sag_components 1.0.547 → 1.0.548

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 (97) hide show
  1. package/dist/stories/components/AttachedFile.js +1 -1
  2. package/dist/stories/components/BarChartsByWeeks.js +200 -0
  3. package/dist/stories/components/BarChartsByWeeks.style.js +23 -0
  4. package/dist/stories/components/PopupCharts.js +2 -1
  5. package/dist/stories/components/TotalDoughnutChart.js +22 -14
  6. package/package.json +1 -1
  7. package/.history/.env_20231001120549 +0 -0
  8. package/.history/.env_20231001120613 +0 -1
  9. package/.history/.env_20231003143620 +0 -1
  10. package/.history/.eslintrc_20230928112617.js +0 -26
  11. package/.history/.eslintrc_20230928130534.js +0 -27
  12. package/.history/.eslintrc_20230928133400.js +0 -28
  13. package/.history/.eslintrc_20230928133404.js +0 -28
  14. package/.history/.eslintrc_20230928133416.js +0 -28
  15. package/.history/.eslintrc_20230928133419.js +0 -28
  16. package/.history/.eslintrc_20230928133432.js +0 -28
  17. package/.history/.eslintrc_20230928133439.js +0 -28
  18. package/.history/.eslintrc_20230928133458.js +0 -29
  19. package/.history/.eslintrc_20230928133500.js +0 -28
  20. package/.history/.eslintrc_20230928134009.js +0 -28
  21. package/.history/.eslintrc_20230928135318.js +0 -34
  22. package/.history/.eslintrc_20230928135321.js +0 -34
  23. package/.history/.eslintrc_20230928135323.js +0 -34
  24. package/.history/.eslintrc_20230928135332.js +0 -34
  25. package/.history/.eslintrc_20230928135333.js +0 -34
  26. package/.history/.eslintrc_20230928135352.js +0 -29
  27. package/.history/.eslintrc_20230928135353.js +0 -29
  28. package/.history/.eslintrc_20230928135355.js +0 -29
  29. package/.history/.eslintrc_20230928135408.js +0 -29
  30. package/.history/.eslintrc_20230928135538.js +0 -30
  31. package/.history/.eslintrc_20230928135539.js +0 -30
  32. package/.history/.eslintrc_20230928135543.js +0 -30
  33. package/.history/.gitignore_20230921093332 +0 -119
  34. package/.history/.gitignore_20230921111638 +0 -120
  35. package/.history/.gitignore_20230921111650 +0 -120
  36. package/.history/.gitignore_20230921111810 +0 -121
  37. package/.history/package-lock_20231114111138.json +0 -47810
  38. package/.history/package-lock_20231114111158.json +0 -47802
  39. package/.history/package_20231029152422.json +0 -82
  40. package/.history/package_20231029153420.json +0 -82
  41. package/.history/package_20231029154416.json +0 -82
  42. package/.history/package_20231030094127.json +0 -82
  43. package/.history/package_20231030114707.json +0 -82
  44. package/.history/package_20231030130704.json +0 -82
  45. package/.history/package_20231030132422.json +0 -82
  46. package/.history/package_20231030134051.json +0 -82
  47. package/.history/package_20231030142913.json +0 -82
  48. package/.history/package_20231030143556.json +0 -82
  49. package/.history/package_20231030144210.json +0 -82
  50. package/.history/package_20231101113942.json +0 -82
  51. package/.history/package_20231101114544.json +0 -82
  52. package/.history/package_20231101151518.json +0 -82
  53. package/.history/package_20231101154501.json +0 -82
  54. package/.history/package_20231101155811.json +0 -82
  55. package/.history/package_20231101160235.json +0 -82
  56. package/.history/package_20231101160406.json +0 -82
  57. package/.history/package_20231101161325.json +0 -82
  58. package/.history/package_20231101161333.json +0 -82
  59. package/.history/package_20231102123623.json +0 -82
  60. package/.history/package_20231102125741.json +0 -82
  61. package/.history/package_20231102130857.json +0 -82
  62. package/.history/package_20231102132227.json +0 -82
  63. package/.history/package_20231102142340.json +0 -82
  64. package/.history/package_20231102143256.json +0 -82
  65. package/.history/package_20231105153539.json +0 -82
  66. package/.history/package_20231105154332.json +0 -82
  67. package/.history/package_20231105171201.json +0 -82
  68. package/.history/package_20231106123849.json +0 -82
  69. package/.history/package_20231107170638.json +0 -82
  70. package/.history/package_20231109103647.json +0 -82
  71. package/.history/package_20231109103911.json +0 -82
  72. package/.history/package_20231109105426.json +0 -82
  73. package/.history/package_20231109132014.json +0 -82
  74. package/.history/package_20231109132115.json +0 -82
  75. package/.history/package_20231114100517.json +0 -82
  76. package/.history/package_20231114100859.json +0 -82
  77. package/.history/package_20231114101553.json +0 -82
  78. package/.history/package_20231114102545.json +0 -82
  79. package/.history/package_20231114111208.json +0 -83
  80. package/.history/package_20231114111515.json +0 -83
  81. package/.history/package_20231114112931.json +0 -83
  82. package/.history/package_20231114113014.json +0 -83
  83. package/.history/package_20231114113155.json +0 -83
  84. package/.history/package_20231114124318.json +0 -83
  85. package/.history/package_20231114125107.json +0 -83
  86. package/.history/package_20231114125510.json +0 -83
  87. package/.history/package_20231114132634.json +0 -83
  88. package/.history/package_20231116165815.json +0 -83
  89. package/.history/package_20231116165916.json +0 -83
  90. package/.history/package_20231119113637.json +0 -83
  91. package/.history/package_20231120100907.json +0 -83
  92. package/.history/package_20231121151523.json +0 -77
  93. package/.history/package_20231121155513.json +0 -77
  94. package/.history/package_20231121162434.json +0 -77
  95. package/.history/package_20231122100718.json +0 -77
  96. package/.history/package_20231128125149.json +0 -82
  97. package/.history/package_20231128125208.json +0 -82
@@ -29,7 +29,7 @@ const AttachedFile = props => {
29
29
  setSelectedFiles(prevFiles => prevFiles.filter(file => file !== fileToRemove));
30
30
  const fileInput = document.getElementById('fileInput');
31
31
  fileInput.value = ''; // Reset input value
32
- onRemoveFile(fileToRemove);
32
+ onRemoveFile();
33
33
  };
34
34
  return /*#__PURE__*/_react.default.createElement(_AttachedFile.AttachedFileContainer, null, selectedFiles.map(file => /*#__PURE__*/_react.default.createElement(_AttachedFile.UploadedFile, {
35
35
  key: "".concat(file.name, "_").concat(file.lastModified)
@@ -0,0 +1,200 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = exports.BarChartsByWeeks = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _recharts = require("recharts");
10
+ var _CommonFunctions = require("./CommonFunctions");
11
+ var _BarChartsByWeeks = require("./BarChartsByWeeks.style");
12
+ /* BarChartsByWeeks */
13
+ const BarChartsByWeeks = props => {
14
+ const {
15
+ title,
16
+ barChartData,
17
+ width,
18
+ height,
19
+ barChartColor,
20
+ xselectedColor,
21
+ tooltipTitle,
22
+ startWeekRange = 0,
23
+ endWeekRange = 0,
24
+ yAxisCounter,
25
+ isPercentValue,
26
+ interval
27
+ } = props;
28
+ const [BarChartContainerWidth, setBarChartContainerWidth] = (0, _react.useState)(0);
29
+ const [BarChartContainerHeight, setBarChartContainerHeight] = (0, _react.useState)(0);
30
+ const anotherRef = (0, _react.useRef)(null);
31
+ const [activeLabel, setActiveLabel] = (0, _react.useState)("");
32
+ const controlsContainerRef = (0, _react.useRef)();
33
+ (0, _react.useEffect)(() => {
34
+ const {
35
+ offsetWidth
36
+ } = controlsContainerRef.current;
37
+ setBarChartContainerWidth(offsetWidth - 20);
38
+ }, [width]);
39
+ (0, _react.useEffect)(() => {
40
+ const {
41
+ offsetHeight
42
+ } = controlsContainerRef.current;
43
+ setBarChartContainerHeight(offsetHeight - 40);
44
+ }, [height]);
45
+ const CustomTooltip = _ref => {
46
+ let {
47
+ active,
48
+ payload,
49
+ label
50
+ } = _ref;
51
+ if (active && payload && payload.length) {
52
+ setActiveLabel(label);
53
+ const week = label && (label === null || label === void 0 ? void 0 : label.toString().length) === 6 ? label.toString().substring(4, 6) : 0;
54
+ return /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TooltipDiv, null, /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TooltipTitle, null, "Week: ".concat(week)), /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TooltipLabel, null, "".concat(tooltipTitle, " \n ").concat(payload[0].value ? isPercentValue ? "".concat("", payload[0].value.toFixed(1), "%") : "".concat("", (0, _CommonFunctions.getFormattedValue)(payload[0].value), (0, _CommonFunctions.getFormattedUnits)(payload[0].value)) : "", " \n ")));
55
+ }
56
+ return null;
57
+ };
58
+ const displayEventWeeksElements = () => {
59
+ var _getWeek;
60
+ if (!barChartData || barChartData.length === 0) return "";
61
+ return /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.EventWeeksLegendDataElementsContainer, {
62
+ id: "EventWeeksLegendDataElementsContainer"
63
+ }, (_getWeek = getWeek()) === null || _getWeek === void 0 ? void 0 : _getWeek.map(item => /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.EventWeeksLegendDataElement, {
64
+ id: "EventWeeksLegendDataElement",
65
+ color: item.title >= startWeekRange && item.title <= endWeekRange ? xselectedColor : "",
66
+ textColor: item.title >= startWeekRange && item.title <= endWeekRange ? "#212121" : "#B1B1B1",
67
+ fontWeight: item.title >= startWeekRange && item.title <= endWeekRange ? 600 : 400,
68
+ borderLeftRadius: item.title === startWeekRange ? "12px" : "0px",
69
+ borderRightRadius: item.title === endWeekRange ? "12px" : "0px"
70
+ }, item.titleWeek)));
71
+ };
72
+ const displayEventWeeksLegendData = () => /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.EventWeeksLegendMainContainer, {
73
+ id: "EventWeeksLegendMainContainer"
74
+ }, displayEventWeeksElements());
75
+ const getWeek = () => {
76
+ if (!barChartData || (barChartData === null || barChartData === void 0 ? void 0 : barChartData.length) === 0) return null;
77
+ const newFormattedData = barChartData === null || barChartData === void 0 ? void 0 : barChartData.map(item => {
78
+ var _item$title;
79
+ return {
80
+ ...item,
81
+ titleWeek: item.title && ((_item$title = item.title) === null || _item$title === void 0 ? void 0 : _item$title.toString().length) === 6 ? item.title.toString().substring(4, 6) : 0
82
+ };
83
+ });
84
+ return newFormattedData;
85
+ };
86
+ return /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.ControlsContainer, {
87
+ id: "ControlsContainer",
88
+ height: height,
89
+ width: width,
90
+ ref: controlsContainerRef
91
+ }, /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.Controls, {
92
+ id: "Controls"
93
+ }, /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TitleAndValueContainer, {
94
+ id: "TitleAndValueContainer"
95
+ }, /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.Title, {
96
+ id: "Title"
97
+ }, title)), /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.AreaChartContainer, {
98
+ ref: anotherRef,
99
+ id: "AreaChartContainer"
100
+ }, /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, {
101
+ id: "ResponsiveContainer",
102
+ width: "100%",
103
+ height: "100%"
104
+ }, /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.BarchartContainer, {
105
+ id: "BarchartContainer"
106
+ }, /*#__PURE__*/_react.default.createElement(_recharts.BarChart, {
107
+ width: BarChartContainerWidth,
108
+ height: BarChartContainerHeight,
109
+ data: barChartData,
110
+ margin: {
111
+ top: 20,
112
+ right: 0,
113
+ bottom: -25,
114
+ left: -5
115
+ }
116
+ }, /*#__PURE__*/_react.default.createElement(_recharts.CartesianGrid, {
117
+ strokeDasharray: "3 3",
118
+ vertical: false
119
+ }), /*#__PURE__*/_react.default.createElement(_recharts.XAxis, {
120
+ dataKey: "title",
121
+ tick: false,
122
+ tickLine: false
123
+ }), /*#__PURE__*/_react.default.createElement(_recharts.YAxis, {
124
+ tickCount: yAxisCounter,
125
+ interval: interval ? interval : 'preserveEnd',
126
+ domain: [0, "auto"],
127
+ tick: {
128
+ fill: "#B1B1B1"
129
+ },
130
+ axisLine: false,
131
+ fontWeight: 400,
132
+ fontSize: "12px",
133
+ tickLine: false,
134
+ tickFormatter: value => "".concat(value ? isPercentValue ? "".concat("", value.toFixed(0), "%") : "".concat("", (0, _CommonFunctions.getFormattedValue)(value), (0, _CommonFunctions.getFormattedUnits)(value)) : "")
135
+ }), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, {
136
+ content: /*#__PURE__*/_react.default.createElement(CustomTooltip, null)
137
+ }), /*#__PURE__*/_react.default.createElement(_recharts.Bar, {
138
+ dataKey: "value",
139
+ name: "title",
140
+ maxBarSize: 45,
141
+ radius: [4, 4, 0, 0],
142
+ fill: barChartColor
143
+ }))))), displayEventWeeksLegendData()));
144
+ };
145
+ exports.BarChartsByWeeks = BarChartsByWeeks;
146
+ var _default = exports.default = BarChartsByWeeks;
147
+ BarChartsByWeeks.defaultProps = {
148
+ title: "String",
149
+ barChartData: [{
150
+ title: "202320",
151
+ value: 542366
152
+ }, {
153
+ title: "202321",
154
+ value: 699511
155
+ }, {
156
+ title: "202322",
157
+ value: 403092
158
+ }, {
159
+ title: "202323",
160
+ value: 396184
161
+ }, {
162
+ title: "202324",
163
+ value: 415317
164
+ }, {
165
+ title: "202325",
166
+ value: 568376
167
+ }, {
168
+ title: "202326",
169
+ value: 1078121
170
+ }, {
171
+ title: "202327",
172
+ value: 347930
173
+ }, {
174
+ title: "202328",
175
+ value: 346258
176
+ }, {
177
+ title: "202329",
178
+ value: 350184
179
+ }, {
180
+ title: "202330",
181
+ value: 312790
182
+ }, {
183
+ title: "202331",
184
+ value: 335076
185
+ }, {
186
+ title: "202332",
187
+ value: 311037
188
+ }],
189
+ width: "100%",
190
+ height: "100%",
191
+ barChartColor: "#BD9EFF",
192
+ xselectedColor: "#42977A",
193
+ tooltipTitle: "Sales",
194
+ startWeekRange: 0,
195
+ endWeekRange: 0,
196
+ tooltipTitle: "",
197
+ yAxisCounter: 10,
198
+ isPercentValue: false,
199
+ interval: 'preserveEnd'
200
+ };
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.TooltipTitle = exports.TooltipLabel = exports.TooltipDiv = exports.TitleAndValueContainer = exports.Title = exports.EventWeeksLegendMainContainer = exports.EventWeeksLegendDataElementsContainer = exports.EventWeeksLegendDataElement = exports.ControlsContainer = exports.Controls = exports.BenchmarkContainer = exports.BarchartContainer = exports.AreaChartContainer = void 0;
8
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
9
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
10
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
11
+ const ControlsContainer = exports.ControlsContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n font-family: \"Poppins\", sans-serif;\n color: #212121;\n width: ", ";\n height: ", ";\n border-radius: 12px;\n min-width: 250px;\n"])), props => props.width, props => props.height);
12
+ const Controls = exports.Controls = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n /* justify-content: space-between; */\n background: #ffffff;\n border-radius: 12px;\n flex-basis: 100%;\n"])));
13
+ const AreaChartContainer = exports.AreaChartContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n margin-top: auto;\n width: 100%; \n height: 85%;\n"])));
14
+ const TooltipDiv = exports.TooltipDiv = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: 5px;\n padding: 8px 12px;\n background: white;\n box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.2);\n margin: 0;\n"])));
15
+ const TooltipLabel = exports.TooltipLabel = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n color: #212121;\n font-size: 14px;\n font-weight: 400;\n line-height: normal;\n width: fit-content;\n"])));
16
+ const TooltipTitle = exports.TooltipTitle = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n color: #212121;\n font-size: 14px;\n font-weight: 600;\n line-height: normal;\n"])));
17
+ const TitleAndValueContainer = exports.TitleAndValueContainer = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n padding: 0 1rem;\n"])));
18
+ const Title = exports.Title = _styledComponents.default.div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size: 18px;\n line-height: 20px;\n @media (max-width: 1536px) {\n font-size: 16px;\n }\n @media (max-width: 1366px) {\n font-size: 14px;\n }\n\n"])));
19
+ const BenchmarkContainer = exports.BenchmarkContainer = _styledComponents.default.div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n margin-left: 1.5rem;\n"])));
20
+ const EventWeeksLegendMainContainer = exports.EventWeeksLegendMainContainer = _styledComponents.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: center;\n flex-direction: column;\n margin: 2px 0 0 0;\n padding: 0 20px 0 55px;\n align-items: center;\n\n"])));
21
+ const EventWeeksLegendDataElementsContainer = exports.EventWeeksLegendDataElementsContainer = _styledComponents.default.div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n margin: 0px;\n align-items: center;\n justify-content: space-around;\n width: 100%;\n"])));
22
+ const EventWeeksLegendDataElement = exports.EventWeeksLegendDataElement = _styledComponents.default.h4(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n font-weight: ", ";\n font-size: 12px;\n line-height: 15px;\n margin: 0px;\n width: 100%;\n justify-content: center;\n align-content: center;\n color: ", ";\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n background: ", ";\n @media (max-width: 1536px) {\n font-size: 11px;\n }\n @media (max-width: 1366px) {\n font-size: 10px;\n }\n"])), props => props.fontWeight, props => props.textColor, props => props.borderLeftRadius, props => props.borderLeftRadius, props => props.borderRightRadius, props => props.borderRightRadius, props => props.color);
23
+ const BarchartContainer = exports.BarchartContainer = _styledComponents.default.div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n"])));
@@ -82,7 +82,8 @@ const PopupCharts = props => {
82
82
  value: rowsData.value,
83
83
  width: "500px",
84
84
  height: "290px",
85
- itemsValuesSeparateLine: false
85
+ itemsValuesSeparateLine: false,
86
+ isPercent: true
86
87
  });
87
88
  };
88
89
  const ChartItem = _ref => {
@@ -28,7 +28,8 @@ const TotalDoughnutChart = props => {
28
28
  width,
29
29
  height,
30
30
  textcolor,
31
- noDataText
31
+ noDataText,
32
+ isPercent
32
33
  } = props;
33
34
  const [DoughnutChartRadius, setDoughnutChartRadius] = (0, _react.useState)(0);
34
35
  const [zoomResolution, setZoomResolution] = (0, _react.useState)(1);
@@ -40,14 +41,14 @@ const TotalDoughnutChart = props => {
40
41
  };
41
42
 
42
43
  // Add event listener for window resize to update zoom resolution
43
- window.addEventListener('resize', handleResize);
44
+ window.addEventListener("resize", handleResize);
44
45
 
45
46
  // Initial update of zoom resolution
46
47
  setZoomResolution(window.devicePixelRatio);
47
48
 
48
49
  // Clean up the event listener when component unmounts
49
50
  return () => {
50
- window.removeEventListener('resize', handleResize);
51
+ window.removeEventListener("resize", handleResize);
51
52
  };
52
53
  }, []);
53
54
  (0, _react.useEffect)(() => {
@@ -70,6 +71,14 @@ const TotalDoughnutChart = props => {
70
71
  const radius = DoughnutChartContainerWidth > DoughnutChartContainerHeight ? DoughnutChartContainerHeight / 2 / resolutionFactor : DoughnutChartContainerWidth / 2 / resolutionFactor;
71
72
  setDoughnutChartRadius(radius);
72
73
  }, [height, width, DoughnutChartContainerRef === null || DoughnutChartContainerRef === void 0 ? void 0 : (_DoughnutChartContain = DoughnutChartContainerRef.current) === null || _DoughnutChartContain === void 0 ? void 0 : _DoughnutChartContain.clientWidth, DoughnutChartContainerRef === null || DoughnutChartContainerRef === void 0 ? void 0 : (_DoughnutChartContain2 = DoughnutChartContainerRef.current) === null || _DoughnutChartContain2 === void 0 ? void 0 : _DoughnutChartContain2.clientHeight, zoomResolution]);
74
+ const displayLegendValue = row => {
75
+ return /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.LegendFormattedValue, {
76
+ id: "LegendFormattedValue",
77
+ style: {
78
+ fontWeight: itemsBoldedValues ? "700" : "500"
79
+ }
80
+ }, !isPercent && row.value && currencySign ? (0, _CommonFunctions.getCurrencySign)(currencyType, row.value) : "", !isPercent && row.value ? dotCutTrenty(row) : !isPercent && "No Data", !isPercent && row.value && dotCut ? (0, _CommonFunctions.getFormattedUnits)(row.value) : "", !isPercent && row.value && itemsPercentagesValueAside && " (".concat(Math.round(row.value / value * 100), "%)"), isPercent && row.value && "".concat(row.value.toFixed(1), "%"));
81
+ };
73
82
  return /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.ControlsContainer, {
74
83
  id: "ControlsContainer",
75
84
  height: height,
@@ -111,7 +120,8 @@ const TotalDoughnutChart = props => {
111
120
  fill: row.color
112
121
  }))), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, {
113
122
  content: /*#__PURE__*/_react.default.createElement(CustomTooltip, {
114
- value: value
123
+ value: value,
124
+ isPercent: isPercent
115
125
  })
116
126
  }), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, null)))), /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.LegendContainer, {
117
127
  id: "LegendContainer"
@@ -129,12 +139,7 @@ const TotalDoughnutChart = props => {
129
139
  flexDirection: itemsValuesSeparateLine ? "column" : "row",
130
140
  alignItems: itemsValuesSeparateLine ? "baseline" : "center"
131
141
  }
132
- }, row.name, /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.LegendFormattedValue, {
133
- id: "LegendFormattedValue",
134
- style: {
135
- fontWeight: itemsBoldedValues ? "700" : "500"
136
- }
137
- }, currencySign ? (0, _CommonFunctions.getCurrencySign)(currencyType, row.value) : "", row.value !== undefined && row.value !== null ? dotCutTrenty(row) : "No Data", row.value !== undefined && row.value !== null && dotCut ? (0, _CommonFunctions.getFormattedUnits)(row.value) : "", itemsPercentagesValueAside && " (".concat(Math.round(row.value / value * 100), "%)"))))))))));
142
+ }, row.name, displayLegendValue(row)))))))));
138
143
  };
139
144
  exports.TotalDoughnutChart = TotalDoughnutChart;
140
145
  var _default = exports.default = TotalDoughnutChart;
@@ -152,21 +157,24 @@ TotalDoughnutChart.defaultProps = {
152
157
  width: "100%",
153
158
  height: "100%",
154
159
  textcolor: "#212121",
155
- noDataText: ""
160
+ noDataText: "",
161
+ isPercent: false
156
162
  };
157
163
  function CustomTooltip(_ref) {
158
164
  let {
159
165
  active,
160
166
  payload,
161
- value
167
+ value,
168
+ isPercent = false
162
169
  } = _ref;
163
170
  if (active && payload && payload.length) {
164
- const percent = value && value !== 0 ? (payload[0].value / value * 100).toFixed(0) : 0;
171
+ const percent = value && value !== 0 && !isPercent ? (payload[0].value / value * 100).toFixed(1) : value && isPercent ? payload[0].value.toFixed(1) : 0;
165
172
  return /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.TooltipDiv, null, /*#__PURE__*/_react.default.createElement(_TotalDoughnutChart.TooltipLabel, null, "".concat(payload[0].name, " ").concat(percent, "%")));
166
173
  }
167
174
  }
168
175
  CustomTooltip.defaultProps = {
169
176
  active: "",
170
177
  payload: "",
171
- value: ""
178
+ value: "",
179
+ isPercent: false
172
180
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sag_components",
3
- "version": "1.0.547",
3
+ "version": "1.0.548",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
File without changes
@@ -1 +0,0 @@
1
- STORYBOOK_FIGMA_ACCESS_TOKEN=figd_YdAmQQKQ2B6ZngEijA0JiqNNUdJvP23G46NK7-fc
@@ -1 +0,0 @@
1
- STORYBOOK_FIGMA_ACCESS_TOKEN=figd_MOcc8-aS91XJ3mFdtNlH4oPVY73ChHlmw6-hKhsb
@@ -1,26 +0,0 @@
1
- module.exports = {
2
- env: {
3
- browser: true,
4
- es2021: true,
5
- },
6
- extends: 'airbnb',
7
- overrides: [
8
- {
9
- env: {
10
- node: true,
11
- },
12
- files: [
13
- '.eslintrc.{js,cjs}',
14
- ],
15
- parserOptions: {
16
- sourceType: 'script',
17
- },
18
- },
19
- ],
20
- parserOptions: {
21
- ecmaVersion: 'latest',
22
- sourceType: 'module',
23
- },
24
- rules: {
25
- },
26
- };
@@ -1,27 +0,0 @@
1
- module.exports = {
2
- env: {
3
- browser: true,
4
- es2021: true,
5
- },
6
- extends: 'airbnb',
7
- overrides: [
8
- {
9
- env: {
10
- node: true,
11
- },
12
- files: [
13
- '.eslintrc.{js,cjs}',
14
- ],
15
- parserOptions: {
16
- sourceType: 'script',
17
- },
18
- },
19
- ],
20
- parserOptions: {
21
- ecmaVersion: 'latest',
22
- sourceType: 'module',
23
- },
24
- rules: {
25
- 'max-len': 'off',
26
- },
27
- };
@@ -1,28 +0,0 @@
1
- module.exports = {
2
- env: {
3
- browser: true,
4
- es2021: true,
5
- },
6
- extends: 'airbnb',
7
- overrides: [
8
- {
9
- env: {
10
- node: true,
11
- },
12
- files: [
13
- '.eslintrc.{js,cjs}',
14
- ],
15
- parserOptions: {
16
- sourceType: 'script',
17
- },
18
- },
19
- ],
20
- parserOptions: {
21
- ecmaVersion: 'latest',
22
- sourceType: 'module',
23
- },
24
- rules: {
25
- 'max-len': 'off',
26
- /*eslint linebreak-style: ["error", "windows"]*/
27
- },
28
- };
@@ -1,28 +0,0 @@
1
- module.exports = {
2
- env: {
3
- browser: true,
4
- es2021: true,
5
- },
6
- extends: 'airbnb',
7
- overrides: [
8
- {
9
- env: {
10
- node: true,
11
- },
12
- files: [
13
- '.eslintrc.{js,cjs}',
14
- ],
15
- parserOptions: {
16
- sourceType: 'script',
17
- },
18
- },
19
- ],
20
- parserOptions: {
21
- ecmaVersion: 'latest',
22
- sourceType: 'module',
23
- },
24
- rules: {
25
- 'max-len': 'off',
26
- eslint linebreak-style: ["error", "windows"]
27
- },
28
- };
@@ -1,28 +0,0 @@
1
- module.exports = {
2
- env: {
3
- browser: true,
4
- es2021: true,
5
- },
6
- extends: 'airbnb',
7
- overrides: [
8
- {
9
- env: {
10
- node: true,
11
- },
12
- files: [
13
- '.eslintrc.{js,cjs}',
14
- ],
15
- parserOptions: {
16
- sourceType: 'script',
17
- },
18
- },
19
- ],
20
- parserOptions: {
21
- ecmaVersion: 'latest',
22
- sourceType: 'module',
23
- },
24
- rules: {
25
- 'max-len': 'off',
26
- linebreak-style: ["error", "windows"]
27
- },
28
- };
@@ -1,28 +0,0 @@
1
- module.exports = {
2
- env: {
3
- browser: true,
4
- es2021: true,
5
- },
6
- extends: 'airbnb',
7
- overrides: [
8
- {
9
- env: {
10
- node: true,
11
- },
12
- files: [
13
- '.eslintrc.{js,cjs}',
14
- ],
15
- parserOptions: {
16
- sourceType: 'script',
17
- },
18
- },
19
- ],
20
- parserOptions: {
21
- ecmaVersion: 'latest',
22
- sourceType: 'module',
23
- },
24
- rules: {
25
- 'max-len': 'off',
26
- 'linebreak-style': ["error", "windows"]
27
- },
28
- };
@@ -1,28 +0,0 @@
1
- module.exports = {
2
- env: {
3
- browser: true,
4
- es2021: true,
5
- },
6
- extends: 'airbnb',
7
- overrides: [
8
- {
9
- env: {
10
- node: true,
11
- },
12
- files: [
13
- '.eslintrc.{js,cjs}',
14
- ],
15
- parserOptions: {
16
- sourceType: 'script',
17
- },
18
- },
19
- ],
20
- parserOptions: {
21
- ecmaVersion: 'latest',
22
- sourceType: 'module',
23
- },
24
- rules: {
25
- 'max-len': 'off',
26
- 'linebreak-style': ['error', 'windows']
27
- },
28
- };
@@ -1,28 +0,0 @@
1
- module.exports = {
2
- env: {
3
- browser: true,
4
- es2021: true,
5
- },
6
- extends: 'airbnb',
7
- overrides: [
8
- {
9
- env: {
10
- node: true,
11
- },
12
- files: [
13
- '.eslintrc.{js,cjs}',
14
- ],
15
- parserOptions: {
16
- sourceType: 'script',
17
- },
18
- },
19
- ],
20
- parserOptions: {
21
- ecmaVersion: 'latest',
22
- sourceType: 'module',
23
- },
24
- rules: {
25
- 'max-len': 'off',
26
- 'linebreak-style': ['error', 'windows'],
27
- },
28
- };
@@ -1,29 +0,0 @@
1
- /* eslint-disable linebreak-style */
2
- module.exports = {
3
- env: {
4
- browser: true,
5
- es2021: true,
6
- },
7
- extends: 'airbnb',
8
- overrides: [
9
- {
10
- env: {
11
- node: true,
12
- },
13
- files: [
14
- '.eslintrc.{js,cjs}',
15
- ],
16
- parserOptions: {
17
- sourceType: 'script',
18
- },
19
- },
20
- ],
21
- parserOptions: {
22
- ecmaVersion: 'latest',
23
- sourceType: 'module',
24
- },
25
- rules: {
26
- 'max-len': 'off',
27
- 'linebreak-style': ['error', 'windows'],
28
- },
29
- };
@@ -1,28 +0,0 @@
1
- module.exports = {
2
- env: {
3
- browser: true,
4
- es2021: true,
5
- },
6
- extends: 'airbnb',
7
- overrides: [
8
- {
9
- env: {
10
- node: true,
11
- },
12
- files: [
13
- '.eslintrc.{js,cjs}',
14
- ],
15
- parserOptions: {
16
- sourceType: 'script',
17
- },
18
- },
19
- ],
20
- parserOptions: {
21
- ecmaVersion: 'latest',
22
- sourceType: 'module',
23
- },
24
- rules: {
25
- 'max-len': 'off',
26
- 'linebreak-style': ['error', 'windows'],
27
- },
28
- };