@razorpay/blade 12.56.1 → 12.58.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 (69) hide show
  1. package/build/lib/native/components/Accordion/Accordion.js +1 -1
  2. package/build/lib/native/components/Accordion/Accordion.js.map +1 -1
  3. package/build/lib/native/components/Charts/CommonChartComponents/CommonChartComponents.native.js +1 -1
  4. package/build/lib/native/components/Charts/CommonChartComponents/CommonChartComponents.native.js.map +1 -1
  5. package/build/lib/native/components/Charts/DonutChart/DonutChart.native.js +12 -0
  6. package/build/lib/native/components/Charts/DonutChart/DonutChart.native.js.map +1 -0
  7. package/build/lib/native/components/index.js +1 -0
  8. package/build/lib/native/components/index.js.map +1 -1
  9. package/build/lib/native/tokens/theme/bladeTheme.js +1 -1
  10. package/build/lib/native/tokens/theme/bladeTheme.js.map +1 -1
  11. package/build/lib/web/development/components/Accordion/Accordion.js +5 -4
  12. package/build/lib/web/development/components/Accordion/Accordion.js.map +1 -1
  13. package/build/lib/web/development/components/Charts/AreaChart/AreaChart.web.js +1 -1
  14. package/build/lib/web/development/components/Charts/AreaChart/AreaChart.web.js.map +1 -1
  15. package/build/lib/web/development/components/Charts/BarChart/BarChart.web.js +2 -2
  16. package/build/lib/web/development/components/Charts/BarChart/BarChart.web.js.map +1 -1
  17. package/build/lib/web/development/components/Charts/BarChart/BarChartContext.js +1 -1
  18. package/build/lib/web/development/components/Charts/BarChart/BarChartContext.js.map +1 -1
  19. package/build/lib/web/development/components/Charts/CommonChartComponents/CommonChartComponents.web.js +21 -6
  20. package/build/lib/web/development/components/Charts/CommonChartComponents/CommonChartComponents.web.js.map +1 -1
  21. package/build/lib/web/development/components/Charts/CommonChartComponents/tokens.js +4 -1
  22. package/build/lib/web/development/components/Charts/CommonChartComponents/tokens.js.map +1 -1
  23. package/build/lib/web/development/components/Charts/DonutChart/DonutChart.web.js +256 -0
  24. package/build/lib/web/development/components/Charts/DonutChart/DonutChart.web.js.map +1 -0
  25. package/build/lib/web/development/components/Charts/DonutChart/index.js +2 -0
  26. package/build/lib/web/development/components/Charts/DonutChart/index.js.map +1 -0
  27. package/build/lib/web/development/components/Charts/DonutChart/tokens.js +78 -0
  28. package/build/lib/web/development/components/Charts/DonutChart/tokens.js.map +1 -0
  29. package/build/lib/web/development/components/Charts/LineChart/LineChart.web.js +1 -1
  30. package/build/lib/web/development/components/Charts/LineChart/LineChart.web.js.map +1 -1
  31. package/build/lib/web/development/components/Charts/index.js +1 -0
  32. package/build/lib/web/development/components/Charts/index.js.map +1 -1
  33. package/build/lib/web/development/components/Charts/utils/useColorTheme.js +13 -5
  34. package/build/lib/web/development/components/Charts/utils/useColorTheme.js.map +1 -1
  35. package/build/lib/web/development/components/index.js +1 -0
  36. package/build/lib/web/development/components/index.js.map +1 -1
  37. package/build/lib/web/development/tokens/theme/bladeTheme.js +22 -22
  38. package/build/lib/web/development/tokens/theme/bladeTheme.js.map +1 -1
  39. package/build/lib/web/production/components/Accordion/Accordion.js +5 -4
  40. package/build/lib/web/production/components/Accordion/Accordion.js.map +1 -1
  41. package/build/lib/web/production/components/Charts/AreaChart/AreaChart.web.js +1 -1
  42. package/build/lib/web/production/components/Charts/AreaChart/AreaChart.web.js.map +1 -1
  43. package/build/lib/web/production/components/Charts/BarChart/BarChart.web.js +2 -2
  44. package/build/lib/web/production/components/Charts/BarChart/BarChart.web.js.map +1 -1
  45. package/build/lib/web/production/components/Charts/BarChart/BarChartContext.js +1 -1
  46. package/build/lib/web/production/components/Charts/BarChart/BarChartContext.js.map +1 -1
  47. package/build/lib/web/production/components/Charts/CommonChartComponents/CommonChartComponents.web.js +21 -6
  48. package/build/lib/web/production/components/Charts/CommonChartComponents/CommonChartComponents.web.js.map +1 -1
  49. package/build/lib/web/production/components/Charts/CommonChartComponents/tokens.js +4 -1
  50. package/build/lib/web/production/components/Charts/CommonChartComponents/tokens.js.map +1 -1
  51. package/build/lib/web/production/components/Charts/DonutChart/DonutChart.web.js +256 -0
  52. package/build/lib/web/production/components/Charts/DonutChart/DonutChart.web.js.map +1 -0
  53. package/build/lib/web/production/components/Charts/DonutChart/index.js +2 -0
  54. package/build/lib/web/production/components/Charts/DonutChart/index.js.map +1 -0
  55. package/build/lib/web/production/components/Charts/DonutChart/tokens.js +78 -0
  56. package/build/lib/web/production/components/Charts/DonutChart/tokens.js.map +1 -0
  57. package/build/lib/web/production/components/Charts/LineChart/LineChart.web.js +1 -1
  58. package/build/lib/web/production/components/Charts/LineChart/LineChart.web.js.map +1 -1
  59. package/build/lib/web/production/components/Charts/index.js +1 -0
  60. package/build/lib/web/production/components/Charts/index.js.map +1 -1
  61. package/build/lib/web/production/components/Charts/utils/useColorTheme.js +13 -5
  62. package/build/lib/web/production/components/Charts/utils/useColorTheme.js.map +1 -1
  63. package/build/lib/web/production/components/index.js +1 -0
  64. package/build/lib/web/production/components/index.js.map +1 -1
  65. package/build/lib/web/production/tokens/theme/bladeTheme.js +22 -22
  66. package/build/lib/web/production/tokens/theme/bladeTheme.js.map +1 -1
  67. package/build/types/components/index.d.ts +846 -309
  68. package/build/types/components/index.native.d.ts +632 -221
  69. package/package.json +1 -1
@@ -0,0 +1,256 @@
1
+ import _typeof from '@babel/runtime/helpers/typeof';
2
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
5
+ import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructuringEmpty';
6
+ import _extends from '@babel/runtime/helpers/extends';
7
+ import { useState, useRef, useEffect, useMemo, isValidElement, createElement } from 'react';
8
+ import { Cell, ResponsiveContainer, PieChart, Label, Pie } from 'recharts';
9
+ import '../utils/index.js';
10
+ import { componentId as componentId$1 } from '../CommonChartComponents/tokens.js';
11
+ import { componentId, LABEL_FONT_STYLES, LABEL_DISTANCE_FROM_CENTER, RADIUS_MAPPING, START_AND_END_ANGLES } from './tokens.js';
12
+ import '../../BladeProvider/index.js';
13
+ import '../../Box/BaseBox/index.js';
14
+ import '../../../utils/metaAttribute/index.js';
15
+ import getIn from '../../../utils/lodashButBetter/get.js';
16
+ import '../../../utils/makeAnalyticsAttribute/index.js';
17
+ import '../../../utils/assignWithoutSideEffects/index.js';
18
+ import '../../../utils/isValidAllowedChildren/index.js';
19
+ import { jsx, jsxs } from 'react/jsx-runtime';
20
+ import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
21
+ import useTheme from '../../BladeProvider/useTheme.js';
22
+ import { getComponentId } from '../../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
23
+ import { BaseBox } from '../../Box/BaseBox/BaseBox.web.js';
24
+ import { metaAttribute } from '../../../utils/metaAttribute/metaAttribute.web.js';
25
+ import { makeAnalyticsAttribute } from '../../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
26
+ import useChartsColorTheme from '../utils/useColorTheme.js';
27
+
28
+ var _excluded = ["children", "content", "testID"],
29
+ _excluded2 = ["cx", "cy", "radius", "dataKey", "nameKey", "children", "data", "colorTheme", "type"];
30
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
31
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
32
+ var _Cell = function _Cell(_ref) {
33
+ var rest = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
34
+ return /*#__PURE__*/jsx(Cell, _objectSpread({}, rest));
35
+ };
36
+ var ChartDonutCell = /*#__PURE__*/assignWithoutSideEffects(_Cell, {
37
+ componentId: componentId.cell
38
+ });
39
+ var getTranslate = function getTranslate(legendLayout, legendAlignment, legendWidth, legendHeight) {
40
+ if (legendLayout === 'vertical') {
41
+ return "translate(calc(-50% + ".concat(legendAlignment === 'right' ? -legendWidth / 2 : legendWidth / 2, "px) , calc(-50%))");
42
+ }
43
+ return "translate(-50%, calc(-50% - ".concat(legendHeight / 2, "px))");
44
+ };
45
+ var ChartDonutWrapper = function ChartDonutWrapper(_ref2) {
46
+ var children = _ref2.children,
47
+ content = _ref2.content,
48
+ testID = _ref2.testID,
49
+ restProps = _objectWithoutProperties(_ref2, _excluded);
50
+ var _useTheme = useTheme(),
51
+ theme = _useTheme.theme;
52
+ var _useState = useState(0),
53
+ _useState2 = _slicedToArray(_useState, 2),
54
+ legendHeight = _useState2[0],
55
+ setLegendHeight = _useState2[1];
56
+ var _useState3 = useState(0),
57
+ _useState4 = _slicedToArray(_useState3, 2),
58
+ legendWidth = _useState4[0],
59
+ setLegendWidth = _useState4[1];
60
+ var chartRef = useRef(null);
61
+ var isValuePresentInContent = content && _typeof(content) === 'object' && 'value' in content;
62
+ var isLabelPresentInContent = content && _typeof(content) === 'object' && 'label' in content;
63
+ useEffect(function () {
64
+ var observer = new MutationObserver(function (mutations) {
65
+ mutations.forEach(function (mutation) {
66
+ if (mutation.type === 'childList') {
67
+ var _chartRef$current;
68
+ var legendWrapper = (_chartRef$current = chartRef.current) === null || _chartRef$current === void 0 ? void 0 : _chartRef$current.querySelector('.recharts-legend-wrapper');
69
+ if (legendWrapper) {
70
+ var height = legendWrapper.getBoundingClientRect().height;
71
+ var width = legendWrapper.getBoundingClientRect().width;
72
+ setLegendHeight(height);
73
+ setLegendWidth(width);
74
+ }
75
+ }
76
+ });
77
+ });
78
+ if (chartRef.current) {
79
+ observer.observe(chartRef.current, {
80
+ childList: true,
81
+ subtree: true
82
+ });
83
+ }
84
+ return function () {
85
+ return observer.disconnect();
86
+ };
87
+ }, []);
88
+ var pieChartRadius = useMemo(function () {
89
+ if (Array.isArray(children)) {
90
+ var _donutChild$props;
91
+ var donutChild = children.find(function (child) {
92
+ return getComponentId(child) === componentId.chartDonut;
93
+ });
94
+ if (!donutChild || ! /*#__PURE__*/isValidElement(donutChild)) {
95
+ return 'medium';
96
+ }
97
+ return (donutChild === null || donutChild === void 0 || (_donutChild$props = donutChild.props) === null || _donutChild$props === void 0 ? void 0 : _donutChild$props.radius) || 'medium';
98
+ }
99
+ return 'medium';
100
+ }, [children]);
101
+ var legendLayout = useMemo(function () {
102
+ if (Array.isArray(children)) {
103
+ var _legendChild$props;
104
+ var legendChild = children.find(function (child) {
105
+ return getComponentId(child) === componentId$1.chartLegend;
106
+ });
107
+ if (!legendChild || ! /*#__PURE__*/isValidElement(legendChild)) {
108
+ return 'horizontal';
109
+ }
110
+ return (legendChild === null || legendChild === void 0 || (_legendChild$props = legendChild.props) === null || _legendChild$props === void 0 ? void 0 : _legendChild$props.layout) || 'horizontal';
111
+ }
112
+ return 'horizontal';
113
+ }, [children]);
114
+ var legendAlignment = useMemo(function () {
115
+ if (Array.isArray(children)) {
116
+ var _legendChild$props2;
117
+ var legendChild = children.find(function (child) {
118
+ return getComponentId(child) === componentId$1.chartLegend;
119
+ });
120
+ if (!legendChild || ! /*#__PURE__*/isValidElement(legendChild)) {
121
+ return 'right';
122
+ }
123
+ return (legendChild === null || legendChild === void 0 || (_legendChild$props2 = legendChild.props) === null || _legendChild$props2 === void 0 ? void 0 : _legendChild$props2.align) || 'right';
124
+ }
125
+ return 'right';
126
+ }, [children]);
127
+ return /*#__PURE__*/jsxs(BaseBox, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
128
+ ref: chartRef
129
+ }, metaAttribute({
130
+ name: 'donut-chart',
131
+ testID: testID
132
+ })), makeAnalyticsAttribute(restProps)), {}, {
133
+ width: "100%",
134
+ height: "100%"
135
+ }, restProps), {}, {
136
+ position: /*#__PURE__*/isValidElement(content) ? 'relative' : undefined,
137
+ children: [/*#__PURE__*/jsx(ResponsiveContainer, {
138
+ width: "100%",
139
+ height: "100%",
140
+ children: /*#__PURE__*/jsxs(PieChart, {
141
+ children: [children, isLabelPresentInContent && /*#__PURE__*/jsx(Label, {
142
+ position: "center",
143
+ fill: theme.colors.surface.text.gray.muted,
144
+ fontSize: theme.typography.fonts.size[LABEL_FONT_STYLES[pieChartRadius].fontSize.label],
145
+ fontFamily: theme.typography.fonts.family.text,
146
+ fontWeight: theme.typography.fonts.weight.medium,
147
+ letterSpacing: theme.typography.letterSpacings[100],
148
+ dy: isValuePresentInContent ? LABEL_DISTANCE_FROM_CENTER[pieChartRadius].withText : LABEL_DISTANCE_FROM_CENTER[pieChartRadius].normal,
149
+ children: content === null || content === void 0 ? void 0 : content.label
150
+ }), isValuePresentInContent && /*#__PURE__*/jsx(Label, {
151
+ position: "center",
152
+ fill: theme.colors.surface.text.gray.normal,
153
+ fontSize: theme.typography.fonts.size[LABEL_FONT_STYLES[pieChartRadius].fontSize.text],
154
+ fontFamily: theme.typography.fonts.family.heading,
155
+ fontWeight: theme.typography.fonts.weight.bold,
156
+ letterSpacing: theme.typography.letterSpacings[100],
157
+ dy: isLabelPresentInContent ? LABEL_DISTANCE_FROM_CENTER[pieChartRadius].withLabel : LABEL_DISTANCE_FROM_CENTER[pieChartRadius].normal,
158
+ children: content === null || content === void 0 ? void 0 : content.value
159
+ })]
160
+ })
161
+ }), /*#__PURE__*/isValidElement(content) && /*#__PURE__*/jsx(BaseBox, {
162
+ position: "absolute",
163
+ top: "50%",
164
+ left: "50%",
165
+ transform: getTranslate(legendLayout, legendAlignment, legendWidth, legendHeight),
166
+ zIndex: 10,
167
+ textAlign: "center",
168
+ children: content
169
+ })]
170
+ }));
171
+ };
172
+ var _ChartDonut = function _ChartDonut(_ref3) {
173
+ var _ref3$cx = _ref3.cx,
174
+ cx = _ref3$cx === void 0 ? '50%' : _ref3$cx,
175
+ _ref3$cy = _ref3.cy,
176
+ cy = _ref3$cy === void 0 ? '50%' : _ref3$cy,
177
+ _ref3$radius = _ref3.radius,
178
+ radius = _ref3$radius === void 0 ? 'medium' : _ref3$radius,
179
+ dataKey = _ref3.dataKey,
180
+ nameKey = _ref3.nameKey,
181
+ children = _ref3.children,
182
+ data = _ref3.data,
183
+ _ref3$colorTheme = _ref3.colorTheme,
184
+ colorTheme = _ref3$colorTheme === void 0 ? 'categorical' : _ref3$colorTheme,
185
+ _ref3$type = _ref3.type,
186
+ type = _ref3$type === void 0 ? 'circle' : _ref3$type,
187
+ rest = _objectWithoutProperties(_ref3, _excluded2);
188
+ var radiusConfig = RADIUS_MAPPING[radius];
189
+ var themeColors = useChartsColorTheme({
190
+ colorTheme: colorTheme
191
+ });
192
+ var _useState5 = useState(null),
193
+ _useState6 = _slicedToArray(_useState5, 2),
194
+ hoveredIndex = _useState6[0],
195
+ setHoveredIndex = _useState6[1];
196
+ var _useTheme2 = useTheme(),
197
+ theme = _useTheme2.theme;
198
+ var getCellOpacity = function getCellOpacity(hoveredIndex, currentIndex) {
199
+ if (hoveredIndex === null) return 1;
200
+ if (hoveredIndex === currentIndex) return 1;
201
+ return 0.2;
202
+ };
203
+ var modifiedChildren = useMemo(function () {
204
+ if (Array.isArray(children)) {
205
+ return children.map(function (child, index) {
206
+ if (getComponentId(child) === componentId.cell) {
207
+ /*
208
+ Why we are not using React.cloneElement ? just use ChartDonutCell no?
209
+ cell can never be custom component in recharts. (as of v3.1.2)
210
+ (https://github.com/recharts/recharts/issues/2788)
211
+ https://github.com/recharts/recharts/discussions/5474
212
+ So we have placeholder component ChartDonutCell. which we replaced by RechartsCell internally so dev can see hover effects
213
+ working out of box.
214
+ */
215
+ var fill = getIn(theme.colors, child.props.color) || themeColors[index];
216
+ return /*#__PURE__*/createElement(Cell, _objectSpread(_objectSpread({}, child.props), {}, {
217
+ fill: fill,
218
+ key: index,
219
+ opacity: getCellOpacity(hoveredIndex, index)
220
+ }));
221
+ } else {
222
+ return child;
223
+ }
224
+ });
225
+ }
226
+ return data === null || data === void 0 ? void 0 : data.map(function (_, index) {
227
+ return /*#__PURE__*/jsx(Cell, {
228
+ fill: themeColors[index],
229
+ opacity: getCellOpacity(hoveredIndex, index)
230
+ }, index);
231
+ });
232
+ // eslint-disable-next-line react-hooks/exhaustive-deps
233
+ }, [children, data, colorTheme, hoveredIndex, themeColors]);
234
+ return /*#__PURE__*/jsx(Pie, _objectSpread(_objectSpread({}, rest), {}, {
235
+ cx: cx,
236
+ cy: cy,
237
+ outerRadius: radiusConfig.outerRadius,
238
+ innerRadius: radiusConfig.innerRadius,
239
+ data: data,
240
+ startAngle: START_AND_END_ANGLES[type].startAngle,
241
+ endAngle: START_AND_END_ANGLES[type].endAngle,
242
+ onMouseEnter: function onMouseEnter(data, index) {
243
+ setHoveredIndex(index);
244
+ },
245
+ onMouseLeave: function onMouseLeave() {
246
+ setHoveredIndex(null);
247
+ },
248
+ children: modifiedChildren
249
+ }));
250
+ };
251
+ var ChartDonut = /*#__PURE__*/assignWithoutSideEffects(_ChartDonut, {
252
+ componentId: componentId.chartDonut
253
+ });
254
+
255
+ export { ChartDonut, ChartDonutCell, ChartDonutWrapper };
256
+ //# sourceMappingURL=DonutChart.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DonutChart.web.js","sources":["../../../../../../../src/components/Charts/DonutChart/DonutChart.web.tsx"],"sourcesContent":["import React, { isValidElement, useMemo, useState, useRef, useEffect } from 'react';\nimport {\n PieChart as RechartsPieChart,\n Pie as RechartsPie,\n Cell as RechartsCell,\n ResponsiveContainer as RechartsResponsiveContainer,\n Label,\n} from 'recharts';\nimport { useChartsColorTheme } from '../utils';\nimport { componentId as commonChartComponentId } from '../CommonChartComponents/tokens';\nimport type {\n ChartDonutWrapperProps,\n ChartDonutCellProps,\n ChartDonutProps,\n ChartRadius,\n} from './types';\nimport {\n RADIUS_MAPPING,\n START_AND_END_ANGLES,\n componentId,\n LABEL_DISTANCE_FROM_CENTER,\n LABEL_FONT_STYLES,\n} from './tokens';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\n\n// Cell component\nconst _Cell: React.FC<ChartDonutCellProps> = ({ ...rest }) => {\n return <RechartsCell {...rest} />;\n};\n\nconst ChartDonutCell = assignWithoutSideEffects(_Cell, {\n componentId: componentId.cell,\n});\n\nconst getTranslate = (\n legendLayout: 'horizontal' | 'vertical',\n legendAlignment: 'left' | 'right',\n legendWidth: number,\n legendHeight: number,\n): string => {\n if (legendLayout === 'vertical') {\n return `translate(calc(-50% + ${\n legendAlignment === 'right' ? -legendWidth / 2 : legendWidth / 2\n }px) , calc(-50%))`;\n }\n return `translate(-50%, calc(-50% - ${legendHeight / 2}px))`;\n};\n\nconst ChartDonutWrapper: React.FC<ChartDonutWrapperProps & TestID & DataAnalyticsAttribute> = ({\n children,\n content,\n testID,\n ...restProps\n}) => {\n const { theme } = useTheme();\n const [legendHeight, setLegendHeight] = useState(0);\n const [legendWidth, setLegendWidth] = useState(0);\n const chartRef = useRef<HTMLDivElement>(null);\n const isValuePresentInContent = content && typeof content === 'object' && 'value' in content;\n const isLabelPresentInContent = content && typeof content === 'object' && 'label' in content;\n useEffect(() => {\n const observer = new MutationObserver((mutations) => {\n mutations.forEach((mutation) => {\n if (mutation.type === 'childList') {\n const legendWrapper = chartRef.current?.querySelector('.recharts-legend-wrapper');\n if (legendWrapper) {\n const height = legendWrapper.getBoundingClientRect().height;\n const width = legendWrapper.getBoundingClientRect().width;\n setLegendHeight(height);\n setLegendWidth(width);\n }\n }\n });\n });\n\n if (chartRef.current) {\n observer.observe(chartRef.current, { childList: true, subtree: true });\n }\n\n return () => observer.disconnect();\n }, []);\n\n const pieChartRadius: ChartRadius = useMemo(() => {\n if (Array.isArray(children)) {\n const donutChild = children.find((child) => getComponentId(child) === componentId.chartDonut);\n if (!donutChild || !isValidElement(donutChild)) {\n return 'medium';\n }\n return donutChild?.props?.radius || 'medium';\n }\n return 'medium';\n }, [children]);\n\n const legendLayout = useMemo(() => {\n if (Array.isArray(children)) {\n const legendChild = children.find(\n (child) => getComponentId(child) === commonChartComponentId.chartLegend,\n );\n if (!legendChild || !isValidElement(legendChild)) {\n return 'horizontal';\n }\n return legendChild?.props?.layout || 'horizontal';\n }\n return 'horizontal';\n }, [children]);\n\n const legendAlignment = useMemo(() => {\n if (Array.isArray(children)) {\n const legendChild = children.find(\n (child) => getComponentId(child) === commonChartComponentId.chartLegend,\n );\n if (!legendChild || !isValidElement(legendChild)) {\n return 'right';\n }\n return legendChild?.props?.align || 'right';\n }\n return 'right';\n }, [children]);\n\n return (\n <BaseBox\n ref={chartRef}\n {...metaAttribute({ name: 'donut-chart', testID })}\n {...makeAnalyticsAttribute(restProps)}\n width=\"100%\"\n height=\"100%\"\n {...restProps}\n position={isValidElement(content) ? 'relative' : undefined}\n >\n <RechartsResponsiveContainer width=\"100%\" height=\"100%\">\n <RechartsPieChart>\n {children}\n {isLabelPresentInContent && (\n <Label\n position=\"center\"\n fill={theme.colors.surface.text.gray.muted}\n fontSize={\n theme.typography.fonts.size[\n LABEL_FONT_STYLES[pieChartRadius].fontSize\n .label as keyof typeof theme.typography.fonts.size\n ]\n }\n fontFamily={theme.typography.fonts.family.text}\n fontWeight={theme.typography.fonts.weight.medium}\n letterSpacing={theme.typography.letterSpacings[100]}\n dy={\n isValuePresentInContent\n ? LABEL_DISTANCE_FROM_CENTER[pieChartRadius].withText\n : LABEL_DISTANCE_FROM_CENTER[pieChartRadius].normal\n }\n >\n {content?.label}\n </Label>\n )}\n {isValuePresentInContent && (\n <Label\n position=\"center\"\n fill={theme.colors.surface.text.gray.normal}\n fontSize={\n theme.typography.fonts.size[\n LABEL_FONT_STYLES[pieChartRadius].fontSize\n .text as keyof typeof theme.typography.fonts.size\n ]\n }\n fontFamily={theme.typography.fonts.family.heading}\n fontWeight={theme.typography.fonts.weight.bold}\n letterSpacing={theme.typography.letterSpacings[100]}\n dy={\n isLabelPresentInContent\n ? LABEL_DISTANCE_FROM_CENTER[pieChartRadius].withLabel\n : LABEL_DISTANCE_FROM_CENTER[pieChartRadius].normal\n }\n >\n {content?.value}\n </Label>\n )}\n </RechartsPieChart>\n </RechartsResponsiveContainer>\n\n {isValidElement(content) && (\n <BaseBox\n position=\"absolute\"\n top=\"50%\"\n left=\"50%\"\n transform={getTranslate(legendLayout, legendAlignment, legendWidth, legendHeight)}\n zIndex={10}\n textAlign=\"center\"\n >\n {content}\n </BaseBox>\n )}\n </BaseBox>\n );\n};\n\nconst _ChartDonut: React.FC<ChartDonutProps> = ({\n cx = '50%',\n cy = '50%',\n radius = 'medium',\n dataKey,\n nameKey,\n children,\n data,\n colorTheme = 'categorical',\n type = 'circle',\n ...rest\n}) => {\n const radiusConfig = RADIUS_MAPPING[radius];\n const themeColors = useChartsColorTheme({ colorTheme });\n const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);\n const { theme } = useTheme();\n\n const getCellOpacity = (hoveredIndex: number | null, currentIndex: number): number => {\n if (hoveredIndex === null) return 1;\n if (hoveredIndex === currentIndex) return 1;\n return 0.2;\n };\n\n const modifiedChildren = useMemo(() => {\n if (Array.isArray(children)) {\n return children.map((child, index) => {\n if (getComponentId(child) === componentId.cell) {\n /* \n Why we are not using React.cloneElement ? just use ChartDonutCell no?\n cell can never be custom component in recharts. (as of v3.1.2)\n (https://github.com/recharts/recharts/issues/2788)\n https://github.com/recharts/recharts/discussions/5474\n\n So we have placeholder component ChartDonutCell. which we replaced by RechartsCell internally so dev can see hover effects\n working out of box. \n */\n const fill = getIn(theme.colors, child.props.color) || themeColors[index];\n return (\n <RechartsCell\n {...child.props}\n fill={fill}\n key={index}\n opacity={getCellOpacity(hoveredIndex, index)}\n />\n );\n } else {\n return child;\n }\n });\n }\n return data?.map((_, index) => (\n <RechartsCell\n fill={themeColors[index]}\n key={index}\n opacity={getCellOpacity(hoveredIndex, index)}\n />\n ));\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [children, data, colorTheme, hoveredIndex, themeColors]);\n\n return (\n <RechartsPie\n {...rest}\n cx={cx}\n cy={cy}\n outerRadius={radiusConfig.outerRadius}\n innerRadius={radiusConfig.innerRadius}\n data={data}\n startAngle={START_AND_END_ANGLES[type].startAngle}\n endAngle={START_AND_END_ANGLES[type].endAngle}\n onMouseEnter={(data, index) => {\n setHoveredIndex(index);\n }}\n onMouseLeave={() => {\n setHoveredIndex(null);\n }}\n >\n {modifiedChildren}\n </RechartsPie>\n );\n};\n\nconst ChartDonut = assignWithoutSideEffects(_ChartDonut, {\n componentId: componentId.chartDonut,\n});\n\nexport { ChartDonut, ChartDonutWrapper, ChartDonutCell };\n"],"names":["_Cell","_ref","rest","_extends","_objectDestructuringEmpty","_jsx","RechartsCell","_objectSpread","ChartDonutCell","assignWithoutSideEffects","componentId","cell","getTranslate","legendLayout","legendAlignment","legendWidth","legendHeight","concat","ChartDonutWrapper","_ref2","children","content","testID","restProps","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","_useState","useState","_useState2","_slicedToArray","setLegendHeight","_useState3","_useState4","setLegendWidth","chartRef","useRef","isValuePresentInContent","_typeof","isLabelPresentInContent","useEffect","observer","MutationObserver","mutations","forEach","mutation","type","_chartRef$current","legendWrapper","current","querySelector","height","getBoundingClientRect","width","observe","childList","subtree","disconnect","pieChartRadius","useMemo","Array","isArray","_donutChild$props","donutChild","find","child","getComponentId","chartDonut","isValidElement","props","radius","_legendChild$props","legendChild","commonChartComponentId","chartLegend","layout","_legendChild$props2","align","_jsxs","BaseBox","ref","metaAttribute","name","makeAnalyticsAttribute","position","undefined","RechartsResponsiveContainer","RechartsPieChart","Label","fill","colors","surface","text","gray","muted","fontSize","typography","fonts","size","LABEL_FONT_STYLES","label","fontFamily","family","fontWeight","weight","medium","letterSpacing","letterSpacings","dy","LABEL_DISTANCE_FROM_CENTER","withText","normal","heading","bold","withLabel","value","top","left","transform","zIndex","textAlign","_ChartDonut","_ref3","_ref3$cx","cx","_ref3$cy","cy","_ref3$radius","dataKey","nameKey","data","_ref3$colorTheme","colorTheme","_ref3$type","_excluded2","radiusConfig","RADIUS_MAPPING","themeColors","useChartsColorTheme","_useState5","_useState6","hoveredIndex","setHoveredIndex","_useTheme2","getCellOpacity","currentIndex","modifiedChildren","map","index","getIn","color","_createElement","key","opacity","_","RechartsPie","outerRadius","innerRadius","startAngle","START_AND_END_ANGLES","endAngle","onMouseEnter","onMouseLeave","ChartDonut"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAMA,KAAoC,GAAG,SAAvCA,KAAoCA,CAAAC,IAAA,EAAoB;EAAA,IAAXC,IAAI,GAAAC,QAAA,CAAA,EAAA,GAAAC,yBAAA,CAAAH,IAAA,GAAAA,IAAA,EAAA,CAAA;EACrD,oBAAOI,GAAA,CAACC,IAAY,EAAAC,aAAA,CAAKL,EAAAA,EAAAA,IAAI,CAAG,CAAC,CAAA;AACnC,CAAC,CAAA;AAED,IAAMM,cAAc,gBAAGC,wBAAwB,CAACT,KAAK,EAAE;EACrDU,WAAW,EAAEA,WAAW,CAACC,IAAAA;AAC3B,CAAC,EAAC;AAEF,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAChBC,YAAuC,EACvCC,eAAiC,EACjCC,WAAmB,EACnBC,YAAoB,EACT;EACX,IAAIH,YAAY,KAAK,UAAU,EAAE;AAC/B,IAAA,OAAA,wBAAA,CAAAI,MAAA,CACEH,eAAe,KAAK,OAAO,GAAG,CAACC,WAAW,GAAG,CAAC,GAAGA,WAAW,GAAG,CAAC,EAAA,oBAAA,CAAA,CAAA;AAEpE,GAAA;AACA,EAAA,OAAA,8BAAA,CAAAE,MAAA,CAAsCD,YAAY,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}
@@ -0,0 +1,2 @@
1
+ export { ChartDonut, ChartDonutCell, ChartDonutWrapper } from './DonutChart.web.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,78 @@
1
+ var RADIUS_MAPPING = {
2
+ small: {
3
+ outerRadius: 80,
4
+ innerRadius: 52
5
+ },
6
+ medium: {
7
+ outerRadius: 120,
8
+ innerRadius: 80
9
+ },
10
+ large: {
11
+ outerRadius: 162,
12
+ innerRadius: 100
13
+ }
14
+ };
15
+ var START_AND_END_ANGLES = {
16
+ circle: {
17
+ startAngle: 450,
18
+ endAngle: 90
19
+ },
20
+ semicircle: {
21
+ startAngle: 180,
22
+ endAngle: 0
23
+ }
24
+ };
25
+ var componentId = {
26
+ chartDonut: 'chartDonut',
27
+ cell: 'cell'
28
+ };
29
+ var CENTER_TEXT_POSITION = {
30
+ withLegend: {
31
+ x: '50%',
32
+ y: '48%'
33
+ },
34
+ withoutLegend: {
35
+ x: '50%',
36
+ y: '50%'
37
+ }
38
+ };
39
+ var LABEL_DISTANCE_FROM_CENTER = {
40
+ small: {
41
+ normal: 0,
42
+ withText: -14,
43
+ withLabel: 6
44
+ },
45
+ medium: {
46
+ normal: 0,
47
+ withText: -16,
48
+ withLabel: 8
49
+ },
50
+ large: {
51
+ normal: 0,
52
+ withText: -18,
53
+ withLabel: 10
54
+ }
55
+ };
56
+ var LABEL_FONT_STYLES = {
57
+ small: {
58
+ fontSize: {
59
+ label: 75,
60
+ text: 500
61
+ }
62
+ },
63
+ medium: {
64
+ fontSize: {
65
+ label: 100,
66
+ text: 600
67
+ }
68
+ },
69
+ large: {
70
+ fontSize: {
71
+ label: 200,
72
+ text: 700
73
+ }
74
+ }
75
+ };
76
+
77
+ export { CENTER_TEXT_POSITION, LABEL_DISTANCE_FROM_CENTER, LABEL_FONT_STYLES, RADIUS_MAPPING, START_AND_END_ANGLES, componentId };
78
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sources":["../../../../../../../src/components/Charts/DonutChart/tokens.tsx"],"sourcesContent":["const RADIUS_MAPPING = {\n small: { outerRadius: 80, innerRadius: 52 },\n medium: { outerRadius: 120, innerRadius: 80 },\n large: { outerRadius: 162, innerRadius: 100 },\n};\n\nconst START_AND_END_ANGLES = {\n circle: { startAngle: 450, endAngle: 90 },\n semicircle: { startAngle: 180, endAngle: 0 },\n};\n\nconst componentId = {\n chartDonut: 'chartDonut',\n cell: 'cell',\n};\n\nconst CENTER_TEXT_POSITION = {\n withLegend: { x: '50%', y: '48%' },\n withoutLegend: { x: '50%', y: '50%' },\n};\n\nconst LABEL_DISTANCE_FROM_CENTER = {\n small: { normal: 0, withText: -14, withLabel: 6 },\n medium: { normal: 0, withText: -16, withLabel: 8 },\n large: { normal: 0, withText: -18, withLabel: 10 },\n};\n\nconst LABEL_FONT_STYLES = {\n small: { fontSize: { label: 75, text: 500 } },\n medium: { fontSize: { label: 100, text: 600 } },\n large: { fontSize: { label: 200, text: 700 } },\n};\n\nexport {\n RADIUS_MAPPING,\n componentId,\n START_AND_END_ANGLES,\n CENTER_TEXT_POSITION,\n LABEL_DISTANCE_FROM_CENTER,\n LABEL_FONT_STYLES,\n};\n"],"names":["RADIUS_MAPPING","small","outerRadius","innerRadius","medium","large","START_AND_END_ANGLES","circle","startAngle","endAngle","semicircle","componentId","chartDonut","cell","CENTER_TEXT_POSITION","withLegend","x","y","withoutLegend","LABEL_DISTANCE_FROM_CENTER","normal","withText","withLabel","LABEL_FONT_STYLES","fontSize","label","text"],"mappings":"AAAA,IAAMA,cAAc,GAAG;AACrBC,EAAAA,KAAK,EAAE;AAAEC,IAAAA,WAAW,EAAE,EAAE;AAAEC,IAAAA,WAAW,EAAE,EAAA;GAAI;AAC3CC,EAAAA,MAAM,EAAE;AAAEF,IAAAA,WAAW,EAAE,GAAG;AAAEC,IAAAA,WAAW,EAAE,E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;AAAEC,MAAAA,KAAK,EAAE,EAAE;AAAEC,MAAAA,IAAI,EAAE,GAAA;AAAI,KAAA;GAAG;AAC7CtB,EAAAA,MAAM,EAAE;AAAEoB,IAAAA,QAAQ,EAAE;AAAEC,MAAAA,KAAK,EAAE,GAAG;AAAEC,MAAAA,IAAI,EAAE,GAAA;AAAI,KAAA;GAAG;AAC/CrB,EAAAA,KAAK,EAAE;AAAEmB,IAAAA,QAAQ,EAAE;AAAEC,MAAAA,KAAK,EAAE,GAAG;AAAEC,MAAAA,IAAI,EAAE,GAAA;AAAI,KAAA;AAAE,GAAA;AAC/C;;;;"}
@@ -42,7 +42,7 @@ var Line = function Line(_ref) {
42
42
  var _useTheme = useTheme(),
43
43
  theme = _useTheme.theme;
44
44
  var themeColors = useChartsColorTheme({
45
- colorTheme: _colorTheme !== null && _colorTheme !== void 0 ? _colorTheme : 'default'
45
+ colorTheme: _colorTheme
46
46
  });
47
47
  var colorToken = color ? getIn(theme.colors, color) : themeColors[_index !== null && _index !== void 0 ? _index : 0];
48
48
  var strokeDasharray = strokeStyle === 'dashed' ? '5 5' : strokeStyle === 'dotted' ? '2 2' : undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"LineChart.web.js","sources":["../../../../../../../src/components/Charts/LineChart/LineChart.web.tsx"],"sourcesContent":["import React from 'react';\nimport {\n LineChart as RechartsLineChart,\n Line as RechartsLine,\n ResponsiveContainer as RechartsResponsiveContainer,\n} from 'recharts';\nimport { useChartsColorTheme } from '../utils';\nimport type { ChartLineProps, ChartLineWrapperProps } from './types';\nimport { componentIds } from './componentIds';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\n\nconst Line: React.FC<ChartLineProps> = ({\n color,\n strokeStyle = 'solid',\n type = 'monotone',\n dot = false,\n activeDot = true,\n showLegend = true,\n _index,\n _colorTheme,\n ...props\n}) => {\n const { theme } = useTheme();\n const themeColors = useChartsColorTheme({ colorTheme: _colorTheme ?? 'default' });\n const colorToken = color ? getIn(theme.colors, color) : themeColors[_index ?? 0];\n\n const strokeDasharray =\n strokeStyle === 'dashed' ? '5 5' : strokeStyle === 'dotted' ? '2 2' : undefined;\n\n const isLineDotted = strokeStyle === 'dashed';\n const animationBegin = isLineDotted\n ? theme.motion.delay.gentle + theme.motion.duration.xgentle\n : theme.motion.delay.gentle;\n const animationDuration = theme.motion.duration.xgentle;\n\n return (\n <RechartsLine\n stroke={colorToken}\n strokeWidth={3}\n strokeDasharray={strokeDasharray}\n type={type}\n activeDot={activeDot}\n dot={dot}\n legendType={showLegend ? 'line' : 'none'}\n animationBegin={animationBegin}\n animationDuration={animationDuration}\n {...props}\n />\n );\n};\n\nconst ChartLine = assignWithoutSideEffects(Line, {\n componentId: componentIds.ChartLine,\n});\n\n// Main components\nconst ChartLineWrapper: React.FC<ChartLineWrapperProps & TestID & DataAnalyticsAttribute> = ({\n children,\n colorTheme = 'default',\n testID,\n data,\n ...restProps\n}) => {\n const lineChartModifiedChildrens = React.useMemo(() => {\n let LineChartIndex = 0;\n return React.Children.map(children, (child) => {\n if (React.isValidElement(child) && getComponentId(child) === componentIds.ChartLine) {\n return React.cloneElement(child, {\n _index: LineChartIndex++,\n _colorTheme: colorTheme,\n } as Partial<ChartLineProps>);\n }\n return child;\n });\n }, [children, colorTheme]);\n return (\n <BaseBox\n {...metaAttribute({ name: 'line-chart', testID })}\n {...makeAnalyticsAttribute(restProps)}\n width=\"100%\"\n height=\"100%\"\n {...restProps}\n >\n <RechartsResponsiveContainer width=\"100%\" height=\"100%\">\n <RechartsLineChart data={data}>{lineChartModifiedChildrens}</RechartsLineChart>\n </RechartsResponsiveContainer>\n </BaseBox>\n );\n};\n\nexport { ChartLine, ChartLineWrapper };\n"],"names":["Line","_ref","color","_ref$strokeStyle","strokeStyle","_ref$type","type","_ref$dot","dot","_ref$activeDot","activeDot","_ref$showLegend","showLegend","_index","_colorTheme","props","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","themeColors","useChartsColorTheme","colorTheme","colorToken","getIn","colors","strokeDasharray","undefined","isLineDotted","animationBegin","motion","delay","gentle","duration","xgentle","animationDuration","_jsx","RechartsLine","_objectSpread","stroke","strokeWidth","legendType","ChartLine","assignWithoutSideEffects","componentId","componentIds","ChartLineWrapper","_ref2","children","_ref2$colorTheme","testID","data","restProps","_excluded2","lineChartModifiedChildrens","React","useMemo","LineChartIndex","Children","map","child","isValidElement","getComponentId","cloneElement","BaseBox","metaAttribute","name","makeAnalyticsAttribute","width","height","RechartsResponsiveContainer","RechartsLineChart"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAMA,IAA8B,GAAG,SAAjCA,IAA8BA,CAAAC,IAAA,EAU9B;AAAA,EAAA,IATJC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAAC,gBAAA,GAAAF,IAAA,CACLG,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,gBAAA;IAAAE,SAAA,GAAAJ,IAAA,CACrBK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,UAAU,GAAAA,SAAA;IAAAE,QAAA,GAAAN,IAAA,CACjBO,GAAG;AAAHA,IAAAA,GAAG,GAAAD,QAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,QAAA;IAAAE,cAAA,GAAAR,IAAA,CACXS,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,cAAA;IAAAE,eAAA,GAAAV,IAAA,CAChBW,UAAU;AAAVA,IAAAA,UAAU,GAA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6C,cAAc,EAAE;AACxB5C,UAAAA,WAAW,EAAES,UAAAA;AACf,SAA4B,CAAC,CAAA;AAC/B,OAAA;AACA,MAAA,OAAOsC,KAAK,CAAA;AACd,KAAC,CAAC,CAAA;AACJ,GAAC,EAAE,CAACZ,QAAQ,EAAE1B,UAAU,CAAC,CAAC,CAAA;AAC1B,EAAA,oBACEc,GAAA,CAAC4B,OAAO,EAAA1B,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAA,EAAA,EACF2B,aAAa,CAAC;AAAEC,IAAAA,IAAI,EAAE,YAAY;AAAEhB,IAAAA,MAAM,EAANA,MAAAA;AAAO,GAAC,CAAC,CAAA,EAC7CiB,sBAAsB,CAACf,SAAS,CAAC,CAAA,EAAA,EAAA,EAAA;AACrCgB,IAAAA,KAAK,EAAC,MAAM;AACZC,IAAAA,MAAM,EAAC,MAAA;AAAM,GAAA,EACTjB,SAAS,CAAA,EAAA,EAAA,EAAA;IAAAJ,QAAA,eAEbZ,GAAA,CAACkC,mBAA2B,EAAA;AAACF,MAAAA,KAAK,EAAC,MAAM;AAACC,MAAAA,MAAM,EAAC,MAAM;MAAArB,QAAA,eACrDZ,GAAA,CAACmC,SAAiB,EAAA;AAACpB,QAAAA,IAAI,EAAEA,IAAK;AAAAH,QAAAA,QAAA,EAAEM,0BAAAA;OAA8C,CAAA;KACnD,CAAA;AAAC,GAAA,CACvB,CAAC,CAAA;AAEd;;;;"}
1
+ {"version":3,"file":"LineChart.web.js","sources":["../../../../../../../src/components/Charts/LineChart/LineChart.web.tsx"],"sourcesContent":["import React from 'react';\nimport {\n LineChart as RechartsLineChart,\n Line as RechartsLine,\n ResponsiveContainer as RechartsResponsiveContainer,\n} from 'recharts';\nimport { useChartsColorTheme } from '../utils';\nimport type { ChartLineProps, ChartLineWrapperProps } from './types';\nimport { componentIds } from './componentIds';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport { useTheme } from '~components/BladeProvider';\nimport BaseBox from '~components/Box/BaseBox';\nimport getIn from '~utils/lodashButBetter/get';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\n\nconst Line: React.FC<ChartLineProps> = ({\n color,\n strokeStyle = 'solid',\n type = 'monotone',\n dot = false,\n activeDot = true,\n showLegend = true,\n _index,\n _colorTheme,\n ...props\n}) => {\n const { theme } = useTheme();\n const themeColors = useChartsColorTheme({ colorTheme: _colorTheme });\n const colorToken = color ? getIn(theme.colors, color) : themeColors[_index ?? 0];\n\n const strokeDasharray =\n strokeStyle === 'dashed' ? '5 5' : strokeStyle === 'dotted' ? '2 2' : undefined;\n\n const isLineDotted = strokeStyle === 'dashed';\n const animationBegin = isLineDotted\n ? theme.motion.delay.gentle + theme.motion.duration.xgentle\n : theme.motion.delay.gentle;\n const animationDuration = theme.motion.duration.xgentle;\n\n return (\n <RechartsLine\n stroke={colorToken}\n strokeWidth={3}\n strokeDasharray={strokeDasharray}\n type={type}\n activeDot={activeDot}\n dot={dot}\n legendType={showLegend ? 'line' : 'none'}\n animationBegin={animationBegin}\n animationDuration={animationDuration}\n {...props}\n />\n );\n};\n\nconst ChartLine = assignWithoutSideEffects(Line, {\n componentId: componentIds.ChartLine,\n});\n\n// Main components\nconst ChartLineWrapper: React.FC<ChartLineWrapperProps & TestID & DataAnalyticsAttribute> = ({\n children,\n colorTheme = 'default',\n testID,\n data,\n ...restProps\n}) => {\n const lineChartModifiedChildrens = React.useMemo(() => {\n let LineChartIndex = 0;\n return React.Children.map(children, (child) => {\n if (React.isValidElement(child) && getComponentId(child) === componentIds.ChartLine) {\n return React.cloneElement(child, {\n _index: LineChartIndex++,\n _colorTheme: colorTheme,\n } as Partial<ChartLineProps>);\n }\n return child;\n });\n }, [children, colorTheme]);\n return (\n <BaseBox\n {...metaAttribute({ name: 'line-chart', testID })}\n {...makeAnalyticsAttribute(restProps)}\n width=\"100%\"\n height=\"100%\"\n {...restProps}\n >\n <RechartsResponsiveContainer width=\"100%\" height=\"100%\">\n <RechartsLineChart data={data}>{lineChartModifiedChildrens}</RechartsLineChart>\n </RechartsResponsiveContainer>\n </BaseBox>\n );\n};\n\nexport { ChartLine, ChartLineWrapper };\n"],"names":["Line","_ref","color","_ref$strokeStyle","strokeStyle","_ref$type","type","_ref$dot","dot","_ref$activeDot","activeDot","_ref$showLegend","showLegend","_index","_colorTheme","props","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","themeColors","useChartsColorTheme","colorTheme","colorToken","getIn","colors","strokeDasharray","undefined","isLineDotted","animationBegin","motion","delay","gentle","duration","xgentle","animationDuration","_jsx","RechartsLine","_objectSpread","stroke","strokeWidth","legendType","ChartLine","assignWithoutSideEffects","componentId","componentIds","ChartLineWrapper","_ref2","children","_ref2$colorTheme","testID","data","restProps","_excluded2","lineChartModifiedChildrens","React","useMemo","LineChartIndex","Children","map","child","isValidElement","getComponentId","cloneElement","BaseBox","metaAttribute","name","makeAnalyticsAttribute","width","height","RechartsResponsiveContainer","RechartsLineChart"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAMA,IAA8B,GAAG,SAAjCA,IAA8BA,CAAAC,IAAA,EAU9B;AAAA,EAAA,IATJC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAAC,gBAAA,GAAAF,IAAA,CACLG,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,OAAO,GAAAA,gBAAA;IAAAE,SAAA,GAAAJ,IAAA,CACrBK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,UAAU,GAAAA,SAAA;IAAAE,QAAA,GAAAN,IAAA,CACjBO,GAAG;AAAHA,IAAAA,GAAG,GAAAD,QAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,QAAA;IAAAE,cAAA,GAA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ACH,SAAS,EAAE;AACnF,QAAA,oBAAOa,cAAK,CAACQ,YAAY,CAACH,KAAK,EAAE;UAC/BhD,MAAM,EAAE6C,cAAc,EAAE;AACxB5C,UAAAA,WAAW,EAAES,UAAAA;AACf,SAA4B,CAAC,CAAA;AAC/B,OAAA;AACA,MAAA,OAAOsC,KAAK,CAAA;AACd,KAAC,CAAC,CAAA;AACJ,GAAC,EAAE,CAACZ,QAAQ,EAAE1B,UAAU,CAAC,CAAC,CAAA;AAC1B,EAAA,oBACEc,GAAA,CAAC4B,OAAO,EAAA1B,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAAA,aAAA,CAAA,EAAA,EACF2B,aAAa,CAAC;AAAEC,IAAAA,IAAI,EAAE,YAAY;AAAEhB,IAAAA,MAAM,EAANA,MAAAA;AAAO,GAAC,CAAC,CAAA,EAC7CiB,sBAAsB,CAACf,SAAS,CAAC,CAAA,EAAA,EAAA,EAAA;AACrCgB,IAAAA,KAAK,EAAC,MAAM;AACZC,IAAAA,MAAM,EAAC,MAAA;AAAM,GAAA,EACTjB,SAAS,CAAA,EAAA,EAAA,EAAA;IAAAJ,QAAA,eAEbZ,GAAA,CAACkC,mBAA2B,EAAA;AAACF,MAAAA,KAAK,EAAC,MAAM;AAACC,MAAAA,MAAM,EAAC,MAAM;MAAArB,QAAA,eACrDZ,GAAA,CAACmC,SAAiB,EAAA;AAACpB,QAAAA,IAAI,EAAEA,IAAK;AAAAH,QAAAA,QAAA,EAAEM,0BAAAA;OAA8C,CAAA;KACnD,CAAA;AAAC,GAAA,CACvB,CAAC,CAAA;AAEd;;;;"}
@@ -1,5 +1,6 @@
1
1
  import './LineChart/index.js';
2
2
  import './AreaChart/index.js';
3
+ import './DonutChart/index.js';
3
4
  import './BarChart/index.js';
4
5
  import './CommonChartComponents/index.js';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,18 +1,26 @@
1
1
  import '../../BladeProvider/index.js';
2
2
  import useTheme from '../../BladeProvider/useTheme.js';
3
3
 
4
+ /**
5
+ * The color theme of the chart.
6
+ * @default 'categorical'
7
+ * @description The color theme of the chart.
8
+ *
9
+ */
10
+
4
11
  var useChartsColorTheme = function useChartsColorTheme(_ref) {
5
12
  var _ref$colorTheme = _ref.colorTheme,
6
- colorTheme = _ref$colorTheme === void 0 ? 'default' : _ref$colorTheme;
13
+ colorTheme = _ref$colorTheme === void 0 ? 'categorical' : _ref$colorTheme;
7
14
  var _useTheme = useTheme(),
8
15
  theme = _useTheme.theme;
9
- var defaultColorThemeArray = [theme.colors.chart.background.categorical.azure.subtle, theme.colors.chart.background.categorical.topaz.moderate, theme.colors.chart.background.categorical.orchid.moderate, theme.colors.chart.background.categorical.emerald.subtle, theme.colors.chart.background.categorical.cider.moderate, theme.colors.chart.background.categorical.sapphire.moderate, theme.colors.chart.background.categorical.magenta.moderate, theme.colors.chart.background.categorical.crimson.subtle, theme.colors.chart.background.categorical.azure.intense, theme.colors.chart.background.categorical.topaz.intense, theme.colors.chart.background.categorical.orchid.intense, theme.colors.chart.background.categorical.emerald.intense, theme.colors.chart.background.categorical.sapphire.intense, theme.colors.chart.background.categorical.magenta.intense, theme.colors.chart.background.categorical.cider.intense, theme.colors.chart.background.categorical.crimson.intense];
10
- if (colorTheme !== 'default') {
11
- console.log('Currently we only support default color theme');
16
+ var categoricalColorThemeArray = [theme.colors.chart.background.categorical.azure.subtle, theme.colors.chart.background.categorical.topaz.moderate, theme.colors.chart.background.categorical.orchid.moderate, theme.colors.chart.background.categorical.emerald.subtle, theme.colors.chart.background.categorical.cider.moderate, theme.colors.chart.background.categorical.sapphire.moderate, theme.colors.chart.background.categorical.magenta.moderate, theme.colors.chart.background.categorical.crimson.subtle, theme.colors.chart.background.categorical.azure.intense, theme.colors.chart.background.categorical.topaz.intense, theme.colors.chart.background.categorical.orchid.intense, theme.colors.chart.background.categorical.emerald.intense, theme.colors.chart.background.categorical.sapphire.intense, theme.colors.chart.background.categorical.magenta.intense, theme.colors.chart.background.categorical.cider.intense, theme.colors.chart.background.categorical.crimson.intense];
17
+ if (colorTheme !== 'categorical') {
18
+ console.log("".concat(colorTheme, " is not supported. Blade only supports 'categorical' color theme"));
12
19
  }
20
+
13
21
  //TODO:Currently we only have one color theme will add more color theme later.
14
22
 
15
- return defaultColorThemeArray;
23
+ return categoricalColorThemeArray;
16
24
  };
17
25
 
18
26
  export { useChartsColorTheme as default };
@@ -1 +1 @@
1
- {"version":3,"file":"useColorTheme.js","sources":["../../../../../../../src/components/Charts/utils/useColorTheme.tsx"],"sourcesContent":["import { useTheme } from '~components/BladeProvider';\n\nexport type colorTheme = 'default';\n\nconst useChartsColorTheme = ({ colorTheme = 'default' }: { colorTheme: colorTheme }): string[] => {\n const { theme } = useTheme();\n const defaultColorThemeArray = [\n theme.colors.chart.background.categorical.azure.subtle,\n theme.colors.chart.background.categorical.topaz.moderate,\n theme.colors.chart.background.categorical.orchid.moderate,\n theme.colors.chart.background.categorical.emerald.subtle,\n theme.colors.chart.background.categorical.cider.moderate,\n theme.colors.chart.background.categorical.sapphire.moderate,\n theme.colors.chart.background.categorical.magenta.moderate,\n theme.colors.chart.background.categorical.crimson.subtle,\n theme.colors.chart.background.categorical.azure.intense,\n theme.colors.chart.background.categorical.topaz.intense,\n theme.colors.chart.background.categorical.orchid.intense,\n theme.colors.chart.background.categorical.emerald.intense,\n theme.colors.chart.background.categorical.sapphire.intense,\n theme.colors.chart.background.categorical.magenta.intense,\n theme.colors.chart.background.categorical.cider.intense,\n theme.colors.chart.background.categorical.crimson.intense,\n ];\n\n if (colorTheme !== 'default') {\n console.log('Currently we only support default color theme');\n }\n //TODO:Currently we only have one color theme will add more color theme later.\n\n return defaultColorThemeArray;\n};\n\nexport default useChartsColorTheme;\n"],"names":["useChartsColorTheme","_ref","_ref$colorTheme","colorTheme","_useTheme","useTheme","theme","defaultColorThemeArray","colors","chart","background","categorical","azure","subtle","topaz","moderate","orchid","emerald","cider","sapphire","magenta","crimson","intense","console","log"],"mappings":";;;AAIA,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,EAAyE;AAAA,EAAA,IAAAC,eAAA,GAAAD,IAAA,CAAnEE,UAAU;AAAVA,IAAAA,UAAU,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,SAAS,GAAAA,eAAA,CAAA;AACnD,EAAA,IAAAE,SAAA,GAAkBC,QAAQ,EAAE;IAApBC,KAAK,GAAAF,SAAA,CAALE,KAAK,CAAA;EACb,IAAMC,sBAAsB,GAAG,CAC7BD,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACC,KAAK,CAACC,MAAM,EACtDP,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACG,KAAK,CAACC,QAAQ,EACxDT,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACK,MAAM,CAACD,QAAQ,EACzDT,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACM,OAAO,CAACJ,MAAM,EACxDP,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACO,KAAK,CAACH,QAAQ,EACxDT,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACQ,QAAQ,CAACJ,QAAQ,EAC3DT,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACS,OAAO,CAACL,QAAQ,EAC1DT,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACU,OAAO,CAACR,MAAM,EACxDP,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACC,KAAK,CAACU,OAAO,EACvDhB,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACG,KAAK,CAACQ,OAAO,EACvDhB,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACK,MAAM,CAACM,OAAO,EACxDhB,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACM,OAAO,CAACK,OAAO,EACzDhB,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACQ,QAAQ,CAACG,OAAO,EAC1DhB,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACS,OAAO,CAACE,OAAO,EACzDhB,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACO,KAAK,CAACI,OAAO,EACvDhB,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACU,OAAO,CAACC,OAAO,CAC1D,CAAA;EAED,IAAInB,UAAU,KAAK,SAAS,EAAE;AAC5BoB,IAAAA,OAAO,CAACC,GAAG,CAAC,+CAA+C,CAAC,CAAA;AAC9D,GAAA;AACA;;AAEA,EAAA,OAAOjB,sBAAsB,CAAA;AAC/B;;;;"}
1
+ {"version":3,"file":"useColorTheme.js","sources":["../../../../../../../src/components/Charts/utils/useColorTheme.tsx"],"sourcesContent":["import { useTheme } from '~components/BladeProvider';\n/**\n * The color theme of the chart.\n * @default 'categorical'\n * @description The color theme of the chart.\n *\n */\nexport type ColorTheme = 'categorical';\n\nconst useChartsColorTheme = ({\n colorTheme = 'categorical',\n}: {\n colorTheme?: ColorTheme;\n}): string[] => {\n const { theme } = useTheme();\n const categoricalColorThemeArray = [\n theme.colors.chart.background.categorical.azure.subtle,\n theme.colors.chart.background.categorical.topaz.moderate,\n theme.colors.chart.background.categorical.orchid.moderate,\n theme.colors.chart.background.categorical.emerald.subtle,\n theme.colors.chart.background.categorical.cider.moderate,\n theme.colors.chart.background.categorical.sapphire.moderate,\n theme.colors.chart.background.categorical.magenta.moderate,\n theme.colors.chart.background.categorical.crimson.subtle,\n theme.colors.chart.background.categorical.azure.intense,\n theme.colors.chart.background.categorical.topaz.intense,\n theme.colors.chart.background.categorical.orchid.intense,\n theme.colors.chart.background.categorical.emerald.intense,\n theme.colors.chart.background.categorical.sapphire.intense,\n theme.colors.chart.background.categorical.magenta.intense,\n theme.colors.chart.background.categorical.cider.intense,\n theme.colors.chart.background.categorical.crimson.intense,\n ];\n\n if (colorTheme !== 'categorical') {\n console.log(`${colorTheme} is not supported. Blade only supports 'categorical' color theme`);\n }\n\n //TODO:Currently we only have one color theme will add more color theme later.\n\n return categoricalColorThemeArray;\n};\n\nexport default useChartsColorTheme;\n"],"names":["useChartsColorTheme","_ref","_ref$colorTheme","colorTheme","_useTheme","useTheme","theme","categoricalColorThemeArray","colors","chart","background","categorical","azure","subtle","topaz","moderate","orchid","emerald","cider","sapphire","magenta","crimson","intense","console","log","concat"],"mappings":";;;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,EAIT;AAAA,EAAA,IAAAC,eAAA,GAAAD,IAAA,CAHdE,UAAU;AAAVA,IAAAA,UAAU,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,aAAa,GAAAA,eAAA,CAAA;AAI1B,EAAA,IAAAE,SAAA,GAAkBC,QAAQ,EAAE;IAApBC,KAAK,GAAAF,SAAA,CAALE,KAAK,CAAA;EACb,IAAMC,0BAA0B,GAAG,CACjCD,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACC,KAAK,CAACC,MAAM,EACtDP,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACG,KAAK,CAACC,QAAQ,EACxDT,KAAK,CAACE,MAAM,CAACC,KAAK,CAACC,UAAU,CAACC,WAAW,CAACK,MAAM,CAACD,QAAQ,EACzDT,KA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,CAAItB,UAAU,sEAAmE,CAAC,CAAA;AAC/F,GAAA;;AAEA;;AAEA,EAAA,OAAOI,0BAA0B,CAAA;AACnC;;;;"}
@@ -110,6 +110,7 @@ export { CheckboxGroup } from './Checkbox/CheckboxGroup/CheckboxGroup.js';
110
110
  export { ChatMessage } from './ChatMessage/ChatMessage.web.js';
111
111
  export { ChartLine, ChartLineWrapper } from './Charts/LineChart/LineChart.web.js';
112
112
  export { ChartArea, ChartAreaWrapper } from './Charts/AreaChart/AreaChart.web.js';
113
+ export { ChartDonut, ChartDonutCell, ChartDonutWrapper } from './Charts/DonutChart/DonutChart.web.js';
113
114
  export { ChartBar, ChartBarWrapper } from './Charts/BarChart/BarChart.web.js';
114
115
  export { ChartCartesianGrid, ChartLegend, ChartReferenceLine, ChartTooltip, ChartXAxis, ChartYAxis } from './Charts/CommonChartComponents/CommonChartComponents.web.js';
115
116
  export { Chip } from './Chip/Chip.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -470,7 +470,7 @@ var colors = {
470
470
  emerald: {
471
471
  faint: colors$1.chromatic.emerald[50],
472
472
  subtle: colors$1.chromatic.emerald[200],
473
- moderate: colors$1.chromatic.emerald[500],
473
+ moderate: colors$1.chromatic.emerald[600],
474
474
  intense: colors$1.chromatic.emerald[600],
475
475
  strong: colors$1.chromatic.emerald[800]
476
476
  },
@@ -482,45 +482,45 @@ var colors = {
482
482
  strong: colors$1.chromatic.crimson[800]
483
483
  },
484
484
  cider: {
485
- subtle: colors$1.chromatic.cider[50],
486
- moderate: colors$1.chromatic.cider[200],
485
+ faint: colors$1.chromatic.cider[50],
486
+ subtle: colors$1.chromatic.cider[200],
487
+ moderate: colors$1.chromatic.cider[600],
487
488
  intense: colors$1.chromatic.cider[600],
488
- faint: colors$1.chromatic.cider[600],
489
489
  strong: colors$1.chromatic.cider[800]
490
490
  },
491
491
  sapphire: {
492
- subtle: colors$1.chromatic.sapphire[50],
493
- moderate: colors$1.chromatic.sapphire[200],
492
+ faint: colors$1.chromatic.sapphire[50],
493
+ subtle: colors$1.chromatic.sapphire[200],
494
+ moderate: colors$1.chromatic.sapphire[600],
494
495
  intense: colors$1.chromatic.sapphire[600],
495
- faint: colors$1.chromatic.sapphire[600],
496
496
  strong: colors$1.chromatic.sapphire[800]
497
497
  },
498
498
  orchid: {
499
- subtle: colors$1.chromatic.orchid[50],
500
- moderate: colors$1.chromatic.orchid[200],
501
- intense: colors$1.chromatic.orchid[500],
502
- faint: colors$1.chromatic.orchid[600],
499
+ faint: colors$1.chromatic.orchid[50],
500
+ subtle: colors$1.chromatic.orchid[200],
501
+ moderate: colors$1.chromatic.orchid[600],
502
+ intense: colors$1.chromatic.orchid[600],
503
503
  strong: colors$1.chromatic.orchid[800]
504
504
  },
505
505
  magenta: {
506
- subtle: colors$1.chromatic.magenta[50],
507
- moderate: colors$1.chromatic.magenta[200],
506
+ faint: colors$1.chromatic.magenta[50],
507
+ subtle: colors$1.chromatic.magenta[200],
508
+ moderate: colors$1.chromatic.magenta[600],
508
509
  intense: colors$1.chromatic.magenta[600],
509
- faint: colors$1.chromatic.magenta[600],
510
510
  strong: colors$1.chromatic.magenta[800]
511
511
  },
512
512
  topaz: {
513
- subtle: colors$1.chromatic.topaz[50],
514
- moderate: colors$1.chromatic.topaz[200],
515
- intense: colors$1.chromatic.topaz[500],
516
- faint: colors$1.chromatic.topaz[600],
513
+ faint: colors$1.chromatic.topaz[50],
514
+ subtle: colors$1.chromatic.topaz[200],
515
+ moderate: colors$1.chromatic.topaz[600],
516
+ intense: colors$1.chromatic.topaz[600],
517
517
  strong: colors$1.chromatic.topaz[800]
518
518
  },
519
519
  gray: {
520
- subtle: colors$1.neutral.blueGrayDark.a50,
521
- moderate: colors$1.neutral.blueGrayDark[100],
522
- intense: colors$1.neutral.blueGrayDark[300],
523
- faint: colors$1.neutral.blueGrayDark[500],
520
+ faint: colors$1.neutral.blueGrayDark.a50,
521
+ subtle: colors$1.neutral.blueGrayDark[100],
522
+ moderate: colors$1.neutral.blueGrayDark[300],
523
+ intense: colors$1.neutral.blueGrayDark[500],
524
524
  strong: colors$1.neutral.blueGrayDark[700]
525
525
  }
526
526
  },