@kingsoft-ai/design 0.1.11 → 0.1.13
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 +1400 -691
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +7764 -4683
- package/dist/index.mjs.map +1 -1
- package/dist/types/DesignThemeProvider.d.ts +27 -5
- package/dist/types/button/Button.d.ts +4 -0
- 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 +7 -1
- package/dist/types/link/Link.d.ts +35 -0
- package/dist/types/link/Link.style.d.ts +9 -0
- package/dist/types/link/index.d.ts +3 -0
- package/dist/types/link/tokens.d.ts +3 -0
- package/dist/types/menu/SubMenuPopover.d.ts +1 -1
- package/dist/types/modal/Modal.d.ts +63 -0
- package/dist/types/modal/Modal.style.d.ts +35 -0
- package/dist/types/modal/__tests__/Modal.test.d.ts +1 -0
- package/dist/types/modal/index.d.ts +2 -0
- package/dist/types/modal/tokens.d.ts +11 -0
- package/dist/types/numberInput/NumberInput.d.ts +11 -3
- package/dist/types/select/Select.d.ts +12 -6
- package/dist/types/switch/Switch.d.ts +8 -0
- package/dist/types/theme.d.ts +2 -1
- 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 +338 -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
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { ReactNode } from 'react';
|
|
8
8
|
import type { AppTheme } from '@kingsoft-ai/theme';
|
|
9
|
+
import type { DeepPartial } from './types/theme-utils';
|
|
9
10
|
export interface DesignThemeProviderProps {
|
|
10
11
|
/** 子组件 */
|
|
11
12
|
children: ReactNode;
|
|
@@ -16,9 +17,30 @@ export interface DesignThemeProviderProps {
|
|
|
16
17
|
mode?: 'light' | 'dark';
|
|
17
18
|
/**
|
|
18
19
|
* 自定义主题对象(可选)
|
|
19
|
-
*
|
|
20
|
+
*
|
|
21
|
+
* 支持部分配置,会自动与默认主题进行深度合并。
|
|
22
|
+
* 只需要提供你想要覆盖的部分即可。
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* // 只覆盖 card 组件的部分 token
|
|
27
|
+
* const customTheme = {
|
|
28
|
+
* components: {
|
|
29
|
+
* card: {
|
|
30
|
+
* container: {
|
|
31
|
+
* background: { default: '#F0F4FF' },
|
|
32
|
+
* radius: '24px',
|
|
33
|
+
* }
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* <DesignThemeProvider theme={customTheme}>
|
|
39
|
+
* <Card>自定义样式的卡片</Card>
|
|
40
|
+
* </DesignThemeProvider>
|
|
41
|
+
* ```
|
|
20
42
|
*/
|
|
21
|
-
theme?: AppTheme
|
|
43
|
+
theme?: DeepPartial<AppTheme>;
|
|
22
44
|
}
|
|
23
45
|
/**
|
|
24
46
|
* Design 组件主题提供者
|
|
@@ -35,9 +57,9 @@ export interface DesignThemeProviderProps {
|
|
|
35
57
|
* <Button>点击我</Button>
|
|
36
58
|
* </DesignThemeProvider>
|
|
37
59
|
*
|
|
38
|
-
* //
|
|
39
|
-
* <DesignThemeProvider theme={
|
|
40
|
-
* <
|
|
60
|
+
* // 使用部分自定义主题(自动与默认主题合并)
|
|
61
|
+
* <DesignThemeProvider theme={{ components: { card: { container: { radius: '24px' } } } }}>
|
|
62
|
+
* <Card>自定义圆角的卡片</Card>
|
|
41
63
|
* </DesignThemeProvider>
|
|
42
64
|
* ```
|
|
43
65
|
*/
|
|
@@ -27,6 +27,8 @@ export type ButtonProps = Omit<AriaButtonProps, 'elementType'> & {
|
|
|
27
27
|
loading?: boolean;
|
|
28
28
|
/** 全宽按钮 */
|
|
29
29
|
fullWidth?: boolean;
|
|
30
|
+
/** 是否禁用(统一 API,优先级高于 isDisabled) */
|
|
31
|
+
disabled?: boolean;
|
|
30
32
|
/** 自定义类名 */
|
|
31
33
|
className?: string;
|
|
32
34
|
/** 子元素 */
|
|
@@ -49,6 +51,8 @@ export declare const Button: import("react").ForwardRefExoticComponent<Omit<Aria
|
|
|
49
51
|
loading?: boolean;
|
|
50
52
|
/** 全宽按钮 */
|
|
51
53
|
fullWidth?: boolean;
|
|
54
|
+
/** 是否禁用(统一 API,优先级高于 isDisabled) */
|
|
55
|
+
disabled?: boolean;
|
|
52
56
|
/** 自定义类名 */
|
|
53
57
|
className?: string;
|
|
54
58
|
/** 子元素 */
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
export interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
3
|
+
/**
|
|
4
|
+
* Card title
|
|
5
|
+
*/
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Content to render in the top-right corner of the card
|
|
9
|
+
*/
|
|
10
|
+
extra?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Card cover image
|
|
13
|
+
*/
|
|
14
|
+
cover?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Card footer content
|
|
17
|
+
*/
|
|
18
|
+
footer?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Lift up when hovering card
|
|
21
|
+
*/
|
|
22
|
+
hoverable?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Card variant
|
|
25
|
+
* @default 'elevated'
|
|
26
|
+
*/
|
|
27
|
+
variant?: 'elevated' | 'outlined' | 'filled';
|
|
28
|
+
/**
|
|
29
|
+
* Custom padding for body
|
|
30
|
+
*/
|
|
31
|
+
bodyPadding?: string;
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { CardTokens } from '../types/component-tokens.types';
|
|
2
|
+
export declare const CardContainer: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme;
|
|
4
|
+
as?: React.ElementType;
|
|
5
|
+
} & {
|
|
6
|
+
tokens: CardTokens;
|
|
7
|
+
variant: "elevated" | "outlined" | "filled";
|
|
8
|
+
hoverable?: boolean;
|
|
9
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
10
|
+
export declare const CardHeader: import("@emotion/styled").StyledComponent<{
|
|
11
|
+
theme?: import("@emotion/react").Theme;
|
|
12
|
+
as?: React.ElementType;
|
|
13
|
+
} & {
|
|
14
|
+
tokens: CardTokens;
|
|
15
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
16
|
+
export declare const CardTitle: import("@emotion/styled").StyledComponent<{
|
|
17
|
+
theme?: import("@emotion/react").Theme;
|
|
18
|
+
as?: React.ElementType;
|
|
19
|
+
} & {
|
|
20
|
+
tokens: CardTokens;
|
|
21
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
22
|
+
export declare const CardExtra: import("@emotion/styled").StyledComponent<{
|
|
23
|
+
theme?: import("@emotion/react").Theme;
|
|
24
|
+
as?: React.ElementType;
|
|
25
|
+
} & {
|
|
26
|
+
tokens: CardTokens;
|
|
27
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
28
|
+
export declare const CardBody: import("@emotion/styled").StyledComponent<{
|
|
29
|
+
theme?: import("@emotion/react").Theme;
|
|
30
|
+
as?: React.ElementType;
|
|
31
|
+
} & {
|
|
32
|
+
tokens: CardTokens;
|
|
33
|
+
padding?: string;
|
|
34
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
35
|
+
export declare const CardCover: import("@emotion/styled").StyledComponent<{
|
|
36
|
+
theme?: import("@emotion/react").Theme;
|
|
37
|
+
as?: React.ElementType;
|
|
38
|
+
} & {
|
|
39
|
+
tokens: CardTokens;
|
|
40
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
41
|
+
export declare const CardFooter: import("@emotion/styled").StyledComponent<{
|
|
42
|
+
theme?: import("@emotion/react").Theme;
|
|
43
|
+
as?: React.ElementType;
|
|
44
|
+
} & {
|
|
45
|
+
tokens: CardTokens;
|
|
46
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
import type { ReactNode } from 'react';
|
|
17
|
+
import type { AriaButtonProps } from 'react-aria';
|
|
18
|
+
import { type FloatButtonType, type FloatButtonShape, type FloatButtonSize, type TooltipPlacement } from './FloatButton.style';
|
|
19
|
+
export type { TooltipPlacement };
|
|
20
|
+
export interface TooltipConfig {
|
|
21
|
+
/** Tooltip 标题 */
|
|
22
|
+
title?: ReactNode;
|
|
23
|
+
/** Tooltip 颜色 */
|
|
24
|
+
color?: string;
|
|
25
|
+
/** Tooltip 位置 */
|
|
26
|
+
placement?: TooltipPlacement;
|
|
27
|
+
}
|
|
28
|
+
export declare const TYPES: readonly ["default", "primary"];
|
|
29
|
+
export declare const SHAPES: readonly ["circle", "square"];
|
|
30
|
+
export declare const SIZES: readonly ["sm", "md", "lg"];
|
|
31
|
+
export interface FloatButtonProps extends Omit<AriaButtonProps, 'elementType'> {
|
|
32
|
+
/** 按钮类型 */
|
|
33
|
+
buttonType?: FloatButtonType;
|
|
34
|
+
/** 按钮形状 */
|
|
35
|
+
shape?: FloatButtonShape;
|
|
36
|
+
/** 按钮尺寸 */
|
|
37
|
+
size?: FloatButtonSize;
|
|
38
|
+
/** 图标 */
|
|
39
|
+
icon?: ReactNode;
|
|
40
|
+
/** 文字描述 */
|
|
41
|
+
description?: ReactNode;
|
|
42
|
+
/** 提示文字或配置 */
|
|
43
|
+
tooltip?: ReactNode | TooltipConfig;
|
|
44
|
+
/** 是否禁用 */
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
/** 自定义类名 */
|
|
47
|
+
className?: string;
|
|
48
|
+
/** 自定义样式 */
|
|
49
|
+
style?: React.CSSProperties;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* FloatButton 悬浮按钮组件
|
|
53
|
+
*
|
|
54
|
+
* 用于页面中的悬浮操作按钮,通常固定在页面特定位置
|
|
55
|
+
* 支持圆形和方形两种形状
|
|
56
|
+
*/
|
|
57
|
+
export declare const FloatButton: import("react").ForwardRefExoticComponent<FloatButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FloatButton 悬浮按钮样式
|
|
3
|
+
*
|
|
4
|
+
* 基于三层 Token 体系实现悬浮按钮样式
|
|
5
|
+
* 参考 antd FloatButton 设计规范
|
|
6
|
+
*/
|
|
7
|
+
export declare const floatButtonTypes: readonly ["default", "primary"];
|
|
8
|
+
export declare const floatButtonShapes: readonly ["circle", "square"];
|
|
9
|
+
export declare const floatButtonSizes: readonly ["sm", "md", "lg"];
|
|
10
|
+
export declare const tooltipPlacements: readonly ["top", "bottom", "left", "right"];
|
|
11
|
+
export type FloatButtonType = (typeof floatButtonTypes)[number];
|
|
12
|
+
export type FloatButtonShape = (typeof floatButtonShapes)[number];
|
|
13
|
+
export type FloatButtonSize = (typeof floatButtonSizes)[number];
|
|
14
|
+
export type TooltipPlacement = (typeof tooltipPlacements)[number];
|
|
15
|
+
/**
|
|
16
|
+
* 悬浮按钮根元素
|
|
17
|
+
*/
|
|
18
|
+
export declare const FloatButtonRoot: import("@emotion/styled").StyledComponent<{
|
|
19
|
+
theme?: import("@emotion/react").Theme;
|
|
20
|
+
as?: React.ElementType;
|
|
21
|
+
} & {
|
|
22
|
+
$buttonType: FloatButtonType;
|
|
23
|
+
$shape: FloatButtonShape;
|
|
24
|
+
$size: FloatButtonSize;
|
|
25
|
+
$isPressed: boolean;
|
|
26
|
+
}, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
27
|
+
/**
|
|
28
|
+
* 按钮内容容器
|
|
29
|
+
*/
|
|
30
|
+
export declare const FloatButtonContent: import("@emotion/styled").StyledComponent<{
|
|
31
|
+
theme?: import("@emotion/react").Theme;
|
|
32
|
+
as?: React.ElementType;
|
|
33
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
34
|
+
/**
|
|
35
|
+
* 图标包装器
|
|
36
|
+
*/
|
|
37
|
+
export declare const IconWrapper: import("@emotion/styled").StyledComponent<{
|
|
38
|
+
theme?: import("@emotion/react").Theme;
|
|
39
|
+
as?: React.ElementType;
|
|
40
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
41
|
+
/**
|
|
42
|
+
* 描述文字
|
|
43
|
+
*/
|
|
44
|
+
export declare const Description: import("@emotion/styled").StyledComponent<{
|
|
45
|
+
theme?: import("@emotion/react").Theme;
|
|
46
|
+
as?: React.ElementType;
|
|
47
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
48
|
+
/**
|
|
49
|
+
* Tooltip 包装器
|
|
50
|
+
*/
|
|
51
|
+
export declare const TooltipWrapper: import("@emotion/styled").StyledComponent<{
|
|
52
|
+
theme?: import("@emotion/react").Theme;
|
|
53
|
+
as?: React.ElementType;
|
|
54
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
55
|
+
/**
|
|
56
|
+
* Tooltip 卡片
|
|
57
|
+
*/
|
|
58
|
+
export declare const TooltipCard: import("@emotion/styled").StyledComponent<{
|
|
59
|
+
theme?: import("@emotion/react").Theme;
|
|
60
|
+
as?: React.ElementType;
|
|
61
|
+
} & {
|
|
62
|
+
$placement: TooltipPlacement;
|
|
63
|
+
$color?: string;
|
|
64
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
65
|
+
/**
|
|
66
|
+
* Tooltip 箭头
|
|
67
|
+
*/
|
|
68
|
+
export declare const TooltipArrow: import("@emotion/styled").StyledComponent<{
|
|
69
|
+
theme?: import("@emotion/react").Theme;
|
|
70
|
+
as?: React.ElementType;
|
|
71
|
+
} & {
|
|
72
|
+
$placement: TooltipPlacement;
|
|
73
|
+
$color?: string;
|
|
74
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export * from './button';
|
|
2
2
|
export * from './checkbox';
|
|
3
3
|
export * from './collapse';
|
|
4
|
+
export * from './floatButton';
|
|
4
5
|
export * from './input';
|
|
5
6
|
export * from './menu';
|
|
7
|
+
export * from './link';
|
|
8
|
+
export * from './modal';
|
|
6
9
|
export * from './numberInput';
|
|
7
10
|
export * from './radio';
|
|
8
11
|
export * from './skeleton';
|
|
@@ -12,9 +15,12 @@ export * from './select';
|
|
|
12
15
|
export * from './table';
|
|
13
16
|
export * from './switch';
|
|
14
17
|
export * from './tag';
|
|
18
|
+
export * from './transfer';
|
|
15
19
|
export * from './upload';
|
|
20
|
+
export * from './card';
|
|
21
|
+
export * from './tooltip';
|
|
16
22
|
export * from './theme';
|
|
17
|
-
export
|
|
23
|
+
export type { ThemeContext, TokenGenerator, DeepPartial } from './types/theme-utils';
|
|
18
24
|
export { DesignThemeProvider } from './DesignThemeProvider';
|
|
19
25
|
export type { DesignThemeProviderProps } from './DesignThemeProvider';
|
|
20
26
|
export { CustomThemeProvider, globalColors, globalSpacing, globalRadii, globalTypography, globalShadows, globalGradients, lightSemantic, darkSemantic, } from '@kingsoft-ai/theme';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { useLink } from 'react-aria';
|
|
3
|
+
import { type LinkVariant, type LinkSize } from './Link.style';
|
|
4
|
+
type UseLinkProps = Parameters<typeof useLink>[0];
|
|
5
|
+
export type LinkProps = UseLinkProps & {
|
|
6
|
+
/** 链接变体:primary (主色), neutral (中性色) */
|
|
7
|
+
variant?: LinkVariant;
|
|
8
|
+
/** 链接尺寸:sm (12px), md (14px), lg (16px) */
|
|
9
|
+
size?: LinkSize;
|
|
10
|
+
/** 是否禁用(统一 API,优先级高于 isDisabled) */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** 自定义类名 */
|
|
13
|
+
className?: string;
|
|
14
|
+
/** 子元素 */
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Link 文字链接组件
|
|
19
|
+
*
|
|
20
|
+
* 用于页面内的跳转或操作,支持多种状态和尺寸。
|
|
21
|
+
* 基于 react-aria useLink 实现无障碍访问。
|
|
22
|
+
*/
|
|
23
|
+
export declare const Link: import("react").ForwardRefExoticComponent<import("react-aria").AriaLinkOptions & {
|
|
24
|
+
/** 链接变体:primary (主色), neutral (中性色) */
|
|
25
|
+
variant?: LinkVariant;
|
|
26
|
+
/** 链接尺寸:sm (12px), md (14px), lg (16px) */
|
|
27
|
+
size?: LinkSize;
|
|
28
|
+
/** 是否禁用(统一 API,优先级高于 isDisabled) */
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/** 自定义类名 */
|
|
31
|
+
className?: string;
|
|
32
|
+
/** 子元素 */
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
} & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type LinkVariant = 'primary' | 'neutral';
|
|
2
|
+
export type LinkSize = 'sm' | 'md' | 'lg';
|
|
3
|
+
export declare const LinkRoot: import("@emotion/styled").StyledComponent<{
|
|
4
|
+
theme?: import("@emotion/react").Theme;
|
|
5
|
+
as?: React.ElementType;
|
|
6
|
+
} & {
|
|
7
|
+
variant: LinkVariant;
|
|
8
|
+
size: LinkSize;
|
|
9
|
+
}, import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, {}>;
|
|
@@ -24,6 +24,6 @@ export interface SubMenuPopoverProps {
|
|
|
24
24
|
* 在折叠状态下,鼠标悬浮一级菜单时展示二级菜单
|
|
25
25
|
*/
|
|
26
26
|
export declare const SubMenuPopover: {
|
|
27
|
-
({ visible, anchorRef, children, onClose, onMouseEnter, onMouseLeave, }: SubMenuPopoverProps):
|
|
27
|
+
({ visible, anchorRef, children, onClose, onMouseEnter, onMouseLeave, }: SubMenuPopoverProps): import("react").ReactPortal | null;
|
|
28
28
|
displayName: string;
|
|
29
29
|
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modal 弹窗组件(React Aria)
|
|
3
|
+
*
|
|
4
|
+
* - 受控:open + onOpenChange(所有关闭路径统一出口)
|
|
5
|
+
* - 基于 react-aria overlays/dialog:焦点管理、ESC、无障碍语义
|
|
6
|
+
* - 支持 portalContainer(微前端 / iframe / shadow dom)
|
|
7
|
+
* - 样式分层:overlay / dialog / close button 分别支持 className 与 style
|
|
8
|
+
*/
|
|
9
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
10
|
+
export type ModalProps = {
|
|
11
|
+
/** 是否展示 Modal */
|
|
12
|
+
open: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* open 状态变更回调
|
|
15
|
+
* 所有关闭路径(ESC / 遮罩 / 关闭按钮 / outside)统一出口
|
|
16
|
+
*/
|
|
17
|
+
onOpenChange: (open: boolean) => void;
|
|
18
|
+
/** 内容(完全自定义) */
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
/** 标题(用于默认头部与 aria 标注) */
|
|
21
|
+
title?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* 是否隐藏默认头部(标题 + 右上角关闭按钮)
|
|
24
|
+
* - true:不渲染默认 Header,你可以在 children 内完全自定义标题区与关闭按钮
|
|
25
|
+
* - false:按默认逻辑渲染(有 title 或可关闭时显示 Header)
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
hideHeader?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* 是否允许“用户主动关闭”
|
|
31
|
+
* - false:禁用 ESC/遮罩/close button/outside 关闭(只能由外部控制 open)
|
|
32
|
+
* - true:按各关闭开关控制
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
isDismissable?: boolean;
|
|
36
|
+
/** 是否允许 ESC 关闭(在 isDismissable=true 前提下生效)@default true */
|
|
37
|
+
closeOnEsc?: boolean;
|
|
38
|
+
/** 是否允许点击遮罩关闭(在 isDismissable=true 前提下生效)@default true */
|
|
39
|
+
closeOnOverlay?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* 是否允许点击外部关闭(在 isDismissable=true 前提下生效)
|
|
42
|
+
* 对应 react-aria shouldCloseOnInteractOutside
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
45
|
+
closeOnOutside?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* 外部点击白名单/黑名单
|
|
48
|
+
* 返回 true 表示允许触发关闭
|
|
49
|
+
*/
|
|
50
|
+
shouldCloseOnInteractOutside?: (element: Element) => boolean;
|
|
51
|
+
/** Portal 挂载容器,默认 document.body(SSR 环境下不回退) */
|
|
52
|
+
portalContainer?: Element;
|
|
53
|
+
/** overlay(遮罩层)样式分层 */
|
|
54
|
+
overlayClassName?: string;
|
|
55
|
+
overlayStyle?: CSSProperties;
|
|
56
|
+
/** dialog(弹层容器)样式分层 */
|
|
57
|
+
dialogClassName?: string;
|
|
58
|
+
dialogStyle?: CSSProperties;
|
|
59
|
+
/** close button 样式分层 */
|
|
60
|
+
closeButtonClassName?: string;
|
|
61
|
+
closeButtonStyle?: CSSProperties;
|
|
62
|
+
};
|
|
63
|
+
export declare const Modal: import("react").ForwardRefExoticComponent<ModalProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modal 样式(React Aria)
|
|
3
|
+
*
|
|
4
|
+
* 设计目标:
|
|
5
|
+
* - 轻盈、科技、极简阴影(避免厚重“Antd 弹窗”观感)
|
|
6
|
+
* - overlay / dialog / close button 三层明确分工
|
|
7
|
+
*/
|
|
8
|
+
export declare const ModalPortalRoot: import("@emotion/styled").StyledComponent<{
|
|
9
|
+
theme?: import("@emotion/react").Theme;
|
|
10
|
+
as?: React.ElementType;
|
|
11
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
12
|
+
export declare const ModalBackdrop: import("@emotion/styled").StyledComponent<{
|
|
13
|
+
theme?: import("@emotion/react").Theme;
|
|
14
|
+
as?: React.ElementType;
|
|
15
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
16
|
+
export declare const ModalDialog: import("@emotion/styled").StyledComponent<{
|
|
17
|
+
theme?: import("@emotion/react").Theme;
|
|
18
|
+
as?: React.ElementType;
|
|
19
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
20
|
+
export declare const ModalDialogHeader: import("@emotion/styled").StyledComponent<{
|
|
21
|
+
theme?: import("@emotion/react").Theme;
|
|
22
|
+
as?: React.ElementType;
|
|
23
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
|
|
24
|
+
export declare const ModalDialogTitle: import("@emotion/styled").StyledComponent<{
|
|
25
|
+
theme?: import("@emotion/react").Theme;
|
|
26
|
+
as?: React.ElementType;
|
|
27
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, {}>;
|
|
28
|
+
export declare const ModalCloseButton: import("@emotion/styled").StyledComponent<{
|
|
29
|
+
theme?: import("@emotion/react").Theme;
|
|
30
|
+
as?: React.ElementType;
|
|
31
|
+
}, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
32
|
+
export declare const ModalDialogBody: import("@emotion/styled").StyledComponent<{
|
|
33
|
+
theme?: import("@emotion/react").Theme;
|
|
34
|
+
as?: React.ElementType;
|
|
35
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modal 组件 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 { ModalTokens } from '../types/component-tokens.types';
|
|
11
|
+
export declare const getModalTokens: TokenGenerator<ModalTokens>;
|
|
@@ -35,8 +35,16 @@ export type NumberInputProps = {
|
|
|
35
35
|
controls?: 'buttons' | 'arrows';
|
|
36
36
|
/** 大小:'md' | 'lg' */
|
|
37
37
|
size?: 'md' | 'lg';
|
|
38
|
-
/**
|
|
39
|
-
|
|
38
|
+
/**
|
|
39
|
+
* 值变化回调(统一 API,推荐使用)
|
|
40
|
+
* 等同于其他表单组件的 onChange,返回 number | undefined
|
|
41
|
+
*/
|
|
42
|
+
onValueChange?: (value: number | undefined) => void;
|
|
43
|
+
/**
|
|
44
|
+
* 值变化回调别名(统一 API)
|
|
45
|
+
* 与 onValueChange 功能相同,提供与其他表单组件一致的 API 命名
|
|
46
|
+
*/
|
|
47
|
+
onChangeValue?: (value: number | undefined) => void;
|
|
40
48
|
/** 标签文本 */
|
|
41
49
|
label?: ReactNode;
|
|
42
50
|
/** 描述文本 */
|
|
@@ -51,7 +59,7 @@ export type NumberInputProps = {
|
|
|
51
59
|
className?: string;
|
|
52
60
|
/** 自定义 ID */
|
|
53
61
|
id?: string;
|
|
54
|
-
/** 原生 onChange
|
|
62
|
+
/** 原生 input onChange 事件(用于表单库等场景) */
|
|
55
63
|
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
56
64
|
};
|
|
57
65
|
/** 数字输入框组件 */
|
|
@@ -17,7 +17,7 @@ export interface SelectOptionType {
|
|
|
17
17
|
/** 是否禁用该选项 */
|
|
18
18
|
disabled?: boolean;
|
|
19
19
|
}
|
|
20
|
-
export interface SelectProps<T> extends Omit<AriaSelectProps<T>, 'errorMessage' | 'selectedKey' | 'defaultSelectedKey' | 'onSelectionChange' | 'selectionMode' | 'children' | 'isDisabled'> {
|
|
20
|
+
export interface SelectProps<T> extends Omit<AriaSelectProps<T>, 'errorMessage' | 'selectedKey' | 'defaultSelectedKey' | 'onSelectionChange' | 'selectionMode' | 'children' | 'isDisabled' | 'value' | 'defaultValue' | 'onChange'> {
|
|
21
21
|
/** 选择模式:single 单选 | multiple 多选 */
|
|
22
22
|
selectionMode?: SelectionMode;
|
|
23
23
|
/** 是否正在加载 */
|
|
@@ -40,15 +40,21 @@ export interface SelectProps<T> extends Omit<AriaSelectProps<T>, 'errorMessage'
|
|
|
40
40
|
errorMessage?: React.ReactNode;
|
|
41
41
|
/** 多选时最大展示的 Tag 数量 */
|
|
42
42
|
maxTagCount?: number;
|
|
43
|
-
/**
|
|
43
|
+
/** 受控值(统一 API,单选时为 Key,多选时为 Iterable<Key>,优先级高于 selectedKey/selectedKeys) */
|
|
44
|
+
value?: React.Key | null | Iterable<React.Key>;
|
|
45
|
+
/** 默认值(统一 API,单选时为 Key,多选时为 Iterable<Key>,优先级高于 defaultSelectedKey/defaultSelectedKeys) */
|
|
46
|
+
defaultValue?: React.Key | Iterable<React.Key>;
|
|
47
|
+
/** 值变化回调(统一 API,优先级高于 onSelectionChange) */
|
|
48
|
+
onChange?: (value: SelectionType) => void;
|
|
49
|
+
/** 单选时选中的 key(兼容旧 API) */
|
|
44
50
|
selectedKey?: React.Key | null;
|
|
45
|
-
/** 单选时默认选中的 key */
|
|
51
|
+
/** 单选时默认选中的 key(兼容旧 API) */
|
|
46
52
|
defaultSelectedKey?: React.Key;
|
|
47
|
-
/** 多选时选中的 keys */
|
|
53
|
+
/** 多选时选中的 keys(兼容旧 API) */
|
|
48
54
|
selectedKeys?: Iterable<React.Key>;
|
|
49
|
-
/** 多选时默认选中的 keys */
|
|
55
|
+
/** 多选时默认选中的 keys(兼容旧 API) */
|
|
50
56
|
defaultSelectedKeys?: Iterable<React.Key>;
|
|
51
|
-
/**
|
|
57
|
+
/** 选择变化回调(兼容旧 API,单选返回 key,多选返回 Set) */
|
|
52
58
|
onSelectionChange?: (keys: SelectionType) => void;
|
|
53
59
|
/**
|
|
54
60
|
* 选项数据(推荐使用)
|
|
@@ -41,6 +41,10 @@ export type SwitchProps = Omit<AriaSwitchProps, 'children' | 'isDisabled'> & Omi
|
|
|
41
41
|
uncheckedLabel?: string;
|
|
42
42
|
/** 是否禁用(替代 isDisabled) */
|
|
43
43
|
disabled?: boolean;
|
|
44
|
+
/** 受控值(统一 API,优先级高于 isSelected) */
|
|
45
|
+
value?: boolean;
|
|
46
|
+
/** 默认值(统一 API,优先级高于 defaultSelected) */
|
|
47
|
+
defaultValue?: boolean;
|
|
44
48
|
/** 外部描述性标签(显示在开关旁边) */
|
|
45
49
|
children?: ReactNode;
|
|
46
50
|
/** 自定义类名 */
|
|
@@ -61,6 +65,10 @@ export declare const Switch: import("react").ForwardRefExoticComponent<Omit<Aria
|
|
|
61
65
|
uncheckedLabel?: string;
|
|
62
66
|
/** 是否禁用(替代 isDisabled) */
|
|
63
67
|
disabled?: boolean;
|
|
68
|
+
/** 受控值(统一 API,优先级高于 isSelected) */
|
|
69
|
+
value?: boolean;
|
|
70
|
+
/** 默认值(统一 API,优先级高于 defaultSelected) */
|
|
71
|
+
defaultValue?: boolean;
|
|
64
72
|
/** 外部描述性标签(显示在开关旁边) */
|
|
65
73
|
children?: ReactNode;
|
|
66
74
|
/** 自定义类名 */
|
package/dist/types/theme.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AppTheme,
|
|
1
|
+
import { AppTheme, SemanticColors, SemanticSpacing, SemanticBorderRadius, SemanticTypography, SemanticShadows } from '@kingsoft-ai/theme';
|
|
2
2
|
import { ThemeContext } from './types/theme-utils';
|
|
3
|
+
import { ComponentTokens } from './types/component-tokens.types';
|
|
3
4
|
export declare const createComponentTokens: (context: ThemeContext) => ComponentTokens;
|
|
4
5
|
interface SemanticTheme {
|
|
5
6
|
colors: SemanticColors;
|