@kingsoft-ai/design 0.1.12 → 0.1.14
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 +1338 -1035
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +7352 -6503
- package/dist/index.mjs.map +1 -1
- package/dist/types/DesignThemeProvider.d.ts +27 -5
- package/dist/types/card/Card.d.ts +34 -0
- package/dist/types/card/Card.style.d.ts +46 -0
- package/dist/types/card/index.d.ts +2 -0
- package/dist/types/card/tokens.d.ts +3 -0
- package/dist/types/floatButton/FloatButton.d.ts +57 -0
- package/dist/types/floatButton/FloatButton.style.d.ts +74 -0
- package/dist/types/floatButton/__tests__/FloatButton.test.d.ts +4 -0
- package/dist/types/floatButton/index.d.ts +4 -0
- package/dist/types/floatButton/tokens.d.ts +3 -0
- package/dist/types/index.d.ts +5 -1
- package/dist/types/menu/SubMenuPopover.d.ts +1 -1
- package/dist/types/modal/Modal.d.ts +57 -72
- package/dist/types/modal/Modal.style.d.ts +10 -96
- package/dist/types/modal/__tests__/Modal.test.d.ts +1 -0
- package/dist/types/modal/index.d.ts +1 -3
- package/dist/types/tooltip/Tooltip.d.ts +84 -0
- package/dist/types/tooltip/Tooltip.style.d.ts +24 -0
- package/dist/types/tooltip/index.d.ts +2 -0
- package/dist/types/tooltip/tokens.d.ts +11 -0
- package/dist/types/transfer/Transfer.d.ts +117 -0
- package/dist/types/transfer/Transfer.style.d.ts +95 -0
- package/dist/types/transfer/index.d.ts +2 -0
- package/dist/types/transfer/tokens.d.ts +3 -0
- package/dist/types/types/component-tokens.types.d.ts +197 -0
- package/dist/types/types/index.d.ts +6 -0
- package/dist/types/types/theme-utils.d.ts +7 -0
- package/package.json +10 -3
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tooltip 文字提示组件
|
|
3
|
+
*
|
|
4
|
+
* 基于 react-aria 实现无障碍访问的提示组件
|
|
5
|
+
* 支持 hover/focus 触发,自定义位置与延迟
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <Tooltip content="提示内容">
|
|
10
|
+
* <Button>悬停查看</Button>
|
|
11
|
+
* </Tooltip>
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
import { type ReactNode, type ReactElement, type CSSProperties } from 'react';
|
|
15
|
+
import { type TooltipPlacement } from './Tooltip.style';
|
|
16
|
+
export type { TooltipPlacement };
|
|
17
|
+
export type TooltipProps = {
|
|
18
|
+
/**
|
|
19
|
+
* 触发 Tooltip 的子元素
|
|
20
|
+
* 必须是可接受 ref 的单一 React 元素
|
|
21
|
+
*/
|
|
22
|
+
children: ReactElement;
|
|
23
|
+
/**
|
|
24
|
+
* Tooltip 显示的内容
|
|
25
|
+
*/
|
|
26
|
+
content: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* 弹出位置
|
|
29
|
+
* @default 'top'
|
|
30
|
+
*/
|
|
31
|
+
placement?: TooltipPlacement;
|
|
32
|
+
/**
|
|
33
|
+
* 距离触发元素的偏移量 (px)
|
|
34
|
+
* @default 8
|
|
35
|
+
*/
|
|
36
|
+
offset?: number;
|
|
37
|
+
/**
|
|
38
|
+
* 打开延迟(毫秒)
|
|
39
|
+
* @default 0
|
|
40
|
+
*/
|
|
41
|
+
delay?: number;
|
|
42
|
+
/**
|
|
43
|
+
* 关闭延迟(毫秒)
|
|
44
|
+
* @default 0
|
|
45
|
+
*/
|
|
46
|
+
closeDelay?: number;
|
|
47
|
+
/**
|
|
48
|
+
* 是否禁用 Tooltip(统一 API,优先级高于 isDisabled)
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* 是否显示箭头
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
showArrow?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* 受控:是否打开(替代 isOpen,符合 Design System 规范)
|
|
59
|
+
*/
|
|
60
|
+
open?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* 非受控:默认是否打开
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
defaultOpen?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* 打开状态变更回调
|
|
68
|
+
*/
|
|
69
|
+
onOpenChange?: (open: boolean) => void;
|
|
70
|
+
/**
|
|
71
|
+
* 自定义类名
|
|
72
|
+
*/
|
|
73
|
+
className?: string;
|
|
74
|
+
/**
|
|
75
|
+
* 自定义样式
|
|
76
|
+
*/
|
|
77
|
+
style?: CSSProperties;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Tooltip 文字提示组件
|
|
81
|
+
*
|
|
82
|
+
* 基于 React Aria 实现的无障碍提示组件
|
|
83
|
+
*/
|
|
84
|
+
export declare const Tooltip: import("react").ForwardRefExoticComponent<TooltipProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tooltip 样式
|
|
3
|
+
*
|
|
4
|
+
* 设计目标:
|
|
5
|
+
* - 轻盈、极简的提示框
|
|
6
|
+
* - 支持四个方向的箭头
|
|
7
|
+
* - 流畅的进入/退出动画
|
|
8
|
+
*/
|
|
9
|
+
export type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right';
|
|
10
|
+
interface TooltipContainerProps {
|
|
11
|
+
placement: TooltipPlacement;
|
|
12
|
+
}
|
|
13
|
+
export declare const TooltipContainer: import("@emotion/styled").StyledComponent<{
|
|
14
|
+
theme?: import("@emotion/react").Theme;
|
|
15
|
+
as?: React.ElementType;
|
|
16
|
+
} & TooltipContainerProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
17
|
+
interface TooltipArrowProps {
|
|
18
|
+
placement: TooltipPlacement;
|
|
19
|
+
}
|
|
20
|
+
export declare const TooltipArrow: import("@emotion/styled").StyledComponent<{
|
|
21
|
+
theme?: import("@emotion/react").Theme;
|
|
22
|
+
as?: React.ElementType;
|
|
23
|
+
} & TooltipArrowProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tooltip 组件 Token
|
|
3
|
+
*
|
|
4
|
+
* 基于三层 Token 体系:
|
|
5
|
+
* - Tier 1 (Global): 全局基础值
|
|
6
|
+
* - Tier 2 (Semantic): 语义化映射
|
|
7
|
+
* - Tier 3 (Component): 组件专用 Token
|
|
8
|
+
*/
|
|
9
|
+
import { TokenGenerator } from '../types/theme-utils';
|
|
10
|
+
import { TooltipTokens } from '../types/component-tokens.types';
|
|
11
|
+
export declare const getTooltipTokens: TokenGenerator<TooltipTokens>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transfer 穿梭框组件
|
|
3
|
+
*
|
|
4
|
+
* 基于 react-aria 实现无障碍访问的穿梭框组件
|
|
5
|
+
* 支持搜索、全选、自定义渲染等功能
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const dataSource = [
|
|
10
|
+
* { key: '1', title: '选项1', description: '描述1' },
|
|
11
|
+
* { key: '2', title: '选项2' },
|
|
12
|
+
* ];
|
|
13
|
+
*
|
|
14
|
+
* <Transfer
|
|
15
|
+
* dataSource={dataSource}
|
|
16
|
+
* targetKeys={['1']}
|
|
17
|
+
* onChange={(keys) => console.log(keys)}
|
|
18
|
+
* />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
import React from 'react';
|
|
22
|
+
export interface TransferItem {
|
|
23
|
+
/** 唯一标识 */
|
|
24
|
+
key: string;
|
|
25
|
+
/** 标题 */
|
|
26
|
+
title: React.ReactNode;
|
|
27
|
+
/** 描述 */
|
|
28
|
+
description?: React.ReactNode;
|
|
29
|
+
/** 是否禁用 */
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/** 其他自定义数据 */
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
}
|
|
34
|
+
export interface TransferHeaderProps {
|
|
35
|
+
/** 方向 */
|
|
36
|
+
direction: 'left' | 'right';
|
|
37
|
+
/** 已选中数量 */
|
|
38
|
+
selectedCount: number;
|
|
39
|
+
/** 总数量 */
|
|
40
|
+
totalCount: number;
|
|
41
|
+
/** 选中的keys */
|
|
42
|
+
selectedKeys: Set<string>;
|
|
43
|
+
/** 全选回调 */
|
|
44
|
+
onSelectAll: (checked: boolean) => void;
|
|
45
|
+
/** 标题 */
|
|
46
|
+
title?: React.ReactNode;
|
|
47
|
+
/** 是否显示全选 */
|
|
48
|
+
showSelectAll: boolean;
|
|
49
|
+
/** 是否禁用 */
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
/** 清空所有选中项回调 */
|
|
52
|
+
onClearAll?: () => void;
|
|
53
|
+
/** 清空模式:'selected' | 'all' */
|
|
54
|
+
clearMode?: 'selected' | 'all';
|
|
55
|
+
}
|
|
56
|
+
export interface TransferActions {
|
|
57
|
+
/** 左侧操作按钮,支持静态元素或动态函数 */
|
|
58
|
+
left?: React.ReactNode | ((selectedKeys: string[]) => React.ReactNode);
|
|
59
|
+
/** 右侧操作按钮,支持静态元素或动态函数 */
|
|
60
|
+
right?: React.ReactNode | ((selectedKeys: string[]) => React.ReactNode);
|
|
61
|
+
}
|
|
62
|
+
export interface TransferProps {
|
|
63
|
+
/** 数据源 */
|
|
64
|
+
dataSource: TransferItem[];
|
|
65
|
+
/** 目标框数据的 key 集合 */
|
|
66
|
+
targetKeys?: string[];
|
|
67
|
+
/** 默认目标框数据的 key 集合 */
|
|
68
|
+
defaultTargetKeys?: string[];
|
|
69
|
+
/** 选中项变化的回调 */
|
|
70
|
+
onChange?: (targetKeys: string[], direction: 'left' | 'right', moveKeys: string[]) => void;
|
|
71
|
+
/** 源框标题 */
|
|
72
|
+
titles?: [React.ReactNode, React.ReactNode];
|
|
73
|
+
/** 是否显示搜索框 */
|
|
74
|
+
showSearch?: boolean;
|
|
75
|
+
/** 搜索框占位符 */
|
|
76
|
+
searchPlaceholder?: [string, string];
|
|
77
|
+
/** 自定义过滤方法 */
|
|
78
|
+
filterOption?: (inputValue: string, item: TransferItem) => boolean;
|
|
79
|
+
/** 自定义渲染每一项 */
|
|
80
|
+
render?: (item: TransferItem) => React.ReactNode;
|
|
81
|
+
/** 是否禁用 */
|
|
82
|
+
disabled?: boolean;
|
|
83
|
+
/** 自定义类名 */
|
|
84
|
+
className?: string;
|
|
85
|
+
/** 自定义样式 */
|
|
86
|
+
style?: React.CSSProperties;
|
|
87
|
+
/** 操作按钮文本 */
|
|
88
|
+
operations?: [React.ReactNode, React.ReactNode];
|
|
89
|
+
/** 是否显示全选 */
|
|
90
|
+
showSelectAll?: boolean;
|
|
91
|
+
/** 底部渲染函数 */
|
|
92
|
+
footer?: (props: {
|
|
93
|
+
direction: 'left' | 'right';
|
|
94
|
+
}) => React.ReactNode;
|
|
95
|
+
/** 列表为空时显示的内容 */
|
|
96
|
+
locale?: {
|
|
97
|
+
itemUnit?: string;
|
|
98
|
+
itemsUnit?: string;
|
|
99
|
+
notFoundContent?: React.ReactNode;
|
|
100
|
+
searchPlaceholder?: string;
|
|
101
|
+
};
|
|
102
|
+
/** 自定义头部渲染 */
|
|
103
|
+
header?: (props: TransferHeaderProps) => React.ReactNode;
|
|
104
|
+
/** 单向模式 */
|
|
105
|
+
oneWay?: boolean;
|
|
106
|
+
/** 自定义操作按钮 */
|
|
107
|
+
actions?: React.ReactNode[] | TransferActions;
|
|
108
|
+
/** 使用分页样式,自定义渲染列表下无效 */
|
|
109
|
+
pagination?: boolean | {
|
|
110
|
+
pageSize?: number;
|
|
111
|
+
showSizeChanger?: boolean;
|
|
112
|
+
pageSizeOptions?: number[];
|
|
113
|
+
showPageInfo?: boolean;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
export declare const Transfer: React.FC<TransferProps>;
|
|
117
|
+
export default Transfer;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transfer 样式组件
|
|
3
|
+
*
|
|
4
|
+
* 基于三层 Token 体系
|
|
5
|
+
*/
|
|
6
|
+
export declare const TransferRoot: import("@emotion/styled").StyledComponent<{
|
|
7
|
+
theme?: import("@emotion/react").Theme;
|
|
8
|
+
as?: React.ElementType;
|
|
9
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
10
|
+
export declare const TransferPanel: import("@emotion/styled").StyledComponent<{
|
|
11
|
+
theme?: import("@emotion/react").Theme;
|
|
12
|
+
as?: React.ElementType;
|
|
13
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
14
|
+
export declare const TransferHeader: import("@emotion/styled").StyledComponent<{
|
|
15
|
+
theme?: import("@emotion/react").Theme;
|
|
16
|
+
as?: React.ElementType;
|
|
17
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
18
|
+
export declare const TransferTitle: import("@emotion/styled").StyledComponent<{
|
|
19
|
+
theme?: import("@emotion/react").Theme;
|
|
20
|
+
as?: React.ElementType;
|
|
21
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
22
|
+
export declare const TransferCount: import("@emotion/styled").StyledComponent<{
|
|
23
|
+
theme?: import("@emotion/react").Theme;
|
|
24
|
+
as?: React.ElementType;
|
|
25
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
26
|
+
export declare const TransferSearchWrapper: import("@emotion/styled").StyledComponent<{
|
|
27
|
+
theme?: import("@emotion/react").Theme;
|
|
28
|
+
as?: React.ElementType;
|
|
29
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
30
|
+
export declare const TransferList: import("@emotion/styled").StyledComponent<{
|
|
31
|
+
theme?: import("@emotion/react").Theme;
|
|
32
|
+
as?: React.ElementType;
|
|
33
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
34
|
+
export declare const TransferItem: import("@emotion/styled").StyledComponent<{
|
|
35
|
+
theme?: import("@emotion/react").Theme;
|
|
36
|
+
as?: React.ElementType;
|
|
37
|
+
} & {
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
selected?: boolean;
|
|
40
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
41
|
+
export declare const TransferItemLabel: import("@emotion/styled").StyledComponent<{
|
|
42
|
+
theme?: import("@emotion/react").Theme;
|
|
43
|
+
as?: React.ElementType;
|
|
44
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
45
|
+
export declare const TransferItemContent: import("@emotion/styled").StyledComponent<{
|
|
46
|
+
theme?: import("@emotion/react").Theme;
|
|
47
|
+
as?: React.ElementType;
|
|
48
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
49
|
+
export declare const TransferItemDeleteButton: import("@emotion/styled").StyledComponent<{
|
|
50
|
+
theme?: import("@emotion/react").Theme;
|
|
51
|
+
as?: React.ElementType;
|
|
52
|
+
} & {
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
}, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
55
|
+
export declare const TransferOperations: import("@emotion/styled").StyledComponent<{
|
|
56
|
+
theme?: import("@emotion/react").Theme;
|
|
57
|
+
as?: React.ElementType;
|
|
58
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
59
|
+
export declare const TransferOperationButton: import("@emotion/styled").StyledComponent<{
|
|
60
|
+
theme?: import("@emotion/react").Theme;
|
|
61
|
+
as?: React.ElementType;
|
|
62
|
+
} & {
|
|
63
|
+
disabled?: boolean;
|
|
64
|
+
active?: boolean;
|
|
65
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
66
|
+
export declare const TransferFooter: import("@emotion/styled").StyledComponent<{
|
|
67
|
+
theme?: import("@emotion/react").Theme;
|
|
68
|
+
as?: React.ElementType;
|
|
69
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
70
|
+
export declare const TransferEmpty: import("@emotion/styled").StyledComponent<{
|
|
71
|
+
theme?: import("@emotion/react").Theme;
|
|
72
|
+
as?: React.ElementType;
|
|
73
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
74
|
+
export declare const TransferPagination: import("@emotion/styled").StyledComponent<{
|
|
75
|
+
theme?: import("@emotion/react").Theme;
|
|
76
|
+
as?: React.ElementType;
|
|
77
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
78
|
+
export declare const TransferPaginationInfo: import("@emotion/styled").StyledComponent<{
|
|
79
|
+
theme?: import("@emotion/react").Theme;
|
|
80
|
+
as?: React.ElementType;
|
|
81
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
82
|
+
export declare const TransferPaginationControls: import("@emotion/styled").StyledComponent<{
|
|
83
|
+
theme?: import("@emotion/react").Theme;
|
|
84
|
+
as?: React.ElementType;
|
|
85
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
86
|
+
export declare const TransferPaginationButton: import("@emotion/styled").StyledComponent<{
|
|
87
|
+
theme?: import("@emotion/react").Theme;
|
|
88
|
+
as?: React.ElementType;
|
|
89
|
+
} & {
|
|
90
|
+
disabled?: boolean;
|
|
91
|
+
}, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
92
|
+
export declare const TransferPageSizeSelector: import("@emotion/styled").StyledComponent<{
|
|
93
|
+
theme?: import("@emotion/react").Theme;
|
|
94
|
+
as?: React.ElementType;
|
|
95
|
+
}, import("react").DetailedHTMLProps<import("react").SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>, {}>;
|
|
@@ -123,6 +123,69 @@ export interface ButtonTokens {
|
|
|
123
123
|
gap: string;
|
|
124
124
|
transition: string;
|
|
125
125
|
}
|
|
126
|
+
export interface FloatButtonTokens {
|
|
127
|
+
default: {
|
|
128
|
+
background: {
|
|
129
|
+
default: string;
|
|
130
|
+
hover: string;
|
|
131
|
+
active: string;
|
|
132
|
+
};
|
|
133
|
+
text: {
|
|
134
|
+
default: string;
|
|
135
|
+
};
|
|
136
|
+
border: {
|
|
137
|
+
default: string;
|
|
138
|
+
};
|
|
139
|
+
shadow: {
|
|
140
|
+
default: string;
|
|
141
|
+
hover: string;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
primary: {
|
|
145
|
+
background: {
|
|
146
|
+
default: string;
|
|
147
|
+
hover: string;
|
|
148
|
+
active: string;
|
|
149
|
+
};
|
|
150
|
+
text: {
|
|
151
|
+
default: string;
|
|
152
|
+
};
|
|
153
|
+
border: {
|
|
154
|
+
default: string;
|
|
155
|
+
};
|
|
156
|
+
shadow: {
|
|
157
|
+
default: string;
|
|
158
|
+
hover: string;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
disabled: {
|
|
162
|
+
background: {
|
|
163
|
+
default: string;
|
|
164
|
+
};
|
|
165
|
+
text: {
|
|
166
|
+
default: string;
|
|
167
|
+
};
|
|
168
|
+
opacity: number;
|
|
169
|
+
};
|
|
170
|
+
size: {
|
|
171
|
+
sm: {
|
|
172
|
+
size: string;
|
|
173
|
+
};
|
|
174
|
+
md: {
|
|
175
|
+
size: string;
|
|
176
|
+
};
|
|
177
|
+
lg: {
|
|
178
|
+
size: string;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
icon: {
|
|
182
|
+
size: string;
|
|
183
|
+
};
|
|
184
|
+
description: {
|
|
185
|
+
fontSize: string;
|
|
186
|
+
lineHeight: string;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
126
189
|
type IconButtonStateTokens = {
|
|
127
190
|
background: {
|
|
128
191
|
default: string;
|
|
@@ -782,6 +845,73 @@ interface LinkStateTokens {
|
|
|
782
845
|
hover: string;
|
|
783
846
|
};
|
|
784
847
|
}
|
|
848
|
+
export interface TransferTokens {
|
|
849
|
+
container: {
|
|
850
|
+
gap: string;
|
|
851
|
+
};
|
|
852
|
+
panel: {
|
|
853
|
+
width: string;
|
|
854
|
+
height: string;
|
|
855
|
+
background: string;
|
|
856
|
+
border: string;
|
|
857
|
+
borderRadius: string;
|
|
858
|
+
};
|
|
859
|
+
header: {
|
|
860
|
+
height: string;
|
|
861
|
+
padding: string;
|
|
862
|
+
fontSize: string;
|
|
863
|
+
color: string;
|
|
864
|
+
background: string;
|
|
865
|
+
};
|
|
866
|
+
list: {
|
|
867
|
+
height: string;
|
|
868
|
+
gap: string;
|
|
869
|
+
padding: string;
|
|
870
|
+
};
|
|
871
|
+
item: {
|
|
872
|
+
height: string;
|
|
873
|
+
padding: string;
|
|
874
|
+
fontSize: string;
|
|
875
|
+
borderRadius: string;
|
|
876
|
+
gap: string;
|
|
877
|
+
text: {
|
|
878
|
+
default: string;
|
|
879
|
+
selected: string;
|
|
880
|
+
disabled: string;
|
|
881
|
+
};
|
|
882
|
+
checkboxSize: string;
|
|
883
|
+
};
|
|
884
|
+
operations: {
|
|
885
|
+
gap: string;
|
|
886
|
+
borderRadius: string;
|
|
887
|
+
borderColor: {
|
|
888
|
+
default: string;
|
|
889
|
+
disabled: string;
|
|
890
|
+
active: string;
|
|
891
|
+
};
|
|
892
|
+
width: string;
|
|
893
|
+
height: string;
|
|
894
|
+
iconSize: string;
|
|
895
|
+
iconColor: {
|
|
896
|
+
default: string;
|
|
897
|
+
disabled: string;
|
|
898
|
+
active: string;
|
|
899
|
+
};
|
|
900
|
+
};
|
|
901
|
+
footer: {
|
|
902
|
+
height: string;
|
|
903
|
+
paddingInline: string;
|
|
904
|
+
fontSize: string;
|
|
905
|
+
color: string;
|
|
906
|
+
borderTop: string;
|
|
907
|
+
marginTop: string;
|
|
908
|
+
};
|
|
909
|
+
empty: {
|
|
910
|
+
color: string;
|
|
911
|
+
fontSize: string;
|
|
912
|
+
};
|
|
913
|
+
transition: string;
|
|
914
|
+
}
|
|
785
915
|
export interface ModalTokens {
|
|
786
916
|
size: {
|
|
787
917
|
sm: {
|
|
@@ -886,8 +1016,72 @@ export interface ModalTokens {
|
|
|
886
1016
|
};
|
|
887
1017
|
transition: string;
|
|
888
1018
|
}
|
|
1019
|
+
export interface CardTokens {
|
|
1020
|
+
container: {
|
|
1021
|
+
background: {
|
|
1022
|
+
default: string;
|
|
1023
|
+
};
|
|
1024
|
+
border: {
|
|
1025
|
+
default: string;
|
|
1026
|
+
hover: string;
|
|
1027
|
+
};
|
|
1028
|
+
shadow: {
|
|
1029
|
+
elevated: string;
|
|
1030
|
+
elevatedHover: string;
|
|
1031
|
+
outlined: string;
|
|
1032
|
+
filled: string;
|
|
1033
|
+
};
|
|
1034
|
+
radius: string;
|
|
1035
|
+
transition: string;
|
|
1036
|
+
};
|
|
1037
|
+
padding: {
|
|
1038
|
+
sm: string;
|
|
1039
|
+
md: string;
|
|
1040
|
+
lg: string;
|
|
1041
|
+
};
|
|
1042
|
+
header: {
|
|
1043
|
+
padding: string;
|
|
1044
|
+
borderBottom: string;
|
|
1045
|
+
title: {
|
|
1046
|
+
color: string;
|
|
1047
|
+
fontSize: string;
|
|
1048
|
+
fontWeight: number;
|
|
1049
|
+
};
|
|
1050
|
+
extra: {
|
|
1051
|
+
color: string;
|
|
1052
|
+
fontSize: string;
|
|
1053
|
+
};
|
|
1054
|
+
};
|
|
1055
|
+
cover: {
|
|
1056
|
+
radius: string;
|
|
1057
|
+
};
|
|
1058
|
+
footer: {
|
|
1059
|
+
padding: string;
|
|
1060
|
+
background: string;
|
|
1061
|
+
borderTop: string;
|
|
1062
|
+
};
|
|
1063
|
+
}
|
|
1064
|
+
export interface TooltipTokens {
|
|
1065
|
+
background: string;
|
|
1066
|
+
color: string;
|
|
1067
|
+
borderRadius: string;
|
|
1068
|
+
boxShadow: string;
|
|
1069
|
+
padding: string;
|
|
1070
|
+
maxWidth: string;
|
|
1071
|
+
fontSize: string;
|
|
1072
|
+
lineHeight: string;
|
|
1073
|
+
arrow: {
|
|
1074
|
+
size: string;
|
|
1075
|
+
};
|
|
1076
|
+
animation: {
|
|
1077
|
+
duration: string;
|
|
1078
|
+
easing: string;
|
|
1079
|
+
};
|
|
1080
|
+
zIndex: number;
|
|
1081
|
+
}
|
|
889
1082
|
export interface ComponentTokens {
|
|
890
1083
|
button: ButtonTokens;
|
|
1084
|
+
floatButton: FloatButtonTokens;
|
|
891
1085
|
iconButton: IconButtonTokens;
|
|
892
1086
|
checkbox: CheckboxTokens;
|
|
893
1087
|
radio: RadioTokens;
|
|
@@ -901,6 +1095,9 @@ export interface ComponentTokens {
|
|
|
901
1095
|
numberfield: NumberFieldTokens;
|
|
902
1096
|
menu: MenuTokens;
|
|
903
1097
|
link: LinkTokens;
|
|
1098
|
+
transfer: TransferTokens;
|
|
904
1099
|
modal: ModalTokens;
|
|
1100
|
+
card: CardTokens;
|
|
1101
|
+
tooltip: TooltipTokens;
|
|
905
1102
|
}
|
|
906
1103
|
export {};
|
|
@@ -18,3 +18,10 @@ export interface ThemeContext {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
export type TokenGenerator<T> = (context: ThemeContext) => T;
|
|
21
|
+
/**
|
|
22
|
+
* 深度 Partial 类型
|
|
23
|
+
* 将对象的所有属性(包括嵌套属性)设置为可选
|
|
24
|
+
*/
|
|
25
|
+
export type DeepPartial<T> = T extends object ? {
|
|
26
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
27
|
+
} : T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kingsoft-ai/design",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -20,12 +20,17 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
+
"@react-aria/tooltip": "^3.9.0",
|
|
23
24
|
"@react-stately/collections": "^3.12.8",
|
|
24
25
|
"@react-stately/list": "^3.13.1",
|
|
25
26
|
"@react-stately/select": "^3.8.0",
|
|
27
|
+
"@react-stately/tooltip": "^3.5.9",
|
|
28
|
+
"@react-types/overlays": "^3.9.2",
|
|
26
29
|
"@react-types/shared": "^3.32.1",
|
|
27
|
-
"@
|
|
28
|
-
"
|
|
30
|
+
"@react-types/tooltip": "^3.5.0",
|
|
31
|
+
"deepmerge": "^4.3.1",
|
|
32
|
+
"@kingsoft-ai/icons": "^0.1.6",
|
|
33
|
+
"@kingsoft-ai/theme": "^0.1.7"
|
|
29
34
|
},
|
|
30
35
|
"peerDependencies": {
|
|
31
36
|
"@emotion/react": ">=11",
|
|
@@ -46,7 +51,9 @@
|
|
|
46
51
|
"@testing-library/jest-dom": "^6.6.3",
|
|
47
52
|
"@testing-library/react": "^16.1.0",
|
|
48
53
|
"@testing-library/user-event": "^14.5.2",
|
|
54
|
+
"@types/deepmerge": "^2.2.3",
|
|
49
55
|
"@types/react": "^19.1.13",
|
|
56
|
+
"@types/react-dom": "^19.1.13",
|
|
50
57
|
"@vitejs/plugin-react": "^5.0.3",
|
|
51
58
|
"@vitest/coverage-v8": "^2.1.8",
|
|
52
59
|
"@vitest/ui": "^2.1.8",
|