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