@rockshin/tao-ui 0.0.1

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/LICENSE +21 -0
  2. package/README.md +65 -0
  3. package/dist/components/button/button.css +1055 -0
  4. package/dist/components/button/button.d.ts +15 -0
  5. package/dist/components/button/button.js +93 -0
  6. package/dist/components/checkbox/checkbox.css +1035 -0
  7. package/dist/components/checkbox/checkbox.d.ts +33 -0
  8. package/dist/components/checkbox/checkbox.js +312 -0
  9. package/dist/components/date-picker/calendar/calendar-grid.d.ts +18 -0
  10. package/dist/components/date-picker/calendar/calendar-grid.js +173 -0
  11. package/dist/components/date-picker/calendar/calendar-header.d.ts +10 -0
  12. package/dist/components/date-picker/calendar/calendar-header.js +336 -0
  13. package/dist/components/date-picker/calendar/month-grid.d.ts +9 -0
  14. package/dist/components/date-picker/calendar/month-grid.js +61 -0
  15. package/dist/components/date-picker/calendar/time-panel.d.ts +12 -0
  16. package/dist/components/date-picker/calendar/time-panel.js +233 -0
  17. package/dist/components/date-picker/calendar/use-calendar.d.ts +15 -0
  18. package/dist/components/date-picker/calendar/use-calendar.js +24 -0
  19. package/dist/components/date-picker/calendar/year-grid.d.ts +9 -0
  20. package/dist/components/date-picker/calendar/year-grid.js +60 -0
  21. package/dist/components/date-picker/date-picker.css +1799 -0
  22. package/dist/components/date-picker/date-picker.d.ts +29 -0
  23. package/dist/components/date-picker/date-picker.js +663 -0
  24. package/dist/components/date-picker/presets.d.ts +9 -0
  25. package/dist/components/date-picker/presets.js +36 -0
  26. package/dist/components/date-picker/range-picker.d.ts +30 -0
  27. package/dist/components/date-picker/range-picker.js +432 -0
  28. package/dist/components/date-picker/types.d.ts +39 -0
  29. package/dist/components/date-picker/types.js +7 -0
  30. package/dist/components/drawer/drawer.css +1112 -0
  31. package/dist/components/drawer/drawer.d.ts +17 -0
  32. package/dist/components/drawer/drawer.js +184 -0
  33. package/dist/components/form-actions/form-actions.d.ts +12 -0
  34. package/dist/components/form-actions/form-actions.js +42 -0
  35. package/dist/components/form-field/form-field.d.ts +17 -0
  36. package/dist/components/form-field/form-field.js +101 -0
  37. package/dist/components/form-field/form.css +1036 -0
  38. package/dist/components/form-section/form-section.d.ts +14 -0
  39. package/dist/components/form-section/form-section.js +92 -0
  40. package/dist/components/input/input.css +1185 -0
  41. package/dist/components/input/input.d.ts +15 -0
  42. package/dist/components/input/input.js +143 -0
  43. package/dist/components/pagination/pagination.css +1099 -0
  44. package/dist/components/pagination/pagination.d.ts +22 -0
  45. package/dist/components/pagination/pagination.js +310 -0
  46. package/dist/components/radio/radio.css +1045 -0
  47. package/dist/components/radio/radio.d.ts +34 -0
  48. package/dist/components/radio/radio.js +215 -0
  49. package/dist/components/scroll-area/scroll-area.css +1099 -0
  50. package/dist/components/scroll-area/scroll-area.d.ts +33 -0
  51. package/dist/components/scroll-area/scroll-area.js +375 -0
  52. package/dist/components/select/mobile-select.css +1044 -0
  53. package/dist/components/select/mobile-select.d.ts +19 -0
  54. package/dist/components/select/mobile-select.js +224 -0
  55. package/dist/components/select/select.css +1327 -0
  56. package/dist/components/select/select.d.ts +32 -0
  57. package/dist/components/select/select.js +532 -0
  58. package/dist/components/select/use-is-mobile.d.ts +1 -0
  59. package/dist/components/select/use-is-mobile.js +30 -0
  60. package/dist/components/splitter/splitter.css +1104 -0
  61. package/dist/components/splitter/splitter.d.ts +33 -0
  62. package/dist/components/splitter/splitter.js +451 -0
  63. package/dist/components/switch/switch.css +1170 -0
  64. package/dist/components/switch/switch.d.ts +19 -0
  65. package/dist/components/switch/switch.js +143 -0
  66. package/dist/components/table/table.css +1255 -0
  67. package/dist/components/table/table.d.ts +73 -0
  68. package/dist/components/table/table.js +1022 -0
  69. package/dist/components/tabs/tabs.css +1076 -0
  70. package/dist/components/tabs/tabs.d.ts +24 -0
  71. package/dist/components/tabs/tabs.js +256 -0
  72. package/dist/components/tag/tag.css +1124 -0
  73. package/dist/components/tag/tag.d.ts +33 -0
  74. package/dist/components/tag/tag.js +237 -0
  75. package/dist/index.d.ts +23 -0
  76. package/dist/index.js +23 -0
  77. package/dist/layouts/form-layout/form-layout.d.ts +6 -0
  78. package/dist/layouts/form-layout/form-layout.js +18 -0
  79. package/dist/layouts/stack/layout.css +1003 -0
  80. package/dist/layouts/stack/stack.d.ts +9 -0
  81. package/dist/layouts/stack/stack.js +27 -0
  82. package/dist/number-input/cursor.d.ts +9 -0
  83. package/dist/number-input/cursor.js +44 -0
  84. package/dist/number-input/format.d.ts +5 -0
  85. package/dist/number-input/format.js +50 -0
  86. package/dist/number-input/index.d.ts +5 -0
  87. package/dist/number-input/index.js +2 -0
  88. package/dist/number-input/number-input.d.ts +9 -0
  89. package/dist/number-input/number-input.js +101 -0
  90. package/dist/number-input/percentage.d.ts +3 -0
  91. package/dist/number-input/percentage.js +28 -0
  92. package/dist/number-input/types.d.ts +5 -0
  93. package/dist/number-input/types.js +0 -0
  94. package/dist/number-input/use-number-input.d.ts +30 -0
  95. package/dist/number-input/use-number-input.js +211 -0
  96. package/dist/number-input/validate.d.ts +3 -0
  97. package/dist/number-input/validate.js +17 -0
  98. package/dist/provider/tao-provider.d.ts +42 -0
  99. package/dist/provider/tao-provider.js +67 -0
  100. package/dist/theme/control.css +1061 -0
  101. package/dist/theme/theme.css +957 -0
  102. package/dist/utils/semantic.d.ts +10 -0
  103. package/dist/utils/semantic.js +5 -0
  104. package/llms.txt +67 -0
  105. package/package.json +97 -0
@@ -0,0 +1,36 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ function Presets(t0) {
4
+ const $ = c(7);
5
+ const { items, onSelect } = t0;
6
+ if (!items.length) return null;
7
+ let t1;
8
+ if ($[0] !== items || $[1] !== onSelect) {
9
+ let t2;
10
+ if ($[3] !== onSelect) {
11
+ t2 = (item)=>/*#__PURE__*/ jsx("button", {
12
+ type: "button",
13
+ "data-tao-preset-btn": "",
14
+ onClick: ()=>onSelect(item.value),
15
+ children: item.label
16
+ }, item.label);
17
+ $[3] = onSelect;
18
+ $[4] = t2;
19
+ } else t2 = $[4];
20
+ t1 = items.map(t2);
21
+ $[0] = items;
22
+ $[1] = onSelect;
23
+ $[2] = t1;
24
+ } else t1 = $[2];
25
+ let t2;
26
+ if ($[5] !== t1) {
27
+ t2 = /*#__PURE__*/ jsx("div", {
28
+ "data-tao-picker-presets": "",
29
+ children: t1
30
+ });
31
+ $[5] = t1;
32
+ $[6] = t2;
33
+ } else t2 = $[6];
34
+ return t2;
35
+ }
36
+ export { Presets };
@@ -0,0 +1,30 @@
1
+ import type { Dayjs } from 'dayjs';
2
+ import { type ReactNode } from 'react';
3
+ import { type TaoSize, type TaoVariant } from '../../provider/tao-provider';
4
+ import './date-picker.css';
5
+ import { type RangePresetItem } from './types';
6
+ type RangeValue = [Dayjs | null, Dayjs | null] | null;
7
+ export interface RangePickerProps {
8
+ value?: RangeValue;
9
+ defaultValue?: [Dayjs | null, Dayjs | null];
10
+ onChange?: (dates: RangeValue, dateStrings: [string, string]) => void;
11
+ picker?: 'date' | 'month' | 'year';
12
+ showTime?: boolean;
13
+ format?: string;
14
+ disabledDate?: (date: Dayjs) => boolean;
15
+ minDate?: Dayjs;
16
+ maxDate?: Dayjs;
17
+ presets?: RangePresetItem[];
18
+ placeholder?: [string, string];
19
+ separator?: ReactNode;
20
+ size?: TaoSize;
21
+ variant?: TaoVariant;
22
+ disabled?: boolean | [boolean, boolean];
23
+ allowClear?: boolean;
24
+ status?: 'error' | 'warning';
25
+ mobile?: boolean;
26
+ open?: boolean;
27
+ onOpenChange?: (open: boolean) => void;
28
+ }
29
+ export declare function RangePicker({ value, onChange, picker, showTime, format: formatProp, disabledDate, minDate, maxDate, presets, placeholder, separator, size, variant, disabled, allowClear, status, mobile, open: controlledOpen, onOpenChange, }: RangePickerProps): import("react/jsx-runtime").JSX.Element;
30
+ export {};
@@ -0,0 +1,432 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import dayjs from "dayjs";
4
+ import { useCallback, useState } from "react";
5
+ import { useTaoConfig } from "../../provider/tao-provider.js";
6
+ import { Drawer } from "../drawer/drawer.js";
7
+ import { useIsMobile } from "../select/use-is-mobile.js";
8
+ import { CalendarGrid } from "./calendar/calendar-grid.js";
9
+ import "./date-picker.css";
10
+ import { Presets } from "./presets.js";
11
+ import { getDefaultFormat } from "./types.js";
12
+ import * as __rspack_external__radix_ui_react_popover_e2827c9f from "@radix-ui/react-popover";
13
+ function RangePicker({ value, onChange, picker = 'date', showTime, format: formatProp, disabledDate, minDate, maxDate, presets, placeholder = [
14
+ 'Start date',
15
+ 'End date'
16
+ ], separator = '~', size, variant, disabled, allowClear = true, status, mobile, open: controlledOpen, onOpenChange }) {
17
+ const ctx = useTaoConfig();
18
+ const resolvedSize = size ?? ctx.size;
19
+ const resolvedVariant = variant ?? ctx.variant;
20
+ const isDisabled = 'boolean' == typeof disabled ? disabled : disabled?.[0] && disabled?.[1];
21
+ const resolvedDisabled = isDisabled ?? ctx.disabled;
22
+ const autoMobile = useIsMobile();
23
+ const isMobile = mobile ?? autoMobile;
24
+ const fmt = formatProp ?? getDefaultFormat(picker, showTime);
25
+ const [internalOpen, setInternalOpen] = useState(false);
26
+ const [hovering, setHovering] = useState(false);
27
+ const isOpen = controlledOpen ?? internalOpen;
28
+ const setOpen = useCallback((v)=>{
29
+ setInternalOpen(v);
30
+ onOpenChange?.(v);
31
+ }, [
32
+ onOpenChange
33
+ ]);
34
+ const [viewDateStart, setViewDateStart] = useState(()=>value?.[0] ?? dayjs());
35
+ const viewDateEnd = viewDateStart.add(1, 'month');
36
+ const [selecting, setSelecting] = useState('start');
37
+ const [hoverDate, setHoverDate] = useState(null);
38
+ const [pendingStart, setPendingStart] = useState(null);
39
+ const rangeStart = pendingStart ?? value?.[0] ?? null;
40
+ const rangeEnd = pendingStart ? null : value?.[1] ?? null;
41
+ const handleDateSelect = useCallback((date)=>{
42
+ if ('start' === selecting) {
43
+ setPendingStart(date);
44
+ setSelecting('end');
45
+ } else {
46
+ let start = pendingStart ?? rangeStart;
47
+ let end = date;
48
+ if (start && date.isBefore(start)) [start, end] = [
49
+ date,
50
+ start
51
+ ];
52
+ onChange?.([
53
+ start,
54
+ end
55
+ ], [
56
+ start?.format(fmt) ?? '',
57
+ end.format(fmt)
58
+ ]);
59
+ setPendingStart(null);
60
+ setSelecting('start');
61
+ setHoverDate(null);
62
+ if (!showTime) setOpen(false);
63
+ }
64
+ }, [
65
+ selecting,
66
+ pendingStart,
67
+ rangeStart,
68
+ onChange,
69
+ fmt,
70
+ showTime,
71
+ setOpen
72
+ ]);
73
+ const handleClear = useCallback((e)=>{
74
+ e.stopPropagation();
75
+ onChange?.(null, [
76
+ '',
77
+ ''
78
+ ]);
79
+ }, [
80
+ onChange
81
+ ]);
82
+ const handlePresetSelect = useCallback((val)=>{
83
+ const [s, e_0] = val;
84
+ onChange?.([
85
+ s,
86
+ e_0
87
+ ], [
88
+ s.format(fmt),
89
+ e_0.format(fmt)
90
+ ]);
91
+ setOpen(false);
92
+ }, [
93
+ onChange,
94
+ fmt,
95
+ setOpen
96
+ ]);
97
+ const displayStart = rangeStart ? rangeStart.format(fmt) : '';
98
+ const displayEnd = rangeEnd ? rangeEnd.format(fmt) : '';
99
+ const showClearBtn = allowClear && (rangeStart || rangeEnd) && !resolvedDisabled;
100
+ const panelContent = /*#__PURE__*/ jsxs("div", {
101
+ "data-tao-range-panel": "",
102
+ children: [
103
+ /*#__PURE__*/ jsxs("div", {
104
+ "data-tao-range-header": "",
105
+ children: [
106
+ /*#__PURE__*/ jsxs("div", {
107
+ "data-tao-calendar-nav": "",
108
+ children: [
109
+ /*#__PURE__*/ jsx("button", {
110
+ type: "button",
111
+ "data-tao-calendar-nav-btn": "",
112
+ onClick: ()=>setViewDateStart(viewDateStart.subtract(1, 'year')),
113
+ "aria-label": "Previous year",
114
+ children: /*#__PURE__*/ jsx(DoubleLeftIcon, {})
115
+ }),
116
+ /*#__PURE__*/ jsx("button", {
117
+ type: "button",
118
+ "data-tao-calendar-nav-btn": "",
119
+ onClick: ()=>setViewDateStart(viewDateStart.subtract(1, 'month')),
120
+ "aria-label": "Previous month",
121
+ children: /*#__PURE__*/ jsx(LeftIcon, {})
122
+ })
123
+ ]
124
+ }),
125
+ /*#__PURE__*/ jsxs("div", {
126
+ "data-tao-range-titles": "",
127
+ children: [
128
+ /*#__PURE__*/ jsx("span", {
129
+ "data-tao-range-title": "",
130
+ children: viewDateStart.format('MMM YYYY')
131
+ }),
132
+ /*#__PURE__*/ jsx("span", {
133
+ "data-tao-range-title": "",
134
+ children: viewDateEnd.format('MMM YYYY')
135
+ })
136
+ ]
137
+ }),
138
+ /*#__PURE__*/ jsxs("div", {
139
+ "data-tao-calendar-nav": "",
140
+ children: [
141
+ /*#__PURE__*/ jsx("button", {
142
+ type: "button",
143
+ "data-tao-calendar-nav-btn": "",
144
+ onClick: ()=>setViewDateStart(viewDateStart.add(1, 'month')),
145
+ "aria-label": "Next month",
146
+ children: /*#__PURE__*/ jsx(RightIcon, {})
147
+ }),
148
+ /*#__PURE__*/ jsx("button", {
149
+ type: "button",
150
+ "data-tao-calendar-nav-btn": "",
151
+ onClick: ()=>setViewDateStart(viewDateStart.add(1, 'year')),
152
+ "aria-label": "Next year",
153
+ children: /*#__PURE__*/ jsx(DoubleRightIcon, {})
154
+ })
155
+ ]
156
+ })
157
+ ]
158
+ }),
159
+ /*#__PURE__*/ jsxs("div", {
160
+ "data-tao-range-panels": "",
161
+ children: [
162
+ /*#__PURE__*/ jsx("div", {
163
+ "data-tao-picker-panel": "",
164
+ children: /*#__PURE__*/ jsx("div", {
165
+ "data-tao-picker-body": "",
166
+ children: /*#__PURE__*/ jsx(CalendarGrid, {
167
+ viewDate: viewDateStart,
168
+ rangeStart: rangeStart,
169
+ rangeEnd: rangeEnd,
170
+ hoverDate: hoverDate,
171
+ onSelect: handleDateSelect,
172
+ onHover: setHoverDate,
173
+ disabledDate: disabledDate,
174
+ minDate: minDate,
175
+ maxDate: maxDate
176
+ })
177
+ })
178
+ }),
179
+ /*#__PURE__*/ jsx("div", {
180
+ "data-tao-picker-panel": "",
181
+ children: /*#__PURE__*/ jsx("div", {
182
+ "data-tao-picker-body": "",
183
+ children: /*#__PURE__*/ jsx(CalendarGrid, {
184
+ viewDate: viewDateEnd,
185
+ rangeStart: rangeStart,
186
+ rangeEnd: rangeEnd,
187
+ hoverDate: hoverDate,
188
+ onSelect: handleDateSelect,
189
+ onHover: setHoverDate,
190
+ disabledDate: disabledDate,
191
+ minDate: minDate,
192
+ maxDate: maxDate
193
+ })
194
+ })
195
+ })
196
+ ]
197
+ }),
198
+ presets && presets.length > 0 && /*#__PURE__*/ jsx(Presets, {
199
+ items: presets,
200
+ onSelect: handlePresetSelect
201
+ })
202
+ ]
203
+ });
204
+ const trigger = /*#__PURE__*/ jsxs("button", {
205
+ type: "button",
206
+ "data-tao-control": "",
207
+ "data-tao-range-trigger": "",
208
+ "data-tao-size": resolvedSize,
209
+ "data-tao-variant": resolvedVariant,
210
+ "data-tao-error": 'error' === status || void 0,
211
+ disabled: resolvedDisabled,
212
+ onClick: isMobile ? ()=>setOpen(true) : void 0,
213
+ onMouseEnter: ()=>setHovering(true),
214
+ onMouseLeave: ()=>setHovering(false),
215
+ children: [
216
+ /*#__PURE__*/ jsx("span", {
217
+ "data-tao-range-input": "",
218
+ "data-tao-active": 'start' === selecting && isOpen || void 0,
219
+ children: displayStart || /*#__PURE__*/ jsx("span", {
220
+ "data-tao-picker-placeholder": "",
221
+ children: placeholder[0]
222
+ })
223
+ }),
224
+ /*#__PURE__*/ jsx("span", {
225
+ "data-tao-range-separator": "",
226
+ children: separator
227
+ }),
228
+ /*#__PURE__*/ jsx("span", {
229
+ "data-tao-range-input": "",
230
+ "data-tao-active": 'end' === selecting && isOpen || void 0,
231
+ children: displayEnd || /*#__PURE__*/ jsx("span", {
232
+ "data-tao-picker-placeholder": "",
233
+ children: placeholder[1]
234
+ })
235
+ }),
236
+ /*#__PURE__*/ jsx("span", {
237
+ "data-tao-picker-icons": "",
238
+ children: showClearBtn && hovering ? /*#__PURE__*/ jsx("span", {
239
+ "data-tao-picker-clear": "",
240
+ onClick: handleClear,
241
+ role: "button",
242
+ "aria-label": "Clear",
243
+ children: /*#__PURE__*/ jsx(CloseIcon, {})
244
+ }) : /*#__PURE__*/ jsx("span", {
245
+ "data-tao-picker-suffix": "",
246
+ children: /*#__PURE__*/ jsx(CalendarIcon, {})
247
+ })
248
+ })
249
+ ]
250
+ });
251
+ if (isMobile) return /*#__PURE__*/ jsxs(Fragment, {
252
+ children: [
253
+ trigger,
254
+ /*#__PURE__*/ jsx(Drawer, {
255
+ open: isOpen,
256
+ onClose: ()=>setOpen(false),
257
+ placement: "bottom",
258
+ title: "Select date range",
259
+ height: "85vh",
260
+ children: panelContent
261
+ })
262
+ ]
263
+ });
264
+ return /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_popover_e2827c9f.Root, {
265
+ open: isOpen,
266
+ onOpenChange: setOpen,
267
+ children: [
268
+ /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_popover_e2827c9f.Trigger, {
269
+ asChild: true,
270
+ children: trigger
271
+ }),
272
+ /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_popover_e2827c9f.Portal, {
273
+ children: /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_popover_e2827c9f.Content, {
274
+ "data-tao-picker-dropdown": "",
275
+ sideOffset: 4,
276
+ align: "start",
277
+ onOpenAutoFocus: (e_1)=>e_1.preventDefault(),
278
+ children: panelContent
279
+ })
280
+ })
281
+ ]
282
+ });
283
+ }
284
+ function CalendarIcon() {
285
+ const $ = c(1);
286
+ let t0;
287
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
288
+ t0 = /*#__PURE__*/ jsxs("svg", {
289
+ width: "16",
290
+ height: "16",
291
+ viewBox: "0 0 24 24",
292
+ fill: "none",
293
+ stroke: "currentColor",
294
+ strokeWidth: "2",
295
+ strokeLinecap: "round",
296
+ strokeLinejoin: "round",
297
+ children: [
298
+ /*#__PURE__*/ jsx("path", {
299
+ d: "M8 2v4M16 2v4"
300
+ }),
301
+ /*#__PURE__*/ jsx("rect", {
302
+ width: "18",
303
+ height: "18",
304
+ x: "3",
305
+ y: "4",
306
+ rx: "2"
307
+ }),
308
+ /*#__PURE__*/ jsx("path", {
309
+ d: "M3 10h18"
310
+ })
311
+ ]
312
+ });
313
+ $[0] = t0;
314
+ } else t0 = $[0];
315
+ return t0;
316
+ }
317
+ function CloseIcon() {
318
+ const $ = c(1);
319
+ let t0;
320
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
321
+ t0 = /*#__PURE__*/ jsx("svg", {
322
+ width: "14",
323
+ height: "14",
324
+ viewBox: "0 0 24 24",
325
+ fill: "none",
326
+ stroke: "currentColor",
327
+ strokeWidth: "2",
328
+ strokeLinecap: "round",
329
+ strokeLinejoin: "round",
330
+ children: /*#__PURE__*/ jsx("path", {
331
+ d: "M18 6 6 18M6 6l12 12"
332
+ })
333
+ });
334
+ $[0] = t0;
335
+ } else t0 = $[0];
336
+ return t0;
337
+ }
338
+ function LeftIcon() {
339
+ const $ = c(1);
340
+ let t0;
341
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
342
+ t0 = /*#__PURE__*/ jsx("svg", {
343
+ width: "14",
344
+ height: "14",
345
+ viewBox: "0 0 24 24",
346
+ fill: "none",
347
+ stroke: "currentColor",
348
+ strokeWidth: "2",
349
+ strokeLinecap: "round",
350
+ strokeLinejoin: "round",
351
+ children: /*#__PURE__*/ jsx("path", {
352
+ d: "m15 18-6-6 6-6"
353
+ })
354
+ });
355
+ $[0] = t0;
356
+ } else t0 = $[0];
357
+ return t0;
358
+ }
359
+ function RightIcon() {
360
+ const $ = c(1);
361
+ let t0;
362
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
363
+ t0 = /*#__PURE__*/ jsx("svg", {
364
+ width: "14",
365
+ height: "14",
366
+ viewBox: "0 0 24 24",
367
+ fill: "none",
368
+ stroke: "currentColor",
369
+ strokeWidth: "2",
370
+ strokeLinecap: "round",
371
+ strokeLinejoin: "round",
372
+ children: /*#__PURE__*/ jsx("path", {
373
+ d: "m9 18 6-6-6-6"
374
+ })
375
+ });
376
+ $[0] = t0;
377
+ } else t0 = $[0];
378
+ return t0;
379
+ }
380
+ function DoubleLeftIcon() {
381
+ const $ = c(1);
382
+ let t0;
383
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
384
+ t0 = /*#__PURE__*/ jsxs("svg", {
385
+ width: "14",
386
+ height: "14",
387
+ viewBox: "0 0 24 24",
388
+ fill: "none",
389
+ stroke: "currentColor",
390
+ strokeWidth: "2",
391
+ strokeLinecap: "round",
392
+ strokeLinejoin: "round",
393
+ children: [
394
+ /*#__PURE__*/ jsx("path", {
395
+ d: "m11 17-5-5 5-5"
396
+ }),
397
+ /*#__PURE__*/ jsx("path", {
398
+ d: "m18 17-5-5 5-5"
399
+ })
400
+ ]
401
+ });
402
+ $[0] = t0;
403
+ } else t0 = $[0];
404
+ return t0;
405
+ }
406
+ function DoubleRightIcon() {
407
+ const $ = c(1);
408
+ let t0;
409
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
410
+ t0 = /*#__PURE__*/ jsxs("svg", {
411
+ width: "14",
412
+ height: "14",
413
+ viewBox: "0 0 24 24",
414
+ fill: "none",
415
+ stroke: "currentColor",
416
+ strokeWidth: "2",
417
+ strokeLinecap: "round",
418
+ strokeLinejoin: "round",
419
+ children: [
420
+ /*#__PURE__*/ jsx("path", {
421
+ d: "m6 17 5-5-5-5"
422
+ }),
423
+ /*#__PURE__*/ jsx("path", {
424
+ d: "m13 17 5-5-5-5"
425
+ })
426
+ ]
427
+ });
428
+ $[0] = t0;
429
+ } else t0 = $[0];
430
+ return t0;
431
+ }
432
+ export { RangePicker };
@@ -0,0 +1,39 @@
1
+ import type { Dayjs } from 'dayjs';
2
+ import type { ReactNode } from 'react';
3
+ import type { TaoSize, TaoVariant } from '../../provider/tao-provider';
4
+ export type PickerMode = 'date' | 'month' | 'year';
5
+ export type PanelMode = 'date' | 'month' | 'year' | 'decade';
6
+ export interface TimeConfig {
7
+ format?: string;
8
+ hourStep?: number;
9
+ minuteStep?: number;
10
+ secondStep?: number;
11
+ }
12
+ export interface PresetItem {
13
+ label: string;
14
+ value: Dayjs;
15
+ }
16
+ export interface RangePresetItem {
17
+ label: string;
18
+ value: [Dayjs, Dayjs];
19
+ }
20
+ export interface SharedPickerProps {
21
+ picker?: PickerMode;
22
+ showTime?: boolean | TimeConfig;
23
+ format?: string;
24
+ disabledDate?: (date: Dayjs) => boolean;
25
+ minDate?: Dayjs;
26
+ maxDate?: Dayjs;
27
+ placeholder?: string;
28
+ size?: TaoSize;
29
+ variant?: TaoVariant;
30
+ disabled?: boolean;
31
+ allowClear?: boolean;
32
+ prefix?: ReactNode;
33
+ suffixIcon?: ReactNode;
34
+ status?: 'error' | 'warning';
35
+ mobile?: boolean;
36
+ open?: boolean;
37
+ onOpenChange?: (open: boolean) => void;
38
+ }
39
+ export declare function getDefaultFormat(picker: PickerMode, showTime?: boolean | TimeConfig): string;
@@ -0,0 +1,7 @@
1
+ function getDefaultFormat(picker, showTime) {
2
+ if ('year' === picker) return 'YYYY';
3
+ if ('month' === picker) return 'YYYY-MM';
4
+ if (showTime) return 'YYYY-MM-DD HH:mm:ss';
5
+ return 'YYYY-MM-DD';
6
+ }
7
+ export { getDefaultFormat };