@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,33 @@
|
|
|
1
|
+
import { type ChangeEvent, type ReactNode } from 'react';
|
|
2
|
+
import { type TaoSize } from '../../provider/tao-provider';
|
|
3
|
+
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
|
|
4
|
+
import './checkbox.css';
|
|
5
|
+
export type CheckboxSemanticPart = 'root' | 'indicator' | 'label';
|
|
6
|
+
export interface CheckboxProps {
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
defaultChecked?: boolean;
|
|
9
|
+
indeterminate?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
12
|
+
value?: string;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
classNames?: SemanticClassNames<CheckboxSemanticPart>;
|
|
15
|
+
styles?: SemanticStyles<CheckboxSemanticPart>;
|
|
16
|
+
}
|
|
17
|
+
export declare function Checkbox({ checked, indeterminate, disabled, onChange, value, children, classNames, styles, }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export type CheckboxOptionType = {
|
|
19
|
+
label: ReactNode;
|
|
20
|
+
value: string;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
} | string;
|
|
23
|
+
export interface CheckboxGroupProps {
|
|
24
|
+
options?: CheckboxOptionType[];
|
|
25
|
+
value?: string[];
|
|
26
|
+
defaultValue?: string[];
|
|
27
|
+
onChange?: (values: string[]) => void;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
size?: TaoSize;
|
|
30
|
+
direction?: 'horizontal' | 'vertical';
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
}
|
|
33
|
+
export declare function CheckboxGroup({ options, value, onChange, disabled, direction, children, }: CheckboxGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { createContext, useContext, useEffect, useRef } from "react";
|
|
4
|
+
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
5
|
+
import { cx } from "../../utils/semantic.js";
|
|
6
|
+
import "./checkbox.css";
|
|
7
|
+
const CheckboxGroupContext = /*#__PURE__*/ createContext(null);
|
|
8
|
+
function Checkbox(t0) {
|
|
9
|
+
const $ = c(43);
|
|
10
|
+
const { checked, indeterminate, disabled, onChange, value, children, classNames, styles } = t0;
|
|
11
|
+
const ctx = useTaoConfig();
|
|
12
|
+
const groupCtx = useContext(CheckboxGroupContext);
|
|
13
|
+
const inputRef = useRef(null);
|
|
14
|
+
const resolvedDisabled = disabled ?? groupCtx?.disabled ?? ctx.disabled ?? false;
|
|
15
|
+
let t1;
|
|
16
|
+
if ($[0] !== checked || $[1] !== groupCtx || $[2] !== value) {
|
|
17
|
+
t1 = groupCtx ? groupCtx.value.includes(value ?? "") : checked;
|
|
18
|
+
$[0] = checked;
|
|
19
|
+
$[1] = groupCtx;
|
|
20
|
+
$[2] = value;
|
|
21
|
+
$[3] = t1;
|
|
22
|
+
} else t1 = $[3];
|
|
23
|
+
const resolvedChecked = t1;
|
|
24
|
+
let t2;
|
|
25
|
+
let t3;
|
|
26
|
+
if ($[4] !== indeterminate) {
|
|
27
|
+
t2 = ()=>{
|
|
28
|
+
if (inputRef.current) inputRef.current.indeterminate = !!indeterminate;
|
|
29
|
+
};
|
|
30
|
+
t3 = [
|
|
31
|
+
indeterminate
|
|
32
|
+
];
|
|
33
|
+
$[4] = indeterminate;
|
|
34
|
+
$[5] = t2;
|
|
35
|
+
$[6] = t3;
|
|
36
|
+
} else {
|
|
37
|
+
t2 = $[5];
|
|
38
|
+
t3 = $[6];
|
|
39
|
+
}
|
|
40
|
+
useEffect(t2, t3);
|
|
41
|
+
let t4;
|
|
42
|
+
if ($[7] !== groupCtx || $[8] !== onChange || $[9] !== value) {
|
|
43
|
+
t4 = (e)=>{
|
|
44
|
+
if (groupCtx && null != value) groupCtx.onChange(value, e.target.checked);
|
|
45
|
+
else onChange?.(e);
|
|
46
|
+
};
|
|
47
|
+
$[7] = groupCtx;
|
|
48
|
+
$[8] = onChange;
|
|
49
|
+
$[9] = value;
|
|
50
|
+
$[10] = t4;
|
|
51
|
+
} else t4 = $[10];
|
|
52
|
+
const handleChange = t4;
|
|
53
|
+
const t5 = resolvedDisabled || void 0;
|
|
54
|
+
const t6 = classNames?.root;
|
|
55
|
+
let t7;
|
|
56
|
+
if ($[11] !== t6) {
|
|
57
|
+
t7 = cx(t6);
|
|
58
|
+
$[11] = t6;
|
|
59
|
+
$[12] = t7;
|
|
60
|
+
} else t7 = $[12];
|
|
61
|
+
const t8 = styles?.root;
|
|
62
|
+
const t9 = indeterminate ? "mixed" : void 0;
|
|
63
|
+
let t10;
|
|
64
|
+
if ($[13] !== handleChange || $[14] !== resolvedChecked || $[15] !== resolvedDisabled || $[16] !== t9) {
|
|
65
|
+
t10 = /*#__PURE__*/ jsx("input", {
|
|
66
|
+
ref: inputRef,
|
|
67
|
+
type: "checkbox",
|
|
68
|
+
checked: resolvedChecked,
|
|
69
|
+
disabled: resolvedDisabled,
|
|
70
|
+
onChange: handleChange,
|
|
71
|
+
"aria-checked": t9,
|
|
72
|
+
"data-tao-checkbox-input": ""
|
|
73
|
+
});
|
|
74
|
+
$[13] = handleChange;
|
|
75
|
+
$[14] = resolvedChecked;
|
|
76
|
+
$[15] = resolvedDisabled;
|
|
77
|
+
$[16] = t9;
|
|
78
|
+
$[17] = t10;
|
|
79
|
+
} else t10 = $[17];
|
|
80
|
+
const t11 = resolvedChecked || void 0;
|
|
81
|
+
const t12 = indeterminate || void 0;
|
|
82
|
+
const t13 = classNames?.indicator;
|
|
83
|
+
let t14;
|
|
84
|
+
if ($[18] !== t13) {
|
|
85
|
+
t14 = cx(t13);
|
|
86
|
+
$[18] = t13;
|
|
87
|
+
$[19] = t14;
|
|
88
|
+
} else t14 = $[19];
|
|
89
|
+
const t15 = styles?.indicator;
|
|
90
|
+
let t16;
|
|
91
|
+
if ($[20] !== indeterminate || $[21] !== resolvedChecked) {
|
|
92
|
+
t16 = resolvedChecked && !indeterminate && /*#__PURE__*/ jsx(CheckIcon, {});
|
|
93
|
+
$[20] = indeterminate;
|
|
94
|
+
$[21] = resolvedChecked;
|
|
95
|
+
$[22] = t16;
|
|
96
|
+
} else t16 = $[22];
|
|
97
|
+
let t17;
|
|
98
|
+
if ($[23] !== indeterminate) {
|
|
99
|
+
t17 = indeterminate && /*#__PURE__*/ jsx(MinusIcon, {});
|
|
100
|
+
$[23] = indeterminate;
|
|
101
|
+
$[24] = t17;
|
|
102
|
+
} else t17 = $[24];
|
|
103
|
+
let t18;
|
|
104
|
+
if ($[25] !== t11 || $[26] !== t12 || $[27] !== t14 || $[28] !== t15 || $[29] !== t16 || $[30] !== t17) {
|
|
105
|
+
t18 = /*#__PURE__*/ jsxs("span", {
|
|
106
|
+
"data-tao-checkbox": "",
|
|
107
|
+
"data-tao-checked": t11,
|
|
108
|
+
"data-tao-indeterminate": t12,
|
|
109
|
+
className: t14,
|
|
110
|
+
style: t15,
|
|
111
|
+
children: [
|
|
112
|
+
t16,
|
|
113
|
+
t17
|
|
114
|
+
]
|
|
115
|
+
});
|
|
116
|
+
$[25] = t11;
|
|
117
|
+
$[26] = t12;
|
|
118
|
+
$[27] = t14;
|
|
119
|
+
$[28] = t15;
|
|
120
|
+
$[29] = t16;
|
|
121
|
+
$[30] = t17;
|
|
122
|
+
$[31] = t18;
|
|
123
|
+
} else t18 = $[31];
|
|
124
|
+
let t19;
|
|
125
|
+
if ($[32] !== children || $[33] !== classNames?.label || $[34] !== styles?.label) {
|
|
126
|
+
t19 = null != children && /*#__PURE__*/ jsx("span", {
|
|
127
|
+
"data-tao-checkbox-label": "",
|
|
128
|
+
className: cx(classNames?.label),
|
|
129
|
+
style: styles?.label,
|
|
130
|
+
children: children
|
|
131
|
+
});
|
|
132
|
+
$[32] = children;
|
|
133
|
+
$[33] = classNames?.label;
|
|
134
|
+
$[34] = styles?.label;
|
|
135
|
+
$[35] = t19;
|
|
136
|
+
} else t19 = $[35];
|
|
137
|
+
let t20;
|
|
138
|
+
if ($[36] !== t10 || $[37] !== t18 || $[38] !== t19 || $[39] !== t5 || $[40] !== t7 || $[41] !== t8) {
|
|
139
|
+
t20 = /*#__PURE__*/ jsxs("label", {
|
|
140
|
+
"data-tao-checkbox-wrapper": "",
|
|
141
|
+
"data-tao-disabled": t5,
|
|
142
|
+
className: t7,
|
|
143
|
+
style: t8,
|
|
144
|
+
children: [
|
|
145
|
+
t10,
|
|
146
|
+
t18,
|
|
147
|
+
t19
|
|
148
|
+
]
|
|
149
|
+
});
|
|
150
|
+
$[36] = t10;
|
|
151
|
+
$[37] = t18;
|
|
152
|
+
$[38] = t19;
|
|
153
|
+
$[39] = t5;
|
|
154
|
+
$[40] = t7;
|
|
155
|
+
$[41] = t8;
|
|
156
|
+
$[42] = t20;
|
|
157
|
+
} else t20 = $[42];
|
|
158
|
+
return t20;
|
|
159
|
+
}
|
|
160
|
+
function CheckboxGroup(t0) {
|
|
161
|
+
const $ = c(26);
|
|
162
|
+
const { options, value: t1, onChange, disabled, direction: t2, children } = t0;
|
|
163
|
+
let t3;
|
|
164
|
+
if ($[0] !== t1) {
|
|
165
|
+
t3 = void 0 === t1 ? [] : t1;
|
|
166
|
+
$[0] = t1;
|
|
167
|
+
$[1] = t3;
|
|
168
|
+
} else t3 = $[1];
|
|
169
|
+
const value = t3;
|
|
170
|
+
const direction = void 0 === t2 ? "horizontal" : t2;
|
|
171
|
+
const ctx = useTaoConfig();
|
|
172
|
+
const resolvedDisabled = disabled ?? ctx.disabled ?? false;
|
|
173
|
+
let t4;
|
|
174
|
+
if ($[2] !== onChange || $[3] !== value) {
|
|
175
|
+
t4 = (itemValue, checked)=>{
|
|
176
|
+
const next = checked ? [
|
|
177
|
+
...value,
|
|
178
|
+
itemValue
|
|
179
|
+
] : value.filter((v)=>v !== itemValue);
|
|
180
|
+
onChange?.(next);
|
|
181
|
+
};
|
|
182
|
+
$[2] = onChange;
|
|
183
|
+
$[3] = value;
|
|
184
|
+
$[4] = t4;
|
|
185
|
+
} else t4 = $[4];
|
|
186
|
+
const handleItemChange = t4;
|
|
187
|
+
let t5;
|
|
188
|
+
if ($[5] !== handleItemChange || $[6] !== resolvedDisabled || $[7] !== value) {
|
|
189
|
+
t5 = {
|
|
190
|
+
value,
|
|
191
|
+
disabled: resolvedDisabled,
|
|
192
|
+
onChange: handleItemChange
|
|
193
|
+
};
|
|
194
|
+
$[5] = handleItemChange;
|
|
195
|
+
$[6] = resolvedDisabled;
|
|
196
|
+
$[7] = value;
|
|
197
|
+
$[8] = t5;
|
|
198
|
+
} else t5 = $[8];
|
|
199
|
+
const groupCtxValue = t5;
|
|
200
|
+
let T0;
|
|
201
|
+
let t6;
|
|
202
|
+
let t7;
|
|
203
|
+
let t8;
|
|
204
|
+
let t9;
|
|
205
|
+
if ($[9] !== children || $[10] !== direction || $[11] !== groupCtxValue || $[12] !== options) {
|
|
206
|
+
const normalizedOptions = options?.map(_temp);
|
|
207
|
+
T0 = CheckboxGroupContext.Provider;
|
|
208
|
+
t9 = groupCtxValue;
|
|
209
|
+
t6 = "";
|
|
210
|
+
t7 = direction;
|
|
211
|
+
t8 = normalizedOptions ? normalizedOptions.map(_temp2) : children;
|
|
212
|
+
$[9] = children;
|
|
213
|
+
$[10] = direction;
|
|
214
|
+
$[11] = groupCtxValue;
|
|
215
|
+
$[12] = options;
|
|
216
|
+
$[13] = T0;
|
|
217
|
+
$[14] = t6;
|
|
218
|
+
$[15] = t7;
|
|
219
|
+
$[16] = t8;
|
|
220
|
+
$[17] = t9;
|
|
221
|
+
} else {
|
|
222
|
+
T0 = $[13];
|
|
223
|
+
t6 = $[14];
|
|
224
|
+
t7 = $[15];
|
|
225
|
+
t8 = $[16];
|
|
226
|
+
t9 = $[17];
|
|
227
|
+
}
|
|
228
|
+
let t10;
|
|
229
|
+
if ($[18] !== t6 || $[19] !== t7 || $[20] !== t8) {
|
|
230
|
+
t10 = /*#__PURE__*/ jsx("div", {
|
|
231
|
+
"data-tao-checkbox-group": t6,
|
|
232
|
+
"data-tao-direction": t7,
|
|
233
|
+
children: t8
|
|
234
|
+
});
|
|
235
|
+
$[18] = t6;
|
|
236
|
+
$[19] = t7;
|
|
237
|
+
$[20] = t8;
|
|
238
|
+
$[21] = t10;
|
|
239
|
+
} else t10 = $[21];
|
|
240
|
+
let t11;
|
|
241
|
+
if ($[22] !== T0 || $[23] !== t10 || $[24] !== t9) {
|
|
242
|
+
t11 = /*#__PURE__*/ jsx(T0, {
|
|
243
|
+
value: t9,
|
|
244
|
+
children: t10
|
|
245
|
+
});
|
|
246
|
+
$[22] = T0;
|
|
247
|
+
$[23] = t10;
|
|
248
|
+
$[24] = t9;
|
|
249
|
+
$[25] = t11;
|
|
250
|
+
} else t11 = $[25];
|
|
251
|
+
return t11;
|
|
252
|
+
}
|
|
253
|
+
function _temp2(opt_0) {
|
|
254
|
+
return /*#__PURE__*/ jsx(Checkbox, {
|
|
255
|
+
value: opt_0.value,
|
|
256
|
+
disabled: opt_0.disabled,
|
|
257
|
+
children: opt_0.label
|
|
258
|
+
}, opt_0.value);
|
|
259
|
+
}
|
|
260
|
+
function _temp(opt) {
|
|
261
|
+
return "string" == typeof opt ? {
|
|
262
|
+
label: opt,
|
|
263
|
+
value: opt
|
|
264
|
+
} : opt;
|
|
265
|
+
}
|
|
266
|
+
function CheckIcon() {
|
|
267
|
+
const $ = c(1);
|
|
268
|
+
let t0;
|
|
269
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
270
|
+
t0 = /*#__PURE__*/ jsx("svg", {
|
|
271
|
+
"data-tao-checkbox-icon": "",
|
|
272
|
+
width: "12",
|
|
273
|
+
height: "12",
|
|
274
|
+
viewBox: "0 0 24 24",
|
|
275
|
+
fill: "none",
|
|
276
|
+
stroke: "currentColor",
|
|
277
|
+
strokeWidth: "3",
|
|
278
|
+
strokeLinecap: "round",
|
|
279
|
+
strokeLinejoin: "round",
|
|
280
|
+
children: /*#__PURE__*/ jsx("polyline", {
|
|
281
|
+
points: "20 6 9 17 4 12"
|
|
282
|
+
})
|
|
283
|
+
});
|
|
284
|
+
$[0] = t0;
|
|
285
|
+
} else t0 = $[0];
|
|
286
|
+
return t0;
|
|
287
|
+
}
|
|
288
|
+
function MinusIcon() {
|
|
289
|
+
const $ = c(1);
|
|
290
|
+
let t0;
|
|
291
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
292
|
+
t0 = /*#__PURE__*/ jsx("svg", {
|
|
293
|
+
"data-tao-checkbox-icon": "",
|
|
294
|
+
width: "12",
|
|
295
|
+
height: "12",
|
|
296
|
+
viewBox: "0 0 24 24",
|
|
297
|
+
fill: "none",
|
|
298
|
+
stroke: "currentColor",
|
|
299
|
+
strokeWidth: "3",
|
|
300
|
+
strokeLinecap: "round",
|
|
301
|
+
children: /*#__PURE__*/ jsx("line", {
|
|
302
|
+
x1: "5",
|
|
303
|
+
y1: "12",
|
|
304
|
+
x2: "19",
|
|
305
|
+
y2: "12"
|
|
306
|
+
})
|
|
307
|
+
});
|
|
308
|
+
$[0] = t0;
|
|
309
|
+
} else t0 = $[0];
|
|
310
|
+
return t0;
|
|
311
|
+
}
|
|
312
|
+
export { Checkbox, CheckboxGroup };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Dayjs } from 'dayjs';
|
|
2
|
+
interface CalendarGridProps {
|
|
3
|
+
viewDate: Dayjs;
|
|
4
|
+
value?: Dayjs | null;
|
|
5
|
+
/** Range mode: start of confirmed range */
|
|
6
|
+
rangeStart?: Dayjs | null;
|
|
7
|
+
/** Range mode: end of confirmed range */
|
|
8
|
+
rangeEnd?: Dayjs | null;
|
|
9
|
+
/** Range mode: date currently being hovered */
|
|
10
|
+
hoverDate?: Dayjs | null;
|
|
11
|
+
onSelect: (date: Dayjs) => void;
|
|
12
|
+
onHover?: (date: Dayjs | null) => void;
|
|
13
|
+
disabledDate?: (date: Dayjs) => boolean;
|
|
14
|
+
minDate?: Dayjs;
|
|
15
|
+
maxDate?: Dayjs;
|
|
16
|
+
}
|
|
17
|
+
export declare function CalendarGrid({ viewDate, value, rangeStart, rangeEnd, hoverDate, onSelect, onHover, disabledDate, minDate, maxDate, }: CalendarGridProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
import { getCalendarWeeks } from "./use-calendar.js";
|
|
5
|
+
const WEEKDAYS = [
|
|
6
|
+
'Mo',
|
|
7
|
+
'Tu',
|
|
8
|
+
'We',
|
|
9
|
+
'Th',
|
|
10
|
+
'Fr',
|
|
11
|
+
'Sa',
|
|
12
|
+
'Su'
|
|
13
|
+
];
|
|
14
|
+
function CalendarGrid(t0) {
|
|
15
|
+
const $ = c(33);
|
|
16
|
+
const { viewDate, value, rangeStart, rangeEnd, hoverDate, onSelect, onHover, disabledDate, minDate, maxDate } = t0;
|
|
17
|
+
let t1;
|
|
18
|
+
let t2;
|
|
19
|
+
let t3;
|
|
20
|
+
let t4;
|
|
21
|
+
if ($[0] !== disabledDate || $[1] !== hoverDate || $[2] !== maxDate || $[3] !== minDate || $[4] !== onHover || $[5] !== onSelect || $[6] !== rangeEnd || $[7] !== rangeStart || $[8] !== value || $[9] !== viewDate) {
|
|
22
|
+
const weeks = getCalendarWeeks(viewDate);
|
|
23
|
+
const today = dayjs();
|
|
24
|
+
let t5;
|
|
25
|
+
if ($[14] !== viewDate) {
|
|
26
|
+
t5 = viewDate.month();
|
|
27
|
+
$[14] = viewDate;
|
|
28
|
+
$[15] = t5;
|
|
29
|
+
} else t5 = $[15];
|
|
30
|
+
const currentMonth = t5;
|
|
31
|
+
const isRangeMode = void 0 !== rangeStart;
|
|
32
|
+
let t6;
|
|
33
|
+
if ($[16] !== disabledDate || $[17] !== maxDate || $[18] !== minDate) {
|
|
34
|
+
t6 = (date)=>{
|
|
35
|
+
if (disabledDate?.(date)) return true;
|
|
36
|
+
if (minDate && date.isBefore(minDate, "day")) return true;
|
|
37
|
+
if (maxDate && date.isAfter(maxDate, "day")) return true;
|
|
38
|
+
return false;
|
|
39
|
+
};
|
|
40
|
+
$[16] = disabledDate;
|
|
41
|
+
$[17] = maxDate;
|
|
42
|
+
$[18] = minDate;
|
|
43
|
+
$[19] = t6;
|
|
44
|
+
} else t6 = $[19];
|
|
45
|
+
const isDisabled = t6;
|
|
46
|
+
let t7;
|
|
47
|
+
if ($[20] !== hoverDate || $[21] !== isRangeMode || $[22] !== rangeEnd || $[23] !== rangeStart) {
|
|
48
|
+
t7 = ()=>{
|
|
49
|
+
if (!isRangeMode) return null;
|
|
50
|
+
const s = rangeStart;
|
|
51
|
+
const e = rangeEnd ?? hoverDate;
|
|
52
|
+
if (!s || !e) return null;
|
|
53
|
+
return s.isBefore(e, "day") ? [
|
|
54
|
+
s,
|
|
55
|
+
e
|
|
56
|
+
] : [
|
|
57
|
+
e,
|
|
58
|
+
s
|
|
59
|
+
];
|
|
60
|
+
};
|
|
61
|
+
$[20] = hoverDate;
|
|
62
|
+
$[21] = isRangeMode;
|
|
63
|
+
$[22] = rangeEnd;
|
|
64
|
+
$[23] = rangeStart;
|
|
65
|
+
$[24] = t7;
|
|
66
|
+
} else t7 = $[24];
|
|
67
|
+
const getEffectiveRange = t7;
|
|
68
|
+
const effectiveRange = getEffectiveRange();
|
|
69
|
+
const isInRange = (date_0)=>{
|
|
70
|
+
if (!effectiveRange) return false;
|
|
71
|
+
return date_0.isAfter(effectiveRange[0], "day") && date_0.isBefore(effectiveRange[1], "day");
|
|
72
|
+
};
|
|
73
|
+
const isRangeStart = (date_1)=>{
|
|
74
|
+
if (!effectiveRange) return false;
|
|
75
|
+
return date_1.isSame(effectiveRange[0], "day");
|
|
76
|
+
};
|
|
77
|
+
const isRangeEnd = (date_2)=>{
|
|
78
|
+
if (!effectiveRange) return false;
|
|
79
|
+
return date_2.isSame(effectiveRange[1], "day");
|
|
80
|
+
};
|
|
81
|
+
t2 = "";
|
|
82
|
+
t3 = "grid";
|
|
83
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
84
|
+
t4 = /*#__PURE__*/ jsx("thead", {
|
|
85
|
+
children: /*#__PURE__*/ jsx("tr", {
|
|
86
|
+
children: WEEKDAYS.map(_temp)
|
|
87
|
+
})
|
|
88
|
+
});
|
|
89
|
+
$[25] = t4;
|
|
90
|
+
} else t4 = $[25];
|
|
91
|
+
t1 = weeks.map((week, wi)=>/*#__PURE__*/ jsx("tr", {
|
|
92
|
+
children: week.map((date_3)=>{
|
|
93
|
+
const isOtherMonth = date_3.month() !== currentMonth;
|
|
94
|
+
const disabled = isDisabled(date_3);
|
|
95
|
+
const isSelected = !isRangeMode && value && date_3.isSame(value, "day");
|
|
96
|
+
const isToday = date_3.isSame(today, "day");
|
|
97
|
+
const inRange = !isOtherMonth && isInRange(date_3);
|
|
98
|
+
const rStart = !isOtherMonth && isRangeStart(date_3);
|
|
99
|
+
const rEnd = !isOtherMonth && isRangeEnd(date_3);
|
|
100
|
+
return /*#__PURE__*/ jsx("td", {
|
|
101
|
+
"data-tao-calendar-cell": "",
|
|
102
|
+
"data-tao-selected": isSelected || void 0,
|
|
103
|
+
"data-tao-today": isToday || void 0,
|
|
104
|
+
"data-tao-other-month": isOtherMonth || void 0,
|
|
105
|
+
"data-tao-disabled": disabled || void 0,
|
|
106
|
+
"data-tao-in-range": inRange || void 0,
|
|
107
|
+
"data-tao-range-start": rStart || void 0,
|
|
108
|
+
"data-tao-range-end": rEnd || void 0,
|
|
109
|
+
onClick: ()=>{
|
|
110
|
+
if (!disabled) onSelect(date_3);
|
|
111
|
+
},
|
|
112
|
+
onMouseEnter: ()=>onHover?.(date_3),
|
|
113
|
+
onMouseLeave: ()=>onHover?.(null),
|
|
114
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
115
|
+
"data-tao-calendar-cell-inner": "",
|
|
116
|
+
children: date_3.date()
|
|
117
|
+
})
|
|
118
|
+
}, date_3.format("YYYY-MM-DD"));
|
|
119
|
+
})
|
|
120
|
+
}, wi));
|
|
121
|
+
$[0] = disabledDate;
|
|
122
|
+
$[1] = hoverDate;
|
|
123
|
+
$[2] = maxDate;
|
|
124
|
+
$[3] = minDate;
|
|
125
|
+
$[4] = onHover;
|
|
126
|
+
$[5] = onSelect;
|
|
127
|
+
$[6] = rangeEnd;
|
|
128
|
+
$[7] = rangeStart;
|
|
129
|
+
$[8] = value;
|
|
130
|
+
$[9] = viewDate;
|
|
131
|
+
$[10] = t1;
|
|
132
|
+
$[11] = t2;
|
|
133
|
+
$[12] = t3;
|
|
134
|
+
$[13] = t4;
|
|
135
|
+
} else {
|
|
136
|
+
t1 = $[10];
|
|
137
|
+
t2 = $[11];
|
|
138
|
+
t3 = $[12];
|
|
139
|
+
t4 = $[13];
|
|
140
|
+
}
|
|
141
|
+
let t5;
|
|
142
|
+
if ($[26] !== t1) {
|
|
143
|
+
t5 = /*#__PURE__*/ jsx("tbody", {
|
|
144
|
+
children: t1
|
|
145
|
+
});
|
|
146
|
+
$[26] = t1;
|
|
147
|
+
$[27] = t5;
|
|
148
|
+
} else t5 = $[27];
|
|
149
|
+
let t6;
|
|
150
|
+
if ($[28] !== t2 || $[29] !== t3 || $[30] !== t4 || $[31] !== t5) {
|
|
151
|
+
t6 = /*#__PURE__*/ jsxs("table", {
|
|
152
|
+
"data-tao-calendar-grid": t2,
|
|
153
|
+
role: t3,
|
|
154
|
+
children: [
|
|
155
|
+
t4,
|
|
156
|
+
t5
|
|
157
|
+
]
|
|
158
|
+
});
|
|
159
|
+
$[28] = t2;
|
|
160
|
+
$[29] = t3;
|
|
161
|
+
$[30] = t4;
|
|
162
|
+
$[31] = t5;
|
|
163
|
+
$[32] = t6;
|
|
164
|
+
} else t6 = $[32];
|
|
165
|
+
return t6;
|
|
166
|
+
}
|
|
167
|
+
function _temp(d) {
|
|
168
|
+
return /*#__PURE__*/ jsx("th", {
|
|
169
|
+
"data-tao-calendar-weekday": "",
|
|
170
|
+
children: d
|
|
171
|
+
}, d);
|
|
172
|
+
}
|
|
173
|
+
export { CalendarGrid };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Dayjs } from 'dayjs';
|
|
2
|
+
import type { PanelMode } from '../types';
|
|
3
|
+
interface CalendarHeaderProps {
|
|
4
|
+
viewDate: Dayjs;
|
|
5
|
+
panelMode: PanelMode;
|
|
6
|
+
onViewDateChange: (date: Dayjs) => void;
|
|
7
|
+
onPanelModeChange: (mode: PanelMode) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function CalendarHeader({ viewDate, panelMode, onViewDateChange, onPanelModeChange, }: CalendarHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|