@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
@@ -1,11 +1,12 @@
1
1
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
2
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
3
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
- import React__default, { useState } from 'react';
4
+ import React__default, { createElement, useState } from 'react';
5
5
  import { Bar, ResponsiveContainer, BarChart } from 'recharts';
6
6
  import '../utils/index.js';
7
+ import '../CommonChartComponents/index.js';
7
8
  import { useBarChartContext, BarChartContext } from './BarChartContext.js';
8
- import { DISTANCE_BETWEEN_STACKED_BARS, BAR_CHART_CORNER_RADIUS, componentIds, BAR_SIZE, DISTANCE_BETWEEN_BARS, DISTANCE_BETWEEN_CATEGORY_BARS } from './tokens.js';
9
+ import { DISTANCE_BETWEEN_STACKED_BARS, componentIds, BAR_SIZE, DISTANCE_BETWEEN_BARS, DISTANCE_BETWEEN_CATEGORY_BARS } from './tokens.js';
9
10
  import '../../BladeProvider/index.js';
10
11
  import '../../Box/BaseBox/index.js';
11
12
  import '../../../utils/metaAttribute/index.js';
@@ -14,11 +15,14 @@ import isNumber from '../../../utils/lodashButBetter/isNumber.js';
14
15
  import '../../../utils/assignWithoutSideEffects/index.js';
15
16
  import '../../../utils/isValidAllowedChildren/index.js';
16
17
  import '../../../utils/makeAnalyticsAttribute/index.js';
17
- import { jsx } from 'react/jsx-runtime';
18
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
18
19
  import useTheme from '../../BladeProvider/useTheme.js';
19
20
  import useChartsColorTheme from '../utils/useColorTheme.js';
21
+ import { getHighestColorInRange } from '../utils/getHighestColorInRange.js';
20
22
  import { assignWithoutSideEffects } from '../../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
21
23
  import { getComponentId } from '../../../utils/isValidAllowedChildren/isValidAllowedChildren.js';
24
+ import { assignDataColorMapping } from '../utils/assignDataColorMapping/assignDataColorMapping.js';
25
+ import { CommonChartComponentsContext } from '../CommonChartComponents/CommonChartComponentsContext.js';
22
26
  import { BaseBox } from '../../Box/BaseBox/BaseBox.web.js';
23
27
  import { metaAttribute } from '../../../utils/metaAttribute/metaAttribute.web.js';
24
28
  import { makeAnalyticsAttribute } from '../../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
@@ -28,7 +32,7 @@ var _excluded = ["color", "name", "dataKey", "activeBar", "label", "showLegend",
28
32
  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; }
29
33
  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; }
30
34
  // Bar component - resolves Blade color tokens to actual colors
31
- var _ChartBar = function _ChartBar(_ref) {
35
+ var _ChartBar = /*#__PURE__*/React__default.memo(function (_ref) {
32
36
  var color = _ref.color,
33
37
  name = _ref.name,
34
38
  dataKey = _ref.dataKey,
@@ -49,13 +53,19 @@ var _ChartBar = function _ChartBar(_ref) {
49
53
  _colorTheme = _useBarChartContext.colorTheme,
50
54
  totalBars = _useBarChartContext.totalBars;
51
55
  var defaultColorArray = useChartsColorTheme({
52
- colorTheme: _colorTheme
56
+ colorTheme: _colorTheme,
57
+ chartName: 'bar',
58
+ chartDataIndicators: totalBars
53
59
  });
54
- var fill = color ? getIn(theme.colors, color) : defaultColorArray[_index];
60
+ var fill = getIn(theme.colors, color !== null && color !== void 0 ? color : defaultColorArray[_index]);
61
+ var strokeFill = getIn(theme.colors, getHighestColorInRange({
62
+ colorToken: color !== null && color !== void 0 ? color : defaultColorArray[_index],
63
+ followIntensityMapping: Boolean(color)
64
+ }));
55
65
  var isStacked = rest.stackId !== undefined;
56
66
  var animationBegin = isStacked ? theme.motion.duration.gentle / totalBars * _index : theme.motion.duration.gentle;
57
67
  var animationDuration = isStacked ? theme.motion.duration.gentle / totalBars : theme.motion.duration.gentle;
58
- return /*#__PURE__*/jsx(Bar, _objectSpread(_objectSpread({}, rest), {}, {
68
+ return /*#__PURE__*/createElement(Bar, _objectSpread(_objectSpread({}, rest), {}, {
59
69
  fill: fill,
60
70
  legendType: showLegend ? 'rect' : 'none',
61
71
  activeBar: activeBar,
@@ -65,6 +75,7 @@ var _ChartBar = function _ChartBar(_ref) {
65
75
  animationEasing: "linear",
66
76
  dataKey: dataKey,
67
77
  name: name,
78
+ key: "".concat(dataKey, "-").concat(_index, "-").concat(name),
68
79
  shape: function shape(props) {
69
80
  var _ref2 = props,
70
81
  fill = _ref2.fill,
@@ -77,30 +88,45 @@ var _ChartBar = function _ChartBar(_ref) {
77
88
  var gap = DISTANCE_BETWEEN_STACKED_BARS;
78
89
  var isVertical = layout === 'vertical';
79
90
  if (isVertical) {
80
- return /*#__PURE__*/jsx("rect", {
81
- fill: fill,
82
- x: x + gap / 2,
83
- y: y,
84
- width: width - gap,
85
- height: height,
86
- rx: BAR_CHART_CORNER_RADIUS,
87
- ry: BAR_CHART_CORNER_RADIUS,
88
- fillOpacity: fillOpacity
91
+ return /*#__PURE__*/jsxs(Fragment, {
92
+ children: [/*#__PURE__*/jsx("rect", {
93
+ fill: fill,
94
+ x: x + gap / 1.5,
95
+ y: y,
96
+ width: width - gap,
97
+ height: height,
98
+ fillOpacity: fillOpacity
99
+ }), /*#__PURE__*/jsx("rect", {
100
+ fill: strokeFill,
101
+ x: x + gap / 1.5 + (width - gap) - 1.5 // Position at the right end
102
+ ,
103
+ y: y,
104
+ width: width > gap ? 1.5 : 0,
105
+ height: height,
106
+ fillOpacity: fillOpacity
107
+ })]
89
108
  });
90
109
  }
91
- return /*#__PURE__*/jsx("rect", {
92
- fill: fill,
93
- x: x,
94
- y: y + gap / 2,
95
- width: width,
96
- height: height > gap ? height - gap : 0,
97
- rx: BAR_CHART_CORNER_RADIUS,
98
- ry: BAR_CHART_CORNER_RADIUS,
99
- fillOpacity: fillOpacity
110
+ return /*#__PURE__*/jsxs(Fragment, {
111
+ children: [/*#__PURE__*/jsx("rect", {
112
+ fill: fill,
113
+ x: x,
114
+ y: y + gap / 1.5,
115
+ width: width,
116
+ height: height > gap ? height - gap : 0,
117
+ fillOpacity: fillOpacity
118
+ }), /*#__PURE__*/jsx("rect", {
119
+ fill: strokeFill,
120
+ x: x,
121
+ y: y + gap / 1.5,
122
+ width: width,
123
+ height: height > gap ? 1.5 : 0,
124
+ fillOpacity: fillOpacity
125
+ })]
100
126
  });
101
127
  }
102
128
  }));
103
- };
129
+ });
104
130
  var ChartBar = /*#__PURE__*/assignWithoutSideEffects(_ChartBar, {
105
131
  componentId: componentIds.chartBar
106
132
  });
@@ -120,54 +146,92 @@ var ChartBarWrapper = function ChartBarWrapper(_ref3) {
120
146
  _useState2 = _slicedToArray(_useState, 2),
121
147
  activeIndex = _useState2[0],
122
148
  setActiveIndex = _useState2[1];
149
+ var themeColors = useChartsColorTheme({
150
+ colorTheme: colorTheme,
151
+ chartName: 'bar'
152
+ });
123
153
  var _React$useMemo = React__default.useMemo(function () {
154
+ var childrenArray = React__default.Children.toArray(children);
155
+ var dataColorMapping = {};
156
+
157
+ // Count ChartBar components
158
+ var totalBars = childrenArray.filter(function (child) {
159
+ return /*#__PURE__*/React__default.isValidElement(child) && getComponentId(child) === componentIds.chartBar;
160
+ }).length;
124
161
  var BarChartIndex = 0;
162
+ /**
163
+ * We check to check child of ChartBarWrapper. if they have any custom color we store that.
164
+ * We need these mapping because colors of tooltip & legend is determine based on this
165
+ * recharts do provide a color but it is hex code and we need blade color token .
166
+ */
125
167
  var modifiedChildren = React__default.Children.map(children, function (child) {
126
168
  if (/*#__PURE__*/React__default.isValidElement(child) && getComponentId(child) === componentIds.chartBar) {
169
+ var _child$props, _child$props2;
170
+ var childColor = child === null || child === void 0 || (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.color;
171
+ var dataKey = child === null || child === void 0 || (_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.dataKey;
172
+ if (dataKey) {
173
+ // assign colors to the dataColorMapping, if no color is assigned we assign color in `assignDataColorMapping`
174
+ dataColorMapping[dataKey] = {
175
+ colorToken: childColor,
176
+ isCustomColor: Boolean(childColor)
177
+ };
178
+ }
127
179
  return /*#__PURE__*/React__default.cloneElement(child, {
128
180
  _index: BarChartIndex++
129
181
  });
130
182
  }
131
183
  return child;
132
184
  });
185
+ assignDataColorMapping(dataColorMapping, themeColors);
133
186
  return {
134
187
  barChartModifiedChildrens: modifiedChildren,
135
- totalBars: BarChartIndex
188
+ totalBars: totalBars,
189
+ dataColorMapping: dataColorMapping
136
190
  };
137
- }, [children]),
191
+ }, [children, themeColors]),
138
192
  barChartModifiedChildrens = _React$useMemo.barChartModifiedChildrens,
139
- totalBars = _React$useMemo.totalBars;
140
- return /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, metaAttribute({
141
- name: 'bar-chart',
142
- testID: testID
143
- })), makeAnalyticsAttribute(restProps)), {}, {
144
- width: "100%",
145
- height: "100%"
146
- }, restProps), {}, {
147
- children: /*#__PURE__*/jsx(BarChartContext.Provider, {
148
- value: {
149
- layout: layout,
150
- activeIndex: activeIndex,
151
- colorTheme: colorTheme,
152
- totalBars: totalBars
153
- },
154
- children: /*#__PURE__*/jsx(ResponsiveContainer, {
155
- width: "100%",
156
- height: "100%",
157
- children: /*#__PURE__*/jsx(BarChart, {
158
- barSize: BAR_SIZE,
159
- barGap: DISTANCE_BETWEEN_BARS,
160
- barCategoryGap: DISTANCE_BETWEEN_CATEGORY_BARS,
161
- onMouseMove: function onMouseMove(state) {
162
- setActiveIndex(state !== null && state !== void 0 && state.activeIndex ? Number(state === null || state === void 0 ? void 0 : state.activeIndex) : undefined);
163
- },
193
+ totalBars = _React$useMemo.totalBars,
194
+ dataColorMapping = _React$useMemo.dataColorMapping;
195
+ return /*#__PURE__*/jsx(CommonChartComponentsContext.Provider, {
196
+ value: {
197
+ chartName: 'bar',
198
+ dataColorMapping: dataColorMapping
199
+ },
200
+ children: /*#__PURE__*/jsx(BaseBox, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, metaAttribute({
201
+ name: 'bar-chart',
202
+ testID: testID
203
+ })), makeAnalyticsAttribute(restProps)), {}, {
204
+ width: "100%",
205
+ height: "100%"
206
+ }, restProps), {}, {
207
+ children: /*#__PURE__*/jsx(BarChartContext.Provider, {
208
+ value: {
164
209
  layout: layout,
165
- data: data,
166
- children: barChartModifiedChildrens
210
+ activeIndex: activeIndex,
211
+ colorTheme: colorTheme,
212
+ totalBars: totalBars
213
+ },
214
+ children: /*#__PURE__*/jsx(ResponsiveContainer, {
215
+ width: "100%",
216
+ height: "100%",
217
+ children: /*#__PURE__*/jsx(BarChart, {
218
+ barSize: BAR_SIZE,
219
+ barGap: DISTANCE_BETWEEN_BARS,
220
+ barCategoryGap: DISTANCE_BETWEEN_CATEGORY_BARS,
221
+ onMouseMove: function onMouseMove(state) {
222
+ setActiveIndex(state !== null && state !== void 0 && state.activeIndex ? Number(state === null || state === void 0 ? void 0 : state.activeIndex) : undefined);
223
+ },
224
+ onMouseLeave: function onMouseLeave() {
225
+ setActiveIndex(undefined);
226
+ },
227
+ layout: layout,
228
+ data: data,
229
+ children: barChartModifiedChildrens
230
+ })
167
231
  })
168
232
  })
169
- })
170
- }));
233
+ }))
234
+ });
171
235
  };
172
236
 
173
237
  export { ChartBar, ChartBarWrapper };
@@ -1 +1 @@
1
- {"version":3,"file":"BarChart.web.js","sources":["../../../../../../../src/components/Charts/BarChart/BarChart.web.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport {\n BarChart as RechartsBarChart,\n Bar as RechartsBar,\n ResponsiveContainer as RechartsResponsiveContainer,\n} from 'recharts';\nimport { useChartsColorTheme } from '../utils';\nimport { BarChartContext, useBarChartContext } from './BarChartContext';\nimport type { ChartBarProps, ChartBarWrapperProps } from './types';\nimport {\n BAR_CHART_CORNER_RADIUS,\n DISTANCE_BETWEEN_STACKED_BARS,\n componentIds,\n BAR_SIZE,\n DISTANCE_BETWEEN_BARS,\n DISTANCE_BETWEEN_CATEGORY_BARS,\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 isNumber from '~utils/lodashButBetter/isNumber';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\n\nexport type RechartsShapeProps = {\n x: number;\n y: number;\n width: number;\n height: number;\n fill: string;\n index: number;\n};\n\n// Bar component - resolves Blade color tokens to actual colors\nconst _ChartBar: React.FC<ChartBarProps> = ({\n color,\n name,\n dataKey,\n activeBar = false,\n label = false,\n showLegend = true,\n _index = 0,\n ...rest\n}) => {\n const { theme } = useTheme();\n const { layout, activeIndex, colorTheme: _colorTheme, totalBars } = useBarChartContext();\n const defaultColorArray = useChartsColorTheme({ colorTheme: _colorTheme });\n const fill = color ? getIn(theme.colors, color) : defaultColorArray[_index];\n const isStacked = rest.stackId !== undefined;\n const animationBegin = isStacked\n ? (theme.motion.duration.gentle / totalBars) * _index\n : theme.motion.duration.gentle;\n const animationDuration = isStacked\n ? theme.motion.duration.gentle / totalBars\n : theme.motion.duration.gentle;\n\n return (\n <RechartsBar\n {...rest}\n fill={fill}\n legendType={showLegend ? 'rect' : 'none'}\n activeBar={activeBar}\n label={label}\n animationBegin={animationBegin}\n animationDuration={animationDuration}\n animationEasing=\"linear\"\n dataKey={dataKey}\n name={name}\n shape={(props: unknown) => {\n const { fill, x, y, width, height, index: barIndex } = props as RechartsShapeProps;\n const fillOpacity = isNumber(activeIndex) ? (barIndex === activeIndex ? 1 : 0.2) : 1;\n const gap = DISTANCE_BETWEEN_STACKED_BARS;\n const isVertical = layout === 'vertical';\n\n if (isVertical) {\n return (\n <rect\n fill={fill}\n x={x + gap / 2}\n y={y}\n width={width - gap}\n height={height}\n rx={BAR_CHART_CORNER_RADIUS}\n ry={BAR_CHART_CORNER_RADIUS}\n fillOpacity={fillOpacity}\n />\n );\n }\n return (\n <rect\n fill={fill}\n x={x}\n y={y + gap / 2}\n width={width}\n height={height > gap ? height - gap : 0}\n rx={BAR_CHART_CORNER_RADIUS}\n ry={BAR_CHART_CORNER_RADIUS}\n fillOpacity={fillOpacity}\n />\n );\n }}\n />\n );\n};\n\nconst ChartBar = assignWithoutSideEffects(_ChartBar, {\n componentId: componentIds.chartBar,\n});\n\n// BarChart wrapper with default margin, auto-color assignment, and max bars guard\nconst ChartBarWrapper: React.FC<ChartBarWrapperProps & TestID & DataAnalyticsAttribute> = ({\n children,\n colorTheme = 'categorical',\n layout = 'horizontal',\n testID,\n data = [],\n ...restProps\n}) => {\n const [activeIndex, setActiveIndex] = useState<number | undefined>(undefined);\n\n const { barChartModifiedChildrens, totalBars } = React.useMemo(() => {\n let BarChartIndex = 0;\n const modifiedChildren = React.Children.map(children, (child) => {\n if (React.isValidElement(child) && getComponentId(child) === componentIds.chartBar) {\n return React.cloneElement(child, {\n _index: BarChartIndex++,\n } as Partial<ChartBarProps>);\n }\n return child;\n });\n\n return {\n barChartModifiedChildrens: modifiedChildren,\n totalBars: BarChartIndex,\n };\n }, [children]);\n\n return (\n <BaseBox\n {...metaAttribute({ name: 'bar-chart', testID })}\n {...makeAnalyticsAttribute(restProps)}\n width=\"100%\"\n height=\"100%\"\n {...restProps}\n >\n <BarChartContext.Provider\n value={{\n layout,\n activeIndex,\n colorTheme,\n totalBars,\n }}\n >\n <RechartsResponsiveContainer width=\"100%\" height=\"100%\">\n <RechartsBarChart\n barSize={BAR_SIZE}\n barGap={DISTANCE_BETWEEN_BARS}\n barCategoryGap={DISTANCE_BETWEEN_CATEGORY_BARS}\n onMouseMove={(state) => {\n setActiveIndex(state?.activeIndex ? Number(state?.activeIndex) : undefined);\n }}\n layout={layout}\n data={data}\n >\n {barChartModifiedChildrens}\n </RechartsBarChart>\n </RechartsResponsiveContainer>\n </BarChartContext.Provider>\n </BaseBox>\n );\n};\n\nexport { ChartBarWrapper, ChartBar };\nexport type { ChartBarProps, ChartBarWrapperProps };\n"],"names":["_ChartBar","_ref","color","name","dataKey","_ref$activeBar","activeBar","_ref$label","label","_ref$showLegend","showLegend","_ref$_index","_index","rest","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","_useBarChartContext","useBarChartContext","layout","activeIndex","_colorTheme","colorTheme","totalBars","defaultColorArray","useChartsColorTheme","fill","getIn","colors","isStacked","stackId","undefined","animationBegin","motion","duration","gentle","animationDuration","_jsx","RechartsBar","_objectSpread","legendType","animationEasing","shape","props","_ref2","x","y","width","height","barIndex","index","fillOpacity","isNumber","gap","DISTANCE_BETWEEN_STACKED_BARS","isVertical","rx","BAR_CHART_CORNER_RADIUS","ry","ChartBar","assignWithoutSideEffects","componentId","componentIds","chartBar","ChartBarWrapper","_ref3","children","_ref3$colorTheme","_ref3$layout","testID","_ref3$data","data","restProps","_excluded2","_useState","useState","_useState2","_slicedToArray","setActiveIndex","_React$useMemo","React","useMemo","BarChartIndex","modifiedChildren","Children","map","child","isValidElement","getComponentId","cloneElement","barChartModifiedChildrens","BaseBox","metaAttribute","makeAnalyticsAttribute","BarChartContext","Provider","value","RechartsResponsiveContainer","RechartsBarChart","barSize","BAR_SIZE","barGap","DISTANCE_BETWEEN_BARS","barCategoryGap","DISTANCE_BETWEEN_CATEGORY_BARS","onMouseMove","state","Number"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA;AACA,IAAMA,SAAkC,GAAG,SAArCA,SAAkCA,CAAAC,IAAA,EASlC;AAAA,EAAA,IARJC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACJC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IAAAC,cAAA,GAAAJ,IAAA,CACPK,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,cAAA;IAAAE,UAAA,GAAAN,IAAA,CACjBO,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,UAAA;IAAAE,eAAA,GAAAR,IAAA,CACbS,UAAU;AAAVA,IAAAA,UAAU,GAAAD,eAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,eAAA;IAAAE,WAAA,GAAAV,IAAA,CACjBW,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,CAAC,GAAAA,WAAA;AACPE,IAAAA,IAAI,GAAAC,wBAAA,CAAAb,IAAA,EAAAc,SAAA,CAAA,CAAA;AAEP,EAAA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AAA,EAAA;AAAAN,IAAAA,QAAA,eAEb7B,GAAA,CAACyD,eAAe,CAACC,QAAQ,EAAA;AACvBC,MAAAA,KAAK,EAAE;AACL7E,QAAAA,MAAM,EAANA,MAAM;AACNC,QAAAA,WAAW,EAAXA,WAAW;AACXE,QAAAA,UAAU,EAAVA,UAAU;AACVC,QAAAA,SAAS,EAATA,SAAAA;OACA;MAAA2C,QAAA,eAEF7B,GAAA,CAAC4D,mBAA2B,EAAA;AAAClD,QAAAA,KAAK,EAAC,MAAM;AAACC,QAAAA,MAAM,EAAC,MAAM;QAAAkB,QAAA,eACrD7B,GAAA,CAAC6D,QAAgB,EAAA;AACfC,UAAAA,OAAO,EAAEC,QAAS;AAClBC,UAAAA,MAAM,EAAEC,qBAAsB;AAC9BC,UAAAA,cAAc,EAAEC,8BAA+B;AAC/CC,UAAAA,WAAW,EAAE,SAAbA,WAAWA,CAAGC,KAAK,EAAK;YACtB5B,cAAc,CAAC4B,KAAK,KAALA,IAAAA,IAAAA,KAAK,eAALA,KAAK,CAAEtF,WAAW,GAAGuF,MAAM,CAACD,KAAK,KAAA,IAAA,IAALA,KAAK,KAALA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,KAAK,CAAEtF,WAAW,CAAC,GAAGW,SAAS,CAAC,CAAA;WAC3E;AACFZ,UAAAA,MAAM,EAAEA,MAAO;AACfoD,UAAAA,IAAI,EAAEA,IAAK;AAAAL,UAAAA,QAAA,EAEVwB,yBAAAA;SACe,CAAA;OACS,CAAA;KACL,CAAA;AAAC,GAAA,CACpB,CAAC,CAAA;AAEd;;;;"}
1
+ {"version":3,"file":"BarChart.web.js","sources":["../../../../../../../src/components/Charts/BarChart/BarChart.web.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport {\n BarChart as RechartsBarChart,\n Bar as RechartsBar,\n ResponsiveContainer as RechartsResponsiveContainer,\n} from 'recharts';\nimport { useChartsColorTheme, getHighestColorInRange, assignDataColorMapping } from '../utils';\nimport { CommonChartComponentsContext } from '../CommonChartComponents';\nimport type { DataColorMapping } from '../CommonChartComponents';\nimport { BarChartContext, useBarChartContext } from './BarChartContext';\nimport type { ChartBarProps, ChartBarWrapperProps } from './types';\nimport {\n DISTANCE_BETWEEN_STACKED_BARS,\n componentIds,\n BAR_SIZE,\n DISTANCE_BETWEEN_BARS,\n DISTANCE_BETWEEN_CATEGORY_BARS,\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 isNumber from '~utils/lodashButBetter/isNumber';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getComponentId } from '~utils/isValidAllowedChildren';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport type { DataAnalyticsAttribute, TestID } from '~utils/types';\n\nexport type RechartsShapeProps = {\n x: number;\n y: number;\n width: number;\n height: number;\n fill: string;\n index: number;\n};\n\n// Bar component - resolves Blade color tokens to actual colors\nconst _ChartBar: React.FC<ChartBarProps> = React.memo(\n ({\n color,\n name,\n dataKey,\n activeBar = false,\n label = false,\n showLegend = true,\n _index = 0,\n ...rest\n }) => {\n const { theme } = useTheme();\n const { layout, activeIndex, colorTheme: _colorTheme, totalBars } = useBarChartContext();\n const defaultColorArray = useChartsColorTheme({\n colorTheme: _colorTheme,\n chartName: 'bar',\n chartDataIndicators: totalBars,\n });\n const fill = getIn(theme.colors, color ?? defaultColorArray[_index]);\n const strokeFill = getIn(\n theme.colors,\n getHighestColorInRange({\n colorToken: color ?? defaultColorArray[_index],\n followIntensityMapping: Boolean(color),\n }),\n );\n\n const isStacked = rest.stackId !== undefined;\n const animationBegin = isStacked\n ? (theme.motion.duration.gentle / totalBars) * _index\n : theme.motion.duration.gentle;\n const animationDuration = isStacked\n ? theme.motion.duration.gentle / totalBars\n : theme.motion.duration.gentle;\n\n return (\n <RechartsBar\n {...rest}\n fill={fill}\n legendType={showLegend ? 'rect' : 'none'}\n activeBar={activeBar}\n label={label}\n animationBegin={animationBegin}\n animationDuration={animationDuration}\n animationEasing=\"linear\"\n dataKey={dataKey}\n name={name}\n key={`${dataKey}-${_index}-${name}`}\n shape={(props: unknown) => {\n const { fill, x, y, width, height, index: barIndex } = props as RechartsShapeProps;\n const fillOpacity = isNumber(activeIndex) ? (barIndex === activeIndex ? 1 : 0.2) : 1;\n const gap = DISTANCE_BETWEEN_STACKED_BARS;\n const isVertical = layout === 'vertical';\n\n if (isVertical) {\n return (\n <>\n <rect\n fill={fill}\n x={x + gap / 1.5}\n y={y}\n width={width - gap}\n height={height}\n fillOpacity={fillOpacity}\n />\n <rect\n fill={strokeFill}\n x={x + gap / 1.5 + (width - gap) - 1.5} // Position at the right end\n y={y}\n width={width > gap ? 1.5 : 0}\n height={height}\n fillOpacity={fillOpacity}\n />\n </>\n );\n }\n return (\n <>\n <rect\n fill={fill}\n x={x}\n y={y + gap / 1.5}\n width={width}\n height={height > gap ? height - gap : 0}\n fillOpacity={fillOpacity}\n />\n <rect\n fill={strokeFill}\n x={x}\n y={y + gap / 1.5}\n width={width}\n height={height > gap ? 1.5 : 0}\n fillOpacity={fillOpacity}\n />\n </>\n );\n }}\n />\n );\n },\n);\n\nconst ChartBar = assignWithoutSideEffects(_ChartBar, {\n componentId: componentIds.chartBar,\n});\n\n// BarChart wrapper with default margin, auto-color assignment, and max bars guard\nconst ChartBarWrapper: React.FC<ChartBarWrapperProps & TestID & DataAnalyticsAttribute> = ({\n children,\n colorTheme = 'categorical',\n layout = 'horizontal',\n testID,\n data = [],\n ...restProps\n}) => {\n const [activeIndex, setActiveIndex] = useState<number | undefined>(undefined);\n\n const themeColors = useChartsColorTheme({\n colorTheme,\n chartName: 'bar',\n });\n\n const { barChartModifiedChildrens, totalBars, dataColorMapping } = React.useMemo(() => {\n const childrenArray = React.Children.toArray(children);\n const dataColorMapping: DataColorMapping = {};\n\n // Count ChartBar components\n const totalBars = childrenArray.filter(\n (child): child is React.ReactElement =>\n React.isValidElement(child) && getComponentId(child) === componentIds.chartBar,\n ).length;\n\n let BarChartIndex = 0;\n /**\n * We check to check child of ChartBarWrapper. 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 const modifiedChildren = React.Children.map(children, (child) => {\n if (React.isValidElement(child) && getComponentId(child) === componentIds.chartBar) {\n const childColor = child?.props?.color;\n const dataKey = (child?.props as ChartBarProps)?.dataKey as string;\n if (dataKey) {\n // assign colors to the dataColorMapping, if no color is assigned we assign color in `assignDataColorMapping`\n dataColorMapping[dataKey] = {\n colorToken: childColor,\n isCustomColor: Boolean(childColor),\n };\n }\n return React.cloneElement(child, {\n _index: BarChartIndex++,\n } as Partial<ChartBarProps>);\n }\n return child;\n });\n assignDataColorMapping(dataColorMapping, themeColors);\n\n return {\n barChartModifiedChildrens: modifiedChildren,\n totalBars,\n dataColorMapping,\n };\n }, [children, themeColors]);\n\n return (\n <CommonChartComponentsContext.Provider value={{ chartName: 'bar', dataColorMapping }}>\n <BaseBox\n {...metaAttribute({ name: 'bar-chart', testID })}\n {...makeAnalyticsAttribute(restProps)}\n width=\"100%\"\n height=\"100%\"\n {...restProps}\n >\n <BarChartContext.Provider\n value={{\n layout,\n activeIndex,\n colorTheme,\n totalBars,\n }}\n >\n <RechartsResponsiveContainer width=\"100%\" height=\"100%\">\n <RechartsBarChart\n barSize={BAR_SIZE}\n barGap={DISTANCE_BETWEEN_BARS}\n barCategoryGap={DISTANCE_BETWEEN_CATEGORY_BARS}\n onMouseMove={(state) => {\n setActiveIndex(state?.activeIndex ? Number(state?.activeIndex) : undefined);\n }}\n onMouseLeave={() => {\n setActiveIndex(undefined);\n }}\n layout={layout}\n data={data}\n >\n {barChartModifiedChildrens}\n </RechartsBarChart>\n </RechartsResponsiveContainer>\n </BarChartContext.Provider>\n </BaseBox>\n </CommonChartComponentsContext.Provider>\n );\n};\n\nexport { ChartBarWrapper, ChartBar };\nexport type { ChartBarProps, ChartBarWrapperProps };\n"],"names":["_ChartBar","React","memo","_ref","color","name","dataKey","_ref$activeBar","activeBar","_ref$label","label","_ref$showLegend","showLegend","_ref$_index","_index","rest","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","_useBarChartContext","useBarChartContext","layout","activeIndex","_colorTheme","colorTheme","totalBars","defaultColorArray","useChartsColorTheme","chartName","chartDataIndicators","fill","getIn","colors","strokeFill","getHighestColorInRange","colorToken","followIntensityMapping","Boolean","isStacked","stackId","undefined","animationBegin","motion","duration","gentle","animationDuration","_createElement","RechartsBar","_objectSpread","legendType","animationEasing","key","concat","shape","props","_ref2","x","y","width","height","barIndex","index","fillOpacity","isNumber","gap","DISTANCE_BETWEEN_STACKED_BARS","isVertical","_jsxs","_Fragment","children","_jsx","ChartBar","assignWithoutSideEffects","componentId","componentIds","chartBar","ChartBarWrapper","_ref3","_ref3$colorTheme","_ref3$layout","testID","_ref3$data","data","restProps","_excluded2","_useState","useState","_useState2","_slicedToArray","setActiveIndex","themeColors","_React$useMemo","useMemo","childrenArray","Children","toArray","dataColorMapping","filter","child","isValidElement","getComponentId","length","BarChartIndex","modifiedChildren","map","_child$props","_child$props2","childColor","isCustomColor","cloneElement","assignDataColorMapping","barChartModifiedChildrens","CommonChartComponentsContext","Provider","value","BaseBox","metaAttribute","makeAnalyticsAttribute","BarChartContext","RechartsResponsiveContainer","RechartsBarChart","barSize","BAR_SIZE","barGap","DISTANCE_BETWEEN_BARS","barCategoryGap","DISTANCE_BETWEEN_CATEGORY_BARS","onMouseMove","state","Number","onMouseLeave"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA;AACA,IAAMA,SAAkC,gBAAGC,cAAK,CAACC,IAAI,CACnD,UAAAC,IAAA,EASM;AAAA,EAAA,IARJC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IACJC,OAAO,GAAAH,IAAA,CA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