sag_components 1.0.381 → 1.0.382
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/Dropdown.js +61 -182
- package/dist/stories/components/DropdownMulti.js +299 -0
- package/dist/stories/components/DropdownMulti.style.js +15 -0
- package/dist/stories/components/IconButton.js +41 -64
- package/dist/stories/components/IconButton.style.js +7 -10
- package/dist/stories/components/ReportTable.js +2 -2
- package/dist/stories/components/TotalBenchmarkAreachart.style.js +2 -2
- package/dist/stories/components/icons/BellIcon.js +4 -3
- package/dist/stories/components/icons/DownloadIcon.js +5 -6
- package/package.json +1 -1
- package/.history/.env_20231001120549 +0 -0
- package/.history/.env_20231001120613 +0 -1
- package/.history/.env_20231003143620 +0 -1
- package/.history/.eslintrc_20230928112617.js +0 -26
- package/.history/.eslintrc_20230928130534.js +0 -27
- package/.history/.eslintrc_20230928133400.js +0 -28
- package/.history/.eslintrc_20230928133404.js +0 -28
- package/.history/.eslintrc_20230928133416.js +0 -28
- package/.history/.eslintrc_20230928133419.js +0 -28
- package/.history/.eslintrc_20230928133432.js +0 -28
- package/.history/.eslintrc_20230928133439.js +0 -28
- package/.history/.eslintrc_20230928133458.js +0 -29
- package/.history/.eslintrc_20230928133500.js +0 -28
- package/.history/.eslintrc_20230928134009.js +0 -28
- package/.history/.eslintrc_20230928135318.js +0 -34
- package/.history/.eslintrc_20230928135321.js +0 -34
- package/.history/.eslintrc_20230928135323.js +0 -34
- package/.history/.eslintrc_20230928135332.js +0 -34
- package/.history/.eslintrc_20230928135333.js +0 -34
- package/.history/.eslintrc_20230928135352.js +0 -29
- package/.history/.eslintrc_20230928135353.js +0 -29
- package/.history/.eslintrc_20230928135355.js +0 -29
- package/.history/.eslintrc_20230928135408.js +0 -29
- package/.history/.eslintrc_20230928135538.js +0 -30
- package/.history/.eslintrc_20230928135539.js +0 -30
- package/.history/.eslintrc_20230928135543.js +0 -30
- package/.history/.gitignore_20230921093332 +0 -119
- package/.history/.gitignore_20230921111638 +0 -120
- package/.history/.gitignore_20230921111650 +0 -120
- package/.history/.gitignore_20230921111810 +0 -121
- package/.history/package-lock_20231114111138.json +0 -47810
- package/.history/package-lock_20231114111158.json +0 -47802
- package/.history/package_20231029152422.json +0 -82
- package/.history/package_20231029153420.json +0 -82
- package/.history/package_20231029154416.json +0 -82
- package/.history/package_20231030094127.json +0 -82
- package/.history/package_20231030114707.json +0 -82
- package/.history/package_20231030130704.json +0 -82
- package/.history/package_20231030132422.json +0 -82
- package/.history/package_20231030134051.json +0 -82
- package/.history/package_20231030142913.json +0 -82
- package/.history/package_20231030143556.json +0 -82
- package/.history/package_20231030144210.json +0 -82
- package/.history/package_20231101113942.json +0 -82
- package/.history/package_20231101114544.json +0 -82
- package/.history/package_20231101151518.json +0 -82
- package/.history/package_20231101154501.json +0 -82
- package/.history/package_20231101155811.json +0 -82
- package/.history/package_20231101160235.json +0 -82
- package/.history/package_20231101160406.json +0 -82
- package/.history/package_20231101161325.json +0 -82
- package/.history/package_20231101161333.json +0 -82
- package/.history/package_20231102123623.json +0 -82
- package/.history/package_20231102125741.json +0 -82
- package/.history/package_20231102130857.json +0 -82
- package/.history/package_20231102132227.json +0 -82
- package/.history/package_20231102142340.json +0 -82
- package/.history/package_20231102143256.json +0 -82
- package/.history/package_20231105153539.json +0 -82
- package/.history/package_20231105154332.json +0 -82
- package/.history/package_20231105171201.json +0 -82
- package/.history/package_20231106123849.json +0 -82
- package/.history/package_20231107170638.json +0 -82
- package/.history/package_20231109103647.json +0 -82
- package/.history/package_20231109103911.json +0 -82
- package/.history/package_20231109105426.json +0 -82
- package/.history/package_20231109132014.json +0 -82
- package/.history/package_20231109132115.json +0 -82
- package/.history/package_20231114100517.json +0 -82
- package/.history/package_20231114100859.json +0 -82
- package/.history/package_20231114101553.json +0 -82
- package/.history/package_20231114102545.json +0 -82
- package/.history/package_20231114111208.json +0 -83
- package/.history/package_20231114111515.json +0 -83
- package/.history/package_20231114112931.json +0 -83
- package/.history/package_20231114113014.json +0 -83
- package/.history/package_20231114113155.json +0 -83
- package/.history/package_20231114124318.json +0 -83
- package/.history/package_20231114125107.json +0 -83
- package/.history/package_20231114125510.json +0 -83
- package/.history/package_20231114132634.json +0 -83
- package/.history/package_20231116165815.json +0 -83
- package/.history/package_20231116165916.json +0 -83
- package/.history/package_20231119113637.json +0 -83
- package/.history/package_20231120100907.json +0 -83
- package/.history/package_20231121151523.json +0 -77
- package/.history/package_20231121155513.json +0 -77
- package/.history/package_20231121162434.json +0 -77
- package/.history/package_20231122100718.json +0 -77
- package/.history/package_20231128125149.json +0 -82
- package/.history/package_20231128125208.json +0 -82
- package/dist/stories/components/icons/DocumentIcon.js +0 -48
|
@@ -33,31 +33,34 @@ var checkedIcon = /*#__PURE__*/_react.default.createElement(_CheckBox.default, {
|
|
|
33
33
|
*/
|
|
34
34
|
var Dropdown = exports.Dropdown = function Dropdown(_ref) {
|
|
35
35
|
var _ref$width = _ref.width,
|
|
36
|
-
width = _ref$width === void 0 ?
|
|
36
|
+
width = _ref$width === void 0 ? "100%" : _ref$width,
|
|
37
37
|
size = _ref.size,
|
|
38
38
|
text = _ref.text,
|
|
39
39
|
shape = _ref.shape,
|
|
40
40
|
placeHolder = _ref.placeHolder,
|
|
41
41
|
multiSelect = _ref.multiSelect,
|
|
42
|
-
limitTagsOnMultiSelect = _ref.limitTagsOnMultiSelect,
|
|
43
42
|
showPopupIcon = _ref.showPopupIcon,
|
|
44
43
|
showSearchIcon = _ref.showSearchIcon,
|
|
45
44
|
options = _ref.options,
|
|
46
45
|
onChange = _ref.onChange,
|
|
47
46
|
onInputChange = _ref.onInputChange,
|
|
48
47
|
_ref$labelColor = _ref.labelColor,
|
|
49
|
-
labelColor = _ref$labelColor === void 0 ?
|
|
48
|
+
labelColor = _ref$labelColor === void 0 ? "#1B30AA" : _ref$labelColor,
|
|
50
49
|
required = _ref.required,
|
|
51
50
|
inputRef = _ref.inputRef,
|
|
52
51
|
defaultValue = _ref.defaultValue,
|
|
53
52
|
_ref$allowedInput = _ref.allowedInput,
|
|
54
|
-
allowedInput = _ref$allowedInput === void 0 ?
|
|
53
|
+
allowedInput = _ref$allowedInput === void 0 ? "all" : _ref$allowedInput,
|
|
55
54
|
_ref$reset = _ref.reset,
|
|
56
55
|
reset = _ref$reset === void 0 ? false : _ref$reset,
|
|
57
56
|
_ref$disableClearable = _ref.disableClearable,
|
|
58
57
|
disableClearable = _ref$disableClearable === void 0 ? false : _ref$disableClearable,
|
|
59
58
|
_ref$disabled = _ref.disabled,
|
|
60
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled
|
|
59
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
60
|
+
_ref$dropdownListfont = _ref.dropdownListfontSize,
|
|
61
|
+
dropdownListfontSize = _ref$dropdownListfont === void 0 ? "14px" : _ref$dropdownListfont,
|
|
62
|
+
_ref$placeHolderFontS = _ref.placeHolderFontSize,
|
|
63
|
+
placeHolderFontSize = _ref$placeHolderFontS === void 0 ? "14px" : _ref$placeHolderFontS;
|
|
61
64
|
/**
|
|
62
65
|
* SAG Dropdown
|
|
63
66
|
*/
|
|
@@ -66,16 +69,10 @@ var Dropdown = exports.Dropdown = function Dropdown(_ref) {
|
|
|
66
69
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
67
70
|
currentInputValue = _useState2[0],
|
|
68
71
|
setCurrentInputValue = _useState2[1];
|
|
69
|
-
var _useState3 = (0, _react.useState)(
|
|
72
|
+
var _useState3 = (0, _react.useState)(),
|
|
70
73
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
// const [defaultValueSetFlag, setDefaultValueSetFlag] = useState(false);
|
|
74
|
-
|
|
75
|
-
// useEffect(() => {
|
|
76
|
-
// reset ? setDefaultValueSetFlag(false) : null;
|
|
77
|
-
// }, [reset]);
|
|
78
|
-
|
|
74
|
+
selectedOptionsState = _useState4[0],
|
|
75
|
+
setSelectedOptionsState = _useState4[1];
|
|
79
76
|
(0, _react.useEffect)(function () {
|
|
80
77
|
var delayDebounceFn = setTimeout(function () {
|
|
81
78
|
onInputChange(currentInputValue);
|
|
@@ -89,60 +86,60 @@ var Dropdown = exports.Dropdown = function Dropdown(_ref) {
|
|
|
89
86
|
MuiFormLabel: {
|
|
90
87
|
styleOverrides: {
|
|
91
88
|
asterisk: {
|
|
92
|
-
color:
|
|
89
|
+
color: "#db3131"
|
|
93
90
|
}
|
|
94
91
|
}
|
|
95
92
|
}
|
|
96
93
|
}
|
|
97
94
|
});
|
|
98
95
|
|
|
99
|
-
//
|
|
100
|
-
var
|
|
101
|
-
if (shape ===
|
|
96
|
+
// Single Text Style
|
|
97
|
+
var getTextFieldStyleSingle = function getTextFieldStyleSingle() {
|
|
98
|
+
if (shape === "round") {
|
|
102
99
|
// round
|
|
103
100
|
return {
|
|
104
|
-
|
|
105
|
-
borderRadius:
|
|
101
|
+
"& .MuiOutlinedInput-root": {
|
|
102
|
+
borderRadius: "12px",
|
|
106
103
|
legend: {
|
|
107
|
-
marginLeft:
|
|
104
|
+
marginLeft: "10px"
|
|
108
105
|
}
|
|
109
106
|
},
|
|
110
|
-
|
|
111
|
-
paddingLeft:
|
|
112
|
-
borderRadius:
|
|
107
|
+
"& .MuiAutocomplete-inputRoot": {
|
|
108
|
+
paddingLeft: "10px !important",
|
|
109
|
+
borderRadius: "12px",
|
|
113
110
|
// This matches the specificity of the default styles at https://github.com/mui-org/material-ui/blob/v4.11.3/packages/material-ui-lab/src/Autocomplete/Autocomplete.js#L90
|
|
114
111
|
'&[class*="MuiOutlinedInput-root"] .MuiAutocomplete-input:first-of-type': {
|
|
115
112
|
// Default left padding is 6px
|
|
116
|
-
paddingLeft:
|
|
113
|
+
paddingLeft: "10px"
|
|
117
114
|
},
|
|
118
|
-
|
|
119
|
-
borderColor:
|
|
115
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
116
|
+
borderColor: "#E7E7E7"
|
|
120
117
|
},
|
|
121
|
-
|
|
122
|
-
borderColor: disabled ?
|
|
118
|
+
"&:hover .MuiOutlinedInput-notchedOutline": {
|
|
119
|
+
borderColor: disabled ? "#E7E7E7" : labelColor
|
|
123
120
|
},
|
|
124
|
-
|
|
125
|
-
borderColor: disabled ?
|
|
121
|
+
"&.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
|
122
|
+
borderColor: disabled ? "#E7E7E7" : labelColor
|
|
126
123
|
}
|
|
127
124
|
},
|
|
128
|
-
|
|
125
|
+
"& .MuiInputLabel-outlined:not(.MuiInputLabel-shrink)": {
|
|
129
126
|
// Default transform is "translate(14px, 20px) scale(1)""
|
|
130
127
|
// This lines up the label with the initial cursor position in the input
|
|
131
128
|
// after changing its padding-left.
|
|
132
|
-
transform:
|
|
133
|
-
fontSize:
|
|
134
|
-
color: disabled ?
|
|
129
|
+
transform: "translate(14px, 18px) scale(1);",
|
|
130
|
+
fontSize: "14px",
|
|
131
|
+
color: disabled ? "#E7E7E7" : currentInputValue && currentInputValue.length > 0 ? "#212121" : "#757575"
|
|
135
132
|
},
|
|
136
|
-
|
|
137
|
-
paddingLeft:
|
|
138
|
-
color: disabled ?
|
|
139
|
-
fontSize:
|
|
133
|
+
"& .MuiInputLabel-outlined": {
|
|
134
|
+
paddingLeft: "10px",
|
|
135
|
+
color: disabled ? "#E7E7E7" : labelColor,
|
|
136
|
+
fontSize: "18px"
|
|
140
137
|
},
|
|
141
|
-
|
|
142
|
-
marginLeft:
|
|
143
|
-
paddingLeft:
|
|
144
|
-
paddingRight:
|
|
145
|
-
background:
|
|
138
|
+
"& .MuiInputLabel-shrink": {
|
|
139
|
+
marginLeft: "1px",
|
|
140
|
+
paddingLeft: "4px",
|
|
141
|
+
paddingRight: "6px",
|
|
142
|
+
background: "white"
|
|
146
143
|
}
|
|
147
144
|
};
|
|
148
145
|
}
|
|
@@ -156,45 +153,34 @@ var Dropdown = exports.Dropdown = function Dropdown(_ref) {
|
|
|
156
153
|
});
|
|
157
154
|
};
|
|
158
155
|
var onChangeHandler = function onChangeHandler(event, newValue) {
|
|
159
|
-
|
|
160
|
-
syntheticBaseEvent: event,
|
|
161
|
-
newValue: newValue
|
|
162
|
-
});
|
|
163
|
-
// setDefaultValueSetFlag(true);
|
|
156
|
+
setSelectedOptionsState(newValue);
|
|
164
157
|
onChange({
|
|
165
158
|
syntheticBaseEvent: event,
|
|
166
159
|
newValue: newValue
|
|
167
160
|
});
|
|
168
161
|
};
|
|
169
|
-
var getOptionByLabel = function getOptionByLabel(label) {
|
|
170
|
-
if (!label) return null;
|
|
171
|
-
if (!options) return null;
|
|
172
|
-
var foundOption = options.find(function (item) {
|
|
173
|
-
return item.label === label;
|
|
174
|
-
});
|
|
175
|
-
if (!foundOption) return null;
|
|
176
|
-
return foundOption;
|
|
177
|
-
};
|
|
178
162
|
var isInputAllowed = function isInputAllowed(inputChar) {
|
|
179
163
|
var NUMERIC_REGEX = /^[0-9-]+$/;
|
|
180
164
|
var ALPHA_REGEX = /^[a-zA-Z]+$/;
|
|
181
165
|
var ALPHA_NUMERIC_REGEX = /^[a-zA-Z0-9-]+$/;
|
|
182
166
|
switch (allowedInput) {
|
|
183
|
-
case
|
|
167
|
+
case "all":
|
|
184
168
|
return true;
|
|
185
|
-
case
|
|
169
|
+
case "alpha":
|
|
186
170
|
if (ALPHA_REGEX.test(inputChar)) return true;
|
|
187
171
|
return false;
|
|
188
|
-
case
|
|
172
|
+
case "numeric":
|
|
189
173
|
if (NUMERIC_REGEX.test(inputChar)) return true;
|
|
190
174
|
return false;
|
|
191
|
-
case
|
|
175
|
+
case "alphaNumeric":
|
|
192
176
|
if (ALPHA_NUMERIC_REGEX.test(inputChar)) return true;
|
|
193
177
|
return false;
|
|
194
178
|
default:
|
|
195
179
|
return true;
|
|
196
180
|
}
|
|
197
181
|
};
|
|
182
|
+
|
|
183
|
+
// --------------------------------------- DROPDOWN SINGLE --------------------------------
|
|
198
184
|
var getAutocompleteSingle = function getAutocompleteSingle() {
|
|
199
185
|
return /*#__PURE__*/_react.default.createElement(_styles.ThemeProvider, {
|
|
200
186
|
theme: theme
|
|
@@ -211,10 +197,9 @@ var Dropdown = exports.Dropdown = function Dropdown(_ref) {
|
|
|
211
197
|
disableClearable: disableClearable,
|
|
212
198
|
defaultValue: defaultValue,
|
|
213
199
|
id: "combo-box",
|
|
214
|
-
options: options
|
|
215
|
-
sx
|
|
216
|
-
|
|
217
|
-
},
|
|
200
|
+
options: options
|
|
201
|
+
// sx={{ width }}
|
|
202
|
+
,
|
|
218
203
|
popupIcon: showPopupIcon ? /*#__PURE__*/_react.default.createElement(_ArrowDropDownIcon.ArrowDropDownIcon, {
|
|
219
204
|
width: "0.5em",
|
|
220
205
|
height: "0.5em"
|
|
@@ -231,140 +216,34 @@ var Dropdown = exports.Dropdown = function Dropdown(_ref) {
|
|
|
231
216
|
label: text,
|
|
232
217
|
inputRef: inputRef || null,
|
|
233
218
|
size: size,
|
|
234
|
-
sx:
|
|
219
|
+
sx: getTextFieldStyleSingle(),
|
|
235
220
|
placeholder: placeHolder,
|
|
236
221
|
InputProps: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params.InputProps), {}, {
|
|
237
222
|
style: {
|
|
238
|
-
fontSize:
|
|
239
|
-
fontFamily:
|
|
223
|
+
fontSize: placeHolderFontSize,
|
|
224
|
+
fontFamily: "Poppins"
|
|
240
225
|
},
|
|
241
226
|
startAdornment: showSearchIcon ? /*#__PURE__*/_react.default.createElement(_InputAdornment.default, {
|
|
242
227
|
position: "start"
|
|
243
228
|
}, /*#__PURE__*/_react.default.createElement(_Search.default, {
|
|
244
229
|
fontSize: "medium"
|
|
245
230
|
})) : null
|
|
246
|
-
})
|
|
247
|
-
InputLabelProps: {
|
|
248
|
-
style: {
|
|
249
|
-
// color: labelColor,
|
|
250
|
-
// fontSize: "14px",
|
|
251
|
-
fontFamily: 'Poppins'
|
|
252
|
-
}
|
|
253
|
-
}
|
|
231
|
+
})
|
|
254
232
|
}));
|
|
255
233
|
},
|
|
256
234
|
ListboxProps: {
|
|
257
235
|
style: {
|
|
258
|
-
fontSize:
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
262
|
-
}));
|
|
263
|
-
};
|
|
264
|
-
var getAutocompleteMulti = function getAutocompleteMulti() {
|
|
265
|
-
return /*#__PURE__*/_react.default.createElement(_styles.ThemeProvider, {
|
|
266
|
-
theme: theme
|
|
267
|
-
}, /*#__PURE__*/_react.default.createElement(_Autocomplete.default, {
|
|
268
|
-
key: reset,
|
|
269
|
-
defaultValue: defaultValue,
|
|
270
|
-
style: {
|
|
271
|
-
width: width
|
|
272
|
-
},
|
|
273
|
-
onChange: function onChange(event, newValue) {
|
|
274
|
-
onChangeHandler(event, newValue);
|
|
275
|
-
},
|
|
276
|
-
onInputChange: function onInputChange(event, newInputValue) {
|
|
277
|
-
onInputChangeHandler(event, newInputValue);
|
|
278
|
-
},
|
|
279
|
-
multiple: true,
|
|
280
|
-
limitTags: limitTagsOnMultiSelect,
|
|
281
|
-
id: "checkboxes-tags",
|
|
282
|
-
options: options,
|
|
283
|
-
disabled: disabled,
|
|
284
|
-
disableCloseOnSelect: true,
|
|
285
|
-
disableClearable: disableClearable,
|
|
286
|
-
getOptionLabel: function getOptionLabel(option) {
|
|
287
|
-
return option.label;
|
|
288
|
-
},
|
|
289
|
-
popupIcon: showPopupIcon ? /*#__PURE__*/_react.default.createElement(_ArrowDropDownIcon.ArrowDropDownIcon, {
|
|
290
|
-
width: "0.5em",
|
|
291
|
-
height: "0.5em"
|
|
292
|
-
}) : null,
|
|
293
|
-
renderOption: function renderOption(props, option, _ref2) {
|
|
294
|
-
var selected = _ref2.selected;
|
|
295
|
-
return /*#__PURE__*/_react.default.createElement("li", props, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
296
|
-
icon: icon,
|
|
297
|
-
checkedIcon: checkedIcon,
|
|
298
|
-
style: {
|
|
299
|
-
marginRight: 8,
|
|
300
|
-
fontSize: '14px',
|
|
301
|
-
fontFamily: 'Poppins'
|
|
302
|
-
},
|
|
303
|
-
checked: selected
|
|
304
|
-
}), option.label);
|
|
305
|
-
},
|
|
306
|
-
renderInput: function renderInput(params) {
|
|
307
|
-
return showSearchIcon && (!currentOption || currentOption && currentOption.length === 0) ? /*#__PURE__*/_react.default.createElement(_TextField.default, Object.assign({}, params, {
|
|
308
|
-
label: text,
|
|
309
|
-
size: size,
|
|
310
|
-
sx: getTextFieldStyle(),
|
|
311
|
-
placeholder: placeHolder,
|
|
312
|
-
onKeyDown: function onKeyDown(event) {
|
|
313
|
-
if (!isInputAllowed(event.key)) {
|
|
314
|
-
event.preventDefault();
|
|
315
|
-
}
|
|
316
|
-
},
|
|
317
|
-
inputRef: inputRef || null,
|
|
318
|
-
required: required,
|
|
319
|
-
InputProps: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params.InputProps), {}, {
|
|
320
|
-
style: {
|
|
321
|
-
fontSize: '14px',
|
|
322
|
-
fontFamily: 'Poppins'
|
|
323
|
-
},
|
|
324
|
-
startAdornment: /*#__PURE__*/_react.default.createElement(_InputAdornment.default, {
|
|
325
|
-
position: "start"
|
|
326
|
-
}, /*#__PURE__*/_react.default.createElement(_Search.default, {
|
|
327
|
-
fontSize: "medium"
|
|
328
|
-
}))
|
|
329
|
-
}),
|
|
330
|
-
InputLabelProps: {
|
|
331
|
-
style: {
|
|
332
|
-
// color: labelColor,
|
|
333
|
-
fontSize: '16px',
|
|
334
|
-
fontFamily: 'Poppins'
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
})) : /*#__PURE__*/_react.default.createElement(_TextField.default, Object.assign({}, params, {
|
|
338
|
-
label: text,
|
|
339
|
-
size: size,
|
|
340
|
-
sx: getTextFieldStyle(),
|
|
341
|
-
placeholder: placeHolder,
|
|
342
|
-
onKeyDown: function onKeyDown(event) {
|
|
343
|
-
if (!isInputAllowed(event.key)) {
|
|
344
|
-
event.preventDefault();
|
|
345
|
-
}
|
|
346
|
-
},
|
|
347
|
-
inputRef: inputRef || null,
|
|
348
|
-
required: required,
|
|
349
|
-
InputLabelProps: {
|
|
350
|
-
style: {
|
|
351
|
-
// color: labelColor,
|
|
352
|
-
fontSize: '16px',
|
|
353
|
-
fontFamily: 'Poppins'
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}));
|
|
357
|
-
},
|
|
358
|
-
ListboxProps: {
|
|
359
|
-
style: {
|
|
360
|
-
fontSize: '14px',
|
|
361
|
-
fontFamily: 'Poppins'
|
|
236
|
+
fontSize: dropdownListfontSize,
|
|
237
|
+
//default: 14px
|
|
238
|
+
fontFamily: "Poppins"
|
|
362
239
|
}
|
|
363
240
|
}
|
|
364
241
|
}));
|
|
365
242
|
};
|
|
243
|
+
|
|
244
|
+
// --------------------------------- MAIN -------------------------------------
|
|
366
245
|
return /*#__PURE__*/_react.default.createElement(_Dropdown.DropdownContainer, {
|
|
367
246
|
width: width
|
|
368
|
-
},
|
|
247
|
+
}, getAutocompleteSingle());
|
|
369
248
|
};
|
|
370
249
|
var _default = exports.default = Dropdown;
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = exports.DropdownMulti = void 0;
|
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _Autocomplete = _interopRequireDefault(require("@mui/material/Autocomplete"));
|
|
13
|
+
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
14
|
+
var _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
|
|
15
|
+
var _InputAdornment = _interopRequireDefault(require("@mui/material/InputAdornment"));
|
|
16
|
+
var _styles = require("@mui/material/styles");
|
|
17
|
+
var _CheckBoxOutlineBlank = _interopRequireDefault(require("@mui/icons-material/CheckBoxOutlineBlank"));
|
|
18
|
+
var _CheckBox = _interopRequireDefault(require("@mui/icons-material/CheckBox"));
|
|
19
|
+
var _Search = _interopRequireDefault(require("@mui/icons-material/Search"));
|
|
20
|
+
var _ArrowDropDownIcon = require("./icons/ArrowDropDownIcon");
|
|
21
|
+
var _DropdownMulti = require("./DropdownMulti.style");
|
|
22
|
+
var icon = /*#__PURE__*/_react.default.createElement(_CheckBoxOutlineBlank.default, {
|
|
23
|
+
fontSize: "small"
|
|
24
|
+
});
|
|
25
|
+
var checkedIcon = /*#__PURE__*/_react.default.createElement(_CheckBox.default, {
|
|
26
|
+
fontSize: "small"
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// import './fonts/Poppins-Regular.ttf';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* SAG DropdownMulti
|
|
33
|
+
*/
|
|
34
|
+
var DropdownMulti = exports.DropdownMulti = function DropdownMulti(_ref) {
|
|
35
|
+
var _ref$width = _ref.width,
|
|
36
|
+
width = _ref$width === void 0 ? "100%" : _ref$width,
|
|
37
|
+
size = _ref.size,
|
|
38
|
+
text = _ref.text,
|
|
39
|
+
shape = _ref.shape,
|
|
40
|
+
placeHolder = _ref.placeHolder,
|
|
41
|
+
limitTagsOnMultiSelect = _ref.limitTagsOnMultiSelect,
|
|
42
|
+
showPopupIcon = _ref.showPopupIcon,
|
|
43
|
+
showSearchIcon = _ref.showSearchIcon,
|
|
44
|
+
options = _ref.options,
|
|
45
|
+
onChange = _ref.onChange,
|
|
46
|
+
onInputChange = _ref.onInputChange,
|
|
47
|
+
_ref$labelColor = _ref.labelColor,
|
|
48
|
+
labelColor = _ref$labelColor === void 0 ? "#1B30AA" : _ref$labelColor,
|
|
49
|
+
required = _ref.required,
|
|
50
|
+
inputRef = _ref.inputRef,
|
|
51
|
+
defaultValue = _ref.defaultValue,
|
|
52
|
+
_ref$allowedInput = _ref.allowedInput,
|
|
53
|
+
allowedInput = _ref$allowedInput === void 0 ? "all" : _ref$allowedInput,
|
|
54
|
+
_ref$reset = _ref.reset,
|
|
55
|
+
reset = _ref$reset === void 0 ? false : _ref$reset,
|
|
56
|
+
_ref$disableClearable = _ref.disableClearable,
|
|
57
|
+
disableClearable = _ref$disableClearable === void 0 ? false : _ref$disableClearable,
|
|
58
|
+
_ref$disabled = _ref.disabled,
|
|
59
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
60
|
+
_ref$dropdownListfont = _ref.dropdownListfontSize,
|
|
61
|
+
dropdownListfontSize = _ref$dropdownListfont === void 0 ? "14px" : _ref$dropdownListfont,
|
|
62
|
+
_ref$placeHolderFontS = _ref.placeHolderFontSize,
|
|
63
|
+
placeHolderFontSize = _ref$placeHolderFontS === void 0 ? "14px" : _ref$placeHolderFontS;
|
|
64
|
+
/**
|
|
65
|
+
* SAG DropdownMulti
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
var _useState = (0, _react.useState)(null),
|
|
69
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
70
|
+
currentInputValue = _useState2[0],
|
|
71
|
+
setCurrentInputValue = _useState2[1];
|
|
72
|
+
var _useState3 = (0, _react.useState)([]),
|
|
73
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
74
|
+
selectedOptionsState = _useState4[0],
|
|
75
|
+
setSelectedOptionsState = _useState4[1];
|
|
76
|
+
(0, _react.useEffect)(function () {
|
|
77
|
+
console.log("selectedOptionsState", selectedOptionsState);
|
|
78
|
+
}, [selectedOptionsState]);
|
|
79
|
+
(0, _react.useEffect)(function () {
|
|
80
|
+
if (reset) {
|
|
81
|
+
setSelectedOptionsState([]);
|
|
82
|
+
//console.log("reset", reset);
|
|
83
|
+
}
|
|
84
|
+
}, [reset]);
|
|
85
|
+
|
|
86
|
+
// useEffect(() => {
|
|
87
|
+
// if(filterSelectedOptions){
|
|
88
|
+
// setSelectedOptionsState(filterSelectedOptions);
|
|
89
|
+
// }
|
|
90
|
+
// }, [filterSelectedOptions]);
|
|
91
|
+
|
|
92
|
+
(0, _react.useEffect)(function () {
|
|
93
|
+
var delayDebounceFn = setTimeout(function () {
|
|
94
|
+
onInputChange(currentInputValue);
|
|
95
|
+
}, 1000);
|
|
96
|
+
return function () {
|
|
97
|
+
return clearTimeout(delayDebounceFn);
|
|
98
|
+
};
|
|
99
|
+
}, [currentInputValue]);
|
|
100
|
+
var theme = (0, _styles.createTheme)({
|
|
101
|
+
components: {
|
|
102
|
+
MuiFormLabel: {
|
|
103
|
+
styleOverrides: {
|
|
104
|
+
asterisk: {
|
|
105
|
+
color: "#db3131"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// ---------------------------- Multi Text Style -----------------------------------------
|
|
113
|
+
var getTextFieldStyleMulti = function getTextFieldStyleMulti() {
|
|
114
|
+
if (shape === "round") {
|
|
115
|
+
// round
|
|
116
|
+
return {
|
|
117
|
+
"& .MuiOutlinedInput-root": {
|
|
118
|
+
borderRadius: "12px",
|
|
119
|
+
legend: {
|
|
120
|
+
marginLeft: "10px"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"& .MuiAutocomplete-inputRoot": {
|
|
124
|
+
paddingLeft: "10px !important",
|
|
125
|
+
borderRadius: "12px",
|
|
126
|
+
// This matches the specificity of the default styles at https://github.com/mui-org/material-ui/blob/v4.11.3/packages/material-ui-lab/src/Autocomplete/Autocomplete.js#L90
|
|
127
|
+
'&[class*="MuiOutlinedInput-root"] .MuiAutocomplete-input:first-of-type': {
|
|
128
|
+
// Default left padding is 6px
|
|
129
|
+
paddingLeft: "10px"
|
|
130
|
+
},
|
|
131
|
+
"& .MuiOutlinedInput-notchedOutline": {
|
|
132
|
+
borderColor: "#E7E7E7"
|
|
133
|
+
},
|
|
134
|
+
"&:hover .MuiOutlinedInput-notchedOutline": {
|
|
135
|
+
borderColor: disabled ? "#E7E7E7" : labelColor
|
|
136
|
+
},
|
|
137
|
+
"&.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
|
138
|
+
borderColor: disabled ? "#E7E7E7" : labelColor
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"& .MuiInputLabel-outlined:not(.MuiInputLabel-shrink)": {
|
|
142
|
+
// Default transform is "translate(14px, 20px) scale(1)""
|
|
143
|
+
// This lines up the label with the initial cursor position in the input
|
|
144
|
+
// after changing its padding-left.
|
|
145
|
+
transform: "translate(14px, 18px) scale(1);",
|
|
146
|
+
fontSize: "14px",
|
|
147
|
+
color: disabled ? "#E7E7E7" : currentInputValue && currentInputValue.length > 0 ? "#212121" : "#757575"
|
|
148
|
+
},
|
|
149
|
+
"& .MuiInputLabel-outlined": {
|
|
150
|
+
paddingLeft: "10px",
|
|
151
|
+
color: disabled ? "#E7E7E7" : labelColor,
|
|
152
|
+
fontSize: "18px"
|
|
153
|
+
},
|
|
154
|
+
"& .MuiInputLabel-shrink": {
|
|
155
|
+
marginLeft: "1px",
|
|
156
|
+
paddingLeft: "4px",
|
|
157
|
+
paddingRight: "6px",
|
|
158
|
+
background: "white"
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
// square
|
|
163
|
+
return null;
|
|
164
|
+
};
|
|
165
|
+
var onInputChangeHandler = function onInputChangeHandler(event, newInputValue) {
|
|
166
|
+
setCurrentInputValue({
|
|
167
|
+
syntheticBaseEvent: event,
|
|
168
|
+
inputValue: newInputValue
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
var onChangeHandler = function onChangeHandler(event, newValue) {
|
|
172
|
+
setSelectedOptionsState(newValue);
|
|
173
|
+
onChange({
|
|
174
|
+
syntheticBaseEvent: event,
|
|
175
|
+
newValue: newValue
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
var isInputAllowed = function isInputAllowed(inputChar) {
|
|
179
|
+
var NUMERIC_REGEX = /^[0-9-]+$/;
|
|
180
|
+
var ALPHA_REGEX = /^[a-zA-Z]+$/;
|
|
181
|
+
var ALPHA_NUMERIC_REGEX = /^[a-zA-Z0-9-]+$/;
|
|
182
|
+
switch (allowedInput) {
|
|
183
|
+
case "all":
|
|
184
|
+
return true;
|
|
185
|
+
case "alpha":
|
|
186
|
+
if (ALPHA_REGEX.test(inputChar)) return true;
|
|
187
|
+
return false;
|
|
188
|
+
case "numeric":
|
|
189
|
+
if (NUMERIC_REGEX.test(inputChar)) return true;
|
|
190
|
+
return false;
|
|
191
|
+
case "alphaNumeric":
|
|
192
|
+
if (ALPHA_NUMERIC_REGEX.test(inputChar)) return true;
|
|
193
|
+
return false;
|
|
194
|
+
default:
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
// --------------------------------------- DropdownMulti--------------------------------
|
|
200
|
+
var getAutocompleteMulti = function getAutocompleteMulti() {
|
|
201
|
+
return selectedOptionsState && /*#__PURE__*/_react.default.createElement(_styles.ThemeProvider, {
|
|
202
|
+
theme: theme
|
|
203
|
+
}, /*#__PURE__*/_react.default.createElement(_Autocomplete.default, {
|
|
204
|
+
onChange: function onChange(event, newValue) {
|
|
205
|
+
onChangeHandler(event, newValue);
|
|
206
|
+
},
|
|
207
|
+
onInputChange: function onInputChange(event, newInputValue) {
|
|
208
|
+
onInputChangeHandler(event, newInputValue);
|
|
209
|
+
},
|
|
210
|
+
multiple: true,
|
|
211
|
+
limitTags: limitTagsOnMultiSelect,
|
|
212
|
+
id: "checkboxes-tags",
|
|
213
|
+
options: options,
|
|
214
|
+
value: selectedOptionsState,
|
|
215
|
+
disabled: disabled,
|
|
216
|
+
disableCloseOnSelect: true,
|
|
217
|
+
disableClearable: disableClearable,
|
|
218
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
219
|
+
return option.label;
|
|
220
|
+
},
|
|
221
|
+
popupIcon: showPopupIcon ? /*#__PURE__*/_react.default.createElement(_ArrowDropDownIcon.ArrowDropDownIcon, {
|
|
222
|
+
width: "0.5em",
|
|
223
|
+
height: "0.5em"
|
|
224
|
+
}) : null,
|
|
225
|
+
renderOption: function renderOption(props, option, _ref2) {
|
|
226
|
+
var selected = _ref2.selected;
|
|
227
|
+
return /*#__PURE__*/_react.default.createElement("li", props, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
228
|
+
icon: icon,
|
|
229
|
+
checkedIcon: checkedIcon,
|
|
230
|
+
checked: selected //{isOptionChecked(option)} //
|
|
231
|
+
}), option.label);
|
|
232
|
+
},
|
|
233
|
+
renderInput: function renderInput(params) {
|
|
234
|
+
console.log("params", params);
|
|
235
|
+
return (
|
|
236
|
+
/*#__PURE__*/
|
|
237
|
+
//showSearchIcon &&
|
|
238
|
+
_react.default.createElement(_TextField.default, Object.assign({}, params, {
|
|
239
|
+
variant: "outlined"
|
|
240
|
+
//label={text}
|
|
241
|
+
,
|
|
242
|
+
size: size,
|
|
243
|
+
sx: getTextFieldStyleMulti(),
|
|
244
|
+
placeholder: placeHolder,
|
|
245
|
+
InputProps: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params.InputProps), {}, {
|
|
246
|
+
style: {
|
|
247
|
+
fontSize: placeHolderFontSize,
|
|
248
|
+
fontFamily: "Poppins"
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// endAdornment: (
|
|
252
|
+
// <>
|
|
253
|
+
// { selectedOptionsState && Object.values( selectedOptionsState)?.map((option, index) => (
|
|
254
|
+
// <span key={index} style={{ margin: '0 5px' }}>
|
|
255
|
+
// {option.label}
|
|
256
|
+
// </span>
|
|
257
|
+
// ))}
|
|
258
|
+
// {params.InputProps.endAdornment}
|
|
259
|
+
|
|
260
|
+
// </>
|
|
261
|
+
// ),
|
|
262
|
+
}),
|
|
263
|
+
|
|
264
|
+
onKeyDown: function onKeyDown(event) {
|
|
265
|
+
if (!isInputAllowed(event.key)) {
|
|
266
|
+
event.preventDefault();
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
inputRef: inputRef || null,
|
|
270
|
+
required: required
|
|
271
|
+
}))
|
|
272
|
+
);
|
|
273
|
+
},
|
|
274
|
+
ListboxProps: {
|
|
275
|
+
style: {
|
|
276
|
+
fontSize: dropdownListfontSize,
|
|
277
|
+
//default: 14px
|
|
278
|
+
fontFamily: "Poppins"
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}));
|
|
282
|
+
};
|
|
283
|
+
var isOptionChecked = function isOptionChecked(option) {
|
|
284
|
+
var _Object$values;
|
|
285
|
+
if (selectedOptionsState && (_Object$values = Object.values(selectedOptionsState)) !== null && _Object$values !== void 0 && _Object$values.map(function (itemFilter) {
|
|
286
|
+
return itemFilter.label;
|
|
287
|
+
}).includes(option.label)) {
|
|
288
|
+
return true;
|
|
289
|
+
} else {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
// --------------------------------- MAIN -------------------------------------
|
|
295
|
+
return /*#__PURE__*/_react.default.createElement(_DropdownMulti.DropdownContainer, {
|
|
296
|
+
width: width
|
|
297
|
+
}, getAutocompleteMulti());
|
|
298
|
+
};
|
|
299
|
+
var _default = exports.default = DropdownMulti;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.DropdownContainer = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
9
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
|
+
var _templateObject;
|
|
11
|
+
//import './font.css';
|
|
12
|
+
|
|
13
|
+
var DropdownContainer = exports.DropdownContainer = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: ", "; \n text-align: left; \n position: relative; \n align-items: center;\n justify-content: center;\n font-family: Poppins; \n font-size: \"14px\";\n"])), function (props) {
|
|
14
|
+
return props.width;
|
|
15
|
+
});
|