import { CommonType } from '../common/type'; import { BaseButtonProps, ButtonMode, ButtonType } from '@sheinx/hooks'; import { SpinClasses } from '../spin/spin.type'; import React from 'react'; import type { SemanticClassNames, SemanticStyles } from '../common/use-semantic'; /** * Button Semantic DOM key 列表 * - root: 按钮元素(button 或 a) * - loading: 加载指示器容器 * * @see /docs/rfc/0001-semantic-dom.md */ export type ButtonSemanticKey = 'root' | 'loading'; /** * 传入函数式 `classNames` 时的状态快照。 * * @version 3.10.0 */ export interface ButtonClassNamesInfo { /** * @cn 是否禁用 * @en Whether disabled */ disabled: boolean; /** * @cn 是否加载中 * @en Whether loading */ loading: boolean; } export interface ButtonClasses { rootClass: string; button: string; round: string; circle: string; square: string; disabled: string; loading: string; text: string; small: string; large: string; default: string; primary: string; secondary: string; danger: string; warning: string; success: string; link: string; dashed: string; outline: string; spin: string; } export interface ButtonGroupClasses { rootClass: string; group: string; } export interface ButtonJssStyle { button?: () => ButtonClasses; spin?: () => SpinClasses; } export interface ButtonGroupJssStyle extends ButtonJssStyle { buttonGroup?: () => ButtonGroupClasses; } export interface ButtonItemProps extends Pick { /** * @en The type of the button * @cn 按钮类型 * @default 'default' */ type: ButtonType; /** * @en The mode of the button * @cn 按钮风格 */ mode: ButtonMode; /** * @en The size of the button * @cn 按钮尺寸 * @default 'default' */ size?: 'small' | 'large' | 'default'; /** * @en Text button * @cn 文字按钮,不展示边框和背景 * @default false */ text?: boolean; /** * @en When outline is true, the background is transparent * @cn outline 为 true 时,显示透明背景的按钮 * @default false */ outline?: boolean; /** * @en Specifies the button should be disabled * @cn 禁用 * @default false */ disabled?: boolean; jssStyle?: ButtonJssStyle; } export interface ButtonBaseProps extends BaseButtonProps, Pick, Omit, 'onClick'> { jssStyle?: { button?: () => ButtonClasses; spin?: () => SpinClasses; }; /** * @en The content inside the button, can be a text icon, etc * @cn 按钮里面的内容, 可以是文字图标等 */ children?: React.ReactNode; renderButton?: (buttonEl: React.ReactNode) => React.ReactElement; /** * @en Customize loading * @cn 自定义loading */ renderLoading?: (buttonEl: React.ReactNode) => React.ReactElement; /** * @en Semantic DOM classNames for internal nodes (root / loading). * Accepts static strings or functions that receive a state snapshot. * @cn Semantic DOM 类名,可按 key 定制内部各节点(root / loading)。 * 支持静态字符串或函数(接收状态快照)。 * @version 3.10.0 */ classNames?: SemanticClassNames; /** * @en Semantic DOM inline styles for internal nodes (root / loading). * @cn Semantic DOM 内联样式,按 key 定制内部各节点。 * @version 3.10.0 */ styles?: SemanticStyles; } export interface ButtonGroupProps extends Pick { /** * @deprecated 线框按钮,即将废弃,请使用 mode="outline" */ outline?: boolean; /** * @deprecated 文本按钮,即将废弃,请使用 mode="text" */ text?: boolean; /** * @deprecated 文本按钮,即将废弃,请使用 mode="link" */ link?: boolean; /** * @en Can be set button shape * @cn 设置按钮形状 */ shape?: 'round'; /** * @en The mode of the button * @cn 按钮风格;如果Button和Group同时设置mode,以Group为准 */ mode?: ButtonMode; /** * @en The type of the button * @cn 按钮类型;如果Button和Group同时设置type,以Button为准 * @default 'default' */ type?: ButtonType; /** * @en Array of Button * @cn 由 Button 组成的 array * @default index */ children: React.ReactNode; /** * @en The id of the button group * @cn 按钮组id */ id?: string; jssStyle?: ButtonGroupJssStyle; } export type ButtonProps = ButtonBaseProps; //# sourceMappingURL=button.type.d.ts.map