@rockshin/tao-ui 0.0.21 → 0.0.23
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 +8 -1
- package/component-manifest.json +77 -48
- package/dist/components/button/button.css +11 -11
- package/dist/components/button/button.d.ts +3 -2
- package/dist/components/button/button.js +55 -47
- package/dist/components/checkbox/checkbox.d.ts +3 -2
- package/dist/components/checkbox/checkbox.js +91 -81
- package/dist/components/date-picker/calendar/calendar-grid.d.ts +7 -1
- package/dist/components/date-picker/calendar/calendar-grid.js +158 -160
- package/dist/components/date-picker/calendar/time-panel.js +64 -70
- package/dist/components/date-picker/date-picker.css +11 -5
- package/dist/components/date-picker/date-picker.d.ts +13 -5
- package/dist/components/date-picker/date-picker.js +389 -718
- package/dist/components/date-picker/range-picker.d.ts +12 -5
- package/dist/components/date-picker/range-picker.js +68 -12
- package/dist/components/date-picker/types.d.ts +5 -0
- package/dist/components/drawer/drawer.css +3 -1
- package/dist/components/form-field/form-field.d.ts +1 -1
- package/dist/components/form-field/form-field.js +106 -63
- package/dist/components/input/input.css +13 -0
- package/dist/components/input/input.d.ts +2 -1
- package/dist/components/input/input.js +76 -70
- package/dist/components/input-number/input-number.d.ts +5 -3
- package/dist/components/input-number/input-number.js +63 -47
- package/dist/components/modal/modal.css +2 -1
- package/dist/components/radio/radio.d.ts +3 -2
- package/dist/components/radio/radio.js +43 -39
- package/dist/components/select/mobile-select.d.ts +1 -1
- package/dist/components/select/mobile-select.js +1 -1
- package/dist/components/select/select-icons.d.ts +7 -0
- package/dist/components/select/select-icons.js +141 -0
- package/dist/components/select/select-model.d.ts +4 -0
- package/dist/components/select/select-model.js +22 -0
- package/dist/components/select/select-searchable-list.d.ts +22 -0
- package/dist/components/select/select-searchable-list.js +101 -0
- package/dist/components/select/select-tags.d.ts +15 -0
- package/dist/components/select/select-tags.js +152 -0
- package/dist/components/select/select-types.d.ts +82 -0
- package/dist/components/select/select-types.js +0 -0
- package/dist/components/select/select.css +2 -1
- package/dist/components/select/select.d.ts +2 -118
- package/dist/components/select/select.js +91 -404
- package/dist/components/select/use-is-mobile.js +2 -5
- package/dist/components/sonner/sonner.js +9 -3
- package/dist/components/spinner/spinner.css +1 -1
- package/dist/components/splitter/splitter.js +181 -133
- package/dist/components/switch/switch.css +17 -8
- package/dist/components/switch/switch.d.ts +3 -2
- package/dist/components/switch/switch.js +90 -79
- package/dist/components/table/table-filter.d.ts +6 -0
- package/dist/components/table/table-filter.js +123 -0
- package/dist/components/table/table-icons.d.ts +9 -0
- package/dist/components/table/table-icons.js +157 -0
- package/dist/components/table/table-model.d.ts +11 -0
- package/dist/components/table/table-model.js +33 -0
- package/dist/components/table/table-types.d.ts +87 -0
- package/dist/components/table/table-types.js +0 -0
- package/dist/components/table/table.css +14 -15
- package/dist/components/table/table.d.ts +3 -101
- package/dist/components/table/table.js +29 -329
- package/dist/components/tabs/tabs.css +5 -2
- package/dist/components/tabs/tabs.js +71 -62
- package/dist/components/textarea/textarea.d.ts +5 -3
- package/dist/components/textarea/textarea.js +102 -85
- package/dist/docs/component-docs.d.ts +1 -0
- package/dist/docs/components/breadcrumb.doc.js +3 -1
- package/dist/docs/components/checkbox.doc.js +2 -5
- package/dist/docs/components/context-menu.doc.js +7 -2
- package/dist/docs/components/drawer.doc.js +4 -2
- package/dist/docs/components/dropdown.doc.js +7 -3
- package/dist/docs/components/form-field.doc.js +0 -1
- package/dist/docs/components/form-layout.doc.d.ts +1 -0
- package/dist/docs/components/form-layout.doc.js +3 -0
- package/dist/docs/components/form-section.doc.js +1 -1
- package/dist/docs/components/input-number.doc.js +2 -3
- package/dist/docs/components/input.doc.js +1 -2
- package/dist/docs/components/modal.doc.js +1 -1
- package/dist/docs/components/pagination.doc.js +1 -3
- package/dist/docs/components/radio.doc.js +1 -4
- package/dist/docs/components/range-picker.doc.js +2 -2
- package/dist/docs/components/select.doc.js +19 -6
- package/dist/docs/components/spinner.doc.js +4 -1
- package/dist/docs/components/splitter.doc.js +1 -1
- package/dist/docs/components/stack.doc.d.ts +1 -0
- package/dist/docs/components/stack.doc.js +3 -0
- package/dist/docs/components/switch.doc.js +1 -2
- package/dist/docs/components/table.doc.js +9 -4
- package/dist/docs/components/tabs.doc.js +2 -1
- package/dist/docs/components/tag.doc.js +1 -0
- package/dist/docs/components/tao-provider.doc.js +1 -2
- package/dist/index.d.ts +7 -9
- package/dist/index.js +4 -5
- package/dist/layouts/form-layout/form-layout.d.ts +8 -2
- package/dist/layouts/form-layout/form-layout.js +33 -9
- package/dist/layouts/stack/stack.d.ts +8 -2
- package/dist/layouts/stack/stack.js +36 -12
- package/dist/provider/tao-provider.d.ts +3 -9
- package/dist/provider/tao-provider.js +99 -33
- package/dist/theme/theme.css +24 -14
- package/dist/theme/tokens.d.ts +2 -2
- package/dist/theme/tokens.js +4 -1
- package/dist/utils/refs.d.ts +2 -0
- package/dist/utils/refs.js +7 -0
- package/llms.txt +26 -24
- package/package.json +16 -4
|
@@ -1,34 +1,16 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { Fragment as external_react_Fragment, useCallback, useId, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { useCallback, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
4
3
|
import { TaoPortalScope, useTaoConfig } from "../../provider/tao-provider.js";
|
|
5
4
|
import { cx } from "../../utils/semantic.js";
|
|
6
5
|
import { MobileSelectDrawer } from "./mobile-select.js";
|
|
6
|
+
import { CheckIcon, ChevronDownIcon, CloseIcon, LoadingIcon, SearchIcon } from "./select-icons.js";
|
|
7
|
+
import { defaultFilter, filterTree, flattenOptions } from "./select-model.js";
|
|
8
|
+
import { SearchableSelectList } from "./select-searchable-list.js";
|
|
9
|
+
import { SelectTags } from "./select-tags.js";
|
|
7
10
|
import "./select.css";
|
|
8
11
|
import { useIsMobile } from "./use-is-mobile.js";
|
|
9
12
|
import * as __rspack_external__radix_ui_react_popover_c8444160 from "@radix-ui/react-popover";
|
|
10
13
|
import * as __rspack_external__radix_ui_react_select_4606f4d3 from "@radix-ui/react-select";
|
|
11
|
-
const defaultFilter = (input, option)=>{
|
|
12
|
-
const label = 'string' == typeof option.label ? option.label : String(option.label);
|
|
13
|
-
return label.toLowerCase().includes(input.toLowerCase());
|
|
14
|
-
};
|
|
15
|
-
function flattenOptions(options) {
|
|
16
|
-
const out = [];
|
|
17
|
-
for (const o of options)if (o.options) out.push(...flattenOptions(o.options));
|
|
18
|
-
else out.push(o);
|
|
19
|
-
return out;
|
|
20
|
-
}
|
|
21
|
-
function filterTree(options, fn, input) {
|
|
22
|
-
const result = [];
|
|
23
|
-
for (const o of options)if (o.options) {
|
|
24
|
-
const kids = filterTree(o.options, fn, input);
|
|
25
|
-
if (kids.length) result.push({
|
|
26
|
-
...o,
|
|
27
|
-
options: kids
|
|
28
|
-
});
|
|
29
|
-
} else if (fn(input, o)) result.push(o);
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
14
|
const PLACEMENT_MAP = {
|
|
33
15
|
bottomLeft: {
|
|
34
16
|
side: 'bottom',
|
|
@@ -48,7 +30,7 @@ const PLACEMENT_MAP = {
|
|
|
48
30
|
}
|
|
49
31
|
};
|
|
50
32
|
function Select(props) {
|
|
51
|
-
const { options, value: valueProp, defaultValue, onChange, onSelect, onDeselect, onClear, mode, placeholder, size, variant, disabled, status, showSearch, filterOption, searchValue: searchValueProp, onSearch, allowClear, loading, loadingIcon, notFoundContent = 'No results', prefix, suffixIcon, removeIcon, autoFocus, id, name, open: openProp, defaultOpen, onOpenChange, placement = 'bottomLeft', popupMatchSelectWidth = true, listHeight = 256, getPopupContainer, optionRender, labelRender, popupRender, tagRender, maxTagCount, maxTagPlaceholder, maxTagTextLength, maxCount, autoClearSearchValue = true, tokenSeparators, hideSelected, mobile, className, style, classNames, styles } = props;
|
|
33
|
+
const { options, value: valueProp, defaultValue, onChange, onSelect, onDeselect, onClear, mode, placeholder, size, variant, disabled, status, showSearch, filterOption, searchValue: searchValueProp, onSearch, allowClear, loading, loadingIcon, notFoundContent = 'No results', prefix, suffixIcon, removeIcon, autoFocus, id, name, open: openProp, defaultOpen, onOpenChange, placement = 'bottomLeft', popupMatchSelectWidth = true, listHeight = 256, getPopupContainer, optionRender, labelRender, popupRender, tagRender, maxTagCount, maxTagPlaceholder, maxTagTextLength, maxCount, autoClearSearchValue = true, tokenSeparators, hideSelected, mobile, className, style, classNames, styles, ref } = props;
|
|
52
34
|
const ctx = useTaoConfig();
|
|
53
35
|
const resolvedSize = size ?? ctx.size;
|
|
54
36
|
const resolvedVariant = variant ?? ctx.variant;
|
|
@@ -60,6 +42,15 @@ function Select(props) {
|
|
|
60
42
|
const searchListboxId = useId();
|
|
61
43
|
const isMultiple = 'multiple' === mode || 'tags' === mode;
|
|
62
44
|
const hasInlineSearch = !!showSearch && !isMobile;
|
|
45
|
+
useImperativeHandle(ref, ()=>({
|
|
46
|
+
focus: ()=>(hasInlineSearch ? inputRef.current : triggerRef.current)?.focus(),
|
|
47
|
+
blur: ()=>(hasInlineSearch ? inputRef.current : triggerRef.current)?.blur(),
|
|
48
|
+
get nativeElement () {
|
|
49
|
+
return hasInlineSearch ? inputRef.current : triggerRef.current;
|
|
50
|
+
}
|
|
51
|
+
}), [
|
|
52
|
+
hasInlineSearch
|
|
53
|
+
]);
|
|
63
54
|
const isValueControlled = void 0 !== valueProp;
|
|
64
55
|
const [valueInternal, setValueInternal] = useState(isMultiple ? defaultValue ?? [] : defaultValue);
|
|
65
56
|
const value = isValueControlled ? valueProp : valueInternal;
|
|
@@ -295,71 +286,18 @@ function Select(props) {
|
|
|
295
286
|
'data-tao-error': 'error' === status || void 0,
|
|
296
287
|
'data-tao-warning': 'warning' === status || void 0
|
|
297
288
|
};
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
};
|
|
311
|
-
return /*#__PURE__*/ jsxs(Fragment, {
|
|
312
|
-
children: [
|
|
313
|
-
visible.map((opt_7)=>{
|
|
314
|
-
const closable = !resolvedDisabled && !opt_7.disabled;
|
|
315
|
-
const tagNode = tagRender ? tagRender({
|
|
316
|
-
label: truncateLabel(opt_7),
|
|
317
|
-
value: opt_7.value,
|
|
318
|
-
closable,
|
|
319
|
-
disabled: !!opt_7.disabled,
|
|
320
|
-
onClose: (e_2)=>handleRemoveTag(opt_7.value, e_2)
|
|
321
|
-
}) : /*#__PURE__*/ jsxs("span", {
|
|
322
|
-
"data-tao-select-tag": "",
|
|
323
|
-
"data-tao-disabled": opt_7.disabled || void 0,
|
|
324
|
-
className: cx(classNames?.tag),
|
|
325
|
-
style: styles?.tag,
|
|
326
|
-
children: [
|
|
327
|
-
/*#__PURE__*/ jsx("span", {
|
|
328
|
-
"data-tao-select-tag-label": "",
|
|
329
|
-
className: cx(classNames?.tagLabel),
|
|
330
|
-
style: styles?.tagLabel,
|
|
331
|
-
children: truncateLabel(opt_7)
|
|
332
|
-
}),
|
|
333
|
-
closable && /*#__PURE__*/ jsx("span", {
|
|
334
|
-
"data-tao-select-tag-close": "",
|
|
335
|
-
className: cx(classNames?.tagClose),
|
|
336
|
-
style: styles?.tagClose,
|
|
337
|
-
role: "button",
|
|
338
|
-
tabIndex: 0,
|
|
339
|
-
"aria-label": `Remove ${'string' == typeof opt_7.label ? opt_7.label : opt_7.value}`,
|
|
340
|
-
onPointerDown: (e_3)=>e_3.stopPropagation(),
|
|
341
|
-
onClick: (e_4)=>handleRemoveTag(opt_7.value, e_4),
|
|
342
|
-
onKeyDown: (e_5)=>{
|
|
343
|
-
if ('Enter' === e_5.key || ' ' === e_5.key) handleRemoveTag(opt_7.value, e_5);
|
|
344
|
-
},
|
|
345
|
-
children: removeIcon ?? /*#__PURE__*/ jsx(CloseSmallIcon, {})
|
|
346
|
-
})
|
|
347
|
-
]
|
|
348
|
-
}, opt_7.value);
|
|
349
|
-
return /*#__PURE__*/ jsx(external_react_Fragment, {
|
|
350
|
-
children: tagNode
|
|
351
|
-
}, opt_7.value);
|
|
352
|
-
}),
|
|
353
|
-
omitted.length > 0 && /*#__PURE__*/ jsx("span", {
|
|
354
|
-
"data-tao-select-tag": "",
|
|
355
|
-
"data-tao-select-tag-rest": "",
|
|
356
|
-
className: cx(classNames?.tagRest),
|
|
357
|
-
style: styles?.tagRest,
|
|
358
|
-
children: 'function' == typeof maxTagPlaceholder ? maxTagPlaceholder(omitted) : maxTagPlaceholder ?? `+${omitted.length}…`
|
|
359
|
-
})
|
|
360
|
-
]
|
|
361
|
-
});
|
|
362
|
-
};
|
|
289
|
+
const tags = isMultiple ? /*#__PURE__*/ jsx(SelectTags, {
|
|
290
|
+
options: selectedOptions,
|
|
291
|
+
disabled: !!resolvedDisabled,
|
|
292
|
+
maxTagCount: maxTagCount,
|
|
293
|
+
maxTagPlaceholder: maxTagPlaceholder,
|
|
294
|
+
maxTagTextLength: maxTagTextLength,
|
|
295
|
+
removeIcon: removeIcon,
|
|
296
|
+
tagRender: tagRender,
|
|
297
|
+
classNames: classNames,
|
|
298
|
+
styles: styles,
|
|
299
|
+
onRemove: handleRemoveTag
|
|
300
|
+
}) : null;
|
|
363
301
|
const trailingIcons = /*#__PURE__*/ jsx("span", {
|
|
364
302
|
"data-tao-select-icons": "",
|
|
365
303
|
children: loading ? /*#__PURE__*/ jsx("span", {
|
|
@@ -370,12 +308,12 @@ function Select(props) {
|
|
|
370
308
|
"data-tao-select-clear": "",
|
|
371
309
|
className: cx(classNames?.clear),
|
|
372
310
|
style: styles?.clear,
|
|
373
|
-
onPointerDown: (
|
|
311
|
+
onPointerDown: (e_2)=>e_2.stopPropagation(),
|
|
374
312
|
onClick: handleClear,
|
|
375
|
-
onKeyDown: (
|
|
376
|
-
if ('Enter' ===
|
|
377
|
-
|
|
378
|
-
|
|
313
|
+
onKeyDown: (e_3)=>{
|
|
314
|
+
if ('Enter' === e_3.key || ' ' === e_3.key) {
|
|
315
|
+
e_3.preventDefault();
|
|
316
|
+
e_3.stopPropagation();
|
|
379
317
|
clearValue();
|
|
380
318
|
}
|
|
381
319
|
},
|
|
@@ -423,6 +361,7 @@ function Select(props) {
|
|
|
423
361
|
if (isMobile) return /*#__PURE__*/ jsxs(Fragment, {
|
|
424
362
|
children: [
|
|
425
363
|
/*#__PURE__*/ jsxs("div", {
|
|
364
|
+
ref: triggerRef,
|
|
426
365
|
id: id,
|
|
427
366
|
"data-tao-control": "",
|
|
428
367
|
"data-tao-select": "",
|
|
@@ -440,9 +379,9 @@ function Select(props) {
|
|
|
440
379
|
...style
|
|
441
380
|
},
|
|
442
381
|
onClick: ()=>handleOpenChange(true),
|
|
443
|
-
onKeyDown: (
|
|
444
|
-
if ('Enter' ===
|
|
445
|
-
|
|
382
|
+
onKeyDown: (e_4)=>{
|
|
383
|
+
if ('Enter' === e_4.key || ' ' === e_4.key) {
|
|
384
|
+
e_4.preventDefault();
|
|
446
385
|
handleOpenChange(true);
|
|
447
386
|
}
|
|
448
387
|
},
|
|
@@ -459,7 +398,7 @@ function Select(props) {
|
|
|
459
398
|
"data-tao-select-values": "",
|
|
460
399
|
className: cx(classNames?.values),
|
|
461
400
|
style: styles?.values,
|
|
462
|
-
children: selectedOptions.length > 0 ?
|
|
401
|
+
children: selectedOptions.length > 0 ? tags : /*#__PURE__*/ jsx("span", {
|
|
463
402
|
"data-tao-select-placeholder": "",
|
|
464
403
|
className: cx(classNames?.placeholder),
|
|
465
404
|
style: styles?.placeholder,
|
|
@@ -513,23 +452,23 @@ function Select(props) {
|
|
|
513
452
|
const resultCount = flattenOptions(filteredOptions).length;
|
|
514
453
|
const overMaxCount = isMultiple && null != maxCount && valueArray.length >= maxCount;
|
|
515
454
|
let optIndex = 0;
|
|
516
|
-
const renderItem = (
|
|
455
|
+
const renderItem = (opt_6)=>{
|
|
517
456
|
const index = optIndex++;
|
|
518
|
-
const textLabel = 'string' == typeof
|
|
519
|
-
const isSelected = valueArray.includes(
|
|
520
|
-
const itemDisabled =
|
|
457
|
+
const textLabel = 'string' == typeof opt_6.label ? opt_6.label : String(opt_6.label);
|
|
458
|
+
const isSelected = valueArray.includes(opt_6.value);
|
|
459
|
+
const itemDisabled = opt_6.disabled || !isSelected && overMaxCount;
|
|
521
460
|
return /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_select_4606f4d3.Item, {
|
|
522
|
-
value:
|
|
461
|
+
value: opt_6.value,
|
|
523
462
|
disabled: itemDisabled,
|
|
524
463
|
"data-tao-select-item": "",
|
|
525
|
-
"data-tao-has-desc": null !=
|
|
464
|
+
"data-tao-has-desc": null != opt_6.description || void 0,
|
|
526
465
|
"data-tao-selected": isMultiple && isSelected ? '' : void 0,
|
|
527
466
|
className: cx(classNames?.item),
|
|
528
467
|
style: styles?.item,
|
|
529
468
|
children: [
|
|
530
469
|
optionRender ? /*#__PURE__*/ jsxs(Fragment, {
|
|
531
470
|
children: [
|
|
532
|
-
optionRender(
|
|
471
|
+
optionRender(opt_6, {
|
|
533
472
|
index
|
|
534
473
|
}),
|
|
535
474
|
/*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_4606f4d3.ItemText, {
|
|
@@ -541,11 +480,11 @@ function Select(props) {
|
|
|
541
480
|
]
|
|
542
481
|
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
543
482
|
children: [
|
|
544
|
-
null !=
|
|
483
|
+
null != opt_6.icon && /*#__PURE__*/ jsx("span", {
|
|
545
484
|
"data-tao-select-item-icon": "",
|
|
546
485
|
className: cx(classNames?.itemIcon),
|
|
547
486
|
style: styles?.itemIcon,
|
|
548
|
-
children:
|
|
487
|
+
children: opt_6.icon
|
|
549
488
|
}),
|
|
550
489
|
/*#__PURE__*/ jsxs("span", {
|
|
551
490
|
"data-tao-select-item-main": "",
|
|
@@ -553,13 +492,13 @@ function Select(props) {
|
|
|
553
492
|
style: styles?.itemLabel,
|
|
554
493
|
children: [
|
|
555
494
|
/*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_4606f4d3.ItemText, {
|
|
556
|
-
children:
|
|
495
|
+
children: opt_6.label
|
|
557
496
|
}),
|
|
558
|
-
null !=
|
|
497
|
+
null != opt_6.description && /*#__PURE__*/ jsx("span", {
|
|
559
498
|
"data-tao-select-item-desc": "",
|
|
560
499
|
className: cx(classNames?.itemDesc),
|
|
561
500
|
style: styles?.itemDesc,
|
|
562
|
-
children:
|
|
501
|
+
children: opt_6.description
|
|
563
502
|
})
|
|
564
503
|
]
|
|
565
504
|
})
|
|
@@ -573,7 +512,7 @@ function Select(props) {
|
|
|
573
512
|
children: /*#__PURE__*/ jsx(CheckIcon, {})
|
|
574
513
|
})
|
|
575
514
|
]
|
|
576
|
-
},
|
|
515
|
+
}, opt_6.value);
|
|
577
516
|
};
|
|
578
517
|
const renderTree = (opts_0)=>opts_0.map((o_13)=>o_13.options ? /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_select_4606f4d3.Group, {
|
|
579
518
|
"data-tao-select-group": "",
|
|
@@ -604,100 +543,23 @@ function Select(props) {
|
|
|
604
543
|
const isSearchableOptionDisabled = (option)=>!!option.disabled || overMaxCount && !valueArray.includes(option.value);
|
|
605
544
|
const searchableOptions = flattenOptions(filteredOptions).filter((option_0)=>!isSearchableOptionDisabled(option_0));
|
|
606
545
|
const activeSearchOption = searchableOptions[Math.min(activeSearchIndex, Math.max(searchableOptions.length - 1, 0))];
|
|
607
|
-
|
|
608
|
-
const renderSearchableItem = (option_1)=>{
|
|
609
|
-
const renderIndex = searchableItemIndex++;
|
|
610
|
-
const optionIndex = searchableOptions.findIndex((candidate)=>candidate.value === option_1.value);
|
|
611
|
-
const isSelected_0 = valueArray.includes(option_1.value);
|
|
612
|
-
const itemDisabled_0 = isSearchableOptionDisabled(option_1);
|
|
613
|
-
return /*#__PURE__*/ jsxs("button", {
|
|
614
|
-
id: `${searchListboxId}-option-${encodeURIComponent(option_1.value)}`,
|
|
615
|
-
type: "button",
|
|
616
|
-
role: "option",
|
|
617
|
-
"aria-selected": isSelected_0,
|
|
618
|
-
disabled: itemDisabled_0,
|
|
619
|
-
"data-disabled": itemDisabled_0 || void 0,
|
|
620
|
-
"data-tao-select-item": "",
|
|
621
|
-
"data-tao-selected": isMultiple && isSelected_0 ? '' : void 0,
|
|
622
|
-
"data-tao-has-desc": null != option_1.description || void 0,
|
|
623
|
-
"data-state": isSelected_0 ? 'checked' : 'unchecked',
|
|
624
|
-
"data-highlighted": activeSearchOption?.value === option_1.value ? '' : void 0,
|
|
625
|
-
className: cx(classNames?.item),
|
|
626
|
-
style: styles?.item,
|
|
627
|
-
onPointerDown: (event_0)=>event_0.preventDefault(),
|
|
628
|
-
onMouseMove: ()=>{
|
|
629
|
-
if (optionIndex >= 0) setActiveSearchIndex(optionIndex);
|
|
630
|
-
},
|
|
631
|
-
onClick: ()=>{
|
|
632
|
-
if (itemDisabled_0) return;
|
|
633
|
-
handleValueChange(option_1.value);
|
|
634
|
-
if (!isMultiple) handleOpenChange(false);
|
|
635
|
-
},
|
|
636
|
-
children: [
|
|
637
|
-
optionRender ? optionRender(option_1, {
|
|
638
|
-
index: renderIndex
|
|
639
|
-
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
640
|
-
children: [
|
|
641
|
-
null != option_1.icon && /*#__PURE__*/ jsx("span", {
|
|
642
|
-
"data-tao-select-item-icon": "",
|
|
643
|
-
className: cx(classNames?.itemIcon),
|
|
644
|
-
style: styles?.itemIcon,
|
|
645
|
-
children: option_1.icon
|
|
646
|
-
}),
|
|
647
|
-
/*#__PURE__*/ jsxs("span", {
|
|
648
|
-
"data-tao-select-item-main": "",
|
|
649
|
-
className: cx(classNames?.itemLabel),
|
|
650
|
-
style: styles?.itemLabel,
|
|
651
|
-
children: [
|
|
652
|
-
/*#__PURE__*/ jsx("span", {
|
|
653
|
-
children: option_1.label
|
|
654
|
-
}),
|
|
655
|
-
null != option_1.description && /*#__PURE__*/ jsx("span", {
|
|
656
|
-
"data-tao-select-item-desc": "",
|
|
657
|
-
className: cx(classNames?.itemDesc),
|
|
658
|
-
style: styles?.itemDesc,
|
|
659
|
-
children: option_1.description
|
|
660
|
-
})
|
|
661
|
-
]
|
|
662
|
-
})
|
|
663
|
-
]
|
|
664
|
-
}),
|
|
665
|
-
isSelected_0 && /*#__PURE__*/ jsx("span", {
|
|
666
|
-
"data-tao-select-check": "",
|
|
667
|
-
children: /*#__PURE__*/ jsx(CheckIcon, {})
|
|
668
|
-
})
|
|
669
|
-
]
|
|
670
|
-
}, option_1.value);
|
|
671
|
-
};
|
|
672
|
-
const renderSearchableTree = (items)=>items.map((option_2)=>option_2.options ? /*#__PURE__*/ jsxs("fieldset", {
|
|
673
|
-
"aria-label": String(option_2.label),
|
|
674
|
-
"data-tao-select-group": "",
|
|
675
|
-
className: cx(classNames?.group),
|
|
676
|
-
style: styles?.group,
|
|
677
|
-
children: [
|
|
678
|
-
/*#__PURE__*/ jsx("legend", {
|
|
679
|
-
"data-tao-select-group-label": "",
|
|
680
|
-
className: cx(classNames?.groupLabel),
|
|
681
|
-
style: styles?.groupLabel,
|
|
682
|
-
children: option_2.label
|
|
683
|
-
}),
|
|
684
|
-
renderSearchableTree(option_2.options)
|
|
685
|
-
]
|
|
686
|
-
}, option_2.value) : renderSearchableItem(option_2));
|
|
687
|
-
const searchableMenuNode = /*#__PURE__*/ jsx("div", {
|
|
546
|
+
const searchableMenuNode = /*#__PURE__*/ jsx(SearchableSelectList, {
|
|
688
547
|
id: searchListboxId,
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
548
|
+
options: filteredOptions,
|
|
549
|
+
resultCount: resultCount,
|
|
550
|
+
searchableOptions: searchableOptions,
|
|
551
|
+
activeValue: activeSearchOption?.value,
|
|
552
|
+
selectedValues: valueArray,
|
|
553
|
+
multiple: isMultiple,
|
|
554
|
+
maxCountReached: overMaxCount,
|
|
555
|
+
listHeight: listHeight,
|
|
556
|
+
notFoundContent: notFoundContent,
|
|
557
|
+
optionRender: optionRender,
|
|
558
|
+
classNames: classNames,
|
|
559
|
+
styles: styles,
|
|
560
|
+
onActiveIndexChange: setActiveSearchIndex,
|
|
561
|
+
onValueChange: handleValueChange,
|
|
562
|
+
onClose: ()=>handleOpenChange(false)
|
|
701
563
|
});
|
|
702
564
|
const container = getPopupContainer && triggerRef.current ? getPopupContainer(triggerRef.current) : void 0;
|
|
703
565
|
const inlineSearchInput = /*#__PURE__*/ jsx("input", {
|
|
@@ -718,37 +580,37 @@ function Select(props) {
|
|
|
718
580
|
"aria-label": selectedOption ? String(selectedOption.label) : placeholder,
|
|
719
581
|
autoFocus: autoFocus,
|
|
720
582
|
autoComplete: "off",
|
|
721
|
-
onClick: (
|
|
722
|
-
if (open)
|
|
583
|
+
onClick: (event_0)=>{
|
|
584
|
+
if (open) event_0.stopPropagation();
|
|
723
585
|
},
|
|
724
|
-
onChange: (
|
|
725
|
-
handleSearchChange(
|
|
586
|
+
onChange: (event_1)=>{
|
|
587
|
+
handleSearchChange(event_1.target.value);
|
|
726
588
|
setActiveSearchIndex(0);
|
|
727
589
|
if (!open) handleOpenChange(true);
|
|
728
590
|
},
|
|
729
|
-
onKeyDown: (
|
|
730
|
-
|
|
731
|
-
handleSearchKeyDown(
|
|
732
|
-
if (
|
|
733
|
-
if ('Escape' ===
|
|
591
|
+
onKeyDown: (event_2)=>{
|
|
592
|
+
event_2.stopPropagation();
|
|
593
|
+
handleSearchKeyDown(event_2);
|
|
594
|
+
if (event_2.defaultPrevented) return;
|
|
595
|
+
if ('Escape' === event_2.key) {
|
|
734
596
|
handleSearchChange('');
|
|
735
597
|
handleOpenChange(false);
|
|
736
598
|
return;
|
|
737
599
|
}
|
|
738
|
-
if ('ArrowDown' ===
|
|
739
|
-
|
|
600
|
+
if ('ArrowDown' === event_2.key) {
|
|
601
|
+
event_2.preventDefault();
|
|
740
602
|
setActiveSearchIndex((index_0)=>Math.min(index_0 + 1, searchableOptions.length - 1));
|
|
741
603
|
if (!open) handleOpenChange(true);
|
|
742
604
|
return;
|
|
743
605
|
}
|
|
744
|
-
if ('ArrowUp' ===
|
|
745
|
-
|
|
606
|
+
if ('ArrowUp' === event_2.key) {
|
|
607
|
+
event_2.preventDefault();
|
|
746
608
|
setActiveSearchIndex((index_1)=>Math.max(index_1 - 1, 0));
|
|
747
609
|
return;
|
|
748
610
|
}
|
|
749
611
|
const nextValue = activeSearchOption?.value ?? ('tags' === mode ? search.trim() : void 0);
|
|
750
|
-
if ('Enter' ===
|
|
751
|
-
|
|
612
|
+
if ('Enter' === event_2.key && nextValue) {
|
|
613
|
+
event_2.preventDefault();
|
|
752
614
|
handleValueChange(nextValue);
|
|
753
615
|
if (!isMultiple) handleOpenChange(false);
|
|
754
616
|
}
|
|
@@ -795,7 +657,7 @@ function Select(props) {
|
|
|
795
657
|
className: cx(classNames?.values),
|
|
796
658
|
style: styles?.values,
|
|
797
659
|
children: [
|
|
798
|
-
|
|
660
|
+
tags,
|
|
799
661
|
inlineSearchInput
|
|
800
662
|
]
|
|
801
663
|
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
@@ -843,9 +705,9 @@ function Select(props) {
|
|
|
843
705
|
side: side,
|
|
844
706
|
align: align,
|
|
845
707
|
sideOffset: 4,
|
|
846
|
-
onOpenAutoFocus: (
|
|
847
|
-
onCloseAutoFocus: (
|
|
848
|
-
|
|
708
|
+
onOpenAutoFocus: (event_3)=>event_3.preventDefault(),
|
|
709
|
+
onCloseAutoFocus: (event_4)=>{
|
|
710
|
+
event_4.preventDefault();
|
|
849
711
|
inputRef.current?.focus();
|
|
850
712
|
},
|
|
851
713
|
children: popupRender ? popupRender(searchableMenuNode) : searchableMenuNode
|
|
@@ -893,7 +755,7 @@ function Select(props) {
|
|
|
893
755
|
"data-tao-select-values": "",
|
|
894
756
|
className: cx(classNames?.values),
|
|
895
757
|
style: styles?.values,
|
|
896
|
-
children: selectedOptions.length > 0 ?
|
|
758
|
+
children: selectedOptions.length > 0 ? tags : /*#__PURE__*/ jsx("span", {
|
|
897
759
|
"data-tao-select-placeholder": "",
|
|
898
760
|
className: cx(classNames?.placeholder),
|
|
899
761
|
style: styles?.placeholder,
|
|
@@ -952,10 +814,10 @@ function Select(props) {
|
|
|
952
814
|
className: cx(classNames?.searchInput),
|
|
953
815
|
style: styles?.searchInput,
|
|
954
816
|
value: search,
|
|
955
|
-
onChange: (
|
|
956
|
-
onKeyDown: (
|
|
957
|
-
|
|
958
|
-
handleSearchKeyDown(
|
|
817
|
+
onChange: (e_5)=>handleSearchChange(e_5.target.value),
|
|
818
|
+
onKeyDown: (e_6)=>{
|
|
819
|
+
e_6.stopPropagation();
|
|
820
|
+
handleSearchKeyDown(e_6);
|
|
959
821
|
},
|
|
960
822
|
placeholder: "Search...",
|
|
961
823
|
autoComplete: "off"
|
|
@@ -970,179 +832,4 @@ function Select(props) {
|
|
|
970
832
|
]
|
|
971
833
|
});
|
|
972
834
|
}
|
|
973
|
-
|
|
974
|
-
const $ = c(1);
|
|
975
|
-
let t0;
|
|
976
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
977
|
-
t0 = /*#__PURE__*/ jsx("svg", {
|
|
978
|
-
width: "16",
|
|
979
|
-
height: "16",
|
|
980
|
-
viewBox: "0 0 24 24",
|
|
981
|
-
fill: "none",
|
|
982
|
-
stroke: "currentColor",
|
|
983
|
-
strokeWidth: "2",
|
|
984
|
-
strokeLinecap: "round",
|
|
985
|
-
strokeLinejoin: "round",
|
|
986
|
-
"aria-hidden": "true",
|
|
987
|
-
focusable: "false",
|
|
988
|
-
role: "presentation",
|
|
989
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
990
|
-
d: "m6 9 6 6 6-6"
|
|
991
|
-
})
|
|
992
|
-
});
|
|
993
|
-
$[0] = t0;
|
|
994
|
-
} else t0 = $[0];
|
|
995
|
-
return t0;
|
|
996
|
-
}
|
|
997
|
-
function ChevronsUpDownIcon() {
|
|
998
|
-
const $ = c(1);
|
|
999
|
-
let t0;
|
|
1000
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1001
|
-
t0 = /*#__PURE__*/ jsx("svg", {
|
|
1002
|
-
width: "16",
|
|
1003
|
-
height: "16",
|
|
1004
|
-
viewBox: "0 0 24 24",
|
|
1005
|
-
fill: "none",
|
|
1006
|
-
stroke: "currentColor",
|
|
1007
|
-
strokeWidth: "2",
|
|
1008
|
-
strokeLinecap: "round",
|
|
1009
|
-
strokeLinejoin: "round",
|
|
1010
|
-
"aria-hidden": "true",
|
|
1011
|
-
focusable: "false",
|
|
1012
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
1013
|
-
d: "m7 15 5 5 5-5M7 9l5-5 5 5"
|
|
1014
|
-
})
|
|
1015
|
-
});
|
|
1016
|
-
$[0] = t0;
|
|
1017
|
-
} else t0 = $[0];
|
|
1018
|
-
return t0;
|
|
1019
|
-
}
|
|
1020
|
-
function CheckIcon() {
|
|
1021
|
-
const $ = c(1);
|
|
1022
|
-
let t0;
|
|
1023
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1024
|
-
t0 = /*#__PURE__*/ jsx("svg", {
|
|
1025
|
-
width: "16",
|
|
1026
|
-
height: "16",
|
|
1027
|
-
viewBox: "0 0 24 24",
|
|
1028
|
-
fill: "none",
|
|
1029
|
-
stroke: "currentColor",
|
|
1030
|
-
strokeWidth: "2.5",
|
|
1031
|
-
strokeLinecap: "round",
|
|
1032
|
-
strokeLinejoin: "round",
|
|
1033
|
-
"aria-hidden": "true",
|
|
1034
|
-
focusable: "false",
|
|
1035
|
-
role: "presentation",
|
|
1036
|
-
children: /*#__PURE__*/ jsx("polyline", {
|
|
1037
|
-
points: "20 6 9 17 4 12"
|
|
1038
|
-
})
|
|
1039
|
-
});
|
|
1040
|
-
$[0] = t0;
|
|
1041
|
-
} else t0 = $[0];
|
|
1042
|
-
return t0;
|
|
1043
|
-
}
|
|
1044
|
-
function CloseIcon() {
|
|
1045
|
-
const $ = c(1);
|
|
1046
|
-
let t0;
|
|
1047
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1048
|
-
t0 = /*#__PURE__*/ jsx("svg", {
|
|
1049
|
-
width: "14",
|
|
1050
|
-
height: "14",
|
|
1051
|
-
viewBox: "0 0 24 24",
|
|
1052
|
-
fill: "none",
|
|
1053
|
-
stroke: "currentColor",
|
|
1054
|
-
strokeWidth: "2",
|
|
1055
|
-
strokeLinecap: "round",
|
|
1056
|
-
strokeLinejoin: "round",
|
|
1057
|
-
"aria-hidden": "true",
|
|
1058
|
-
focusable: "false",
|
|
1059
|
-
role: "presentation",
|
|
1060
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
1061
|
-
d: "M18 6 6 18M6 6l12 12"
|
|
1062
|
-
})
|
|
1063
|
-
});
|
|
1064
|
-
$[0] = t0;
|
|
1065
|
-
} else t0 = $[0];
|
|
1066
|
-
return t0;
|
|
1067
|
-
}
|
|
1068
|
-
function CloseSmallIcon() {
|
|
1069
|
-
const $ = c(1);
|
|
1070
|
-
let t0;
|
|
1071
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1072
|
-
t0 = /*#__PURE__*/ jsx("svg", {
|
|
1073
|
-
width: "10",
|
|
1074
|
-
height: "10",
|
|
1075
|
-
viewBox: "0 0 24 24",
|
|
1076
|
-
fill: "none",
|
|
1077
|
-
stroke: "currentColor",
|
|
1078
|
-
strokeWidth: "2.5",
|
|
1079
|
-
strokeLinecap: "round",
|
|
1080
|
-
strokeLinejoin: "round",
|
|
1081
|
-
"aria-hidden": "true",
|
|
1082
|
-
focusable: "false",
|
|
1083
|
-
role: "presentation",
|
|
1084
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
1085
|
-
d: "M18 6 6 18M6 6l12 12"
|
|
1086
|
-
})
|
|
1087
|
-
});
|
|
1088
|
-
$[0] = t0;
|
|
1089
|
-
} else t0 = $[0];
|
|
1090
|
-
return t0;
|
|
1091
|
-
}
|
|
1092
|
-
function SearchIcon() {
|
|
1093
|
-
const $ = c(1);
|
|
1094
|
-
let t0;
|
|
1095
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1096
|
-
t0 = /*#__PURE__*/ jsxs("svg", {
|
|
1097
|
-
width: "14",
|
|
1098
|
-
height: "14",
|
|
1099
|
-
viewBox: "0 0 24 24",
|
|
1100
|
-
fill: "none",
|
|
1101
|
-
stroke: "currentColor",
|
|
1102
|
-
strokeWidth: "2",
|
|
1103
|
-
strokeLinecap: "round",
|
|
1104
|
-
strokeLinejoin: "round",
|
|
1105
|
-
"aria-hidden": "true",
|
|
1106
|
-
focusable: "false",
|
|
1107
|
-
role: "presentation",
|
|
1108
|
-
children: [
|
|
1109
|
-
/*#__PURE__*/ jsx("circle", {
|
|
1110
|
-
cx: "11",
|
|
1111
|
-
cy: "11",
|
|
1112
|
-
r: "8"
|
|
1113
|
-
}),
|
|
1114
|
-
/*#__PURE__*/ jsx("path", {
|
|
1115
|
-
d: "m21 21-4.3-4.3"
|
|
1116
|
-
})
|
|
1117
|
-
]
|
|
1118
|
-
});
|
|
1119
|
-
$[0] = t0;
|
|
1120
|
-
} else t0 = $[0];
|
|
1121
|
-
return t0;
|
|
1122
|
-
}
|
|
1123
|
-
function LoadingIcon() {
|
|
1124
|
-
const $ = c(1);
|
|
1125
|
-
let t0;
|
|
1126
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1127
|
-
t0 = /*#__PURE__*/ jsx("svg", {
|
|
1128
|
-
"data-tao-select-loading": "",
|
|
1129
|
-
width: "16",
|
|
1130
|
-
height: "16",
|
|
1131
|
-
viewBox: "0 0 24 24",
|
|
1132
|
-
fill: "none",
|
|
1133
|
-
stroke: "currentColor",
|
|
1134
|
-
strokeWidth: "2",
|
|
1135
|
-
strokeLinecap: "round",
|
|
1136
|
-
strokeLinejoin: "round",
|
|
1137
|
-
"aria-hidden": "true",
|
|
1138
|
-
focusable: "false",
|
|
1139
|
-
role: "presentation",
|
|
1140
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
1141
|
-
d: "M21 12a9 9 0 1 1-6.219-8.56"
|
|
1142
|
-
})
|
|
1143
|
-
});
|
|
1144
|
-
$[0] = t0;
|
|
1145
|
-
} else t0 = $[0];
|
|
1146
|
-
return t0;
|
|
1147
|
-
}
|
|
1148
|
-
export { ChevronsUpDownIcon, SearchIcon, Select };
|
|
835
|
+
export { Select };
|