sag_components 1.0.937 → 1.0.939

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.
@@ -22,22 +22,24 @@ const BarChartTwoRows = props => {
22
22
  const {
23
23
  className,
24
24
  title,
25
- barChartData,
26
- barSize,
27
- isDollar,
28
25
  width,
29
26
  height,
27
+ barChartHeight,
28
+ barSize,
29
+ barFontSizeValue,
30
+ barChartData,
30
31
  barChartColorFirst,
31
32
  barChartColorSecond,
32
- showLegend,
33
- legendData,
34
33
  showDollarSign,
34
+ isDollar,
35
35
  showReferenceLine,
36
36
  referenceLinePoint,
37
37
  referenceLineColor,
38
38
  referenceLineDashed,
39
39
  lowerValueLabel,
40
- highValueLabel
40
+ highValueLabel,
41
+ showLegend,
42
+ legendData
41
43
  } = props;
42
44
  const controlsContainerRef = (0, _react.useRef)();
43
45
  const displayFormattedValue = value => {
@@ -83,13 +85,18 @@ const BarChartTwoRows = props => {
83
85
  }, /*#__PURE__*/_react.default.createElement(_BarChartTwoRows.LabelBoldText, {
84
86
  textAnchor: "middle",
85
87
  x: "0",
86
- dy: "50",
88
+ dy: "30",
87
89
  fontSize: 16,
88
90
  fontWeight: 600
89
- }, payload.value), /*#__PURE__*/_react.default.createElement(_BarChartTwoRows.LabelText, {
91
+ }, payload.value)), /*#__PURE__*/_react.default.createElement("text", {
92
+ x: 0,
93
+ y: 0,
94
+ dy: 16,
95
+ fill: "#212121"
96
+ }, /*#__PURE__*/_react.default.createElement(_BarChartTwoRows.LabelText, {
90
97
  textAnchor: "middle",
91
98
  x: "0",
92
- dy: "30",
99
+ dy: "50",
93
100
  fontSize: 14,
94
101
  fontWeight: 400
95
102
  }, retailerData[0].date)));
@@ -110,7 +117,7 @@ const BarChartTwoRows = props => {
110
117
  y: y,
111
118
  dy: -8,
112
119
  fill: stroke,
113
- fontSize: "0.6em",
120
+ fontSize: barFontSizeValue,
114
121
  textAnchor: "middle"
115
122
  }, displayFormattedValue(value));
116
123
  };
@@ -119,18 +126,20 @@ const BarChartTwoRows = props => {
119
126
  height: height,
120
127
  width: width,
121
128
  ref: controlsContainerRef
122
- }, /*#__PURE__*/_react.default.createElement(_BarChartTwoRows.Controls, null, /*#__PURE__*/_react.default.createElement(_BarChartTwoRows.Title, null, title), /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, {
123
- width: "100%",
124
- height: "100%"
129
+ }, /*#__PURE__*/_react.default.createElement(_BarChartTwoRows.Controls, {
130
+ className: "Controls"
131
+ }, title !== '' && /*#__PURE__*/_react.default.createElement(_BarChartTwoRows.Title, null, title), /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, {
132
+ height: barChartHeight
125
133
  }, /*#__PURE__*/_react.default.createElement(_recharts.BarChart, {
126
134
  width: width,
127
135
  height: height,
128
136
  data: barChartData,
137
+ maxBarSize: 60,
129
138
  margin: {
130
139
  top: 20,
131
140
  right: 0,
132
- bottom: 0,
133
- left: -5
141
+ left: 0,
142
+ bottom: 20
134
143
  }
135
144
  }, showReferenceLine && /*#__PURE__*/_react.default.createElement(_recharts.ReferenceLine, {
136
145
  y: referenceLinePoint,
@@ -140,9 +149,9 @@ const BarChartTwoRows = props => {
140
149
  dataKey: "title",
141
150
  tick: CustomizedTickBarChart,
142
151
  tickLine: false,
143
- height: 120,
144
- stroke: "#D0D0D0",
145
- interval: 0
152
+ height: 80,
153
+ interval: 0,
154
+ stroke: "#D0D0D0"
146
155
  }), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, {
147
156
  content: /*#__PURE__*/_react.default.createElement(CustomTooltip, null)
148
157
  }), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, null), /*#__PURE__*/_react.default.createElement(_recharts.Bar, {
@@ -168,6 +177,27 @@ exports.BarChartTwoRows = BarChartTwoRows;
168
177
  var _default = exports.default = BarChartTwoRows;
169
178
  BarChartTwoRows.defaultProps = {
170
179
  title: 'String',
180
+ width: '100%',
181
+ height: '100%',
182
+ barChartHeight: 250,
183
+ barSize: 60,
184
+ barFontSizeValue: '0.6em',
185
+ barChartColorFirst: '#BD9EFF',
186
+ barChartColorSecond: '#0b00aaF',
187
+ showDollarSign: true,
188
+ isDollar: true,
189
+ showReferenceLine: false,
190
+ referenceLinePoint: 0,
191
+ referenceLineColor: '#212121',
192
+ referenceLineDashed: '5',
193
+ lowerValueLabel: 'Lower Value:',
194
+ highValueLabel: 'High Value:',
195
+ showLegend: true,
196
+ legendData: [{
197
+ title: 'Incremental Sales',
198
+ iconType: ICON_TYPE_SQUARE,
199
+ iconColor: '#BD9EFF'
200
+ }],
171
201
  barChartData: [{
172
202
  title: 'Food Lion',
173
203
  date: '15.01.24-31.01.24',
@@ -188,24 +218,5 @@ BarChartTwoRows.defaultProps = {
188
218
  title: 'Stop&Shop',
189
219
  date: '15.01.24-31.01.24',
190
220
  value: 415317
191
- }],
192
- width: '100%',
193
- height: '100%',
194
- barSize: 60,
195
- barChartColorFirst: '#BD9EFF',
196
- barChartColorSecond: '#0b00aaF',
197
- showDollarSign: true,
198
- isDollar: true,
199
- showLegend: true,
200
- legendData: [{
201
- title: 'Incremental Sales',
202
- iconType: ICON_TYPE_SQUARE,
203
- iconColor: '#BD9EFF'
204
- }],
205
- showReferenceLine: false,
206
- referenceLinePoint: 0,
207
- referenceLineColor: '#212121',
208
- referenceLineDashed: '5',
209
- lowerValueLabel: 'Lower Value:',
210
- highValueLabel: 'High Value:'
221
+ }]
211
222
  };
@@ -7,19 +7,45 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.TooltipTitle = exports.TooltipLabel = exports.TooltipDiv = exports.Title = exports.LabelText = exports.LabelBoldText = exports.ControlsContainer = exports.Controls = void 0;
8
8
  var _styledComponents = _interopRequireDefault(require("styled-components"));
9
9
  const ControlsContainer = exports.ControlsContainer = _styledComponents.default.div`
10
- position: relative;
11
10
  font-family: "Poppins", sans-serif;
12
- color: #212121;
13
11
  width: ${props => props.width};
14
12
  height: ${props => props.height};
15
- min-width: 250px;
13
+ border-radius: 12px;
14
+ align-self: center;
15
+ &.NoData {
16
+ align-self: center;
17
+ display: flex;
18
+ align-items: center;
19
+ width: 50%;
20
+ margin: 10% auto 0;
21
+ }
22
+ > * {
23
+ box-sizing: border-box;
24
+ }
16
25
  `;
17
26
  const Controls = exports.Controls = _styledComponents.default.div`
18
27
  height: 100%;
19
28
  width: 100%;
29
+ padding: 24px 40px;
20
30
  background: white;
21
31
  display: flex;
22
32
  flex-direction: column;
33
+ @media (max-width: 1536px) {
34
+ padding: 12px 32px;
35
+ }
36
+ `;
37
+ const Title = exports.Title = _styledComponents.default.span`
38
+ color: #212121;
39
+ display: inline-block;
40
+ font-size: 18px;
41
+ font-weight: 400;
42
+ margin-bottom: auto;
43
+ @media (max-width: 1536px) {
44
+ font-size: 16px;
45
+ }
46
+ @media (max-width: 1366px) {
47
+ font-size: 14px;
48
+ }
23
49
  `;
24
50
  const TooltipDiv = exports.TooltipDiv = _styledComponents.default.div`
25
51
  border-radius: 5px;
@@ -40,19 +66,6 @@ const TooltipTitle = exports.TooltipTitle = _styledComponents.default.div`
40
66
  font-size: 14px;
41
67
  font-weight: 600;
42
68
  `;
43
- const Title = exports.Title = _styledComponents.default.h5`
44
- font-weight: 500;
45
- font-size: 18px;
46
- line-height: 20px;
47
- margin: 0 0 30px;
48
- @media (max-width: 1536px) {
49
- font-size: 16px;
50
- margin: 0 0 20px;
51
- }
52
- @media (max-width: 1366px) {
53
- font-size: 14px;
54
- }
55
- `;
56
69
  const LabelBoldText = exports.LabelBoldText = _styledComponents.default.tspan`
57
70
  font-size: 0.7em;
58
71
  `;
@@ -59,7 +59,7 @@ const getFormattedValue = num => {
59
59
  if (Math.abs(num) >= 1000) {
60
60
  return (num / 1000).toFixed(1).replace(/\.0$/, '');
61
61
  }
62
- return Number(num).toFixed(1);
62
+ return Number(num) % 1 === 0 ? num : Number(num).toFixed(1);
63
63
  };
64
64
  exports.getFormattedValue = getFormattedValue;
65
65
  const getNumberWithCommas = x => {
@@ -23,21 +23,25 @@ const SingleBarLineCharts = props => {
23
23
  width,
24
24
  height,
25
25
  title,
26
+ data,
27
+ totalsData,
28
+ showLegend,
29
+ legendData,
30
+ maxBarRange,
31
+ lineRange,
32
+ lineFontSizeValue,
33
+ barFontSizeValue,
26
34
  barSize,
27
- maxRange,
28
35
  barChartHeight,
29
36
  lineChartHeight,
30
- showSecondBar,
31
37
  isLineChartCurrency,
32
38
  isLineChartBolded,
33
39
  setLineChartTooltip,
34
40
  isTopBarPercent,
41
+ showSecondBar,
35
42
  showPeriod,
36
43
  currencySignLine,
37
44
  currencySign,
38
- data,
39
- totalsData,
40
- legendData,
41
45
  noDataText
42
46
  } = props;
43
47
  const [showLegendTooltip, setShowLegendTooltip] = (0, _react.useState)(false);
@@ -92,7 +96,7 @@ const SingleBarLineCharts = props => {
92
96
  x: x + width / 2,
93
97
  y: y - radius,
94
98
  fontWeight: 400,
95
- fontSize: "0.6em",
99
+ fontSize: barChartHeight,
96
100
  textAnchor: "middle"
97
101
  }, "0"));
98
102
  }
@@ -101,7 +105,7 @@ const SingleBarLineCharts = props => {
101
105
  x: x + width / 2,
102
106
  y: y - radius,
103
107
  fontWeight: 400,
104
- fontSize: "0.6em",
108
+ fontSize: barChartHeight,
105
109
  textAnchor: "middle",
106
110
  dominantBaseline: "middle"
107
111
  }, "N/A"));
@@ -110,7 +114,7 @@ const SingleBarLineCharts = props => {
110
114
  x: x + width / 2,
111
115
  y: y - radius,
112
116
  fontWeight: 400,
113
- fontSize: "0.6em",
117
+ fontSize: barChartHeight,
114
118
  textAnchor: "middle",
115
119
  dominantBaseline: "middle"
116
120
  }, `${currencySign}${(0, _CommonFunctions.getFormattedValue)(value)}${(0, _CommonFunctions.getFormattedUnits)(value)}${isTopBarPercent ? '%' : ''}`));
@@ -150,7 +154,7 @@ const SingleBarLineCharts = props => {
150
154
  textAnchor: "middle",
151
155
  x: "0",
152
156
  dy: "30",
153
- fontWeight: 500
157
+ fontWeight: 600
154
158
  }, retailerData[0].retailer)), showPeriod && /*#__PURE__*/_react.default.createElement("text", {
155
159
  x: 0,
156
160
  y: 0,
@@ -181,7 +185,7 @@ const SingleBarLineCharts = props => {
181
185
  dy: -8,
182
186
  fill: stroke,
183
187
  fontWeight: isLineChartBolded ? 600 : 400,
184
- fontSize: "0.6em",
188
+ fontSize: lineFontSizeValue,
185
189
  textAnchor: "middle"
186
190
  }, `${isLineChartCurrency ? currencySignLine : ''}${(0, _CommonFunctions.getFormattedValue)(value)}${(0, _CommonFunctions.getFormattedUnits)(value)}`);
187
191
  };
@@ -209,15 +213,15 @@ const SingleBarLineCharts = props => {
209
213
  data: data,
210
214
  margin: {
211
215
  top: 20,
212
- right: 100,
213
- left: 100,
214
- bottom: 10
216
+ right: 80,
217
+ left: 80,
218
+ bottom: 20
215
219
  }
216
220
  }, /*#__PURE__*/_react.default.createElement(_recharts.YAxis, {
217
221
  type: "number",
218
222
  width: 0,
219
223
  display: "none",
220
- domain: ['auto', dataMax => dataMax * maxRange],
224
+ domain: [dataMin => dataMin / lineRange, dataMax => dataMax * lineRange],
221
225
  allowDataOverflow: true
222
226
  }), /*#__PURE__*/_react.default.createElement(_recharts.Line, {
223
227
  type: "monotone",
@@ -235,24 +239,29 @@ const SingleBarLineCharts = props => {
235
239
  data: data,
236
240
  maxBarSize: 60,
237
241
  margin: {
238
- top: 30,
239
- right: 30,
240
- left: 30,
241
- bottom: 5
242
+ top: 20,
243
+ right: 0,
244
+ left: 0,
245
+ bottom: 20
242
246
  }
243
247
  }, /*#__PURE__*/_react.default.createElement(_recharts.XAxis, {
244
248
  dataKey: "retailer",
245
249
  tick: CustomizedTickBarChart,
246
250
  tickLine: false,
247
- height: 120,
251
+ height: 80,
248
252
  interval: 0,
249
253
  fill: "#212121"
250
254
  }), /*#__PURE__*/_react.default.createElement(_recharts.YAxis, {
251
255
  type: "number",
252
256
  width: 0,
253
257
  display: "none",
254
- domain: ['auto', dataMax => dataMax * maxRange],
255
- allowDataOverflow: true
258
+ allowDataOverflow: true,
259
+ domain: ['auto', dataMax => {
260
+ if (String(dataMax) === '-Infinity') {
261
+ return 0;
262
+ }
263
+ return dataMax * maxBarRange;
264
+ }]
256
265
  }), /*#__PURE__*/_react.default.createElement(_recharts.ReferenceLine, {
257
266
  y: 0,
258
267
  stroke: "#D0D0D0"
@@ -276,7 +285,7 @@ const SingleBarLineCharts = props => {
276
285
  fill: "#212121",
277
286
  dataKey: "secondBarValue",
278
287
  content: CustomizedLabelBarchart
279
- })))), /*#__PURE__*/_react.default.createElement(_PerformanceAnalyticsLegend.PerformanceAnalyticsLegend, {
288
+ })))), showLegend && /*#__PURE__*/_react.default.createElement(_PerformanceAnalyticsLegend.PerformanceAnalyticsLegend, {
280
289
  legendData: legendData
281
290
  })) : /*#__PURE__*/_react.default.createElement(_NoDataFoundMessage.NoDataFoundMessage, {
282
291
  noDataText: noDataText
@@ -286,9 +295,17 @@ exports.SingleBarLineCharts = SingleBarLineCharts;
286
295
  var _default = exports.default = SingleBarLineCharts;
287
296
  SingleBarLineCharts.defaultProps = {
288
297
  className: '',
289
- title: '',
290
298
  width: '100%',
291
299
  height: '100%',
300
+ title: '',
301
+ data: [],
302
+ totalsData: [],
303
+ showLegend: true,
304
+ legendData: [],
305
+ maxBarRange: 1,
306
+ lineRange: 1,
307
+ lineFontSizeValue: '0.6em',
308
+ barFontSizeValue: '0.6em',
292
309
  barSize: 60,
293
310
  barChartHeight: 250,
294
311
  lineChartHeight: 50,
@@ -296,13 +313,9 @@ SingleBarLineCharts.defaultProps = {
296
313
  isLineChartBolded: false,
297
314
  setLineChartTooltip: false,
298
315
  isTopBarPercent: true,
299
- maxRange: 1,
316
+ showSecondBar: true,
300
317
  showPeriod: true,
301
318
  currencySign: '€',
302
319
  currencySignLine: '€',
303
- showSecondBar: true,
304
- data: [],
305
- totalsData: [],
306
- legendData: [],
307
320
  noDataText: 'No data'
308
321
  };
@@ -26,22 +26,30 @@ const ControlsContainer = exports.ControlsContainer = _styledComponents.default.
26
26
  box-sizing: border-box;
27
27
  }
28
28
  `;
29
- const Title = exports.Title = _styledComponents.default.span`
30
- color: black;
31
- display: inline-block;
32
- font-size: 18px;
33
- font-weight: 400;
34
- margin-bottom: 12px;
35
- `;
36
29
  const Controls = exports.Controls = _styledComponents.default.div`
37
30
  width: 100%;
38
31
  height: 100%;
39
32
  padding: 24px 40px;
40
33
  background: white;
34
+ display: flex;
35
+ flex-direction: column;
41
36
  @media (max-width: 1536px) {
42
37
  padding: 12px 32px;
43
38
  }
44
39
  `;
40
+ const Title = exports.Title = _styledComponents.default.span`
41
+ color: #212121;
42
+ display: inline-block;
43
+ font-size: 18px;
44
+ font-weight: 400;
45
+ margin-bottom: auto;
46
+ @media (max-width: 1536px) {
47
+ font-size: 16px;
48
+ }
49
+ @media (max-width: 1366px) {
50
+ font-size: 14px;
51
+ }
52
+ `;
45
53
  const LinnerDataBoxWrap = exports.LinnerDataBoxWrap = (0, _styledComponents.default)(_LinnerDataBox.LinnerDataBox)`
46
54
  padding: 0 0 16px;
47
55
  .vertival-line {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sag_components",
3
- "version": "1.0.937",
3
+ "version": "1.0.939",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {