datastake-daf 0.6.380 → 0.6.381

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 (32) hide show
  1. package/dist/components/index.js +345 -220
  2. package/dist/utils/index.js +24 -0
  3. package/package.json +2 -2
  4. package/src/@daf/core/components/Charts/AreaChart/AreaChart.stories.jsx +444 -1
  5. package/src/@daf/core/components/Charts/AreaChart/index.jsx +27 -12
  6. package/src/@daf/core/components/Charts/BarChart/BarChart.stories.jsx +88 -0
  7. package/src/@daf/core/components/Charts/BarChart/index.jsx +27 -12
  8. package/src/@daf/core/components/Charts/ColumnChart/ColumnChart.stories.jsx +23 -28
  9. package/src/@daf/core/components/Charts/ColumnChart/index.jsx +42 -20
  10. package/src/@daf/core/components/Charts/DonutPie/DonutPie.stories.jsx +55 -0
  11. package/src/@daf/core/components/Charts/DonutPie/index.js +21 -11
  12. package/src/@daf/core/components/Charts/DualAxes/DualAxes.stories.js +33 -0
  13. package/src/@daf/core/components/Charts/DualAxes/index.js +21 -0
  14. package/src/@daf/core/components/Charts/LineChart/LineChart.stories.jsx +81 -0
  15. package/src/@daf/core/components/Charts/LineChart/index.jsx +21 -12
  16. package/src/@daf/core/components/Charts/PieChart/PieChart.stories.js +52 -0
  17. package/src/@daf/core/components/Charts/PieChart/chart.jsx +20 -90
  18. package/src/@daf/core/components/Charts/RadarChart/RadarChart.stories.jsx +52 -0
  19. package/src/@daf/core/components/Charts/RadarChart/index.jsx +21 -0
  20. package/src/@daf/core/components/Charts/RadialBarChart/RadialBarChart.stories.jsx +56 -0
  21. package/src/@daf/core/components/Charts/RadialBarChart/index.jsx +22 -0
  22. package/src/@daf/core/components/Charts/StackChart/StackChart.stories.jsx +22 -0
  23. package/src/@daf/core/components/Charts/StackChart/index.jsx +22 -14
  24. package/src/@daf/core/components/Charts/components/CustomLegend/index.js +80 -0
  25. package/src/@daf/core/components/Charts/helper.js +25 -0
  26. package/src/@daf/core/components/Screens/Admin/AdminModals/AddUser/index.jsx +2 -4
  27. package/src/@daf/core/components/Screens/Admin/AdminModals/NewUser/index.jsx +5 -23
  28. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Edit/index.jsx +1 -12
  29. package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +0 -2
  30. package/src/helpers/StringHelper.js +29 -0
  31. package/src/utils.js +1 -1
  32. package/dist/style/datastake/mapbox-gl.css +0 -330
@@ -45763,7 +45763,7 @@ dt.div`
45763
45763
  }
45764
45764
 
45765
45765
  `;
45766
- const LegendStyle = dt.ul`
45766
+ dt.ul`
45767
45767
  list-style: none;
45768
45768
  margin: var(--size-lg) 0 0;
45769
45769
  padding: 0;
@@ -45788,6 +45788,98 @@ const LegendStyle = dt.ul`
45788
45788
  }
45789
45789
  `;
45790
45790
 
45791
+ const useLegendConfig = ({
45792
+ legendConfig,
45793
+ isPdf
45794
+ }) => {
45795
+ const {
45796
+ enabled,
45797
+ position: legendPosition = 'bottom',
45798
+ items: _legendItems = null,
45799
+ layout: legendLayout = 'horizontal',
45800
+ interactive: legendInteractive = true,
45801
+ style: legendStyle = {}
45802
+ } = legendConfig;
45803
+ const legendEnabled = enabled !== undefined ? isPdf || enabled : isPdf;
45804
+ const [legendItems, setLegendItems] = React__default["default"].useState(_legendItems);
45805
+ return {
45806
+ legendEnabled,
45807
+ legendItems,
45808
+ legendPosition,
45809
+ legendLayout,
45810
+ legendInteractive,
45811
+ legendStyle
45812
+ };
45813
+ };
45814
+
45815
+ const CustomLegend = ({
45816
+ items = [],
45817
+ onToggle,
45818
+ layout = 'horizontal',
45819
+ interactive = true,
45820
+ style = {}
45821
+ }) => {
45822
+ const isVertical = layout === 'vertical';
45823
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
45824
+ style: {
45825
+ display: "flex",
45826
+ justifyContent: "center",
45827
+ alignItems: isVertical ? "flex-start" : "center",
45828
+ flexDirection: isVertical ? "column" : "row",
45829
+ flexWrap: isVertical ? "nowrap" : "wrap",
45830
+ gap: isVertical ? "12px" : "20px",
45831
+ paddingTop: "16px",
45832
+ ...style
45833
+ },
45834
+ children: items.map((item, index) => /*#__PURE__*/jsxRuntime.jsxs("div", {
45835
+ onClick: () => interactive && onToggle && onToggle(item.id),
45836
+ style: {
45837
+ display: "flex",
45838
+ alignItems: "flex-start",
45839
+ opacity: item.hidden ? 0.4 : 1,
45840
+ transition: "opacity 0.2s ease",
45841
+ userSelect: "none",
45842
+ maxWidth: isVertical ? "300px" : "auto"
45843
+ },
45844
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
45845
+ style: {
45846
+ width: 16,
45847
+ height: 16,
45848
+ backgroundColor: item.color,
45849
+ marginRight: 8,
45850
+ borderRadius: 3,
45851
+ flexShrink: 0,
45852
+ marginTop: 2,
45853
+ border: item.hidden ? "2px solid #d9d9d9" : "none",
45854
+ boxSizing: "border-box"
45855
+ }
45856
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
45857
+ style: {
45858
+ display: "flex",
45859
+ flexDirection: "column",
45860
+ gap: "4px"
45861
+ },
45862
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
45863
+ style: {
45864
+ fontSize: 14,
45865
+ fontWeight: 500,
45866
+ color: item.hidden ? "#999" : "#262626",
45867
+ lineHeight: "20px"
45868
+ },
45869
+ children: item.label
45870
+ }), item.description && /*#__PURE__*/jsxRuntime.jsx("span", {
45871
+ style: {
45872
+ fontSize: 12,
45873
+ color: item.hidden ? "#bfbfbf" : "#8c8c8c",
45874
+ lineHeight: "18px"
45875
+ },
45876
+ children: item.description
45877
+ })]
45878
+ })]
45879
+ }, index))
45880
+ });
45881
+ };
45882
+
45791
45883
  const Chart = _ref => {
45792
45884
  let {
45793
45885
  data = [],
@@ -45804,6 +45896,7 @@ const Chart = _ref => {
45804
45896
  children = null,
45805
45897
  legend,
45806
45898
  isPdf = false,
45899
+ legendConfig = {},
45807
45900
  isPercentage = false
45808
45901
  } = _ref;
45809
45902
  const [hoveredGroup, setHoveredGroup] = React.useState(null);
@@ -45812,6 +45905,17 @@ const Chart = _ref => {
45812
45905
  const [mouseY, setMouseY] = React.useState(0);
45813
45906
  const [mouseX, setMouseX] = React.useState(0);
45814
45907
  const [mouseLocked, setMouseLocked] = React.useState(false);
45908
+ const {
45909
+ legendEnabled,
45910
+ legendItems,
45911
+ legendPosition,
45912
+ legendLayout,
45913
+ legendInteractive,
45914
+ legendStyle
45915
+ } = useLegendConfig({
45916
+ legendConfig,
45917
+ isPdf
45918
+ });
45815
45919
  const getCoordinatesForPercent = React.useCallback(percent => [Math.cos(2 * Math.PI * percent), Math.sin(2 * Math.PI * percent)], []);
45816
45920
  const onMouseLeaveHandler = React.useCallback((e, hG, id) => {
45817
45921
  if (mouseLocked) {
@@ -45835,31 +45939,6 @@ const Chart = _ref => {
45835
45939
  }));
45836
45940
  }
45837
45941
  }, [svgRef, containerRef, hoveredGroup, mouseLocked]);
45838
- const legendConfig = React.useMemo(() => {
45839
- if (legend === false || legend === null) {
45840
- return isPdf ? {} : null;
45841
- }
45842
- if (typeof legend === 'object') {
45843
- return legend;
45844
- }
45845
- if (legend === true || isPdf) {
45846
- return {};
45847
- }
45848
- return null;
45849
- }, [legend, isPdf]);
45850
- const legendItems = React.useMemo(() => {
45851
- const items = Array.isArray(data) ? data : [];
45852
- if (!legendConfig) {
45853
- return [];
45854
- }
45855
- const {
45856
- itemName
45857
- } = legendConfig;
45858
- const getName = typeof (itemName === null || itemName === void 0 ? void 0 : itemName.formatter) === 'function' ? (item, index) => itemName.formatter(item.name || item.label || "Item ".concat(index + 1), item, index) : (item, index) => item.name || item.label || "Item ".concat(index + 1);
45859
- return items.map((item, index) => _objectSpread2(_objectSpread2({}, item), {}, {
45860
- label: getName(item, index)
45861
- }));
45862
- }, [data, legendConfig]);
45863
45942
  const dataToShow = React.useMemo(() => {
45864
45943
  let cumulativePercent = 0;
45865
45944
  function getRotationAngle(percent) {
@@ -45959,59 +46038,11 @@ const Chart = _ref => {
45959
46038
  onMouseMove: e => onMouseLeaveHandler(e, {}, 0)
45960
46039
  } : {}), {}, {
45961
46040
  children: dataToShow
45962
- })), tooltip, !!legendConfig && legendItems.length > 0 && /*#__PURE__*/jsxRuntime.jsx(LegendStyle, {
45963
- className: legendConfig === null || legendConfig === void 0 ? void 0 : legendConfig.className,
45964
- "data-position": (legendConfig === null || legendConfig === void 0 ? void 0 : legendConfig.position) || 'bottom',
45965
- children: legendItems.map((item, index) => {
45966
- var _item$id;
45967
- const markerStyle = (legendConfig === null || legendConfig === void 0 ? void 0 : legendConfig.marker) || {};
45968
- return /*#__PURE__*/jsxRuntime.jsxs("li", {
45969
- className: item.className,
45970
- onMouseEnter: () => {
45971
- if (mouseLocked) {
45972
- return;
45973
- }
45974
- setHoveredGroup(_objectSpread2(_objectSpread2({}, item), {}, {
45975
- id: index,
45976
- fromLegend: true
45977
- }));
45978
- },
45979
- onMouseLeave: () => {
45980
- if (mouseLocked) {
45981
- return;
45982
- }
45983
- setHoveredGroup(null);
45984
- },
45985
- onClick: () => {
45986
- if (!changeOpacityOnHover) {
45987
- return;
45988
- }
45989
- if ((hoveredGroup === null || hoveredGroup === void 0 ? void 0 : hoveredGroup.id) === index && hoveredGroup !== null && hoveredGroup !== void 0 && hoveredGroup.fromLegend) {
45990
- setHoveredGroup(null);
45991
- setMouseLocked(false);
45992
- return;
45993
- }
45994
- setHoveredGroup(_objectSpread2(_objectSpread2({}, item), {}, {
45995
- id: index,
45996
- fromLegend: true
45997
- }));
45998
- setMouseLocked(prev => !prev);
45999
- },
46000
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
46001
- className: "legend-marker",
46002
- style: {
46003
- backgroundColor: item.color,
46004
- width: (markerStyle === null || markerStyle === void 0 ? void 0 : markerStyle.size) || 12,
46005
- height: (markerStyle === null || markerStyle === void 0 ? void 0 : markerStyle.size) || 12,
46006
- borderRadius: (markerStyle === null || markerStyle === void 0 ? void 0 : markerStyle.shape) === 'square' ? 2 : '50%',
46007
- border: (markerStyle === null || markerStyle === void 0 ? void 0 : markerStyle.style) === 'line' ? "2px solid ".concat(item.color) : undefined,
46008
- background: (markerStyle === null || markerStyle === void 0 ? void 0 : markerStyle.style) === 'line' ? 'transparent' : item.color
46009
- }
46010
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
46011
- children: item.label
46012
- })]
46013
- }, (_item$id = item.id) !== null && _item$id !== void 0 ? _item$id : index);
46014
- })
46041
+ })), tooltip, legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
46042
+ items: legendItems,
46043
+ layout: legendLayout,
46044
+ interactive: legendInteractive,
46045
+ style: legendStyle
46015
46046
  }), children]
46016
46047
  });
46017
46048
  };
@@ -49381,7 +49412,7 @@ const Container$1 = dt.div`
49381
49412
  width: ${props => props.isPdf ? props.width ? props.width : '1000px' : 'calc(100% - 48px)'};
49382
49413
  `;
49383
49414
 
49384
- const _excluded$7 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "isPercentage", "seriesField", "formattedYAxis", "formattedXAxis", "color", "height", "t", "isPdf", "extraLegendConfig", "width"];
49415
+ const _excluded$7 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "isPercentage", "seriesField", "formattedYAxis", "formattedXAxis", "color", "height", "t", "isPdf", "legendConfig", "width"];
49385
49416
  const {
49386
49417
  useToken: useToken$g
49387
49418
  } = antd.theme;
@@ -49467,7 +49498,7 @@ function BarChart(_ref) {
49467
49498
  height,
49468
49499
  t = s => s,
49469
49500
  isPdf = false,
49470
- extraLegendConfig = {},
49501
+ legendConfig = {},
49471
49502
  width
49472
49503
  } = _ref;
49473
49504
  _objectWithoutProperties(_ref, _excluded$7);
@@ -49476,7 +49507,17 @@ function BarChart(_ref) {
49476
49507
  const {
49477
49508
  token
49478
49509
  } = useToken$g();
49479
- const hasLegendConfig = Object.keys(extraLegendConfig).length > 0;
49510
+ const {
49511
+ legendEnabled,
49512
+ legendItems,
49513
+ legendPosition,
49514
+ legendLayout,
49515
+ legendInteractive,
49516
+ legendStyle
49517
+ } = useLegendConfig({
49518
+ legendConfig,
49519
+ isPdf
49520
+ });
49480
49521
  React__default["default"].useEffect(() => {
49481
49522
  if (!containerRef.current) {
49482
49523
  return;
@@ -49507,12 +49548,7 @@ function BarChart(_ref) {
49507
49548
  isStack,
49508
49549
  color: color || token.colorPrimary7,
49509
49550
  seriesField,
49510
- legend: isPdf ? _objectSpread2({
49511
- itemName: {
49512
- formatter: text => t(text)
49513
- },
49514
- position: 'bottom'
49515
- }, extraLegendConfig) : hasLegendConfig || false,
49551
+ legend: false,
49516
49552
  animation: animated
49517
49553
  };
49518
49554
  if (!chartRef.current) {
@@ -49530,21 +49566,26 @@ function BarChart(_ref) {
49530
49566
  }
49531
49567
  };
49532
49568
  }, []);
49533
- return /*#__PURE__*/jsxRuntime.jsx("div", {
49569
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
49534
49570
  className: "flex flex-1 flex-column justify-content-center",
49535
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
49571
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
49536
49572
  className: "flex justify-content-center",
49537
49573
  children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
49538
49574
  ref: containerRef,
49539
49575
  height: height,
49540
- isPdf: isPdf,
49576
+ isPdf: false,
49541
49577
  width: width
49542
49578
  })
49543
- })
49579
+ }), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
49580
+ items: legendItems,
49581
+ layout: legendLayout,
49582
+ interactive: legendInteractive,
49583
+ style: legendStyle
49584
+ })]
49544
49585
  });
49545
49586
  }
49546
49587
 
49547
- const _excluded$6 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isSmooth", "seriesField", "isArea", "formattedYAxis", "formattedXAxis", "color", "isPercentage", "height", "autoHideXLabel", "t", "isPdf", "extraLegendConfig", "width"];
49588
+ const _excluded$6 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isSmooth", "seriesField", "isArea", "formattedYAxis", "formattedXAxis", "color", "isPercentage", "height", "autoHideXLabel", "t", "isPdf", "legendConfig", "width"];
49548
49589
  const {
49549
49590
  useToken: useToken$f
49550
49591
  } = antd.theme;
@@ -49628,7 +49669,7 @@ function LineChart(_ref) {
49628
49669
  autoHideXLabel = true,
49629
49670
  t = s => s,
49630
49671
  isPdf = false,
49631
- extraLegendConfig = {},
49672
+ legendConfig = {},
49632
49673
  width
49633
49674
  } = _ref;
49634
49675
  _objectWithoutProperties(_ref, _excluded$6);
@@ -49637,7 +49678,17 @@ function LineChart(_ref) {
49637
49678
  const {
49638
49679
  token
49639
49680
  } = useToken$f();
49640
- const hasLegendConfig = Object.keys(extraLegendConfig).length > 0;
49681
+ const {
49682
+ legendEnabled,
49683
+ legendItems,
49684
+ legendPosition,
49685
+ legendLayout,
49686
+ legendInteractive,
49687
+ legendStyle
49688
+ } = useLegendConfig({
49689
+ legendConfig,
49690
+ isPdf
49691
+ });
49641
49692
  React__default["default"].useEffect(() => {
49642
49693
  if (!containerRef.current) {
49643
49694
  return;
@@ -49681,12 +49732,7 @@ function LineChart(_ref) {
49681
49732
  fillOpacity: isArea ? 0.15 : 0
49682
49733
  }
49683
49734
  },
49684
- legend: isPdf ? _objectSpread2({
49685
- itemName: {
49686
- formatter: text => t(text)
49687
- },
49688
- position: 'bottom'
49689
- }, extraLegendConfig) : hasLegendConfig || false
49735
+ legend: false
49690
49736
  };
49691
49737
  if (!chartRef.current) {
49692
49738
  chartRef.current = new g2plot.Line(containerRef.current, config);
@@ -49694,7 +49740,7 @@ function LineChart(_ref) {
49694
49740
  } else {
49695
49741
  chartRef.current.update(config);
49696
49742
  }
49697
- }, [data, containerRef.current, isSmooth, animated, xFieldKey, yFieldKey, seriesField, isArea, color, token.colorPrimary7, formattedXAxis, formattedYAxis, isPercentage, renderTooltipContent, tooltipConfig, isPdf, extraLegendConfig, t]);
49743
+ }, [data, containerRef.current, isSmooth, animated, xFieldKey, yFieldKey, seriesField, isArea, color, token.colorPrimary7, formattedXAxis, formattedYAxis, isPercentage, renderTooltipContent, tooltipConfig, isPdf, t]);
49698
49744
  React__default["default"].useEffect(() => {
49699
49745
  return () => {
49700
49746
  if (chartRef.current) {
@@ -49703,9 +49749,9 @@ function LineChart(_ref) {
49703
49749
  }
49704
49750
  };
49705
49751
  }, []);
49706
- return /*#__PURE__*/jsxRuntime.jsx("div", {
49752
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
49707
49753
  className: "flex flex-1 flex-column justify-content-center",
49708
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
49754
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
49709
49755
  className: "flex justify-content-center",
49710
49756
  children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
49711
49757
  ref: containerRef,
@@ -49713,11 +49759,16 @@ function LineChart(_ref) {
49713
49759
  isPdf: isPdf,
49714
49760
  width: width
49715
49761
  })
49716
- })
49762
+ }), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
49763
+ items: legendItems,
49764
+ layout: legendLayout,
49765
+ interactive: legendInteractive,
49766
+ style: legendStyle
49767
+ })]
49717
49768
  });
49718
49769
  }
49719
49770
 
49720
- const _excluded$5 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "seriesField", "isPercentage", "showBackground", "formattedYAxis", "formattedXAxis", "color", "height", "groupField", "t", "isPdf", "extraLegendConfig", "shouldSeperateLegendName", "width"];
49771
+ const _excluded$5 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "seriesField", "isPercentage", "showBackground", "formattedYAxis", "formattedXAxis", "color", "height", "groupField", "width", "legendConfig", "isPdf"];
49721
49772
  const {
49722
49773
  useToken: useToken$e
49723
49774
  } = antd.theme;
@@ -49782,6 +49833,20 @@ const {
49782
49833
  * - `color` (string | string[] | function):
49783
49834
  * Custom color or color function for bars. If not provided, falls back to Ant Design's theme primary color.
49784
49835
  *
49836
+ * - `legendConfig` (object):
49837
+ * Configuration for the custom legend:
49838
+ * {
49839
+ * enabled: boolean, // Show/hide the legend (default: false)
49840
+ * position: 'top' | 'bottom', // Legend position (default: 'bottom')
49841
+ * items: Array<{ // Manual legend items (optional, auto-generated from data if not provided)
49842
+ * label: string, // Display label
49843
+ * color: string, // Color for this item
49844
+ * description?: string // Optional description/explanation
49845
+ * }>,
49846
+ * layout: 'horizontal' | 'vertical', // Legend layout (default: 'horizontal')
49847
+ * interactive: boolean, // Allow clicking to filter data (default: true)
49848
+ * style: object // Custom CSS styles for legend container
49849
+ * }
49785
49850
  */
49786
49851
 
49787
49852
  function ColumnChart(_ref) {
@@ -49802,11 +49867,9 @@ function ColumnChart(_ref) {
49802
49867
  color,
49803
49868
  height,
49804
49869
  groupField,
49805
- t = s => s,
49806
- isPdf = false,
49807
- extraLegendConfig = {},
49808
- shouldSeperateLegendName = false,
49809
- width
49870
+ width,
49871
+ legendConfig = {},
49872
+ isPdf = false
49810
49873
  } = _ref;
49811
49874
  _objectWithoutProperties(_ref, _excluded$5);
49812
49875
  const containerRef = React__default["default"].useRef(null);
@@ -49814,7 +49877,17 @@ function ColumnChart(_ref) {
49814
49877
  const {
49815
49878
  token
49816
49879
  } = useToken$e();
49817
- const hasLegendConfig = Object.keys(extraLegendConfig).length > 0;
49880
+ const {
49881
+ legendEnabled,
49882
+ legendItems,
49883
+ legendPosition,
49884
+ legendLayout,
49885
+ legendInteractive,
49886
+ legendStyle
49887
+ } = useLegendConfig({
49888
+ legendConfig,
49889
+ isPdf
49890
+ });
49818
49891
  React__default["default"].useEffect(() => {
49819
49892
  if (!containerRef.current) {
49820
49893
  return;
@@ -49849,15 +49922,7 @@ function ColumnChart(_ref) {
49849
49922
  formatter: isPercentage ? v => "".concat(v).replace(/\d{1,3}(?=(\d{3})+$)/g, s => "".concat(s, ",")) + " %" : formattedYAxis
49850
49923
  }
49851
49924
  }),
49852
- legend: isPdf ? _objectSpread2({
49853
- itemName: {
49854
- formatter: text => {
49855
- const textToTranslate = shouldSeperateLegendName ? text.split("-")[1].toLowerCase() : text;
49856
- return t(textToTranslate);
49857
- }
49858
- },
49859
- position: 'bottom'
49860
- }, extraLegendConfig) : hasLegendConfig || false
49925
+ legend: false
49861
49926
  }, showBackground && isPercentage && {
49862
49927
  columnBackground: {
49863
49928
  style: {}
@@ -49878,17 +49943,22 @@ function ColumnChart(_ref) {
49878
49943
  }
49879
49944
  };
49880
49945
  }, []);
49881
- return /*#__PURE__*/jsxRuntime.jsx("div", {
49946
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
49882
49947
  className: "flex flex-1 flex-column justify-content-center",
49883
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
49948
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
49884
49949
  className: "flex justify-content-center",
49885
49950
  children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
49886
49951
  ref: containerRef,
49887
49952
  height: height,
49888
- isPdf: isPdf,
49953
+ isPdf: false,
49889
49954
  width: width
49890
49955
  })
49891
- })
49956
+ }), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
49957
+ items: legendItems,
49958
+ layout: legendLayout,
49959
+ interactive: legendInteractive,
49960
+ style: legendStyle
49961
+ })]
49892
49962
  });
49893
49963
  }
49894
49964
 
@@ -49947,13 +50017,26 @@ function RadialBarChart(_ref) {
49947
50017
  colorKey,
49948
50018
  animation = false,
49949
50019
  isPercentage = true,
49950
- color
50020
+ color,
50021
+ isPdf = false,
50022
+ legendConfig = {}
49951
50023
  } = _ref;
49952
50024
  const containerRef = React__default["default"].useRef(null);
49953
50025
  const chartRef = React__default["default"].useRef(null);
49954
50026
  const {
49955
50027
  token
49956
50028
  } = useToken$d();
50029
+ const {
50030
+ legendEnabled,
50031
+ legendItems,
50032
+ legendPosition,
50033
+ legendLayout,
50034
+ legendInteractive,
50035
+ legendStyle
50036
+ } = useLegendConfig({
50037
+ legendConfig,
50038
+ isPdf
50039
+ });
49957
50040
  const formattedData = React.useMemo(() => {
49958
50041
  return data.map(item => _objectSpread2(_objectSpread2({}, item), {}, {
49959
50042
  originalValue: item[yFieldKey],
@@ -50036,18 +50119,23 @@ function RadialBarChart(_ref) {
50036
50119
  }
50037
50120
  };
50038
50121
  }, []);
50039
- return /*#__PURE__*/jsxRuntime.jsx("div", {
50122
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
50040
50123
  className: "flex flex-1 flex-column justify-content-center",
50041
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
50124
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
50042
50125
  className: "flex justify-content-center",
50043
50126
  children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
50044
50127
  ref: containerRef
50045
50128
  })
50046
- })
50129
+ }), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
50130
+ items: legendItems,
50131
+ layout: legendLayout,
50132
+ interactive: legendInteractive,
50133
+ style: legendStyle
50134
+ })]
50047
50135
  });
50048
50136
  }
50049
50137
 
50050
- const _excluded$4 = ["data", "angleField", "colorField", "color", "height", "innerRadius", "radius", "legend", "label", "statistic", "tooltip", "renderTooltipContent", "tooltipConfig", "meta", "animation", "t", "isPdf", "extraLegendConfig"];
50138
+ const _excluded$4 = ["data", "angleField", "colorField", "color", "height", "innerRadius", "radius", "legend", "label", "statistic", "tooltip", "renderTooltipContent", "tooltipConfig", "meta", "animation", "t", "isPdf", "legendConfig"];
50051
50139
  const {
50052
50140
  useToken: useToken$c
50053
50141
  } = antd.theme;
@@ -50120,7 +50208,7 @@ function DonutPie(_ref) {
50120
50208
  animation = false,
50121
50209
  t = s => s,
50122
50210
  isPdf = false,
50123
- extraLegendConfig = {}
50211
+ legendConfig = {}
50124
50212
  } = _ref,
50125
50213
  rest = _objectWithoutProperties(_ref, _excluded$4);
50126
50214
  const containerRef = React.useRef(null);
@@ -50128,7 +50216,17 @@ function DonutPie(_ref) {
50128
50216
  const {
50129
50217
  token
50130
50218
  } = useToken$c();
50131
- const hasLegendConfig = Object.keys(extraLegendConfig).length > 0;
50219
+ const {
50220
+ legendEnabled,
50221
+ legendItems,
50222
+ legendPosition,
50223
+ legendLayout,
50224
+ legendInteractive,
50225
+ legendStyle
50226
+ } = useLegendConfig({
50227
+ legendConfig,
50228
+ isPdf
50229
+ });
50132
50230
 
50133
50231
  // Memoize processed data for progress mode
50134
50232
  const processedData = React.useMemo(() => {
@@ -50154,12 +50252,7 @@ function DonutPie(_ref) {
50154
50252
  color: color || [token.colorPrimary7, "#E8EDF3"],
50155
50253
  radius,
50156
50254
  innerRadius,
50157
- legend: isPdf ? _objectSpread2({
50158
- itemName: {
50159
- formatter: text => t(text)
50160
- },
50161
- position: 'bottom'
50162
- }, extraLegendConfig) : hasLegendConfig || false,
50255
+ legend: false,
50163
50256
  label,
50164
50257
  statistic,
50165
50258
  tooltip: tooltipOption,
@@ -50181,9 +50274,9 @@ function DonutPie(_ref) {
50181
50274
  }
50182
50275
  };
50183
50276
  }, []);
50184
- return /*#__PURE__*/jsxRuntime.jsx("div", {
50277
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
50185
50278
  className: "flex flex-1 flex-column justify-content-center",
50186
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
50279
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
50187
50280
  className: "flex justify-content-center",
50188
50281
  children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
50189
50282
  ref: containerRef,
@@ -50192,7 +50285,12 @@ function DonutPie(_ref) {
50192
50285
  },
50193
50286
  isPdf: isPdf
50194
50287
  })
50195
- })
50288
+ }), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
50289
+ items: legendItems,
50290
+ layout: legendLayout,
50291
+ interactive: legendInteractive,
50292
+ style: legendStyle
50293
+ })]
50196
50294
  });
50197
50295
  }
50198
50296
 
@@ -50246,7 +50344,7 @@ const Style$g = dt.div`
50246
50344
  }
50247
50345
  }
50248
50346
  `;
50249
- const StyleWrapper = dt.div`
50347
+ dt.div`
50250
50348
  .legend {
50251
50349
  display: flex;
50252
50350
  flex-wrap: wrap;
@@ -50455,7 +50553,8 @@ function StackChart(_ref) {
50455
50553
  valueField = "value",
50456
50554
  height = 300,
50457
50555
  isPdf = false,
50458
- t = s => s
50556
+ t = s => s,
50557
+ legendConfig = {}
50459
50558
  } = _ref;
50460
50559
  const ref = React__default["default"].useRef();
50461
50560
  const {
@@ -50474,6 +50573,17 @@ function StackChart(_ref) {
50474
50573
  });
50475
50574
  return Array.from(uniqueLabels);
50476
50575
  }, [data, xFieldKey]);
50576
+ const {
50577
+ legendEnabled,
50578
+ legendItems,
50579
+ legendPosition,
50580
+ legendLayout,
50581
+ legendInteractive,
50582
+ legendStyle
50583
+ } = useLegendConfig({
50584
+ legendConfig,
50585
+ isPdf
50586
+ });
50477
50587
  const groupedByLabel = React__default["default"].useMemo(() => {
50478
50588
  return data.reduce((acc, item) => {
50479
50589
  const label = item[xFieldKey];
@@ -50583,7 +50693,7 @@ function StackChart(_ref) {
50583
50693
  }));
50584
50694
  }
50585
50695
  }, [hoveredGroup]);
50586
- return /*#__PURE__*/jsxRuntime.jsxs(StyleWrapper, {
50696
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
50587
50697
  children: [/*#__PURE__*/jsxRuntime.jsxs(Style$g, _objectSpread2(_objectSpread2({}, isEmpty ? {
50588
50698
  onMouseEnter: () => {
50589
50699
  setHoveredGroup({
@@ -50611,28 +50721,16 @@ function StackChart(_ref) {
50611
50721
  },
50612
50722
  children: content()
50613
50723
  })]
50614
- })), isPdf && /*#__PURE__*/jsxRuntime.jsx("div", {
50615
- className: "legend",
50616
- children: Object.entries(seriesColors).map(_ref4 => {
50617
- let [series, color] = _ref4;
50618
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
50619
- className: "legend-item",
50620
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
50621
- className: "legend-color",
50622
- style: {
50623
- backgroundColor: color || token.colorPrimary7
50624
- }
50625
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
50626
- className: "legend-label",
50627
- children: t(series)
50628
- })]
50629
- }, series);
50630
- })
50724
+ })), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
50725
+ items: legendItems,
50726
+ layout: legendLayout,
50727
+ interactive: legendInteractive,
50728
+ style: legendStyle
50631
50729
  })]
50632
50730
  });
50633
50731
  }
50634
50732
 
50635
- const _excluded$3 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "fillOpacity", "height", "t", "isPdf", "extraLegendConfig", "width"];
50733
+ const _excluded$3 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "fillOpacity", "height", "t", "isPdf", "legendConfig", "width"];
50636
50734
  const {
50637
50735
  useToken: useToken$a
50638
50736
  } = antd.theme;
@@ -50706,7 +50804,7 @@ const AreaChart = _ref => {
50706
50804
  height,
50707
50805
  t = s => s,
50708
50806
  isPdf = false,
50709
- extraLegendConfig = {},
50807
+ legendConfig = {},
50710
50808
  width
50711
50809
  } = _ref,
50712
50810
  rest = _objectWithoutProperties(_ref, _excluded$3);
@@ -50715,7 +50813,17 @@ const AreaChart = _ref => {
50715
50813
  const {
50716
50814
  token
50717
50815
  } = useToken$a();
50718
- const hasLegendConfig = Object.keys(extraLegendConfig).length > 0;
50816
+ const {
50817
+ legendEnabled,
50818
+ legendItems,
50819
+ legendPosition,
50820
+ legendLayout,
50821
+ legendInteractive,
50822
+ legendStyle
50823
+ } = useLegendConfig({
50824
+ legendConfig,
50825
+ isPdf
50826
+ });
50719
50827
  React.useEffect(() => {
50720
50828
  if (!containerRef.current) {
50721
50829
  return;
@@ -50750,12 +50858,7 @@ const AreaChart = _ref => {
50750
50858
  areaStyle: {
50751
50859
  fillOpacity
50752
50860
  },
50753
- legend: isPdf ? _objectSpread2({
50754
- itemName: {
50755
- formatter: text => t(text)
50756
- },
50757
- position: 'bottom'
50758
- }, extraLegendConfig) : hasLegendConfig || false,
50861
+ legend: false,
50759
50862
  line: false
50760
50863
  }, rest);
50761
50864
  if (!chartRef.current) {
@@ -50773,21 +50876,26 @@ const AreaChart = _ref => {
50773
50876
  }
50774
50877
  };
50775
50878
  }, []);
50776
- return /*#__PURE__*/jsxRuntime.jsx("div", {
50879
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
50777
50880
  className: "flex flex-1 flex-column justify-content-center",
50778
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
50881
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
50779
50882
  className: "flex justify-content-center",
50780
50883
  children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
50781
50884
  ref: containerRef,
50782
50885
  height: height,
50783
- isPdf: isPdf,
50886
+ isPdf: false,
50784
50887
  width: width
50785
50888
  })
50786
- })
50889
+ }), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
50890
+ items: legendItems,
50891
+ layout: legendLayout,
50892
+ interactive: legendInteractive,
50893
+ style: legendStyle
50894
+ })]
50787
50895
  });
50788
50896
  };
50789
50897
 
50790
- const _excluded$2 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "score", "height"];
50898
+ const _excluded$2 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "score", "height", "isPdf", "legendConfig"];
50791
50899
  const {
50792
50900
  useToken: useToken$9
50793
50901
  } = antd.theme;
@@ -50808,7 +50916,9 @@ const RadarChart = _ref => {
50808
50916
  min: 0,
50809
50917
  max: 100
50810
50918
  },
50811
- height
50919
+ height,
50920
+ isPdf = false,
50921
+ legendConfig = {}
50812
50922
  } = _ref,
50813
50923
  rest = _objectWithoutProperties(_ref, _excluded$2);
50814
50924
  const containerRef = React.useRef(null);
@@ -50816,6 +50926,17 @@ const RadarChart = _ref => {
50816
50926
  const {
50817
50927
  token
50818
50928
  } = useToken$9();
50929
+ const {
50930
+ legendEnabled,
50931
+ legendItems,
50932
+ legendPosition,
50933
+ legendLayout,
50934
+ legendInteractive,
50935
+ legendStyle
50936
+ } = useLegendConfig({
50937
+ legendConfig,
50938
+ isPdf
50939
+ });
50819
50940
  React.useEffect(() => {
50820
50941
  if (!containerRef.current) {
50821
50942
  return;
@@ -50900,15 +51021,20 @@ const RadarChart = _ref => {
50900
51021
  }
50901
51022
  };
50902
51023
  }, []);
50903
- return /*#__PURE__*/jsxRuntime.jsx("div", {
51024
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
50904
51025
  className: "flex flex-1 flex-column justify-content-center",
50905
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
51026
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
50906
51027
  className: "flex justify-content-center",
50907
51028
  children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
50908
51029
  ref: containerRef,
50909
51030
  height: height
50910
51031
  })
50911
- })
51032
+ }), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
51033
+ items: legendItems,
51034
+ layout: legendLayout,
51035
+ interactive: legendInteractive,
51036
+ style: legendStyle
51037
+ })]
50912
51038
  });
50913
51039
  };
50914
51040
 
@@ -50927,13 +51053,26 @@ function DualAxesChart(_ref) {
50927
51053
  formattedLeftAxis = s => s,
50928
51054
  formattedRightAxis = s => s,
50929
51055
  formattedXAxis = s => s,
50930
- color
51056
+ color,
51057
+ legendConfig = {},
51058
+ isPdf = false
50931
51059
  } = _ref;
50932
51060
  const containerRef = React__default["default"].useRef(null);
50933
51061
  const chartRef = React__default["default"].useRef(null);
50934
51062
  const {
50935
51063
  token
50936
51064
  } = useToken$8();
51065
+ const {
51066
+ legendEnabled,
51067
+ legendItems,
51068
+ legendPosition,
51069
+ legendLayout,
51070
+ legendInteractive,
51071
+ legendStyle
51072
+ } = useLegendConfig({
51073
+ legendConfig,
51074
+ isPdf
51075
+ });
50937
51076
  const _colours = React.useMemo(() => {
50938
51077
  const defaultColours = [token.colorPrimary7, token.colorPrimary6, token.colorPrimary8];
50939
51078
  if (color) {
@@ -51001,15 +51140,20 @@ function DualAxesChart(_ref) {
51001
51140
  }
51002
51141
  };
51003
51142
  }, []);
51004
- return /*#__PURE__*/jsxRuntime.jsx("div", {
51143
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
51005
51144
  className: "flex flex-1 flex-column justify-content-center",
51006
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
51145
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
51007
51146
  className: "flex justify-content-center",
51008
51147
  children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
51009
51148
  ref: containerRef,
51010
51149
  "data-testid": "dual-axes-chart"
51011
51150
  })
51012
- })
51151
+ }), legendEnabled && legendPosition === 'bottom' && /*#__PURE__*/jsxRuntime.jsx(CustomLegend, {
51152
+ items: legendItems,
51153
+ layout: legendLayout,
51154
+ interactive: legendInteractive,
51155
+ style: legendStyle
51156
+ })]
51013
51157
  });
51014
51158
  }
51015
51159
 
@@ -54050,7 +54194,6 @@ function AddUserModal({
54050
54194
  setAccountUsed(true);
54051
54195
  }).catch(() => {});
54052
54196
  };
54053
- console.log("hellooooooooooooooooooooooooo");
54054
54197
  return /*#__PURE__*/jsxRuntime.jsx(Modal, {
54055
54198
  open: isOpen,
54056
54199
  title: "admin::edit-user",
@@ -54094,6 +54237,13 @@ function AddUserModal({
54094
54237
  }
54095
54238
  }
54096
54239
  })
54240
+ }), accountUsed && /*#__PURE__*/jsxRuntime.jsx(antd.Alert, {
54241
+ message: t("FB00001"),
54242
+ type: "error",
54243
+ className: "mb-2",
54244
+ showIcon: true,
54245
+ closable: true,
54246
+ onClose: () => setAccountUsed(false)
54097
54247
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
54098
54248
  name: "role",
54099
54249
  label: t("Role"),
@@ -56904,8 +57054,7 @@ function NewUser({
56904
57054
  isOpen,
56905
57055
  onClose,
56906
57056
  defaultData,
56907
- userRoles = [],
56908
- addUser = () => {}
57057
+ userRoles = []
56909
57058
  }) {
56910
57059
  const [MainForm] = antd.Form.useForm();
56911
57060
  const [accountUsed, setAccountUsed] = React.useState(false);
@@ -56919,26 +57068,8 @@ function NewUser({
56919
57068
  }, [defaultData]);
56920
57069
  const onSubmit = () => {
56921
57070
  MainForm.validateFields().then(val => {
56922
- // Create user object with the form data
56923
- const userData = {
56924
- firstName: val.firstName,
56925
- lastName: val.lastName,
56926
- email: val.email,
56927
- role: val.role,
56928
- apps: {
56929
- sbg: {
56930
- role: val.role,
56931
- access: true
56932
- }
56933
- }
56934
- };
56935
-
56936
- // Add user to local state
56937
- addUser(userData);
56938
-
56939
- // Close modal and reset form
56940
- onClose();
56941
- MainForm.resetFields();
57071
+ console.log(val);
57072
+ setAccountUsed(true);
56942
57073
  }).catch(() => {});
56943
57074
  };
56944
57075
  return /*#__PURE__*/jsxRuntime.jsx(Modal, {
@@ -56984,6 +57115,13 @@ function NewUser({
56984
57115
  }
56985
57116
  }
56986
57117
  })
57118
+ }), accountUsed && /*#__PURE__*/jsxRuntime.jsx(antd.Alert, {
57119
+ message: t("FB00001"),
57120
+ type: "error",
57121
+ className: "mb-2",
57122
+ showIcon: true,
57123
+ closable: true,
57124
+ onClose: () => setAccountUsed(false)
56987
57125
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
56988
57126
  name: "role",
56989
57127
  label: t("Role"),
@@ -57254,7 +57392,6 @@ function Users({
57254
57392
  accountStatuses,
57255
57393
  deleteUser = () => {},
57256
57394
  updateUser = () => {},
57257
- addUser = () => {},
57258
57395
  transferAdmin = () => {}
57259
57396
  }) {
57260
57397
  const [hasError, setHasError] = React.useState(false);
@@ -57377,8 +57514,7 @@ function Users({
57377
57514
  t: t,
57378
57515
  isOpen: newUserModalVisible,
57379
57516
  onClose: () => setNewUserModalVisible(false),
57380
- userRoles: userRoles,
57381
- addUser: addUser
57517
+ userRoles: userRoles
57382
57518
  })]
57383
57519
  });
57384
57520
  }
@@ -57614,15 +57750,6 @@ function Edit({
57614
57750
  })
57615
57751
  }));
57616
57752
  }, []);
57617
- const addUser = React.useCallback(userData => {
57618
- setIsChanged(true);
57619
- setData(prev => ({
57620
- ...prev,
57621
- users: [...(prev.users || []), {
57622
- ...userData
57623
- }]
57624
- }));
57625
- }, []);
57626
57753
  const onSuspend = () => {
57627
57754
  antd.Modal.confirm({
57628
57755
  title: t("sbg-admin::suspend-title"),
@@ -57669,7 +57796,6 @@ function Edit({
57669
57796
  onCancel: () => {}
57670
57797
  });
57671
57798
  };
57672
- console.log("good morning");
57673
57799
  const renderItem = item => {
57674
57800
  if (item.type === "users") {
57675
57801
  return /*#__PURE__*/jsxRuntime.jsx(Users, {
@@ -57681,7 +57807,6 @@ function Edit({
57681
57807
  userRoles: userRoles,
57682
57808
  deleteUser: deleteUser,
57683
57809
  updateUser: updateUser,
57684
- addUser: addUser,
57685
57810
  goTo: goTo,
57686
57811
  accountStatuses: accountStatuses,
57687
57812
  transferAdmin: transferAdmin