UNPKG

2.25 kBTypeScriptView Raw
1import React from 'react';
2import type { ReactNode, ButtonHTMLAttributes, DetailedHTMLProps } from 'react';
3import { NativeProps } from '../../utils/native-props';
4declare type NativeButtonProps = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
5export declare type ButtonProps = {
6 color?: 'default' | 'primary' | 'success' | 'warning' | 'danger';
7 fill?: 'solid' | 'outline' | 'none';
8 size?: 'mini' | 'small' | 'middle' | 'large';
9 block?: boolean;
10 loading?: boolean | 'auto';
11 loadingText?: string;
12 loadingIcon?: ReactNode;
13 disabled?: boolean;
14 onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void>;
15 type?: 'submit' | 'reset' | 'button';
16 shape?: 'default' | 'rounded' | 'rectangular';
17 children?: ReactNode;
18} & Pick<NativeButtonProps, 'onMouseDown' | 'onMouseUp' | 'onTouchStart' | 'onTouchEnd' | 'id'> & NativeProps<'--text-color' | '--background-color' | '--border-radius' | '--border-width' | '--border-style' | '--border-color'>;
19export declare type ButtonRef = {
20 nativeElement: HTMLButtonElement | null;
21};
22export declare const Button: React.ForwardRefExoticComponent<{
23 color?: "default" | "primary" | "success" | "warning" | "danger" | undefined;
24 fill?: "none" | "solid" | "outline" | undefined;
25 size?: "small" | "large" | "middle" | "mini" | undefined;
26 block?: boolean | undefined;
27 loading?: boolean | "auto" | undefined;
28 loadingText?: string | undefined;
29 loadingIcon?: ReactNode;
30 disabled?: boolean | undefined;
31 onClick?: ((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void>) | undefined;
32 type?: "reset" | "submit" | "button" | undefined;
33 shape?: "default" | "rounded" | "rectangular" | undefined;
34 children?: ReactNode;
35} & Pick<NativeButtonProps, "id" | "onTouchStart" | "onMouseDown" | "onMouseUp" | "onTouchEnd"> & {
36 className?: string | undefined;
37 style?: (React.CSSProperties & Partial<Record<"--border-radius" | "--text-color" | "--background-color" | "--border-width" | "--border-style" | "--border-color", string>>) | undefined;
38 tabIndex?: number | undefined;
39} & React.AriaAttributes & React.RefAttributes<ButtonRef>>;
40export {};
41
\No newline at end of file