@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
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkbox 组件 Token 类型定义
|
|
3
|
+
*/
|
|
4
|
+
export interface CheckboxTokens {
|
|
5
|
+
control: {
|
|
6
|
+
size: string;
|
|
7
|
+
borderRadius: string;
|
|
8
|
+
borderWidth: string;
|
|
9
|
+
background: {
|
|
10
|
+
default: string;
|
|
11
|
+
checked: string;
|
|
12
|
+
disabled: string;
|
|
13
|
+
disabledChecked: string;
|
|
14
|
+
};
|
|
15
|
+
borderColor: {
|
|
16
|
+
default: string;
|
|
17
|
+
hover: string;
|
|
18
|
+
checked: string;
|
|
19
|
+
disabled: string;
|
|
20
|
+
disabledChecked: string;
|
|
21
|
+
};
|
|
22
|
+
icon: {
|
|
23
|
+
color: string;
|
|
24
|
+
size: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
focusRing: string;
|
|
28
|
+
gap: string;
|
|
29
|
+
text: {
|
|
30
|
+
label: {
|
|
31
|
+
fontSize: string;
|
|
32
|
+
lineHeight: string;
|
|
33
|
+
color: string;
|
|
34
|
+
disabled: string;
|
|
35
|
+
fontWeight: number;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
transition: string;
|
|
39
|
+
}
|
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Collapse 折叠面板组件
|
|
3
|
-
*
|
|
4
|
-
* 可以折叠/展开的内容区域
|
|
5
|
-
* 支持手风琴模式(同时只能展开一个)和普通模式(可同时展开多个)
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* // 非受控模式
|
|
10
|
-
* <Collapse defaultActiveKey={['1']}>
|
|
11
|
-
* <CollapseItem itemKey="1" title="标题1">内容1</CollapseItem>
|
|
12
|
-
* <CollapseItem itemKey="2" title="标题2">内容2</CollapseItem>
|
|
13
|
-
* </Collapse>
|
|
14
|
-
*
|
|
15
|
-
* // 受控模式 + 手风琴
|
|
16
|
-
* <Collapse
|
|
17
|
-
* activeKey={activeKey}
|
|
18
|
-
* onChange={setActiveKey}
|
|
19
|
-
* accordion
|
|
20
|
-
* >
|
|
21
|
-
* <CollapseItem itemKey="1" title="标题1">内容1</CollapseItem>
|
|
22
|
-
* <CollapseItem itemKey="2" title="标题2">内容2</CollapseItem>
|
|
23
|
-
* </Collapse>
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
1
|
import type { ReactNode } from 'react';
|
|
27
2
|
export interface CollapseProps {
|
|
28
3
|
/** 当前激活的面板(受控) */
|
|
@@ -37,14 +12,7 @@ export interface CollapseProps {
|
|
|
37
12
|
children?: ReactNode;
|
|
38
13
|
/** 自定义类名 */
|
|
39
14
|
className?: string;
|
|
15
|
+
/** 自定义样式(支持 CSS 变量定制) */
|
|
16
|
+
style?: React.CSSProperties;
|
|
40
17
|
}
|
|
41
|
-
/**
|
|
42
|
-
* Collapse 折叠面板
|
|
43
|
-
*
|
|
44
|
-
* 特性:
|
|
45
|
-
* - 支持受控和非受控模式
|
|
46
|
-
* - 支持手风琴模式(accordion)
|
|
47
|
-
* - 平滑的展开/收起动画
|
|
48
|
-
* - 完整的键盘导航和无障碍支持
|
|
49
|
-
*/
|
|
50
18
|
export declare const Collapse: import("react").ForwardRefExoticComponent<CollapseProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Collapse
|
|
2
|
+
* Collapse Styled Components
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* - Tier 3 (Component): 组件专用 Token --ksd-collapse-*
|
|
8
|
-
*
|
|
9
|
-
* 无需 ThemeProvider,直接使用 CSS 变量
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* 箭头旋转动画(展开)
|
|
4
|
+
* 使用 Styled Token System 实现样式:
|
|
5
|
+
* - JS Token 优先(来自 ThemeProvider,支持用户自定义)
|
|
6
|
+
* - CSS 变量作为 fallback(无 Provider 时的兜底)
|
|
13
7
|
*/
|
|
14
8
|
export declare const rotateArrowDown: {
|
|
15
9
|
name: string;
|
|
@@ -17,34 +11,22 @@ export declare const rotateArrowDown: {
|
|
|
17
11
|
anim: 1;
|
|
18
12
|
toString: () => string;
|
|
19
13
|
} & string;
|
|
20
|
-
/**
|
|
21
|
-
* 箭头旋转动画(收起)
|
|
22
|
-
*/
|
|
23
14
|
export declare const rotateArrowUp: {
|
|
24
15
|
name: string;
|
|
25
16
|
styles: string;
|
|
26
17
|
anim: 1;
|
|
27
18
|
toString: () => string;
|
|
28
19
|
} & string;
|
|
29
|
-
/**
|
|
30
|
-
* Collapse 根容器
|
|
31
|
-
*/
|
|
32
20
|
export declare const CollapseRoot: import("@emotion/styled").StyledComponent<{
|
|
33
21
|
theme?: import("@emotion/react").Theme;
|
|
34
22
|
as?: React.ElementType;
|
|
35
23
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
36
|
-
/**
|
|
37
|
-
* CollapseItem 容器
|
|
38
|
-
*/
|
|
39
24
|
export declare const CollapseItemWrapper: import("@emotion/styled").StyledComponent<{
|
|
40
25
|
theme?: import("@emotion/react").Theme;
|
|
41
26
|
as?: React.ElementType;
|
|
42
27
|
} & {
|
|
43
28
|
isLast?: boolean;
|
|
44
29
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
45
|
-
/**
|
|
46
|
-
* 折叠面板标题栏
|
|
47
|
-
*/
|
|
48
30
|
export declare const CollapseHeader: import("@emotion/styled").StyledComponent<{
|
|
49
31
|
theme?: import("@emotion/react").Theme;
|
|
50
32
|
as?: React.ElementType;
|
|
@@ -52,39 +34,24 @@ export declare const CollapseHeader: import("@emotion/styled").StyledComponent<{
|
|
|
52
34
|
isExpanded: boolean;
|
|
53
35
|
isDisabled?: boolean;
|
|
54
36
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
55
|
-
/**
|
|
56
|
-
* 箭头图标容器
|
|
57
|
-
*/
|
|
58
37
|
export declare const ArrowWrapper: import("@emotion/styled").StyledComponent<{
|
|
59
38
|
theme?: import("@emotion/react").Theme;
|
|
60
39
|
as?: React.ElementType;
|
|
61
40
|
} & {
|
|
62
41
|
isExpanded: boolean;
|
|
63
42
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
64
|
-
/**
|
|
65
|
-
* 标题内容区
|
|
66
|
-
*/
|
|
67
43
|
export declare const TitleWrapper: import("@emotion/styled").StyledComponent<{
|
|
68
44
|
theme?: import("@emotion/react").Theme;
|
|
69
45
|
as?: React.ElementType;
|
|
70
46
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
71
|
-
/**
|
|
72
|
-
* 标题文本
|
|
73
|
-
*/
|
|
74
47
|
export declare const TitleText: import("@emotion/styled").StyledComponent<{
|
|
75
48
|
theme?: import("@emotion/react").Theme;
|
|
76
49
|
as?: React.ElementType;
|
|
77
50
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>;
|
|
78
|
-
/**
|
|
79
|
-
* 右侧后缀内容区
|
|
80
|
-
*/
|
|
81
51
|
export declare const SuffixWrapper: import("@emotion/styled").StyledComponent<{
|
|
82
52
|
theme?: import("@emotion/react").Theme;
|
|
83
53
|
as?: React.ElementType;
|
|
84
54
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
85
|
-
/**
|
|
86
|
-
* 折叠内容外层容器
|
|
87
|
-
*/
|
|
88
55
|
export declare const CollapseContentWrapper: import("@emotion/styled").StyledComponent<{
|
|
89
56
|
theme?: import("@emotion/react").Theme;
|
|
90
57
|
as?: React.ElementType;
|
|
@@ -92,18 +59,12 @@ export declare const CollapseContentWrapper: import("@emotion/styled").StyledCom
|
|
|
92
59
|
isExpanded: boolean;
|
|
93
60
|
contentHeight: number;
|
|
94
61
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
95
|
-
/**
|
|
96
|
-
* 折叠内容内层容器
|
|
97
|
-
*/
|
|
98
62
|
export declare const CollapseContentInner: import("@emotion/styled").StyledComponent<{
|
|
99
63
|
theme?: import("@emotion/react").Theme;
|
|
100
64
|
as?: React.ElementType;
|
|
101
65
|
} & {
|
|
102
66
|
isExpanded: boolean;
|
|
103
67
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
104
|
-
/**
|
|
105
|
-
* 折叠内容文本区域
|
|
106
|
-
*/
|
|
107
68
|
export declare const ContentText: import("@emotion/styled").StyledComponent<{
|
|
108
69
|
theme?: import("@emotion/react").Theme;
|
|
109
70
|
as?: React.ElementType;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collapse Styled Tokens
|
|
3
|
+
*
|
|
4
|
+
* 将 Collapse 的 JS tokens 与 CSS 变量映射,实现:
|
|
5
|
+
* - 有 ThemeProvider 时:使用 JS token 值(可被用户自定义)
|
|
6
|
+
* - 无 ThemeProvider 时:fallback 到 CSS 变量(基础样式)
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Collapse 组件的 Styled Tokens
|
|
10
|
+
*/
|
|
11
|
+
export declare const $collapse: {
|
|
12
|
+
readonly border: (props: {
|
|
13
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
14
|
+
_useCSSVariables?: boolean;
|
|
15
|
+
};
|
|
16
|
+
}) => string;
|
|
17
|
+
readonly divider: (props: {
|
|
18
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
19
|
+
_useCSSVariables?: boolean;
|
|
20
|
+
};
|
|
21
|
+
}) => string;
|
|
22
|
+
readonly bg: (props: {
|
|
23
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
24
|
+
_useCSSVariables?: boolean;
|
|
25
|
+
};
|
|
26
|
+
}) => string;
|
|
27
|
+
readonly bgHover: (props: {
|
|
28
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
29
|
+
_useCSSVariables?: boolean;
|
|
30
|
+
};
|
|
31
|
+
}) => string;
|
|
32
|
+
readonly text: (props: {
|
|
33
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
34
|
+
_useCSSVariables?: boolean;
|
|
35
|
+
};
|
|
36
|
+
}) => string;
|
|
37
|
+
readonly textTitle: (props: {
|
|
38
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
39
|
+
_useCSSVariables?: boolean;
|
|
40
|
+
};
|
|
41
|
+
}) => string;
|
|
42
|
+
readonly arrow: (props: {
|
|
43
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
44
|
+
_useCSSVariables?: boolean;
|
|
45
|
+
};
|
|
46
|
+
}) => string;
|
|
47
|
+
readonly arrowSize: (props: {
|
|
48
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
49
|
+
_useCSSVariables?: boolean;
|
|
50
|
+
};
|
|
51
|
+
}) => string;
|
|
52
|
+
readonly headerPadding: (props: {
|
|
53
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
54
|
+
_useCSSVariables?: boolean;
|
|
55
|
+
};
|
|
56
|
+
}) => string;
|
|
57
|
+
readonly contentPadding: (props: {
|
|
58
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
59
|
+
_useCSSVariables?: boolean;
|
|
60
|
+
};
|
|
61
|
+
}) => string;
|
|
62
|
+
readonly borderRadius: (props: {
|
|
63
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
64
|
+
_useCSSVariables?: boolean;
|
|
65
|
+
};
|
|
66
|
+
}) => string;
|
|
67
|
+
readonly gap: (props: {
|
|
68
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
69
|
+
_useCSSVariables?: boolean;
|
|
70
|
+
};
|
|
71
|
+
}) => string;
|
|
72
|
+
readonly transition: (props: {
|
|
73
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
74
|
+
_useCSSVariables?: boolean;
|
|
75
|
+
};
|
|
76
|
+
}) => string;
|
|
77
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collapse 组件 Token 类型定义
|
|
3
|
+
*/
|
|
4
|
+
export interface CollapseTokens {
|
|
5
|
+
border: {
|
|
6
|
+
default: string;
|
|
7
|
+
};
|
|
8
|
+
background: {
|
|
9
|
+
default: string;
|
|
10
|
+
hover: string;
|
|
11
|
+
};
|
|
12
|
+
text: {
|
|
13
|
+
default: string;
|
|
14
|
+
title: string;
|
|
15
|
+
};
|
|
16
|
+
divider: string;
|
|
17
|
+
arrow: {
|
|
18
|
+
default: string;
|
|
19
|
+
};
|
|
20
|
+
padding: {
|
|
21
|
+
header: string;
|
|
22
|
+
content: string;
|
|
23
|
+
};
|
|
24
|
+
borderRadius: string;
|
|
25
|
+
gap: string;
|
|
26
|
+
transition: string;
|
|
27
|
+
arrowSize: string;
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Design Theme Context
|
|
3
|
+
*
|
|
4
|
+
* 独立的 Theme Context,用于解决 monorepo 中多个 emotion 实例导致的
|
|
5
|
+
* ThemeContext 无法正确传递的问题。
|
|
6
|
+
*
|
|
7
|
+
* 这个 Context 与 emotion 的 ThemeProvider 并行使用,确保 styled-components
|
|
8
|
+
* 可以通过 useDesignTheme hook 获取到正确的 theme。
|
|
9
|
+
*/
|
|
10
|
+
import { type ReactNode } from 'react';
|
|
11
|
+
import type { AppTheme } from '@kingsoft-ai/theme';
|
|
12
|
+
declare const DesignThemeContext: import("react").Context<AppTheme | null>;
|
|
13
|
+
export interface DesignThemeContextProviderProps {
|
|
14
|
+
theme: AppTheme;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export declare const DesignThemeContextProvider: ({ theme, children, }: DesignThemeContextProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* 获取 Design Theme
|
|
20
|
+
*
|
|
21
|
+
* 优先从我们自己的 Context 获取,确保在 monorepo 环境下正确工作
|
|
22
|
+
*/
|
|
23
|
+
export declare const useDesignTheme: () => AppTheme | null;
|
|
24
|
+
export { DesignThemeContext };
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FloatButton 悬浮按钮组件
|
|
3
|
-
*
|
|
4
|
-
* 基于 react-aria 实现无障碍访问的悬浮按钮组件
|
|
5
|
-
* 参考 antd FloatButton 设计实现
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* <FloatButton
|
|
10
|
-
* icon={<IconPlus />}
|
|
11
|
-
* type="primary"
|
|
12
|
-
* onClick={() => console.log('clicked')}
|
|
13
|
-
* />
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
1
|
import type { ReactNode } from 'react';
|
|
17
2
|
import type { AriaButtonProps } from 'react-aria';
|
|
18
3
|
import { type FloatButtonType, type FloatButtonShape, type FloatButtonSize, type TooltipPlacement } from './FloatButton.style';
|
|
@@ -48,10 +33,4 @@ export interface FloatButtonProps extends Omit<AriaButtonProps, 'elementType'> {
|
|
|
48
33
|
/** 自定义样式 */
|
|
49
34
|
style?: React.CSSProperties;
|
|
50
35
|
}
|
|
51
|
-
/**
|
|
52
|
-
* FloatButton 悬浮按钮组件
|
|
53
|
-
*
|
|
54
|
-
* 用于页面中的悬浮操作按钮,通常固定在页面特定位置
|
|
55
|
-
* 支持圆形和方形两种形状
|
|
56
|
-
*/
|
|
57
36
|
export declare const FloatButton: import("react").ForwardRefExoticComponent<FloatButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FloatButton 悬浮按钮样式
|
|
3
|
-
*
|
|
4
|
-
* 基于 CSS 变量的三层 Token 体系:
|
|
5
|
-
* - Tier 1 (Global): 全局基础值 --ksd-colors-*, --ksd-spacing-*, etc.
|
|
6
|
-
* - Tier 2 (Semantic): 语义化映射 --ksd-brand-*, --ksd-text-*, etc.
|
|
7
|
-
* - Tier 3 (Component): 组件专用 Token --ksd-float-button-*
|
|
8
|
-
*
|
|
9
|
-
* 无需 ThemeProvider,直接使用 CSS 变量
|
|
10
|
-
*/
|
|
11
1
|
export declare const floatButtonTypes: readonly ["default", "primary"];
|
|
12
2
|
export declare const floatButtonShapes: readonly ["circle", "square"];
|
|
13
3
|
export declare const floatButtonSizes: readonly ["sm", "md", "lg"];
|
|
@@ -16,9 +6,6 @@ export type FloatButtonType = (typeof floatButtonTypes)[number];
|
|
|
16
6
|
export type FloatButtonShape = (typeof floatButtonShapes)[number];
|
|
17
7
|
export type FloatButtonSize = (typeof floatButtonSizes)[number];
|
|
18
8
|
export type TooltipPlacement = (typeof tooltipPlacements)[number];
|
|
19
|
-
/**
|
|
20
|
-
* 悬浮按钮根元素
|
|
21
|
-
*/
|
|
22
9
|
export declare const FloatButtonRoot: import("@emotion/styled").StyledComponent<{
|
|
23
10
|
theme?: import("@emotion/react").Theme;
|
|
24
11
|
as?: React.ElementType;
|
|
@@ -28,37 +15,22 @@ export declare const FloatButtonRoot: import("@emotion/styled").StyledComponent<
|
|
|
28
15
|
$size: FloatButtonSize;
|
|
29
16
|
$isPressed: boolean;
|
|
30
17
|
}, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
31
|
-
/**
|
|
32
|
-
* 按钮内容容器
|
|
33
|
-
*/
|
|
34
18
|
export declare const FloatButtonContent: import("@emotion/styled").StyledComponent<{
|
|
35
19
|
theme?: import("@emotion/react").Theme;
|
|
36
20
|
as?: React.ElementType;
|
|
37
21
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
38
|
-
/**
|
|
39
|
-
* 图标包装器
|
|
40
|
-
*/
|
|
41
22
|
export declare const IconWrapper: import("@emotion/styled").StyledComponent<{
|
|
42
23
|
theme?: import("@emotion/react").Theme;
|
|
43
24
|
as?: React.ElementType;
|
|
44
25
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
45
|
-
/**
|
|
46
|
-
* 描述文字
|
|
47
|
-
*/
|
|
48
26
|
export declare const Description: import("@emotion/styled").StyledComponent<{
|
|
49
27
|
theme?: import("@emotion/react").Theme;
|
|
50
28
|
as?: React.ElementType;
|
|
51
29
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
52
|
-
/**
|
|
53
|
-
* Tooltip 包装器
|
|
54
|
-
*/
|
|
55
30
|
export declare const TooltipWrapper: import("@emotion/styled").StyledComponent<{
|
|
56
31
|
theme?: import("@emotion/react").Theme;
|
|
57
32
|
as?: React.ElementType;
|
|
58
33
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
59
|
-
/**
|
|
60
|
-
* Tooltip 卡片
|
|
61
|
-
*/
|
|
62
34
|
export declare const TooltipCard: import("@emotion/styled").StyledComponent<{
|
|
63
35
|
theme?: import("@emotion/react").Theme;
|
|
64
36
|
as?: React.ElementType;
|
|
@@ -66,9 +38,6 @@ export declare const TooltipCard: import("@emotion/styled").StyledComponent<{
|
|
|
66
38
|
$placement: TooltipPlacement;
|
|
67
39
|
$color?: string;
|
|
68
40
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
69
|
-
/**
|
|
70
|
-
* Tooltip 箭头
|
|
71
|
-
*/
|
|
72
41
|
export declare const TooltipArrow: import("@emotion/styled").StyledComponent<{
|
|
73
42
|
theme?: import("@emotion/react").Theme;
|
|
74
43
|
as?: React.ElementType;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FloatButton Styled Tokens
|
|
3
|
+
*
|
|
4
|
+
* 将 FloatButton 的 JS tokens 与 CSS 变量映射,实现:
|
|
5
|
+
* - 有 ThemeProvider 时:使用 JS token 值(可被用户自定义)
|
|
6
|
+
* - 无 ThemeProvider 时:fallback 到 CSS 变量(基础样式)
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* FloatButton 组件的 Styled Tokens
|
|
10
|
+
*/
|
|
11
|
+
export declare const $floatButton: {
|
|
12
|
+
readonly defaultBg: (props: {
|
|
13
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
14
|
+
_useCSSVariables?: boolean;
|
|
15
|
+
};
|
|
16
|
+
}) => string;
|
|
17
|
+
readonly defaultBgHover: (props: {
|
|
18
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
19
|
+
_useCSSVariables?: boolean;
|
|
20
|
+
};
|
|
21
|
+
}) => string;
|
|
22
|
+
readonly defaultBgActive: (props: {
|
|
23
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
24
|
+
_useCSSVariables?: boolean;
|
|
25
|
+
};
|
|
26
|
+
}) => string;
|
|
27
|
+
readonly defaultText: (props: {
|
|
28
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
29
|
+
_useCSSVariables?: boolean;
|
|
30
|
+
};
|
|
31
|
+
}) => string;
|
|
32
|
+
readonly defaultBorder: (props: {
|
|
33
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
34
|
+
_useCSSVariables?: boolean;
|
|
35
|
+
};
|
|
36
|
+
}) => string;
|
|
37
|
+
readonly defaultShadow: (props: {
|
|
38
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
39
|
+
_useCSSVariables?: boolean;
|
|
40
|
+
};
|
|
41
|
+
}) => string;
|
|
42
|
+
readonly defaultShadowHover: (props: {
|
|
43
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
44
|
+
_useCSSVariables?: boolean;
|
|
45
|
+
};
|
|
46
|
+
}) => string;
|
|
47
|
+
readonly primaryBg: (props: {
|
|
48
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
49
|
+
_useCSSVariables?: boolean;
|
|
50
|
+
};
|
|
51
|
+
}) => string;
|
|
52
|
+
readonly primaryBgHover: (props: {
|
|
53
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
54
|
+
_useCSSVariables?: boolean;
|
|
55
|
+
};
|
|
56
|
+
}) => string;
|
|
57
|
+
readonly primaryBgActive: (props: {
|
|
58
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
59
|
+
_useCSSVariables?: boolean;
|
|
60
|
+
};
|
|
61
|
+
}) => string;
|
|
62
|
+
readonly primaryText: (props: {
|
|
63
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
64
|
+
_useCSSVariables?: boolean;
|
|
65
|
+
};
|
|
66
|
+
}) => string;
|
|
67
|
+
readonly primaryBorder: (props: {
|
|
68
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
69
|
+
_useCSSVariables?: boolean;
|
|
70
|
+
};
|
|
71
|
+
}) => string;
|
|
72
|
+
readonly primaryShadow: (props: {
|
|
73
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
74
|
+
_useCSSVariables?: boolean;
|
|
75
|
+
};
|
|
76
|
+
}) => string;
|
|
77
|
+
readonly primaryShadowHover: (props: {
|
|
78
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
79
|
+
_useCSSVariables?: boolean;
|
|
80
|
+
};
|
|
81
|
+
}) => string;
|
|
82
|
+
readonly disabledBg: (props: {
|
|
83
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
84
|
+
_useCSSVariables?: boolean;
|
|
85
|
+
};
|
|
86
|
+
}) => string;
|
|
87
|
+
readonly disabledText: (props: {
|
|
88
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
89
|
+
_useCSSVariables?: boolean;
|
|
90
|
+
};
|
|
91
|
+
}) => string;
|
|
92
|
+
readonly disabledOpacity: (props: {
|
|
93
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
94
|
+
_useCSSVariables?: boolean;
|
|
95
|
+
};
|
|
96
|
+
}) => string;
|
|
97
|
+
readonly smSize: (props: {
|
|
98
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
99
|
+
_useCSSVariables?: boolean;
|
|
100
|
+
};
|
|
101
|
+
}) => string;
|
|
102
|
+
readonly mdSize: (props: {
|
|
103
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
104
|
+
_useCSSVariables?: boolean;
|
|
105
|
+
};
|
|
106
|
+
}) => string;
|
|
107
|
+
readonly lgSize: (props: {
|
|
108
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
109
|
+
_useCSSVariables?: boolean;
|
|
110
|
+
};
|
|
111
|
+
}) => string;
|
|
112
|
+
readonly iconSize: (props: {
|
|
113
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
114
|
+
_useCSSVariables?: boolean;
|
|
115
|
+
};
|
|
116
|
+
}) => string;
|
|
117
|
+
readonly descriptionFontSize: (props: {
|
|
118
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
119
|
+
_useCSSVariables?: boolean;
|
|
120
|
+
};
|
|
121
|
+
}) => string;
|
|
122
|
+
readonly descriptionLineHeight: (props: {
|
|
123
|
+
theme?: import("@kingsoft-ai/theme").Theme & {
|
|
124
|
+
_useCSSVariables?: boolean;
|
|
125
|
+
};
|
|
126
|
+
}) => string;
|
|
127
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FloatButton 组件 Token 类型定义
|
|
3
|
+
*/
|
|
4
|
+
export interface FloatButtonTokens {
|
|
5
|
+
default: {
|
|
6
|
+
background: {
|
|
7
|
+
default: string;
|
|
8
|
+
hover: string;
|
|
9
|
+
active: string;
|
|
10
|
+
};
|
|
11
|
+
text: {
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
border: {
|
|
15
|
+
default: string;
|
|
16
|
+
};
|
|
17
|
+
shadow: {
|
|
18
|
+
default: string;
|
|
19
|
+
hover: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
primary: {
|
|
23
|
+
background: {
|
|
24
|
+
default: string;
|
|
25
|
+
hover: string;
|
|
26
|
+
active: string;
|
|
27
|
+
};
|
|
28
|
+
text: {
|
|
29
|
+
default: string;
|
|
30
|
+
};
|
|
31
|
+
border: {
|
|
32
|
+
default: string;
|
|
33
|
+
};
|
|
34
|
+
shadow: {
|
|
35
|
+
default: string;
|
|
36
|
+
hover: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
disabled: {
|
|
40
|
+
background: {
|
|
41
|
+
default: string;
|
|
42
|
+
};
|
|
43
|
+
text: {
|
|
44
|
+
default: string;
|
|
45
|
+
};
|
|
46
|
+
opacity: number;
|
|
47
|
+
};
|
|
48
|
+
size: {
|
|
49
|
+
sm: {
|
|
50
|
+
size: string;
|
|
51
|
+
};
|
|
52
|
+
md: {
|
|
53
|
+
size: string;
|
|
54
|
+
};
|
|
55
|
+
lg: {
|
|
56
|
+
size: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
icon: {
|
|
60
|
+
size: string;
|
|
61
|
+
};
|
|
62
|
+
description: {
|
|
63
|
+
fontSize: string;
|
|
64
|
+
lineHeight: string;
|
|
65
|
+
};
|
|
66
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -20,10 +20,11 @@ export * from './transfer';
|
|
|
20
20
|
export * from './upload';
|
|
21
21
|
export * from './card';
|
|
22
22
|
export * from './tooltip';
|
|
23
|
+
export * from './slider';
|
|
23
24
|
export * from './theme';
|
|
24
|
-
export type { ThemeContext, TokenGenerator, DeepPartial } from './types/theme-utils';
|
|
25
25
|
export { DesignThemeProvider } from './DesignThemeProvider';
|
|
26
26
|
export type { DesignThemeProviderProps } from './DesignThemeProvider';
|
|
27
|
-
export {
|
|
28
|
-
export type {
|
|
29
|
-
export * from './types
|
|
27
|
+
export { globalColors, globalSpacing, globalRadii, globalTypography, globalShadows, globalGradients, lightSemantic, darkSemantic, } from '@kingsoft-ai/theme';
|
|
28
|
+
export type { AppTheme, Theme, ComponentTheme, GlobalColors, GlobalColorScale, GlobalSpacing, GlobalRadii, GlobalTypography, GlobalShadows, GlobalGradients, SemanticColors, SemanticSpacing, SemanticBorderRadius, SemanticTypography, SemanticShadows, } from '@kingsoft-ai/theme';
|
|
29
|
+
export * from './types';
|
|
30
|
+
export { token, createStyledTokens, tokenWhen, themeValue, } from './utils/styled-token';
|