@rockshin/tao-ui 0.0.21 → 0.0.22

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.
Files changed (105) hide show
  1. package/README.md +8 -1
  2. package/component-manifest.json +77 -48
  3. package/dist/components/button/button.css +11 -11
  4. package/dist/components/button/button.d.ts +3 -2
  5. package/dist/components/button/button.js +55 -47
  6. package/dist/components/checkbox/checkbox.d.ts +3 -2
  7. package/dist/components/checkbox/checkbox.js +91 -81
  8. package/dist/components/date-picker/calendar/calendar-grid.d.ts +7 -1
  9. package/dist/components/date-picker/calendar/calendar-grid.js +158 -160
  10. package/dist/components/date-picker/calendar/time-panel.js +64 -70
  11. package/dist/components/date-picker/date-picker.css +11 -5
  12. package/dist/components/date-picker/date-picker.d.ts +13 -5
  13. package/dist/components/date-picker/date-picker.js +389 -718
  14. package/dist/components/date-picker/range-picker.d.ts +12 -5
  15. package/dist/components/date-picker/range-picker.js +68 -12
  16. package/dist/components/date-picker/types.d.ts +5 -0
  17. package/dist/components/drawer/drawer.css +3 -1
  18. package/dist/components/form-field/form-field.d.ts +1 -1
  19. package/dist/components/form-field/form-field.js +106 -63
  20. package/dist/components/input/input.css +7 -1
  21. package/dist/components/input/input.d.ts +2 -1
  22. package/dist/components/input/input.js +76 -70
  23. package/dist/components/input-number/input-number.d.ts +5 -3
  24. package/dist/components/input-number/input-number.js +63 -47
  25. package/dist/components/modal/modal.css +2 -1
  26. package/dist/components/radio/radio.d.ts +3 -2
  27. package/dist/components/radio/radio.js +43 -39
  28. package/dist/components/select/mobile-select.d.ts +1 -1
  29. package/dist/components/select/mobile-select.js +1 -1
  30. package/dist/components/select/select-icons.d.ts +7 -0
  31. package/dist/components/select/select-icons.js +141 -0
  32. package/dist/components/select/select-model.d.ts +4 -0
  33. package/dist/components/select/select-model.js +22 -0
  34. package/dist/components/select/select-searchable-list.d.ts +22 -0
  35. package/dist/components/select/select-searchable-list.js +101 -0
  36. package/dist/components/select/select-tags.d.ts +15 -0
  37. package/dist/components/select/select-tags.js +152 -0
  38. package/dist/components/select/select-types.d.ts +82 -0
  39. package/dist/components/select/select-types.js +0 -0
  40. package/dist/components/select/select.css +2 -1
  41. package/dist/components/select/select.d.ts +2 -118
  42. package/dist/components/select/select.js +91 -404
  43. package/dist/components/select/use-is-mobile.js +2 -5
  44. package/dist/components/sonner/sonner.js +9 -3
  45. package/dist/components/spinner/spinner.css +1 -1
  46. package/dist/components/splitter/splitter.js +181 -133
  47. package/dist/components/switch/switch.css +17 -8
  48. package/dist/components/switch/switch.d.ts +3 -2
  49. package/dist/components/switch/switch.js +90 -79
  50. package/dist/components/table/table-filter.d.ts +6 -0
  51. package/dist/components/table/table-filter.js +123 -0
  52. package/dist/components/table/table-icons.d.ts +9 -0
  53. package/dist/components/table/table-icons.js +157 -0
  54. package/dist/components/table/table-model.d.ts +11 -0
  55. package/dist/components/table/table-model.js +33 -0
  56. package/dist/components/table/table-types.d.ts +87 -0
  57. package/dist/components/table/table-types.js +0 -0
  58. package/dist/components/table/table.css +14 -15
  59. package/dist/components/table/table.d.ts +3 -101
  60. package/dist/components/table/table.js +29 -329
  61. package/dist/components/tabs/tabs.css +5 -2
  62. package/dist/components/tabs/tabs.js +71 -62
  63. package/dist/components/textarea/textarea.d.ts +5 -3
  64. package/dist/components/textarea/textarea.js +102 -85
  65. package/dist/docs/component-docs.d.ts +1 -0
  66. package/dist/docs/components/breadcrumb.doc.js +3 -1
  67. package/dist/docs/components/checkbox.doc.js +2 -5
  68. package/dist/docs/components/context-menu.doc.js +7 -2
  69. package/dist/docs/components/drawer.doc.js +4 -2
  70. package/dist/docs/components/dropdown.doc.js +7 -3
  71. package/dist/docs/components/form-field.doc.js +0 -1
  72. package/dist/docs/components/form-layout.doc.d.ts +1 -0
  73. package/dist/docs/components/form-layout.doc.js +3 -0
  74. package/dist/docs/components/form-section.doc.js +1 -1
  75. package/dist/docs/components/input-number.doc.js +2 -3
  76. package/dist/docs/components/input.doc.js +1 -2
  77. package/dist/docs/components/modal.doc.js +1 -1
  78. package/dist/docs/components/pagination.doc.js +1 -3
  79. package/dist/docs/components/radio.doc.js +1 -4
  80. package/dist/docs/components/range-picker.doc.js +2 -2
  81. package/dist/docs/components/select.doc.js +19 -6
  82. package/dist/docs/components/spinner.doc.js +4 -1
  83. package/dist/docs/components/splitter.doc.js +1 -1
  84. package/dist/docs/components/stack.doc.d.ts +1 -0
  85. package/dist/docs/components/stack.doc.js +3 -0
  86. package/dist/docs/components/switch.doc.js +1 -2
  87. package/dist/docs/components/table.doc.js +9 -4
  88. package/dist/docs/components/tabs.doc.js +2 -1
  89. package/dist/docs/components/tag.doc.js +1 -0
  90. package/dist/docs/components/tao-provider.doc.js +1 -2
  91. package/dist/index.d.ts +7 -9
  92. package/dist/index.js +4 -5
  93. package/dist/layouts/form-layout/form-layout.d.ts +8 -2
  94. package/dist/layouts/form-layout/form-layout.js +33 -9
  95. package/dist/layouts/stack/stack.d.ts +8 -2
  96. package/dist/layouts/stack/stack.js +36 -12
  97. package/dist/provider/tao-provider.d.ts +3 -9
  98. package/dist/provider/tao-provider.js +99 -33
  99. package/dist/theme/theme.css +24 -14
  100. package/dist/theme/tokens.d.ts +2 -2
  101. package/dist/theme/tokens.js +4 -1
  102. package/dist/utils/refs.d.ts +2 -0
  103. package/dist/utils/refs.js +7 -0
  104. package/llms.txt +26 -24
  105. package/package.json +16 -4
@@ -0,0 +1,141 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ function ChevronDownIcon() {
4
+ const $ = c(1);
5
+ let t0;
6
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
7
+ t0 = /*#__PURE__*/ jsx(Icon, {
8
+ size: 16,
9
+ strokeWidth: 2,
10
+ children: /*#__PURE__*/ jsx("path", {
11
+ d: "m6 9 6 6 6-6"
12
+ })
13
+ });
14
+ $[0] = t0;
15
+ } else t0 = $[0];
16
+ return t0;
17
+ }
18
+ function CheckIcon() {
19
+ const $ = c(1);
20
+ let t0;
21
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
22
+ t0 = /*#__PURE__*/ jsx(Icon, {
23
+ size: 16,
24
+ strokeWidth: 2.5,
25
+ children: /*#__PURE__*/ jsx("polyline", {
26
+ points: "20 6 9 17 4 12"
27
+ })
28
+ });
29
+ $[0] = t0;
30
+ } else t0 = $[0];
31
+ return t0;
32
+ }
33
+ function CloseIcon(t0) {
34
+ const $ = c(4);
35
+ const { small: t1 } = t0;
36
+ const small = void 0 === t1 ? false : t1;
37
+ const t2 = small ? 10 : 14;
38
+ const t3 = small ? 2.5 : 2;
39
+ let t4;
40
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
41
+ t4 = /*#__PURE__*/ jsx("path", {
42
+ d: "M18 6 6 18M6 6l12 12"
43
+ });
44
+ $[0] = t4;
45
+ } else t4 = $[0];
46
+ let t5;
47
+ if ($[1] !== t2 || $[2] !== t3) {
48
+ t5 = /*#__PURE__*/ jsx(Icon, {
49
+ size: t2,
50
+ strokeWidth: t3,
51
+ children: t4
52
+ });
53
+ $[1] = t2;
54
+ $[2] = t3;
55
+ $[3] = t5;
56
+ } else t5 = $[3];
57
+ return t5;
58
+ }
59
+ function SearchIcon() {
60
+ const $ = c(1);
61
+ let t0;
62
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
63
+ t0 = /*#__PURE__*/ jsxs(Icon, {
64
+ size: 14,
65
+ strokeWidth: 2,
66
+ children: [
67
+ /*#__PURE__*/ jsx("circle", {
68
+ cx: "11",
69
+ cy: "11",
70
+ r: "8"
71
+ }),
72
+ /*#__PURE__*/ jsx("path", {
73
+ d: "m21 21-4.3-4.3"
74
+ })
75
+ ]
76
+ });
77
+ $[0] = t0;
78
+ } else t0 = $[0];
79
+ return t0;
80
+ }
81
+ function LoadingIcon() {
82
+ const $ = c(1);
83
+ let t0;
84
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
85
+ t0 = /*#__PURE__*/ jsx(Icon, {
86
+ size: 16,
87
+ strokeWidth: 2,
88
+ "data-tao-select-loading": "",
89
+ children: /*#__PURE__*/ jsx("path", {
90
+ d: "M21 12a9 9 0 1 1-6.219-8.56"
91
+ })
92
+ });
93
+ $[0] = t0;
94
+ } else t0 = $[0];
95
+ return t0;
96
+ }
97
+ function Icon(t0) {
98
+ const $ = c(10);
99
+ let children;
100
+ let props;
101
+ let size;
102
+ let strokeWidth;
103
+ if ($[0] !== t0) {
104
+ ({ size, strokeWidth, children, ...props } = t0);
105
+ $[0] = t0;
106
+ $[1] = children;
107
+ $[2] = props;
108
+ $[3] = size;
109
+ $[4] = strokeWidth;
110
+ } else {
111
+ children = $[1];
112
+ props = $[2];
113
+ size = $[3];
114
+ strokeWidth = $[4];
115
+ }
116
+ let t1;
117
+ if ($[5] !== children || $[6] !== props || $[7] !== size || $[8] !== strokeWidth) {
118
+ t1 = /*#__PURE__*/ jsx("svg", {
119
+ width: size,
120
+ height: size,
121
+ viewBox: "0 0 24 24",
122
+ fill: "none",
123
+ stroke: "currentColor",
124
+ strokeWidth: strokeWidth,
125
+ strokeLinecap: "round",
126
+ strokeLinejoin: "round",
127
+ "aria-hidden": "true",
128
+ focusable: "false",
129
+ role: "presentation",
130
+ ...props,
131
+ children: children
132
+ });
133
+ $[5] = children;
134
+ $[6] = props;
135
+ $[7] = size;
136
+ $[8] = strokeWidth;
137
+ $[9] = t1;
138
+ } else t1 = $[9];
139
+ return t1;
140
+ }
141
+ export { CheckIcon, ChevronDownIcon, CloseIcon, LoadingIcon, SearchIcon };
@@ -0,0 +1,4 @@
1
+ import type { SelectOption } from './select-types';
2
+ export declare function defaultFilter(input: string, option: SelectOption): boolean;
3
+ export declare function flattenOptions(options: SelectOption[]): SelectOption[];
4
+ export declare function filterTree(options: SelectOption[], filter: (input: string, option: SelectOption) => boolean, input: string): SelectOption[];
@@ -0,0 +1,22 @@
1
+ function defaultFilter(input, option) {
2
+ const label = 'string' == typeof option.label ? option.label : String(option.label);
3
+ return label.toLowerCase().includes(input.toLowerCase());
4
+ }
5
+ function flattenOptions(options) {
6
+ const result = [];
7
+ for (const option of options)if (option.options) result.push(...flattenOptions(option.options));
8
+ else result.push(option);
9
+ return result;
10
+ }
11
+ function filterTree(options, filter, input) {
12
+ const result = [];
13
+ for (const option of options)if (option.options) {
14
+ const children = filterTree(option.options, filter, input);
15
+ if (children.length) result.push({
16
+ ...option,
17
+ options: children
18
+ });
19
+ } else if (filter(input, option)) result.push(option);
20
+ return result;
21
+ }
22
+ export { defaultFilter, filterTree, flattenOptions };
@@ -0,0 +1,22 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { SelectOption, SelectProps } from './select-types';
3
+ interface SearchableSelectListProps {
4
+ id: string;
5
+ options: SelectOption[];
6
+ resultCount: number;
7
+ searchableOptions: SelectOption[];
8
+ activeValue?: string;
9
+ selectedValues: string[];
10
+ multiple: boolean;
11
+ maxCountReached: boolean;
12
+ listHeight: number;
13
+ notFoundContent: ReactNode;
14
+ optionRender?: SelectProps['optionRender'];
15
+ classNames?: SelectProps['classNames'];
16
+ styles?: SelectProps['styles'];
17
+ onActiveIndexChange: (index: number) => void;
18
+ onValueChange: (value: string) => void;
19
+ onClose: () => void;
20
+ }
21
+ export declare function SearchableSelectList({ id, options, resultCount, searchableOptions, activeValue, selectedValues, multiple, maxCountReached, listHeight, notFoundContent, optionRender, classNames, styles, onActiveIndexChange, onValueChange, onClose, }: SearchableSelectListProps): import("react/jsx-runtime").JSX.Element;
22
+ export {};
@@ -0,0 +1,101 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { cx } from "../../utils/semantic.js";
3
+ import { CheckIcon } from "./select-icons.js";
4
+ function SearchableSelectList({ id, options, resultCount, searchableOptions, activeValue, selectedValues, multiple, maxCountReached, listHeight, notFoundContent, optionRender, classNames, styles, onActiveIndexChange, onValueChange, onClose }) {
5
+ let itemIndex = 0;
6
+ const renderItem = (option)=>{
7
+ const renderIndex = itemIndex++;
8
+ const optionIndex = searchableOptions.findIndex((candidate)=>candidate.value === option.value);
9
+ const isSelected = selectedValues.includes(option.value);
10
+ const isDisabled = !!option.disabled || maxCountReached && !isSelected;
11
+ return /*#__PURE__*/ jsxs("button", {
12
+ id: `${id}-option-${encodeURIComponent(option.value)}`,
13
+ type: "button",
14
+ role: "option",
15
+ "aria-selected": isSelected,
16
+ disabled: isDisabled,
17
+ "data-disabled": isDisabled || void 0,
18
+ "data-tao-select-item": "",
19
+ "data-tao-selected": multiple && isSelected ? '' : void 0,
20
+ "data-tao-has-desc": null != option.description || void 0,
21
+ "data-state": isSelected ? 'checked' : 'unchecked',
22
+ "data-highlighted": activeValue === option.value ? '' : void 0,
23
+ className: cx(classNames?.item),
24
+ style: styles?.item,
25
+ onPointerDown: (event)=>event.preventDefault(),
26
+ onMouseMove: ()=>{
27
+ if (optionIndex >= 0) onActiveIndexChange(optionIndex);
28
+ },
29
+ onClick: ()=>{
30
+ if (isDisabled) return;
31
+ onValueChange(option.value);
32
+ if (!multiple) onClose();
33
+ },
34
+ children: [
35
+ optionRender ? optionRender(option, {
36
+ index: renderIndex
37
+ }) : /*#__PURE__*/ jsxs(Fragment, {
38
+ children: [
39
+ null != option.icon && /*#__PURE__*/ jsx("span", {
40
+ "data-tao-select-item-icon": "",
41
+ className: cx(classNames?.itemIcon),
42
+ style: styles?.itemIcon,
43
+ children: option.icon
44
+ }),
45
+ /*#__PURE__*/ jsxs("span", {
46
+ "data-tao-select-item-main": "",
47
+ className: cx(classNames?.itemLabel),
48
+ style: styles?.itemLabel,
49
+ children: [
50
+ /*#__PURE__*/ jsx("span", {
51
+ children: option.label
52
+ }),
53
+ null != option.description && /*#__PURE__*/ jsx("span", {
54
+ "data-tao-select-item-desc": "",
55
+ className: cx(classNames?.itemDesc),
56
+ style: styles?.itemDesc,
57
+ children: option.description
58
+ })
59
+ ]
60
+ })
61
+ ]
62
+ }),
63
+ isSelected && /*#__PURE__*/ jsx("span", {
64
+ "data-tao-select-check": "",
65
+ children: /*#__PURE__*/ jsx(CheckIcon, {})
66
+ })
67
+ ]
68
+ }, option.value);
69
+ };
70
+ const renderTree = (items)=>items.map((option_0)=>option_0.options ? /*#__PURE__*/ jsxs("fieldset", {
71
+ "aria-label": String(option_0.label),
72
+ "data-tao-select-group": "",
73
+ className: cx(classNames?.group),
74
+ style: styles?.group,
75
+ children: [
76
+ /*#__PURE__*/ jsx("legend", {
77
+ "data-tao-select-group-label": "",
78
+ className: cx(classNames?.groupLabel),
79
+ style: styles?.groupLabel,
80
+ children: option_0.label
81
+ }),
82
+ renderTree(option_0.options)
83
+ ]
84
+ }, option_0.value) : renderItem(option_0));
85
+ return /*#__PURE__*/ jsx("div", {
86
+ id: id,
87
+ role: "listbox",
88
+ "aria-multiselectable": multiple || void 0,
89
+ "data-tao-select-viewport": "",
90
+ style: {
91
+ maxHeight: listHeight
92
+ },
93
+ children: resultCount > 0 ? renderTree(options) : /*#__PURE__*/ jsx("div", {
94
+ "data-tao-select-empty": "",
95
+ className: cx(classNames?.empty),
96
+ style: styles?.empty,
97
+ children: notFoundContent
98
+ })
99
+ });
100
+ }
101
+ export { SearchableSelectList };
@@ -0,0 +1,15 @@
1
+ import { type ReactNode, type SyntheticEvent } from 'react';
2
+ import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
3
+ import type { SelectOption, SelectSemanticPart, TagRenderProps } from './select-types';
4
+ export declare function SelectTags({ options, disabled, maxTagCount, maxTagPlaceholder, maxTagTextLength, removeIcon, tagRender, classNames, styles, onRemove, }: {
5
+ options: SelectOption[];
6
+ disabled: boolean;
7
+ maxTagCount?: number | 'responsive';
8
+ maxTagPlaceholder?: ReactNode | ((omittedValues: SelectOption[]) => ReactNode);
9
+ maxTagTextLength?: number;
10
+ removeIcon?: ReactNode;
11
+ tagRender?: (props: TagRenderProps) => ReactNode;
12
+ classNames?: SemanticClassNames<SelectSemanticPart>;
13
+ styles?: SemanticStyles<SelectSemanticPart>;
14
+ onRemove: (value: string, event: SyntheticEvent) => void;
15
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,152 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import { Fragment as external_react_Fragment } from "react";
4
+ import { cx } from "../../utils/semantic.js";
5
+ import { CloseIcon } from "./select-icons.js";
6
+ function SelectTags(t0) {
7
+ const $ = c(52);
8
+ const { options, disabled, maxTagCount, maxTagPlaceholder, maxTagTextLength, removeIcon, tagRender, classNames, styles, onRemove } = t0;
9
+ if (0 === options.length) return null;
10
+ let t1;
11
+ if ($[0] !== maxTagCount || $[1] !== options) {
12
+ t1 = "number" == typeof maxTagCount ? options.slice(0, maxTagCount) : options;
13
+ $[0] = maxTagCount;
14
+ $[1] = options;
15
+ $[2] = t1;
16
+ } else t1 = $[2];
17
+ const visible = t1;
18
+ let t2;
19
+ let t3;
20
+ if ($[3] !== classNames?.tag || $[4] !== classNames?.tagClose || $[5] !== classNames?.tagLabel || $[6] !== classNames?.tagRest || $[7] !== disabled || $[8] !== maxTagCount || $[9] !== maxTagPlaceholder || $[10] !== maxTagTextLength || $[11] !== onRemove || $[12] !== options || $[13] !== removeIcon || $[14] !== styles?.tag || $[15] !== styles?.tagClose || $[16] !== styles?.tagLabel || $[17] !== styles?.tagRest || $[18] !== tagRender || $[19] !== visible) {
21
+ const omitted = "number" == typeof maxTagCount ? options.slice(maxTagCount) : [];
22
+ let t4;
23
+ if ($[22] !== maxTagTextLength) {
24
+ t4 = (option)=>{
25
+ const text = "string" == typeof option.label ? option.label : String(option.label);
26
+ return null != maxTagTextLength && text.length > maxTagTextLength ? `${text.slice(0, maxTagTextLength)}…` : option.label;
27
+ };
28
+ $[22] = maxTagTextLength;
29
+ $[23] = t4;
30
+ } else t4 = $[23];
31
+ const label = t4;
32
+ if ($[24] !== classNames?.tag || $[25] !== classNames?.tagClose || $[26] !== classNames?.tagLabel || $[27] !== disabled || $[28] !== label || $[29] !== onRemove || $[30] !== removeIcon || $[31] !== styles?.tag || $[32] !== styles?.tagClose || $[33] !== styles?.tagLabel || $[34] !== tagRender || $[35] !== visible) {
33
+ let t5;
34
+ if ($[37] !== classNames?.tag || $[38] !== classNames?.tagClose || $[39] !== classNames?.tagLabel || $[40] !== disabled || $[41] !== label || $[42] !== onRemove || $[43] !== removeIcon || $[44] !== styles?.tag || $[45] !== styles?.tagClose || $[46] !== styles?.tagLabel || $[47] !== tagRender) {
35
+ t5 = (option_0)=>{
36
+ const closable = !disabled && !option_0.disabled;
37
+ const tag = tagRender ? tagRender({
38
+ label: label(option_0),
39
+ value: option_0.value,
40
+ closable,
41
+ disabled: !!option_0.disabled,
42
+ onClose: (event)=>onRemove(option_0.value, event)
43
+ }) : /*#__PURE__*/ jsxs("span", {
44
+ "data-tao-select-tag": "",
45
+ "data-tao-disabled": option_0.disabled || void 0,
46
+ className: cx(classNames?.tag),
47
+ style: styles?.tag,
48
+ children: [
49
+ /*#__PURE__*/ jsx("span", {
50
+ "data-tao-select-tag-label": "",
51
+ className: cx(classNames?.tagLabel),
52
+ style: styles?.tagLabel,
53
+ children: label(option_0)
54
+ }),
55
+ closable && /*#__PURE__*/ jsx("span", {
56
+ "data-tao-select-tag-close": "",
57
+ className: cx(classNames?.tagClose),
58
+ style: styles?.tagClose,
59
+ role: "button",
60
+ tabIndex: 0,
61
+ "aria-label": `Remove ${"string" == typeof option_0.label ? option_0.label : option_0.value}`,
62
+ onPointerDown: _temp,
63
+ onClick: (event_1)=>onRemove(option_0.value, event_1),
64
+ onKeyDown: (event_2)=>{
65
+ if ("Enter" === event_2.key || " " === event_2.key) onRemove(option_0.value, event_2);
66
+ },
67
+ children: removeIcon ?? /*#__PURE__*/ jsx(CloseIcon, {
68
+ small: true
69
+ })
70
+ })
71
+ ]
72
+ }, option_0.value);
73
+ return /*#__PURE__*/ jsx(external_react_Fragment, {
74
+ children: tag
75
+ }, option_0.value);
76
+ };
77
+ $[37] = classNames?.tag;
78
+ $[38] = classNames?.tagClose;
79
+ $[39] = classNames?.tagLabel;
80
+ $[40] = disabled;
81
+ $[41] = label;
82
+ $[42] = onRemove;
83
+ $[43] = removeIcon;
84
+ $[44] = styles?.tag;
85
+ $[45] = styles?.tagClose;
86
+ $[46] = styles?.tagLabel;
87
+ $[47] = tagRender;
88
+ $[48] = t5;
89
+ } else t5 = $[48];
90
+ t2 = visible.map(t5);
91
+ $[24] = classNames?.tag;
92
+ $[25] = classNames?.tagClose;
93
+ $[26] = classNames?.tagLabel;
94
+ $[27] = disabled;
95
+ $[28] = label;
96
+ $[29] = onRemove;
97
+ $[30] = removeIcon;
98
+ $[31] = styles?.tag;
99
+ $[32] = styles?.tagClose;
100
+ $[33] = styles?.tagLabel;
101
+ $[34] = tagRender;
102
+ $[35] = visible;
103
+ $[36] = t2;
104
+ } else t2 = $[36];
105
+ t3 = omitted.length > 0 && /*#__PURE__*/ jsx("span", {
106
+ "data-tao-select-tag": "",
107
+ "data-tao-select-tag-rest": "",
108
+ className: cx(classNames?.tagRest),
109
+ style: styles?.tagRest,
110
+ children: "function" == typeof maxTagPlaceholder ? maxTagPlaceholder(omitted) : maxTagPlaceholder ?? `+${omitted.length}…`
111
+ });
112
+ $[3] = classNames?.tag;
113
+ $[4] = classNames?.tagClose;
114
+ $[5] = classNames?.tagLabel;
115
+ $[6] = classNames?.tagRest;
116
+ $[7] = disabled;
117
+ $[8] = maxTagCount;
118
+ $[9] = maxTagPlaceholder;
119
+ $[10] = maxTagTextLength;
120
+ $[11] = onRemove;
121
+ $[12] = options;
122
+ $[13] = removeIcon;
123
+ $[14] = styles?.tag;
124
+ $[15] = styles?.tagClose;
125
+ $[16] = styles?.tagLabel;
126
+ $[17] = styles?.tagRest;
127
+ $[18] = tagRender;
128
+ $[19] = visible;
129
+ $[20] = t2;
130
+ $[21] = t3;
131
+ } else {
132
+ t2 = $[20];
133
+ t3 = $[21];
134
+ }
135
+ let t4;
136
+ if ($[49] !== t2 || $[50] !== t3) {
137
+ t4 = /*#__PURE__*/ jsxs(Fragment, {
138
+ children: [
139
+ t2,
140
+ t3
141
+ ]
142
+ });
143
+ $[49] = t2;
144
+ $[50] = t3;
145
+ $[51] = t4;
146
+ } else t4 = $[51];
147
+ return t4;
148
+ }
149
+ function _temp(event_0) {
150
+ return event_0.stopPropagation();
151
+ }
152
+ export { SelectTags };
@@ -0,0 +1,82 @@
1
+ import type { CSSProperties, ReactNode, Ref } from 'react';
2
+ import type { TaoSize, TaoStatus, TaoVariant } from '../../provider/tao-provider';
3
+ import type { SemanticClassNames, SemanticStyles } from '../../utils/semantic';
4
+ export interface SelectOption {
5
+ label: ReactNode;
6
+ value: string;
7
+ disabled?: boolean;
8
+ icon?: ReactNode;
9
+ description?: ReactNode;
10
+ options?: SelectOption[];
11
+ }
12
+ export type SelectSemanticPart = 'root' | 'prefix' | 'suffix' | 'placeholder' | 'clear' | 'popup' | 'search' | 'searchInput' | 'group' | 'groupLabel' | 'item' | 'itemIcon' | 'itemLabel' | 'itemDesc' | 'empty' | 'tag' | 'tagLabel' | 'tagClose' | 'tagRest' | 'values';
13
+ export type SelectPlacement = 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight';
14
+ export interface TagRenderProps {
15
+ label: ReactNode;
16
+ value: string;
17
+ closable: boolean;
18
+ disabled: boolean;
19
+ onClose: (event: React.MouseEvent) => void;
20
+ }
21
+ export interface SelectRef {
22
+ focus: () => void;
23
+ blur: () => void;
24
+ nativeElement: HTMLElement | null;
25
+ }
26
+ export interface SelectProps {
27
+ options: SelectOption[];
28
+ value?: string | string[];
29
+ defaultValue?: string | string[];
30
+ onChange?: (value: string | string[], option?: SelectOption | SelectOption[]) => void;
31
+ onSelect?: (value: string, option: SelectOption) => void;
32
+ onDeselect?: (value: string, option: SelectOption) => void;
33
+ onClear?: () => void;
34
+ mode?: 'multiple' | 'tags';
35
+ placeholder?: string;
36
+ size?: TaoSize;
37
+ variant?: TaoVariant;
38
+ disabled?: boolean;
39
+ status?: TaoStatus;
40
+ showSearch?: boolean;
41
+ filterOption?: (input: string, option: SelectOption) => boolean;
42
+ searchValue?: string;
43
+ onSearch?: (value: string) => void;
44
+ allowClear?: boolean | {
45
+ clearIcon?: ReactNode;
46
+ };
47
+ loading?: boolean;
48
+ loadingIcon?: ReactNode;
49
+ notFoundContent?: ReactNode;
50
+ prefix?: ReactNode;
51
+ suffixIcon?: ReactNode;
52
+ removeIcon?: ReactNode;
53
+ autoFocus?: boolean;
54
+ id?: string;
55
+ name?: string;
56
+ open?: boolean;
57
+ defaultOpen?: boolean;
58
+ onOpenChange?: (open: boolean) => void;
59
+ placement?: SelectPlacement;
60
+ popupMatchSelectWidth?: boolean | number;
61
+ listHeight?: number;
62
+ getPopupContainer?: (trigger: HTMLElement) => HTMLElement;
63
+ optionRender?: (option: SelectOption, info: {
64
+ index: number;
65
+ }) => ReactNode;
66
+ labelRender?: (option: SelectOption) => ReactNode;
67
+ popupRender?: (menu: ReactNode) => ReactNode;
68
+ tagRender?: (props: TagRenderProps) => ReactNode;
69
+ maxTagCount?: number | 'responsive';
70
+ maxTagPlaceholder?: ReactNode | ((omittedValues: SelectOption[]) => ReactNode);
71
+ maxTagTextLength?: number;
72
+ maxCount?: number;
73
+ autoClearSearchValue?: boolean;
74
+ tokenSeparators?: string[];
75
+ hideSelected?: boolean;
76
+ mobile?: boolean;
77
+ className?: string;
78
+ style?: CSSProperties;
79
+ classNames?: SemanticClassNames<SelectSemanticPart>;
80
+ styles?: SemanticStyles<SelectSemanticPart>;
81
+ ref?: Ref<SelectRef>;
82
+ }
File without changes
@@ -190,7 +190,7 @@ button[data-tao-select-clear] {
190
190
 
191
191
  [data-tao-select-loading] {
192
192
  color: var(--tao-color-text-tertiary);
193
- animation: .8s linear infinite tao-spin;
193
+ animation: tao-spin calc(var(--tao-motion-unit) * 8) linear infinite;
194
194
  }
195
195
 
196
196
  @keyframes tao-spin {
@@ -299,6 +299,7 @@ legend[data-tao-select-group-label] {
299
299
  }
300
300
 
301
301
  [data-tao-select-item] {
302
+ box-sizing: border-box;
302
303
  width: 100%;
303
304
  min-height: var(--tao-control-height);
304
305
  padding-inline: var(--tao-padding-sm);