@rockshin/tao-ui 0.0.1 → 0.0.3

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 (71) hide show
  1. package/dist/components/breadcrumb/breadcrumb.css +1091 -0
  2. package/dist/components/breadcrumb/breadcrumb.d.ts +43 -0
  3. package/dist/components/breadcrumb/breadcrumb.js +268 -0
  4. package/dist/components/button/button.css +46 -21
  5. package/dist/components/checkbox/checkbox.css +33 -12
  6. package/dist/components/collapsible/collapsible.css +1026 -0
  7. package/dist/components/collapsible/collapsible.d.ts +39 -0
  8. package/dist/components/collapsible/collapsible.js +168 -0
  9. package/dist/components/context-menu/context-menu.css +1149 -0
  10. package/dist/components/context-menu/context-menu.d.ts +19 -0
  11. package/dist/components/context-menu/context-menu.js +106 -0
  12. package/dist/components/date-picker/calendar/month-grid.d.ts +1 -1
  13. package/dist/components/date-picker/calendar/time-panel.d.ts +1 -1
  14. package/dist/components/date-picker/calendar/year-grid.d.ts +1 -1
  15. package/dist/components/date-picker/date-picker.css +87 -17
  16. package/dist/components/date-picker/date-picker.js +9 -7
  17. package/dist/components/date-picker/range-picker.js +9 -7
  18. package/dist/components/drawer/drawer.css +128 -15
  19. package/dist/components/drawer/drawer.d.ts +36 -3
  20. package/dist/components/drawer/drawer.js +323 -121
  21. package/dist/components/dropdown/dropdown.css +999 -0
  22. package/dist/components/dropdown/dropdown.d.ts +45 -0
  23. package/dist/components/dropdown/dropdown.js +383 -0
  24. package/dist/components/form-field/form.css +33 -12
  25. package/dist/components/input/input.css +86 -14
  26. package/dist/components/menu/menu-render.d.ts +89 -0
  27. package/dist/components/menu/menu-render.js +379 -0
  28. package/dist/components/menu/menu.css +1145 -0
  29. package/dist/components/modal/confirm-dialog.d.ts +37 -0
  30. package/dist/components/modal/confirm-dialog.js +193 -0
  31. package/dist/components/modal/confirm.d.ts +13 -0
  32. package/dist/components/modal/confirm.js +56 -0
  33. package/dist/components/modal/index.d.ts +21 -0
  34. package/dist/components/modal/index.js +18 -0
  35. package/dist/components/modal/modal.css +1169 -0
  36. package/dist/components/modal/modal.d.ts +50 -0
  37. package/dist/components/modal/modal.js +362 -0
  38. package/dist/components/modal/use-modal.d.ts +21 -0
  39. package/dist/components/modal/use-modal.js +83 -0
  40. package/dist/components/pagination/pagination.css +33 -12
  41. package/dist/components/pagination/pagination.js +3 -1
  42. package/dist/components/radio/radio.css +33 -12
  43. package/dist/components/scroll-area/scroll-area.css +33 -12
  44. package/dist/components/select/mobile-select.css +75 -13
  45. package/dist/components/select/mobile-select.d.ts +4 -1
  46. package/dist/components/select/mobile-select.js +103 -107
  47. package/dist/components/select/select.css +167 -26
  48. package/dist/components/select/select.d.ts +62 -4
  49. package/dist/components/select/select.js +359 -377
  50. package/dist/components/spinner/spinner.css +1084 -0
  51. package/dist/components/spinner/spinner.d.ts +26 -0
  52. package/dist/components/spinner/spinner.js +229 -0
  53. package/dist/components/splitter/splitter.css +33 -12
  54. package/dist/components/switch/switch.css +33 -12
  55. package/dist/components/table/table.css +57 -18
  56. package/dist/components/table/table.d.ts +17 -2
  57. package/dist/components/table/table.js +214 -206
  58. package/dist/components/tabs/tabs.css +36 -17
  59. package/dist/components/tag/tag.css +33 -12
  60. package/dist/components/textarea/textarea.css +1246 -0
  61. package/dist/components/textarea/textarea.d.ts +19 -0
  62. package/dist/components/textarea/textarea.js +181 -0
  63. package/dist/index.d.ts +25 -18
  64. package/dist/index.js +22 -15
  65. package/dist/layouts/stack/layout.css +33 -12
  66. package/dist/provider/tao-provider.d.ts +17 -1
  67. package/dist/provider/tao-provider.js +53 -15
  68. package/dist/theme/control.css +86 -13
  69. package/dist/theme/theme.css +33 -12
  70. package/llms.txt +7 -6
  71. package/package.json +18 -13
@@ -1,7 +1,8 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { c } from "react/compiler-runtime";
3
- import { useState } from "react";
4
- import { useTaoConfig } from "../../provider/tao-provider.js";
3
+ import { useCallback, useMemo, useRef, useState } from "react";
4
+ import { TaoPortalScope, useTaoConfig } from "../../provider/tao-provider.js";
5
+ import { cx } from "../../utils/semantic.js";
5
6
  import { MobileSelectDrawer } from "./mobile-select.js";
6
7
  import "./select.css";
7
8
  import { useIsMobile } from "./use-is-mobile.js";
@@ -10,411 +11,370 @@ const defaultFilter = (input, option)=>{
10
11
  const label = 'string' == typeof option.label ? option.label : String(option.label);
11
12
  return label.toLowerCase().includes(input.toLowerCase());
12
13
  };
14
+ function flattenOptions(options) {
15
+ const out = [];
16
+ for (const o of options)if (o.options) out.push(...flattenOptions(o.options));
17
+ else out.push(o);
18
+ return out;
19
+ }
20
+ function filterTree(options, fn, input) {
21
+ const result = [];
22
+ for (const o of options)if (o.options) {
23
+ const kids = filterTree(o.options, fn, input);
24
+ if (kids.length) result.push({
25
+ ...o,
26
+ options: kids
27
+ });
28
+ } else if (fn(input, o)) result.push(o);
29
+ return result;
30
+ }
31
+ const PLACEMENT_MAP = {
32
+ bottomLeft: {
33
+ side: 'bottom',
34
+ align: 'start'
35
+ },
36
+ bottomRight: {
37
+ side: 'bottom',
38
+ align: 'end'
39
+ },
40
+ topLeft: {
41
+ side: 'top',
42
+ align: 'start'
43
+ },
44
+ topRight: {
45
+ side: 'top',
46
+ align: 'end'
47
+ }
48
+ };
13
49
  function Select(props) {
14
- const $ = c(95);
15
- const { options, value, onChange, placeholder, size, variant, disabled, showSearch, filterOption, allowClear, loading, notFoundContent: t0, prefix, mobile } = props;
16
- const notFoundContent = void 0 === t0 ? "No results" : t0;
50
+ const { options, value: valueProp, defaultValue, onChange, onSelect, onClear, placeholder, size, variant, disabled, status, showSearch, filterOption, searchValue: searchValueProp, onSearch, allowClear, loading, loadingIcon, notFoundContent = 'No results', prefix, suffixIcon, autoFocus, id, name, open: openProp, defaultOpen, onOpenChange, placement = 'bottomLeft', popupMatchSelectWidth = true, listHeight = 256, getPopupContainer, optionRender, labelRender, popupRender, mobile, className, style, classNames, styles } = props;
17
51
  const ctx = useTaoConfig();
18
52
  const resolvedSize = size ?? ctx.size;
19
53
  const resolvedVariant = variant ?? ctx.variant;
20
54
  const resolvedDisabled = disabled ?? ctx.disabled;
21
55
  const autoMobile = useIsMobile();
22
56
  const isMobile = mobile ?? autoMobile;
23
- const [open, setOpen] = useState(false);
24
- const [search, setSearch] = useState("");
57
+ const triggerRef = useRef(null);
58
+ const isValueControlled = void 0 !== valueProp;
59
+ const [valueInternal, setValueInternal] = useState(defaultValue);
60
+ const value = isValueControlled ? valueProp : valueInternal;
61
+ const isOpenControlled = void 0 !== openProp;
62
+ const [openInternal, setOpenInternal] = useState(defaultOpen ?? false);
63
+ const open = isOpenControlled ? openProp : openInternal;
64
+ const isSearchControlled = void 0 !== searchValueProp;
65
+ const [searchInternal, setSearchInternal] = useState('');
66
+ const search = isSearchControlled ? searchValueProp : searchInternal;
25
67
  const [hovering, setHovering] = useState(false);
26
- let t1;
27
- bb0: {
28
- if (!showSearch || !search) {
29
- t1 = options;
30
- break bb0;
31
- }
68
+ const allOptions = useMemo(()=>flattenOptions(options), [
69
+ options
70
+ ]);
71
+ const handleValueChange = useCallback((next)=>{
72
+ const opt = allOptions.find((o)=>o.value === next);
73
+ if (!isValueControlled) setValueInternal(next);
74
+ onChange?.(next, opt);
75
+ if (opt) onSelect?.(next, opt);
76
+ }, [
77
+ allOptions,
78
+ isValueControlled,
79
+ onChange,
80
+ onSelect
81
+ ]);
82
+ const handleOpenChange = useCallback((next_0)=>{
83
+ if (!isOpenControlled) setOpenInternal(next_0);
84
+ if (!next_0 && !isSearchControlled) setSearchInternal('');
85
+ onOpenChange?.(next_0);
86
+ }, [
87
+ isOpenControlled,
88
+ isSearchControlled,
89
+ onOpenChange
90
+ ]);
91
+ const handleSearchChange = useCallback((v)=>{
92
+ if (!isSearchControlled) setSearchInternal(v);
93
+ onSearch?.(v);
94
+ }, [
95
+ isSearchControlled,
96
+ onSearch
97
+ ]);
98
+ const handleClear = useCallback((e)=>{
99
+ e.stopPropagation();
100
+ if (!isValueControlled) setValueInternal(void 0);
101
+ onChange?.('', void 0);
102
+ onClear?.();
103
+ }, [
104
+ isValueControlled,
105
+ onChange,
106
+ onClear
107
+ ]);
108
+ const filteredOptions = useMemo(()=>{
109
+ if (!showSearch || !search) return options;
32
110
  const fn = filterOption ?? defaultFilter;
33
- let t2;
34
- if ($[0] !== fn || $[1] !== options || $[2] !== search) {
35
- let t3;
36
- if ($[4] !== fn || $[5] !== search) {
37
- t3 = (o)=>fn(search, o);
38
- $[4] = fn;
39
- $[5] = search;
40
- $[6] = t3;
41
- } else t3 = $[6];
42
- t2 = options.filter(t3);
43
- $[0] = fn;
44
- $[1] = options;
45
- $[2] = search;
46
- $[3] = t2;
47
- } else t2 = $[3];
48
- t1 = t2;
49
- }
50
- const filteredOptions = t1;
51
- let t2;
52
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
53
- t2 = (nextOpen)=>{
54
- setOpen(nextOpen);
55
- if (!nextOpen) setSearch("");
56
- };
57
- $[7] = t2;
58
- } else t2 = $[7];
59
- const handleOpenChange = t2;
60
- let t3;
61
- if ($[8] !== onChange) {
62
- t3 = (e)=>{
63
- e.stopPropagation();
64
- onChange?.("");
65
- };
66
- $[8] = onChange;
67
- $[9] = t3;
68
- } else t3 = $[9];
69
- const handleClear = t3;
70
- const showClearBtn = allowClear && value && !resolvedDisabled;
71
- let t4;
72
- if ($[10] !== options || $[11] !== value) {
73
- let t5;
74
- if ($[13] !== value) {
75
- t5 = (o_0)=>o_0.value === value;
76
- $[13] = value;
77
- $[14] = t5;
78
- } else t5 = $[14];
79
- t4 = options.find(t5);
80
- $[10] = options;
81
- $[11] = value;
82
- $[12] = t4;
83
- } else t4 = $[12];
84
- const selectedOption = t4;
85
- if (isMobile) {
86
- const t5 = resolvedDisabled || void 0;
87
- let t6;
88
- let t7;
89
- let t8;
90
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
91
- t6 = ()=>setOpen(true);
92
- t7 = ()=>setHovering(true);
93
- t8 = ()=>setHovering(false);
94
- $[15] = t6;
95
- $[16] = t7;
96
- $[17] = t8;
97
- } else {
98
- t6 = $[15];
99
- t7 = $[16];
100
- t8 = $[17];
101
- }
102
- let t9;
103
- if ($[18] !== prefix) {
104
- t9 = null != prefix && /*#__PURE__*/ jsx("span", {
105
- "data-tao-select-prefix": "",
106
- children: prefix
107
- });
108
- $[18] = prefix;
109
- $[19] = t9;
110
- } else t9 = $[19];
111
- let t10;
112
- if ($[20] !== placeholder || $[21] !== selectedOption) {
113
- t10 = selectedOption ? selectedOption.label : /*#__PURE__*/ jsx("span", {
114
- "data-tao-select-placeholder": "",
115
- children: placeholder
116
- });
117
- $[20] = placeholder;
118
- $[21] = selectedOption;
119
- $[22] = t10;
120
- } else t10 = $[22];
121
- let t11;
122
- if ($[23] !== t10) {
123
- t11 = /*#__PURE__*/ jsx("span", {
124
- "data-tao-select-value": "",
125
- children: t10
126
- });
127
- $[23] = t10;
128
- $[24] = t11;
129
- } else t11 = $[24];
130
- let t12;
131
- if ($[25] !== loading) {
132
- t12 = loading && /*#__PURE__*/ jsx(LoadingIcon, {});
133
- $[25] = loading;
134
- $[26] = t12;
135
- } else t12 = $[26];
136
- let t13;
137
- if ($[27] !== handleClear || $[28] !== hovering || $[29] !== showClearBtn) {
138
- t13 = showClearBtn && hovering ? /*#__PURE__*/ jsx("span", {
139
- "data-tao-select-clear": "",
140
- onClick: handleClear,
141
- role: "button",
142
- "aria-label": "Clear",
143
- children: /*#__PURE__*/ jsx(CloseIcon, {})
144
- }) : /*#__PURE__*/ jsx("span", {
145
- "data-tao-select-icon": "",
146
- children: /*#__PURE__*/ jsx(ChevronDownIcon, {})
147
- });
148
- $[27] = handleClear;
149
- $[28] = hovering;
150
- $[29] = showClearBtn;
151
- $[30] = t13;
152
- } else t13 = $[30];
153
- let t14;
154
- if ($[31] !== t12 || $[32] !== t13) {
155
- t14 = /*#__PURE__*/ jsxs("span", {
156
- "data-tao-select-icons": "",
157
- children: [
158
- t12,
159
- t13
160
- ]
161
- });
162
- $[31] = t12;
163
- $[32] = t13;
164
- $[33] = t14;
165
- } else t14 = $[33];
166
- let t15;
167
- if ($[34] !== resolvedDisabled || $[35] !== resolvedSize || $[36] !== resolvedVariant || $[37] !== t11 || $[38] !== t14 || $[39] !== t5 || $[40] !== t9) {
168
- t15 = /*#__PURE__*/ jsxs("button", {
111
+ return filterTree(options, fn, search);
112
+ }, [
113
+ options,
114
+ search,
115
+ showSearch,
116
+ filterOption
117
+ ]);
118
+ const allowClearEnabled = !!allowClear;
119
+ const clearIcon = 'object' == typeof allowClear && allowClear.clearIcon || /*#__PURE__*/ jsx(CloseIcon, {});
120
+ const showClearBtn = allowClearEnabled && !!value && !resolvedDisabled;
121
+ const selectedOption = allOptions.find((o_0)=>o_0.value === value);
122
+ const statusProps = {
123
+ 'data-tao-error': 'error' === status || void 0,
124
+ 'data-tao-warning': 'warning' === status || void 0
125
+ };
126
+ const triggerLabel = selectedOption ? labelRender ? labelRender(selectedOption) : selectedOption.label : /*#__PURE__*/ jsx("span", {
127
+ "data-tao-select-placeholder": "",
128
+ className: cx(classNames?.placeholder),
129
+ style: styles?.placeholder,
130
+ children: placeholder
131
+ });
132
+ const trailingIcons = /*#__PURE__*/ jsx("span", {
133
+ "data-tao-select-icons": "",
134
+ children: loading ? /*#__PURE__*/ jsx("span", {
135
+ "data-tao-select-icon": "",
136
+ "data-tao-select-loading-slot": "",
137
+ children: loadingIcon ?? /*#__PURE__*/ jsx(LoadingIcon, {})
138
+ }) : showClearBtn && hovering ? /*#__PURE__*/ jsx("span", {
139
+ "data-tao-select-clear": "",
140
+ className: cx(classNames?.clear),
141
+ style: styles?.clear,
142
+ onPointerDown: (e_0)=>e_0.stopPropagation(),
143
+ onClick: handleClear,
144
+ role: "button",
145
+ "aria-label": "Clear",
146
+ children: clearIcon
147
+ }) : /*#__PURE__*/ jsx("span", {
148
+ "data-tao-select-icon": "",
149
+ "data-tao-custom-suffix": null != suffixIcon || void 0,
150
+ className: cx(classNames?.suffix),
151
+ style: styles?.suffix,
152
+ children: suffixIcon ?? /*#__PURE__*/ jsx(ChevronDownIcon, {})
153
+ })
154
+ });
155
+ if (isMobile) return /*#__PURE__*/ jsxs(Fragment, {
156
+ children: [
157
+ /*#__PURE__*/ jsxs("button", {
169
158
  type: "button",
159
+ id: id,
170
160
  "data-tao-control": "",
171
161
  "data-tao-select": "",
172
162
  "data-tao-size": resolvedSize,
173
163
  "data-tao-variant": resolvedVariant,
174
- "data-tao-disabled": t5,
164
+ "data-tao-disabled": resolvedDisabled || void 0,
165
+ ...statusProps,
175
166
  disabled: resolvedDisabled,
176
- onClick: t6,
177
- onMouseEnter: t7,
178
- onMouseLeave: t8,
167
+ autoFocus: autoFocus,
168
+ className: cx(classNames?.root, className),
169
+ style: {
170
+ ...styles?.root,
171
+ ...style
172
+ },
173
+ onClick: ()=>handleOpenChange(true),
174
+ onMouseEnter: ()=>setHovering(true),
175
+ onMouseLeave: ()=>setHovering(false),
179
176
  children: [
180
- t9,
181
- t11,
182
- t14
177
+ null != prefix && /*#__PURE__*/ jsx("span", {
178
+ "data-tao-select-prefix": "",
179
+ className: cx(classNames?.prefix),
180
+ style: styles?.prefix,
181
+ children: prefix
182
+ }),
183
+ selectedOption?.icon != null && /*#__PURE__*/ jsx("span", {
184
+ "data-tao-select-value-icon": "",
185
+ children: selectedOption.icon
186
+ }),
187
+ /*#__PURE__*/ jsx("span", {
188
+ "data-tao-select-value": "",
189
+ children: triggerLabel
190
+ }),
191
+ trailingIcons
183
192
  ]
184
- });
185
- $[34] = resolvedDisabled;
186
- $[35] = resolvedSize;
187
- $[36] = resolvedVariant;
188
- $[37] = t11;
189
- $[38] = t14;
190
- $[39] = t5;
191
- $[40] = t9;
192
- $[41] = t15;
193
- } else t15 = $[41];
194
- let t16;
195
- if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
196
- t16 = ()=>handleOpenChange(false);
197
- $[42] = t16;
198
- } else t16 = $[42];
199
- let t17;
200
- if ($[43] !== filterOption || $[44] !== notFoundContent || $[45] !== onChange || $[46] !== open || $[47] !== options || $[48] !== placeholder || $[49] !== showSearch || $[50] !== value) {
201
- t17 = /*#__PURE__*/ jsx(MobileSelectDrawer, {
193
+ }),
194
+ /*#__PURE__*/ jsx(MobileSelectDrawer, {
202
195
  open: open,
203
- onClose: t16,
196
+ onClose: ()=>handleOpenChange(false),
204
197
  options: options,
205
198
  value: value,
206
- onChange: onChange,
199
+ onChange: handleValueChange,
207
200
  placeholder: placeholder,
208
201
  showSearch: showSearch,
209
202
  filterOption: filterOption,
210
- notFoundContent: notFoundContent
211
- });
212
- $[43] = filterOption;
213
- $[44] = notFoundContent;
214
- $[45] = onChange;
215
- $[46] = open;
216
- $[47] = options;
217
- $[48] = placeholder;
218
- $[49] = showSearch;
219
- $[50] = value;
220
- $[51] = t17;
221
- } else t17 = $[51];
222
- let t18;
223
- if ($[52] !== t15 || $[53] !== t17) {
224
- t18 = /*#__PURE__*/ jsxs(Fragment, {
225
- children: [
226
- t15,
227
- t17
228
- ]
229
- });
230
- $[52] = t15;
231
- $[53] = t17;
232
- $[54] = t18;
233
- } else t18 = $[54];
234
- return t18;
235
- }
236
- const t5 = resolvedDisabled || void 0;
237
- let t6;
238
- let t7;
239
- if ($[55] === Symbol.for("react.memo_cache_sentinel")) {
240
- t6 = ()=>setHovering(true);
241
- t7 = ()=>setHovering(false);
242
- $[55] = t6;
243
- $[56] = t7;
244
- } else {
245
- t6 = $[55];
246
- t7 = $[56];
247
- }
248
- let t8;
249
- if ($[57] !== prefix) {
250
- t8 = null != prefix && /*#__PURE__*/ jsx("span", {
251
- "data-tao-select-prefix": "",
252
- children: prefix
253
- });
254
- $[57] = prefix;
255
- $[58] = t8;
256
- } else t8 = $[58];
257
- let t9;
258
- if ($[59] !== placeholder) {
259
- t9 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_36a82244.Value, {
260
- placeholder: placeholder
261
- });
262
- $[59] = placeholder;
263
- $[60] = t9;
264
- } else t9 = $[60];
265
- let t10;
266
- if ($[61] !== loading) {
267
- t10 = loading && /*#__PURE__*/ jsx(LoadingIcon, {});
268
- $[61] = loading;
269
- $[62] = t10;
270
- } else t10 = $[62];
271
- let t11;
272
- if ($[63] !== handleClear || $[64] !== hovering || $[65] !== showClearBtn) {
273
- t11 = showClearBtn && hovering ? /*#__PURE__*/ jsx("span", {
274
- "data-tao-select-clear": "",
275
- onClick: handleClear,
276
- role: "button",
277
- "aria-label": "Clear",
278
- children: /*#__PURE__*/ jsx(CloseIcon, {})
279
- }) : /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_36a82244.Icon, {
280
- "data-tao-select-icon": "",
281
- children: /*#__PURE__*/ jsx(ChevronDownIcon, {})
282
- });
283
- $[63] = handleClear;
284
- $[64] = hovering;
285
- $[65] = showClearBtn;
286
- $[66] = t11;
287
- } else t11 = $[66];
288
- let t12;
289
- if ($[67] !== t10 || $[68] !== t11) {
290
- t12 = /*#__PURE__*/ jsxs("span", {
291
- "data-tao-select-icons": "",
292
- children: [
293
- t10,
294
- t11
295
- ]
296
- });
297
- $[67] = t10;
298
- $[68] = t11;
299
- $[69] = t12;
300
- } else t12 = $[69];
301
- let t13;
302
- if ($[70] !== resolvedSize || $[71] !== resolvedVariant || $[72] !== t12 || $[73] !== t5 || $[74] !== t8 || $[75] !== t9) {
303
- t13 = /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_select_36a82244.Trigger, {
304
- "data-tao-control": "",
305
- "data-tao-select": "",
306
- "data-tao-size": resolvedSize,
307
- "data-tao-variant": resolvedVariant,
308
- "data-tao-disabled": t5,
309
- onMouseEnter: t6,
310
- onMouseLeave: t7,
311
- children: [
312
- t8,
313
- t9,
314
- t12
315
- ]
316
- });
317
- $[70] = resolvedSize;
318
- $[71] = resolvedVariant;
319
- $[72] = t12;
320
- $[73] = t5;
321
- $[74] = t8;
322
- $[75] = t9;
323
- $[76] = t13;
324
- } else t13 = $[76];
325
- let t14;
326
- if ($[77] !== search || $[78] !== showSearch) {
327
- t14 = showSearch && /*#__PURE__*/ jsxs("div", {
328
- "data-tao-select-search": "",
203
+ notFoundContent: notFoundContent,
204
+ optionRender: optionRender
205
+ })
206
+ ]
207
+ });
208
+ const { side, align } = PLACEMENT_MAP[placement];
209
+ const contentStyle = {
210
+ ...styles?.popup
211
+ };
212
+ if ('number' == typeof popupMatchSelectWidth) contentStyle.width = popupMatchSelectWidth;
213
+ const resultCount = flattenOptions(filteredOptions).length;
214
+ let optIndex = 0;
215
+ const renderItem = (opt_0)=>{
216
+ const index = optIndex++;
217
+ const textLabel = 'string' == typeof opt_0.label ? opt_0.label : String(opt_0.label);
218
+ return /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_select_36a82244.Item, {
219
+ value: opt_0.value,
220
+ disabled: opt_0.disabled,
221
+ "data-tao-select-item": "",
222
+ "data-tao-has-desc": null != opt_0.description || void 0,
223
+ className: cx(classNames?.item),
224
+ style: styles?.item,
329
225
  children: [
330
- /*#__PURE__*/ jsx(SearchIcon, {}),
331
- /*#__PURE__*/ jsx("input", {
332
- "data-tao-select-search-input": "",
333
- value: search,
334
- onChange: (e_0)=>setSearch(e_0.target.value),
335
- placeholder: "Search...",
336
- autoFocus: true
226
+ optionRender ? /*#__PURE__*/ jsxs(Fragment, {
227
+ children: [
228
+ optionRender(opt_0, {
229
+ index
230
+ }),
231
+ /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_36a82244.ItemText, {
232
+ style: {
233
+ display: 'none'
234
+ },
235
+ children: textLabel
236
+ })
237
+ ]
238
+ }) : /*#__PURE__*/ jsxs(Fragment, {
239
+ children: [
240
+ null != opt_0.icon && /*#__PURE__*/ jsx("span", {
241
+ "data-tao-select-item-icon": "",
242
+ className: cx(classNames?.itemIcon),
243
+ style: styles?.itemIcon,
244
+ children: opt_0.icon
245
+ }),
246
+ /*#__PURE__*/ jsxs("span", {
247
+ "data-tao-select-item-main": "",
248
+ className: cx(classNames?.itemLabel),
249
+ style: styles?.itemLabel,
250
+ children: [
251
+ /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_36a82244.ItemText, {
252
+ children: opt_0.label
253
+ }),
254
+ null != opt_0.description && /*#__PURE__*/ jsx("span", {
255
+ "data-tao-select-item-desc": "",
256
+ className: cx(classNames?.itemDesc),
257
+ style: styles?.itemDesc,
258
+ children: opt_0.description
259
+ })
260
+ ]
261
+ })
262
+ ]
263
+ }),
264
+ /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_36a82244.ItemIndicator, {
265
+ "data-tao-select-check": "",
266
+ children: /*#__PURE__*/ jsx(CheckIcon, {})
337
267
  })
338
268
  ]
339
- });
340
- $[77] = search;
341
- $[78] = showSearch;
342
- $[79] = t14;
343
- } else t14 = $[79];
344
- let t15;
345
- if ($[80] !== filteredOptions || $[81] !== notFoundContent) {
346
- t15 = filteredOptions.length > 0 ? filteredOptions.map(_temp) : /*#__PURE__*/ jsx("div", {
347
- "data-tao-select-empty": "",
348
- children: notFoundContent
349
- });
350
- $[80] = filteredOptions;
351
- $[81] = notFoundContent;
352
- $[82] = t15;
353
- } else t15 = $[82];
354
- let t16;
355
- if ($[83] !== t15) {
356
- t16 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_36a82244.Viewport, {
357
- "data-tao-select-viewport": "",
358
- children: t15
359
- });
360
- $[83] = t15;
361
- $[84] = t16;
362
- } else t16 = $[84];
363
- let t17;
364
- if ($[85] !== t14 || $[86] !== t16) {
365
- t17 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_36a82244.Portal, {
366
- children: /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_select_36a82244.Content, {
367
- "data-tao-select-content": "",
368
- position: "popper",
369
- sideOffset: 4,
269
+ }, opt_0.value);
270
+ };
271
+ const renderTree = (opts)=>opts.map((o_1)=>o_1.options ? /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_select_36a82244.Group, {
272
+ "data-tao-select-group": "",
273
+ className: cx(classNames?.group),
274
+ style: styles?.group,
370
275
  children: [
371
- t14,
372
- t16
276
+ /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_36a82244.Label, {
277
+ "data-tao-select-group-label": "",
278
+ className: cx(classNames?.groupLabel),
279
+ style: styles?.groupLabel,
280
+ children: o_1.label
281
+ }),
282
+ o_1.options.map(renderItem)
373
283
  ]
284
+ }, o_1.value) : renderItem(o_1));
285
+ const menuNode = /*#__PURE__*/ jsxs(Fragment, {
286
+ children: [
287
+ showSearch && /*#__PURE__*/ jsxs("div", {
288
+ "data-tao-select-search": "",
289
+ className: cx(classNames?.search),
290
+ style: styles?.search,
291
+ children: [
292
+ /*#__PURE__*/ jsx(SearchIcon, {}),
293
+ /*#__PURE__*/ jsx("input", {
294
+ "data-tao-select-search-input": "",
295
+ value: search,
296
+ onChange: (e_1)=>handleSearchChange(e_1.target.value),
297
+ placeholder: "Search...",
298
+ autoFocus: true
299
+ })
300
+ ]
301
+ }),
302
+ /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_36a82244.Viewport, {
303
+ "data-tao-select-viewport": "",
304
+ style: {
305
+ maxHeight: listHeight
306
+ },
307
+ children: resultCount > 0 ? renderTree(filteredOptions) : /*#__PURE__*/ jsx("div", {
308
+ "data-tao-select-empty": "",
309
+ className: cx(classNames?.empty),
310
+ style: styles?.empty,
311
+ children: notFoundContent
312
+ })
374
313
  })
375
- });
376
- $[85] = t14;
377
- $[86] = t16;
378
- $[87] = t17;
379
- } else t17 = $[87];
380
- let t18;
381
- if ($[88] !== onChange || $[89] !== open || $[90] !== resolvedDisabled || $[91] !== t13 || $[92] !== t17 || $[93] !== value) {
382
- t18 = /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_select_36a82244.Root, {
383
- value: value,
384
- onValueChange: onChange,
385
- disabled: resolvedDisabled,
386
- open: open,
387
- onOpenChange: handleOpenChange,
388
- children: [
389
- t13,
390
- t17
391
- ]
392
- });
393
- $[88] = onChange;
394
- $[89] = open;
395
- $[90] = resolvedDisabled;
396
- $[91] = t13;
397
- $[92] = t17;
398
- $[93] = value;
399
- $[94] = t18;
400
- } else t18 = $[94];
401
- return t18;
402
- }
403
- function _temp(opt) {
404
- return /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_select_36a82244.Item, {
405
- value: opt.value,
406
- disabled: opt.disabled,
407
- "data-tao-select-item": "",
314
+ ]
315
+ });
316
+ const container = getPopupContainer && triggerRef.current ? getPopupContainer(triggerRef.current) : void 0;
317
+ return /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_select_36a82244.Root, {
318
+ value: value || void 0,
319
+ onValueChange: handleValueChange,
320
+ disabled: resolvedDisabled,
321
+ open: open,
322
+ onOpenChange: handleOpenChange,
323
+ name: name,
408
324
  children: [
409
- /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_36a82244.ItemText, {
410
- children: opt.label
325
+ /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_select_36a82244.Trigger, {
326
+ ref: triggerRef,
327
+ id: id,
328
+ "data-tao-control": "",
329
+ "data-tao-select": "",
330
+ "data-tao-size": resolvedSize,
331
+ "data-tao-variant": resolvedVariant,
332
+ "data-tao-disabled": resolvedDisabled || void 0,
333
+ ...statusProps,
334
+ autoFocus: autoFocus,
335
+ className: cx(classNames?.root, className),
336
+ style: {
337
+ ...styles?.root,
338
+ ...style
339
+ },
340
+ onMouseEnter: ()=>setHovering(true),
341
+ onMouseLeave: ()=>setHovering(false),
342
+ children: [
343
+ null != prefix && /*#__PURE__*/ jsx("span", {
344
+ "data-tao-select-prefix": "",
345
+ className: cx(classNames?.prefix),
346
+ style: styles?.prefix,
347
+ children: prefix
348
+ }),
349
+ selectedOption?.icon != null && /*#__PURE__*/ jsx("span", {
350
+ "data-tao-select-value-icon": "",
351
+ children: selectedOption.icon
352
+ }),
353
+ /*#__PURE__*/ jsx("span", {
354
+ "data-tao-select-value": "",
355
+ children: triggerLabel
356
+ }),
357
+ trailingIcons
358
+ ]
411
359
  }),
412
- /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_36a82244.ItemIndicator, {
413
- "data-tao-select-check": "",
414
- children: /*#__PURE__*/ jsx(CheckIcon, {})
360
+ /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_36a82244.Portal, {
361
+ container: container,
362
+ children: /*#__PURE__*/ jsx(TaoPortalScope, {
363
+ children: /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_36a82244.Content, {
364
+ "data-tao-select-content": "",
365
+ "data-tao-popup-width": false === popupMatchSelectWidth ? 'content' : void 0,
366
+ className: cx(classNames?.popup),
367
+ style: contentStyle,
368
+ position: "popper",
369
+ side: side,
370
+ align: align,
371
+ sideOffset: 4,
372
+ children: popupRender ? popupRender(menuNode) : menuNode
373
+ })
374
+ })
415
375
  })
416
376
  ]
417
- }, opt.value);
377
+ });
418
378
  }
419
379
  function ChevronDownIcon() {
420
380
  const $ = c(1);
@@ -437,6 +397,28 @@ function ChevronDownIcon() {
437
397
  } else t0 = $[0];
438
398
  return t0;
439
399
  }
400
+ function ChevronsUpDownIcon() {
401
+ const $ = c(1);
402
+ let t0;
403
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
404
+ t0 = /*#__PURE__*/ jsx("svg", {
405
+ width: "16",
406
+ height: "16",
407
+ viewBox: "0 0 24 24",
408
+ fill: "none",
409
+ stroke: "currentColor",
410
+ strokeWidth: "2",
411
+ strokeLinecap: "round",
412
+ strokeLinejoin: "round",
413
+ "aria-hidden": "true",
414
+ children: /*#__PURE__*/ jsx("path", {
415
+ d: "m7 15 5 5 5-5M7 9l5-5 5 5"
416
+ })
417
+ });
418
+ $[0] = t0;
419
+ } else t0 = $[0];
420
+ return t0;
421
+ }
440
422
  function CheckIcon() {
441
423
  const $ = c(1);
442
424
  let t0;
@@ -513,8 +495,8 @@ function LoadingIcon() {
513
495
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
514
496
  t0 = /*#__PURE__*/ jsx("svg", {
515
497
  "data-tao-select-loading": "",
516
- width: "14",
517
- height: "14",
498
+ width: "16",
499
+ height: "16",
518
500
  viewBox: "0 0 24 24",
519
501
  fill: "none",
520
502
  stroke: "currentColor",
@@ -529,4 +511,4 @@ function LoadingIcon() {
529
511
  } else t0 = $[0];
530
512
  return t0;
531
513
  }
532
- export { Select };
514
+ export { ChevronsUpDownIcon, Select };