-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathsplitbutton.d.ts
More file actions
283 lines (277 loc) · 8.9 KB
/
splitbutton.d.ts
File metadata and controls
283 lines (277 loc) · 8.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
/**
*
* SplitButton groups a set of commands in an overlay with a default command.
*
* [Live Demo](https://www.primereact.org/splitbutton/)
*
* @module splitbutton
*
*/
import * as React from 'react';
import { CSSTransitionProps as ReactCSSTransitionProps } from 'react-transition-group/CSSTransition';
import { ButtonPassThroughOptions } from '../button/button';
import { ComponentHooks } from '../componentbase/componentbase';
import { CSSTransitionProps } from '../csstransition';
import { MenuItem } from '../menuitem';
import { PassThroughOptions } from '../passthrough';
import { TooltipPassThroughOptions } from '../tooltip/tooltip';
import { TooltipOptions } from '../tooltip/tooltipoptions';
import { IconType, PassThroughType, TemplateType } from '../utils';
export declare type SplitButtonPassThroughType<T> = PassThroughType<T, SplitButtonPassThroughMethodOptions>;
export declare type SplitButtonPassThroughTransitionType = ReactCSSTransitionProps | ((options: SplitButtonPassThroughMethodOptions) => ReactCSSTransitionProps) | undefined;
/**
* Custom passthrough(pt) option method.
*/
export interface SplitButtonPassThroughMethodOptions {
props: SplitButtonProps;
}
/**
* Custom passthrough(pt) options.
* @see {@link SplitButtonProps.pt}
*/
export interface SplitButtonPassThroughOptions {
/**
* Uses to pass attributes to the root's DOM element.
*/
root?: SplitButtonPassThroughType<React.HTMLAttributes<HTMLDivElement>>;
/**
* Uses to pass attributes to the icon's DOM element.
*/
icon?: SplitButtonPassThroughType<React.SVGProps<SVGSVGElement> | React.HTMLAttributes<HTMLSpanElement | SVGSVGElement>>;
/**
* Uses to pass attributes to the Button component.
*/
button?: ButtonPassThroughOptions;
/**
* Uses to pass attributes to the Button component.
*/
menuButton?: ButtonPassThroughOptions;
/**
* Uses to pass attributes to the menu's DOM element.
*/
menu?: SplitButtonPassThroughType<React.HTMLAttributes<HTMLDivElement>>;
/**
* Uses to pass attributes to the menu list's DOM element.
*/
menuList?: SplitButtonPassThroughType<React.HTMLAttributes<HTMLUListElement>>;
/**
* Uses to pass attributes to the separator's DOM element.
*/
separator?: SplitButtonPassThroughType<React.HTMLAttributes<HTMLLIElement>>;
/**
* Uses to pass attributes to the menu icon's DOM element.
*/
menuIcon?: SplitButtonPassThroughType<React.SVGProps<SVGSVGElement> | React.HTMLAttributes<HTMLSpanElement>>;
/**
* Uses to pass attributes to the menu label's DOM element.
*/
menuLabel?: SplitButtonPassThroughType<React.HTMLAttributes<HTMLSpanElement>>;
/**
* Uses to pass attributes to the anchor's DOM element.
*/
anchor?: SplitButtonPassThroughType<React.HTMLAttributes<HTMLAnchorElement>>;
/**
* Uses to pass attributes to the menu item's DOM element.
*/
menuItem?: SplitButtonPassThroughType<React.HTMLAttributes<HTMLLIElement>>;
/**
* Uses to pass attributes tooltip's DOM element.
* @type {TooltipPassThroughOptions}
*/
tooltip?: TooltipPassThroughOptions;
/**
* Used to manage all lifecycle hooks
* @see {@link ComponentHooks}
*/
hooks?: ComponentHooks;
/**
* Used to control React Transition API.
*/
transition?: SplitButtonPassThroughTransitionType;
}
/**
* Defines valid properties in SplitButton component. In addition to these, all properties of HTMLDivElement can be used in this component.
* @group Properties
*/
export interface SplitButtonProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'ref'> {
/**
* Text of the button.
*/
label?: string | undefined;
/**
* Name of the icon.
*/
icon?: IconType<SplitButtonProps> | undefined;
/**
* Add a textual class to the button without a background initially.
* @defaultValue false
*/
text?: boolean | undefined;
/**
* Add a circular border radius to the button.
* @defaultValue false
*/
rounded?: boolean | undefined;
/**
* Add a shadow to indicate elevation.
* @defaultValue false
*/
raised?: boolean | undefined;
/**
* Add a border class without a background initially.
* @defaultValue false
*/
outlined?: boolean | undefined;
/**
* Defines the style of the button, valid values are "secondary", "success", "info", "warning", "danger", "contrast", "help".
*/
severity?: 'secondary' | 'success' | 'info' | 'warning' | 'danger' | 'help' | 'contrast' | undefined;
/**
* Defines the size of the button, valid values are "small" and "large".
*/
size?: 'small' | 'large' | undefined;
/**
* Display loading icon of the button
* @defaultValue false
*/
loading?: boolean | undefined;
/**
* Name of the loading icon or JSX.Element for loading icon.
*/
loadingIcon?: IconType<SplitButtonProps> | undefined;
/**
* MenuModel instance to define the overlay items.
*/
model?: MenuItem[] | undefined;
/**
* When present, it specifies that the component should be disabled.
* @defaultValue false
*/
disabled?: boolean | undefined;
/**
* When present, it specifies that the element should be visible.
* @defaultValue true
*/
visible?: boolean | undefined;
/**
* ClassName of the button.
*/
buttonClassName?: string | undefined;
/**
* Inline style of the overlay menu.
*/
menuStyle?: React.CSSProperties | undefined;
/**
* ClassName class of the overlay menu.
*/
menuClassName?: string | undefined;
/**
* ClassName of the menu dropdown button.
*/
menuButtonClassName?: string | undefined;
/**
* Props for the main button, any prop is passed implicity to the button element.
*/
buttonProps?: any | undefined;
/**
* Props for the dropdown button, any prop is passed implicity to the dropdown button element.
*/
menuButtonProps?: any | undefined;
/**
* DOM element instance where the overlay panel should be mounted. Valid values are any DOM Element and 'self'. The self value is used to render a component where it is located.
* @defaultValue document.body
*/
appendTo?: 'self' | HTMLElement | undefined | null | (() => HTMLElement);
/**
* Content of the tooltip.
*/
tooltip?: string | undefined;
/**
* Configuration of the tooltip, refer to the tooltip documentation for more information.
*/
tooltipOptions?: TooltipOptions | undefined;
/**
* Template of the default button.
*/
buttonTemplate?: TemplateType<SplitButtonProps> | undefined;
/**
* The properties of CSSTransition can be customized, except for "nodeRef" and "in" properties.
*/
transitionOptions?: CSSTransitionProps | undefined;
/**
* Name of the dropdown icon or JSX.Element for dropdown icon.
*/
dropdownIcon?: IconType<SplitButtonProps> | undefined;
/**
* Callback to invoke when main button is clicked.
* @param {React.MouseEvent<HTMLElement>} event - Browser event
*/
onClick?(event: React.MouseEvent<HTMLElement>): void;
/**
* Callback to invoke when overlay panel becomes visible.
*/
onShow?(): void;
/**
* Callback to invoke when overlay panel becomes hidden.
*/
onHide?(): void;
/**
* Used to get the child elements of the component.
* @readonly
*/
children?: React.ReactNode | undefined;
/**
* Uses to pass attributes to DOM elements inside the component.
* @type {SplitButtonPassThroughOptions}
*/
pt?: SplitButtonPassThroughOptions;
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
/**
* When enabled, it removes component related styles in the core.
* @defaultValue false
*/
unstyled?: boolean;
}
/**
* Defines current inline state in SplitButton component.
*/
export interface SplitButtonState {
/**
* Current id state as a boolean.
*/
id: string;
/**
* Current overlay visible state as a boolean.
*/
overlayVisible: boolean;
}
/**
* **PrimeReact - SplitButton**
*
* _SplitButton groups a set of commands in an overlay with a default command._
*
* [Live Demo](https://www.primereact.org/splitbutton/)
* --- ---
* 
*
* @group Component
*/
export declare class SplitButton extends React.Component<SplitButtonProps, any> {
/**
* Used to show the popup.
*/
public show(): void;
/**
* Used to hide the popup.
*/
public hide(): void;
/**
* Used to get container element.
* @return {HTMLDivElement | null} Container element
*/
public getElement(): HTMLDivElement | null;
}