sag_components 1.0.1068 → 1.0.1069

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.
Files changed (32) hide show
  1. package/dist/Button.test.js +10 -10
  2. package/dist/LinkButton.test.js +10 -10
  3. package/dist/SingleBar.test.js +2 -2
  4. package/dist/index.js +1 -1
  5. package/dist/setupTests.js +1 -3
  6. package/dist/stories/CampaignTool/PopupContent.stories.js +284 -0
  7. package/dist/stories/components/BannerEventBoxTest.js +42 -0
  8. package/dist/stories/components/BannerEventBoxTest.style.js +11 -0
  9. package/dist/stories/components/CampaignTool/Card.style.js +0 -2
  10. package/dist/stories/components/CampaignTool/MultipleCard.style.js +0 -2
  11. package/dist/stories/components/CampaignTool/PopupFieldsRules.js +44 -44
  12. package/dist/stories/components/CampaignTool/Table.style.js +0 -2
  13. package/dist/stories/components/FilterButton.js +53 -0
  14. package/dist/stories/components/FilterButton.style.js +12 -0
  15. package/dist/stories/components/LinnerDataBox.js +1 -0
  16. package/dist/stories/components/Modal.style.js +0 -2
  17. package/dist/stories/components/NewInput.js +33 -0
  18. package/dist/stories/components/NewInput.style.js +13 -0
  19. package/dist/stories/components/QuickFilterDropdownMultiSelection.js +1 -1
  20. package/dist/stories/components/QuickFilterDropdownSingle.js +1 -1
  21. package/dist/stories/components/QuickFilterDropdownSingle.style.js +13 -13
  22. package/dist/stories/components/ReportTable.js +6 -6
  23. package/dist/stories/components/ReportTable.style.js +2 -2
  24. package/dist/stories/components/SalesSplit.js +153 -0
  25. package/dist/stories/components/SalesSplit.style.js +150 -0
  26. package/dist/stories/components/SingleBarLineCharts.js +137 -56
  27. package/dist/stories/components/TabMenu.style.js +1 -2
  28. package/dist/stories/components/TotalBenchmark.style.js +0 -2
  29. package/dist/stories/components/icons/TheGiantCompanyIcon_old.js +1831 -0
  30. package/dist/stories/utils/IconsHandler.style.js +0 -1
  31. package/dist/vite.config.js +15 -0
  32. package/package.json +1 -1
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _framerMotion = require("framer-motion");
10
+ var _SalesSplit = require("./SalesSplit.style");
11
+ var _NoDataFoundMessage = require("./NoDataFoundMessage");
12
+ const SalesSplit = props => {
13
+ const {
14
+ title,
15
+ data,
16
+ lowLimit,
17
+ barHeight
18
+ } = props;
19
+ const [tooltip, setTooltip] = (0, _react.useState)(null);
20
+ const [barHeightState, setBarHeightState] = (0, _react.useState)(barHeight);
21
+ const barRefs = (0, _react.useRef)([]); // Array to store refs for each bar
22
+ const barsContainerRef = (0, _react.useRef)(null);
23
+ const [tooltipPosition, setTooltipPosition] = (0, _react.useState)({
24
+ x: 0,
25
+ y: 0
26
+ });
27
+
28
+ // Filter data based on lowLimit
29
+ const filteredData = data.filter(item => item.value >= lowLimit);
30
+
31
+ // Calculate the total value of all bars
32
+ const totalValue = filteredData.reduce((sum, item) => sum + item.value, 0);
33
+
34
+ // Reset tooltip when height changes
35
+ (0, _react.useEffect)(() => {
36
+ setBarHeightState(barHeight);
37
+ setTooltip(null);
38
+ }, [barHeight]);
39
+
40
+ // Function to render Tooltip
41
+ const renderTooltip = item => {
42
+ if (tooltip && tooltipPosition && tooltip.label === `${item.label} - ${Math.round(item.value / totalValue * 100)}%`) {
43
+ const top = `${tooltipPosition.y}px`;
44
+ const left = `${tooltipPosition.x - 10}px`;
45
+ return /*#__PURE__*/_react.default.createElement(_SalesSplit.TooltipContainer, {
46
+ className: "TooltipContainer",
47
+ top: top,
48
+ left: left
49
+ }, item.label, ' ', "-", ' ', /*#__PURE__*/_react.default.createElement("span", null, Math.round(item.value / totalValue * 100), "%"));
50
+ }
51
+ return null;
52
+ };
53
+
54
+ // Function to render the bars and BarsContainer
55
+ const renderBars = () => /*#__PURE__*/_react.default.createElement(_SalesSplit.BarsContainer, {
56
+ ref: barsContainerRef,
57
+ className: "BarsContainer",
58
+ height: barHeightState
59
+ }, filteredData.map((item, index) => {
60
+ const barWidth = item.value / totalValue * 100;
61
+ return /*#__PURE__*/_react.default.createElement(_SalesSplit.BarWrapper, {
62
+ className: "BarWrapper"
63
+ // eslint-disable-next-line react/no-array-index-key
64
+ ,
65
+ key: index,
66
+ width: `${barWidth}%`,
67
+ height: barHeightState
68
+ }, /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, null, /*#__PURE__*/_react.default.createElement(_SalesSplit.BarContainer, {
69
+ ref: el => {
70
+ barRefs.current[index] = el;
71
+ } // Attach ref
72
+ ,
73
+ className: "BarContainer",
74
+ height: barHeightState,
75
+ color: item.color,
76
+ initial: {
77
+ width: '0%'
78
+ },
79
+ animate: {
80
+ width: '100%'
81
+ },
82
+ exit: {
83
+ width: '0%'
84
+ },
85
+ transition: {
86
+ duration: 0.4
87
+ },
88
+ onMouseEnter: e => {
89
+ var _barRefs$current$inde;
90
+ const barRect = (_barRefs$current$inde = barRefs.current[index]) === null || _barRefs$current$inde === void 0 ? void 0 : _barRefs$current$inde.getBoundingClientRect();
91
+ if (barRect && e.clientX > barRect.x && e.clientX < barRect.x + barRect.width && e.clientY > barRect.y && e.clientY < barRect.y + barRect.height) {
92
+ setTooltip({
93
+ label: `${item.label} - ${Math.round(item.value / totalValue * 100)}%`
94
+ });
95
+ setTooltipPosition({
96
+ x: e.clientX,
97
+ y: e.clientY
98
+ });
99
+ }
100
+ },
101
+ onMouseLeave: e => {
102
+ var _barRefs$current$inde2;
103
+ const barRect = (_barRefs$current$inde2 = barRefs.current[index]) === null || _barRefs$current$inde2 === void 0 ? void 0 : _barRefs$current$inde2.getBoundingClientRect();
104
+ if (!barRect || e.clientX < barRect.x || e.clientX > barRect.x + barRect.width || e.clientY < barRect.y || e.clientY > barRect.y + barRect.height) {
105
+ setTooltip(null);
106
+ }
107
+ },
108
+ onMouseMove: e => {
109
+ var _barRefs$current$inde3;
110
+ const barRect = (_barRefs$current$inde3 = barRefs.current[index]) === null || _barRefs$current$inde3 === void 0 ? void 0 : _barRefs$current$inde3.getBoundingClientRect();
111
+ if (barRect && e.clientX > barRect.x && e.clientX < barRect.x + barRect.width && e.clientY > barRect.y && e.clientY < barRect.y + barRect.height) {
112
+ setTooltipPosition({
113
+ x: e.clientX,
114
+ y: e.clientY
115
+ });
116
+ }
117
+ }
118
+ }, /*#__PURE__*/_react.default.createElement(_SalesSplit.BarLabel, {
119
+ className: "BarLabel"
120
+ }, Math.round(item.value / totalValue * 100), "%")), renderTooltip(item)));
121
+ }));
122
+
123
+ // Function to render the Legend Area
124
+ const renderLegend = () => /*#__PURE__*/_react.default.createElement(_SalesSplit.LegendContainer, {
125
+ className: "LegendContainer"
126
+ }, filteredData.map((item, index) =>
127
+ /*#__PURE__*/
128
+ // eslint-disable-next-line react/no-array-index-key
129
+ _react.default.createElement(_SalesSplit.LegendItem, {
130
+ className: "LegendItem",
131
+ key: index
132
+ }, /*#__PURE__*/_react.default.createElement(_SalesSplit.LegendColorBox, {
133
+ className: "LegendColorBox",
134
+ style: {
135
+ backgroundColor: item.color
136
+ }
137
+ }), /*#__PURE__*/_react.default.createElement(_SalesSplit.LegendLabel, {
138
+ className: "LegendLabel"
139
+ }, item.label))));
140
+ return /*#__PURE__*/_react.default.createElement(_SalesSplit.SalesSplitContainer, {
141
+ className: "SalesSplitContainer"
142
+ }, !data || data.length === 0 ? /*#__PURE__*/_react.default.createElement(_NoDataFoundMessage.NoDataFoundMessage, {
143
+ className: "NoDataFoundMessage",
144
+ noDataText: ""
145
+ }) : /*#__PURE__*/_react.default.createElement(_SalesSplit.SalesSplitWrapper, {
146
+ className: "SalesSplitWrapper"
147
+ }, /*#__PURE__*/_react.default.createElement(_SalesSplit.TitleContainer, {
148
+ className: "TitleContainer"
149
+ }, /*#__PURE__*/_react.default.createElement(_SalesSplit.Title, {
150
+ className: "Title"
151
+ }, title)), renderBars(), renderLegend()));
152
+ };
153
+ var _default = exports.default = SalesSplit;
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.TooltipContainer = exports.TitleContainer = exports.Title = exports.SalesSplitWrapper = exports.SalesSplitContainer = exports.LegendLabel = exports.LegendItem = exports.LegendContainer = exports.LegendColorBox = exports.BarsContainer = exports.BarWrapper = exports.BarLabel = exports.BarContainer = void 0;
8
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
9
+ var _framerMotion = require("framer-motion");
10
+ const SalesSplitContainer = exports.SalesSplitContainer = _styledComponents.default.div`
11
+
12
+ display: flex;
13
+ flex-direction: column;
14
+ justify-content: flex-start;
15
+ position: relative;
16
+ height: ${props => props.height};
17
+ width: 100%;
18
+ font-family: "Poppins", sans-serif;
19
+
20
+ `;
21
+
22
+ // Wrapper with padding
23
+ const SalesSplitWrapper = exports.SalesSplitWrapper = _styledComponents.default.div`
24
+ display: flex;
25
+ flex-direction: column;
26
+ padding: 20px;
27
+ height: ${props => props.height};
28
+ `;
29
+ const TitleContainer = exports.TitleContainer = _styledComponents.default.div`
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: flex-start;
33
+ margin: 0 0 10px 0;
34
+ `;
35
+ const Title = exports.Title = _styledComponents.default.h3`
36
+ user-select: none;
37
+ text-align: left;
38
+ margin: 0;
39
+ font-family: "Poppins", sans-serif;
40
+ font-weight: 400;
41
+ font-size: 18px;
42
+ @media (max-width: 1536px) {
43
+ font-size: 16px;
44
+ }
45
+ @media (max-width: 1366px) {
46
+ font-size: 14px;
47
+ }
48
+ `;
49
+ const BarsContainer = exports.BarsContainer = _styledComponents.default.div`
50
+ display: flex;
51
+ align-items: center;
52
+ justify-content: flex-start;
53
+ width: 100%;
54
+ height: ${props => props.height};
55
+ `;
56
+ const BarWrapper = exports.BarWrapper = _styledComponents.default.div`
57
+ display: flex;
58
+ flex-direction: column;
59
+ /* align-items: center; */
60
+ justify-content: flex-start;
61
+ align-items: stretch; /* Ensures full vertical stretch */
62
+ width: ${props => props.width};
63
+ height: ${props => props.height};
64
+ `;
65
+ const BarContainer = exports.BarContainer = (0, _styledComponents.default)(_framerMotion.motion.div)`
66
+ background-color: ${props => props.color};
67
+ display: flex;
68
+ align-items: center;
69
+ justify-content: center;
70
+ height: ${props => props.height};
71
+ width: 0%; /* Starts at 0% for animation */
72
+ `;
73
+ const BarLabel = exports.BarLabel = _styledComponents.default.span`
74
+ color: white;
75
+ font-size: 14px;
76
+ font-weight: 400;
77
+ user-select: none;
78
+ `;
79
+ const TooltipContainer = exports.TooltipContainer = _styledComponents.default.div`
80
+ position: absolute;
81
+
82
+ top: ${props => props.top};
83
+ left: ${props => props.left};
84
+ transition: left 0.8s ease, top 0.8s ease;
85
+
86
+ background-color: white;
87
+ box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
88
+ font-weight: 400;
89
+ font-size: 14px;
90
+ line-height: 21px;
91
+ padding: 8px 12px;
92
+ border-radius: 4px;
93
+ z-index: 10;
94
+ font-family: "Poppins", sans-serif;
95
+ user-select: none;
96
+
97
+ // Make the percentage bold
98
+ span {
99
+ font-weight: bold;
100
+ }
101
+
102
+ // treeangle on the bottom
103
+ /* &:before {
104
+ content: "";
105
+ position: absolute;
106
+ bottom: -12px;
107
+ left: 50%;
108
+ transform: translateX(-50%);
109
+ width: 0;
110
+ height: 0;
111
+ border-left: 8px solid transparent;
112
+ border-right: 8px solid transparent;
113
+ border-top: 12px solid white;
114
+ } */
115
+ `;
116
+ const LegendContainer = exports.LegendContainer = _styledComponents.default.div`
117
+ display: flex;
118
+ align-items: center;
119
+ justify-content: center;
120
+ flex-wrap: wrap;
121
+ gap: 24px;
122
+ margin-top: 10px;
123
+ width: 100%;
124
+ flex-shrink: 0;
125
+ `;
126
+ const LegendItem = exports.LegendItem = _styledComponents.default.div`
127
+ display: flex;
128
+ align-items: center;
129
+ margin-right: 15px;
130
+ `;
131
+ const LegendColorBox = exports.LegendColorBox = _styledComponents.default.div`
132
+ width: 16px;
133
+ height: 16px;
134
+ margin-right: 8px;
135
+ background-color: ${props => props.color};
136
+ border-radius: 2px;
137
+ `;
138
+ const LegendLabel = exports.LegendLabel = _styledComponents.default.span`
139
+ user-select: none;
140
+ font-family: "Poppins", sans-serif;
141
+ color: #212121;
142
+ font-weight: 400;
143
+ font-size: 14px;
144
+ @media (max-width: 1536px) {
145
+ font-size: 12px;
146
+ }
147
+ @media (max-width: 1366px) {
148
+ font-size: 10px;
149
+ }
150
+ `;
@@ -16,35 +16,63 @@ var _CommonFunctions = require("./CommonFunctions");
16
16
  /* eslint-disable no-shadow */
17
17
  /* eslint-disable react/prop-types */
18
18
 
19
- const SingleBarLineCharts = props => {
19
+ const SingleBarLineCharts = _ref => {
20
20
  var _legendData$find, _legendData$find2, _legendData$filter$, _legendData$filter$2;
21
- const {
22
- className,
23
- width,
24
- height,
25
- title,
26
- data,
27
- totalsData,
28
- showLegend,
29
- legendData,
30
- maxBarRange,
31
- showLineChart,
32
- lineRange,
33
- lineFontSizeValue,
34
- barFontSizeValue,
35
- barSize,
36
- barChartHeight,
37
- lineChartHeight,
38
- isLineChartCurrency,
39
- isLineChartBolded,
40
- setLineChartTooltip,
41
- isTopBarPercent,
42
- showSecondBar,
43
- showPeriod,
44
- currencySignLine,
45
- currencySign,
46
- noDataText
47
- } = props;
21
+ let {
22
+ className = '',
23
+ width = '100%',
24
+ height = '100%',
25
+ title = '',
26
+ data = [],
27
+ totalsData = [],
28
+ showLegend = true,
29
+ legendData = [],
30
+ maxBarRange = 1,
31
+ showLineChart = true,
32
+ lineRange = 1,
33
+ lineFontSizeValue = '0.6em',
34
+ barFontSizeValue = '0.6em',
35
+ barSize = 60,
36
+ barChartHeight = 250,
37
+ lineChartHeight = 50,
38
+ isLineChartCurrency = false,
39
+ isLineChartBolded = false,
40
+ setLineChartTooltip = false,
41
+ isTopBarPercent = true,
42
+ showSecondBar = true,
43
+ showPeriod = true,
44
+ currencySign = '€',
45
+ currencySignLine = '€',
46
+ noDataText = 'No data'
47
+ } = _ref;
48
+ // const {
49
+ // className,
50
+ // width,
51
+ // height,
52
+ // title,
53
+ // data,
54
+ // totalsData,
55
+ // showLegend,
56
+ // legendData,
57
+ // maxBarRange,
58
+ // showLineChart,
59
+ // lineRange,
60
+ // lineFontSizeValue,
61
+ // barFontSizeValue,
62
+ // barSize,
63
+ // barChartHeight,
64
+ // lineChartHeight,
65
+ // isLineChartCurrency,
66
+ // isLineChartBolded,
67
+ // setLineChartTooltip,
68
+ // isTopBarPercent,
69
+ // showSecondBar,
70
+ // showPeriod,
71
+ // currencySignLine,
72
+ // currencySign,
73
+ // noDataText,
74
+ // } = props;
75
+
48
76
  const [showLegendTooltip, setShowLegendTooltip] = (0, _react.useState)(false);
49
77
  const [tooltipCouponText, setTooltipCouponText] = (0, _react.useState)({
50
78
  content: '',
@@ -304,31 +332,84 @@ const SingleBarLineCharts = props => {
304
332
  }));
305
333
  };
306
334
  exports.SingleBarLineCharts = SingleBarLineCharts;
307
- var _default = exports.default = SingleBarLineCharts;
308
- SingleBarLineCharts.defaultProps = {
309
- className: '',
310
- width: '100%',
311
- height: '100%',
312
- title: '',
313
- data: [],
314
- totalsData: [],
315
- showLegend: true,
316
- legendData: [],
317
- maxBarRange: 1,
318
- showLineChart: true,
319
- lineRange: 1,
320
- lineFontSizeValue: '0.6em',
321
- barFontSizeValue: '0.6em',
322
- barSize: 60,
323
- barChartHeight: 250,
324
- lineChartHeight: 50,
325
- isLineChartCurrency: false,
326
- isLineChartBolded: false,
327
- setLineChartTooltip: false,
328
- isTopBarPercent: true,
329
- showSecondBar: true,
330
- showPeriod: true,
331
- currencySign: '€',
332
- currencySignLine: '€',
333
- noDataText: 'No data'
334
- };
335
+ var _default = exports.default = SingleBarLineCharts; // SingleBarLineCharts.propTypes = {
336
+ // className: PropTypes.string,
337
+ // width: PropTypes.string,
338
+ // height: PropTypes.string,
339
+ // title: PropTypes.string,
340
+ // data: PropTypes.arrayOf(
341
+ // PropTypes.shape({
342
+ // retailer: PropTypes.string,
343
+ // offerType: PropTypes.string,
344
+ // period: PropTypes.string,
345
+ // lineValue: PropTypes.number,
346
+ // barValue: PropTypes.number,
347
+ // secondBarValue: PropTypes.number,
348
+ // }),
349
+ // ),
350
+ // totalsData: PropTypes.arrayOf(
351
+ // PropTypes.shape({
352
+ // title: PropTypes.string,
353
+ // value: PropTypes.number,
354
+ // sign: PropTypes.string,
355
+ // extraInfo: PropTypes.arrayOf(
356
+ // PropTypes.shape({
357
+ // title: PropTypes.string,
358
+ // value: PropTypes.number,
359
+ // }),
360
+ // ),
361
+ // }),
362
+ // ),
363
+ // showLegend: PropTypes.bool,
364
+ // legendData: PropTypes.arrayOf(
365
+ // PropTypes.shape({
366
+ // iconColor: PropTypes.string,
367
+ // iconType: PropTypes.string,
368
+ // title: PropTypes.string,
369
+ // }),
370
+ // ),
371
+ // maxBarRange: PropTypes.number,
372
+ // showLineChart: PropTypes.bool,
373
+ // lineRange: PropTypes.number,
374
+ // lineFontSizeValue: PropTypes.string,
375
+ // barFontSizeValue: PropTypes.string,
376
+ // barSize: PropTypes.number,
377
+ // barChartHeight: PropTypes.number,
378
+ // lineChartHeight: PropTypes.number,
379
+ // isLineChartCurrency: PropTypes.bool,
380
+ // isLineChartBolded: PropTypes.bool,
381
+ // setLineChartTooltip: PropTypes.bool,
382
+ // isTopBarPercent: PropTypes.bool,
383
+ // showSecondBar: PropTypes.bool,
384
+ // showPeriod: PropTypes.bool,
385
+ // currencySign: PropTypes.string,
386
+ // currencySignLine: PropTypes.string,
387
+ // noDataText: PropTypes.string,
388
+ // };
389
+ // SingleBarLineCharts.defaultProps = {
390
+ // className: '',
391
+ // width: '100%',
392
+ // height: '100%',
393
+ // title: '',
394
+ // data: [],
395
+ // totalsData: [],
396
+ // showLegend: true,
397
+ // legendData: [],
398
+ // maxBarRange: 1,
399
+ // showLineChart: true,
400
+ // lineRange: 1,
401
+ // lineFontSizeValue: '0.6em',
402
+ // barFontSizeValue: '0.6em',
403
+ // barSize: 60,
404
+ // barChartHeight: 250,
405
+ // lineChartHeight: 50,
406
+ // isLineChartCurrency: false,
407
+ // isLineChartBolded: false,
408
+ // setLineChartTooltip: false,
409
+ // isTopBarPercent: true,
410
+ // showSecondBar: true,
411
+ // showPeriod: true,
412
+ // currencySign: '€',
413
+ // currencySignLine: '€',
414
+ // noDataText: 'No data',
415
+ // };
@@ -59,8 +59,7 @@ const Tab = exports.Tab = _styledComponents.default.div`
59
59
  &.active {
60
60
  font-weight: 600;
61
61
  color: ${props => props.color};
62
- border-bottom: 1mm solid #229E38;
63
- //2px solid ${props => props.color};
62
+ border-bottom: 1mm solid ${props => props.color};
64
63
  }
65
64
  `;
66
65
  const PresentationSlider = exports.PresentationSlider = _styledComponents.default.div`
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.TitleAndValueContainer = exports.Title = exports.NoDataFoundContainer = exports.FormattedValueNoData = exports.FormattedValue = exports.ControlsContainer = exports.Controls = exports.BenchmarkContainerParent = exports.BenchmarkContainer = void 0;
8
8
  var _styledComponents = _interopRequireDefault(require("styled-components"));
9
- const MIN_HEIGHT = 300;
10
- const MIN_WIDTH = 260;
11
9
  const ControlsContainer = exports.ControlsContainer = _styledComponents.default.div`
12
10
  display: flex;
13
11
  position: relative;