@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,34 @@
|
|
|
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 './radio.css';
|
|
5
|
+
export type RadioSemanticPart = 'root' | 'indicator' | 'label';
|
|
6
|
+
export interface RadioProps {
|
|
7
|
+
value?: string;
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
defaultChecked?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
name?: string;
|
|
14
|
+
classNames?: SemanticClassNames<RadioSemanticPart>;
|
|
15
|
+
styles?: SemanticStyles<RadioSemanticPart>;
|
|
16
|
+
}
|
|
17
|
+
export declare function Radio({ value, checked, disabled, onChange, children, name, classNames, styles, }: RadioProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export type RadioOptionType = {
|
|
19
|
+
label: ReactNode;
|
|
20
|
+
value: string;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
} | string;
|
|
23
|
+
export interface RadioGroupProps {
|
|
24
|
+
options?: RadioOptionType[];
|
|
25
|
+
value?: string;
|
|
26
|
+
defaultValue?: string;
|
|
27
|
+
onChange?: (value: string) => void;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
size?: TaoSize;
|
|
30
|
+
direction?: 'horizontal' | 'vertical';
|
|
31
|
+
name?: string;
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
export declare function RadioGroup({ options, value, onChange, disabled, direction, name, children, }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
5
|
+
import { cx } from "../../utils/semantic.js";
|
|
6
|
+
import "./radio.css";
|
|
7
|
+
const RadioGroupContext = /*#__PURE__*/ createContext(null);
|
|
8
|
+
function Radio(t0) {
|
|
9
|
+
const $ = c(29);
|
|
10
|
+
const { value, checked, disabled, onChange, children, name, classNames, styles } = t0;
|
|
11
|
+
const ctx = useTaoConfig();
|
|
12
|
+
const groupCtx = useContext(RadioGroupContext);
|
|
13
|
+
const resolvedDisabled = disabled ?? groupCtx?.disabled ?? ctx.disabled ?? false;
|
|
14
|
+
const resolvedChecked = groupCtx ? groupCtx.value === value : checked;
|
|
15
|
+
const resolvedName = groupCtx?.name ?? name;
|
|
16
|
+
let t1;
|
|
17
|
+
if ($[0] !== groupCtx || $[1] !== onChange || $[2] !== value) {
|
|
18
|
+
t1 = (e)=>{
|
|
19
|
+
if (groupCtx && null != value) groupCtx.onChange(value);
|
|
20
|
+
else onChange?.(e);
|
|
21
|
+
};
|
|
22
|
+
$[0] = groupCtx;
|
|
23
|
+
$[1] = onChange;
|
|
24
|
+
$[2] = value;
|
|
25
|
+
$[3] = t1;
|
|
26
|
+
} else t1 = $[3];
|
|
27
|
+
const handleChange = t1;
|
|
28
|
+
const t2 = resolvedDisabled || void 0;
|
|
29
|
+
const t3 = classNames?.root;
|
|
30
|
+
let t4;
|
|
31
|
+
if ($[4] !== t3) {
|
|
32
|
+
t4 = cx(t3);
|
|
33
|
+
$[4] = t3;
|
|
34
|
+
$[5] = t4;
|
|
35
|
+
} else t4 = $[5];
|
|
36
|
+
const t5 = styles?.root;
|
|
37
|
+
let t6;
|
|
38
|
+
if ($[6] !== handleChange || $[7] !== resolvedChecked || $[8] !== resolvedDisabled || $[9] !== resolvedName || $[10] !== value) {
|
|
39
|
+
t6 = /*#__PURE__*/ jsx("input", {
|
|
40
|
+
type: "radio",
|
|
41
|
+
name: resolvedName,
|
|
42
|
+
value: value,
|
|
43
|
+
checked: resolvedChecked,
|
|
44
|
+
disabled: resolvedDisabled,
|
|
45
|
+
onChange: handleChange,
|
|
46
|
+
"data-tao-radio-input": ""
|
|
47
|
+
});
|
|
48
|
+
$[6] = handleChange;
|
|
49
|
+
$[7] = resolvedChecked;
|
|
50
|
+
$[8] = resolvedDisabled;
|
|
51
|
+
$[9] = resolvedName;
|
|
52
|
+
$[10] = value;
|
|
53
|
+
$[11] = t6;
|
|
54
|
+
} else t6 = $[11];
|
|
55
|
+
const t7 = resolvedChecked || void 0;
|
|
56
|
+
const t8 = classNames?.indicator;
|
|
57
|
+
let t9;
|
|
58
|
+
if ($[12] !== t8) {
|
|
59
|
+
t9 = cx(t8);
|
|
60
|
+
$[12] = t8;
|
|
61
|
+
$[13] = t9;
|
|
62
|
+
} else t9 = $[13];
|
|
63
|
+
const t10 = styles?.indicator;
|
|
64
|
+
let t11;
|
|
65
|
+
if ($[14] !== t10 || $[15] !== t7 || $[16] !== t9) {
|
|
66
|
+
t11 = /*#__PURE__*/ jsx("span", {
|
|
67
|
+
"data-tao-radio": "",
|
|
68
|
+
"data-tao-checked": t7,
|
|
69
|
+
className: t9,
|
|
70
|
+
style: t10
|
|
71
|
+
});
|
|
72
|
+
$[14] = t10;
|
|
73
|
+
$[15] = t7;
|
|
74
|
+
$[16] = t9;
|
|
75
|
+
$[17] = t11;
|
|
76
|
+
} else t11 = $[17];
|
|
77
|
+
let t12;
|
|
78
|
+
if ($[18] !== children || $[19] !== classNames?.label || $[20] !== styles?.label) {
|
|
79
|
+
t12 = null != children && /*#__PURE__*/ jsx("span", {
|
|
80
|
+
"data-tao-radio-label": "",
|
|
81
|
+
className: cx(classNames?.label),
|
|
82
|
+
style: styles?.label,
|
|
83
|
+
children: children
|
|
84
|
+
});
|
|
85
|
+
$[18] = children;
|
|
86
|
+
$[19] = classNames?.label;
|
|
87
|
+
$[20] = styles?.label;
|
|
88
|
+
$[21] = t12;
|
|
89
|
+
} else t12 = $[21];
|
|
90
|
+
let t13;
|
|
91
|
+
if ($[22] !== t11 || $[23] !== t12 || $[24] !== t2 || $[25] !== t4 || $[26] !== t5 || $[27] !== t6) {
|
|
92
|
+
t13 = /*#__PURE__*/ jsxs("label", {
|
|
93
|
+
"data-tao-radio-wrapper": "",
|
|
94
|
+
"data-tao-disabled": t2,
|
|
95
|
+
className: t4,
|
|
96
|
+
style: t5,
|
|
97
|
+
children: [
|
|
98
|
+
t6,
|
|
99
|
+
t11,
|
|
100
|
+
t12
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
$[22] = t11;
|
|
104
|
+
$[23] = t12;
|
|
105
|
+
$[24] = t2;
|
|
106
|
+
$[25] = t4;
|
|
107
|
+
$[26] = t5;
|
|
108
|
+
$[27] = t6;
|
|
109
|
+
$[28] = t13;
|
|
110
|
+
} else t13 = $[28];
|
|
111
|
+
return t13;
|
|
112
|
+
}
|
|
113
|
+
function RadioGroup(t0) {
|
|
114
|
+
const $ = c(26);
|
|
115
|
+
const { options, value, onChange, disabled, direction: t1, name, children } = t0;
|
|
116
|
+
const direction = void 0 === t1 ? "horizontal" : t1;
|
|
117
|
+
const ctx = useTaoConfig();
|
|
118
|
+
const resolvedDisabled = disabled ?? ctx.disabled ?? false;
|
|
119
|
+
let t2;
|
|
120
|
+
if ($[0] !== onChange) {
|
|
121
|
+
t2 = (itemValue)=>{
|
|
122
|
+
onChange?.(itemValue);
|
|
123
|
+
};
|
|
124
|
+
$[0] = onChange;
|
|
125
|
+
$[1] = t2;
|
|
126
|
+
} else t2 = $[1];
|
|
127
|
+
const handleChange = t2;
|
|
128
|
+
let t3;
|
|
129
|
+
if ($[2] !== handleChange || $[3] !== name || $[4] !== resolvedDisabled || $[5] !== value) {
|
|
130
|
+
t3 = {
|
|
131
|
+
name,
|
|
132
|
+
value,
|
|
133
|
+
disabled: resolvedDisabled,
|
|
134
|
+
onChange: handleChange
|
|
135
|
+
};
|
|
136
|
+
$[2] = handleChange;
|
|
137
|
+
$[3] = name;
|
|
138
|
+
$[4] = resolvedDisabled;
|
|
139
|
+
$[5] = value;
|
|
140
|
+
$[6] = t3;
|
|
141
|
+
} else t3 = $[6];
|
|
142
|
+
const groupCtxValue = t3;
|
|
143
|
+
let T0;
|
|
144
|
+
let t4;
|
|
145
|
+
let t5;
|
|
146
|
+
let t6;
|
|
147
|
+
let t7;
|
|
148
|
+
let t8;
|
|
149
|
+
if ($[7] !== children || $[8] !== direction || $[9] !== groupCtxValue || $[10] !== options) {
|
|
150
|
+
const normalizedOptions = options?.map(_temp);
|
|
151
|
+
T0 = RadioGroupContext.Provider;
|
|
152
|
+
t8 = groupCtxValue;
|
|
153
|
+
t4 = "";
|
|
154
|
+
t5 = direction;
|
|
155
|
+
t6 = "radiogroup";
|
|
156
|
+
t7 = normalizedOptions ? normalizedOptions.map(_temp2) : children;
|
|
157
|
+
$[7] = children;
|
|
158
|
+
$[8] = direction;
|
|
159
|
+
$[9] = groupCtxValue;
|
|
160
|
+
$[10] = options;
|
|
161
|
+
$[11] = T0;
|
|
162
|
+
$[12] = t4;
|
|
163
|
+
$[13] = t5;
|
|
164
|
+
$[14] = t6;
|
|
165
|
+
$[15] = t7;
|
|
166
|
+
$[16] = t8;
|
|
167
|
+
} else {
|
|
168
|
+
T0 = $[11];
|
|
169
|
+
t4 = $[12];
|
|
170
|
+
t5 = $[13];
|
|
171
|
+
t6 = $[14];
|
|
172
|
+
t7 = $[15];
|
|
173
|
+
t8 = $[16];
|
|
174
|
+
}
|
|
175
|
+
let t9;
|
|
176
|
+
if ($[17] !== t4 || $[18] !== t5 || $[19] !== t6 || $[20] !== t7) {
|
|
177
|
+
t9 = /*#__PURE__*/ jsx("div", {
|
|
178
|
+
"data-tao-radio-group": t4,
|
|
179
|
+
"data-tao-direction": t5,
|
|
180
|
+
role: t6,
|
|
181
|
+
children: t7
|
|
182
|
+
});
|
|
183
|
+
$[17] = t4;
|
|
184
|
+
$[18] = t5;
|
|
185
|
+
$[19] = t6;
|
|
186
|
+
$[20] = t7;
|
|
187
|
+
$[21] = t9;
|
|
188
|
+
} else t9 = $[21];
|
|
189
|
+
let t10;
|
|
190
|
+
if ($[22] !== T0 || $[23] !== t8 || $[24] !== t9) {
|
|
191
|
+
t10 = /*#__PURE__*/ jsx(T0, {
|
|
192
|
+
value: t8,
|
|
193
|
+
children: t9
|
|
194
|
+
});
|
|
195
|
+
$[22] = T0;
|
|
196
|
+
$[23] = t8;
|
|
197
|
+
$[24] = t9;
|
|
198
|
+
$[25] = t10;
|
|
199
|
+
} else t10 = $[25];
|
|
200
|
+
return t10;
|
|
201
|
+
}
|
|
202
|
+
function _temp2(opt_0) {
|
|
203
|
+
return /*#__PURE__*/ jsx(Radio, {
|
|
204
|
+
value: opt_0.value,
|
|
205
|
+
disabled: opt_0.disabled,
|
|
206
|
+
children: opt_0.label
|
|
207
|
+
}, opt_0.value);
|
|
208
|
+
}
|
|
209
|
+
function _temp(opt) {
|
|
210
|
+
return "string" == typeof opt ? {
|
|
211
|
+
label: opt,
|
|
212
|
+
value: opt
|
|
213
|
+
} : opt;
|
|
214
|
+
}
|
|
215
|
+
export { Radio, RadioGroup };
|