choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
67 lines (66 loc) • 2.39 kB
TypeScript
import React, { CSSProperties, KeyboardEventHandler, MouseEventHandler, PureComponent } from 'react';
import PropTypes from 'prop-types';
import Group from './ButtonGroup';
import { Size } from '../_util/enum';
import { ConfigContextValue } from '../config-provider/ConfigContext';
export declare type ButtonType = 'primary' | 'ghost' | 'dashed' | 'danger';
export declare type ButtonShape = 'circle' | 'circle-outline';
export declare type ButtonFuncType = 'raised' | 'flat';
export interface ButtonProps {
type?: ButtonType;
htmlType?: string;
icon?: string;
shape?: ButtonShape;
size?: Size;
onClick?: MouseEventHandler<any>;
onMouseUp?: MouseEventHandler<any>;
onMouseDown?: MouseEventHandler<any>;
onMouseEnter?: MouseEventHandler<any>;
onMouseLeave?: MouseEventHandler<any>;
onKeyPress?: KeyboardEventHandler<any>;
onKeyDown?: KeyboardEventHandler<any>;
tabIndex?: number;
loading?: boolean | {
delay?: number;
};
disabled?: boolean;
style?: CSSProperties;
prefixCls?: string;
className?: string;
ghost?: boolean;
target?: string;
href?: string;
download?: string;
funcType?: ButtonFuncType;
}
export default class Button extends PureComponent<ButtonProps, any> {
static displayName: string;
static get contextType(): React.Context<ConfigContextValue>;
static Group: typeof Group;
static __C7N_BUTTON: boolean;
static defaultProps: {
loading: boolean;
ghost: boolean;
funcType: string;
};
static propTypes: {
type: PropTypes.Requireable<string>;
shape: PropTypes.Requireable<string>;
size: PropTypes.Requireable<Size>;
htmlType: PropTypes.Requireable<string>;
onClick: PropTypes.Requireable<(...args: any[]) => any>;
loading: PropTypes.Requireable<boolean | object>;
className: PropTypes.Requireable<string>;
icon: PropTypes.Requireable<string>;
ghost: PropTypes.Requireable<boolean>;
funcType: PropTypes.Requireable<string>;
};
context: ConfigContextValue;
timeout: number;
delayTimeout: number;
constructor(props: ButtonProps);
componentWillReceiveProps(nextProps: ButtonProps): void;
componentWillUnmount(): void;
handleClick: MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;
render(): JSX.Element;
}