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