sag_components 1.0.704 → 1.0.706
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.
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = exports.BarChartsByWeeks = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _recharts = require("recharts");
|
|
11
|
+
var _FormattedValue = require("./FormattedValue");
|
|
11
12
|
var _CommonFunctions = require("./CommonFunctions");
|
|
12
13
|
var _BarChartsByWeeks = require("./BarChartsByWeeks.style");
|
|
13
14
|
var _PerformanceAnalyticsLegend = _interopRequireDefault(require("./PerformanceAnalyticsLegend"));
|
|
@@ -20,11 +21,17 @@ const ICON_TYPE_LEGEND_LINE_ICON = 'LegendLineIcon';
|
|
|
20
21
|
const BarChartsByWeeks = props => {
|
|
21
22
|
const {
|
|
22
23
|
title,
|
|
24
|
+
headerValueTopTitle,
|
|
25
|
+
headerValueBottomTitle,
|
|
26
|
+
headerValue,
|
|
27
|
+
HeaderValueCurrencyType,
|
|
28
|
+
HeaderValueIsPercent,
|
|
23
29
|
barChartData,
|
|
24
30
|
isTitleOriganal,
|
|
25
31
|
width,
|
|
26
32
|
height,
|
|
27
33
|
barChartColor,
|
|
34
|
+
barChartSecondColor,
|
|
28
35
|
xselectedColor,
|
|
29
36
|
tooltipTitle,
|
|
30
37
|
startWeekRange = 0,
|
|
@@ -33,7 +40,8 @@ const BarChartsByWeeks = props => {
|
|
|
33
40
|
isPercentValue,
|
|
34
41
|
interval,
|
|
35
42
|
showLegend,
|
|
36
|
-
legendData
|
|
43
|
+
legendData,
|
|
44
|
+
showTwoBars
|
|
37
45
|
} = props;
|
|
38
46
|
const [BarChartContainerWidth, setBarChartContainerWidth] = (0, _react.useState)(0);
|
|
39
47
|
const [BarChartContainerHeight, setBarChartContainerHeight] = (0, _react.useState)(0);
|
|
@@ -86,11 +94,11 @@ const BarChartsByWeeks = props => {
|
|
|
86
94
|
var _getWeek;
|
|
87
95
|
if (!barChartData || barChartData.length === 0) return '';
|
|
88
96
|
return /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.EventWeeksLegendDataElementsContainer, {
|
|
89
|
-
|
|
97
|
+
className: "EventWeeksLegendDataElementsContainer"
|
|
90
98
|
}, (_getWeek = getWeek()) === null || _getWeek === void 0 ? void 0 : _getWeek.map(item => {
|
|
91
99
|
var _item$title2, _item$title3;
|
|
92
100
|
return /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.EventWeeksLegendDataElement, {
|
|
93
|
-
|
|
101
|
+
className: "EventWeeksLegendDataElement",
|
|
94
102
|
color: item.title >= startWeekRange && item.title <= endWeekRange ? xselectedColor : '',
|
|
95
103
|
textColor: item.title >= startWeekRange && item.title <= endWeekRange ? '#212121' : '#B1B1B1',
|
|
96
104
|
fontWeight: item.title >= startWeekRange && item.title <= endWeekRange ? 600 : 400,
|
|
@@ -100,21 +108,28 @@ const BarChartsByWeeks = props => {
|
|
|
100
108
|
}));
|
|
101
109
|
};
|
|
102
110
|
const displayEventWeeksLegendData = () => /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.EventWeeksLegendMainContainer, {
|
|
103
|
-
|
|
111
|
+
className: "EventWeeksLegendMainContainer"
|
|
104
112
|
}, displayEventWeeksElements());
|
|
105
113
|
return /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.ControlsContainer, {
|
|
106
|
-
|
|
114
|
+
className: "ControlsContainer",
|
|
107
115
|
height: height,
|
|
108
116
|
width: width,
|
|
109
117
|
ref: controlsContainerRef
|
|
110
118
|
}, /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.Controls, {
|
|
111
|
-
|
|
119
|
+
className: "Controls"
|
|
112
120
|
}, /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.TitleAndValueContainer, {
|
|
113
|
-
|
|
121
|
+
className: "TitleAndValueContainer"
|
|
114
122
|
}, /*#__PURE__*/_react.default.createElement(_BarChartsByWeeks.Title, {
|
|
115
|
-
|
|
116
|
-
}, title)
|
|
117
|
-
|
|
123
|
+
className: "Title"
|
|
124
|
+
}, title), /*#__PURE__*/_react.default.createElement(_FormattedValue.FormattedValue, {
|
|
125
|
+
title: headerValueTopTitle,
|
|
126
|
+
subtitle: headerValueBottomTitle,
|
|
127
|
+
value: headerValue,
|
|
128
|
+
currencyType: HeaderValueCurrencyType,
|
|
129
|
+
isPercent: HeaderValueIsPercent,
|
|
130
|
+
dotCut: true
|
|
131
|
+
})), /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, {
|
|
132
|
+
className: "ResponsiveContainer",
|
|
118
133
|
width: "100%",
|
|
119
134
|
height: showLegend ? '80%' : '86%'
|
|
120
135
|
}, /*#__PURE__*/_react.default.createElement(_recharts.BarChart, {
|
|
@@ -148,20 +163,40 @@ const BarChartsByWeeks = props => {
|
|
|
148
163
|
tickFormatter: value => "".concat(displayFormattedValue(value))
|
|
149
164
|
}), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, {
|
|
150
165
|
content: /*#__PURE__*/_react.default.createElement(CustomTooltip, null)
|
|
151
|
-
}), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, null), /*#__PURE__*/_react.default.createElement(_recharts.Bar, {
|
|
166
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, null), !showTwoBars ? /*#__PURE__*/_react.default.createElement(_recharts.Bar, {
|
|
152
167
|
dataKey: "value",
|
|
153
168
|
name: "title",
|
|
154
169
|
maxBarSize: 30,
|
|
155
170
|
radius: [4, 4, 0, 0],
|
|
156
171
|
fill: barChartColor
|
|
157
|
-
})
|
|
172
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_recharts.Bar, {
|
|
173
|
+
dataKey: "value",
|
|
174
|
+
name: "title",
|
|
175
|
+
maxBarSize: 30
|
|
176
|
+
// radius={[4, 4, 0, 0]}
|
|
177
|
+
,
|
|
178
|
+
stackId: "a",
|
|
179
|
+
fill: barChartColor
|
|
180
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.Bar, {
|
|
181
|
+
dataKey: "secondValue",
|
|
182
|
+
name: "title",
|
|
183
|
+
maxBarSize: 30,
|
|
184
|
+
radius: [4, 4, 0, 0],
|
|
185
|
+
stackId: "a",
|
|
186
|
+
fill: barChartSecondColor
|
|
187
|
+
})))), displayEventWeeksLegendData(), showLegend && /*#__PURE__*/_react.default.createElement(_PerformanceAnalyticsLegend.default, {
|
|
158
188
|
legendData: legendData
|
|
159
189
|
})));
|
|
160
190
|
};
|
|
161
191
|
exports.BarChartsByWeeks = BarChartsByWeeks;
|
|
162
192
|
var _default = exports.default = BarChartsByWeeks;
|
|
163
193
|
BarChartsByWeeks.defaultProps = {
|
|
164
|
-
title: '
|
|
194
|
+
title: '',
|
|
195
|
+
headerValueTopTitle: '',
|
|
196
|
+
headerValueBottomTitle: '',
|
|
197
|
+
headerValue: '',
|
|
198
|
+
HeaderValueCurrencyType: '',
|
|
199
|
+
HeaderValueIsPercent: '',
|
|
165
200
|
barChartData: [{
|
|
166
201
|
title: '202320',
|
|
167
202
|
value: 542366
|
|
@@ -205,6 +240,7 @@ BarChartsByWeeks.defaultProps = {
|
|
|
205
240
|
width: '100%',
|
|
206
241
|
height: '100%',
|
|
207
242
|
barChartColor: '#BD9EFF',
|
|
243
|
+
barChartSecondColor: '#42977A',
|
|
208
244
|
xselectedColor: '#42977A',
|
|
209
245
|
tooltipTitle: 'Sales',
|
|
210
246
|
startWeekRange: 0,
|
|
@@ -222,5 +258,6 @@ BarChartsByWeeks.defaultProps = {
|
|
|
222
258
|
title: 'Category Average',
|
|
223
259
|
iconType: ICON_TYPE_LEGEND_LINE_ICON,
|
|
224
260
|
iconColor: '#C906FD'
|
|
225
|
-
}]
|
|
261
|
+
}],
|
|
262
|
+
showTwoBars: false
|
|
226
263
|
};
|
|
@@ -15,7 +15,7 @@ const TooltipDiv = exports.TooltipDiv = _styledComponents.default.div(_templateO
|
|
|
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"])));
|
|
17
17
|
const TitleAndValueContainer = exports.TitleAndValueContainer = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n padding: 0 1rem;\n"])));
|
|
18
|
-
const Title = exports.Title = _styledComponents.default.div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n font-family: \"Poppins\", sans-serif;\n font-weight: 500;\n font-size:
|
|
18
|
+
const Title = exports.Title = _styledComponents.default.div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n font-family: \"Poppins\", sans-serif;\n font-weight: 500;\n font-size: 20px;\n line-height: 20px;\n @media (max-width: 1536px) {\n font-size: 16px;\n }\n @media (max-width: 1366px) {\n font-size: 14px;\n }\n\n"])));
|
|
19
19
|
const EventWeeksLegendMainContainer = exports.EventWeeksLegendMainContainer = _styledComponents.default.div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: center;\n flex-direction: column;\n margin: 2px 0 0 0;\n padding-left: 55px;\n align-items: center;\n\n"])));
|
|
20
20
|
const EventWeeksLegendDataElementsContainer = exports.EventWeeksLegendDataElementsContainer = _styledComponents.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n margin: 0px;\n align-items: center;\n justify-content: space-around;\n width: 100%;\n"])));
|
|
21
21
|
const EventWeeksLegendDataElement = exports.EventWeeksLegendDataElement = _styledComponents.default.h4(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n font-weight: ", ";\n font-size: 12px;\n line-height: 15px;\n margin: 0px;\n width: 100%;\n justify-content: center;\n align-content: center;\n color: ", ";\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n background: ", ";\n @media (max-width: 1536px) {\n font-size: 11px;\n }\n @media (max-width: 1366px) {\n font-size: 10px;\n }\n"])), props => props.fontWeight, props => props.textColor, props => props.borderLeftRadius, props => props.borderLeftRadius, props => props.borderRightRadius, props => props.borderRightRadius, props => props.color);
|
|
@@ -0,0 +1,68 @@
|
|
|
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.FormattedValue = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _CommonFunctions = require("./CommonFunctions");
|
|
10
|
+
var _FormattedValue = require("./FormattedValue.style");
|
|
11
|
+
/* FormattedValue */
|
|
12
|
+
const FormattedValue = props => {
|
|
13
|
+
const {
|
|
14
|
+
className,
|
|
15
|
+
title,
|
|
16
|
+
subtitle,
|
|
17
|
+
value,
|
|
18
|
+
dotCut,
|
|
19
|
+
currencySign,
|
|
20
|
+
currencyType,
|
|
21
|
+
width,
|
|
22
|
+
height,
|
|
23
|
+
textcolor,
|
|
24
|
+
isPercent
|
|
25
|
+
} = props;
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement(_FormattedValue.ControlsContainer, {
|
|
27
|
+
className: className || 'FormattedValue_ControlsContainer',
|
|
28
|
+
height: height,
|
|
29
|
+
width: width,
|
|
30
|
+
textcolor: textcolor
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement(_FormattedValue.Controls, {
|
|
32
|
+
className: "Controls",
|
|
33
|
+
height: height,
|
|
34
|
+
width: width
|
|
35
|
+
}, /*#__PURE__*/_react.default.createElement(_FormattedValue.TitleAndValueContainer, {
|
|
36
|
+
className: "TitleAndValueContainer"
|
|
37
|
+
}, title ? /*#__PURE__*/_react.default.createElement(_FormattedValue.Title, {
|
|
38
|
+
className: "Title",
|
|
39
|
+
width: width
|
|
40
|
+
}, title) : '', /*#__PURE__*/_react.default.createElement(_FormattedValue.CurrencySignAndFormattedValueContainer, {
|
|
41
|
+
className: "CurrencySignAndFormattedValueContainer"
|
|
42
|
+
}, /*#__PURE__*/_react.default.createElement(_FormattedValue.FormattedValueText, {
|
|
43
|
+
className: "FormattedValueText",
|
|
44
|
+
width: width
|
|
45
|
+
}, /*#__PURE__*/_react.default.createElement(_FormattedValue.CurrencySignOrPercent, {
|
|
46
|
+
className: "CurrencySignOrPercent"
|
|
47
|
+
}, currencySign ? (0, _CommonFunctions.getCurrencySign)(currencyType, value) : ''), dotCut ? (0, _CommonFunctions.getFormattedValue)(value && Math.abs(value) > 0 && value % 1 !== 0 ? value === null || value === void 0 ? void 0 : value.toFixed(2) : value) : (0, _CommonFunctions.getNumberWithCommas)(value), dotCut ? (0, _CommonFunctions.getFormattedUnits)(value) : '', /*#__PURE__*/_react.default.createElement(_FormattedValue.CurrencySignOrPercent, {
|
|
48
|
+
className: "CurrencySignOrPercent"
|
|
49
|
+
}, isPercent ? '%' : ''))), subtitle ? /*#__PURE__*/_react.default.createElement(_FormattedValue.Title, {
|
|
50
|
+
className: "Title",
|
|
51
|
+
width: width
|
|
52
|
+
}, subtitle) : '')));
|
|
53
|
+
};
|
|
54
|
+
exports.FormattedValue = FormattedValue;
|
|
55
|
+
var _default = exports.default = FormattedValue;
|
|
56
|
+
FormattedValue.defaultProps = {
|
|
57
|
+
className: 'FormattedValue_ControlsContainer',
|
|
58
|
+
title: '',
|
|
59
|
+
subtitle: '',
|
|
60
|
+
value: 0,
|
|
61
|
+
dotCut: false,
|
|
62
|
+
currencySign: false,
|
|
63
|
+
currencyType: 'USD',
|
|
64
|
+
width: '100%',
|
|
65
|
+
height: '100%',
|
|
66
|
+
textcolor: '#212121',
|
|
67
|
+
isPercent: false
|
|
68
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.TitleAndValueContainer = exports.Title = exports.FormattedValueText = exports.CurrencySignOrPercent = exports.CurrencySignAndFormattedValueContainer = 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;
|
|
11
|
+
const scrollableStyles = "\n overflow-y: auto;\n\n &::-webkit-scrollbar {\n width: 8px;\n }\n\n &::-webkit-scrollbar-track {\n background: #E8E8E8;\n border-radius: 5px;\n }\n\n &::-webkit-scrollbar-thumb {\n background: #D0D0D0;\n border-radius: 5px;\n }\n";
|
|
12
|
+
const 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-weight: 500;\n font-size: 20px;\n color: ", ";\n width: ", ";\n height: ", ";\n display: flex;\n align-items: center;\n @media (max-width: 1536px) {\n ", "\n }\n\n > * {\n box-sizing: border-box;\n }\n"])), props => props.textcolor, props => props.width, props => props.height, scrollableStyles);
|
|
13
|
+
const Controls = exports.Controls = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n background: white; \n"])));
|
|
14
|
+
const TitleAndValueContainer = exports.TitleAndValueContainer = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column; \n"])));
|
|
15
|
+
const Title = exports.Title = _styledComponents.default.h4(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size: 20px;\n margin: 0;\n @media (max-width: 1536px) {\n font-size: 14px;\n }\n @media (max-width: 1366px) {\n font-size: 10px;\n }\n"])));
|
|
16
|
+
const CurrencySignAndFormattedValueContainer = exports.CurrencySignAndFormattedValueContainer = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n gap: 16px;\n"])));
|
|
17
|
+
const CurrencySignOrPercent = exports.CurrencySignOrPercent = _styledComponents.default.span(_templateObject6 || (_templateObject6 = (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"])));
|
|
18
|
+
const FormattedValueText = exports.FormattedValueText = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n font-weight: 500;\n font-size: 40px;\n @media (max-width: 1536px) {\n font-size: 34px;\n }\n @media (max-width: 1366px) {\n font-size: 28px;\n }\n"])));
|