sag_components 1.0.47 → 1.0.48
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.
|
@@ -11,15 +11,15 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm
|
|
|
11
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _SegmentedButtonStyle = require("./SegmentedButton.style.js");
|
|
14
|
-
var _excluded = ["name", "options", "
|
|
14
|
+
var _excluded = ["name", "options", "width", "heigth", "controlRadius", "segmentRadius", "fontSize", "backgroundColor", "selectedSegmentColor", "selectedTextColor", "unselectedTextColor", "defaultIndex", "onClick"];
|
|
15
15
|
/*SegmentedButton*/
|
|
16
16
|
var SegmentedButton = function SegmentedButton(_ref) {
|
|
17
17
|
var name = _ref.name,
|
|
18
18
|
options = _ref.options,
|
|
19
|
-
_ref$
|
|
20
|
-
|
|
21
|
-
_ref$
|
|
22
|
-
|
|
19
|
+
_ref$width = _ref.width,
|
|
20
|
+
width = _ref$width === void 0 ? 120 : _ref$width,
|
|
21
|
+
_ref$heigth = _ref.heigth,
|
|
22
|
+
heigth = _ref$heigth === void 0 ? 40 : _ref$heigth,
|
|
23
23
|
_ref$controlRadius = _ref.controlRadius,
|
|
24
24
|
controlRadius = _ref$controlRadius === void 0 ? 8 : _ref$controlRadius,
|
|
25
25
|
_ref$segmentRadius = _ref.segmentRadius,
|
|
@@ -76,6 +76,10 @@ var SegmentedButton = function SegmentedButton(_ref) {
|
|
|
76
76
|
value: value
|
|
77
77
|
});
|
|
78
78
|
};
|
|
79
|
+
var segmentWidth = 120;
|
|
80
|
+
if (options && options.length > 0 && width && width > 0) {
|
|
81
|
+
segmentWidth = width / options.length;
|
|
82
|
+
}
|
|
79
83
|
return /*#__PURE__*/_react.default.createElement(_SegmentedButtonStyle.ControlsContainer, {
|
|
80
84
|
fontSize: fontSize,
|
|
81
85
|
ref: controlRef
|
|
@@ -108,7 +112,7 @@ var SegmentedButton = function SegmentedButton(_ref) {
|
|
|
108
112
|
}), /*#__PURE__*/_react.default.createElement(_SegmentedButtonStyle.SegmentLabel, {
|
|
109
113
|
selectedTextColor: selectedTextColor,
|
|
110
114
|
unselectedTextColor: unselectedTextColor,
|
|
111
|
-
segmentHeigth:
|
|
115
|
+
segmentHeigth: heigth / 5,
|
|
112
116
|
className: "".concat(activeIndex === i ? "active" : "inactive", " "),
|
|
113
117
|
htmlFor: item.value
|
|
114
118
|
}, item.value));
|
|
@@ -0,0 +1,128 @@
|
|
|
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 = exports.TotalBenchmarkBarchart = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _recharts = require("recharts");
|
|
12
|
+
var _CommonFunctions = require("./CommonFunctions");
|
|
13
|
+
var _Benchmark = require("./Benchmark");
|
|
14
|
+
var _TotalBenchmarkBarchartStyle = require("./TotalBenchmarkBarchart.style.js");
|
|
15
|
+
var _excluded = ["title", "value", "benchmarkTotalValue", "benchmarkValue", "currency", "currencyType", "barChartData", "dotCut", "width", "height", "textColor"];
|
|
16
|
+
/*TotalBenchmarkBarchart*/
|
|
17
|
+
var TotalBenchmarkBarchart = function TotalBenchmarkBarchart(_ref) {
|
|
18
|
+
var title = _ref.title,
|
|
19
|
+
value = _ref.value,
|
|
20
|
+
benchmarkTotalValue = _ref.benchmarkTotalValue,
|
|
21
|
+
benchmarkValue = _ref.benchmarkValue,
|
|
22
|
+
_ref$currency = _ref.currency,
|
|
23
|
+
currency = _ref$currency === void 0 ? true : _ref$currency,
|
|
24
|
+
_ref$currencyType = _ref.currencyType,
|
|
25
|
+
currencyType = _ref$currencyType === void 0 ? "USD" : _ref$currencyType,
|
|
26
|
+
barChartData = _ref.barChartData,
|
|
27
|
+
_ref$dotCut = _ref.dotCut,
|
|
28
|
+
dotCut = _ref$dotCut === void 0 ? true : _ref$dotCut,
|
|
29
|
+
_ref$width = _ref.width,
|
|
30
|
+
width = _ref$width === void 0 ? 260 : _ref$width,
|
|
31
|
+
_ref$height = _ref.height,
|
|
32
|
+
height = _ref$height === void 0 ? 350 : _ref$height,
|
|
33
|
+
_ref$textColor = _ref.textColor,
|
|
34
|
+
textColor = _ref$textColor === void 0 ? "black" : _ref$textColor,
|
|
35
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
36
|
+
var formattedBarChartData = [];
|
|
37
|
+
if (barChartData && barChartData.length === 2) {
|
|
38
|
+
formattedBarChartData.push({
|
|
39
|
+
title1: barChartData[0].title,
|
|
40
|
+
value1: barChartData[0].value,
|
|
41
|
+
formattedValue1: currency ? (0, _CommonFunctions.getCurrencySign)(currencyType).toString().concat("", (0, _CommonFunctions.getFormattedValue)(barChartData[0].value), "", (0, _CommonFunctions.getFormattedUnits)(barChartData[0].value)) : "",
|
|
42
|
+
color1: barChartData[0].color ? barChartData[0].color : "#79DB95",
|
|
43
|
+
title2: barChartData[1].title,
|
|
44
|
+
value2: barChartData[1].value,
|
|
45
|
+
formattedValue2: currency ? (0, _CommonFunctions.getCurrencySign)(currencyType).toString().concat("", (0, _CommonFunctions.getFormattedValue)(barChartData[1].value), "", (0, _CommonFunctions.getFormattedUnits)(barChartData[1].value)) : "",
|
|
46
|
+
color2: barChartData[1].color ? barChartData[1].color : "#D4C0FF"
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement(_TotalBenchmarkBarchartStyle.ControlsContainer, {
|
|
50
|
+
height: height,
|
|
51
|
+
width: width,
|
|
52
|
+
textColor: textColor
|
|
53
|
+
}, /*#__PURE__*/_react.default.createElement(_TotalBenchmarkBarchartStyle.Controls, {
|
|
54
|
+
height: height,
|
|
55
|
+
width: width
|
|
56
|
+
}, /*#__PURE__*/_react.default.createElement(_TotalBenchmarkBarchartStyle.Title, {
|
|
57
|
+
width: width
|
|
58
|
+
}, title), /*#__PURE__*/_react.default.createElement(_TotalBenchmarkBarchartStyle.ValueAndBenchmarkContainer, {
|
|
59
|
+
height: height,
|
|
60
|
+
width: width
|
|
61
|
+
}, /*#__PURE__*/_react.default.createElement(_TotalBenchmarkBarchartStyle.CurrencySign, null, currency ? (0, _CommonFunctions.getCurrencySign)(currencyType, value) : ""), /*#__PURE__*/_react.default.createElement(_TotalBenchmarkBarchartStyle.FormattedValue, {
|
|
62
|
+
width: width
|
|
63
|
+
}, dotCut ? (0, _CommonFunctions.getFormattedValue)(value) : (0, _CommonFunctions.getNumberWithCommas)(value), dotCut ? (0, _CommonFunctions.getFormattedUnits)(value) : ""), benchmarkTotalValue ? /*#__PURE__*/_react.default.createElement(_TotalBenchmarkBarchartStyle.BenchmarkContainer, {
|
|
64
|
+
width: width
|
|
65
|
+
}, /*#__PURE__*/_react.default.createElement(_Benchmark.Benchmark, {
|
|
66
|
+
totalValue: benchmarkTotalValue,
|
|
67
|
+
currentValue: value,
|
|
68
|
+
benchmarkValue: benchmarkValue,
|
|
69
|
+
height: 12,
|
|
70
|
+
width: 100,
|
|
71
|
+
color: "#79DB95",
|
|
72
|
+
linearGradientColor: "#C3EFD0",
|
|
73
|
+
linearGradientUnderAvarageColor: "#FDB1B1",
|
|
74
|
+
underAvarageColor: "#FD5959",
|
|
75
|
+
backgroundColor: "#F2F2F2"
|
|
76
|
+
})) : ""), /*#__PURE__*/_react.default.createElement(_TotalBenchmarkBarchartStyle.BarchartContainer, {
|
|
77
|
+
height: height,
|
|
78
|
+
width: width
|
|
79
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.BarChart, {
|
|
80
|
+
width: 240,
|
|
81
|
+
height: 120,
|
|
82
|
+
data: formattedBarChartData,
|
|
83
|
+
margin: {
|
|
84
|
+
top: 20,
|
|
85
|
+
right: -20,
|
|
86
|
+
bottom: 0,
|
|
87
|
+
left: -20
|
|
88
|
+
}
|
|
89
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.CartesianGrid, {
|
|
90
|
+
strokeDasharray: "3 3",
|
|
91
|
+
vertical: false
|
|
92
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.Bar, {
|
|
93
|
+
dataKey: "value1",
|
|
94
|
+
fill: formattedBarChartData[0].color1,
|
|
95
|
+
name: "Actual",
|
|
96
|
+
maxBarSize: 60,
|
|
97
|
+
radius: [5, 5, 0, 0]
|
|
98
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.LabelList, {
|
|
99
|
+
dataKey: "formattedValue1",
|
|
100
|
+
position: "top",
|
|
101
|
+
fill: textColor,
|
|
102
|
+
style: (0, _defineProperty2.default)({}, "font-size", "16px")
|
|
103
|
+
})), /*#__PURE__*/_react.default.createElement(_recharts.Bar, {
|
|
104
|
+
dataKey: "value2",
|
|
105
|
+
fill: formattedBarChartData[0].color2,
|
|
106
|
+
name: "Base Line",
|
|
107
|
+
maxBarSize: 60,
|
|
108
|
+
radius: [5, 5, 0, 0],
|
|
109
|
+
label: "aaa"
|
|
110
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.LabelList, {
|
|
111
|
+
dataKey: "formattedValue2",
|
|
112
|
+
position: "top",
|
|
113
|
+
fill: textColor,
|
|
114
|
+
style: (0, _defineProperty2.default)({}, "font-size", "16px")
|
|
115
|
+
}))), formattedBarChartData && formattedBarChartData.length > 0 ? /*#__PURE__*/_react.default.createElement(_TotalBenchmarkBarchartStyle.BottomDetailsRowContainer, {
|
|
116
|
+
height: height,
|
|
117
|
+
width: width
|
|
118
|
+
}, /*#__PURE__*/_react.default.createElement(_TotalBenchmarkBarchartStyle.BottomDetailsRowTitle, {
|
|
119
|
+
height: height,
|
|
120
|
+
width: width
|
|
121
|
+
}, formattedBarChartData[0].title1), /*#__PURE__*/_react.default.createElement(_TotalBenchmarkBarchartStyle.BottomDetailsRowTitle, {
|
|
122
|
+
height: height,
|
|
123
|
+
width: width
|
|
124
|
+
}, formattedBarChartData[0].title2)) : ""), ";"));
|
|
125
|
+
};
|
|
126
|
+
exports.TotalBenchmarkBarchart = TotalBenchmarkBarchart;
|
|
127
|
+
var _default = TotalBenchmarkBarchart;
|
|
128
|
+
exports.default = _default;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ValueAndBenchmarkContainer = exports.Title = exports.FormattedValue = exports.CurrencySign = exports.ControlsContainer = exports.Controls = exports.BottomDetailsRowTitle = exports.BottomDetailsRowContainer = exports.BenchmarkContainer = exports.BarchartContainer = 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 MIN_HEIGHT = 300;
|
|
12
|
+
var MIN_WIDTH = 260;
|
|
13
|
+
var ControlsContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n position: relative;\n margin: 0px 0 0px;\n font-family: \"Lato\", sans-serif;\n font-style: normal;\n color: ", ";\n width: ", ";\n height: ", ";\n //box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);\n border-radius: 12px;\n //border: 1px solid red;\n"])), function (props) {
|
|
14
|
+
return props.textColor;
|
|
15
|
+
}, function (props) {
|
|
16
|
+
return (props.width - MIN_WIDTH <= 0 ? MIN_WIDTH : props.width).toString().concat("", "px");
|
|
17
|
+
}, function (props) {
|
|
18
|
+
return (props.height - MIN_HEIGHT <= 0 ? MIN_HEIGHT : props.height).toString().concat("", "px");
|
|
19
|
+
});
|
|
20
|
+
exports.ControlsContainer = ControlsContainer;
|
|
21
|
+
var Controls = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n border-radius: 12px;\n width: ", ";\n height: ", ";\n top: 68px;\n left: 40px;\n background: #ffffff;\n //border: 1px solid yellow;\n"])), function (props) {
|
|
22
|
+
return (props.width - MIN_WIDTH <= 0 ? 217 : 217 + (props.width - MIN_WIDTH)).toString().concat("", "px");
|
|
23
|
+
}, function (props) {
|
|
24
|
+
return (props.height - MIN_HEIGHT <= 0 ? 230 : 230 + (props.height - MIN_HEIGHT)).toString().concat("", "px");
|
|
25
|
+
});
|
|
26
|
+
exports.Controls = Controls;
|
|
27
|
+
var Title = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n width: ", ";\n height: 22px;\n left: 0px;\n top: 0px;\n font-weight: 600;\n font-size: 18px;\n line-height: 22px;\n //border: 1px solid red;\n"])), function (props) {
|
|
28
|
+
return (props.width - MIN_WIDTH <= 0 ? 250 : 250 + (props.width - MIN_WIDTH)).toString().concat("", "px");
|
|
29
|
+
});
|
|
30
|
+
exports.Title = Title;
|
|
31
|
+
var ValueAndBenchmarkContainer = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n display: inline-flex;\n width: ", ";\n height: ", ";\n left: 0px;\n top: 30px;\n //border: 1px solid green;\n"])), function (props) {
|
|
32
|
+
return (props.width - MIN_WIDTH <= 0 ? 217 : 217 + (props.width - MIN_WIDTH)).toString().concat("", "px");
|
|
33
|
+
}, function (props) {
|
|
34
|
+
return (props.height - MIN_HEIGHT <= 0 ? 0 : 0 + (props.height - MIN_HEIGHT)).toString().concat("", "px");
|
|
35
|
+
});
|
|
36
|
+
exports.ValueAndBenchmarkContainer = ValueAndBenchmarkContainer;
|
|
37
|
+
var CurrencySign = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n //position: absolute;\n margin-left: 0px;\n margin-top: 19px;\n width: 11px;\n height: 22px;\n left: 40px;\n top: 10px;\n font-weight: 500;\n font-size: 18px;\n line-height: 22px;\n //border: 1px solid red;\n"])));
|
|
38
|
+
exports.CurrencySign = CurrencySign;
|
|
39
|
+
var FormattedValue = _styledComponents.default.div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n //position: absolute;\n margin-left: 2px;\n width: ", ";\n height: 48px;\n left: 0px;\n top: 40px;\n font-weight: 500;\n font-size: 40px;\n line-height: 48px;\n //border: 1px solid red;\n"])), function (props) {
|
|
40
|
+
return (props.width - MIN_WIDTH <= 0 ? 217 : 217 + (props.width - MIN_WIDTH)).toString().concat("", "px");
|
|
41
|
+
});
|
|
42
|
+
exports.FormattedValue = FormattedValue;
|
|
43
|
+
var BenchmarkContainer = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n //position: absolute;\n margin-left: 4px;\n margin-top: 26px;\n width: 100px;\n height: 12px;\n left: ", ";\n //top: 24px;\n //border: 1px solid red;\n"])), function (props) {
|
|
44
|
+
return (props.width - MIN_WIDTH <= 0 ? 115 : 115 + (props.width - MIN_WIDTH)).toString().concat("", "px");
|
|
45
|
+
});
|
|
46
|
+
exports.BenchmarkContainer = BenchmarkContainer;
|
|
47
|
+
var BarchartContainer = _styledComponents.default.div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n // display: inline-flex;\n width: 240 px;\n height: ", ";\n left: 0px;\n top: 120px;\n //border: 1px solid green;\n"])), function (props) {
|
|
48
|
+
return (props.height - MIN_HEIGHT <= 0 ? 100 : 100 + (props.height - MIN_HEIGHT)).toString().concat("", "px");
|
|
49
|
+
});
|
|
50
|
+
exports.BarchartContainer = BarchartContainer;
|
|
51
|
+
var BottomDetailsRowContainer = _styledComponents.default.div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n //width: 245px;\n height: 20px;\n left: 0px;\n top: 3px;\n \n //border: 1px solid brown;\n"])));
|
|
52
|
+
exports.BottomDetailsRowContainer = BottomDetailsRowContainer;
|
|
53
|
+
var BottomDetailsRowTitle = _styledComponents.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n margin-top: 1px;\n margin-left: 1px; \n margin-right: 1px;\n height: 19px;\n width: 115px;\n left: 0px;\n top: 0px;\n font-weight: 400;\n font-size: 14px;\n line-height: 17px;\n //border: 1px solid red;\n"])));
|
|
54
|
+
exports.BottomDetailsRowTitle = BottomDetailsRowTitle;
|