aha-components 1.7.6 → 1.7.8
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/Button.esm.js +1 -1
- package/dist/Button.esm.js.map +1 -1
- package/dist/Button.js +1 -1
- package/dist/Button.js.map +1 -1
- package/dist/Pagination.esm.js +1 -1
- package/dist/Pagination.esm.js.map +1 -1
- package/dist/Pagination.js +1 -1
- package/dist/Pagination.js.map +1 -1
- package/dist/Popover.esm.js +1 -1
- package/dist/Popover.esm.js.map +1 -1
- package/dist/Popover.js +1 -1
- package/dist/Popover.js.map +1 -1
- package/dist/Table.esm.js +1 -1
- package/dist/Table.esm.js.map +1 -1
- package/dist/Table.js +1 -1
- package/dist/Table.js.map +1 -1
- package/dist/components/Button/Button.stories.d.ts +15 -7
- package/dist/components/Button/index.d.ts +19 -15
- package/dist/components/Popover/index.d.ts +6 -0
- package/dist/index.d.ts +24 -15
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/stories/DesignTokens.stories.d.ts +5 -0
- package/dist/tokens.d.ts +1253 -0
- package/package.json +1 -1
|
@@ -3,12 +3,20 @@ import Button from './index';
|
|
|
3
3
|
declare const meta: Meta<typeof Button>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof Button>;
|
|
6
|
-
export declare const
|
|
7
|
-
|
|
6
|
+
export declare const Playground: Story;
|
|
7
|
+
/** Hierarchy:5 个层级 × default/focused/disabled/loading */
|
|
8
|
+
export declare const Hierarchy: Story;
|
|
9
|
+
/** Destructive:4 个 destructive 层级 × default/focused/disabled/loading */
|
|
10
|
+
export declare const Destructive: Story;
|
|
11
|
+
/** Size: sm / md / lg / xl */
|
|
8
12
|
export declare const Sizes: Story;
|
|
9
|
-
|
|
10
|
-
export declare const
|
|
11
|
-
|
|
13
|
+
/** State:以 secondary 为例展示 4 个状态 */
|
|
14
|
+
export declare const States: Story;
|
|
15
|
+
/** Icon only:仅图标按钮(square) */
|
|
16
|
+
export declare const IconOnly: Story;
|
|
17
|
+
/** 图标位置:左(leading) */
|
|
12
18
|
export declare const WithIcon: Story;
|
|
13
|
-
|
|
14
|
-
export declare const
|
|
19
|
+
/** 图标位置:右(trailing) */
|
|
20
|
+
export declare const IconTrailing: Story;
|
|
21
|
+
/** 完整矩阵:size × hierarchy × state × icon-only */
|
|
22
|
+
export declare const FullMatrix: Story;
|
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* 对齐 Figma: Untitled UI v7 — Buttons
|
|
4
|
+
* 维度:Size × Hierarchy × State × Icon only
|
|
5
|
+
* Size: sm(36) / md(40) / lg(44) / xl(48)
|
|
6
|
+
* Hierarchy: primary / secondary / tertiary / link-color / link-gray
|
|
7
|
+
* State: default / hover / focused / disabled / loading
|
|
8
|
+
* Icon only: boolean
|
|
9
|
+
*/
|
|
10
|
+
export type ButtonHierarchy = 'primary' | 'secondary' | 'tertiary' | 'link-color' | 'link-gray' | 'destructive-primary' | 'destructive-secondary' | 'destructive-tertiary' | 'destructive-link' | 'default';
|
|
11
|
+
export type ButtonSize = 'sm' | 'md' | 'lg' | 'xl' | 'small' | 'mediumSmall' | 'medium' | 'large';
|
|
12
|
+
export type ButtonType = ButtonHierarchy;
|
|
4
13
|
export interface ButtonProps {
|
|
5
|
-
/** 按钮内容 */
|
|
6
14
|
children?: React.ReactNode;
|
|
7
|
-
/**
|
|
8
|
-
type?:
|
|
9
|
-
/**
|
|
15
|
+
/** 按钮层级(对应 Figma Hierarchy)。`default` 为 `secondary` 的旧名 */
|
|
16
|
+
type?: ButtonHierarchy;
|
|
17
|
+
/** 按钮尺寸(对应 Figma Size)。旧名会映射到新尺寸 */
|
|
10
18
|
size?: ButtonSize;
|
|
11
|
-
/** 是否禁用 */
|
|
12
19
|
disabled?: boolean;
|
|
13
|
-
/** 是否加载中 */
|
|
14
20
|
loading?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
/**
|
|
21
|
+
/** 仅图标按钮。不传 `children`、仅传 `icon` 时自动开启 */
|
|
22
|
+
iconOnly?: boolean;
|
|
23
|
+
/** 受控的 Focused 视觉态,用于 Storybook 预览设计稿;真实键盘焦点由 :focus-visible 处理 */
|
|
24
|
+
focused?: boolean;
|
|
25
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
18
26
|
htmlType?: 'button' | 'submit' | 'reset';
|
|
19
|
-
/** 自定义类名 */
|
|
20
27
|
className?: string;
|
|
21
|
-
/** 自定义样式 */
|
|
22
28
|
style?: React.CSSProperties;
|
|
23
|
-
/** 图标 */
|
|
24
29
|
icon?: React.ReactNode;
|
|
25
|
-
/** 图标位置 */
|
|
26
30
|
iconPosition?: 'left' | 'right';
|
|
27
31
|
[key: string]: any;
|
|
28
32
|
}
|
|
@@ -26,6 +26,12 @@ export interface PopoverProps {
|
|
|
26
26
|
popoverClassName?: string;
|
|
27
27
|
/** 是否禁用 */
|
|
28
28
|
disabled?: boolean;
|
|
29
|
+
/** 关闭时是否销毁内容,默认 true */
|
|
30
|
+
destroyOnHide?: boolean;
|
|
31
|
+
/** antd 兼容参数:关闭时是否销毁内容 */
|
|
32
|
+
destroyTooltipOnHide?: boolean;
|
|
33
|
+
/** 是否显示箭头(兼容参数,当前不渲染箭头) */
|
|
34
|
+
arrow?: boolean;
|
|
29
35
|
}
|
|
30
36
|
declare const Popover: React.FC<PopoverProps>;
|
|
31
37
|
export default Popover;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* 对齐 Figma: Untitled UI v7 — Buttons
|
|
6
|
+
* 维度:Size × Hierarchy × State × Icon only
|
|
7
|
+
* Size: sm(36) / md(40) / lg(44) / xl(48)
|
|
8
|
+
* Hierarchy: primary / secondary / tertiary / link-color / link-gray
|
|
9
|
+
* State: default / hover / focused / disabled / loading
|
|
10
|
+
* Icon only: boolean
|
|
11
|
+
*/
|
|
12
|
+
type ButtonHierarchy = 'primary' | 'secondary' | 'tertiary' | 'link-color' | 'link-gray' | 'destructive-primary' | 'destructive-secondary' | 'destructive-tertiary' | 'destructive-link' | 'default';
|
|
13
|
+
type ButtonSize = 'sm' | 'md' | 'lg' | 'xl' | 'small' | 'mediumSmall' | 'medium' | 'large';
|
|
6
14
|
interface ButtonProps {
|
|
7
|
-
/** 按钮内容 */
|
|
8
15
|
children?: React.ReactNode;
|
|
9
|
-
/**
|
|
10
|
-
type?:
|
|
11
|
-
/**
|
|
16
|
+
/** 按钮层级(对应 Figma Hierarchy)。`default` 为 `secondary` 的旧名 */
|
|
17
|
+
type?: ButtonHierarchy;
|
|
18
|
+
/** 按钮尺寸(对应 Figma Size)。旧名会映射到新尺寸 */
|
|
12
19
|
size?: ButtonSize;
|
|
13
|
-
/** 是否禁用 */
|
|
14
20
|
disabled?: boolean;
|
|
15
|
-
/** 是否加载中 */
|
|
16
21
|
loading?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
/**
|
|
22
|
+
/** 仅图标按钮。不传 `children`、仅传 `icon` 时自动开启 */
|
|
23
|
+
iconOnly?: boolean;
|
|
24
|
+
/** 受控的 Focused 视觉态,用于 Storybook 预览设计稿;真实键盘焦点由 :focus-visible 处理 */
|
|
25
|
+
focused?: boolean;
|
|
26
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
20
27
|
htmlType?: 'button' | 'submit' | 'reset';
|
|
21
|
-
/** 自定义类名 */
|
|
22
28
|
className?: string;
|
|
23
|
-
/** 自定义样式 */
|
|
24
29
|
style?: React.CSSProperties;
|
|
25
|
-
/** 图标 */
|
|
26
30
|
icon?: React.ReactNode;
|
|
27
|
-
/** 图标位置 */
|
|
28
31
|
iconPosition?: 'left' | 'right';
|
|
29
32
|
[key: string]: any;
|
|
30
33
|
}
|
|
@@ -908,6 +911,12 @@ interface PopoverProps {
|
|
|
908
911
|
popoverClassName?: string;
|
|
909
912
|
/** 是否禁用 */
|
|
910
913
|
disabled?: boolean;
|
|
914
|
+
/** 关闭时是否销毁内容,默认 true */
|
|
915
|
+
destroyOnHide?: boolean;
|
|
916
|
+
/** antd 兼容参数:关闭时是否销毁内容 */
|
|
917
|
+
destroyTooltipOnHide?: boolean;
|
|
918
|
+
/** 是否显示箭头(兼容参数,当前不渲染箭头) */
|
|
919
|
+
arrow?: boolean;
|
|
911
920
|
}
|
|
912
921
|
declare const Popover: React.FC<PopoverProps>;
|
|
913
922
|
|