ab-ui-library 1.55.3 → 1.56.0
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.
|
@@ -72,7 +72,9 @@ var MultiTextareaWithChipsComponent = function MultiTextareaWithChipsComponent(_
|
|
|
72
72
|
formProps = _ref.formProps,
|
|
73
73
|
minChipLength = _ref.minChipLength,
|
|
74
74
|
maxChipLength = _ref.maxChipLength,
|
|
75
|
-
onBlurConfig = _ref.onBlurConfig
|
|
75
|
+
onBlurConfig = _ref.onBlurConfig,
|
|
76
|
+
_ref$transformToUpper = _ref.transformToUppercase,
|
|
77
|
+
transformToUppercase = _ref$transformToUpper === void 0 ? false : _ref$transformToUpper;
|
|
76
78
|
var _useState = useState(''),
|
|
77
79
|
_useState2 = _slicedToArray(_useState, 2),
|
|
78
80
|
inputValue = _useState2[0],
|
|
@@ -108,7 +110,8 @@ var MultiTextareaWithChipsComponent = function MultiTextareaWithChipsComponent(_
|
|
|
108
110
|
var handleSelectOption = function handleSelectOption(option) {
|
|
109
111
|
if (chipManagement.getChipTexts().includes(option)) return;
|
|
110
112
|
try {
|
|
111
|
-
var
|
|
113
|
+
var valueToValidate = transformToUppercase ? option.toUpperCase() : option;
|
|
114
|
+
var validatedChip = chipValidation.createValidatedChip(valueToValidate);
|
|
112
115
|
chipManagement.addChip(validatedChip);
|
|
113
116
|
setInputValue('');
|
|
114
117
|
dropdownLogic.closeDropdown();
|
|
@@ -122,7 +125,8 @@ var MultiTextareaWithChipsComponent = function MultiTextareaWithChipsComponent(_
|
|
|
122
125
|
var handleAddCustomValue = useCallback(function (value) {
|
|
123
126
|
if (chipManagement.getChipTexts().includes(value)) return;
|
|
124
127
|
try {
|
|
125
|
-
var
|
|
128
|
+
var valueToValidate = transformToUppercase ? value.toUpperCase() : value;
|
|
129
|
+
var validatedChip = chipValidation.createValidatedChip(valueToValidate);
|
|
126
130
|
chipManagement.addChip(validatedChip);
|
|
127
131
|
setInputValue('');
|
|
128
132
|
setChipError('');
|
|
@@ -131,7 +135,7 @@ var MultiTextareaWithChipsComponent = function MultiTextareaWithChipsComponent(_
|
|
|
131
135
|
setChipError(error instanceof Error ? error.message : 'Invalid value');
|
|
132
136
|
}
|
|
133
137
|
}
|
|
134
|
-
}, [chipManagement, chipValidation, allowInvalidChips]);
|
|
138
|
+
}, [chipManagement, chipValidation, allowInvalidChips, transformToUppercase]);
|
|
135
139
|
var onBlurLogic = useOnBlurLogic({
|
|
136
140
|
inputValue: inputValue,
|
|
137
141
|
disabled: disabled,
|
|
@@ -154,6 +158,9 @@ var MultiTextareaWithChipsComponent = function MultiTextareaWithChipsComponent(_
|
|
|
154
158
|
var handleInputChange = function handleInputChange(e) {
|
|
155
159
|
if (disabled) return;
|
|
156
160
|
var value = e.target.value;
|
|
161
|
+
if (transformToUppercase) {
|
|
162
|
+
value = value.toUpperCase();
|
|
163
|
+
}
|
|
157
164
|
setInputValue(value);
|
|
158
165
|
dropdownLogic.handleInputChange(value);
|
|
159
166
|
};
|
|
@@ -244,7 +251,7 @@ var MultiTextareaWithChipsComponent = function MultiTextareaWithChipsComponent(_
|
|
|
244
251
|
onFocus: handleInputFocus,
|
|
245
252
|
onBlur: handleInputBlur,
|
|
246
253
|
placeholder: inputPlaceholder,
|
|
247
|
-
className:
|
|
254
|
+
className: 'multi-textarea-chips__input',
|
|
248
255
|
disabled: disabled,
|
|
249
256
|
"aria-describedby": hasError ? "".concat(fieldName, "-error") : helperText ? "".concat(fieldName, "-helper") : undefined,
|
|
250
257
|
"aria-invalid": hasError ? 'true' : 'false',
|
|
@@ -30,6 +30,7 @@ export interface TMultiTextareaWithChipsProps extends IFormCompProps {
|
|
|
30
30
|
minChipLength?: number;
|
|
31
31
|
maxChipLength?: number;
|
|
32
32
|
searchPlaceholderText?: string;
|
|
33
|
+
transformToUppercase?: boolean;
|
|
33
34
|
typeAndEnterPlaceholderText?: string;
|
|
34
35
|
noOptionsPlaceholderText?: string;
|
|
35
36
|
fieldName?: string;
|