@dxc-technology/halstack-react 0.0.0-2d619b4 → 0.0.0-2f08981
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/README.md +1 -1
- package/dist/ThemeContext.js +74 -64
- package/dist/V3Select/V3Select.js +549 -0
- package/dist/V3Select/index.d.ts +27 -0
- package/dist/V3Textarea/V3Textarea.js +264 -0
- package/dist/V3Textarea/index.d.ts +27 -0
- package/dist/accordion/index.d.ts +28 -0
- package/dist/accordion-group/index.d.ts +16 -0
- package/dist/alert/Alert.js +5 -5
- package/dist/box/index.d.ts +25 -0
- package/dist/button/Button.js +3 -3
- package/dist/button/index.d.ts +24 -0
- package/dist/card/index.d.ts +22 -0
- package/dist/checkbox/Checkbox.js +4 -5
- package/dist/checkbox/index.d.ts +24 -0
- package/dist/chip/index.d.ts +22 -0
- package/dist/common/variables.js +231 -91
- package/dist/date/index.d.ts +27 -0
- package/dist/{new-date/NewDate.js → date-input/DateInput.js} +62 -62
- package/dist/{new-date → date-input}/index.d.ts +25 -16
- package/dist/dialog/index.d.ts +18 -0
- package/dist/dropdown/index.d.ts +26 -0
- package/dist/file-input/FileInput.js +13 -10
- package/dist/file-input/FileItem.js +33 -9
- package/dist/file-input/index.d.ts +81 -0
- package/dist/footer/Footer.js +44 -18
- package/dist/footer/Icons.js +77 -0
- package/dist/footer/index.d.ts +25 -0
- package/dist/header/Header.js +122 -55
- package/dist/header/Icons.js +59 -0
- package/dist/header/index.d.ts +25 -0
- package/dist/heading/Heading.js +12 -0
- package/dist/heading/index.d.ts +17 -0
- package/dist/input-text/Icons.js +22 -0
- package/dist/input-text/InputText.js +4 -6
- package/dist/input-text/index.d.ts +36 -0
- package/dist/layout/ApplicationLayout.js +4 -8
- package/dist/layout/Icons.js +55 -0
- package/dist/link/index.d.ts +23 -0
- package/dist/main.d.ts +39 -5
- package/dist/main.js +30 -30
- package/dist/{number/Number.js → number-input/NumberInput.js} +9 -11
- package/dist/{number/NumberContext.js → number-input/NumberInputContext.js} +2 -2
- package/dist/{number → number-input}/index.d.ts +27 -9
- package/dist/paginator/Icons.js +66 -0
- package/dist/paginator/Paginator.js +53 -37
- package/dist/paginator/index.d.ts +20 -0
- package/dist/{password/Password.js → password-input/PasswordInput.js} +14 -11
- package/dist/{password → password-input}/index.d.ts +30 -16
- package/dist/progress-bar/index.d.ts +18 -0
- package/dist/radio/index.d.ts +23 -0
- package/dist/resultsetTable/index.d.ts +19 -0
- package/dist/select/Select.js +848 -301
- package/dist/select/index.d.ts +53 -0
- package/dist/sidenav/index.d.ts +13 -0
- package/dist/slider/Slider.js +104 -19
- package/dist/slider/index.d.ts +29 -0
- package/dist/spinner/index.d.ts +17 -0
- package/dist/switch/index.d.ts +24 -0
- package/dist/table/index.d.ts +13 -0
- package/dist/tabs/index.d.ts +19 -0
- package/dist/tag/index.d.ts +24 -0
- package/dist/{new-input-text/NewInputText.js → text-input/TextInput.js} +132 -135
- package/dist/{new-input-text → text-input}/index.d.ts +31 -16
- package/dist/textarea/Textarea.js +227 -122
- package/dist/{new-textarea → textarea}/index.d.ts +34 -18
- package/dist/toggle/index.d.ts +21 -0
- package/dist/toggle-group/ToggleGroup.js +132 -28
- package/dist/toggle-group/index.d.ts +21 -0
- package/dist/upload/buttons-upload/ButtonsUpload.js +7 -11
- package/dist/upload/buttons-upload/Icons.js +40 -0
- package/dist/upload/dragAndDropArea/DragAndDropArea.js +14 -14
- package/dist/upload/dragAndDropArea/Icons.js +39 -0
- package/dist/upload/file-upload/FileToUpload.js +26 -21
- package/dist/upload/file-upload/Icons.js +66 -0
- package/dist/upload/index.d.ts +15 -0
- package/dist/upload/transaction/Icons.js +160 -0
- package/dist/upload/transaction/Transaction.js +11 -38
- package/dist/wizard/Icons.js +65 -0
- package/dist/wizard/Wizard.js +3 -9
- package/dist/wizard/index.d.ts +18 -0
- package/package.json +5 -9
- package/test/Date.test.js +13 -11
- package/test/{NewDate.test.js → DateInput.test.js} +66 -27
- package/test/FileInput.test.js +164 -2
- package/test/Footer.test.js +2 -7
- package/test/Header.test.js +5 -10
- package/test/Heading.test.js +60 -12
- package/test/{Number.test.js → NumberInput.test.js} +84 -66
- package/test/Paginator.test.js +5 -1
- package/test/PasswordInput.test.js +83 -0
- package/test/ResultsetTable.test.js +5 -4
- package/test/Select.test.js +374 -171
- package/test/Slider.test.js +9 -17
- package/test/{NewInputText.test.js → TextInput.test.js} +138 -272
- package/test/Textarea.test.js +193 -0
- package/test/ToggleGroup.test.js +5 -1
- package/test/Upload.test.js +1 -1
- package/test/V3Select.test.js +212 -0
- package/test/{TextArea.test.js → V3TextArea.test.js} +6 -7
- package/dist/checkbox/Checkbox.stories.js +0 -144
- package/dist/checkbox/readme.md +0 -116
- package/dist/date/Date.stories.js +0 -205
- package/dist/date/readme.md +0 -73
- package/dist/footer/Footer.stories.js +0 -94
- package/dist/footer/dxc_logo.svg +0 -15
- package/dist/footer/readme.md +0 -41
- package/dist/header/Header.stories.js +0 -176
- package/dist/header/close_icon.svg +0 -1
- package/dist/header/dxc_logo_black.svg +0 -8
- package/dist/header/hamb_menu_black.svg +0 -1
- package/dist/header/hamb_menu_white.svg +0 -1
- package/dist/header/readme.md +0 -33
- package/dist/input-text/InputText.stories.js +0 -209
- package/dist/input-text/error.svg +0 -1
- package/dist/input-text/readme.md +0 -91
- package/dist/layout/facebook.svg +0 -45
- package/dist/layout/linkedin.svg +0 -50
- package/dist/layout/twitter.svg +0 -53
- package/dist/link/readme.md +0 -51
- package/dist/new-textarea/NewTextarea.js +0 -365
- package/dist/paginator/images/next.svg +0 -3
- package/dist/paginator/images/nextPage.svg +0 -3
- package/dist/paginator/images/previous.svg +0 -3
- package/dist/paginator/images/previousPage.svg +0 -3
- package/dist/paginator/readme.md +0 -50
- package/dist/password/styles.css +0 -3
- package/dist/progress-bar/ProgressBar.stories.js +0 -280
- package/dist/progress-bar/readme.md +0 -63
- package/dist/radio/Radio.stories.js +0 -166
- package/dist/radio/readme.md +0 -70
- package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
- package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
- package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
- package/dist/slider/Slider.stories.js +0 -241
- package/dist/slider/readme.md +0 -64
- package/dist/spinner/Spinner.stories.js +0 -183
- package/dist/spinner/readme.md +0 -65
- package/dist/switch/Switch.stories.js +0 -134
- package/dist/switch/readme.md +0 -133
- package/dist/tabs/Tabs.stories.js +0 -130
- package/dist/tabs/readme.md +0 -78
- package/dist/tabs-for-sections/TabsForSections.js +0 -92
- package/dist/tabs-for-sections/readme.md +0 -78
- package/dist/toggle/Toggle.stories.js +0 -297
- package/dist/toggle/readme.md +0 -80
- package/dist/upload/Upload.stories.js +0 -72
- package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
- package/dist/upload/buttons-upload/upload-button.svg +0 -1
- package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
- package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
- package/dist/upload/file-upload/audio-icon.svg +0 -4
- package/dist/upload/file-upload/close.svg +0 -4
- package/dist/upload/file-upload/file-icon.svg +0 -4
- package/dist/upload/file-upload/video-icon.svg +0 -4
- package/dist/upload/readme.md +0 -37
- package/dist/upload/transaction/audio-icon-err.svg +0 -4
- package/dist/upload/transaction/audio-icon.svg +0 -4
- package/dist/upload/transaction/error-icon.svg +0 -4
- package/dist/upload/transaction/file-icon-err.svg +0 -4
- package/dist/upload/transaction/file-icon.svg +0 -4
- package/dist/upload/transaction/image-icon-err.svg +0 -4
- package/dist/upload/transaction/image-icon.svg +0 -4
- package/dist/upload/transaction/success-icon.svg +0 -4
- package/dist/upload/transaction/video-icon-err.svg +0 -4
- package/dist/upload/transaction/video-icon.svg +0 -4
- package/dist/wizard/invalid_icon.svg +0 -5
- package/dist/wizard/valid_icon.svg +0 -5
- package/dist/wizard/validation-wrong.svg +0 -6
- package/test/NewTextarea.test.js +0 -252
- package/test/Password.test.js +0 -76
- package/test/TabsForSections.test.js +0 -34
|
@@ -33,11 +33,21 @@ var _uuid = require("uuid");
|
|
|
33
33
|
|
|
34
34
|
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
|
|
35
35
|
|
|
36
|
-
var
|
|
36
|
+
var _NumberInputContext = _interopRequireDefault(require("../number-input/NumberInputContext.js"));
|
|
37
37
|
|
|
38
|
-
function
|
|
38
|
+
function _templateObject17() {
|
|
39
39
|
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: calc((39px - 1.75em) / 2) 0 calc((39px - 1.75em) / 2) 1em;\n align-items: center;\n font-size: 0.875rem;\n line-height: 1.75em;\n"]);
|
|
40
40
|
|
|
41
|
+
_templateObject17 = function _templateObject17() {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function _templateObject16() {
|
|
49
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n margin-right: 0.5rem;\n height: 18px;\n width: 18px;\n color: ", ";\n\n svg {\n line-height: 1.75em;\n font-size: 0.875rem;\n }\n"]);
|
|
50
|
+
|
|
41
51
|
_templateObject16 = function _templateObject16() {
|
|
42
52
|
return data;
|
|
43
53
|
};
|
|
@@ -86,7 +96,7 @@ function _templateObject12() {
|
|
|
86
96
|
}
|
|
87
97
|
|
|
88
98
|
function _templateObject11() {
|
|
89
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n margin-left: calc(1rem * 0.25);\n
|
|
99
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n margin-left: calc(1rem * 0.25);\n color: ", ";\n\n svg {\n line-height: 18px;\n font-size: 1.25rem;\n }\n"]);
|
|
90
100
|
|
|
91
101
|
_templateObject11 = function _templateObject11() {
|
|
92
102
|
return data;
|
|
@@ -116,7 +126,7 @@ function _templateObject9() {
|
|
|
116
126
|
}
|
|
117
127
|
|
|
118
128
|
function _templateObject8() {
|
|
119
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius:
|
|
129
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 2px;\n padding: 3px;\n margin-left: calc(1rem * 0.25);\n ", "\n\n box-shadow: 0 0 0 2px transparent;\n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n svg {\n line-height: 18px;\n }\n"]);
|
|
120
130
|
|
|
121
131
|
_templateObject8 = function _templateObject8() {
|
|
122
132
|
return data;
|
|
@@ -156,7 +166,7 @@ function _templateObject5() {
|
|
|
156
166
|
}
|
|
157
167
|
|
|
158
168
|
function _templateObject4() {
|
|
159
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height:
|
|
169
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
160
170
|
|
|
161
171
|
_templateObject4 = function _templateObject4() {
|
|
162
172
|
return data;
|
|
@@ -176,7 +186,7 @@ function _templateObject3() {
|
|
|
176
186
|
}
|
|
177
187
|
|
|
178
188
|
function _templateObject2() {
|
|
179
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height:
|
|
189
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
180
190
|
|
|
181
191
|
_templateObject2 = function _templateObject2() {
|
|
182
192
|
return data;
|
|
@@ -224,15 +234,17 @@ var getLengthErrorMessage = function getLengthErrorMessage(length) {
|
|
|
224
234
|
return "Min length ".concat(length.min, ", max length ").concat(length.max, ".");
|
|
225
235
|
};
|
|
226
236
|
|
|
237
|
+
var getPatternErrorMessage = function getPatternErrorMessage() {
|
|
238
|
+
return "Please match the format requested.";
|
|
239
|
+
};
|
|
240
|
+
|
|
227
241
|
var patternMatch = function patternMatch(pattern, value) {
|
|
228
242
|
return new RegExp(pattern).test(value);
|
|
229
243
|
};
|
|
230
244
|
|
|
231
|
-
var
|
|
232
|
-
|
|
233
|
-
};
|
|
245
|
+
var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
246
|
+
var _action$title;
|
|
234
247
|
|
|
235
|
-
var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
236
248
|
var _ref$label = _ref.label,
|
|
237
249
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
238
250
|
_ref$name = _ref.name,
|
|
@@ -298,53 +310,30 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
298
310
|
isAutosuggestError = _useState12[0],
|
|
299
311
|
changeIsAutosuggestError = _useState12[1];
|
|
300
312
|
|
|
301
|
-
var _useState13 = (0, _react.useState)(
|
|
313
|
+
var _useState13 = (0, _react.useState)([]),
|
|
302
314
|
_useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
|
|
303
|
-
|
|
304
|
-
|
|
315
|
+
filteredSuggestions = _useState14[0],
|
|
316
|
+
changeFilteredSuggestions = _useState14[1];
|
|
305
317
|
|
|
306
|
-
var _useState15 = (0, _react.useState)(
|
|
318
|
+
var _useState15 = (0, _react.useState)(-1),
|
|
307
319
|
_useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
var _useState17 = (0, _react.useState)(-1),
|
|
312
|
-
_useState18 = (0, _slicedToArray2["default"])(_useState17, 2),
|
|
313
|
-
visualFocusedSuggIndex = _useState18[0],
|
|
314
|
-
changeVisualFocusedSuggIndex = _useState18[1];
|
|
315
|
-
|
|
316
|
-
var _useState19 = (0, _react.useState)(null),
|
|
317
|
-
_useState20 = (0, _slicedToArray2["default"])(_useState19, 2),
|
|
318
|
-
minNumber = _useState20[0],
|
|
319
|
-
setMinNumber = _useState20[1];
|
|
320
|
+
visualFocusedSuggIndex = _useState16[0],
|
|
321
|
+
changeVisualFocusedSuggIndex = _useState16[1];
|
|
320
322
|
|
|
321
|
-
var
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
setMaxNumber = _useState22[1];
|
|
325
|
-
|
|
326
|
-
var _useState23 = (0, _react.useState)(null),
|
|
327
|
-
_useState24 = (0, _slicedToArray2["default"])(_useState23, 2),
|
|
328
|
-
stepNumber = _useState24[0],
|
|
329
|
-
setStepNumber = _useState24[1];
|
|
323
|
+
var _useState17 = (0, _react.useState)("input-".concat((0, _uuid.v4)())),
|
|
324
|
+
_useState18 = (0, _slicedToArray2["default"])(_useState17, 1),
|
|
325
|
+
inputId = _useState18[0];
|
|
330
326
|
|
|
331
327
|
var suggestionsRef = (0, _react.useRef)(null);
|
|
332
328
|
var inputRef = (0, _react.useRef)(null);
|
|
333
329
|
var actionRef = (0, _react.useRef)(null);
|
|
334
330
|
var colorsTheme = (0, _useTheme["default"])();
|
|
335
331
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
336
|
-
var inputId = "input-".concat((0, _uuid.v4)());
|
|
337
332
|
var autosuggestId = "".concat(inputId, "-listBox");
|
|
338
333
|
var errorId = "error-message-".concat(inputId);
|
|
339
|
-
var
|
|
334
|
+
var numberInputContext = (0, _react.useContext)(_NumberInputContext["default"]);
|
|
340
335
|
|
|
341
|
-
var
|
|
342
|
-
var changedValue = typeof newValue === "number" ? newValue.toString() : newValue;
|
|
343
|
-
value !== null && value !== void 0 ? value : setInnerValue(newValue);
|
|
344
|
-
typeof onChange === "function" && onChange(changedValue);
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
var notOptionalCheck = function notOptionalCheck(value) {
|
|
336
|
+
var isNotOptional = function isNotOptional(value) {
|
|
348
337
|
return value === "" && !optional;
|
|
349
338
|
};
|
|
350
339
|
|
|
@@ -353,11 +342,17 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
353
342
|
};
|
|
354
343
|
|
|
355
344
|
var isNumberIncorrect = function isNumberIncorrect(value) {
|
|
356
|
-
return minNumber && parseInt(value) < minNumber || maxNumber && parseInt(value) > maxNumber;
|
|
345
|
+
return (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) && parseInt(value) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) && parseInt(value) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
var isTextInputType = function isTextInputType() {
|
|
349
|
+
var _inputRef$current, _inputRef$current2;
|
|
350
|
+
|
|
351
|
+
return !(inputRef !== null && inputRef !== void 0 && (_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.getAttribute("type")) || (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.getAttribute("type")) === "text";
|
|
357
352
|
};
|
|
358
353
|
|
|
359
354
|
var getNumberErrorMessage = function getNumberErrorMessage(value) {
|
|
360
|
-
if (minNumber && parseInt(value) < minNumber) return "Value must be greater than or equal to ".concat(minNumber, ".");else if (maxNumber && parseInt(value) > maxNumber) return "Value must be less than or equal to ".concat(maxNumber, ".");
|
|
355
|
+
if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && parseInt(value) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) return "Value must be greater than or equal to ".concat(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber, ".");else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(value) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) return "Value must be less than or equal to ".concat(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber, ".");
|
|
361
356
|
};
|
|
362
357
|
|
|
363
358
|
var hasInputSuggestions = function hasInputSuggestions() {
|
|
@@ -373,6 +368,27 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
373
368
|
changeVisualFocusedSuggIndex(-1);
|
|
374
369
|
};
|
|
375
370
|
|
|
371
|
+
var changeValue = function changeValue(newValue) {
|
|
372
|
+
value !== null && value !== void 0 ? value : setInnerValue(newValue);
|
|
373
|
+
var changedValue = typeof newValue === "number" ? newValue.toString() : newValue;
|
|
374
|
+
if (isNotOptional(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
375
|
+
value: changedValue,
|
|
376
|
+
error: getNotOptionalErrorMessage()
|
|
377
|
+
});else if (isLengthIncorrect(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
378
|
+
value: changedValue,
|
|
379
|
+
error: getLengthErrorMessage(length)
|
|
380
|
+
});else if (newValue && pattern && !patternMatch(pattern, newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
381
|
+
value: changedValue,
|
|
382
|
+
error: getPatternErrorMessage()
|
|
383
|
+
});else if (newValue && isNumberIncorrect(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
384
|
+
value: changedValue,
|
|
385
|
+
error: getNumberErrorMessage(newValue)
|
|
386
|
+
});else onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
387
|
+
value: changedValue,
|
|
388
|
+
error: null
|
|
389
|
+
});
|
|
390
|
+
};
|
|
391
|
+
|
|
376
392
|
var handleInputContainerOnClick = function handleInputContainerOnClick() {
|
|
377
393
|
document.activeElement !== actionRef.current && inputRef.current.focus();
|
|
378
394
|
};
|
|
@@ -388,38 +404,22 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
388
404
|
|
|
389
405
|
var handleIOnBlur = function handleIOnBlur(event) {
|
|
390
406
|
suggestions && closeSuggestions();
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
value: event.target.value,
|
|
408
|
-
error: getPatternErrorMessage()
|
|
409
|
-
});
|
|
410
|
-
} else if (event.target.value && isNumberIncorrect(event.target.value)) {
|
|
411
|
-
changeValidationError(getNumberErrorMessage(event.target.value));
|
|
412
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
413
|
-
value: event.target.value,
|
|
414
|
-
error: getNumberErrorMessage(event.target.value)
|
|
415
|
-
});
|
|
416
|
-
} else {
|
|
417
|
-
changeValidationError("");
|
|
418
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
419
|
-
value: event.target.value,
|
|
420
|
-
error: null
|
|
421
|
-
});
|
|
422
|
-
}
|
|
407
|
+
if (isNotOptional(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
408
|
+
value: event.target.value,
|
|
409
|
+
error: getNotOptionalErrorMessage()
|
|
410
|
+
});else if (isLengthIncorrect(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
411
|
+
value: event.target.value,
|
|
412
|
+
error: getLengthErrorMessage(length)
|
|
413
|
+
});else if (event.target.value && pattern && !patternMatch(pattern, event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
414
|
+
value: event.target.value,
|
|
415
|
+
error: getPatternErrorMessage()
|
|
416
|
+
});else if (event.target.value && isNumberIncorrect(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
417
|
+
value: event.target.value,
|
|
418
|
+
error: getNumberErrorMessage(event.target.value)
|
|
419
|
+
});else onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
420
|
+
value: event.target.value,
|
|
421
|
+
error: null
|
|
422
|
+
});
|
|
423
423
|
};
|
|
424
424
|
|
|
425
425
|
var handleIOnFocus = function handleIOnFocus() {
|
|
@@ -430,7 +430,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
430
430
|
switch (event.keyCode) {
|
|
431
431
|
case 40:
|
|
432
432
|
// Arrow Down
|
|
433
|
-
if (
|
|
433
|
+
if (numberInputContext) {
|
|
434
434
|
decrementNumber();
|
|
435
435
|
event.preventDefault();
|
|
436
436
|
} else {
|
|
@@ -450,7 +450,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
450
450
|
|
|
451
451
|
case 38:
|
|
452
452
|
// Arrow Up
|
|
453
|
-
if (
|
|
453
|
+
if (numberInputContext) {
|
|
454
454
|
incrementNumber();
|
|
455
455
|
event.preventDefault();
|
|
456
456
|
} else {
|
|
@@ -492,15 +492,12 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
492
492
|
};
|
|
493
493
|
|
|
494
494
|
var setNumberProps = function setNumberProps(type, min, max, step) {
|
|
495
|
-
var _inputRef$
|
|
495
|
+
var _inputRef$current3, _inputRef$current4, _inputRef$current5, _inputRef$current6;
|
|
496
496
|
|
|
497
|
-
type && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$
|
|
498
|
-
min && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$
|
|
499
|
-
max && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$
|
|
500
|
-
step && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$
|
|
501
|
-
setMinNumber(min);
|
|
502
|
-
setMaxNumber(max);
|
|
503
|
-
setStepNumber(step);
|
|
497
|
+
type && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.setAttribute("type", type));
|
|
498
|
+
min && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.setAttribute("min", min));
|
|
499
|
+
max && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : _inputRef$current5.setAttribute("max", max));
|
|
500
|
+
step && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : _inputRef$current6.setAttribute("step", step));
|
|
504
501
|
};
|
|
505
502
|
|
|
506
503
|
(0, _react.useLayoutEffect)(function () {
|
|
@@ -512,8 +509,6 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
512
509
|
return changeIsScrollable(false);
|
|
513
510
|
}, [isScrollable, visualFocusedSuggIndex]);
|
|
514
511
|
(0, _react.useEffect)(function () {
|
|
515
|
-
var _inputRef$current5;
|
|
516
|
-
|
|
517
512
|
if (typeof suggestions === "function") {
|
|
518
513
|
changeIsSearching(true);
|
|
519
514
|
changeIsAutosuggestError(false);
|
|
@@ -539,10 +534,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
539
534
|
changeVisualFocusedSuggIndex(-1);
|
|
540
535
|
}
|
|
541
536
|
|
|
542
|
-
|
|
543
|
-
inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : _inputRef$current5.addEventListener("wheel", function (event) {
|
|
544
|
-
return event.preventDefault();
|
|
545
|
-
});
|
|
537
|
+
numberInputContext && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
|
|
546
538
|
}, [value, innerValue, suggestions]);
|
|
547
539
|
var defaultClearAction = {
|
|
548
540
|
onClick: function onClick() {
|
|
@@ -575,18 +567,18 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
575
567
|
}));
|
|
576
568
|
|
|
577
569
|
var decrementNumber = function decrementNumber() {
|
|
578
|
-
var numberValue = value
|
|
570
|
+
var numberValue = value !== null && value !== void 0 ? value : innerValue;
|
|
579
571
|
|
|
580
|
-
if (minNumber && parseInt(numberValue) < minNumber) {
|
|
572
|
+
if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && parseInt(numberValue) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) {
|
|
581
573
|
changeValue(parseInt(numberValue));
|
|
582
|
-
} else if (maxNumber && parseInt(numberValue) > maxNumber) {
|
|
583
|
-
changeValue(maxNumber);
|
|
584
|
-
} else if (minNumber && (parseInt(numberValue) === minNumber || numberValue === "" || stepNumber && parseInt(numberValue) - stepNumber < minNumber)) {
|
|
585
|
-
changeValue(minNumber);
|
|
586
|
-
} else if (stepNumber && minNumber && parseInt(numberValue) - stepNumber >= minNumber || stepNumber && numberValue !== "") {
|
|
587
|
-
changeValue(parseInt(numberValue) - stepNumber);
|
|
588
|
-
} else if (stepNumber && numberValue == "") {
|
|
589
|
-
changeValue(-stepNumber);
|
|
574
|
+
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(numberValue) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) {
|
|
575
|
+
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
576
|
+
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && (parseInt(numberValue) === (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || numberValue === "" || numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && parseInt(numberValue) - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber))) {
|
|
577
|
+
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
|
|
578
|
+
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && parseInt(numberValue) - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) >= (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue !== "") {
|
|
579
|
+
changeValue(parseInt(numberValue) - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
580
|
+
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
|
|
581
|
+
changeValue(-(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
590
582
|
} else if (numberValue === "") {
|
|
591
583
|
changeValue(-1);
|
|
592
584
|
} else {
|
|
@@ -595,18 +587,18 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
595
587
|
};
|
|
596
588
|
|
|
597
589
|
var incrementNumber = function incrementNumber() {
|
|
598
|
-
var numberValue = value
|
|
590
|
+
var numberValue = value !== null && value !== void 0 ? value : innerValue;
|
|
599
591
|
|
|
600
|
-
if (maxNumber && parseInt(numberValue) > maxNumber) {
|
|
592
|
+
if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(numberValue) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) {
|
|
601
593
|
changeValue(parseInt(numberValue));
|
|
602
|
-
} else if (minNumber && (parseInt(numberValue) < minNumber || numberValue === "")) {
|
|
603
|
-
changeValue(minNumber);
|
|
604
|
-
} else if (maxNumber && (parseInt(numberValue) === maxNumber || stepNumber && parseInt(numberValue) + stepNumber > maxNumber)) {
|
|
605
|
-
changeValue(maxNumber);
|
|
606
|
-
} else if (stepNumber && maxNumber && parseInt(numberValue) + stepNumber <= maxNumber || stepNumber && numberValue !== "") {
|
|
607
|
-
changeValue(parseInt(numberValue) + stepNumber);
|
|
608
|
-
} else if (stepNumber && numberValue == "") {
|
|
609
|
-
changeValue(stepNumber);
|
|
594
|
+
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && (parseInt(numberValue) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || numberValue === "")) {
|
|
595
|
+
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
|
|
596
|
+
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && (parseInt(numberValue) === (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) || numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && parseInt(numberValue) + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber))) {
|
|
597
|
+
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
598
|
+
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(numberValue) + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber) <= (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber) || numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue !== "") {
|
|
599
|
+
changeValue(parseInt(numberValue) + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
600
|
+
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
|
|
601
|
+
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber);
|
|
610
602
|
} else if (numberValue === "") {
|
|
611
603
|
changeValue(1);
|
|
612
604
|
} else {
|
|
@@ -651,12 +643,6 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
651
643
|
}))
|
|
652
644
|
};
|
|
653
645
|
|
|
654
|
-
var isTextInputType = function isTextInputType() {
|
|
655
|
-
var _inputRef$current6, _inputRef$current7;
|
|
656
|
-
|
|
657
|
-
return !(inputRef !== null && inputRef !== void 0 && (_inputRef$current6 = inputRef.current) !== null && _inputRef$current6 !== void 0 && _inputRef$current6.getAttribute("type")) || (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current7 = inputRef.current) === null || _inputRef$current7 === void 0 ? void 0 : _inputRef$current7.getAttribute("type")) === "text";
|
|
658
|
-
};
|
|
659
|
-
|
|
660
646
|
var HighlightedSuggestion = function HighlightedSuggestion(_ref2) {
|
|
661
647
|
var suggestion = _ref2.suggestion,
|
|
662
648
|
index = _ref2.index;
|
|
@@ -665,11 +651,11 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
665
651
|
var noMatchedWords = suggestion.replace(regEx, "");
|
|
666
652
|
return _react["default"].createElement(Suggestion, {
|
|
667
653
|
id: "suggestion-".concat(index),
|
|
668
|
-
onMouseDown: function onMouseDown() {
|
|
669
|
-
changeIsActiveSuggestion(true);
|
|
654
|
+
onMouseDown: function onMouseDown(event) {
|
|
655
|
+
event.button === 0 && changeIsActiveSuggestion(true);
|
|
670
656
|
},
|
|
671
|
-
onMouseUp: function onMouseUp() {
|
|
672
|
-
if (isActiveSuggestion) {
|
|
657
|
+
onMouseUp: function onMouseUp(event) {
|
|
658
|
+
if (event.button === 0 && isActiveSuggestion) {
|
|
673
659
|
changeValue(suggestion);
|
|
674
660
|
changeIsActiveSuggestion(false);
|
|
675
661
|
closeSuggestions();
|
|
@@ -689,7 +675,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
689
675
|
};
|
|
690
676
|
|
|
691
677
|
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
692
|
-
theme: colorsTheme.
|
|
678
|
+
theme: colorsTheme.textInput
|
|
693
679
|
}, _react["default"].createElement(DxcInput, {
|
|
694
680
|
margin: margin,
|
|
695
681
|
ref: ref,
|
|
@@ -702,7 +688,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
702
688
|
disabled: disabled,
|
|
703
689
|
backgroundType: backgroundType
|
|
704
690
|
}, helperText), _react["default"].createElement(InputContainer, {
|
|
705
|
-
error: error
|
|
691
|
+
error: error,
|
|
706
692
|
disabled: disabled,
|
|
707
693
|
backgroundType: backgroundType,
|
|
708
694
|
onClick: handleInputContainerOnClick
|
|
@@ -723,6 +709,8 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
723
709
|
ref: inputRef,
|
|
724
710
|
backgroundType: backgroundType,
|
|
725
711
|
pattern: pattern,
|
|
712
|
+
minLength: length === null || length === void 0 ? void 0 : length.min,
|
|
713
|
+
maxLength: length === null || length === void 0 ? void 0 : length.max,
|
|
726
714
|
autoComplete: autocomplete,
|
|
727
715
|
tabIndex: tabIndex,
|
|
728
716
|
role: isTextInputType() && hasInputSuggestions() ? "combobox" : "textbox",
|
|
@@ -730,10 +718,10 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
730
718
|
"aria-controls": isTextInputType() && hasInputSuggestions() ? inputId : undefined,
|
|
731
719
|
"aria-expanded": isTextInputType() && hasInputSuggestions() ? isOpen ? "true" : "false" : undefined,
|
|
732
720
|
"aria-activedescendant": isTextInputType() && hasInputSuggestions() && isOpen && visualFocusedSuggIndex !== -1 ? "suggestion-".concat(visualFocusedSuggIndex) : undefined,
|
|
733
|
-
"aria-invalid": error
|
|
734
|
-
"aria-describedby": error
|
|
721
|
+
"aria-invalid": error ? "true" : "false",
|
|
722
|
+
"aria-describedby": error ? errorId : undefined,
|
|
735
723
|
"aria-required": optional ? "false" : "true"
|
|
736
|
-
}), !disabled &&
|
|
724
|
+
}), !disabled && error && _react["default"].createElement(ErrorIcon, {
|
|
737
725
|
backgroundType: backgroundType,
|
|
738
726
|
"aria-label": "Error"
|
|
739
727
|
}, errorIcon), !disabled && clearable && (value !== null && value !== void 0 ? value : innerValue).length > 0 && _react["default"].createElement(Action, {
|
|
@@ -741,7 +729,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
741
729
|
backgroundType: backgroundType,
|
|
742
730
|
tabIndex: tabIndex,
|
|
743
731
|
"aria-label": "Clear"
|
|
744
|
-
}, defaultClearAction.icon), (
|
|
732
|
+
}, defaultClearAction.icon), (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" ? _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(Action, {
|
|
745
733
|
ref: actionRef,
|
|
746
734
|
disabled: disabled,
|
|
747
735
|
onClick: decrementAction.onClick,
|
|
@@ -759,6 +747,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
759
747
|
ref: actionRef,
|
|
760
748
|
disabled: disabled,
|
|
761
749
|
onClick: action.onClick,
|
|
750
|
+
title: (_action$title = action.title) !== null && _action$title !== void 0 ? _action$title : action.title,
|
|
762
751
|
backgroundType: backgroundType,
|
|
763
752
|
tabIndex: tabIndex
|
|
764
753
|
}, typeof action.icon === "string" ? _react["default"].createElement(ActionIcon, {
|
|
@@ -784,12 +773,12 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
784
773
|
suggestion: suggestion,
|
|
785
774
|
index: index
|
|
786
775
|
});
|
|
787
|
-
}), isSearching && _react["default"].createElement(SuggestionsSystemMessage, null, "Searching..."), isAutosuggestError && _react["default"].createElement(SuggestionsError, null, _react["default"].createElement(
|
|
776
|
+
}), isSearching && _react["default"].createElement(SuggestionsSystemMessage, null, "Searching..."), isAutosuggestError && _react["default"].createElement(SuggestionsError, null, _react["default"].createElement(SuggestionsErrorIcon, {
|
|
788
777
|
backgroundType: backgroundType
|
|
789
778
|
}, errorIcon), "Error fetching data"))), !disabled && _react["default"].createElement(Error, {
|
|
790
779
|
id: errorId,
|
|
791
780
|
backgroundType: backgroundType
|
|
792
|
-
}, error
|
|
781
|
+
}, error)));
|
|
793
782
|
});
|
|
794
783
|
|
|
795
784
|
var sizes = {
|
|
@@ -827,6 +816,8 @@ var Label = _styledComponents["default"].label(_templateObject2(), function (pro
|
|
|
827
816
|
return props.theme.labelFontStyle;
|
|
828
817
|
}, function (props) {
|
|
829
818
|
return props.theme.labelFontWeight;
|
|
819
|
+
}, function (props) {
|
|
820
|
+
return props.theme.labelLineHeight;
|
|
830
821
|
});
|
|
831
822
|
|
|
832
823
|
var OptionalLabel = _styledComponents["default"].span(_templateObject3(), function (props) {
|
|
@@ -843,6 +834,8 @@ var HelperText = _styledComponents["default"].span(_templateObject4(), function
|
|
|
843
834
|
return props.theme.helperTextFontStyle;
|
|
844
835
|
}, function (props) {
|
|
845
836
|
return props.theme.helperTextFontWeight;
|
|
837
|
+
}, function (props) {
|
|
838
|
+
return props.theme.helperTextLineHeight;
|
|
846
839
|
});
|
|
847
840
|
|
|
848
841
|
var InputContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
|
|
@@ -935,9 +928,13 @@ var SuggestionsSystemMessage = _styledComponents["default"].span(_templateObject
|
|
|
935
928
|
return props.theme.systemMessageFontColor;
|
|
936
929
|
});
|
|
937
930
|
|
|
938
|
-
var
|
|
931
|
+
var SuggestionsErrorIcon = _styledComponents["default"].span(_templateObject16(), function (props) {
|
|
932
|
+
return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
var SuggestionsError = _styledComponents["default"].span(_templateObject17());
|
|
939
936
|
|
|
940
|
-
|
|
937
|
+
DxcTextInput.propTypes = {
|
|
941
938
|
label: _propTypes["default"].string,
|
|
942
939
|
name: _propTypes["default"].string,
|
|
943
940
|
value: _propTypes["default"].string,
|
|
@@ -973,5 +970,5 @@ DxcNewInputText.propTypes = {
|
|
|
973
970
|
}),
|
|
974
971
|
tabIndex: _propTypes["default"].number
|
|
975
972
|
};
|
|
976
|
-
var _default =
|
|
973
|
+
var _default = DxcTextInput;
|
|
977
974
|
exports["default"] = _default;
|
|
@@ -47,8 +47,10 @@ type Props = {
|
|
|
47
47
|
*/
|
|
48
48
|
disabled?: boolean;
|
|
49
49
|
/**
|
|
50
|
-
* If true, the input will be optional, showing '(Optional)'
|
|
51
|
-
* Otherwise, the field will be considered required and
|
|
50
|
+
* If true, the input will be optional, showing '(Optional)'
|
|
51
|
+
* next to the label. Otherwise, the field will be considered required and an error will be
|
|
52
|
+
* passed as a parameter to the OnBlur and onChange functions when it has
|
|
53
|
+
* not been filled.
|
|
52
54
|
*/
|
|
53
55
|
optional?: boolean;
|
|
54
56
|
/**
|
|
@@ -60,17 +62,23 @@ type Props = {
|
|
|
60
62
|
*/
|
|
61
63
|
suffix?: string;
|
|
62
64
|
/**
|
|
63
|
-
* This function will be called when the user types within the input
|
|
65
|
+
* This function will be called when the user types within the input
|
|
66
|
+
* element of the component. An object including the current value and
|
|
67
|
+
* the error (if the value entered is not valid) will be passed to this
|
|
68
|
+
* function. If there is no error, error will be null.
|
|
64
69
|
*/
|
|
65
|
-
onChange?: (value: string) => void;
|
|
70
|
+
onChange?: (val: { value: string; error: string }) => void;
|
|
66
71
|
/**
|
|
67
|
-
* This function will be called when the input loses the focus.
|
|
68
|
-
*
|
|
72
|
+
* This function will be called when the input element loses the focus.
|
|
73
|
+
* An object including the input value and the error (if the value
|
|
74
|
+
* entered is not valid) will be passed to this function. If there is no error,
|
|
75
|
+
* error will be null.
|
|
69
76
|
*/
|
|
70
77
|
onBlur?: (obj: { value: string; error: string }) => void;
|
|
71
78
|
/**
|
|
72
|
-
* If it is defined, the component will change its appearance, showing
|
|
73
|
-
* If it is not defined, the error
|
|
79
|
+
* If it is defined, the component will change its appearance, showing
|
|
80
|
+
* the error below the input component. If it is not defined, the error
|
|
81
|
+
* messages will be managed internally, but never displayed on its own.
|
|
74
82
|
*/
|
|
75
83
|
error?: string;
|
|
76
84
|
/**
|
|
@@ -81,16 +89,23 @@ type Props = {
|
|
|
81
89
|
*/
|
|
82
90
|
suggestions?: string[] | (() => void);
|
|
83
91
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
92
|
+
* Regular expression that defines the valid format allowed by the input.
|
|
93
|
+
* This will be checked both when the input element loses the focus and
|
|
94
|
+
* while typing within it. If the string entered does not match the
|
|
95
|
+
* pattern, the onBlur and onChange functions will be called with the
|
|
96
|
+
* current value and an internal error informing that this value does not
|
|
97
|
+
* match the pattern. If the pattern is met, the error parameter of both
|
|
98
|
+
* events will be null.
|
|
88
99
|
*/
|
|
89
100
|
pattern?: string;
|
|
90
101
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
102
|
+
* Specifies the minimun and maximum length allowed by the input.
|
|
103
|
+
* This will be checked both when the input element loses the
|
|
104
|
+
* focus and while typing within it. If the string entered does not
|
|
105
|
+
* comply the length, the onBlur and onChange functions will be called
|
|
106
|
+
* with the current value and an internal error informing that the value
|
|
107
|
+
* length does not comply the specified range. If a valid length is
|
|
108
|
+
* reached, the error parameter of both events will be null.
|
|
94
109
|
*/
|
|
95
110
|
length?: { min?: number; max?: number };
|
|
96
111
|
/**
|
|
@@ -117,4 +132,4 @@ type Props = {
|
|
|
117
132
|
ref?: React.RefObject<HTMLDivElement>;
|
|
118
133
|
};
|
|
119
134
|
|
|
120
|
-
export default function
|
|
135
|
+
export default function DxcTextInput(props: Props): JSX.Element;
|