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.
@@ -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 Basic: Story;
7
- export declare const Types: Story;
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
- export declare const PrimarySizes: Story;
10
- export declare const Disabled: Story;
11
- export declare const Loading: Story;
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
- export declare const LoadingWithIcon: Story;
14
- export declare const AllStates: Story;
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
- export type ButtonType = 'default' | 'primary';
3
- export type ButtonSize = 'small' | 'mediumSmall' | 'medium' | 'large';
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?: ButtonType;
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
- onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
17
- /** 按钮原生type */
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
- type ButtonType = 'default' | 'primary';
5
- type ButtonSize = 'small' | 'mediumSmall' | 'medium' | 'large';
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?: ButtonType;
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
- onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
19
- /** 按钮原生type */
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