@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
|
@@ -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 };
|