sag_components 1.0.79 → 1.0.81
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/TotalBenchmarkArrows.js +1 -1
- package/dist/stories/components/TotalBenchmarkArrows.style.js +2 -2
- package/dist/stories/components/TotalBenchmarkBarchart.js +1 -1
- package/dist/stories/components/TotalDoughnutChart.js +26 -6
- package/dist/stories/components/TotalDoughnutChart.style.js +18 -16
- package/package.json +1 -1
|
@@ -68,7 +68,7 @@ var TotalBenchmarkArrows = function TotalBenchmarkArrows(_ref) {
|
|
|
68
68
|
currentValue: value,
|
|
69
69
|
benchmarkValue: benchmarkValue,
|
|
70
70
|
height: 12,
|
|
71
|
-
width:
|
|
71
|
+
width: 75,
|
|
72
72
|
color: "#79DB95",
|
|
73
73
|
linearGradientColor: "#C3EFD0",
|
|
74
74
|
linearGradientUnderAvarageColor: "#FDB1B1",
|
|
@@ -32,8 +32,8 @@ var FormattedValue = _styledComponents.default.div(_templateObject4 || (_templat
|
|
|
32
32
|
return (props.width - MIN_WIDTH <= 0 ? 217 : 217 + (props.width - MIN_WIDTH)).toString().concat("", "px");
|
|
33
33
|
});
|
|
34
34
|
exports.FormattedValue = FormattedValue;
|
|
35
|
-
var BenchmarkContainer = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n width:
|
|
36
|
-
return (props.width - MIN_WIDTH <= 0 ?
|
|
35
|
+
var BenchmarkContainer = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n width: 75px;\n height: 12px;\n left: ", ";\n top: 66px;\n //border: 1px solid red;\n"])), function (props) {
|
|
36
|
+
return (props.width - MIN_WIDTH <= 0 ? 140 : 140 + (props.width - MIN_WIDTH)).toString().concat("", "px");
|
|
37
37
|
});
|
|
38
38
|
exports.BenchmarkContainer = BenchmarkContainer;
|
|
39
39
|
var DetailsContainer = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n width: ", "; \n height: ", "; \n left: 0px;\n top: 120px;\n //border: 1px solid green;\n"])), function (props) {
|
|
@@ -75,7 +75,7 @@ var TotalBenchmarkBarchart = function TotalBenchmarkBarchart(_ref) {
|
|
|
75
75
|
currentValue: value,
|
|
76
76
|
benchmarkValue: benchmarkValue,
|
|
77
77
|
height: 12,
|
|
78
|
-
width:
|
|
78
|
+
width: 75,
|
|
79
79
|
color: "#79DB95",
|
|
80
80
|
linearGradientColor: "#C3EFD0",
|
|
81
81
|
linearGradientUnderAvarageColor: "#FDB1B1",
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = exports.TotalDoughnutChart = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
8
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
9
|
-
var _react =
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
12
|
var _CommonFunctions = require("./CommonFunctions");
|
|
11
13
|
var _recharts = require("recharts");
|
|
12
14
|
var _TotalDoughnutChartStyle = require("./TotalDoughnutChart.style.js");
|
|
@@ -25,18 +27,36 @@ var TotalDoughnutChart = function TotalDoughnutChart(_ref) {
|
|
|
25
27
|
currencyType = _ref$currencyType === void 0 ? "USD" : _ref$currencyType,
|
|
26
28
|
legendData = _ref.legendData,
|
|
27
29
|
_ref$width = _ref.width,
|
|
28
|
-
width = _ref$width === void 0 ? "
|
|
30
|
+
width = _ref$width === void 0 ? "250px" : _ref$width,
|
|
29
31
|
_ref$height = _ref.height,
|
|
30
|
-
height = _ref$height === void 0 ? "
|
|
32
|
+
height = _ref$height === void 0 ? "280px" : _ref$height,
|
|
31
33
|
_ref$textColor = _ref.textColor,
|
|
32
34
|
textColor = _ref$textColor === void 0 ? "black" : _ref$textColor,
|
|
33
35
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
36
|
+
var DEFAULT_ROOT_FONT = 16;
|
|
37
|
+
var DEFAULT_COMPONENT_WIDTH = 250;
|
|
38
|
+
var _useState = (0, _react.useState)(DEFAULT_ROOT_FONT.toString().concat("", "px")),
|
|
39
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
40
|
+
rootFont = _useState2[0],
|
|
41
|
+
setRootFont = _useState2[1];
|
|
42
|
+
var controlsContainerRef = (0, _react.useRef)();
|
|
43
|
+
(0, _react.useEffect)(function () {
|
|
44
|
+
var offsetWidth = controlsContainerRef.current.offsetWidth;
|
|
45
|
+
setRootFont(getRootFont(offsetWidth));
|
|
46
|
+
}, [width]);
|
|
47
|
+
var getRootFont = function getRootFont(width) {
|
|
48
|
+
var relation = width.toString().replace("px", "").replace("%", "") / DEFAULT_COMPONENT_WIDTH;
|
|
49
|
+
var fontRoot = (DEFAULT_ROOT_FONT * relation).toString().concat("", "px");
|
|
50
|
+
return fontRoot;
|
|
51
|
+
};
|
|
34
52
|
var onPieEnterHandler = function onPieEnterHandler() {};
|
|
35
53
|
return /*#__PURE__*/_react.default.createElement(_TotalDoughnutChartStyle.ControlsContainer, {
|
|
36
54
|
id: "ControlsContainer",
|
|
37
55
|
height: height,
|
|
38
56
|
width: width,
|
|
39
|
-
textColor: textColor
|
|
57
|
+
textColor: textColor,
|
|
58
|
+
ref: controlsContainerRef,
|
|
59
|
+
rootFont: rootFont
|
|
40
60
|
}, /*#__PURE__*/_react.default.createElement(_TotalDoughnutChartStyle.Controls, {
|
|
41
61
|
id: "Controls",
|
|
42
62
|
height: height,
|
|
@@ -63,8 +83,8 @@ var TotalDoughnutChart = function TotalDoughnutChart(_ref) {
|
|
|
63
83
|
onMouseEnter: onPieEnterHandler
|
|
64
84
|
}, /*#__PURE__*/_react.default.createElement(_recharts.Pie, {
|
|
65
85
|
data: legendData,
|
|
66
|
-
|
|
67
|
-
|
|
86
|
+
outerRadius: 33 * (rootFont.toString().replace("px", "") / DEFAULT_ROOT_FONT),
|
|
87
|
+
innerRadius: 23 * (rootFont.toString().replace("px", "") / DEFAULT_ROOT_FONT),
|
|
68
88
|
fill: "#8884d8",
|
|
69
89
|
dataKey: "value"
|
|
70
90
|
}, legendData.map(function (row, index) {
|
|
@@ -8,7 +8,9 @@ exports.TitleAndValueContainer = exports.Title = exports.LegendTitleAndFormatedV
|
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
9
9
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
10
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17;
|
|
11
|
-
var ControlsContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n position: relative;\n
|
|
11
|
+
var ControlsContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n position: relative;\n font-family: \"Lato\", sans-serif;\n font-style: normal; \n font-size: ", ";\n color: ", ";\n width: ", ";\n height: ", ";\n //box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);\n border-radius: 12px; \n align-content: center;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n"])), function (props) {
|
|
12
|
+
return props.rootFont;
|
|
13
|
+
}, function (props) {
|
|
12
14
|
return props.textColor;
|
|
13
15
|
}, function (props) {
|
|
14
16
|
return props.width;
|
|
@@ -16,37 +18,37 @@ var ControlsContainer = _styledComponents.default.div(_templateObject || (_templ
|
|
|
16
18
|
return props.height;
|
|
17
19
|
});
|
|
18
20
|
exports.ControlsContainer = ControlsContainer;
|
|
19
|
-
var Controls = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n border-radius: 12px;\n width:100%;\n height:100%;\n background: #ffffff;\n justify-content: center;\n align-items: center;\n flex-direction: column
|
|
21
|
+
var Controls = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n border-radius: 12px;\n width:100%;\n height:100%;\n background: #ffffff;\n justify-content: center;\n align-items: center;\n flex-direction: column; \n"])));
|
|
20
22
|
exports.Controls = Controls;
|
|
21
|
-
var TitleAndValueContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n width:
|
|
23
|
+
var TitleAndValueContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n width: 90%;\n margin-top: 35px;\n"])));
|
|
22
24
|
exports.TitleAndValueContainer = TitleAndValueContainer;
|
|
23
|
-
var Title = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n width: 100%; \n height:
|
|
25
|
+
var Title = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n width: 100%; \n height: 100%; \n font-weight: 600;\n font-size: 1em;\n"])));
|
|
24
26
|
exports.Title = Title;
|
|
25
27
|
var CurrencySignAndFormattedValueContainer = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n align-items: baseline;\n"])));
|
|
26
28
|
exports.CurrencySignAndFormattedValueContainer = CurrencySignAndFormattedValueContainer;
|
|
27
|
-
var CurrencySign = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size:
|
|
29
|
+
var CurrencySign = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size: 1em;\n"])));
|
|
28
30
|
exports.CurrencySign = CurrencySign;
|
|
29
|
-
var FormattedValue = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size: 2.
|
|
31
|
+
var FormattedValue = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size: 2.22em; \n"])));
|
|
30
32
|
exports.FormattedValue = FormattedValue;
|
|
31
|
-
var DoughnutChartAndLegendContainer = _styledComponents.default.div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n width:
|
|
33
|
+
var DoughnutChartAndLegendContainer = _styledComponents.default.div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n width: 90%;\n height: 27%;\n margin-top: 2.18em; // 35px;\n margin-bottom: 2.18em; // 35px;\n"])));
|
|
32
34
|
exports.DoughnutChartAndLegendContainer = DoughnutChartAndLegendContainer;
|
|
33
|
-
var DoughnutChart = _styledComponents.default.div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n width: 34%;\n height: 100%;\n
|
|
35
|
+
var DoughnutChart = _styledComponents.default.div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n width: 34%;\n height: 100%;\n"])));
|
|
34
36
|
exports.DoughnutChart = DoughnutChart;
|
|
35
|
-
var LegendContainer = _styledComponents.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n width: 66%;\n padding-left: 10px;\n flex-direction: column;\n align-items: left;\n justify-content: space-between;\n
|
|
37
|
+
var LegendContainer = _styledComponents.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n width: 66%;\n padding-left: 10px;\n flex-direction: column;\n align-items: left;\n justify-content: space-between;\n"])));
|
|
36
38
|
exports.LegendContainer = LegendContainer;
|
|
37
|
-
var LegendControlsContainer = _styledComponents.default.div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n align-items: center;\n height: 50%;\n width: 100%;\n
|
|
39
|
+
var LegendControlsContainer = _styledComponents.default.div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n align-items: center;\n height: 50%;\n width: 100%;\n"])));
|
|
38
40
|
exports.LegendControlsContainer = LegendControlsContainer;
|
|
39
|
-
var LegendTitleAndFormatedValueContainer = _styledComponents.default.div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n width:
|
|
41
|
+
var LegendTitleAndFormatedValueContainer = _styledComponents.default.div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n width: 100%;\n height: 100%;\n margin-left: 0.1em; \n flex-direction: column;\n"])));
|
|
40
42
|
exports.LegendTitleAndFormatedValueContainer = LegendTitleAndFormatedValueContainer;
|
|
41
|
-
var LegendFormatedValueContainer = _styledComponents.default.div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n
|
|
43
|
+
var LegendFormatedValueContainer = _styledComponents.default.div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n width: 100%;\n height: 50%;\n"])));
|
|
42
44
|
exports.LegendFormatedValueContainer = LegendFormatedValueContainer;
|
|
43
|
-
var LegendColorRectangle = _styledComponents.default.div(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n width:
|
|
45
|
+
var LegendColorRectangle = _styledComponents.default.div(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n width: 0.8em;\n height: 0.7em;\n margin-right:0.3em;\n background: ", ";\n"])), function (props) {
|
|
44
46
|
return props.color;
|
|
45
47
|
});
|
|
46
48
|
exports.LegendColorRectangle = LegendColorRectangle;
|
|
47
|
-
var LegendTitle = _styledComponents.default.div(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 400;\n font-size: 0.
|
|
49
|
+
var LegendTitle = _styledComponents.default.div(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 400;\n font-size: 0.8em; \n width: 100%;\n height: 50%;\n"])));
|
|
48
50
|
exports.LegendTitle = LegendTitle;
|
|
49
|
-
var LegendCurrencySign = _styledComponents.default.div(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 600;\n font-size: 0.
|
|
51
|
+
var LegendCurrencySign = _styledComponents.default.div(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 600;\n font-size: 0.8em; \n"])));
|
|
50
52
|
exports.LegendCurrencySign = LegendCurrencySign;
|
|
51
|
-
var LegendFormattedValue = _styledComponents.default.div(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 600;\n font-size:0.
|
|
53
|
+
var LegendFormattedValue = _styledComponents.default.div(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 600;\n font-size: 0.8em; \n"])));
|
|
52
54
|
exports.LegendFormattedValue = LegendFormattedValue;
|