@rockshin/tao-ui 0.0.1 → 0.0.2

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 (59) hide show
  1. package/dist/components/breadcrumb/breadcrumb.css +1088 -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 +43 -21
  5. package/dist/components/checkbox/checkbox.css +30 -12
  6. package/dist/components/collapsible/collapsible.css +1023 -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 +1146 -0
  10. package/dist/components/context-menu/context-menu.d.ts +19 -0
  11. package/dist/components/context-menu/context-menu.js +104 -0
  12. package/dist/components/date-picker/date-picker.css +44 -16
  13. package/dist/components/drawer/drawer.css +123 -13
  14. package/dist/components/drawer/drawer.d.ts +36 -3
  15. package/dist/components/drawer/drawer.js +314 -121
  16. package/dist/components/dropdown/dropdown.css +996 -0
  17. package/dist/components/dropdown/dropdown.d.ts +45 -0
  18. package/dist/components/dropdown/dropdown.js +381 -0
  19. package/dist/components/form-field/form.css +30 -12
  20. package/dist/components/input/input.css +44 -14
  21. package/dist/components/menu/menu-render.d.ts +89 -0
  22. package/dist/components/menu/menu-render.js +376 -0
  23. package/dist/components/menu/menu.css +1142 -0
  24. package/dist/components/modal/confirm-dialog.d.ts +37 -0
  25. package/dist/components/modal/confirm-dialog.js +193 -0
  26. package/dist/components/modal/confirm.d.ts +13 -0
  27. package/dist/components/modal/confirm.js +56 -0
  28. package/dist/components/modal/index.d.ts +21 -0
  29. package/dist/components/modal/index.js +18 -0
  30. package/dist/components/modal/modal.css +1166 -0
  31. package/dist/components/modal/modal.d.ts +50 -0
  32. package/dist/components/modal/modal.js +353 -0
  33. package/dist/components/modal/use-modal.d.ts +21 -0
  34. package/dist/components/modal/use-modal.js +83 -0
  35. package/dist/components/pagination/pagination.css +30 -12
  36. package/dist/components/radio/radio.css +30 -12
  37. package/dist/components/scroll-area/scroll-area.css +30 -12
  38. package/dist/components/select/mobile-select.css +65 -13
  39. package/dist/components/select/mobile-select.js +17 -3
  40. package/dist/components/select/select.css +102 -15
  41. package/dist/components/select/select.d.ts +4 -0
  42. package/dist/components/select/select.js +204 -168
  43. package/dist/components/splitter/splitter.css +30 -12
  44. package/dist/components/switch/switch.css +30 -12
  45. package/dist/components/table/table.css +54 -18
  46. package/dist/components/table/table.d.ts +17 -2
  47. package/dist/components/table/table.js +214 -206
  48. package/dist/components/tabs/tabs.css +33 -17
  49. package/dist/components/tag/tag.css +30 -12
  50. package/dist/components/textarea/textarea.css +1204 -0
  51. package/dist/components/textarea/textarea.d.ts +19 -0
  52. package/dist/components/textarea/textarea.js +181 -0
  53. package/dist/index.d.ts +24 -18
  54. package/dist/index.js +21 -15
  55. package/dist/layouts/stack/layout.css +30 -12
  56. package/dist/theme/control.css +44 -13
  57. package/dist/theme/theme.css +30 -12
  58. package/llms.txt +7 -6
  59. package/package.json +6 -1
@@ -1,164 +1,357 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { c } from "react/compiler-runtime";
3
+ import { useEffect, useRef, useState } from "react";
3
4
  import { cx } from "../../utils/semantic.js";
4
5
  import "./drawer.css";
5
6
  import * as __rspack_external__radix_ui_react_dialog_6b867f3d from "@radix-ui/react-dialog";
7
+ const SIZE_PRESET = {
8
+ default: 378,
9
+ large: 736
10
+ };
11
+ const MIN_DRAG_SIZE = 200;
6
12
  function Drawer(t0) {
7
- const $ = c(42);
8
- const { open, onClose, title, placement: t1, width, height, children, classNames, styles: stylesProp } = t0;
13
+ const $ = c(88);
14
+ const { open, onClose, title, extra, footer, placement: t1, size, width, height, closable: t2, closeIcon, maskClosable: t3, mask: t4, keyboard: t5, resizable, afterOpenChange, afterClose, destroyOnHidden: t6, children, classNames, styles: stylesProp } = t0;
9
15
  const placement = void 0 === t1 ? "right" : t1;
16
+ const closable = void 0 === t2 ? true : t2;
17
+ const maskClosable = void 0 === t3 ? true : t3;
18
+ const mask = void 0 === t4 ? true : t4;
19
+ const keyboard = void 0 === t5 ? true : t5;
20
+ const destroyOnHidden = void 0 === t6 ? true : t6;
21
+ const prevOpen = useRef(open);
22
+ let t7;
23
+ let t8;
24
+ if ($[0] !== afterClose || $[1] !== afterOpenChange || $[2] !== open) {
25
+ t7 = ()=>{
26
+ if (prevOpen.current !== open) {
27
+ afterOpenChange?.(open);
28
+ if (!open) afterClose?.();
29
+ prevOpen.current = open;
30
+ }
31
+ };
32
+ t8 = [
33
+ open,
34
+ afterOpenChange,
35
+ afterClose
36
+ ];
37
+ $[0] = afterClose;
38
+ $[1] = afterOpenChange;
39
+ $[2] = open;
40
+ $[3] = t7;
41
+ $[4] = t8;
42
+ } else {
43
+ t7 = $[3];
44
+ t8 = $[4];
45
+ }
46
+ useEffect(t7, t8);
10
47
  const isHorizontal = "left" === placement || "right" === placement;
48
+ const sizePx = size ? SIZE_PRESET[size] : void 0;
49
+ const resizeCfg = "object" == typeof resizable ? resizable : void 0;
50
+ const isResizable = !!resizable;
51
+ const contentRef = useRef(null);
52
+ const dragRef = useRef(null);
53
+ const [drag, setDrag] = useState(null);
54
+ const dragSize = drag && drag.horizontal === isHorizontal ? drag.size : null;
55
+ let t9;
56
+ if ($[5] !== isHorizontal || $[6] !== resizeCfg) {
57
+ t9 = (e)=>{
58
+ const el = contentRef.current;
59
+ if (!el) return;
60
+ e.preventDefault();
61
+ e.currentTarget.setPointerCapture(e.pointerId);
62
+ const rect = el.getBoundingClientRect();
63
+ dragRef.current = {
64
+ startPos: isHorizontal ? e.clientX : e.clientY,
65
+ startSize: isHorizontal ? rect.width : rect.height
66
+ };
67
+ resizeCfg?.onResizeStart?.();
68
+ };
69
+ $[5] = isHorizontal;
70
+ $[6] = resizeCfg;
71
+ $[7] = t9;
72
+ } else t9 = $[7];
73
+ const onDraggerPointerDown = t9;
74
+ let t10;
75
+ if ($[8] !== isHorizontal || $[9] !== placement || $[10] !== resizeCfg) {
76
+ t10 = (e_0)=>{
77
+ const dragStart = dragRef.current;
78
+ if (!dragStart) return;
79
+ const pos = isHorizontal ? e_0.clientX : e_0.clientY;
80
+ let delta = pos - dragStart.startPos;
81
+ if ("right" === placement || "bottom" === placement) delta = -delta;
82
+ const max = isHorizontal ? window.innerWidth : window.innerHeight;
83
+ const next = Math.max(MIN_DRAG_SIZE, Math.min(dragStart.startSize + delta, max));
84
+ setDrag({
85
+ horizontal: isHorizontal,
86
+ size: next
87
+ });
88
+ resizeCfg?.onResize?.(next);
89
+ };
90
+ $[8] = isHorizontal;
91
+ $[9] = placement;
92
+ $[10] = resizeCfg;
93
+ $[11] = t10;
94
+ } else t10 = $[11];
95
+ const onDraggerPointerMove = t10;
96
+ let t11;
97
+ if ($[12] !== resizeCfg) {
98
+ t11 = (e_1)=>{
99
+ if (!dragRef.current) return;
100
+ dragRef.current = null;
101
+ e_1.currentTarget.releasePointerCapture?.(e_1.pointerId);
102
+ resizeCfg?.onResizeEnd?.();
103
+ };
104
+ $[12] = resizeCfg;
105
+ $[13] = t11;
106
+ } else t11 = $[13];
107
+ const onDraggerPointerUp = t11;
108
+ const t12 = stylesProp?.root;
11
109
  let contentStyle;
12
- if ($[0] !== height || $[1] !== isHorizontal || $[2] !== width) {
13
- contentStyle = {};
14
- if (isHorizontal && null != width) contentStyle.width = "number" == typeof width ? `${width}px` : width;
15
- if (!isHorizontal && null != height) contentStyle.height = "number" == typeof height ? `${height}px` : height;
16
- $[0] = height;
17
- $[1] = isHorizontal;
18
- $[2] = width;
19
- $[3] = contentStyle;
20
- } else contentStyle = $[3];
21
- let t2;
22
- if ($[4] !== onClose) {
23
- t2 = (v)=>{
110
+ if ($[14] !== dragSize || $[15] !== height || $[16] !== isHorizontal || $[17] !== sizePx || $[18] !== t12 || $[19] !== width) {
111
+ contentStyle = {
112
+ ...t12
113
+ };
114
+ if (isHorizontal) {
115
+ const w = dragSize ?? width ?? sizePx;
116
+ if (null != w) contentStyle.width = "number" == typeof w ? `${w}px` : w;
117
+ } else {
118
+ const h = dragSize ?? height ?? sizePx;
119
+ if (null != h) contentStyle.height = "number" == typeof h ? `${h}px` : h;
120
+ }
121
+ $[14] = dragSize;
122
+ $[15] = height;
123
+ $[16] = isHorizontal;
124
+ $[17] = sizePx;
125
+ $[18] = t12;
126
+ $[19] = width;
127
+ $[20] = contentStyle;
128
+ } else contentStyle = $[20];
129
+ const keepAlive = !destroyOnHidden;
130
+ const forceMount = keepAlive ? true : void 0;
131
+ const showHeader = null != title || null != extra || closable;
132
+ let t13;
133
+ if ($[21] !== onClose) {
134
+ t13 = (v)=>{
24
135
  if (!v) onClose?.();
25
136
  };
26
- $[4] = onClose;
27
- $[5] = t2;
28
- } else t2 = $[5];
29
- const t3 = classNames?.overlay;
30
- let t4;
31
- if ($[6] !== t3) {
32
- t4 = cx(t3);
33
- $[6] = t3;
34
- $[7] = t4;
35
- } else t4 = $[7];
36
- const t5 = stylesProp?.overlay;
37
- let t6;
38
- if ($[8] !== t4 || $[9] !== t5) {
39
- t6 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_6b867f3d.Overlay, {
137
+ $[21] = onClose;
138
+ $[22] = t13;
139
+ } else t13 = $[22];
140
+ let t14;
141
+ if ($[23] !== classNames?.overlay || $[24] !== forceMount || $[25] !== mask || $[26] !== stylesProp?.overlay) {
142
+ t14 = mask && /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_6b867f3d.Overlay, {
143
+ forceMount: forceMount,
40
144
  "data-tao-drawer-overlay": "",
41
- className: t4,
42
- style: t5
145
+ className: cx(classNames?.overlay),
146
+ style: stylesProp?.overlay
43
147
  });
44
- $[8] = t4;
45
- $[9] = t5;
46
- $[10] = t6;
47
- } else t6 = $[10];
48
- const t7 = stylesProp?.root;
49
- let t8;
50
- if ($[11] !== contentStyle || $[12] !== t7) {
51
- t8 = {
52
- ...contentStyle,
53
- ...t7
148
+ $[23] = classNames?.overlay;
149
+ $[24] = forceMount;
150
+ $[25] = mask;
151
+ $[26] = stylesProp?.overlay;
152
+ $[27] = t14;
153
+ } else t14 = $[27];
154
+ const t15 = classNames?.root;
155
+ let t16;
156
+ if ($[28] !== t15) {
157
+ t16 = cx(t15);
158
+ $[28] = t15;
159
+ $[29] = t16;
160
+ } else t16 = $[29];
161
+ let t17;
162
+ if ($[30] !== keyboard) {
163
+ t17 = (e_2)=>{
164
+ if (!keyboard) e_2.preventDefault();
54
165
  };
55
- $[11] = contentStyle;
56
- $[12] = t7;
57
- $[13] = t8;
58
- } else t8 = $[13];
59
- const t9 = classNames?.root;
60
- let t10;
61
- if ($[14] !== t9) {
62
- t10 = cx(t9);
63
- $[14] = t9;
64
- $[15] = t10;
65
- } else t10 = $[15];
66
- let t11;
67
- if ($[16] !== classNames?.header || $[17] !== classNames?.title || $[18] !== onClose || $[19] !== stylesProp?.header || $[20] !== stylesProp?.title || $[21] !== title) {
68
- t11 = (null != title || null != onClose) && /*#__PURE__*/ jsxs("div", {
166
+ $[30] = keyboard;
167
+ $[31] = t17;
168
+ } else t17 = $[31];
169
+ let t18;
170
+ let t19;
171
+ if ($[32] !== maskClosable) {
172
+ t18 = (e_3)=>{
173
+ if (!maskClosable) e_3.preventDefault();
174
+ };
175
+ t19 = (e_4)=>{
176
+ if (!maskClosable) e_4.preventDefault();
177
+ };
178
+ $[32] = maskClosable;
179
+ $[33] = t18;
180
+ $[34] = t19;
181
+ } else {
182
+ t18 = $[33];
183
+ t19 = $[34];
184
+ }
185
+ let t20;
186
+ if ($[35] !== classNames?.dragger || $[36] !== isResizable || $[37] !== onDraggerPointerDown || $[38] !== onDraggerPointerMove || $[39] !== onDraggerPointerUp || $[40] !== placement || $[41] !== stylesProp?.dragger) {
187
+ t20 = isResizable && /*#__PURE__*/ jsx("div", {
188
+ "data-tao-drawer-dragger": "",
189
+ "data-tao-placement": placement,
190
+ className: cx(classNames?.dragger),
191
+ style: stylesProp?.dragger,
192
+ onPointerDown: onDraggerPointerDown,
193
+ onPointerMove: onDraggerPointerMove,
194
+ onPointerUp: onDraggerPointerUp
195
+ });
196
+ $[35] = classNames?.dragger;
197
+ $[36] = isResizable;
198
+ $[37] = onDraggerPointerDown;
199
+ $[38] = onDraggerPointerMove;
200
+ $[39] = onDraggerPointerUp;
201
+ $[40] = placement;
202
+ $[41] = stylesProp?.dragger;
203
+ $[42] = t20;
204
+ } else t20 = $[42];
205
+ let t21;
206
+ if ($[43] !== classNames?.close || $[44] !== classNames?.extra || $[45] !== classNames?.header || $[46] !== classNames?.title || $[47] !== closable || $[48] !== closeIcon || $[49] !== extra || $[50] !== onClose || $[51] !== showHeader || $[52] !== stylesProp?.close || $[53] !== stylesProp?.extra || $[54] !== stylesProp?.header || $[55] !== stylesProp?.title || $[56] !== title) {
207
+ t21 = showHeader && /*#__PURE__*/ jsxs("div", {
69
208
  "data-tao-drawer-header": "",
70
209
  className: cx(classNames?.header),
71
210
  style: stylesProp?.header,
72
211
  children: [
73
- null != title && /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_6b867f3d.Title, {
212
+ null != title ? /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_6b867f3d.Title, {
74
213
  "data-tao-drawer-title": "",
75
214
  className: cx(classNames?.title),
76
215
  style: stylesProp?.title,
77
216
  children: title
217
+ }) : /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_6b867f3d.Title, {
218
+ "data-tao-drawer-title": "",
219
+ style: {
220
+ display: "none"
221
+ }
78
222
  }),
79
- null != onClose && /*#__PURE__*/ jsx("button", {
80
- type: "button",
81
- "data-tao-drawer-close": "",
82
- onClick: onClose,
83
- "aria-label": "Close",
84
- children: /*#__PURE__*/ jsx(CloseIcon, {})
223
+ /*#__PURE__*/ jsxs("div", {
224
+ "data-tao-drawer-actions": "",
225
+ children: [
226
+ null != extra && /*#__PURE__*/ jsx("div", {
227
+ "data-tao-drawer-extra": "",
228
+ className: cx(classNames?.extra),
229
+ style: stylesProp?.extra,
230
+ children: extra
231
+ }),
232
+ closable && /*#__PURE__*/ jsx("button", {
233
+ type: "button",
234
+ "data-tao-drawer-close": "",
235
+ className: cx(classNames?.close),
236
+ style: stylesProp?.close,
237
+ onClick: onClose,
238
+ "aria-label": "Close",
239
+ children: closeIcon ?? /*#__PURE__*/ jsx(CloseIcon, {})
240
+ })
241
+ ]
85
242
  })
86
243
  ]
87
244
  });
88
- $[16] = classNames?.header;
89
- $[17] = classNames?.title;
90
- $[18] = onClose;
91
- $[19] = stylesProp?.header;
92
- $[20] = stylesProp?.title;
93
- $[21] = title;
94
- $[22] = t11;
95
- } else t11 = $[22];
96
- const t12 = classNames?.body;
97
- let t13;
98
- if ($[23] !== t12) {
99
- t13 = cx(t12);
100
- $[23] = t12;
101
- $[24] = t13;
102
- } else t13 = $[24];
103
- const t14 = stylesProp?.body;
104
- let t15;
105
- if ($[25] !== children || $[26] !== t13 || $[27] !== t14) {
106
- t15 = /*#__PURE__*/ jsx("div", {
245
+ $[43] = classNames?.close;
246
+ $[44] = classNames?.extra;
247
+ $[45] = classNames?.header;
248
+ $[46] = classNames?.title;
249
+ $[47] = closable;
250
+ $[48] = closeIcon;
251
+ $[49] = extra;
252
+ $[50] = onClose;
253
+ $[51] = showHeader;
254
+ $[52] = stylesProp?.close;
255
+ $[53] = stylesProp?.extra;
256
+ $[54] = stylesProp?.header;
257
+ $[55] = stylesProp?.title;
258
+ $[56] = title;
259
+ $[57] = t21;
260
+ } else t21 = $[57];
261
+ const t22 = classNames?.body;
262
+ let t23;
263
+ if ($[58] !== t22) {
264
+ t23 = cx(t22);
265
+ $[58] = t22;
266
+ $[59] = t23;
267
+ } else t23 = $[59];
268
+ const t24 = stylesProp?.body;
269
+ let t25;
270
+ if ($[60] !== children || $[61] !== t23 || $[62] !== t24) {
271
+ t25 = /*#__PURE__*/ jsx("div", {
107
272
  "data-tao-drawer-body": "",
108
- className: t13,
109
- style: t14,
273
+ className: t23,
274
+ style: t24,
110
275
  children: children
111
276
  });
112
- $[25] = children;
113
- $[26] = t13;
114
- $[27] = t14;
115
- $[28] = t15;
116
- } else t15 = $[28];
117
- let t16;
118
- if ($[29] !== placement || $[30] !== t10 || $[31] !== t11 || $[32] !== t15 || $[33] !== t8) {
119
- t16 = /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_dialog_6b867f3d.Content, {
277
+ $[60] = children;
278
+ $[61] = t23;
279
+ $[62] = t24;
280
+ $[63] = t25;
281
+ } else t25 = $[63];
282
+ let t26;
283
+ if ($[64] !== classNames?.footer || $[65] !== footer || $[66] !== stylesProp?.footer) {
284
+ t26 = null != footer && /*#__PURE__*/ jsx("div", {
285
+ "data-tao-drawer-footer": "",
286
+ className: cx(classNames?.footer),
287
+ style: stylesProp?.footer,
288
+ children: footer
289
+ });
290
+ $[64] = classNames?.footer;
291
+ $[65] = footer;
292
+ $[66] = stylesProp?.footer;
293
+ $[67] = t26;
294
+ } else t26 = $[67];
295
+ let t27;
296
+ if ($[68] !== contentStyle || $[69] !== forceMount || $[70] !== placement || $[71] !== t16 || $[72] !== t17 || $[73] !== t18 || $[74] !== t19 || $[75] !== t20 || $[76] !== t21 || $[77] !== t25 || $[78] !== t26) {
297
+ t27 = /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_dialog_6b867f3d.Content, {
298
+ ref: contentRef,
299
+ forceMount: forceMount,
120
300
  "data-tao-drawer": "",
121
301
  "data-tao-placement": placement,
122
- style: t8,
123
- className: t10,
302
+ style: contentStyle,
303
+ className: t16,
124
304
  "aria-describedby": void 0,
305
+ onEscapeKeyDown: t17,
306
+ onPointerDownOutside: t18,
307
+ onInteractOutside: t19,
125
308
  children: [
126
- t11,
127
- t15
309
+ t20,
310
+ t21,
311
+ t25,
312
+ t26
128
313
  ]
129
314
  });
130
- $[29] = placement;
131
- $[30] = t10;
132
- $[31] = t11;
133
- $[32] = t15;
134
- $[33] = t8;
135
- $[34] = t16;
136
- } else t16 = $[34];
137
- let t17;
138
- if ($[35] !== t16 || $[36] !== t6) {
139
- t17 = /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_dialog_6b867f3d.Portal, {
315
+ $[68] = contentStyle;
316
+ $[69] = forceMount;
317
+ $[70] = placement;
318
+ $[71] = t16;
319
+ $[72] = t17;
320
+ $[73] = t18;
321
+ $[74] = t19;
322
+ $[75] = t20;
323
+ $[76] = t21;
324
+ $[77] = t25;
325
+ $[78] = t26;
326
+ $[79] = t27;
327
+ } else t27 = $[79];
328
+ let t28;
329
+ if ($[80] !== forceMount || $[81] !== t14 || $[82] !== t27) {
330
+ t28 = /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_dialog_6b867f3d.Portal, {
331
+ forceMount: forceMount,
140
332
  children: [
141
- t6,
142
- t16
333
+ t14,
334
+ t27
143
335
  ]
144
336
  });
145
- $[35] = t16;
146
- $[36] = t6;
147
- $[37] = t17;
148
- } else t17 = $[37];
149
- let t18;
150
- if ($[38] !== open || $[39] !== t17 || $[40] !== t2) {
151
- t18 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_6b867f3d.Root, {
337
+ $[80] = forceMount;
338
+ $[81] = t14;
339
+ $[82] = t27;
340
+ $[83] = t28;
341
+ } else t28 = $[83];
342
+ let t29;
343
+ if ($[84] !== open || $[85] !== t13 || $[86] !== t28) {
344
+ t29 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_6b867f3d.Root, {
152
345
  open: open,
153
- onOpenChange: t2,
154
- children: t17
346
+ onOpenChange: t13,
347
+ children: t28
155
348
  });
156
- $[38] = open;
157
- $[39] = t17;
158
- $[40] = t2;
159
- $[41] = t18;
160
- } else t18 = $[41];
161
- return t18;
349
+ $[84] = open;
350
+ $[85] = t13;
351
+ $[86] = t28;
352
+ $[87] = t29;
353
+ } else t29 = $[87];
354
+ return t29;
162
355
  }
163
356
  function CloseIcon() {
164
357
  const $ = c(1);