@rockshin/tao-ui 0.0.25 → 0.0.26
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/README.md +17 -6
- package/component-manifest.json +534 -6
- package/dist/components/alert/alert.css +120 -0
- package/dist/components/alert/alert.d.ts +20 -0
- package/dist/components/alert/alert.js +185 -0
- package/dist/components/button/button.css +19 -18
- package/dist/components/button/button.d.ts +8 -0
- package/dist/components/date-picker/date-picker.js +1 -1
- package/dist/components/date-picker/range-picker.js +1 -1
- package/dist/components/dropdown/dropdown.css +22 -1
- package/dist/components/dropdown/dropdown.js +4 -3
- package/dist/components/form/form-context.d.ts +7 -0
- package/dist/components/form/form-context.js +8 -0
- package/dist/components/form/form-item.d.ts +55 -0
- package/dist/components/form/form-item.js +131 -0
- package/dist/components/form/form.css +22 -0
- package/dist/components/form/form.d.ts +35 -0
- package/dist/components/form/form.js +125 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +1 -0
- package/dist/components/form-field/form-field-view.d.ts +30 -0
- package/dist/components/form-field/form-field-view.js +154 -0
- package/dist/components/form-field/form-field.d.ts +2 -2
- package/dist/components/form-field/form-field.js +29 -137
- package/dist/components/form-field/form.css +17 -7
- package/dist/components/input/input.css +6 -6
- package/dist/components/modal/confirm-dialog.js +14 -111
- package/dist/components/modal/modal.d.ts +7 -1
- package/dist/components/modal/modal.js +205 -195
- package/dist/components/popconfirm/popconfirm.css +44 -0
- package/dist/components/popconfirm/popconfirm.d.ts +41 -0
- package/dist/components/popconfirm/popconfirm.js +238 -0
- package/dist/components/popover/popover.css +105 -0
- package/dist/components/popover/popover.d.ts +41 -0
- package/dist/components/popover/popover.js +412 -0
- package/dist/components/select/select.js +1 -1
- package/dist/components/status-icon/status-icon.d.ts +5 -0
- package/dist/components/status-icon/status-icon.js +77 -0
- package/dist/components/table/table-types.d.ts +7 -0
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.js +296 -283
- package/dist/components/tooltip/tooltip.css +93 -0
- package/dist/components/tooltip/tooltip.d.ts +33 -0
- package/dist/components/tooltip/tooltip.js +226 -0
- package/dist/docs/components/alert.doc.d.ts +29 -0
- package/dist/docs/components/alert.doc.js +93 -0
- package/dist/docs/components/form.doc.d.ts +29 -0
- package/dist/docs/components/form.doc.js +71 -0
- package/dist/docs/components/modal.doc.d.ts +6 -0
- package/dist/docs/components/modal.doc.js +9 -1
- package/dist/docs/components/popconfirm.doc.d.ts +29 -0
- package/dist/docs/components/popconfirm.doc.js +132 -0
- package/dist/docs/components/popover.doc.d.ts +29 -0
- package/dist/docs/components/popover.doc.js +121 -0
- package/dist/docs/components/stack.doc.d.ts +6 -0
- package/dist/docs/components/stack.doc.js +23 -2
- package/dist/docs/components/table.doc.js +2 -1
- package/dist/docs/components/tao-provider.doc.js +11 -1
- package/dist/docs/components/tooltip.doc.d.ts +37 -0
- package/dist/docs/components/tooltip.doc.js +76 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +8 -1
- package/dist/layouts/stack/stack.d.ts +12 -3
- package/dist/layouts/stack/stack.js +60 -34
- package/dist/provider/tao-provider.d.ts +71 -0
- package/dist/provider/tao-provider.js +166 -120
- package/dist/theme/control.css +12 -12
- package/dist/theme/theme.css +23 -0
- package/dist/utils/breakpoint.d.ts +31 -0
- package/dist/utils/breakpoint.js +80 -0
- package/dist/utils/overlay.d.ts +19 -0
- package/dist/utils/overlay.js +41 -0
- package/llms.txt +68 -3
- package/package.json +6 -4
- package/dist/components/select/use-is-mobile.d.ts +0 -1
- package/dist/components/select/use-is-mobile.js +0 -27
|
@@ -1,51 +1,77 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { resolveResponsiveValue, useBreakpoint } from "../../utils/breakpoint.js";
|
|
3
4
|
import { cx } from "../../utils/semantic.js";
|
|
4
5
|
import "./layout.css";
|
|
5
6
|
function Stack(t0) {
|
|
6
|
-
const $ = c(
|
|
7
|
+
const $ = c(22);
|
|
7
8
|
const { direction: t1, gap: t2, align: t3, children, className, style, classNames, styles } = t0;
|
|
8
9
|
const direction = void 0 === t1 ? "vertical" : t1;
|
|
9
10
|
const gap = void 0 === t2 ? "md" : t2;
|
|
10
11
|
const align = void 0 === t3 ? "stretch" : t3;
|
|
11
|
-
const
|
|
12
|
+
const screens = useBreakpoint();
|
|
13
|
+
let t4;
|
|
14
|
+
if ($[0] !== direction || $[1] !== screens) {
|
|
15
|
+
t4 = resolveResponsiveValue(direction, screens) ?? "vertical";
|
|
16
|
+
$[0] = direction;
|
|
17
|
+
$[1] = screens;
|
|
18
|
+
$[2] = t4;
|
|
19
|
+
} else t4 = $[2];
|
|
20
|
+
const resolvedDirection = t4;
|
|
12
21
|
let t5;
|
|
13
|
-
if ($[
|
|
14
|
-
t5 =
|
|
15
|
-
$[
|
|
16
|
-
$[
|
|
17
|
-
$[
|
|
18
|
-
} else t5 = $[
|
|
19
|
-
const
|
|
20
|
-
let
|
|
21
|
-
if ($[
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
if ($[3] !== gap || $[4] !== screens) {
|
|
23
|
+
t5 = resolveResponsiveValue(gap, screens) ?? "md";
|
|
24
|
+
$[3] = gap;
|
|
25
|
+
$[4] = screens;
|
|
26
|
+
$[5] = t5;
|
|
27
|
+
} else t5 = $[5];
|
|
28
|
+
const resolvedGap = t5;
|
|
29
|
+
let t6;
|
|
30
|
+
if ($[6] !== align || $[7] !== screens) {
|
|
31
|
+
t6 = resolveResponsiveValue(align, screens) ?? "stretch";
|
|
32
|
+
$[6] = align;
|
|
33
|
+
$[7] = screens;
|
|
34
|
+
$[8] = t6;
|
|
35
|
+
} else t6 = $[8];
|
|
36
|
+
const resolvedAlign = t6;
|
|
37
|
+
const t7 = classNames?.root;
|
|
38
|
+
let t8;
|
|
39
|
+
if ($[9] !== className || $[10] !== t7) {
|
|
40
|
+
t8 = cx(t7, className);
|
|
41
|
+
$[9] = className;
|
|
42
|
+
$[10] = t7;
|
|
43
|
+
$[11] = t8;
|
|
44
|
+
} else t8 = $[11];
|
|
45
|
+
const t9 = styles?.root;
|
|
46
|
+
let t10;
|
|
47
|
+
if ($[12] !== style || $[13] !== t9) {
|
|
48
|
+
t10 = {
|
|
49
|
+
...t9,
|
|
24
50
|
...style
|
|
25
51
|
};
|
|
26
|
-
$[
|
|
27
|
-
$[
|
|
28
|
-
$[
|
|
29
|
-
} else
|
|
30
|
-
let
|
|
31
|
-
if ($[
|
|
32
|
-
|
|
52
|
+
$[12] = style;
|
|
53
|
+
$[13] = t9;
|
|
54
|
+
$[14] = t10;
|
|
55
|
+
} else t10 = $[14];
|
|
56
|
+
let t11;
|
|
57
|
+
if ($[15] !== children || $[16] !== resolvedAlign || $[17] !== resolvedDirection || $[18] !== resolvedGap || $[19] !== t10 || $[20] !== t8) {
|
|
58
|
+
t11 = /*#__PURE__*/ jsx("div", {
|
|
33
59
|
"data-tao-stack": "",
|
|
34
|
-
"data-tao-direction":
|
|
35
|
-
"data-tao-gap":
|
|
36
|
-
"data-tao-align":
|
|
37
|
-
className:
|
|
38
|
-
style:
|
|
60
|
+
"data-tao-direction": resolvedDirection,
|
|
61
|
+
"data-tao-gap": resolvedGap,
|
|
62
|
+
"data-tao-align": resolvedAlign,
|
|
63
|
+
className: t8,
|
|
64
|
+
style: t10,
|
|
39
65
|
children: children
|
|
40
66
|
});
|
|
41
|
-
$[
|
|
42
|
-
$[
|
|
43
|
-
$[
|
|
44
|
-
$[
|
|
45
|
-
$[
|
|
46
|
-
$[
|
|
47
|
-
$[
|
|
48
|
-
} else
|
|
49
|
-
return
|
|
67
|
+
$[15] = children;
|
|
68
|
+
$[16] = resolvedAlign;
|
|
69
|
+
$[17] = resolvedDirection;
|
|
70
|
+
$[18] = resolvedGap;
|
|
71
|
+
$[19] = t10;
|
|
72
|
+
$[20] = t8;
|
|
73
|
+
$[21] = t11;
|
|
74
|
+
} else t11 = $[21];
|
|
75
|
+
return t11;
|
|
50
76
|
}
|
|
51
77
|
export { Stack };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
import { type TaoTokenName } from '../theme/tokens';
|
|
2
3
|
export interface TaoSeedToken {
|
|
3
4
|
colorPrimary?: string;
|
|
4
5
|
colorSuccess?: string;
|
|
@@ -20,6 +21,52 @@ export interface TaoSeedToken {
|
|
|
20
21
|
zIndexPopupBase?: number;
|
|
21
22
|
}
|
|
22
23
|
export type TaoThemeMode = 'light' | 'dark';
|
|
24
|
+
export interface ButtonComponentToken {
|
|
25
|
+
fontWeight?: CSSProperties['fontWeight'];
|
|
26
|
+
borderRadius?: number;
|
|
27
|
+
paddingInline?: number;
|
|
28
|
+
paddingInlineSM?: number;
|
|
29
|
+
paddingInlineLG?: number;
|
|
30
|
+
primaryColor?: string;
|
|
31
|
+
primaryShadow?: string;
|
|
32
|
+
defaultColor?: string;
|
|
33
|
+
defaultBg?: string;
|
|
34
|
+
defaultBorderColor?: string;
|
|
35
|
+
defaultHoverBg?: string;
|
|
36
|
+
defaultHoverColor?: string;
|
|
37
|
+
defaultHoverBorderColor?: string;
|
|
38
|
+
contentFontSize?: number;
|
|
39
|
+
contentFontSizeSM?: number;
|
|
40
|
+
contentFontSizeLG?: number;
|
|
41
|
+
}
|
|
42
|
+
export interface InputComponentToken {
|
|
43
|
+
paddingInline?: number;
|
|
44
|
+
paddingInlineSM?: number;
|
|
45
|
+
paddingInlineLG?: number;
|
|
46
|
+
hoverBorderColor?: string;
|
|
47
|
+
activeBorderColor?: string;
|
|
48
|
+
activeShadow?: string;
|
|
49
|
+
errorActiveShadow?: string;
|
|
50
|
+
hoverBg?: string;
|
|
51
|
+
activeBg?: string;
|
|
52
|
+
inputFontSize?: number;
|
|
53
|
+
inputFontSizeSM?: number;
|
|
54
|
+
inputFontSizeLG?: number;
|
|
55
|
+
}
|
|
56
|
+
export interface FormFieldComponentToken {
|
|
57
|
+
labelColor?: string;
|
|
58
|
+
labelFontSize?: number;
|
|
59
|
+
labelRequiredMarkColor?: string;
|
|
60
|
+
itemGap?: number;
|
|
61
|
+
descriptionColor?: string;
|
|
62
|
+
errorColor?: string;
|
|
63
|
+
errorFontSize?: number;
|
|
64
|
+
}
|
|
65
|
+
export interface TaoComponentTokenMap {
|
|
66
|
+
Button?: ButtonComponentToken;
|
|
67
|
+
Input?: InputComponentToken;
|
|
68
|
+
FormField?: FormFieldComponentToken;
|
|
69
|
+
}
|
|
23
70
|
export interface TaoThemeConfig {
|
|
24
71
|
token?: Partial<TaoSeedToken>;
|
|
25
72
|
/**
|
|
@@ -32,6 +79,14 @@ export interface TaoThemeConfig {
|
|
|
32
79
|
* 零 runtime 放弃此路径)。需要亮/暗混排时,把亮部移出 dark provider。
|
|
33
80
|
*/
|
|
34
81
|
mode?: TaoThemeMode;
|
|
82
|
+
/**
|
|
83
|
+
* 紧凑密度。true 时输出 data-tao-density="compact",激活 theme.css 的
|
|
84
|
+
* compact scope(控件高度 32→28、padding/margin 各降一档)。经 context
|
|
85
|
+
* 级联,portal 浮层透传。与 antd compactAlgorithm 对应,纯 CSS 实现。
|
|
86
|
+
*/
|
|
87
|
+
compact?: boolean;
|
|
88
|
+
/** Per-component token overrides (DESIGN.md §3.6). */
|
|
89
|
+
components?: TaoComponentTokenMap;
|
|
35
90
|
inherit?: boolean;
|
|
36
91
|
}
|
|
37
92
|
export type TaoSize = 'small' | 'medium' | 'large';
|
|
@@ -43,8 +98,24 @@ export interface TaoConfig {
|
|
|
43
98
|
variant: TaoVariant;
|
|
44
99
|
/** Resolved 明暗模式,portal 浮层用它重建 data-tao-theme。 */
|
|
45
100
|
mode: TaoThemeMode;
|
|
101
|
+
/** Resolved 紧凑密度,portal 浮层用它重建 data-tao-density。 */
|
|
102
|
+
compact: boolean;
|
|
46
103
|
}
|
|
47
104
|
export declare function useTaoConfig(): TaoConfig;
|
|
105
|
+
/**
|
|
106
|
+
* antd `theme.useToken` counterpart, zero-runtime edition: returns every
|
|
107
|
+
* design token as a `var(--tao-*)` reference string, so custom components can
|
|
108
|
+
* stay visually consistent with tao-ui and still resolve in the browser
|
|
109
|
+
* against the live theme (dark mode, seed overrides, compact density):
|
|
110
|
+
*
|
|
111
|
+
* ```tsx
|
|
112
|
+
* const { token } = useTaoToken();
|
|
113
|
+
* <div style={{ borderRadius: token['--tao-radius-lg'], padding: token['--tao-padding-lg'] }} />
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export declare function useTaoToken(): {
|
|
117
|
+
token: Record<TaoTokenName, string>;
|
|
118
|
+
};
|
|
48
119
|
/**
|
|
49
120
|
* Re-establishes the theme token scope inside a portal. Floating components
|
|
50
121
|
* portal their popup to document.body, escaping the `[data-tao-provider]`
|
|
@@ -2,39 +2,54 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
3
|
import { Slot } from "@radix-ui/react-slot";
|
|
4
4
|
import { createContext, useContext, useRef } from "react";
|
|
5
|
+
import { taoTokenVars } from "../theme/tokens.js";
|
|
5
6
|
const TaoConfigContext = /*#__PURE__*/ createContext({
|
|
6
7
|
size: 'medium',
|
|
7
8
|
disabled: false,
|
|
8
9
|
variant: 'outlined',
|
|
9
10
|
mode: 'light',
|
|
11
|
+
compact: false,
|
|
10
12
|
tokenStyle: {}
|
|
11
13
|
});
|
|
12
14
|
function useTaoConfig() {
|
|
13
|
-
const $ = c(
|
|
14
|
-
const { size, disabled, variant, mode } = useContext(TaoConfigContext);
|
|
15
|
+
const $ = c(6);
|
|
16
|
+
const { size, disabled, variant, mode, compact } = useContext(TaoConfigContext);
|
|
15
17
|
let t0;
|
|
16
|
-
if ($[0] !==
|
|
18
|
+
if ($[0] !== compact || $[1] !== disabled || $[2] !== mode || $[3] !== size || $[4] !== variant) {
|
|
17
19
|
t0 = {
|
|
18
20
|
size,
|
|
19
21
|
disabled,
|
|
20
22
|
variant,
|
|
21
|
-
mode
|
|
23
|
+
mode,
|
|
24
|
+
compact
|
|
22
25
|
};
|
|
23
|
-
$[0] =
|
|
24
|
-
$[1] =
|
|
25
|
-
$[2] =
|
|
26
|
-
$[3] =
|
|
27
|
-
$[4] =
|
|
28
|
-
|
|
26
|
+
$[0] = compact;
|
|
27
|
+
$[1] = disabled;
|
|
28
|
+
$[2] = mode;
|
|
29
|
+
$[3] = size;
|
|
30
|
+
$[4] = variant;
|
|
31
|
+
$[5] = t0;
|
|
32
|
+
} else t0 = $[5];
|
|
29
33
|
return t0;
|
|
30
34
|
}
|
|
31
35
|
function useTaoInternalConfig() {
|
|
32
36
|
return useContext(TaoConfigContext);
|
|
33
37
|
}
|
|
38
|
+
function useTaoToken() {
|
|
39
|
+
const $ = c(1);
|
|
40
|
+
let t0;
|
|
41
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
42
|
+
t0 = {
|
|
43
|
+
token: taoTokenVars
|
|
44
|
+
};
|
|
45
|
+
$[0] = t0;
|
|
46
|
+
} else t0 = $[0];
|
|
47
|
+
return t0;
|
|
48
|
+
}
|
|
34
49
|
function TaoPortalScope(t0) {
|
|
35
|
-
const $ = c(
|
|
50
|
+
const $ = c(20);
|
|
36
51
|
const { children, style, asChild } = t0;
|
|
37
|
-
const { tokenStyle, mode } = useTaoInternalConfig();
|
|
52
|
+
const { tokenStyle, mode, compact } = useTaoInternalConfig();
|
|
38
53
|
let t1;
|
|
39
54
|
if ($[0] !== mode) {
|
|
40
55
|
t1 = "light" === mode ? void 0 : {
|
|
@@ -44,57 +59,70 @@ function TaoPortalScope(t0) {
|
|
|
44
59
|
$[1] = t1;
|
|
45
60
|
} else t1 = $[1];
|
|
46
61
|
const themeAttr = t1;
|
|
62
|
+
let t2;
|
|
63
|
+
if ($[2] !== compact) {
|
|
64
|
+
t2 = compact ? {
|
|
65
|
+
"data-tao-density": "compact"
|
|
66
|
+
} : void 0;
|
|
67
|
+
$[2] = compact;
|
|
68
|
+
$[3] = t2;
|
|
69
|
+
} else t2 = $[3];
|
|
70
|
+
const densityAttr = t2;
|
|
47
71
|
if (asChild) {
|
|
48
|
-
let
|
|
49
|
-
if ($[
|
|
50
|
-
|
|
72
|
+
let t3;
|
|
73
|
+
if ($[4] !== style || $[5] !== tokenStyle) {
|
|
74
|
+
t3 = {
|
|
51
75
|
...tokenStyle,
|
|
52
76
|
...style
|
|
53
77
|
};
|
|
54
|
-
$[
|
|
55
|
-
$[
|
|
56
|
-
$[
|
|
57
|
-
} else
|
|
58
|
-
let
|
|
59
|
-
if ($[
|
|
60
|
-
|
|
78
|
+
$[4] = style;
|
|
79
|
+
$[5] = tokenStyle;
|
|
80
|
+
$[6] = t3;
|
|
81
|
+
} else t3 = $[6];
|
|
82
|
+
let t4;
|
|
83
|
+
if ($[7] !== children || $[8] !== densityAttr || $[9] !== t3 || $[10] !== themeAttr) {
|
|
84
|
+
t4 = /*#__PURE__*/ jsx(Slot, {
|
|
61
85
|
"data-tao-provider": "",
|
|
62
86
|
...themeAttr,
|
|
63
|
-
|
|
87
|
+
...densityAttr,
|
|
88
|
+
style: t3,
|
|
64
89
|
children: children
|
|
65
90
|
});
|
|
66
|
-
$[
|
|
67
|
-
$[
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
70
|
-
|
|
71
|
-
|
|
91
|
+
$[7] = children;
|
|
92
|
+
$[8] = densityAttr;
|
|
93
|
+
$[9] = t3;
|
|
94
|
+
$[10] = themeAttr;
|
|
95
|
+
$[11] = t4;
|
|
96
|
+
} else t4 = $[11];
|
|
97
|
+
return t4;
|
|
72
98
|
}
|
|
73
|
-
let
|
|
74
|
-
if ($[
|
|
75
|
-
|
|
99
|
+
let t3;
|
|
100
|
+
if ($[12] !== style || $[13] !== tokenStyle) {
|
|
101
|
+
t3 = {
|
|
76
102
|
display: "contents",
|
|
77
103
|
...tokenStyle,
|
|
78
104
|
...style
|
|
79
105
|
};
|
|
80
|
-
$[
|
|
81
|
-
$[
|
|
82
|
-
$[
|
|
83
|
-
} else
|
|
84
|
-
let
|
|
85
|
-
if ($[
|
|
86
|
-
|
|
106
|
+
$[12] = style;
|
|
107
|
+
$[13] = tokenStyle;
|
|
108
|
+
$[14] = t3;
|
|
109
|
+
} else t3 = $[14];
|
|
110
|
+
let t4;
|
|
111
|
+
if ($[15] !== children || $[16] !== densityAttr || $[17] !== t3 || $[18] !== themeAttr) {
|
|
112
|
+
t4 = /*#__PURE__*/ jsx("div", {
|
|
87
113
|
"data-tao-provider": "",
|
|
88
114
|
...themeAttr,
|
|
89
|
-
|
|
115
|
+
...densityAttr,
|
|
116
|
+
style: t3,
|
|
90
117
|
children: children
|
|
91
118
|
});
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
|
|
97
|
-
|
|
119
|
+
$[15] = children;
|
|
120
|
+
$[16] = densityAttr;
|
|
121
|
+
$[17] = t3;
|
|
122
|
+
$[18] = themeAttr;
|
|
123
|
+
$[19] = t4;
|
|
124
|
+
} else t4 = $[19];
|
|
125
|
+
return t4;
|
|
98
126
|
}
|
|
99
127
|
const TOKEN_TO_VAR = {
|
|
100
128
|
colorPrimary: '--tao-color-primary',
|
|
@@ -139,141 +167,159 @@ const DEFAULT_TOKEN_STYLE = {
|
|
|
139
167
|
'--tao-z-index-base': '0',
|
|
140
168
|
'--tao-z-index-popup-base': '1000'
|
|
141
169
|
};
|
|
142
|
-
function
|
|
143
|
-
const key = JSON.stringify(
|
|
170
|
+
function useStableThemeKey(token, components) {
|
|
171
|
+
const key = JSON.stringify({
|
|
172
|
+
token: token ?? null,
|
|
173
|
+
components: components ?? null
|
|
174
|
+
});
|
|
144
175
|
const ref = useRef(key);
|
|
145
176
|
if (ref.current !== key) ref.current = key;
|
|
146
177
|
return ref.current;
|
|
147
178
|
}
|
|
179
|
+
function kebabCase(key) {
|
|
180
|
+
return key.replace(/[A-Z]+/g, (match)=>`-${match.toLowerCase()}`).replace(/^-/, '');
|
|
181
|
+
}
|
|
182
|
+
const UNITLESS_COMPONENT_TOKEN_KEYS = new Set([
|
|
183
|
+
'fontWeight'
|
|
184
|
+
]);
|
|
148
185
|
function TaoProvider(t0) {
|
|
149
186
|
const $ = c(26);
|
|
150
187
|
const { theme, size, disabled, variant, children } = t0;
|
|
151
188
|
const parentConfig = useContext(TaoConfigContext);
|
|
152
189
|
const inherit = theme?.inherit ?? true;
|
|
153
|
-
const
|
|
154
|
-
const tokenKey = useStableTokenKey(token);
|
|
190
|
+
const themeKey = useStableThemeKey(theme?.token, theme?.components);
|
|
155
191
|
let t1;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
const parsedToken = t2;
|
|
164
|
-
if (!parsedToken) {
|
|
165
|
-
t1 = void 0;
|
|
166
|
-
break bb0;
|
|
167
|
-
}
|
|
168
|
-
let vars;
|
|
169
|
-
if ($[2] !== parsedToken) {
|
|
170
|
-
vars = {};
|
|
171
|
-
for (const [key, varName] of Object.entries(TOKEN_TO_VAR)){
|
|
172
|
-
const val = parsedToken[key];
|
|
173
|
-
if (null != val) vars[varName] = String(val);
|
|
192
|
+
if ($[0] !== themeKey) {
|
|
193
|
+
bb0: {
|
|
194
|
+
const parsedTheme = JSON.parse(themeKey);
|
|
195
|
+
const parsedToken = parsedTheme.token;
|
|
196
|
+
if (!parsedToken && !parsedTheme.components) {
|
|
197
|
+
t1 = void 0;
|
|
198
|
+
break bb0;
|
|
174
199
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
200
|
+
const vars = {};
|
|
201
|
+
if (parsedToken) {
|
|
202
|
+
for (const [key, varName] of Object.entries(TOKEN_TO_VAR)){
|
|
203
|
+
const val = parsedToken[key];
|
|
204
|
+
if (null != val) vars[varName] = String(val);
|
|
205
|
+
}
|
|
206
|
+
for (const [key_0, varName_0] of Object.entries(TOKEN_TO_VAR_PX)){
|
|
207
|
+
const val_0 = parsedToken[key_0];
|
|
208
|
+
if (null != val_0) vars[varName_0] = `${val_0}px`;
|
|
209
|
+
}
|
|
210
|
+
for (const [key_1, varName_1] of Object.entries(TOKEN_TO_VAR_NUMBER)){
|
|
211
|
+
const val_1 = parsedToken[key_1];
|
|
212
|
+
if (null != val_1) vars[varName_1] = String(val_1);
|
|
213
|
+
}
|
|
214
|
+
if (false === parsedToken.motion) vars["--tao-motion-unit"] = "0s";
|
|
215
|
+
else if (null != parsedToken.motionUnit) vars["--tao-motion-unit"] = `${parsedToken.motionUnit}s`;
|
|
178
216
|
}
|
|
179
|
-
|
|
180
|
-
const
|
|
181
|
-
|
|
217
|
+
if (parsedTheme.components) {
|
|
218
|
+
for (const [component, tokens] of Object.entries(parsedTheme.components))if (tokens) for (const [key_2, value] of Object.entries(tokens)){
|
|
219
|
+
if (null == value) continue;
|
|
220
|
+
const varName_2 = `--tao-${kebabCase(component)}-${kebabCase(key_2)}`;
|
|
221
|
+
vars[varName_2] = "number" != typeof value || UNITLESS_COMPONENT_TOKEN_KEYS.has(key_2) ? String(value) : `${value}px`;
|
|
222
|
+
}
|
|
182
223
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
t1 = vars;
|
|
189
|
-
}
|
|
224
|
+
t1 = vars;
|
|
225
|
+
}
|
|
226
|
+
$[0] = themeKey;
|
|
227
|
+
$[1] = t1;
|
|
228
|
+
} else t1 = $[1];
|
|
190
229
|
const ownVars = t1;
|
|
191
230
|
let t2;
|
|
192
|
-
if ($[
|
|
231
|
+
if ($[2] !== inherit || $[3] !== ownVars) {
|
|
193
232
|
t2 = inherit ? {
|
|
194
233
|
...ownVars
|
|
195
234
|
} : {
|
|
196
235
|
...DEFAULT_TOKEN_STYLE,
|
|
197
236
|
...ownVars
|
|
198
237
|
};
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
$[
|
|
202
|
-
} else t2 = $[
|
|
238
|
+
$[2] = inherit;
|
|
239
|
+
$[3] = ownVars;
|
|
240
|
+
$[4] = t2;
|
|
241
|
+
} else t2 = $[4];
|
|
203
242
|
const scopedVars = t2;
|
|
204
243
|
let t3;
|
|
205
|
-
if ($[
|
|
244
|
+
if ($[5] !== inherit || $[6] !== parentConfig.tokenStyle || $[7] !== scopedVars) {
|
|
206
245
|
t3 = inherit ? {
|
|
207
246
|
...parentConfig.tokenStyle,
|
|
208
247
|
...scopedVars
|
|
209
248
|
} : {
|
|
210
249
|
...scopedVars
|
|
211
250
|
};
|
|
212
|
-
$[
|
|
213
|
-
$[
|
|
214
|
-
$[
|
|
215
|
-
$[
|
|
216
|
-
} else t3 = $[
|
|
251
|
+
$[5] = inherit;
|
|
252
|
+
$[6] = parentConfig.tokenStyle;
|
|
253
|
+
$[7] = scopedVars;
|
|
254
|
+
$[8] = t3;
|
|
255
|
+
} else t3 = $[8];
|
|
217
256
|
const tokenStyle = t3;
|
|
218
257
|
let t4;
|
|
219
|
-
if ($[
|
|
258
|
+
if ($[9] !== scopedVars) {
|
|
220
259
|
t4 = {
|
|
221
260
|
display: "contents",
|
|
222
261
|
...scopedVars
|
|
223
262
|
};
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
} else t4 = $[
|
|
263
|
+
$[9] = scopedVars;
|
|
264
|
+
$[10] = t4;
|
|
265
|
+
} else t4 = $[10];
|
|
227
266
|
const divStyle = t4;
|
|
228
267
|
const parentSize = parentConfig.size;
|
|
229
268
|
const parentDisabled = parentConfig.disabled;
|
|
230
269
|
const parentVariant = parentConfig.variant;
|
|
231
270
|
const parentMode = parentConfig.mode;
|
|
271
|
+
const parentCompact = parentConfig.compact;
|
|
232
272
|
const mode = theme?.mode ?? (inherit ? parentMode : "light");
|
|
273
|
+
const compact = theme?.compact ?? (inherit ? parentCompact : false);
|
|
233
274
|
const t5 = size ?? (inherit ? parentSize : "medium");
|
|
234
275
|
const t6 = disabled ?? (inherit ? parentDisabled : false);
|
|
235
276
|
const t7 = variant ?? (inherit ? parentVariant : "outlined");
|
|
236
277
|
let t8;
|
|
237
|
-
if ($[
|
|
278
|
+
if ($[11] !== compact || $[12] !== mode || $[13] !== t5 || $[14] !== t6 || $[15] !== t7 || $[16] !== tokenStyle) {
|
|
238
279
|
t8 = {
|
|
239
280
|
size: t5,
|
|
240
281
|
disabled: t6,
|
|
241
282
|
variant: t7,
|
|
242
283
|
mode,
|
|
284
|
+
compact,
|
|
243
285
|
tokenStyle
|
|
244
286
|
};
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
251
|
-
|
|
287
|
+
$[11] = compact;
|
|
288
|
+
$[12] = mode;
|
|
289
|
+
$[13] = t5;
|
|
290
|
+
$[14] = t6;
|
|
291
|
+
$[15] = t7;
|
|
292
|
+
$[16] = tokenStyle;
|
|
293
|
+
$[17] = t8;
|
|
294
|
+
} else t8 = $[17];
|
|
252
295
|
const config = t8;
|
|
253
296
|
const t9 = "light" === mode ? void 0 : mode;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
297
|
+
const t10 = compact ? "compact" : void 0;
|
|
298
|
+
let t11;
|
|
299
|
+
if ($[18] !== children || $[19] !== divStyle || $[20] !== t10 || $[21] !== t9) {
|
|
300
|
+
t11 = /*#__PURE__*/ jsx("div", {
|
|
257
301
|
style: divStyle,
|
|
258
302
|
"data-tao-provider": "",
|
|
259
303
|
"data-tao-theme": t9,
|
|
304
|
+
"data-tao-density": t10,
|
|
260
305
|
children: children
|
|
261
306
|
});
|
|
262
|
-
$[
|
|
263
|
-
$[
|
|
307
|
+
$[18] = children;
|
|
308
|
+
$[19] = divStyle;
|
|
309
|
+
$[20] = t10;
|
|
264
310
|
$[21] = t9;
|
|
265
|
-
$[22] =
|
|
266
|
-
} else
|
|
267
|
-
let
|
|
268
|
-
if ($[23] !== config || $[24] !==
|
|
269
|
-
|
|
311
|
+
$[22] = t11;
|
|
312
|
+
} else t11 = $[22];
|
|
313
|
+
let t12;
|
|
314
|
+
if ($[23] !== config || $[24] !== t11) {
|
|
315
|
+
t12 = /*#__PURE__*/ jsx(TaoConfigContext.Provider, {
|
|
270
316
|
value: config,
|
|
271
|
-
children:
|
|
317
|
+
children: t11
|
|
272
318
|
});
|
|
273
319
|
$[23] = config;
|
|
274
|
-
$[24] =
|
|
275
|
-
$[25] =
|
|
276
|
-
} else
|
|
277
|
-
return
|
|
320
|
+
$[24] = t11;
|
|
321
|
+
$[25] = t12;
|
|
322
|
+
} else t12 = $[25];
|
|
323
|
+
return t12;
|
|
278
324
|
}
|
|
279
|
-
export { TaoPortalScope, TaoProvider, useTaoConfig };
|
|
325
|
+
export { TaoPortalScope, TaoProvider, useTaoConfig, useTaoToken };
|
package/dist/theme/control.css
CHANGED
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
[data-tao-control][data-tao-variant="outlined"]:hover:not([data-disabled]):not(:focus-within):not([data-state="open"]) {
|
|
21
|
-
border-color: color-mix(in oklch,
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
border-color: var(--tao-input-hover-border-color, color-mix(in oklch,
|
|
22
|
+
var(--tao-color-text-base) 20%,
|
|
23
|
+
var(--tao-color-bg-base)));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
[data-tao-control][data-tao-variant="outlined"]:focus-within, [data-tao-control][data-tao-variant="outlined"][data-state="open"] {
|
|
27
|
-
border-color: var(--tao-primary);
|
|
28
|
-
box-shadow: 0 0 0 var(--tao-ring-width) var(--tao-control-outline);
|
|
27
|
+
border-color: var(--tao-input-active-border-color, var(--tao-primary));
|
|
28
|
+
box-shadow: var(--tao-input-active-shadow, 0 0 0 var(--tao-ring-width) var(--tao-control-outline));
|
|
29
29
|
outline: none;
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
|
|
40
40
|
[data-tao-control][data-tao-variant="outlined"][data-tao-error]:focus-within, [data-tao-control][data-tao-variant="outlined"][data-tao-error][data-state="open"] {
|
|
41
41
|
border-color: var(--tao-error);
|
|
42
|
-
box-shadow: 0 0 0 var(--tao-ring-width) var(--tao-color-error-outline);
|
|
42
|
+
box-shadow: var(--tao-input-error-active-shadow, 0 0 0 var(--tao-ring-width) var(--tao-color-error-outline));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
[data-tao-control][data-tao-variant="outlined"][data-tao-warning] {
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
[data-tao-control][data-tao-variant="filled"]:hover:not([data-disabled]):not(:focus-within):not([data-state="open"]) {
|
|
72
|
-
background: var(--tao-color-fill-secondary);
|
|
72
|
+
background: var(--tao-input-hover-bg, var(--tao-color-fill-secondary));
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
[data-tao-control][data-tao-variant="filled"]:focus-within, [data-tao-control][data-tao-variant="filled"][data-state="open"] {
|
|
76
|
-
background: var(--tao-color-bg-container);
|
|
77
|
-
border-color: var(--tao-primary);
|
|
78
|
-
box-shadow: 0 0 0 var(--tao-ring-width) var(--tao-control-outline);
|
|
76
|
+
background: var(--tao-input-active-bg, var(--tao-color-bg-container));
|
|
77
|
+
border-color: var(--tao-input-active-border-color, var(--tao-primary));
|
|
78
|
+
box-shadow: var(--tao-input-active-shadow, 0 0 0 var(--tao-ring-width) var(--tao-control-outline));
|
|
79
79
|
outline: none;
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -90,9 +90,9 @@
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
[data-tao-control][data-tao-variant="filled"][data-tao-error]:focus-within, [data-tao-control][data-tao-variant="filled"][data-tao-error][data-state="open"] {
|
|
93
|
-
background: var(--tao-color-bg-container);
|
|
93
|
+
background: var(--tao-input-active-bg, var(--tao-color-bg-container));
|
|
94
94
|
border-color: var(--tao-error);
|
|
95
|
-
box-shadow: 0 0 0 var(--tao-ring-width) var(--tao-color-error-outline);
|
|
95
|
+
box-shadow: var(--tao-input-error-active-shadow, 0 0 0 var(--tao-ring-width) var(--tao-color-error-outline));
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
[data-tao-control][data-tao-variant="filled"][data-tao-warning] {
|