sag_components 1.0.423 → 1.0.425

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/CommonFunctions.js +28 -18
  2. package/dist/stories/components/IconButton.js +35 -16
  3. package/dist/stories/components/IconButton.style.js +2 -2
  4. package/dist/stories/components/TotalBenchmarkAreachart.js +87 -53
  5. package/dist/stories/components/TotalBenchmarkAreachart.style.js +13 -7
  6. package/package.json +9 -9
  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
@@ -3,18 +3,18 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getNumberWithCommas = exports.getFormattedValue = exports.getFormattedUnits = exports.getCurrencySign = void 0;
6
+ exports.isNumericValue = exports.getNumberWithCommas = exports.getFormattedValue = exports.getFormattedUnits = exports.getCurrencySign = void 0;
7
7
  const getCurrencySign = (currencyTypeToConvert, value) => {
8
8
  if (value === undefined || value === null) {
9
- return '';
9
+ return "";
10
10
  }
11
11
  if (isNaN(parseFloat(value))) {
12
- return '';
12
+ return "";
13
13
  }
14
- if (!currencyTypeToConvert) return '';
15
- let currencySign = '';
16
- const currencyFormatter = new Intl.NumberFormat('en-US', {
17
- style: 'currency',
14
+ if (!currencyTypeToConvert) return "";
15
+ let currencySign = "";
16
+ const currencyFormatter = new Intl.NumberFormat("en-US", {
17
+ style: "currency",
18
18
  currency: currencyTypeToConvert
19
19
  });
20
20
  currencySign = currencyFormatter.format(Math.abs(value)).substring(0, 1);
@@ -23,21 +23,21 @@ const getCurrencySign = (currencyTypeToConvert, value) => {
23
23
  exports.getCurrencySign = getCurrencySign;
24
24
  const getFormattedUnits = num => {
25
25
  if (num === undefined || num === null) {
26
- return '';
26
+ return "";
27
27
  }
28
28
  if (isNaN(parseFloat(num))) {
29
- return '';
29
+ return "";
30
30
  }
31
31
  if (Math.abs(num) >= 1000000000) {
32
- return 'B';
32
+ return "B";
33
33
  }
34
34
  if (Math.abs(num) >= 1000000) {
35
- return 'M';
35
+ return "M";
36
36
  }
37
37
  if (Math.abs(num) >= 1000) {
38
- return 'K';
38
+ return "K";
39
39
  }
40
- return '';
40
+ return "";
41
41
  };
42
42
  exports.getFormattedUnits = getFormattedUnits;
43
43
  const getFormattedValue = num => {
@@ -50,13 +50,13 @@ const getFormattedValue = num => {
50
50
 
51
51
  // if (typeof num === 'number') {
52
52
  if (Math.abs(num) >= 1000000000) {
53
- return (num / 1000000000).toFixed(1).replace(/\.0$/, '');
53
+ return (num / 1000000000).toFixed(1).replace(/\.0$/, "");
54
54
  }
55
55
  if (Math.abs(num) >= 1000000) {
56
- return (num / 1000000).toFixed(1).replace(/\.0$/, '');
56
+ return (num / 1000000).toFixed(1).replace(/\.0$/, "");
57
57
  }
58
58
  if (Math.abs(num) >= 1000) {
59
- return (num / 1000).toFixed(1).replace(/\.0$/, '');
59
+ return (num / 1000).toFixed(1).replace(/\.0$/, "");
60
60
  }
61
61
  return num;
62
62
  // }
@@ -65,7 +65,17 @@ exports.getFormattedValue = getFormattedValue;
65
65
  const getNumberWithCommas = x => {
66
66
  let param = x.toString();
67
67
  const pattern = /(-?\d+)(\d{3})/;
68
- while (pattern.test(param)) param = param.replace(pattern, '$1,$2');
68
+ while (pattern.test(param)) param = param.replace(pattern, "$1,$2");
69
69
  return param;
70
70
  };
71
- exports.getNumberWithCommas = getNumberWithCommas;
71
+ exports.getNumberWithCommas = getNumberWithCommas;
72
+ const isNumericValue = num => {
73
+ if (num === undefined || num === null) {
74
+ return false;
75
+ }
76
+ if (isNaN(parseFloat(num))) {
77
+ return false;
78
+ }
79
+ return true;
80
+ };
81
+ exports.isNumericValue = isNumericValue;
@@ -17,10 +17,7 @@ var _IconButton = require("./IconButton.style");
17
17
  /* IconButton */
18
18
  const IconButton = props => {
19
19
  const {
20
- // downloadStatus,
21
- fileName,
22
- fileLink,
23
- showProcess,
20
+ downloadStatus,
24
21
  contentColor,
25
22
  buttonText,
26
23
  backgroundColor,
@@ -30,28 +27,30 @@ const IconButton = props => {
30
27
  iconWidth,
31
28
  iconHeight,
32
29
  disabled,
30
+ inProgress,
33
31
  onClick,
34
32
  onCancelClick
35
33
  } = props;
34
+ const [mouseDownPressed, setMouseDownPressed] = (0, _react.useState)(false);
36
35
  const [progress, setProgress] = (0, _react.useState)(0);
37
36
  const incrementProgress = () => {
38
- if (showProcess && progress <= 90) {
37
+ if (downloadStatus === 'in progress' && progress <= 90) {
39
38
  const interval = setInterval(() => {
40
39
  setProgress(prevProgress => {
41
- const newProgress = prevProgress + 3;
40
+ const newProgress = prevProgress + 1;
42
41
  if (newProgress >= 90) {
43
42
  clearInterval(interval);
44
43
  }
45
44
  return newProgress;
46
45
  });
47
46
  }, 500);
48
- } else {
47
+ } else if (downloadStatus === 'success') {
49
48
  setProgress(0);
50
49
  }
51
50
  };
52
51
  (0, _react.useEffect)(() => {
53
52
  incrementProgress();
54
- }, [showProcess]);
53
+ }, [downloadStatus]);
55
54
  const getIcon = icon => {
56
55
  switch (icon) {
57
56
  case 'download':
@@ -100,35 +99,54 @@ const IconButton = props => {
100
99
  return '';
101
100
  }
102
101
  };
102
+ const onMouseDownHandler = () => {
103
+ if (disabled) return;
104
+ setMouseDownPressed(true);
105
+ };
106
+ const onMouseUpHandler = () => {
107
+ if (disabled) return;
108
+ setMouseDownPressed(false);
109
+ };
110
+ const onPointerOutHandler = () => {
111
+ if (disabled) return;
112
+ if (!mouseDownPressed) return;
113
+ setMouseDownPressed(false);
114
+ };
115
+ const getClassNameExtention = () => {
116
+ if (disabled) return 'disabled';
117
+ if (mouseDownPressed) return 'mouseDownPressed';
118
+ return '';
119
+ };
103
120
  const onClickHandler = event => {
121
+ if (disabled) return;
104
122
  onClick(event);
105
123
  };
106
124
  const onCancelClickHandler = event => {
107
125
  onCancelClick(event);
108
126
  };
109
127
  return /*#__PURE__*/_react.default.createElement(_IconButton.ButtonWrapper, null, /*#__PURE__*/_react.default.createElement(_IconButton.IconButtonContainer, {
110
- download: fileName,
111
- href: fileLink,
128
+ className: getClassNameExtention(),
112
129
  backgroundColor: backgroundColor,
113
130
  borderColor: borderColor,
114
131
  borderRadius: borderRadius,
115
132
  color: contentColor,
116
- inProgress: showProcess,
133
+ onMouseDown: onMouseDownHandler,
134
+ onMouseUp: onMouseUpHandler,
135
+ onPointerOut: onPointerOutHandler,
136
+ inProgress: inProgress,
117
137
  progress: progress,
118
138
  onClick: event => {
119
139
  onClickHandler(event);
120
140
  }
121
- }, getIcon(iconName), buttonText !== '' && buttonText !== undefined && /*#__PURE__*/_react.default.createElement(_IconButton.SpanText, null, buttonText)), showProcess && /*#__PURE__*/_react.default.createElement(_IconButton.CancelClick, {
141
+ }, getIcon(iconName), buttonText !== '' && buttonText !== undefined && /*#__PURE__*/_react.default.createElement(_IconButton.SpanText, null, buttonText)), inProgress && /*#__PURE__*/_react.default.createElement(_IconButton.CancelClick, {
122
142
  onClick: event => onCancelClickHandler(event)
123
143
  }, "Click here to cancel"));
124
144
  };
125
145
  exports.IconButton = IconButton;
126
146
  var _default = exports.default = IconButton;
127
147
  IconButton.defaultProps = {
128
- // downloadStatus: '',
129
- fileName: '',
130
- fileLink: '',
131
- showProcess: false,
148
+ // downloadStatus: 'fail',
149
+ downloadStatus: 'in progress',
132
150
  buttonText: '',
133
151
  iconName: 'eye',
134
152
  contentColor: '#212121',
@@ -138,6 +156,7 @@ IconButton.defaultProps = {
138
156
  iconHeight: 18,
139
157
  iconWidth: 18,
140
158
  disabled: false,
159
+ inProgress: false,
141
160
  onClick: () => {},
142
161
  onCancelClick: () => {}
143
162
  };
@@ -10,6 +10,6 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
10
10
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
11
11
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
12
12
  const ButtonWrapper = exports.ButtonWrapper = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: fit-content;\n text-align: center;\n"])));
13
- const IconButtonContainer = exports.IconButtonContainer = _styledComponents.default.a(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n font-size: 14px;\n font-weight: 400;\n display: flex;\n gap: 10px;\n align-items: center;\n justify-content: center;\n padding: 12px 20px;\n text-decoration: none;\n color: ", ";\n border-radius: ", ";\n border: 1px solid ", ";\n background: ", ";\n position: relative;\n transition: all .3s;\n ", "\n &:hover, &:focus {\n cursor: pointer;\n box-shadow: 5px 5px 10px 0px rgba(0, 0, 0, 0.1);\n }\n"])), props => props.color, props => props.borderRadius, props => props.borderColor.toString(), props => props.backgroundColor.toString(), props => props.inProgress && (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n pointer-events: none;\n &:after {\n content: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n text-wrap: nowrap;\n position: absolute;\n background: linear-gradient(\n to right,\n #5FCC70 ", "%,\n #B1B1B1 ", "%,\n #B1B1B1 100%\n );\n width: 100%;\n height: 100%;\n border-radius: ", ";\n border-width: 0;\n z-index: 9;\n }\n "])), props => props.buttonText, props.progress, props.progress + 1, props => props.borderRadius));
13
+ const IconButtonContainer = exports.IconButtonContainer = _styledComponents.default.button(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n font-size: 14px;\n font-weight: 400;\n display: flex;\n gap: 10px;\n align-items: center;\n justify-content: center;\n padding: 12px 20px;\n margin-bottom: 5px;\n color: ", ";\n border-radius: ", ";\n border: 1px solid ", ";\n background: ", ";\n position: relative;\n transition: all .3s;\n ", "\n &:hover, &:focus {\n cursor: pointer;\n box-shadow: 5px 5px 10px 0px rgba(0, 0, 0, 0.1);\n }\n"])), props => props.color, props => props.borderRadius, props => props.borderColor.toString(), props => props.backgroundColor.toString(), props => props.inProgress && (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n pointer-events: none;\n &:after {\n content: 'In Progress';\n display: flex;\n align-items: center;\n justify-content: center;\n text-wrap: nowrap;\n position: absolute;\n background: linear-gradient(\n to right,\n #5FCC70 ", "%,\n #B1B1B1 ", "%,\n #B1B1B1 100%\n );\n width: 100%;\n height: 100%;\n border-radius: ", ";\n border-width: 0;\n z-index: 9;\n }\n "])), props.progress, props.progress + 1, props => props.borderRadius));
14
14
  const SpanText = exports.SpanText = _styledComponents.default.span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n"])));
15
- const CancelClick = exports.CancelClick = _styledComponents.default.span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n display: inherit;\n font-family: \"Lato\", sans-serif;;\n font-size: 14px;\n color: #568202;\n cursor: pointer;\n margin-top: 5px;\n"])));
15
+ const CancelClick = exports.CancelClick = _styledComponents.default.span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n display: inherit;\n font-family: \"Lato\", sans-serif;;\n font-size: 14px;\n color: #568202;\n"])));
@@ -10,9 +10,9 @@ var _recharts = require("recharts");
10
10
  var _ArrowUpIcon = require("./icons/ArrowUpIcon");
11
11
  var _ArrowDownIcon = require("./icons/ArrowDownIcon");
12
12
  var _NoDataFoundMessage = require("./NoDataFoundMessage");
13
+ var _CommonFunctions = require("./CommonFunctions");
13
14
  var _Benchmark = require("./Benchmark");
14
15
  var _TotalBenchmarkAreachart = require("./TotalBenchmarkAreachart.style");
15
- var _CommonFunctions = require("./CommonFunctions");
16
16
  /* TotalBenchmarkAreachart */
17
17
  const TotalBenchmarkAreachart = props => {
18
18
  const {
@@ -36,14 +36,16 @@ const TotalBenchmarkAreachart = props => {
36
36
  opacity,
37
37
  value1Title,
38
38
  value2Title,
39
- noDataText
39
+ noDataText,
40
+ startWeekRange = 0,
41
+ endWeekRange = 0
40
42
  } = props;
41
43
  const DEFAULT_ROOT_FONT = 16;
42
44
  const DEFAULT_COMPONENT_WIDTH = 250;
43
45
  const DEFAULT_COMPONENT_HEIGHT = 280;
44
- const [rootFont, setRootFont] = (0, _react.useState)(DEFAULT_ROOT_FONT.toString().concat('', 'px'));
46
+ const [rootFont, setRootFont] = (0, _react.useState)(DEFAULT_ROOT_FONT.toString().concat("", "px"));
45
47
  const anotherRef = (0, _react.useRef)(null);
46
- const [activeLabel, setActiveLabel] = (0, _react.useState)('');
48
+ const [activeLabel, setActiveLabel] = (0, _react.useState)("");
47
49
  const controlsContainerRef = (0, _react.useRef)();
48
50
  (0, _react.useEffect)(() => {
49
51
  const {
@@ -52,16 +54,16 @@ const TotalBenchmarkAreachart = props => {
52
54
  setRootFont(getRootFont(offsetWidth));
53
55
  }, [width]);
54
56
  const getRootFont = width => {
55
- const relation = width.toString().replace('px', '').replace('%', '') / DEFAULT_COMPONENT_WIDTH;
56
- const fontRoot = (DEFAULT_ROOT_FONT * relation).toString().concat('', 'px');
57
+ const relation = width.toString().replace("px", "").replace("%", "") / DEFAULT_COMPONENT_WIDTH;
58
+ const fontRoot = (DEFAULT_ROOT_FONT * relation).toString().concat("", "px");
57
59
  return fontRoot;
58
60
  };
59
- const getSizeFactor = () => rootFont.toString().replace('px', '') / DEFAULT_ROOT_FONT;
61
+ const getSizeFactor = () => rootFont.toString().replace("px", "") / DEFAULT_ROOT_FONT;
60
62
  const getArrowSign = arrowSign => {
61
63
  if (!arrowSign) {
62
- return '';
64
+ return "";
63
65
  }
64
- if (arrowSign === 'up') {
66
+ if (arrowSign === "up") {
65
67
  return /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.DetailsRowArrowContainer, {
66
68
  id: "DetailsRowArrowContainer",
67
69
  value: value
@@ -78,13 +80,15 @@ const TotalBenchmarkAreachart = props => {
78
80
  height: 25 * getSizeFactor()
79
81
  }));
80
82
  };
81
- const CustomTick = _ref => {
82
- let {
83
+
84
+ // ----------------------------- Custom tick function - not used -----------------------
85
+ const CustomTick = item => {
86
+ const {
83
87
  x,
84
88
  y,
85
89
  stroke,
86
90
  payload
87
- } = _ref;
91
+ } = item;
88
92
  return /*#__PURE__*/_react.default.createElement("g", {
89
93
  transform: "translate(".concat(x, ",").concat(y, ")")
90
94
  }, activeLabel === payload.value && /*#__PURE__*/_react.default.createElement("rect", {
@@ -103,18 +107,44 @@ const TotalBenchmarkAreachart = props => {
103
107
  fontSize: "14px"
104
108
  }, payload.value));
105
109
  };
106
- const CustomTooltip = _ref2 => {
110
+ const CustomTooltip = _ref => {
107
111
  let {
108
112
  active,
109
113
  payload,
110
114
  label
111
- } = _ref2;
115
+ } = _ref;
112
116
  if (active && payload && payload.length) {
113
117
  setActiveLabel(label);
114
118
  return /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.TooltipDiv, null, /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.TooltipTitle, null, "".concat(label)), /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.TooltipLabel, null, "".concat(value1Title, " ").concat((0, _CommonFunctions.getFormattedValue)(payload[0].value)).concat((0, _CommonFunctions.getFormattedUnits)(payload[0].value))), /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.TooltipLabel, null, "".concat(value2Title, " ").concat((0, _CommonFunctions.getFormattedValue)(payload[1].value)).concat((0, _CommonFunctions.getFormattedUnits)(payload[1].value))));
115
119
  }
116
120
  return null;
117
121
  };
122
+ const displayEventWeeksElements = () => {
123
+ return /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.EventWeeksLegendDataElementsContainer, {
124
+ id: "EventWeeksLegendDataElementsContainer"
125
+ }, areaChartData === null || areaChartData === void 0 ? void 0 : areaChartData.map(item => {
126
+ console.log("displayEventWeeksElements", item);
127
+ if (item !== null) {
128
+ return /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.EventWeeksLegendDataElement, {
129
+ id: "EventWeeksLegendDataElement",
130
+ color: item.title >= startWeekRange && item.title <= endWeekRange ? xselectedColor : "",
131
+ borderLeftRadius: item.title === startWeekRange ? "12px" : "0px",
132
+ borderRightRadius: item.title === endWeekRange ? "12px" : "0px"
133
+ }, item.title);
134
+ }
135
+ }));
136
+ };
137
+ const displayEventWeeksLegendData = () => /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.EventWeeksLegendMainContainer, {
138
+ id: "EventWeeksLegendMainContainer"
139
+ }, displayEventWeeksElements(), /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.EventWeeksLegendContainer, {
140
+ id: "EventWeeksLegendContainer"
141
+ }, /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.EventWeeksLegendColorRectangle, {
142
+ id: "EventWeeksLegendColorRectangle",
143
+ color: xselectedColor
144
+ }), /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.EventWeeksLegendTitle, {
145
+ id: "EventWeeksLegendTitle",
146
+ width: width
147
+ }, "Event weeks")));
118
148
  return /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.ControlsContainer, {
119
149
  id: "ControlsContainer",
120
150
  height: height,
@@ -129,9 +159,9 @@ const TotalBenchmarkAreachart = props => {
129
159
  id: "Title"
130
160
  }, title), /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.ValueAndBenchmarkContainer, {
131
161
  id: "ValueAndBenchmarkContainer"
132
- }, value !== undefined && value != null ? getArrowSign(arrowSign) : '', /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.FormattedValue, {
162
+ }, value !== undefined && value != null ? getArrowSign(arrowSign) : "", /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.FormattedValue, {
133
163
  id: "FormattedValue"
134
- }, value !== undefined && value != null ? /*#__PURE__*/_react.default.createElement("span", null, "".concat(value, " "), /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.CurrencySign, null, "%")) : ''), /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.FormattedValueNoDataMessage, null, value === undefined || value === null ? 'No Data' : ''), addingBenchmark && benchmarkTotalValue ? /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.BenchmarkContainer, {
164
+ }, value !== undefined && value != null ? /*#__PURE__*/_react.default.createElement("span", null, "".concat(value, " "), /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.CurrencySign, null, "%")) : ""), /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.FormattedValueNoDataMessage, null, value === undefined || value === null ? "No Data" : ""), addingBenchmark && benchmarkTotalValue ? /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.BenchmarkContainer, {
135
165
  id: "BenchmarkContainer"
136
166
  }, /*#__PURE__*/_react.default.createElement(_Benchmark.Benchmark, {
137
167
  id: "Benchmark",
@@ -145,7 +175,7 @@ const TotalBenchmarkAreachart = props => {
145
175
  linearGradientUnderAvarageColor: "#FDB1B1",
146
176
  underAvarageColor: "#FD5959",
147
177
  backgroundColor: "#F2F2F2"
148
- })) : '')), /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.AreaChartContainer, {
178
+ })) : "")), /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.AreaChartContainer, {
149
179
  ref: anotherRef,
150
180
  id: "AreaChartContainer"
151
181
  }, /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, {
@@ -158,7 +188,7 @@ const TotalBenchmarkAreachart = props => {
158
188
  margin: {
159
189
  top: 0,
160
190
  right: 24,
161
- bottom: -5,
191
+ bottom: -30,
162
192
  left: 24
163
193
  }
164
194
  }, /*#__PURE__*/_react.default.createElement(_recharts.CartesianGrid, {
@@ -194,12 +224,14 @@ const TotalBenchmarkAreachart = props => {
194
224
  stopOpacity: opacity
195
225
  }))), /*#__PURE__*/_react.default.createElement(_recharts.XAxis, {
196
226
  dataKey: "title",
197
- tick: item => /*#__PURE__*/_react.default.createElement(CustomTick, item),
227
+ tick: false
228
+ // tick={(item) => <CustomTick {...item} />}
229
+ ,
198
230
  tickLine: false,
199
231
  style: {
200
- fontWeight: '700',
201
- stroke: '#D0D0D0',
202
- strokeWidth: '1px'
232
+ fontWeight: "700",
233
+ stroke: "#D0D0D0",
234
+ strokeWidth: "1px"
203
235
  }
204
236
  }), /*#__PURE__*/_react.default.createElement(_recharts.CartesianGrid, {
205
237
  strokeDasharray: "3 3"
@@ -217,84 +249,86 @@ const TotalBenchmarkAreachart = props => {
217
249
  fill: "url(#colorValue2)"
218
250
  }), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, {
219
251
  content: /*#__PURE__*/_react.default.createElement(CustomTooltip, null)
220
- }), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, null))))) : /*#__PURE__*/_react.default.createElement(_NoDataFoundMessage.NoDataFoundMessage, {
252
+ }), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, null)))), displayEventWeeksLegendData()) : /*#__PURE__*/_react.default.createElement(_NoDataFoundMessage.NoDataFoundMessage, {
221
253
  noDataText: noDataText
222
254
  }));
223
255
  };
224
256
  exports.TotalBenchmarkAreachart = TotalBenchmarkAreachart;
225
257
  var _default = exports.default = TotalBenchmarkAreachart;
226
258
  TotalBenchmarkAreachart.defaultProps = {
227
- title: 'String',
259
+ title: "String",
228
260
  value: 300,
229
- arrowSign: '$',
261
+ arrowSign: "$",
230
262
  addingBenchmark: true,
231
- benchmarkTotalValue: '',
263
+ benchmarkTotalValue: "",
232
264
  benchmarkValue: null,
233
265
  areaChartData: [{
234
- title: 'W20',
266
+ title: "W20",
235
267
  value1: 542366,
236
268
  value2: 247715
237
269
  }, {
238
- title: 'W21',
270
+ title: "W21",
239
271
  value1: 699511,
240
272
  value2: 252313
241
273
  }, {
242
- title: 'W22',
274
+ title: "W22",
243
275
  value1: 403092,
244
276
  value2: 260822
245
277
  }, {
246
- title: 'W23',
278
+ title: "W23",
247
279
  value1: 396184,
248
280
  value2: 264325
249
281
  }, {
250
- title: 'W24',
282
+ title: "W24",
251
283
  value1: 415317,
252
284
  value2: 269243
253
285
  }, {
254
- title: 'W25',
286
+ title: "W25",
255
287
  value1: 568376,
256
288
  value2: 269592
257
289
  }, {
258
- title: 'W26',
290
+ title: "W26",
259
291
  value1: 1078121,
260
292
  value2: 269949
261
293
  }, {
262
- title: 'W27',
294
+ title: "W27",
263
295
  value1: 347930,
264
296
  value2: 270735
265
297
  }, {
266
- title: 'W28',
298
+ title: "W28",
267
299
  value1: 346258,
268
300
  value2: 271200
269
301
  }, {
270
- title: 'W29',
302
+ title: "W29",
271
303
  value1: 350184,
272
304
  value2: 270324
273
305
  }, {
274
- title: 'W30',
306
+ title: "W30",
275
307
  value1: 312790,
276
308
  value2: 266821
277
309
  }, {
278
- title: 'W31',
310
+ title: "W31",
279
311
  value1: 335076,
280
312
  value2: 267064
281
313
  }, {
282
- title: 'W32',
314
+ title: "W32",
283
315
  value1: 311037,
284
316
  value2: 266821
285
317
  }],
286
- width: '100%',
287
- height: '100%',
288
- textcolor: '#212121',
289
- areaChart1Color: '#BD9EFF',
290
- areaChart2Color: '#96B4FF',
291
- xselectedColor: '#42977A',
292
- fillChart1Color: 'rgba(34, 158, 56, 0.20)',
293
- fillChart2Color: 'rgba(255, 84, 84, 0.2)',
294
- startOffset: '17.04%',
295
- endOffset: '17.04%',
296
- opacity: '191',
297
- value1Title: 'Actual Sales',
298
- value2Title: 'Baseline Sales',
299
- noDataText: ''
318
+ width: "100%",
319
+ height: "100%",
320
+ textcolor: "#212121",
321
+ areaChart1Color: "#BD9EFF",
322
+ areaChart2Color: "#96B4FF",
323
+ xselectedColor: "#42977A",
324
+ fillChart1Color: "rgba(34, 158, 56, 0.20)",
325
+ fillChart2Color: "rgba(255, 84, 84, 0.2)",
326
+ startOffset: "17.04%",
327
+ endOffset: "17.04%",
328
+ opacity: "191",
329
+ value1Title: "Actual Sales",
330
+ value2Title: "Baseline Sales",
331
+ noDataText: "",
332
+ startWeekRange: 0,
333
+ endWeekRange: 0
300
334
  };
@@ -4,13 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.ValueAndBenchmarkContainer = exports.TooltipTitle = exports.TooltipLabel = exports.TooltipDiv = exports.TitleAndValueContainer = exports.Title = exports.FormattedValueNoDataMessage = exports.FormattedValue = exports.DetailsRowArrowContainer = exports.CurrencySign = exports.ControlsContainer = exports.Controls = exports.BenchmarkContainer = exports.AreaChartContainer = void 0;
7
+ exports.ValueAndBenchmarkContainer = exports.TooltipTitle = exports.TooltipLabel = exports.TooltipDiv = exports.TitleAndValueContainer = exports.Title = exports.FormattedValueNoDataMessage = exports.FormattedValue = exports.EventWeeksLegendTitle = exports.EventWeeksLegendMainContainer = exports.EventWeeksLegendDataElementsContainer = exports.EventWeeksLegendDataElement = exports.EventWeeksLegendContainer = exports.EventWeeksLegendColorRectangle = exports.DetailsRowArrowContainer = exports.CurrencySign = exports.ControlsContainer = exports.Controls = exports.BenchmarkContainer = exports.AreaChartContainer = void 0;
8
8
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
9
9
  var _styledComponents = _interopRequireDefault(require("styled-components"));
10
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
11
- const ControlsContainer = exports.ControlsContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n font-family: \"Poppins\", sans-serif;\n color: ", ";\n width: ", ";\n height: ", ";\n border-radius: 12px;\n"])), props => props.textColor, 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 width: 100%;\n height: 50%;\n"])));
10
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20;
11
+ const ControlsContainer = exports.ControlsContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n font-family: \"Poppins\", sans-serif;\n color: ", ";\n width: ", ";\n height: ", ";\n border-radius: 12px;\n min-width: 250px;\n"])), props => props.textColor, 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: 50%;\n"])));
14
14
  const TooltipDiv = exports.TooltipDiv = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: 5px;\n background: #ffffff;\n border-radius: 5px;\n padding: 8px 12px;\n display: grid;\n"])));
15
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
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"])));
@@ -20,5 +20,11 @@ const ValueAndBenchmarkContainer = exports.ValueAndBenchmarkContainer = _styledC
20
20
  const DetailsRowArrowContainer = exports.DetailsRowArrowContainer = _styledComponents.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: flex-end;\n width: 22px;\n @media (max-width: 1366px) {\n width: 12px;\n }\n @media (max-width: 1536px) {\n width: 14px;\n }\n"])));
21
21
  const FormattedValue = exports.FormattedValue = _styledComponents.default.div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size: 40px;\n @media (max-width: 1366px) {\n font-size: 20px;\n }\n @media (max-width: 1536px) {\n font-size: 24px;\n }\n"])));
22
22
  const CurrencySign = exports.CurrencySign = _styledComponents.default.span(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n font-size: 16px;\n @media (max-width: 1366px) {\n font-size: 12px;\n }\n @media (max-width: 1536px) {\n font-size: 14px;\n }\n"])));
23
- const FormattedValueNoDataMessage = exports.FormattedValueNoDataMessage = _styledComponents.default.div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n margin-left: 0.3rem;\n font-weight: 700;\n font-size: 16px;\n margin: 0; \n"])));
24
- const BenchmarkContainer = exports.BenchmarkContainer = _styledComponents.default.div(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n margin-left: 1.5rem;\n"])));
23
+ const FormattedValueNoDataMessage = exports.FormattedValueNoDataMessage = _styledComponents.default.div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n margin-left: 0.3rem;\n font-weight: 700;\n font-size: 16px;\n margin: 0;\n"])));
24
+ const BenchmarkContainer = exports.BenchmarkContainer = _styledComponents.default.div(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n margin-left: 1.5rem;\n"])));
25
+ const EventWeeksLegendMainContainer = exports.EventWeeksLegendMainContainer = _styledComponents.default.div(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: center;\n flex-direction: column;\n margin-top: 2px;\n align-items: center;\n"])));
26
+ const EventWeeksLegendContainer = exports.EventWeeksLegendContainer = _styledComponents.default.div(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: center;\n flex-direction: row;\n margin-top: 2px;\n align-items: center;\n"])));
27
+ const EventWeeksLegendTitle = exports.EventWeeksLegendTitle = _styledComponents.default.h4(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n margin: 0 0 0 5px;\n @media (max-width: 1536px) {\n font-size: 14px;\n }\n @media (max-width: 1366px) {\n font-size: 12px;\n }\n"])));
28
+ const EventWeeksLegendColorRectangle = exports.EventWeeksLegendColorRectangle = _styledComponents.default.div(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2.default)(["\n width: 0.5rem;\n min-width: 0.5rem;\n height: 0.5rem;\n border-radius: 2px;\n background: ", ";\n"])), props => props.color);
29
+ const EventWeeksLegendDataElementsContainer = exports.EventWeeksLegendDataElementsContainer = _styledComponents.default.div(_templateObject19 || (_templateObject19 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n margin-top: 1px;\n align-items: center;\n justify-content: space-around;\n width: 90%;\n"])));
30
+ const EventWeeksLegendDataElement = exports.EventWeeksLegendDataElement = _styledComponents.default.h4(_templateObject20 || (_templateObject20 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n font-weight: 400;\n font-size: 12px;\n line-height: 18px;\n margin: 2px 0px;\n width: 100%;\n justify-content: center;\n align-content: center;\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.borderLeftRadius, props => props.borderLeftRadius, props => props.borderRightRadius, props => props.borderRightRadius, props => props.color);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sag_components",
3
- "version": "1.0.423",
3
+ "version": "1.0.425",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -19,7 +19,7 @@
19
19
  "@babel/preset-env": "^7.23.6",
20
20
  "@babel/preset-react": "^7.23.3",
21
21
  "@babel/preset-typescript": "^7.23.3",
22
- "@storybook/addon-designs": "^7.0.7",
22
+ "@storybook/addon-designs": "^7.0.5",
23
23
  "@storybook/addon-essentials": "^7.4.6",
24
24
  "@storybook/addon-interactions": "^7.4.6",
25
25
  "@storybook/addon-links": "^7.4.6",
@@ -35,24 +35,24 @@
35
35
  "babel-preset-react-app": "^10.0.1",
36
36
  "cross-env": "^7.0.3",
37
37
  "css-loader": "^6.8.1",
38
- "eslint": "^8.56.0",
38
+ "eslint": "^8.53.0",
39
39
  "eslint-config-airbnb": "^19.0.4",
40
- "eslint-plugin-import": "^2.29.1",
40
+ "eslint-plugin-import": "^2.29.0",
41
41
  "eslint-plugin-jsx-a11y": "^6.8.0",
42
42
  "eslint-plugin-react": "^7.33.2",
43
43
  "eslint-plugin-react-hooks": "^4.6.0",
44
44
  "react-dom": "^18.2.0",
45
45
  "react-scripts": "^5.0.1",
46
46
  "sass": "^1.69.5",
47
- "sass-loader": "^13.3.3",
47
+ "sass-loader": "^13.3.2",
48
48
  "style-loader": "^3.3.3"
49
49
  },
50
50
  "dependencies": {
51
- "@emotion/react": "^11.11.3",
51
+ "@emotion/react": "^11.11.1",
52
52
  "@emotion/styled": "^11.11.0",
53
- "@mui/icons-material": "^5.15.2",
54
- "@mui/material": "^5.15.2",
55
- "@mui/x-date-pickers": "^6.18.6",
53
+ "@mui/icons-material": "^5.14.16",
54
+ "@mui/material": "^5.14.16",
55
+ "@mui/x-date-pickers": "^6.18.0",
56
56
  "classnames": "^2.3.2",
57
57
  "dayjs": "^1.11.10",
58
58
  "prop-types": "^15.8.1",
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
- };