@rockshin/tao-ui 0.0.2 → 0.0.3
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 +3 -0
- package/dist/components/button/button.css +3 -0
- package/dist/components/checkbox/checkbox.css +3 -0
- package/dist/components/collapsible/collapsible.css +3 -0
- package/dist/components/context-menu/context-menu.css +4 -1
- 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 +43 -1
- 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 +5 -2
- package/dist/components/drawer/drawer.js +27 -18
- package/dist/components/dropdown/dropdown.css +3 -0
- package/dist/components/dropdown/dropdown.js +17 -15
- package/dist/components/form-field/form.css +3 -0
- package/dist/components/input/input.css +42 -0
- package/dist/components/menu/menu-render.js +11 -8
- package/dist/components/menu/menu.css +4 -1
- package/dist/components/modal/modal.css +5 -2
- package/dist/components/modal/modal.js +27 -18
- package/dist/components/pagination/pagination.css +3 -0
- package/dist/components/pagination/pagination.js +3 -1
- package/dist/components/radio/radio.css +3 -0
- package/dist/components/scroll-area/scroll-area.css +3 -0
- package/dist/components/select/mobile-select.css +10 -0
- 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 +65 -11
- package/dist/components/select/select.d.ts +58 -4
- package/dist/components/select/select.js +356 -410
- package/dist/components/spinner/spinner.css +1084 -0
- package/dist/components/spinner/spinner.d.ts +26 -0
- package/dist/components/spinner/spinner.js +229 -0
- package/dist/components/splitter/splitter.css +3 -0
- package/dist/components/switch/switch.css +3 -0
- package/dist/components/table/table.css +3 -0
- package/dist/components/tabs/tabs.css +3 -0
- package/dist/components/tag/tag.css +3 -0
- package/dist/components/textarea/textarea.css +42 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +4 -3
- package/dist/layouts/stack/layout.css +3 -0
- package/dist/provider/tao-provider.d.ts +17 -1
- package/dist/provider/tao-provider.js +53 -15
- package/dist/theme/control.css +42 -0
- package/dist/theme/theme.css +3 -0
- package/package.json +13 -13
|
@@ -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 };
|
|
@@ -314,6 +314,9 @@
|
|
|
314
314
|
--tao-font-family: "Geist Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
|
|
315
315
|
--tao-font-family-code: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
316
316
|
--tao-motion-unit: .1s;
|
|
317
|
+
--tao-z-index-drawer: 1000;
|
|
318
|
+
--tao-z-index-modal: 1000;
|
|
319
|
+
--tao-z-index-popup: 1100;
|
|
317
320
|
--tao-primary: var(--tao-color-primary);
|
|
318
321
|
--tao-primary-hover: var(--tao-color-primary);
|
|
319
322
|
}
|
|
@@ -314,6 +314,9 @@
|
|
|
314
314
|
--tao-font-family: "Geist Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
|
|
315
315
|
--tao-font-family-code: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
316
316
|
--tao-motion-unit: .1s;
|
|
317
|
+
--tao-z-index-drawer: 1000;
|
|
318
|
+
--tao-z-index-modal: 1000;
|
|
319
|
+
--tao-z-index-popup: 1100;
|
|
317
320
|
--tao-primary: var(--tao-color-primary);
|
|
318
321
|
--tao-primary-hover: var(--tao-color-primary);
|
|
319
322
|
}
|
|
@@ -314,6 +314,9 @@
|
|
|
314
314
|
--tao-font-family: "Geist Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
|
|
315
315
|
--tao-font-family-code: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
316
316
|
--tao-motion-unit: .1s;
|
|
317
|
+
--tao-z-index-drawer: 1000;
|
|
318
|
+
--tao-z-index-modal: 1000;
|
|
319
|
+
--tao-z-index-popup: 1100;
|
|
317
320
|
--tao-primary: var(--tao-color-primary);
|
|
318
321
|
--tao-primary-hover: var(--tao-color-primary);
|
|
319
322
|
}
|
|
@@ -314,6 +314,9 @@
|
|
|
314
314
|
--tao-font-family: "Geist Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
|
|
315
315
|
--tao-font-family-code: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
316
316
|
--tao-motion-unit: .1s;
|
|
317
|
+
--tao-z-index-drawer: 1000;
|
|
318
|
+
--tao-z-index-modal: 1000;
|
|
319
|
+
--tao-z-index-popup: 1100;
|
|
317
320
|
--tao-primary: var(--tao-color-primary);
|
|
318
321
|
--tao-primary-hover: var(--tao-color-primary);
|
|
319
322
|
}
|
|
@@ -314,6 +314,9 @@
|
|
|
314
314
|
--tao-font-family: "Geist Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
|
|
315
315
|
--tao-font-family-code: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
316
316
|
--tao-motion-unit: .1s;
|
|
317
|
+
--tao-z-index-drawer: 1000;
|
|
318
|
+
--tao-z-index-modal: 1000;
|
|
319
|
+
--tao-z-index-popup: 1100;
|
|
317
320
|
--tao-primary: var(--tao-color-primary);
|
|
318
321
|
--tao-primary-hover: var(--tao-color-primary);
|
|
319
322
|
}
|
|
@@ -356,6 +356,9 @@
|
|
|
356
356
|
--tao-font-family: "Geist Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
|
|
357
357
|
--tao-font-family-code: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
358
358
|
--tao-motion-unit: .1s;
|
|
359
|
+
--tao-z-index-drawer: 1000;
|
|
360
|
+
--tao-z-index-modal: 1000;
|
|
361
|
+
--tao-z-index-popup: 1100;
|
|
359
362
|
--tao-primary: var(--tao-color-primary);
|
|
360
363
|
--tao-primary-hover: var(--tao-color-primary);
|
|
361
364
|
}
|
|
@@ -878,6 +881,25 @@
|
|
|
878
881
|
box-shadow: 0 0 0 2px var(--tao-color-error-outline);
|
|
879
882
|
}
|
|
880
883
|
|
|
884
|
+
[data-tao-control][data-tao-variant="outlined"][data-tao-warning] {
|
|
885
|
+
border-color: var(--tao-warning);
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
[data-tao-control][data-tao-variant="outlined"][data-tao-warning]:hover:not([data-disabled]):not(:focus-within) {
|
|
889
|
+
border-color: var(--tao-color-warning);
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
893
|
+
[data-tao-control][data-tao-variant="outlined"][data-tao-warning]:hover:not([data-disabled]):not(:focus-within) {
|
|
894
|
+
border-color: color-mix(in oklch, var(--tao-color-warning) 80%, white);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
[data-tao-control][data-tao-variant="outlined"][data-tao-warning]:focus-within, [data-tao-control][data-tao-variant="outlined"][data-tao-warning][data-state="open"] {
|
|
899
|
+
border-color: var(--tao-warning);
|
|
900
|
+
box-shadow: 0 0 0 2px var(--tao-color-warning-outline);
|
|
901
|
+
}
|
|
902
|
+
|
|
881
903
|
[data-tao-control][data-tao-variant="outlined"][data-disabled], [data-tao-control][data-tao-variant="outlined"]:has(input:disabled) {
|
|
882
904
|
background: var(--tao-color-bg-disabled);
|
|
883
905
|
border-color: var(--tao-color-border);
|
|
@@ -922,6 +944,26 @@
|
|
|
922
944
|
box-shadow: 0 0 0 2px var(--tao-color-error-outline);
|
|
923
945
|
}
|
|
924
946
|
|
|
947
|
+
[data-tao-control][data-tao-variant="filled"][data-tao-warning] {
|
|
948
|
+
background: var(--tao-warning-bg);
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
[data-tao-control][data-tao-variant="filled"][data-tao-warning]:hover:not([data-disabled]):not(:focus-within) {
|
|
952
|
+
background: var(--tao-color-warning);
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
956
|
+
[data-tao-control][data-tao-variant="filled"][data-tao-warning]:hover:not([data-disabled]):not(:focus-within) {
|
|
957
|
+
background: color-mix(in oklch, var(--tao-color-warning) 10%, var(--tao-color-bg-base));
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
[data-tao-control][data-tao-variant="filled"][data-tao-warning]:focus-within, [data-tao-control][data-tao-variant="filled"][data-tao-warning][data-state="open"] {
|
|
962
|
+
background: var(--tao-color-bg-container);
|
|
963
|
+
border-color: var(--tao-warning);
|
|
964
|
+
box-shadow: 0 0 0 2px var(--tao-color-warning-outline);
|
|
965
|
+
}
|
|
966
|
+
|
|
925
967
|
[data-tao-control][data-tao-variant="filled"][data-disabled], [data-tao-control][data-tao-variant="filled"]:has(input:disabled) {
|
|
926
968
|
background: var(--tao-color-bg-disabled);
|
|
927
969
|
border-color: var(--tao-color-border);
|
package/dist/index.d.ts
CHANGED
|
@@ -11,19 +11,20 @@ export { FormActions, type FormActionsProps, type FormActionsSemanticPart, } fro
|
|
|
11
11
|
export { FormField, type FormFieldProps, type FormFieldSemanticPart, } from './components/form-field/form-field';
|
|
12
12
|
export { FormSection, type FormSectionProps, type FormSectionSemanticPart, } from './components/form-section/form-section';
|
|
13
13
|
export { Input, type InputProps, type InputSemanticPart, } from './components/input/input';
|
|
14
|
-
export { type AutoSizeOptions, Textarea, type TextareaProps, type TextareaSemanticPart, } from './components/textarea/textarea';
|
|
15
14
|
export { type ConfirmType, Modal, type ModalFooterRender, type ModalFuncProps, type ModalFuncReturn, type ModalHookApi, type ModalProps, type ModalSemanticPart, } from './components/modal';
|
|
16
15
|
export { Pagination, type PaginationProps, type PaginationSemanticPart, } from './components/pagination/pagination';
|
|
17
16
|
export { Radio, RadioGroup, type RadioGroupProps, type RadioOptionType, type RadioProps, type RadioSemanticPart, } from './components/radio/radio';
|
|
18
17
|
export { ScrollArea, type ScrollAreaProps, type ScrollAreaSemanticPart, type ScrollAreaType, } from './components/scroll-area/scroll-area';
|
|
19
|
-
export { Select, type SelectOption, type SelectProps, } from './components/select/select';
|
|
18
|
+
export { ChevronsUpDownIcon, Select, type SelectOption, type SelectPlacement, type SelectProps, type SelectSemanticPart, } from './components/select/select';
|
|
19
|
+
export { Spinner, type SpinnerProps, type SpinnerSemanticPart, } from './components/spinner/spinner';
|
|
20
20
|
export { Splitter, type SplitterPanelProps, type SplitterProps, type SplitterSemanticPart, } from './components/splitter/splitter';
|
|
21
21
|
export { Switch, type SwitchProps, type SwitchSemanticPart, } from './components/switch/switch';
|
|
22
22
|
export { type SorterResult, type SortOrder, Table, type TableColumn, type TableFilterItem, type TablePagination, type TableProps, type TableRowSelection, type TableSemanticPart, } from './components/table/table';
|
|
23
23
|
export { type TabItem, Tabs, type TabsProps, type TabsSemanticPart, } from './components/tabs/tabs';
|
|
24
24
|
export { CheckableTag, type CheckableTagProps, Tag, type TagColor, type TagProps, type TagSemanticPart, type TagVariant, } from './components/tag/tag';
|
|
25
|
+
export { type AutoSizeOptions, Textarea, type TextareaProps, type TextareaSemanticPart, } from './components/textarea/textarea';
|
|
25
26
|
export { FormLayout, type FormLayoutProps, } from './layouts/form-layout/form-layout';
|
|
26
27
|
export { Stack, type StackProps } from './layouts/stack/stack';
|
|
27
28
|
export { type FormatOptions, NumberInput, type NumberInputProps, type PadDecimalsOnBlur, type UseNumberInputOptions, type UseNumberInputReturn, useNumberInput, } from './number-input';
|
|
28
|
-
export { TaoProvider, type TaoProviderProps, type TaoSeedToken, type TaoSize, type TaoThemeConfig, type TaoVariant, useTaoConfig, } from './provider/tao-provider';
|
|
29
|
+
export { TaoPortalScope, TaoProvider, type TaoProviderProps, type TaoSeedToken, type TaoSize, type TaoThemeConfig, type TaoVariant, useTaoConfig, } from './provider/tao-provider';
|
|
29
30
|
export { cx, type SemanticClassNames, type SemanticStyles, } from './utils/semantic';
|
package/dist/index.js
CHANGED
|
@@ -11,19 +11,20 @@ export { FormActions } from "./components/form-actions/form-actions.js";
|
|
|
11
11
|
export { FormField } from "./components/form-field/form-field.js";
|
|
12
12
|
export { FormSection } from "./components/form-section/form-section.js";
|
|
13
13
|
export { Input } from "./components/input/input.js";
|
|
14
|
-
export { Textarea } from "./components/textarea/textarea.js";
|
|
15
14
|
export { Modal } from "./components/modal/index.js";
|
|
16
15
|
export { Pagination } from "./components/pagination/pagination.js";
|
|
17
16
|
export { Radio, RadioGroup } from "./components/radio/radio.js";
|
|
18
17
|
export { ScrollArea } from "./components/scroll-area/scroll-area.js";
|
|
19
|
-
export { Select } from "./components/select/select.js";
|
|
18
|
+
export { ChevronsUpDownIcon, Select } from "./components/select/select.js";
|
|
19
|
+
export { Spinner } from "./components/spinner/spinner.js";
|
|
20
20
|
export { Splitter } from "./components/splitter/splitter.js";
|
|
21
21
|
export { Switch } from "./components/switch/switch.js";
|
|
22
22
|
export { Table } from "./components/table/table.js";
|
|
23
23
|
export { Tabs } from "./components/tabs/tabs.js";
|
|
24
24
|
export { CheckableTag, Tag } from "./components/tag/tag.js";
|
|
25
|
+
export { Textarea } from "./components/textarea/textarea.js";
|
|
25
26
|
export { FormLayout } from "./layouts/form-layout/form-layout.js";
|
|
26
27
|
export { Stack } from "./layouts/stack/stack.js";
|
|
27
28
|
export { NumberInput, useNumberInput } from "./number-input/index.js";
|
|
28
|
-
export { TaoProvider, useTaoConfig } from "./provider/tao-provider.js";
|
|
29
|
+
export { TaoPortalScope, TaoProvider, useTaoConfig } from "./provider/tao-provider.js";
|
|
29
30
|
export { cx } from "./utils/semantic.js";
|
|
@@ -314,6 +314,9 @@
|
|
|
314
314
|
--tao-font-family: "Geist Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
|
|
315
315
|
--tao-font-family-code: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
316
316
|
--tao-motion-unit: .1s;
|
|
317
|
+
--tao-z-index-drawer: 1000;
|
|
318
|
+
--tao-z-index-modal: 1000;
|
|
319
|
+
--tao-z-index-popup: 1100;
|
|
317
320
|
--tao-primary: var(--tao-color-primary);
|
|
318
321
|
--tao-primary-hover: var(--tao-color-primary);
|
|
319
322
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
2
|
export interface TaoSeedToken {
|
|
3
3
|
colorPrimary?: string;
|
|
4
4
|
colorSuccess?: string;
|
|
@@ -29,8 +29,24 @@ interface TaoConfigContextValue {
|
|
|
29
29
|
size: TaoSize;
|
|
30
30
|
disabled: boolean;
|
|
31
31
|
variant: TaoVariant;
|
|
32
|
+
/**
|
|
33
|
+
* Merged CSS custom-property overrides from this provider and all ancestors.
|
|
34
|
+
* Carried through context so portaled layers (Modal/Drawer/Select dropdown…)
|
|
35
|
+
* — which render outside the provider's DOM subtree — can re-apply the theme.
|
|
36
|
+
*/
|
|
37
|
+
tokenStyle: CSSProperties;
|
|
32
38
|
}
|
|
33
39
|
export declare function useTaoConfig(): TaoConfigContextValue;
|
|
40
|
+
/**
|
|
41
|
+
* Re-establishes the theme token scope inside a portal. Floating components
|
|
42
|
+
* portal their popup to document.body, escaping the `[data-tao-provider]`
|
|
43
|
+
* element that carries custom token overrides; wrapping the portal content in
|
|
44
|
+
* this component re-applies those overrides so colors/sizes stay consistent.
|
|
45
|
+
*/
|
|
46
|
+
export declare function TaoPortalScope({ children, style, }: {
|
|
47
|
+
children: ReactNode;
|
|
48
|
+
style?: CSSProperties;
|
|
49
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
34
50
|
export interface TaoProviderProps {
|
|
35
51
|
children: ReactNode;
|
|
36
52
|
theme?: TaoThemeConfig;
|
|
@@ -1,13 +1,42 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
2
3
|
import { createContext, useContext, useMemo } from "react";
|
|
3
4
|
const TaoConfigContext = /*#__PURE__*/ createContext({
|
|
4
5
|
size: 'medium',
|
|
5
6
|
disabled: false,
|
|
6
|
-
variant: 'outlined'
|
|
7
|
+
variant: 'outlined',
|
|
8
|
+
tokenStyle: {}
|
|
7
9
|
});
|
|
8
10
|
function useTaoConfig() {
|
|
9
11
|
return useContext(TaoConfigContext);
|
|
10
12
|
}
|
|
13
|
+
function TaoPortalScope(t0) {
|
|
14
|
+
const $ = c(6);
|
|
15
|
+
const { children, style } = t0;
|
|
16
|
+
const { tokenStyle } = useTaoConfig();
|
|
17
|
+
let t1;
|
|
18
|
+
if ($[0] !== style || $[1] !== tokenStyle) {
|
|
19
|
+
t1 = {
|
|
20
|
+
...tokenStyle,
|
|
21
|
+
...style
|
|
22
|
+
};
|
|
23
|
+
$[0] = style;
|
|
24
|
+
$[1] = tokenStyle;
|
|
25
|
+
$[2] = t1;
|
|
26
|
+
} else t1 = $[2];
|
|
27
|
+
let t2;
|
|
28
|
+
if ($[3] !== children || $[4] !== t1) {
|
|
29
|
+
t2 = /*#__PURE__*/ jsx("div", {
|
|
30
|
+
"data-tao-provider": "",
|
|
31
|
+
style: t1,
|
|
32
|
+
children: children
|
|
33
|
+
});
|
|
34
|
+
$[3] = children;
|
|
35
|
+
$[4] = t1;
|
|
36
|
+
$[5] = t2;
|
|
37
|
+
} else t2 = $[5];
|
|
38
|
+
return t2;
|
|
39
|
+
}
|
|
11
40
|
const TOKEN_TO_VAR = {
|
|
12
41
|
colorPrimary: '--tao-color-primary',
|
|
13
42
|
colorSuccess: '--tao-color-success',
|
|
@@ -28,18 +57,7 @@ const TOKEN_TO_VAR_PX = {
|
|
|
28
57
|
function TaoProvider({ theme, size, disabled, variant, children }) {
|
|
29
58
|
const parentConfig = useContext(TaoConfigContext);
|
|
30
59
|
const inherit = theme?.inherit ?? true;
|
|
31
|
-
const
|
|
32
|
-
size: size ?? (inherit ? parentConfig.size : 'medium'),
|
|
33
|
-
disabled: disabled ?? (inherit ? parentConfig.disabled : false),
|
|
34
|
-
variant: variant ?? (inherit ? parentConfig.variant : 'outlined')
|
|
35
|
-
}), [
|
|
36
|
-
size,
|
|
37
|
-
disabled,
|
|
38
|
-
variant,
|
|
39
|
-
parentConfig,
|
|
40
|
-
inherit
|
|
41
|
-
]);
|
|
42
|
-
const style = useMemo(()=>{
|
|
60
|
+
const ownVars = useMemo(()=>{
|
|
43
61
|
if (!theme?.token) return;
|
|
44
62
|
const vars = {};
|
|
45
63
|
const t = theme.token;
|
|
@@ -55,13 +73,33 @@ function TaoProvider({ theme, size, disabled, variant, children }) {
|
|
|
55
73
|
}, [
|
|
56
74
|
theme?.token
|
|
57
75
|
]);
|
|
76
|
+
const tokenStyle = useMemo(()=>({
|
|
77
|
+
...parentConfig.tokenStyle,
|
|
78
|
+
...ownVars
|
|
79
|
+
}), [
|
|
80
|
+
parentConfig.tokenStyle,
|
|
81
|
+
ownVars
|
|
82
|
+
]);
|
|
83
|
+
const config = useMemo(()=>({
|
|
84
|
+
size: size ?? (inherit ? parentConfig.size : 'medium'),
|
|
85
|
+
disabled: disabled ?? (inherit ? parentConfig.disabled : false),
|
|
86
|
+
variant: variant ?? (inherit ? parentConfig.variant : 'outlined'),
|
|
87
|
+
tokenStyle
|
|
88
|
+
}), [
|
|
89
|
+
size,
|
|
90
|
+
disabled,
|
|
91
|
+
variant,
|
|
92
|
+
parentConfig,
|
|
93
|
+
inherit,
|
|
94
|
+
tokenStyle
|
|
95
|
+
]);
|
|
58
96
|
return /*#__PURE__*/ jsx(TaoConfigContext.Provider, {
|
|
59
97
|
value: config,
|
|
60
98
|
children: /*#__PURE__*/ jsx("div", {
|
|
61
|
-
style:
|
|
99
|
+
style: ownVars,
|
|
62
100
|
"data-tao-provider": "",
|
|
63
101
|
children: children
|
|
64
102
|
})
|
|
65
103
|
});
|
|
66
104
|
}
|
|
67
|
-
export { TaoProvider, useTaoConfig };
|
|
105
|
+
export { TaoPortalScope, TaoProvider, useTaoConfig };
|
package/dist/theme/control.css
CHANGED
|
@@ -314,6 +314,9 @@
|
|
|
314
314
|
--tao-font-family: "Geist Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
|
|
315
315
|
--tao-font-family-code: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
316
316
|
--tao-motion-unit: .1s;
|
|
317
|
+
--tao-z-index-drawer: 1000;
|
|
318
|
+
--tao-z-index-modal: 1000;
|
|
319
|
+
--tao-z-index-popup: 1100;
|
|
317
320
|
--tao-primary: var(--tao-color-primary);
|
|
318
321
|
--tao-primary-hover: var(--tao-color-primary);
|
|
319
322
|
}
|
|
@@ -836,6 +839,25 @@
|
|
|
836
839
|
box-shadow: 0 0 0 2px var(--tao-color-error-outline);
|
|
837
840
|
}
|
|
838
841
|
|
|
842
|
+
[data-tao-control][data-tao-variant="outlined"][data-tao-warning] {
|
|
843
|
+
border-color: var(--tao-warning);
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
[data-tao-control][data-tao-variant="outlined"][data-tao-warning]:hover:not([data-disabled]):not(:focus-within) {
|
|
847
|
+
border-color: var(--tao-color-warning);
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
851
|
+
[data-tao-control][data-tao-variant="outlined"][data-tao-warning]:hover:not([data-disabled]):not(:focus-within) {
|
|
852
|
+
border-color: color-mix(in oklch, var(--tao-color-warning) 80%, white);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
[data-tao-control][data-tao-variant="outlined"][data-tao-warning]:focus-within, [data-tao-control][data-tao-variant="outlined"][data-tao-warning][data-state="open"] {
|
|
857
|
+
border-color: var(--tao-warning);
|
|
858
|
+
box-shadow: 0 0 0 2px var(--tao-color-warning-outline);
|
|
859
|
+
}
|
|
860
|
+
|
|
839
861
|
[data-tao-control][data-tao-variant="outlined"][data-disabled], [data-tao-control][data-tao-variant="outlined"]:has(input:disabled) {
|
|
840
862
|
background: var(--tao-color-bg-disabled);
|
|
841
863
|
border-color: var(--tao-color-border);
|
|
@@ -880,6 +902,26 @@
|
|
|
880
902
|
box-shadow: 0 0 0 2px var(--tao-color-error-outline);
|
|
881
903
|
}
|
|
882
904
|
|
|
905
|
+
[data-tao-control][data-tao-variant="filled"][data-tao-warning] {
|
|
906
|
+
background: var(--tao-warning-bg);
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
[data-tao-control][data-tao-variant="filled"][data-tao-warning]:hover:not([data-disabled]):not(:focus-within) {
|
|
910
|
+
background: var(--tao-color-warning);
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
914
|
+
[data-tao-control][data-tao-variant="filled"][data-tao-warning]:hover:not([data-disabled]):not(:focus-within) {
|
|
915
|
+
background: color-mix(in oklch, var(--tao-color-warning) 10%, var(--tao-color-bg-base));
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
[data-tao-control][data-tao-variant="filled"][data-tao-warning]:focus-within, [data-tao-control][data-tao-variant="filled"][data-tao-warning][data-state="open"] {
|
|
920
|
+
background: var(--tao-color-bg-container);
|
|
921
|
+
border-color: var(--tao-warning);
|
|
922
|
+
box-shadow: 0 0 0 2px var(--tao-color-warning-outline);
|
|
923
|
+
}
|
|
924
|
+
|
|
883
925
|
[data-tao-control][data-tao-variant="filled"][data-disabled], [data-tao-control][data-tao-variant="filled"]:has(input:disabled) {
|
|
884
926
|
background: var(--tao-color-bg-disabled);
|
|
885
927
|
border-color: var(--tao-color-border);
|
package/dist/theme/theme.css
CHANGED
|
@@ -314,6 +314,9 @@
|
|
|
314
314
|
--tao-font-family: "Geist Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
|
|
315
315
|
--tao-font-family-code: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
316
316
|
--tao-motion-unit: .1s;
|
|
317
|
+
--tao-z-index-drawer: 1000;
|
|
318
|
+
--tao-z-index-modal: 1000;
|
|
319
|
+
--tao-z-index-popup: 1100;
|
|
317
320
|
--tao-primary: var(--tao-color-primary);
|
|
318
321
|
--tao-primary-hover: var(--tao-color-primary);
|
|
319
322
|
}
|