@kingsoft-ai/design 0.1.9

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 (97) hide show
  1. package/README.md +67 -0
  2. package/dist/index.cjs +2485 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.mjs +9638 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/dist/types/__tests__/setup.d.ts +1 -0
  7. package/dist/types/__tests__/test-utils.d.ts +26 -0
  8. package/dist/types/button/Button.d.ts +56 -0
  9. package/dist/types/button/Button.style.d.ts +69 -0
  10. package/dist/types/button/IconButton.d.ts +47 -0
  11. package/dist/types/button/IconButton.style.d.ts +32 -0
  12. package/dist/types/button/__tests__/Button.test.d.ts +14 -0
  13. package/dist/types/button/__tests__/IconButton.test.d.ts +1 -0
  14. package/dist/types/button/index.d.ts +4 -0
  15. package/dist/types/button/tokens.d.ts +4 -0
  16. package/dist/types/checkbox/Checkbox.d.ts +42 -0
  17. package/dist/types/checkbox/Checkbox.style.d.ts +9 -0
  18. package/dist/types/checkbox/CheckboxButton.d.ts +52 -0
  19. package/dist/types/checkbox/CheckboxButton.style.d.ts +26 -0
  20. package/dist/types/checkbox/__tests__/Checkbox.test.d.ts +4 -0
  21. package/dist/types/checkbox/__tests__/CheckboxButton.test.d.ts +4 -0
  22. package/dist/types/checkbox/index.d.ts +7 -0
  23. package/dist/types/checkbox/tokens.d.ts +3 -0
  24. package/dist/types/collapse/Collapse.d.ts +50 -0
  25. package/dist/types/collapse/Collapse.style.d.ts +153 -0
  26. package/dist/types/collapse/CollapseItem.d.ts +46 -0
  27. package/dist/types/collapse/__tests__/Collapse.test.d.ts +14 -0
  28. package/dist/types/collapse/index.d.ts +4 -0
  29. package/dist/types/collapse/tokens.d.ts +3 -0
  30. package/dist/types/index.d.ts +18 -0
  31. package/dist/types/input/Input.d.ts +73 -0
  32. package/dist/types/input/Input.style.d.ts +96 -0
  33. package/dist/types/input/__tests__/Input.test.d.ts +17 -0
  34. package/dist/types/input/index.d.ts +2 -0
  35. package/dist/types/input/tokens.d.ts +3 -0
  36. package/dist/types/menu/Menu.d.ts +37 -0
  37. package/dist/types/menu/Menu.style.d.ts +122 -0
  38. package/dist/types/menu/MenuFooter.d.ts +32 -0
  39. package/dist/types/menu/MenuGroup.d.ts +26 -0
  40. package/dist/types/menu/MenuHeader.d.ts +32 -0
  41. package/dist/types/menu/MenuItem.d.ts +40 -0
  42. package/dist/types/menu/SubMenuItem.d.ts +26 -0
  43. package/dist/types/menu/SubMenuPopover.d.ts +29 -0
  44. package/dist/types/menu/__tests__/Menu.test.d.ts +1 -0
  45. package/dist/types/menu/index.d.ts +13 -0
  46. package/dist/types/menu/tokens.d.ts +3 -0
  47. package/dist/types/numberInput/NumberInput.d.ts +59 -0
  48. package/dist/types/numberInput/NumberInput.style.d.ts +44 -0
  49. package/dist/types/numberInput/__tests__/NumberInput.test.d.ts +1 -0
  50. package/dist/types/numberInput/index.d.ts +2 -0
  51. package/dist/types/numberInput/tokens.d.ts +3 -0
  52. package/dist/types/progress/Progress.d.ts +64 -0
  53. package/dist/types/progress/Progress.style.d.ts +117 -0
  54. package/dist/types/progress/__tests__/Progress.test.d.ts +1 -0
  55. package/dist/types/progress/index.d.ts +3 -0
  56. package/dist/types/radio/Radio.d.ts +9 -0
  57. package/dist/types/radio/Radio.style.d.ts +36 -0
  58. package/dist/types/radio/__tests__/Radio.test.d.ts +13 -0
  59. package/dist/types/radio/index.d.ts +2 -0
  60. package/dist/types/radio/tokens.d.ts +3 -0
  61. package/dist/types/select/ListBox.d.ts +11 -0
  62. package/dist/types/select/Popover.d.ts +10 -0
  63. package/dist/types/select/Select.d.ts +140 -0
  64. package/dist/types/select/Select.style.d.ts +73 -0
  65. package/dist/types/select/__tests__/Select.test.d.ts +1 -0
  66. package/dist/types/select/index.d.ts +3 -0
  67. package/dist/types/select/tokens.d.ts +3 -0
  68. package/dist/types/skeleton/Skeleton.d.ts +23 -0
  69. package/dist/types/skeleton/Skeleton.style.d.ts +32 -0
  70. package/dist/types/skeleton/index.d.ts +3 -0
  71. package/dist/types/skeleton/tokens.d.ts +3 -0
  72. package/dist/types/stepper/Step.d.ts +24 -0
  73. package/dist/types/stepper/Stepper.d.ts +20 -0
  74. package/dist/types/stepper/Stepper.style.d.ts +57 -0
  75. package/dist/types/stepper/index.d.ts +3 -0
  76. package/dist/types/stepper/tokens.d.ts +3 -0
  77. package/dist/types/switch/Switch.d.ts +68 -0
  78. package/dist/types/switch/Switch.style.d.ts +100 -0
  79. package/dist/types/switch/__tests__/Switch.test.d.ts +14 -0
  80. package/dist/types/switch/index.d.ts +6 -0
  81. package/dist/types/switch/tokens.d.ts +3 -0
  82. package/dist/types/table/Table.d.ts +88 -0
  83. package/dist/types/table/Table.style.d.ts +97 -0
  84. package/dist/types/table/index.d.ts +2 -0
  85. package/dist/types/tag/Tag.d.ts +80 -0
  86. package/dist/types/tag/Tag.style.d.ts +83 -0
  87. package/dist/types/tag/__tests__/Tag.test.d.ts +14 -0
  88. package/dist/types/tag/index.d.ts +2 -0
  89. package/dist/types/tag/tokens.d.ts +3 -0
  90. package/dist/types/theme.d.ts +14 -0
  91. package/dist/types/types/component-tokens.types.d.ts +765 -0
  92. package/dist/types/types/theme-utils.d.ts +20 -0
  93. package/dist/types/upload/Upload.d.ts +80 -0
  94. package/dist/types/upload/Upload.style.d.ts +158 -0
  95. package/dist/types/upload/__tests__/Upload.test.d.ts +16 -0
  96. package/dist/types/upload/index.d.ts +3 -0
  97. package/package.json +73 -0
@@ -0,0 +1,24 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type StepperOrientation, type StepperLabelPlacement, type StepStatus, type StepSize, type StepperVariant } from './Stepper.style';
3
+ export interface StepProps {
4
+ /** Title of the step */
5
+ title?: ReactNode;
6
+ /** Description of the step */
7
+ description?: ReactNode;
8
+ /** Icon of the step */
9
+ icon?: ReactNode;
10
+ /** Status of the step, determined by Stepper if not provided */
11
+ status?: StepStatus;
12
+ /** Disable the step */
13
+ disabled?: boolean;
14
+ /** Click handler */
15
+ onClick?: () => void;
16
+ className?: string;
17
+ index?: number;
18
+ orientation?: StepperOrientation;
19
+ labelPlacement?: StepperLabelPlacement;
20
+ size?: StepSize;
21
+ last?: boolean;
22
+ variant?: StepperVariant;
23
+ }
24
+ export declare const Step: import("react").ForwardRefExoticComponent<StepProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,20 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type StepperOrientation, type StepperLabelPlacement, type StepSize, type StepperVariant } from './Stepper.style';
3
+ export interface StepperProps {
4
+ /** Current active step index (0-indexed) */
5
+ active?: number;
6
+ /** Orientation of the stepper */
7
+ orientation?: StepperOrientation;
8
+ /** Label placement (only for horizontal orientation) */
9
+ labelPlacement?: StepperLabelPlacement;
10
+ /** Size of the stepper */
11
+ size?: StepSize;
12
+ /** Visual variant */
13
+ variant?: StepperVariant;
14
+ /** Children (Step components) */
15
+ children: ReactNode;
16
+ className?: string;
17
+ /** Callback when step is clicked */
18
+ onChange?: (index: number) => void;
19
+ }
20
+ export declare const Stepper: import("react").ForwardRefExoticComponent<StepperProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,57 @@
1
+ export type StepperOrientation = 'horizontal' | 'vertical';
2
+ export type StepperLabelPlacement = 'right' | 'bottom';
3
+ export type StepStatus = 'wait' | 'process' | 'finish' | 'error';
4
+ export type StepSize = 'md' | 'sm';
5
+ export type StepperVariant = 'default' | 'dot';
6
+ export declare const StepperRoot: import("@emotion/styled").StyledComponent<{
7
+ theme?: import("@emotion/react").Theme;
8
+ as?: React.ElementType;
9
+ } & {
10
+ orientation: StepperOrientation;
11
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
12
+ export declare const StepRoot: import("@emotion/styled").StyledComponent<{
13
+ theme?: import("@emotion/react").Theme;
14
+ as?: React.ElementType;
15
+ } & {
16
+ orientation: StepperOrientation;
17
+ labelPlacement: StepperLabelPlacement;
18
+ status: StepStatus;
19
+ isLast: boolean;
20
+ flexBasis?: string;
21
+ variant: StepperVariant;
22
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
23
+ export declare const StepIconContainer: import("@emotion/styled").StyledComponent<{
24
+ theme?: import("@emotion/react").Theme;
25
+ as?: React.ElementType;
26
+ } & {
27
+ status: StepStatus;
28
+ size: StepSize;
29
+ variant: StepperVariant;
30
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
31
+ export declare const StepContent: import("@emotion/styled").StyledComponent<{
32
+ theme?: import("@emotion/react").Theme;
33
+ as?: React.ElementType;
34
+ } & {
35
+ orientation: StepperOrientation;
36
+ labelPlacement: StepperLabelPlacement;
37
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
38
+ export declare const StepTitle: import("@emotion/styled").StyledComponent<{
39
+ theme?: import("@emotion/react").Theme;
40
+ as?: React.ElementType;
41
+ } & {
42
+ status: StepStatus;
43
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
44
+ export declare const StepDescription: import("@emotion/styled").StyledComponent<{
45
+ theme?: import("@emotion/react").Theme;
46
+ as?: React.ElementType;
47
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
48
+ export declare const StepConnector: import("@emotion/styled").StyledComponent<{
49
+ theme?: import("@emotion/react").Theme;
50
+ as?: React.ElementType;
51
+ } & {
52
+ orientation: StepperOrientation;
53
+ labelPlacement: StepperLabelPlacement;
54
+ isFinished: boolean;
55
+ size: StepSize;
56
+ variant: StepperVariant;
57
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,3 @@
1
+ export * from './Stepper';
2
+ export * from './Step';
3
+ export type { StepperOrientation, StepperLabelPlacement, StepStatus, StepSize, StepperVariant, } from './Stepper.style';
@@ -0,0 +1,3 @@
1
+ import { TokenGenerator } from '../types/theme-utils';
2
+ import { StepperTokens } from '../types/component-tokens.types';
3
+ export declare const getStepperTokens: TokenGenerator<StepperTokens>;
@@ -0,0 +1,68 @@
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
+ import type { ReactNode } from 'react';
31
+ import type { AriaSwitchProps } from 'react-aria';
32
+ import type { ToggleProps } from '@react-types/checkbox';
33
+ import { type SwitchSize } from './Switch.style';
34
+ export declare const SIZES: readonly ["sm", "md"];
35
+ export type SwitchProps = Omit<AriaSwitchProps, 'children' | 'isDisabled'> & Omit<ToggleProps, 'children' | 'isDisabled'> & {
36
+ /** 开关尺寸:小号(20px)、标准(24px) */
37
+ size?: SwitchSize;
38
+ /** 选中状态的文字标签(显示在开关内部) */
39
+ checkedLabel?: string;
40
+ /** 未选中状态的文字标签(显示在开关内部) */
41
+ uncheckedLabel?: string;
42
+ /** 是否禁用(替代 isDisabled) */
43
+ disabled?: boolean;
44
+ /** 外部描述性标签(显示在开关旁边) */
45
+ children?: ReactNode;
46
+ /** 自定义类名 */
47
+ className?: string;
48
+ };
49
+ /**
50
+ * Switch 开关组件
51
+ *
52
+ * 基于 Figma 设计规范实现的开关组件,支持带文字的开关
53
+ * 使用 react-aria 保证无障碍访问性
54
+ */
55
+ export declare const Switch: import("react").ForwardRefExoticComponent<Omit<AriaSwitchProps, "isDisabled" | "children"> & Omit<ToggleProps, "isDisabled" | "children"> & {
56
+ /** 开关尺寸:小号(20px)、标准(24px) */
57
+ size?: SwitchSize;
58
+ /** 选中状态的文字标签(显示在开关内部) */
59
+ checkedLabel?: string;
60
+ /** 未选中状态的文字标签(显示在开关内部) */
61
+ uncheckedLabel?: string;
62
+ /** 是否禁用(替代 isDisabled) */
63
+ disabled?: boolean;
64
+ /** 外部描述性标签(显示在开关旁边) */
65
+ children?: ReactNode;
66
+ /** 自定义类名 */
67
+ className?: string;
68
+ } & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Switch 开关样式
3
+ *
4
+ * 基于三层 Token 体系:
5
+ * - Tier 1 (Global): 全局基础值
6
+ * - Tier 2 (Semantic): 语义化映射
7
+ * - Tier 3 (Component): 组件专用 Token
8
+ *
9
+ * 完全还原 Figma 设计稿规范
10
+ * 支持带文字的开关组件(如 ON/OFF、开/关)
11
+ */
12
+ export declare const switchSizes: readonly ["sm", "md"];
13
+ export type SwitchSize = (typeof switchSizes)[number];
14
+ /**
15
+ * Switch 根元素(label 标签)
16
+ *
17
+ * 特性:
18
+ * - 基于三层 Token 设计
19
+ * - 完整的交互状态(hover, focus, disabled)
20
+ * - 支持带文字的开关
21
+ * - 平滑的动画过渡
22
+ */
23
+ export declare const SwitchRoot: import("@emotion/styled").StyledComponent<{
24
+ theme?: import("@emotion/react").Theme;
25
+ as?: React.ElementType;
26
+ } & {
27
+ size: SwitchSize;
28
+ isSelected: boolean;
29
+ isDisabled: boolean;
30
+ isFocusVisible: boolean;
31
+ hasInnerLabel: boolean;
32
+ }, 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
+ export declare const SwitchContent: import("@emotion/styled").StyledComponent<{
44
+ theme?: import("@emotion/react").Theme;
45
+ as?: React.ElementType;
46
+ } & {
47
+ isSelected: boolean;
48
+ hasInnerLabel: boolean;
49
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
50
+ /**
51
+ * Switch 文字标签
52
+ *
53
+ * 显示开关状态文字(如 ON/OFF、开/关)
54
+ * 使用 Tier 3 组件层文字 Token
55
+ *
56
+ * 使用相对定位,不影响滑块的绝对定位计算
57
+ */
58
+ export declare const SwitchLabel: import("@emotion/styled").StyledComponent<{
59
+ theme?: import("@emotion/react").Theme;
60
+ as?: React.ElementType;
61
+ } & {
62
+ isSelected: boolean;
63
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
64
+ /**
65
+ * Switch 滑块(Thumb)
66
+ *
67
+ * 白色圆形滑块,根据开关状态滑动
68
+ * 使用 Tier 3 组件层滑块 Token
69
+ *
70
+ * 使用绝对定位 + transform 实现平滑的位置动画
71
+ * 根据 Figma 设计:
72
+ * - 未选中时:left: 0(紧贴左边缘,实际距离容器边缘 3px)
73
+ * - 选中时:right: 0(紧贴右边缘,实际距离容器边缘 3px)
74
+ */
75
+ export declare const SwitchThumb: import("@emotion/styled").StyledComponent<{
76
+ theme?: import("@emotion/react").Theme;
77
+ as?: React.ElementType;
78
+ } & {
79
+ isSelected: boolean;
80
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
81
+ /**
82
+ * 外部标签容器
83
+ *
84
+ * 用于在 Switch 外部显示描述性标签
85
+ */
86
+ export declare const SwitchLabelWrapper: import("@emotion/styled").StyledComponent<{
87
+ theme?: import("@emotion/react").Theme;
88
+ as?: React.ElementType;
89
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
90
+ /**
91
+ * 外部标签文字
92
+ *
93
+ * Switch 旁边的描述性文字
94
+ */
95
+ export declare const SwitchLabelText: import("@emotion/styled").StyledComponent<{
96
+ theme?: import("@emotion/react").Theme;
97
+ as?: React.ElementType;
98
+ } & {
99
+ isDisabled: boolean;
100
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Switch 组件测试
3
+ *
4
+ * 测试覆盖:
5
+ * - 基础渲染
6
+ * - 尺寸 (sm, md)
7
+ * - 受控/非受控模式
8
+ * - 交互状态 (click, keyboard)
9
+ * - 禁用状态
10
+ * - 带文字标签
11
+ * - 外部标签
12
+ * - 无障碍性
13
+ */
14
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Switch 开关组件导出
3
+ */
4
+ export { Switch, SIZES as SWITCH_SIZES } from './Switch';
5
+ export type { SwitchProps } from './Switch';
6
+ export type { SwitchSize } from './Switch.style';
@@ -0,0 +1,3 @@
1
+ import { TokenGenerator } from '../types/theme-utils';
2
+ import { SwitchTokens } from '../types/component-tokens.types';
3
+ export declare const getSwitchTokens: TokenGenerator<SwitchTokens>;
@@ -0,0 +1,88 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type TableSize, type TableVariant } from './Table.style';
3
+ export type { TableSize, TableVariant } from './Table.style';
4
+ export declare const SIZES: readonly ["sm", "md", "lg"];
5
+ export declare const VARIANTS: readonly ["default", "bordered", "striped"];
6
+ export interface TableColumn<T = any> {
7
+ /** 列唯一标识 */
8
+ key: string;
9
+ /** 列标题 */
10
+ title?: ReactNode;
11
+ /** 列宽度 */
12
+ width?: number | string;
13
+ /** 对齐方式 */
14
+ align?: 'left' | 'center' | 'right';
15
+ /** 是否可排序 */
16
+ sortable?: boolean;
17
+ /** 固定列 */
18
+ fixed?: 'left' | 'right';
19
+ /** 自定义渲染 */
20
+ render?: (value: any, record: T, index: number) => ReactNode;
21
+ /** 是否省略文本 */
22
+ ellipsis?: boolean;
23
+ }
24
+ export interface TableDataSource<T = any> {
25
+ /** 唯一标识 */
26
+ id: string | number;
27
+ /** 子数据(用于树形结构) */
28
+ children?: TableDataSource<T>[];
29
+ /** 其他数据字段 */
30
+ [key: string]: any;
31
+ }
32
+ export interface TableProps<T extends Record<string, any> = Record<string, any>> {
33
+ /** 列配置 */
34
+ columns: TableColumn<T>[];
35
+ /** 数据源 */
36
+ dataSource: T[];
37
+ /** 表格尺寸 */
38
+ size?: TableSize;
39
+ /** 表格变体 */
40
+ variant?: TableVariant;
41
+ /** 是否显示边框 */
42
+ bordered?: boolean;
43
+ /** 是否全宽 */
44
+ fullWidth?: boolean;
45
+ /** 滚动配置 */
46
+ scroll?: {
47
+ /** 横向滚动宽度 */
48
+ x?: number | string;
49
+ /** 纵向滚动高度 */
50
+ y?: number | string;
51
+ };
52
+ /** 是否可选择 */
53
+ selectable?: boolean;
54
+ /** 选择类型 */
55
+ selectionMode?: 'single' | 'multiple';
56
+ /** 选中的行 */
57
+ selectedKeys?: Set<string | number> | 'all';
58
+ /** 选中行变化回调 */
59
+ onSelectionChange?: (keys: Set<string | number> | 'all') => void;
60
+ /** 是否可展开 */
61
+ expandable?: boolean;
62
+ /** 展开的行 */
63
+ expandedKeys?: Set<string | number>;
64
+ /** 展开行变化回调 */
65
+ onExpandChange?: (keys: Set<string | number>) => void;
66
+ /** 自定义展开内容 */
67
+ expandedRowRender?: (record: T, index: number) => ReactNode;
68
+ /** 排序配置 */
69
+ sortConfig?: {
70
+ key: string;
71
+ direction: 'asc' | 'desc' | null;
72
+ };
73
+ /** 排序变化回调 */
74
+ onSortChange?: (key: string, direction: 'asc' | 'desc' | null) => void;
75
+ /** 行点击事件 */
76
+ onRowClick?: (record: T, index: number) => void;
77
+ /** 空数据展示 */
78
+ emptyText?: ReactNode;
79
+ /** 自定义类名 */
80
+ className?: string;
81
+ /** 是否允许折行 */
82
+ wrapText?: boolean;
83
+ /** Loading 状态 */
84
+ loading?: boolean;
85
+ }
86
+ export declare const Table: <T extends Record<string, any> = Record<string, any>>(props: TableProps<T> & {
87
+ ref?: React.ForwardedRef<HTMLTableElement>;
88
+ }) => React.ReactElement;
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Table 样式定义
3
+ *
4
+ * 基于 Figma 设计稿的表格样式实现
5
+ */
6
+ export declare const tableSizes: readonly ["sm", "md", "lg"];
7
+ export type TableSize = (typeof tableSizes)[number];
8
+ export declare const tableVariants: readonly ["default", "bordered", "striped"];
9
+ export type TableVariant = (typeof tableVariants)[number];
10
+ export declare const TableContainer: import("@emotion/styled").StyledComponent<{
11
+ theme?: import("@emotion/react").Theme;
12
+ as?: React.ElementType;
13
+ } & {
14
+ size?: TableSize;
15
+ fullWidth?: boolean;
16
+ scrollX?: number | string;
17
+ scrollY?: number | string;
18
+ showScrollbar?: boolean;
19
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
20
+ export declare const StyledTable: import("@emotion/styled").StyledComponent<{
21
+ theme?: import("@emotion/react").Theme;
22
+ as?: React.ElementType;
23
+ } & {
24
+ size?: TableSize;
25
+ variant?: TableVariant;
26
+ scrollX?: number | string;
27
+ }, import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, {}>;
28
+ export declare const TableHeader: import("@emotion/styled").StyledComponent<{
29
+ theme?: import("@emotion/react").Theme;
30
+ as?: React.ElementType;
31
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, {}>;
32
+ export declare const TableHeaderRow: import("@emotion/styled").StyledComponent<{
33
+ theme?: import("@emotion/react").Theme;
34
+ as?: React.ElementType;
35
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, {}>;
36
+ export declare const TableHeaderCell: import("@emotion/styled").StyledComponent<{
37
+ theme?: import("@emotion/react").Theme;
38
+ as?: React.ElementType;
39
+ } & {
40
+ size?: TableSize;
41
+ sortable?: boolean;
42
+ fixed?: "left" | "right";
43
+ align?: "left" | "center" | "right";
44
+ width?: number | string;
45
+ }, import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, {}>;
46
+ export declare const SortIndicator: import("@emotion/styled").StyledComponent<{
47
+ theme?: import("@emotion/react").Theme;
48
+ as?: React.ElementType;
49
+ } & {
50
+ direction?: "asc" | "desc" | null;
51
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
52
+ export declare const TableBody: import("@emotion/styled").StyledComponent<{
53
+ theme?: import("@emotion/react").Theme;
54
+ as?: React.ElementType;
55
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, {}>;
56
+ export declare const TableRow: import("@emotion/styled").StyledComponent<{
57
+ theme?: import("@emotion/react").Theme;
58
+ as?: React.ElementType;
59
+ } & {
60
+ selectable?: boolean;
61
+ selected?: boolean;
62
+ expandable?: boolean;
63
+ expanded?: boolean;
64
+ isSubRow?: boolean;
65
+ level?: number;
66
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, {}>;
67
+ export declare const TableCell: import("@emotion/styled").StyledComponent<{
68
+ theme?: import("@emotion/react").Theme;
69
+ as?: React.ElementType;
70
+ } & {
71
+ size?: TableSize;
72
+ fixed?: "left" | "right";
73
+ align?: "left" | "center" | "right";
74
+ width?: number | string;
75
+ level?: number;
76
+ }, import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, {}>;
77
+ export declare const CheckboxCell: import("@emotion/styled").StyledComponent<{
78
+ theme?: import("@emotion/react").Theme;
79
+ as?: React.ElementType;
80
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
81
+ export declare const ExpandButton: import("@emotion/styled").StyledComponent<{
82
+ theme?: import("@emotion/react").Theme;
83
+ as?: React.ElementType;
84
+ } & {
85
+ expanded?: boolean;
86
+ }, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
87
+ export declare const EmptyState: import("@emotion/styled").StyledComponent<{
88
+ theme?: import("@emotion/react").Theme;
89
+ as?: React.ElementType;
90
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
91
+ export declare const CellContent: import("@emotion/styled").StyledComponent<{
92
+ theme?: import("@emotion/react").Theme;
93
+ as?: React.ElementType;
94
+ } & {
95
+ ellipsis?: boolean;
96
+ wrapText?: boolean;
97
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,2 @@
1
+ export { Table, SIZES as TABLE_SIZES, VARIANTS as TABLE_VARIANTS } from './Table';
2
+ export type { TableProps, TableColumn, TableDataSource, TableSize, TableVariant } from './Table';
@@ -0,0 +1,80 @@
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
+ import { type ReactNode } from 'react';
27
+ import type { AriaButtonProps } from 'react-aria';
28
+ import { type TagVariant, type TagSize, type TagColor } from './Tag.style';
29
+ export type { TagVariant, TagSize, TagColor };
30
+ export interface TagProps {
31
+ /** 标签变体:默认 | 可选择 */
32
+ variant?: TagVariant;
33
+ /** 标签尺寸:小号(18px) | 中号(24px) | 大号(32px) */
34
+ size?: TagSize;
35
+ /** 标签颜色 */
36
+ color?: TagColor;
37
+ /** 是否显示边框(仅彩色标签适用) */
38
+ bordered?: boolean;
39
+ /** 是否可关闭 */
40
+ closable?: boolean;
41
+ /** 是否可选择(checkable 变体) */
42
+ checkable?: boolean;
43
+ /** 是否已选中(checkable 变体) */
44
+ checked?: boolean;
45
+ /** 前置图标 */
46
+ icon?: ReactNode;
47
+ /** 是否禁用 */
48
+ disabled?: boolean;
49
+ /** 自定义类名 */
50
+ className?: string;
51
+ /** 子元素 */
52
+ children?: ReactNode;
53
+ /** 关闭回调 */
54
+ onClose?: () => void;
55
+ /** 选中状态变化回调(checkable 变体) */
56
+ onChange?: (checked: boolean) => void;
57
+ /** 点击回调 */
58
+ onClick?: () => void;
59
+ }
60
+ /**
61
+ * Tag 标签组件
62
+ *
63
+ * 基于 Figma 设计规范实现的标签组件,支持多种变体、颜色和尺寸
64
+ * 使用 react-aria 保证无障碍访问性
65
+ */
66
+ export declare const Tag: import("react").ForwardRefExoticComponent<TagProps & import("react").RefAttributes<HTMLSpanElement>>;
67
+ export interface TagAddProps extends Omit<AriaButtonProps, 'elementType'> {
68
+ /** 标签尺寸 */
69
+ size?: TagSize;
70
+ /** 自定义类名 */
71
+ className?: string;
72
+ /** 子元素 */
73
+ children?: ReactNode;
74
+ }
75
+ /**
76
+ * Tag.Add 添加标签按钮
77
+ *
78
+ * 用于添加新标签的按钮组件
79
+ */
80
+ export declare const TagAdd: import("react").ForwardRefExoticComponent<TagAddProps & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Tag 标签样式
3
+ *
4
+ * 基于三层 Token 体系:
5
+ * - Tier 1 (Global): 全局基础值
6
+ * - Tier 2 (Semantic): 语义化映射
7
+ * - Tier 3 (Component): 组件专用 Token
8
+ *
9
+ * 完全还原 Figma 设计稿规范
10
+ */
11
+ export declare const tagVariants: readonly ["default", "checkable"];
12
+ export declare const tagSizes: readonly ["sm", "md", "lg"];
13
+ export declare const tagColors: readonly ["default", "red", "orange", "yellow", "green", "lavender", "lilac", "carmine", "rose", "mint", "olive", "blue"];
14
+ export type TagVariant = (typeof tagVariants)[number];
15
+ export type TagSize = (typeof tagSizes)[number];
16
+ export type TagColor = (typeof tagColors)[number];
17
+ /**
18
+ * Tag 根元素
19
+ *
20
+ * 特性:
21
+ * - 基于三层 Token 设计
22
+ * - 支持多种颜色和变体
23
+ * - 完整的交互状态(hover, active, disabled)
24
+ * - 支持边框和无边框模式
25
+ */
26
+ export declare const TagRoot: import("@emotion/styled").StyledComponent<{
27
+ theme?: import("@emotion/react").Theme;
28
+ as?: React.ElementType;
29
+ } & {
30
+ variant: TagVariant;
31
+ size: TagSize;
32
+ color: TagColor;
33
+ bordered: boolean;
34
+ checked: boolean;
35
+ closable: boolean;
36
+ isDisabled: boolean;
37
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
38
+ /**
39
+ * Tag 内容容器
40
+ *
41
+ * 用于布局图标和文本
42
+ */
43
+ export declare const TagContent: import("@emotion/styled").StyledComponent<{
44
+ theme?: import("@emotion/react").Theme;
45
+ as?: React.ElementType;
46
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
47
+ /**
48
+ * 图标包装器
49
+ *
50
+ * 特性:
51
+ * - 保持布局稳定
52
+ * - 支持前置图标
53
+ */
54
+ export declare const IconWrapper: import("@emotion/styled").StyledComponent<{
55
+ theme?: import("@emotion/react").Theme;
56
+ as?: React.ElementType;
57
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
58
+ /**
59
+ * 关闭按钮
60
+ *
61
+ * 使用 span 而非 button,避免在 Select 等组件中嵌套 button 导致的 HTML 错误
62
+ *
63
+ * 特性:
64
+ * - 独立的交互区域
65
+ * - hover 时显示反馈
66
+ */
67
+ export declare const CloseButton: import("@emotion/styled").StyledComponent<{
68
+ theme?: import("@emotion/react").Theme;
69
+ as?: React.ElementType;
70
+ } & {
71
+ size: TagSize;
72
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
73
+ /**
74
+ * 添加按钮(New Tag)
75
+ *
76
+ * 专门用于添加新标签的按钮样式
77
+ */
78
+ export declare const AddButton: import("@emotion/styled").StyledComponent<{
79
+ theme?: import("@emotion/react").Theme;
80
+ as?: React.ElementType;
81
+ } & {
82
+ size: TagSize;
83
+ }, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;