@kingsoft-ai/design 0.1.19 → 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.
Files changed (130) hide show
  1. package/dist/index.cjs +3150 -2478
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.mjs +7430 -6241
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/style.css +1 -1
  6. package/dist/types/DesignThemeProvider.d.ts +25 -20
  7. package/dist/types/button/Button.d.ts +4 -19
  8. package/dist/types/button/Button.style.d.ts +4 -35
  9. package/dist/types/button/IconButton.d.ts +4 -5
  10. package/dist/types/button/IconButton.style.d.ts +4 -7
  11. package/dist/types/button/styled-tokens.d.ts +582 -0
  12. package/dist/types/button/tokens.d.ts +1 -1
  13. package/dist/types/button/tokens.types.d.ts +190 -0
  14. package/dist/types/card/Card.d.ts +0 -6
  15. package/dist/types/card/Card.style.d.ts +4 -7
  16. package/dist/types/card/styled-tokens.d.ts +130 -0
  17. package/dist/types/card/tokens.d.ts +1 -1
  18. package/dist/types/card/tokens.types.d.ts +48 -0
  19. package/dist/types/checkbox/Checkbox.d.ts +0 -7
  20. package/dist/types/checkbox/Checkbox.style.d.ts +29 -7
  21. package/dist/types/checkbox/CheckboxButton.d.ts +0 -16
  22. package/dist/types/checkbox/CheckboxButton.style.d.ts +24 -12
  23. package/dist/types/checkbox/styled-tokens.d.ts +122 -0
  24. package/dist/types/checkbox/tokens.d.ts +1 -1
  25. package/dist/types/checkbox/tokens.types.d.ts +39 -0
  26. package/dist/types/collapse/Collapse.d.ts +2 -34
  27. package/dist/types/collapse/Collapse.style.d.ts +4 -43
  28. package/dist/types/collapse/styled-tokens.d.ts +77 -0
  29. package/dist/types/collapse/tokens.d.ts +1 -1
  30. package/dist/types/collapse/tokens.types.d.ts +28 -0
  31. package/dist/types/context/ThemeContext.d.ts +24 -0
  32. package/dist/types/context/index.d.ts +2 -0
  33. package/dist/types/floatButton/FloatButton.d.ts +0 -21
  34. package/dist/types/floatButton/FloatButton.style.d.ts +0 -31
  35. package/dist/types/floatButton/styled-tokens.d.ts +127 -0
  36. package/dist/types/floatButton/tokens.d.ts +1 -1
  37. package/dist/types/floatButton/tokens.types.d.ts +66 -0
  38. package/dist/types/index.d.ts +5 -4
  39. package/dist/types/input/Input.d.ts +4 -22
  40. package/dist/types/input/Input.style.d.ts +4 -48
  41. package/dist/types/input/styled-tokens.d.ts +147 -0
  42. package/dist/types/input/tokens.d.ts +1 -1
  43. package/dist/types/input/tokens.types.d.ts +46 -0
  44. package/dist/types/link/Link.d.ts +4 -0
  45. package/dist/types/link/Link.style.d.ts +4 -10
  46. package/dist/types/link/styled-tokens.d.ts +107 -0
  47. package/dist/types/link/tokens.d.ts +1 -1
  48. package/dist/types/link/tokens.types.d.ts +39 -0
  49. package/dist/types/menu/Menu.d.ts +0 -25
  50. package/dist/types/menu/Menu.style.d.ts +4 -43
  51. package/dist/types/menu/MenuItem.d.ts +0 -6
  52. package/dist/types/menu/styled-tokens.d.ts +217 -0
  53. package/dist/types/menu/tokens.d.ts +1 -1
  54. package/dist/types/menu/tokens.types.d.ts +79 -0
  55. package/dist/types/modal/Modal.d.ts +0 -8
  56. package/dist/types/modal/Modal.style.d.ts +4 -11
  57. package/dist/types/modal/styled-tokens.d.ts +370 -0
  58. package/dist/types/modal/tokens.d.ts +1 -1
  59. package/dist/types/modal/tokens.types.d.ts +107 -0
  60. package/dist/types/numberInput/NumberInput.d.ts +2 -22
  61. package/dist/types/numberInput/NumberInput.style.d.ts +4 -7
  62. package/dist/types/numberInput/styled-tokens.d.ts +192 -0
  63. package/dist/types/numberInput/tokens.d.ts +1 -1
  64. package/dist/types/numberInput/tokens.types.d.ts +65 -0
  65. package/dist/types/progress/Progress.d.ts +4 -27
  66. package/dist/types/progress/Progress.style.d.ts +4 -43
  67. package/dist/types/progress/styled-tokens.d.ts +137 -0
  68. package/dist/types/progress/tokens.d.ts +3 -0
  69. package/dist/types/progress/tokens.types.d.ts +52 -0
  70. package/dist/types/radio/Radio.d.ts +4 -0
  71. package/dist/types/radio/Radio.style.d.ts +9 -28
  72. package/dist/types/radio/styled-tokens.d.ts +122 -0
  73. package/dist/types/radio/tokens.d.ts +1 -1
  74. package/dist/types/radio/tokens.types.d.ts +41 -0
  75. package/dist/types/select/Select.style.d.ts +4 -7
  76. package/dist/types/select/styled-tokens.d.ts +237 -0
  77. package/dist/types/select/tokens.d.ts +1 -1
  78. package/dist/types/select/tokens.types.d.ts +72 -0
  79. package/dist/types/skeleton/Skeleton.style.d.ts +0 -25
  80. package/dist/types/skeleton/styled-tokens.d.ts +82 -0
  81. package/dist/types/skeleton/tokens.d.ts +1 -1
  82. package/dist/types/skeleton/tokens.types.d.ts +31 -0
  83. package/dist/types/slider/Slider.d.ts +74 -0
  84. package/dist/types/slider/Slider.style.d.ts +125 -0
  85. package/dist/types/slider/__tests__/Slider.test.d.ts +13 -0
  86. package/dist/types/slider/index.d.ts +2 -0
  87. package/dist/types/slider/styled-tokens.d.ts +252 -0
  88. package/dist/types/slider/tokens.d.ts +3 -0
  89. package/dist/types/slider/tokens.types.d.ts +121 -0
  90. package/dist/types/stepper/Stepper.d.ts +3 -0
  91. package/dist/types/stepper/Stepper.style.d.ts +4 -7
  92. package/dist/types/stepper/styled-tokens.d.ts +157 -0
  93. package/dist/types/stepper/tokens.d.ts +1 -1
  94. package/dist/types/stepper/tokens.types.d.ts +68 -0
  95. package/dist/types/switch/Switch.d.ts +4 -35
  96. package/dist/types/switch/Switch.style.d.ts +4 -56
  97. package/dist/types/switch/styled-tokens.d.ts +132 -0
  98. package/dist/types/switch/tokens.d.ts +1 -1
  99. package/dist/types/switch/tokens.types.d.ts +45 -0
  100. package/dist/types/table/Table.d.ts +2 -0
  101. package/dist/types/table/Table.style.d.ts +4 -7
  102. package/dist/types/table/styled-tokens.d.ts +182 -0
  103. package/dist/types/table/tokens.d.ts +3 -0
  104. package/dist/types/table/tokens.types.d.ts +43 -0
  105. package/dist/types/tag/Tag.d.ts +4 -36
  106. package/dist/types/tag/Tag.style.d.ts +5 -41
  107. package/dist/types/tag/styled-tokens.d.ts +140 -0
  108. package/dist/types/tag/tokens.d.ts +1 -1
  109. package/dist/types/tag/tokens.types.d.ts +76 -0
  110. package/dist/types/theme.d.ts +1 -2
  111. package/dist/types/tooltip/Tooltip.d.ts +0 -18
  112. package/dist/types/tooltip/Tooltip.style.d.ts +0 -19
  113. package/dist/types/tooltip/styled-tokens.d.ts +72 -0
  114. package/dist/types/tooltip/tokens.d.ts +1 -1
  115. package/dist/types/tooltip/tokens.types.d.ts +21 -0
  116. package/dist/types/transfer/Transfer.d.ts +0 -20
  117. package/dist/types/transfer/Transfer.style.d.ts +0 -10
  118. package/dist/types/transfer/styled-tokens.d.ts +252 -0
  119. package/dist/types/transfer/tokens.d.ts +1 -1
  120. package/dist/types/transfer/tokens.types.d.ts +79 -0
  121. package/dist/types/types/index.d.ts +64 -4
  122. package/dist/types/upload/Upload.d.ts +2 -21
  123. package/dist/types/upload/Upload.style.d.ts +4 -64
  124. package/dist/types/upload/styled-tokens.d.ts +227 -0
  125. package/dist/types/upload/tokens.d.ts +3 -0
  126. package/dist/types/upload/tokens.types.d.ts +66 -0
  127. package/dist/types/utils/index.d.ts +4 -0
  128. package/dist/types/utils/styled-token.d.ts +117 -0
  129. package/package.json +5 -4
  130. package/dist/styles.css +0 -1
@@ -0,0 +1,190 @@
1
+ /**
2
+ * Button 组件 Token 类型定义
3
+ */
4
+ type IconButtonStateTokens = {
5
+ background: {
6
+ default: string;
7
+ hover: string;
8
+ active: string;
9
+ };
10
+ border: {
11
+ default: string;
12
+ hover?: string;
13
+ active?: string;
14
+ };
15
+ icon: {
16
+ default: string;
17
+ hover?: string;
18
+ active?: string;
19
+ };
20
+ shadow?: {
21
+ default: string;
22
+ hover?: string;
23
+ };
24
+ };
25
+ export interface ButtonTokens {
26
+ primary: {
27
+ background: {
28
+ default: string;
29
+ hover: string;
30
+ active: string;
31
+ };
32
+ text: {
33
+ default: string;
34
+ };
35
+ border: {
36
+ default: string;
37
+ };
38
+ shadow: {
39
+ default: string;
40
+ hover: string;
41
+ };
42
+ };
43
+ secondary: {
44
+ background: {
45
+ default: string;
46
+ hover: string;
47
+ active: string;
48
+ };
49
+ text: {
50
+ default: string;
51
+ };
52
+ border: {
53
+ default: string;
54
+ hover: string;
55
+ active: string;
56
+ };
57
+ shadow: {
58
+ default: string;
59
+ };
60
+ };
61
+ text: {
62
+ background: {
63
+ default: string;
64
+ hover: string;
65
+ active: string;
66
+ };
67
+ text: {
68
+ default: string;
69
+ };
70
+ border: {
71
+ default: string;
72
+ hover: string;
73
+ active: string;
74
+ };
75
+ };
76
+ danger: {
77
+ background: {
78
+ default: string;
79
+ hover: string;
80
+ active: string;
81
+ };
82
+ text: {
83
+ default: string;
84
+ };
85
+ border: {
86
+ default: string;
87
+ };
88
+ shadow: {
89
+ default: string;
90
+ hover: string;
91
+ };
92
+ };
93
+ gradient: {
94
+ background: {
95
+ default: string;
96
+ gradientFrom: string;
97
+ gradientTo: string;
98
+ };
99
+ text: {
100
+ default: string;
101
+ };
102
+ border: {
103
+ default: string;
104
+ };
105
+ shadow: {
106
+ default: string;
107
+ hover: string;
108
+ };
109
+ };
110
+ disabled: {
111
+ background: {
112
+ default: string;
113
+ };
114
+ text: {
115
+ default: string;
116
+ };
117
+ opacity: number;
118
+ };
119
+ size: {
120
+ sm: {
121
+ height: string;
122
+ fontSize: string;
123
+ paddingInline: string;
124
+ iconSize: string;
125
+ };
126
+ md: {
127
+ height: string;
128
+ fontSize: string;
129
+ paddingInline: string;
130
+ iconSize: string;
131
+ };
132
+ lg: {
133
+ height: string;
134
+ fontSize: string;
135
+ paddingInline: string;
136
+ iconSize: string;
137
+ };
138
+ };
139
+ borderRadius: string;
140
+ fontWeight: number;
141
+ gap: string;
142
+ transition: string;
143
+ }
144
+ export interface IconButtonTokens {
145
+ appearance: {
146
+ solid: {
147
+ primary: IconButtonStateTokens;
148
+ neutral: IconButtonStateTokens;
149
+ danger: IconButtonStateTokens;
150
+ };
151
+ outline: {
152
+ primary: IconButtonStateTokens;
153
+ neutral: IconButtonStateTokens;
154
+ danger: IconButtonStateTokens;
155
+ };
156
+ ghost: {
157
+ primary: IconButtonStateTokens;
158
+ neutral: IconButtonStateTokens;
159
+ danger: IconButtonStateTokens;
160
+ };
161
+ };
162
+ disabled: {
163
+ background: string;
164
+ border: string;
165
+ icon: string;
166
+ opacity: number;
167
+ };
168
+ size: {
169
+ sm: {
170
+ edge: string;
171
+ iconSize: string;
172
+ };
173
+ md: {
174
+ edge: string;
175
+ iconSize: string;
176
+ };
177
+ lg: {
178
+ edge: string;
179
+ iconSize: string;
180
+ };
181
+ };
182
+ borderRadius: string;
183
+ transition: string;
184
+ focusRing: {
185
+ color: string;
186
+ offset: string;
187
+ width: string;
188
+ };
189
+ }
190
+ export {};
@@ -1,9 +1,3 @@
1
- /**
2
- * Card 卡片组件
3
- *
4
- * 基于 CSS 变量实现,无需 ThemeProvider
5
- * 支持通过覆盖 CSS 变量自定义样式
6
- */
7
1
  import React, { ReactNode } from 'react';
8
2
  import { type CardVariant } from './Card.style';
9
3
  export interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
@@ -1,12 +1,9 @@
1
1
  /**
2
- * Card 卡片样式
2
+ * Card Styled Components
3
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-card-*
8
- *
9
- * 无需 ThemeProvider,直接使用 CSS 变量
4
+ * 使用 Styled Token System 实现样式:
5
+ * - JS Token 优先(来自 ThemeProvider,支持用户自定义)
6
+ * - CSS 变量作为 fallback(无 Provider 时的兜底)
10
7
  */
11
8
  export type CardVariant = 'elevated' | 'outlined' | 'filled';
12
9
  export declare const CardContainer: import("@emotion/styled").StyledComponent<{
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Card Styled Tokens
3
+ *
4
+ * 将 Card 的 JS tokens 与 CSS 变量映射,实现:
5
+ * - 有 ThemeProvider 时:使用 JS token 值(可被用户自定义)
6
+ * - 无 ThemeProvider 时:fallback 到 CSS 变量(基础样式)
7
+ */
8
+ /**
9
+ * Card 组件的 Styled Tokens
10
+ *
11
+ * 命名规范:$ 前缀表示这是可在 styled-components 中直接使用的 token 对象
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * import { $card } from './styled-tokens';
16
+ *
17
+ * const CardContainer = styled.div`
18
+ * background: ${$card.bg};
19
+ * border-radius: ${$card.radius};
20
+ * transition: ${$card.transition};
21
+ * `;
22
+ * ```
23
+ */
24
+ export declare const $card: {
25
+ readonly bg: (props: {
26
+ theme?: import("@kingsoft-ai/theme").Theme & {
27
+ _useCSSVariables?: boolean;
28
+ };
29
+ }) => string;
30
+ readonly border: (props: {
31
+ theme?: import("@kingsoft-ai/theme").Theme & {
32
+ _useCSSVariables?: boolean;
33
+ };
34
+ }) => string;
35
+ readonly borderHover: (props: {
36
+ theme?: import("@kingsoft-ai/theme").Theme & {
37
+ _useCSSVariables?: boolean;
38
+ };
39
+ }) => string;
40
+ readonly shadowElevated: (props: {
41
+ theme?: import("@kingsoft-ai/theme").Theme & {
42
+ _useCSSVariables?: boolean;
43
+ };
44
+ }) => string;
45
+ readonly shadowElevatedHover: (props: {
46
+ theme?: import("@kingsoft-ai/theme").Theme & {
47
+ _useCSSVariables?: boolean;
48
+ };
49
+ }) => string;
50
+ readonly radius: (props: {
51
+ theme?: import("@kingsoft-ai/theme").Theme & {
52
+ _useCSSVariables?: boolean;
53
+ };
54
+ }) => string;
55
+ readonly transition: (props: {
56
+ theme?: import("@kingsoft-ai/theme").Theme & {
57
+ _useCSSVariables?: boolean;
58
+ };
59
+ }) => string;
60
+ readonly paddingSm: (props: {
61
+ theme?: import("@kingsoft-ai/theme").Theme & {
62
+ _useCSSVariables?: boolean;
63
+ };
64
+ }) => string;
65
+ readonly paddingMd: (props: {
66
+ theme?: import("@kingsoft-ai/theme").Theme & {
67
+ _useCSSVariables?: boolean;
68
+ };
69
+ }) => string;
70
+ readonly paddingLg: (props: {
71
+ theme?: import("@kingsoft-ai/theme").Theme & {
72
+ _useCSSVariables?: boolean;
73
+ };
74
+ }) => string;
75
+ readonly headerPadding: (props: {
76
+ theme?: import("@kingsoft-ai/theme").Theme & {
77
+ _useCSSVariables?: boolean;
78
+ };
79
+ }) => string;
80
+ readonly headerBorderBottom: (props: {
81
+ theme?: import("@kingsoft-ai/theme").Theme & {
82
+ _useCSSVariables?: boolean;
83
+ };
84
+ }) => string;
85
+ readonly titleColor: (props: {
86
+ theme?: import("@kingsoft-ai/theme").Theme & {
87
+ _useCSSVariables?: boolean;
88
+ };
89
+ }) => string;
90
+ readonly titleFontSize: (props: {
91
+ theme?: import("@kingsoft-ai/theme").Theme & {
92
+ _useCSSVariables?: boolean;
93
+ };
94
+ }) => string;
95
+ readonly titleFontWeight: (props: {
96
+ theme?: import("@kingsoft-ai/theme").Theme & {
97
+ _useCSSVariables?: boolean;
98
+ };
99
+ }) => string;
100
+ readonly extraColor: (props: {
101
+ theme?: import("@kingsoft-ai/theme").Theme & {
102
+ _useCSSVariables?: boolean;
103
+ };
104
+ }) => string;
105
+ readonly extraFontSize: (props: {
106
+ theme?: import("@kingsoft-ai/theme").Theme & {
107
+ _useCSSVariables?: boolean;
108
+ };
109
+ }) => string;
110
+ readonly coverRadius: (props: {
111
+ theme?: import("@kingsoft-ai/theme").Theme & {
112
+ _useCSSVariables?: boolean;
113
+ };
114
+ }) => string;
115
+ readonly footerPadding: (props: {
116
+ theme?: import("@kingsoft-ai/theme").Theme & {
117
+ _useCSSVariables?: boolean;
118
+ };
119
+ }) => string;
120
+ readonly footerBg: (props: {
121
+ theme?: import("@kingsoft-ai/theme").Theme & {
122
+ _useCSSVariables?: boolean;
123
+ };
124
+ }) => string;
125
+ readonly footerBorderTop: (props: {
126
+ theme?: import("@kingsoft-ai/theme").Theme & {
127
+ _useCSSVariables?: boolean;
128
+ };
129
+ }) => string;
130
+ };
@@ -1,3 +1,3 @@
1
1
  import { TokenGenerator } from '../types/theme-utils';
2
- import { CardTokens } from '../types/component-tokens.types';
2
+ import { CardTokens } from './tokens.types';
3
3
  export declare const getCardTokens: TokenGenerator<CardTokens>;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Card 组件 Token 类型定义
3
+ */
4
+ export interface CardTokens {
5
+ container: {
6
+ background: {
7
+ default: string;
8
+ };
9
+ border: {
10
+ default: string;
11
+ hover: string;
12
+ };
13
+ shadow: {
14
+ elevated: string;
15
+ elevatedHover: string;
16
+ outlined: string;
17
+ filled: string;
18
+ };
19
+ radius: string;
20
+ transition: string;
21
+ };
22
+ padding: {
23
+ sm: string;
24
+ md: string;
25
+ lg: string;
26
+ };
27
+ header: {
28
+ padding: string;
29
+ borderBottom: string;
30
+ title: {
31
+ color: string;
32
+ fontSize: string;
33
+ fontWeight: number;
34
+ };
35
+ extra: {
36
+ color: string;
37
+ fontSize: string;
38
+ };
39
+ };
40
+ cover: {
41
+ radius: string;
42
+ };
43
+ footer: {
44
+ padding: string;
45
+ background: string;
46
+ borderTop: string;
47
+ };
48
+ }
@@ -1,10 +1,3 @@
1
- /**
2
- * Checkbox 组件
3
- * 基于 Figma 设计稿 1:1 还原
4
- *
5
- * 使用 CSS 变量的三层 Token 体系,无需 ThemeProvider
6
- */
7
- /** @jsxImportSource @emotion/react */
8
1
  import React from 'react';
9
2
  export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'size' | 'onChange'> {
10
3
  /**
@@ -1,13 +1,35 @@
1
1
  /**
2
- * Checkbox 组件样式
2
+ * Checkbox Styled Components
3
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-checkbox-*
8
- *
9
- * 无需 ThemeProvider,直接使用 CSS 变量
4
+ * 使用 Styled Token System 实现样式:
5
+ * - JS Token 优先(来自 ThemeProvider,支持用户自定义)
6
+ * - CSS 变量作为 fallback(无 Provider 时的兜底)
10
7
  */
8
+ export declare const CheckboxContainer: import("@emotion/styled").StyledComponent<{
9
+ theme?: import("@emotion/react").Theme;
10
+ as?: React.ElementType;
11
+ }, import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, {}>;
12
+ export declare const CheckboxControl: import("@emotion/styled").StyledComponent<{
13
+ theme?: import("@emotion/react").Theme;
14
+ as?: React.ElementType;
15
+ } & {
16
+ isHovered?: boolean;
17
+ isChecked?: boolean;
18
+ isIndeterminate?: boolean;
19
+ isDisabled?: boolean;
20
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
21
+ export declare const CheckboxIcon: import("@emotion/styled").StyledComponent<{
22
+ theme?: import("@emotion/react").Theme;
23
+ as?: React.ElementType;
24
+ } & {
25
+ isChecked?: boolean;
26
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
27
+ export declare const CheckboxLabel: import("@emotion/styled").StyledComponent<{
28
+ theme?: import("@emotion/react").Theme;
29
+ as?: React.ElementType;
30
+ } & {
31
+ isDisabled?: boolean;
32
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
11
33
  export declare const checkboxContainer: import("@emotion/react").SerializedStyles;
12
34
  export declare const checkboxControl: import("@emotion/react").SerializedStyles;
13
35
  export declare const checkboxIcon: import("@emotion/react").SerializedStyles;
@@ -1,14 +1,3 @@
1
- /**
2
- * CheckboxButton 组件 - 按钮风格的 Checkbox
3
- *
4
- * 特性:
5
- * - 按钮样式的 checkbox 外观
6
- * - 右下角显示勾选标记
7
- * - 支持受控/非受控模式
8
- *
9
- * 使用 CSS 变量的三层 Token 体系,无需 ThemeProvider
10
- */
11
- /** @jsxImportSource @emotion/react */
12
1
  import React from 'react';
13
2
  import type { CheckboxButtonSize } from './CheckboxButton.style';
14
3
  export interface CheckboxButtonProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'size' | 'onChange' | 'indeterminate'> {
@@ -45,10 +34,5 @@ export interface CheckboxButtonProps extends Omit<React.InputHTMLAttributes<HTML
45
34
  */
46
35
  style?: React.CSSProperties;
47
36
  }
48
- /**
49
- * CheckboxButton - 按钮风格的复选框组件
50
- *
51
- * 按照设计稿,呈现为按钮样式,右下角带勾选标记
52
- */
53
37
  export declare const CheckboxButton: React.ForwardRefExoticComponent<CheckboxButtonProps & React.RefAttributes<HTMLInputElement>>;
54
38
  export default CheckboxButton;
@@ -1,17 +1,9 @@
1
1
  /**
2
- * CheckboxButton 组件样式
2
+ * CheckboxButton Styled Components
3
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-checkbox-*
8
- *
9
- * 无需 ThemeProvider,直接使用 CSS 变量
10
- *
11
- * 设计规范:
12
- * - 按钮样式的 checkbox
13
- * - 右下角勾选标记
14
- * - 完整的交互状态
4
+ * 使用 Styled Token System 实现样式:
5
+ * - JS Token 优先(来自 ThemeProvider,支持用户自定义)
6
+ * - CSS 变量作为 fallback(无 Provider 时的兜底)
15
7
  */
16
8
  export type CheckboxButtonSize = 'sm' | 'md' | 'lg';
17
9
  interface CheckboxButtonSizeConfig {
@@ -25,6 +17,26 @@ interface CheckboxButtonSizeConfig {
25
17
  checkmarkIcon: number;
26
18
  }
27
19
  export declare const checkboxButtonSizeTokens: Record<CheckboxButtonSize, CheckboxButtonSizeConfig>;
20
+ export declare const CheckboxButtonContainer: import("@emotion/styled").StyledComponent<{
21
+ theme?: import("@emotion/react").Theme;
22
+ as?: React.ElementType;
23
+ }, import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, {}>;
24
+ export declare const CheckboxButtonWrapper: import("@emotion/styled").StyledComponent<{
25
+ theme?: import("@emotion/react").Theme;
26
+ as?: React.ElementType;
27
+ } & {
28
+ size: CheckboxButtonSize;
29
+ isHovered?: boolean;
30
+ isChecked?: boolean;
31
+ isDisabled?: boolean;
32
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
33
+ export declare const CheckboxButtonCheckmark: import("@emotion/styled").StyledComponent<{
34
+ theme?: import("@emotion/react").Theme;
35
+ as?: React.ElementType;
36
+ } & {
37
+ size: CheckboxButtonSize;
38
+ isDisabled?: boolean;
39
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
28
40
  export declare const checkboxButtonContainer: import("@emotion/react").SerializedStyles;
29
41
  export declare const checkboxButtonWrapper: (size?: CheckboxButtonSize) => import("@emotion/react").SerializedStyles;
30
42
  export declare const checkboxButtonCheckmark: (size?: CheckboxButtonSize) => import("@emotion/react").SerializedStyles;
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Checkbox Styled Tokens
3
+ *
4
+ * 将 Checkbox 的 JS tokens 与 CSS 变量映射,实现:
5
+ * - 有 ThemeProvider 时:使用 JS token 值(可被用户自定义)
6
+ * - 无 ThemeProvider 时:fallback 到 CSS 变量(基础样式)
7
+ */
8
+ /**
9
+ * Checkbox 组件的 Styled Tokens
10
+ */
11
+ export declare const $checkbox: {
12
+ readonly controlSize: (props: {
13
+ theme?: import("@kingsoft-ai/theme").Theme & {
14
+ _useCSSVariables?: boolean;
15
+ };
16
+ }) => string;
17
+ readonly controlBorderRadius: (props: {
18
+ theme?: import("@kingsoft-ai/theme").Theme & {
19
+ _useCSSVariables?: boolean;
20
+ };
21
+ }) => string;
22
+ readonly controlBorderWidth: (props: {
23
+ theme?: import("@kingsoft-ai/theme").Theme & {
24
+ _useCSSVariables?: boolean;
25
+ };
26
+ }) => string;
27
+ readonly controlBg: (props: {
28
+ theme?: import("@kingsoft-ai/theme").Theme & {
29
+ _useCSSVariables?: boolean;
30
+ };
31
+ }) => string;
32
+ readonly controlBgChecked: (props: {
33
+ theme?: import("@kingsoft-ai/theme").Theme & {
34
+ _useCSSVariables?: boolean;
35
+ };
36
+ }) => string;
37
+ readonly controlBgDisabled: (props: {
38
+ theme?: import("@kingsoft-ai/theme").Theme & {
39
+ _useCSSVariables?: boolean;
40
+ };
41
+ }) => string;
42
+ readonly controlBgDisabledChecked: (props: {
43
+ theme?: import("@kingsoft-ai/theme").Theme & {
44
+ _useCSSVariables?: boolean;
45
+ };
46
+ }) => string;
47
+ readonly controlBorder: (props: {
48
+ theme?: import("@kingsoft-ai/theme").Theme & {
49
+ _useCSSVariables?: boolean;
50
+ };
51
+ }) => string;
52
+ readonly controlBorderHover: (props: {
53
+ theme?: import("@kingsoft-ai/theme").Theme & {
54
+ _useCSSVariables?: boolean;
55
+ };
56
+ }) => string;
57
+ readonly controlBorderChecked: (props: {
58
+ theme?: import("@kingsoft-ai/theme").Theme & {
59
+ _useCSSVariables?: boolean;
60
+ };
61
+ }) => string;
62
+ readonly controlBorderDisabled: (props: {
63
+ theme?: import("@kingsoft-ai/theme").Theme & {
64
+ _useCSSVariables?: boolean;
65
+ };
66
+ }) => string;
67
+ readonly controlBorderDisabledChecked: (props: {
68
+ theme?: import("@kingsoft-ai/theme").Theme & {
69
+ _useCSSVariables?: boolean;
70
+ };
71
+ }) => string;
72
+ readonly iconColor: (props: {
73
+ theme?: import("@kingsoft-ai/theme").Theme & {
74
+ _useCSSVariables?: boolean;
75
+ };
76
+ }) => string;
77
+ readonly iconSize: (props: {
78
+ theme?: import("@kingsoft-ai/theme").Theme & {
79
+ _useCSSVariables?: boolean;
80
+ };
81
+ }) => string;
82
+ readonly focusRing: (props: {
83
+ theme?: import("@kingsoft-ai/theme").Theme & {
84
+ _useCSSVariables?: boolean;
85
+ };
86
+ }) => string;
87
+ readonly gap: (props: {
88
+ theme?: import("@kingsoft-ai/theme").Theme & {
89
+ _useCSSVariables?: boolean;
90
+ };
91
+ }) => string;
92
+ readonly labelFontSize: (props: {
93
+ theme?: import("@kingsoft-ai/theme").Theme & {
94
+ _useCSSVariables?: boolean;
95
+ };
96
+ }) => string;
97
+ readonly labelLineHeight: (props: {
98
+ theme?: import("@kingsoft-ai/theme").Theme & {
99
+ _useCSSVariables?: boolean;
100
+ };
101
+ }) => string;
102
+ readonly labelColor: (props: {
103
+ theme?: import("@kingsoft-ai/theme").Theme & {
104
+ _useCSSVariables?: boolean;
105
+ };
106
+ }) => string;
107
+ readonly labelColorDisabled: (props: {
108
+ theme?: import("@kingsoft-ai/theme").Theme & {
109
+ _useCSSVariables?: boolean;
110
+ };
111
+ }) => string;
112
+ readonly labelFontWeight: (props: {
113
+ theme?: import("@kingsoft-ai/theme").Theme & {
114
+ _useCSSVariables?: boolean;
115
+ };
116
+ }) => string;
117
+ readonly transition: (props: {
118
+ theme?: import("@kingsoft-ai/theme").Theme & {
119
+ _useCSSVariables?: boolean;
120
+ };
121
+ }) => string;
122
+ };
@@ -1,3 +1,3 @@
1
1
  import { TokenGenerator } from '../types/theme-utils';
2
- import { CheckboxTokens } from '../types/component-tokens.types';
2
+ import { CheckboxTokens } from './tokens.types';
3
3
  export declare const getCheckboxTokens: TokenGenerator<CheckboxTokens>;