@dxc-technology/halstack-react 0.0.0-b821bfb → 0.0.0-b903d8a
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 +46 -0
- package/dist/index.d.mts +6516 -0
- package/dist/index.d.ts +6516 -0
- package/dist/index.js +12982 -0
- package/dist/index.mjs +12925 -0
- package/package.json +82 -72
- package/BackgroundColorContext.js +0 -46
- package/ThemeContext.js +0 -250
- package/V3Select/V3Select.js +0 -549
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -264
- package/V3Textarea/index.d.ts +0 -27
- package/accordion/Accordion.js +0 -353
- package/accordion/index.d.ts +0 -28
- package/accordion-group/AccordionGroup.js +0 -186
- package/accordion-group/index.d.ts +0 -16
- package/alert/Alert.js +0 -403
- package/alert/index.d.ts +0 -51
- package/badge/Badge.js +0 -63
- package/box/Box.js +0 -156
- package/box/index.d.ts +0 -25
- package/button/Button.js +0 -238
- package/button/Button.stories.js +0 -27
- package/button/index.d.ts +0 -24
- package/card/Card.js +0 -254
- package/card/index.d.ts +0 -22
- package/checkbox/Checkbox.js +0 -299
- package/checkbox/index.d.ts +0 -24
- package/chip/Chip.js +0 -265
- package/chip/index.d.ts +0 -22
- package/common/OpenSans.css +0 -81
- package/common/RequiredComponent.js +0 -40
- package/common/fonts/OpenSans-Bold.ttf +0 -0
- package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-Italic.ttf +0 -0
- package/common/fonts/OpenSans-Light.ttf +0 -0
- package/common/fonts/OpenSans-LightItalic.ttf +0 -0
- package/common/fonts/OpenSans-Regular.ttf +0 -0
- package/common/fonts/OpenSans-SemiBold.ttf +0 -0
- package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/common/utils.js +0 -22
- package/common/variables.js +0 -1567
- package/date/Date.js +0 -379
- package/date/index.d.ts +0 -27
- package/date-input/DateInput.js +0 -400
- package/date-input/index.d.ts +0 -95
- package/dialog/Dialog.js +0 -218
- package/dialog/index.d.ts +0 -18
- package/dropdown/Dropdown.js +0 -544
- package/dropdown/index.d.ts +0 -26
- package/file-input/FileInput.js +0 -644
- package/file-input/FileItem.js +0 -287
- package/file-input/index.d.ts +0 -81
- package/footer/Footer.js +0 -421
- package/footer/Icons.js +0 -77
- package/footer/index.d.ts +0 -25
- package/header/Header.js +0 -470
- package/header/Icons.js +0 -59
- package/header/index.d.ts +0 -25
- package/heading/Heading.js +0 -230
- package/heading/index.d.ts +0 -17
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -705
- package/input-text/index.d.ts +0 -36
- package/layout/ApplicationLayout.js +0 -327
- package/layout/Icons.js +0 -55
- package/link/Link.js +0 -237
- package/link/index.d.ts +0 -23
- package/main.d.ts +0 -40
- package/main.js +0 -359
- package/number-input/NumberInput.js +0 -136
- package/number-input/NumberInputContext.js +0 -16
- package/number-input/index.d.ts +0 -113
- package/paginator/Icons.js +0 -66
- package/paginator/Paginator.js +0 -305
- package/paginator/index.d.ts +0 -20
- package/password-input/PasswordInput.js +0 -203
- package/password-input/index.d.ts +0 -94
- package/progress-bar/ProgressBar.js +0 -242
- package/progress-bar/index.d.ts +0 -18
- package/radio/Radio.js +0 -209
- package/radio/index.d.ts +0 -23
- package/resultsetTable/ResultsetTable.js +0 -358
- package/resultsetTable/index.d.ts +0 -19
- package/select/Select.js +0 -1138
- package/select/index.d.ts +0 -131
- package/sidenav/Sidenav.js +0 -179
- package/sidenav/index.d.ts +0 -13
- package/slider/Slider.js +0 -404
- package/slider/index.d.ts +0 -29
- package/spinner/Spinner.js +0 -381
- package/spinner/index.d.ts +0 -17
- package/switch/Switch.js +0 -222
- package/switch/index.d.ts +0 -24
- package/table/Table.js +0 -132
- package/table/index.d.ts +0 -13
- package/tabs/Tabs.js +0 -343
- package/tabs/index.d.ts +0 -19
- package/tag/Tag.js +0 -282
- package/tag/index.d.ts +0 -24
- package/text-input/TextInput.js +0 -992
- package/text-input/index.d.ts +0 -135
- package/textarea/Textarea.js +0 -369
- package/textarea/index.d.ts +0 -117
- package/toggle/Toggle.js +0 -220
- package/toggle/index.d.ts +0 -21
- package/toggle-group/ToggleGroup.js +0 -327
- package/toggle-group/index.d.ts +0 -21
- package/upload/Upload.js +0 -205
- package/upload/buttons-upload/ButtonsUpload.js +0 -135
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -329
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -189
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -123
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -148
- package/upload/transactions/Transactions.js +0 -138
- package/useTheme.js +0 -22
- package/wizard/Icons.js +0 -65
- package/wizard/Wizard.js +0 -405
- package/wizard/index.d.ts +0 -18
package/text-input/TextInput.js
DELETED
|
@@ -1,992 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports["default"] = void 0;
|
|
11
|
-
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
|
-
|
|
16
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
|
-
|
|
18
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
|
-
|
|
20
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
-
|
|
22
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
23
|
-
|
|
24
|
-
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
25
|
-
|
|
26
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
|
-
|
|
28
|
-
var _variables = require("../common/variables.js");
|
|
29
|
-
|
|
30
|
-
var _utils = require("../common/utils.js");
|
|
31
|
-
|
|
32
|
-
var _uuid = require("uuid");
|
|
33
|
-
|
|
34
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
|
|
35
|
-
|
|
36
|
-
var _NumberInputContext = _interopRequireDefault(require("../number-input/NumberInputContext.js"));
|
|
37
|
-
|
|
38
|
-
function _templateObject18() {
|
|
39
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0.25rem 1rem;\n align-items: center;\n line-height: 1.715em;\n color: ", ";\n"]);
|
|
40
|
-
|
|
41
|
-
_templateObject18 = function _templateObject18() {
|
|
42
|
-
return data;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return data;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function _templateObject17() {
|
|
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"]);
|
|
50
|
-
|
|
51
|
-
_templateObject17 = function _templateObject17() {
|
|
52
|
-
return data;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function _templateObject16() {
|
|
59
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0.25rem 1rem;\n color: ", ";\n line-height: 1.715em;\n"]);
|
|
60
|
-
|
|
61
|
-
_templateObject16 = function _templateObject16() {
|
|
62
|
-
return data;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
return data;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function _templateObject15() {
|
|
69
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding: 0.25rem 0.5rem 0.188rem 0.5rem;\n ", ";\n"]);
|
|
70
|
-
|
|
71
|
-
_templateObject15 = function _templateObject15() {
|
|
72
|
-
return data;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
return data;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function _templateObject14() {
|
|
79
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n padding: 0 0.5rem;\n line-height: 1.715em;\n cursor: pointer;\n\n box-shadow: inset 0 0 0 2px\n ", ";\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n"]);
|
|
80
|
-
|
|
81
|
-
_templateObject14 = function _templateObject14() {
|
|
82
|
-
return data;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
return data;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function _templateObject13() {
|
|
89
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n z-index: 1;\n max-height: 304px;\n overflow-y: auto;\n top: calc(100% + 4px);\n left: 0;\n margin: 0;\n padding: 0.25rem 0;\n width: 100%;\n background-color: ", ";\n border: 1px solid\n ", ";\n border-radius: 0.25rem;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n cursor: default;\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"]);
|
|
90
|
-
|
|
91
|
-
_templateObject13 = function _templateObject13() {
|
|
92
|
-
return data;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
return data;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function _templateObject12() {
|
|
99
|
-
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"]);
|
|
100
|
-
|
|
101
|
-
_templateObject12 = function _templateObject12() {
|
|
102
|
-
return data;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
return data;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function _templateObject11() {
|
|
109
|
-
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: 0.25rem;\n color: ", ";\n\n svg {\n line-height: 18px;\n font-size: 1.25rem;\n }\n"]);
|
|
110
|
-
|
|
111
|
-
_templateObject11 = function _templateObject11() {
|
|
112
|
-
return data;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
return data;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function _templateObject10() {
|
|
119
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n line-height: 1.5rem;\n margin: 0 0.25rem;\n padding: 0 0 0 0.5rem;\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"]);
|
|
120
|
-
|
|
121
|
-
_templateObject10 = function _templateObject10() {
|
|
122
|
-
return data;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
return data;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function _templateObject9() {
|
|
129
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n line-height: 1.5rem;\n margin-left: 0.25rem;\n padding: 0 0.5rem 0 0;\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"]);
|
|
130
|
-
|
|
131
|
-
_templateObject9 = function _templateObject9() {
|
|
132
|
-
return data;
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
return data;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function _templateObject8() {
|
|
139
|
-
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: 0.25rem;\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"]);
|
|
140
|
-
|
|
141
|
-
_templateObject8 = function _templateObject8() {
|
|
142
|
-
return data;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
return data;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function _templateObject7() {
|
|
149
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n width: 16px;\n height: 16px;\n"]);
|
|
150
|
-
|
|
151
|
-
_templateObject7 = function _templateObject7() {
|
|
152
|
-
return data;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
return data;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function _templateObject6() {
|
|
159
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n height: calc(2.5rem - 2px);\n width: 100%;\n background: none;\n border: none;\n outline: none;\n padding: 0 0.5rem;\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"]);
|
|
160
|
-
|
|
161
|
-
_templateObject6 = function _templateObject6() {
|
|
162
|
-
return data;
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
return data;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function _templateObject5() {
|
|
169
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n align-items: center;\n height: calc(2.5rem - 2px);\n margin: ", ";\n padding: 0 0.5rem;\n\n ", "\n box-shadow: 0 0 0 2px transparent;\n border-radius: 4px;\n border: 1px solid\n ", ";\n ", "\n ", ";\n\n ", ";\n"]);
|
|
170
|
-
|
|
171
|
-
_templateObject5 = function _templateObject5() {
|
|
172
|
-
return data;
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
return data;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function _templateObject4() {
|
|
179
|
-
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
|
-
|
|
181
|
-
_templateObject4 = function _templateObject4() {
|
|
182
|
-
return data;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
return data;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function _templateObject3() {
|
|
189
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"]);
|
|
190
|
-
|
|
191
|
-
_templateObject3 = function _templateObject3() {
|
|
192
|
-
return data;
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
return data;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function _templateObject2() {
|
|
199
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
200
|
-
|
|
201
|
-
_templateObject2 = function _templateObject2() {
|
|
202
|
-
return data;
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
return data;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function _templateObject() {
|
|
209
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"]);
|
|
210
|
-
|
|
211
|
-
_templateObject = function _templateObject() {
|
|
212
|
-
return data;
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
return data;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
var textInputIcons = {
|
|
219
|
-
error: _react["default"].createElement("svg", {
|
|
220
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
221
|
-
height: "24px",
|
|
222
|
-
viewBox: "0 0 24 24",
|
|
223
|
-
width: "24px",
|
|
224
|
-
fill: "currentColor"
|
|
225
|
-
}, _react["default"].createElement("path", {
|
|
226
|
-
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
|
|
227
|
-
})),
|
|
228
|
-
clear: _react["default"].createElement("svg", {
|
|
229
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
230
|
-
width: "24",
|
|
231
|
-
height: "24",
|
|
232
|
-
viewBox: "0 0 24 24",
|
|
233
|
-
fill: "currentColor"
|
|
234
|
-
}, _react["default"].createElement("path", {
|
|
235
|
-
d: "M0 0h24v24H0V0z",
|
|
236
|
-
fill: "none"
|
|
237
|
-
}), _react["default"].createElement("path", {
|
|
238
|
-
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
|
|
239
|
-
})),
|
|
240
|
-
increment: _react["default"].createElement("svg", {
|
|
241
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
242
|
-
height: "24px",
|
|
243
|
-
viewBox: "0 0 24 24",
|
|
244
|
-
width: "24px",
|
|
245
|
-
fill: "currentColor"
|
|
246
|
-
}, _react["default"].createElement("path", {
|
|
247
|
-
d: "M0 0h24v24H0z",
|
|
248
|
-
fill: "none"
|
|
249
|
-
}), _react["default"].createElement("path", {
|
|
250
|
-
d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"
|
|
251
|
-
})),
|
|
252
|
-
decrement: _react["default"].createElement("svg", {
|
|
253
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
254
|
-
height: "24px",
|
|
255
|
-
viewBox: "0 0 24 24",
|
|
256
|
-
width: "24px",
|
|
257
|
-
fill: "currentColor"
|
|
258
|
-
}, _react["default"].createElement("path", {
|
|
259
|
-
d: "M0 0h24v24H0z",
|
|
260
|
-
fill: "none"
|
|
261
|
-
}), _react["default"].createElement("path", {
|
|
262
|
-
d: "M19 13H5v-2h14v2z"
|
|
263
|
-
}))
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
var makeCancelable = function makeCancelable(promise) {
|
|
267
|
-
var hasCanceled_ = false;
|
|
268
|
-
var wrappedPromise = new Promise(function (resolve, reject) {
|
|
269
|
-
promise.then(function (val) {
|
|
270
|
-
return hasCanceled_ ? reject({
|
|
271
|
-
isCanceled: true
|
|
272
|
-
}) : resolve(val);
|
|
273
|
-
}, function (promiseError) {
|
|
274
|
-
return hasCanceled_ ? reject({
|
|
275
|
-
isCanceled: true
|
|
276
|
-
}) : reject(promiseError);
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
|
-
return {
|
|
280
|
-
promise: wrappedPromise,
|
|
281
|
-
cancel: function cancel() {
|
|
282
|
-
hasCanceled_ = true;
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
var getNotOptionalErrorMessage = function getNotOptionalErrorMessage() {
|
|
288
|
-
return "This field is required. Please, enter a value.";
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
var getLengthErrorMessage = function getLengthErrorMessage(length) {
|
|
292
|
-
return "Min length ".concat(length.min, ", max length ").concat(length.max, ".");
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
var getPatternErrorMessage = function getPatternErrorMessage() {
|
|
296
|
-
return "Please match the format requested.";
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
var patternMatch = function patternMatch(pattern, value) {
|
|
300
|
-
return new RegExp(pattern).test(value);
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
var DxcTextInput = _react["default"].forwardRef(function (_ref, ref) {
|
|
304
|
-
var _action$title;
|
|
305
|
-
|
|
306
|
-
var _ref$label = _ref.label,
|
|
307
|
-
label = _ref$label === void 0 ? "" : _ref$label,
|
|
308
|
-
_ref$name = _ref.name,
|
|
309
|
-
name = _ref$name === void 0 ? "" : _ref$name,
|
|
310
|
-
value = _ref.value,
|
|
311
|
-
_ref$helperText = _ref.helperText,
|
|
312
|
-
helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
|
|
313
|
-
_ref$placeholder = _ref.placeholder,
|
|
314
|
-
placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
|
|
315
|
-
action = _ref.action,
|
|
316
|
-
_ref$clearable = _ref.clearable,
|
|
317
|
-
clearable = _ref$clearable === void 0 ? false : _ref$clearable,
|
|
318
|
-
_ref$disabled = _ref.disabled,
|
|
319
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
320
|
-
_ref$optional = _ref.optional,
|
|
321
|
-
optional = _ref$optional === void 0 ? false : _ref$optional,
|
|
322
|
-
_ref$prefix = _ref.prefix,
|
|
323
|
-
prefix = _ref$prefix === void 0 ? "" : _ref$prefix,
|
|
324
|
-
_ref$suffix = _ref.suffix,
|
|
325
|
-
suffix = _ref$suffix === void 0 ? "" : _ref$suffix,
|
|
326
|
-
onChange = _ref.onChange,
|
|
327
|
-
onBlur = _ref.onBlur,
|
|
328
|
-
_ref$error = _ref.error,
|
|
329
|
-
error = _ref$error === void 0 ? "" : _ref$error,
|
|
330
|
-
suggestions = _ref.suggestions,
|
|
331
|
-
pattern = _ref.pattern,
|
|
332
|
-
length = _ref.length,
|
|
333
|
-
_ref$autocomplete = _ref.autocomplete,
|
|
334
|
-
autocomplete = _ref$autocomplete === void 0 ? "off" : _ref$autocomplete,
|
|
335
|
-
margin = _ref.margin,
|
|
336
|
-
_ref$size = _ref.size,
|
|
337
|
-
size = _ref$size === void 0 ? "medium" : _ref$size,
|
|
338
|
-
_ref$tabIndex = _ref.tabIndex,
|
|
339
|
-
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
340
|
-
|
|
341
|
-
var _useState = (0, _react.useState)("input-".concat((0, _uuid.v4)())),
|
|
342
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 1),
|
|
343
|
-
inputId = _useState2[0];
|
|
344
|
-
|
|
345
|
-
var _useState3 = (0, _react.useState)(""),
|
|
346
|
-
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
347
|
-
innerValue = _useState4[0],
|
|
348
|
-
setInnerValue = _useState4[1];
|
|
349
|
-
|
|
350
|
-
var _useState5 = (0, _react.useState)(false),
|
|
351
|
-
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
352
|
-
isOpen = _useState6[0],
|
|
353
|
-
changeIsOpen = _useState6[1];
|
|
354
|
-
|
|
355
|
-
var _useState7 = (0, _react.useState)(false),
|
|
356
|
-
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
357
|
-
isSearching = _useState8[0],
|
|
358
|
-
changeIsSearching = _useState8[1];
|
|
359
|
-
|
|
360
|
-
var _useState9 = (0, _react.useState)(false),
|
|
361
|
-
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
362
|
-
isAutosuggestError = _useState10[0],
|
|
363
|
-
changeIsAutosuggestError = _useState10[1];
|
|
364
|
-
|
|
365
|
-
var _useState11 = (0, _react.useState)([]),
|
|
366
|
-
_useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
|
|
367
|
-
filteredSuggestions = _useState12[0],
|
|
368
|
-
changeFilteredSuggestions = _useState12[1];
|
|
369
|
-
|
|
370
|
-
var _useState13 = (0, _react.useState)(-1),
|
|
371
|
-
_useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
|
|
372
|
-
visualFocusedSuggIndex = _useState14[0],
|
|
373
|
-
changeVisualFocusedSuggIndex = _useState14[1];
|
|
374
|
-
|
|
375
|
-
var suggestionsRef = (0, _react.useRef)(null);
|
|
376
|
-
var inputRef = (0, _react.useRef)(null);
|
|
377
|
-
var actionRef = (0, _react.useRef)(null);
|
|
378
|
-
var colorsTheme = (0, _useTheme["default"])();
|
|
379
|
-
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
380
|
-
var autosuggestId = "".concat(inputId, "-listBox");
|
|
381
|
-
var errorId = "error-message-".concat(inputId);
|
|
382
|
-
var numberInputContext = (0, _react.useContext)(_NumberInputContext["default"]);
|
|
383
|
-
|
|
384
|
-
var isNotOptional = function isNotOptional(value) {
|
|
385
|
-
return value === "" && !optional;
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
var isLengthIncorrect = function isLengthIncorrect(value) {
|
|
389
|
-
return value !== "" && length && length.min && length.max && (value.length < length.min || value.length > length.max);
|
|
390
|
-
};
|
|
391
|
-
|
|
392
|
-
var isNumberIncorrect = function isNumberIncorrect(value) {
|
|
393
|
-
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);
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
var isTextInputType = function isTextInputType() {
|
|
397
|
-
var _inputRef$current, _inputRef$current2;
|
|
398
|
-
|
|
399
|
-
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";
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
var getNumberErrorMessage = function getNumberErrorMessage(value) {
|
|
403
|
-
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, ".");
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
var hasSuggestions = function hasSuggestions() {
|
|
407
|
-
return typeof suggestions === "function" || suggestions && suggestions.length > 0;
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
var openSuggestions = function openSuggestions() {
|
|
411
|
-
if (hasSuggestions() && (filteredSuggestions.length > 0 || isSearching || isAutosuggestError)) changeIsOpen(true);
|
|
412
|
-
};
|
|
413
|
-
|
|
414
|
-
var closeSuggestions = function closeSuggestions() {
|
|
415
|
-
changeIsOpen(false);
|
|
416
|
-
changeVisualFocusedSuggIndex(-1);
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
var changeValue = function changeValue(newValue) {
|
|
420
|
-
value !== null && value !== void 0 ? value : setInnerValue(newValue);
|
|
421
|
-
var changedValue = typeof newValue === "number" ? newValue.toString() : newValue;
|
|
422
|
-
if (isNotOptional(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
423
|
-
value: changedValue,
|
|
424
|
-
error: getNotOptionalErrorMessage()
|
|
425
|
-
});else if (isLengthIncorrect(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
426
|
-
value: changedValue,
|
|
427
|
-
error: getLengthErrorMessage(length)
|
|
428
|
-
});else if (newValue && pattern && !patternMatch(pattern, newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
429
|
-
value: changedValue,
|
|
430
|
-
error: getPatternErrorMessage()
|
|
431
|
-
});else if (newValue && isNumberIncorrect(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
432
|
-
value: changedValue,
|
|
433
|
-
error: getNumberErrorMessage(newValue)
|
|
434
|
-
});else onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
435
|
-
value: changedValue,
|
|
436
|
-
error: null
|
|
437
|
-
});
|
|
438
|
-
};
|
|
439
|
-
|
|
440
|
-
var handleInputContainerOnClick = function handleInputContainerOnClick() {
|
|
441
|
-
document.activeElement !== actionRef.current && inputRef.current.focus();
|
|
442
|
-
};
|
|
443
|
-
|
|
444
|
-
var handleIOnChange = function handleIOnChange(event) {
|
|
445
|
-
openSuggestions();
|
|
446
|
-
changeValue(event.target.value);
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
var handleIOnClick = function handleIOnClick() {
|
|
450
|
-
openSuggestions();
|
|
451
|
-
};
|
|
452
|
-
|
|
453
|
-
var handleIOnBlur = function handleIOnBlur(event) {
|
|
454
|
-
suggestions && closeSuggestions();
|
|
455
|
-
if (isNotOptional(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
456
|
-
value: event.target.value,
|
|
457
|
-
error: getNotOptionalErrorMessage()
|
|
458
|
-
});else if (isLengthIncorrect(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
459
|
-
value: event.target.value,
|
|
460
|
-
error: getLengthErrorMessage(length)
|
|
461
|
-
});else if (event.target.value && pattern && !patternMatch(pattern, event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
462
|
-
value: event.target.value,
|
|
463
|
-
error: getPatternErrorMessage()
|
|
464
|
-
});else if (event.target.value && isNumberIncorrect(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
465
|
-
value: event.target.value,
|
|
466
|
-
error: getNumberErrorMessage(event.target.value)
|
|
467
|
-
});else onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
468
|
-
value: event.target.value,
|
|
469
|
-
error: null
|
|
470
|
-
});
|
|
471
|
-
};
|
|
472
|
-
|
|
473
|
-
var handleIOnFocus = function handleIOnFocus() {
|
|
474
|
-
openSuggestions();
|
|
475
|
-
};
|
|
476
|
-
|
|
477
|
-
var handleIOnKeyDown = function handleIOnKeyDown(event) {
|
|
478
|
-
switch (event.keyCode) {
|
|
479
|
-
case 40:
|
|
480
|
-
// Arrow Down
|
|
481
|
-
if (numberInputContext) {
|
|
482
|
-
decrementNumber();
|
|
483
|
-
event.preventDefault();
|
|
484
|
-
} else {
|
|
485
|
-
event.preventDefault();
|
|
486
|
-
openSuggestions();
|
|
487
|
-
|
|
488
|
-
if (!isAutosuggestError && !isSearching && filteredSuggestions.length > 0) {
|
|
489
|
-
changeVisualFocusedSuggIndex(function (visualFocusedSuggIndex) {
|
|
490
|
-
if (visualFocusedSuggIndex < filteredSuggestions.length - 1) return visualFocusedSuggIndex + 1;else if (visualFocusedSuggIndex === filteredSuggestions.length - 1) return 0;
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
break;
|
|
496
|
-
|
|
497
|
-
case 38:
|
|
498
|
-
// Arrow Up
|
|
499
|
-
if (numberInputContext) {
|
|
500
|
-
incrementNumber();
|
|
501
|
-
event.preventDefault();
|
|
502
|
-
} else {
|
|
503
|
-
event.preventDefault();
|
|
504
|
-
openSuggestions();
|
|
505
|
-
|
|
506
|
-
if (!isAutosuggestError && !isSearching && filteredSuggestions.length > 0) {
|
|
507
|
-
changeVisualFocusedSuggIndex(function (visualFocusedSuggIndex) {
|
|
508
|
-
if (visualFocusedSuggIndex === 0 || visualFocusedSuggIndex === -1) return filteredSuggestions.length > 0 ? filteredSuggestions.length - 1 : suggestions.length - 1;else return visualFocusedSuggIndex - 1;
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
break;
|
|
514
|
-
|
|
515
|
-
case 27:
|
|
516
|
-
// Esc
|
|
517
|
-
event.preventDefault();
|
|
518
|
-
|
|
519
|
-
if (hasSuggestions()) {
|
|
520
|
-
changeValue("");
|
|
521
|
-
isOpen && closeSuggestions();
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
break;
|
|
525
|
-
|
|
526
|
-
case 13:
|
|
527
|
-
// Enter
|
|
528
|
-
if (hasSuggestions() && !isSearching) {
|
|
529
|
-
var validFocusedSuggestion = filteredSuggestions.length > 0 && visualFocusedSuggIndex >= 0 && visualFocusedSuggIndex < filteredSuggestions.length;
|
|
530
|
-
validFocusedSuggestion && changeValue(filteredSuggestions[visualFocusedSuggIndex]);
|
|
531
|
-
isOpen && closeSuggestions();
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
break;
|
|
535
|
-
}
|
|
536
|
-
};
|
|
537
|
-
|
|
538
|
-
var handleClearActionOnClick = function handleClearActionOnClick() {
|
|
539
|
-
changeValue("");
|
|
540
|
-
inputRef.current.focus();
|
|
541
|
-
suggestions && closeSuggestions();
|
|
542
|
-
};
|
|
543
|
-
|
|
544
|
-
var handleDecrementActionOnClick = function handleDecrementActionOnClick() {
|
|
545
|
-
decrementNumber();
|
|
546
|
-
inputRef.current.focus();
|
|
547
|
-
};
|
|
548
|
-
|
|
549
|
-
var handleIncrementActionOnClick = function handleIncrementActionOnClick() {
|
|
550
|
-
incrementNumber();
|
|
551
|
-
inputRef.current.focus();
|
|
552
|
-
};
|
|
553
|
-
|
|
554
|
-
var setNumberProps = function setNumberProps(type, min, max, step) {
|
|
555
|
-
var _inputRef$current3, _inputRef$current4, _inputRef$current5, _inputRef$current6;
|
|
556
|
-
|
|
557
|
-
type && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.setAttribute("type", type));
|
|
558
|
-
min && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.setAttribute("min", min));
|
|
559
|
-
max && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : _inputRef$current5.setAttribute("max", max));
|
|
560
|
-
step && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : _inputRef$current6.setAttribute("step", step));
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
var decrementNumber = function decrementNumber() {
|
|
564
|
-
var numberValue = value !== null && value !== void 0 ? value : innerValue;
|
|
565
|
-
|
|
566
|
-
if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && parseInt(numberValue) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber)) {
|
|
567
|
-
changeValue(parseInt(numberValue));
|
|
568
|
-
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(numberValue) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) {
|
|
569
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
570
|
-
} 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))) {
|
|
571
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
|
|
572
|
-
} 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 !== "") {
|
|
573
|
-
changeValue(parseInt(numberValue) - (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
574
|
-
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
|
|
575
|
-
changeValue(-(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
576
|
-
} else if (numberValue === "") {
|
|
577
|
-
changeValue(-1);
|
|
578
|
-
} else {
|
|
579
|
-
changeValue(parseInt(numberValue) - 1);
|
|
580
|
-
}
|
|
581
|
-
};
|
|
582
|
-
|
|
583
|
-
var incrementNumber = function incrementNumber() {
|
|
584
|
-
var numberValue = value !== null && value !== void 0 ? value : innerValue;
|
|
585
|
-
|
|
586
|
-
if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.maxNumber && parseInt(numberValue) > (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber)) {
|
|
587
|
-
changeValue(parseInt(numberValue));
|
|
588
|
-
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.minNumber && (parseInt(numberValue) < (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber) || numberValue === "")) {
|
|
589
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.minNumber);
|
|
590
|
-
} 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))) {
|
|
591
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.maxNumber);
|
|
592
|
-
} 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 !== "") {
|
|
593
|
-
changeValue(parseInt(numberValue) + (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber));
|
|
594
|
-
} else if (numberInputContext !== null && numberInputContext !== void 0 && numberInputContext.stepNumber && numberValue == "") {
|
|
595
|
-
changeValue(numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.stepNumber);
|
|
596
|
-
} else if (numberValue === "") {
|
|
597
|
-
changeValue(1);
|
|
598
|
-
} else {
|
|
599
|
-
changeValue(parseInt(numberValue) + 1);
|
|
600
|
-
}
|
|
601
|
-
};
|
|
602
|
-
|
|
603
|
-
(0, _react.useLayoutEffect)(function () {
|
|
604
|
-
var _suggestionsRef$curre, _visualFocusedOptionE;
|
|
605
|
-
|
|
606
|
-
var visualFocusedOptionEl = suggestionsRef === null || suggestionsRef === void 0 ? void 0 : (_suggestionsRef$curre = suggestionsRef.current) === null || _suggestionsRef$curre === void 0 ? void 0 : _suggestionsRef$curre.querySelectorAll("[role='option']")[visualFocusedSuggIndex];
|
|
607
|
-
visualFocusedOptionEl === null || visualFocusedOptionEl === void 0 ? void 0 : (_visualFocusedOptionE = visualFocusedOptionEl.scrollIntoView) === null || _visualFocusedOptionE === void 0 ? void 0 : _visualFocusedOptionE.call(visualFocusedOptionEl, {
|
|
608
|
-
block: "nearest",
|
|
609
|
-
inline: "start"
|
|
610
|
-
});
|
|
611
|
-
}, [visualFocusedSuggIndex]);
|
|
612
|
-
(0, _react.useEffect)(function () {
|
|
613
|
-
if (typeof suggestions === "function") {
|
|
614
|
-
changeIsSearching(true);
|
|
615
|
-
changeIsAutosuggestError(false);
|
|
616
|
-
changeFilteredSuggestions([]);
|
|
617
|
-
var cancelablePromise = makeCancelable(suggestions(value !== null && value !== void 0 ? value : innerValue));
|
|
618
|
-
cancelablePromise.promise.then(function (promiseResponse) {
|
|
619
|
-
changeIsSearching(false);
|
|
620
|
-
changeIsAutosuggestError(false);
|
|
621
|
-
changeFilteredSuggestions(promiseResponse);
|
|
622
|
-
})["catch"](function (err) {
|
|
623
|
-
if (!err.isCanceled) {
|
|
624
|
-
changeIsSearching(false);
|
|
625
|
-
changeIsAutosuggestError(true);
|
|
626
|
-
}
|
|
627
|
-
});
|
|
628
|
-
return function () {
|
|
629
|
-
cancelablePromise.cancel();
|
|
630
|
-
};
|
|
631
|
-
} else if ((suggestions === null || suggestions === void 0 ? void 0 : suggestions.length) > 0) {
|
|
632
|
-
changeFilteredSuggestions(suggestions.filter(function (suggestion) {
|
|
633
|
-
return suggestion.toUpperCase().startsWith((value !== null && value !== void 0 ? value : innerValue).toUpperCase());
|
|
634
|
-
}));
|
|
635
|
-
changeVisualFocusedSuggIndex(-1);
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
numberInputContext && setNumberProps(numberInputContext.typeNumber, numberInputContext.minNumber, numberInputContext.maxNumber, numberInputContext.stepNumber);
|
|
639
|
-
}, [value, innerValue, suggestions]);
|
|
640
|
-
(0, _react.useLayoutEffect)(function () {
|
|
641
|
-
if (filteredSuggestions.length === 0 && !isSearching && !isAutosuggestError) closeSuggestions();
|
|
642
|
-
}, [filteredSuggestions]);
|
|
643
|
-
|
|
644
|
-
var getLastOptionIndex = function getLastOptionIndex() {
|
|
645
|
-
var last = 0;
|
|
646
|
-
|
|
647
|
-
var reducer = function reducer(acc, current) {
|
|
648
|
-
var _current$options;
|
|
649
|
-
|
|
650
|
-
return acc + ((_current$options = current.options) === null || _current$options === void 0 ? void 0 : _current$options.length);
|
|
651
|
-
};
|
|
652
|
-
|
|
653
|
-
if (filteredSuggestions.length > 0) filteredSuggestions[0].options ? last = filteredSuggestions.reduce(reducer, 0) - 1 : last = filteredSuggestions.length - 1;
|
|
654
|
-
return last;
|
|
655
|
-
};
|
|
656
|
-
|
|
657
|
-
var lastOptionIndex = (0, _react.useMemo)(function () {
|
|
658
|
-
return getLastOptionIndex();
|
|
659
|
-
}, [filteredSuggestions]);
|
|
660
|
-
|
|
661
|
-
var HighlightedSuggestion = function HighlightedSuggestion(_ref2) {
|
|
662
|
-
var suggestion = _ref2.suggestion,
|
|
663
|
-
index = _ref2.index;
|
|
664
|
-
var regEx = new RegExp(value !== null && value !== void 0 ? value : innerValue, "i");
|
|
665
|
-
var matchedWords = suggestion.match(regEx);
|
|
666
|
-
var noMatchedWords = suggestion.replace(regEx, "");
|
|
667
|
-
var isLastOption = index === lastOptionIndex;
|
|
668
|
-
return _react["default"].createElement(Suggestion, {
|
|
669
|
-
id: "suggestion-".concat(index),
|
|
670
|
-
onClick: function onClick() {
|
|
671
|
-
changeValue(suggestion);
|
|
672
|
-
closeSuggestions();
|
|
673
|
-
},
|
|
674
|
-
role: "option",
|
|
675
|
-
"aria-selected": visualFocusedSuggIndex === index && "true",
|
|
676
|
-
visualFocused: visualFocusedSuggIndex === index
|
|
677
|
-
}, _react["default"].createElement(StyledSuggestion, {
|
|
678
|
-
last: isLastOption,
|
|
679
|
-
visualFocused: visualFocusedSuggIndex === index
|
|
680
|
-
}, typeof suggestions === "function" ? suggestion : _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement("strong", null, matchedWords), noMatchedWords)));
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
684
|
-
theme: colorsTheme.textInput
|
|
685
|
-
}, _react["default"].createElement(DxcInput, {
|
|
686
|
-
margin: margin,
|
|
687
|
-
ref: ref,
|
|
688
|
-
size: size
|
|
689
|
-
}, _react["default"].createElement(Label, {
|
|
690
|
-
htmlFor: inputId,
|
|
691
|
-
disabled: disabled,
|
|
692
|
-
backgroundType: backgroundType
|
|
693
|
-
}, label, " ", optional && _react["default"].createElement(OptionalLabel, null, "(Optional)")), _react["default"].createElement(HelperText, {
|
|
694
|
-
disabled: disabled,
|
|
695
|
-
backgroundType: backgroundType
|
|
696
|
-
}, helperText), _react["default"].createElement(InputContainer, {
|
|
697
|
-
error: error,
|
|
698
|
-
disabled: disabled,
|
|
699
|
-
backgroundType: backgroundType,
|
|
700
|
-
onClick: handleInputContainerOnClick
|
|
701
|
-
}, prefix && _react["default"].createElement(Prefix, {
|
|
702
|
-
disabled: disabled,
|
|
703
|
-
backgroundType: backgroundType
|
|
704
|
-
}, prefix), _react["default"].createElement(Input, {
|
|
705
|
-
id: inputId,
|
|
706
|
-
name: name,
|
|
707
|
-
value: value !== null && value !== void 0 ? value : innerValue,
|
|
708
|
-
placeholder: placeholder,
|
|
709
|
-
onChange: handleIOnChange,
|
|
710
|
-
onClick: handleIOnClick,
|
|
711
|
-
onBlur: handleIOnBlur,
|
|
712
|
-
onFocus: handleIOnFocus,
|
|
713
|
-
onKeyDown: handleIOnKeyDown,
|
|
714
|
-
disabled: disabled,
|
|
715
|
-
ref: inputRef,
|
|
716
|
-
backgroundType: backgroundType,
|
|
717
|
-
pattern: pattern,
|
|
718
|
-
minLength: length === null || length === void 0 ? void 0 : length.min,
|
|
719
|
-
maxLength: length === null || length === void 0 ? void 0 : length.max,
|
|
720
|
-
autoComplete: autocomplete,
|
|
721
|
-
tabIndex: tabIndex,
|
|
722
|
-
role: isTextInputType() && hasSuggestions() ? "combobox" : "textbox",
|
|
723
|
-
"aria-autocomplete": isTextInputType() && hasSuggestions() ? "list" : undefined,
|
|
724
|
-
"aria-controls": isTextInputType() && hasSuggestions() ? autosuggestId : undefined,
|
|
725
|
-
"aria-expanded": isTextInputType() && hasSuggestions() ? isOpen ? "true" : "false" : undefined,
|
|
726
|
-
"aria-activedescendant": isTextInputType() && hasSuggestions() && isOpen && visualFocusedSuggIndex !== -1 ? "suggestion-".concat(visualFocusedSuggIndex) : undefined,
|
|
727
|
-
"aria-invalid": error ? "true" : "false",
|
|
728
|
-
"aria-describedby": error ? errorId : undefined,
|
|
729
|
-
"aria-required": optional ? "false" : "true"
|
|
730
|
-
}), !disabled && error && _react["default"].createElement(ErrorIcon, {
|
|
731
|
-
backgroundType: backgroundType,
|
|
732
|
-
"aria-label": "Error"
|
|
733
|
-
}, textInputIcons.error), !disabled && clearable && (value !== null && value !== void 0 ? value : innerValue).length > 0 && _react["default"].createElement(Action, {
|
|
734
|
-
onClick: handleClearActionOnClick,
|
|
735
|
-
backgroundType: backgroundType,
|
|
736
|
-
tabIndex: tabIndex,
|
|
737
|
-
"aria-label": "Clear"
|
|
738
|
-
}, textInputIcons.clear), (numberInputContext === null || numberInputContext === void 0 ? void 0 : numberInputContext.typeNumber) === "number" ? _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(Action, {
|
|
739
|
-
ref: actionRef,
|
|
740
|
-
disabled: disabled,
|
|
741
|
-
onClick: handleDecrementActionOnClick,
|
|
742
|
-
backgroundType: backgroundType,
|
|
743
|
-
tabIndex: tabIndex,
|
|
744
|
-
"aria-label": "Decrement"
|
|
745
|
-
}, textInputIcons.decrement), _react["default"].createElement(Action, {
|
|
746
|
-
ref: actionRef,
|
|
747
|
-
disabled: disabled,
|
|
748
|
-
onClick: handleIncrementActionOnClick,
|
|
749
|
-
backgroundType: backgroundType,
|
|
750
|
-
tabIndex: tabIndex,
|
|
751
|
-
"aria-label": "Increment"
|
|
752
|
-
}, textInputIcons.increment)) : action && _react["default"].createElement(Action, {
|
|
753
|
-
ref: actionRef,
|
|
754
|
-
disabled: disabled,
|
|
755
|
-
onClick: action.onClick,
|
|
756
|
-
title: (_action$title = action.title) !== null && _action$title !== void 0 ? _action$title : action.title,
|
|
757
|
-
backgroundType: backgroundType,
|
|
758
|
-
tabIndex: tabIndex
|
|
759
|
-
}, typeof action.icon === "string" ? _react["default"].createElement(ActionIcon, {
|
|
760
|
-
src: action.icon
|
|
761
|
-
}) : action.icon), suffix && _react["default"].createElement(Suffix, {
|
|
762
|
-
disabled: disabled,
|
|
763
|
-
backgroundType: backgroundType
|
|
764
|
-
}, suffix), isOpen && _react["default"].createElement(Suggestions, {
|
|
765
|
-
id: autosuggestId,
|
|
766
|
-
isError: isAutosuggestError,
|
|
767
|
-
onMouseDown: function onMouseDown(event) {
|
|
768
|
-
event.preventDefault();
|
|
769
|
-
},
|
|
770
|
-
onMouseLeave: function onMouseLeave() {
|
|
771
|
-
changeVisualFocusedSuggIndex(-1);
|
|
772
|
-
},
|
|
773
|
-
ref: suggestionsRef,
|
|
774
|
-
role: "listbox",
|
|
775
|
-
"aria-label": label
|
|
776
|
-
}, !isSearching && !isAutosuggestError && filteredSuggestions.length > 0 && filteredSuggestions.map(function (suggestion, index) {
|
|
777
|
-
return _react["default"].createElement(HighlightedSuggestion, {
|
|
778
|
-
key: "suggestion-".concat((0, _uuid.v4)()),
|
|
779
|
-
suggestion: suggestion,
|
|
780
|
-
index: index
|
|
781
|
-
});
|
|
782
|
-
}), isSearching && _react["default"].createElement(SuggestionsSystemMessage, null, "Searching..."), isAutosuggestError && _react["default"].createElement(SuggestionsError, null, _react["default"].createElement(SuggestionsErrorIcon, {
|
|
783
|
-
backgroundType: backgroundType
|
|
784
|
-
}, textInputIcons.error), "Error fetching data"))), !disabled && _react["default"].createElement(Error, {
|
|
785
|
-
id: errorId,
|
|
786
|
-
backgroundType: backgroundType
|
|
787
|
-
}, error)));
|
|
788
|
-
});
|
|
789
|
-
|
|
790
|
-
var sizes = {
|
|
791
|
-
small: "240px",
|
|
792
|
-
medium: "360px",
|
|
793
|
-
large: "480px",
|
|
794
|
-
fillParent: "100%"
|
|
795
|
-
};
|
|
796
|
-
|
|
797
|
-
var calculateWidth = function calculateWidth(margin, size) {
|
|
798
|
-
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
799
|
-
};
|
|
800
|
-
|
|
801
|
-
var DxcInput = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
802
|
-
return calculateWidth(props.margin, props.size);
|
|
803
|
-
}, function (props) {
|
|
804
|
-
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
805
|
-
}, function (props) {
|
|
806
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
807
|
-
}, function (props) {
|
|
808
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
|
|
809
|
-
}, function (props) {
|
|
810
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
811
|
-
}, function (props) {
|
|
812
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
813
|
-
});
|
|
814
|
-
|
|
815
|
-
var Label = _styledComponents["default"].label(_templateObject2(), function (props) {
|
|
816
|
-
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledLabelFontColorOnDark : props.theme.disabledLabelFontColor : props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.theme.labelFontColor;
|
|
817
|
-
}, function (props) {
|
|
818
|
-
return props.theme.fontFamily;
|
|
819
|
-
}, function (props) {
|
|
820
|
-
return props.theme.labelFontSize;
|
|
821
|
-
}, function (props) {
|
|
822
|
-
return props.theme.labelFontStyle;
|
|
823
|
-
}, function (props) {
|
|
824
|
-
return props.theme.labelFontWeight;
|
|
825
|
-
}, function (props) {
|
|
826
|
-
return props.theme.labelLineHeight;
|
|
827
|
-
});
|
|
828
|
-
|
|
829
|
-
var OptionalLabel = _styledComponents["default"].span(_templateObject3(), function (props) {
|
|
830
|
-
return props.theme.optionalLabelFontWeight;
|
|
831
|
-
});
|
|
832
|
-
|
|
833
|
-
var HelperText = _styledComponents["default"].span(_templateObject4(), function (props) {
|
|
834
|
-
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledHelperTextFontColorOnDark : props.theme.disabledHelperTextFontColor : props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.theme.helperTextFontColor;
|
|
835
|
-
}, function (props) {
|
|
836
|
-
return props.theme.fontFamily;
|
|
837
|
-
}, function (props) {
|
|
838
|
-
return props.theme.helperTextFontSize;
|
|
839
|
-
}, function (props) {
|
|
840
|
-
return props.theme.helperTextFontStyle;
|
|
841
|
-
}, function (props) {
|
|
842
|
-
return props.theme.helperTextFontWeight;
|
|
843
|
-
}, function (props) {
|
|
844
|
-
return props.theme.helperTextLineHeight;
|
|
845
|
-
});
|
|
846
|
-
|
|
847
|
-
var InputContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
|
|
848
|
-
return "".concat(props.theme.inputMarginTop, " 0 ").concat(props.theme.inputMarginBottom, " 0");
|
|
849
|
-
}, function (props) {
|
|
850
|
-
if (props.disabled) return props.backgroundType === "dark" ? "background-color: ".concat(props.theme.disabledContainerFillColorOnDark, ";") : "background-color: ".concat(props.theme.disabledContainerFillColor, ";");
|
|
851
|
-
}, function (props) {
|
|
852
|
-
if (props.disabled) return props.backgroundType === "dark" ? props.theme.disabledBorderColorOnDark : props.theme.disabledBorderColor;else return props.backgroundType === "dark" ? props.theme.enabledBorderColorOnDark : props.theme.enabledBorderColor;
|
|
853
|
-
}, function (props) {
|
|
854
|
-
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 ");
|
|
855
|
-
}, function (props) {
|
|
856
|
-
return props.disabled && "cursor: not-allowed;";
|
|
857
|
-
}, function (props) {
|
|
858
|
-
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 ");
|
|
859
|
-
});
|
|
860
|
-
|
|
861
|
-
var Input = _styledComponents["default"].input(_templateObject6(), function (props) {
|
|
862
|
-
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledValueFontColorOnDark : props.theme.disabledValueFontColor : props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.theme.valueFontColor;
|
|
863
|
-
}, function (props) {
|
|
864
|
-
return props.theme.fontFamily;
|
|
865
|
-
}, function (props) {
|
|
866
|
-
return props.theme.valueFontSize;
|
|
867
|
-
}, function (props) {
|
|
868
|
-
return props.theme.valueFontStyle;
|
|
869
|
-
}, function (props) {
|
|
870
|
-
return props.theme.valueFontWeight;
|
|
871
|
-
}, function (props) {
|
|
872
|
-
return props.disabled && "cursor: not-allowed;";
|
|
873
|
-
}, function (props) {
|
|
874
|
-
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPlaceholderFontColorOnDark : props.theme.disabledPlaceholderFontColor : props.backgroundType === "dark" ? props.theme.placeholderFontColorOnDark : props.theme.placeholderFontColor;
|
|
875
|
-
});
|
|
876
|
-
|
|
877
|
-
var ActionIcon = _styledComponents["default"].img(_templateObject7());
|
|
878
|
-
|
|
879
|
-
var Action = _styledComponents["default"].button(_templateObject8(), function (props) {
|
|
880
|
-
return props.theme.fontFamily;
|
|
881
|
-
}, function (props) {
|
|
882
|
-
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
|
|
883
|
-
}, function (props) {
|
|
884
|
-
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionBackgroundColorOnDark : props.theme.disabledActionBackgroundColor : props.backgroundType === "dark" ? props.theme.actionBackgroundColorOnDark : props.theme.actionBackgroundColor;
|
|
885
|
-
}, function (props) {
|
|
886
|
-
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionIconColorOnDark : props.theme.disabledActionIconColor : props.backgroundType === "dark" ? props.theme.actionIconColorOnDark : props.theme.actionIconColor;
|
|
887
|
-
}, function (props) {
|
|
888
|
-
return !props.disabled && "\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 &: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 &: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 ");
|
|
889
|
-
});
|
|
890
|
-
|
|
891
|
-
var Prefix = _styledComponents["default"].span(_templateObject9(), function (props) {
|
|
892
|
-
var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPrefixColorOnDark : props.theme.disabledPrefixColor : props.backgroundType === "dark" ? props.theme.prefixColorOnDark : props.theme.prefixColor;
|
|
893
|
-
return "color: ".concat(color, "; border-right: 1px solid ").concat(color, ";");
|
|
894
|
-
}, function (props) {
|
|
895
|
-
return props.theme.fontFamily;
|
|
896
|
-
});
|
|
897
|
-
|
|
898
|
-
var Suffix = _styledComponents["default"].span(_templateObject10(), function (props) {
|
|
899
|
-
var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledSuffixColorOnDark : props.theme.disabledSuffixColor : props.backgroundType === "dark" ? props.theme.suffixColorOnDark : props.theme.suffixColor;
|
|
900
|
-
return "color: ".concat(color, "; border-left: 1px solid ").concat(color, ";");
|
|
901
|
-
}, function (props) {
|
|
902
|
-
return props.theme.fontFamily;
|
|
903
|
-
});
|
|
904
|
-
|
|
905
|
-
var ErrorIcon = _styledComponents["default"].span(_templateObject11(), function (props) {
|
|
906
|
-
return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
|
|
907
|
-
});
|
|
908
|
-
|
|
909
|
-
var Error = _styledComponents["default"].span(_templateObject12(), function (props) {
|
|
910
|
-
return props.backgroundType === "dark" ? props.theme.errorMessageColorOnDark : props.theme.errorMessageColor;
|
|
911
|
-
}, function (props) {
|
|
912
|
-
return props.theme.fontFamily;
|
|
913
|
-
});
|
|
914
|
-
|
|
915
|
-
var Suggestions = _styledComponents["default"].ul(_templateObject13(), function (props) {
|
|
916
|
-
return props.isError ? props.theme.errorListDialogBackgroundColor : props.theme.listDialogBackgroundColor;
|
|
917
|
-
}, function (props) {
|
|
918
|
-
return props.isError ? props.theme.errorListDialogBorderColor : props.theme.listDialogBorderColor;
|
|
919
|
-
}, function (props) {
|
|
920
|
-
return props.theme.listOptionFontColor;
|
|
921
|
-
}, function (props) {
|
|
922
|
-
return props.theme.fontFamily;
|
|
923
|
-
}, function (props) {
|
|
924
|
-
return props.theme.listOptionFontSize;
|
|
925
|
-
}, function (props) {
|
|
926
|
-
return props.theme.listOptionFontStyle;
|
|
927
|
-
}, function (props) {
|
|
928
|
-
return props.theme.listOptionFontWeight;
|
|
929
|
-
});
|
|
930
|
-
|
|
931
|
-
var Suggestion = _styledComponents["default"].li(_templateObject14(), function (props) {
|
|
932
|
-
return props.visualFocused ? props.theme.focusListOptionBorderColor : "transparent";
|
|
933
|
-
}, function (props) {
|
|
934
|
-
return props.theme.hoverListOptionBackgroundColor;
|
|
935
|
-
}, function (props) {
|
|
936
|
-
return props.theme.activeListOptionBackgroundColor;
|
|
937
|
-
});
|
|
938
|
-
|
|
939
|
-
var StyledSuggestion = _styledComponents["default"].span(_templateObject15(), function (props) {
|
|
940
|
-
return props.last || props.visualFocused ? "border-bottom: 1px solid transparent" : "border-bottom: 1px solid ".concat(props.theme.listOptionDividerColor);
|
|
941
|
-
});
|
|
942
|
-
|
|
943
|
-
var SuggestionsSystemMessage = _styledComponents["default"].span(_templateObject16(), function (props) {
|
|
944
|
-
return props.theme.systemMessageFontColor;
|
|
945
|
-
});
|
|
946
|
-
|
|
947
|
-
var SuggestionsErrorIcon = _styledComponents["default"].span(_templateObject17(), function (props) {
|
|
948
|
-
return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
|
|
949
|
-
});
|
|
950
|
-
|
|
951
|
-
var SuggestionsError = _styledComponents["default"].span(_templateObject18(), function (props) {
|
|
952
|
-
return props.theme.errorListDialogFontColor;
|
|
953
|
-
});
|
|
954
|
-
|
|
955
|
-
DxcTextInput.propTypes = {
|
|
956
|
-
label: _propTypes["default"].string,
|
|
957
|
-
name: _propTypes["default"].string,
|
|
958
|
-
value: _propTypes["default"].string,
|
|
959
|
-
helperText: _propTypes["default"].string,
|
|
960
|
-
placeholder: _propTypes["default"].string,
|
|
961
|
-
action: _propTypes["default"].shape({
|
|
962
|
-
onClick: _propTypes["default"].func.isRequired,
|
|
963
|
-
icon: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
964
|
-
type: _propTypes["default"].oneOf(["svg"])
|
|
965
|
-
}), _propTypes["default"].string]).isRequired
|
|
966
|
-
}),
|
|
967
|
-
clearable: _propTypes["default"].bool,
|
|
968
|
-
disabled: _propTypes["default"].bool,
|
|
969
|
-
optional: _propTypes["default"].bool,
|
|
970
|
-
prefix: _propTypes["default"].string,
|
|
971
|
-
suffix: _propTypes["default"].string,
|
|
972
|
-
onChange: _propTypes["default"].func,
|
|
973
|
-
onBlur: _propTypes["default"].func,
|
|
974
|
-
error: _propTypes["default"].string,
|
|
975
|
-
autocomplete: _propTypes["default"].string,
|
|
976
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
977
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
978
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
979
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
980
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
981
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
982
|
-
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
983
|
-
suggestions: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].array]),
|
|
984
|
-
pattern: _propTypes["default"].string,
|
|
985
|
-
length: _propTypes["default"].shape({
|
|
986
|
-
min: _propTypes["default"].number,
|
|
987
|
-
max: _propTypes["default"].number
|
|
988
|
-
}),
|
|
989
|
-
tabIndex: _propTypes["default"].number
|
|
990
|
-
};
|
|
991
|
-
var _default = DxcTextInput;
|
|
992
|
-
exports["default"] = _default;
|