UNPKG

3.2 kBTypeScriptView Raw
1import * as React from 'react';
2import Icon from './Icon';
3import * as PropTypes from 'prop-types';
4declare const ButtonSize: ["small", "large"];
5declare type ButtonSize = typeof ButtonSize[number];
6declare const ButtonType: ["primary", "dashed", "danger"];
7declare type ButtonType = typeof ButtonType[number];
8declare const ButtonShape: ["round", "circle"];
9declare type ButtonShape = typeof ButtonShape[number];
10declare const ButtonHtmlType: ["submit", "reset", "text"];
11declare type ButtonHtmlType = typeof ButtonHtmlType[number];
12interface IButtonGroupContext {
13 size?: ButtonSize;
14 type?: ButtonType;
15 shape?: ButtonShape;
16 disabled?: boolean;
17}
18interface State {
19 clickAnimating: boolean;
20}
21declare class Button extends React.Component<Button.Props, State> {
22 static displayName: string;
23 static contextType: React.Context<IButtonGroupContext>;
24 static propTypes: {
25 size: PropTypes.Requireable<"small" | "large">;
26 type: PropTypes.Requireable<"primary" | "dashed" | "danger">;
27 shape: PropTypes.Requireable<"round" | "circle">;
28 icon: PropTypes.Requireable<"left" | "right" | "search" | "user" | "check-circle-fill" | "close-circle-fill" | "info-circle-fill" | "warning-circle-fill">;
29 iconRight: PropTypes.Requireable<"left" | "right" | "search" | "user" | "check-circle-fill" | "close-circle-fill" | "info-circle-fill" | "warning-circle-fill">;
30 disabled: PropTypes.Requireable<boolean>;
31 htmlType: PropTypes.Requireable<"submit" | "reset" | "text">;
32 className: PropTypes.Requireable<string>;
33 style: PropTypes.Requireable<object>;
34 onClick: PropTypes.Requireable<(...args: any[]) => any>;
35 };
36 private _animatingTimer;
37 context: IButtonGroupContext;
38 readonly state: {
39 clickAnimating: boolean;
40 };
41 onClick(e: React.MouseEvent): void;
42 render(): JSX.Element;
43}
44declare namespace Button {
45 const Size: ["small", "large"];
46 const Type: ["primary", "dashed", "danger"];
47 const Shape: ["round", "circle"];
48 const Icon: ["left", "right", "search", "user", "check-circle-fill", "close-circle-fill", "info-circle-fill", "warning-circle-fill"];
49 const HtmlType: ["submit", "reset", "text"];
50 interface Props {
51 size?: ButtonSize;
52 type?: ButtonType;
53 shape?: ButtonShape;
54 icon?: Icon.Props['type'];
55 iconRight?: Icon.Props['type'];
56 disabled?: boolean;
57 htmlType?: ButtonHtmlType;
58 className?: string;
59 style?: React.CSSProperties;
60 onClick?: React.MouseEventHandler;
61 }
62 class Group extends React.Component<Group.Props> {
63 static displayName: string;
64 static propTypes: object;
65 render(): JSX.Element;
66 }
67 namespace Group {
68 const Size: ["small", "large"];
69 const Type: ["primary", "dashed", "danger"];
70 const Shape: ["round", "circle"];
71 interface Props extends React.Props<{}> {
72 size?: ButtonSize;
73 type?: ButtonType;
74 shape?: ButtonShape;
75 disabled?: boolean;
76 className?: string;
77 style?: React.CSSProperties;
78 }
79 }
80}
81export default Button;