sag_components 1.0.257 → 1.0.259
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.
- package/dist/stories/components/CodeEditor.js +40 -0
- package/dist/stories/components/CodeEditor.style.js +12 -0
- package/dist/stories/components/CollapseData.js +68 -0
- package/dist/stories/components/CollapseData.style.js +27 -0
- package/dist/stories/components/Modal.js +19 -0
- package/dist/stories/components/Modal.style.js +17 -0
- package/dist/stories/components/PerformanceAnalytics.js +254 -0
- package/dist/stories/components/PerformanceAnalytics.style.js +41 -0
- package/dist/stories/components/PerformanceAnalyticsTotals.js +70 -0
- package/dist/stories/components/PerformanceAnalyticsTotals.style.js +28 -0
- package/dist/stories/components/TotalCostModal.js +143 -0
- package/dist/stories/components/icons/ClockIcon.js +26 -0
- package/dist/stories/components/icons/ShoppingCartIcon.js +44 -0
- package/package.json +1 -1
- package/.history/.env_20231001120549 +0 -0
- package/.history/.env_20231001120613 +0 -1
- package/.history/.env_20231003143620 +0 -1
- package/.history/.eslintrc_20230928112617.js +0 -26
- package/.history/.eslintrc_20230928130534.js +0 -27
- package/.history/.eslintrc_20230928133400.js +0 -28
- package/.history/.eslintrc_20230928133404.js +0 -28
- package/.history/.eslintrc_20230928133416.js +0 -28
- package/.history/.eslintrc_20230928133419.js +0 -28
- package/.history/.eslintrc_20230928133432.js +0 -28
- package/.history/.eslintrc_20230928133439.js +0 -28
- package/.history/.eslintrc_20230928133458.js +0 -29
- package/.history/.eslintrc_20230928133500.js +0 -28
- package/.history/.eslintrc_20230928134009.js +0 -28
- package/.history/.eslintrc_20230928135318.js +0 -34
- package/.history/.eslintrc_20230928135321.js +0 -34
- package/.history/.eslintrc_20230928135323.js +0 -34
- package/.history/.eslintrc_20230928135332.js +0 -34
- package/.history/.eslintrc_20230928135333.js +0 -34
- package/.history/.eslintrc_20230928135352.js +0 -29
- package/.history/.eslintrc_20230928135353.js +0 -29
- package/.history/.eslintrc_20230928135355.js +0 -29
- package/.history/.eslintrc_20230928135408.js +0 -29
- package/.history/.eslintrc_20230928135538.js +0 -30
- package/.history/.eslintrc_20230928135539.js +0 -30
- package/.history/.eslintrc_20230928135543.js +0 -30
- package/.history/.gitignore_20230921093332 +0 -119
- package/.history/.gitignore_20230921111638 +0 -120
- package/.history/.gitignore_20230921111650 +0 -120
- package/.history/.gitignore_20230921111810 +0 -121
- package/.history/package_20230928095230.json +0 -74
- package/.history/package_20230928112303.json +0 -75
- package/.history/package_20230928131946.json +0 -80
- package/.history/package_20230928131950.json +0 -81
- package/.history/package_20230928131953.json +0 -80
- package/.history/package_20230928131956.json +0 -81
- package/.history/package_20230928131959.json +0 -80
- package/.history/package_20230928132003.json +0 -81
- package/.history/package_20230928132004.json +0 -81
- package/.history/package_20230928134639.json +0 -80
- package/.history/package_20230928134643.json +0 -81
- package/.history/package_20230928134645.json +0 -81
- package/.history/package_20230928134650.json +0 -81
- package/.history/package_20230928134912.json +0 -81
- package/.history/package_20230928174159.json +0 -81
- package/.history/package_20230928174200.json +0 -81
- package/.history/package_20230928174202.json +0 -81
- package/.history/package_20230928174226.json +0 -81
- package/.history/package_20230928174227.json +0 -81
- package/.history/package_20230928174228.json +0 -81
- package/.history/package_20230928174318.json +0 -81
- package/.history/package_20230928174320.json +0 -81
- package/.history/package_20231001121933.json +0 -82
- package/.history/package_20231001131144.json +0 -82
- package/.history/package_20231001134252.json +0 -81
- package/.history/package_20231004111340.json +0 -82
- package/.history/package_20231004111550.json +0 -82
- package/.history/package_20231004135419.json +0 -82
- package/.history/package_20231004150338.json +0 -82
- package/.history/package_20231004150347.json +0 -82
- package/.history/package_20231004154152.json +0 -82
- package/.history/package_20231004155924.json +0 -82
- package/.history/package_20231015134436.json +0 -82
- package/.history/package_20231016165235.json +0 -82
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactAce = _interopRequireDefault(require("react-ace"));
|
|
10
|
+
require("ace-builds/src-noconflict/mode-mysql");
|
|
11
|
+
require("ace-builds/src-noconflict/theme-monokai");
|
|
12
|
+
require("ace-builds/src-noconflict/ext-language_tools");
|
|
13
|
+
require("ace-builds/src-noconflict/snippets/mysql");
|
|
14
|
+
// CodeEditor.js
|
|
15
|
+
|
|
16
|
+
var CodeEditor = function CodeEditor(_ref) {
|
|
17
|
+
var value = _ref.value,
|
|
18
|
+
onChange = _ref.onChange;
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement(_reactAce.default, {
|
|
20
|
+
style: {
|
|
21
|
+
height: "200px"
|
|
22
|
+
},
|
|
23
|
+
mode: "mysql",
|
|
24
|
+
theme: "monokai",
|
|
25
|
+
value: value,
|
|
26
|
+
onChange: onChange,
|
|
27
|
+
name: "code-editor",
|
|
28
|
+
editorProps: {
|
|
29
|
+
$blockScrolling: true
|
|
30
|
+
},
|
|
31
|
+
setOptions: {
|
|
32
|
+
enableBasicAutocompletion: true,
|
|
33
|
+
enableLiveAutocompletion: true,
|
|
34
|
+
enableSnippets: true,
|
|
35
|
+
showLineNumbers: true,
|
|
36
|
+
tabSize: 1
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
var _default = exports.default = CodeEditor;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.AceEditorContent = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
9
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
|
+
var _reactAce = _interopRequireDefault(require("react-ace"));
|
|
11
|
+
var _templateObject;
|
|
12
|
+
var AceEditorContent = exports.AceEditorContent = (0, _styledComponents.default)(_reactAce.default)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n height: 400px;\n"])));
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = exports.CollapseData = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _CollapseData = require("./CollapseData.style");
|
|
12
|
+
var _NoDataFoundMessage = require("./NoDataFoundMessage");
|
|
13
|
+
var _ShoppingCartIcon = require("./icons/ShoppingCartIcon");
|
|
14
|
+
var _ClockIcon = require("./icons/ClockIcon");
|
|
15
|
+
var _ArrowUpIcon = require("./icons/ArrowUpIcon");
|
|
16
|
+
var _ArrowDownIcon = require("./icons/ArrowDownIcon");
|
|
17
|
+
var CollapseData = exports.CollapseData = function CollapseData(props) {
|
|
18
|
+
var title = props.title,
|
|
19
|
+
tableData = props.tableData,
|
|
20
|
+
noDataText = props.noDataText,
|
|
21
|
+
width = props.width,
|
|
22
|
+
height = props.height;
|
|
23
|
+
var _useState = (0, _react.useState)(null),
|
|
24
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
25
|
+
activeIndex = _useState2[0],
|
|
26
|
+
setActiveIndex = _useState2[1];
|
|
27
|
+
var handleClick = function handleClick(index) {
|
|
28
|
+
setActiveIndex(activeIndex === index ? null : index);
|
|
29
|
+
};
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement(_CollapseData.AccordionWrapper, {
|
|
31
|
+
width: width,
|
|
32
|
+
height: height
|
|
33
|
+
}, tableData.length === 0 ? /*#__PURE__*/_react.default.createElement(_NoDataFoundMessage.NoDataFoundMessage, {
|
|
34
|
+
noDataText: noDataText
|
|
35
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_CollapseData.ComponentHeader, null, title), tableData.map(function (section) {
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
37
|
+
key: section.key,
|
|
38
|
+
className: "accordion-section",
|
|
39
|
+
id: section.key
|
|
40
|
+
}, /*#__PURE__*/_react.default.createElement(_CollapseData.TitleAccordion, {
|
|
41
|
+
isOpen: activeIndex === section.key,
|
|
42
|
+
onClick: function onClick() {
|
|
43
|
+
return handleClick(section.key);
|
|
44
|
+
}
|
|
45
|
+
}, /*#__PURE__*/_react.default.createElement(_CollapseData.IconAndTitle, null, section.icon === 'Basket' ? /*#__PURE__*/_react.default.createElement(_ShoppingCartIcon.ShoppingCartIcon, null) : /*#__PURE__*/_react.default.createElement(_ClockIcon.ClockIcon, null), /*#__PURE__*/_react.default.createElement("u", null, section.title)), /*#__PURE__*/_react.default.createElement(_CollapseData.ArrowAndNumber, null, /*#__PURE__*/_react.default.createElement(_CollapseData.IconDiv, null, section.value >= 0 ? /*#__PURE__*/_react.default.createElement(_ArrowUpIcon.ArrowUpIcon, {
|
|
46
|
+
width: "11px",
|
|
47
|
+
height: "12px"
|
|
48
|
+
}) : /*#__PURE__*/_react.default.createElement(_ArrowDownIcon.ArrowDownIcon, {
|
|
49
|
+
width: "11px",
|
|
50
|
+
height: "12px"
|
|
51
|
+
})), /*#__PURE__*/_react.default.createElement(_CollapseData.TitleDiv, null, "".concat(parseFloat(section.value.toFixed(1))).concat(section.valueType)))), activeIndex === section.key && /*#__PURE__*/_react.default.createElement(_CollapseData.TableWrapper, null, /*#__PURE__*/_react.default.createElement(_CollapseData.Table, null, /*#__PURE__*/_react.default.createElement("thead", null, /*#__PURE__*/_react.default.createElement("tr", null, section.table.map(function (headline) {
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement(_CollapseData.Th, null, headline.title);
|
|
53
|
+
}))), /*#__PURE__*/_react.default.createElement("tbody", null, /*#__PURE__*/_react.default.createElement("tr", null, section.table.map(function (data) {
|
|
54
|
+
if (data.value !== null) {
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement(_CollapseData.Td, null, "".concat(data.value >= 0 ? '+' : '').concat(data.value.toFixed(1)).concat(section.valueType));
|
|
56
|
+
}
|
|
57
|
+
return /*#__PURE__*/_react.default.createElement(_CollapseData.Td, null, "No Data");
|
|
58
|
+
}))))));
|
|
59
|
+
})));
|
|
60
|
+
};
|
|
61
|
+
var _default = exports.default = CollapseData;
|
|
62
|
+
CollapseData.defaultProps = {
|
|
63
|
+
title: '',
|
|
64
|
+
noDataText: '',
|
|
65
|
+
width: '455px',
|
|
66
|
+
height: '379px',
|
|
67
|
+
tableData: []
|
|
68
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.TitleDiv = exports.TitleAccordion = exports.Th = exports.Td = exports.TableWrapper = exports.Table = exports.IconDiv = exports.IconAndTitle = exports.ComponentHeader = exports.ArrowAndNumber = exports.AccordionWrapper = 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;
|
|
11
|
+
var AccordionWrapper = exports.AccordionWrapper = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: ", ";\n min-width: 455px;\n height: ", ";\n min-height: 379px;\n"])), function (props) {
|
|
12
|
+
return props.width;
|
|
13
|
+
}, function (props) {
|
|
14
|
+
return props.height;
|
|
15
|
+
});
|
|
16
|
+
var TitleAccordion = exports.TitleAccordion = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n display: inline-block;\n align-items: center;\n background-color: ", ";\n margin-bottom: 16px;\n"])), function (props) {
|
|
17
|
+
return props.isOpen ? '#D0D0D0' : 'white';
|
|
18
|
+
});
|
|
19
|
+
var IconAndTitle = exports.IconAndTitle = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n width: auto;\n font-family: \"poppins\";\n font-weight: 400;\n font-size: 16px;\n line-height: 24px;\n display: flex;\n float: left;\n align-items: center;\n & > svg {\n margin-right: 15px;\n }\n"])));
|
|
20
|
+
var ArrowAndNumber = exports.ArrowAndNumber = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n float: right;\n font-family: \"poppins\";\n font-weight: 600;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 23%;\n margin-right: 20px;\n"])));
|
|
21
|
+
var IconDiv = exports.IconDiv = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: flex-end;\n width: 25%;\n"])));
|
|
22
|
+
var TitleDiv = exports.TitleDiv = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n width: 70%;\n text-align: left;\n padding-left: 3px;\n"])));
|
|
23
|
+
var TableWrapper = exports.TableWrapper = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n overflow-x: auto;\n margin-bottom: 22px;\n"])));
|
|
24
|
+
var Table = exports.Table = _styledComponents.default.table(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n border-collapse: collapse;\n width: 100%;\n table-layout: fixed;\n"])));
|
|
25
|
+
var Th = exports.Th = _styledComponents.default.th(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n background-color: white;\n font-family: \"poppins\";\n font-weight: 600;\n font-size: 12px;\n border: 1px solid #ccc;\n padding: 10px;\n text-align: center;\n line-height: 18px;\n border-top: none;\n border-left: none;\n &:last-of-type {\n border-right: none;\n }\n"])));
|
|
26
|
+
var Td = exports.Td = _styledComponents.default.td(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n border: 1px solid #ccc;\n padding: 10px;\n text-align: center;\n line-height: 21px;\n font-size: 14px;\n font-family: \"poppins\";\n font-weight: 400;\n border-bottom: none;\n border-left: none;\n &:last-of-type {\n border-right: none;\n }\n"])));
|
|
27
|
+
var ComponentHeader = exports.ComponentHeader = _styledComponents.default.h3(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n font-family: \"poppins\";\n font-weight: 500;\n font-size: 18px;\n line-height: 27px;\n"])));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _Modal = require("./Modal.style");
|
|
10
|
+
var Modal = function Modal(_ref) {
|
|
11
|
+
var isOpen = _ref.isOpen,
|
|
12
|
+
onClose = _ref.onClose,
|
|
13
|
+
children = _ref.children;
|
|
14
|
+
if (!isOpen) return null;
|
|
15
|
+
return /*#__PURE__*/_react.default.createElement(_Modal.ModalOverlay, null, /*#__PURE__*/_react.default.createElement(_Modal.ModalContent, null, children, /*#__PURE__*/_react.default.createElement(_Modal.CloseButton, {
|
|
16
|
+
onClick: onClose
|
|
17
|
+
}, "Close")));
|
|
18
|
+
};
|
|
19
|
+
var _default = exports.default = Modal;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.SubmitButton = exports.ModalOverlay = exports.ModalContent = exports.CloseButton = void 0;
|
|
9
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
12
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
13
|
+
var fadeIn = (0, _styledComponents.keyframes)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n"])));
|
|
14
|
+
var ModalOverlay = exports.ModalOverlay = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index:999999;\n background-color: rgba(0, 0, 0, 0.7);\n display: flex;\n justify-content: center;\n align-items: center;\n animation: ", " 0.3s ease-in-out;\n"])), fadeIn);
|
|
15
|
+
var ModalContent = exports.ModalContent = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n background-color: #fff;\n overflow: scroll;\n padding: 20px;\n border-radius: 8px;\n width: 50%;\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n animation: ", " 0.5s ease-in-out;\n"])), fadeIn);
|
|
16
|
+
var CloseButton = exports.CloseButton = _styledComponents.default.button(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n margin-top: 10px;\n padding: 5px 15px;\n border: none;\n background-color: #333;\n color: #fff;\n cursor: pointer;\n border-radius: 4px;\n &:hover {\n background-color: #555;\n }\n"])));
|
|
17
|
+
var SubmitButton = exports.SubmitButton = _styledComponents.default.input(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin-top: 10px;\n margin-right: 10px;\n padding: 5px 15px;\n border: none;\n background-color: #333;\n color: #fff;\n cursor: pointer;\n border-radius: 4px;\n &:hover {\n background-color: #555;\n }\n"])));
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = exports.PerformanceAnalytics = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _propTypes = _interopRequireWildcard(require("prop-types"));
|
|
13
|
+
var _recharts = require("recharts");
|
|
14
|
+
var _NoDataFoundMessage = require("./NoDataFoundMessage");
|
|
15
|
+
var _SegmentedButton = require("./SegmentedButton");
|
|
16
|
+
var _CommonFunctions = require("./CommonFunctions");
|
|
17
|
+
var _PerformanceAnalytics = require("./PerformanceAnalytics.style");
|
|
18
|
+
var _Benchmark = require("./Benchmark");
|
|
19
|
+
var _excluded = ["totalsData", "data", "displayType", "colorGraphROI", "colorBarchart1", "colorBarchart2", "textColor", "width", "height", "noDataText"];
|
|
20
|
+
/* PerformanceAnalytics */
|
|
21
|
+
var PerformanceAnalytics = exports.PerformanceAnalytics = function PerformanceAnalytics(_ref) {
|
|
22
|
+
var _ref$totalsData = _ref.totalsData,
|
|
23
|
+
totalsData = _ref$totalsData === void 0 ? [{
|
|
24
|
+
title: string | null,
|
|
25
|
+
value: _propTypes.number | null,
|
|
26
|
+
dotCut: _propTypes.bool,
|
|
27
|
+
currency: _propTypes.bool,
|
|
28
|
+
currencyType: string | null,
|
|
29
|
+
growthPercent: _propTypes.number | null
|
|
30
|
+
}] : _ref$totalsData,
|
|
31
|
+
_ref$data = _ref.data,
|
|
32
|
+
data = _ref$data === void 0 ? [{
|
|
33
|
+
retailer: string | null,
|
|
34
|
+
offerType: string | null,
|
|
35
|
+
period: string | null,
|
|
36
|
+
roiValue: _propTypes.number | null,
|
|
37
|
+
// individual performance
|
|
38
|
+
packageCostValue: _propTypes.number | null,
|
|
39
|
+
redemptionCostValue: _propTypes.number | null,
|
|
40
|
+
incrementalSalesValue: _propTypes.number | null,
|
|
41
|
+
// % Incremental Growth
|
|
42
|
+
IncrementalGrowthValue: _propTypes.number | null,
|
|
43
|
+
// % Contribution of Total
|
|
44
|
+
packageCostPercentValue: _propTypes.number | null,
|
|
45
|
+
redemptionCostPercentValue: _propTypes.number | null,
|
|
46
|
+
incrementalSalesPercentValue: _propTypes.number | null,
|
|
47
|
+
// New / existing Shoppers
|
|
48
|
+
newShoppersValue: _propTypes.number | null,
|
|
49
|
+
newShoppersPercentValue: _propTypes.number | null,
|
|
50
|
+
existingShoppersValue: _propTypes.number | null,
|
|
51
|
+
existingShoppersPercentValue: _propTypes.number | null
|
|
52
|
+
}] : _ref$data,
|
|
53
|
+
_ref$displayType = _ref.displayType,
|
|
54
|
+
displayType = _ref$displayType === void 0 ? "TotalCost" : _ref$displayType,
|
|
55
|
+
_ref$colorGraphROI = _ref.colorGraphROI,
|
|
56
|
+
colorGraphROI = _ref$colorGraphROI === void 0 ? "#9CCB3B" : _ref$colorGraphROI,
|
|
57
|
+
_ref$colorBarchart = _ref.colorBarchart1,
|
|
58
|
+
colorBarchart1 = _ref$colorBarchart === void 0 ? "#1F7677" : _ref$colorBarchart,
|
|
59
|
+
_ref$colorBarchart2 = _ref.colorBarchart2,
|
|
60
|
+
colorBarchart2 = _ref$colorBarchart2 === void 0 ? "#90CE9C" : _ref$colorBarchart2,
|
|
61
|
+
_ref$textColor = _ref.textColor,
|
|
62
|
+
textColor = _ref$textColor === void 0 ? "#212121" : _ref$textColor,
|
|
63
|
+
width = _ref.width,
|
|
64
|
+
height = _ref.height,
|
|
65
|
+
noDataText = _ref.noDataText,
|
|
66
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
67
|
+
var DEFAULT_ROOT_FONT = 18;
|
|
68
|
+
var DEFAULT_COMPONENT_WIDTH = 250;
|
|
69
|
+
var _useState = (0, _react.useState)(""),
|
|
70
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
71
|
+
segmentedButtonsFilter = _useState2[0],
|
|
72
|
+
setSegmentedButtonsFilter = _useState2[1];
|
|
73
|
+
var _useState3 = (0, _react.useState)(""),
|
|
74
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
75
|
+
activeLabelROI = _useState4[0],
|
|
76
|
+
setActiveLabelROI = _useState4[1];
|
|
77
|
+
var _useState5 = (0, _react.useState)(DEFAULT_ROOT_FONT.toString().concat("", "px")),
|
|
78
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
79
|
+
rootFont = _useState6[0],
|
|
80
|
+
setRootFont = _useState6[1];
|
|
81
|
+
var controlsContainerRef = (0, _react.useRef)();
|
|
82
|
+
var getRootFont = function getRootFont(scopeWidth) {
|
|
83
|
+
var relation = scopeWidth.toString().replace("px", "").replace("%", "") / DEFAULT_COMPONENT_WIDTH;
|
|
84
|
+
var fontRoot = (DEFAULT_ROOT_FONT * relation).toString().concat("", "px");
|
|
85
|
+
return fontRoot;
|
|
86
|
+
};
|
|
87
|
+
var dotCutTrenty = function dotCutTrenty(row) {
|
|
88
|
+
return dotCut ? (0, _CommonFunctions.getFormattedValue)(row.value) : (0, _CommonFunctions.getNumberWithCommas)(row.value);
|
|
89
|
+
};
|
|
90
|
+
(0, _react.useEffect)(function () {
|
|
91
|
+
var offsetWidth = controlsContainerRef.current.offsetWidth;
|
|
92
|
+
setRootFont(getRootFont(offsetWidth));
|
|
93
|
+
}, [width]);
|
|
94
|
+
var getTotalsData = function getTotalsData() {
|
|
95
|
+
return /*#__PURE__*/_react.default.createElement(_PerformanceAnalytics.TotalsDataContainer, {
|
|
96
|
+
id: "TotalsDataContainer"
|
|
97
|
+
}, totalsData === null || totalsData === void 0 ? void 0 : totalsData.map(function (item) {
|
|
98
|
+
return /*#__PURE__*/_react.default.createElement(_PerformanceAnalytics.TitleAndValueContainer, {
|
|
99
|
+
id: "TitleAndValueContainer"
|
|
100
|
+
}, /*#__PURE__*/_react.default.createElement(_PerformanceAnalytics.Title, {
|
|
101
|
+
id: "Title",
|
|
102
|
+
width: width
|
|
103
|
+
}, item.title), /*#__PURE__*/_react.default.createElement(_PerformanceAnalytics.CurrencySignAndFormattedValueContainer, {
|
|
104
|
+
id: "CurrencySignAndFormattedValueContainer"
|
|
105
|
+
}, /*#__PURE__*/_react.default.createElement(_PerformanceAnalytics.FormattedValue, {
|
|
106
|
+
id: "FormattedValue",
|
|
107
|
+
width: width
|
|
108
|
+
}, /*#__PURE__*/_react.default.createElement(_PerformanceAnalytics.CurrencySign, {
|
|
109
|
+
id: "CurrencySign"
|
|
110
|
+
}, item.currency ? (0, _CommonFunctions.getCurrencySign)(item.currencyType, item.value) : ""), item.dotCut ? (0, _CommonFunctions.getFormattedValue)(item.value) : (0, _CommonFunctions.getNumberWithCommas)(item.value), item.dotCut ? (0, _CommonFunctions.getFormattedUnits)(item.value) : "")));
|
|
111
|
+
}));
|
|
112
|
+
};
|
|
113
|
+
var getSegmentedButtons = function getSegmentedButtons() {
|
|
114
|
+
return /*#__PURE__*/_react.default.createElement(_PerformanceAnalytics.SegmentedButtonContainer, {
|
|
115
|
+
id: "SegmentedButtonContainer"
|
|
116
|
+
}, /*#__PURE__*/_react.default.createElement(_SegmentedButton.SegmentedButton, {
|
|
117
|
+
id: "SegmentedButton BaselineSTLY",
|
|
118
|
+
options: [{
|
|
119
|
+
value: "Individual Performance"
|
|
120
|
+
}, {
|
|
121
|
+
value: "% Incremental Growth"
|
|
122
|
+
}, {
|
|
123
|
+
value: "% Contribution of Total"
|
|
124
|
+
}],
|
|
125
|
+
backgroundColor: "#F2F2F2",
|
|
126
|
+
controlRadius: 8,
|
|
127
|
+
defaultIndex: 0,
|
|
128
|
+
fontSize: 12,
|
|
129
|
+
name: "segmentedDollarsOrUnits",
|
|
130
|
+
onClick: function onClick(event) {
|
|
131
|
+
setSegmentedButtonsFilter(event.value);
|
|
132
|
+
},
|
|
133
|
+
segmentRadius: 8,
|
|
134
|
+
selectedSegmentColor: "#ffffff",
|
|
135
|
+
selectedTextColor: "#212121",
|
|
136
|
+
unselectedTextColor: "#212121",
|
|
137
|
+
width: 490,
|
|
138
|
+
heigth: 14
|
|
139
|
+
}));
|
|
140
|
+
};
|
|
141
|
+
var CustomizedLabelROI = function CustomizedLabelROI(props) {
|
|
142
|
+
var x = props.x,
|
|
143
|
+
y = props.y,
|
|
144
|
+
stroke = props.stroke,
|
|
145
|
+
value = props.value;
|
|
146
|
+
return /*#__PURE__*/_react.default.createElement("text", {
|
|
147
|
+
x: x,
|
|
148
|
+
y: y,
|
|
149
|
+
dy: -4,
|
|
150
|
+
fill: stroke,
|
|
151
|
+
fontSize: 10,
|
|
152
|
+
textAnchor: "middle"
|
|
153
|
+
}, value);
|
|
154
|
+
};
|
|
155
|
+
var CustomTooltipROI = function CustomTooltipROI(_ref2) {
|
|
156
|
+
var active = _ref2.active,
|
|
157
|
+
payload = _ref2.payload,
|
|
158
|
+
label = _ref2.label,
|
|
159
|
+
name = _ref2.name;
|
|
160
|
+
if (active && payload && payload.length) {
|
|
161
|
+
console.log("CustomTooltipROI", active, payload, label, name);
|
|
162
|
+
setActiveLabelROI(label);
|
|
163
|
+
return /*#__PURE__*/_react.default.createElement(_PerformanceAnalytics.TooltipDivROI, null, /*#__PURE__*/_react.default.createElement(_PerformanceAnalytics.TooltipTitleROI, null, "".concat(label)), /*#__PURE__*/_react.default.createElement(_PerformanceAnalytics.TooltipLabelROI, null, "ROI: ".concat((0, _CommonFunctions.getFormattedValue)(payload[0].value)).concat((0, _CommonFunctions.getFormattedUnits)(payload[0].value))));
|
|
164
|
+
}
|
|
165
|
+
return null;
|
|
166
|
+
};
|
|
167
|
+
var getLineChartROI = function getLineChartROI() {
|
|
168
|
+
return /*#__PURE__*/_react.default.createElement(_recharts.LineChart, {
|
|
169
|
+
width: 700,
|
|
170
|
+
height: 150,
|
|
171
|
+
data: data,
|
|
172
|
+
margin: {
|
|
173
|
+
top: 20,
|
|
174
|
+
right: 30,
|
|
175
|
+
left: 20,
|
|
176
|
+
bottom: 10
|
|
177
|
+
}
|
|
178
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, {
|
|
179
|
+
content: /*#__PURE__*/_react.default.createElement(CustomTooltipROI, null)
|
|
180
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.Line, {
|
|
181
|
+
type: "monotone",
|
|
182
|
+
dataKey: "roiValue",
|
|
183
|
+
name: "retailer",
|
|
184
|
+
stroke: colorGraphROI
|
|
185
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.LabelList, {
|
|
186
|
+
content: /*#__PURE__*/_react.default.createElement(CustomizedLabelROI, null)
|
|
187
|
+
})));
|
|
188
|
+
};
|
|
189
|
+
return /*#__PURE__*/_react.default.createElement(_PerformanceAnalytics.ControlsContainer, {
|
|
190
|
+
id: "ControlsContainer",
|
|
191
|
+
height: height,
|
|
192
|
+
width: width,
|
|
193
|
+
textColor: textColor,
|
|
194
|
+
ref: controlsContainerRef,
|
|
195
|
+
rootFont: rootFont
|
|
196
|
+
}, (totalsData === null || totalsData === void 0 ? void 0 : totalsData.length) > 0 && (data === null || data === void 0 ? void 0 : data.length) > 0 ? /*#__PURE__*/_react.default.createElement(_PerformanceAnalytics.Controls, {
|
|
197
|
+
id: "Controls",
|
|
198
|
+
height: height,
|
|
199
|
+
width: width
|
|
200
|
+
}, getTotalsData(), getSegmentedButtons(), getLineChartROI()) : /*#__PURE__*/_react.default.createElement(_NoDataFoundMessage.NoDataFoundMessage, {
|
|
201
|
+
noDataText: noDataText
|
|
202
|
+
}));
|
|
203
|
+
};
|
|
204
|
+
var _default = exports.default = PerformanceAnalytics; // PerformanceAnalytics.propTypes = {
|
|
205
|
+
// title: PropTypes.string,
|
|
206
|
+
// value: PropTypes.number,
|
|
207
|
+
// addingBenchmark: PropTypes.bool,
|
|
208
|
+
// dotCut: PropTypes.bool,
|
|
209
|
+
// currencySign: PropTypes.bool,
|
|
210
|
+
// currencyType: PropTypes.string,
|
|
211
|
+
// legendData: PropTypes.arrayOf(
|
|
212
|
+
// PropTypes.shape({
|
|
213
|
+
// name: PropTypes.string,
|
|
214
|
+
// description: PropTypes.string,
|
|
215
|
+
// })
|
|
216
|
+
// ),
|
|
217
|
+
// itemsPercentagesValueAside: PropTypes.bool,
|
|
218
|
+
// itemsBoldedValues: PropTypes.bool,
|
|
219
|
+
// itemsValuesSeparateLine: PropTypes.bool,
|
|
220
|
+
// width: PropTypes.string,
|
|
221
|
+
// height: PropTypes.string,
|
|
222
|
+
// textColor: PropTypes.string,
|
|
223
|
+
// noDataText: PropTypes.string,
|
|
224
|
+
// };
|
|
225
|
+
// PerformanceAnalytics.defaultProps = {
|
|
226
|
+
// title: "Total Cost",
|
|
227
|
+
// value: 0,
|
|
228
|
+
// addingBenchmark: false,
|
|
229
|
+
// dotCut: false,
|
|
230
|
+
// currencySign: false,
|
|
231
|
+
// currencyType: "USD",
|
|
232
|
+
// legendData: [],
|
|
233
|
+
// itemsPercentagesValueAside: false,
|
|
234
|
+
// itemsBoldedValues: true,
|
|
235
|
+
// itemsValuesSeparateLine: true,
|
|
236
|
+
// width: "300px",
|
|
237
|
+
// height: "280px",
|
|
238
|
+
// textColor: "#212121",
|
|
239
|
+
// noDataText: "",
|
|
240
|
+
// };
|
|
241
|
+
function CustomTooltip(_ref3) {
|
|
242
|
+
var active = _ref3.active,
|
|
243
|
+
payload = _ref3.payload,
|
|
244
|
+
value = _ref3.value;
|
|
245
|
+
if (active && payload && payload.length) {
|
|
246
|
+
var percent = value && value !== 0 ? (payload[0].value / value * 100).toFixed(0) : 0;
|
|
247
|
+
return /*#__PURE__*/_react.default.createElement(_PerformanceAnalytics.TooltipDivROI, null, /*#__PURE__*/_react.default.createElement(_PerformanceAnalytics.TooltipLabelROI, null, "".concat(payload[0].name, " ").concat(percent, "%")));
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
CustomTooltip.defaultProps = {
|
|
251
|
+
active: "",
|
|
252
|
+
payload: "",
|
|
253
|
+
value: ""
|
|
254
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.TotalsDataContainer = exports.TooltipTitleROI = exports.TooltipLabelROI = exports.TooltipDivROI = exports.TitleAndValueContainer = exports.Title = exports.SegmentedButtonContainer = exports.LegendTitleAndFormatedValueContainer = exports.LegendTitle = exports.LegendFormattedValue = exports.LegendFormatedValueContainer = exports.LegendControlsContainer = exports.LegendContainer = exports.LegendColorRectangle = exports.FormattedValue = exports.DoughnutChartAndLegendContainer = exports.DoughnutChart = exports.CurrencySignAndFormattedValueContainer = exports.CurrencySign = exports.ControlsContainer = exports.Controls = 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, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21;
|
|
11
|
+
var ControlsContainer = exports.ControlsContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n font-family: \"Poppins\", sans-serif;\n font-style: normal;\n font-size: ", ";\n color: ", ";\n width: ", ";\n height: ", ";\n border-radius: 12px;\n align-self: center;\n\n > * {\n box-sizing: border-box;\n }\n"])), function (props) {
|
|
12
|
+
return props.rootFont;
|
|
13
|
+
}, function (props) {
|
|
14
|
+
return props.textColor;
|
|
15
|
+
}, function (props) {
|
|
16
|
+
return props.width;
|
|
17
|
+
}, function (props) {
|
|
18
|
+
return props.height;
|
|
19
|
+
});
|
|
20
|
+
var Controls = exports.Controls = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n gap: 20px;\n flex-direction: column;\n width: 100%;\n height: 100%;\n background: white;\n"])));
|
|
21
|
+
var TotalsDataContainer = exports.TotalsDataContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n"])));
|
|
22
|
+
var SegmentedButtonContainer = exports.SegmentedButtonContainer = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n padding: 10px 0 0 10px;\n"])));
|
|
23
|
+
var TooltipDivROI = exports.TooltipDivROI = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: 5px;\n background: #fff;\n font-family: \"Poppins\", sans-serif;\n border-radius: 5px;\n padding: 8px 12px;\n display: grid;\n"])));
|
|
24
|
+
var TooltipLabelROI = exports.TooltipLabelROI = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n color: #212121;\n font-family: \"Poppins\", sans-serif;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: normal;\n width: fit-content;\n"])));
|
|
25
|
+
var TooltipTitleROI = exports.TooltipTitleROI = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n color: #212121;\n font-family: Poppins;\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: normal;\n"])));
|
|
26
|
+
var TitleAndValueContainer = exports.TitleAndValueContainer = _styledComponents.default.div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n padding: 0 20px;\n"])));
|
|
27
|
+
var Title = exports.Title = _styledComponents.default.h4(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size: 1rem;\n margin: 0;\n @media (max-width: 1536px) {\n font-size: 14px;\n }\n @media (max-width: 1366px) {\n font-size: 12px;\n }\n"])));
|
|
28
|
+
var CurrencySignAndFormattedValueContainer = exports.CurrencySignAndFormattedValueContainer = _styledComponents.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n gap: 16px;\n"])));
|
|
29
|
+
var CurrencySign = exports.CurrencySign = _styledComponents.default.span(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size: 16px;\n @media (max-width: 1536px) {\n font-size: 14px;\n }\n @media (max-width: 1366px) {\n font-size: 11px;\n }\n"])));
|
|
30
|
+
var FormattedValue = exports.FormattedValue = _styledComponents.default.div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size: 40px;\n @media (max-width: 1536px) {\n font-size: 24px;\n }\n @media (max-width: 1366px) {\n font-size: 20px;\n }\n"])));
|
|
31
|
+
var DoughnutChartAndLegendContainer = exports.DoughnutChartAndLegendContainer = _styledComponents.default.div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n margin-top: auto;\n padding: 0 20px;\n"])));
|
|
32
|
+
var DoughnutChart = exports.DoughnutChart = _styledComponents.default.div(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n min-width: 40%;\n flex-basis: 40%;\n min-height: 6rem;\n"])));
|
|
33
|
+
var LegendContainer = exports.LegendContainer = _styledComponents.default.div(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2.default)(["\n flex-grow: 1;\n padding-left: 10px;\n display: flex;\n flex-direction: column;\n justify-content: space-evenly;\n"])));
|
|
34
|
+
var LegendControlsContainer = exports.LegendControlsContainer = _styledComponents.default.div(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n gap: 0.5rem;\n align-items: center;\n margin-bottom: 0.375rem;\n"])));
|
|
35
|
+
var LegendTitleAndFormatedValueContainer = exports.LegendTitleAndFormatedValueContainer = _styledComponents.default.div(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2.default)(["\n flex-grow: 1;\n"])));
|
|
36
|
+
var LegendFormatedValueContainer = exports.LegendFormatedValueContainer = _styledComponents.default.div(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2.default)(["\n font-size: 0.875rem;\n"])));
|
|
37
|
+
var LegendColorRectangle = exports.LegendColorRectangle = _styledComponents.default.div(_templateObject19 || (_templateObject19 = (0, _taggedTemplateLiteral2.default)(["\n width: 0.875rem;\n min-width: 0.875rem;\n height: 0.875rem;\n border-radius: 2px;\n background: ", ";\n"])), function (props) {
|
|
38
|
+
return props.color;
|
|
39
|
+
});
|
|
40
|
+
var LegendTitle = exports.LegendTitle = _styledComponents.default.h5(_templateObject20 || (_templateObject20 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 400;\n font-size: 16px;\n gap: 5px;\n margin: 0;\n display: flex;\n justify-content: space-between;\n @media (max-width: 1536px) {\n font-size: 11px;\n }\n @media (max-width: 1366px) {\n font-size: 10px;\n }\n"])));
|
|
41
|
+
var LegendFormattedValue = exports.LegendFormattedValue = _styledComponents.default.span(_templateObject21 || (_templateObject21 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n white-space: nowrap;\n"])));
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = exports.PerformanceAnalyticsTotals = void 0;
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _propTypes = _interopRequireWildcard(require("prop-types"));
|
|
11
|
+
var _CommonFunctions = require("./CommonFunctions");
|
|
12
|
+
var _PerformanceAnalyticsTotals = require("./PerformanceAnalyticsTotals.style");
|
|
13
|
+
/* PerformanceAnalyticsTotals */
|
|
14
|
+
var PerformanceAnalyticsTotals = exports.PerformanceAnalyticsTotals = function PerformanceAnalyticsTotals(_ref) {
|
|
15
|
+
var _ref$totalsData = _ref.totalsData,
|
|
16
|
+
totalsData = _ref$totalsData === void 0 ? [{
|
|
17
|
+
title: string | null,
|
|
18
|
+
value: _propTypes.number | null,
|
|
19
|
+
dotCut: _propTypes.bool,
|
|
20
|
+
currency: _propTypes.bool,
|
|
21
|
+
currencyType: string | null,
|
|
22
|
+
growthPercent: _propTypes.number | null
|
|
23
|
+
}] : _ref$totalsData,
|
|
24
|
+
_ref$textColor = _ref.textColor,
|
|
25
|
+
textColor = _ref$textColor === void 0 ? "#212121" : _ref$textColor,
|
|
26
|
+
width = _ref.width,
|
|
27
|
+
height = _ref.height;
|
|
28
|
+
// const getGrowthPercent = (growthPercent) => {
|
|
29
|
+
|
|
30
|
+
// if (!growthPercent) return "";
|
|
31
|
+
|
|
32
|
+
// return
|
|
33
|
+
// <GrowthPercent id="GrowthPercent">
|
|
34
|
+
|
|
35
|
+
// getGrowthPercent(item.growthPercent)
|
|
36
|
+
|
|
37
|
+
// </GrowthPercent> ;
|
|
38
|
+
// };
|
|
39
|
+
|
|
40
|
+
var getTotalsData = function getTotalsData() {
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement(_PerformanceAnalyticsTotals.TotalsDataContainer, {
|
|
42
|
+
id: "TotalsDataContainer"
|
|
43
|
+
}, totalsData === null || totalsData === void 0 ? void 0 : totalsData.map(function (item) {
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement(_PerformanceAnalyticsTotals.TitleAndValueContainer, {
|
|
45
|
+
id: "TitleAndValueContainer"
|
|
46
|
+
}, /*#__PURE__*/_react.default.createElement(_PerformanceAnalyticsTotals.Title, {
|
|
47
|
+
id: "Title",
|
|
48
|
+
width: width
|
|
49
|
+
}, item.title), /*#__PURE__*/_react.default.createElement(_PerformanceAnalyticsTotals.CurrencySignAndFormattedValueContainer, {
|
|
50
|
+
id: "CurrencySignAndFormattedValueContainer"
|
|
51
|
+
}, /*#__PURE__*/_react.default.createElement(_PerformanceAnalyticsTotals.FormattedValue, {
|
|
52
|
+
id: "FormattedValue",
|
|
53
|
+
width: width
|
|
54
|
+
}, /*#__PURE__*/_react.default.createElement(_PerformanceAnalyticsTotals.CurrencySign, {
|
|
55
|
+
id: "CurrencySign"
|
|
56
|
+
}, item.currency ? (0, _CommonFunctions.getCurrencySign)(item.currencyType, item.value) : ""), item.dotCut ? (0, _CommonFunctions.getFormattedValue)(item.value) : (0, _CommonFunctions.getNumberWithCommas)(item.value), item.dotCut ? (0, _CommonFunctions.getFormattedUnits)(item.value) : "")));
|
|
57
|
+
}));
|
|
58
|
+
};
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement(_PerformanceAnalyticsTotals.ControlsContainer, {
|
|
60
|
+
id: "ControlsContainer",
|
|
61
|
+
height: height,
|
|
62
|
+
width: width,
|
|
63
|
+
textColor: textColor
|
|
64
|
+
}, (totalsData === null || totalsData === void 0 ? void 0 : totalsData.length) > 0 ? /*#__PURE__*/_react.default.createElement(_PerformanceAnalyticsTotals.Controls, {
|
|
65
|
+
id: "Controls",
|
|
66
|
+
height: height,
|
|
67
|
+
width: width
|
|
68
|
+
}, getTotalsData()) : "");
|
|
69
|
+
};
|
|
70
|
+
var _default = exports.default = PerformanceAnalyticsTotals;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.TotalsDataContainer = exports.TitleAndValueContainer = exports.Title = exports.LegendFormatedValueContainer = exports.GrowthPercent = exports.FormattedValue = exports.CurrencySignAndFormattedValueContainer = exports.CurrencySign = exports.ControlsContainer = exports.Controls = 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;
|
|
11
|
+
var ControlsContainer = exports.ControlsContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n font-family: \"Poppins\", sans-serif;\n font-style: normal;\n font-size: ", ";\n color: ", ";\n width: ", ";\n height: ", ";\n border-radius: 12px;\n align-self: center;\n\n > * {\n box-sizing: border-box;\n }\n"])), function (props) {
|
|
12
|
+
return props.rootFont;
|
|
13
|
+
}, function (props) {
|
|
14
|
+
return props.textColor;
|
|
15
|
+
}, function (props) {
|
|
16
|
+
return props.width;
|
|
17
|
+
}, function (props) {
|
|
18
|
+
return props.height;
|
|
19
|
+
});
|
|
20
|
+
var Controls = exports.Controls = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n gap: 20px;\n flex-direction: column;\n width: 100%;\n height: 100%;\n background: white;\n"])));
|
|
21
|
+
var TotalsDataContainer = exports.TotalsDataContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n"])));
|
|
22
|
+
var TitleAndValueContainer = exports.TitleAndValueContainer = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n padding: 0 20px;\n"])));
|
|
23
|
+
var Title = exports.Title = _styledComponents.default.h4(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size: 1rem;\n margin: 0;\n @media (max-width: 1536px) {\n font-size: 14px;\n }\n @media (max-width: 1366px) {\n font-size: 12px;\n }\n"])));
|
|
24
|
+
var CurrencySignAndFormattedValueContainer = exports.CurrencySignAndFormattedValueContainer = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n gap: 16px;\n"])));
|
|
25
|
+
var CurrencySign = exports.CurrencySign = _styledComponents.default.span(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size: 16px;\n @media (max-width: 1536px) {\n font-size: 14px;\n }\n @media (max-width: 1366px) {\n font-size: 11px;\n }\n"])));
|
|
26
|
+
var GrowthPercent = exports.GrowthPercent = _styledComponents.default.span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size: 16px;\n @media (max-width: 1536px) {\n font-size: 14px;\n }\n @media (max-width: 1366px) {\n font-size: 11px;\n }\n"])));
|
|
27
|
+
var FormattedValue = exports.FormattedValue = _styledComponents.default.div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size: 40px;\n @media (max-width: 1536px) {\n font-size: 24px;\n }\n @media (max-width: 1366px) {\n font-size: 20px;\n }\n"])));
|
|
28
|
+
var LegendFormatedValueContainer = exports.LegendFormatedValueContainer = _styledComponents.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n font-size: 0.875rem;\n"])));
|