@wonderflow/react-components 12.10.0 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/dist/components/circular-progress/circular-progress.d.ts +4 -0
  2. package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
  3. package/dist/components/circular-progress/circular-progress.js +4 -3
  4. package/dist/components/circular-progress/circular-progress.module.css +1 -1
  5. package/dist/components/circular-progress/circular-progress.stories.d.ts.map +1 -1
  6. package/dist/components/circular-progress/circular-progress.stories.js +1 -0
  7. package/dist/components/circular-progress/circular-progress.test.js +5 -0
  8. package/dist/components/product-card/product-card.test.js +4 -2
  9. package/dist/examples/charts/mock-data/channels.js +9 -9
  10. package/dist/examples/charts/mock-data/feedbackCount.d.ts +1 -0
  11. package/dist/examples/charts/mock-data/feedbackCount.d.ts.map +1 -1
  12. package/dist/examples/charts/mock-data/feedbackCount.js +23 -1
  13. package/dist/examples/charts/mock-data/positiveNegative.d.ts +8 -0
  14. package/dist/examples/charts/mock-data/positiveNegative.d.ts.map +1 -0
  15. package/dist/examples/charts/mock-data/positiveNegative.js +171 -0
  16. package/dist/examples/charts/storybook/bar-chart.stories.d.ts +22 -0
  17. package/dist/examples/charts/storybook/bar-chart.stories.d.ts.map +1 -0
  18. package/dist/examples/charts/storybook/bar-chart.stories.js +276 -0
  19. package/dist/examples/charts/storybook/line-chart.stories.d.ts +97 -15
  20. package/dist/examples/charts/storybook/line-chart.stories.d.ts.map +1 -1
  21. package/dist/examples/charts/storybook/line-chart.stories.js +38 -11
  22. package/package.json +4 -4
@@ -19,6 +19,10 @@ export declare type CircularProgressProps = {
19
19
  * Show or hide the progress value.
20
20
  */
21
21
  showProgress?: boolean;
22
+ /**
23
+ * Show or hide the percent sign next to the value.
24
+ */
25
+ showPercentSign?: boolean;
22
26
  };
23
27
  export declare const CircularProgress: import("react").ForwardRefExoticComponent<{
24
28
  style?: Record<string, any> | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"circular-progress.d.ts","sourceRoot":"","sources":["../../../src/components/circular-progress/circular-progress.tsx"],"names":[],"mappings":";AAuBA,oBAAY,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAA;AAED,eAAO,MAAM,gBAAgB;;;0EAmC3B,CAAC"}
1
+ {"version":3,"file":"circular-progress.d.ts","sourceRoot":"","sources":["../../../src/components/circular-progress/circular-progress.tsx"],"names":[],"mappings":";AAuBA,oBAAY,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAA;AAED,eAAO,MAAM,gBAAgB;;;0EAsC3B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  /*
3
- * Copyright 2022-2023 Wonderflow Design Team
3
+ * Copyright 2022-2024 Wonderflow Design Team
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -17,12 +17,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
17
17
  import clsx from 'clsx';
18
18
  import { forwardRef, useCallback, useMemo, } from 'react';
19
19
  import * as styles from './circular-progress.module.css';
20
- export const CircularProgress = forwardRef(({ className, value, max = 100, dimension = 'regular', showProgress, style, ...otherProps }, forwardedRef) => {
20
+ export const CircularProgress = forwardRef(({ className, value, max = 100, dimension = 'regular', showProgress, showPercentSign = false, style, ...otherProps }, forwardedRef) => {
21
21
  const getPercentage = useCallback(() => (value ? Math.round((100 * value) / max) : 0), [max, value]);
22
+ const sign = showPercentSign ? '%' : '';
22
23
  const clamp = useMemo(() => (num, min, max) => Math.min(Math.max(num, min), max), []);
23
24
  const dynamicStyle = {
24
25
  '--progress': `${getPercentage()}%`,
25
26
  };
26
- return (_jsx("div", { ref: forwardedRef, role: "progressbar", "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": max, className: clsx(styles.CircularProgress, className), "data-circular-progress": clamp(getPercentage(), 0, 100), "data-circular-progress-dimension": dimension, "data-circular-progress-show-progress": showProgress, style: { ...dynamicStyle, ...style }, ...otherProps }));
27
+ return (_jsx("div", { ref: forwardedRef, role: "progressbar", "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": max, className: clsx(styles.CircularProgress, className), "data-circular-progress": `${clamp(getPercentage(), 0, 100)}${sign}`, "data-circular-progress-dimension": dimension, "data-circular-progress-show-progress": showProgress, style: { ...dynamicStyle, ...style }, ...otherProps }));
27
28
  });
28
29
  CircularProgress.displayName = 'CircularProgress';
@@ -1 +1 @@
1
- @layer components{.CircularProgress{--hue:220;--track-size:4px;--track-bg:var(--dimmed-1);aspect-ratio:1/1;display:grid;font-size:1rem;font-weight:token(--wds-wds-font-weight-bold);inline-size:4rem;min-inline-size:64px;place-items:center;position:relative}.CircularProgress[data-circular-progress-show-progress=true]:after{content:attr(data-circular-progress);display:block}.CircularProgress[data-circular-progress-dimension=regular]{--track-size:8px;font-size:1.75rem;inline-size:8.5rem}.CircularProgress[data-circular-progress-dimension=big]{--track-size:16px;font-size:token(--wds-wds-font-size-40);inline-size:11.5rem}.CircularProgress:before{background:conic-gradient(var(--progress-color,var(--cta-default)),var(--progress-color,var(--cta-default)) var(--progress,0),var(--track-bg) var(--progress,0) 100%);border-radius:50%;bottom:0;content:"";left:0;-webkit-mask-image:radial-gradient(transparent calc(71% - var(--track-size)),#000 calc(71% - var(--track-size) + .5px));mask-image:radial-gradient(transparent calc(71% - var(--track-size)),#000 calc(71% - var(--track-size) + .5px));position:absolute;right:0;top:0;z-index:-1}}
1
+ @layer components{.CircularProgress{--hue:220;--track-size:4px;--track-bg:var(--dimmed-1);aspect-ratio:1/1;display:grid;font-size:1rem;font-weight:token(--wds-wds-font-weight-bold);inline-size:4rem;min-inline-size:64px;place-items:center;position:relative}.CircularProgress[data-circular-progress-show-progress=true]:after{content:attr(data-circular-progress);display:block}.CircularProgress[data-circular-progress-dimension=regular]{--track-size:8px;font-size:1.75rem;inline-size:8.5rem}.CircularProgress[data-circular-progress-dimension=big]{--track-size:16px;font-size:2.5rem;inline-size:11.5rem}.CircularProgress:before{background:conic-gradient(var(--progress-color,var(--cta-default)),var(--progress-color,var(--cta-default)) var(--progress,0),var(--track-bg) var(--progress,0) 100%);border-radius:50%;bottom:0;content:"";left:0;-webkit-mask-image:radial-gradient(transparent calc(71% - var(--track-size)),#000 calc(71% - var(--track-size) + .5px));mask-image:radial-gradient(transparent calc(71% - var(--track-size)),#000 calc(71% - var(--track-size) + .5px));position:absolute;right:0;top:0;z-index:0}}
@@ -1 +1 @@
1
- {"version":3,"file":"circular-progress.stories.d.ts","sourceRoot":"","sources":["../../../src/components/circular-progress/circular-progress.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,gBAAgB,CAqBjD,CAAC;AAEF,eAAe,KAAK,CAAC;AAIrB,eAAO,MAAM,WAAW;;;+FAAoB,CAAC"}
1
+ {"version":3,"file":"circular-progress.stories.d.ts","sourceRoot":"","sources":["../../../src/components/circular-progress/circular-progress.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,gBAAgB,CAsBjD,CAAC;AAEF,eAAe,KAAK,CAAC;AAIrB,eAAO,MAAM,WAAW;;;+FAAoB,CAAC"}
@@ -7,6 +7,7 @@ const story = {
7
7
  max: 100,
8
8
  dimension: 'regular',
9
9
  showProgress: true,
10
+ showPercentSign: false,
10
11
  },
11
12
  argTypes: {
12
13
  value: {
@@ -10,4 +10,9 @@ describe('<CircularProgress>', () => {
10
10
  const { container } = render(_jsx(CircularProgress, { value: 0 }));
11
11
  expect(container).not.toBeNull();
12
12
  });
13
+ test(' it should render percent sign', () => {
14
+ const { container } = render(_jsx(CircularProgress, { value: 10, showPercentSign: true }));
15
+ expect(document.querySelector('[data-circular-progress="10%"]')).toBeDefined();
16
+ expect(container).not.toBeNull();
17
+ });
13
18
  });
@@ -26,11 +26,13 @@ describe('<ProductCard>', () => {
26
26
  expect(container).not.toBeNull();
27
27
  });
28
28
  test('it should render properly with on click', () => {
29
- const { container } = render(_jsx(ProductCard, { title: "title", subtitle: "subtitle", source: SourceImages, direction: "horizontal", rating: 1.2, feedbackCount: 1.2, votesCount: 1.2, onClick: () => console.log('clicked') }));
29
+ const spyOnClick = jest.fn();
30
+ const { container } = render(_jsx(ProductCard, { title: "title", subtitle: "subtitle", source: SourceImages, direction: "horizontal", rating: 1.2, feedbackCount: 1.2, votesCount: 1.2, onClick: spyOnClick }));
30
31
  expect(container).not.toBeNull();
31
32
  });
32
33
  test('it should render properly with children', () => {
33
- const { container } = render(_jsx(ProductCard, { title: "title", subtitle: "subtitle", source: SourceImages, direction: "horizontal", rating: 1.2, feedbackCount: 1.2, votesCount: 1.2, onClick: () => console.log('clicked'), footer: _jsx("div", { children: "some content" }), children: _jsx("div", { children: "some content" }) }));
34
+ const spyOnClick = jest.fn();
35
+ const { container } = render(_jsx(ProductCard, { title: "title", subtitle: "subtitle", source: SourceImages, direction: "horizontal", rating: 1.2, feedbackCount: 1.2, votesCount: 1.2, onClick: spyOnClick, footer: _jsx("div", { children: "some content" }), children: _jsx("div", { children: "some content" }) }));
34
36
  expect(container).not.toBeNull();
35
37
  });
36
38
  });
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Wonderflow Design Team
2
+ * Copyright 2023-2024 Wonderflow Design Team
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@ export const channels = [
20
20
  '2 stars': 51,
21
21
  '3 stars': 66,
22
22
  '4 stars': 157,
23
- '5 stars': 1500,
23
+ '5 stars': 150,
24
24
  },
25
25
  {
26
26
  channel: 'amazon.co.uk',
@@ -36,7 +36,7 @@ export const channels = [
36
36
  '2 stars': 284,
37
37
  '3 stars': 370,
38
38
  '4 stars': 866,
39
- '5 stars': 8302,
39
+ '5 stars': 830,
40
40
  },
41
41
  {
42
42
  channel: 'amazon.com.au',
@@ -100,7 +100,7 @@ export const channels = [
100
100
  '2 stars': 236,
101
101
  '3 stars': 529,
102
102
  '4 stars': 3217,
103
- '5 stars': 35541,
103
+ '5 stars': 3554,
104
104
  },
105
105
  {
106
106
  channel: 'bestbuy.ca',
@@ -108,7 +108,7 @@ export const channels = [
108
108
  '2 stars': 242,
109
109
  '3 stars': 562,
110
110
  '4 stars': 3548,
111
- '5 stars': 38635,
111
+ '5 stars': 3863,
112
112
  },
113
113
  {
114
114
  channel: 'canadiantire.ca',
@@ -116,7 +116,7 @@ export const channels = [
116
116
  '2 stars': 193,
117
117
  '3 stars': 468,
118
118
  '4 stars': 3108,
119
- '5 stars': 34484,
119
+ '5 stars': 3448,
120
120
  },
121
121
  {
122
122
  channel: 'darty.com',
@@ -132,7 +132,7 @@ export const channels = [
132
132
  '2 stars': 181,
133
133
  '3 stars': 452,
134
134
  '4 stars': 2984,
135
- '5 stars': 33501,
135
+ '5 stars': 3350,
136
136
  },
137
137
  {
138
138
  channel: 'otto.de',
@@ -156,7 +156,7 @@ export const channels = [
156
156
  '2 stars': 206,
157
157
  '3 stars': 484,
158
158
  '4 stars': 3264,
159
- '5 stars': 36357,
159
+ '5 stars': 3635,
160
160
  },
161
161
  {
162
162
  channel: 'wayfair.com',
@@ -164,7 +164,7 @@ export const channels = [
164
164
  '2 stars': 64,
165
165
  '3 stars': 120,
166
166
  '4 stars': 588,
167
- '5 stars': 7663,
167
+ '5 stars': 766,
168
168
  },
169
169
  ];
170
170
  export const channelsB = [
@@ -3,6 +3,7 @@ export declare const feedbackCount: {
3
3
  overlay: number;
4
4
  'feedback count': number;
5
5
  extraData: null;
6
+ overlayB: number;
6
7
  }[];
7
8
  export declare const feedbackCountGaps: ({
8
9
  date: string;
@@ -1 +1 @@
1
- {"version":3,"file":"feedbackCount.d.ts","sourceRoot":"","sources":["../../../../src/examples/charts/mock-data/feedbackCount.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,aAAa;;;;;GAqIzB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;IAqI7B,CAAC"}
1
+ {"version":3,"file":"feedbackCount.d.ts","sourceRoot":"","sources":["../../../../src/examples/charts/mock-data/feedbackCount.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,aAAa;;;;;;GA2JzB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;IAqI7B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2023 Wonderflow Design Team
2
+ * Copyright 2023-2024 Wonderflow Design Team
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -19,132 +19,154 @@ export const feedbackCount = [
19
19
  overlay: 0.1,
20
20
  'feedback count': 16,
21
21
  extraData: null,
22
+ overlayB: 0.31,
22
23
  },
23
24
  {
24
25
  date: '2003',
25
26
  overlay: 0.11,
26
27
  'feedback count': 30,
27
28
  extraData: null,
29
+ overlayB: 0.1,
28
30
  },
29
31
  {
30
32
  date: '2004',
31
33
  overlay: 0.14,
32
34
  'feedback count': 20,
33
35
  extraData: null,
36
+ overlayB: 0.43,
34
37
  },
35
38
  {
36
39
  date: '2005',
37
40
  overlay: 0.13,
38
41
  'feedback count': 52,
39
42
  extraData: null,
43
+ overlayB: 0.33,
40
44
  },
41
45
  {
42
46
  date: '2006',
43
47
  overlay: 0.14,
44
48
  'feedback count': 131,
45
49
  extraData: null,
50
+ overlayB: 0.24,
46
51
  },
47
52
  {
48
53
  date: '2007',
49
54
  overlay: 0.18,
50
55
  'feedback count': 462,
51
56
  extraData: null,
57
+ overlayB: 0.12,
52
58
  },
53
59
  {
54
60
  date: '2008',
55
61
  overlay: 0.16,
56
62
  'feedback count': 419,
57
63
  extraData: null,
64
+ overlayB: 0.27,
58
65
  },
59
66
  {
60
67
  date: '2009',
61
68
  overlay: 0.13,
62
69
  'feedback count': 266,
63
70
  extraData: null,
71
+ overlayB: 0.31,
64
72
  },
65
73
  {
66
74
  date: '2010',
67
75
  overlay: 0.15,
68
76
  'feedback count': 273,
69
77
  extraData: null,
78
+ overlayB: 0.75,
70
79
  },
71
80
  {
72
81
  date: '2011',
73
82
  overlay: 0.21,
74
83
  'feedback count': 491,
75
84
  extraData: null,
85
+ overlayB: 0.72,
76
86
  },
77
87
  {
78
88
  date: '2012',
79
89
  overlay: 0.22,
80
90
  'feedback count': 558,
81
91
  extraData: null,
92
+ overlayB: 0.58,
82
93
  },
83
94
  {
84
95
  date: '2013',
85
96
  overlay: 0.11,
86
97
  'feedback count': 2414,
87
98
  extraData: null,
99
+ overlayB: 0.61,
88
100
  },
89
101
  {
90
102
  date: '2014',
91
103
  overlay: 0.12,
92
104
  'feedback count': 8031,
93
105
  extraData: null,
106
+ overlayB: 0.27,
94
107
  },
95
108
  {
96
109
  date: '2015',
97
110
  overlay: 0.17,
98
111
  'feedback count': 9196,
99
112
  extraData: null,
113
+ overlayB: 0.36,
100
114
  },
101
115
  {
102
116
  date: '2016',
103
117
  overlay: 0.14,
104
118
  'feedback count': 5869,
105
119
  extraData: null,
120
+ overlayB: 0.35,
106
121
  },
107
122
  {
108
123
  date: '2017',
109
124
  overlay: 0.24,
110
125
  'feedback count': 8786,
111
126
  extraData: null,
127
+ overlayB: 0.64,
112
128
  },
113
129
  {
114
130
  date: '2018',
115
131
  overlay: 0.32,
116
132
  'feedback count': 4182,
117
133
  extraData: null,
134
+ overlayB: 0.62,
118
135
  },
119
136
  {
120
137
  date: '2019',
121
138
  overlay: 0.31,
122
139
  'feedback count': 8303,
123
140
  extraData: null,
141
+ overlayB: 0.50,
124
142
  },
125
143
  {
126
144
  date: '2020',
127
145
  overlay: 0.44,
128
146
  'feedback count': 11490,
129
147
  extraData: null,
148
+ overlayB: 0.47,
130
149
  },
131
150
  {
132
151
  date: '2021',
133
152
  overlay: 0.53,
134
153
  'feedback count': 5539,
135
154
  extraData: null,
155
+ overlayB: 0.34,
136
156
  },
137
157
  {
138
158
  date: '2022',
139
159
  overlay: 0.75,
140
160
  'feedback count': 2952,
141
161
  extraData: null,
162
+ overlayB: 0.45,
142
163
  },
143
164
  {
144
165
  date: '2023',
145
166
  overlay: 0.74,
146
167
  'feedback count': 1746,
147
168
  extraData: null,
169
+ overlayB: 0.29,
148
170
  },
149
171
  ];
150
172
  export const feedbackCountGaps = [
@@ -0,0 +1,8 @@
1
+ export declare const positiveNegative: {
2
+ date: string;
3
+ overlay: number;
4
+ 'feedback count': number;
5
+ extraData: null;
6
+ overlayB: number;
7
+ }[];
8
+ //# sourceMappingURL=positiveNegative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"positiveNegative.d.ts","sourceRoot":"","sources":["../../../../src/examples/charts/mock-data/positiveNegative.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,gBAAgB;;;;;;GA2J5B,CAAC"}
@@ -0,0 +1,171 @@
1
+ /*
2
+ * Copyright 2023-2024 Wonderflow Design Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export const positiveNegative = [
17
+ {
18
+ date: '2002',
19
+ overlay: 0.1,
20
+ 'feedback count': 16,
21
+ extraData: null,
22
+ overlayB: 0.31,
23
+ },
24
+ {
25
+ date: '2003',
26
+ overlay: -0.21,
27
+ 'feedback count': 30,
28
+ extraData: null,
29
+ overlayB: 0.1,
30
+ },
31
+ {
32
+ date: '2004',
33
+ overlay: -0.14,
34
+ 'feedback count': 20,
35
+ extraData: null,
36
+ overlayB: 0.43,
37
+ },
38
+ {
39
+ date: '2005',
40
+ overlay: 0.3,
41
+ 'feedback count': 52,
42
+ extraData: null,
43
+ overlayB: 0.33,
44
+ },
45
+ {
46
+ date: '2006',
47
+ overlay: 0.14,
48
+ 'feedback count': 131,
49
+ extraData: null,
50
+ overlayB: 0.24,
51
+ },
52
+ {
53
+ date: '2007',
54
+ overlay: -0.18,
55
+ 'feedback count': 462,
56
+ extraData: null,
57
+ overlayB: 0.12,
58
+ },
59
+ {
60
+ date: '2008',
61
+ overlay: 0.16,
62
+ 'feedback count': 419,
63
+ extraData: null,
64
+ overlayB: 0.27,
65
+ },
66
+ {
67
+ date: '2009',
68
+ overlay: 0.13,
69
+ 'feedback count': 266,
70
+ extraData: null,
71
+ overlayB: 0.31,
72
+ },
73
+ {
74
+ date: '2010',
75
+ overlay: 0.15,
76
+ 'feedback count': 273,
77
+ extraData: null,
78
+ overlayB: 0.75,
79
+ },
80
+ {
81
+ date: '2011',
82
+ overlay: 0.21,
83
+ 'feedback count': 491,
84
+ extraData: null,
85
+ overlayB: 0.72,
86
+ },
87
+ {
88
+ date: '2012',
89
+ overlay: 0.22,
90
+ 'feedback count': 558,
91
+ extraData: null,
92
+ overlayB: 0.58,
93
+ },
94
+ {
95
+ date: '2013',
96
+ overlay: 0.31,
97
+ 'feedback count': 2414,
98
+ extraData: null,
99
+ overlayB: 0.61,
100
+ },
101
+ {
102
+ date: '2014',
103
+ overlay: 0.12,
104
+ 'feedback count': 8031,
105
+ extraData: null,
106
+ overlayB: 0.27,
107
+ },
108
+ {
109
+ date: '2015',
110
+ overlay: 0.27,
111
+ 'feedback count': 9196,
112
+ extraData: null,
113
+ overlayB: 0.36,
114
+ },
115
+ {
116
+ date: '2016',
117
+ overlay: -0.14,
118
+ 'feedback count': 5869,
119
+ extraData: null,
120
+ overlayB: 0.35,
121
+ },
122
+ {
123
+ date: '2017',
124
+ overlay: -0.24,
125
+ 'feedback count': 8786,
126
+ extraData: null,
127
+ overlayB: 0.64,
128
+ },
129
+ {
130
+ date: '2018',
131
+ overlay: -0.32,
132
+ 'feedback count': 4182,
133
+ extraData: null,
134
+ overlayB: 0.62,
135
+ },
136
+ {
137
+ date: '2019',
138
+ overlay: 0.1,
139
+ 'feedback count': 8303,
140
+ extraData: null,
141
+ overlayB: 0.50,
142
+ },
143
+ {
144
+ date: '2020',
145
+ overlay: 0.34,
146
+ 'feedback count': 11490,
147
+ extraData: null,
148
+ overlayB: 0.47,
149
+ },
150
+ {
151
+ date: '2021',
152
+ overlay: 0.53,
153
+ 'feedback count': 5539,
154
+ extraData: null,
155
+ overlayB: 0.34,
156
+ },
157
+ {
158
+ date: '2022',
159
+ overlay: 0.75,
160
+ 'feedback count': 2952,
161
+ extraData: null,
162
+ overlayB: 0.45,
163
+ },
164
+ {
165
+ date: '2023',
166
+ overlay: 0.74,
167
+ 'feedback count': 1746,
168
+ extraData: null,
169
+ overlayB: 0.29,
170
+ },
171
+ ];
@@ -0,0 +1,22 @@
1
+ /// <reference types="react" />
2
+ import { ComponentMeta, ComponentStory } from '@storybook/react';
3
+ import { BarChart, BarChartProps } from '@wonderflow/charts';
4
+ declare const story: ComponentMeta<typeof BarChart>;
5
+ export default story;
6
+ export declare const Default: ComponentStory<import("react").FC<BarChartProps>>;
7
+ export declare const withOverlay: ComponentStory<import("react").FC<BarChartProps>>;
8
+ export declare const withMultipleOverlay: ComponentStory<import("react").FC<BarChartProps>>;
9
+ export declare const withMultipleSeries: ComponentStory<import("react").FC<BarChartProps>>;
10
+ export declare const withAverage: ComponentStory<import("react").FC<BarChartProps>>;
11
+ export declare const withTrendline: ComponentStory<import("react").FC<BarChartProps>>;
12
+ export declare const withCategoriesOnIndex: ComponentStory<import("react").FC<BarChartProps>>;
13
+ export declare const withNestedData: ComponentStory<import("react").FC<BarChartProps>>;
14
+ export declare const withBackground: ComponentStory<import("react").FC<BarChartProps>>;
15
+ export declare const PositiveAndNegative: ComponentStory<import("react").FC<BarChartProps>>;
16
+ export declare const withVerticalFixedBars: ComponentStory<import("react").FC<BarChartProps>>;
17
+ export declare const withMissingData: ComponentStory<import("react").FC<BarChartProps>>;
18
+ export declare const withCustomBarStyle: ComponentStory<import("react").FC<BarChartProps>>;
19
+ export declare const withBrush: ComponentStory<import("react").FC<BarChartProps>>;
20
+ export declare const WithMenu: ComponentStory<import("react").FC<BarChartProps>>;
21
+ export declare const WithinCard: ComponentStory<import("react").FC<BarChartProps>>;
22
+ //# sourceMappingURL=bar-chart.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bar-chart.stories.d.ts","sourceRoot":"","sources":["../../../../src/examples/charts/storybook/bar-chart.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAwB,MAAM,oBAAoB,CAAC;AAcnF,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,QAAQ,CAiDzC,CAAC;AAEF,eAAe,KAAK,CAAC;AAIrB,eAAO,MAAM,OAAO,mDAAoB,CAAC;AAGzC,eAAO,MAAM,WAAW,mDAAoB,CAAC;AAS7C,eAAO,MAAM,mBAAmB,mDAAoB,CAAC;AAiBrD,eAAO,MAAM,kBAAkB,mDAAoB,CAAC;AAiBpD,eAAO,MAAM,WAAW,mDAAoB,CAAC;AAM7C,eAAO,MAAM,aAAa,mDAAoB,CAAC;AAW/C,eAAO,MAAM,qBAAqB,mDAAoB,CAAC;AAevD,eAAO,MAAM,cAAc,mDAAoB,CAAC;AA2BhD,eAAO,MAAM,cAAc,mDAAoB,CAAC;AAehD,eAAO,MAAM,mBAAmB,mDAAoB,CAAC;AAerD,eAAO,MAAM,qBAAqB,mDAAoB,CAAC;AAYvD,eAAO,MAAM,eAAe,mDAAoB,CAAC;AAUjD,eAAO,MAAM,kBAAkB,mDAAoB,CAAC;AA0BpD,eAAO,MAAM,SAAS,mDAAoB,CAAC;AAiC3C,eAAO,MAAM,QAAQ,mDAAoB,CAAC;AAkB1C,eAAO,MAAM,UAAU,mDAA8B,CAAC"}
@@ -0,0 +1,276 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { BarChart, CartesianChartLayout } from '@wonderflow/charts';
3
+ import { Card } from '../../..';
4
+ // import { BarChart, BarChartProps, CartesianChartLayout } from '../../../../../charts/src';
5
+ import { channels, channelsB, feedbackCount, feedbackCountGaps, proCons, products, } from '../mock-data';
6
+ import { positiveNegative } from '../mock-data/positiveNegative';
7
+ import { FakeMenu } from './line-chart.stories';
8
+ import styles from './sb-charts.module.css';
9
+ const story = {
10
+ title: 'Charts/Bar Chart',
11
+ component: BarChart,
12
+ args: {
13
+ title: 'Bar Chart',
14
+ subtitle: 'A simple bar chart',
15
+ sortBy: 'as-is',
16
+ // isStacked: false,
17
+ // showLabel: false,
18
+ isLoading: false,
19
+ showAverage: false,
20
+ showTrendline: false,
21
+ showBrush: false,
22
+ showBackground: false,
23
+ hideLegend: false,
24
+ hidePadding: false,
25
+ preventTooltipDisplay: false,
26
+ preventResponsive: false,
27
+ layout: CartesianChartLayout.HORIZONTAL,
28
+ theme: 'light',
29
+ reverseIndex: false,
30
+ mirrorDomains: false,
31
+ fixedBarSize: false,
32
+ data: feedbackCount,
33
+ index: {
34
+ dataKey: 'date',
35
+ label: 'Year',
36
+ },
37
+ series: {
38
+ dataKey: ['feedback count'],
39
+ label: 'Feedback Count',
40
+ },
41
+ overlay: undefined,
42
+ menu: undefined,
43
+ },
44
+ argTypes: {
45
+ layout: {
46
+ options: ['horizontal', 'vertical'],
47
+ control: { type: 'radio' },
48
+ },
49
+ sortBy: {
50
+ options: ['descending-key', 'ascending-key', 'descending-value', 'ascending-value', 'as-is'],
51
+ control: { type: 'select' },
52
+ },
53
+ theme: {
54
+ options: ['light', 'dark'],
55
+ control: { type: 'radio' },
56
+ },
57
+ },
58
+ };
59
+ export default story;
60
+ const Template = (args) => _jsx(BarChart, { ...args });
61
+ export const Default = Template.bind({});
62
+ Default.args = {};
63
+ export const withOverlay = Template.bind({});
64
+ withOverlay.args = {
65
+ subtitle: 'A bar chart with overlay',
66
+ overlay: {
67
+ dataKey: ['overlay'],
68
+ label: 'Overlay',
69
+ },
70
+ };
71
+ export const withMultipleOverlay = Template.bind({});
72
+ withMultipleOverlay.args = {
73
+ subtitle: 'A group bar chart with one series and two overlay',
74
+ series: {
75
+ dataKey: ['feedback count'],
76
+ label: 'Feedback Count',
77
+ domain: [0, 12000],
78
+ },
79
+ overlay: {
80
+ dataKey: ['overlay', 'overlayB'],
81
+ rename: ((o, i) => (i === 0 ? 'OverlayA' : o)),
82
+ label: 'Overlay',
83
+ domain: [0, 1],
84
+ },
85
+ data: feedbackCount.slice(11),
86
+ };
87
+ export const withMultipleSeries = Template.bind({});
88
+ withMultipleSeries.args = {
89
+ title: 'Multiple Series',
90
+ subtitle: 'A group bar chart',
91
+ data: proCons,
92
+ index: {
93
+ dataKey: 'date',
94
+ label: 'Time',
95
+ },
96
+ series: {
97
+ domain: [0, 140],
98
+ dataKey: ['positive', 'negative', 'neutral'],
99
+ label: 'Pros & cons',
100
+ style: [undefined, undefined, { fill: 'gray' }],
101
+ },
102
+ };
103
+ export const withAverage = Template.bind({});
104
+ withAverage.args = {
105
+ subtitle: 'A bar chart with average',
106
+ showAverage: true,
107
+ };
108
+ export const withTrendline = Template.bind({});
109
+ withTrendline.args = {
110
+ subtitle: 'A bar chart with overlay and trendlines',
111
+ overlay: {
112
+ dataKey: ['overlay'],
113
+ label: 'Overlay',
114
+ domain: [0, 1],
115
+ },
116
+ showTrendline: true,
117
+ };
118
+ export const withCategoriesOnIndex = Template.bind({});
119
+ withCategoriesOnIndex.args = {
120
+ title: 'Multiple Series',
121
+ subtitle: 'A line chart with categories on index',
122
+ data: channels,
123
+ index: {
124
+ dataKey: 'channel',
125
+ label: 'Channels',
126
+ },
127
+ series: {
128
+ dataKey: ['1 star', '2 stars', '3 stars', '4 stars', '5 stars'],
129
+ label: 'Feedback count',
130
+ },
131
+ };
132
+ export const withNestedData = Template.bind({});
133
+ withNestedData.args = {
134
+ title: 'Multiple Series',
135
+ subtitle: 'A bar chart rendered from nested data',
136
+ data: channelsB,
137
+ index: {
138
+ dataKey: 'channel',
139
+ label: 'Channels',
140
+ },
141
+ series: {
142
+ dataKey: ['1 star.value', '2 stars.value', '3 stars.value', '4 stars.value', '5 stars.value'],
143
+ label: 'Feedback count',
144
+ domain: [0, 4000],
145
+ },
146
+ overlay: {
147
+ dataKey: ['overlay.value'],
148
+ rename: _ => 'Some KPI',
149
+ label: 'Some KPI',
150
+ domain: [0, 5],
151
+ },
152
+ tooltip: {
153
+ extraSeriesData: (series) => `${series.percentage}%`,
154
+ extraOverlayData: (overlay) => `${overlay.percentage}%`,
155
+ extraContent: _jsx("div", { children: "some extra content" }),
156
+ },
157
+ };
158
+ export const withBackground = Template.bind({});
159
+ withBackground.args = {
160
+ subtitle: 'A bar chart with bars background color',
161
+ series: {
162
+ dataKey: ['feedback count'],
163
+ label: 'Feedback Count',
164
+ showBackground: true,
165
+ },
166
+ overlay: {
167
+ dataKey: ['overlay'],
168
+ label: 'Overlay',
169
+ showBackground: true,
170
+ },
171
+ };
172
+ export const PositiveAndNegative = Template.bind({});
173
+ PositiveAndNegative.args = {
174
+ subtitle: 'A bar chart with positive and negative values',
175
+ data: positiveNegative,
176
+ series: {
177
+ dataKey: ['feedback count'],
178
+ label: 'Feedback Count',
179
+ },
180
+ overlay: {
181
+ dataKey: ['overlay'],
182
+ label: 'Overlay',
183
+ },
184
+ mirrorDomains: true,
185
+ };
186
+ export const withVerticalFixedBars = Template.bind({});
187
+ withVerticalFixedBars.args = {
188
+ subtitle: 'A bar chart with vertical fixed thickness bars',
189
+ overlay: {
190
+ dataKey: ['overlay'],
191
+ label: 'Overlay',
192
+ domain: [0, 1],
193
+ },
194
+ fixedBarSize: true,
195
+ layout: CartesianChartLayout.VERTICAL,
196
+ };
197
+ export const withMissingData = Template.bind({});
198
+ withMissingData.args = {
199
+ data: feedbackCountGaps,
200
+ subtitle: 'A bar line chart with null values',
201
+ overlay: {
202
+ dataKey: ['overlay'],
203
+ label: 'Overlay',
204
+ },
205
+ };
206
+ export const withCustomBarStyle = Template.bind({});
207
+ withCustomBarStyle.args = {
208
+ title: 'Multiple Series',
209
+ subtitle: 'A bar chart with multiple series and custom colors',
210
+ data: proCons,
211
+ index: {
212
+ dataKey: 'date',
213
+ label: 'Time',
214
+ },
215
+ series: {
216
+ dataKey: ['positive', 'negative', 'neutral'],
217
+ label: 'Pros & cons',
218
+ style: [
219
+ {
220
+ fill: 'slateGray',
221
+ },
222
+ {
223
+ fill: 'salmon',
224
+ },
225
+ {
226
+ fill: 'lightBlue',
227
+ },
228
+ ],
229
+ },
230
+ };
231
+ export const withBrush = Template.bind({});
232
+ withBrush.args = {
233
+ data: products,
234
+ subtitle: 'A bar chart with twelve series',
235
+ sortBy: 'descending-value',
236
+ showBackground: true,
237
+ showBrush: true,
238
+ index: {
239
+ dataKey: 'date',
240
+ label: 'Year',
241
+ },
242
+ series: {
243
+ dataKey: [
244
+ 'QN95B Neo QLED 4K TV',
245
+ 'Q800A Neo QLED 4K TV',
246
+ 'Q60A QLED 4K TV',
247
+ 'C2 OLED 4K TV',
248
+ 'G2 OLED Evo 4K TV',
249
+ 'B2 OLED 4K TV',
250
+ 'A95K QD-OLED 4K TV',
251
+ 'X95J LED 4K TV',
252
+ 'X85J LED 4K TV',
253
+ 'R6485Q Mini-LED QLED 4K TV',
254
+ 'S546Q 4K QLED TV',
255
+ 'S435 4K Roku TV',
256
+ ],
257
+ label: 'Product Units',
258
+ tickFormat: (l) => `${l}K`,
259
+ domain: [0, 1000],
260
+ hideZero: true,
261
+ },
262
+ };
263
+ export const WithMenu = Template.bind({});
264
+ WithMenu.args = {
265
+ menu: FakeMenu,
266
+ };
267
+ const WithinCardTemplate = (args) => {
268
+ const { theme } = args;
269
+ return (_jsx(Card, { bordered: true, className: styles.Card, style: { backgroundColor: theme === 'dark' ? '#202227' : undefined }, children: _jsx(BarChart, { ...args }) }));
270
+ };
271
+ export const WithinCard = WithinCardTemplate.bind({});
272
+ WithinCard.args = {
273
+ subtitle: 'A bar chart within a card 75vh and width 100%',
274
+ hidePadding: true,
275
+ theme: 'dark',
276
+ };
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { ComponentMeta, ComponentStory } from '@storybook/react';
3
3
  import { CartesianChartLayout, LineChart } from '@wonderflow/charts';
4
+ export declare const FakeMenu: JSX.Element;
4
5
  declare const story: ComponentMeta<typeof LineChart>;
5
6
  export default story;
6
7
  export declare const Default: ComponentStory<import("react").ForwardRefExoticComponent<{
@@ -10,9 +11,11 @@ export declare const Default: ComponentStory<import("react").ForwardRefExoticCom
10
11
  renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
11
12
  index: import("@wonderflow/charts").LineChartIndex;
12
13
  series: import("@wonderflow/charts").LineChartSeries;
13
- overlay?: import("@wonderflow/charts").LineChartOverlay | undefined;
14
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
14
15
  showAverage?: boolean | undefined;
16
+ showTrendline?: boolean | undefined;
15
17
  tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
18
+ preventTooltipDisplay?: boolean | undefined;
16
19
  hideMissingDataConnection?: boolean | undefined;
17
20
  showMarker?: boolean | undefined;
18
21
  showMarkerLabel?: boolean | undefined;
@@ -25,9 +28,28 @@ export declare const withOverlay: ComponentStory<import("react").ForwardRefExoti
25
28
  renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
26
29
  index: import("@wonderflow/charts").LineChartIndex;
27
30
  series: import("@wonderflow/charts").LineChartSeries;
28
- overlay?: import("@wonderflow/charts").LineChartOverlay | undefined;
31
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
29
32
  showAverage?: boolean | undefined;
33
+ showTrendline?: boolean | undefined;
30
34
  tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
35
+ preventTooltipDisplay?: boolean | undefined;
36
+ hideMissingDataConnection?: boolean | undefined;
37
+ showMarker?: boolean | undefined;
38
+ showMarkerLabel?: boolean | undefined;
39
+ hidePadding?: boolean | undefined;
40
+ } & import("type-fest/source/except").Except<import("@wonderflow/charts").CartesianBaseProps, "axis" | "axisFiltered" | "onBrushChange"> & import("react").RefAttributes<HTMLElement>>>;
41
+ export declare const withMultipleOverlay: ComponentStory<import("react").ForwardRefExoticComponent<{
42
+ theme?: import("@wonderflow/charts").ThemeVariants | undefined;
43
+ layout?: CartesianChartLayout | undefined;
44
+ data: import("@wonderflow/charts").Data;
45
+ renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
46
+ index: import("@wonderflow/charts").LineChartIndex;
47
+ series: import("@wonderflow/charts").LineChartSeries;
48
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
49
+ showAverage?: boolean | undefined;
50
+ showTrendline?: boolean | undefined;
51
+ tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
52
+ preventTooltipDisplay?: boolean | undefined;
31
53
  hideMissingDataConnection?: boolean | undefined;
32
54
  showMarker?: boolean | undefined;
33
55
  showMarkerLabel?: boolean | undefined;
@@ -40,9 +62,28 @@ export declare const withAverage: ComponentStory<import("react").ForwardRefExoti
40
62
  renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
41
63
  index: import("@wonderflow/charts").LineChartIndex;
42
64
  series: import("@wonderflow/charts").LineChartSeries;
43
- overlay?: import("@wonderflow/charts").LineChartOverlay | undefined;
65
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
44
66
  showAverage?: boolean | undefined;
67
+ showTrendline?: boolean | undefined;
45
68
  tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
69
+ preventTooltipDisplay?: boolean | undefined;
70
+ hideMissingDataConnection?: boolean | undefined;
71
+ showMarker?: boolean | undefined;
72
+ showMarkerLabel?: boolean | undefined;
73
+ hidePadding?: boolean | undefined;
74
+ } & import("type-fest/source/except").Except<import("@wonderflow/charts").CartesianBaseProps, "axis" | "axisFiltered" | "onBrushChange"> & import("react").RefAttributes<HTMLElement>>>;
75
+ export declare const withTrendline: ComponentStory<import("react").ForwardRefExoticComponent<{
76
+ theme?: import("@wonderflow/charts").ThemeVariants | undefined;
77
+ layout?: CartesianChartLayout | undefined;
78
+ data: import("@wonderflow/charts").Data;
79
+ renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
80
+ index: import("@wonderflow/charts").LineChartIndex;
81
+ series: import("@wonderflow/charts").LineChartSeries;
82
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
83
+ showAverage?: boolean | undefined;
84
+ showTrendline?: boolean | undefined;
85
+ tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
86
+ preventTooltipDisplay?: boolean | undefined;
46
87
  hideMissingDataConnection?: boolean | undefined;
47
88
  showMarker?: boolean | undefined;
48
89
  showMarkerLabel?: boolean | undefined;
@@ -55,9 +96,11 @@ export declare const withMissingData: ComponentStory<import("react").ForwardRefE
55
96
  renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
56
97
  index: import("@wonderflow/charts").LineChartIndex;
57
98
  series: import("@wonderflow/charts").LineChartSeries;
58
- overlay?: import("@wonderflow/charts").LineChartOverlay | undefined;
99
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
59
100
  showAverage?: boolean | undefined;
101
+ showTrendline?: boolean | undefined;
60
102
  tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
103
+ preventTooltipDisplay?: boolean | undefined;
61
104
  hideMissingDataConnection?: boolean | undefined;
62
105
  showMarker?: boolean | undefined;
63
106
  showMarkerLabel?: boolean | undefined;
@@ -70,9 +113,11 @@ export declare const withMultipleSeries: ComponentStory<import("react").ForwardR
70
113
  renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
71
114
  index: import("@wonderflow/charts").LineChartIndex;
72
115
  series: import("@wonderflow/charts").LineChartSeries;
73
- overlay?: import("@wonderflow/charts").LineChartOverlay | undefined;
116
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
74
117
  showAverage?: boolean | undefined;
118
+ showTrendline?: boolean | undefined;
75
119
  tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
120
+ preventTooltipDisplay?: boolean | undefined;
76
121
  hideMissingDataConnection?: boolean | undefined;
77
122
  showMarker?: boolean | undefined;
78
123
  showMarkerLabel?: boolean | undefined;
@@ -85,9 +130,11 @@ export declare const withCategoriesOnIndex: ComponentStory<import("react").Forwa
85
130
  renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
86
131
  index: import("@wonderflow/charts").LineChartIndex;
87
132
  series: import("@wonderflow/charts").LineChartSeries;
88
- overlay?: import("@wonderflow/charts").LineChartOverlay | undefined;
133
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
89
134
  showAverage?: boolean | undefined;
135
+ showTrendline?: boolean | undefined;
90
136
  tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
137
+ preventTooltipDisplay?: boolean | undefined;
91
138
  hideMissingDataConnection?: boolean | undefined;
92
139
  showMarker?: boolean | undefined;
93
140
  showMarkerLabel?: boolean | undefined;
@@ -100,9 +147,11 @@ export declare const withNestedData: ComponentStory<import("react").ForwardRefEx
100
147
  renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
101
148
  index: import("@wonderflow/charts").LineChartIndex;
102
149
  series: import("@wonderflow/charts").LineChartSeries;
103
- overlay?: import("@wonderflow/charts").LineChartOverlay | undefined;
150
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
104
151
  showAverage?: boolean | undefined;
152
+ showTrendline?: boolean | undefined;
105
153
  tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
154
+ preventTooltipDisplay?: boolean | undefined;
106
155
  hideMissingDataConnection?: boolean | undefined;
107
156
  showMarker?: boolean | undefined;
108
157
  showMarkerLabel?: boolean | undefined;
@@ -115,9 +164,11 @@ export declare const withCustomLineStyle: ComponentStory<import("react").Forward
115
164
  renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
116
165
  index: import("@wonderflow/charts").LineChartIndex;
117
166
  series: import("@wonderflow/charts").LineChartSeries;
118
- overlay?: import("@wonderflow/charts").LineChartOverlay | undefined;
167
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
119
168
  showAverage?: boolean | undefined;
169
+ showTrendline?: boolean | undefined;
120
170
  tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
171
+ preventTooltipDisplay?: boolean | undefined;
121
172
  hideMissingDataConnection?: boolean | undefined;
122
173
  showMarker?: boolean | undefined;
123
174
  showMarkerLabel?: boolean | undefined;
@@ -130,9 +181,11 @@ export declare const withBrush: ComponentStory<import("react").ForwardRefExoticC
130
181
  renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
131
182
  index: import("@wonderflow/charts").LineChartIndex;
132
183
  series: import("@wonderflow/charts").LineChartSeries;
133
- overlay?: import("@wonderflow/charts").LineChartOverlay | undefined;
184
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
134
185
  showAverage?: boolean | undefined;
186
+ showTrendline?: boolean | undefined;
135
187
  tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
188
+ preventTooltipDisplay?: boolean | undefined;
136
189
  hideMissingDataConnection?: boolean | undefined;
137
190
  showMarker?: boolean | undefined;
138
191
  showMarkerLabel?: boolean | undefined;
@@ -145,9 +198,11 @@ export declare const withCustomDomain: ComponentStory<import("react").ForwardRef
145
198
  renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
146
199
  index: import("@wonderflow/charts").LineChartIndex;
147
200
  series: import("@wonderflow/charts").LineChartSeries;
148
- overlay?: import("@wonderflow/charts").LineChartOverlay | undefined;
201
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
149
202
  showAverage?: boolean | undefined;
203
+ showTrendline?: boolean | undefined;
150
204
  tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
205
+ preventTooltipDisplay?: boolean | undefined;
151
206
  hideMissingDataConnection?: boolean | undefined;
152
207
  showMarker?: boolean | undefined;
153
208
  showMarkerLabel?: boolean | undefined;
@@ -160,9 +215,11 @@ export declare const withVerticalLayout: ComponentStory<import("react").ForwardR
160
215
  renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
161
216
  index: import("@wonderflow/charts").LineChartIndex;
162
217
  series: import("@wonderflow/charts").LineChartSeries;
163
- overlay?: import("@wonderflow/charts").LineChartOverlay | undefined;
218
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
164
219
  showAverage?: boolean | undefined;
220
+ showTrendline?: boolean | undefined;
165
221
  tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
222
+ preventTooltipDisplay?: boolean | undefined;
166
223
  hideMissingDataConnection?: boolean | undefined;
167
224
  showMarker?: boolean | undefined;
168
225
  showMarkerLabel?: boolean | undefined;
@@ -175,9 +232,28 @@ export declare const withNoData: ComponentStory<import("react").ForwardRefExotic
175
232
  renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
176
233
  index: import("@wonderflow/charts").LineChartIndex;
177
234
  series: import("@wonderflow/charts").LineChartSeries;
178
- overlay?: import("@wonderflow/charts").LineChartOverlay | undefined;
235
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
236
+ showAverage?: boolean | undefined;
237
+ showTrendline?: boolean | undefined;
238
+ tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
239
+ preventTooltipDisplay?: boolean | undefined;
240
+ hideMissingDataConnection?: boolean | undefined;
241
+ showMarker?: boolean | undefined;
242
+ showMarkerLabel?: boolean | undefined;
243
+ hidePadding?: boolean | undefined;
244
+ } & import("type-fest/source/except").Except<import("@wonderflow/charts").CartesianBaseProps, "axis" | "axisFiltered" | "onBrushChange"> & import("react").RefAttributes<HTMLElement>>>;
245
+ export declare const WithMenu: ComponentStory<import("react").ForwardRefExoticComponent<{
246
+ theme?: import("@wonderflow/charts").ThemeVariants | undefined;
247
+ layout?: CartesianChartLayout | undefined;
248
+ data: import("@wonderflow/charts").Data;
249
+ renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
250
+ index: import("@wonderflow/charts").LineChartIndex;
251
+ series: import("@wonderflow/charts").LineChartSeries;
252
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
179
253
  showAverage?: boolean | undefined;
254
+ showTrendline?: boolean | undefined;
180
255
  tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
256
+ preventTooltipDisplay?: boolean | undefined;
181
257
  hideMissingDataConnection?: boolean | undefined;
182
258
  showMarker?: boolean | undefined;
183
259
  showMarkerLabel?: boolean | undefined;
@@ -190,9 +266,11 @@ export declare const renderAsLines: ComponentStory<import("react").ForwardRefExo
190
266
  renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
191
267
  index: import("@wonderflow/charts").LineChartIndex;
192
268
  series: import("@wonderflow/charts").LineChartSeries;
193
- overlay?: import("@wonderflow/charts").LineChartOverlay | undefined;
269
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
194
270
  showAverage?: boolean | undefined;
271
+ showTrendline?: boolean | undefined;
195
272
  tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
273
+ preventTooltipDisplay?: boolean | undefined;
196
274
  hideMissingDataConnection?: boolean | undefined;
197
275
  showMarker?: boolean | undefined;
198
276
  showMarkerLabel?: boolean | undefined;
@@ -205,9 +283,11 @@ export declare const renderAsSteps: ComponentStory<import("react").ForwardRefExo
205
283
  renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
206
284
  index: import("@wonderflow/charts").LineChartIndex;
207
285
  series: import("@wonderflow/charts").LineChartSeries;
208
- overlay?: import("@wonderflow/charts").LineChartOverlay | undefined;
286
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
209
287
  showAverage?: boolean | undefined;
288
+ showTrendline?: boolean | undefined;
210
289
  tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
290
+ preventTooltipDisplay?: boolean | undefined;
211
291
  hideMissingDataConnection?: boolean | undefined;
212
292
  showMarker?: boolean | undefined;
213
293
  showMarkerLabel?: boolean | undefined;
@@ -220,9 +300,11 @@ export declare const WithinCard: ComponentStory<import("react").ForwardRefExotic
220
300
  renderAs?: import("@wonderflow/charts").LineChartRenderType | undefined;
221
301
  index: import("@wonderflow/charts").LineChartIndex;
222
302
  series: import("@wonderflow/charts").LineChartSeries;
223
- overlay?: import("@wonderflow/charts").LineChartOverlay | undefined;
303
+ overlay?: import("@wonderflow/charts").LineChartSeries | undefined;
224
304
  showAverage?: boolean | undefined;
305
+ showTrendline?: boolean | undefined;
225
306
  tooltip?: import("@wonderflow/charts").LineChartTooltip | undefined;
307
+ preventTooltipDisplay?: boolean | undefined;
226
308
  hideMissingDataConnection?: boolean | undefined;
227
309
  showMarker?: boolean | undefined;
228
310
  showMarkerLabel?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"line-chart.stories.d.ts","sourceRoot":"","sources":["../../../../src/examples/charts/storybook/line-chart.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAkB,MAAM,oBAAoB,CAAC;AAUrF,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,SAAS,CA2C1C,CAAC;AAEF,eAAe,KAAK,CAAC;AAIrB,eAAO,MAAM,OAAO;;;;;;;;;;;;;;uLAAoB,CAAC;AAGzC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;uLAAoB,CAAC;AAS7C,eAAO,MAAM,WAAW;;;;;;;;;;;;;;uLAAoB,CAAC;AAM7C,eAAO,MAAM,eAAe;;;;;;;;;;;;;;uLAAoB,CAAC;AAUjD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;uLAAoB,CAAC;AAiBpD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;uLAAoB,CAAC;AAevD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;uLAAoB,CAAC;AAgChD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;uLAAoB,CAAC;AA8BrD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;uLAAoB,CAAC;AAiC3C,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;uLAAoB,CAAC;AAclD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;uLAAoB,CAAC;AAiBpD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;uLAAoB,CAAC;AAQ5C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;uLAAoB,CAAC;AAiB/C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;uLAAoB,CAAC;AA8B/C,eAAO,MAAM,UAAU;;;;;;;;;;;;;;uLAA8B,CAAC"}
1
+ {"version":3,"file":"line-chart.stories.d.ts","sourceRoot":"","sources":["../../../../src/examples/charts/storybook/line-chart.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAkB,MAAM,oBAAoB,CAAC;AAUrF,eAAO,MAAM,QAAQ,aAyBpB,CAAC;AAEF,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,SAAS,CAgD1C,CAAC;AAEF,eAAe,KAAK,CAAC;AAIrB,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;uLAAoB,CAAC;AAGzC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;uLAAoB,CAAC;AAS7C,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;uLAAoB,CAAC;AASrD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;uLAAoB,CAAC;AAM7C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;uLAAoB,CAAC;AAU/C,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;uLAAoB,CAAC;AAUjD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;uLAAoB,CAAC;AAiBpD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;uLAAoB,CAAC;AAevD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;uLAAoB,CAAC;AAgChD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;uLAAoB,CAAC;AA8BrD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;uLAAoB,CAAC;AAiC3C,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;uLAAoB,CAAC;AAclD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;uLAAoB,CAAC;AAiBpD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;uLAAoB,CAAC;AAQ5C,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;uLAAoB,CAAC;AAK1C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;uLAAoB,CAAC;AAiB/C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;uLAAoB,CAAC;AA8B/C,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;uLAA8B,CAAC"}
@@ -1,27 +1,32 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { CartesianChartLayout, LineChart } from '@wonderflow/charts';
3
- import { Card } from '../../..';
3
+ import { Card, Menu } from '../../..';
4
4
  // import { CartesianChartLayout, LineChart, LineChartProps } from '../../../../../charts/src';
5
5
  import { channels, channelsB, feedbackCount, feedbackCountGaps, proCons, products, } from '../mock-data';
6
6
  import styles from './sb-charts.module.css';
7
+ export const FakeMenu = (_jsxs(Menu, { children: [_jsx(Menu.Item, { autoFocus: true, icon: "arrow-right", value: "1", description: _jsx(_Fragment, { children: "this is my description" }), children: "Sample long menu item" }), _jsx(Menu.ItemCheckbox, { onClick: () => ({}), checked: true, icon: "check", value: "2", children: "Checkbox item" }), _jsx(Menu.Item, { value: "3", icon: "right-from-bracket", children: "Item option 3" }), _jsx(Menu.Separator, {}), _jsx(Menu.Item, { value: "4", icon: "arrow-down-to-bracket", children: "Even shorter" }), _jsx(Menu.Item, { value: "5", disabled: true, children: "Really?" })] }));
7
8
  const story = {
8
9
  title: 'Charts/Line Chart',
9
10
  component: LineChart,
10
11
  args: {
11
12
  title: 'Line Charts',
12
13
  subtitle: 'A trend line chart',
13
- preventResponsive: false,
14
14
  isLoading: false,
15
15
  showMarker: false,
16
16
  showMarkerLabel: false,
17
- hideMissingDataConnection: false,
18
17
  showAverage: false,
18
+ showTrendline: false,
19
19
  showBrush: false,
20
+ hideMissingDataConnection: false,
20
21
  hideLegend: false,
21
22
  hidePadding: false,
23
+ preventTooltipDisplay: false,
24
+ preventResponsive: false,
22
25
  layout: CartesianChartLayout.HORIZONTAL,
23
26
  renderAs: 'curves',
24
27
  theme: 'light',
28
+ mirrorDomains: false,
29
+ reverseIndex: false,
25
30
  data: feedbackCount,
26
31
  index: {
27
32
  dataKey: 'date',
@@ -32,6 +37,7 @@ const story = {
32
37
  label: 'Feedback Count',
33
38
  },
34
39
  overlay: undefined,
40
+ menu: undefined,
35
41
  },
36
42
  argTypes: {
37
43
  layout: {
@@ -56,7 +62,15 @@ export const withOverlay = Template.bind({});
56
62
  withOverlay.args = {
57
63
  subtitle: 'A trend line chart with overlay',
58
64
  overlay: {
59
- dataKey: 'overlay',
65
+ dataKey: ['overlay'],
66
+ label: 'Overlay',
67
+ },
68
+ };
69
+ export const withMultipleOverlay = Template.bind({});
70
+ withMultipleOverlay.args = {
71
+ subtitle: 'A trend line chart with overlay',
72
+ overlay: {
73
+ dataKey: ['overlay', 'overlayB'],
60
74
  label: 'Overlay',
61
75
  },
62
76
  };
@@ -65,12 +79,21 @@ withAverage.args = {
65
79
  subtitle: 'A trend line chart with average',
66
80
  showAverage: true,
67
81
  };
82
+ export const withTrendline = Template.bind({});
83
+ withTrendline.args = {
84
+ subtitle: 'A trend line chart with overlay and trendlines',
85
+ overlay: {
86
+ dataKey: ['overlay'],
87
+ label: 'Overlay',
88
+ },
89
+ showTrendline: true,
90
+ };
68
91
  export const withMissingData = Template.bind({});
69
92
  withMissingData.args = {
70
93
  data: feedbackCountGaps,
71
94
  subtitle: 'A trend line chart with null values',
72
95
  overlay: {
73
- dataKey: 'overlay',
96
+ dataKey: ['overlay'],
74
97
  label: 'Overlay',
75
98
  },
76
99
  };
@@ -119,12 +142,12 @@ withNestedData.args = {
119
142
  rename: (_, i) => Array(i + 1).fill('⭐').join(),
120
143
  },
121
144
  overlay: {
122
- dataKey: 'overlay.value',
145
+ dataKey: ['overlay.value'],
123
146
  label: 'TGW',
124
147
  domain: [0, 5],
125
- style: {
126
- strokeDasharray: '2 4',
127
- },
148
+ style: [{
149
+ strokeDasharray: '2 4',
150
+ }],
128
151
  },
129
152
  tooltip: {
130
153
  extraSeriesData: (series) => `${series.percentage}%`,
@@ -213,7 +236,7 @@ export const withVerticalLayout = Template.bind({});
213
236
  withVerticalLayout.args = {
214
237
  layout: CartesianChartLayout.VERTICAL,
215
238
  overlay: {
216
- dataKey: 'overlay',
239
+ dataKey: ['overlay'],
217
240
  label: 'Overlay',
218
241
  },
219
242
  index: {
@@ -232,6 +255,10 @@ withNoData.args = {
232
255
  subtitle: 'A trend line chart w/o data',
233
256
  emptyStateMessage: 'Please select items from the right menu to render the chart.',
234
257
  };
258
+ export const WithMenu = Template.bind({});
259
+ WithMenu.args = {
260
+ menu: FakeMenu,
261
+ };
235
262
  export const renderAsLines = Template.bind({});
236
263
  renderAsLines.args = {
237
264
  title: 'Multiple Series',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderflow/react-components",
3
- "version": "12.10.0",
3
+ "version": "13.0.0",
4
4
  "description": "UI components from Wonderflow's Wanda design system",
5
5
  "author": "Wonderflow",
6
6
  "license": "Apache-2.0",
@@ -82,9 +82,9 @@
82
82
  "@types/react-dom": "17.0.14",
83
83
  "@types/react-table": "7.7.18",
84
84
  "@types/react-test-renderer": "18.0.7",
85
- "@wonderflow/config": "12.10.0",
86
- "@wonderflow/tokens": "12.10.0",
87
- "@wonderflow/charts": "12.10.0",
85
+ "@wonderflow/config": "13.0.0",
86
+ "@wonderflow/tokens": "13.0.0",
87
+ "@wonderflow/charts": "13.0.0",
88
88
  "@types/uuid": "9.0.7",
89
89
  "babel-loader": "8.2.5",
90
90
  "cpy-cli": "3.1.1",