@dxc-technology/halstack-react 0.0.0-5908eb4 → 0.0.0-5b2ad05
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/ThemeContext.js +134 -100
- package/dist/V3Select/V3Select.js +549 -0
- package/dist/V3Textarea/V3Textarea.js +264 -0
- package/dist/accordion/Accordion.js +66 -59
- package/dist/accordion-group/AccordionGroup.js +1 -3
- package/dist/alert/Alert.js +126 -111
- package/dist/alert/index.d.ts +51 -0
- package/dist/box/Box.js +1 -9
- package/dist/button/Button.js +33 -27
- package/dist/checkbox/Checkbox.js +26 -21
- package/dist/chip/Chip.js +21 -25
- package/dist/common/variables.js +808 -535
- package/dist/date/Date.js +13 -15
- package/dist/{new-date/NewDate.js → date-input/DateInput.js} +85 -76
- package/dist/date-input/index.d.ts +95 -0
- package/dist/dialog/Dialog.js +15 -32
- package/dist/dropdown/Dropdown.js +117 -66
- package/dist/file-input/FileInput.js +644 -0
- package/dist/file-input/FileItem.js +280 -0
- package/dist/file-input/index.d.ts +81 -0
- package/dist/footer/Footer.js +63 -49
- package/dist/footer/Icons.js +77 -0
- package/dist/header/Header.js +123 -84
- package/dist/header/Icons.js +59 -0
- package/dist/heading/Heading.js +13 -5
- package/dist/input-text/Icons.js +22 -0
- package/dist/input-text/InputText.js +96 -63
- package/dist/layout/ApplicationLayout.js +5 -9
- package/dist/layout/Icons.js +55 -0
- package/dist/link/Link.js +4 -8
- package/dist/main.d.ts +8 -0
- package/dist/main.js +45 -29
- package/dist/{number/Number.js → number-input/NumberInput.js} +28 -19
- package/dist/{number/NumberContext.js → number-input/NumberInputContext.js} +2 -2
- package/dist/number-input/index.d.ts +113 -0
- package/dist/paginator/Icons.js +66 -0
- package/dist/paginator/Paginator.js +17 -17
- package/dist/password-input/PasswordInput.js +198 -0
- package/dist/password-input/index.d.ts +94 -0
- package/dist/progress-bar/ProgressBar.js +63 -27
- package/dist/select/Select.js +869 -347
- package/dist/select/index.d.ts +53 -0
- package/dist/sidenav/Sidenav.js +11 -15
- package/dist/slider/Slider.js +155 -66
- package/dist/spinner/Spinner.js +225 -58
- package/dist/table/Table.js +5 -1
- package/dist/tag/Tag.js +37 -35
- package/dist/{new-input-text/NewInputText.js → text-input/TextInput.js} +241 -199
- package/dist/text-input/index.d.ts +135 -0
- package/dist/textarea/Textarea.js +233 -124
- package/dist/textarea/index.d.ts +117 -0
- package/dist/toggle-group/ToggleGroup.js +130 -44
- package/dist/upload/Upload.js +3 -3
- package/dist/upload/buttons-upload/ButtonsUpload.js +12 -12
- package/dist/upload/buttons-upload/Icons.js +40 -0
- package/dist/upload/dragAndDropArea/DragAndDropArea.js +23 -19
- package/dist/upload/dragAndDropArea/Icons.js +39 -0
- package/dist/upload/file-upload/FileToUpload.js +27 -22
- package/dist/upload/file-upload/Icons.js +66 -0
- package/dist/upload/transaction/Icons.js +160 -0
- package/dist/upload/transaction/Transaction.js +18 -41
- package/dist/upload/transactions/Transactions.js +11 -11
- package/dist/wizard/Icons.js +65 -0
- package/dist/wizard/Wizard.js +11 -17
- package/package.json +6 -9
- package/test/Date.test.js +48 -44
- package/test/{NewDate.test.js → DateInput.test.js} +86 -33
- package/test/Dropdown.test.js +15 -0
- package/test/FileInput.test.js +201 -0
- package/test/Footer.test.js +2 -7
- package/test/Header.test.js +5 -10
- package/test/Heading.test.js +60 -12
- package/test/InputText.test.js +24 -16
- package/test/NumberInput.test.js +259 -0
- package/test/Paginator.test.js +1 -1
- package/test/PasswordInput.test.js +83 -0
- package/test/ResultsetTable.test.js +1 -2
- package/test/Slider.test.js +9 -17
- package/test/Spinner.test.js +5 -0
- package/test/TextInput.test.js +732 -0
- package/test/Textarea.test.js +193 -0
- package/test/ToggleGroup.test.js +5 -1
- package/test/Upload.test.js +5 -5
- package/test/{Select.test.js → V3Select.test.js} +56 -36
- package/test/{TextArea.test.js → V3TextArea.test.js} +6 -7
- package/dist/accordion/Accordion.stories.js +0 -207
- package/dist/accordion/readme.md +0 -96
- package/dist/accordion-group/AccordionGroup.stories.js +0 -207
- package/dist/accordion-group/readme.md +0 -70
- package/dist/alert/Alert.stories.js +0 -158
- package/dist/alert/close.svg +0 -4
- package/dist/alert/error.svg +0 -4
- package/dist/alert/info.svg +0 -4
- package/dist/alert/readme.md +0 -43
- package/dist/alert/success.svg +0 -4
- package/dist/alert/warning.svg +0 -4
- package/dist/button/Button.stories.js +0 -224
- package/dist/button/readme.md +0 -93
- 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/dialog/Dialog.stories.js +0 -217
- package/dist/dialog/readme.md +0 -32
- package/dist/dropdown/Dropdown.stories.js +0 -249
- package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
- package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
- package/dist/dropdown/readme.md +0 -69
- 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/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/Password.js +0 -139
- 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/select/Select.stories.js +0 -235
- package/dist/select/readme.md +0 -72
- 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/toggle-group/readme.md +0 -82
- 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/NewInputText.test.js +0 -663
- package/test/Number.test.js +0 -205
- package/test/Password.test.js +0 -63
- package/test/TabsForSections.test.js +0 -34
|
@@ -33,11 +33,31 @@ 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
|
+
|
|
51
|
+
_templateObject16 = function _templateObject16() {
|
|
52
|
+
return data;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function _templateObject15() {
|
|
59
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: calc((39px - 1.75em) / 2) 0 calc((39px - 1.75em) / 2) 1em;\n color: ", ";\n font-size: 0.875rem;\n line-height: 1.75em;\n"]);
|
|
60
|
+
|
|
41
61
|
_templateObject15 = function _templateObject15() {
|
|
42
62
|
return data;
|
|
43
63
|
};
|
|
@@ -46,7 +66,7 @@ function _templateObject15() {
|
|
|
46
66
|
}
|
|
47
67
|
|
|
48
68
|
function _templateObject14() {
|
|
49
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
69
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n padding: calc((39px - 1.75em) / 2) 0 calc((39px - 1.75em) / 2) 1em;\n line-height: 1.75em;\n list-style-type: none;\n cursor: pointer;\n\n ", "\n"]);
|
|
50
70
|
|
|
51
71
|
_templateObject14 = function _templateObject14() {
|
|
52
72
|
return data;
|
|
@@ -56,7 +76,7 @@ function _templateObject14() {
|
|
|
56
76
|
}
|
|
57
77
|
|
|
58
78
|
function _templateObject13() {
|
|
59
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
79
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n position: absolute;\n z-index: 1;\n max-height: 160px;\n overflow: auto;\n top: calc(100% + 4px);\n left: 0;\n margin: 0;\n padding: 0;\n width: 100%;\n box-sizing: border-box;\n cursor: default;\n border-radius: 4px;\n border: 1px solid ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"]);
|
|
60
80
|
|
|
61
81
|
_templateObject13 = function _templateObject13() {
|
|
62
82
|
return data;
|
|
@@ -66,7 +86,7 @@ function _templateObject13() {
|
|
|
66
86
|
}
|
|
67
87
|
|
|
68
88
|
function _templateObject12() {
|
|
69
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
89
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n"]);
|
|
70
90
|
|
|
71
91
|
_templateObject12 = function _templateObject12() {
|
|
72
92
|
return data;
|
|
@@ -76,7 +96,7 @@ function _templateObject12() {
|
|
|
76
96
|
}
|
|
77
97
|
|
|
78
98
|
function _templateObject11() {
|
|
79
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\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"]);
|
|
80
100
|
|
|
81
101
|
_templateObject11 = function _templateObject11() {
|
|
82
102
|
return data;
|
|
@@ -86,7 +106,7 @@ function _templateObject11() {
|
|
|
86
106
|
}
|
|
87
107
|
|
|
88
108
|
function _templateObject10() {
|
|
89
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n height: calc(1rem * 1.5);\n line-height: calc(1rem * 1.5);\n margin
|
|
109
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n height: calc(1rem * 1.5);\n line-height: calc(1rem * 1.5);\n margin: 0 calc(1rem * 0.25);\n padding: 0 0 0 calc(1rem * 0.5);\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"]);
|
|
90
110
|
|
|
91
111
|
_templateObject10 = function _templateObject10() {
|
|
92
112
|
return data;
|
|
@@ -106,7 +126,7 @@ function _templateObject9() {
|
|
|
106
126
|
}
|
|
107
127
|
|
|
108
128
|
function _templateObject8() {
|
|
109
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height:
|
|
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"]);
|
|
110
130
|
|
|
111
131
|
_templateObject8 = function _templateObject8() {
|
|
112
132
|
return data;
|
|
@@ -116,7 +136,7 @@ function _templateObject8() {
|
|
|
116
136
|
}
|
|
117
137
|
|
|
118
138
|
function _templateObject7() {
|
|
119
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
139
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n width: 16px;\n height: 16px;\n"]);
|
|
120
140
|
|
|
121
141
|
_templateObject7 = function _templateObject7() {
|
|
122
142
|
return data;
|
|
@@ -126,7 +146,7 @@ function _templateObject7() {
|
|
|
126
146
|
}
|
|
127
147
|
|
|
128
148
|
function _templateObject6() {
|
|
129
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n height: calc(calc(1rem * 2.5) - calc(1px * 2));\n width: 100%;\n background: none;\n border: none;\n outline: none;\n padding: 0 calc(1rem * 0.5);\n\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n ", "\n\n ::placeholder {\n color: ", ";\n }\n"]);
|
|
149
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n height: calc(calc(1rem * 2.5) - calc(1px * 2));\n width: 100%;\n background: none;\n border: none;\n outline: none;\n padding: 0 calc(1rem * 0.5);\n\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n ", "\n\n ::placeholder {\n color: ", ";\n }\n"]);
|
|
130
150
|
|
|
131
151
|
_templateObject6 = function _templateObject6() {
|
|
132
152
|
return data;
|
|
@@ -136,7 +156,7 @@ function _templateObject6() {
|
|
|
136
156
|
}
|
|
137
157
|
|
|
138
158
|
function _templateObject5() {
|
|
139
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(calc(1rem * 2.5) - calc(1px * 2));\n
|
|
159
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(calc(1rem * 2.5) - calc(1px * 2));\n margin: calc(1rem * 0.25) 0;\n padding: 0 calc(1rem * 0.5);\n\n ", "\n box-shadow: 0 0 0 2px transparent;\n border-radius: 4px;\n border: 1px solid\n ", ";\n ", "\n ", ";\n\n ", ";\n"]);
|
|
140
160
|
|
|
141
161
|
_templateObject5 = function _templateObject5() {
|
|
142
162
|
return data;
|
|
@@ -146,7 +166,7 @@ function _templateObject5() {
|
|
|
146
166
|
}
|
|
147
167
|
|
|
148
168
|
function _templateObject4() {
|
|
149
|
-
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"]);
|
|
150
170
|
|
|
151
171
|
_templateObject4 = function _templateObject4() {
|
|
152
172
|
return data;
|
|
@@ -166,7 +186,7 @@ function _templateObject3() {
|
|
|
166
186
|
}
|
|
167
187
|
|
|
168
188
|
function _templateObject2() {
|
|
169
|
-
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"]);
|
|
170
190
|
|
|
171
191
|
_templateObject2 = function _templateObject2() {
|
|
172
192
|
return data;
|
|
@@ -206,19 +226,23 @@ var makeCancelable = function makeCancelable(promise) {
|
|
|
206
226
|
};
|
|
207
227
|
};
|
|
208
228
|
|
|
209
|
-
var
|
|
210
|
-
return "
|
|
229
|
+
var getNotOptionalErrorMessage = function getNotOptionalErrorMessage() {
|
|
230
|
+
return "This field is required. Please, enter a value.";
|
|
211
231
|
};
|
|
212
232
|
|
|
213
|
-
var
|
|
214
|
-
return
|
|
233
|
+
var getLengthErrorMessage = function getLengthErrorMessage(length) {
|
|
234
|
+
return "Min length ".concat(length.min, ", max length ").concat(length.max, ".");
|
|
215
235
|
};
|
|
216
236
|
|
|
217
237
|
var getPatternErrorMessage = function getPatternErrorMessage() {
|
|
218
238
|
return "Please match the format requested.";
|
|
219
239
|
};
|
|
220
240
|
|
|
221
|
-
var
|
|
241
|
+
var patternMatch = function patternMatch(pattern, value) {
|
|
242
|
+
return new RegExp(pattern).test(value);
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
222
246
|
var _ref$label = _ref.label,
|
|
223
247
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
224
248
|
_ref$name = _ref.name,
|
|
@@ -243,12 +267,14 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
243
267
|
onBlur = _ref.onBlur,
|
|
244
268
|
_ref$error = _ref.error,
|
|
245
269
|
error = _ref$error === void 0 ? "" : _ref$error,
|
|
246
|
-
margin = _ref.margin,
|
|
247
|
-
_ref$size = _ref.size,
|
|
248
|
-
size = _ref$size === void 0 ? "medium" : _ref$size,
|
|
249
270
|
suggestions = _ref.suggestions,
|
|
250
271
|
pattern = _ref.pattern,
|
|
251
272
|
length = _ref.length,
|
|
273
|
+
_ref$autocomplete = _ref.autocomplete,
|
|
274
|
+
autocomplete = _ref$autocomplete === void 0 ? "off" : _ref$autocomplete,
|
|
275
|
+
margin = _ref.margin,
|
|
276
|
+
_ref$size = _ref.size,
|
|
277
|
+
size = _ref$size === void 0 ? "medium" : _ref$size,
|
|
252
278
|
_ref$tabIndex = _ref.tabIndex,
|
|
253
279
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
254
280
|
|
|
@@ -269,67 +295,44 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
269
295
|
|
|
270
296
|
var _useState7 = (0, _react.useState)(false),
|
|
271
297
|
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
272
|
-
|
|
273
|
-
|
|
298
|
+
isScrollable = _useState8[0],
|
|
299
|
+
changeIsScrollable = _useState8[1];
|
|
274
300
|
|
|
275
301
|
var _useState9 = (0, _react.useState)(false),
|
|
276
302
|
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
277
|
-
|
|
278
|
-
|
|
303
|
+
isActiveSuggestion = _useState10[0],
|
|
304
|
+
changeIsActiveSuggestion = _useState10[1];
|
|
279
305
|
|
|
280
306
|
var _useState11 = (0, _react.useState)(false),
|
|
281
307
|
_useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
|
|
282
|
-
|
|
283
|
-
|
|
308
|
+
isAutosuggestError = _useState12[0],
|
|
309
|
+
changeIsAutosuggestError = _useState12[1];
|
|
284
310
|
|
|
285
|
-
var _useState13 = (0, _react.useState)(
|
|
311
|
+
var _useState13 = (0, _react.useState)([]),
|
|
286
312
|
_useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
|
|
287
|
-
|
|
288
|
-
|
|
313
|
+
filteredSuggestions = _useState14[0],
|
|
314
|
+
changeFilteredSuggestions = _useState14[1];
|
|
289
315
|
|
|
290
|
-
var _useState15 = (0, _react.useState)(
|
|
316
|
+
var _useState15 = (0, _react.useState)(-1),
|
|
291
317
|
_useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
var _useState17 = (0, _react.useState)(
|
|
296
|
-
_useState18 = (0, _slicedToArray2["default"])(_useState17,
|
|
297
|
-
|
|
298
|
-
changeFilteredSuggestions = _useState18[1];
|
|
299
|
-
|
|
300
|
-
var _useState19 = (0, _react.useState)(-1),
|
|
301
|
-
_useState20 = (0, _slicedToArray2["default"])(_useState19, 2),
|
|
302
|
-
visualFocusedSuggIndex = _useState20[0],
|
|
303
|
-
changeVisualFocusedSuggIndex = _useState20[1];
|
|
304
|
-
|
|
305
|
-
var _useState21 = (0, _react.useState)(null),
|
|
306
|
-
_useState22 = (0, _slicedToArray2["default"])(_useState21, 2),
|
|
307
|
-
minNumber = _useState22[0],
|
|
308
|
-
setMinNumber = _useState22[1];
|
|
309
|
-
|
|
310
|
-
var _useState23 = (0, _react.useState)(null),
|
|
311
|
-
_useState24 = (0, _slicedToArray2["default"])(_useState23, 2),
|
|
312
|
-
maxNumber = _useState24[0],
|
|
313
|
-
setMaxNumber = _useState24[1];
|
|
314
|
-
|
|
315
|
-
var _useState25 = (0, _react.useState)(null),
|
|
316
|
-
_useState26 = (0, _slicedToArray2["default"])(_useState25, 2),
|
|
317
|
-
stepNumber = _useState26[0],
|
|
318
|
-
setStepNumber = _useState26[1];
|
|
318
|
+
visualFocusedSuggIndex = _useState16[0],
|
|
319
|
+
changeVisualFocusedSuggIndex = _useState16[1];
|
|
320
|
+
|
|
321
|
+
var _useState17 = (0, _react.useState)("input-".concat((0, _uuid.v4)())),
|
|
322
|
+
_useState18 = (0, _slicedToArray2["default"])(_useState17, 1),
|
|
323
|
+
inputId = _useState18[0];
|
|
319
324
|
|
|
320
325
|
var suggestionsRef = (0, _react.useRef)(null);
|
|
321
326
|
var inputRef = (0, _react.useRef)(null);
|
|
322
327
|
var actionRef = (0, _react.useRef)(null);
|
|
323
328
|
var colorsTheme = (0, _useTheme["default"])();
|
|
324
329
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
325
|
-
var inputId = "input-".concat((0, _uuid.v4)());
|
|
326
330
|
var autosuggestId = "".concat(inputId, "-listBox");
|
|
327
|
-
var
|
|
331
|
+
var errorId = "error-message-".concat(inputId);
|
|
332
|
+
var numberInputContext = (0, _react.useContext)(_NumberInputContext["default"]);
|
|
328
333
|
|
|
329
|
-
var
|
|
330
|
-
|
|
331
|
-
value !== null && value !== void 0 ? value : setInnerValue(newValue);
|
|
332
|
-
typeof onChange === "function" && onChange(changedValue);
|
|
334
|
+
var isNotOptional = function isNotOptional(value) {
|
|
335
|
+
return value === "" && !optional;
|
|
333
336
|
};
|
|
334
337
|
|
|
335
338
|
var isLengthIncorrect = function isLengthIncorrect(value) {
|
|
@@ -337,15 +340,25 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
337
340
|
};
|
|
338
341
|
|
|
339
342
|
var isNumberIncorrect = function isNumberIncorrect(value) {
|
|
340
|
-
return minNumber && parseInt(value) < minNumber || maxNumber && parseInt(value) > maxNumber;
|
|
343
|
+
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);
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
var isTextInputType = function isTextInputType() {
|
|
347
|
+
var _inputRef$current, _inputRef$current2;
|
|
348
|
+
|
|
349
|
+
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";
|
|
341
350
|
};
|
|
342
351
|
|
|
343
352
|
var getNumberErrorMessage = function getNumberErrorMessage(value) {
|
|
344
|
-
if (minNumber && parseInt(value) < minNumber)
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
353
|
+
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, ".");
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
var hasInputSuggestions = function hasInputSuggestions() {
|
|
357
|
+
return typeof suggestions === "function" || suggestions && suggestions.length > 0;
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
var openSuggestions = function openSuggestions() {
|
|
361
|
+
hasInputSuggestions() && changeIsOpen(true);
|
|
349
362
|
};
|
|
350
363
|
|
|
351
364
|
var closeSuggestions = function closeSuggestions() {
|
|
@@ -353,71 +366,79 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
353
366
|
changeVisualFocusedSuggIndex(-1);
|
|
354
367
|
};
|
|
355
368
|
|
|
369
|
+
var changeValue = function changeValue(newValue) {
|
|
370
|
+
value !== null && value !== void 0 ? value : setInnerValue(newValue);
|
|
371
|
+
var changedValue = typeof newValue === "number" ? newValue.toString() : newValue;
|
|
372
|
+
if (isNotOptional(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
373
|
+
value: changedValue,
|
|
374
|
+
error: getNotOptionalErrorMessage()
|
|
375
|
+
});else if (isLengthIncorrect(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
376
|
+
value: changedValue,
|
|
377
|
+
error: getLengthErrorMessage(length)
|
|
378
|
+
});else if (newValue && pattern && !patternMatch(pattern, newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
379
|
+
value: changedValue,
|
|
380
|
+
error: getPatternErrorMessage()
|
|
381
|
+
});else if (newValue && isNumberIncorrect(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
382
|
+
value: changedValue,
|
|
383
|
+
error: getNumberErrorMessage(newValue)
|
|
384
|
+
});else onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
385
|
+
value: changedValue,
|
|
386
|
+
error: null
|
|
387
|
+
});
|
|
388
|
+
};
|
|
389
|
+
|
|
356
390
|
var handleInputContainerOnClick = function handleInputContainerOnClick() {
|
|
357
391
|
document.activeElement !== actionRef.current && inputRef.current.focus();
|
|
358
392
|
};
|
|
359
393
|
|
|
360
394
|
var handleIOnChange = function handleIOnChange(event) {
|
|
361
|
-
|
|
395
|
+
openSuggestions();
|
|
362
396
|
changeValue(event.target.value);
|
|
363
397
|
};
|
|
364
398
|
|
|
365
399
|
var handleIOnClick = function handleIOnClick() {
|
|
366
|
-
|
|
400
|
+
openSuggestions();
|
|
367
401
|
};
|
|
368
402
|
|
|
369
403
|
var handleIOnBlur = function handleIOnBlur(event) {
|
|
370
404
|
suggestions && closeSuggestions();
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
}
|
|
387
|
-
changeIsError(true);
|
|
388
|
-
changeValidationError(getNumberErrorMessage(event.target.value));
|
|
389
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
390
|
-
value: event.target.value,
|
|
391
|
-
error: getNumberErrorMessage(event.target.value)
|
|
392
|
-
});
|
|
393
|
-
} else {
|
|
394
|
-
changeIsError(false);
|
|
395
|
-
changeValidationError("");
|
|
396
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
397
|
-
value: event.target.value,
|
|
398
|
-
error: null
|
|
399
|
-
});
|
|
400
|
-
}
|
|
405
|
+
if (isNotOptional(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
406
|
+
value: event.target.value,
|
|
407
|
+
error: getNotOptionalErrorMessage()
|
|
408
|
+
});else if (isLengthIncorrect(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
409
|
+
value: event.target.value,
|
|
410
|
+
error: getLengthErrorMessage(length)
|
|
411
|
+
});else if (event.target.value && pattern && !patternMatch(pattern, event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
412
|
+
value: event.target.value,
|
|
413
|
+
error: getPatternErrorMessage()
|
|
414
|
+
});else if (event.target.value && isNumberIncorrect(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
415
|
+
value: event.target.value,
|
|
416
|
+
error: getNumberErrorMessage(event.target.value)
|
|
417
|
+
});else onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
418
|
+
value: event.target.value,
|
|
419
|
+
error: null
|
|
420
|
+
});
|
|
401
421
|
};
|
|
402
422
|
|
|
403
423
|
var handleIOnFocus = function handleIOnFocus() {
|
|
404
|
-
|
|
424
|
+
openSuggestions();
|
|
405
425
|
};
|
|
406
426
|
|
|
407
427
|
var handleIOnKeyDown = function handleIOnKeyDown(event) {
|
|
408
428
|
switch (event.keyCode) {
|
|
409
429
|
case 40:
|
|
410
430
|
// Arrow Down
|
|
411
|
-
if (
|
|
412
|
-
|
|
431
|
+
if (numberInputContext) {
|
|
432
|
+
decrementNumber();
|
|
433
|
+
event.preventDefault();
|
|
413
434
|
} else {
|
|
414
435
|
event.preventDefault();
|
|
436
|
+
openSuggestions();
|
|
415
437
|
|
|
416
438
|
if (!isAutosuggestError && !isSearching && filteredSuggestions.length > 0) {
|
|
417
439
|
changeVisualFocusedSuggIndex(function (visualFocusedSuggIndex) {
|
|
418
440
|
if (visualFocusedSuggIndex < filteredSuggestions.length - 1) return visualFocusedSuggIndex + 1;else if (visualFocusedSuggIndex === filteredSuggestions.length - 1) return 0;
|
|
419
441
|
});
|
|
420
|
-
changeIsOpen(true);
|
|
421
442
|
changeIsScrollable(true);
|
|
422
443
|
changeIsActiveSuggestion(false);
|
|
423
444
|
}
|
|
@@ -427,16 +448,17 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
427
448
|
|
|
428
449
|
case 38:
|
|
429
450
|
// Arrow Up
|
|
430
|
-
if (
|
|
451
|
+
if (numberInputContext) {
|
|
431
452
|
incrementNumber();
|
|
453
|
+
event.preventDefault();
|
|
432
454
|
} else {
|
|
433
455
|
event.preventDefault();
|
|
456
|
+
openSuggestions();
|
|
434
457
|
|
|
435
458
|
if (!isAutosuggestError && !isSearching && filteredSuggestions.length > 0) {
|
|
436
459
|
changeVisualFocusedSuggIndex(function (visualFocusedSuggIndex) {
|
|
437
460
|
if (visualFocusedSuggIndex === 0 || visualFocusedSuggIndex === -1) return filteredSuggestions.length > 0 ? filteredSuggestions.length - 1 : suggestions.length - 1;else return visualFocusedSuggIndex - 1;
|
|
438
461
|
});
|
|
439
|
-
changeIsOpen(true);
|
|
440
462
|
changeIsScrollable(true);
|
|
441
463
|
changeIsActiveSuggestion(false);
|
|
442
464
|
}
|
|
@@ -448,23 +470,19 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
448
470
|
// Esc
|
|
449
471
|
event.preventDefault();
|
|
450
472
|
|
|
451
|
-
if (
|
|
473
|
+
if (hasInputSuggestions()) {
|
|
452
474
|
changeValue("");
|
|
453
|
-
|
|
454
|
-
if (isOpen) {
|
|
455
|
-
changeIsError(false);
|
|
456
|
-
closeSuggestions();
|
|
457
|
-
}
|
|
475
|
+
isOpen && closeSuggestions();
|
|
458
476
|
}
|
|
459
477
|
|
|
460
478
|
break;
|
|
461
479
|
|
|
462
480
|
case 13:
|
|
463
481
|
// Enter
|
|
464
|
-
if (
|
|
482
|
+
if (hasInputSuggestions() && !isSearching) {
|
|
465
483
|
var validFocusedSuggestion = filteredSuggestions.length > 0 && visualFocusedSuggIndex >= 0 && visualFocusedSuggIndex < filteredSuggestions.length;
|
|
466
484
|
validFocusedSuggestion && changeValue(filteredSuggestions[visualFocusedSuggIndex]);
|
|
467
|
-
closeSuggestions();
|
|
485
|
+
isOpen && closeSuggestions();
|
|
468
486
|
}
|
|
469
487
|
|
|
470
488
|
break;
|
|
@@ -472,25 +490,22 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
472
490
|
};
|
|
473
491
|
|
|
474
492
|
var setNumberProps = function setNumberProps(type, min, max, step) {
|
|
475
|
-
var _inputRef$
|
|
493
|
+
var _inputRef$current3, _inputRef$current4, _inputRef$current5, _inputRef$current6;
|
|
476
494
|
|
|
477
|
-
type && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$
|
|
478
|
-
min && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$
|
|
479
|
-
max && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$
|
|
480
|
-
step && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$
|
|
481
|
-
setMinNumber(min);
|
|
482
|
-
setMaxNumber(max);
|
|
483
|
-
setStepNumber(step);
|
|
495
|
+
type && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.setAttribute("type", type));
|
|
496
|
+
min && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.setAttribute("min", min));
|
|
497
|
+
max && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : _inputRef$current5.setAttribute("max", max));
|
|
498
|
+
step && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : _inputRef$current6.setAttribute("step", step));
|
|
484
499
|
};
|
|
485
500
|
|
|
486
501
|
(0, _react.useLayoutEffect)(function () {
|
|
487
502
|
var _suggestionsRef$curre;
|
|
488
503
|
|
|
489
|
-
isScrollable && ((_suggestionsRef$curre = suggestionsRef.current) === null || _suggestionsRef$curre === void 0 ? void 0 : _suggestionsRef$curre.scrollTo({
|
|
504
|
+
isScrollable && (suggestionsRef === null || suggestionsRef === void 0 ? void 0 : (_suggestionsRef$curre = suggestionsRef.current) === null || _suggestionsRef$curre === void 0 ? void 0 : _suggestionsRef$curre.scrollTo({
|
|
490
505
|
top: visualFocusedSuggIndex * 39
|
|
491
506
|
}));
|
|
492
507
|
return changeIsScrollable(false);
|
|
493
|
-
}, [isScrollable,
|
|
508
|
+
}, [isScrollable, visualFocusedSuggIndex]);
|
|
494
509
|
(0, _react.useEffect)(function () {
|
|
495
510
|
if (typeof suggestions === "function") {
|
|
496
511
|
changeIsSearching(true);
|
|
@@ -517,14 +532,11 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
517
532
|
changeVisualFocusedSuggIndex(-1);
|
|
518
533
|
}
|
|
519
534
|
|
|
520
|
-
|
|
535
|
+
numberInputContext && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
|
|
521
536
|
}, [value, innerValue, suggestions]);
|
|
522
537
|
var defaultClearAction = {
|
|
523
538
|
onClick: function onClick() {
|
|
524
539
|
changeValue("");
|
|
525
|
-
changeValidationError("");
|
|
526
|
-
changeIsError(false);
|
|
527
|
-
changeIsAutosuggestError(false);
|
|
528
540
|
inputRef.current.focus();
|
|
529
541
|
suggestions && closeSuggestions();
|
|
530
542
|
},
|
|
@@ -553,18 +565,18 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
553
565
|
}));
|
|
554
566
|
|
|
555
567
|
var decrementNumber = function decrementNumber() {
|
|
556
|
-
var numberValue = value
|
|
568
|
+
var numberValue = value !== null && value !== void 0 ? value : innerValue;
|
|
557
569
|
|
|
558
|
-
if (minNumber && parseInt(numberValue) < minNumber) {
|
|
570
|
+
if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && parseInt(numberValue) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) {
|
|
559
571
|
changeValue(parseInt(numberValue));
|
|
560
|
-
} else if (maxNumber && parseInt(numberValue) > maxNumber) {
|
|
561
|
-
changeValue(maxNumber);
|
|
562
|
-
} else if (minNumber && (parseInt(numberValue) === minNumber || numberValue === "" || stepNumber && parseInt(numberValue) - stepNumber < minNumber)) {
|
|
563
|
-
changeValue(minNumber);
|
|
564
|
-
} else if (stepNumber && minNumber && parseInt(numberValue) - stepNumber >= minNumber || stepNumber && numberValue !== "") {
|
|
565
|
-
changeValue(parseInt(numberValue) - stepNumber);
|
|
566
|
-
} else if (stepNumber && numberValue == "") {
|
|
567
|
-
changeValue(-stepNumber);
|
|
572
|
+
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(numberValue) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) {
|
|
573
|
+
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
574
|
+
} 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))) {
|
|
575
|
+
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
|
|
576
|
+
} 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 !== "") {
|
|
577
|
+
changeValue(parseInt(numberValue) - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
578
|
+
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
|
|
579
|
+
changeValue(-(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
568
580
|
} else if (numberValue === "") {
|
|
569
581
|
changeValue(-1);
|
|
570
582
|
} else {
|
|
@@ -573,18 +585,18 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
573
585
|
};
|
|
574
586
|
|
|
575
587
|
var incrementNumber = function incrementNumber() {
|
|
576
|
-
var numberValue = value
|
|
588
|
+
var numberValue = value !== null && value !== void 0 ? value : innerValue;
|
|
577
589
|
|
|
578
|
-
if (maxNumber && parseInt(numberValue) > maxNumber) {
|
|
590
|
+
if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(numberValue) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) {
|
|
579
591
|
changeValue(parseInt(numberValue));
|
|
580
|
-
} else if (minNumber && (parseInt(numberValue) < minNumber || numberValue === "")) {
|
|
581
|
-
changeValue(minNumber);
|
|
582
|
-
} else if (maxNumber && (parseInt(numberValue) === maxNumber || stepNumber && parseInt(numberValue) + stepNumber > maxNumber)) {
|
|
583
|
-
changeValue(maxNumber);
|
|
584
|
-
} else if (stepNumber && maxNumber && parseInt(numberValue) + stepNumber <= maxNumber || stepNumber && numberValue !== "") {
|
|
585
|
-
changeValue(parseInt(numberValue) + stepNumber);
|
|
586
|
-
} else if (stepNumber && numberValue == "") {
|
|
587
|
-
changeValue(stepNumber);
|
|
592
|
+
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && (parseInt(numberValue) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || numberValue === "")) {
|
|
593
|
+
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
|
|
594
|
+
} 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))) {
|
|
595
|
+
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
596
|
+
} 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 !== "") {
|
|
597
|
+
changeValue(parseInt(numberValue) + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
598
|
+
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
|
|
599
|
+
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber);
|
|
588
600
|
} else if (numberValue === "") {
|
|
589
601
|
changeValue(1);
|
|
590
602
|
} else {
|
|
@@ -602,7 +614,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
602
614
|
height: "24px",
|
|
603
615
|
viewBox: "0 0 24 24",
|
|
604
616
|
width: "24px",
|
|
605
|
-
fill: "
|
|
617
|
+
fill: "currentColor"
|
|
606
618
|
}, _react["default"].createElement("path", {
|
|
607
619
|
d: "M0 0h24v24H0z",
|
|
608
620
|
fill: "none"
|
|
@@ -620,7 +632,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
620
632
|
height: "24px",
|
|
621
633
|
viewBox: "0 0 24 24",
|
|
622
634
|
width: "24px",
|
|
623
|
-
fill: "
|
|
635
|
+
fill: "currentColor"
|
|
624
636
|
}, _react["default"].createElement("path", {
|
|
625
637
|
d: "M0 0h24v24H0z",
|
|
626
638
|
fill: "none"
|
|
@@ -636,11 +648,12 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
636
648
|
var matchedWords = suggestion.match(regEx);
|
|
637
649
|
var noMatchedWords = suggestion.replace(regEx, "");
|
|
638
650
|
return _react["default"].createElement(Suggestion, {
|
|
639
|
-
|
|
640
|
-
|
|
651
|
+
id: "suggestion-".concat(index),
|
|
652
|
+
onMouseDown: function onMouseDown(event) {
|
|
653
|
+
event.button === 0 && changeIsActiveSuggestion(true);
|
|
641
654
|
},
|
|
642
|
-
onMouseUp: function onMouseUp() {
|
|
643
|
-
if (isActiveSuggestion) {
|
|
655
|
+
onMouseUp: function onMouseUp(event) {
|
|
656
|
+
if (event.button === 0 && isActiveSuggestion) {
|
|
644
657
|
changeValue(suggestion);
|
|
645
658
|
changeIsActiveSuggestion(false);
|
|
646
659
|
closeSuggestions();
|
|
@@ -653,12 +666,14 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
653
666
|
changeIsActiveSuggestion(false);
|
|
654
667
|
},
|
|
655
668
|
visualFocused: visualFocusedSuggIndex === index,
|
|
656
|
-
active: visualFocusedSuggIndex === index && isActiveSuggestion
|
|
669
|
+
active: visualFocusedSuggIndex === index && isActiveSuggestion,
|
|
670
|
+
role: "option",
|
|
671
|
+
"aria-selected": visualFocusedSuggIndex === index && "true"
|
|
657
672
|
}, typeof suggestions === "function" ? suggestion : _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("strong", null, matchedWords), noMatchedWords));
|
|
658
673
|
};
|
|
659
674
|
|
|
660
675
|
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
661
|
-
theme: colorsTheme.
|
|
676
|
+
theme: colorsTheme.textInput
|
|
662
677
|
}, _react["default"].createElement(DxcInput, {
|
|
663
678
|
margin: margin,
|
|
664
679
|
ref: ref,
|
|
@@ -671,7 +686,7 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
671
686
|
disabled: disabled,
|
|
672
687
|
backgroundType: backgroundType
|
|
673
688
|
}, helperText), _react["default"].createElement(InputContainer, {
|
|
674
|
-
error: error
|
|
689
|
+
error: error,
|
|
675
690
|
disabled: disabled,
|
|
676
691
|
backgroundType: backgroundType,
|
|
677
692
|
onClick: handleInputContainerOnClick
|
|
@@ -692,35 +707,52 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
692
707
|
ref: inputRef,
|
|
693
708
|
backgroundType: backgroundType,
|
|
694
709
|
pattern: pattern,
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
710
|
+
minLength: length === null || length === void 0 ? void 0 : length.min,
|
|
711
|
+
maxLength: length === null || length === void 0 ? void 0 : length.max,
|
|
712
|
+
autoComplete: autocomplete,
|
|
713
|
+
tabIndex: tabIndex,
|
|
714
|
+
role: isTextInputType() && hasInputSuggestions() ? "combobox" : "textbox",
|
|
715
|
+
"aria-autocomplete": isTextInputType() && hasInputSuggestions() ? "list" : undefined,
|
|
716
|
+
"aria-controls": isTextInputType() && hasInputSuggestions() ? inputId : undefined,
|
|
717
|
+
"aria-expanded": isTextInputType() && hasInputSuggestions() ? isOpen ? "true" : "false" : undefined,
|
|
718
|
+
"aria-activedescendant": isTextInputType() && hasInputSuggestions() && isOpen && visualFocusedSuggIndex !== -1 ? "suggestion-".concat(visualFocusedSuggIndex) : undefined,
|
|
719
|
+
"aria-invalid": error ? "true" : "false",
|
|
720
|
+
"aria-describedby": error ? errorId : undefined,
|
|
721
|
+
"aria-required": optional ? "false" : "true"
|
|
722
|
+
}), !disabled && error && _react["default"].createElement(ErrorIcon, {
|
|
723
|
+
backgroundType: backgroundType,
|
|
724
|
+
"aria-label": "Error"
|
|
698
725
|
}, errorIcon), !disabled && clearable && (value !== null && value !== void 0 ? value : innerValue).length > 0 && _react["default"].createElement(Action, {
|
|
699
726
|
onClick: defaultClearAction.onClick,
|
|
700
727
|
backgroundType: backgroundType,
|
|
701
|
-
tabIndex: tabIndex
|
|
702
|
-
|
|
728
|
+
tabIndex: tabIndex,
|
|
729
|
+
"aria-label": "Clear"
|
|
730
|
+
}, defaultClearAction.icon), (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" ? _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(Action, {
|
|
703
731
|
ref: actionRef,
|
|
704
732
|
disabled: disabled,
|
|
705
733
|
onClick: decrementAction.onClick,
|
|
706
734
|
backgroundType: backgroundType,
|
|
707
|
-
tabIndex: tabIndex
|
|
735
|
+
tabIndex: tabIndex,
|
|
736
|
+
"aria-label": "Decrement"
|
|
708
737
|
}, decrementAction.icon), _react["default"].createElement(Action, {
|
|
709
738
|
ref: actionRef,
|
|
710
739
|
disabled: disabled,
|
|
711
740
|
onClick: incrementAction.onClick,
|
|
712
741
|
backgroundType: backgroundType,
|
|
713
|
-
tabIndex: tabIndex
|
|
742
|
+
tabIndex: tabIndex,
|
|
743
|
+
"aria-label": "Increment"
|
|
714
744
|
}, incrementAction.icon)) : action && _react["default"].createElement(Action, {
|
|
715
745
|
ref: actionRef,
|
|
716
746
|
disabled: disabled,
|
|
717
747
|
onClick: action.onClick,
|
|
718
748
|
backgroundType: backgroundType,
|
|
719
749
|
tabIndex: tabIndex
|
|
720
|
-
}, action.icon
|
|
750
|
+
}, typeof action.icon === "string" ? _react["default"].createElement(ActionIcon, {
|
|
751
|
+
src: action.icon
|
|
752
|
+
}) : action.icon), suffix && _react["default"].createElement(Suffix, {
|
|
721
753
|
disabled: disabled,
|
|
722
754
|
backgroundType: backgroundType
|
|
723
|
-
}, suffix),
|
|
755
|
+
}, suffix), isOpen && _react["default"].createElement(Suggestions, {
|
|
724
756
|
id: autosuggestId,
|
|
725
757
|
isError: isAutosuggestError,
|
|
726
758
|
onMouseDown: function onMouseDown(event) {
|
|
@@ -729,23 +761,26 @@ var DxcNewInputText = _react["default"].forwardRef(function (_ref, ref) {
|
|
|
729
761
|
onMouseLeave: function onMouseLeave() {
|
|
730
762
|
changeVisualFocusedSuggIndex(-1);
|
|
731
763
|
},
|
|
732
|
-
ref: suggestionsRef
|
|
764
|
+
ref: suggestionsRef,
|
|
765
|
+
role: "listbox",
|
|
766
|
+
"aria-label": label
|
|
733
767
|
}, !isSearching && !isAutosuggestError && filteredSuggestions.length === 0 && _react["default"].createElement(SuggestionsSystemMessage, null, "No results found"), !isSearching && !isAutosuggestError && filteredSuggestions.length > 0 && filteredSuggestions.map(function (suggestion, index) {
|
|
734
768
|
return _react["default"].createElement(HighlightedSuggestion, {
|
|
735
769
|
key: "suggestion-".concat((0, _uuid.v4)()),
|
|
736
770
|
suggestion: suggestion,
|
|
737
771
|
index: index
|
|
738
772
|
});
|
|
739
|
-
}), isSearching && _react["default"].createElement(SuggestionsSystemMessage, null, "Searching..."), isAutosuggestError && _react["default"].createElement(SuggestionsError, null, _react["default"].createElement(
|
|
773
|
+
}), isSearching && _react["default"].createElement(SuggestionsSystemMessage, null, "Searching..."), isAutosuggestError && _react["default"].createElement(SuggestionsError, null, _react["default"].createElement(SuggestionsErrorIcon, {
|
|
740
774
|
backgroundType: backgroundType
|
|
741
|
-
}, errorIcon), "Error fetching data"))), _react["default"].createElement(Error, {
|
|
775
|
+
}, errorIcon), "Error fetching data"))), !disabled && _react["default"].createElement(Error, {
|
|
776
|
+
id: errorId,
|
|
742
777
|
backgroundType: backgroundType
|
|
743
|
-
}, error
|
|
778
|
+
}, error)));
|
|
744
779
|
});
|
|
745
780
|
|
|
746
781
|
var sizes = {
|
|
747
|
-
small: "
|
|
748
|
-
medium: "
|
|
782
|
+
small: "240px",
|
|
783
|
+
medium: "360px",
|
|
749
784
|
large: "480px",
|
|
750
785
|
fillParent: "100%"
|
|
751
786
|
};
|
|
@@ -778,6 +813,8 @@ var Label = _styledComponents["default"].label(_templateObject2(), function (pro
|
|
|
778
813
|
return props.theme.labelFontStyle;
|
|
779
814
|
}, function (props) {
|
|
780
815
|
return props.theme.labelFontWeight;
|
|
816
|
+
}, function (props) {
|
|
817
|
+
return props.theme.labelLineHeight;
|
|
781
818
|
});
|
|
782
819
|
|
|
783
820
|
var OptionalLabel = _styledComponents["default"].span(_templateObject3(), function (props) {
|
|
@@ -794,18 +831,20 @@ var HelperText = _styledComponents["default"].span(_templateObject4(), function
|
|
|
794
831
|
return props.theme.helperTextFontStyle;
|
|
795
832
|
}, function (props) {
|
|
796
833
|
return props.theme.helperTextFontWeight;
|
|
834
|
+
}, function (props) {
|
|
835
|
+
return props.theme.helperTextLineHeight;
|
|
797
836
|
});
|
|
798
837
|
|
|
799
838
|
var InputContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
|
|
800
839
|
if (props.disabled) return props.backgroundType === "dark" ? "background-color: ".concat(props.theme.disabledContainerFillColorOnDark, ";") : "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
|
|
801
840
|
}, function (props) {
|
|
802
|
-
return props.
|
|
841
|
+
if (props.disabled) return props.backgroundType === "dark" ? props.theme.disabledBorderColorOnDark : props.theme.disabledBorderColor;else return props.backgroundType === "dark" ? props.theme.enabledBorderColorOnDark : props.theme.enabledBorderColor;
|
|
803
842
|
}, function (props) {
|
|
804
|
-
|
|
843
|
+
return props.error && !props.disabled && "border-color: transparent;\n box-shadow: 0 0 0 2px ".concat(props.backgroundType === "dark" ? props.theme.errorBorderColorOnDark : props.theme.errorBorderColor, ";\n ");
|
|
805
844
|
}, function (props) {
|
|
806
845
|
return props.disabled && "cursor: not-allowed;";
|
|
807
846
|
}, function (props) {
|
|
808
|
-
return !props.disabled && "\n &:hover {\n border-color: ".concat(props.error ?
|
|
847
|
+
return !props.disabled && "\n &:hover {\n border-color: ".concat(props.error ? "transparent" : props.backgroundType === "dark" ? props.theme.hoverBorderColorOnDark : props.theme.hoverBorderColor, ";\n ").concat(props.error && "box-shadow: 0 0 0 2px ".concat(props.backgroundType === "dark" ? props.theme.hoverErrorBorderColorOnDark : props.theme.hoverErrorBorderColor, ";"), "\n }\n &:focus-within {\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(props.backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor, ";\n }\n ");
|
|
809
848
|
});
|
|
810
849
|
|
|
811
850
|
var Input = _styledComponents["default"].input(_templateObject6(), function (props) {
|
|
@@ -824,20 +863,18 @@ var Input = _styledComponents["default"].input(_templateObject6(), function (pro
|
|
|
824
863
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPlaceholderFontColorOnDark : props.theme.disabledPlaceholderFontColor : props.backgroundType === "dark" ? props.theme.placeholderFontColorOnDark : props.theme.placeholderFontColor;
|
|
825
864
|
});
|
|
826
865
|
|
|
827
|
-
var
|
|
866
|
+
var ActionIcon = _styledComponents["default"].img(_templateObject7());
|
|
867
|
+
|
|
868
|
+
var Action = _styledComponents["default"].button(_templateObject8(), function (props) {
|
|
828
869
|
return props.theme.fontFamily;
|
|
829
870
|
}, function (props) {
|
|
830
|
-
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer";
|
|
871
|
+
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
|
|
831
872
|
}, function (props) {
|
|
832
873
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionBackgroundColorOnDark : props.theme.disabledActionBackgroundColor : props.backgroundType === "dark" ? props.theme.actionBackgroundColorOnDark : props.theme.actionBackgroundColor;
|
|
833
874
|
}, function (props) {
|
|
834
875
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionIconColorOnDark : props.theme.disabledActionIconColor : props.backgroundType === "dark" ? props.theme.actionIconColorOnDark : props.theme.actionIconColor;
|
|
835
876
|
}, function (props) {
|
|
836
|
-
return !props.disabled && "\n &:hover {\n background-color: ".concat(props.backgroundType === "dark" ? props.theme.hoverActionBackgroundColorOnDark : props.theme.hoverActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.hoverActionIconColorOnDark : props.theme.hoverActionIconColor, ";\n }\n &:focus {\n outline: none;\n
|
|
837
|
-
});
|
|
838
|
-
|
|
839
|
-
var ErrorIcon = _styledComponents["default"].span(_templateObject8(), function (props) {
|
|
840
|
-
return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
|
|
877
|
+
return !props.disabled && "\n &:hover {\n background-color: ".concat(props.backgroundType === "dark" ? props.theme.hoverActionBackgroundColorOnDark : props.theme.hoverActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.hoverActionIconColorOnDark : props.theme.hoverActionIconColor, ";\n }\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ").concat(props.backgroundType === "dark" ? props.theme.focusActionBorderColorOnDark : props.theme.focusActionBorderColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.focusActionIconColorOnDark : props.theme.focusActionIconColor, ";\n }\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ").concat(props.backgroundType === "dark" ? props.theme.focusActionBorderColorOnDark : props.theme.focusActionBorderColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.focusActionIconColorOnDark : props.theme.focusActionIconColor, ";\n }\n &:active {\n background-color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionBackgroundColorOnDark : props.theme.activeActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionIconColorOnDark : props.theme.activeActionIconColor, ";\n }\n ");
|
|
841
878
|
});
|
|
842
879
|
|
|
843
880
|
var Prefix = _styledComponents["default"].span(_templateObject9(), function (props) {
|
|
@@ -854,13 +891,17 @@ var Suffix = _styledComponents["default"].span(_templateObject10(), function (pr
|
|
|
854
891
|
return props.theme.fontFamily;
|
|
855
892
|
});
|
|
856
893
|
|
|
857
|
-
var
|
|
894
|
+
var ErrorIcon = _styledComponents["default"].span(_templateObject11(), function (props) {
|
|
895
|
+
return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
|
|
896
|
+
});
|
|
897
|
+
|
|
898
|
+
var Error = _styledComponents["default"].span(_templateObject12(), function (props) {
|
|
858
899
|
return props.backgroundType === "dark" ? props.theme.errorMessageColorOnDark : props.theme.errorMessageColor;
|
|
859
900
|
}, function (props) {
|
|
860
901
|
return props.theme.fontFamily;
|
|
861
902
|
});
|
|
862
903
|
|
|
863
|
-
var Suggestions = _styledComponents["default"].ul(
|
|
904
|
+
var Suggestions = _styledComponents["default"].ul(_templateObject13(), function (props) {
|
|
864
905
|
return props.isError ? props.theme.errorMessageBackgroundColor : "#ffffff";
|
|
865
906
|
}, function (props) {
|
|
866
907
|
return props.isError ? props.theme.errorMessageBorderColor : props.theme.enabledBorderColor;
|
|
@@ -876,17 +917,21 @@ var Suggestions = _styledComponents["default"].ul(_templateObject12(), function
|
|
|
876
917
|
return props.theme.listOptionFontWeight;
|
|
877
918
|
});
|
|
878
919
|
|
|
879
|
-
var Suggestion = _styledComponents["default"].li(
|
|
920
|
+
var Suggestion = _styledComponents["default"].li(_templateObject14(), function (props) {
|
|
880
921
|
return props.active ? "background-color: ".concat(props.theme.activeListOptionBackgroundColor, ";") : props.visualFocused && "background-color: ".concat(props.theme.hoverListOptionBackgroundColor, ";");
|
|
881
922
|
});
|
|
882
923
|
|
|
883
|
-
var SuggestionsSystemMessage = _styledComponents["default"].span(
|
|
924
|
+
var SuggestionsSystemMessage = _styledComponents["default"].span(_templateObject15(), function (props) {
|
|
884
925
|
return props.theme.systemMessageFontColor;
|
|
885
926
|
});
|
|
886
927
|
|
|
887
|
-
var
|
|
928
|
+
var SuggestionsErrorIcon = _styledComponents["default"].span(_templateObject16(), function (props) {
|
|
929
|
+
return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
|
|
930
|
+
});
|
|
931
|
+
|
|
932
|
+
var SuggestionsError = _styledComponents["default"].span(_templateObject17());
|
|
888
933
|
|
|
889
|
-
|
|
934
|
+
DxcTextInput.propTypes = {
|
|
890
935
|
label: _propTypes["default"].string,
|
|
891
936
|
name: _propTypes["default"].string,
|
|
892
937
|
value: _propTypes["default"].string,
|
|
@@ -894,22 +939,19 @@ DxcNewInputText.propTypes = {
|
|
|
894
939
|
placeholder: _propTypes["default"].string,
|
|
895
940
|
action: _propTypes["default"].shape({
|
|
896
941
|
onClick: _propTypes["default"].func.isRequired,
|
|
897
|
-
icon: _propTypes["default"].shape({
|
|
942
|
+
icon: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
898
943
|
type: _propTypes["default"].oneOf(["svg"])
|
|
899
|
-
}).isRequired
|
|
944
|
+
}), _propTypes["default"].string]).isRequired
|
|
900
945
|
}),
|
|
901
946
|
clearable: _propTypes["default"].bool,
|
|
902
947
|
disabled: _propTypes["default"].bool,
|
|
903
948
|
optional: _propTypes["default"].bool,
|
|
904
|
-
prefix: _propTypes["default"].
|
|
905
|
-
|
|
906
|
-
})]),
|
|
907
|
-
suffix: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].shape({
|
|
908
|
-
type: _propTypes["default"].oneOf(["svg"])
|
|
909
|
-
})]),
|
|
949
|
+
prefix: _propTypes["default"].string,
|
|
950
|
+
suffix: _propTypes["default"].string,
|
|
910
951
|
onChange: _propTypes["default"].func,
|
|
911
952
|
onBlur: _propTypes["default"].func,
|
|
912
953
|
error: _propTypes["default"].string,
|
|
954
|
+
autocomplete: _propTypes["default"].string,
|
|
913
955
|
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
914
956
|
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
915
957
|
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
@@ -925,5 +967,5 @@ DxcNewInputText.propTypes = {
|
|
|
925
967
|
}),
|
|
926
968
|
tabIndex: _propTypes["default"].number
|
|
927
969
|
};
|
|
928
|
-
var _default =
|
|
970
|
+
var _default = DxcTextInput;
|
|
929
971
|
exports["default"] = _default;
|