sag_components 1.0.422 → 1.0.424

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 +90 -58
  5. package/dist/stories/components/TotalBenchmarkAreachart.style.js +9 -6
  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.buttonText, props.progress, props.progress + 1, 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,24 +80,43 @@ const TotalBenchmarkAreachart = props => {
78
80
  height: 25 * getSizeFactor()
79
81
  }));
80
82
  };
81
- const CustomTick = _ref => {
82
- let {
83
+
84
+ // ----------------------------- Custom tick function -----------------------
85
+ const CustomTick = item => {
86
+ var _payload$value, _payload$value2, _payload$value3;
87
+ const {
83
88
  x,
84
89
  y,
85
90
  stroke,
86
91
  payload
87
- } = _ref;
92
+ } = item;
93
+ const NORMAL_WIDTH = 350;
94
+ const currentWeek = (payload === null || payload === void 0 ? void 0 : (_payload$value = payload.value) === null || _payload$value === void 0 ? void 0 : _payload$value.length) > 1 ? payload === null || payload === void 0 ? void 0 : (_payload$value2 = payload.value) === null || _payload$value2 === void 0 ? void 0 : _payload$value2.substring(1, payload === null || payload === void 0 ? void 0 : (_payload$value3 = payload.value) === null || _payload$value3 === void 0 ? void 0 : _payload$value3.length) : 0;
95
+ if (!(0, _CommonFunctions.isNumericValue)(currentWeek) || !(0, _CommonFunctions.isNumericValue)(startWeekRange) || !(0, _CommonFunctions.isNumericValue)(endWeekRange)) {
96
+ return;
97
+ }
98
+ const currentWeekNumeric = Number(currentWeek);
99
+ const startWeekRangeNumeric = Number(startWeekRange);
100
+ const endWeekRangeNumeric = Number(endWeekRange);
101
+ const {
102
+ offsetWidth
103
+ } = controlsContainerRef.current;
104
+ const elementWidthFactor = offsetWidth / NORMAL_WIDTH * 0.5;
105
+ const lastElementWidthFactor = offsetWidth / NORMAL_WIDTH * 0.9;
106
+ const elementLeftFactor = offsetWidth / NORMAL_WIDTH * 0.3;
107
+ const elementWidth = currentWeekNumeric === endWeekRangeNumeric ? 45 * lastElementWidthFactor : 140 * elementWidthFactor;
108
+ console.log("offsetWidth", offsetWidth, elementWidthFactor);
88
109
  return /*#__PURE__*/_react.default.createElement("g", {
89
110
  transform: "translate(".concat(x, ",").concat(y, ")")
90
- }, activeLabel === payload.value && /*#__PURE__*/_react.default.createElement("rect", {
91
- x: -15,
111
+ }, currentWeekNumeric >= startWeekRangeNumeric && currentWeekNumeric <= endWeekRangeNumeric ? /*#__PURE__*/_react.default.createElement("rect", {
112
+ x: -50 * elementLeftFactor,
92
113
  y: 0,
93
- width: "40",
94
- height: "18",
114
+ width: elementWidth,
115
+ height: 18,
95
116
  rx: 9,
96
- fill: xselectedColor,
97
- fillOpacity: "0.30"
98
- }), /*#__PURE__*/_react.default.createElement("text", {
117
+ fill: xselectedColor
118
+ //fillOpacity="0.50"
119
+ }) : "", /*#__PURE__*/_react.default.createElement("text", {
99
120
  x: 0,
100
121
  y: 14,
101
122
  dx: -10,
@@ -103,18 +124,27 @@ const TotalBenchmarkAreachart = props => {
103
124
  fontSize: "14px"
104
125
  }, payload.value));
105
126
  };
106
- const CustomTooltip = _ref2 => {
127
+ const CustomTooltip = _ref => {
107
128
  let {
108
129
  active,
109
130
  payload,
110
131
  label
111
- } = _ref2;
132
+ } = _ref;
112
133
  if (active && payload && payload.length) {
113
134
  setActiveLabel(label);
114
135
  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
136
  }
116
137
  return null;
117
138
  };
139
+ const getEventWeeksLegendData = () => /*#__PURE__*/_react.default.createElement(_TotalBenchmarkAreachart.EventWeeksLegendDataContainer, {
140
+ id: "EventWeeksLegendDataContainer"
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, {
@@ -197,9 +227,9 @@ const TotalBenchmarkAreachart = props => {
197
227
  tick: item => /*#__PURE__*/_react.default.createElement(CustomTick, item),
198
228
  tickLine: false,
199
229
  style: {
200
- fontWeight: '700',
201
- stroke: '#D0D0D0',
202
- strokeWidth: '1px'
230
+ fontWeight: "700",
231
+ stroke: "#D0D0D0",
232
+ strokeWidth: "1px"
203
233
  }
204
234
  }), /*#__PURE__*/_react.default.createElement(_recharts.CartesianGrid, {
205
235
  strokeDasharray: "3 3"
@@ -217,84 +247,86 @@ const TotalBenchmarkAreachart = props => {
217
247
  fill: "url(#colorValue2)"
218
248
  }), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, {
219
249
  content: /*#__PURE__*/_react.default.createElement(CustomTooltip, null)
220
- }), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, null))))) : /*#__PURE__*/_react.default.createElement(_NoDataFoundMessage.NoDataFoundMessage, {
250
+ }), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, null)))), getEventWeeksLegendData()) : /*#__PURE__*/_react.default.createElement(_NoDataFoundMessage.NoDataFoundMessage, {
221
251
  noDataText: noDataText
222
252
  }));
223
253
  };
224
254
  exports.TotalBenchmarkAreachart = TotalBenchmarkAreachart;
225
255
  var _default = exports.default = TotalBenchmarkAreachart;
226
256
  TotalBenchmarkAreachart.defaultProps = {
227
- title: 'String',
257
+ title: "String",
228
258
  value: 300,
229
- arrowSign: '$',
259
+ arrowSign: "$",
230
260
  addingBenchmark: true,
231
- benchmarkTotalValue: '',
261
+ benchmarkTotalValue: "",
232
262
  benchmarkValue: null,
233
263
  areaChartData: [{
234
- title: 'W20',
264
+ title: "W20",
235
265
  value1: 542366,
236
266
  value2: 247715
237
267
  }, {
238
- title: 'W21',
268
+ title: "W21",
239
269
  value1: 699511,
240
270
  value2: 252313
241
271
  }, {
242
- title: 'W22',
272
+ title: "W22",
243
273
  value1: 403092,
244
274
  value2: 260822
245
275
  }, {
246
- title: 'W23',
276
+ title: "W23",
247
277
  value1: 396184,
248
278
  value2: 264325
249
279
  }, {
250
- title: 'W24',
280
+ title: "W24",
251
281
  value1: 415317,
252
282
  value2: 269243
253
283
  }, {
254
- title: 'W25',
284
+ title: "W25",
255
285
  value1: 568376,
256
286
  value2: 269592
257
287
  }, {
258
- title: 'W26',
288
+ title: "W26",
259
289
  value1: 1078121,
260
290
  value2: 269949
261
291
  }, {
262
- title: 'W27',
292
+ title: "W27",
263
293
  value1: 347930,
264
294
  value2: 270735
265
295
  }, {
266
- title: 'W28',
296
+ title: "W28",
267
297
  value1: 346258,
268
298
  value2: 271200
269
299
  }, {
270
- title: 'W29',
300
+ title: "W29",
271
301
  value1: 350184,
272
302
  value2: 270324
273
303
  }, {
274
- title: 'W30',
304
+ title: "W30",
275
305
  value1: 312790,
276
306
  value2: 266821
277
307
  }, {
278
- title: 'W31',
308
+ title: "W31",
279
309
  value1: 335076,
280
310
  value2: 267064
281
311
  }, {
282
- title: 'W32',
312
+ title: "W32",
283
313
  value1: 311037,
284
314
  value2: 266821
285
315
  }],
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: ''
316
+ width: "100%",
317
+ height: "100%",
318
+ textcolor: "#212121",
319
+ areaChart1Color: "#BD9EFF",
320
+ areaChart2Color: "#96B4FF",
321
+ xselectedColor: "#42977A",
322
+ fillChart1Color: "rgba(34, 158, 56, 0.20)",
323
+ fillChart2Color: "rgba(255, 84, 84, 0.2)",
324
+ startOffset: "17.04%",
325
+ endOffset: "17.04%",
326
+ opacity: "191",
327
+ value1Title: "Actual Sales",
328
+ value2Title: "Baseline Sales",
329
+ noDataText: "",
330
+ startWeekRange: 0,
331
+ endWeekRange: 0
300
332
  };
@@ -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.EventWeeksLegendDataContainer = 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;
10
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17;
11
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"])));
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,8 @@ 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 EventWeeksLegendDataContainer = exports.EventWeeksLegendDataContainer = _styledComponents.default.div(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: center;\n margin-top: 10px;\n align-items: center;\n"])));
26
+ const EventWeeksLegendTitle = exports.EventWeeksLegendTitle = _styledComponents.default.h4(_templateObject16 || (_templateObject16 = (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"])));
27
+ const EventWeeksLegendColorRectangle = exports.EventWeeksLegendColorRectangle = _styledComponents.default.div(_templateObject17 || (_templateObject17 = (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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sag_components",
3
- "version": "1.0.422",
3
+ "version": "1.0.424",
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
- };