@rockshin/tao-ui 0.0.2 → 0.0.4
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/dist/components/breadcrumb/breadcrumb.css +2 -976
- package/dist/components/button/button.css +2 -976
- package/dist/components/checkbox/checkbox.css +3 -976
- package/dist/components/collapsible/collapsible.css +2 -976
- package/dist/components/context-menu/context-menu.css +1 -1141
- package/dist/components/context-menu/context-menu.js +10 -8
- package/dist/components/date-picker/calendar/month-grid.d.ts +1 -1
- package/dist/components/date-picker/calendar/time-panel.d.ts +1 -1
- package/dist/components/date-picker/calendar/year-grid.d.ts +1 -1
- package/dist/components/date-picker/date-picker.css +23 -1147
- package/dist/components/date-picker/date-picker.js +9 -7
- package/dist/components/date-picker/range-picker.js +9 -7
- package/dist/components/drawer/drawer.css +29 -1006
- package/dist/components/drawer/drawer.js +27 -18
- package/dist/components/dropdown/dropdown.css +0 -975
- package/dist/components/dropdown/dropdown.js +17 -15
- package/dist/components/form-field/form.css +4 -977
- package/dist/components/input/input.css +0 -1134
- package/dist/components/menu/menu-render.js +11 -8
- package/dist/components/menu/menu.css +4 -978
- package/dist/components/modal/modal.css +7 -981
- package/dist/components/modal/modal.js +27 -18
- package/dist/components/pagination/pagination.css +4 -977
- package/dist/components/pagination/pagination.js +3 -1
- package/dist/components/radio/radio.css +4 -977
- package/dist/components/scroll-area/scroll-area.css +11 -981
- package/dist/components/select/mobile-select.css +9 -976
- package/dist/components/select/mobile-select.d.ts +4 -1
- package/dist/components/select/mobile-select.js +103 -121
- package/dist/components/select/select.css +31 -1150
- package/dist/components/select/select.d.ts +58 -4
- package/dist/components/select/select.js +356 -410
- package/dist/components/spinner/spinner.css +97 -0
- package/dist/components/spinner/spinner.d.ts +26 -0
- package/dist/components/spinner/spinner.js +229 -0
- package/dist/components/splitter/splitter.css +7 -978
- package/dist/components/switch/switch.css +8 -981
- package/dist/components/table/table.css +13 -992
- package/dist/components/tabs/tabs.css +4 -977
- package/dist/components/tag/tag.css +6 -977
- package/dist/components/textarea/textarea.css +0 -1134
- package/dist/index.d.ts +32 -29
- package/dist/index.js +6 -3
- package/dist/layouts/stack/layout.css +0 -975
- package/dist/provider/tao-provider.d.ts +17 -1
- package/dist/provider/tao-provider.js +53 -15
- package/dist/theme/control.css +35 -983
- package/dist/theme/theme.css +74 -902
- package/package.json +13 -16
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
[data-tao-spinner] {
|
|
2
|
+
justify-content: center;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: var(--tao-padding-xs);
|
|
5
|
+
color: var(--tao-color-primary);
|
|
6
|
+
font-family: var(--tao-font-family);
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
[data-tao-spinner-indicator] {
|
|
12
|
+
line-height: 0;
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
[data-tao-spinner-svg] {
|
|
17
|
+
width: 1.25em;
|
|
18
|
+
height: 1.25em;
|
|
19
|
+
animation: .8s linear infinite tao-spinner-rotate;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[data-tao-spinner][data-tao-size="small"] {
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[data-tao-spinner][data-tao-size="medium"] {
|
|
27
|
+
font-size: 20px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[data-tao-spinner][data-tao-size="large"] {
|
|
31
|
+
font-size: 32px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@keyframes tao-spinner-rotate {
|
|
35
|
+
to {
|
|
36
|
+
transform: rotate(360deg);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
[data-tao-spinner-tip] {
|
|
41
|
+
font-size: var(--tao-font-size-sm);
|
|
42
|
+
color: var(--tao-color-text-secondary);
|
|
43
|
+
text-align: center;
|
|
44
|
+
line-height: 1.4;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[data-tao-spinner-container] {
|
|
48
|
+
position: relative;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[data-tao-spinner-content] {
|
|
52
|
+
transition: opacity var(--tao-motion-duration-mid) var(--tao-motion-ease-out);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
[data-tao-spinner-container][data-tao-spinning] [data-tao-spinner-content] {
|
|
56
|
+
opacity: .5;
|
|
57
|
+
pointer-events: none;
|
|
58
|
+
-webkit-user-select: none;
|
|
59
|
+
user-select: none;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
[data-tao-spinner-overlay] {
|
|
63
|
+
z-index: 1;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
align-items: center;
|
|
66
|
+
display: flex;
|
|
67
|
+
position: absolute;
|
|
68
|
+
inset: 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
[data-tao-spinner-fullscreen] {
|
|
72
|
+
z-index: var(--tao-z-index-popup);
|
|
73
|
+
background: color-mix(in oklch, var(--tao-color-bg-base) 60%, transparent);
|
|
74
|
+
animation: tao-spinner-fade-in var(--tao-motion-duration-mid) ease-out;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
align-items: center;
|
|
77
|
+
display: flex;
|
|
78
|
+
position: fixed;
|
|
79
|
+
inset: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@supports (backdrop-filter: blur(2px)) {
|
|
83
|
+
[data-tao-spinner-fullscreen] {
|
|
84
|
+
backdrop-filter: blur(2px);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@keyframes tao-spinner-fade-in {
|
|
89
|
+
from {
|
|
90
|
+
opacity: 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
to {
|
|
94
|
+
opacity: 1;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
import { type TaoSize } from '../../provider/tao-provider';
|
|
3
|
+
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
|
|
4
|
+
import './spinner.css';
|
|
5
|
+
export type SpinnerSemanticPart = 'root' | 'indicator' | 'tip' | 'overlay';
|
|
6
|
+
export interface SpinnerProps {
|
|
7
|
+
/** Whether the spinner is visible. Defaults to true. */
|
|
8
|
+
spinning?: boolean;
|
|
9
|
+
/** Size of the indicator. Inherits from TaoProvider. */
|
|
10
|
+
size?: TaoSize;
|
|
11
|
+
/** Description text rendered under the indicator. */
|
|
12
|
+
tip?: ReactNode;
|
|
13
|
+
/** Delay (ms) before showing the spinner — prevents flicker on fast loads. */
|
|
14
|
+
delay?: number;
|
|
15
|
+
/** Custom indicator node, replaces the default spinner. */
|
|
16
|
+
indicator?: ReactNode;
|
|
17
|
+
/** Wrap content: the spinner overlays `children` while spinning. */
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
/** Render a full-screen backdrop with a centered spinner. */
|
|
20
|
+
fullscreen?: boolean;
|
|
21
|
+
className?: string;
|
|
22
|
+
style?: CSSProperties;
|
|
23
|
+
classNames?: SemanticClassNames<SpinnerSemanticPart>;
|
|
24
|
+
styles?: SemanticStyles<SpinnerSemanticPart>;
|
|
25
|
+
}
|
|
26
|
+
export declare function Spinner({ spinning, size, tip, delay, indicator, children, fullscreen, className, style, classNames, styles, }: SpinnerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
5
|
+
import { cx } from "../../utils/semantic.js";
|
|
6
|
+
import "./spinner.css";
|
|
7
|
+
function Spinner(t0) {
|
|
8
|
+
const $ = c(53);
|
|
9
|
+
const { spinning: t1, size, tip, delay, indicator, children, fullscreen: t2, className, style, classNames, styles } = t0;
|
|
10
|
+
const spinning = void 0 === t1 ? true : t1;
|
|
11
|
+
const fullscreen = void 0 === t2 ? false : t2;
|
|
12
|
+
const ctx = useTaoConfig();
|
|
13
|
+
const resolvedSize = size ?? ctx.size;
|
|
14
|
+
const [active, setActive] = useState(delay ? false : spinning);
|
|
15
|
+
let t3;
|
|
16
|
+
let t4;
|
|
17
|
+
if ($[0] !== delay || $[1] !== spinning) {
|
|
18
|
+
t3 = ()=>{
|
|
19
|
+
if (delay && spinning) {
|
|
20
|
+
const t = setTimeout(()=>setActive(true), delay);
|
|
21
|
+
return ()=>clearTimeout(t);
|
|
22
|
+
}
|
|
23
|
+
setActive(spinning);
|
|
24
|
+
};
|
|
25
|
+
t4 = [
|
|
26
|
+
spinning,
|
|
27
|
+
delay
|
|
28
|
+
];
|
|
29
|
+
$[0] = delay;
|
|
30
|
+
$[1] = spinning;
|
|
31
|
+
$[2] = t3;
|
|
32
|
+
$[3] = t4;
|
|
33
|
+
} else {
|
|
34
|
+
t3 = $[2];
|
|
35
|
+
t4 = $[3];
|
|
36
|
+
}
|
|
37
|
+
useEffect(t3, t4);
|
|
38
|
+
const t5 = classNames?.root;
|
|
39
|
+
const t6 = !children && !fullscreen && className;
|
|
40
|
+
let t7;
|
|
41
|
+
if ($[4] !== t5 || $[5] !== t6) {
|
|
42
|
+
t7 = cx(t5, t6);
|
|
43
|
+
$[4] = t5;
|
|
44
|
+
$[5] = t6;
|
|
45
|
+
$[6] = t7;
|
|
46
|
+
} else t7 = $[6];
|
|
47
|
+
let t8;
|
|
48
|
+
if ($[7] !== children || $[8] !== fullscreen || $[9] !== style || $[10] !== styles?.root) {
|
|
49
|
+
t8 = children || fullscreen ? styles?.root : {
|
|
50
|
+
...styles?.root,
|
|
51
|
+
...style
|
|
52
|
+
};
|
|
53
|
+
$[7] = children;
|
|
54
|
+
$[8] = fullscreen;
|
|
55
|
+
$[9] = style;
|
|
56
|
+
$[10] = styles?.root;
|
|
57
|
+
$[11] = t8;
|
|
58
|
+
} else t8 = $[11];
|
|
59
|
+
const t9 = classNames?.indicator;
|
|
60
|
+
let t10;
|
|
61
|
+
if ($[12] !== t9) {
|
|
62
|
+
t10 = cx(t9);
|
|
63
|
+
$[12] = t9;
|
|
64
|
+
$[13] = t10;
|
|
65
|
+
} else t10 = $[13];
|
|
66
|
+
const t11 = styles?.indicator;
|
|
67
|
+
let t12;
|
|
68
|
+
if ($[14] !== indicator) {
|
|
69
|
+
t12 = indicator ?? /*#__PURE__*/ jsx(DefaultIndicator, {});
|
|
70
|
+
$[14] = indicator;
|
|
71
|
+
$[15] = t12;
|
|
72
|
+
} else t12 = $[15];
|
|
73
|
+
let t13;
|
|
74
|
+
if ($[16] !== t10 || $[17] !== t11 || $[18] !== t12) {
|
|
75
|
+
t13 = /*#__PURE__*/ jsx("span", {
|
|
76
|
+
"data-tao-spinner-indicator": "",
|
|
77
|
+
className: t10,
|
|
78
|
+
style: t11,
|
|
79
|
+
children: t12
|
|
80
|
+
});
|
|
81
|
+
$[16] = t10;
|
|
82
|
+
$[17] = t11;
|
|
83
|
+
$[18] = t12;
|
|
84
|
+
$[19] = t13;
|
|
85
|
+
} else t13 = $[19];
|
|
86
|
+
let t14;
|
|
87
|
+
if ($[20] !== classNames?.tip || $[21] !== styles?.tip || $[22] !== tip) {
|
|
88
|
+
t14 = null != tip && /*#__PURE__*/ jsx("span", {
|
|
89
|
+
"data-tao-spinner-tip": "",
|
|
90
|
+
className: cx(classNames?.tip),
|
|
91
|
+
style: styles?.tip,
|
|
92
|
+
children: tip
|
|
93
|
+
});
|
|
94
|
+
$[20] = classNames?.tip;
|
|
95
|
+
$[21] = styles?.tip;
|
|
96
|
+
$[22] = tip;
|
|
97
|
+
$[23] = t14;
|
|
98
|
+
} else t14 = $[23];
|
|
99
|
+
let t15;
|
|
100
|
+
if ($[24] !== resolvedSize || $[25] !== t13 || $[26] !== t14 || $[27] !== t7 || $[28] !== t8) {
|
|
101
|
+
t15 = /*#__PURE__*/ jsxs("span", {
|
|
102
|
+
"data-tao-spinner": "",
|
|
103
|
+
"data-tao-size": resolvedSize,
|
|
104
|
+
className: t7,
|
|
105
|
+
style: t8,
|
|
106
|
+
role: "status",
|
|
107
|
+
"aria-live": "polite",
|
|
108
|
+
children: [
|
|
109
|
+
t13,
|
|
110
|
+
t14
|
|
111
|
+
]
|
|
112
|
+
});
|
|
113
|
+
$[24] = resolvedSize;
|
|
114
|
+
$[25] = t13;
|
|
115
|
+
$[26] = t14;
|
|
116
|
+
$[27] = t7;
|
|
117
|
+
$[28] = t8;
|
|
118
|
+
$[29] = t15;
|
|
119
|
+
} else t15 = $[29];
|
|
120
|
+
const spinnerCore = t15;
|
|
121
|
+
if (fullscreen) {
|
|
122
|
+
if (!active) return null;
|
|
123
|
+
const t16 = classNames?.overlay;
|
|
124
|
+
let t17;
|
|
125
|
+
if ($[30] !== className || $[31] !== t16) {
|
|
126
|
+
t17 = cx(t16, className);
|
|
127
|
+
$[30] = className;
|
|
128
|
+
$[31] = t16;
|
|
129
|
+
$[32] = t17;
|
|
130
|
+
} else t17 = $[32];
|
|
131
|
+
const t18 = styles?.overlay;
|
|
132
|
+
let t19;
|
|
133
|
+
if ($[33] !== style || $[34] !== t18) {
|
|
134
|
+
t19 = {
|
|
135
|
+
...t18,
|
|
136
|
+
...style
|
|
137
|
+
};
|
|
138
|
+
$[33] = style;
|
|
139
|
+
$[34] = t18;
|
|
140
|
+
$[35] = t19;
|
|
141
|
+
} else t19 = $[35];
|
|
142
|
+
let t20;
|
|
143
|
+
if ($[36] !== spinnerCore || $[37] !== t17 || $[38] !== t19) {
|
|
144
|
+
t20 = /*#__PURE__*/ jsx("div", {
|
|
145
|
+
"data-tao-spinner-fullscreen": "",
|
|
146
|
+
className: t17,
|
|
147
|
+
style: t19,
|
|
148
|
+
children: spinnerCore
|
|
149
|
+
});
|
|
150
|
+
$[36] = spinnerCore;
|
|
151
|
+
$[37] = t17;
|
|
152
|
+
$[38] = t19;
|
|
153
|
+
$[39] = t20;
|
|
154
|
+
} else t20 = $[39];
|
|
155
|
+
return t20;
|
|
156
|
+
}
|
|
157
|
+
if (null != children) {
|
|
158
|
+
const t16 = active || void 0;
|
|
159
|
+
let t17;
|
|
160
|
+
if ($[40] !== children) {
|
|
161
|
+
t17 = /*#__PURE__*/ jsx("div", {
|
|
162
|
+
"data-tao-spinner-content": "",
|
|
163
|
+
children: children
|
|
164
|
+
});
|
|
165
|
+
$[40] = children;
|
|
166
|
+
$[41] = t17;
|
|
167
|
+
} else t17 = $[41];
|
|
168
|
+
let t18;
|
|
169
|
+
if ($[42] !== active || $[43] !== classNames?.overlay || $[44] !== spinnerCore || $[45] !== styles?.overlay) {
|
|
170
|
+
t18 = active && /*#__PURE__*/ jsx("div", {
|
|
171
|
+
"data-tao-spinner-overlay": "",
|
|
172
|
+
className: cx(classNames?.overlay),
|
|
173
|
+
style: styles?.overlay,
|
|
174
|
+
children: spinnerCore
|
|
175
|
+
});
|
|
176
|
+
$[42] = active;
|
|
177
|
+
$[43] = classNames?.overlay;
|
|
178
|
+
$[44] = spinnerCore;
|
|
179
|
+
$[45] = styles?.overlay;
|
|
180
|
+
$[46] = t18;
|
|
181
|
+
} else t18 = $[46];
|
|
182
|
+
let t19;
|
|
183
|
+
if ($[47] !== className || $[48] !== style || $[49] !== t16 || $[50] !== t17 || $[51] !== t18) {
|
|
184
|
+
t19 = /*#__PURE__*/ jsxs("div", {
|
|
185
|
+
"data-tao-spinner-container": "",
|
|
186
|
+
"data-tao-spinning": t16,
|
|
187
|
+
className: className,
|
|
188
|
+
style: style,
|
|
189
|
+
children: [
|
|
190
|
+
t17,
|
|
191
|
+
t18
|
|
192
|
+
]
|
|
193
|
+
});
|
|
194
|
+
$[47] = className;
|
|
195
|
+
$[48] = style;
|
|
196
|
+
$[49] = t16;
|
|
197
|
+
$[50] = t17;
|
|
198
|
+
$[51] = t18;
|
|
199
|
+
$[52] = t19;
|
|
200
|
+
} else t19 = $[52];
|
|
201
|
+
return t19;
|
|
202
|
+
}
|
|
203
|
+
if (!active) return null;
|
|
204
|
+
return spinnerCore;
|
|
205
|
+
}
|
|
206
|
+
function DefaultIndicator() {
|
|
207
|
+
const $ = c(1);
|
|
208
|
+
let t0;
|
|
209
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
210
|
+
t0 = /*#__PURE__*/ jsx("svg", {
|
|
211
|
+
"data-tao-spinner-svg": "",
|
|
212
|
+
viewBox: "0 0 50 50",
|
|
213
|
+
fill: "none",
|
|
214
|
+
"aria-hidden": true,
|
|
215
|
+
children: /*#__PURE__*/ jsx("circle", {
|
|
216
|
+
cx: "25",
|
|
217
|
+
cy: "25",
|
|
218
|
+
r: "20",
|
|
219
|
+
stroke: "currentColor",
|
|
220
|
+
strokeWidth: "5",
|
|
221
|
+
strokeLinecap: "round",
|
|
222
|
+
strokeDasharray: "90 40"
|
|
223
|
+
})
|
|
224
|
+
});
|
|
225
|
+
$[0] = t0;
|
|
226
|
+
} else t0 = $[0];
|
|
227
|
+
return t0;
|
|
228
|
+
}
|
|
229
|
+
export { Spinner };
|