sag_components 1.0.131 → 1.0.134
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.
|
@@ -9,16 +9,25 @@ exports.default = exports.Button = void 0;
|
|
|
9
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
12
13
|
var _Stack = _interopRequireDefault(require("@mui/material/Stack"));
|
|
13
|
-
var _excluded = ["text", "shape", "size", "disabled", "radius", "textColor", "backgroundColor", "onClick"];
|
|
14
|
+
var _excluded = ["text", "fontFamily", "fontSize", "shape", "size", "height", "width", "disabled", "radius", "textColor", "backgroundColor", "borderColor", "hoverTextColor", "hoverBackgroundColor", "hoverBorderColor", "onClick"];
|
|
14
15
|
var Button = function Button(_ref) {
|
|
15
16
|
var text = _ref.text,
|
|
17
|
+
fontFamily = _ref.fontFamily,
|
|
18
|
+
fontSize = _ref.fontSize,
|
|
16
19
|
shape = _ref.shape,
|
|
17
20
|
size = _ref.size,
|
|
21
|
+
height = _ref.height,
|
|
22
|
+
width = _ref.width,
|
|
18
23
|
disabled = _ref.disabled,
|
|
19
24
|
radius = _ref.radius,
|
|
20
25
|
textColor = _ref.textColor,
|
|
21
26
|
backgroundColor = _ref.backgroundColor,
|
|
27
|
+
borderColor = _ref.borderColor,
|
|
28
|
+
hoverTextColor = _ref.hoverTextColor,
|
|
29
|
+
hoverBackgroundColor = _ref.hoverBackgroundColor,
|
|
30
|
+
hoverBorderColor = _ref.hoverBorderColor,
|
|
22
31
|
_onClick = _ref.onClick,
|
|
23
32
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
24
33
|
var getTextColor = function getTextColor() {
|
|
@@ -33,18 +42,48 @@ var Button = function Button(_ref) {
|
|
|
33
42
|
return textColor;
|
|
34
43
|
}
|
|
35
44
|
};
|
|
45
|
+
var theme = (0, _styles.createTheme)({
|
|
46
|
+
typography: {
|
|
47
|
+
"fontFamily": fontFamily,
|
|
48
|
+
"fontSize": fontSize
|
|
49
|
+
},
|
|
50
|
+
components: {
|
|
51
|
+
MuiButton: {
|
|
52
|
+
styleOverrides: {
|
|
53
|
+
root: function root(_ref2) {
|
|
54
|
+
var ownerState = _ref2.ownerState;
|
|
55
|
+
return {
|
|
56
|
+
"&:hover": {
|
|
57
|
+
backgroundColor: hoverBackgroundColor,
|
|
58
|
+
color: hoverTextColor,
|
|
59
|
+
borderColor: hoverBorderColor
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
36
67
|
return /*#__PURE__*/React.createElement(_Stack.default, {
|
|
37
68
|
direction: "row",
|
|
38
69
|
spacing: 2
|
|
70
|
+
}, /*#__PURE__*/React.createElement(_styles.ThemeProvider, {
|
|
71
|
+
theme: theme
|
|
39
72
|
}, /*#__PURE__*/React.createElement(_Button.default, {
|
|
40
73
|
sx: {
|
|
74
|
+
minHeight: height ? height : null,
|
|
75
|
+
maxHeight: height ? height : null,
|
|
76
|
+
minWidth: width ? width : null,
|
|
77
|
+
maxWidth: width ? width : null,
|
|
41
78
|
textTransform: "none",
|
|
42
79
|
borderRadius: radius * 0.05,
|
|
43
80
|
color: getTextColor(),
|
|
44
81
|
// shape === "contained" ? "white" : "black",
|
|
45
82
|
backgroundColor: {
|
|
46
83
|
backgroundColor: backgroundColor
|
|
47
|
-
}
|
|
84
|
+
},
|
|
85
|
+
borderColor: borderColor,
|
|
86
|
+
fontFamily: fontFamily
|
|
48
87
|
},
|
|
49
88
|
variant: shape,
|
|
50
89
|
size: size,
|
|
@@ -52,7 +91,7 @@ var Button = function Button(_ref) {
|
|
|
52
91
|
onClick: function onClick(event) {
|
|
53
92
|
_onClick(event);
|
|
54
93
|
}
|
|
55
|
-
}, text));
|
|
94
|
+
}, text)));
|
|
56
95
|
};
|
|
57
96
|
exports.Button = Button;
|
|
58
97
|
var _default = Button;
|
|
@@ -20,7 +20,7 @@ var ControlsContainer = _styledComponents.default.div(_templateObject || (_templ
|
|
|
20
20
|
exports.ControlsContainer = ControlsContainer;
|
|
21
21
|
var Controls = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n border-radius: 12px;\n background: #ffffff;\n justify-content: center; \n flex-direction: column;\n flex-basis: 100%;\n padding: 0 16px;\n justify-content: space-between;\n"])));
|
|
22
22
|
exports.Controls = Controls;
|
|
23
|
-
var Title = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)([" \n font-weight: 600;\n font-size: 1rem; \n margin-left: 0.5rem;\n margin-top:
|
|
23
|
+
var Title = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)([" \n font-weight: 600;\n font-size: 1rem; \n margin-left: 0.5rem;\n margin-top: 15px;\n"])));
|
|
24
24
|
exports.Title = Title;
|
|
25
25
|
var ValueAndBenchmarkContainer = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n display: inline-flex;\n align-items: baseline; \n margin-left: 0.5rem;\n"])));
|
|
26
26
|
exports.ValueAndBenchmarkContainer = ValueAndBenchmarkContainer;
|
|
@@ -45,7 +45,27 @@ var TotalBenchmarkBarchart = function TotalBenchmarkBarchart(_ref) {
|
|
|
45
45
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
46
46
|
heightFactor = _useState4[0],
|
|
47
47
|
setHeightFactor = _useState4[1];
|
|
48
|
+
var _useState5 = (0, _react.useState)([]),
|
|
49
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
50
|
+
formattedBarChartData = _useState6[0],
|
|
51
|
+
setFormattedBarChartData = _useState6[1];
|
|
48
52
|
var controlsContainerRef = (0, _react.useRef)();
|
|
53
|
+
(0, _react.useEffect)(function () {
|
|
54
|
+
var tempFormattedBarChartData = [];
|
|
55
|
+
if (barChartData && barChartData.length === 2) {
|
|
56
|
+
tempFormattedBarChartData.push({
|
|
57
|
+
title1: barChartData[0].title,
|
|
58
|
+
value1: barChartData[0].value,
|
|
59
|
+
formattedValue1: currency ? (0, _CommonFunctions.getCurrencySign)(currencyType).toString().concat("", (0, _CommonFunctions.getFormattedValue)(barChartData[0].value), "", (0, _CommonFunctions.getFormattedUnits)(barChartData[0].value)) : "",
|
|
60
|
+
color1: barChartData[0].color ? barChartData[0].color : "#79DB95",
|
|
61
|
+
title2: barChartData[1].title,
|
|
62
|
+
value2: barChartData[1].value,
|
|
63
|
+
formattedValue2: currency ? (0, _CommonFunctions.getCurrencySign)(currencyType).toString().concat("", (0, _CommonFunctions.getFormattedValue)(barChartData[1].value), "", (0, _CommonFunctions.getFormattedUnits)(barChartData[1].value)) : "",
|
|
64
|
+
color2: barChartData[1].color ? barChartData[1].color : "#D4C0FF"
|
|
65
|
+
});
|
|
66
|
+
setFormattedBarChartData(tempFormattedBarChartData);
|
|
67
|
+
}
|
|
68
|
+
}, [barChartData]);
|
|
49
69
|
(0, _react.useEffect)(function () {
|
|
50
70
|
var offsetWidth = controlsContainerRef.current.offsetWidth;
|
|
51
71
|
setRootFont(getRootFont(offsetWidth));
|
|
@@ -60,19 +80,6 @@ var TotalBenchmarkBarchart = function TotalBenchmarkBarchart(_ref) {
|
|
|
60
80
|
var fontRoot = (DEFAULT_ROOT_FONT * relation).toString().concat("", "px");
|
|
61
81
|
return fontRoot;
|
|
62
82
|
};
|
|
63
|
-
var formattedBarChartData = [];
|
|
64
|
-
if (barChartData && barChartData.length === 2) {
|
|
65
|
-
formattedBarChartData.push({
|
|
66
|
-
title1: barChartData[0].title,
|
|
67
|
-
value1: barChartData[0].value,
|
|
68
|
-
formattedValue1: currency ? (0, _CommonFunctions.getCurrencySign)(currencyType).toString().concat("", (0, _CommonFunctions.getFormattedValue)(barChartData[0].value), "", (0, _CommonFunctions.getFormattedUnits)(barChartData[0].value)) : "",
|
|
69
|
-
color1: barChartData[0].color ? barChartData[0].color : "#79DB95",
|
|
70
|
-
title2: barChartData[1].title,
|
|
71
|
-
value2: barChartData[1].value,
|
|
72
|
-
formattedValue2: currency ? (0, _CommonFunctions.getCurrencySign)(currencyType).toString().concat("", (0, _CommonFunctions.getFormattedValue)(barChartData[1].value), "", (0, _CommonFunctions.getFormattedUnits)(barChartData[1].value)) : "",
|
|
73
|
-
color2: barChartData[1].color ? barChartData[1].color : "#D4C0FF"
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
83
|
var getSizeFactor = function getSizeFactor() {
|
|
77
84
|
return rootFont.toString().replace("px", "") / DEFAULT_ROOT_FONT;
|
|
78
85
|
};
|
|
@@ -110,7 +117,7 @@ var TotalBenchmarkBarchart = function TotalBenchmarkBarchart(_ref) {
|
|
|
110
117
|
backgroundColor: "#F2F2F2"
|
|
111
118
|
})) : ""), /*#__PURE__*/_react.default.createElement(_TotalBenchmarkBarchartStyle.BarchartContainer, {
|
|
112
119
|
id: "BarchartContainer"
|
|
113
|
-
}, /*#__PURE__*/_react.default.createElement(_recharts.BarChart, {
|
|
120
|
+
}, formattedBarChartData && formattedBarChartData.length === 1 && /*#__PURE__*/_react.default.createElement(_recharts.BarChart, {
|
|
114
121
|
width: 224 * getSizeFactor(),
|
|
115
122
|
height: 104 * heightFactor,
|
|
116
123
|
data: formattedBarChartData,
|