sag_components 1.0.972 → 1.0.974

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.
@@ -9,64 +9,112 @@ require("@testing-library/jest-dom");
9
9
  /* eslint-disable import/no-unresolved */
10
10
  /* eslint-disable no-undef */
11
11
 
12
- test('SingleBarLineCharts Check if data is rendered', () => {
13
- const data = [{
14
- retailer: 'Retailer 1',
15
- offerType: 'Offer 1',
16
- period: 'Period 1',
17
- lineValue: 10,
18
- barValue: 20,
19
- secondBarValue: 30
20
- }, {
21
- retailer: 'Retailer 2',
22
- offerType: 'Offer 2',
23
- period: 'Period 2',
24
- lineValue: 15,
25
- barValue: 25,
26
- secondBarValue: 35
27
- }];
12
+ const data = [{
13
+ retailer: 'Food Lion',
14
+ period: '15.01.24-31.01.24',
15
+ lineValue: 23.6,
16
+ barValue: 82.11,
17
+ secondBarValue: -138
18
+ }, {
19
+ retailer: 'Hannaford',
20
+ period: '02.01.24-15.01.24',
21
+ lineValue: -4.6,
22
+ barValue: -149.9,
23
+ secondBarValue: 51.94
24
+ }];
25
+ const totalsData1 = [{
26
+ value: 374,
27
+ sign: '$',
28
+ extraInfo: []
29
+ }, {
30
+ value: 1.6,
31
+ sign: '',
32
+ extraInfo: []
33
+ }];
34
+ const legendData1 = [{
35
+ iconColor: '#1F7677',
36
+ iconType: 'Square',
37
+ title: 'Dark Green'
38
+ }, {
39
+ iconColor: '#90CE9C',
40
+ iconType: 'Square',
41
+ title: 'Light Green'
42
+ }, {
43
+ iconColor: '#e89e68',
44
+ iconType: 'LegendUnionIcon',
45
+ title: 'Incremental Sales ROI'
46
+ }];
47
+ test('SingleBarLineCharts Check if title data is rendered', async () => {
28
48
  (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_SingleBarLineCharts.default, {
29
49
  width: "100%",
30
50
  height: "100%",
51
+ title: "Total Cost Sales",
52
+ data: data,
53
+ totalsData: totalsData1,
54
+ legendData: legendData1,
55
+ maxBarRange: 1.3,
56
+ lineRange: 3,
57
+ barSize: 60,
31
58
  barChartColor: "#1F7677",
32
59
  secondBarChartColor: "#90CE9C",
33
- barChartHeight: 250,
60
+ barChartHeight: 255,
34
61
  tooltipBarchartLabel: "Label",
35
- lineChartHeight: 50,
62
+ lineChartHeight: 85,
63
+ isLineChartCurrency: false,
64
+ setLineChartTooltip: true,
36
65
  lineChartColor: "#1F7677",
37
66
  isLineChartPercent: false,
38
67
  isLineChartBolded: false,
39
68
  isTopBarPercent: true,
69
+ showSecondBar: true,
70
+ showPeriod: true,
40
71
  currencySign: "\u20AC",
41
- data: data,
42
- totalsData: [],
43
- legendData: [],
44
- noDataText: "No data"
72
+ noDataText: "No data",
73
+ currencySignLine: ""
45
74
  }));
46
- const retailer1Element = _react2.screen.getByText(/Retailer 1/i);
47
- const retailer2Element = _react2.screen.getByText(/Retailer 2/i);
48
- expect(retailer1Element).toBeInTheDocument();
49
- expect(retailer2Element).toBeInTheDocument();
75
+
76
+ // Use findByText to handle async rendering
77
+ const titleElement = await _react2.screen.findByText(content => content.includes('Total Cost Sales'));
78
+ const total1Element = await _react2.screen.findByText(content => content.includes('374'));
79
+ const total2Element = await _react2.screen.findByText(content => content.includes('1.6'));
80
+ expect(titleElement).toBeInTheDocument();
81
+ expect(total1Element).toBeInTheDocument();
82
+ expect(total2Element).toBeInTheDocument();
50
83
  });
51
- test('SingleBarLineCharts Check if no data message is rendered', () => {
84
+ test('SingleBarLineCharts Check if legend data is rendered', async () => {
52
85
  (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_SingleBarLineCharts.default, {
53
86
  width: "100%",
54
87
  height: "100%",
88
+ title: "Total Cost Sales",
89
+ data: data,
90
+ totalsData: totalsData1,
91
+ legendData: legendData1,
92
+ maxBarRange: 1.3,
93
+ lineRange: 3,
94
+ barSize: 60,
55
95
  barChartColor: "#1F7677",
56
96
  secondBarChartColor: "#90CE9C",
57
- barChartHeight: 250,
97
+ barChartHeight: 255,
58
98
  tooltipBarchartLabel: "Label",
59
- lineChartHeight: 50,
99
+ lineChartHeight: 85,
100
+ isLineChartCurrency: false,
101
+ setLineChartTooltip: true,
60
102
  lineChartColor: "#1F7677",
61
103
  isLineChartPercent: false,
62
104
  isLineChartBolded: false,
63
105
  isTopBarPercent: true,
106
+ showSecondBar: true,
107
+ showPeriod: true,
64
108
  currencySign: "\u20AC",
65
- data: [],
66
- totalsData: [],
67
- legendData: [],
68
- noDataText: "No data"
109
+ noDataText: "No data",
110
+ currencySignLine: ""
69
111
  }));
70
- const noDataElement = _react2.screen.getByText(/No data/i);
71
- expect(noDataElement).toBeInTheDocument();
112
+
113
+ // Use findByText to handle async rendering
114
+ const legend1Element = await _react2.screen.findByText(content => content.includes('Dark Green'));
115
+ const legend2Element = await _react2.screen.findByText(content => content.includes('Light Green'));
116
+ const legend3Element = await _react2.screen.findByText(content => content.includes('Incremental Sales ROI'));
117
+ expect(legend1Element).toBeInTheDocument();
118
+ expect(legend2Element).toBeInTheDocument();
119
+ expect(legend3Element).toBeInTheDocument();
72
120
  });
@@ -1,3 +1,17 @@
1
1
  "use strict";
2
2
 
3
- require("@testing-library/jest-dom");
3
+ require("@testing-library/jest-dom");
4
+ // src/setupTests.js
5
+
6
+ // eslint-disable-next-line import/no-extraneous-dependencies
7
+
8
+ global.ResizeObserver = class {
9
+ // eslint-disable-next-line class-methods-use-this
10
+ observe() {}
11
+
12
+ // eslint-disable-next-line class-methods-use-this
13
+ unobserve() {}
14
+
15
+ // eslint-disable-next-line class-methods-use-this
16
+ disconnect() {}
17
+ };
@@ -34,7 +34,8 @@ const BannerEventBoxList = props => {
34
34
  linkText,
35
35
  disableToggle,
36
36
  bannerWidth,
37
- loaderColor
37
+ loaderColor,
38
+ showDraft
38
39
  } = props;
39
40
  const [IsItemOpen, setIsItemOpen] = (0, _react.useState)(false);
40
41
  const handleToggle = () => {
@@ -95,7 +96,7 @@ const BannerEventBoxList = props => {
95
96
  onInfoClick: () => retailerFile(item === null || item === void 0 ? void 0 : item.banner),
96
97
  disabled: item === null || item === void 0 ? void 0 : item.disabled,
97
98
  buttonText: item.buttonText
98
- }))) : children));
99
+ })), showDraft && /*#__PURE__*/_react.default.createElement(_BannerEventBoxList.DraftTag, null, "DRAFT")) : children));
99
100
  };
100
101
  BannerEventBoxList.defaultProps = {
101
102
  className: '',
@@ -146,6 +147,7 @@ BannerEventBoxList.defaultProps = {
146
147
  disableToggle: true,
147
148
  children: null,
148
149
  bannerWidth: 'auto',
149
- loaderColor: '#212121'
150
+ loaderColor: '#212121',
151
+ showDraft: false
150
152
  };
151
153
  var _default = exports.default = BannerEventBoxList;
@@ -4,7 +4,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.ToggleContainer = exports.SubDetails = exports.ProductName = exports.MainDetails = exports.MainContainer = exports.LoaderWrapper = exports.Loader = exports.CollapseMenuItemMainContainer = exports.CollapseMenuItemContentContainer = exports.CollapseMenuItemContainer = exports.BannerIcon = void 0;
7
+ exports.ToggleContainer = exports.SubDetails = exports.ProductName = exports.MainDetails = exports.MainContainer = exports.LoaderWrapper = exports.Loader = exports.DraftTag = exports.CollapseMenuItemMainContainer = exports.CollapseMenuItemContentContainer = exports.CollapseMenuItemContainer = exports.BannerIcon = void 0;
8
8
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
9
  const CollapseMenuItemMainContainer = exports.CollapseMenuItemMainContainer = _styledComponents.default.div`
10
10
  font-family: "Poppins", sans-serif;
@@ -179,4 +179,11 @@ const MainContainer = exports.MainContainer = _styledComponents.default.div`
179
179
  display: flex;
180
180
  gap: 20px;
181
181
  padding: 20px 0 4px;
182
+ `;
183
+ const DraftTag = exports.DraftTag = _styledComponents.default.div`
184
+ color: #E41111;
185
+ border: 2px solid #E41111;
186
+ font-size: 20px;
187
+ padding: 6px 18px;
188
+ height: fit-content;
182
189
  `;
@@ -20,7 +20,7 @@ const QuickFilterInput = exports.QuickFilterInput = _styledComponents.default.di
20
20
  const Label = exports.Label = _styledComponents.default.label`
21
21
  font-size: 14px;
22
22
  font-weight: 500;
23
- color: #212121;
23
+ color: ${props => props.disabled ? "#D0D0D0" : "212121"};
24
24
  font-family: "Poppins";
25
25
  white-space: nowrap;
26
26
  `;
@@ -71,7 +71,7 @@ const StyledInput = exports.StyledInput = _styledComponents.default.input`
71
71
  border: none;
72
72
  background-color: transparent;
73
73
  &::placeholder {
74
- color: #b1b1b1;
74
+ color: ${props => props.disabled ? "#D0D0D0" : "#b1b1b1"};
75
75
  }
76
76
  `;
77
77
  const OptionsContainer = exports.OptionsContainer = _styledComponents.default.div`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sag_components",
3
- "version": "1.0.972",
3
+ "version": "1.0.974",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {