1 | import * as React from 'react';
|
2 | import { DistributiveOmit, OverridableStringUnion } from '@mui/types';
|
3 | import { SxProps } from '@mui/system';
|
4 | import { Theme } from '../styles';
|
5 | import { ExtendButtonBase, ExtendButtonBaseTypeMap } from '../ButtonBase';
|
6 | import { OverrideProps, OverridableComponent, OverridableTypeMap } from '../OverridableComponent';
|
7 | import { ButtonClasses } from './buttonClasses';
|
8 |
|
9 | export interface ButtonPropsVariantOverrides {}
|
10 |
|
11 | export interface ButtonPropsColorOverrides {}
|
12 |
|
13 | export interface ButtonPropsSizeOverrides {}
|
14 |
|
15 | export interface ButtonOwnProps {
|
16 | |
17 |
|
18 |
|
19 | children?: React.ReactNode;
|
20 | |
21 |
|
22 |
|
23 | classes?: Partial<ButtonClasses>;
|
24 | |
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | color?: OverridableStringUnion<
|
31 | 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning',
|
32 | ButtonPropsColorOverrides
|
33 | >;
|
34 | |
35 |
|
36 |
|
37 |
|
38 | disabled?: boolean;
|
39 | |
40 |
|
41 |
|
42 |
|
43 | disableElevation?: boolean;
|
44 | |
45 |
|
46 |
|
47 |
|
48 | disableFocusRipple?: boolean;
|
49 | |
50 |
|
51 |
|
52 | endIcon?: React.ReactNode;
|
53 | |
54 |
|
55 |
|
56 |
|
57 | fullWidth?: boolean;
|
58 | |
59 |
|
60 |
|
61 |
|
62 | href?: string;
|
63 | |
64 |
|
65 |
|
66 |
|
67 |
|
68 | size?: OverridableStringUnion<'small' | 'medium' | 'large', ButtonPropsSizeOverrides>;
|
69 | |
70 |
|
71 |
|
72 | startIcon?: React.ReactNode;
|
73 | |
74 |
|
75 |
|
76 | sx?: SxProps<Theme>;
|
77 | |
78 |
|
79 |
|
80 |
|
81 | variant?: OverridableStringUnion<'text' | 'outlined' | 'contained', ButtonPropsVariantOverrides>;
|
82 | }
|
83 |
|
84 | export type ButtonTypeMap<
|
85 | AdditionalProps = {},
|
86 | RootComponent extends React.ElementType = 'button',
|
87 | > = ExtendButtonBaseTypeMap<{
|
88 | props: AdditionalProps & ButtonOwnProps;
|
89 | defaultComponent: RootComponent;
|
90 | }>;
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 | export interface ExtendButtonTypeMap<TypeMap extends OverridableTypeMap> {
|
98 | props: TypeMap['props'] &
|
99 | (TypeMap['props'] extends { classes?: Record<string, string> }
|
100 | ? DistributiveOmit<ButtonTypeMap['props'], 'classes'>
|
101 | : ButtonTypeMap['props']);
|
102 | defaultComponent: TypeMap['defaultComponent'];
|
103 | }
|
104 |
|
105 | export type ExtendButton<TypeMap extends OverridableTypeMap> = ((
|
106 | props: { href: string } & OverrideProps<ExtendButtonBaseTypeMap<TypeMap>, 'a'>,
|
107 | ) => React.JSX.Element) &
|
108 | OverridableComponent<ExtendButtonBaseTypeMap<TypeMap>>;
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 | declare const Button: ExtendButtonBase<ButtonTypeMap>;
|
123 |
|
124 | export type ButtonProps<
|
125 | RootComponent extends React.ElementType = ButtonTypeMap['defaultComponent'],
|
126 | AdditionalProps = {},
|
127 | > = OverrideProps<ButtonTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
|
128 | component?: React.ElementType;
|
129 | };
|
130 |
|
131 | export default Button;
|