@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.
- package/LICENSE +21 -0
- package/README.md +65 -0
- package/dist/components/button/button.css +1055 -0
- package/dist/components/button/button.d.ts +15 -0
- package/dist/components/button/button.js +93 -0
- package/dist/components/checkbox/checkbox.css +1035 -0
- package/dist/components/checkbox/checkbox.d.ts +33 -0
- package/dist/components/checkbox/checkbox.js +312 -0
- package/dist/components/date-picker/calendar/calendar-grid.d.ts +18 -0
- package/dist/components/date-picker/calendar/calendar-grid.js +173 -0
- package/dist/components/date-picker/calendar/calendar-header.d.ts +10 -0
- package/dist/components/date-picker/calendar/calendar-header.js +336 -0
- package/dist/components/date-picker/calendar/month-grid.d.ts +9 -0
- package/dist/components/date-picker/calendar/month-grid.js +61 -0
- package/dist/components/date-picker/calendar/time-panel.d.ts +12 -0
- package/dist/components/date-picker/calendar/time-panel.js +233 -0
- package/dist/components/date-picker/calendar/use-calendar.d.ts +15 -0
- package/dist/components/date-picker/calendar/use-calendar.js +24 -0
- package/dist/components/date-picker/calendar/year-grid.d.ts +9 -0
- package/dist/components/date-picker/calendar/year-grid.js +60 -0
- package/dist/components/date-picker/date-picker.css +1799 -0
- package/dist/components/date-picker/date-picker.d.ts +29 -0
- package/dist/components/date-picker/date-picker.js +663 -0
- package/dist/components/date-picker/presets.d.ts +9 -0
- package/dist/components/date-picker/presets.js +36 -0
- package/dist/components/date-picker/range-picker.d.ts +30 -0
- package/dist/components/date-picker/range-picker.js +432 -0
- package/dist/components/date-picker/types.d.ts +39 -0
- package/dist/components/date-picker/types.js +7 -0
- package/dist/components/drawer/drawer.css +1112 -0
- package/dist/components/drawer/drawer.d.ts +17 -0
- package/dist/components/drawer/drawer.js +184 -0
- package/dist/components/form-actions/form-actions.d.ts +12 -0
- package/dist/components/form-actions/form-actions.js +42 -0
- package/dist/components/form-field/form-field.d.ts +17 -0
- package/dist/components/form-field/form-field.js +101 -0
- package/dist/components/form-field/form.css +1036 -0
- package/dist/components/form-section/form-section.d.ts +14 -0
- package/dist/components/form-section/form-section.js +92 -0
- package/dist/components/input/input.css +1185 -0
- package/dist/components/input/input.d.ts +15 -0
- package/dist/components/input/input.js +143 -0
- package/dist/components/pagination/pagination.css +1099 -0
- package/dist/components/pagination/pagination.d.ts +22 -0
- package/dist/components/pagination/pagination.js +310 -0
- package/dist/components/radio/radio.css +1045 -0
- package/dist/components/radio/radio.d.ts +34 -0
- package/dist/components/radio/radio.js +215 -0
- package/dist/components/scroll-area/scroll-area.css +1099 -0
- package/dist/components/scroll-area/scroll-area.d.ts +33 -0
- package/dist/components/scroll-area/scroll-area.js +375 -0
- package/dist/components/select/mobile-select.css +1044 -0
- package/dist/components/select/mobile-select.d.ts +19 -0
- package/dist/components/select/mobile-select.js +224 -0
- package/dist/components/select/select.css +1327 -0
- package/dist/components/select/select.d.ts +32 -0
- package/dist/components/select/select.js +532 -0
- package/dist/components/select/use-is-mobile.d.ts +1 -0
- package/dist/components/select/use-is-mobile.js +30 -0
- package/dist/components/splitter/splitter.css +1104 -0
- package/dist/components/splitter/splitter.d.ts +33 -0
- package/dist/components/splitter/splitter.js +451 -0
- package/dist/components/switch/switch.css +1170 -0
- package/dist/components/switch/switch.d.ts +19 -0
- package/dist/components/switch/switch.js +143 -0
- package/dist/components/table/table.css +1255 -0
- package/dist/components/table/table.d.ts +73 -0
- package/dist/components/table/table.js +1022 -0
- package/dist/components/tabs/tabs.css +1076 -0
- package/dist/components/tabs/tabs.d.ts +24 -0
- package/dist/components/tabs/tabs.js +256 -0
- package/dist/components/tag/tag.css +1124 -0
- package/dist/components/tag/tag.d.ts +33 -0
- package/dist/components/tag/tag.js +237 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +23 -0
- package/dist/layouts/form-layout/form-layout.d.ts +6 -0
- package/dist/layouts/form-layout/form-layout.js +18 -0
- package/dist/layouts/stack/layout.css +1003 -0
- package/dist/layouts/stack/stack.d.ts +9 -0
- package/dist/layouts/stack/stack.js +27 -0
- package/dist/number-input/cursor.d.ts +9 -0
- package/dist/number-input/cursor.js +44 -0
- package/dist/number-input/format.d.ts +5 -0
- package/dist/number-input/format.js +50 -0
- package/dist/number-input/index.d.ts +5 -0
- package/dist/number-input/index.js +2 -0
- package/dist/number-input/number-input.d.ts +9 -0
- package/dist/number-input/number-input.js +101 -0
- package/dist/number-input/percentage.d.ts +3 -0
- package/dist/number-input/percentage.js +28 -0
- package/dist/number-input/types.d.ts +5 -0
- package/dist/number-input/types.js +0 -0
- package/dist/number-input/use-number-input.d.ts +30 -0
- package/dist/number-input/use-number-input.js +211 -0
- package/dist/number-input/validate.d.ts +3 -0
- package/dist/number-input/validate.js +17 -0
- package/dist/provider/tao-provider.d.ts +42 -0
- package/dist/provider/tao-provider.js +67 -0
- package/dist/theme/control.css +1061 -0
- package/dist/theme/theme.css +957 -0
- package/dist/utils/semantic.d.ts +10 -0
- package/dist/utils/semantic.js +5 -0
- package/llms.txt +67 -0
- package/package.json +97 -0
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
function CalendarHeader(t0) {
|
|
4
|
+
const $ = c(58);
|
|
5
|
+
const { viewDate, panelMode, onViewDateChange, onPanelModeChange } = t0;
|
|
6
|
+
let t1;
|
|
7
|
+
if ($[0] !== onViewDateChange || $[1] !== panelMode || $[2] !== viewDate) {
|
|
8
|
+
t1 = ()=>{
|
|
9
|
+
if ("date" === panelMode) onViewDateChange(viewDate.subtract(1, "month"));
|
|
10
|
+
else if ("month" === panelMode) onViewDateChange(viewDate.subtract(1, "year"));
|
|
11
|
+
else if ("year" === panelMode || "decade" === panelMode) onViewDateChange(viewDate.subtract(10, "year"));
|
|
12
|
+
};
|
|
13
|
+
$[0] = onViewDateChange;
|
|
14
|
+
$[1] = panelMode;
|
|
15
|
+
$[2] = viewDate;
|
|
16
|
+
$[3] = t1;
|
|
17
|
+
} else t1 = $[3];
|
|
18
|
+
const handlePrev = t1;
|
|
19
|
+
let t2;
|
|
20
|
+
if ($[4] !== onViewDateChange || $[5] !== panelMode || $[6] !== viewDate) {
|
|
21
|
+
t2 = ()=>{
|
|
22
|
+
if ("date" === panelMode) onViewDateChange(viewDate.add(1, "month"));
|
|
23
|
+
else if ("month" === panelMode) onViewDateChange(viewDate.add(1, "year"));
|
|
24
|
+
else if ("year" === panelMode || "decade" === panelMode) onViewDateChange(viewDate.add(10, "year"));
|
|
25
|
+
};
|
|
26
|
+
$[4] = onViewDateChange;
|
|
27
|
+
$[5] = panelMode;
|
|
28
|
+
$[6] = viewDate;
|
|
29
|
+
$[7] = t2;
|
|
30
|
+
} else t2 = $[7];
|
|
31
|
+
const handleNext = t2;
|
|
32
|
+
let t3;
|
|
33
|
+
if ($[8] !== onViewDateChange || $[9] !== viewDate) {
|
|
34
|
+
t3 = ()=>{
|
|
35
|
+
onViewDateChange(viewDate.subtract(1, "year"));
|
|
36
|
+
};
|
|
37
|
+
$[8] = onViewDateChange;
|
|
38
|
+
$[9] = viewDate;
|
|
39
|
+
$[10] = t3;
|
|
40
|
+
} else t3 = $[10];
|
|
41
|
+
const handleSuperPrev = t3;
|
|
42
|
+
let t4;
|
|
43
|
+
if ($[11] !== onViewDateChange || $[12] !== viewDate) {
|
|
44
|
+
t4 = ()=>{
|
|
45
|
+
onViewDateChange(viewDate.add(1, "year"));
|
|
46
|
+
};
|
|
47
|
+
$[11] = onViewDateChange;
|
|
48
|
+
$[12] = viewDate;
|
|
49
|
+
$[13] = t4;
|
|
50
|
+
} else t4 = $[13];
|
|
51
|
+
const handleSuperNext = t4;
|
|
52
|
+
let t5;
|
|
53
|
+
if ($[14] !== onPanelModeChange || $[15] !== panelMode) {
|
|
54
|
+
t5 = ()=>{
|
|
55
|
+
onPanelModeChange("month" === panelMode ? "date" : "month");
|
|
56
|
+
};
|
|
57
|
+
$[14] = onPanelModeChange;
|
|
58
|
+
$[15] = panelMode;
|
|
59
|
+
$[16] = t5;
|
|
60
|
+
} else t5 = $[16];
|
|
61
|
+
const handleMonthClick = t5;
|
|
62
|
+
let t6;
|
|
63
|
+
if ($[17] !== onPanelModeChange || $[18] !== panelMode) {
|
|
64
|
+
t6 = ()=>{
|
|
65
|
+
onPanelModeChange("year" === panelMode ? "date" : "year");
|
|
66
|
+
};
|
|
67
|
+
$[17] = onPanelModeChange;
|
|
68
|
+
$[18] = panelMode;
|
|
69
|
+
$[19] = t6;
|
|
70
|
+
} else t6 = $[19];
|
|
71
|
+
const handleYearClick = t6;
|
|
72
|
+
const decadeStart = 10 * Math.floor(viewDate.year() / 10);
|
|
73
|
+
let t7;
|
|
74
|
+
if ($[20] !== handleSuperPrev || $[21] !== panelMode) {
|
|
75
|
+
t7 = "date" === panelMode && /*#__PURE__*/ jsx("button", {
|
|
76
|
+
type: "button",
|
|
77
|
+
"data-tao-calendar-nav-btn": "",
|
|
78
|
+
onClick: handleSuperPrev,
|
|
79
|
+
"aria-label": "Previous year",
|
|
80
|
+
children: /*#__PURE__*/ jsx(DoubleLeftIcon, {})
|
|
81
|
+
});
|
|
82
|
+
$[20] = handleSuperPrev;
|
|
83
|
+
$[21] = panelMode;
|
|
84
|
+
$[22] = t7;
|
|
85
|
+
} else t7 = $[22];
|
|
86
|
+
let t8;
|
|
87
|
+
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
88
|
+
t8 = /*#__PURE__*/ jsx(LeftIcon, {});
|
|
89
|
+
$[23] = t8;
|
|
90
|
+
} else t8 = $[23];
|
|
91
|
+
let t9;
|
|
92
|
+
if ($[24] !== handlePrev) {
|
|
93
|
+
t9 = /*#__PURE__*/ jsx("button", {
|
|
94
|
+
type: "button",
|
|
95
|
+
"data-tao-calendar-nav-btn": "",
|
|
96
|
+
onClick: handlePrev,
|
|
97
|
+
"aria-label": "Previous",
|
|
98
|
+
children: t8
|
|
99
|
+
});
|
|
100
|
+
$[24] = handlePrev;
|
|
101
|
+
$[25] = t9;
|
|
102
|
+
} else t9 = $[25];
|
|
103
|
+
let t10;
|
|
104
|
+
if ($[26] !== t7 || $[27] !== t9) {
|
|
105
|
+
t10 = /*#__PURE__*/ jsxs("div", {
|
|
106
|
+
"data-tao-calendar-nav": "",
|
|
107
|
+
children: [
|
|
108
|
+
t7,
|
|
109
|
+
t9
|
|
110
|
+
]
|
|
111
|
+
});
|
|
112
|
+
$[26] = t7;
|
|
113
|
+
$[27] = t9;
|
|
114
|
+
$[28] = t10;
|
|
115
|
+
} else t10 = $[28];
|
|
116
|
+
let t11;
|
|
117
|
+
if ($[29] !== handleMonthClick || $[30] !== handleYearClick || $[31] !== panelMode || $[32] !== viewDate) {
|
|
118
|
+
t11 = "date" === panelMode && /*#__PURE__*/ jsxs(Fragment, {
|
|
119
|
+
children: [
|
|
120
|
+
/*#__PURE__*/ jsx("button", {
|
|
121
|
+
type: "button",
|
|
122
|
+
"data-tao-calendar-title-btn": "",
|
|
123
|
+
onClick: handleMonthClick,
|
|
124
|
+
children: viewDate.format("MMM")
|
|
125
|
+
}),
|
|
126
|
+
/*#__PURE__*/ jsx("button", {
|
|
127
|
+
type: "button",
|
|
128
|
+
"data-tao-calendar-title-btn": "",
|
|
129
|
+
onClick: handleYearClick,
|
|
130
|
+
children: viewDate.format("YYYY")
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
});
|
|
134
|
+
$[29] = handleMonthClick;
|
|
135
|
+
$[30] = handleYearClick;
|
|
136
|
+
$[31] = panelMode;
|
|
137
|
+
$[32] = viewDate;
|
|
138
|
+
$[33] = t11;
|
|
139
|
+
} else t11 = $[33];
|
|
140
|
+
let t12;
|
|
141
|
+
if ($[34] !== handleYearClick || $[35] !== panelMode || $[36] !== viewDate) {
|
|
142
|
+
t12 = "month" === panelMode && /*#__PURE__*/ jsx("button", {
|
|
143
|
+
type: "button",
|
|
144
|
+
"data-tao-calendar-title-btn": "",
|
|
145
|
+
onClick: handleYearClick,
|
|
146
|
+
children: viewDate.format("YYYY")
|
|
147
|
+
});
|
|
148
|
+
$[34] = handleYearClick;
|
|
149
|
+
$[35] = panelMode;
|
|
150
|
+
$[36] = viewDate;
|
|
151
|
+
$[37] = t12;
|
|
152
|
+
} else t12 = $[37];
|
|
153
|
+
let t13;
|
|
154
|
+
if ($[38] !== decadeStart || $[39] !== panelMode) {
|
|
155
|
+
t13 = ("year" === panelMode || "decade" === panelMode) && /*#__PURE__*/ jsxs("span", {
|
|
156
|
+
"data-tao-calendar-title-text": "",
|
|
157
|
+
children: [
|
|
158
|
+
decadeStart,
|
|
159
|
+
" – ",
|
|
160
|
+
decadeStart + 9
|
|
161
|
+
]
|
|
162
|
+
});
|
|
163
|
+
$[38] = decadeStart;
|
|
164
|
+
$[39] = panelMode;
|
|
165
|
+
$[40] = t13;
|
|
166
|
+
} else t13 = $[40];
|
|
167
|
+
let t14;
|
|
168
|
+
if ($[41] !== t11 || $[42] !== t12 || $[43] !== t13) {
|
|
169
|
+
t14 = /*#__PURE__*/ jsxs("div", {
|
|
170
|
+
"data-tao-calendar-title": "",
|
|
171
|
+
children: [
|
|
172
|
+
t11,
|
|
173
|
+
t12,
|
|
174
|
+
t13
|
|
175
|
+
]
|
|
176
|
+
});
|
|
177
|
+
$[41] = t11;
|
|
178
|
+
$[42] = t12;
|
|
179
|
+
$[43] = t13;
|
|
180
|
+
$[44] = t14;
|
|
181
|
+
} else t14 = $[44];
|
|
182
|
+
let t15;
|
|
183
|
+
if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
|
|
184
|
+
t15 = /*#__PURE__*/ jsx(RightIcon, {});
|
|
185
|
+
$[45] = t15;
|
|
186
|
+
} else t15 = $[45];
|
|
187
|
+
let t16;
|
|
188
|
+
if ($[46] !== handleNext) {
|
|
189
|
+
t16 = /*#__PURE__*/ jsx("button", {
|
|
190
|
+
type: "button",
|
|
191
|
+
"data-tao-calendar-nav-btn": "",
|
|
192
|
+
onClick: handleNext,
|
|
193
|
+
"aria-label": "Next",
|
|
194
|
+
children: t15
|
|
195
|
+
});
|
|
196
|
+
$[46] = handleNext;
|
|
197
|
+
$[47] = t16;
|
|
198
|
+
} else t16 = $[47];
|
|
199
|
+
let t17;
|
|
200
|
+
if ($[48] !== handleSuperNext || $[49] !== panelMode) {
|
|
201
|
+
t17 = "date" === panelMode && /*#__PURE__*/ jsx("button", {
|
|
202
|
+
type: "button",
|
|
203
|
+
"data-tao-calendar-nav-btn": "",
|
|
204
|
+
onClick: handleSuperNext,
|
|
205
|
+
"aria-label": "Next year",
|
|
206
|
+
children: /*#__PURE__*/ jsx(DoubleRightIcon, {})
|
|
207
|
+
});
|
|
208
|
+
$[48] = handleSuperNext;
|
|
209
|
+
$[49] = panelMode;
|
|
210
|
+
$[50] = t17;
|
|
211
|
+
} else t17 = $[50];
|
|
212
|
+
let t18;
|
|
213
|
+
if ($[51] !== t16 || $[52] !== t17) {
|
|
214
|
+
t18 = /*#__PURE__*/ jsxs("div", {
|
|
215
|
+
"data-tao-calendar-nav": "",
|
|
216
|
+
children: [
|
|
217
|
+
t16,
|
|
218
|
+
t17
|
|
219
|
+
]
|
|
220
|
+
});
|
|
221
|
+
$[51] = t16;
|
|
222
|
+
$[52] = t17;
|
|
223
|
+
$[53] = t18;
|
|
224
|
+
} else t18 = $[53];
|
|
225
|
+
let t19;
|
|
226
|
+
if ($[54] !== t10 || $[55] !== t14 || $[56] !== t18) {
|
|
227
|
+
t19 = /*#__PURE__*/ jsxs("div", {
|
|
228
|
+
"data-tao-calendar-header": "",
|
|
229
|
+
children: [
|
|
230
|
+
t10,
|
|
231
|
+
t14,
|
|
232
|
+
t18
|
|
233
|
+
]
|
|
234
|
+
});
|
|
235
|
+
$[54] = t10;
|
|
236
|
+
$[55] = t14;
|
|
237
|
+
$[56] = t18;
|
|
238
|
+
$[57] = t19;
|
|
239
|
+
} else t19 = $[57];
|
|
240
|
+
return t19;
|
|
241
|
+
}
|
|
242
|
+
function LeftIcon() {
|
|
243
|
+
const $ = c(1);
|
|
244
|
+
let t0;
|
|
245
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
246
|
+
t0 = /*#__PURE__*/ jsx("svg", {
|
|
247
|
+
width: "14",
|
|
248
|
+
height: "14",
|
|
249
|
+
viewBox: "0 0 24 24",
|
|
250
|
+
fill: "none",
|
|
251
|
+
stroke: "currentColor",
|
|
252
|
+
strokeWidth: "2",
|
|
253
|
+
strokeLinecap: "round",
|
|
254
|
+
strokeLinejoin: "round",
|
|
255
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
256
|
+
d: "m15 18-6-6 6-6"
|
|
257
|
+
})
|
|
258
|
+
});
|
|
259
|
+
$[0] = t0;
|
|
260
|
+
} else t0 = $[0];
|
|
261
|
+
return t0;
|
|
262
|
+
}
|
|
263
|
+
function RightIcon() {
|
|
264
|
+
const $ = c(1);
|
|
265
|
+
let t0;
|
|
266
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
267
|
+
t0 = /*#__PURE__*/ jsx("svg", {
|
|
268
|
+
width: "14",
|
|
269
|
+
height: "14",
|
|
270
|
+
viewBox: "0 0 24 24",
|
|
271
|
+
fill: "none",
|
|
272
|
+
stroke: "currentColor",
|
|
273
|
+
strokeWidth: "2",
|
|
274
|
+
strokeLinecap: "round",
|
|
275
|
+
strokeLinejoin: "round",
|
|
276
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
277
|
+
d: "m9 18 6-6-6-6"
|
|
278
|
+
})
|
|
279
|
+
});
|
|
280
|
+
$[0] = t0;
|
|
281
|
+
} else t0 = $[0];
|
|
282
|
+
return t0;
|
|
283
|
+
}
|
|
284
|
+
function DoubleLeftIcon() {
|
|
285
|
+
const $ = c(1);
|
|
286
|
+
let t0;
|
|
287
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
288
|
+
t0 = /*#__PURE__*/ jsxs("svg", {
|
|
289
|
+
width: "14",
|
|
290
|
+
height: "14",
|
|
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: "m11 17-5-5 5-5"
|
|
300
|
+
}),
|
|
301
|
+
/*#__PURE__*/ jsx("path", {
|
|
302
|
+
d: "m18 17-5-5 5-5"
|
|
303
|
+
})
|
|
304
|
+
]
|
|
305
|
+
});
|
|
306
|
+
$[0] = t0;
|
|
307
|
+
} else t0 = $[0];
|
|
308
|
+
return t0;
|
|
309
|
+
}
|
|
310
|
+
function DoubleRightIcon() {
|
|
311
|
+
const $ = c(1);
|
|
312
|
+
let t0;
|
|
313
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
314
|
+
t0 = /*#__PURE__*/ jsxs("svg", {
|
|
315
|
+
width: "14",
|
|
316
|
+
height: "14",
|
|
317
|
+
viewBox: "0 0 24 24",
|
|
318
|
+
fill: "none",
|
|
319
|
+
stroke: "currentColor",
|
|
320
|
+
strokeWidth: "2",
|
|
321
|
+
strokeLinecap: "round",
|
|
322
|
+
strokeLinejoin: "round",
|
|
323
|
+
children: [
|
|
324
|
+
/*#__PURE__*/ jsx("path", {
|
|
325
|
+
d: "m6 17 5-5-5-5"
|
|
326
|
+
}),
|
|
327
|
+
/*#__PURE__*/ jsx("path", {
|
|
328
|
+
d: "m13 17 5-5-5-5"
|
|
329
|
+
})
|
|
330
|
+
]
|
|
331
|
+
});
|
|
332
|
+
$[0] = t0;
|
|
333
|
+
} else t0 = $[0];
|
|
334
|
+
return t0;
|
|
335
|
+
}
|
|
336
|
+
export { CalendarHeader };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Dayjs } from 'dayjs';
|
|
2
|
+
interface MonthGridProps {
|
|
3
|
+
viewDate: Dayjs;
|
|
4
|
+
value?: Dayjs | null;
|
|
5
|
+
onSelect: (date: Dayjs) => void;
|
|
6
|
+
disabledDate?: (date: Dayjs) => boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function MonthGrid({ viewDate, value, onSelect, disabledDate }: MonthGridProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { getMonths } from "./use-calendar.js";
|
|
4
|
+
const MONTH_LABELS = [
|
|
5
|
+
'Jan',
|
|
6
|
+
'Feb',
|
|
7
|
+
'Mar',
|
|
8
|
+
'Apr',
|
|
9
|
+
'May',
|
|
10
|
+
'Jun',
|
|
11
|
+
'Jul',
|
|
12
|
+
'Aug',
|
|
13
|
+
'Sep',
|
|
14
|
+
'Oct',
|
|
15
|
+
'Nov',
|
|
16
|
+
'Dec'
|
|
17
|
+
];
|
|
18
|
+
function MonthGrid(t0) {
|
|
19
|
+
const $ = c(9);
|
|
20
|
+
const { viewDate, value, onSelect, disabledDate } = t0;
|
|
21
|
+
let t1;
|
|
22
|
+
let t2;
|
|
23
|
+
if ($[0] !== disabledDate || $[1] !== onSelect || $[2] !== value || $[3] !== viewDate) {
|
|
24
|
+
const months = getMonths(viewDate.year());
|
|
25
|
+
t1 = "";
|
|
26
|
+
t2 = months.map((m, i)=>{
|
|
27
|
+
const isSelected = value && value.month() === i && value.year() === viewDate.year();
|
|
28
|
+
const disabled = disabledDate?.(m) ?? false;
|
|
29
|
+
return /*#__PURE__*/ jsx("button", {
|
|
30
|
+
type: "button",
|
|
31
|
+
"data-tao-month-cell": "",
|
|
32
|
+
"data-tao-selected": isSelected || void 0,
|
|
33
|
+
"data-tao-disabled": disabled || void 0,
|
|
34
|
+
disabled: disabled,
|
|
35
|
+
onClick: ()=>onSelect(m),
|
|
36
|
+
children: MONTH_LABELS[i]
|
|
37
|
+
}, i);
|
|
38
|
+
});
|
|
39
|
+
$[0] = disabledDate;
|
|
40
|
+
$[1] = onSelect;
|
|
41
|
+
$[2] = value;
|
|
42
|
+
$[3] = viewDate;
|
|
43
|
+
$[4] = t1;
|
|
44
|
+
$[5] = t2;
|
|
45
|
+
} else {
|
|
46
|
+
t1 = $[4];
|
|
47
|
+
t2 = $[5];
|
|
48
|
+
}
|
|
49
|
+
let t3;
|
|
50
|
+
if ($[6] !== t1 || $[7] !== t2) {
|
|
51
|
+
t3 = /*#__PURE__*/ jsx("div", {
|
|
52
|
+
"data-tao-month-grid": t1,
|
|
53
|
+
children: t2
|
|
54
|
+
});
|
|
55
|
+
$[6] = t1;
|
|
56
|
+
$[7] = t2;
|
|
57
|
+
$[8] = t3;
|
|
58
|
+
} else t3 = $[8];
|
|
59
|
+
return t3;
|
|
60
|
+
}
|
|
61
|
+
export { MonthGrid };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TimeConfig } from '../types';
|
|
2
|
+
interface TimePanelProps {
|
|
3
|
+
hour: number;
|
|
4
|
+
minute: number;
|
|
5
|
+
second: number;
|
|
6
|
+
onChange: (h: number, m: number, s: number) => void;
|
|
7
|
+
config?: TimeConfig;
|
|
8
|
+
/** Increment to force scroll-to-selected even when the value hasn't changed */
|
|
9
|
+
scrollKey?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function TimePanel({ hour, minute, second, onChange, config, scrollKey }: TimePanelProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
function TimePanel(t0) {
|
|
5
|
+
const $ = c(37);
|
|
6
|
+
const { hour, minute, second, onChange, config, scrollKey } = t0;
|
|
7
|
+
const hourStep = config?.hourStep ?? 1;
|
|
8
|
+
const minuteStep = config?.minuteStep ?? 1;
|
|
9
|
+
const secondStep = config?.secondStep ?? 1;
|
|
10
|
+
let t1;
|
|
11
|
+
if ($[0] !== hourStep) {
|
|
12
|
+
t1 = Array.from({
|
|
13
|
+
length: Math.ceil(24 / hourStep)
|
|
14
|
+
}, (_, i)=>i * hourStep);
|
|
15
|
+
$[0] = hourStep;
|
|
16
|
+
$[1] = t1;
|
|
17
|
+
} else t1 = $[1];
|
|
18
|
+
const hours = t1;
|
|
19
|
+
let t2;
|
|
20
|
+
if ($[2] !== minuteStep) {
|
|
21
|
+
t2 = Array.from({
|
|
22
|
+
length: Math.ceil(60 / minuteStep)
|
|
23
|
+
}, (__0, i_0)=>i_0 * minuteStep);
|
|
24
|
+
$[2] = minuteStep;
|
|
25
|
+
$[3] = t2;
|
|
26
|
+
} else t2 = $[3];
|
|
27
|
+
const minutes = t2;
|
|
28
|
+
let t3;
|
|
29
|
+
if ($[4] !== secondStep) {
|
|
30
|
+
t3 = Array.from({
|
|
31
|
+
length: Math.ceil(60 / secondStep)
|
|
32
|
+
}, (__1, i_1)=>i_1 * secondStep);
|
|
33
|
+
$[4] = secondStep;
|
|
34
|
+
$[5] = t3;
|
|
35
|
+
} else t3 = $[5];
|
|
36
|
+
const seconds = t3;
|
|
37
|
+
let t4;
|
|
38
|
+
if ($[6] !== minute || $[7] !== onChange || $[8] !== second) {
|
|
39
|
+
t4 = (v)=>onChange(v, minute, second);
|
|
40
|
+
$[6] = minute;
|
|
41
|
+
$[7] = onChange;
|
|
42
|
+
$[8] = second;
|
|
43
|
+
$[9] = t4;
|
|
44
|
+
} else t4 = $[9];
|
|
45
|
+
let t5;
|
|
46
|
+
if ($[10] !== hour || $[11] !== hours || $[12] !== scrollKey || $[13] !== t4) {
|
|
47
|
+
t5 = /*#__PURE__*/ jsx(TimeColumn, {
|
|
48
|
+
values: hours,
|
|
49
|
+
selected: hour,
|
|
50
|
+
onSelect: t4,
|
|
51
|
+
label: "Hour",
|
|
52
|
+
scrollKey: scrollKey
|
|
53
|
+
});
|
|
54
|
+
$[10] = hour;
|
|
55
|
+
$[11] = hours;
|
|
56
|
+
$[12] = scrollKey;
|
|
57
|
+
$[13] = t4;
|
|
58
|
+
$[14] = t5;
|
|
59
|
+
} else t5 = $[14];
|
|
60
|
+
let t6;
|
|
61
|
+
if ($[15] !== hour || $[16] !== onChange || $[17] !== second) {
|
|
62
|
+
t6 = (v_0)=>onChange(hour, v_0, second);
|
|
63
|
+
$[15] = hour;
|
|
64
|
+
$[16] = onChange;
|
|
65
|
+
$[17] = second;
|
|
66
|
+
$[18] = t6;
|
|
67
|
+
} else t6 = $[18];
|
|
68
|
+
let t7;
|
|
69
|
+
if ($[19] !== minute || $[20] !== minutes || $[21] !== scrollKey || $[22] !== t6) {
|
|
70
|
+
t7 = /*#__PURE__*/ jsx(TimeColumn, {
|
|
71
|
+
values: minutes,
|
|
72
|
+
selected: minute,
|
|
73
|
+
onSelect: t6,
|
|
74
|
+
label: "Minute",
|
|
75
|
+
scrollKey: scrollKey
|
|
76
|
+
});
|
|
77
|
+
$[19] = minute;
|
|
78
|
+
$[20] = minutes;
|
|
79
|
+
$[21] = scrollKey;
|
|
80
|
+
$[22] = t6;
|
|
81
|
+
$[23] = t7;
|
|
82
|
+
} else t7 = $[23];
|
|
83
|
+
let t8;
|
|
84
|
+
if ($[24] !== hour || $[25] !== minute || $[26] !== onChange) {
|
|
85
|
+
t8 = (v_1)=>onChange(hour, minute, v_1);
|
|
86
|
+
$[24] = hour;
|
|
87
|
+
$[25] = minute;
|
|
88
|
+
$[26] = onChange;
|
|
89
|
+
$[27] = t8;
|
|
90
|
+
} else t8 = $[27];
|
|
91
|
+
let t9;
|
|
92
|
+
if ($[28] !== scrollKey || $[29] !== second || $[30] !== seconds || $[31] !== t8) {
|
|
93
|
+
t9 = /*#__PURE__*/ jsx(TimeColumn, {
|
|
94
|
+
values: seconds,
|
|
95
|
+
selected: second,
|
|
96
|
+
onSelect: t8,
|
|
97
|
+
label: "Second",
|
|
98
|
+
scrollKey: scrollKey
|
|
99
|
+
});
|
|
100
|
+
$[28] = scrollKey;
|
|
101
|
+
$[29] = second;
|
|
102
|
+
$[30] = seconds;
|
|
103
|
+
$[31] = t8;
|
|
104
|
+
$[32] = t9;
|
|
105
|
+
} else t9 = $[32];
|
|
106
|
+
let t10;
|
|
107
|
+
if ($[33] !== t5 || $[34] !== t7 || $[35] !== t9) {
|
|
108
|
+
t10 = /*#__PURE__*/ jsxs("div", {
|
|
109
|
+
"data-tao-time-panel": "",
|
|
110
|
+
children: [
|
|
111
|
+
t5,
|
|
112
|
+
t7,
|
|
113
|
+
t9
|
|
114
|
+
]
|
|
115
|
+
});
|
|
116
|
+
$[33] = t5;
|
|
117
|
+
$[34] = t7;
|
|
118
|
+
$[35] = t9;
|
|
119
|
+
$[36] = t10;
|
|
120
|
+
} else t10 = $[36];
|
|
121
|
+
return t10;
|
|
122
|
+
}
|
|
123
|
+
function TimeColumn(t0) {
|
|
124
|
+
const $ = c(21);
|
|
125
|
+
const { values, selected, onSelect, label, scrollKey } = t0;
|
|
126
|
+
const listRef = useRef(null);
|
|
127
|
+
let t1;
|
|
128
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
129
|
+
t1 = ()=>{
|
|
130
|
+
const el = listRef.current;
|
|
131
|
+
if (!el) return;
|
|
132
|
+
const selectedEl = el.querySelector("[data-tao-selected]");
|
|
133
|
+
selectedEl?.scrollIntoView({
|
|
134
|
+
block: "center",
|
|
135
|
+
behavior: "smooth"
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
$[0] = t1;
|
|
139
|
+
} else t1 = $[0];
|
|
140
|
+
const scrollToSelected = t1;
|
|
141
|
+
const initRef = _temp;
|
|
142
|
+
let t2;
|
|
143
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
144
|
+
t2 = ()=>{
|
|
145
|
+
scrollToSelected();
|
|
146
|
+
};
|
|
147
|
+
$[1] = t2;
|
|
148
|
+
} else t2 = $[1];
|
|
149
|
+
let t3;
|
|
150
|
+
if ($[2] !== scrollKey || $[3] !== selected) {
|
|
151
|
+
t3 = [
|
|
152
|
+
selected,
|
|
153
|
+
scrollKey,
|
|
154
|
+
scrollToSelected
|
|
155
|
+
];
|
|
156
|
+
$[2] = scrollKey;
|
|
157
|
+
$[3] = selected;
|
|
158
|
+
$[4] = t3;
|
|
159
|
+
} else t3 = $[4];
|
|
160
|
+
useEffect(t2, t3);
|
|
161
|
+
let t4;
|
|
162
|
+
if ($[5] !== label) {
|
|
163
|
+
t4 = /*#__PURE__*/ jsx("div", {
|
|
164
|
+
"data-tao-time-column-title": "",
|
|
165
|
+
children: label
|
|
166
|
+
});
|
|
167
|
+
$[5] = label;
|
|
168
|
+
$[6] = t4;
|
|
169
|
+
} else t4 = $[6];
|
|
170
|
+
let t5;
|
|
171
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
172
|
+
t5 = (el_1)=>{
|
|
173
|
+
listRef.current = el_1;
|
|
174
|
+
initRef(el_1);
|
|
175
|
+
};
|
|
176
|
+
$[7] = t5;
|
|
177
|
+
} else t5 = $[7];
|
|
178
|
+
let t6;
|
|
179
|
+
if ($[8] !== onSelect || $[9] !== selected || $[10] !== values) {
|
|
180
|
+
let t7;
|
|
181
|
+
if ($[12] !== onSelect || $[13] !== selected) {
|
|
182
|
+
t7 = (v)=>/*#__PURE__*/ jsx("button", {
|
|
183
|
+
type: "button",
|
|
184
|
+
"data-tao-time-cell": "",
|
|
185
|
+
"data-tao-selected": v === selected || void 0,
|
|
186
|
+
onClick: ()=>onSelect(v),
|
|
187
|
+
children: String(v).padStart(2, "0")
|
|
188
|
+
}, v);
|
|
189
|
+
$[12] = onSelect;
|
|
190
|
+
$[13] = selected;
|
|
191
|
+
$[14] = t7;
|
|
192
|
+
} else t7 = $[14];
|
|
193
|
+
t6 = values.map(t7);
|
|
194
|
+
$[8] = onSelect;
|
|
195
|
+
$[9] = selected;
|
|
196
|
+
$[10] = values;
|
|
197
|
+
$[11] = t6;
|
|
198
|
+
} else t6 = $[11];
|
|
199
|
+
let t7;
|
|
200
|
+
if ($[15] !== t6) {
|
|
201
|
+
t7 = /*#__PURE__*/ jsx("div", {
|
|
202
|
+
"data-tao-time-column-list": "",
|
|
203
|
+
ref: t5,
|
|
204
|
+
children: t6
|
|
205
|
+
});
|
|
206
|
+
$[15] = t6;
|
|
207
|
+
$[16] = t7;
|
|
208
|
+
} else t7 = $[16];
|
|
209
|
+
let t8;
|
|
210
|
+
if ($[17] !== label || $[18] !== t4 || $[19] !== t7) {
|
|
211
|
+
t8 = /*#__PURE__*/ jsxs("div", {
|
|
212
|
+
"data-tao-time-column": "",
|
|
213
|
+
"aria-label": label,
|
|
214
|
+
children: [
|
|
215
|
+
t4,
|
|
216
|
+
t7
|
|
217
|
+
]
|
|
218
|
+
});
|
|
219
|
+
$[17] = label;
|
|
220
|
+
$[18] = t4;
|
|
221
|
+
$[19] = t7;
|
|
222
|
+
$[20] = t8;
|
|
223
|
+
} else t8 = $[20];
|
|
224
|
+
return t8;
|
|
225
|
+
}
|
|
226
|
+
function _temp(el_0) {
|
|
227
|
+
if (!el_0) return;
|
|
228
|
+
const selectedEl_0 = el_0.querySelector("[data-tao-selected]");
|
|
229
|
+
selectedEl_0?.scrollIntoView({
|
|
230
|
+
block: "center"
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
export { TimePanel };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Dayjs } from 'dayjs';
|
|
2
|
+
/**
|
|
3
|
+
* Generate 6×7 matrix of days for a calendar month view.
|
|
4
|
+
* Weeks start on Monday. Includes fill days from prev/next month.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getCalendarWeeks(viewDate: Dayjs): Dayjs[][];
|
|
7
|
+
/**
|
|
8
|
+
* Generate 12 months for a given year.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getMonths(year: number): Dayjs[];
|
|
11
|
+
/**
|
|
12
|
+
* Generate 12 years for the decade containing the given year.
|
|
13
|
+
* Decade: e.g. 2026 → 2020-2031 (decade start - 1 to decade end + 1).
|
|
14
|
+
*/
|
|
15
|
+
export declare function getYears(year: number): Dayjs[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
function getCalendarWeeks(viewDate) {
|
|
3
|
+
const startOfMonth = viewDate.startOf('month');
|
|
4
|
+
const dayOfWeek = startOfMonth.day();
|
|
5
|
+
const offset = 0 === dayOfWeek ? 6 : dayOfWeek - 1;
|
|
6
|
+
const start = startOfMonth.subtract(offset, 'day');
|
|
7
|
+
return Array.from({
|
|
8
|
+
length: 6
|
|
9
|
+
}, (_, week)=>Array.from({
|
|
10
|
+
length: 7
|
|
11
|
+
}, (_, day)=>start.add(7 * week + day, 'day')));
|
|
12
|
+
}
|
|
13
|
+
function getMonths(year) {
|
|
14
|
+
return Array.from({
|
|
15
|
+
length: 12
|
|
16
|
+
}, (_, i)=>dayjs().year(year).month(i).startOf('month'));
|
|
17
|
+
}
|
|
18
|
+
function getYears(year) {
|
|
19
|
+
const decadeStart = 10 * Math.floor(year / 10);
|
|
20
|
+
return Array.from({
|
|
21
|
+
length: 12
|
|
22
|
+
}, (_, i)=>dayjs().year(decadeStart + i).startOf('year'));
|
|
23
|
+
}
|
|
24
|
+
export { getCalendarWeeks, getMonths, getYears };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Dayjs } from 'dayjs';
|
|
2
|
+
interface YearGridProps {
|
|
3
|
+
viewDate: Dayjs;
|
|
4
|
+
value?: Dayjs | null;
|
|
5
|
+
onSelect: (date: Dayjs) => void;
|
|
6
|
+
disabledDate?: (date: Dayjs) => boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function YearGrid({ viewDate, value, onSelect, disabledDate }: YearGridProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|