@rescui/select 0.18.4 → 0.19.0
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/lib/_virtual/check-outline.js +294 -63
- package/lib/_virtual/close-outline.js +294 -63
- package/lib/_virtual/down-outline.js +294 -63
- package/lib/_virtual/index.css.js +12 -12
- package/lib/_virtual/loading-outline.js +310 -79
- package/lib/hooks/use-a11y.d.ts +2 -2
- package/lib/hooks/use-a11y.js +124 -36
- package/lib/hooks/use-actual-size-from-css.d.ts +3 -4
- package/lib/hooks/use-actual-size-from-css.js +47 -18
- package/lib/hooks/use-focus.js +54 -10
- package/lib/hooks/use-hover.js +54 -10
- package/lib/hooks/use-label-focus.js +45 -15
- package/lib/hooks/use-multi-handlers.js +113 -38
- package/lib/hooks/use-options.d.ts +2 -1
- package/lib/hooks/use-options.js +92 -56
- package/lib/hooks/use-primary-contrast-css-var-transfer.d.ts +2 -3
- package/lib/hooks/use-primary-contrast-css-var-transfer.js +45 -15
- package/lib/index.css +194 -194
- package/lib/multiselect.js +527 -174
- package/lib/native-select.js +416 -118
- package/lib/parts/form-trigger-wrapper.js +159 -39
- package/lib/parts/hidden-select.js +105 -29
- package/lib/parts/icons.js +191 -49
- package/lib/parts/list-box.js +277 -74
- package/lib/parts/multi-trigger.d.ts +2 -2
- package/lib/parts/multi-trigger.js +125 -48
- package/lib/parts/native-select-options-with-groups.js +154 -52
- package/lib/parts/popup-content.d.ts +3 -3
- package/lib/parts/popup-content.js +146 -46
- package/lib/select-basic.js +456 -147
- package/lib/select-searchable.js +448 -155
- package/lib/select.js +228 -56
- package/lib/styles/common.p.module.css.js +29 -29
- package/lib/styles/form-trigger.p.module.css.js +12 -12
- package/lib/styles/list-box.p.module.css.js +13 -13
- package/lib/utils/get-text-from-nodes.js +1 -1
- package/package.json +12 -11
package/lib/select-searchable.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
|
|
2
|
+
import { c } from 'react-compiler-runtime';
|
|
3
|
+
import React, { useState, useRef } from 'react';
|
|
2
4
|
import { useCombobox } from 'downshift';
|
|
3
5
|
import scrollIntoView from 'scroll-into-view-if-needed';
|
|
4
6
|
import { useLabelFocus } from './hooks/use-label-focus.js';
|
|
@@ -13,61 +15,222 @@ import { mergeProps } from './utils/merge-props.js';
|
|
|
13
15
|
import { itemToString } from './utils/item-to-string.js';
|
|
14
16
|
import { getOptionValue } from './utils/get-option-value.js';
|
|
15
17
|
import { getRealItemsCnt } from './utils/get-real-items-cnt.js';
|
|
16
|
-
import styles from './styles/common.p.module.css.js';
|
|
17
|
-
|
|
18
|
-
function SelectSearchable(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
18
|
+
import styles from './styles/common.p.module.css.js';
|
|
19
|
+
|
|
20
|
+
function SelectSearchable(t0) {
|
|
21
|
+
const $ = c(105);
|
|
22
|
+
let boldLabel;
|
|
23
|
+
let disableFlip;
|
|
24
|
+
let error;
|
|
25
|
+
let isClearable;
|
|
26
|
+
let isDisabled;
|
|
27
|
+
let isLoading;
|
|
28
|
+
let label;
|
|
29
|
+
let maxVisibleItems;
|
|
30
|
+
let mode;
|
|
31
|
+
let name;
|
|
32
|
+
let noOptionsMessage;
|
|
33
|
+
let note;
|
|
34
|
+
let onChange;
|
|
35
|
+
let options;
|
|
36
|
+
let placeholder;
|
|
37
|
+
let placement;
|
|
38
|
+
let renderInTrigger;
|
|
39
|
+
let reserveErrorLine;
|
|
40
|
+
let rest;
|
|
41
|
+
let selectedItem;
|
|
42
|
+
let size;
|
|
43
|
+
let theme;
|
|
44
|
+
|
|
45
|
+
if ($[0] !== t0) {
|
|
46
|
+
const {
|
|
47
|
+
options: t1,
|
|
48
|
+
value: t2,
|
|
49
|
+
onChange: t3,
|
|
50
|
+
error: t4,
|
|
51
|
+
label: t5,
|
|
52
|
+
note: t6,
|
|
53
|
+
size: t7,
|
|
54
|
+
mode: t8,
|
|
55
|
+
theme: t9,
|
|
56
|
+
placement: t10,
|
|
57
|
+
renderInTrigger: t11,
|
|
58
|
+
disableFlip: t12,
|
|
59
|
+
boldLabel: t13,
|
|
60
|
+
reserveErrorLine: t14,
|
|
61
|
+
maxVisibleItems: t15,
|
|
62
|
+
isClearable: t16,
|
|
63
|
+
isLoading: t17,
|
|
64
|
+
isDisabled: t18,
|
|
65
|
+
name: t19,
|
|
66
|
+
noOptionsMessage: t20,
|
|
67
|
+
className,
|
|
68
|
+
id,
|
|
69
|
+
style,
|
|
70
|
+
placeholder: t21,
|
|
71
|
+
...t22
|
|
72
|
+
} = t0;
|
|
73
|
+
options = t1;
|
|
74
|
+
selectedItem = t2;
|
|
75
|
+
onChange = t3;
|
|
76
|
+
error = t4;
|
|
77
|
+
label = t5;
|
|
78
|
+
note = t6;
|
|
79
|
+
size = t7;
|
|
80
|
+
mode = t8;
|
|
81
|
+
theme = t9;
|
|
82
|
+
placement = t10;
|
|
83
|
+
renderInTrigger = t11;
|
|
84
|
+
disableFlip = t12;
|
|
85
|
+
boldLabel = t13;
|
|
86
|
+
reserveErrorLine = t14;
|
|
87
|
+
maxVisibleItems = t15;
|
|
88
|
+
isClearable = t16;
|
|
89
|
+
isLoading = t17;
|
|
90
|
+
isDisabled = t18;
|
|
91
|
+
name = t19;
|
|
92
|
+
noOptionsMessage = t20;
|
|
93
|
+
placeholder = t21;
|
|
94
|
+
rest = t22;
|
|
95
|
+
$[0] = t0;
|
|
96
|
+
$[1] = boldLabel;
|
|
97
|
+
$[2] = disableFlip;
|
|
98
|
+
$[3] = error;
|
|
99
|
+
$[4] = isClearable;
|
|
100
|
+
$[5] = isDisabled;
|
|
101
|
+
$[6] = isLoading;
|
|
102
|
+
$[7] = label;
|
|
103
|
+
$[8] = maxVisibleItems;
|
|
104
|
+
$[9] = mode;
|
|
105
|
+
$[10] = name;
|
|
106
|
+
$[11] = noOptionsMessage;
|
|
107
|
+
$[12] = note;
|
|
108
|
+
$[13] = onChange;
|
|
109
|
+
$[14] = options;
|
|
110
|
+
$[15] = placeholder;
|
|
111
|
+
$[16] = placement;
|
|
112
|
+
$[17] = renderInTrigger;
|
|
113
|
+
$[18] = reserveErrorLine;
|
|
114
|
+
$[19] = rest;
|
|
115
|
+
$[20] = selectedItem;
|
|
116
|
+
$[21] = size;
|
|
117
|
+
$[22] = theme;
|
|
118
|
+
} else {
|
|
119
|
+
boldLabel = $[1];
|
|
120
|
+
disableFlip = $[2];
|
|
121
|
+
error = $[3];
|
|
122
|
+
isClearable = $[4];
|
|
123
|
+
isDisabled = $[5];
|
|
124
|
+
isLoading = $[6];
|
|
125
|
+
label = $[7];
|
|
126
|
+
maxVisibleItems = $[8];
|
|
127
|
+
mode = $[9];
|
|
128
|
+
name = $[10];
|
|
129
|
+
noOptionsMessage = $[11];
|
|
130
|
+
note = $[12];
|
|
131
|
+
onChange = $[13];
|
|
132
|
+
options = $[14];
|
|
133
|
+
placeholder = $[15];
|
|
134
|
+
placement = $[16];
|
|
135
|
+
renderInTrigger = $[17];
|
|
136
|
+
reserveErrorLine = $[18];
|
|
137
|
+
rest = $[19];
|
|
138
|
+
selectedItem = $[20];
|
|
139
|
+
size = $[21];
|
|
140
|
+
theme = $[22];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const [inputEl, setInputEl] = useState(null);
|
|
47
144
|
const dropdownRef = useRef(null);
|
|
48
|
-
const
|
|
145
|
+
const [menuEl, setMenuEl] = useState(null);
|
|
49
146
|
const {
|
|
50
147
|
flattenedOptions,
|
|
51
148
|
listBoxItems,
|
|
52
149
|
setFilterString,
|
|
53
150
|
filterString
|
|
54
151
|
} = useOptions(options);
|
|
55
|
-
|
|
152
|
+
let t1;
|
|
153
|
+
|
|
154
|
+
if ($[23] !== listBoxItems) {
|
|
155
|
+
t1 = getRealItemsCnt(listBoxItems);
|
|
156
|
+
$[23] = listBoxItems;
|
|
157
|
+
$[24] = t1;
|
|
158
|
+
} else {
|
|
159
|
+
t1 = $[24];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const isListBoxEmpty = t1 === 0;
|
|
56
163
|
const hasValue = Boolean(selectedItem);
|
|
57
|
-
|
|
164
|
+
let t2;
|
|
165
|
+
|
|
166
|
+
if ($[25] !== selectedItem) {
|
|
167
|
+
t2 = selectedItem ? new Map([[getOptionValue(selectedItem), selectedItem]]) : new Map();
|
|
168
|
+
$[25] = selectedItem;
|
|
169
|
+
$[26] = t2;
|
|
170
|
+
} else {
|
|
171
|
+
t2 = $[26];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const selectedMap = t2;
|
|
175
|
+
let t3;
|
|
176
|
+
|
|
177
|
+
if ($[27] !== error || $[28] !== inputEl || $[29] !== isDisabled || $[30] !== note) {
|
|
178
|
+
t3 = {
|
|
179
|
+
prefix: "select",
|
|
180
|
+
error,
|
|
181
|
+
description: note,
|
|
182
|
+
fieldEl: inputEl,
|
|
183
|
+
isDisabled
|
|
184
|
+
};
|
|
185
|
+
$[27] = error;
|
|
186
|
+
$[28] = inputEl;
|
|
187
|
+
$[29] = isDisabled;
|
|
188
|
+
$[30] = note;
|
|
189
|
+
$[31] = t3;
|
|
190
|
+
} else {
|
|
191
|
+
t3 = $[31];
|
|
192
|
+
}
|
|
193
|
+
|
|
58
194
|
const {
|
|
59
195
|
fieldProps,
|
|
60
196
|
errorMessageProps,
|
|
61
197
|
descriptionProps,
|
|
62
198
|
baseId,
|
|
63
199
|
labelProps
|
|
64
|
-
} = useA11y(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
200
|
+
} = useA11y(t3);
|
|
201
|
+
let t5;
|
|
202
|
+
|
|
203
|
+
if ($[32] !== menuEl) {
|
|
204
|
+
t5 = (listItemEl, listEl) => {
|
|
205
|
+
scrollIntoView(listItemEl, {
|
|
206
|
+
scrollMode: "if-needed",
|
|
207
|
+
block: "nearest",
|
|
208
|
+
boundary: listEl ?? menuEl
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
$[32] = menuEl;
|
|
213
|
+
$[33] = t5;
|
|
214
|
+
} else {
|
|
215
|
+
t5 = $[33];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
let t6;
|
|
219
|
+
|
|
220
|
+
if ($[34] !== onChange) {
|
|
221
|
+
t6 = t7 => {
|
|
222
|
+
const {
|
|
223
|
+
selectedItem: newSelectedItem
|
|
224
|
+
} = t7;
|
|
225
|
+
onChange?.(newSelectedItem);
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
$[34] = onChange;
|
|
229
|
+
$[35] = t6;
|
|
230
|
+
} else {
|
|
231
|
+
t6 = $[35];
|
|
232
|
+
}
|
|
233
|
+
|
|
71
234
|
const {
|
|
72
235
|
isOpen,
|
|
73
236
|
getToggleButtonProps,
|
|
@@ -76,13 +239,13 @@ function SelectSearchable(_ref) {
|
|
|
76
239
|
getInputProps,
|
|
77
240
|
highlightedIndex,
|
|
78
241
|
getItemProps,
|
|
79
|
-
setInputValue
|
|
242
|
+
setInputValue: t8
|
|
80
243
|
} = useCombobox({
|
|
81
|
-
onInputValueChange(
|
|
82
|
-
|
|
244
|
+
onInputValueChange(t4) {
|
|
245
|
+
const {
|
|
83
246
|
inputValue,
|
|
84
247
|
type
|
|
85
|
-
} =
|
|
248
|
+
} = t4;
|
|
86
249
|
|
|
87
250
|
if (type === useCombobox.stateChangeTypes.InputChange) {
|
|
88
251
|
setFilterString(inputValue);
|
|
@@ -94,135 +257,177 @@ function SelectSearchable(_ref) {
|
|
|
94
257
|
itemToString,
|
|
95
258
|
itemToKey: getOptionValue,
|
|
96
259
|
selectedItem,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
scrollIntoView: (listItemEl, listEl) => {
|
|
100
|
-
scrollIntoView(listItemEl, {
|
|
101
|
-
scrollMode: 'if-needed',
|
|
102
|
-
block: 'nearest',
|
|
103
|
-
boundary: listEl ?? menuRef.current
|
|
104
|
-
});
|
|
105
|
-
},
|
|
106
|
-
onSelectedItemChange: _ref3 => {
|
|
107
|
-
let {
|
|
108
|
-
selectedItem: newSelectedItem
|
|
109
|
-
} = _ref3;
|
|
110
|
-
onChange?.(newSelectedItem);
|
|
111
|
-
},
|
|
260
|
+
scrollIntoView: t5,
|
|
261
|
+
onSelectedItemChange: t6,
|
|
112
262
|
|
|
113
263
|
isItemDisabled(item) {
|
|
114
264
|
return item && item.disabled;
|
|
115
265
|
},
|
|
116
266
|
|
|
117
|
-
onIsOpenChange(
|
|
118
|
-
|
|
267
|
+
onIsOpenChange(t7) {
|
|
268
|
+
const {
|
|
119
269
|
isOpen: newIsOpen,
|
|
120
|
-
selectedItem:
|
|
270
|
+
selectedItem: newSelectedItem_0,
|
|
121
271
|
inputValue: newInputValue
|
|
122
|
-
} =
|
|
123
|
-
const inputValueFromSelectedItem = itemToString(
|
|
272
|
+
} = t7;
|
|
273
|
+
const inputValueFromSelectedItem = itemToString(newSelectedItem_0);
|
|
124
274
|
|
|
125
275
|
if (newIsOpen) {
|
|
126
|
-
setFilterString(
|
|
127
|
-
} else
|
|
128
|
-
|
|
276
|
+
setFilterString("");
|
|
277
|
+
} else {
|
|
278
|
+
if (newInputValue !== inputValueFromSelectedItem) {
|
|
279
|
+
setInputValue(inputValueFromSelectedItem);
|
|
280
|
+
}
|
|
129
281
|
}
|
|
130
282
|
},
|
|
131
283
|
|
|
132
284
|
stateReducer(state, actionAndChanges) {
|
|
133
285
|
const {
|
|
134
286
|
changes,
|
|
135
|
-
type
|
|
287
|
+
type: type_0
|
|
136
288
|
} = actionAndChanges;
|
|
137
289
|
|
|
138
|
-
switch (
|
|
290
|
+
switch (type_0) {
|
|
139
291
|
case useCombobox.stateChangeTypes.InputKeyDownEscape:
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
292
|
+
{
|
|
293
|
+
if (!state.isOpen) {
|
|
294
|
+
return state;
|
|
295
|
+
}
|
|
143
296
|
|
|
144
|
-
|
|
297
|
+
return changes;
|
|
298
|
+
}
|
|
145
299
|
|
|
146
300
|
default:
|
|
147
|
-
|
|
301
|
+
{
|
|
302
|
+
return changes;
|
|
303
|
+
}
|
|
148
304
|
}
|
|
149
305
|
}
|
|
150
306
|
|
|
151
307
|
});
|
|
308
|
+
const setInputValue = t8;
|
|
309
|
+
let t9;
|
|
152
310
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
311
|
+
if ($[36] !== onChange || $[37] !== setInputValue) {
|
|
312
|
+
t9 = () => {
|
|
313
|
+
setInputValue("");
|
|
314
|
+
onChange?.(null);
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
$[36] = onChange;
|
|
318
|
+
$[37] = setInputValue;
|
|
319
|
+
$[38] = t9;
|
|
320
|
+
} else {
|
|
321
|
+
t9 = $[38];
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const reset = t9;
|
|
325
|
+
let menuProps;
|
|
326
|
+
let t10;
|
|
327
|
+
|
|
328
|
+
if ($[39] !== getInputProps || $[40] !== getMenuProps || $[41] !== isListBoxEmpty || $[42] !== isOpen) {
|
|
329
|
+
menuProps = getMenuProps({
|
|
330
|
+
ref: setMenuEl
|
|
331
|
+
}, {
|
|
332
|
+
suppressRefError: true
|
|
333
|
+
});
|
|
334
|
+
t10 = getInputProps({
|
|
335
|
+
ref: setInputEl,
|
|
336
|
+
...(isOpen && isListBoxEmpty ? {
|
|
337
|
+
"aria-activedescendant": menuProps.id
|
|
338
|
+
} : {})
|
|
339
|
+
});
|
|
340
|
+
$[39] = getInputProps;
|
|
341
|
+
$[40] = getMenuProps;
|
|
342
|
+
$[41] = isListBoxEmpty;
|
|
343
|
+
$[42] = isOpen;
|
|
344
|
+
$[43] = menuProps;
|
|
345
|
+
$[44] = t10;
|
|
346
|
+
} else {
|
|
347
|
+
menuProps = $[43];
|
|
348
|
+
t10 = $[44];
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
const inputProps = t10;
|
|
174
352
|
const {
|
|
175
353
|
isFocusedByLabel,
|
|
176
354
|
labelClickProps,
|
|
177
355
|
triggerFocusProps: labelFocusForTriggerProps
|
|
178
356
|
} = useLabelFocus();
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
357
|
+
const t11 = filterString.length > 0;
|
|
358
|
+
let t12;
|
|
359
|
+
|
|
360
|
+
if ($[45] !== isLoading || $[46] !== noOptionsMessage || $[47] !== t11) {
|
|
361
|
+
t12 = getEmptyMessage({
|
|
362
|
+
isLoading,
|
|
363
|
+
isNothingFound: t11,
|
|
364
|
+
noOptionsMessage
|
|
365
|
+
});
|
|
366
|
+
$[45] = isLoading;
|
|
367
|
+
$[46] = noOptionsMessage;
|
|
368
|
+
$[47] = t11;
|
|
369
|
+
$[48] = t12;
|
|
370
|
+
} else {
|
|
371
|
+
t12 = $[48];
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const emptyListMessage = t12;
|
|
375
|
+
let t13;
|
|
376
|
+
|
|
377
|
+
if ($[49] !== getItemProps || $[50] !== highlightedIndex || $[51] !== menuProps || $[52] !== selectedMap) {
|
|
378
|
+
t13 = {
|
|
379
|
+
selectedMap,
|
|
380
|
+
highlightedIndex,
|
|
381
|
+
getItemProps,
|
|
382
|
+
menuProps,
|
|
383
|
+
isMulti: false
|
|
384
|
+
};
|
|
385
|
+
$[49] = getItemProps;
|
|
386
|
+
$[50] = highlightedIndex;
|
|
387
|
+
$[51] = menuProps;
|
|
388
|
+
$[52] = selectedMap;
|
|
389
|
+
$[53] = t13;
|
|
390
|
+
} else {
|
|
391
|
+
t13 = $[53];
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
const listBoxState = t13;
|
|
395
|
+
let t14;
|
|
396
|
+
|
|
397
|
+
if ($[54] !== getLabelProps || $[55] !== labelClickProps || $[56] !== labelProps) {
|
|
398
|
+
t14 = mergeProps(labelProps, getLabelProps(), labelClickProps);
|
|
399
|
+
$[54] = getLabelProps;
|
|
400
|
+
$[55] = labelClickProps;
|
|
401
|
+
$[56] = labelProps;
|
|
402
|
+
$[57] = t14;
|
|
403
|
+
} else {
|
|
404
|
+
t14 = $[57];
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
let t15;
|
|
408
|
+
|
|
409
|
+
if ($[58] !== flattenedOptions || $[59] !== name || $[60] !== selectedItem) {
|
|
410
|
+
t15 = /*#__PURE__*/React.createElement(HiddenSelect, {
|
|
411
|
+
name: name,
|
|
412
|
+
value: selectedItem,
|
|
413
|
+
isMultiple: false,
|
|
414
|
+
options: flattenedOptions
|
|
415
|
+
});
|
|
416
|
+
$[58] = flattenedOptions;
|
|
417
|
+
$[59] = name;
|
|
418
|
+
$[60] = selectedItem;
|
|
419
|
+
$[61] = t15;
|
|
420
|
+
} else {
|
|
421
|
+
t15 = $[61];
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
let t16;
|
|
425
|
+
|
|
426
|
+
if ($[62] !== fieldProps || $[63] !== getToggleButtonProps || $[64] !== hasValue || $[65] !== inputEl || $[66] !== inputProps || $[67] !== isClearable || $[68] !== isDisabled || $[69] !== isFocusedByLabel || $[70] !== isLoading || $[71] !== isOpen || $[72] !== labelFocusForTriggerProps || $[73] !== placeholder || $[74] !== reset || $[75] !== rest) {
|
|
427
|
+
t16 = t17 => {
|
|
428
|
+
const {
|
|
224
429
|
ref: triggerRefForDropdown
|
|
225
|
-
} =
|
|
430
|
+
} = t17;
|
|
226
431
|
return /*#__PURE__*/React.createElement("div", {
|
|
227
432
|
className: styles.triggerContainer,
|
|
228
433
|
"data-open": isOpen,
|
|
@@ -231,27 +436,115 @@ function SelectSearchable(_ref) {
|
|
|
231
436
|
className: styles.trigger,
|
|
232
437
|
"data-test": "select__trigger",
|
|
233
438
|
ref: triggerRefForDropdown
|
|
234
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
235
|
-
...mergeProps(fieldProps, // aria-invalid & aria-describedby, rest are overridden by inputProps,
|
|
236
|
-
inputProps, labelFocusForTriggerProps),
|
|
439
|
+
}, /*#__PURE__*/React.createElement("input", _extends({}, rest, mergeProps(fieldProps, inputProps, labelFocusForTriggerProps), {
|
|
237
440
|
disabled: isDisabled ? true : undefined,
|
|
238
441
|
className: styles.searchInput,
|
|
239
442
|
placeholder: placeholder,
|
|
240
443
|
"data-test": "select__trigger_input"
|
|
241
|
-
}), /*#__PURE__*/React.createElement(Icons, {
|
|
444
|
+
})), /*#__PURE__*/React.createElement(Icons, _extends({
|
|
242
445
|
isLoading: isLoading,
|
|
243
446
|
canHaveClearIcon: isClearable && !isDisabled && hasValue,
|
|
244
447
|
onClear: () => {
|
|
245
448
|
reset();
|
|
246
|
-
|
|
449
|
+
inputEl?.focus();
|
|
247
450
|
},
|
|
248
|
-
triggerId: inputProps.id
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
451
|
+
triggerId: inputProps.id
|
|
452
|
+
}, mergeProps(getToggleButtonProps(), {
|
|
453
|
+
role: "button"
|
|
454
|
+
})))));
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
$[62] = fieldProps;
|
|
458
|
+
$[63] = getToggleButtonProps;
|
|
459
|
+
$[64] = hasValue;
|
|
460
|
+
$[65] = inputEl;
|
|
461
|
+
$[66] = inputProps;
|
|
462
|
+
$[67] = isClearable;
|
|
463
|
+
$[68] = isDisabled;
|
|
464
|
+
$[69] = isFocusedByLabel;
|
|
465
|
+
$[70] = isLoading;
|
|
466
|
+
$[71] = isOpen;
|
|
467
|
+
$[72] = labelFocusForTriggerProps;
|
|
468
|
+
$[73] = placeholder;
|
|
469
|
+
$[74] = reset;
|
|
470
|
+
$[75] = rest;
|
|
471
|
+
$[76] = t16;
|
|
472
|
+
} else {
|
|
473
|
+
t16 = $[76];
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
let t17;
|
|
477
|
+
|
|
478
|
+
if ($[77] !== disableFlip || $[78] !== emptyListMessage || $[79] !== inputEl || $[80] !== isOpen || $[81] !== listBoxItems || $[82] !== listBoxState || $[83] !== maxVisibleItems || $[84] !== mode || $[85] !== placement || $[86] !== renderInTrigger || $[87] !== size || $[88] !== t16 || $[89] !== theme) {
|
|
479
|
+
t17 = /*#__PURE__*/React.createElement(PopupContent, {
|
|
480
|
+
theme: theme,
|
|
481
|
+
size: size,
|
|
482
|
+
mode: mode,
|
|
483
|
+
dropdownRef: dropdownRef,
|
|
484
|
+
triggerEl: inputEl,
|
|
485
|
+
placement: placement,
|
|
486
|
+
renderInTrigger: renderInTrigger,
|
|
487
|
+
disableFlip: disableFlip,
|
|
488
|
+
isOpen: isOpen,
|
|
489
|
+
listBoxState: listBoxState,
|
|
490
|
+
maxVisibleItems: maxVisibleItems,
|
|
491
|
+
emptyListMessage: emptyListMessage,
|
|
492
|
+
listBoxItems: listBoxItems,
|
|
493
|
+
trigger: t16
|
|
494
|
+
});
|
|
495
|
+
$[77] = disableFlip;
|
|
496
|
+
$[78] = emptyListMessage;
|
|
497
|
+
$[79] = inputEl;
|
|
498
|
+
$[80] = isOpen;
|
|
499
|
+
$[81] = listBoxItems;
|
|
500
|
+
$[82] = listBoxState;
|
|
501
|
+
$[83] = maxVisibleItems;
|
|
502
|
+
$[84] = mode;
|
|
503
|
+
$[85] = placement;
|
|
504
|
+
$[86] = renderInTrigger;
|
|
505
|
+
$[87] = size;
|
|
506
|
+
$[88] = t16;
|
|
507
|
+
$[89] = theme;
|
|
508
|
+
$[90] = t17;
|
|
509
|
+
} else {
|
|
510
|
+
t17 = $[90];
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
let t18;
|
|
514
|
+
|
|
515
|
+
if ($[91] !== boldLabel || $[92] !== descriptionProps || $[93] !== error || $[94] !== errorMessageProps || $[95] !== isDisabled || $[96] !== label || $[97] !== note || $[98] !== reserveErrorLine || $[99] !== size || $[100] !== t14 || $[101] !== t15 || $[102] !== t17 || $[103] !== theme) {
|
|
516
|
+
t18 = /*#__PURE__*/React.createElement(FormTriggerWrapper, {
|
|
517
|
+
theme: theme,
|
|
518
|
+
size: size,
|
|
519
|
+
disabled: isDisabled,
|
|
520
|
+
label: label,
|
|
521
|
+
labelProps: t14,
|
|
522
|
+
boldLabel: boldLabel,
|
|
523
|
+
error: error,
|
|
524
|
+
reserveErrorLine: reserveErrorLine,
|
|
525
|
+
errorMessageProps: errorMessageProps,
|
|
526
|
+
note: note,
|
|
527
|
+
descriptionProps: descriptionProps
|
|
528
|
+
}, t15, t17);
|
|
529
|
+
$[91] = boldLabel;
|
|
530
|
+
$[92] = descriptionProps;
|
|
531
|
+
$[93] = error;
|
|
532
|
+
$[94] = errorMessageProps;
|
|
533
|
+
$[95] = isDisabled;
|
|
534
|
+
$[96] = label;
|
|
535
|
+
$[97] = note;
|
|
536
|
+
$[98] = reserveErrorLine;
|
|
537
|
+
$[99] = size;
|
|
538
|
+
$[100] = t14;
|
|
539
|
+
$[101] = t15;
|
|
540
|
+
$[102] = t17;
|
|
541
|
+
$[103] = theme;
|
|
542
|
+
$[104] = t18;
|
|
543
|
+
} else {
|
|
544
|
+
t18 = $[104];
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
return t18;
|
|
255
548
|
}
|
|
256
549
|
|
|
257
550
|
export { SelectSearchable };
|