@dxc-technology/halstack-react 0.0.0-b3da1a9 → 0.0.0-b3de035
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 +7 -7
- package/dist/V3Select/V3Select.js +549 -0
- package/dist/V3Select/index.d.ts +27 -0
- package/dist/V3Textarea/index.d.ts +27 -0
- package/dist/accordion/index.d.ts +28 -0
- package/dist/accordion-group/index.d.ts +16 -0
- package/dist/box/index.d.ts +25 -0
- package/dist/button/index.d.ts +24 -0
- package/dist/card/index.d.ts +22 -0
- package/dist/checkbox/index.d.ts +24 -0
- package/dist/chip/index.d.ts +22 -0
- package/dist/common/variables.js +125 -129
- package/dist/date/Date.js +6 -6
- package/dist/date/index.d.ts +27 -0
- package/dist/dialog/index.d.ts +18 -0
- package/dist/dropdown/index.d.ts +26 -0
- package/dist/file-input/FileItem.js +8 -1
- package/dist/file-input/index.d.ts +1 -1
- package/dist/footer/index.d.ts +25 -0
- package/dist/header/index.d.ts +25 -0
- package/dist/heading/index.d.ts +17 -0
- package/dist/input-text/index.d.ts +36 -0
- package/dist/link/index.d.ts +23 -0
- package/dist/main.d.ts +36 -4
- package/dist/main.js +8 -8
- package/dist/paginator/Paginator.js +3 -3
- package/dist/paginator/index.d.ts +20 -0
- package/dist/password-input/PasswordInput.js +6 -1
- package/dist/progress-bar/index.d.ts +18 -0
- package/dist/radio/index.d.ts +23 -0
- package/dist/resultsetTable/index.d.ts +19 -0
- package/dist/select/Select.js +822 -302
- package/dist/{new-select → select}/index.d.ts +1 -1
- package/dist/sidenav/index.d.ts +13 -0
- package/dist/slider/index.d.ts +29 -0
- package/dist/spinner/index.d.ts +17 -0
- package/dist/switch/index.d.ts +24 -0
- package/dist/table/index.d.ts +13 -0
- package/dist/tabs/index.d.ts +19 -0
- package/dist/tag/index.d.ts +24 -0
- package/dist/text-input/TextInput.js +3 -0
- package/dist/toggle/index.d.ts +21 -0
- package/dist/toggle-group/index.d.ts +21 -0
- package/dist/upload/Upload.js +3 -3
- package/dist/upload/index.d.ts +15 -0
- package/dist/wizard/index.d.ts +18 -0
- package/package.json +1 -1
- package/test/Date.test.js +34 -36
- package/test/Upload.test.js +4 -4
- package/test/{Select.test.js → V3Select.test.js} +12 -12
- package/dist/new-select/NewSelect.js +0 -1085
package/dist/select/Select.js
CHANGED
|
@@ -9,44 +9,200 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
13
|
|
|
14
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
17
17
|
|
|
18
18
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
19
|
|
|
20
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _variables = require("../common/variables.js");
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _uuid = require("uuid");
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _utils = require("../common/utils.js");
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _Checkbox = _interopRequireDefault(require("../checkbox/Checkbox"));
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
function _templateObject27() {
|
|
35
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n height: 16px;\n width: 16px;\n margin-left: 4px;\n color: ", ";\n"]);
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
_templateObject27 = function _templateObject27() {
|
|
38
|
+
return data;
|
|
39
|
+
};
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
function _templateObject26() {
|
|
45
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"]);
|
|
41
46
|
|
|
42
|
-
|
|
47
|
+
_templateObject26 = function _templateObject26() {
|
|
48
|
+
return data;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return data;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function _templateObject25() {
|
|
55
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n width: 16px;\n height: 16px;\n"]);
|
|
56
|
+
|
|
57
|
+
_templateObject25 = function _templateObject25() {
|
|
58
|
+
return data;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function _templateObject24() {
|
|
65
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n margin-left: 8px;\n color: ", ";\n"]);
|
|
66
|
+
|
|
67
|
+
_templateObject24 = function _templateObject24() {
|
|
68
|
+
return data;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return data;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function _templateObject23() {
|
|
75
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n overflow: hidden;\n padding-left: 8px;\n ", "\n"]);
|
|
76
|
+
|
|
77
|
+
_templateObject23 = function _templateObject23() {
|
|
78
|
+
return data;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return data;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function _templateObject22() {
|
|
85
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 4px 8px 3px 0;\n min-height: 24px;\n ", "\n ", ";\n"]);
|
|
86
|
+
|
|
87
|
+
_templateObject22 = function _templateObject22() {
|
|
88
|
+
return data;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return data;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function _templateObject21() {
|
|
95
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n padding: 0 8px;\n box-shadow: inset 0 0 0 2px transparent;\n ", "\n ", ";\n line-height: 1.715em;\n cursor: pointer;\n\n &:hover {\n ", ";\n }\n &:active {\n ", ";\n }\n"]);
|
|
96
|
+
|
|
97
|
+
_templateObject21 = function _templateObject21() {
|
|
98
|
+
return data;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
return data;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function _templateObject20() {
|
|
105
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n padding: 4px 16px;\n font-weight: ", ";\n line-height: 1.715em;\n"]);
|
|
106
|
+
|
|
107
|
+
_templateObject20 = function _templateObject20() {
|
|
108
|
+
return data;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return data;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function _templateObject19() {
|
|
115
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 16px;\n width: 16px;\n padding: 4px;\n margin-right: calc(1rem * 0.25);\n"]);
|
|
116
|
+
|
|
117
|
+
_templateObject19 = function _templateObject19() {
|
|
118
|
+
return data;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
return data;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function _templateObject18() {
|
|
125
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 4px 16px;\n color: ", ";\n font-size: 0.875rem;\n line-height: 1.715em;\n"]);
|
|
126
|
+
|
|
127
|
+
_templateObject18 = function _templateObject18() {
|
|
128
|
+
return data;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
return data;
|
|
132
|
+
}
|
|
43
133
|
|
|
44
|
-
|
|
134
|
+
function _templateObject17() {
|
|
135
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n z-index: 1;\n max-height: 304px;\n overflow-x: auto;\n top: calc(100% + 4px);\n left: 0;\n margin: 0;\n padding: 4px 0;\n width: 100%;\n box-sizing: border-box;\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 4px;\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"]);
|
|
45
136
|
|
|
46
|
-
|
|
137
|
+
_templateObject17 = function _templateObject17() {
|
|
138
|
+
return data;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
return data;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function _templateObject16() {
|
|
145
|
+
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 background-color: ", ";\n color: ", ";\n\n ", "\n\n svg {\n line-height: 18px;\n }\n"]);
|
|
146
|
+
|
|
147
|
+
_templateObject16 = function _templateObject16() {
|
|
148
|
+
return data;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
return data;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function _templateObject15() {
|
|
155
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 16px;\n width: 16px;\n padding: 4px;\n margin-left: calc(1rem * 0.25);\n color: ", ";\n"]);
|
|
156
|
+
|
|
157
|
+
_templateObject15 = function _templateObject15() {
|
|
158
|
+
return data;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
return data;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function _templateObject14() {
|
|
165
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
166
|
+
|
|
167
|
+
_templateObject14 = function _templateObject14() {
|
|
168
|
+
return data;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
return data;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function _templateObject13() {
|
|
175
|
+
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 pointer-events: none;\n color: ", ";\n\n svg {\n line-height: 18px;\n font-size: 1.25rem;\n }\n"]);
|
|
176
|
+
|
|
177
|
+
_templateObject13 = function _templateObject13() {
|
|
178
|
+
return data;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
return data;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function _templateObject12() {
|
|
185
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n grid-area: 1 / 1 / 1 / 1;\n height: calc(calc(1rem * 2.5) - calc(1px * 2));\n background: none;\n border: none;\n outline: none;\n padding: 0 calc(1rem * 0.5);\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n"]);
|
|
186
|
+
|
|
187
|
+
_templateObject12 = function _templateObject12() {
|
|
188
|
+
return data;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
return data;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function _templateObject11() {
|
|
195
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: none;\n"]);
|
|
196
|
+
|
|
197
|
+
_templateObject11 = function _templateObject11() {
|
|
198
|
+
return data;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
return data;
|
|
202
|
+
}
|
|
47
203
|
|
|
48
204
|
function _templateObject10() {
|
|
49
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
205
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n grid-area: 1 / 1 / 1 / 1;\n display: inline-flex;\n align-items: center;\n height: calc(calc(1rem * 2.5) - calc(1px * 2));\n padding: 0 calc(1rem * 0.5);\n user-select: none;\n overflow: hidden;\n\n color: ", ";\n\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n"]);
|
|
50
206
|
|
|
51
207
|
_templateObject10 = function _templateObject10() {
|
|
52
208
|
return data;
|
|
@@ -56,7 +212,7 @@ function _templateObject10() {
|
|
|
56
212
|
}
|
|
57
213
|
|
|
58
214
|
function _templateObject9() {
|
|
59
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
215
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: grid;\n width: 100%;\n"]);
|
|
60
216
|
|
|
61
217
|
_templateObject9 = function _templateObject9() {
|
|
62
218
|
return data;
|
|
@@ -66,7 +222,7 @@ function _templateObject9() {
|
|
|
66
222
|
}
|
|
67
223
|
|
|
68
224
|
function _templateObject8() {
|
|
69
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n
|
|
225
|
+
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 padding: 3px;\n ", "\n background-color: ", ";\n color: ", ";\n\n ", "\n\n svg {\n line-height: 18px;\n }\n"]);
|
|
70
226
|
|
|
71
227
|
_templateObject8 = function _templateObject8() {
|
|
72
228
|
return data;
|
|
@@ -76,7 +232,7 @@ function _templateObject8() {
|
|
|
76
232
|
}
|
|
77
233
|
|
|
78
234
|
function _templateObject7() {
|
|
79
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n
|
|
235
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n user-select: none;\n background-color: ", ";\n border-right: 1px solid ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n ", "\n"]);
|
|
80
236
|
|
|
81
237
|
_templateObject7 = function _templateObject7() {
|
|
82
238
|
return data;
|
|
@@ -86,7 +242,7 @@ function _templateObject7() {
|
|
|
86
242
|
}
|
|
87
243
|
|
|
88
244
|
function _templateObject6() {
|
|
89
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n
|
|
245
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n border: 1px solid ", ";\n border-radius: 2px;\n width: 48px;\n"]);
|
|
90
246
|
|
|
91
247
|
_templateObject6 = function _templateObject6() {
|
|
92
248
|
return data;
|
|
@@ -96,7 +252,7 @@ function _templateObject6() {
|
|
|
96
252
|
}
|
|
97
253
|
|
|
98
254
|
function _templateObject5() {
|
|
99
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
255
|
+
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 outline: none;\n box-shadow: 0 0 0 2px transparent;\n border-radius: 4px;\n border: 1px solid\n ", ";\n ", "\n ", ";\n\n ", ";\n"]);
|
|
100
256
|
|
|
101
257
|
_templateObject5 = function _templateObject5() {
|
|
102
258
|
return data;
|
|
@@ -106,7 +262,7 @@ function _templateObject5() {
|
|
|
106
262
|
}
|
|
107
263
|
|
|
108
264
|
function _templateObject4() {
|
|
109
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
265
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
110
266
|
|
|
111
267
|
_templateObject4 = function _templateObject4() {
|
|
112
268
|
return data;
|
|
@@ -116,7 +272,7 @@ function _templateObject4() {
|
|
|
116
272
|
}
|
|
117
273
|
|
|
118
274
|
function _templateObject3() {
|
|
119
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
275
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"]);
|
|
120
276
|
|
|
121
277
|
_templateObject3 = function _templateObject3() {
|
|
122
278
|
return data;
|
|
@@ -126,7 +282,7 @@ function _templateObject3() {
|
|
|
126
282
|
}
|
|
127
283
|
|
|
128
284
|
function _templateObject2() {
|
|
129
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
285
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n cursor: default;\n"]);
|
|
130
286
|
|
|
131
287
|
_templateObject2 = function _templateObject2() {
|
|
132
288
|
return data;
|
|
@@ -136,7 +292,7 @@ function _templateObject2() {
|
|
|
136
292
|
}
|
|
137
293
|
|
|
138
294
|
function _templateObject() {
|
|
139
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n width:
|
|
295
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"]);
|
|
140
296
|
|
|
141
297
|
_templateObject = function _templateObject() {
|
|
142
298
|
return data;
|
|
@@ -145,190 +301,552 @@ function _templateObject() {
|
|
|
145
301
|
return data;
|
|
146
302
|
}
|
|
147
303
|
|
|
148
|
-
var
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
304
|
+
var selectIcons = {
|
|
305
|
+
error: _react["default"].createElement("svg", {
|
|
306
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
307
|
+
height: "24px",
|
|
308
|
+
viewBox: "0 0 24 24",
|
|
309
|
+
width: "24px",
|
|
310
|
+
fill: "currentColor"
|
|
311
|
+
}, _react["default"].createElement("path", {
|
|
312
|
+
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"
|
|
313
|
+
})),
|
|
314
|
+
arrowUp: _react["default"].createElement("svg", {
|
|
315
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
316
|
+
height: "24px",
|
|
317
|
+
viewBox: "0 0 24 24",
|
|
318
|
+
width: "24px",
|
|
319
|
+
fill: "currentColor"
|
|
320
|
+
}, _react["default"].createElement("path", {
|
|
321
|
+
d: "M0 0h24v24H0V0z",
|
|
322
|
+
fill: "none"
|
|
323
|
+
}), _react["default"].createElement("path", {
|
|
324
|
+
d: "M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6 1.41 1.41z"
|
|
325
|
+
})),
|
|
326
|
+
arrowDown: _react["default"].createElement("svg", {
|
|
327
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
328
|
+
height: "24px",
|
|
329
|
+
viewBox: "0 0 24 24",
|
|
330
|
+
width: "24px",
|
|
331
|
+
fill: "currentColor"
|
|
332
|
+
}, _react["default"].createElement("path", {
|
|
333
|
+
d: "M0 0h24v24H0V0z",
|
|
334
|
+
fill: "none"
|
|
335
|
+
}), _react["default"].createElement("path", {
|
|
336
|
+
d: "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"
|
|
337
|
+
})),
|
|
338
|
+
clear: _react["default"].createElement("svg", {
|
|
339
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
340
|
+
width: "24",
|
|
341
|
+
height: "24",
|
|
342
|
+
viewBox: "0 0 24 24",
|
|
343
|
+
fill: "currentColor"
|
|
344
|
+
}, _react["default"].createElement("path", {
|
|
345
|
+
d: "M0 0h24v24H0V0z",
|
|
346
|
+
fill: "none"
|
|
347
|
+
}), _react["default"].createElement("path", {
|
|
348
|
+
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"
|
|
349
|
+
})),
|
|
350
|
+
selected: _react["default"].createElement("svg", {
|
|
351
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
352
|
+
height: "24px",
|
|
353
|
+
viewBox: "0 0 24 24",
|
|
354
|
+
width: "24px",
|
|
355
|
+
fill: "currentColor"
|
|
356
|
+
}, _react["default"].createElement("path", {
|
|
357
|
+
d: "M0 0h24v24H0z",
|
|
358
|
+
fill: "none"
|
|
359
|
+
}), _react["default"].createElement("path", {
|
|
360
|
+
d: "M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"
|
|
361
|
+
})),
|
|
362
|
+
searchOff: _react["default"].createElement("svg", {
|
|
363
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
364
|
+
height: "24px",
|
|
365
|
+
viewBox: "0 0 24 24",
|
|
366
|
+
width: "24px",
|
|
367
|
+
fill: "currentColor"
|
|
368
|
+
}, _react["default"].createElement("g", null, _react["default"].createElement("rect", {
|
|
369
|
+
fill: "none",
|
|
370
|
+
height: "24",
|
|
371
|
+
width: "24"
|
|
372
|
+
})), _react["default"].createElement("g", null, _react["default"].createElement("g", null, _react["default"].createElement("path", {
|
|
373
|
+
d: "M15.5,14h-0.79l-0.28-0.27C15.41,12.59,16,11.11,16,9.5C16,5.91,13.09,3,9.5,3C6.08,3,3.28,5.64,3.03,9h2.02 C5.3,6.75,7.18,5,9.5,5C11.99,5,14,7.01,14,9.5S11.99,14,9.5,14c-0.17,0-0.33-0.03-0.5-0.05v2.02C9.17,15.99,9.33,16,9.5,16 c1.61,0,3.09-0.59,4.23-1.57L14,14.71v0.79l5,4.99L20.49,19L15.5,14z"
|
|
374
|
+
}), _react["default"].createElement("polygon", {
|
|
375
|
+
points: "6.47,10.82 4,13.29 1.53,10.82 0.82,11.53 3.29,14 0.82,16.47 1.53,17.18 4,14.71 6.47,17.18 7.18,16.47 4.71,14 7.18,11.53"
|
|
376
|
+
}))))
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
var getNotOptionalErrorMessage = function getNotOptionalErrorMessage() {
|
|
380
|
+
return "This field is required. Please, enter a value.";
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
var filterOptionsBySearchValue = function filterOptionsBySearchValue(options, searchValue) {
|
|
384
|
+
if ((options === null || options === void 0 ? void 0 : options.length) > 0) {
|
|
385
|
+
if (options[0].options) return options.map(function (optionGroup) {
|
|
386
|
+
var group = {
|
|
387
|
+
label: optionGroup.label,
|
|
388
|
+
options: optionGroup.options.filter(function (option) {
|
|
389
|
+
return option.label.toUpperCase().includes(searchValue.toUpperCase());
|
|
390
|
+
})
|
|
391
|
+
};
|
|
392
|
+
return group;
|
|
393
|
+
});else return options.filter(function (option) {
|
|
394
|
+
return option.label.toUpperCase().includes(searchValue.toUpperCase());
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
var DxcSelect = _react["default"].forwardRef(function (_ref, ref) {
|
|
400
|
+
var _ref3;
|
|
401
|
+
|
|
402
|
+
var _ref$label = _ref.label,
|
|
403
|
+
label = _ref$label === void 0 ? "" : _ref$label,
|
|
404
|
+
_ref$name = _ref.name,
|
|
405
|
+
name = _ref$name === void 0 ? "" : _ref$name,
|
|
406
|
+
value = _ref.value,
|
|
407
|
+
options = _ref.options,
|
|
408
|
+
_ref$helperText = _ref.helperText,
|
|
409
|
+
helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
|
|
410
|
+
_ref$placeholder = _ref.placeholder,
|
|
411
|
+
placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
|
|
156
412
|
_ref$disabled = _ref.disabled,
|
|
157
413
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
158
|
-
_ref$
|
|
159
|
-
|
|
160
|
-
_ref$
|
|
161
|
-
|
|
162
|
-
_ref$iconPosition = _ref.iconPosition,
|
|
163
|
-
iconPosition = _ref$iconPosition === void 0 ? "before" : _ref$iconPosition,
|
|
414
|
+
_ref$optional = _ref.optional,
|
|
415
|
+
optional = _ref$optional === void 0 ? false : _ref$optional,
|
|
416
|
+
_ref$searchable = _ref.searchable,
|
|
417
|
+
searchable = _ref$searchable === void 0 ? false : _ref$searchable,
|
|
164
418
|
_ref$multiple = _ref.multiple,
|
|
165
419
|
multiple = _ref$multiple === void 0 ? false : _ref$multiple,
|
|
420
|
+
onChange = _ref.onChange,
|
|
421
|
+
onBlur = _ref.onBlur,
|
|
422
|
+
_ref$error = _ref.error,
|
|
423
|
+
error = _ref$error === void 0 ? "" : _ref$error,
|
|
166
424
|
margin = _ref.margin,
|
|
167
425
|
_ref$size = _ref.size,
|
|
168
426
|
size = _ref$size === void 0 ? "medium" : _ref$size,
|
|
169
427
|
_ref$tabIndex = _ref.tabIndex,
|
|
170
428
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
429
|
+
|
|
430
|
+
var _useState = (0, _react.useState)("select-".concat((0, _uuid.v4)())),
|
|
431
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 1),
|
|
432
|
+
selectId = _useState2[0];
|
|
433
|
+
|
|
434
|
+
var selectLabelId = "label-".concat(selectId);
|
|
435
|
+
|
|
436
|
+
var _useState3 = (0, _react.useState)(multiple ? [] : ""),
|
|
437
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
438
|
+
innerValue = _useState4[0],
|
|
439
|
+
setInnerValue = _useState4[1];
|
|
440
|
+
|
|
441
|
+
var _useState5 = (0, _react.useState)(""),
|
|
442
|
+
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
443
|
+
searchValue = _useState6[0],
|
|
444
|
+
setSearchValue = _useState6[1];
|
|
445
|
+
|
|
446
|
+
var _useState7 = (0, _react.useState)(-1),
|
|
447
|
+
_useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
|
|
448
|
+
visualFocusIndex = _useState8[0],
|
|
449
|
+
changeVisualFocusIndex = _useState8[1];
|
|
450
|
+
|
|
451
|
+
var _useState9 = (0, _react.useState)(false),
|
|
452
|
+
_useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
|
|
453
|
+
isOpen = _useState10[0],
|
|
454
|
+
changeIsOpen = _useState10[1];
|
|
455
|
+
|
|
456
|
+
var selectContainerRef = (0, _react.useRef)(null);
|
|
457
|
+
var selectSearchInputRef = (0, _react.useRef)(null);
|
|
458
|
+
var selectOptionsListRef = (0, _react.useRef)(null);
|
|
171
459
|
var colorsTheme = (0, _useTheme["default"])();
|
|
172
|
-
var
|
|
460
|
+
var filteredOptions = (0, _react.useMemo)(function () {
|
|
461
|
+
return filterOptionsBySearchValue(options, searchValue);
|
|
462
|
+
}, [options, searchValue]);
|
|
463
|
+
var optionalEmptyOption = {
|
|
464
|
+
label: placeholder,
|
|
465
|
+
value: ""
|
|
466
|
+
};
|
|
173
467
|
|
|
174
|
-
var
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
setSelectedValue = _useState2[1];
|
|
468
|
+
var notOptionalCheck = function notOptionalCheck(value) {
|
|
469
|
+
return value === "" && !optional;
|
|
470
|
+
};
|
|
178
471
|
|
|
179
|
-
var
|
|
180
|
-
|
|
181
|
-
|
|
472
|
+
var notOptionalMultipleCheck = function notOptionalMultipleCheck() {
|
|
473
|
+
return (value !== null && value !== void 0 ? value : innerValue).length === 0 && !optional;
|
|
474
|
+
};
|
|
182
475
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
476
|
+
var canBeOpenOptions = function canBeOpenOptions() {
|
|
477
|
+
return !disabled && (options === null || options === void 0 ? void 0 : options.length) > 0 && groupsHaveOptions();
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
var groupsHaveOptions = function groupsHaveOptions() {
|
|
481
|
+
return options[0].hasOwnProperty("options") ? options[0].options ? options.some(function (groupOption) {
|
|
482
|
+
return groupOption.options.length > 0;
|
|
483
|
+
}) : false : true;
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
var filteredGroupsHaveOptions = function filteredGroupsHaveOptions() {
|
|
487
|
+
return filteredOptions !== null && filteredOptions !== void 0 && filteredOptions[0].options ? filteredOptions.some(function (groupOption) {
|
|
488
|
+
var _groupOption$options;
|
|
489
|
+
|
|
490
|
+
return ((_groupOption$options = groupOption.options) === null || _groupOption$options === void 0 ? void 0 : _groupOption$options.length) > 0;
|
|
491
|
+
}) : true;
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
var openOptions = function openOptions() {
|
|
495
|
+
if (!isOpen && canBeOpenOptions()) changeIsOpen(true);
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
var closeOptions = function closeOptions() {
|
|
499
|
+
if (isOpen) {
|
|
500
|
+
changeIsOpen(false);
|
|
501
|
+
changeVisualFocusIndex(-1);
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
var handleSelectChangeValue = function handleSelectChangeValue(newOption) {
|
|
506
|
+
if (multiple) {
|
|
507
|
+
var _res, _res2;
|
|
508
|
+
|
|
509
|
+
var res;
|
|
510
|
+
if ((value !== null && value !== void 0 ? value : innerValue).includes(newOption.value)) value ? res = value.filter(function (optionVal) {
|
|
511
|
+
return optionVal !== newOption.value;
|
|
512
|
+
}) : setInnerValue(function (previous) {
|
|
513
|
+
return previous.filter(function (optionVal) {
|
|
514
|
+
return optionVal !== newOption.value;
|
|
515
|
+
});
|
|
516
|
+
});else value ? res = [].concat((0, _toConsumableArray2["default"])(value), [newOption.value]) : setInnerValue(function (previous) {
|
|
517
|
+
return [].concat((0, _toConsumableArray2["default"])(previous), [newOption.value]);
|
|
518
|
+
});
|
|
519
|
+
if (notOptionalMultipleCheck(newOption.value)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
520
|
+
value: (_res = res) !== null && _res !== void 0 ? _res : innerValue,
|
|
521
|
+
error: getNotOptionalErrorMessage()
|
|
522
|
+
});else onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
523
|
+
value: (_res2 = res) !== null && _res2 !== void 0 ? _res2 : innerValue,
|
|
524
|
+
error: null
|
|
525
|
+
});
|
|
186
526
|
} else {
|
|
187
|
-
|
|
527
|
+
value !== null && value !== void 0 ? value : setInnerValue(newOption.value);
|
|
528
|
+
if (notOptionalCheck(newOption.value)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
529
|
+
value: newOption.value,
|
|
530
|
+
error: getNotOptionalErrorMessage()
|
|
531
|
+
});else onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
532
|
+
value: newOption.value,
|
|
533
|
+
error: null
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
};
|
|
188
537
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
538
|
+
var handleSelectOnClick = function handleSelectOnClick() {
|
|
539
|
+
if (isOpen) {
|
|
540
|
+
closeOptions();
|
|
541
|
+
setSearchValue("");
|
|
542
|
+
} else openOptions();
|
|
543
|
+
|
|
544
|
+
searchable && selectSearchInputRef.current.focus();
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
var handleSelectOnFocus = function handleSelectOnFocus() {
|
|
548
|
+
searchable && selectSearchInputRef.current.focus();
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
var handleSelectOnBlur = function handleSelectOnBlur(event) {
|
|
552
|
+
// focus leaves container (outside, not to childs)
|
|
553
|
+
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
554
|
+
closeOptions();
|
|
555
|
+
setSearchValue("");
|
|
556
|
+
if (notOptionalCheck(value !== null && value !== void 0 ? value : innerValue)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
557
|
+
value: value !== null && value !== void 0 ? value : innerValue,
|
|
558
|
+
error: getNotOptionalErrorMessage()
|
|
559
|
+
});else onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
560
|
+
value: value !== null && value !== void 0 ? value : innerValue,
|
|
561
|
+
error: null
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
var handleSelectOnKeyDown = function handleSelectOnKeyDown(event) {
|
|
567
|
+
switch (event.keyCode) {
|
|
568
|
+
case 40:
|
|
569
|
+
// Arrow Down
|
|
570
|
+
event.preventDefault();
|
|
571
|
+
changeVisualFocusIndex(function (visualFocusIndex) {
|
|
572
|
+
if (visualFocusIndex < lastOptionIndex) return visualFocusIndex + 1;else if (visualFocusIndex === lastOptionIndex) return 0;
|
|
573
|
+
});
|
|
574
|
+
openOptions();
|
|
575
|
+
break;
|
|
576
|
+
|
|
577
|
+
case 38:
|
|
578
|
+
// Arrow Up
|
|
579
|
+
event.preventDefault();
|
|
580
|
+
changeVisualFocusIndex(function (visualFocusIndex) {
|
|
581
|
+
return visualFocusIndex === 0 || visualFocusIndex === -1 ? lastOptionIndex : visualFocusIndex - 1;
|
|
582
|
+
});
|
|
583
|
+
openOptions();
|
|
584
|
+
break;
|
|
585
|
+
|
|
586
|
+
case 27:
|
|
587
|
+
// Esc
|
|
588
|
+
event.preventDefault();
|
|
589
|
+
closeOptions();
|
|
590
|
+
setSearchValue("");
|
|
591
|
+
break;
|
|
592
|
+
|
|
593
|
+
case 13:
|
|
594
|
+
// Enter
|
|
595
|
+
if (isOpen) {
|
|
596
|
+
var accLength = optional && !multiple ? 1 : 0;
|
|
597
|
+
|
|
598
|
+
if (searchable) {
|
|
599
|
+
if (filteredOptions.length > 0) {
|
|
600
|
+
if (optional && !multiple && visualFocusIndex === 0 && filteredGroupsHaveOptions()) handleSelectChangeValue(optionalEmptyOption);else filteredOptions[0].options ? filteredGroupsHaveOptions() && filteredOptions.some(function (groupOption) {
|
|
601
|
+
var groupLength = accLength + groupOption.options.length;
|
|
602
|
+
groupLength > visualFocusIndex && handleSelectChangeValue(groupOption.options[visualFocusIndex - accLength]);
|
|
603
|
+
accLength = groupLength;
|
|
604
|
+
return groupLength > visualFocusIndex;
|
|
605
|
+
}) : handleSelectChangeValue(filteredOptions[visualFocusIndex - accLength]);
|
|
606
|
+
}
|
|
607
|
+
} else {
|
|
608
|
+
if (optional && !multiple && visualFocusIndex === 0) handleSelectChangeValue(optionalEmptyOption);else options[0].options ? options.some(function (groupOption) {
|
|
609
|
+
var groupLength = accLength + groupOption.options.length;
|
|
610
|
+
groupLength > visualFocusIndex && handleSelectChangeValue(groupOption.options[visualFocusIndex - accLength]);
|
|
611
|
+
accLength = groupLength;
|
|
612
|
+
return groupLength > visualFocusIndex;
|
|
613
|
+
}) : handleSelectChangeValue(options[visualFocusIndex - accLength]);
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
!multiple && closeOptions();
|
|
617
|
+
setSearchValue("");
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
break;
|
|
192
621
|
}
|
|
193
622
|
};
|
|
194
623
|
|
|
195
|
-
var
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
iconPosition: iconPosition
|
|
213
|
-
}), selectedItem && selectedItem.label && _react["default"].createElement(SelectedOptionLabelContainer, {
|
|
214
|
-
iconSrc: selectedItem && selectedItem.iconSrc && selectedItem.icon,
|
|
215
|
-
iconPosition: iconPosition,
|
|
216
|
-
disabled: disabled
|
|
217
|
-
}, selectedItem && selectedItem.label));
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
var getSelectedValuesWithLabel = function getSelectedValuesWithLabel(optionsList, selected) {
|
|
221
|
-
return _react["default"].createElement(MultipleLabelSelected, null, optionsList.filter(function (x) {
|
|
222
|
-
return selected.includes(x.value);
|
|
223
|
-
}).map(function (optionToRender) {
|
|
224
|
-
return optionToRender.label;
|
|
225
|
-
}).join(", "));
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
var getSelectedValuesWithIcons = function getSelectedValuesWithIcons(optionsList, selected) {
|
|
229
|
-
return optionsList.filter(function (x) {
|
|
230
|
-
return selected.includes(x.value);
|
|
231
|
-
}).map(function (optionToRender) {
|
|
232
|
-
return getLabelForSingleSelect(optionToRender.value);
|
|
624
|
+
var handleSearchIOnChange = function handleSearchIOnChange(event) {
|
|
625
|
+
setSearchValue(event.target.value);
|
|
626
|
+
changeVisualFocusIndex(-1);
|
|
627
|
+
openOptions();
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
var handleClearActionOnClick = function handleClearActionOnClick(event) {
|
|
631
|
+
event.stopPropagation();
|
|
632
|
+
setSearchValue("");
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
var handleClearOptionsActionOnClick = function handleClearOptionsActionOnClick(event) {
|
|
636
|
+
event.stopPropagation();
|
|
637
|
+
value !== null && value !== void 0 ? value : setInnerValue([]);
|
|
638
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
639
|
+
value: [],
|
|
640
|
+
error: getNotOptionalErrorMessage()
|
|
233
641
|
});
|
|
642
|
+
selectContainerRef.current.focus();
|
|
234
643
|
};
|
|
235
644
|
|
|
236
|
-
var
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
645
|
+
var getLastOptionIndex = function getLastOptionIndex() {
|
|
646
|
+
var last = 0;
|
|
647
|
+
|
|
648
|
+
var reducer = function reducer(acc, current) {
|
|
649
|
+
var _current$options;
|
|
650
|
+
|
|
651
|
+
return acc + ((_current$options = current.options) === null || _current$options === void 0 ? void 0 : _current$options.length);
|
|
652
|
+
};
|
|
653
|
+
|
|
654
|
+
if (searchable && filteredOptions.length > 0) filteredOptions[0].options ? last = filteredOptions.reduce(reducer, 0) - 1 : last = filteredOptions.length - 1;else if ((options === null || options === void 0 ? void 0 : options.length) > 0) options[0].options ? last = options.reduce(reducer, 0) - 1 : last = options.length - 1;
|
|
655
|
+
return optional && !multiple ? last + 1 : last;
|
|
240
656
|
};
|
|
241
657
|
|
|
242
|
-
var
|
|
243
|
-
return
|
|
658
|
+
var lastOptionIndex = (0, _react.useMemo)(function () {
|
|
659
|
+
return getLastOptionIndex();
|
|
660
|
+
}, [searchable, optional, multiple, searchable ? filteredOptions : options]);
|
|
661
|
+
|
|
662
|
+
var getSelectedOption = function getSelectedOption() {
|
|
663
|
+
var val = value !== null && value !== void 0 ? value : innerValue;
|
|
664
|
+
var selectedOption = multiple ? [] : "";
|
|
665
|
+
|
|
666
|
+
if (multiple) {
|
|
667
|
+
if ((options === null || options === void 0 ? void 0 : options.length) > 0) {
|
|
668
|
+
options.forEach(function (option) {
|
|
669
|
+
if (option.options) {
|
|
670
|
+
option.options.forEach(function (singleOption) {
|
|
671
|
+
if (val.includes(singleOption.value)) selectedOption.push(singleOption);
|
|
672
|
+
});
|
|
673
|
+
} else if (val.includes(option.value)) selectedOption.push(option);
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
} else {
|
|
677
|
+
if ((options === null || options === void 0 ? void 0 : options.length) > 0) {
|
|
678
|
+
options.forEach(function (option) {
|
|
679
|
+
if (option.options) {
|
|
680
|
+
option.options.forEach(function (singleOption) {
|
|
681
|
+
if (singleOption.value === val) selectedOption = singleOption;
|
|
682
|
+
});
|
|
683
|
+
} else if (option.value === val) selectedOption = option;
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
return selectedOption;
|
|
244
689
|
};
|
|
245
690
|
|
|
246
|
-
var
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
691
|
+
var selectedOption = (0, _react.useMemo)(function () {
|
|
692
|
+
return getSelectedOption();
|
|
693
|
+
}, [options, multiple, value !== null && value !== void 0 ? value : innerValue]);
|
|
694
|
+
(0, _react.useLayoutEffect)(function () {
|
|
695
|
+
var _selectOptionsListRef;
|
|
696
|
+
|
|
697
|
+
var visualFocusedOptionEl = selectOptionsListRef === null || selectOptionsListRef === void 0 ? void 0 : (_selectOptionsListRef = selectOptionsListRef.current) === null || _selectOptionsListRef === void 0 ? void 0 : _selectOptionsListRef.querySelectorAll("[role='option']")[visualFocusIndex];
|
|
698
|
+
visualFocusedOptionEl === null || visualFocusedOptionEl === void 0 ? void 0 : visualFocusedOptionEl.scrollIntoView({
|
|
699
|
+
block: "nearest",
|
|
700
|
+
inline: "start"
|
|
701
|
+
});
|
|
702
|
+
}, [visualFocusIndex]);
|
|
703
|
+
(0, _react.useLayoutEffect)(function () {
|
|
704
|
+
if (isOpen && !multiple) {
|
|
705
|
+
var listEl = selectOptionsListRef === null || selectOptionsListRef === void 0 ? void 0 : selectOptionsListRef.current;
|
|
706
|
+
var selectedListOptionEl = listEl === null || listEl === void 0 ? void 0 : listEl.querySelector("[aria-selected='true']");
|
|
707
|
+
listEl === null || listEl === void 0 ? void 0 : listEl.scrollTo({
|
|
708
|
+
top: (selectedListOptionEl === null || selectedListOptionEl === void 0 ? void 0 : selectedListOptionEl.offsetTop) - (listEl === null || listEl === void 0 ? void 0 : listEl.clientHeight) / 2
|
|
253
709
|
});
|
|
254
|
-
return result;
|
|
255
|
-
} else if (checkedValue) {
|
|
256
|
-
return checkedValue.findIndex(function (element) {
|
|
257
|
-
return element === option.value;
|
|
258
|
-
}) !== -1 || false;
|
|
259
710
|
}
|
|
711
|
+
}, [isOpen]);
|
|
712
|
+
|
|
713
|
+
var Option = function Option(_ref2) {
|
|
714
|
+
var option = _ref2.option,
|
|
715
|
+
index = _ref2.index,
|
|
716
|
+
_ref2$isGroupedOption = _ref2.isGroupedOption,
|
|
717
|
+
isGroupedOption = _ref2$isGroupedOption === void 0 ? false : _ref2$isGroupedOption;
|
|
718
|
+
var isSelected = multiple ? (value !== null && value !== void 0 ? value : innerValue).includes(option.value) : (value !== null && value !== void 0 ? value : innerValue) === option.value;
|
|
719
|
+
var isLastOption = index === lastOptionIndex;
|
|
720
|
+
return _react["default"].createElement(OptionItem, {
|
|
721
|
+
onClick: function onClick(event) {
|
|
722
|
+
// left mouse button only
|
|
723
|
+
handleSelectChangeValue(option);
|
|
724
|
+
!multiple && closeOptions();
|
|
725
|
+
setSearchValue("");
|
|
726
|
+
},
|
|
727
|
+
visualFocused: visualFocusIndex === index,
|
|
728
|
+
selected: isSelected,
|
|
729
|
+
"aria-selected": isSelected && "true",
|
|
730
|
+
role: "option"
|
|
731
|
+
}, _react["default"].createElement(StyledOption, {
|
|
732
|
+
visualFocused: visualFocusIndex === index,
|
|
733
|
+
selected: isSelected,
|
|
734
|
+
last: isLastOption,
|
|
735
|
+
grouped: isGroupedOption,
|
|
736
|
+
multiple: multiple
|
|
737
|
+
}, multiple && _react["default"].createElement(_Checkbox["default"], {
|
|
738
|
+
tabIndex: -1,
|
|
739
|
+
checked: isSelected
|
|
740
|
+
}), option.icon && _react["default"].createElement(OptionIcon, {
|
|
741
|
+
selected: isSelected
|
|
742
|
+
}, typeof option.icon === "string" ? _react["default"].createElement(OptionIconImg, {
|
|
743
|
+
src: option.icon
|
|
744
|
+
}) : option.icon), _react["default"].createElement(OptionContent, {
|
|
745
|
+
grouped: isGroupedOption,
|
|
746
|
+
hasIcon: option.icon,
|
|
747
|
+
multiple: multiple
|
|
748
|
+
}, _react["default"].createElement(OptionLabel, null, option.label), !multiple && isSelected && _react["default"].createElement(OptionSelectedIndicator, null, selectIcons.selected))));
|
|
260
749
|
};
|
|
261
750
|
|
|
262
|
-
var
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
backgroundType: backgroundType
|
|
282
|
-
}, option.label)));
|
|
751
|
+
var global_index = optional && !multiple ? 0 : -1; // index for options (not groups), starting from 0 to options.length -1
|
|
752
|
+
|
|
753
|
+
var mapOptionFunc = function mapOptionFunc(option) {
|
|
754
|
+
if (option.options) {
|
|
755
|
+
return _react["default"].createElement(_react["default"].Fragment, null, option.options.length > 0 && _react["default"].createElement(OptionGroupLabel, null, option.label), option.options.map(function (singleOption) {
|
|
756
|
+
global_index++;
|
|
757
|
+
return _react["default"].createElement(Option, {
|
|
758
|
+
option: singleOption,
|
|
759
|
+
index: global_index,
|
|
760
|
+
isGroupedOption: true
|
|
761
|
+
});
|
|
762
|
+
}));
|
|
763
|
+
} else {
|
|
764
|
+
global_index++;
|
|
765
|
+
return _react["default"].createElement(Option, {
|
|
766
|
+
option: option,
|
|
767
|
+
index: global_index
|
|
768
|
+
});
|
|
769
|
+
}
|
|
283
770
|
};
|
|
284
771
|
|
|
285
772
|
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
286
773
|
theme: colorsTheme.select
|
|
287
|
-
}, _react["default"].createElement(
|
|
774
|
+
}, _react["default"].createElement(DxcSelectContainer, {
|
|
288
775
|
margin: margin,
|
|
289
776
|
size: size,
|
|
290
|
-
|
|
777
|
+
ref: ref
|
|
778
|
+
}, _react["default"].createElement(Label, {
|
|
779
|
+
id: selectLabelId,
|
|
780
|
+
disabled: disabled,
|
|
781
|
+
onClick: function onClick() {
|
|
782
|
+
selectContainerRef.current.focus();
|
|
783
|
+
}
|
|
784
|
+
}, label, " ", optional && _react["default"].createElement(OptionalLabel, null, "(Optional)")), _react["default"].createElement(HelperText, {
|
|
785
|
+
disabled: disabled
|
|
786
|
+
}, helperText), _react["default"].createElement(SelectContainer, {
|
|
787
|
+
id: selectId,
|
|
291
788
|
disabled: disabled,
|
|
292
|
-
|
|
293
|
-
|
|
789
|
+
error: error,
|
|
790
|
+
onBlur: handleSelectOnBlur,
|
|
791
|
+
onClick: handleSelectOnClick,
|
|
792
|
+
onFocus: handleSelectOnFocus,
|
|
793
|
+
onKeyDown: handleSelectOnKeyDown,
|
|
794
|
+
ref: selectContainerRef,
|
|
795
|
+
tabIndex: tabIndex,
|
|
796
|
+
"aria-labelledby": selectLabelId
|
|
797
|
+
}, multiple && selectedOption.length > 0 && _react["default"].createElement(SelectionIndicator, null, _react["default"].createElement(SelectionNumber, {
|
|
294
798
|
disabled: disabled
|
|
295
|
-
},
|
|
799
|
+
}, selectedOption.length, " "), _react["default"].createElement(ClearOptionsAction, {
|
|
800
|
+
disabled: disabled,
|
|
801
|
+
onClick: handleClearOptionsActionOnClick,
|
|
802
|
+
tabIndex: -1,
|
|
803
|
+
title: "Clear selected options",
|
|
804
|
+
"aria-label": "Clear selected options"
|
|
805
|
+
}, selectIcons.clear)), _react["default"].createElement(SearchableValueContainer, null, _react["default"].createElement(ValueInput, {
|
|
296
806
|
name: name,
|
|
297
|
-
multiple:
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
value:
|
|
807
|
+
value: multiple ? (value !== null && value !== void 0 ? value : innerValue).join(", ") : value !== null && value !== void 0 ? value : innerValue,
|
|
808
|
+
readOnly: true
|
|
809
|
+
}), searchable && _react["default"].createElement(SearchInput, {
|
|
810
|
+
value: searchValue,
|
|
301
811
|
disabled: disabled,
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
color: colorsTheme.select.optionBackgroundColor
|
|
321
|
-
}, _react["default"].createElement(ThemedOption, {
|
|
322
|
-
option: option
|
|
323
|
-
})));
|
|
324
|
-
})), assistiveText && _react["default"].createElement(_FormHelperText["default"], {
|
|
812
|
+
onChange: handleSearchIOnChange,
|
|
813
|
+
ref: selectSearchInputRef,
|
|
814
|
+
autoComplete: "off",
|
|
815
|
+
autoCorrect: "off"
|
|
816
|
+
}), (!searchable || searchValue === "") && (multiple ? _react["default"].createElement(SelectedOption, {
|
|
817
|
+
disabled: disabled,
|
|
818
|
+
atBackground: (value !== null && value !== void 0 ? value : innerValue).length === 0 || isOpen
|
|
819
|
+
}, _react["default"].createElement(OptionLabel, null, selectedOption.map(function (option) {
|
|
820
|
+
return option.label;
|
|
821
|
+
}).join(", ")), selectedOption.length === 0 && placeholder) : _react["default"].createElement(SelectedOption, {
|
|
822
|
+
disabled: disabled,
|
|
823
|
+
atBackground: !(value !== null && value !== void 0 ? value : innerValue) || isOpen
|
|
824
|
+
}, _react["default"].createElement(OptionLabel, null, (_ref3 = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) !== null && _ref3 !== void 0 ? _ref3 : placeholder)))), !disabled && error && _react["default"].createElement(ErrorIcon, null, selectIcons.error), searchable && searchValue.length > 0 && _react["default"].createElement(ClearAction, {
|
|
825
|
+
onClick: handleClearActionOnClick,
|
|
826
|
+
tabIndex: -1,
|
|
827
|
+
title: "Clear search text",
|
|
828
|
+
"aria-label": "Clear search text"
|
|
829
|
+
}, selectIcons.clear), _react["default"].createElement(CollapseIndicator, {
|
|
325
830
|
disabled: disabled
|
|
326
|
-
},
|
|
327
|
-
|
|
831
|
+
}, isOpen ? selectIcons.arrowUp : selectIcons.arrowDown), isOpen && _react["default"].createElement(OptionsList, {
|
|
832
|
+
onClick: function onClick(event) {
|
|
833
|
+
event.stopPropagation();
|
|
834
|
+
},
|
|
835
|
+
onMouseDown: function onMouseDown(event) {
|
|
836
|
+
event.preventDefault();
|
|
837
|
+
},
|
|
838
|
+
ref: selectOptionsListRef,
|
|
839
|
+
role: "listbox",
|
|
840
|
+
"aria-label": label
|
|
841
|
+
}, searchable && (filteredOptions.length === 0 || !filteredGroupsHaveOptions()) ? _react["default"].createElement(OptionsSystemMessage, null, _react["default"].createElement(NoMatchesFoundIcon, null, selectIcons.searchOff), "No matches found") : optional && !multiple && _react["default"].createElement(Option, {
|
|
842
|
+
option: optionalEmptyOption,
|
|
843
|
+
index: 0
|
|
844
|
+
}), searchable ? filteredOptions.map(mapOptionFunc) : options.map(mapOptionFunc))), !disabled && _react["default"].createElement(Error, null, error)));
|
|
845
|
+
});
|
|
328
846
|
|
|
329
847
|
var sizes = {
|
|
330
|
-
small: "
|
|
331
|
-
medium: "
|
|
848
|
+
small: "240px",
|
|
849
|
+
medium: "360px",
|
|
332
850
|
large: "480px",
|
|
333
851
|
fillParent: "100%"
|
|
334
852
|
};
|
|
@@ -337,213 +855,215 @@ var calculateWidth = function calculateWidth(margin, size) {
|
|
|
337
855
|
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
338
856
|
};
|
|
339
857
|
|
|
340
|
-
var
|
|
341
|
-
|
|
342
|
-
var OptionListContainer = _styledComponents["default"].div(_templateObject2(), function (props) {
|
|
343
|
-
return props.theme.fontFamily;
|
|
344
|
-
}, function (props) {
|
|
345
|
-
return props.iconPosition === "before" && "row" || "row-reverse";
|
|
858
|
+
var DxcSelectContainer = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
859
|
+
return calculateWidth(props.margin, props.size);
|
|
346
860
|
}, function (props) {
|
|
347
|
-
return props.
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
var OptionListIconContainer = _styledComponents["default"].div(_templateObject3(), function (props) {
|
|
351
|
-
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledColorOnDark : props.theme.disabledColor : props.backgroundType === "dark" ? props.theme.optionIconColorOnDark : props.theme.optionIconColor;
|
|
861
|
+
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
352
862
|
}, function (props) {
|
|
353
|
-
return props.
|
|
863
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
354
864
|
}, function (props) {
|
|
355
|
-
return props.
|
|
865
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
|
|
356
866
|
}, function (props) {
|
|
357
|
-
return props.
|
|
867
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
358
868
|
}, function (props) {
|
|
359
|
-
return props.
|
|
869
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
360
870
|
});
|
|
361
871
|
|
|
362
|
-
var
|
|
363
|
-
return props.theme.
|
|
872
|
+
var Label = _styledComponents["default"].span(_templateObject2(), function (props) {
|
|
873
|
+
return props.disabled ? props.theme.disabledColor : props.theme.labelFontColor;
|
|
364
874
|
}, function (props) {
|
|
365
|
-
return props.theme.
|
|
366
|
-
}, function (props) {
|
|
367
|
-
return props.iconPosition === "after" && props.label !== "" && props.theme.optionIconSpacing || "0px";
|
|
875
|
+
return props.theme.fontFamily;
|
|
368
876
|
}, function (props) {
|
|
369
|
-
return props.
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
var OptionListLabelContainer = _styledComponents["default"].span(_templateObject5(), function (props) {
|
|
373
|
-
return props.theme.optionFontSize;
|
|
877
|
+
return props.theme.labelFontSize;
|
|
374
878
|
}, function (props) {
|
|
375
|
-
return props.theme.
|
|
879
|
+
return props.theme.labelFontStyle;
|
|
376
880
|
}, function (props) {
|
|
377
|
-
return props.theme.
|
|
881
|
+
return props.theme.labelFontWeight;
|
|
378
882
|
}, function (props) {
|
|
379
|
-
return props.
|
|
883
|
+
return props.theme.labelLineHeight;
|
|
884
|
+
});
|
|
885
|
+
|
|
886
|
+
var OptionalLabel = _styledComponents["default"].span(_templateObject3(), function (props) {
|
|
887
|
+
return props.theme.optionalLabelFontWeight;
|
|
380
888
|
});
|
|
381
889
|
|
|
382
|
-
var
|
|
383
|
-
return props.
|
|
890
|
+
var HelperText = _styledComponents["default"].span(_templateObject4(), function (props) {
|
|
891
|
+
return props.disabled ? props.theme.disabledColor : props.theme.helperTextFontColor;
|
|
384
892
|
}, function (props) {
|
|
385
|
-
return props.
|
|
893
|
+
return props.theme.fontFamily;
|
|
386
894
|
}, function (props) {
|
|
387
|
-
return props.
|
|
895
|
+
return props.theme.helperTextFontSize;
|
|
388
896
|
}, function (props) {
|
|
389
|
-
return
|
|
897
|
+
return props.theme.helperTextFontStyle;
|
|
390
898
|
}, function (props) {
|
|
391
|
-
return props.
|
|
899
|
+
return props.theme.helperTextFontWeight;
|
|
392
900
|
}, function (props) {
|
|
393
|
-
return props.
|
|
394
|
-
});
|
|
395
|
-
|
|
396
|
-
var SelectedOptionLabelContainer = _styledComponents["default"].span(_templateObject7(), function (props) {
|
|
397
|
-
return props.theme.fontFamily;
|
|
901
|
+
return props.theme.helperTextLineHeight;
|
|
398
902
|
});
|
|
399
903
|
|
|
400
|
-
var
|
|
401
|
-
return props.theme.
|
|
904
|
+
var SelectContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
|
|
905
|
+
return props.disabled ? props.theme.disabledInputBorderColor : props.theme.enabledInputBorderColor;
|
|
402
906
|
}, function (props) {
|
|
403
|
-
return props.theme.
|
|
907
|
+
return props.error && !props.disabled && "border-color: transparent;\n box-shadow: 0 0 0 2px ".concat(props.theme.errorInputBorderColor, ";\n ");
|
|
404
908
|
}, function (props) {
|
|
405
|
-
return props.
|
|
909
|
+
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
|
|
406
910
|
}, function (props) {
|
|
407
|
-
return props.
|
|
911
|
+
return !props.disabled && "\n &:hover {\n border-color: ".concat(props.error ? "transparent" : props.theme.hoverInputBorderColor, ";\n ").concat(props.error && "box-shadow: 0 0 0 2px ".concat(props.theme.hoverInputErrorBorderColor, ";"), "\n }\n &:focus-within {\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(props.theme.focusInputBorderColor, ";\n }\n ");
|
|
408
912
|
});
|
|
409
913
|
|
|
410
|
-
var
|
|
411
|
-
return props.
|
|
412
|
-
}, function (props) {
|
|
413
|
-
return props.theme.valueIconSize;
|
|
414
|
-
}, function (props) {
|
|
415
|
-
return props.theme.valueIconSize;
|
|
416
|
-
}, function (props) {
|
|
417
|
-
return props.iconPosition === "after" && props.label !== "" && props.theme.valueIconSpacing || "0px";
|
|
418
|
-
}, function (props) {
|
|
419
|
-
return props.iconPosition === "before" && props.label !== "" && props.theme.valueIconSpacing || "0px";
|
|
914
|
+
var SelectionIndicator = _styledComponents["default"].span(_templateObject6(), function (props) {
|
|
915
|
+
return props.theme.selectionIndicatorBorderColor;
|
|
420
916
|
});
|
|
421
917
|
|
|
422
|
-
var
|
|
423
|
-
return
|
|
424
|
-
}, function (props) {
|
|
425
|
-
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
426
|
-
}, function (props) {
|
|
427
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
918
|
+
var SelectionNumber = _styledComponents["default"].span(_templateObject7(), function (props) {
|
|
919
|
+
return props.theme.selectionIndicatorBackgroundColor;
|
|
428
920
|
}, function (props) {
|
|
429
|
-
return props.
|
|
921
|
+
return props.theme.selectionIndicatorBorderColor;
|
|
430
922
|
}, function (props) {
|
|
431
|
-
return props.
|
|
432
|
-
}, function (props) {
|
|
433
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
923
|
+
return props.disabled ? props.theme.disabledColor : props.theme.selectionIndicatorFontColor;
|
|
434
924
|
}, function (props) {
|
|
435
925
|
return props.theme.fontFamily;
|
|
436
926
|
}, function (props) {
|
|
437
|
-
return props.theme.
|
|
927
|
+
return props.theme.selectionIndicatorFontSize;
|
|
438
928
|
}, function (props) {
|
|
439
|
-
return props.theme.
|
|
929
|
+
return props.theme.selectionIndicatorFontStyle;
|
|
440
930
|
}, function (props) {
|
|
441
|
-
return props.theme.
|
|
442
|
-
}, function (props) {
|
|
443
|
-
return props.backgroundType === "dark" ? props.invalid === true ? props.theme.errorColorOnDark : props.theme.assistiveTextFontColorOnDark : props.invalid === true ? props.theme.errorColor : props.theme.assistiveTextFontColor;
|
|
444
|
-
}, function (props) {
|
|
445
|
-
return props.backgroundType === "dark" ? props.theme.disabledColorOnDark : props.theme.disabledColor;
|
|
931
|
+
return props.theme.selectionIndicatorFontWeight;
|
|
446
932
|
}, function (props) {
|
|
933
|
+
return props.disabled ? "cursor: not-allowed;" : "cursor: default;";
|
|
934
|
+
});
|
|
935
|
+
|
|
936
|
+
var ClearOptionsAction = _styledComponents["default"].button(_templateObject8(), function (props) {
|
|
447
937
|
return props.theme.fontFamily;
|
|
448
938
|
}, function (props) {
|
|
449
|
-
return props.
|
|
450
|
-
}, function (props) {
|
|
451
|
-
return props.theme.labelFontStyle;
|
|
939
|
+
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
|
|
452
940
|
}, function (props) {
|
|
453
|
-
return props.theme.
|
|
941
|
+
return props.theme.enabledSelectionIndicatorActionBackgroundColor;
|
|
454
942
|
}, function (props) {
|
|
455
|
-
return props.
|
|
943
|
+
return props.disabled ? props.theme.disabledColor : props.theme.enabledSelectionIndicatorActionIconColor;
|
|
456
944
|
}, function (props) {
|
|
457
|
-
return props.
|
|
458
|
-
}
|
|
459
|
-
|
|
945
|
+
return !props.disabled && "\n &:hover {\n background-color: ".concat(props.theme.hoverSelectionIndicatorActionBackgroundColor, ";\n color: ").concat(props.theme.hoverSelectionIndicatorActionIconColor, ";\n }\n &:active {\n background-color: ").concat(props.theme.activeSelectionIndicatorActionBackgroundColor, ";\n color: ").concat(props.theme.activeSelectionIndicatorActionIconColor, ";\n }\n ");
|
|
946
|
+
});
|
|
947
|
+
|
|
948
|
+
var SearchableValueContainer = _styledComponents["default"].div(_templateObject9());
|
|
949
|
+
|
|
950
|
+
var SelectedOption = _styledComponents["default"].span(_templateObject10(), function (props) {
|
|
951
|
+
if (props.disabled) return props.theme.disabledColor;else if (props.atBackground) return props.theme.placeholderFontColor;else return props.theme.valueFontColor;
|
|
460
952
|
}, function (props) {
|
|
461
|
-
return props.theme.
|
|
953
|
+
return props.theme.fontFamily;
|
|
462
954
|
}, function (props) {
|
|
463
|
-
return props.theme.
|
|
955
|
+
return props.theme.valueFontSize;
|
|
464
956
|
}, function (props) {
|
|
465
|
-
return props.
|
|
957
|
+
return props.theme.valueFontStyle;
|
|
466
958
|
}, function (props) {
|
|
467
|
-
return props.
|
|
959
|
+
return props.theme.valueFontWeight;
|
|
960
|
+
});
|
|
961
|
+
|
|
962
|
+
var ValueInput = _styledComponents["default"].input(_templateObject11());
|
|
963
|
+
|
|
964
|
+
var SearchInput = _styledComponents["default"].input(_templateObject12(), function (props) {
|
|
965
|
+
return props.disabled ? props.theme.disabledColor : props.theme.valueFontColor;
|
|
468
966
|
}, function (props) {
|
|
469
|
-
return props.
|
|
967
|
+
return props.theme.fontFamily;
|
|
470
968
|
}, function (props) {
|
|
471
969
|
return props.theme.valueFontSize;
|
|
472
970
|
}, function (props) {
|
|
473
971
|
return props.theme.valueFontStyle;
|
|
474
972
|
}, function (props) {
|
|
475
973
|
return props.theme.valueFontWeight;
|
|
974
|
+
});
|
|
975
|
+
|
|
976
|
+
var ErrorIcon = _styledComponents["default"].span(_templateObject13(), function (props) {
|
|
977
|
+
return props.theme.errorColor;
|
|
978
|
+
});
|
|
979
|
+
|
|
980
|
+
var Error = _styledComponents["default"].span(_templateObject14(), function (props) {
|
|
981
|
+
return props.theme.errorColor;
|
|
476
982
|
}, function (props) {
|
|
477
|
-
return props.
|
|
478
|
-
}, function (props) {
|
|
479
|
-
return props.theme.underlineThickness;
|
|
480
|
-
}, function (props) {
|
|
481
|
-
return props.backgroundType === "dark" ? props.invalid === true && props.theme.errorColorOnDark || props.disabled && props.theme.disabledColorOnDark || props.theme.underlineFocusColorOnDark : props.invalid === true && props.theme.errorColor || props.disabled && props.theme.disabledColor || props.theme.underlineFocusColor;
|
|
482
|
-
}, function (props) {
|
|
483
|
-
return props.theme.underlineThickness;
|
|
983
|
+
return props.theme.fontFamily;
|
|
484
984
|
}, function (props) {
|
|
485
|
-
return props.
|
|
985
|
+
return props.theme.errorMessageFontSize;
|
|
486
986
|
}, function (props) {
|
|
487
|
-
return props.theme.
|
|
987
|
+
return props.theme.errorMessagetFontStyle;
|
|
488
988
|
}, function (props) {
|
|
489
|
-
return props.
|
|
989
|
+
return props.theme.errorMessageFontWeight;
|
|
490
990
|
}, function (props) {
|
|
491
|
-
return props.theme.
|
|
991
|
+
return props.theme.errorMessagetLineHeight;
|
|
992
|
+
});
|
|
993
|
+
|
|
994
|
+
var CollapseIndicator = _styledComponents["default"].span(_templateObject15(), function (props) {
|
|
995
|
+
return props.disabled ? props.theme.disabledColor : props.theme.collapseIndicatorColor;
|
|
996
|
+
});
|
|
997
|
+
|
|
998
|
+
var ClearAction = _styledComponents["default"].button(_templateObject16(), function (props) {
|
|
999
|
+
return props.theme.fontFamily;
|
|
492
1000
|
}, function (props) {
|
|
493
|
-
return props.
|
|
1001
|
+
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
|
|
494
1002
|
}, function (props) {
|
|
495
|
-
return props.
|
|
1003
|
+
return props.disabled ? props.theme.disabledActionBackgroundColor : props.theme.actionBackgroundColor;
|
|
496
1004
|
}, function (props) {
|
|
497
|
-
return props.theme.
|
|
1005
|
+
return props.disabled ? props.theme.disabledColor : props.theme.actionIconColor;
|
|
498
1006
|
}, function (props) {
|
|
499
|
-
return props.theme.
|
|
1007
|
+
return !props.disabled && "\n &:hover {\n background-color: ".concat(props.theme.hoverActionBackgroundColor, ";\n color: ").concat(props.theme.hoverActionIconColor, ";\n }\n &:active {\n background-color: ").concat(props.theme.activeActionBackgroundColor, ";\n color: ").concat(props.theme.activeActionIconColor, ";\n }\n ");
|
|
1008
|
+
});
|
|
1009
|
+
|
|
1010
|
+
var OptionsList = _styledComponents["default"].ul(_templateObject17(), function (props) {
|
|
1011
|
+
return props.theme.itemListBackgroundColor;
|
|
500
1012
|
}, function (props) {
|
|
501
|
-
return props.theme.
|
|
1013
|
+
return props.theme.itemListBorderColor;
|
|
502
1014
|
}, function (props) {
|
|
503
|
-
return props.theme.
|
|
1015
|
+
return props.theme.listItemFontColor;
|
|
504
1016
|
}, function (props) {
|
|
505
|
-
return props.theme.
|
|
1017
|
+
return props.theme.fontFamily;
|
|
506
1018
|
}, function (props) {
|
|
507
|
-
return props.theme.
|
|
1019
|
+
return props.theme.listItemFontSize;
|
|
508
1020
|
}, function (props) {
|
|
509
|
-
return props.theme.
|
|
1021
|
+
return props.theme.listItemFontStyle;
|
|
510
1022
|
}, function (props) {
|
|
511
|
-
return props.theme.
|
|
1023
|
+
return props.theme.listItemFontWeight;
|
|
1024
|
+
});
|
|
1025
|
+
|
|
1026
|
+
var OptionsSystemMessage = _styledComponents["default"].span(_templateObject18(), function (props) {
|
|
1027
|
+
return props.theme.systemMessageFontColor;
|
|
1028
|
+
});
|
|
1029
|
+
|
|
1030
|
+
var NoMatchesFoundIcon = _styledComponents["default"].span(_templateObject19());
|
|
1031
|
+
|
|
1032
|
+
var OptionGroupLabel = _styledComponents["default"].li(_templateObject20(), function (props) {
|
|
1033
|
+
return props.theme.listGroupItemFontWeight;
|
|
1034
|
+
});
|
|
1035
|
+
|
|
1036
|
+
var OptionItem = _styledComponents["default"].li(_templateObject21(), function (props) {
|
|
1037
|
+
return props.visualFocused && "box-shadow: inset 0 0 0 2px ".concat(props.theme.focusListItemBorderColor, ";");
|
|
512
1038
|
}, function (props) {
|
|
513
|
-
return props.
|
|
1039
|
+
return props.selected && "background-color: ".concat(props.theme.selectedListItemBackgroundColor);
|
|
514
1040
|
}, function (props) {
|
|
515
|
-
return props.
|
|
1041
|
+
return props.selected ? "background-color: ".concat(props.theme.selectedHoverListItemBackgroundColor, ";") : "background-color: ".concat(props.theme.unselectedHoverListItemBackgroundColor, ";");
|
|
516
1042
|
}, function (props) {
|
|
517
|
-
return props.
|
|
1043
|
+
return props.selected ? "background-color: ".concat(props.theme.selectedActiveListItemBackgroundColor, ";") : "background-color: ".concat(props.theme.unselectedActiveListItemBackgroundColor, ";");
|
|
1044
|
+
});
|
|
1045
|
+
|
|
1046
|
+
var StyledOption = _styledComponents["default"].span(_templateObject22(), function (props) {
|
|
1047
|
+
return props.grouped && props.multiple && "padding-left: 16px;";
|
|
518
1048
|
}, function (props) {
|
|
519
|
-
return props.
|
|
1049
|
+
return props.last || props.visualFocused || props.selected ? "border-bottom: 1px solid transparent" : "border-bottom: 1px solid ".concat(props.theme.listItemDividerColor);
|
|
1050
|
+
});
|
|
1051
|
+
|
|
1052
|
+
var OptionContent = _styledComponents["default"].span(_templateObject23(), function (props) {
|
|
1053
|
+
return props.grouped && !props.multiple && !props.hasIcon && "padding-left: 16px;";
|
|
1054
|
+
});
|
|
1055
|
+
|
|
1056
|
+
var OptionIcon = _styledComponents["default"].span(_templateObject24(), function (props) {
|
|
1057
|
+
return props.theme.listItemIconColor;
|
|
1058
|
+
});
|
|
1059
|
+
|
|
1060
|
+
var OptionIconImg = _styledComponents["default"].img(_templateObject25());
|
|
1061
|
+
|
|
1062
|
+
var OptionLabel = _styledComponents["default"].span(_templateObject26());
|
|
1063
|
+
|
|
1064
|
+
var OptionSelectedIndicator = _styledComponents["default"].span(_templateObject27(), function (props) {
|
|
1065
|
+
return props.theme.selectedListItemIconColor;
|
|
520
1066
|
});
|
|
521
1067
|
|
|
522
|
-
DxcSelect.propTypes = {
|
|
523
|
-
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
524
|
-
label: _propTypes["default"].string,
|
|
525
|
-
assistiveText: _propTypes["default"].string,
|
|
526
|
-
name: _propTypes["default"].string,
|
|
527
|
-
value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number, _propTypes["default"].arrayOf(_propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]))]),
|
|
528
|
-
disabled: _propTypes["default"].bool,
|
|
529
|
-
required: _propTypes["default"].bool,
|
|
530
|
-
invalid: _propTypes["default"].bool,
|
|
531
|
-
iconPosition: _propTypes["default"].oneOf(["after", "before"]),
|
|
532
|
-
onChange: _propTypes["default"].func,
|
|
533
|
-
options: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
534
|
-
value: _propTypes["default"].any.isRequired,
|
|
535
|
-
label: _propTypes["default"].string,
|
|
536
|
-
icon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
|
|
537
|
-
iconSrc: _propTypes["default"].string
|
|
538
|
-
})),
|
|
539
|
-
multiple: _propTypes["default"].bool,
|
|
540
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
541
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
542
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
543
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
544
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
545
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
546
|
-
tabIndex: _propTypes["default"].number
|
|
547
|
-
};
|
|
548
1068
|
var _default = DxcSelect;
|
|
549
1069
|
exports["default"] = _default;
|