sag_components 1.0.721 → 1.0.724
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.
- package/dist/stories/components/BarChart.js +17 -4
- package/dist/stories/components/BarChartTwoRows.js +4 -10
- package/dist/stories/components/DropdownMultiNew.js +31 -7
- package/dist/stories/components/DropdownNew.js +8 -4
- package/dist/stories/components/DropdownSingleNew.js +31 -7
- package/package.json +1 -1
|
@@ -29,7 +29,11 @@ const BarChart = props => {
|
|
|
29
29
|
height,
|
|
30
30
|
barChartColor,
|
|
31
31
|
showLegend,
|
|
32
|
-
legendData
|
|
32
|
+
legendData,
|
|
33
|
+
showReferenceLine,
|
|
34
|
+
referenceLinePoint,
|
|
35
|
+
referenceLineColor,
|
|
36
|
+
referenceLineDashed
|
|
33
37
|
} = props;
|
|
34
38
|
|
|
35
39
|
// const [BarChartContainerWidth, setBarChartContainerWidth] = useState(0);
|
|
@@ -149,12 +153,17 @@ const BarChart = props => {
|
|
|
149
153
|
bottom: 25,
|
|
150
154
|
left: -5
|
|
151
155
|
}
|
|
152
|
-
}, /*#__PURE__*/_react.default.createElement(_recharts.
|
|
156
|
+
}, showReferenceLine && /*#__PURE__*/_react.default.createElement(_recharts.ReferenceLine, {
|
|
157
|
+
y: referenceLinePoint,
|
|
158
|
+
stroke: referenceLineColor,
|
|
159
|
+
strokeDasharray: referenceLineDashed
|
|
160
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.XAxis, {
|
|
153
161
|
dataKey: "title",
|
|
154
162
|
tick: CustomizedTickBarChart,
|
|
155
163
|
tickLine: false,
|
|
156
164
|
height: 120,
|
|
157
|
-
stroke: "#D0D0D0"
|
|
165
|
+
stroke: "#D0D0D0",
|
|
166
|
+
domain: [0, 'auto']
|
|
158
167
|
}), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, {
|
|
159
168
|
content: /*#__PURE__*/_react.default.createElement(CustomTooltip, null)
|
|
160
169
|
}), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, null), /*#__PURE__*/_react.default.createElement(_recharts.Bar, {
|
|
@@ -205,5 +214,9 @@ BarChart.defaultProps = {
|
|
|
205
214
|
title: 'Incremental Sales',
|
|
206
215
|
iconType: ICON_TYPE_SQUARE,
|
|
207
216
|
iconColor: '#BD9EFF'
|
|
208
|
-
}]
|
|
217
|
+
}],
|
|
218
|
+
showReferenceLine: true,
|
|
219
|
+
referenceLinePoint: 0,
|
|
220
|
+
referenceLineColor: '#212121',
|
|
221
|
+
referenceLineDashed: '5'
|
|
209
222
|
};
|
|
@@ -101,26 +101,20 @@ const BarChartTwoRows = props => {
|
|
|
101
101
|
value
|
|
102
102
|
} = props;
|
|
103
103
|
return /*#__PURE__*/_react.default.createElement("text", {
|
|
104
|
-
x: x,
|
|
104
|
+
x: x + 30,
|
|
105
105
|
y: y,
|
|
106
106
|
dy: -8,
|
|
107
107
|
fill: stroke,
|
|
108
|
-
fontSize: 14
|
|
108
|
+
fontSize: 14,
|
|
109
|
+
textAnchor: "middle"
|
|
109
110
|
}, displayFormattedValue(value));
|
|
110
111
|
};
|
|
111
112
|
return /*#__PURE__*/_react.default.createElement(_BarChartTwoRows.ControlsContainer, {
|
|
112
113
|
className: className,
|
|
113
|
-
id: "ControlsContainer",
|
|
114
114
|
height: height,
|
|
115
115
|
width: width,
|
|
116
116
|
ref: controlsContainerRef
|
|
117
|
-
}, /*#__PURE__*/_react.default.createElement(_BarChartTwoRows.Controls, {
|
|
118
|
-
id: "Controls"
|
|
119
|
-
}, /*#__PURE__*/_react.default.createElement(_BarChartTwoRows.TitleAndValueContainer, {
|
|
120
|
-
id: "TitleAndValueContainer"
|
|
121
|
-
}, /*#__PURE__*/_react.default.createElement(_BarChartTwoRows.Title, {
|
|
122
|
-
id: "Title"
|
|
123
|
-
}, title)), /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, {
|
|
117
|
+
}, /*#__PURE__*/_react.default.createElement(_BarChartTwoRows.Controls, null, /*#__PURE__*/_react.default.createElement(_BarChartTwoRows.TitleAndValueContainer, null, /*#__PURE__*/_react.default.createElement(_BarChartTwoRows.Title, null, title)), /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, {
|
|
124
118
|
id: "ResponsiveContainer",
|
|
125
119
|
width: "100%",
|
|
126
120
|
height: showLegend ? '80%' : '86%'
|
|
@@ -29,7 +29,8 @@ const DropdownMultiNew = _ref => {
|
|
|
29
29
|
errorMessage,
|
|
30
30
|
labelColor,
|
|
31
31
|
xIconShow,
|
|
32
|
-
checkBoxColor
|
|
32
|
+
checkBoxColor,
|
|
33
|
+
showLabelOnTop
|
|
33
34
|
} = _ref;
|
|
34
35
|
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
35
36
|
const [showOptions, setShowOptions] = (0, _react.useState)(false);
|
|
@@ -142,6 +143,32 @@ const DropdownMultiNew = _ref => {
|
|
|
142
143
|
}, selectedOptions.length - 2, "+") : '');
|
|
143
144
|
return content;
|
|
144
145
|
};
|
|
146
|
+
const getLabel = () => {
|
|
147
|
+
if (!showLabelOnTop && isFocused) {
|
|
148
|
+
return '';
|
|
149
|
+
}
|
|
150
|
+
if ((selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) > 0) {
|
|
151
|
+
return label;
|
|
152
|
+
}
|
|
153
|
+
return labelEmptyValue;
|
|
154
|
+
// selectedOptions?.length > 0 ? label : labelEmptyValue}
|
|
155
|
+
};
|
|
156
|
+
const getRequired = () => {
|
|
157
|
+
if (!showLabelOnTop && isFocused) {
|
|
158
|
+
return '';
|
|
159
|
+
}
|
|
160
|
+
if (!showLabelOnTop && !label && (selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) > 0) {
|
|
161
|
+
return '';
|
|
162
|
+
}
|
|
163
|
+
if (required) {
|
|
164
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
165
|
+
style: {
|
|
166
|
+
color: 'red'
|
|
167
|
+
}
|
|
168
|
+
}, "*");
|
|
169
|
+
}
|
|
170
|
+
return '';
|
|
171
|
+
};
|
|
145
172
|
return /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.DropdownWrapper, {
|
|
146
173
|
className: "DropdownWrapper",
|
|
147
174
|
width: width,
|
|
@@ -169,11 +196,7 @@ const DropdownMultiNew = _ref => {
|
|
|
169
196
|
error: error,
|
|
170
197
|
errorMessage: errorMessage,
|
|
171
198
|
onClick: handleLabelClick
|
|
172
|
-
}, (
|
|
173
|
-
style: {
|
|
174
|
-
color: 'red'
|
|
175
|
-
}
|
|
176
|
-
}, "*")), displaySelectedOptions(), showOptions ? /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.StyledInput, {
|
|
199
|
+
}, getLabel(), getRequired()), displaySelectedOptions(), showOptions ? /*#__PURE__*/_react.default.createElement(_DropdownMultiNew.StyledInput, {
|
|
177
200
|
className: "StyledInput",
|
|
178
201
|
ref: inputRef,
|
|
179
202
|
value: inputValue,
|
|
@@ -248,5 +271,6 @@ DropdownMultiNew.defaultProps = {
|
|
|
248
271
|
options: [],
|
|
249
272
|
selectedValue: [],
|
|
250
273
|
xIconShow: true,
|
|
251
|
-
onChange: () => {}
|
|
274
|
+
onChange: () => {},
|
|
275
|
+
showLabelOnTop: true
|
|
252
276
|
};
|
|
@@ -27,7 +27,8 @@ const DropdownNew = _ref => {
|
|
|
27
27
|
errorMessage,
|
|
28
28
|
labelColor,
|
|
29
29
|
checkBoxColor,
|
|
30
|
-
xIconShow
|
|
30
|
+
xIconShow,
|
|
31
|
+
showLabelOnTop
|
|
31
32
|
} = _ref;
|
|
32
33
|
return /*#__PURE__*/_react.default.createElement(_DropdownNew.DropdownMain, {
|
|
33
34
|
className: "DropdownMain",
|
|
@@ -46,7 +47,8 @@ const DropdownNew = _ref => {
|
|
|
46
47
|
error: error,
|
|
47
48
|
errorMessage: errorMessage,
|
|
48
49
|
selectedValue: selectedValue,
|
|
49
|
-
onChange: onChange
|
|
50
|
+
onChange: onChange,
|
|
51
|
+
showLabelOnTop: showLabelOnTop
|
|
50
52
|
}) : /*#__PURE__*/_react.default.createElement(_DropdownSingleNew.DropdownSingleNew, {
|
|
51
53
|
className: "DropdownSingleNew",
|
|
52
54
|
placeHolder: placeHolder,
|
|
@@ -62,7 +64,8 @@ const DropdownNew = _ref => {
|
|
|
62
64
|
errorMessage: errorMessage,
|
|
63
65
|
selectedValue: selectedValue,
|
|
64
66
|
xIconShow: xIconShow,
|
|
65
|
-
onChange: onChange
|
|
67
|
+
onChange: onChange,
|
|
68
|
+
showLabelOnTop: showLabelOnTop
|
|
66
69
|
}));
|
|
67
70
|
};
|
|
68
71
|
exports.DropdownNew = DropdownNew;
|
|
@@ -81,5 +84,6 @@ DropdownNew.defaultProps = {
|
|
|
81
84
|
options: [],
|
|
82
85
|
selectedValue: [],
|
|
83
86
|
xIconShow: true,
|
|
84
|
-
onChange: () => {}
|
|
87
|
+
onChange: () => {},
|
|
88
|
+
showLabelOnTop: true
|
|
85
89
|
};
|
|
@@ -26,7 +26,8 @@ const DropdownSingleNew = _ref => {
|
|
|
26
26
|
error,
|
|
27
27
|
errorMessage,
|
|
28
28
|
xIconShow,
|
|
29
|
-
labelColor
|
|
29
|
+
labelColor,
|
|
30
|
+
showLabelOnTop
|
|
30
31
|
} = _ref;
|
|
31
32
|
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
32
33
|
const [showOptions, setShowOptions] = (0, _react.useState)(false);
|
|
@@ -110,6 +111,32 @@ const DropdownSingleNew = _ref => {
|
|
|
110
111
|
newValue: []
|
|
111
112
|
});
|
|
112
113
|
};
|
|
114
|
+
const getLabel = () => {
|
|
115
|
+
if (!showLabelOnTop && isFocused) {
|
|
116
|
+
return '';
|
|
117
|
+
}
|
|
118
|
+
if ((selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) > 0) {
|
|
119
|
+
return label;
|
|
120
|
+
}
|
|
121
|
+
return labelEmptyValue;
|
|
122
|
+
// selectedOptions?.length > 0 ? label : labelEmptyValue}
|
|
123
|
+
};
|
|
124
|
+
const getRequired = () => {
|
|
125
|
+
if (!showLabelOnTop && isFocused) {
|
|
126
|
+
return '';
|
|
127
|
+
}
|
|
128
|
+
if (!showLabelOnTop && !label && (selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) > 0) {
|
|
129
|
+
return '';
|
|
130
|
+
}
|
|
131
|
+
if (required) {
|
|
132
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
133
|
+
style: {
|
|
134
|
+
color: 'red'
|
|
135
|
+
}
|
|
136
|
+
}, "*");
|
|
137
|
+
}
|
|
138
|
+
return '';
|
|
139
|
+
};
|
|
113
140
|
return /*#__PURE__*/_react.default.createElement(_DropdownSingleNew.DropdownWrapper, {
|
|
114
141
|
className: "DropdownWrapper",
|
|
115
142
|
width: width,
|
|
@@ -137,11 +164,7 @@ const DropdownSingleNew = _ref => {
|
|
|
137
164
|
error: error,
|
|
138
165
|
errorMessage: errorMessage,
|
|
139
166
|
onClick: handleLabelClick
|
|
140
|
-
}, (
|
|
141
|
-
style: {
|
|
142
|
-
color: 'red'
|
|
143
|
-
}
|
|
144
|
-
}, "*")), /*#__PURE__*/_react.default.createElement(_DropdownSingleNew.StyledInput, {
|
|
167
|
+
}, getLabel(), getRequired()), /*#__PURE__*/_react.default.createElement(_DropdownSingleNew.StyledInput, {
|
|
145
168
|
className: "StyledInput",
|
|
146
169
|
ref: inputRef
|
|
147
170
|
// eslint-disable-next-line no-nested-ternary
|
|
@@ -207,5 +230,6 @@ DropdownSingleNew.defaultProps = {
|
|
|
207
230
|
options: [],
|
|
208
231
|
selectedValue: [],
|
|
209
232
|
xIconShow: true,
|
|
210
|
-
onChange: () => {}
|
|
233
|
+
onChange: () => {},
|
|
234
|
+
showLabelOnTop: true
|
|
211
235
|
};
|