@kingsoft-ai/design 0.1.18 → 0.2.6
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/index.cjs +3150 -2478
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +7211 -7849
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/DesignThemeProvider.d.ts +25 -20
- package/dist/types/button/Button.d.ts +4 -19
- package/dist/types/button/Button.style.d.ts +4 -35
- package/dist/types/button/IconButton.d.ts +4 -5
- package/dist/types/button/IconButton.style.d.ts +4 -7
- package/dist/types/button/styled-tokens.d.ts +582 -0
- package/dist/types/button/tokens.d.ts +1 -1
- package/dist/types/button/tokens.types.d.ts +190 -0
- package/dist/types/card/Card.d.ts +0 -6
- package/dist/types/card/Card.style.d.ts +4 -7
- package/dist/types/card/styled-tokens.d.ts +130 -0
- package/dist/types/card/tokens.d.ts +1 -1
- package/dist/types/card/tokens.types.d.ts +48 -0
- package/dist/types/checkbox/Checkbox.d.ts +0 -7
- package/dist/types/checkbox/Checkbox.style.d.ts +29 -7
- package/dist/types/checkbox/CheckboxButton.d.ts +0 -16
- package/dist/types/checkbox/CheckboxButton.style.d.ts +24 -12
- package/dist/types/checkbox/styled-tokens.d.ts +122 -0
- package/dist/types/checkbox/tokens.d.ts +1 -1
- package/dist/types/checkbox/tokens.types.d.ts +39 -0
- package/dist/types/collapse/Collapse.d.ts +2 -34
- package/dist/types/collapse/Collapse.style.d.ts +4 -43
- package/dist/types/collapse/styled-tokens.d.ts +77 -0
- package/dist/types/collapse/tokens.d.ts +1 -1
- package/dist/types/collapse/tokens.types.d.ts +28 -0
- package/dist/types/context/ThemeContext.d.ts +24 -0
- package/dist/types/context/index.d.ts +2 -0
- package/dist/types/floatButton/FloatButton.d.ts +0 -21
- package/dist/types/floatButton/FloatButton.style.d.ts +0 -31
- package/dist/types/floatButton/styled-tokens.d.ts +127 -0
- package/dist/types/floatButton/tokens.d.ts +1 -1
- package/dist/types/floatButton/tokens.types.d.ts +66 -0
- package/dist/types/index.d.ts +5 -4
- package/dist/types/input/Input.d.ts +4 -22
- package/dist/types/input/Input.style.d.ts +4 -48
- package/dist/types/input/styled-tokens.d.ts +147 -0
- package/dist/types/input/tokens.d.ts +1 -1
- package/dist/types/input/tokens.types.d.ts +46 -0
- package/dist/types/link/Link.d.ts +4 -0
- package/dist/types/link/Link.style.d.ts +4 -10
- package/dist/types/link/styled-tokens.d.ts +107 -0
- package/dist/types/link/tokens.d.ts +1 -1
- package/dist/types/link/tokens.types.d.ts +39 -0
- package/dist/types/menu/Menu.d.ts +0 -25
- package/dist/types/menu/Menu.style.d.ts +4 -43
- package/dist/types/menu/MenuItem.d.ts +0 -6
- package/dist/types/menu/styled-tokens.d.ts +217 -0
- package/dist/types/menu/tokens.d.ts +1 -1
- package/dist/types/menu/tokens.types.d.ts +79 -0
- package/dist/types/modal/Modal.d.ts +0 -8
- package/dist/types/modal/Modal.style.d.ts +4 -11
- package/dist/types/modal/styled-tokens.d.ts +370 -0
- package/dist/types/modal/tokens.d.ts +1 -1
- package/dist/types/modal/tokens.types.d.ts +107 -0
- package/dist/types/numberInput/NumberInput.d.ts +2 -22
- package/dist/types/numberInput/NumberInput.style.d.ts +4 -7
- package/dist/types/numberInput/styled-tokens.d.ts +192 -0
- package/dist/types/numberInput/tokens.d.ts +1 -1
- package/dist/types/numberInput/tokens.types.d.ts +65 -0
- package/dist/types/progress/Progress.d.ts +4 -27
- package/dist/types/progress/Progress.style.d.ts +4 -43
- package/dist/types/progress/styled-tokens.d.ts +137 -0
- package/dist/types/progress/tokens.d.ts +3 -0
- package/dist/types/progress/tokens.types.d.ts +52 -0
- package/dist/types/radio/Radio.d.ts +4 -0
- package/dist/types/radio/Radio.style.d.ts +9 -28
- package/dist/types/radio/styled-tokens.d.ts +122 -0
- package/dist/types/radio/tokens.d.ts +1 -1
- package/dist/types/radio/tokens.types.d.ts +41 -0
- package/dist/types/select/Select.style.d.ts +4 -7
- package/dist/types/select/styled-tokens.d.ts +237 -0
- package/dist/types/select/tokens.d.ts +1 -1
- package/dist/types/select/tokens.types.d.ts +72 -0
- package/dist/types/skeleton/Skeleton.style.d.ts +0 -25
- package/dist/types/skeleton/styled-tokens.d.ts +82 -0
- package/dist/types/skeleton/tokens.d.ts +1 -1
- package/dist/types/skeleton/tokens.types.d.ts +31 -0
- package/dist/types/slider/Slider.d.ts +74 -0
- package/dist/types/slider/Slider.style.d.ts +125 -0
- package/dist/types/slider/__tests__/Slider.test.d.ts +13 -0
- package/dist/types/slider/index.d.ts +2 -0
- package/dist/types/slider/styled-tokens.d.ts +252 -0
- package/dist/types/slider/tokens.d.ts +3 -0
- package/dist/types/slider/tokens.types.d.ts +121 -0
- package/dist/types/stepper/Stepper.d.ts +3 -0
- package/dist/types/stepper/Stepper.style.d.ts +4 -7
- package/dist/types/stepper/styled-tokens.d.ts +157 -0
- package/dist/types/stepper/tokens.d.ts +1 -1
- package/dist/types/stepper/tokens.types.d.ts +68 -0
- package/dist/types/switch/Switch.d.ts +4 -35
- package/dist/types/switch/Switch.style.d.ts +4 -56
- package/dist/types/switch/styled-tokens.d.ts +132 -0
- package/dist/types/switch/tokens.d.ts +1 -1
- package/dist/types/switch/tokens.types.d.ts +45 -0
- package/dist/types/table/Table.d.ts +2 -0
- package/dist/types/table/Table.style.d.ts +4 -7
- package/dist/types/table/styled-tokens.d.ts +182 -0
- package/dist/types/table/tokens.d.ts +3 -0
- package/dist/types/table/tokens.types.d.ts +43 -0
- package/dist/types/tag/Tag.d.ts +4 -36
- package/dist/types/tag/Tag.style.d.ts +5 -41
- package/dist/types/tag/styled-tokens.d.ts +140 -0
- package/dist/types/tag/tokens.d.ts +1 -1
- package/dist/types/tag/tokens.types.d.ts +76 -0
- package/dist/types/theme.d.ts +1 -2
- package/dist/types/tooltip/Tooltip.d.ts +0 -18
- package/dist/types/tooltip/Tooltip.style.d.ts +0 -19
- package/dist/types/tooltip/styled-tokens.d.ts +72 -0
- package/dist/types/tooltip/tokens.d.ts +1 -1
- package/dist/types/tooltip/tokens.types.d.ts +21 -0
- package/dist/types/transfer/Transfer.d.ts +0 -20
- package/dist/types/transfer/Transfer.style.d.ts +0 -10
- package/dist/types/transfer/styled-tokens.d.ts +252 -0
- package/dist/types/transfer/tokens.d.ts +1 -1
- package/dist/types/transfer/tokens.types.d.ts +79 -0
- package/dist/types/types/index.d.ts +64 -4
- package/dist/types/upload/Upload.d.ts +2 -21
- package/dist/types/upload/Upload.style.d.ts +4 -64
- package/dist/types/upload/styled-tokens.d.ts +227 -0
- package/dist/types/upload/tokens.d.ts +3 -0
- package/dist/types/upload/tokens.types.d.ts +66 -0
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/styled-token.d.ts +117 -0
- package/package.json +14 -13
- package/dist/styles.css +0 -1
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Switch 开关组件
|
|
3
|
-
*
|
|
4
|
-
* 基于 react-aria 实现无障碍访问的开关组件
|
|
5
|
-
* 完全符合 Figma 设计稿规范
|
|
6
|
-
* 支持带文字的开关(如 ON/OFF、开/关)
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```tsx
|
|
10
|
-
* // 基础用法
|
|
11
|
-
* <Switch>开启通知</Switch>
|
|
12
|
-
*
|
|
13
|
-
* // 带状态文字
|
|
14
|
-
* <Switch
|
|
15
|
-
* checkedLabel="开"
|
|
16
|
-
* uncheckedLabel="关"
|
|
17
|
-
* >
|
|
18
|
-
* 夜间模式
|
|
19
|
-
* </Switch>
|
|
20
|
-
*
|
|
21
|
-
* // 受控组件
|
|
22
|
-
* <Switch
|
|
23
|
-
* isSelected={enabled}
|
|
24
|
-
* onChange={setEnabled}
|
|
25
|
-
* >
|
|
26
|
-
* 自动保存
|
|
27
|
-
* </Switch>
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
1
|
import type { ReactNode } from 'react';
|
|
31
2
|
import type { AriaSwitchProps } from 'react-aria';
|
|
32
3
|
import type { ToggleProps } from '@react-types/checkbox';
|
|
@@ -49,13 +20,9 @@ export type SwitchProps = Omit<AriaSwitchProps, 'children' | 'isDisabled'> & Omi
|
|
|
49
20
|
children?: ReactNode;
|
|
50
21
|
/** 自定义类名 */
|
|
51
22
|
className?: string;
|
|
23
|
+
/** 自定义样式(支持 CSS 变量定制) */
|
|
24
|
+
style?: React.CSSProperties;
|
|
52
25
|
};
|
|
53
|
-
/**
|
|
54
|
-
* Switch 开关组件
|
|
55
|
-
*
|
|
56
|
-
* 基于 Figma 设计规范实现的开关组件,支持带文字的开关
|
|
57
|
-
* 使用 react-aria 保证无障碍访问性
|
|
58
|
-
*/
|
|
59
26
|
export declare const Switch: import("react").ForwardRefExoticComponent<Omit<AriaSwitchProps, "children" | "isDisabled"> & Omit<ToggleProps, "children" | "isDisabled"> & {
|
|
60
27
|
/** 开关尺寸:小号(20px)、标准(24px) */
|
|
61
28
|
size?: SwitchSize;
|
|
@@ -73,4 +40,6 @@ export declare const Switch: import("react").ForwardRefExoticComponent<Omit<Aria
|
|
|
73
40
|
children?: ReactNode;
|
|
74
41
|
/** 自定义类名 */
|
|
75
42
|
className?: string;
|
|
43
|
+
/** 自定义样式(支持 CSS 变量定制) */
|
|
44
|
+
style?: React.CSSProperties;
|
|
76
45
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Switch
|
|
2
|
+
* Switch Styled Components
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* - Tier 3 (Component): 组件专用 Token --ksd-switch-*
|
|
8
|
-
*
|
|
9
|
-
* 无需 ThemeProvider,直接使用 CSS 变量
|
|
10
|
-
* 支持带文字的开关组件(如 ON/OFF、开/关)
|
|
4
|
+
* 使用 Styled Token System 实现样式:
|
|
5
|
+
* - JS Token 优先(来自 ThemeProvider,支持用户自定义)
|
|
6
|
+
* - CSS 变量作为 fallback(无 Provider 时的兜底)
|
|
11
7
|
*/
|
|
12
8
|
export declare const switchSizes: readonly ["sm", "md"];
|
|
13
9
|
export type SwitchSize = (typeof switchSizes)[number];
|
|
14
|
-
/**
|
|
15
|
-
* Switch 根元素(label 标签)
|
|
16
|
-
*
|
|
17
|
-
* 特性:
|
|
18
|
-
* - 基于 CSS 变量,无需 ThemeProvider
|
|
19
|
-
* - 完整的交互状态(hover, focus, disabled)
|
|
20
|
-
* - 支持带文字的开关
|
|
21
|
-
* - 平滑的动画过渡
|
|
22
|
-
*/
|
|
23
10
|
export declare const SwitchRoot: import("@emotion/styled").StyledComponent<{
|
|
24
11
|
theme?: import("@emotion/react").Theme;
|
|
25
12
|
as?: React.ElementType;
|
|
@@ -30,16 +17,6 @@ export declare const SwitchRoot: import("@emotion/styled").StyledComponent<{
|
|
|
30
17
|
isFocusVisible: boolean;
|
|
31
18
|
hasInnerLabel: boolean;
|
|
32
19
|
}, import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, {}>;
|
|
33
|
-
/**
|
|
34
|
-
* Switch 内容容器
|
|
35
|
-
*
|
|
36
|
-
* 用于布局文字和滑块,确保正确的间距和对齐
|
|
37
|
-
* 根据 Figma 设计,元素间距为 4px
|
|
38
|
-
*
|
|
39
|
-
* 布局策略:
|
|
40
|
-
* - 文字使用相对定位,根据状态调整 justify-content
|
|
41
|
-
* - 滑块使用绝对定位 + left/right 切换实现平滑动画
|
|
42
|
-
*/
|
|
43
20
|
export declare const SwitchContent: import("@emotion/styled").StyledComponent<{
|
|
44
21
|
theme?: import("@emotion/react").Theme;
|
|
45
22
|
as?: React.ElementType;
|
|
@@ -47,51 +24,22 @@ export declare const SwitchContent: import("@emotion/styled").StyledComponent<{
|
|
|
47
24
|
isSelected: boolean;
|
|
48
25
|
hasInnerLabel: boolean;
|
|
49
26
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
50
|
-
/**
|
|
51
|
-
* Switch 文字标签
|
|
52
|
-
*
|
|
53
|
-
* 显示开关状态文字(如 ON/OFF、开/关)
|
|
54
|
-
* 使用 CSS 变量实现
|
|
55
|
-
*
|
|
56
|
-
* 使用相对定位,不影响滑块的绝对定位计算
|
|
57
|
-
*/
|
|
58
27
|
export declare const SwitchLabel: import("@emotion/styled").StyledComponent<{
|
|
59
28
|
theme?: import("@emotion/react").Theme;
|
|
60
29
|
as?: React.ElementType;
|
|
61
30
|
} & {
|
|
62
31
|
isSelected: boolean;
|
|
63
32
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
64
|
-
/**
|
|
65
|
-
* Switch 滑块(Thumb)
|
|
66
|
-
*
|
|
67
|
-
* 白色圆形滑块,根据开关状态滑动
|
|
68
|
-
* 使用 CSS 变量实现
|
|
69
|
-
*
|
|
70
|
-
* 使用绝对定位 + transform 实现平滑的位置动画
|
|
71
|
-
* 根据 Figma 设计:
|
|
72
|
-
* - 未选中时:left: 0(紧贴左边缘,实际距离容器边缘 3px)
|
|
73
|
-
* - 选中时:right: 0(紧贴右边缘,实际距离容器边缘 3px)
|
|
74
|
-
*/
|
|
75
33
|
export declare const SwitchThumb: import("@emotion/styled").StyledComponent<{
|
|
76
34
|
theme?: import("@emotion/react").Theme;
|
|
77
35
|
as?: React.ElementType;
|
|
78
36
|
} & {
|
|
79
37
|
isSelected: boolean;
|
|
80
38
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
81
|
-
/**
|
|
82
|
-
* 外部标签容器
|
|
83
|
-
*
|
|
84
|
-
* 用于在 Switch 外部显示描述性标签
|
|
85
|
-
*/
|
|
86
39
|
export declare const SwitchLabelWrapper: import("@emotion/styled").StyledComponent<{
|
|
87
40
|
theme?: import("@emotion/react").Theme;
|
|
88
41
|
as?: React.ElementType;
|
|
89
42
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
90
|
-
/**
|
|
91
|
-
* 外部标签文字
|
|
92
|
-
*
|
|
93
|
-
* Switch 旁边的描述性文字
|
|
94
|
-
*/
|
|
95
43
|
export declare const SwitchLabelText: import("@emotion/styled").StyledComponent<{
|
|
96
44
|
theme?: import("@emotion/react").Theme;
|
|
97
45
|
as?: React.ElementType;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Switch Styled Tokens
|
|
3
|
+
*
|
|
4
|
+
* 将 Switch 的 JS tokens 与 CSS 变量映射,实现:
|
|
5
|
+
* - 有 ThemeProvider 时:使用 JS token 值(可被用户自定义)
|
|
6
|
+
* - 无 ThemeProvider 时:fallback 到 CSS 变量(基础样式)
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Switch 组件的 Styled Tokens
|
|
10
|
+
*/
|
|
11
|
+
export declare const $switch: {
|
|
12
|
+
readonly smWidth: (props: {
|
|
13
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
14
|
+
_useCSSVariables?: boolean;
|
|
15
|
+
};
|
|
16
|
+
}) => string;
|
|
17
|
+
readonly smHeight: (props: {
|
|
18
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
19
|
+
_useCSSVariables?: boolean;
|
|
20
|
+
};
|
|
21
|
+
}) => string;
|
|
22
|
+
readonly smThumbSize: (props: {
|
|
23
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
24
|
+
_useCSSVariables?: boolean;
|
|
25
|
+
};
|
|
26
|
+
}) => string;
|
|
27
|
+
readonly smFontSize: (props: {
|
|
28
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
29
|
+
_useCSSVariables?: boolean;
|
|
30
|
+
};
|
|
31
|
+
}) => string;
|
|
32
|
+
readonly smPaddingInline: (props: {
|
|
33
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
34
|
+
_useCSSVariables?: boolean;
|
|
35
|
+
};
|
|
36
|
+
}) => string;
|
|
37
|
+
readonly mdWidth: (props: {
|
|
38
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
39
|
+
_useCSSVariables?: boolean;
|
|
40
|
+
};
|
|
41
|
+
}) => string;
|
|
42
|
+
readonly mdHeight: (props: {
|
|
43
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
44
|
+
_useCSSVariables?: boolean;
|
|
45
|
+
};
|
|
46
|
+
}) => string;
|
|
47
|
+
readonly mdThumbSize: (props: {
|
|
48
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
49
|
+
_useCSSVariables?: boolean;
|
|
50
|
+
};
|
|
51
|
+
}) => string;
|
|
52
|
+
readonly mdFontSize: (props: {
|
|
53
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
54
|
+
_useCSSVariables?: boolean;
|
|
55
|
+
};
|
|
56
|
+
}) => string;
|
|
57
|
+
readonly mdPaddingInline: (props: {
|
|
58
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
59
|
+
_useCSSVariables?: boolean;
|
|
60
|
+
};
|
|
61
|
+
}) => string;
|
|
62
|
+
readonly bgUnchecked: (props: {
|
|
63
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
64
|
+
_useCSSVariables?: boolean;
|
|
65
|
+
};
|
|
66
|
+
}) => string;
|
|
67
|
+
readonly bgChecked: (props: {
|
|
68
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
69
|
+
_useCSSVariables?: boolean;
|
|
70
|
+
};
|
|
71
|
+
}) => string;
|
|
72
|
+
readonly bgDisabled: (props: {
|
|
73
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
74
|
+
_useCSSVariables?: boolean;
|
|
75
|
+
};
|
|
76
|
+
}) => string;
|
|
77
|
+
readonly thumbBg: (props: {
|
|
78
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
79
|
+
_useCSSVariables?: boolean;
|
|
80
|
+
};
|
|
81
|
+
}) => string;
|
|
82
|
+
readonly thumbShadow: (props: {
|
|
83
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
84
|
+
_useCSSVariables?: boolean;
|
|
85
|
+
};
|
|
86
|
+
}) => string;
|
|
87
|
+
readonly textColor: (props: {
|
|
88
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
89
|
+
_useCSSVariables?: boolean;
|
|
90
|
+
};
|
|
91
|
+
}) => string;
|
|
92
|
+
readonly textFontSize: (props: {
|
|
93
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
94
|
+
_useCSSVariables?: boolean;
|
|
95
|
+
};
|
|
96
|
+
}) => string;
|
|
97
|
+
readonly textFontWeight: (props: {
|
|
98
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
99
|
+
_useCSSVariables?: boolean;
|
|
100
|
+
};
|
|
101
|
+
}) => string;
|
|
102
|
+
readonly borderRadius: (props: {
|
|
103
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
104
|
+
_useCSSVariables?: boolean;
|
|
105
|
+
};
|
|
106
|
+
}) => string;
|
|
107
|
+
readonly gap: (props: {
|
|
108
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
109
|
+
_useCSSVariables?: boolean;
|
|
110
|
+
};
|
|
111
|
+
}) => string;
|
|
112
|
+
readonly transition: (props: {
|
|
113
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
114
|
+
_useCSSVariables?: boolean;
|
|
115
|
+
};
|
|
116
|
+
}) => string;
|
|
117
|
+
readonly disabledOpacity: (props: {
|
|
118
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
119
|
+
_useCSSVariables?: boolean;
|
|
120
|
+
};
|
|
121
|
+
}) => string;
|
|
122
|
+
readonly focusRingColor: (props: {
|
|
123
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
124
|
+
_useCSSVariables?: boolean;
|
|
125
|
+
};
|
|
126
|
+
}) => string;
|
|
127
|
+
readonly focusRingOffset: (props: {
|
|
128
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
129
|
+
_useCSSVariables?: boolean;
|
|
130
|
+
};
|
|
131
|
+
}) => string;
|
|
132
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Switch 组件 Token 类型定义
|
|
3
|
+
*/
|
|
4
|
+
export interface SwitchTokens {
|
|
5
|
+
size: {
|
|
6
|
+
sm: {
|
|
7
|
+
width: string;
|
|
8
|
+
height: string;
|
|
9
|
+
thumbSize: string;
|
|
10
|
+
fontSize: string;
|
|
11
|
+
paddingInline: string;
|
|
12
|
+
};
|
|
13
|
+
md: {
|
|
14
|
+
width: string;
|
|
15
|
+
height: string;
|
|
16
|
+
thumbSize: string;
|
|
17
|
+
fontSize: string;
|
|
18
|
+
paddingInline: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
background: {
|
|
22
|
+
unchecked: string;
|
|
23
|
+
checked: string;
|
|
24
|
+
disabled: string;
|
|
25
|
+
};
|
|
26
|
+
thumb: {
|
|
27
|
+
background: string;
|
|
28
|
+
shadow: string;
|
|
29
|
+
};
|
|
30
|
+
text: {
|
|
31
|
+
color: string;
|
|
32
|
+
fontSize: string;
|
|
33
|
+
fontWeight: number;
|
|
34
|
+
};
|
|
35
|
+
borderRadius: string;
|
|
36
|
+
gap: string;
|
|
37
|
+
transition: string;
|
|
38
|
+
disabled: {
|
|
39
|
+
opacity: number;
|
|
40
|
+
};
|
|
41
|
+
focusRing: {
|
|
42
|
+
color: string;
|
|
43
|
+
offset: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -78,6 +78,8 @@ export interface TableProps<T extends Record<string, any> = Record<string, any>>
|
|
|
78
78
|
emptyText?: ReactNode;
|
|
79
79
|
/** 自定义类名 */
|
|
80
80
|
className?: string;
|
|
81
|
+
/** 自定义样式(支持 CSS 变量定制) */
|
|
82
|
+
style?: React.CSSProperties;
|
|
81
83
|
/** 是否允许折行 */
|
|
82
84
|
wrapText?: boolean;
|
|
83
85
|
/** Loading 状态 */
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Table
|
|
2
|
+
* Table Styled Components
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* - Tier 3 (Component): 组件专用 Token --ksd-table-*
|
|
8
|
-
*
|
|
9
|
-
* 无需 ThemeProvider,直接使用 CSS 变量
|
|
4
|
+
* 使用 Styled Token System 实现样式:
|
|
5
|
+
* - JS Token 优先(来自 ThemeProvider,支持用户自定义)
|
|
6
|
+
* - CSS 变量作为 fallback(无 Provider 时的兜底)
|
|
10
7
|
*/
|
|
11
8
|
export declare const tableSizes: readonly ["sm", "md", "lg"];
|
|
12
9
|
export type TableSize = (typeof tableSizes)[number];
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table Styled Tokens
|
|
3
|
+
*
|
|
4
|
+
* 将 Table 的 JS tokens 与 CSS 变量映射,实现:
|
|
5
|
+
* - 有 ThemeProvider 时:使用 JS token 值(可被用户自定义)
|
|
6
|
+
* - 无 ThemeProvider 时:fallback 到 CSS 变量(基础样式)
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Table 组件的 Styled Tokens
|
|
10
|
+
*/
|
|
11
|
+
export declare const $table: {
|
|
12
|
+
readonly borderRadiusSm: (props: {
|
|
13
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
14
|
+
_useCSSVariables?: boolean;
|
|
15
|
+
};
|
|
16
|
+
}) => string;
|
|
17
|
+
readonly borderRadiusMd: (props: {
|
|
18
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
19
|
+
_useCSSVariables?: boolean;
|
|
20
|
+
};
|
|
21
|
+
}) => string;
|
|
22
|
+
readonly borderRadiusLg: (props: {
|
|
23
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
24
|
+
_useCSSVariables?: boolean;
|
|
25
|
+
};
|
|
26
|
+
}) => string;
|
|
27
|
+
readonly borderColor: (props: {
|
|
28
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
29
|
+
_useCSSVariables?: boolean;
|
|
30
|
+
};
|
|
31
|
+
}) => string;
|
|
32
|
+
readonly bg: (props: {
|
|
33
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
34
|
+
_useCSSVariables?: boolean;
|
|
35
|
+
};
|
|
36
|
+
}) => string;
|
|
37
|
+
readonly headerBg: (props: {
|
|
38
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
39
|
+
_useCSSVariables?: boolean;
|
|
40
|
+
};
|
|
41
|
+
}) => string;
|
|
42
|
+
readonly rowBg: (props: {
|
|
43
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
44
|
+
_useCSSVariables?: boolean;
|
|
45
|
+
};
|
|
46
|
+
}) => string;
|
|
47
|
+
readonly rowHoverBg: (props: {
|
|
48
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
49
|
+
_useCSSVariables?: boolean;
|
|
50
|
+
};
|
|
51
|
+
}) => string;
|
|
52
|
+
readonly rowActiveBg: (props: {
|
|
53
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
54
|
+
_useCSSVariables?: boolean;
|
|
55
|
+
};
|
|
56
|
+
}) => string;
|
|
57
|
+
readonly rowSelectedBg: (props: {
|
|
58
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
59
|
+
_useCSSVariables?: boolean;
|
|
60
|
+
};
|
|
61
|
+
}) => string;
|
|
62
|
+
readonly rowSubrowBg: (props: {
|
|
63
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
64
|
+
_useCSSVariables?: boolean;
|
|
65
|
+
};
|
|
66
|
+
}) => string;
|
|
67
|
+
readonly headerColor: (props: {
|
|
68
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
69
|
+
_useCSSVariables?: boolean;
|
|
70
|
+
};
|
|
71
|
+
}) => string;
|
|
72
|
+
readonly cellColor: (props: {
|
|
73
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
74
|
+
_useCSSVariables?: boolean;
|
|
75
|
+
};
|
|
76
|
+
}) => string;
|
|
77
|
+
readonly cellPaddingSm: (props: {
|
|
78
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
79
|
+
_useCSSVariables?: boolean;
|
|
80
|
+
};
|
|
81
|
+
}) => string;
|
|
82
|
+
readonly cellPaddingMd: (props: {
|
|
83
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
84
|
+
_useCSSVariables?: boolean;
|
|
85
|
+
};
|
|
86
|
+
}) => string;
|
|
87
|
+
readonly cellPaddingLg: (props: {
|
|
88
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
89
|
+
_useCSSVariables?: boolean;
|
|
90
|
+
};
|
|
91
|
+
}) => string;
|
|
92
|
+
readonly cellFontSize: (props: {
|
|
93
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
94
|
+
_useCSSVariables?: boolean;
|
|
95
|
+
};
|
|
96
|
+
}) => string;
|
|
97
|
+
readonly cellLineHeight: (props: {
|
|
98
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
99
|
+
_useCSSVariables?: boolean;
|
|
100
|
+
};
|
|
101
|
+
}) => string;
|
|
102
|
+
readonly dividerColor: (props: {
|
|
103
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
104
|
+
_useCSSVariables?: boolean;
|
|
105
|
+
};
|
|
106
|
+
}) => string;
|
|
107
|
+
readonly scrollbarWidth: (props: {
|
|
108
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
109
|
+
_useCSSVariables?: boolean;
|
|
110
|
+
};
|
|
111
|
+
}) => string;
|
|
112
|
+
readonly scrollbarThumbColor: (props: {
|
|
113
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
114
|
+
_useCSSVariables?: boolean;
|
|
115
|
+
};
|
|
116
|
+
}) => string;
|
|
117
|
+
readonly scrollbarTrackColor: (props: {
|
|
118
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
119
|
+
_useCSSVariables?: boolean;
|
|
120
|
+
};
|
|
121
|
+
}) => string;
|
|
122
|
+
readonly sortIconColor: (props: {
|
|
123
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
124
|
+
_useCSSVariables?: boolean;
|
|
125
|
+
};
|
|
126
|
+
}) => string;
|
|
127
|
+
readonly sortIconActiveColor: (props: {
|
|
128
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
129
|
+
_useCSSVariables?: boolean;
|
|
130
|
+
};
|
|
131
|
+
}) => string;
|
|
132
|
+
readonly expandBtnSize: (props: {
|
|
133
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
134
|
+
_useCSSVariables?: boolean;
|
|
135
|
+
};
|
|
136
|
+
}) => string;
|
|
137
|
+
readonly expandIconSize: (props: {
|
|
138
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
139
|
+
_useCSSVariables?: boolean;
|
|
140
|
+
};
|
|
141
|
+
}) => string;
|
|
142
|
+
readonly expandIconColor: (props: {
|
|
143
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
144
|
+
_useCSSVariables?: boolean;
|
|
145
|
+
};
|
|
146
|
+
}) => string;
|
|
147
|
+
readonly expandIconHoverColor: (props: {
|
|
148
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
149
|
+
_useCSSVariables?: boolean;
|
|
150
|
+
};
|
|
151
|
+
}) => string;
|
|
152
|
+
readonly emptyPadding: (props: {
|
|
153
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
154
|
+
_useCSSVariables?: boolean;
|
|
155
|
+
};
|
|
156
|
+
}) => string;
|
|
157
|
+
readonly emptyColor: (props: {
|
|
158
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
159
|
+
_useCSSVariables?: boolean;
|
|
160
|
+
};
|
|
161
|
+
}) => string;
|
|
162
|
+
readonly emptyFontSize: (props: {
|
|
163
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
164
|
+
_useCSSVariables?: boolean;
|
|
165
|
+
};
|
|
166
|
+
}) => string;
|
|
167
|
+
readonly fixedShadowLeft: (props: {
|
|
168
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
169
|
+
_useCSSVariables?: boolean;
|
|
170
|
+
};
|
|
171
|
+
}) => string;
|
|
172
|
+
readonly fixedShadowRight: (props: {
|
|
173
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
174
|
+
_useCSSVariables?: boolean;
|
|
175
|
+
};
|
|
176
|
+
}) => string;
|
|
177
|
+
readonly transition: (props: {
|
|
178
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
179
|
+
_useCSSVariables?: boolean;
|
|
180
|
+
};
|
|
181
|
+
}) => string;
|
|
182
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table 组件 Token 类型定义
|
|
3
|
+
*/
|
|
4
|
+
export interface TableTokens {
|
|
5
|
+
borderRadius: {
|
|
6
|
+
sm: string;
|
|
7
|
+
md: string;
|
|
8
|
+
lg: string;
|
|
9
|
+
};
|
|
10
|
+
borderColor: string;
|
|
11
|
+
bg: string;
|
|
12
|
+
headerBg: string;
|
|
13
|
+
rowBg: string;
|
|
14
|
+
rowHoverBg: string;
|
|
15
|
+
rowActiveBg: string;
|
|
16
|
+
rowSelectedBg: string;
|
|
17
|
+
rowSubrowBg: string;
|
|
18
|
+
headerColor: string;
|
|
19
|
+
cellColor: string;
|
|
20
|
+
cellPadding: {
|
|
21
|
+
sm: string;
|
|
22
|
+
md: string;
|
|
23
|
+
lg: string;
|
|
24
|
+
};
|
|
25
|
+
cellFontSize: string;
|
|
26
|
+
cellLineHeight: string | number;
|
|
27
|
+
dividerColor: string;
|
|
28
|
+
scrollbarWidth: string;
|
|
29
|
+
scrollbarThumbColor: string;
|
|
30
|
+
scrollbarTrackColor: string;
|
|
31
|
+
sortIconColor: string;
|
|
32
|
+
sortIconActiveColor: string;
|
|
33
|
+
expandBtnSize: string;
|
|
34
|
+
expandIconSize: string;
|
|
35
|
+
expandIconColor: string;
|
|
36
|
+
expandIconHoverColor: string;
|
|
37
|
+
emptyPadding: string;
|
|
38
|
+
emptyColor: string;
|
|
39
|
+
emptyFontSize: string;
|
|
40
|
+
fixedShadowLeft: string;
|
|
41
|
+
fixedShadowRight: string;
|
|
42
|
+
transition: string;
|
|
43
|
+
}
|
package/dist/types/tag/Tag.d.ts
CHANGED
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tag 标签组件
|
|
3
|
-
*
|
|
4
|
-
* 基于 react-aria 实现无障碍访问的标签组件
|
|
5
|
-
* 完全符合 Figma 设计稿规范
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* // 基础用法
|
|
10
|
-
* <Tag>标签</Tag>
|
|
11
|
-
*
|
|
12
|
-
* // 可关闭
|
|
13
|
-
* <Tag closable onClose={() => console.log('closed')}>标签</Tag>
|
|
14
|
-
*
|
|
15
|
-
* // 带图标
|
|
16
|
-
* <Tag icon={<IconOutline />}>标签</Tag>
|
|
17
|
-
*
|
|
18
|
-
* // 可选择
|
|
19
|
-
* <Tag checkable checked onChange={(checked) => console.log(checked)}>标签</Tag>
|
|
20
|
-
*
|
|
21
|
-
* // 彩色标签
|
|
22
|
-
* <Tag color="red">红色</Tag>
|
|
23
|
-
* <Tag color="blue" bordered>蓝色带边框</Tag>
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
1
|
import { type ReactNode } from 'react';
|
|
27
2
|
import type { AriaButtonProps } from 'react-aria';
|
|
28
3
|
import { type TagVariant, type TagSize, type TagColor } from './Tag.style';
|
|
@@ -48,6 +23,8 @@ export interface TagProps {
|
|
|
48
23
|
disabled?: boolean;
|
|
49
24
|
/** 自定义类名 */
|
|
50
25
|
className?: string;
|
|
26
|
+
/** 自定义样式(支持 CSS 变量定制) */
|
|
27
|
+
style?: React.CSSProperties;
|
|
51
28
|
/** 子元素 */
|
|
52
29
|
children?: ReactNode;
|
|
53
30
|
/** 关闭回调 */
|
|
@@ -57,24 +34,15 @@ export interface TagProps {
|
|
|
57
34
|
/** 点击回调 */
|
|
58
35
|
onClick?: () => void;
|
|
59
36
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Tag 标签组件
|
|
62
|
-
*
|
|
63
|
-
* 基于 Figma 设计规范实现的标签组件,支持多种变体、颜色和尺寸
|
|
64
|
-
* 使用 react-aria 保证无障碍访问性
|
|
65
|
-
*/
|
|
66
37
|
export declare const Tag: import("react").ForwardRefExoticComponent<TagProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
67
38
|
export interface TagAddProps extends Omit<AriaButtonProps, 'elementType'> {
|
|
68
39
|
/** 标签尺寸 */
|
|
69
40
|
size?: TagSize;
|
|
70
41
|
/** 自定义类名 */
|
|
71
42
|
className?: string;
|
|
43
|
+
/** 自定义样式(支持 CSS 变量定制) */
|
|
44
|
+
style?: React.CSSProperties;
|
|
72
45
|
/** 子元素 */
|
|
73
46
|
children?: ReactNode;
|
|
74
47
|
}
|
|
75
|
-
/**
|
|
76
|
-
* Tag.Add 添加标签按钮
|
|
77
|
-
*
|
|
78
|
-
* 用于添加新标签的按钮组件
|
|
79
|
-
*/
|
|
80
48
|
export declare const TagAdd: import("react").ForwardRefExoticComponent<TagAddProps & import("react").RefAttributes<HTMLButtonElement>>;
|