import { CSSProperties, HTMLProps, ReactNode, AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react'; import { type SizeType } from '../config-provider'; export interface BaseButtonProps { style?: CSSProperties; className?: string | string[]; children?: ReactNode; /** * 按钮主要分为五种按钮类型:主要按钮、次级按钮、虚框按钮、文字按钮、链接按钮。`default` 为次级按钮。 * @defaultValue default */ type?: 'primary' | 'secondary' | 'default' | 'dashed' | 'text' | 'link' | 'ghost'; /** * 按钮状态 * @defaultValue default */ level?: 'primary' | 'secondary' | 'warning' | 'danger' | 'success' | 'default'; /** * 是否是主要按钮 */ primary?: boolean; /** * 是否是次要按钮 */ secondary?: boolean; /** * 成功按钮 */ success?: boolean; /** * 危险按钮 */ warning?: boolean; /** * 警告按钮 */ danger?: boolean; /** * 虚线 */ dashed?: boolean; /** * 幽灵模式 */ ghost?: boolean; /** * 按钮的尺寸 * @defaultValue default */ size?: SizeType; /** * 按钮形状,`circle` - 圆形, `round` - 全圆角, `square` - 长方形 * @defaultValue square */ shape?: 'circle' | 'round' | 'square'; /** * 添加跳转链接,设置此属性,button表现跟a标签一致 */ href?: string; /** * a 链接的 target 属性,href 存在时生效 */ target?: string; /** * a 链接的原生属性,href 存在时生效 */ anchorProps?: HTMLProps; /** * 是否禁用 */ disabled?: boolean; /** * 按钮是否是加载状态 */ loading?: boolean; /** * 当 loading 的时候,不改变按钮的宽度。 */ loadingFixedWidth?: boolean; /** * 设置按钮的图标 */ icon?: ReactNode; /** * 只有图标,按钮宽高相等。如果指定 `icon` 且没有 children,`iconOnly` 默认为 true */ iconOnly?: boolean; /** * 是否展示border */ iconOnlyBorder: boolean; /** * 按钮宽度随容器自适应。 */ block?: boolean; /** * 点击按钮的回调 */ onClick?: (e: Event) => void; } export declare type AnchorButtonProps = { href: string; target?: string; anchorProps?: HTMLProps; } & BaseButtonProps & Omit, 'type' | 'onClick' | 'className'>; export declare type FinalButtonProps = { /** * 按钮原生的 html type 类型 * @defaultValue button */ htmlType?: 'button' | 'submit' | 'reset'; } & BaseButtonProps & Omit, 'type' | 'onClick' | 'className'>; /** * @title Button */ export declare type ButtonProps = Partial; export interface ButtonGroupProps { style?: CSSProperties; className?: string | string[]; children?: ReactNode; }