@razorpay/blade 12.63.0 → 12.65.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 (204) hide show
  1. package/build/lib/native/components/Badge/Badge.js +1 -1
  2. package/build/lib/native/components/Badge/Badge.js.map +1 -1
  3. package/build/lib/native/components/Badge/badgeTokens.js +1 -1
  4. package/build/lib/native/components/Badge/badgeTokens.js.map +1 -1
  5. package/build/lib/native/components/Charts/CommonChartComponents/CommonChartComponentsContext.js +6 -0
  6. package/build/lib/native/components/Charts/CommonChartComponents/CommonChartComponentsContext.js.map +1 -0
  7. package/build/lib/native/components/Charts/CommonChartComponents/tokens.js +4 -0
  8. package/build/lib/native/components/Charts/CommonChartComponents/tokens.js.map +1 -0
  9. package/build/lib/native/components/Form/CharacterCounter/CharacterCounter.js.map +1 -1
  10. package/build/lib/native/components/Input/BaseInput/BaseInput.js.map +1 -1
  11. package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js +1 -1
  12. package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  13. package/build/lib/native/components/Input/BaseInput/baseInputTokens.js +1 -1
  14. package/build/lib/native/components/Input/BaseInput/baseInputTokens.js.map +1 -1
  15. package/build/lib/native/components/QuickFilters/QuickFilter.js +1 -1
  16. package/build/lib/native/components/QuickFilters/QuickFilter.js.map +1 -1
  17. package/build/lib/native/components/Radio/Radio.js +1 -1
  18. package/build/lib/native/components/Radio/Radio.js.map +1 -1
  19. package/build/lib/native/components/Table/TableContext.js +1 -1
  20. package/build/lib/native/components/Table/TableContext.js.map +1 -1
  21. package/build/lib/native/components/Table/tokens.js +1 -1
  22. package/build/lib/native/components/Table/tokens.js.map +1 -1
  23. package/build/lib/native/components/index.js +2 -0
  24. package/build/lib/native/components/index.js.map +1 -1
  25. package/build/lib/native/tokens/global/colors.js +1 -1
  26. package/build/lib/native/tokens/global/colors.js.map +1 -1
  27. package/build/lib/native/tokens/global/size.js +1 -1
  28. package/build/lib/native/tokens/global/size.js.map +1 -1
  29. package/build/lib/native/tokens/theme/bladeTheme.js +1 -1
  30. package/build/lib/native/tokens/theme/bladeTheme.js.map +1 -1
  31. package/build/lib/native/tokens/theme/theme.js.map +1 -1
  32. package/build/lib/web/development/components/Badge/Badge.js +4 -0
  33. package/build/lib/web/development/components/Badge/Badge.js.map +1 -1
  34. package/build/lib/web/development/components/Badge/badgeTokens.js +4 -0
  35. package/build/lib/web/development/components/Badge/badgeTokens.js.map +1 -1
  36. package/build/lib/web/development/components/Charts/AreaChart/AreaChart.web.js +140 -38
  37. package/build/lib/web/development/components/Charts/AreaChart/AreaChart.web.js.map +1 -1
  38. package/build/lib/web/development/components/Charts/BarChart/BarChart.web.js +121 -57
  39. package/build/lib/web/development/components/Charts/BarChart/BarChart.web.js.map +1 -1
  40. package/build/lib/web/development/components/Charts/CommonChartComponents/CommonChartComponents.web.js +145 -92
  41. package/build/lib/web/development/components/Charts/CommonChartComponents/CommonChartComponents.web.js.map +1 -1
  42. package/build/lib/web/development/components/Charts/CommonChartComponents/CommonChartComponentsContext.js +15 -0
  43. package/build/lib/web/development/components/Charts/CommonChartComponents/CommonChartComponentsContext.js.map +1 -0
  44. package/build/lib/web/development/components/Charts/CommonChartComponents/index.js +2 -0
  45. package/build/lib/web/development/components/Charts/CommonChartComponents/index.js.map +1 -1
  46. package/build/lib/web/development/components/Charts/CommonChartComponents/tokens.js +2 -1
  47. package/build/lib/web/development/components/Charts/CommonChartComponents/tokens.js.map +1 -1
  48. package/build/lib/web/development/components/Charts/DonutChart/DonutChart.web.js +202 -69
  49. package/build/lib/web/development/components/Charts/DonutChart/DonutChart.web.js.map +1 -1
  50. package/build/lib/web/development/components/Charts/LineChart/LineChart.web.js +84 -32
  51. package/build/lib/web/development/components/Charts/LineChart/LineChart.web.js.map +1 -1
  52. package/build/lib/web/development/components/Charts/utils/assignDataColorMapping/assignDataColorMapping.js +33 -0
  53. package/build/lib/web/development/components/Charts/utils/assignDataColorMapping/assignDataColorMapping.js.map +1 -0
  54. package/build/lib/web/development/components/Charts/utils/assignDataColorMapping/index.js +2 -0
  55. package/build/lib/web/development/components/Charts/utils/assignDataColorMapping/index.js.map +1 -0
  56. package/build/lib/web/development/components/Charts/utils/getHighestColorInRange.js +53 -0
  57. package/build/lib/web/development/components/Charts/utils/getHighestColorInRange.js.map +1 -0
  58. package/build/lib/web/development/components/Charts/utils/index.js +5 -0
  59. package/build/lib/web/development/components/Charts/utils/index.js.map +1 -1
  60. package/build/lib/web/development/components/Charts/utils/isSequentialColor.js +35 -0
  61. package/build/lib/web/development/components/Charts/utils/isSequentialColor.js.map +1 -0
  62. package/build/lib/web/development/components/Charts/utils/sanitizeString/index.js +2 -0
  63. package/build/lib/web/development/components/Charts/utils/sanitizeString/index.js.map +1 -0
  64. package/build/lib/web/development/components/Charts/utils/sanitizeString/sanitizeString.js +30 -0
  65. package/build/lib/web/development/components/Charts/utils/sanitizeString/sanitizeString.js.map +1 -0
  66. package/build/lib/web/development/components/Charts/utils/tokens.js +7 -0
  67. package/build/lib/web/development/components/Charts/utils/tokens.js.map +1 -0
  68. package/build/lib/web/development/components/Charts/utils/useColorTheme.js +32 -11
  69. package/build/lib/web/development/components/Charts/utils/useColorTheme.js.map +1 -1
  70. package/build/lib/web/development/components/Dropdown/FilterChipGroup.web.js +3 -1
  71. package/build/lib/web/development/components/Dropdown/FilterChipGroup.web.js.map +1 -1
  72. package/build/lib/web/development/components/FilterChip/BaseFilterChip.web.js +8 -9
  73. package/build/lib/web/development/components/FilterChip/BaseFilterChip.web.js.map +1 -1
  74. package/build/lib/web/development/components/FilterChip/tokens.js +1 -1
  75. package/build/lib/web/development/components/FilterChip/tokens.js.map +1 -1
  76. package/build/lib/web/development/components/Form/CharacterCounter/CharacterCounter.js.map +1 -1
  77. package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
  78. package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js +2 -0
  79. package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  80. package/build/lib/web/development/components/Input/BaseInput/baseInputTokens.js +11 -0
  81. package/build/lib/web/development/components/Input/BaseInput/baseInputTokens.js.map +1 -1
  82. package/build/lib/web/development/components/Input/PhoneNumberInput/CountrySelector.web.js +1 -0
  83. package/build/lib/web/development/components/Input/PhoneNumberInput/CountrySelector.web.js.map +1 -1
  84. package/build/lib/web/development/components/ListView/ListViewFilters.web.js +13 -102
  85. package/build/lib/web/development/components/ListView/ListViewFilters.web.js.map +1 -1
  86. package/build/lib/web/development/components/QuickFilters/QuickFilter.js +2 -1
  87. package/build/lib/web/development/components/QuickFilters/QuickFilter.js.map +1 -1
  88. package/build/lib/web/development/components/Radio/Radio.js +4 -2
  89. package/build/lib/web/development/components/Radio/Radio.js.map +1 -1
  90. package/build/lib/web/development/components/Table/Table.web.js +3 -1
  91. package/build/lib/web/development/components/Table/Table.web.js.map +1 -1
  92. package/build/lib/web/development/components/Table/TableBody.web.js +2 -1
  93. package/build/lib/web/development/components/Table/TableBody.web.js.map +1 -1
  94. package/build/lib/web/development/components/Table/TableContext.js +2 -1
  95. package/build/lib/web/development/components/Table/TableContext.js.map +1 -1
  96. package/build/lib/web/development/components/Table/TableFooter.web.js +2 -1
  97. package/build/lib/web/development/components/Table/TableFooter.web.js.map +1 -1
  98. package/build/lib/web/development/components/Table/TableHeader.web.js +78 -68
  99. package/build/lib/web/development/components/Table/TableHeader.web.js.map +1 -1
  100. package/build/lib/web/development/components/Table/TablePagination.web.js +5 -2
  101. package/build/lib/web/development/components/Table/TablePagination.web.js.map +1 -1
  102. package/build/lib/web/development/components/Table/TableToolbar.web.js +15 -13
  103. package/build/lib/web/development/components/Table/TableToolbar.web.js.map +1 -1
  104. package/build/lib/web/development/components/Table/tokens.js +11 -8
  105. package/build/lib/web/development/components/Table/tokens.js.map +1 -1
  106. package/build/lib/web/development/components/index.js +2 -0
  107. package/build/lib/web/development/components/index.js.map +1 -1
  108. package/build/lib/web/development/tokens/global/colors.js +48 -48
  109. package/build/lib/web/development/tokens/global/colors.js.map +1 -1
  110. package/build/lib/web/development/tokens/global/size.js +2 -0
  111. package/build/lib/web/development/tokens/global/size.js.map +1 -1
  112. package/build/lib/web/development/tokens/theme/bladeTheme.js +139 -111
  113. package/build/lib/web/development/tokens/theme/bladeTheme.js.map +1 -1
  114. package/build/lib/web/development/tokens/theme/theme.js.map +1 -1
  115. package/build/lib/web/production/components/Badge/Badge.js +4 -0
  116. package/build/lib/web/production/components/Badge/Badge.js.map +1 -1
  117. package/build/lib/web/production/components/Badge/badgeTokens.js +4 -0
  118. package/build/lib/web/production/components/Badge/badgeTokens.js.map +1 -1
  119. package/build/lib/web/production/components/Charts/AreaChart/AreaChart.web.js +140 -38
  120. package/build/lib/web/production/components/Charts/AreaChart/AreaChart.web.js.map +1 -1
  121. package/build/lib/web/production/components/Charts/BarChart/BarChart.web.js +121 -57
  122. package/build/lib/web/production/components/Charts/BarChart/BarChart.web.js.map +1 -1
  123. package/build/lib/web/production/components/Charts/CommonChartComponents/CommonChartComponents.web.js +145 -92
  124. package/build/lib/web/production/components/Charts/CommonChartComponents/CommonChartComponents.web.js.map +1 -1
  125. package/build/lib/web/production/components/Charts/CommonChartComponents/CommonChartComponentsContext.js +15 -0
  126. package/build/lib/web/production/components/Charts/CommonChartComponents/CommonChartComponentsContext.js.map +1 -0
  127. package/build/lib/web/production/components/Charts/CommonChartComponents/index.js +2 -0
  128. package/build/lib/web/production/components/Charts/CommonChartComponents/index.js.map +1 -1
  129. package/build/lib/web/production/components/Charts/CommonChartComponents/tokens.js +2 -1
  130. package/build/lib/web/production/components/Charts/CommonChartComponents/tokens.js.map +1 -1
  131. package/build/lib/web/production/components/Charts/DonutChart/DonutChart.web.js +202 -69
  132. package/build/lib/web/production/components/Charts/DonutChart/DonutChart.web.js.map +1 -1
  133. package/build/lib/web/production/components/Charts/LineChart/LineChart.web.js +84 -32
  134. package/build/lib/web/production/components/Charts/LineChart/LineChart.web.js.map +1 -1
  135. package/build/lib/web/production/components/Charts/utils/assignDataColorMapping/assignDataColorMapping.js +33 -0
  136. package/build/lib/web/production/components/Charts/utils/assignDataColorMapping/assignDataColorMapping.js.map +1 -0
  137. package/build/lib/web/production/components/Charts/utils/assignDataColorMapping/index.js +2 -0
  138. package/build/lib/web/production/components/Charts/utils/assignDataColorMapping/index.js.map +1 -0
  139. package/build/lib/web/production/components/Charts/utils/getHighestColorInRange.js +53 -0
  140. package/build/lib/web/production/components/Charts/utils/getHighestColorInRange.js.map +1 -0
  141. package/build/lib/web/production/components/Charts/utils/index.js +5 -0
  142. package/build/lib/web/production/components/Charts/utils/index.js.map +1 -1
  143. package/build/lib/web/production/components/Charts/utils/isSequentialColor.js +35 -0
  144. package/build/lib/web/production/components/Charts/utils/isSequentialColor.js.map +1 -0
  145. package/build/lib/web/production/components/Charts/utils/sanitizeString/index.js +2 -0
  146. package/build/lib/web/production/components/Charts/utils/sanitizeString/index.js.map +1 -0
  147. package/build/lib/web/production/components/Charts/utils/sanitizeString/sanitizeString.js +30 -0
  148. package/build/lib/web/production/components/Charts/utils/sanitizeString/sanitizeString.js.map +1 -0
  149. package/build/lib/web/production/components/Charts/utils/tokens.js +7 -0
  150. package/build/lib/web/production/components/Charts/utils/tokens.js.map +1 -0
  151. package/build/lib/web/production/components/Charts/utils/useColorTheme.js +32 -11
  152. package/build/lib/web/production/components/Charts/utils/useColorTheme.js.map +1 -1
  153. package/build/lib/web/production/components/Dropdown/FilterChipGroup.web.js +3 -1
  154. package/build/lib/web/production/components/Dropdown/FilterChipGroup.web.js.map +1 -1
  155. package/build/lib/web/production/components/FilterChip/BaseFilterChip.web.js +8 -9
  156. package/build/lib/web/production/components/FilterChip/BaseFilterChip.web.js.map +1 -1
  157. package/build/lib/web/production/components/FilterChip/tokens.js +1 -1
  158. package/build/lib/web/production/components/FilterChip/tokens.js.map +1 -1
  159. package/build/lib/web/production/components/Form/CharacterCounter/CharacterCounter.js.map +1 -1
  160. package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
  161. package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js +2 -0
  162. package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
  163. package/build/lib/web/production/components/Input/BaseInput/baseInputTokens.js +11 -0
  164. package/build/lib/web/production/components/Input/BaseInput/baseInputTokens.js.map +1 -1
  165. package/build/lib/web/production/components/Input/PhoneNumberInput/CountrySelector.web.js +1 -0
  166. package/build/lib/web/production/components/Input/PhoneNumberInput/CountrySelector.web.js.map +1 -1
  167. package/build/lib/web/production/components/ListView/ListViewFilters.web.js +13 -102
  168. package/build/lib/web/production/components/ListView/ListViewFilters.web.js.map +1 -1
  169. package/build/lib/web/production/components/QuickFilters/QuickFilter.js +2 -1
  170. package/build/lib/web/production/components/QuickFilters/QuickFilter.js.map +1 -1
  171. package/build/lib/web/production/components/Radio/Radio.js +4 -2
  172. package/build/lib/web/production/components/Radio/Radio.js.map +1 -1
  173. package/build/lib/web/production/components/Table/Table.web.js +3 -1
  174. package/build/lib/web/production/components/Table/Table.web.js.map +1 -1
  175. package/build/lib/web/production/components/Table/TableBody.web.js +2 -1
  176. package/build/lib/web/production/components/Table/TableBody.web.js.map +1 -1
  177. package/build/lib/web/production/components/Table/TableContext.js +2 -1
  178. package/build/lib/web/production/components/Table/TableContext.js.map +1 -1
  179. package/build/lib/web/production/components/Table/TableFooter.web.js +2 -1
  180. package/build/lib/web/production/components/Table/TableFooter.web.js.map +1 -1
  181. package/build/lib/web/production/components/Table/TableHeader.web.js +78 -68
  182. package/build/lib/web/production/components/Table/TableHeader.web.js.map +1 -1
  183. package/build/lib/web/production/components/Table/TablePagination.web.js +5 -2
  184. package/build/lib/web/production/components/Table/TablePagination.web.js.map +1 -1
  185. package/build/lib/web/production/components/Table/TableToolbar.web.js +15 -13
  186. package/build/lib/web/production/components/Table/TableToolbar.web.js.map +1 -1
  187. package/build/lib/web/production/components/Table/tokens.js +11 -8
  188. package/build/lib/web/production/components/Table/tokens.js.map +1 -1
  189. package/build/lib/web/production/components/index.js +2 -0
  190. package/build/lib/web/production/components/index.js.map +1 -1
  191. package/build/lib/web/production/tokens/global/colors.js +48 -48
  192. package/build/lib/web/production/tokens/global/colors.js.map +1 -1
  193. package/build/lib/web/production/tokens/global/size.js +2 -0
  194. package/build/lib/web/production/tokens/global/size.js.map +1 -1
  195. package/build/lib/web/production/tokens/theme/bladeTheme.js +139 -111
  196. package/build/lib/web/production/tokens/theme/bladeTheme.js.map +1 -1
  197. package/build/lib/web/production/tokens/theme/theme.js.map +1 -1
  198. package/build/types/components/index.d.ts +109 -23
  199. package/build/types/components/index.native.d.ts +106 -20
  200. package/build/types/tokens/index.d.ts +8 -6
  201. package/build/types/tokens/index.native.d.ts +8 -6
  202. package/build/types/utils/index.d.ts +29 -6
  203. package/build/types/utils/index.native.d.ts +29 -6
  204. package/package.json +1 -1
@@ -3,6 +3,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
3
3
  import React__default from 'react';
4
4
  import { Line as Line$1, ResponsiveContainer, LineChart } from 'recharts';
5
5
  import '../utils/index.js';
6
+ import '../CommonChartComponents/index.js';
6
7
  import { componentIds } from './componentIds.js';
7
8
  import '../../../utils/metaAttribute/index.js';
8
9
  import '../../BladeProvider/index.js';
@@ -16,11 +17,13 @@ import useTheme from '../../BladeProvider/useTheme.js';
16
17
  import useChartsColorTheme from '../utils/useColorTheme.js';
17
18
  import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
18
19
  import { getComponentId } from '../../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
20
+ import { assignDataColorMapping } from '../utils/assignDataColorMapping/assignDataColorMapping.js';
21
+ import { CommonChartComponentsContext } from '../CommonChartComponents/CommonChartComponentsContext.js';
19
22
  import { BaseBox } from '../../Box/BaseBox/BaseBox.web.js';
20
23
  import { metaAttribute } from '../../../utils/metaAttribute/metaAttribute.web.js';
21
24
  import { makeAnalyticsAttribute } from '../../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
22
25
 
23
- var _excluded = ["color", "strokeStyle", "type", "dot", "activeDot", "showLegend", "_index", "_colorTheme"],
26
+ var _excluded = ["color", "strokeStyle", "type", "dot", "activeDot", "showLegend", "_index", "_colorTheme", "_totalLines"],
24
27
  _excluded2 = ["children", "colorTheme", "testID", "data"];
25
28
  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; }
26
29
  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; }
@@ -38,27 +41,32 @@ var Line = function Line(_ref) {
38
41
  showLegend = _ref$showLegend === void 0 ? true : _ref$showLegend,
39
42
  _index = _ref._index,
40
43
  _colorTheme = _ref._colorTheme,
44
+ _totalLines = _ref._totalLines,
41
45
  props = _objectWithoutProperties(_ref, _excluded);
42
46
  var _useTheme = useTheme(),
43
47
  theme = _useTheme.theme;
44
48
  var themeColors = useChartsColorTheme({
45
- colorTheme: _colorTheme
49
+ colorTheme: _colorTheme,
50
+ chartName: 'line',
51
+ chartDataIndicators: _totalLines
46
52
  });
47
- var colorToken = color ? getIn(theme.colors, color) : themeColors[_index !== null && _index !== void 0 ? _index : 0];
53
+ var colorToken = getIn(theme.colors, color !== null && color !== void 0 ? color : themeColors[_index !== null && _index !== void 0 ? _index : 0]);
48
54
  var strokeDasharray = strokeStyle === 'dashed' ? '5 5' : strokeStyle === 'dotted' ? '2 2' : undefined;
49
55
  var isLineDotted = strokeStyle === 'dashed';
50
56
  var animationBegin = isLineDotted ? theme.motion.delay.gentle + theme.motion.duration.xgentle : theme.motion.delay.gentle;
51
57
  var animationDuration = theme.motion.duration.xgentle;
52
58
  return /*#__PURE__*/jsx(Line$1, _objectSpread({
53
59
  stroke: colorToken,
54
- strokeWidth: 3,
60
+ strokeWidth: 1.5,
55
61
  strokeDasharray: strokeDasharray,
56
62
  type: type,
57
63
  activeDot: activeDot,
58
64
  dot: dot,
59
65
  legendType: showLegend ? 'line' : 'none',
60
66
  animationBegin: animationBegin,
61
- animationDuration: animationDuration
67
+ animationDuration: animationDuration,
68
+ strokeLinecap: "round",
69
+ strokeLinejoin: "round"
62
70
  }, props));
63
71
  };
64
72
  var ChartLine = /*#__PURE__*/assignWithoutSideEffects(Line, {
@@ -69,38 +77,82 @@ var ChartLine = /*#__PURE__*/assignWithoutSideEffects(Line, {
69
77
  var ChartLineWrapper = function ChartLineWrapper(_ref2) {
70
78
  var children = _ref2.children,
71
79
  _ref2$colorTheme = _ref2.colorTheme,
72
- colorTheme = _ref2$colorTheme === void 0 ? 'default' : _ref2$colorTheme,
80
+ colorTheme = _ref2$colorTheme === void 0 ? 'categorical' : _ref2$colorTheme,
73
81
  testID = _ref2.testID,
74
82
  data = _ref2.data,
75
83
  restProps = _objectWithoutProperties(_ref2, _excluded2);
76
- var lineChartModifiedChildrens = React__default.useMemo(function () {
77
- var LineChartIndex = 0;
78
- return React__default.Children.map(children, function (child) {
79
- if (/*#__PURE__*/React__default.isValidElement(child) && getComponentId(child) === componentIds.ChartLine) {
80
- return /*#__PURE__*/React__default.cloneElement(child, {
81
- _index: LineChartIndex++,
82
- _colorTheme: colorTheme
83
- });
84
- }
85
- return child;
86
- });
87
- }, [children, colorTheme]);
88
- return /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, metaAttribute({
89
- name: 'line-chart',
90
- testID: testID
91
- })), makeAnalyticsAttribute(restProps)), {}, {
92
- width: "100%",
93
- height: "100%"
94
- }, restProps), {}, {
95
- children: /*#__PURE__*/jsx(ResponsiveContainer, {
84
+ var themeColors = useChartsColorTheme({
85
+ colorTheme: colorTheme,
86
+ chartName: 'line'
87
+ });
88
+ /**
89
+ * We need to check child of CharLineWrapper. if they have any custom color we store that.
90
+ * We need these mapping because colors of tooltip & legend is determine based on this
91
+ * recharts do provide a color but it is hex code and we need blade color token .
92
+ */
93
+
94
+ var _React$useMemo = React__default.useMemo(function () {
95
+ var childrenArray = React__default.Children.toArray(children);
96
+ var dataColorMapping = {};
97
+ // Count ChartLine components
98
+ var totalLines = childrenArray.filter(function (child) {
99
+ return /*#__PURE__*/React__default.isValidElement(child) && getComponentId(child) === componentIds.ChartLine;
100
+ }).length;
101
+ var LineChartIndex = 0;
102
+ var lineChartModifiedChildrens = React__default.Children.map(children, function (child) {
103
+ if (/*#__PURE__*/React__default.isValidElement(child) && getComponentId(child) === componentIds.ChartLine) {
104
+ var _child$props, _child$props2;
105
+ var childColor = child === null || child === void 0 || (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.color;
106
+ var dataKey = child === null || child === void 0 || (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.dataKey;
107
+ if (dataKey) {
108
+ /**
109
+ * if we have custom color given by user we use that other wise we just
110
+ * assign theme colors to the dataColorMapping, in `assignDataColorMapping`
111
+ */
112
+ dataColorMapping[dataKey] = {
113
+ colorToken: childColor,
114
+ isCustomColor: Boolean(childColor)
115
+ };
116
+ }
117
+ return /*#__PURE__*/React__default.cloneElement(child, {
118
+ _index: LineChartIndex++,
119
+ _colorTheme: colorTheme,
120
+ _totaLine: totalLines
121
+ });
122
+ }
123
+ return child;
124
+ });
125
+ assignDataColorMapping(dataColorMapping, themeColors);
126
+ return {
127
+ dataColorMapping: dataColorMapping,
128
+ lineChartModifiedChildrens: lineChartModifiedChildrens,
129
+ totalLines: totalLines
130
+ };
131
+ }, [children, colorTheme, themeColors]),
132
+ dataColorMapping = _React$useMemo.dataColorMapping,
133
+ lineChartModifiedChildrens = _React$useMemo.lineChartModifiedChildrens;
134
+ return /*#__PURE__*/jsx(CommonChartComponentsContext.Provider, {
135
+ value: {
136
+ chartName: 'line',
137
+ dataColorMapping: dataColorMapping
138
+ },
139
+ children: /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, metaAttribute({
140
+ name: 'line-chart',
141
+ testID: testID
142
+ })), makeAnalyticsAttribute(restProps)), {}, {
96
143
  width: "100%",
97
- height: "100%",
98
- children: /*#__PURE__*/jsx(LineChart, {
99
- data: data,
100
- children: lineChartModifiedChildrens
144
+ height: "100%"
145
+ }, restProps), {}, {
146
+ children: /*#__PURE__*/jsx(ResponsiveContainer, {
147
+ width: "100%",
148
+ height: "100%",
149
+ children: /*#__PURE__*/jsx(LineChart, {
150
+ data: data,
151
+ children: lineChartModifiedChildrens
152
+ })
101
153
  })
102
- })
103
- }));
154
+ }))
155
+ });
104
156
  };
105
157
 
106
158
  export { ChartLine, ChartLineWrapper };
@@ -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 });\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,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,eAAA;IACjBE,MAAM,GAAAZ,IAAA,C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AAC,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, assignDataColorMapping } from '../utils';\nimport { CommonChartComponentsContext } from '../CommonChartComponents';\nimport type { DataColorMapping } from '../CommonChartComponents/types';\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 _totalLines,\n ...props\n}) => {\n const { theme } = useTheme();\n const themeColors = useChartsColorTheme({\n colorTheme: _colorTheme,\n chartName: 'line',\n chartDataIndicators: _totalLines,\n });\n const colorToken = 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={1.5}\n strokeDasharray={strokeDasharray}\n type={type}\n activeDot={activeDot}\n dot={dot}\n legendType={showLegend ? 'line' : 'none'}\n animationBegin={animationBegin}\n animationDuration={animationDuration}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\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 = 'categorical',\n testID,\n data,\n ...restProps\n}) => {\n const themeColors = useChartsColorTheme({\n colorTheme,\n chartName: 'line',\n });\n /**\n * We need to check child of CharLineWrapper. if they have any custom color we store that.\n * We need these mapping because colors of tooltip & legend is determine based on this\n * recharts do provide a color but it is hex code and we need blade color token .\n */\n\n const { dataColorMapping, lineChartModifiedChildrens } = React.useMemo(() => {\n const childrenArray = React.Children.toArray(children);\n const dataColorMapping: DataColorMapping = {};\n // Count ChartLine components\n const totalLines = childrenArray.filter(\n (child): child is React.ReactElement =>\n React.isValidElement(child) && getComponentId(child) === componentIds.ChartLine,\n ).length;\n\n let LineChartIndex = 0;\n const lineChartModifiedChildrens = React.Children.map(children, (child) => {\n if (React.isValidElement(child) && getComponentId(child) === componentIds.ChartLine) {\n const childColor = child?.props?.color;\n const dataKey = (child?.props as ChartLineProps)?.dataKey as string;\n if (dataKey) {\n /**\n * if we have custom color given by user we use that other wise we just\n * assign theme colors to the dataColorMapping, in `assignDataColorMapping`\n */\n dataColorMapping[dataKey] = {\n colorToken: childColor,\n isCustomColor: Boolean(childColor),\n };\n }\n return React.cloneElement(child, {\n _index: LineChartIndex++,\n _colorTheme: colorTheme,\n _totaLine: totalLines,\n } as Partial<ChartLineProps>);\n }\n return child;\n });\n assignDataColorMapping(dataColorMapping, themeColors);\n\n return { dataColorMapping, lineChartModifiedChildrens, totalLines };\n }, [children, colorTheme, themeColors]);\n\n return (\n <CommonChartComponentsContext.Provider value={{ chartName: 'line', dataColorMapping }}>\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 </CommonChartComponentsContext.Provider>\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","_totalLines","props","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","themeColors","useChartsColorTheme","colorTheme","chartName","chartDataIndicators","colorToken","getIn","colors","strokeDasharray","undefined","isLineDotted","animationBegin","motion","delay","gentle","duration","xgentle","animationDuration","_jsx","RechartsLine","_objectSpread","stroke","strokeWidth","legendType","strokeLinecap","strokeLinejoin","ChartLine","assignWithoutSideEffects","componentId","componentIds","ChartLineWrapper","_ref2","children","_ref2$colorTheme","testID","data","restProps","_excluded2","_React$useMemo","React","useMemo","childrenArray","Children","toArray","dataColorMapping","totalLines","filter","child","isValidElement","getComponentId","length","LineChartIndex","lineChartModifiedChildrens","map","_child$props","_child$props2","childColor","dataKey","isCustomColor","Boolean","cloneElement","_totaLine","assignDataColorMapping","CommonChartComponentsContext","Provider","value","BaseBox","metaAttribute","name","makeAnalyticsAttribute","width","height","RechartsResponsiveContainer","RechartsLineChart"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,IAAMA,IAA8B,GAAG,SAAjCA,IAA8BA,CAAAC,IAAA,EAW9B;AAAA,EAAA,IAVJC,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,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,eAAA;IACjBE,MAAM,GAAAZ,IAAA,CAANY,MAAM;IACNC,WAAW,GAAAb,IAAA,CAAXa,WAAW;IACXC,WAAW,GAAAd,IAAA,CAAXc,WAAW;AACRC,IAAAA,K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AAA,QAAA,EAAEoB,0BAAAA;SAA8C,CAAA;OACnD,CAAA;KACtB,CAAA,CAAA;AAAC,GAC2B,CAAC,CAAA;AAE5C;;;;"}
@@ -0,0 +1,33 @@
1
+ import { DEFAULT_COLOR } from '../tokens.js';
2
+
3
+ /**
4
+ * Assigns colors to dataColorMapping based on theme colors and handles edge cases
5
+ * @param dataColorMapping - The data color mapping object to modify
6
+ * @param themeColors - Array of theme colors to assign
7
+ * @returns The modified dataColorMapping object
8
+ */
9
+ var assignDataColorMapping = function assignDataColorMapping(dataColorMapping, themeColors) {
10
+ var _dataColorMapping$Obj;
11
+ // Check if dataColor mapping has only one key and if it does, we need to add the default color to the dataColorMapping if no color is provided.
12
+ if (Object.keys(dataColorMapping).length === 1 && !((_dataColorMapping$Obj = dataColorMapping[Object.keys(dataColorMapping)[0]]) !== null && _dataColorMapping$Obj !== void 0 && _dataColorMapping$Obj.colorToken)) {
13
+ dataColorMapping[Object.keys(dataColorMapping)[0]] = {
14
+ colorToken: DEFAULT_COLOR,
15
+ isCustomColor: false
16
+ };
17
+ }
18
+
19
+ // Assign theme colors to the dataColorMapping, if no color is assigned.
20
+ Object.keys(dataColorMapping).forEach(function (key, index) {
21
+ var _dataColorMapping$key;
22
+ if (!((_dataColorMapping$key = dataColorMapping[key]) !== null && _dataColorMapping$key !== void 0 && _dataColorMapping$key.colorToken)) {
23
+ dataColorMapping[key] = {
24
+ colorToken: themeColors[index],
25
+ isCustomColor: false
26
+ };
27
+ }
28
+ });
29
+ return dataColorMapping;
30
+ };
31
+
32
+ export { assignDataColorMapping };
33
+ //# sourceMappingURL=assignDataColorMapping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assignDataColorMapping.js","sources":["../../../../../../../../src/components/Charts/utils/assignDataColorMapping/assignDataColorMapping.ts"],"sourcesContent":["import type { ChartsCategoricalColorToken } from '../types';\nimport { DEFAULT_COLOR } from '../tokens';\n\ntype DataColorMapping = Record<\n string,\n {\n colorToken?: ChartsCategoricalColorToken | undefined;\n isCustomColor: boolean;\n }\n>;\n\n/**\n * Assigns colors to dataColorMapping based on theme colors and handles edge cases\n * @param dataColorMapping - The data color mapping object to modify\n * @param themeColors - Array of theme colors to assign\n * @returns The modified dataColorMapping object\n */\nexport const assignDataColorMapping = (\n dataColorMapping: DataColorMapping,\n themeColors: ChartsCategoricalColorToken[],\n): DataColorMapping => {\n // Check if dataColor mapping has only one key and if it does, we need to add the default color to the dataColorMapping if no color is provided.\n if (\n Object.keys(dataColorMapping).length === 1 &&\n !dataColorMapping[Object.keys(dataColorMapping)[0]]?.colorToken\n ) {\n dataColorMapping[Object.keys(dataColorMapping)[0]] = {\n colorToken: DEFAULT_COLOR,\n isCustomColor: false,\n };\n }\n\n // Assign theme colors to the dataColorMapping, if no color is assigned.\n Object.keys(dataColorMapping).forEach((key, index) => {\n if (!dataColorMapping[key]?.colorToken) {\n dataColorMapping[key] = {\n colorToken: themeColors[index],\n isCustomColor: false,\n };\n }\n });\n\n return dataColorMapping;\n};\n"],"names":["assignDataColorMapping","dataColorMapping","themeColors","_dataColorMapping$Obj","Object","keys","length","colorToken","DEFAULT_COLOR","isCustomColor","forEach","key","index","_dataColorMapping$key"],"mappings":";;AAWA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAsBA,CACjCC,gBAAkC,EAClCC,WAA0C,EACrB;AAAA,EAAA,IAAAC,qBAAA,CAAA;AACrB;AACA,EAAA,IACEC,MAAM,CAACC,IAAI,CAACJ,gBAAgB,CAAC,CAACK,MAAM,KAAK,CAAC,IAC1C,EAAAH,CAAAA,qBAAA,GAACF,gBAAgB,CAACG,MAAM,CAACC,IAAI,CAACJ,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,MAAA,IAAA,IAAAE,qBAAA,KAAA,KAAA,CAAA,IAAlDA,qBAAA,CAAoDI,UAAU,CAC/D,EAAA;IACAN,gBAAgB,CAACG,MAAM,CAACC,IAAI,CAACJ,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;AACnDM,MAAAA,UAAU,EAAEC,aAAa;AACzBC,MAAAA,aAAa,EAAE,KAAA;KAChB,CAAA;AACH,GAAA;;AAEA;AACAL,EAAAA,MAAM,CAACC,IAAI,CAACJ,gBAAgB,CAAC,CAACS,OAAO,CAAC,UAACC,GAAG,EAAEC,KAAK,EAAK;AAAA,IAAA,IAAAC,qBAAA,CAAA;AACpD,IAAA,IAAI,EAAAA,CAAAA,qBAAA,GAACZ,gBAAgB,CAACU,GAAG,CAAC,MAAA,IAAA,IAAAE,qBAAA,KAAA,KAAA,CAAA,IAArBA,qBAAA,CAAuBN,UAAU,CAAE,EAAA;MACtCN,gBAAgB,CAACU,GAAG,CAAC,GAAG;AACtBJ,QAAAA,UAAU,EAAEL,WAAW,CAACU,KAAK,CAAC;AAC9BH,QAAAA,aAAa,EAAE,KAAA;OAChB,CAAA;AACH,KAAA;AACF,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOR,gBAAgB,CAAA;AACzB;;;;"}
@@ -0,0 +1,2 @@
1
+ export { assignDataColorMapping } from './assignDataColorMapping.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,53 @@
1
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
+
3
+ /**
4
+ *
5
+ * @param colorToken - The color token to get the highest color for
6
+ * @param followIntensityMapping - Whether to follow the intensity mapping for the color token (only for categorical colors)
7
+ * if enabled, the color token will be mapped to the intensity based on the intensity mapping
8
+ * if disabled, the color token will be mapped to the strong intensity
9
+ * @returns The highest color token in the range
10
+ */
11
+
12
+ var getHighestColorInRange = function getHighestColorInRange(_ref) {
13
+ var colorToken = _ref.colorToken,
14
+ _ref$followIntensityM = _ref.followIntensityMapping,
15
+ followIntensityMapping = _ref$followIntensityM === void 0 ? false : _ref$followIntensityM;
16
+ // Check if it's a sequential color token
17
+ var sequentialMatch = colorToken.match(/^data\.background\.sequential\.([^.]+)\.(\d+)$/);
18
+ if (sequentialMatch) {
19
+ var _sequentialMatch = _slicedToArray(sequentialMatch, 2),
20
+ colorName = _sequentialMatch[1];
21
+ return "data.background.sequential.".concat(colorName, ".1000");
22
+ }
23
+
24
+ // Check if it's a categorical color token
25
+ var categoricalMatch = colorToken.match(/^data\.background\.categorical\.([^.]+)\.([^.]+)$/);
26
+ if (categoricalMatch) {
27
+ var _categoricalMatch = _slicedToArray(categoricalMatch, 3),
28
+ _colorName = _categoricalMatch[1],
29
+ intensity = _categoricalMatch[2];
30
+ if (followIntensityMapping) {
31
+ // Dynamic color intensity mapping
32
+ var intensityMapping = {
33
+ faint: 'strong',
34
+ subtle: 'intense',
35
+ moderate: 'moderate',
36
+ intense: 'subtle',
37
+ strong: 'faint'
38
+ };
39
+ var mappedIntensity = intensityMapping[intensity] || intensity;
40
+ return "data.background.categorical.".concat(_colorName, ".").concat(mappedIntensity);
41
+ } else {
42
+ // Default behavior: always return strong
43
+ return "data.background.categorical.".concat(_colorName, ".strong");
44
+ }
45
+ }
46
+
47
+ // This should never happen due to TypeScript typing, but handle gracefully
48
+ console.warn("Invalid color token format: ".concat(colorToken, ". Expected format: data.background.{categorical|sequential}.{color}.{intensity|value}"));
49
+ return colorToken;
50
+ };
51
+
52
+ export { getHighestColorInRange };
53
+ //# sourceMappingURL=getHighestColorInRange.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getHighestColorInRange.js","sources":["../../../../../../../src/components/Charts/utils/getHighestColorInRange.ts"],"sourcesContent":["import type { ChartColorToken, ColorIntensity } from './types';\n\n/**\n *\n * @param colorToken - The color token to get the highest color for\n * @param followIntensityMapping - Whether to follow the intensity mapping for the color token (only for categorical colors)\n * if enabled, the color token will be mapped to the intensity based on the intensity mapping\n * if disabled, the color token will be mapped to the strong intensity\n * @returns The highest color token in the range\n */\n\nexport const getHighestColorInRange = ({\n colorToken,\n followIntensityMapping = false,\n}: {\n colorToken: ChartColorToken;\n followIntensityMapping?: boolean;\n}): ChartColorToken => {\n // Check if it's a sequential color token\n const sequentialMatch = colorToken.match(/^data\\.background\\.sequential\\.([^.]+)\\.(\\d+)$/);\n if (sequentialMatch) {\n const [, colorName] = sequentialMatch;\n return (`data.background.sequential.${colorName}.1000` as unknown) as ChartColorToken;\n }\n\n // Check if it's a categorical color token\n const categoricalMatch = colorToken.match(/^data\\.background\\.categorical\\.([^.]+)\\.([^.]+)$/);\n if (categoricalMatch) {\n const [, colorName, intensity] = categoricalMatch;\n\n if (followIntensityMapping) {\n // Dynamic color intensity mapping\n const intensityMapping: Record<string, ColorIntensity> = {\n faint: 'strong',\n subtle: 'intense',\n moderate: 'moderate',\n intense: 'subtle',\n strong: 'faint',\n };\n\n const mappedIntensity = intensityMapping[intensity] || intensity;\n return (`data.background.categorical.${colorName}.${mappedIntensity}` as unknown) as ChartColorToken;\n } else {\n // Default behavior: always return strong\n return (`data.background.categorical.${colorName}.strong` as unknown) as ChartColorToken;\n }\n }\n\n // This should never happen due to TypeScript typing, but handle gracefully\n console.warn(\n `Invalid color token format: ${colorToken}. Expected format: data.background.{categorical|sequential}.{color}.{intensity|value}`,\n );\n return colorToken;\n};\n"],"names":["getHighestColorInRange","_ref","colorToken","_ref$followIntensityM","followIntensityMapping","sequentialMatch","match","_sequentialMatch","_slicedToArray","colorName","concat","categoricalMatch","_categoricalMatch","intensity","intensityMapping","faint","subtle","moderate","intense","strong","mappedIntensity","console","warn"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;IAEaA,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAAC,IAAA,EAMZ;AAAA,EAAA,IALrBC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IAAAC,qBAAA,GAAAF,IAAA,CACVG,sBAAsB;AAAtBA,IAAAA,sBAAsB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,qBAAA,CAAA;AAK9B;AACA,E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AA,CAAAZ,MAAA,CACqBR,UAAU,0FAC3C,CAAC,CAAA;AACD,EAAA,OAAOA,UAAU,CAAA;AACnB;;;;"}
@@ -1,2 +1,7 @@
1
1
  export { default as useChartsColorTheme } from './useColorTheme.js';
2
+ export { isSequentialColor } from './isSequentialColor.js';
3
+ export { getHighestColorInRange } from './getHighestColorInRange.js';
4
+ import './sanitizeString/index.js';
5
+ export { colorSequence, totalChartColors } from './tokens.js';
6
+ import './assignDataColorMapping/index.js';
2
7
  //# 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":";;;;;"}
@@ -0,0 +1,35 @@
1
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
+
3
+ /**
4
+ * Checks if a color token is a sequential color.
5
+ * Sequential colors follow the pattern: data.background.sequential.{colorName}.{numericValue}
6
+ * where numeric values are 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000
7
+ *
8
+ * @param colorToken - The color token to check
9
+ * @returns true if the color token is sequential, false otherwise
10
+ *
11
+ * @example
12
+ * isSequentialColor('data.background.sequential.azure.500')
13
+ * // Returns: true
14
+ *
15
+ * @example
16
+ * isSequentialColor('data.background.categorical.azure.moderate')
17
+ * // Returns: false
18
+ */
19
+ var isSequentialColor = function isSequentialColor(colorToken) {
20
+ // Check if it matches the sequential color pattern
21
+ var sequentialMatch = colorToken.match(/^data\.background\.sequential\.([^.]+)\.(\d+)$/);
22
+ if (!sequentialMatch) {
23
+ return false;
24
+ }
25
+ var _sequentialMatch = _slicedToArray(sequentialMatch, 3),
26
+ numericValue = _sequentialMatch[2];
27
+ var numericValueInt = parseInt(numericValue, 10);
28
+
29
+ // Valid sequential color numeric values: 0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000
30
+ var validSequentialValues = [0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000];
31
+ return validSequentialValues.includes(numericValueInt);
32
+ };
33
+
34
+ export { isSequentialColor };
35
+ //# sourceMappingURL=isSequentialColor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isSequentialColor.js","sources":["../../../../../../../src/components/Charts/utils/isSequentialColor.tsx"],"sourcesContent":["/**\n * Checks if a color token is a sequential color.\n * Sequential colors follow the pattern: data.background.sequential.{colorName}.{numericValue}\n * where numeric values are 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000\n *\n * @param colorToken - The color token to check\n * @returns true if the color token is sequential, false otherwise\n *\n * @example\n * isSequentialColor('data.background.sequential.azure.500')\n * // Returns: true\n *\n * @example\n * isSequentialColor('data.background.categorical.azure.moderate')\n * // Returns: false\n */\nexport const isSequentialColor = (colorToken: string): boolean => {\n // Check if it matches the sequential color pattern\n const sequentialMatch = colorToken.match(/^data\\.background\\.sequential\\.([^.]+)\\.(\\d+)$/);\n\n if (!sequentialMatch) {\n return false;\n }\n\n const [, , numericValue] = sequentialMatch;\n const numericValueInt = parseInt(numericValue, 10);\n\n // Valid sequential color numeric values: 0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000\n const validSequentialValues = [0, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000];\n\n return validSequentialValues.includes(numericValueInt);\n};\n"],"names":["isSequentialColor","colorToken","sequentialMatch","match","_sequentialMatch","_slicedToArray","numericValue","numericValueInt","parseInt","validSequentialValues","includes"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACaA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIC,UAAkB,EAAc;AAChE;AACA,EAAA,IAAMC,eAAe,GAAGD,UAAU,CAACE,KAAK,CAAC,gDAAgD,CAAC,CAAA;EAE1F,IAAI,CAACD,eAAe,EAAE;AACpB,IAAA,OAAO,KAAK,CAAA;AACd,GAAA;AAEA,EAAA,IAAAE,gBAAA,GAAAC,cAAA,CAA2BH,eAAe,EAAA,CAAA,CAAA;AAA/BI,IAAAA,YAAY,GAAAF,gBAAA,CAAA,CAAA,CAAA,CAAA;AACvB,EAAA,IAAMG,eAAe,GAAGC,QAAQ,CAACF,YAAY,EAAE,EAAE,CAAC,CAAA;;AAElD;EACA,IAAMG,qBAAqB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;AAExF,EAAA,OAAOA,qBAAqB,CAACC,QAAQ,CAACH,eAAe,CAAC,CAAA;AACxD;;;;"}
@@ -0,0 +1,2 @@
1
+ export { sanitizeString } from './sanitizeString.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Simple chart data sanitization utility
3
+ *
4
+ * This utility safely sanitizes strings for use in chart data objects.
5
+ * It removes problematic characters while preserving the essential content.
6
+ *
7
+ * @param input - The string to sanitize
8
+ * @returns Sanitized string safe for chart data
9
+ * @example
10
+ * sanitizeString('Sales Data 2024')
11
+ * // Returns: 'Sales_Data_2024'
12
+ */
13
+ var sanitizeString = function sanitizeString(input) {
14
+ // Handle null/undefined input
15
+ if (input == null) {
16
+ return '';
17
+ }
18
+
19
+ // Convert to string if not already
20
+ var str = String(input);
21
+ return str.trim() // Remove leading/trailing whitespace
22
+ .replace(/<[^>]*>/g, '') // Remove HTML tags
23
+ .replace(/[\r\n\t]/g, '_') // Replace line breaks and tabs with underscores
24
+ .replace(/\s+/g, ' ') // Normalize multiple spaces to single space
25
+ .trim() // Trim again after processing
26
+ .substring(0, 100); // Limit to reasonable length for chart labels
27
+ };
28
+
29
+ export { sanitizeString };
30
+ //# sourceMappingURL=sanitizeString.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitizeString.js","sources":["../../../../../../../../src/components/Charts/utils/sanitizeString/sanitizeString.ts"],"sourcesContent":["/**\n * Simple chart data sanitization utility\n *\n * This utility safely sanitizes strings for use in chart data objects.\n * It removes problematic characters while preserving the essential content.\n *\n * @param input - The string to sanitize\n * @returns Sanitized string safe for chart data\n * @example\n * sanitizeString('Sales Data 2024')\n * // Returns: 'Sales_Data_2024'\n */\nexport const sanitizeString = (input: string | null | undefined): string => {\n // Handle null/undefined input\n if (input == null) {\n return '';\n }\n\n // Convert to string if not already\n const str = String(input);\n\n return str\n .trim() // Remove leading/trailing whitespace\n .replace(/<[^>]*>/g, '') // Remove HTML tags\n .replace(/[\\r\\n\\t]/g, '_') // Replace line breaks and tabs with underscores\n .replace(/\\s+/g, ' ') // Normalize multiple spaces to single space\n .trim() // Trim again after processing\n .substring(0, 100); // Limit to reasonable length for chart labels\n};\n"],"names":["sanitizeString","input","str","String","trim","replace","substring"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACaA,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,KAAgC,EAAa;AAC1E;EACA,IAAIA,KAAK,IAAI,IAAI,EAAE;AACjB,IAAA,OAAO,EAAE,CAAA;AACX,GAAA;;AAEA;AACA,EAAA,IAAMC,GAAG,GAAGC,MAAM,CAACF,KAAK,CAAC,CAAA;AAEzB,EAAA,OAAOC,GAAG,CACPE,IAAI,EAAE;AAAC,GACPC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;AAAC,GACxBA,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC;AAAC,GAC1BA,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;GACpBD,IAAI,EAAE;AAAC,GACPE,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACvB;;;;"}
@@ -0,0 +1,7 @@
1
+ // Color sequence
2
+ var colorSequence = ['blue', 'green', 'gold', 'purple', 'orange', 'pink', 'skyBlue', 'red', 'gray'];
3
+ var totalChartColors = colorSequence.length;
4
+ var DEFAULT_COLOR = 'data.background.categorical.gray.moderate';
5
+
6
+ export { DEFAULT_COLOR, colorSequence, totalChartColors };
7
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sources":["../../../../../../../src/components/Charts/utils/tokens.ts"],"sourcesContent":["import type { ChartColorTokenNames } from './types';\n\n// Color sequence\nconst colorSequence: ChartColorTokenNames[] = [\n 'blue',\n 'green',\n 'gold',\n 'purple',\n 'orange',\n 'pink',\n 'skyBlue',\n 'red',\n 'gray',\n];\n\nconst totalChartColors = colorSequence.length;\n\nconst DEFAULT_COLOR = 'data.background.categorical.gray.moderate';\n\nexport { colorSequence, totalChartColors, DEFAULT_COLOR };\n"],"names":["colorSequence","totalChartColors","length","DEFAULT_COLOR"],"mappings":"AAEA;AACMA,IAAAA,aAAqC,GAAG,CAC5C,MAAM,EACN,OAAO,EACP,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,MAAM,EACP;AAED,IAAMC,gBAAgB,GAAGD,aAAa,CAACE,OAAM;AAEvCC,IAAAA,aAAa,GAAG;;;;"}
@@ -1,26 +1,47 @@
1
- import '../../BladeProvider/index.js';
2
- import useTheme from '../../BladeProvider/useTheme.js';
1
+ import { colorSequence } from './tokens.js';
3
2
 
4
3
  /**
5
4
  * The color theme of the chart.
6
5
  * @default 'categorical'
7
6
  * @description The color theme of the chart.
8
- *
9
7
  */
10
8
 
11
9
  var useChartsColorTheme = function useChartsColorTheme(_ref) {
12
10
  var _ref$colorTheme = _ref.colorTheme,
13
- colorTheme = _ref$colorTheme === void 0 ? 'categorical' : _ref$colorTheme;
14
- var _useTheme = useTheme(),
15
- theme = _useTheme.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"));
11
+ colorTheme = _ref$colorTheme === void 0 ? 'categorical' : _ref$colorTheme,
12
+ chartName = _ref.chartName,
13
+ _ref$chartDataIndicat = _ref.chartDataIndicators,
14
+ chartDataIndicators = _ref$chartDataIndicat === void 0 ? 0 : _ref$chartDataIndicat;
15
+ // Single data point should be gray
16
+ if (chartDataIndicators === 1 && chartName !== 'donut') {
17
+ return ['data.background.categorical.gray.moderate'];
19
18
  }
20
19
 
21
- //TODO:Currently we only have one color theme will add more color theme later.
20
+ // Intensity sequence based on chart type
21
+ var getIntensitySequence = function getIntensitySequence(chartName) {
22
+ if (chartName === 'line' || chartName === 'area') {
23
+ // Reverse sequence for Line and Area charts: strong, moderate, subtle, faint
24
+ return ['strong', 'intense', 'moderate', 'subtle', 'faint'];
25
+ } else {
26
+ // Default sequence for Bar and Donut charts: faint, subtle, moderate, strong
27
+ return ['faint', 'subtle', 'moderate', 'intense', 'strong'];
28
+ }
29
+ };
30
+ var intensitySequence = getIntensitySequence(chartName);
31
+ var colorThemeArray = [];
22
32
 
23
- return categoricalColorThemeArray;
33
+ // Generate colors based on sequence and intensity
34
+ // For each intensity level, go through all colors
35
+ intensitySequence.forEach(function (intensity) {
36
+ colorSequence.forEach(function (colorName) {
37
+ var colorValue = "data.background.categorical.".concat(colorName, ".").concat(intensity);
38
+ colorThemeArray.push(colorValue);
39
+ });
40
+ });
41
+ if (colorTheme !== 'categorical') {
42
+ console.log("".concat(colorTheme, " is not supported. Blade only supports 'categorical' color theme"));
43
+ }
44
+ return colorThemeArray;
24
45
  };
25
46
 
26
47
  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/**\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,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,aAAa,EAAE;AAChCoB,IAAAA,OAAO,CAACC,GAAG,CAAA,EAAA,CAAAC,MAAA,CAAItB,UAAU,sEAAmE,CAAC,CAAA;AAC/F,GAAA;;AAEA;;AAEA,EAAA,OAAOI,0BAA0B,CAAA;AACnC;;;;"}
1
+ {"version":3,"file":"useColorTheme.js","sources":["../../../../../../../src/components/Charts/utils/useColorTheme.tsx"],"sourcesContent":["import type { ColorTheme, ChartName, ChartColorTokenNames, ColorIntensity } from './types';\nimport { colorSequence } from './tokens';\n/**\n * The color theme of the chart.\n * @default 'categorical'\n * @description The color theme of the chart.\n */\n\nconst useChartsColorTheme = ({\n colorTheme = 'categorical',\n chartName,\n chartDataIndicators = 0,\n}: {\n colorTheme?: ColorTheme;\n chartName?: ChartName;\n chartDataIndicators?: number;\n}): CategoricalColorToken[] => {\n // Single data point should be gray\n if (chartDataIndicators === 1 && chartName !== 'donut') {\n return ['data.background.categorical.gray.moderate'];\n }\n\n // Intensity sequence based on chart type\n const getIntensitySequence = (chartName?: ChartName): ColorIntensity[] => {\n if (chartName === 'line' || chartName === 'area') {\n // Reverse sequence for Line and Area charts: strong, moderate, subtle, faint\n return ['strong', 'intense', 'moderate', 'subtle', 'faint'];\n } else {\n // Default sequence for Bar and Donut charts: faint, subtle, moderate, strong\n return ['faint', 'subtle', 'moderate', 'intense', 'strong'];\n }\n };\n\n const intensitySequence = getIntensitySequence(chartName);\n const colorThemeArray: CategoricalColorToken[] = [];\n\n // Generate colors based on sequence and intensity\n // For each intensity level, go through all colors\n intensitySequence.forEach((intensity) => {\n colorSequence.forEach((colorName) => {\n const colorValue = `data.background.categorical.${colorName}.${intensity}`;\n colorThemeArray.push(colorValue as CategoricalColorToken);\n });\n });\n\n if (colorTheme !== 'categorical') {\n console.log(`${colorTheme} is not supported. Blade only supports 'categorical' color theme`);\n }\n\n return colorThemeArray;\n};\n\n/**\n * Color token types for type safety\n */\ntype CategoricalColorToken = `data.background.categorical.${ChartColorTokenNames}.${ColorIntensity}`;\n\nexport default useChartsColorTheme;\n"],"names":["useChartsColorTheme","_ref","_ref$colorTheme","colorTheme","chartName","_ref$chartDataIndicat","chartDataIndicators","getIntensitySequence","intensitySequence","colorThemeArray","forEach","intensity","colorSequence","colorName","colorValue","concat","push","console","log"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;;AAEA,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAAC,IAAA,EAQM;AAAA,EAAA,IAAAC,eAAA,GAAAD,IAAA,CAP7BE,UAAU;AAAVA,IAAAA,UAAU,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,aAAa,GAAAA,eAAA;IAC1BE,SAAS,GAAAH,IAAA,CAATG,SAAS;IAAAC,qBAAA,GAAAJ,IAAA,CACTK,mBAAmB;AAAnBA,IAAAA,mBAAmB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,CAAC,GAAAA,qBAAA,CAAA;AAMvB;AACA,EAAA,IAAIC,mBAAmB,KAAK,CAAC,IAAIF,SAAS,KAAK,OAAO,EAAE;IACtD,OAAO,CAAC,2CAA2C,CAAC,CAAA;AACtD,GAAA;;AAEA;AACA,EAAA,IAAMG,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAIH,SAAqB,EAAuB;AACxE,IAAA,IAAIA,SAAS,KAAK,MAAM,IAAIA,SAAS,KAAK,MAAM,EAAE;AAChD;MACA,OAAO,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;AAC7D,KAAC,MAAM;AACL;MACA,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAA;AAC7D,KAAA;GACD,CAAA;AAED,EAAA,IAAMI,iBAAiB,GAAGD,oBAAoB,CAACH,SAAS,CAAC,CAAA;EACzD,IAAMK,eAAwC,GAAG,EAAE,CAAA;;AAEnD;AACA;AACAD,EAAAA,iBAAiB,CAACE,OAAO,CAAC,UAACC,SAAS,EAAK;AACvCC,IAAAA,aAAa,CAACF,OAAO,CAAC,UAACG,SAAS,EAAK;MACnC,IAAMC,UAAU,kCAAAC,MAAA,CAAkCF,SAAS,EAAAE,GAAAA,CAAAA,CAAAA,MAAA,CAAIJ,SAAS,CAAE,CAAA;AAC1EF,MAAAA,eAAe,CAACO,IAAI,CAACF,UAAmC,CAAC,CAAA;AAC3D,KAAC,CAAC,CAAA;AACJ,GAAC,CAAC,CAAA;EAEF,IAAIX,UAAU,KAAK,aAAa,EAAE;AAChCc,IAAAA,OAAO,CAACC,GAAG,CAAA,EAAA,CAAAH,MAAA,CAAIZ,UAAU,qEAAkE,CAAC,CAAA;AAC9F,GAAA;AAEA,EAAA,OAAOM,eAAe,CAAA;AACxB;;;;"}
@@ -56,13 +56,15 @@ var FilterChipGroup = function FilterChipGroup(_ref) {
56
56
  testID: testID
57
57
  })), makeAnalyticsAttribute(rest)), {}, {
58
58
  display: "flex",
59
- padding: "spacing.4",
59
+ padding: ['spacing.4', 'spacing.1'],
60
60
  alignItems: "center",
61
61
  justifyContent: "flex-start",
62
62
  width: "100%",
63
63
  gap: "spacing.3",
64
64
  flexWrap: "wrap",
65
65
  children: [children, showClearButton && (filterChipGroupSelectedFilters.length > 0 || selectedFiltersCount > 0) ? /*#__PURE__*/jsx(Link, {
66
+ size: "xsmall",
67
+ color: "neutral",
66
68
  onClick: handleClearButtonClick,
67
69
  children: "Clear Filter".concat(filterChipGroupSelectedFilters.length > 1 || selectedFiltersCount > 1 ? 's' : '')
68
70
  }) : null]
@@ -1 +1 @@
1
- {"version":3,"file":"FilterChipGroup.web.js","sources":["../../../../../../src/components/Dropdown/FilterChipGroup.web.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useListViewFilterContext } from '../ListView/ListViewFiltersContext.web';\nimport type { FilterChipGroupProps } from './types';\nimport { FilterChipGroupProvider } from './FilterChipGroupContext.web';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { Link } from '~components/Link';\n\nconst FilterChipGroup = ({\n testID,\n children,\n showClearButton = true,\n onClearButtonClick,\n ...rest\n}: FilterChipGroupProps): React.ReactElement => {\n const [filterChipGroupSelectedFilters, setFilterChipGroupSelectedFilters] = useState<string[]>(\n [],\n );\n const [clearFilterCallbackTriggerer, setClearFilterCallbackTriggerer] = useState<number>(0);\n const { selectedFiltersCount, setListViewSelectedFilters } = useListViewFilterContext();\n const handleClearButtonClick = (): void => {\n onClearButtonClick?.();\n setListViewSelectedFilters({});\n setFilterChipGroupSelectedFilters([]);\n setClearFilterCallbackTriggerer((prev) => prev + 1);\n };\n return (\n <FilterChipGroupProvider\n value={{\n filterChipGroupSelectedFilters,\n setFilterChipGroupSelectedFilters,\n clearFilterCallbackTriggerer,\n setClearFilterCallbackTriggerer,\n }}\n >\n <BaseBox\n {...metaAttribute({ name: MetaConstants.FilterChipGroup, testID })}\n {...makeAnalyticsAttribute(rest)}\n display=\"flex\"\n padding=\"spacing.4\"\n alignItems=\"center\"\n justifyContent=\"flex-start\"\n width=\"100%\"\n gap=\"spacing.3\"\n flexWrap=\"wrap\"\n >\n {children}\n {showClearButton &&\n (filterChipGroupSelectedFilters.length > 0 || selectedFiltersCount > 0) ? (\n <Link onClick={handleClearButtonClick}>{`Clear Filter${\n filterChipGroupSelectedFilters.length > 1 || selectedFiltersCount > 1 ? 's' : ''\n }`}</Link>\n ) : null}\n </BaseBox>\n </FilterChipGroupProvider>\n );\n};\n\nexport { FilterChipGroup };\n"],"names":["FilterChipGroup","_ref","testID","children","_ref$showClearButton","showClearButton","onClearButtonClick","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","filterChipGroupSelectedFilters","setFilterChipGroupSelectedFilters","_useState3","_useState4","clearFilterCallbackTriggerer","setClearFilterCallbackTriggerer","_useListViewFilterCon","useListViewFilterContext","selectedFiltersCount","setListViewSelectedFilters","handleClearButtonClick","prev","_jsx","FilterChipGroupProvider","value","_jsxs","BaseBox","_objectSpread","metaAttribute","name","MetaConstants","makeAnalyticsAttribute","display","padding","alignItems","justifyContent","width","gap","flexWrap","length","Link","onClick","concat"],"mappings":";;;;;;;;;;;;;;;;;;;;AASA,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAM2B;AAAA,EAAA,IAL9CC,MAAM,GAAAD,IAAA,CAANC,MAAM;IACNC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAAC,oBAAA,GAAAH,IAAA,CACRI,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,oBAAA;IACtBE,kBAAkB,GAAAL,IAAA,CAAlBK,kBAAkB;AACfC,IAAAA,IAAI,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA,CAAA,CAAA;AAEP,EAAA,IAAAC,SAAA,GAA4EC,QAAQ,CAClF,EACF,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,S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I,EAAEC,aAAa,CAAClC,eAAe;AAAEE,MAAAA,MAAM,EAANA,MAAAA;AAAO,KAAC,CAAC,CAAA,EAC9DiC,sBAAsB,CAAC5B,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAChC6B,MAAAA,OAAO,EAAC,MAAM;AACdC,MAAAA,OAAO,EAAC,WAAW;AACnBC,MAAAA,UAAU,EAAC,QAAQ;AACnBC,MAAAA,cAAc,EAAC,YAAY;AAC3BC,MAAAA,KAAK,EAAC,MAAM;AACZC,MAAAA,GAAG,EAAC,WAAW;AACfC,MAAAA,QAAQ,EAAC,MAAM;AAAAvC,MAAAA,QAAA,GAEdA,QAAQ,EACRE,eAAe,KACfS,8BAA8B,CAAC6B,MAAM,GAAG,CAAC,IAAIrB,oBAAoB,GAAG,CAAC,CAAC,gBACrEI,GAAA,CAACkB,IAAI,EAAA;AAACC,QAAAA,OAAO,EAAErB,sBAAuB;AAAArB,QAAAA,QAAA,EAAA2C,cAAAA,CAAAA,MAAA,CACpChC,8BAA8B,CAAC6B,MAAM,GAAG,CAAC,IAAIrB,oBAAoB,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE,CAAA;OACzE,CAAC,GACR,IAAI,CAAA;KACD,CAAA,CAAA;AAAC,GACa,CAAC,CAAA;AAE9B;;;;"}
1
+ {"version":3,"file":"FilterChipGroup.web.js","sources":["../../../../../../src/components/Dropdown/FilterChipGroup.web.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useListViewFilterContext } from '../ListView/ListViewFiltersContext.web';\nimport type { FilterChipGroupProps } from './types';\nimport { FilterChipGroupProvider } from './FilterChipGroupContext.web';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport { MetaConstants, metaAttribute } from '~utils/metaAttribute';\nimport { Link } from '~components/Link';\n\nconst FilterChipGroup = ({\n testID,\n children,\n showClearButton = true,\n onClearButtonClick,\n ...rest\n}: FilterChipGroupProps): React.ReactElement => {\n const [filterChipGroupSelectedFilters, setFilterChipGroupSelectedFilters] = useState<string[]>(\n [],\n );\n const [clearFilterCallbackTriggerer, setClearFilterCallbackTriggerer] = useState<number>(0);\n const { selectedFiltersCount, setListViewSelectedFilters } = useListViewFilterContext();\n const handleClearButtonClick = (): void => {\n onClearButtonClick?.();\n setListViewSelectedFilters({});\n setFilterChipGroupSelectedFilters([]);\n setClearFilterCallbackTriggerer((prev) => prev + 1);\n };\n return (\n <FilterChipGroupProvider\n value={{\n filterChipGroupSelectedFilters,\n setFilterChipGroupSelectedFilters,\n clearFilterCallbackTriggerer,\n setClearFilterCallbackTriggerer,\n }}\n >\n <BaseBox\n {...metaAttribute({ name: MetaConstants.FilterChipGroup, testID })}\n {...makeAnalyticsAttribute(rest)}\n display=\"flex\"\n padding={['spacing.4', 'spacing.1']}\n alignItems=\"center\"\n justifyContent=\"flex-start\"\n width=\"100%\"\n gap=\"spacing.3\"\n flexWrap=\"wrap\"\n >\n {children}\n {showClearButton &&\n (filterChipGroupSelectedFilters.length > 0 || selectedFiltersCount > 0) ? (\n <Link size=\"xsmall\" color=\"neutral\" onClick={handleClearButtonClick}>{`Clear Filter${\n filterChipGroupSelectedFilters.length > 1 || selectedFiltersCount > 1 ? 's' : ''\n }`}</Link>\n ) : null}\n </BaseBox>\n </FilterChipGroupProvider>\n );\n};\n\nexport { FilterChipGroup };\n"],"names":["FilterChipGroup","_ref","testID","children","_ref$showClearButton","showClearButton","onClearButtonClick","rest","_objectWithoutProperties","_excluded","_useState","useState","_useState2","_slicedToArray","filterChipGroupSelectedFilters","setFilterChipGroupSelectedFilters","_useState3","_useState4","clearFilterCallbackTriggerer","setClearFilterCallbackTriggerer","_useListViewFilterCon","useListViewFilterContext","selectedFiltersCount","setListViewSelectedFilters","handleClearButtonClick","prev","_jsx","FilterChipGroupProvider","value","_jsxs","BaseBox","_objectSpread","metaAttribute","name","MetaConstants","makeAnalyticsAttribute","display","padding","alignItems","justifyContent","width","gap","flexWrap","length","Link","size","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