choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
64 lines (63 loc) • 2.46 kB
TypeScript
import { AnchorHTMLAttributes, ButtonHTMLAttributes, MouseEventHandler, PureComponent, ReactElement, ReactNode } from 'react';
import Group from './ButtonGroup';
import { Size } from '../_util/enum';
import ConfigContext, { ConfigContextValue } from '../config-provider/ConfigContext';
export declare type ButtonType = 'default' | 'primary' | 'ghost' | 'dashed' | 'danger';
export declare type ButtonShape = 'circle' | 'circle-outline';
export declare type ButtonFuncType = 'raised' | 'flat';
export declare type ButtonHTMLType = 'submit' | 'button' | 'reset';
export interface BaseButtonProps {
type?: ButtonType;
htmlType?: string;
icon?: string;
shape?: ButtonShape;
size?: Size;
onClick?: MouseEventHandler<HTMLElement>;
loading?: boolean | {
delay?: number;
};
prefixCls?: string;
className?: string;
ghost?: boolean;
twoCNChar?: boolean;
rippleDisabled?: boolean;
funcType?: ButtonFuncType;
children?: ReactNode;
renderIcon?: (type: string) => ReactElement;
}
export declare type AnchorButtonProps = {
href: string;
target?: string;
} & BaseButtonProps & Omit<AnchorHTMLAttributes<any>, 'type' | 'onClick'>;
export declare type NativeButtonProps = {
htmlType?: ButtonHTMLType;
} & BaseButtonProps & Omit<ButtonHTMLAttributes<any>, 'type' | 'onClick'>;
export declare type ButtonProps = Partial<AnchorButtonProps & NativeButtonProps>;
export default class Button extends PureComponent<ButtonProps, any> {
static displayName: string;
static get contextType(): typeof ConfigContext;
static Group: typeof Group;
static __C7N_BUTTON: boolean;
static defaultProps: {
loading: boolean;
ghost: boolean;
funcType: string;
};
context: ConfigContextValue;
timeout: number;
delayTimeout: number;
element: HTMLButtonElement | null;
isTooltipShown?: boolean;
saveRef: (element: any) => void;
constructor(props: ButtonProps);
componentDidMount(): void;
componentWillReceiveProps(nextProps: ButtonProps): void;
componentDidUpdate(): void;
componentWillUnmount(): void;
fixTwoCNChar(): void;
handleClick: MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;
handleMouseEnter: MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;
handleMouseLeave: MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;
isNeedInserted(): boolean;
render(): JSX.Element;
}