Skip to content

Commit 11c6be1

Browse files
authored
Merge pull request #55 from adobe/donut
Donut chart
2 parents 5f6bac9 + 95ac41f commit 11c6be1

File tree

39 files changed

+2012
-85
lines changed

39 files changed

+2012
-85
lines changed

package.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,21 @@
33
"version": "v1.0.1",
44
"description": "Declarative library for composing Spectrum visualizations in React.",
55
"browser": "./dist/index.js",
6-
"main": "./dist/index.js",
76
"module": "./dist/index.js",
8-
"types": "./dist/@types/index.d.ts",
7+
"exports": {
8+
".": "./dist/index.js",
9+
"./alpha": "./dist/alpha.js"
10+
},
11+
"typesVersions": {
12+
"*": {
13+
"*": [
14+
"./dist/@types/index.d.ts"
15+
],
16+
"alpha": [
17+
"./dist/@types/alpha/index.d.ts"
18+
]
19+
}
20+
},
921
"files": [
1022
"/dist"
1123
],
@@ -28,7 +40,7 @@
2840
"ts": "yarn tsc",
2941
"tsc": "tsc --noEmit --skipLibCheck",
3042
"prepack": "yarn build",
31-
"pack-test": "rm -rf dist & npm pack",
43+
"pack-test": "rm -rf dist & cross-env NODE_ENV=development npm pack",
3244
"start": "yarn storybook",
3345
"storybook": "cross-env NODE_OPTIONS=--openssl-legacy-provider && storybook dev -p 6009",
3446
"test": "cross-env BABEL_ENV=test jest",
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2023 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
12+
13+
/* eslint-disable @typescript-eslint/no-unused-vars */
14+
import { FC } from 'react';
15+
16+
import { DEFAULT_COLOR, DEFAULT_METRIC } from '@constants';
17+
18+
import { DonutProps } from '../../../types';
19+
20+
// destructure props here and set defaults so that storybook can pick them up
21+
const Donut: FC<DonutProps> = ({
22+
children,
23+
color = DEFAULT_COLOR,
24+
hasDirectLabels = false,
25+
holeRatio = 0.85,
26+
isBoolean = false,
27+
metric = DEFAULT_METRIC,
28+
metricLabel,
29+
name,
30+
segment,
31+
startAngle = 0,
32+
}) => {
33+
return null;
34+
};
35+
36+
// displayName is used to validate the component type in the spec builder
37+
Donut.displayName = 'Donut';
38+
39+
export { Donut };
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright 2023 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
12+
13+
export * from './Donut';

src/alpha/components/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright 2024 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
12+
13+
export * from './Donut';

src/alpha/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright 2024 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
12+
13+
export * from './components';

src/components/Annotation/Annotation.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,15 @@
1111
*/
1212

1313
/* eslint-disable @typescript-eslint/no-unused-vars */
14+
import { FC } from 'react';
15+
1416
import { AnnotationProps } from '../../types';
1517

16-
export function Annotation({ textKey = 'annotation', style }: AnnotationProps) {
18+
const Annotation: FC<AnnotationProps> = ({ textKey = 'annotation', style }) => {
1719
return null;
18-
}
20+
};
21+
22+
// displayName is used to validate the component type in the spec builder
23+
Annotation.displayName = 'Annotation';
24+
25+
export { Annotation };

src/components/Area/Area.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
*/
1212

1313
/* eslint-disable @typescript-eslint/no-unused-vars */
14+
import { FC } from 'react';
15+
1416
import { DEFAULT_COLOR, DEFAULT_METRIC, DEFAULT_TIME_DIMENSION } from '@constants';
1517

1618
import { AreaProps } from '../../types';
1719

1820
// destructure props here and set defaults so that storybook can pick them up
19-
export function Area({
21+
const Area: FC<AreaProps> = ({
2022
children,
2123
name,
2224
opacity = 0.8,
@@ -28,6 +30,11 @@ export function Area({
2830
metricEnd,
2931
metricStart,
3032
padding,
31-
}: AreaProps) {
33+
}) => {
3234
return null;
33-
}
35+
};
36+
37+
// displayName is used to validate the component type in the spec builder
38+
Area.displayName = 'Area';
39+
40+
export { Area };

src/components/Axis/Axis.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
*/
1212

1313
/* eslint-disable @typescript-eslint/no-unused-vars */
14+
import { FC } from 'react';
15+
1416
import {
1517
DEFAULT_GRANULARITY,
1618
DEFAULT_LABEL_ALIGN,
@@ -20,7 +22,7 @@ import {
2022

2123
import { AxisProps } from '../../types';
2224

23-
export function Axis({
25+
const Axis: FC<AxisProps> = ({
2426
position,
2527
baseline = false,
2628
baselineOffset = 0,
@@ -38,6 +40,11 @@ export function Axis({
3840
ticks = false,
3941
tickMinStep = undefined,
4042
title = undefined,
41-
}: AxisProps) {
43+
}) => {
4244
return null;
43-
}
45+
};
46+
47+
// displayName is used to validate the component type in the spec builder
48+
Axis.displayName = 'Axis';
49+
50+
export { Axis };

src/components/AxisAnnotation/AxisAnnotation.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,21 @@
1111
*/
1212

1313
/* eslint-disable @typescript-eslint/no-unused-vars */
14+
import { FC } from 'react';
15+
1416
import { DEFAULT_AXIS_ANNOTATION_COLOR, DEFAULT_AXIS_ANNOTATION_OFFSET } from '@constants';
1517

1618
import { AxisAnnotationProps } from '../../types';
1719

18-
export function AxisAnnotation({
20+
const AxisAnnotation: FC<AxisAnnotationProps> = ({
1921
dataKey = 'annotations',
2022
color = DEFAULT_AXIS_ANNOTATION_COLOR,
2123
offset = DEFAULT_AXIS_ANNOTATION_OFFSET,
22-
}: AxisAnnotationProps) {
24+
}) => {
2325
return null;
24-
}
26+
};
27+
28+
// displayName is used to validate the component type in the spec builder
29+
AxisAnnotation.displayName = 'AxisAnnotation';
30+
31+
export { AxisAnnotation };

src/components/Bar/Bar.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
*/
1212

1313
/* eslint-disable @typescript-eslint/no-unused-vars */
14+
import { FC } from 'react';
15+
1416
import { DEFAULT_CATEGORICAL_DIMENSION, DEFAULT_METRIC, PADDING_RATIO, TRELLIS_PADDING } from '@constants';
1517

1618
import { BarProps } from '../../types';
1719

18-
export function Bar({
20+
const Bar: FC<BarProps> = ({
1921
dimension = DEFAULT_CATEGORICAL_DIMENSION,
2022
color = { value: 'categorical-100' },
2123
metric = DEFAULT_METRIC,
@@ -27,6 +29,11 @@ export function Bar({
2729
trellisPadding = TRELLIS_PADDING,
2830
paddingRatio = PADDING_RATIO,
2931
paddingOuter,
30-
}: BarProps) {
32+
}) => {
3133
return null;
32-
}
34+
};
35+
36+
// displayName is used to validate the component type in the spec builder
37+
Bar.displayName = 'Bar';
38+
39+
export { Bar };

0 commit comments

Comments
 (0)