@baseline-ui/core 0.0.0-next-20240723194303
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Acknowledgements.md +26450 -0
- package/License.md +5 -0
- package/README.md +0 -0
- package/dist/index.css +10 -0
- package/dist/index.d.mts +2576 -0
- package/dist/index.d.ts +2576 -0
- package/dist/index.js +180 -0
- package/dist/index.mjs +56 -0
- package/package.json +73 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2576 @@
|
|
|
1
|
+
import React, { Key, Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { DraggableCollectionStateOptions, DroppableCollectionStateOptions, Orientation, ListState, SliderStateOptions, ToggleProps, OverlayTriggerProps, OverlayTriggerState, MenuTriggerProps, TooltipTriggerProps, NumberFieldStateOptions, ListProps, SelectStateOptions, Item as Item$2, Selection as Selection$1, ComboBoxStateOptions, ListData, ListOptions } from 'react-stately';
|
|
3
|
+
import * as react_aria from 'react-aria';
|
|
4
|
+
import { DraggableCollectionOptions, DroppableCollectionOptions, AriaListBoxProps, AriaListBoxOptions, OptionAria, AriaButtonProps, AriaSliderProps, AriaSwitchProps, AriaSearchFieldProps, AriaPopoverProps, useOverlayTrigger, AriaMenuProps, AriaMenuTriggerProps, AriaLinkOptions, SeparatorProps as SeparatorProps$1, AriaProgressBarProps, AriaTextFieldProps, AriaTooltipProps, AriaPositionProps, OverlayProps, AriaToggleButtonProps, AriaCheckboxProps, AriaNumberFieldProps, I18nProviderProps as I18nProviderProps$1, LocalizedStrings, useNumberFormatter, useDateFormatter, AriaTagGroupProps, AriaSelectOptions, AriaDialogProps, DropOptions, ClipboardProps, PressProps, AriaRadioGroupProps, AriaModalOverlayProps, AriaComboBoxOptions, AriaComboBoxProps, Locale, Key as Key$1 } from 'react-aria';
|
|
5
|
+
export { I18nProviderProps, useCollator, useDateFormatter, useNumberFormatter } from 'react-aria';
|
|
6
|
+
import { Node as Node$1, DragItem, DOMAttributes, AriaLabelingProps, AriaValidationProps } from '@react-types/shared';
|
|
7
|
+
import { IconProps, SVGRProps } from '@baseline-ui/icons';
|
|
8
|
+
import { Theme, Sprinkles } from '@baseline-ui/tokens';
|
|
9
|
+
import { AriaTabListProps } from '@react-types/tabs';
|
|
10
|
+
import { ColorFieldProps, Color } from '@react-stately/color';
|
|
11
|
+
import { OnRender, OnRenderStart, OnDragStart, OnDrag, OnDragEnd, OnResizeStart, OnResize, OnResizeEnd, OnRotateStart, OnRotate, OnRotateEnd, OnSnap, RotationPosition } from 'react-moveable';
|
|
12
|
+
import { AriaToolbarProps } from '@react-aria/toolbar';
|
|
13
|
+
import { UseTransitionProps } from '@react-spring/core';
|
|
14
|
+
|
|
15
|
+
declare type DragAndDropProps = Omit<DraggableCollectionStateOptions & DraggableCollectionOptions & DroppableCollectionOptions & DroppableCollectionStateOptions, "keyboardDelegate" | "dropTargetDelegate" | "shouldAcceptItemDrop" | "onDropEnter" | "onDropActivate" | "onDropExit" | "getDropOperation" | "collection" | "selectionManager" | "onRootDrop" | "onInsert" | "getAllowedDropOperations" | "getItems" | "onItemDrop"> & Partial<Pick<DraggableCollectionStateOptions, "getItems">> & {
|
|
16
|
+
/**
|
|
17
|
+
* Indicates whether reordering is enabled.
|
|
18
|
+
*
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
enableReorder: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the items are arranged in a stack or grid.
|
|
24
|
+
*
|
|
25
|
+
* @default stack
|
|
26
|
+
*/
|
|
27
|
+
layout: "grid" | "stack";
|
|
28
|
+
/**
|
|
29
|
+
* The primary orientation of the items. Usually this is the direction that
|
|
30
|
+
* the collection scrolls.
|
|
31
|
+
*
|
|
32
|
+
* @default vertical
|
|
33
|
+
*/
|
|
34
|
+
orientation: Orientation;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
interface BlockProps {
|
|
38
|
+
/**
|
|
39
|
+
* The unique identifier for the block. This is used to identify the block in
|
|
40
|
+
* the DOM and in the block map. It is added as a data attribute
|
|
41
|
+
* `data-block-id` to the root element of the block if a DOM node is
|
|
42
|
+
* rendered.
|
|
43
|
+
*/
|
|
44
|
+
"data-block-id"?: Key;
|
|
45
|
+
}
|
|
46
|
+
interface StylingProps extends BlockProps {
|
|
47
|
+
/** The className applied to the root element of the component. */
|
|
48
|
+
className?: string;
|
|
49
|
+
/** The style applied to the root element of the component. */
|
|
50
|
+
style?: React.CSSProperties;
|
|
51
|
+
}
|
|
52
|
+
interface Rect {
|
|
53
|
+
/** The left position of the rectangle. */
|
|
54
|
+
left: number;
|
|
55
|
+
/** The top position of the rectangle. */
|
|
56
|
+
top: number;
|
|
57
|
+
/** The width of the rectangle. */
|
|
58
|
+
width?: number;
|
|
59
|
+
/** The height of the rectangle. */
|
|
60
|
+
height?: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Check if the selector is inside an overlay content
|
|
65
|
+
*
|
|
66
|
+
* @param selector
|
|
67
|
+
*/
|
|
68
|
+
declare function isInsideOverlayContent(selector: HTMLElement): Element | null;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Check if the given object is a `Rect`.
|
|
72
|
+
*
|
|
73
|
+
* @param rect
|
|
74
|
+
*/
|
|
75
|
+
declare function isRect(rect: Rect): rect is Rect;
|
|
76
|
+
|
|
77
|
+
interface ListOption<T = Record<string, any>> {
|
|
78
|
+
id: string;
|
|
79
|
+
label: string;
|
|
80
|
+
description?: string;
|
|
81
|
+
icon?: React.FC<IconProps>;
|
|
82
|
+
data?: T;
|
|
83
|
+
type?: "option";
|
|
84
|
+
}
|
|
85
|
+
interface ListSection {
|
|
86
|
+
id: string;
|
|
87
|
+
title?: string;
|
|
88
|
+
type: "section";
|
|
89
|
+
children: ListOption[];
|
|
90
|
+
}
|
|
91
|
+
declare type ListItem = ListOption | ListSection;
|
|
92
|
+
interface ListBoxProps extends StylingProps, Omit<AriaListBoxProps<ListItem> & AriaListBoxOptions<ListItem>, "children" | "linkBehavior" | "isVirtualized" | "keyboardDelegate" | "items">, Omit<DragAndDropProps, "preview" | "enableReorder" | "orientation" | "layout">, Partial<Pick<DragAndDropProps, "enableReorder" | "orientation" | "layout">> {
|
|
93
|
+
/**
|
|
94
|
+
* The items to render in the listbox. Items have the following shape:
|
|
95
|
+
*
|
|
96
|
+
* ```ts
|
|
97
|
+
* export type ListOption = {
|
|
98
|
+
* id: string;
|
|
99
|
+
* label: string;
|
|
100
|
+
* description?: string;
|
|
101
|
+
* icon?: React.FC<IconProps>;
|
|
102
|
+
* };
|
|
103
|
+
*
|
|
104
|
+
* export type ListSection = {
|
|
105
|
+
* id: string;
|
|
106
|
+
* title?: string;
|
|
107
|
+
* type: "section";
|
|
108
|
+
* children: ListOption[];
|
|
109
|
+
* };
|
|
110
|
+
*
|
|
111
|
+
* type ListItem = ListOption | ListSection;
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
items?: ListItem[];
|
|
115
|
+
/**
|
|
116
|
+
* The custom render function for the listbox options.
|
|
117
|
+
*
|
|
118
|
+
* @param item Node<ListItem>
|
|
119
|
+
* @param options [OptionAria]()
|
|
120
|
+
* @param ref React.RefObject<HTMLLIElement>
|
|
121
|
+
*/
|
|
122
|
+
renderOption?: (item: Node$1<ListItem>, options: OptionAria & {
|
|
123
|
+
showSelectedIcon?: boolean;
|
|
124
|
+
_state: ListState<ListItem>;
|
|
125
|
+
}, ref: React.Ref<HTMLLIElement>) => React.ReactNode;
|
|
126
|
+
/** Renders the drop indicator component. */
|
|
127
|
+
renderDropIndicator?: (options: {
|
|
128
|
+
dropIndicatorProps: React.HTMLAttributes<HTMLLIElement>;
|
|
129
|
+
isDropTarget: boolean;
|
|
130
|
+
isHidden: boolean;
|
|
131
|
+
orientation: Orientation;
|
|
132
|
+
}, ref: React.RefObject<HTMLLIElement>) => React.ReactNode;
|
|
133
|
+
/**
|
|
134
|
+
* The custom render function for the drag preview. This can be used to render
|
|
135
|
+
* a custom drag preview when dragging items.
|
|
136
|
+
*/
|
|
137
|
+
renderDragPreview?: (items: DragItem[]) => React.ReactNode;
|
|
138
|
+
/** Whether to show the selected checkmark icon. */
|
|
139
|
+
showSelectedIcon?: boolean;
|
|
140
|
+
/** The label for the listbox. */
|
|
141
|
+
label?: React.ReactNode;
|
|
142
|
+
/** The CSS class name for the drop indicator. */
|
|
143
|
+
dropIndicatorClassName?: string;
|
|
144
|
+
/** The style of the drop indicator used in a component. */
|
|
145
|
+
dropIndicatorStyle?: React.CSSProperties;
|
|
146
|
+
/** The CSS class name for the option. */
|
|
147
|
+
optionClassName?: string | ((item: ListOption) => string);
|
|
148
|
+
/** The CSS class name for the section. */
|
|
149
|
+
sectionClassName?: string | ((item: ListSection) => string);
|
|
150
|
+
/** The style of the option. */
|
|
151
|
+
optionStyle?: React.CSSProperties | ((item: ListOption) => React.CSSProperties);
|
|
152
|
+
/** The style of the section. */
|
|
153
|
+
sectionStyle?: React.CSSProperties | ((item: ListSection) => React.CSSProperties);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
declare const ListBox: React.ForwardRefExoticComponent<ListBoxProps & React.RefAttributes<HTMLUListElement>>;
|
|
157
|
+
|
|
158
|
+
interface ActionButtonSharedProps extends Omit<AriaButtonProps<"button" | "div">, "rel" | "href" | "target" | "children">, StylingProps {
|
|
159
|
+
}
|
|
160
|
+
interface ActionButtonProps extends ActionButtonSharedProps {
|
|
161
|
+
/**
|
|
162
|
+
* The button's variant.
|
|
163
|
+
*
|
|
164
|
+
* @default primary
|
|
165
|
+
*/
|
|
166
|
+
variant?: "primary" | "secondary" | "tertiary" | "ghost" | "popover" | "toolbar";
|
|
167
|
+
/** The button's label. */
|
|
168
|
+
label: React.ReactNode;
|
|
169
|
+
/** The button's icon before the label. */
|
|
170
|
+
iconStart?: React.FC<IconProps>;
|
|
171
|
+
/** The button's icon after the label. */
|
|
172
|
+
iconEnd?: React.FC<IconProps>;
|
|
173
|
+
/**
|
|
174
|
+
* The button's size.
|
|
175
|
+
*
|
|
176
|
+
* @default sm
|
|
177
|
+
*/
|
|
178
|
+
size?: "sm" | "md" | "lg";
|
|
179
|
+
/** Indicates whether focusing should be prevented on press. */
|
|
180
|
+
preventFocusOnPress?: boolean;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
declare const ActionButton: React.ForwardRefExoticComponent<ActionButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
184
|
+
|
|
185
|
+
interface DomNodeRendererProps {
|
|
186
|
+
/** The class name applied to the wrapper `div` component. */
|
|
187
|
+
className?: string;
|
|
188
|
+
/**
|
|
189
|
+
* The DOM node to render inside the component. If this is not provided, the
|
|
190
|
+
* component will render nothing. If this is provided, the component will
|
|
191
|
+
* render the DOM node inside a `div` component with `display` set to
|
|
192
|
+
* `contents`.
|
|
193
|
+
*/
|
|
194
|
+
node: Node;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
declare const DomNodeRenderer: React.ForwardRefExoticComponent<DomNodeRendererProps & React.RefAttributes<HTMLDivElement>>;
|
|
198
|
+
|
|
199
|
+
interface SliderProps extends Omit<AriaSliderProps<number> & SliderStateOptions<number>, "orientation" | "numberFormatter">, StylingProps {
|
|
200
|
+
/**
|
|
201
|
+
* Whether the slider is read only.
|
|
202
|
+
*
|
|
203
|
+
* @default false
|
|
204
|
+
*/
|
|
205
|
+
isReadOnly?: boolean;
|
|
206
|
+
/** The format options passed to `Intl.NumberFormat`. */
|
|
207
|
+
numberFormatOptions?: Intl.NumberFormatOptions & {
|
|
208
|
+
numberingSystem?: string;
|
|
209
|
+
};
|
|
210
|
+
/** The label for the slider. */
|
|
211
|
+
label?: React.ReactNode;
|
|
212
|
+
/**
|
|
213
|
+
* Whether to include a number input for the slider.
|
|
214
|
+
*
|
|
215
|
+
* @default false
|
|
216
|
+
*/
|
|
217
|
+
includeNumberInput?: boolean;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
declare const Slider: React.ForwardRefExoticComponent<SliderProps & React.RefAttributes<HTMLDivElement>>;
|
|
221
|
+
|
|
222
|
+
interface SwitchProps extends Omit<AriaSwitchProps, "children">, Omit<ToggleProps, "children" | "isRequired" | "validate" | "validationBehavior" | "validationState" | "isInvalid">, StylingProps {
|
|
223
|
+
/** The label to display next to the switch. */
|
|
224
|
+
label?: React.ReactNode;
|
|
225
|
+
/** The position of the label. */
|
|
226
|
+
labelPosition?: "top" | "left";
|
|
227
|
+
/** The status label to display next to the switch. */
|
|
228
|
+
statusLabel?: {
|
|
229
|
+
on: string;
|
|
230
|
+
off: string;
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLLabelElement>>;
|
|
235
|
+
|
|
236
|
+
interface SearchInputProps extends Omit<AriaSearchFieldProps, "validationState" | "label" | "aria-autocomplete" | "autoComplete" | "isRequired" | "aria-haspopup" | "isReadOnly" | "aria-activedescendant" | "type" | "validationBehavior" | "validate" | "isInvalid">, StylingProps {
|
|
237
|
+
/**
|
|
238
|
+
* The size of the search input.
|
|
239
|
+
*
|
|
240
|
+
* @default "md"
|
|
241
|
+
*/
|
|
242
|
+
size?: "sm" | "md" | "lg";
|
|
243
|
+
/**
|
|
244
|
+
* The variant of the search input.
|
|
245
|
+
*
|
|
246
|
+
* @default "primary"
|
|
247
|
+
*/
|
|
248
|
+
variant?: "primary" | "ghost";
|
|
249
|
+
/** Defines a string value that labels the current element. */
|
|
250
|
+
"aria-label": string;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
declare const SearchInput: React.ForwardRefExoticComponent<SearchInputProps & React.RefAttributes<HTMLDivElement>>;
|
|
254
|
+
|
|
255
|
+
interface ThemeProviderProps extends StylingProps {
|
|
256
|
+
/**
|
|
257
|
+
* The theme to use. If not provided, the theme will be inherited from the
|
|
258
|
+
* parent ThemeProvider. If there is no parent ThemeProvider, the default
|
|
259
|
+
* theme will be used.
|
|
260
|
+
*
|
|
261
|
+
* @default "system"
|
|
262
|
+
*/
|
|
263
|
+
theme?: Theme | "light" | "dark" | "system";
|
|
264
|
+
/** The children to render. */
|
|
265
|
+
children: React.ReactNode;
|
|
266
|
+
/**
|
|
267
|
+
* A function that will be called when the theme changes from any of the child
|
|
268
|
+
* components.
|
|
269
|
+
*/
|
|
270
|
+
setTheme?: (theme: Theme | "light" | "dark" | "system") => void;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
declare const ThemeProvider: React.ForwardRefExoticComponent<ThemeProviderProps & React.RefAttributes<HTMLDivElement>>;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* A hook that returns the user preferences for color scheme, contrast, reduced
|
|
277
|
+
* motion, transparency and reduced data. The values are updated when the user
|
|
278
|
+
* changes their preferences.
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* const { colorScheme, highContrast, reducedMotion, transparency } =
|
|
282
|
+
* useUserPreferences();
|
|
283
|
+
*
|
|
284
|
+
* @param ownerWindow - The window object to use. Defaults to the global window
|
|
285
|
+
* object.
|
|
286
|
+
* @returns The user preferences.
|
|
287
|
+
*/
|
|
288
|
+
declare function useUserPreferences(ownerWindow?: Window & typeof globalThis): {
|
|
289
|
+
colorScheme: "dark" | "light";
|
|
290
|
+
highContrast: boolean;
|
|
291
|
+
reducedMotion: boolean;
|
|
292
|
+
transparency: boolean;
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
interface PortalContainerProviderProps {
|
|
296
|
+
/**
|
|
297
|
+
* The container element for the popover. By default, the modal is rendered as
|
|
298
|
+
* a child of the body element.
|
|
299
|
+
*
|
|
300
|
+
* @default undefined
|
|
301
|
+
*/
|
|
302
|
+
portalContainer: HTMLElement | undefined;
|
|
303
|
+
/** The children to render. */
|
|
304
|
+
children: React.ReactNode;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
declare const PortalContainerProvider: React.FC<PortalContainerProviderProps>;
|
|
308
|
+
|
|
309
|
+
declare type OverlayTriggerProps_ = Parameters<typeof useOverlayTrigger>[0];
|
|
310
|
+
interface PopoverProps extends OverlayTriggerProps, OverlayTriggerProps_ {
|
|
311
|
+
/** The children of the popover. */
|
|
312
|
+
children: React.ReactNode | ((state: OverlayTriggerState) => React.ReactNode);
|
|
313
|
+
}
|
|
314
|
+
interface PopoverContentProps extends Omit<AriaPopoverProps, "popoverRef" | "triggerRef" | "arrowSize" | "arrowBoundaryOffset">, StylingProps {
|
|
315
|
+
/**
|
|
316
|
+
* The reference element for the popover position. By default, the popover is
|
|
317
|
+
* positioned relative to the trigger element.
|
|
318
|
+
*/
|
|
319
|
+
triggerRef?: React.RefObject<HTMLElement>;
|
|
320
|
+
/** The class name for the underlay element. */
|
|
321
|
+
underlayClassName?: string;
|
|
322
|
+
/** The contents of the popover. */
|
|
323
|
+
children: React.ReactNode;
|
|
324
|
+
/**
|
|
325
|
+
* The container element for the popover. By default, the modal is rendered as
|
|
326
|
+
* a child of the body element.
|
|
327
|
+
*
|
|
328
|
+
* @default document.body
|
|
329
|
+
*/
|
|
330
|
+
portalContainer?: HTMLElement;
|
|
331
|
+
/**
|
|
332
|
+
* Whether to include an arrow on the popover.
|
|
333
|
+
*
|
|
334
|
+
* @default false
|
|
335
|
+
*/
|
|
336
|
+
includeArrow?: boolean;
|
|
337
|
+
/** The class name for the content container element. */
|
|
338
|
+
contentContainerClassName?: string;
|
|
339
|
+
/** The style for the content container element. */
|
|
340
|
+
contentContainerStyle?: React.CSSProperties;
|
|
341
|
+
}
|
|
342
|
+
interface PopoverTriggerProps {
|
|
343
|
+
/** The contents of the popover trigger. */
|
|
344
|
+
children?: React.ReactNode | (({ isOpen, triggerProps, triggerRef, }: {
|
|
345
|
+
isOpen: boolean;
|
|
346
|
+
triggerProps: AriaButtonProps<"button">;
|
|
347
|
+
triggerRef: React.RefObject<HTMLElement>;
|
|
348
|
+
}) => React.ReactNode);
|
|
349
|
+
/**
|
|
350
|
+
* Client rect to be used as anchor for the popover content when no child
|
|
351
|
+
* element is provided.
|
|
352
|
+
*/
|
|
353
|
+
anchorRect?: Rect;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
357
|
+
|
|
358
|
+
declare const PopoverTrigger: React.FC<PopoverTriggerProps>;
|
|
359
|
+
|
|
360
|
+
declare const Popover: React.FC<PopoverProps>;
|
|
361
|
+
|
|
362
|
+
declare type MenuOption = Omit<ListOption, "description"> & {
|
|
363
|
+
keyboardShortcut?: string;
|
|
364
|
+
};
|
|
365
|
+
declare type MenuSection = Omit<ListSection, "children"> & {
|
|
366
|
+
children: MenuOption[];
|
|
367
|
+
};
|
|
368
|
+
declare type MenuItem = MenuOption | MenuSection;
|
|
369
|
+
declare type MenuPopoverProps = Pick<PopoverContentProps, "isNonModal" | "placement" | "shouldUpdatePosition" | "shouldFlip" | "boundaryElement" | "crossOffset" | "offset" | "portalContainer">;
|
|
370
|
+
interface MenuProps extends MenuPopoverProps, MenuTriggerProps, Omit<AriaMenuProps<MenuItem>, "children">, Omit<AriaMenuTriggerProps, "type"> {
|
|
371
|
+
/** The `className` property assigned to the root element of the component. */
|
|
372
|
+
className?: string;
|
|
373
|
+
/** The `className` property assigned to the content element of the component. */
|
|
374
|
+
contentClassName?: string;
|
|
375
|
+
/** The `className` property assigned to the item element of the component. */
|
|
376
|
+
itemClassName?: string;
|
|
377
|
+
/**
|
|
378
|
+
* A list of items to render in the menu. Items have the following shape:
|
|
379
|
+
*
|
|
380
|
+
* ```ts
|
|
381
|
+
* export type MenuOption = {
|
|
382
|
+
* id: string;
|
|
383
|
+
* label: string;
|
|
384
|
+
* keyboardShortcut?: string;
|
|
385
|
+
* icon?: React.FC<IconProps>;
|
|
386
|
+
* };
|
|
387
|
+
*
|
|
388
|
+
* export type MenuSection = {
|
|
389
|
+
* id: string;
|
|
390
|
+
* title?: string;
|
|
391
|
+
* type: "section";
|
|
392
|
+
* children: MenuOption[];
|
|
393
|
+
* };
|
|
394
|
+
*
|
|
395
|
+
* export type MenuItem = MenuOption | MenuSection;
|
|
396
|
+
* ```
|
|
397
|
+
*/
|
|
398
|
+
items: MenuItem[];
|
|
399
|
+
/**
|
|
400
|
+
* A function that renders the trigger element of the component. The default
|
|
401
|
+
* implementation renders an `ActionButton` component.
|
|
402
|
+
*
|
|
403
|
+
* ```tsx
|
|
404
|
+
* <Menu renderTrigger={({ buttonProps, ref }) => <ActionButton {...buttonProps} label="Label" ref={ref} />
|
|
405
|
+
* ```
|
|
406
|
+
*/
|
|
407
|
+
renderTrigger?: (options: {
|
|
408
|
+
buttonProps: ActionButtonProps;
|
|
409
|
+
ref: React.RefObject<HTMLButtonElement>;
|
|
410
|
+
}) => React.ReactNode;
|
|
411
|
+
/**
|
|
412
|
+
* The label of the trigger element. This can be a string, a React node, or a
|
|
413
|
+
* function that accepts a boolean indicating whether the menu is open.
|
|
414
|
+
*/
|
|
415
|
+
triggerLabel?: React.ReactNode | ((isOpen: boolean) => React.ReactNode);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
declare const Menu: React.ForwardRefExoticComponent<MenuProps & React.RefAttributes<HTMLUListElement>>;
|
|
419
|
+
|
|
420
|
+
interface LinkProps extends AriaLinkOptions, StylingProps {
|
|
421
|
+
/** The link's style variant. */
|
|
422
|
+
variant?: "default" | "inline";
|
|
423
|
+
/** The children to render. */
|
|
424
|
+
children: React.ReactNode;
|
|
425
|
+
/** The size of the link. */
|
|
426
|
+
size?: "sm" | "md" | "lg";
|
|
427
|
+
/**
|
|
428
|
+
* The type of the link.
|
|
429
|
+
*
|
|
430
|
+
* @default "body"
|
|
431
|
+
*/
|
|
432
|
+
type?: "body" | "label";
|
|
433
|
+
/** The title of the link, for providing additional information. */
|
|
434
|
+
title?: string;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLElement>>;
|
|
438
|
+
|
|
439
|
+
interface SharedFileUploadProps extends StylingProps {
|
|
440
|
+
/** Whether the component is inlined. */
|
|
441
|
+
variant?: "default" | "inline";
|
|
442
|
+
/** Whether the component is disabled. */
|
|
443
|
+
isDisabled?: boolean;
|
|
444
|
+
/** The label to display. */
|
|
445
|
+
label: string;
|
|
446
|
+
/** The description to display. */
|
|
447
|
+
description?: string;
|
|
448
|
+
/**
|
|
449
|
+
* The pattern to match the file name against. This is a regular expression,
|
|
450
|
+
* and will be matched against the entire file name.
|
|
451
|
+
*/
|
|
452
|
+
accept?: string;
|
|
453
|
+
/** The name of the input. */
|
|
454
|
+
name?: string;
|
|
455
|
+
/** The callback function that is fired when the value changes. */
|
|
456
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
457
|
+
/**
|
|
458
|
+
* The callback function that is fired when the value changes and the value is
|
|
459
|
+
* valid.
|
|
460
|
+
*/
|
|
461
|
+
onValueChange?: (files: File[]) => void;
|
|
462
|
+
/**
|
|
463
|
+
* Identifies the element (or elements) that provide a detailed, extended
|
|
464
|
+
* description for the object.
|
|
465
|
+
*/
|
|
466
|
+
"aria-describedby"?: string;
|
|
467
|
+
}
|
|
468
|
+
interface FileUploadProps extends SharedFileUploadProps {
|
|
469
|
+
/** The Icon to display. */
|
|
470
|
+
icon?: React.FC<IconProps>;
|
|
471
|
+
/** Whether to allow multiple files to be uploaded. */
|
|
472
|
+
multiple?: boolean;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
declare const FileUpload: React.ForwardRefExoticComponent<FileUploadProps & React.RefAttributes<HTMLLabelElement>>;
|
|
476
|
+
|
|
477
|
+
interface SeparatorProps extends SeparatorProps$1, StylingProps {
|
|
478
|
+
/**
|
|
479
|
+
* The variant of the separator.
|
|
480
|
+
*
|
|
481
|
+
* @default "primary"
|
|
482
|
+
*/
|
|
483
|
+
variant?: "primary" | "secondary";
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
declare const Separator: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLDivElement>>;
|
|
487
|
+
|
|
488
|
+
interface ProgressBarProps extends Omit<AriaProgressBarProps, "isIndeterminate"> {
|
|
489
|
+
/** The `className` property assigned to the root element of the component. */
|
|
490
|
+
className?: string;
|
|
491
|
+
/**
|
|
492
|
+
* The variant of the progress bar.
|
|
493
|
+
*
|
|
494
|
+
* @default active
|
|
495
|
+
*/
|
|
496
|
+
variant?: "active" | "success" | "error";
|
|
497
|
+
/** The description of the progress bar. */
|
|
498
|
+
description?: string;
|
|
499
|
+
/**
|
|
500
|
+
* Whether the progress bar value should be displayed.
|
|
501
|
+
*
|
|
502
|
+
* @default false
|
|
503
|
+
*/
|
|
504
|
+
showValue?: boolean;
|
|
505
|
+
/** The error message of the progress bar. */
|
|
506
|
+
errorMessage?: string;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
declare const ProgressBar: React.ForwardRefExoticComponent<ProgressBarProps & React.RefAttributes<HTMLDivElement>>;
|
|
510
|
+
|
|
511
|
+
interface InputMessage {
|
|
512
|
+
/** The description to display below the input. */
|
|
513
|
+
description?: string;
|
|
514
|
+
/** The error message to display when the input is in an error state. */
|
|
515
|
+
errorMessage?: string;
|
|
516
|
+
/** The warning message to display when the input is in a warning state. */
|
|
517
|
+
warningMessage?: string;
|
|
518
|
+
}
|
|
519
|
+
interface TextInputProps extends Omit<AriaTextFieldProps, "validationState" | "isInvalid" | "description" | "errorMessage">, StylingProps, InputMessage {
|
|
520
|
+
/** The state of the input. */
|
|
521
|
+
validationState?: "valid" | "error" | "warning";
|
|
522
|
+
/**
|
|
523
|
+
* The variant of the text input.
|
|
524
|
+
*
|
|
525
|
+
* @default primary
|
|
526
|
+
*/
|
|
527
|
+
variant?: "primary" | "ghost";
|
|
528
|
+
/**
|
|
529
|
+
* The position of the label relative to the input.
|
|
530
|
+
*
|
|
531
|
+
* @default top
|
|
532
|
+
*/
|
|
533
|
+
labelPosition?: "top" | "start";
|
|
534
|
+
/** Whether the input is read only. */
|
|
535
|
+
readOnly?: boolean;
|
|
536
|
+
/** The style object to apply to the input element */
|
|
537
|
+
inputStyle?: React.CSSProperties;
|
|
538
|
+
/** The class name to apply to the input element */
|
|
539
|
+
inputClassName?: string;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
declare const TextInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
543
|
+
|
|
544
|
+
interface ReactionProps extends Omit<AriaSwitchProps & ToggleProps, "validationState" | "isRequired" | "children" | "isInvalid" | "validationBehavior" | "validate">, StylingProps {
|
|
545
|
+
/** The size of the reaction. */
|
|
546
|
+
size?: "sm" | "md";
|
|
547
|
+
/** The number of reactions. */
|
|
548
|
+
count: number;
|
|
549
|
+
/** The icon to render. */
|
|
550
|
+
icon?: React.FC<IconProps>;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
declare const Reaction: React.ForwardRefExoticComponent<ReactionProps & React.RefAttributes<HTMLLabelElement>>;
|
|
554
|
+
|
|
555
|
+
interface TooltipProps extends TooltipTriggerProps, AriaTooltipProps, Omit<AriaPositionProps, "overlayRef" | "targetRef" | "maxHeight" | "isOpen" | "arrowSize"> {
|
|
556
|
+
/** The content of the tooltip. */
|
|
557
|
+
text?: string;
|
|
558
|
+
/** The tooltip trigger element. */
|
|
559
|
+
children: React.ReactNode;
|
|
560
|
+
/**
|
|
561
|
+
* The delay time for the tooltip to show up.
|
|
562
|
+
*
|
|
563
|
+
* @default 1000
|
|
564
|
+
*/
|
|
565
|
+
delay?: number;
|
|
566
|
+
/**
|
|
567
|
+
* The delay time for the tooltip to hide.
|
|
568
|
+
*
|
|
569
|
+
* @default 500
|
|
570
|
+
*/
|
|
571
|
+
closeDelay?: number;
|
|
572
|
+
/**
|
|
573
|
+
* Represents the size of an element.
|
|
574
|
+
*
|
|
575
|
+
* @default md
|
|
576
|
+
*/
|
|
577
|
+
size?: "sm" | "md";
|
|
578
|
+
/**
|
|
579
|
+
* The variant that can be applied to an element.
|
|
580
|
+
*
|
|
581
|
+
* @default default
|
|
582
|
+
*/
|
|
583
|
+
variant?: "default" | "inverse";
|
|
584
|
+
/**
|
|
585
|
+
* Indicates whether to include an arrow in the output.
|
|
586
|
+
*
|
|
587
|
+
* @default true
|
|
588
|
+
*/
|
|
589
|
+
includeArrow?: boolean;
|
|
590
|
+
/**
|
|
591
|
+
* The container element for the modal. By default, the modal is rendered as a
|
|
592
|
+
* child of the body element.
|
|
593
|
+
*
|
|
594
|
+
* @default document.body
|
|
595
|
+
*/
|
|
596
|
+
portalContainer?: HTMLElement;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
declare const Tooltip: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<HTMLDivElement>>;
|
|
600
|
+
|
|
601
|
+
interface PortalProps extends OverlayProps {
|
|
602
|
+
/** The `className` property assigned to the root element of the component. */
|
|
603
|
+
className?: string;
|
|
604
|
+
/** The `style` property assigned to the root element of the component. */
|
|
605
|
+
style?: React.CSSProperties;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
declare const Portal: React.ForwardRefExoticComponent<PortalProps & React.RefAttributes<HTMLDivElement>>;
|
|
609
|
+
|
|
610
|
+
interface ProgressSpinnerProps extends Omit<AriaProgressBarProps, "value" | "isIndeterminate" | "formatOptions" | "maxValue" | "minValue" | "valueLabel">, StylingProps {
|
|
611
|
+
/**
|
|
612
|
+
* The size of the progress circle.
|
|
613
|
+
*
|
|
614
|
+
* @default md
|
|
615
|
+
*/
|
|
616
|
+
size?: "sm" | "md";
|
|
617
|
+
/**
|
|
618
|
+
* The progress circle's variant.
|
|
619
|
+
*
|
|
620
|
+
* @default active
|
|
621
|
+
*/
|
|
622
|
+
variant?: "active" | "inactive" | "success" | "error";
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
declare const ProgressSpinner: React.ForwardRefExoticComponent<ProgressSpinnerProps & React.RefAttributes<HTMLDivElement>>;
|
|
626
|
+
|
|
627
|
+
interface ActionIconButtonProps extends ActionButtonSharedProps {
|
|
628
|
+
/** The icon to display */
|
|
629
|
+
icon: React.FC<IconProps>;
|
|
630
|
+
/**
|
|
631
|
+
* The size of the icon button.
|
|
632
|
+
*
|
|
633
|
+
* @default "md"
|
|
634
|
+
*/
|
|
635
|
+
size?: "xxs" | "xs" | "sm" | "md" | "lg";
|
|
636
|
+
/**
|
|
637
|
+
* The variant of the icon button.
|
|
638
|
+
*
|
|
639
|
+
* @default "primary"
|
|
640
|
+
*/
|
|
641
|
+
variant?: "primary" | "secondary" | "tertiary" | "ghost" | "toolbar" | "popover";
|
|
642
|
+
/** Indicates whether focusing should be prevented on press. */
|
|
643
|
+
preventFocusOnPress?: boolean;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
declare const ActionIconButton: React.ForwardRefExoticComponent<ActionIconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
647
|
+
|
|
648
|
+
interface ToggleButtonProps extends StylingProps, Omit<AriaToggleButtonProps, "children"> {
|
|
649
|
+
/** The text content of the button. */
|
|
650
|
+
label: React.ReactNode;
|
|
651
|
+
/** The icon to display before the label. */
|
|
652
|
+
iconStart?: React.FC<SVGRProps>;
|
|
653
|
+
/**
|
|
654
|
+
* The size of the button.
|
|
655
|
+
*
|
|
656
|
+
* @default "md"
|
|
657
|
+
*/
|
|
658
|
+
size?: "sm" | "md" | "lg";
|
|
659
|
+
/** Indicates whether focusing should be prevented on press. */
|
|
660
|
+
preventFocusOnPress?: boolean;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
declare const ToggleButton: React.ForwardRefExoticComponent<ToggleButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
664
|
+
|
|
665
|
+
interface CheckboxProps extends Omit<AriaCheckboxProps, "children" | "validationBehavior" | "validationState" | "validate">, StylingProps {
|
|
666
|
+
/** The checkbox's label. */
|
|
667
|
+
label?: string;
|
|
668
|
+
/**
|
|
669
|
+
* The position of the label
|
|
670
|
+
*
|
|
671
|
+
* @default end
|
|
672
|
+
*/
|
|
673
|
+
labelPosition?: "start" | "end";
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLLabelElement>>;
|
|
677
|
+
|
|
678
|
+
declare type Excluded = "isDisabled" | "isReadOnly" | "isRequired" | "locale" | "validationState" | "label" | "formatOptions" | "isInvalid" | "validationBehaviour" | "validate" | "description" | "errorMessage";
|
|
679
|
+
interface PaginationProps extends Omit<AriaNumberFieldProps, Excluded>, Omit<NumberFieldStateOptions, Excluded>, StylingProps {
|
|
680
|
+
/** The largest value allowed for the input. */
|
|
681
|
+
maxValue: number;
|
|
682
|
+
/** The label for the pagination component. */
|
|
683
|
+
"aria-label": string;
|
|
684
|
+
/**
|
|
685
|
+
* The variant of the pagination component.
|
|
686
|
+
*
|
|
687
|
+
* @default floating
|
|
688
|
+
*/
|
|
689
|
+
variant?: "floating" | "pinned";
|
|
690
|
+
/**
|
|
691
|
+
* The size of the pagination component.
|
|
692
|
+
*
|
|
693
|
+
* @default md
|
|
694
|
+
*/
|
|
695
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
declare const Pagination: React.ForwardRefExoticComponent<PaginationProps & React.RefAttributes<HTMLDivElement>>;
|
|
699
|
+
|
|
700
|
+
interface I18nProviderProps extends I18nProviderProps$1 {
|
|
701
|
+
/** The messages to use for internationalization. */
|
|
702
|
+
messages?: LocalizedStrings;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
declare const I18nProvider: React.FC<I18nProviderProps>;
|
|
706
|
+
|
|
707
|
+
declare type NumberFormatProps = Parameters<typeof useNumberFormatter>[0] & {
|
|
708
|
+
/** The number to format. */
|
|
709
|
+
value: number;
|
|
710
|
+
};
|
|
711
|
+
|
|
712
|
+
declare const NumberFormat: React.FC<NumberFormatProps>;
|
|
713
|
+
|
|
714
|
+
declare type DateFormatProps = Parameters<typeof useDateFormatter>[0] & {
|
|
715
|
+
/** The date to format. */
|
|
716
|
+
date: Date;
|
|
717
|
+
};
|
|
718
|
+
|
|
719
|
+
declare const DateFormat: React.FC<DateFormatProps>;
|
|
720
|
+
|
|
721
|
+
interface Item$1 {
|
|
722
|
+
id: string;
|
|
723
|
+
label: string;
|
|
724
|
+
variant?: "neutral" | "red" | "green" | "blue" | "high-contrast";
|
|
725
|
+
icon?: React.FC<SVGRProps>;
|
|
726
|
+
}
|
|
727
|
+
interface TagGroupProps extends StylingProps, Omit<AriaTagGroupProps<Item$1>, "children" | "errorMessage" | "description">, Omit<ListProps<Item$1>, "children" | "collection" | "filter"> {
|
|
728
|
+
/**
|
|
729
|
+
* The items to display in the tag group.
|
|
730
|
+
*
|
|
731
|
+
* Type Item = { id: string; label: string; variant?: "neutral" | "red" |
|
|
732
|
+
* "green" | "blue" | "high-contrast"; icon?: React.FC<SVGRProps>; }
|
|
733
|
+
*/
|
|
734
|
+
items: Item$1[];
|
|
735
|
+
/**
|
|
736
|
+
* The variant of the tag group.
|
|
737
|
+
*
|
|
738
|
+
* @default "neutral"
|
|
739
|
+
*/
|
|
740
|
+
variant?: Item$1["variant"];
|
|
741
|
+
/** The label for the tag group. */
|
|
742
|
+
"aria-label": string;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
declare const TagGroup: React.ForwardRefExoticComponent<TagGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
746
|
+
|
|
747
|
+
interface AccordionProps extends StylingProps {
|
|
748
|
+
/**
|
|
749
|
+
* This prop controls the expansion mode of the accordion. If set to `single`,
|
|
750
|
+
* only one item can be expanded at a time. If set to `multiple`, multiple
|
|
751
|
+
* items can be expanded at the same time.
|
|
752
|
+
*
|
|
753
|
+
* @default single
|
|
754
|
+
*/
|
|
755
|
+
expansionMode?: "single" | "multiple";
|
|
756
|
+
/** This callback is called when the expanded state of the accordion changes. */
|
|
757
|
+
onChange?: (value: Set<Key>) => void;
|
|
758
|
+
/** The children of the accordion. Each child should be an `AccordionItem`. */
|
|
759
|
+
children: React.ReactNode;
|
|
760
|
+
/** The keys of the items that should be expanded by default. */
|
|
761
|
+
defaultExpandedKeys?: Set<Key>;
|
|
762
|
+
/**
|
|
763
|
+
* The keys of the items that should be expanded. If this prop is provided,
|
|
764
|
+
* the accordion will be a controlled component. This means that the expanded
|
|
765
|
+
* state of the accordion will not change unless you update this prop.
|
|
766
|
+
*/
|
|
767
|
+
expandedKeys?: Set<Key>;
|
|
768
|
+
/**
|
|
769
|
+
* The keys of the items that should be disabled. Disabled items cannot be
|
|
770
|
+
* expanded or collapsed.
|
|
771
|
+
*/
|
|
772
|
+
disabledKeys?: Set<Key>;
|
|
773
|
+
}
|
|
774
|
+
interface AccordionItemProps extends StylingProps {
|
|
775
|
+
/** The title of the accordion item. */
|
|
776
|
+
title: string;
|
|
777
|
+
/**
|
|
778
|
+
* The buttons that should be rendered in the accordion item. These buttons
|
|
779
|
+
* will be rendered in the top right corner of the accordion item. They will
|
|
780
|
+
* be rendered in the order they are provided. The buttons will be rendered as
|
|
781
|
+
* `ActionIconButton`s, so you can pass any props that you would pass to an
|
|
782
|
+
* `ActionIconButton`.
|
|
783
|
+
*
|
|
784
|
+
* @example
|
|
785
|
+
* ```jsx
|
|
786
|
+
* <AccordionItem
|
|
787
|
+
* title="Accordion Item"
|
|
788
|
+
* actions={[{
|
|
789
|
+
* icon: EditIcon,
|
|
790
|
+
* label: "Edit",
|
|
791
|
+
* onPress: () => alert("Edit"),
|
|
792
|
+
* }]}>Content</AccordionItem>
|
|
793
|
+
* ```;
|
|
794
|
+
*/
|
|
795
|
+
actions?: Omit<ActionIconButtonProps, "size" | "variant" | "excludeFromTabOrder">[];
|
|
796
|
+
/**
|
|
797
|
+
* The action buttons should only be shown when the user hovers over or
|
|
798
|
+
* focuses the accordion item.
|
|
799
|
+
*
|
|
800
|
+
* @default false
|
|
801
|
+
*/
|
|
802
|
+
showActionsOnTriggerOnly?: boolean;
|
|
803
|
+
/** The content of the accordion item. */
|
|
804
|
+
children: React.ReactNode;
|
|
805
|
+
/** The key of the accordion item. */
|
|
806
|
+
value: Key;
|
|
807
|
+
/**
|
|
808
|
+
* The description of the accordion item. This will be rendered at the end of
|
|
809
|
+
* the accordion header.
|
|
810
|
+
*/
|
|
811
|
+
subLabel?: string;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
declare const Accordion: React.ForwardRefExoticComponent<AccordionProps & React.RefAttributes<HTMLDivElement>>;
|
|
815
|
+
|
|
816
|
+
declare const AccordionItem: React.ForwardRefExoticComponent<AccordionItemProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
817
|
+
|
|
818
|
+
interface SelectProps extends Omit<AriaSelectOptions<ListItem> & SelectStateOptions<ListItem> & PopoverContentProps, "validationState" | "items" | "children" | "isRequired" | "className" | "style" | "triggerRef" | "validate" | "validationBehavior" | "keyboardDelegate">, Pick<ListBoxProps, "items" | "showSelectedIcon" | "optionStyle" | "optionClassName">, StylingProps {
|
|
819
|
+
/**
|
|
820
|
+
* The position of the label.
|
|
821
|
+
*
|
|
822
|
+
* @default "top"
|
|
823
|
+
*/
|
|
824
|
+
labelPosition?: "top" | "start";
|
|
825
|
+
/** The description of the select component. */
|
|
826
|
+
description?: string;
|
|
827
|
+
/** The error message of the select component. */
|
|
828
|
+
errorMessage?: string;
|
|
829
|
+
/** The warning message of the select component. */
|
|
830
|
+
warningMessage?: string;
|
|
831
|
+
/** The label of the select component. */
|
|
832
|
+
label?: React.ReactNode;
|
|
833
|
+
/** The variant of the select component. */
|
|
834
|
+
variant?: "primary" | "ghost";
|
|
835
|
+
/** The state of the select component. */
|
|
836
|
+
validationState?: "valid" | "error" | "warning";
|
|
837
|
+
/** Whether the select component is read only. */
|
|
838
|
+
isReadOnly?: boolean;
|
|
839
|
+
/**
|
|
840
|
+
* This callback can be used to render the trigger element of the select
|
|
841
|
+
* component. The trigger element is the element that is clicked to open the
|
|
842
|
+
* select menu.
|
|
843
|
+
*/
|
|
844
|
+
renderTrigger?: (options: {
|
|
845
|
+
buttonProps: Omit<ActionButtonProps, "variant" | "label" | "elementType" | "iconStart" | "iconEnd">;
|
|
846
|
+
valueProps: DOMAttributes;
|
|
847
|
+
isOpen: boolean;
|
|
848
|
+
selectedValue: ListItem | null;
|
|
849
|
+
ref: React.RefObject<HTMLButtonElement>;
|
|
850
|
+
}) => React.ReactNode;
|
|
851
|
+
}
|
|
852
|
+
interface IconSelectProps extends Omit<SelectProps, "renderTrigger">, Pick<TooltipProps, "placement"> {
|
|
853
|
+
/** The icon to show at the start of the select component. */
|
|
854
|
+
icon: React.FC<IconProps>;
|
|
855
|
+
/** The aria label for the select component. */
|
|
856
|
+
"aria-label": string;
|
|
857
|
+
/** Whether to include a tooltip for the select component. */
|
|
858
|
+
includeTooltip?: boolean;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLDivElement>>;
|
|
862
|
+
|
|
863
|
+
declare const IconSelect: React.ForwardRefExoticComponent<IconSelectProps & React.RefAttributes<HTMLDivElement>>;
|
|
864
|
+
|
|
865
|
+
interface AvatarProps extends StylingProps {
|
|
866
|
+
/**
|
|
867
|
+
* The size of the component.
|
|
868
|
+
*
|
|
869
|
+
* @default "md"
|
|
870
|
+
*/
|
|
871
|
+
size?: "md" | "sm";
|
|
872
|
+
/**
|
|
873
|
+
* The icon to display. This icon has to be imported from the
|
|
874
|
+
* `@baseline-ui/icons` package.
|
|
875
|
+
*/
|
|
876
|
+
icon?: React.FC<SVGRProps>;
|
|
877
|
+
/** The name of the user. */
|
|
878
|
+
name: string;
|
|
879
|
+
/** The URL of the image to display. */
|
|
880
|
+
imgSrc?: string;
|
|
881
|
+
/**
|
|
882
|
+
* The image loading strategy to use. See
|
|
883
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes:~:text=a%20fallback%20destination.-,loading,-Indicates%20how%20the)
|
|
884
|
+
*/
|
|
885
|
+
imgLoading?: "lazy" | "eager";
|
|
886
|
+
/** Whether to show the initials of the user if no image is provided. */
|
|
887
|
+
showInitials?: boolean;
|
|
888
|
+
/** Whether the component is disabled. */
|
|
889
|
+
isDisabled?: boolean;
|
|
890
|
+
/** Whether the user has a notification. */
|
|
891
|
+
hasNotifications?: boolean;
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLSpanElement>>;
|
|
895
|
+
|
|
896
|
+
declare type ItemProps = React.ComponentProps<typeof Item$2> & StylingProps & {
|
|
897
|
+
key?: Key;
|
|
898
|
+
icon?: React.FC<SVGRProps>;
|
|
899
|
+
value?: string;
|
|
900
|
+
title?: string;
|
|
901
|
+
titleClassName?: string;
|
|
902
|
+
titleStyle?: React.CSSProperties;
|
|
903
|
+
};
|
|
904
|
+
declare type TabsProps = Omit<StylingProps & AriaTabListProps<ItemProps>, "orientation" | "children" | "items" | "selectedKey" | "defaultSelectedKey" | "disabledKeys"> & {
|
|
905
|
+
/**
|
|
906
|
+
* The `TabItem` components to render inside the `Tabs` component.
|
|
907
|
+
*
|
|
908
|
+
* ```jsx
|
|
909
|
+
* <Tabs>
|
|
910
|
+
* <TabItem key="tab1" title="Tab 1">
|
|
911
|
+
* <div>Tab 1 content</div>
|
|
912
|
+
* </TabItem>
|
|
913
|
+
* <TabItem key="tab2" title="Tab 2">
|
|
914
|
+
* <div>Tab 2 content</div>
|
|
915
|
+
* </TabItem>
|
|
916
|
+
* </Tabs>;
|
|
917
|
+
* ```
|
|
918
|
+
*/
|
|
919
|
+
children: React.ReactNode;
|
|
920
|
+
/**
|
|
921
|
+
* The key of the tab that needs to be removed.
|
|
922
|
+
*
|
|
923
|
+
* @param key
|
|
924
|
+
*/
|
|
925
|
+
onRemove?: (key: Key) => void;
|
|
926
|
+
/** The value of the tab that needs to be selected. */
|
|
927
|
+
selectedValue?: string;
|
|
928
|
+
/** The default value of the tab that needs to be selected. */
|
|
929
|
+
defaultSelectedValue?: string;
|
|
930
|
+
/** The values of the tabs that need to be disabled. */
|
|
931
|
+
disabledValues?: Set<Key>;
|
|
932
|
+
/** A list of action buttons to render beside the tab items. */
|
|
933
|
+
actions?: Omit<ActionIconButtonProps, "variant" | "size">[];
|
|
934
|
+
/** The variant of the tabs */
|
|
935
|
+
variant?: "primary" | "ghost";
|
|
936
|
+
/** The className to apply to the tab header container. */
|
|
937
|
+
tabHeaderClassName?: string;
|
|
938
|
+
/** The style to apply to the tab header container. */
|
|
939
|
+
tabHeaderStyle?: React.CSSProperties;
|
|
940
|
+
};
|
|
941
|
+
declare type TabItemProps = StylingProps & {
|
|
942
|
+
/** The title of the tab. This will be displayed in the tab button. */
|
|
943
|
+
title: string;
|
|
944
|
+
/** The icon to display in front of the title. */
|
|
945
|
+
icon?: React.FC<SVGRProps>;
|
|
946
|
+
/** The value of the tab. This will be used to identify the tab. */
|
|
947
|
+
value: string;
|
|
948
|
+
/** The className to apply to the tab item. */
|
|
949
|
+
titleClassName?: string;
|
|
950
|
+
/** The style to apply to the tab item. */
|
|
951
|
+
titleStyle?: React.CSSProperties;
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
declare const Tabs: React.ForwardRefExoticComponent<Omit<StylingProps & react_aria.AriaTabListProps<ItemProps>, "children" | "items" | "disabledKeys" | "orientation" | "selectedKey" | "defaultSelectedKey"> & {
|
|
955
|
+
children: React.ReactNode;
|
|
956
|
+
onRemove?: ((key: React.Key) => void) | undefined;
|
|
957
|
+
selectedValue?: string | undefined;
|
|
958
|
+
defaultSelectedValue?: string | undefined;
|
|
959
|
+
disabledValues?: Set<React.Key> | undefined;
|
|
960
|
+
actions?: Omit<ActionIconButtonProps, "size" | "variant">[] | undefined;
|
|
961
|
+
variant?: "primary" | "ghost" | undefined;
|
|
962
|
+
tabHeaderClassName?: string | undefined;
|
|
963
|
+
tabHeaderStyle?: React.CSSProperties | undefined;
|
|
964
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
965
|
+
|
|
966
|
+
declare const TabItem: React.FC<TabItemProps>;
|
|
967
|
+
|
|
968
|
+
interface InlineAlertProps extends StylingProps {
|
|
969
|
+
/**
|
|
970
|
+
* The variant of the alert.
|
|
971
|
+
*
|
|
972
|
+
* @default "info"
|
|
973
|
+
*/
|
|
974
|
+
variant?: "info" | "warning" | "error" | "success";
|
|
975
|
+
/** The title of the alert. */
|
|
976
|
+
title: string;
|
|
977
|
+
/** The description of the alert. */
|
|
978
|
+
description: string;
|
|
979
|
+
/**
|
|
980
|
+
* The label of the action button. When provided, the action button will be
|
|
981
|
+
* rendered.
|
|
982
|
+
*/
|
|
983
|
+
actionLabel?: string;
|
|
984
|
+
/** The callback fired when the action button is clicked. */
|
|
985
|
+
onAction?: () => void;
|
|
986
|
+
/**
|
|
987
|
+
* The callback fired when the close button is clicked. When provided, the
|
|
988
|
+
* close button will be rendered.
|
|
989
|
+
*/
|
|
990
|
+
onClose?: () => void;
|
|
991
|
+
/**
|
|
992
|
+
* The arrangement of the variable.
|
|
993
|
+
*
|
|
994
|
+
* @default "single"
|
|
995
|
+
* @typedef {"single" | "multi" | "compact"} Arrangement
|
|
996
|
+
*/
|
|
997
|
+
arrangement?: "single" | "multi" | "compact";
|
|
998
|
+
/**
|
|
999
|
+
* The size of the alert.
|
|
1000
|
+
*
|
|
1001
|
+
* @default "md"
|
|
1002
|
+
*/
|
|
1003
|
+
size?: "sm" | "md";
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
declare const InlineAlert: React.ForwardRefExoticComponent<InlineAlertProps & React.RefAttributes<HTMLDivElement>>;
|
|
1007
|
+
|
|
1008
|
+
interface NumberInputProps extends StylingProps, Omit<AriaNumberFieldProps, "validationState" | "isRequired" | "validate" | "validationBehavior"> {
|
|
1009
|
+
/**
|
|
1010
|
+
* The position of the label relative to the input.
|
|
1011
|
+
*
|
|
1012
|
+
* @default top
|
|
1013
|
+
*/
|
|
1014
|
+
labelPosition?: "top" | "start";
|
|
1015
|
+
/**
|
|
1016
|
+
* The variant of the number input.
|
|
1017
|
+
*
|
|
1018
|
+
* @default primary
|
|
1019
|
+
*/
|
|
1020
|
+
variant?: "primary" | "ghost";
|
|
1021
|
+
/**
|
|
1022
|
+
* Whether to show the stepper buttons.
|
|
1023
|
+
*
|
|
1024
|
+
* @default true
|
|
1025
|
+
*/
|
|
1026
|
+
showStepper?: boolean;
|
|
1027
|
+
/** The description to display below the input. */
|
|
1028
|
+
description?: string;
|
|
1029
|
+
/** The error message to display when the input is in an error state. */
|
|
1030
|
+
errorMessage?: string;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & React.RefAttributes<HTMLDivElement>>;
|
|
1034
|
+
|
|
1035
|
+
interface DrawerProps extends StylingProps, AriaDialogProps {
|
|
1036
|
+
/** The children to render. */
|
|
1037
|
+
children: React.ReactNode;
|
|
1038
|
+
/**
|
|
1039
|
+
* The valid values for the background type are "medium" and "subtle".
|
|
1040
|
+
*
|
|
1041
|
+
* @default "medium"
|
|
1042
|
+
*/
|
|
1043
|
+
background?: "medium" | "subtle";
|
|
1044
|
+
/** The title to display in the drawer. */
|
|
1045
|
+
title: string;
|
|
1046
|
+
/** The props of additional `ActionIconButton` to display in the drawer header. */
|
|
1047
|
+
action?: ActionIconButtonProps;
|
|
1048
|
+
/** The callback to call when the drawer is requested to be closed. */
|
|
1049
|
+
onCloseRequest?: () => void;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
declare const Drawer: React.ForwardRefExoticComponent<DrawerProps & React.RefAttributes<HTMLDivElement>>;
|
|
1053
|
+
|
|
1054
|
+
interface DialogProps extends AriaDialogProps, StylingProps {
|
|
1055
|
+
/** The children to render. */
|
|
1056
|
+
children: React.ReactNode;
|
|
1057
|
+
/**
|
|
1058
|
+
* The size of the dialog. This defines the max width of the dialog.
|
|
1059
|
+
*
|
|
1060
|
+
* @default "sm"
|
|
1061
|
+
*/
|
|
1062
|
+
size?: "sm" | "md" | "lg" | "content";
|
|
1063
|
+
/**
|
|
1064
|
+
* The variant of the dialog.
|
|
1065
|
+
*
|
|
1066
|
+
* @default "primary"
|
|
1067
|
+
*/
|
|
1068
|
+
variant?: "primary" | "ghost";
|
|
1069
|
+
/**
|
|
1070
|
+
* The background color of the drawer.
|
|
1071
|
+
*
|
|
1072
|
+
* @default "medium"
|
|
1073
|
+
*/
|
|
1074
|
+
drawerBackground?: DrawerProps["background"];
|
|
1075
|
+
/**
|
|
1076
|
+
* When used inside a modal, this prop will decide whether the dialog should
|
|
1077
|
+
* inherit the drawer styles.
|
|
1078
|
+
*
|
|
1079
|
+
* @default false
|
|
1080
|
+
*/
|
|
1081
|
+
inheritDrawer?: boolean;
|
|
1082
|
+
}
|
|
1083
|
+
interface DialogTitleProps extends StylingProps {
|
|
1084
|
+
/** The children to render. */
|
|
1085
|
+
children: React.ReactNode;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
declare const Dialog: React.ForwardRefExoticComponent<DialogProps & React.RefAttributes<HTMLDivElement>>;
|
|
1089
|
+
|
|
1090
|
+
declare const DialogTitle: React.ForwardRefExoticComponent<DialogTitleProps & React.RefAttributes<HTMLDivElement>>;
|
|
1091
|
+
|
|
1092
|
+
interface ColorPreset {
|
|
1093
|
+
label: string;
|
|
1094
|
+
color: string;
|
|
1095
|
+
}
|
|
1096
|
+
interface ColorInputProps extends OverlayTriggerProps, StylingProps, Pick<ColorFieldProps, "onChange" | "defaultValue" | "value" | "label" | "isDisabled">, Pick<AriaLabelingProps, "aria-label">, Pick<PopoverContentProps, "isNonModal" | "placement" | "shouldUpdatePosition" | "shouldFlip" | "boundaryElement" | "crossOffset" | "offset" | "portalContainer"> {
|
|
1097
|
+
/**
|
|
1098
|
+
* The list of color presets to show in the color picker. The signature of the
|
|
1099
|
+
* color presets is:
|
|
1100
|
+
*
|
|
1101
|
+
* ```ts
|
|
1102
|
+
* export interface ColorPreset {
|
|
1103
|
+
* label: string;
|
|
1104
|
+
* color: string;
|
|
1105
|
+
* }
|
|
1106
|
+
* ```
|
|
1107
|
+
*
|
|
1108
|
+
* The color can be a hex or hexa value.
|
|
1109
|
+
*/
|
|
1110
|
+
presets?: ColorPreset[];
|
|
1111
|
+
/**
|
|
1112
|
+
* Whether to include the custom color picker. If `false`, the color picker
|
|
1113
|
+
* will only show the color presets. The custom color picker allows the user
|
|
1114
|
+
* to pick any color. You can set the `allowAlpha` prop to `false` to disable
|
|
1115
|
+
* the alpha channel.
|
|
1116
|
+
*
|
|
1117
|
+
* @default true
|
|
1118
|
+
*/
|
|
1119
|
+
includePicker?: boolean;
|
|
1120
|
+
/**
|
|
1121
|
+
* Whether to show the color label. The color label is the name of the color
|
|
1122
|
+
* that is currently selected. If boolean, the label will be shown only when
|
|
1123
|
+
* the color is not `null`. If a function, the function will be called with
|
|
1124
|
+
* the current color and should return a string. If `false`, the label will
|
|
1125
|
+
* not be shown.
|
|
1126
|
+
*
|
|
1127
|
+
* @default true
|
|
1128
|
+
*/
|
|
1129
|
+
colorLabel?: boolean | ((color: Color | null) => string);
|
|
1130
|
+
/**
|
|
1131
|
+
* Whether to allow alpha values in the custom color picker.
|
|
1132
|
+
*
|
|
1133
|
+
* @default true
|
|
1134
|
+
*/
|
|
1135
|
+
allowAlpha?: boolean;
|
|
1136
|
+
/**
|
|
1137
|
+
* Whether to allow the removal of the color.
|
|
1138
|
+
*
|
|
1139
|
+
* @default false
|
|
1140
|
+
*/
|
|
1141
|
+
allowRemoval?: boolean;
|
|
1142
|
+
/** The label position of the color input. */
|
|
1143
|
+
labelPosition?: "top" | "start";
|
|
1144
|
+
/**
|
|
1145
|
+
* Whether to show the color picker in active or lazy mode. In active mode,
|
|
1146
|
+
* the color picker will be rendered when the color input popover is open and
|
|
1147
|
+
* the value of the color input will be updated when the user picks a color.
|
|
1148
|
+
* In lazy mode, the color picker will be rendered only when the user clicks
|
|
1149
|
+
* on the "Add color" button and the selected color will be added to custom
|
|
1150
|
+
* colors when the user clicks on the "Add color" button.
|
|
1151
|
+
*
|
|
1152
|
+
* @default active
|
|
1153
|
+
*/
|
|
1154
|
+
pickerMode?: "active" | "lazy";
|
|
1155
|
+
/**
|
|
1156
|
+
* The key to use to store the picked color in the local storage.
|
|
1157
|
+
*
|
|
1158
|
+
* @default baselinePickedColor
|
|
1159
|
+
*/
|
|
1160
|
+
storePickedColorKey?: string;
|
|
1161
|
+
/**
|
|
1162
|
+
* The label to show on the add color button.
|
|
1163
|
+
*
|
|
1164
|
+
* @default Add color
|
|
1165
|
+
*/
|
|
1166
|
+
addColorButtonLabel?: string;
|
|
1167
|
+
/**
|
|
1168
|
+
* The label to show on the remove color button.
|
|
1169
|
+
*
|
|
1170
|
+
* @default Remove color
|
|
1171
|
+
*/
|
|
1172
|
+
removeColorButtonLabel?: string;
|
|
1173
|
+
/**
|
|
1174
|
+
* The label to show on the custom colors section.
|
|
1175
|
+
*
|
|
1176
|
+
* @default Custom colors
|
|
1177
|
+
*/
|
|
1178
|
+
customColorsLabel?: string;
|
|
1179
|
+
/**
|
|
1180
|
+
* An optional function to render the custom trigger button.
|
|
1181
|
+
*
|
|
1182
|
+
* @param options
|
|
1183
|
+
*/
|
|
1184
|
+
renderTriggerButton?: (options: {
|
|
1185
|
+
isOpen: boolean;
|
|
1186
|
+
color: Color | null;
|
|
1187
|
+
ref: React.RefObject<HTMLButtonElement>;
|
|
1188
|
+
colorName?: string | boolean;
|
|
1189
|
+
triggerProps: AriaButtonProps<"button">;
|
|
1190
|
+
labelId?: string;
|
|
1191
|
+
}) => React.ReactElement;
|
|
1192
|
+
}
|
|
1193
|
+
interface IconColorInputProps extends StylingProps, Omit<ColorInputProps, "renderTriggerButton" | "colorLabel" | "label" | "labelPosition">, Pick<TooltipProps, "placement"> {
|
|
1194
|
+
/** The icon to show at the start of the color input. */
|
|
1195
|
+
icon: React.FC<IconProps>;
|
|
1196
|
+
/** Whether to include a tooltip for the color input. */
|
|
1197
|
+
includeTooltip?: boolean;
|
|
1198
|
+
/** The aria label for the color input button. */
|
|
1199
|
+
"aria-label": string;
|
|
1200
|
+
/**
|
|
1201
|
+
* The variant of the color input button.
|
|
1202
|
+
*
|
|
1203
|
+
* @default standard
|
|
1204
|
+
*/
|
|
1205
|
+
variant: "compact" | "standard";
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
declare const ColorInput: React.ForwardRefExoticComponent<ColorInputProps & React.RefAttributes<HTMLDivElement>>;
|
|
1209
|
+
|
|
1210
|
+
declare const ColorSwatch: React.FC<ColorSwatchProps>;
|
|
1211
|
+
interface ColorSwatchProps {
|
|
1212
|
+
color?: string;
|
|
1213
|
+
isFocusVisible?: boolean;
|
|
1214
|
+
isDisabled?: boolean;
|
|
1215
|
+
isSelected?: boolean;
|
|
1216
|
+
isPresentational?: boolean;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
declare const IconColorInputButton: React.ForwardRefExoticComponent<Omit<ColorInputButtonProps, "children" | "color" | "labelPosition"> & {
|
|
1220
|
+
icon: React.FC<IconProps>;
|
|
1221
|
+
color?: string | null | undefined;
|
|
1222
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
1223
|
+
interface ColorInputButtonProps extends Omit<ActionButtonProps, "label">, Pick<ColorInputProps, "colorLabel"> {
|
|
1224
|
+
isOpen: boolean;
|
|
1225
|
+
"aria-label"?: string;
|
|
1226
|
+
labelPosition?: "top" | "start";
|
|
1227
|
+
color: Color | null;
|
|
1228
|
+
colorName?: string | boolean;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
declare const IconColorInput: React.ForwardRefExoticComponent<IconColorInputProps & React.RefAttributes<HTMLDivElement>>;
|
|
1232
|
+
|
|
1233
|
+
interface FreehandCanvasProps extends StylingProps, AriaLabelingProps {
|
|
1234
|
+
/** The className applicable to the SVG canvas. */
|
|
1235
|
+
canvasClassName?: string;
|
|
1236
|
+
/** The style applicable to the SVG canvas. */
|
|
1237
|
+
canvasStyle?: React.CSSProperties;
|
|
1238
|
+
/** The ref for the canvas. */
|
|
1239
|
+
canvasRef?: React.RefObject<HTMLDivElement>;
|
|
1240
|
+
/** The className applicable to the footer. */
|
|
1241
|
+
footerClassName?: string;
|
|
1242
|
+
/** The style applicable to the footer. */
|
|
1243
|
+
footerStyle?: React.CSSProperties;
|
|
1244
|
+
/**
|
|
1245
|
+
* How much to soften the stroke's edges.
|
|
1246
|
+
*
|
|
1247
|
+
* @default 0
|
|
1248
|
+
*/
|
|
1249
|
+
smoothing?: number;
|
|
1250
|
+
/**
|
|
1251
|
+
* How much to streamline the stroke.
|
|
1252
|
+
*
|
|
1253
|
+
* @default 0
|
|
1254
|
+
*/
|
|
1255
|
+
streamline?: number;
|
|
1256
|
+
/** An easing function to apply to each point's pressure. */
|
|
1257
|
+
easing?: (pressure: number) => number;
|
|
1258
|
+
/**
|
|
1259
|
+
* Whether to simulate pressure based on velocity.
|
|
1260
|
+
*
|
|
1261
|
+
* @default false
|
|
1262
|
+
*/
|
|
1263
|
+
simulatePressure?: boolean;
|
|
1264
|
+
/** Cap, taper and easing for the start of the line. */
|
|
1265
|
+
start?: {
|
|
1266
|
+
cap?: boolean;
|
|
1267
|
+
taper?: number | boolean;
|
|
1268
|
+
easing?: (distance: number) => number;
|
|
1269
|
+
};
|
|
1270
|
+
/** Cap, taper and easing for the end of the line. */
|
|
1271
|
+
end?: {
|
|
1272
|
+
cap?: boolean;
|
|
1273
|
+
taper?: number | boolean;
|
|
1274
|
+
easing?: (distance: number) => number;
|
|
1275
|
+
};
|
|
1276
|
+
/**
|
|
1277
|
+
* The width of the stroke.
|
|
1278
|
+
*
|
|
1279
|
+
* @default 2
|
|
1280
|
+
*/
|
|
1281
|
+
strokeWidth?: number;
|
|
1282
|
+
/**
|
|
1283
|
+
* The color of the stroke.
|
|
1284
|
+
*
|
|
1285
|
+
* @default #3A87FD
|
|
1286
|
+
*/
|
|
1287
|
+
strokeColor?: string;
|
|
1288
|
+
/**
|
|
1289
|
+
* Whether to keep the points within the canvas.
|
|
1290
|
+
*
|
|
1291
|
+
* @default true
|
|
1292
|
+
*/
|
|
1293
|
+
isBound?: boolean;
|
|
1294
|
+
/**
|
|
1295
|
+
* Callback for when the points change. This is called on every point change.
|
|
1296
|
+
*
|
|
1297
|
+
* @param points
|
|
1298
|
+
*/
|
|
1299
|
+
onChange?: (points: number[][][]) => void;
|
|
1300
|
+
/**
|
|
1301
|
+
* Callback for when the points change has ended. This is called once after
|
|
1302
|
+
* the pointerup event. It is recommended to use this callback for performance
|
|
1303
|
+
* reasons.
|
|
1304
|
+
*
|
|
1305
|
+
* @param points
|
|
1306
|
+
*/
|
|
1307
|
+
onChangeEnd?: (points: number[][][]) => void;
|
|
1308
|
+
/** The default points to render. */
|
|
1309
|
+
defaultValue?: number[][][];
|
|
1310
|
+
/**
|
|
1311
|
+
* The value of the canvas. This can be used to make the canvas a controlled
|
|
1312
|
+
* component.
|
|
1313
|
+
*/
|
|
1314
|
+
value?: number[][][];
|
|
1315
|
+
/** The label for the canvas. */
|
|
1316
|
+
label?: string;
|
|
1317
|
+
/**
|
|
1318
|
+
* Whether to enable history for undo/redo.
|
|
1319
|
+
*
|
|
1320
|
+
* @default false
|
|
1321
|
+
*/
|
|
1322
|
+
enableHistory?: boolean;
|
|
1323
|
+
/**
|
|
1324
|
+
* Whether the canvas is inline.
|
|
1325
|
+
*
|
|
1326
|
+
* @default true
|
|
1327
|
+
*/
|
|
1328
|
+
isInline?: boolean;
|
|
1329
|
+
/** Whether the canvas is disabled. */
|
|
1330
|
+
isDisabled?: boolean;
|
|
1331
|
+
/** The placeholder for the canvas. */
|
|
1332
|
+
placeholder?: string;
|
|
1333
|
+
/** The label for the clear button. */
|
|
1334
|
+
clearLabel?: string;
|
|
1335
|
+
/** The label for the undo button. */
|
|
1336
|
+
undoLabel?: string;
|
|
1337
|
+
/** The label for the redo button. */
|
|
1338
|
+
redoLabel?: string;
|
|
1339
|
+
/** Description for the canvas. */
|
|
1340
|
+
description?: string;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
declare const FreehandCanvas: React.ForwardRefExoticComponent<FreehandCanvasProps & React.RefAttributes<HTMLDivElement>>;
|
|
1344
|
+
|
|
1345
|
+
declare type TextProps<T extends keyof React.JSX.IntrinsicElements = "span"> = StylingProps & React.ComponentProps<T> & {
|
|
1346
|
+
/**
|
|
1347
|
+
* The type of text to render.
|
|
1348
|
+
*
|
|
1349
|
+
* @default "title"
|
|
1350
|
+
*/
|
|
1351
|
+
type?: "subtitle" | "title" | "label" | "value" | "helper" | "body";
|
|
1352
|
+
/**
|
|
1353
|
+
* The size of the text.
|
|
1354
|
+
*
|
|
1355
|
+
* @default "md"
|
|
1356
|
+
*/
|
|
1357
|
+
size?: "sm" | "md" | "lg";
|
|
1358
|
+
/** The text to render. Can be a string or a number. */
|
|
1359
|
+
children: React.ReactNode;
|
|
1360
|
+
/**
|
|
1361
|
+
* The HTML element to render.
|
|
1362
|
+
*
|
|
1363
|
+
* @default "span"
|
|
1364
|
+
*/
|
|
1365
|
+
elementType?: React.ElementType;
|
|
1366
|
+
};
|
|
1367
|
+
|
|
1368
|
+
declare const Text: React.ForwardRefExoticComponent<Pick<TextProps<"span">, "onDrop" | "onDragStart" | "onDragEnd" | "type" | "className" | "style" | "dir" | "slot" | "title" | "children" | "autoFocus" | "onFocus" | "onBlur" | "id" | "aria-label" | "aria-labelledby" | "aria-describedby" | "aria-details" | "data-block-id" | "color" | "size" | "content" | "translate" | "hidden" | "elementType" | "role" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStartCapture" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & React.RefAttributes<HTMLDivElement>>;
|
|
1369
|
+
|
|
1370
|
+
interface TransformProps {
|
|
1371
|
+
/** The `className` property assigned to the root element of the component. */
|
|
1372
|
+
className?: string;
|
|
1373
|
+
/** The `style` property assigned to the root element of the component. */
|
|
1374
|
+
style?: React.CSSProperties;
|
|
1375
|
+
/** The children to render. */
|
|
1376
|
+
children: (options: {
|
|
1377
|
+
style: React.CSSProperties;
|
|
1378
|
+
}) => React.ReactNode;
|
|
1379
|
+
/** Whether the transform is draggable. */
|
|
1380
|
+
isDraggable?: boolean;
|
|
1381
|
+
/** Whether the transform is resizable. */
|
|
1382
|
+
isResizable?: boolean;
|
|
1383
|
+
/** Whether the transform is rotatable. */
|
|
1384
|
+
isRotatable?: boolean;
|
|
1385
|
+
/** Whether the transform is snappable. */
|
|
1386
|
+
isSnappable?: boolean;
|
|
1387
|
+
/** A callback that will be called when the transform changes. */
|
|
1388
|
+
onTransform?: (transform: OnRender) => void;
|
|
1389
|
+
/** A callback that will be called when the transform starts. */
|
|
1390
|
+
onTransformStart?: (transform: OnRenderStart) => void;
|
|
1391
|
+
/** A callback that will be called when the transform ends. */
|
|
1392
|
+
onTransformEnd?: (transform: OnRender) => void;
|
|
1393
|
+
/** A callback that will be called when the target drag starts. */
|
|
1394
|
+
onDragStart?: (e: OnDragStart) => void;
|
|
1395
|
+
/** A callback that will be called when the target is dragged. */
|
|
1396
|
+
onDrag?: (e: OnDrag) => void;
|
|
1397
|
+
/** A callback that will be called when the target drag ends. */
|
|
1398
|
+
onDragEnd?: (e: OnDragEnd) => void;
|
|
1399
|
+
/** A callback that will be called when the target resize starts. */
|
|
1400
|
+
onResizeStart?: (e: OnResizeStart) => void;
|
|
1401
|
+
/** A callback that will be called when the target is resized. */
|
|
1402
|
+
onResize?: (e: OnResize) => void;
|
|
1403
|
+
/** A callback that will be called when the target resize ends. */
|
|
1404
|
+
onResizeEnd?: (e: OnResizeEnd) => void;
|
|
1405
|
+
/** A callback that will be called when the target rotation starts. */
|
|
1406
|
+
onRotateStart?: (e: OnRotateStart) => void;
|
|
1407
|
+
/** A callback that will be called when the target is rotated. */
|
|
1408
|
+
onRotate?: (e: OnRotate) => void;
|
|
1409
|
+
/** A callback that will be called when the target rotation ends. */
|
|
1410
|
+
onRotateEnd?: (e: OnRotateEnd) => void;
|
|
1411
|
+
/** A callback that will be called when the target is snapped. */
|
|
1412
|
+
onSnap?: (e: OnSnap) => void;
|
|
1413
|
+
/** A callback that will be called when the child is double clicked. */
|
|
1414
|
+
onDoubleClick?: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
1415
|
+
/** A list of selectors relative to which the guidelines will be rendered. */
|
|
1416
|
+
elementGuidelines?: string[];
|
|
1417
|
+
/**
|
|
1418
|
+
* Set directions to show the control box.
|
|
1419
|
+
*
|
|
1420
|
+
* @default false if rotatable, ["n", "nw", "ne", "s", "se", "sw", "e", "w"] otherwise
|
|
1421
|
+
*/
|
|
1422
|
+
renderDirections?: boolean | ("n" | "nw" | "ne" | "s" | "se" | "sw" | "e" | "w")[];
|
|
1423
|
+
/**
|
|
1424
|
+
* Whether the anchor should be hidden when dragging.
|
|
1425
|
+
*
|
|
1426
|
+
* @default true
|
|
1427
|
+
*/
|
|
1428
|
+
hideAnchorOnDrag?: boolean;
|
|
1429
|
+
/** The `title` property assigned to the root element of the component. */
|
|
1430
|
+
title: string;
|
|
1431
|
+
/** The position of the rotation anchor. */
|
|
1432
|
+
rotationPosition?: RotationPosition;
|
|
1433
|
+
/**
|
|
1434
|
+
* Degree angles to snap to rotation
|
|
1435
|
+
*
|
|
1436
|
+
* @default [ ]
|
|
1437
|
+
*/
|
|
1438
|
+
snapRotationDegrees?: number[];
|
|
1439
|
+
/**
|
|
1440
|
+
* Snap works if `abs(current rotation - snapRotationDegrees) <
|
|
1441
|
+
* snapRotationThreshold`.
|
|
1442
|
+
*
|
|
1443
|
+
* @default 5
|
|
1444
|
+
*/
|
|
1445
|
+
snapRotationThreshold?: number;
|
|
1446
|
+
/** Whether the transform should be updated automatically. */
|
|
1447
|
+
autoUpdate?: boolean;
|
|
1448
|
+
/** The element ref, selector or element to which the transform will be bound. */
|
|
1449
|
+
bound?: React.RefObject<HTMLElement> | string | HTMLElement;
|
|
1450
|
+
/** The element ref, selector or element that is it's scrollable ancestor. */
|
|
1451
|
+
scrollableAncestor?: React.RefObject<HTMLElement> | string | HTMLElement;
|
|
1452
|
+
/**
|
|
1453
|
+
* Whether to prevent bubbling of events like mousedown, touchstart, etc.
|
|
1454
|
+
*
|
|
1455
|
+
* @default false
|
|
1456
|
+
*/
|
|
1457
|
+
stopPropagation?: boolean;
|
|
1458
|
+
/**
|
|
1459
|
+
* Whether to call preventDefault on touchstart or mousedown
|
|
1460
|
+
*
|
|
1461
|
+
* @default true
|
|
1462
|
+
*/
|
|
1463
|
+
preventDefault?: boolean;
|
|
1464
|
+
/**
|
|
1465
|
+
* The default transformOrigin of the target can be set in advance.
|
|
1466
|
+
*
|
|
1467
|
+
* @default ""
|
|
1468
|
+
*/
|
|
1469
|
+
transformOrigin?: (string | number)[] | string;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
declare const Transform: React.ForwardRefExoticComponent<TransformProps & React.RefAttributes<HTMLDivElement>>;
|
|
1473
|
+
|
|
1474
|
+
interface ImageDropZoneProps extends Omit<SharedFileUploadProps, "label" | "variant">, Omit<DropOptions, "ref" | "getDropOperation" | "hasDropButton" | "getDropOperationForPoint">, Omit<ClipboardProps, "getItems" | "onCut" | "onCopy">, Pick<FreehandCanvasProps, "footerClassName" | "footerStyle" | "placeholder" | "clearLabel">, AriaLabelingProps {
|
|
1475
|
+
/**
|
|
1476
|
+
* The initial image to display. This will be used as the `src` attribute of
|
|
1477
|
+
* the `<img>` element. You will be able to choose a new image.
|
|
1478
|
+
*/
|
|
1479
|
+
defaultImageSrc?: string | File;
|
|
1480
|
+
/**
|
|
1481
|
+
* The image to display. This will be used as the `src` attribute of the
|
|
1482
|
+
* `<img>` element and will not be able to be changed from within the
|
|
1483
|
+
* component. Basically, this makes the component controlled.
|
|
1484
|
+
*/
|
|
1485
|
+
imageSrc?: string | File;
|
|
1486
|
+
/**
|
|
1487
|
+
* The alt text to display for the image. This will be used as the `alt`
|
|
1488
|
+
* attribute of the `<img>`. element. If no `imageAlt` is provided, the
|
|
1489
|
+
* `label` will be used.
|
|
1490
|
+
*/
|
|
1491
|
+
imageAlt?: string;
|
|
1492
|
+
/** The label to display for the picker button. */
|
|
1493
|
+
pickerButtonLabel?: string;
|
|
1494
|
+
/**
|
|
1495
|
+
* Whether to show the checkered background behind the image. This is useful
|
|
1496
|
+
* when the image has transparency.
|
|
1497
|
+
*
|
|
1498
|
+
* @default true
|
|
1499
|
+
*/
|
|
1500
|
+
includeCheckeredBackground?: boolean;
|
|
1501
|
+
/** Whether the component is inlined. */
|
|
1502
|
+
isInline?: boolean;
|
|
1503
|
+
/** The class name to apply to the picker button. */
|
|
1504
|
+
pickerButtonClassName?: string;
|
|
1505
|
+
/** The style to apply to the picker button. */
|
|
1506
|
+
pickerButtonStyle?: React.CSSProperties;
|
|
1507
|
+
/** The class name to apply to the label. */
|
|
1508
|
+
labelClassName?: string;
|
|
1509
|
+
/** The style to apply to the label. */
|
|
1510
|
+
labelStyle?: React.CSSProperties;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
declare const ImageDropZone: React.ForwardRefExoticComponent<ImageDropZoneProps & React.RefAttributes<HTMLDivElement>>;
|
|
1514
|
+
|
|
1515
|
+
interface PreviewProps extends StylingProps, AriaLabelingProps {
|
|
1516
|
+
/**
|
|
1517
|
+
* Whether the preview should be displayed inline or not. This is just a
|
|
1518
|
+
* visual change, the component will still behave the same.
|
|
1519
|
+
*
|
|
1520
|
+
* @default true
|
|
1521
|
+
*/
|
|
1522
|
+
isInline?: boolean;
|
|
1523
|
+
/**
|
|
1524
|
+
* The image to display in the preview. This can be a URL or a base64 encoded
|
|
1525
|
+
* string.
|
|
1526
|
+
*/
|
|
1527
|
+
imageSrc?: string;
|
|
1528
|
+
/** The alt text for the image. */
|
|
1529
|
+
imageAlt?: string;
|
|
1530
|
+
/** The SVG to display in the preview. This can be a React element or a string. */
|
|
1531
|
+
svgSrc?: string | React.ReactElement;
|
|
1532
|
+
/** Whether the preview should be disabled or not. */
|
|
1533
|
+
isDisabled?: boolean;
|
|
1534
|
+
/** The text to display in the preview. */
|
|
1535
|
+
textValue?: string;
|
|
1536
|
+
/** The style of the text. */
|
|
1537
|
+
textStyle?: React.CSSProperties;
|
|
1538
|
+
/**
|
|
1539
|
+
* This is fired when the `actionButtons` are not passed and you trigger a
|
|
1540
|
+
* `click` event on the preview. In case you have passed `actionButtons`, this
|
|
1541
|
+
* is not fired as focus shifts to the action buttons.
|
|
1542
|
+
*/
|
|
1543
|
+
onPress?: PressProps["onPress"];
|
|
1544
|
+
/**
|
|
1545
|
+
* The callback to be called when the delete button is clicked. When passed,
|
|
1546
|
+
* the delete button is displayed.
|
|
1547
|
+
*/
|
|
1548
|
+
onDelete?: ActionButtonProps["onPress"];
|
|
1549
|
+
/**
|
|
1550
|
+
* The label to be used for the delete button. This is used for accessibility
|
|
1551
|
+
* purposes.
|
|
1552
|
+
*/
|
|
1553
|
+
deleteAriaLabel?: string;
|
|
1554
|
+
/** The callback to be called when the preview is clicked. */
|
|
1555
|
+
addAriaLabel?: string;
|
|
1556
|
+
/**
|
|
1557
|
+
* The accent variable represents the type of accent color used in the
|
|
1558
|
+
* application. It can have one of the following values:
|
|
1559
|
+
*
|
|
1560
|
+
* - "theme": Represents the accent color defined by the current application
|
|
1561
|
+
* theme.
|
|
1562
|
+
* - "positive": Represents a positive accent color that doesn't change with
|
|
1563
|
+
* theme.
|
|
1564
|
+
*
|
|
1565
|
+
* @default "theme"
|
|
1566
|
+
*/
|
|
1567
|
+
accent?: "theme" | "positive";
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
declare const Preview: React.ForwardRefExoticComponent<PreviewProps & React.RefAttributes<HTMLDivElement>>;
|
|
1571
|
+
|
|
1572
|
+
interface RadioGroupProps extends StylingProps, Omit<AriaRadioGroupProps, "description" | "errorMessage" | "isRequired" | "isInvalid" | "validate" | "validationBehavior" | "validationState"> {
|
|
1573
|
+
/**
|
|
1574
|
+
* The position of the label relative to the input.
|
|
1575
|
+
*
|
|
1576
|
+
* @default top
|
|
1577
|
+
*/
|
|
1578
|
+
labelPosition?: "top" | "start";
|
|
1579
|
+
/**
|
|
1580
|
+
* The list of items to render in the radio group. Items have the following
|
|
1581
|
+
* shape:
|
|
1582
|
+
*
|
|
1583
|
+
* ```ts
|
|
1584
|
+
* export type ListOption = {
|
|
1585
|
+
* id: string;
|
|
1586
|
+
* label: string;
|
|
1587
|
+
* description?: string;
|
|
1588
|
+
* icon?: React.FC<IconProps>;
|
|
1589
|
+
* };
|
|
1590
|
+
* ```
|
|
1591
|
+
*/
|
|
1592
|
+
items: ListOption[];
|
|
1593
|
+
/**
|
|
1594
|
+
* Render item option
|
|
1595
|
+
*
|
|
1596
|
+
* @typedef {Object} RenderItemOptions
|
|
1597
|
+
* @property {boolean} isFocusVisible - Whether the focus ring is visible.
|
|
1598
|
+
* @property {boolean} isFocused - Whether the option is focused.
|
|
1599
|
+
* @property {boolean} isSelected - Whether the option is selected.
|
|
1600
|
+
* @property {boolean} isHovered - Whether the option is hovered.
|
|
1601
|
+
* @property {boolean} isDisabled - Whether the option is disabled.
|
|
1602
|
+
*/
|
|
1603
|
+
/**
|
|
1604
|
+
* The custom render function for the radio group options.
|
|
1605
|
+
*
|
|
1606
|
+
* @param {ListOption} item The item to render.
|
|
1607
|
+
* @param {RenderItemOptions} options The options for rendering the item.
|
|
1608
|
+
*/
|
|
1609
|
+
renderOption?: (item: ListOption, options: {
|
|
1610
|
+
isFocusVisible: boolean;
|
|
1611
|
+
isFocused: boolean;
|
|
1612
|
+
isSelected: boolean;
|
|
1613
|
+
isHovered: boolean;
|
|
1614
|
+
isDisabled: boolean;
|
|
1615
|
+
optionLabelPosition: "start" | "end";
|
|
1616
|
+
isReadOnly?: boolean;
|
|
1617
|
+
}) => React.ReactNode;
|
|
1618
|
+
/** The class name for the group container. */
|
|
1619
|
+
optionsContainerClassName?: string;
|
|
1620
|
+
/** The style for the group container. */
|
|
1621
|
+
optionsContainerStyle?: React.CSSProperties;
|
|
1622
|
+
/** The ids of the items that are disabled. */
|
|
1623
|
+
disabledValues?: string[];
|
|
1624
|
+
/**
|
|
1625
|
+
* The position of the label of individual radio buttons.
|
|
1626
|
+
*
|
|
1627
|
+
* @default end
|
|
1628
|
+
*/
|
|
1629
|
+
optionLabelPosition?: "start" | "end";
|
|
1630
|
+
/** The className applicable to the label. */
|
|
1631
|
+
optionClassName?: string;
|
|
1632
|
+
/** The style applicable to the label. */
|
|
1633
|
+
optionStyle?: React.CSSProperties;
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
1637
|
+
|
|
1638
|
+
interface ModalProps extends OverlayTriggerProps {
|
|
1639
|
+
}
|
|
1640
|
+
interface ModalContentProps extends Omit<AriaModalOverlayProps, "isDismissable" | "isKeyboardDismissDisabled">, StylingProps {
|
|
1641
|
+
/**
|
|
1642
|
+
* The contents of the modal. Can be a React node or a function that returns a
|
|
1643
|
+
* React node.
|
|
1644
|
+
*/
|
|
1645
|
+
children: React.ReactNode | ((props: {
|
|
1646
|
+
close: () => void;
|
|
1647
|
+
}) => React.ReactNode);
|
|
1648
|
+
/**
|
|
1649
|
+
* The container element for the modal. By default, the modal is rendered as a
|
|
1650
|
+
* child of the body element.
|
|
1651
|
+
*
|
|
1652
|
+
* @default document.body
|
|
1653
|
+
*/
|
|
1654
|
+
portalContainer?: HTMLElement;
|
|
1655
|
+
/**
|
|
1656
|
+
* Whether to disable the animation for the modal. This is useful when you
|
|
1657
|
+
* want to render one modal after another without the animation.
|
|
1658
|
+
*
|
|
1659
|
+
* @default false
|
|
1660
|
+
*/
|
|
1661
|
+
disableAnimation?: boolean;
|
|
1662
|
+
/**
|
|
1663
|
+
* Whether the modal should be rendered as a drawer. This will render the
|
|
1664
|
+
* modal with a transparent background and no border at the bottom. The `auto`
|
|
1665
|
+
* value will render the modal as a drawer on mobile and as a dialog on
|
|
1666
|
+
* desktop and tablet.
|
|
1667
|
+
*
|
|
1668
|
+
* @default false
|
|
1669
|
+
*/
|
|
1670
|
+
enableDrawer?: boolean | "auto";
|
|
1671
|
+
/**
|
|
1672
|
+
* Specifies if the component is dismissable or not. If the value is a
|
|
1673
|
+
* function, it will be called with a boolean indicating if the modal is
|
|
1674
|
+
* rendered as a drawer or not.
|
|
1675
|
+
*
|
|
1676
|
+
* @default true
|
|
1677
|
+
*/
|
|
1678
|
+
isDismissable?: boolean | ((isDrawer: boolean) => boolean);
|
|
1679
|
+
/**
|
|
1680
|
+
* Determines if keyboard dismissal is disabled. If the value is a function,
|
|
1681
|
+
* it will be called with a boolean indicating if the modal is rendered as a
|
|
1682
|
+
* drawer or not.
|
|
1683
|
+
*
|
|
1684
|
+
* @default false
|
|
1685
|
+
*/
|
|
1686
|
+
isKeyboardDismissDisabled?: boolean | ((isDrawer: boolean) => boolean);
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
declare const Modal: React.FC<ModalProps>;
|
|
1690
|
+
|
|
1691
|
+
declare const ModalContent: React.FC<ModalContentProps>;
|
|
1692
|
+
|
|
1693
|
+
declare const ModalTrigger: React.FC;
|
|
1694
|
+
|
|
1695
|
+
declare const ModalClose: React.FC;
|
|
1696
|
+
|
|
1697
|
+
interface MessageFormatProps {
|
|
1698
|
+
/**
|
|
1699
|
+
* By default `<MessageFormat>` will render the formatted string into a
|
|
1700
|
+
* `<React.Fragment>`. If you need to customize rendering, you can either wrap
|
|
1701
|
+
* it with another React element (recommended), specify a different tagName
|
|
1702
|
+
* (e.g., 'div')
|
|
1703
|
+
*/
|
|
1704
|
+
elementType?: React.ElementType | "div" | "span";
|
|
1705
|
+
/** The id of the message to format. */
|
|
1706
|
+
id: string;
|
|
1707
|
+
/** The default message to use if the message id is not found. */
|
|
1708
|
+
defaultMessage?: string;
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
declare const MessageFormat: React.FC<MessageFormatProps>;
|
|
1712
|
+
|
|
1713
|
+
interface GroupProps extends StylingProps, AriaLabelingProps {
|
|
1714
|
+
/**
|
|
1715
|
+
* The `role` property specifies the accessibility `role` for the group. By
|
|
1716
|
+
* default, it is set to 'group'. If the contents of the group are important
|
|
1717
|
+
* enough to be included in the page table of contents, use 'region'. If the
|
|
1718
|
+
* group is visual only and does not represent a semantic grouping of
|
|
1719
|
+
* controls, use 'presentation'.
|
|
1720
|
+
*
|
|
1721
|
+
* @default group
|
|
1722
|
+
*/
|
|
1723
|
+
role?: "group" | "region" | "presentation";
|
|
1724
|
+
/** Whether the group is disabled. */
|
|
1725
|
+
isDisabled?: boolean;
|
|
1726
|
+
/** The children to render. */
|
|
1727
|
+
children: React.ReactNode;
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
declare const Group: React.ForwardRefExoticComponent<GroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
1731
|
+
|
|
1732
|
+
declare type SprinkleProps = Parameters<Sprinkles>[0];
|
|
1733
|
+
interface BoxProps extends Pick<StylingProps, "data-block-id">, Omit<React.ComponentPropsWithoutRef<"div">, "color">, SprinkleProps {
|
|
1734
|
+
/**
|
|
1735
|
+
* The HTML element to use for the box.
|
|
1736
|
+
*
|
|
1737
|
+
* @default "div"
|
|
1738
|
+
*/
|
|
1739
|
+
elementType?: string;
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
declare const Box: React.ForwardRefExoticComponent<BoxProps & React.RefAttributes<HTMLDivElement>>;
|
|
1743
|
+
|
|
1744
|
+
interface ColorPresetInlineInputProps extends Omit<RadioGroupProps, "items" | "disabledValues"> {
|
|
1745
|
+
items: ColorPreset[];
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
declare const ColorPresetInlineInput: React.ForwardRefExoticComponent<ColorPresetInlineInputProps & React.RefAttributes<HTMLDivElement>>;
|
|
1749
|
+
|
|
1750
|
+
interface ToolbarProps extends StylingProps, AriaToolbarProps {
|
|
1751
|
+
/** The children of the toolbar. */
|
|
1752
|
+
children: React.ReactNode;
|
|
1753
|
+
/**
|
|
1754
|
+
* Identifies the element (or elements) whose contents or presence are
|
|
1755
|
+
* controlled by the current element.
|
|
1756
|
+
*/
|
|
1757
|
+
"aria-controls"?: string;
|
|
1758
|
+
/**
|
|
1759
|
+
* This prop is used to determine if the toolbar should be collapsible. If
|
|
1760
|
+
* true, the buttons in the toolbar will be hidden behind a menu when the
|
|
1761
|
+
* toolbar is too small to display all of the buttons.
|
|
1762
|
+
*
|
|
1763
|
+
* @default false
|
|
1764
|
+
*/
|
|
1765
|
+
isCollapsible?: boolean;
|
|
1766
|
+
/**
|
|
1767
|
+
* The props to pass to the Menu component when the toolbar is collapsible.
|
|
1768
|
+
* This prop is only relevant when `isCollapsible` is true.
|
|
1769
|
+
*/
|
|
1770
|
+
collapsibleMenuProps?: Omit<MenuProps, "items" | "onAction" | "placement" | "disabledKeys">;
|
|
1771
|
+
/**
|
|
1772
|
+
* A function that renders a spacer element in the collapsible toolbar between
|
|
1773
|
+
* the toolbar buttons and the menu trigger. This prop is only relevant when
|
|
1774
|
+
* `isCollapsible` is true.
|
|
1775
|
+
*/
|
|
1776
|
+
renderSpacer?: () => React.ReactNode;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
declare const Toolbar: React.ForwardRefExoticComponent<ToolbarProps & React.RefAttributes<HTMLDivElement>>;
|
|
1780
|
+
|
|
1781
|
+
interface ToggleIconButtonProps extends StylingProps, Omit<ToggleProps, "children">, Omit<ToggleButtonProps, "size" | "iconStart" | "label"> {
|
|
1782
|
+
/**
|
|
1783
|
+
* The available sizes for a variable.
|
|
1784
|
+
*
|
|
1785
|
+
* @default "md"
|
|
1786
|
+
*/
|
|
1787
|
+
size?: "xxs" | "xs" | "sm" | "md" | "lg";
|
|
1788
|
+
/** Represents the variant of a component. */
|
|
1789
|
+
variant?: "primary" | "secondary" | "tertiary" | "toolbar";
|
|
1790
|
+
/**
|
|
1791
|
+
* The icon to be displayed on the button. You can pass an object with
|
|
1792
|
+
* `selected` and `unselected` keys to display different icons based on the
|
|
1793
|
+
* state of the button.
|
|
1794
|
+
*/
|
|
1795
|
+
icon: React.FC<IconProps> | {
|
|
1796
|
+
selected: React.FC<IconProps>;
|
|
1797
|
+
unselected: React.FC<IconProps>;
|
|
1798
|
+
};
|
|
1799
|
+
/** Indicates whether focusing should be prevented on press. */
|
|
1800
|
+
preventFocusOnPress?: boolean;
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
declare const ToggleIconButton: React.ForwardRefExoticComponent<ToggleIconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
1804
|
+
|
|
1805
|
+
interface MentionableUser {
|
|
1806
|
+
id: string;
|
|
1807
|
+
name: string;
|
|
1808
|
+
displayName: string;
|
|
1809
|
+
avatar?: AvatarProps;
|
|
1810
|
+
description?: string;
|
|
1811
|
+
}
|
|
1812
|
+
interface EditorHandle {
|
|
1813
|
+
setCaretPosition: (index: number) => void;
|
|
1814
|
+
}
|
|
1815
|
+
interface EditorProps extends StylingProps, AriaLabelingProps {
|
|
1816
|
+
/**
|
|
1817
|
+
* The function to be called when `Enter` key is pressed or Save button is
|
|
1818
|
+
* clicked.
|
|
1819
|
+
*/
|
|
1820
|
+
onSave?: (value: string) => void;
|
|
1821
|
+
/**
|
|
1822
|
+
* The function to be called when Cancel button is clicked. If not provided,
|
|
1823
|
+
* the Cancel button will not be rendered.
|
|
1824
|
+
*/
|
|
1825
|
+
onCancel?: () => void;
|
|
1826
|
+
/** The default value of the editor. */
|
|
1827
|
+
defaultValue?: string;
|
|
1828
|
+
/** The value of the editor. */
|
|
1829
|
+
value?: string;
|
|
1830
|
+
/**
|
|
1831
|
+
* The function to be called when the value of the editor changes.
|
|
1832
|
+
*
|
|
1833
|
+
* @param value
|
|
1834
|
+
*/
|
|
1835
|
+
onChange?: (value: string) => void;
|
|
1836
|
+
/** Whether the editor is disabled. This includes both input and save button. */
|
|
1837
|
+
isDisabled?: boolean;
|
|
1838
|
+
/** Whether saving it disabled. Ths disables only save button. */
|
|
1839
|
+
isSaveDisabled?: boolean;
|
|
1840
|
+
/**
|
|
1841
|
+
* Indicates whether rich text is enabled or not.
|
|
1842
|
+
*
|
|
1843
|
+
* @default true
|
|
1844
|
+
*/
|
|
1845
|
+
enableRichText?: boolean;
|
|
1846
|
+
/** The placeholder text to be displayed when the editor is empty. */
|
|
1847
|
+
placeholder?: string;
|
|
1848
|
+
/**
|
|
1849
|
+
* The variant of the editor.
|
|
1850
|
+
*
|
|
1851
|
+
* @default default
|
|
1852
|
+
*/
|
|
1853
|
+
variant?: "default" | "minimal";
|
|
1854
|
+
/** Whether the editor is inline or not. */
|
|
1855
|
+
isInline?: boolean;
|
|
1856
|
+
/** Specifies whether spell checking is enabled or disabled. */
|
|
1857
|
+
spellCheck?: boolean;
|
|
1858
|
+
/**
|
|
1859
|
+
* Optional property that represents the ARIA label for the submit button.
|
|
1860
|
+
* This property is used to provide an accessible label for the button, which
|
|
1861
|
+
* is read by screen readers to assist visually impaired users.
|
|
1862
|
+
*
|
|
1863
|
+
* @default Save
|
|
1864
|
+
*/
|
|
1865
|
+
submitButtonAriaLabel?: string;
|
|
1866
|
+
/**
|
|
1867
|
+
* The React node representing the icon to be displayed on the submit button.
|
|
1868
|
+
*
|
|
1869
|
+
* @default ArrowUpCircleFilledIcon
|
|
1870
|
+
*/
|
|
1871
|
+
submitButtonIcon?: React.FC<IconProps>;
|
|
1872
|
+
/**
|
|
1873
|
+
* Optional property that represents the ARIA label for the cancel button.
|
|
1874
|
+
*
|
|
1875
|
+
* @default Cancel
|
|
1876
|
+
*/
|
|
1877
|
+
cancelButtonAriaLabel?: string;
|
|
1878
|
+
/**
|
|
1879
|
+
* The name of the avatar. The avatar is visible when `variant` is set to
|
|
1880
|
+
* `minimal` and `enableRichText` is set to `false`.
|
|
1881
|
+
*/
|
|
1882
|
+
avatarName?: string;
|
|
1883
|
+
/**
|
|
1884
|
+
* The ARIA label for the editable content. In case of rich text, this label
|
|
1885
|
+
* is used to provide an accessible label for the contenteditable element,
|
|
1886
|
+
* which is read by screen readers to assist visually impaired users. In case
|
|
1887
|
+
* of plain text, this label is used to provide an accessible label for the
|
|
1888
|
+
* textarea element.
|
|
1889
|
+
*
|
|
1890
|
+
* @default Editing Area
|
|
1891
|
+
*/
|
|
1892
|
+
editableContentAriaLabel?: string;
|
|
1893
|
+
/**
|
|
1894
|
+
* An optional array of mentionable users. Mention feature is only available
|
|
1895
|
+
* when `enableRichText` is set to `true` and this prop is provided.
|
|
1896
|
+
*
|
|
1897
|
+
* ```tsx
|
|
1898
|
+
* type MentionableUser = {
|
|
1899
|
+
* id: string;
|
|
1900
|
+
* name: string;
|
|
1901
|
+
* displayName: string;
|
|
1902
|
+
* avatar?: AvatarProps;
|
|
1903
|
+
* description?: string;
|
|
1904
|
+
* };
|
|
1905
|
+
* ```
|
|
1906
|
+
*/
|
|
1907
|
+
mentionableUsers?: MentionableUser[];
|
|
1908
|
+
/**
|
|
1909
|
+
* The maximum number of mentionable users to be displayed in the suggestions.
|
|
1910
|
+
* This prop is only used when `mentionableUsers` is provided.
|
|
1911
|
+
*
|
|
1912
|
+
* @default 10
|
|
1913
|
+
*/
|
|
1914
|
+
maxMentionableUsersSuggestions?: number;
|
|
1915
|
+
/** Footer button represents the buttons that are displayed in the footer. */
|
|
1916
|
+
footerButtons?: ({
|
|
1917
|
+
type: "action";
|
|
1918
|
+
props: Omit<ActionIconButtonProps, "size" | "variant">;
|
|
1919
|
+
} | {
|
|
1920
|
+
type: "toggle";
|
|
1921
|
+
props: Omit<ToggleIconButtonProps, "size" | "variant">;
|
|
1922
|
+
})[];
|
|
1923
|
+
/** The imperative handle for manipulating editor. */
|
|
1924
|
+
editorHandle?: React.RefObject<EditorHandle>;
|
|
1925
|
+
/**
|
|
1926
|
+
* Whether to clear the editor value when the editor is saved.
|
|
1927
|
+
*
|
|
1928
|
+
* @default false
|
|
1929
|
+
*/
|
|
1930
|
+
clearOnSave?: boolean;
|
|
1931
|
+
/**
|
|
1932
|
+
* Whether to clear the editor value when the cancel button is clicked.
|
|
1933
|
+
*
|
|
1934
|
+
* @default false
|
|
1935
|
+
*/
|
|
1936
|
+
clearOnCancel?: boolean;
|
|
1937
|
+
/**
|
|
1938
|
+
* Whether to autofocus the editor when it is mounted.
|
|
1939
|
+
*
|
|
1940
|
+
* @default false
|
|
1941
|
+
*/
|
|
1942
|
+
autoFocus?: boolean;
|
|
1943
|
+
/**
|
|
1944
|
+
* Whether to save the editor value when `Enter` key is pressed.
|
|
1945
|
+
*
|
|
1946
|
+
* @default false
|
|
1947
|
+
*/
|
|
1948
|
+
saveOnEnter?: boolean;
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
declare const Editor: React.MemoExoticComponent<React.ForwardRefExoticComponent<EditorProps & React.RefAttributes<HTMLDivElement>>>;
|
|
1952
|
+
|
|
1953
|
+
interface ScrollControlButtonProps extends StylingProps, Pick<ActionButtonProps, "label"> {
|
|
1954
|
+
/**
|
|
1955
|
+
* The ref to the scrollable element.
|
|
1956
|
+
*
|
|
1957
|
+
* @default document.body
|
|
1958
|
+
*/
|
|
1959
|
+
scrollRef?: React.RefObject<HTMLElement>;
|
|
1960
|
+
/**
|
|
1961
|
+
* Indicates whether the button should be hidden when the keyboard is being
|
|
1962
|
+
* used.
|
|
1963
|
+
*
|
|
1964
|
+
* @default false
|
|
1965
|
+
*/
|
|
1966
|
+
hideForKeyboard?: boolean;
|
|
1967
|
+
/**
|
|
1968
|
+
* The delay in milliseconds before the button is hidden when the scrolling
|
|
1969
|
+
* stops.
|
|
1970
|
+
*
|
|
1971
|
+
* @default 1500
|
|
1972
|
+
*/
|
|
1973
|
+
delay?: number;
|
|
1974
|
+
/**
|
|
1975
|
+
* Indicates whether the scroll should be smooth.
|
|
1976
|
+
*
|
|
1977
|
+
* @default true
|
|
1978
|
+
*/
|
|
1979
|
+
smoothScroll?: boolean;
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
declare const ScrollControlButton: React.ForwardRefExoticComponent<ScrollControlButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
1983
|
+
|
|
1984
|
+
interface TransitionProps extends StylingProps {
|
|
1985
|
+
isMounted: boolean;
|
|
1986
|
+
transitions: UseTransitionProps;
|
|
1987
|
+
elementType?: keyof React.ReactHTML;
|
|
1988
|
+
children: React.ReactNode;
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
declare const Transition: React.ForwardRefExoticComponent<TransitionProps & React.RefAttributes<HTMLElement>>;
|
|
1992
|
+
|
|
1993
|
+
interface AlertDialogProps extends StylingProps {
|
|
1994
|
+
/**
|
|
1995
|
+
* The title of the dialog. This is the main heading of the dialog and is
|
|
1996
|
+
* displayed at the top of the dialog.
|
|
1997
|
+
*/
|
|
1998
|
+
title: string;
|
|
1999
|
+
/**
|
|
2000
|
+
* The message of the dialog. This is the main content of the dialog and is
|
|
2001
|
+
* displayed below the title.
|
|
2002
|
+
*/
|
|
2003
|
+
message?: React.ReactNode;
|
|
2004
|
+
/**
|
|
2005
|
+
* The label for the cancel button. This is the text that is displayed on the
|
|
2006
|
+
* button that allows the user to cancel the dialog.
|
|
2007
|
+
*/
|
|
2008
|
+
cancelLabel?: string;
|
|
2009
|
+
/**
|
|
2010
|
+
* The label for the confirm button. This is the text that is displayed on the
|
|
2011
|
+
* button that allows the user to confirm the dialog.
|
|
2012
|
+
*/
|
|
2013
|
+
primaryActionLabel?: string;
|
|
2014
|
+
/**
|
|
2015
|
+
* The function that is called when the user confirms the dialog. This is
|
|
2016
|
+
* called when the user clicks the primary action button.
|
|
2017
|
+
*/
|
|
2018
|
+
onPrimaryAction?: () => void;
|
|
2019
|
+
/**
|
|
2020
|
+
* The function that is called when the user cancels the dialog. This is
|
|
2021
|
+
* called when the user clicks the cancel button or the close button.
|
|
2022
|
+
*/
|
|
2023
|
+
onCancel?: () => void;
|
|
2024
|
+
/** The button that should be focused when the dialog is opened. */
|
|
2025
|
+
autoFocusButton?: "primary" | "cancel";
|
|
2026
|
+
/** Whether the primary action button should be disabled. */
|
|
2027
|
+
isPrimaryActionDisabled?: boolean;
|
|
2028
|
+
/**
|
|
2029
|
+
* The props that are passed to the text input. If this is provided, a text
|
|
2030
|
+
* input will be displayed at the bottom of the dialog.
|
|
2031
|
+
*/
|
|
2032
|
+
textInputProps?: TextInputProps;
|
|
2033
|
+
/**
|
|
2034
|
+
* The icon that is displayed at the top of the dialog. This is typically used
|
|
2035
|
+
* to display an icon that represents the type of alert that is being shown.
|
|
2036
|
+
*/
|
|
2037
|
+
icon?: React.FC<IconProps>;
|
|
2038
|
+
/** The color of the icon. This is the color that is used to fill the icon. */
|
|
2039
|
+
iconColor?: string;
|
|
2040
|
+
/**
|
|
2041
|
+
* Whether the close button should be displayed in the top end corner of the
|
|
2042
|
+
* dialog. If this is `true`, a close button will be displayed. If this is
|
|
2043
|
+
* `false`, no close button will be displayed.
|
|
2044
|
+
*
|
|
2045
|
+
* @default true
|
|
2046
|
+
*/
|
|
2047
|
+
showCloseButton?: boolean;
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
declare const AlertDialog: React.ForwardRefExoticComponent<AlertDialogProps & React.RefAttributes<HTMLDivElement>>;
|
|
2051
|
+
|
|
2052
|
+
interface MarkdownProps extends StylingProps {
|
|
2053
|
+
/** The markdown to render. */
|
|
2054
|
+
children: string;
|
|
2055
|
+
/** The flag to show the caret at the end */
|
|
2056
|
+
showCaret?: boolean;
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2059
|
+
declare const Markdown: React.ForwardRefExoticComponent<MarkdownProps & React.RefAttributes<HTMLDivElement>>;
|
|
2060
|
+
|
|
2061
|
+
interface AudioPlayerProps extends StylingProps, AriaLabelingProps {
|
|
2062
|
+
/**
|
|
2063
|
+
* The sources of the audio file. The `url` is the URL of the audio file, and
|
|
2064
|
+
* the `type` is the MIME type of the audio file.
|
|
2065
|
+
*
|
|
2066
|
+
* ```tsx
|
|
2067
|
+
* <AudioPlayer
|
|
2068
|
+
* sources={[
|
|
2069
|
+
* { url: "/sound.mp3", type: "audio/mpeg" },
|
|
2070
|
+
* { url: "/sound.ogg", type: "audio/ogg" },
|
|
2071
|
+
* ]}
|
|
2072
|
+
* />
|
|
2073
|
+
* ```
|
|
2074
|
+
*/
|
|
2075
|
+
sources: {
|
|
2076
|
+
url: string;
|
|
2077
|
+
type: string;
|
|
2078
|
+
}[];
|
|
2079
|
+
/**
|
|
2080
|
+
* The size of the audio player.
|
|
2081
|
+
*
|
|
2082
|
+
* @default "lg"
|
|
2083
|
+
*/
|
|
2084
|
+
size?: "sm" | "lg";
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
declare const AudioPlayer: React.ForwardRefExoticComponent<AudioPlayerProps & React.RefAttributes<HTMLDivElement>>;
|
|
2088
|
+
|
|
2089
|
+
interface Item {
|
|
2090
|
+
id: string;
|
|
2091
|
+
src?: string;
|
|
2092
|
+
alt?: string;
|
|
2093
|
+
label: string;
|
|
2094
|
+
}
|
|
2095
|
+
interface ImageGalleryProps extends StylingProps, Omit<ListBoxProps, "items" | "layout" | "grid" | "renderOption" | "renderDropIndicator" | "renderDragPreview" | "showSelectedIcon" | "orientation" | "shouldSelectOnPressUp" | "shouldFocusOnHover" | "dropIndicatorClassName" | "dropIndicatorStyle" | "shouldUseVirtualFocus" | "getItems" | "acceptedDragTypes" | "sectionClassName" | "sectionStyle"> {
|
|
2096
|
+
/**
|
|
2097
|
+
* An array of objects containing the image source, alt text, and label for
|
|
2098
|
+
* each image.
|
|
2099
|
+
*
|
|
2100
|
+
* ```tsx
|
|
2101
|
+
* const items = [
|
|
2102
|
+
* {
|
|
2103
|
+
* id: "1",
|
|
2104
|
+
* src: "https://example.com/image1.jpg",
|
|
2105
|
+
* alt: "Image 1",
|
|
2106
|
+
* label: "Image 1",
|
|
2107
|
+
* },
|
|
2108
|
+
* {
|
|
2109
|
+
* id: "2",
|
|
2110
|
+
* src: "https://example.com/image2.jpg",
|
|
2111
|
+
* alt: "Image 2",
|
|
2112
|
+
* label: "Image 2",
|
|
2113
|
+
* },
|
|
2114
|
+
* ];
|
|
2115
|
+
* ```
|
|
2116
|
+
*/
|
|
2117
|
+
items?: Item[];
|
|
2118
|
+
/**
|
|
2119
|
+
* The width of the images.
|
|
2120
|
+
*
|
|
2121
|
+
* @default "sm"
|
|
2122
|
+
*/
|
|
2123
|
+
imageWidth?: number | "sm" | "md";
|
|
2124
|
+
/**
|
|
2125
|
+
* The aspect ratio of the images.
|
|
2126
|
+
*
|
|
2127
|
+
* @default 16 / 9
|
|
2128
|
+
*/
|
|
2129
|
+
aspectRatio?: number;
|
|
2130
|
+
/**
|
|
2131
|
+
* The fit of the images.
|
|
2132
|
+
*
|
|
2133
|
+
* @default "cover"
|
|
2134
|
+
*/
|
|
2135
|
+
fit?: "contain" | "cover";
|
|
2136
|
+
/** A callback that is called when the list of images or selection is updated. */
|
|
2137
|
+
onListChange?: (items: Item[]) => void;
|
|
2138
|
+
/** A callback that is called when an image is deleted. */
|
|
2139
|
+
onDelete?: (keys: Selection$1) => void;
|
|
2140
|
+
/** A callback that is called when a key is pressed. */
|
|
2141
|
+
onKeyDown?: (event: React.KeyboardEvent<HTMLDivElement>) => void;
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
declare const ImageGallery: React.ForwardRefExoticComponent<ImageGalleryProps & React.RefAttributes<HTMLDivElement>>;
|
|
2145
|
+
|
|
2146
|
+
interface ButtonSelectProps extends StylingProps, Pick<SelectProps, "isDisabled" | "validationState" | "onSelectionChange" | "selectedKey" | "defaultSelectedKey" | "items" | "showSelectedIcon" | "isOpen" | "defaultOpen">, Pick<ActionButtonProps, "onPress" | "excludeFromTabOrder">, AriaLabelingProps {
|
|
2147
|
+
/**
|
|
2148
|
+
* The size of the button.
|
|
2149
|
+
*
|
|
2150
|
+
* @default "md"
|
|
2151
|
+
*/
|
|
2152
|
+
size?: "md" | "lg";
|
|
2153
|
+
/**
|
|
2154
|
+
* Whether to hide the label in the button.
|
|
2155
|
+
*
|
|
2156
|
+
* @default false
|
|
2157
|
+
*/
|
|
2158
|
+
hideLabel?: boolean;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
declare const ButtonSelect: React.ForwardRefExoticComponent<ButtonSelectProps & React.RefAttributes<HTMLDivElement>>;
|
|
2162
|
+
|
|
2163
|
+
interface ComboBoxProps extends StylingProps, Omit<AriaComboBoxOptions<ListItem>, "items" | "children" | "inputRef" | "popoverRef" | "listBoxRef" | "buttonRef" | "validationState" | "errorMessage" | "description">, Omit<AriaComboBoxProps<ListItem>, "items" | "children" | "errorMessage" | "description" | "validationState">, Omit<ListBoxProps, "autoFocus" | "onBlur" | "onFocus" | "onSelectionChange" | "selectionBehavior" | "selectionMode" | "selectedKeys" | "defaultSelectedKeys" | "renderDropIndicator" | "renderDragPreview" | "dropIndicatorClassName" | "dropIndicatorStyle" | keyof DragAndDropProps>, AriaValidationProps, Omit<ComboBoxStateOptions<ListItem>, "items" | "children" | "errorMessage" | "description" | "validationState" | "selectedKey">, InputMessage {
|
|
2164
|
+
/** ID of the initially selected item */
|
|
2165
|
+
defaultSelectedKey?: string;
|
|
2166
|
+
/**
|
|
2167
|
+
* The state of the combobox input.
|
|
2168
|
+
*
|
|
2169
|
+
* @default valid
|
|
2170
|
+
*/
|
|
2171
|
+
validationState?: "valid" | "error" | "warning";
|
|
2172
|
+
/**
|
|
2173
|
+
* The variant of the text input.
|
|
2174
|
+
*
|
|
2175
|
+
* @default primary
|
|
2176
|
+
*/
|
|
2177
|
+
variant?: "primary" | "ghost";
|
|
2178
|
+
/**
|
|
2179
|
+
* The position of the label relative to the input.
|
|
2180
|
+
*
|
|
2181
|
+
* @default top
|
|
2182
|
+
*/
|
|
2183
|
+
labelPosition?: "top" | "start";
|
|
2184
|
+
/** Whether the input is read only. */
|
|
2185
|
+
readOnly?: boolean;
|
|
2186
|
+
/** The style object to apply to the input element */
|
|
2187
|
+
inputStyle?: React.CSSProperties;
|
|
2188
|
+
/** The class name to apply to the input element */
|
|
2189
|
+
inputClassName?: string;
|
|
2190
|
+
/** Optional label for the toggle button */
|
|
2191
|
+
toggleLabel?: string;
|
|
2192
|
+
/**
|
|
2193
|
+
* The custom render function for the listbox options.
|
|
2194
|
+
*
|
|
2195
|
+
* @param item Node<ListItem>
|
|
2196
|
+
* @param options [OptionAria]()
|
|
2197
|
+
* @param ref React.RefObject<HTMLLIElement>
|
|
2198
|
+
*/
|
|
2199
|
+
renderOption?: (item: Node$1<ListItem>, options: OptionAria & {
|
|
2200
|
+
showSelectedIcon?: boolean;
|
|
2201
|
+
_state: ListState<ListItem>;
|
|
2202
|
+
}, ref: React.Ref<HTMLLIElement>) => React.ReactNode;
|
|
2203
|
+
filterItems?: boolean;
|
|
2204
|
+
onInputChange?: (value: string) => void;
|
|
2205
|
+
showIcon?: boolean;
|
|
2206
|
+
/**
|
|
2207
|
+
* The items to render in the listbox. Items have the following shape:
|
|
2208
|
+
*
|
|
2209
|
+
* ```ts
|
|
2210
|
+
* export type ListOption = {
|
|
2211
|
+
* id: string;
|
|
2212
|
+
* label: string;
|
|
2213
|
+
* description?: string;
|
|
2214
|
+
* icon?: React.FC<IconProps>;
|
|
2215
|
+
* };
|
|
2216
|
+
*
|
|
2217
|
+
* export type ListSection = {
|
|
2218
|
+
* id: string;
|
|
2219
|
+
* title?: string;
|
|
2220
|
+
* type: "section";
|
|
2221
|
+
* children: ListOption[];
|
|
2222
|
+
* };
|
|
2223
|
+
*
|
|
2224
|
+
* type ListItem = ListOption | ListSection;
|
|
2225
|
+
* ```
|
|
2226
|
+
*/
|
|
2227
|
+
items: ListItem[];
|
|
2228
|
+
/**
|
|
2229
|
+
* Specify which interaction should trigger the dropdown to open
|
|
2230
|
+
*
|
|
2231
|
+
* @default input
|
|
2232
|
+
*/
|
|
2233
|
+
menuTrigger?: "manual" | "input" | "focus";
|
|
2234
|
+
/** Custom filter function to use when filtering items. */
|
|
2235
|
+
filter?: ComboBoxStateOptions<ListItem>["defaultFilter"];
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
declare const ComboBox: React.ForwardRefExoticComponent<ComboBoxProps & React.RefAttributes<HTMLDivElement>>;
|
|
2239
|
+
|
|
2240
|
+
/**
|
|
2241
|
+
* A hook that creates an IntersectionObserver and observes a target element.
|
|
2242
|
+
*
|
|
2243
|
+
* @example
|
|
2244
|
+
* ```tsx
|
|
2245
|
+
* import { useIntersectionObserver } from "@baseline-ui/core";
|
|
2246
|
+
*
|
|
2247
|
+
* const MyComponent = () => {
|
|
2248
|
+
* const ref = useRef(null);
|
|
2249
|
+
*
|
|
2250
|
+
* const onIntersect = (entry) => {
|
|
2251
|
+
* console.log(entry);
|
|
2252
|
+
* };
|
|
2253
|
+
*
|
|
2254
|
+
* useIntersectionObserver({ ref, onIntersect });
|
|
2255
|
+
*
|
|
2256
|
+
* return <div ref={ref}>Hello world</div>;
|
|
2257
|
+
* };
|
|
2258
|
+
* ```;
|
|
2259
|
+
*
|
|
2260
|
+
* @param {IntersectionObserverOptions} options - The options for the
|
|
2261
|
+
* IntersectionObserver.
|
|
2262
|
+
* @param {React.RefObject<HTMLElement>} options.ref - The ref of the target
|
|
2263
|
+
* element to observe.
|
|
2264
|
+
* @param {(entry: IntersectionObserverEntry) => void} options.onIntersect - The
|
|
2265
|
+
* function to call when the target element intersects the root element.
|
|
2266
|
+
* @param {boolean} options.isDisabled - Whether the IntersectionObserver should
|
|
2267
|
+
* be disabled.
|
|
2268
|
+
* @param {number | number[]} options.threshold - The threshold(s) at which to
|
|
2269
|
+
* trigger the onIntersect function.
|
|
2270
|
+
* @param {string} options.rootMargin - The margin around the root element.
|
|
2271
|
+
* @param {React.RefObject<HTMLElement>} options.root - The ref of the root
|
|
2272
|
+
* element to observe.
|
|
2273
|
+
*/
|
|
2274
|
+
declare function useIntersectionObserver({ ref, onIntersect, isDisabled, threshold, rootMargin, root, }: IntersectionObserverOptions): void;
|
|
2275
|
+
interface IntersectionObserverOptions {
|
|
2276
|
+
ref: React.RefObject<HTMLElement>;
|
|
2277
|
+
onIntersect: (entry: IntersectionObserverEntry) => void;
|
|
2278
|
+
root?: React.RefObject<HTMLElement>;
|
|
2279
|
+
rootMargin?: string;
|
|
2280
|
+
threshold?: number;
|
|
2281
|
+
isDisabled?: boolean;
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
/**
|
|
2285
|
+
* A hook that observes the size changes of a DOM element using the
|
|
2286
|
+
* ResizeObserver API.
|
|
2287
|
+
*
|
|
2288
|
+
* @example
|
|
2289
|
+
* ```tsx
|
|
2290
|
+
* const ref = useRef<HTMLDivElement>(null);
|
|
2291
|
+
*
|
|
2292
|
+
* const { size } = useResizeObserver({
|
|
2293
|
+
* ref,
|
|
2294
|
+
* onResize: (entry) => {
|
|
2295
|
+
* // do something
|
|
2296
|
+
* },
|
|
2297
|
+
* isDisabled: false,
|
|
2298
|
+
* });
|
|
2299
|
+
* ```;
|
|
2300
|
+
*
|
|
2301
|
+
* @param {Object} options - The options object.
|
|
2302
|
+
* @param {React.RefObject<HTMLElement>} options.ref - The ref object that
|
|
2303
|
+
* points to the observed element.
|
|
2304
|
+
* @param {Function} options.onResize - The callback function that is called
|
|
2305
|
+
* when the element is resized.
|
|
2306
|
+
* @param {boolean} options.isDisabled - A flag that indicates whether the
|
|
2307
|
+
* observer is disabled.
|
|
2308
|
+
* @returns {Object} An object that contains the size of the observed element.
|
|
2309
|
+
*/
|
|
2310
|
+
declare function useResizeObserver({ ref, onResize, isDisabled, }: ResizeObserverOptions): {
|
|
2311
|
+
size: {
|
|
2312
|
+
width: number;
|
|
2313
|
+
height: number;
|
|
2314
|
+
} | undefined;
|
|
2315
|
+
};
|
|
2316
|
+
interface ResizeObserverOptions {
|
|
2317
|
+
ref: React.RefObject<HTMLElement>;
|
|
2318
|
+
onResize?: (entry: ResizeObserverEntry) => void;
|
|
2319
|
+
isDisabled?: boolean;
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2322
|
+
/**
|
|
2323
|
+
* A custom hook that loads an image and returns its loading state and props.
|
|
2324
|
+
*
|
|
2325
|
+
* @example
|
|
2326
|
+
* ```tsx
|
|
2327
|
+
* const { isLoaded, hasError, isLoading, imgProps } = useImage({
|
|
2328
|
+
* src: "https://via.placeholder.com/150",
|
|
2329
|
+
* alt: "Placeholder image",
|
|
2330
|
+
* });
|
|
2331
|
+
* ```;
|
|
2332
|
+
*/
|
|
2333
|
+
declare function useImage({ src, alt }: {
|
|
2334
|
+
src?: string;
|
|
2335
|
+
alt: string;
|
|
2336
|
+
}): {
|
|
2337
|
+
isLoaded: boolean;
|
|
2338
|
+
hasError: boolean;
|
|
2339
|
+
isLoading: boolean;
|
|
2340
|
+
imgProps: {
|
|
2341
|
+
src?: string;
|
|
2342
|
+
alt: string;
|
|
2343
|
+
};
|
|
2344
|
+
};
|
|
2345
|
+
|
|
2346
|
+
/**
|
|
2347
|
+
* A hook that provides undo and redo functionality for a given state.
|
|
2348
|
+
*
|
|
2349
|
+
* @example
|
|
2350
|
+
* ```tsx
|
|
2351
|
+
* const { state, push, undo, redo, pastStates, futureStates, canUndo, canRedo } = useUndoRedo({
|
|
2352
|
+
* onAction: (state, action) => {
|
|
2353
|
+
* // do something
|
|
2354
|
+
* },
|
|
2355
|
+
* });
|
|
2356
|
+
*
|
|
2357
|
+
* // push a new state
|
|
2358
|
+
* push({ foo: "bar" });
|
|
2359
|
+
*
|
|
2360
|
+
* // undo the last state
|
|
2361
|
+
* undo();
|
|
2362
|
+
*
|
|
2363
|
+
* // redo the last state
|
|
2364
|
+
* redo();
|
|
2365
|
+
* ```;
|
|
2366
|
+
*
|
|
2367
|
+
* @template T The type of the state object.
|
|
2368
|
+
* @param initialState The initial state object.
|
|
2369
|
+
* @param options Additional options for the hook.
|
|
2370
|
+
* @param options.isDisabled Whether the undo/redo functionality should be
|
|
2371
|
+
* disabled.
|
|
2372
|
+
* @param options.onAction A callback function that is called whenever an undo
|
|
2373
|
+
* or redo action is performed.
|
|
2374
|
+
* @returns An object containing the current state, undo and redo functions, and
|
|
2375
|
+
* other related properties.
|
|
2376
|
+
*/
|
|
2377
|
+
declare const useUndoRedo: <T>(initialState: T | undefined, { isDisabled, onAction, }: {
|
|
2378
|
+
isDisabled?: boolean | undefined;
|
|
2379
|
+
onAction?: ((state: T, action: "UNDO" | "REDO") => void) | undefined;
|
|
2380
|
+
}) => {
|
|
2381
|
+
state: T;
|
|
2382
|
+
push: (newState: T) => void;
|
|
2383
|
+
undo: () => void;
|
|
2384
|
+
redo: () => void;
|
|
2385
|
+
pastStates: T[];
|
|
2386
|
+
futureStates: T[];
|
|
2387
|
+
canUndo: boolean;
|
|
2388
|
+
canRedo: boolean;
|
|
2389
|
+
};
|
|
2390
|
+
|
|
2391
|
+
/**
|
|
2392
|
+
* This hook returns true if the component is being rendered for the first time.
|
|
2393
|
+
* This is useful for avoiding side effects on the first render inside of
|
|
2394
|
+
* useEffect.
|
|
2395
|
+
*
|
|
2396
|
+
* @example
|
|
2397
|
+
* ```tsx
|
|
2398
|
+
* const isFirstRender = useIsFirstRender();
|
|
2399
|
+
*
|
|
2400
|
+
* useEffect(() => {
|
|
2401
|
+
* if (isFirstRender) return;
|
|
2402
|
+
* // do something
|
|
2403
|
+
* return () => {
|
|
2404
|
+
* // do something on unmount
|
|
2405
|
+
* };
|
|
2406
|
+
* }, [isFirstRender]);
|
|
2407
|
+
* ```;
|
|
2408
|
+
*
|
|
2409
|
+
* @returns Whether or not the component is being rendered for the first time
|
|
2410
|
+
*/
|
|
2411
|
+
declare function useIsFirstRender(): boolean;
|
|
2412
|
+
|
|
2413
|
+
/**
|
|
2414
|
+
* A hook that provides internationalization functionality. It returns a
|
|
2415
|
+
* function to format messages and the current locale. The hook can be used with
|
|
2416
|
+
* or without a messages object. If no messages object is provided, the hook
|
|
2417
|
+
* will use the messages provided by the `I18nProvider`. If a messages object is
|
|
2418
|
+
* provided, the hook will use those messages instead of the ones provided by
|
|
2419
|
+
* the `I18nProvider`.
|
|
2420
|
+
*
|
|
2421
|
+
* @example
|
|
2422
|
+
* ```tsx
|
|
2423
|
+
* import { useI18n } from "@baseline-ui/core";
|
|
2424
|
+
*
|
|
2425
|
+
* const messages = {
|
|
2426
|
+
* en: { hello: "Hello" },
|
|
2427
|
+
* fr: { hello: "Bonjour" },
|
|
2428
|
+
* };
|
|
2429
|
+
*
|
|
2430
|
+
* const MyComponent = () => {
|
|
2431
|
+
* const { formatMessage, locale } = useI18n(messages);
|
|
2432
|
+
*
|
|
2433
|
+
* return (
|
|
2434
|
+
* <div>
|
|
2435
|
+
* <p>{formatMessage("hello")}</p>
|
|
2436
|
+
* <p>{locale}</p>
|
|
2437
|
+
* </div>
|
|
2438
|
+
* )};
|
|
2439
|
+
* ```;
|
|
2440
|
+
*
|
|
2441
|
+
* @template T - A type that represents the shape of the translation messages.
|
|
2442
|
+
* @param {Object<string, T>} [messages] - An optional object containing
|
|
2443
|
+
* translation messages for different languages.
|
|
2444
|
+
* @returns {I18nResult<T>} An object containing a function to format messages
|
|
2445
|
+
* and the current locale.
|
|
2446
|
+
*/
|
|
2447
|
+
declare function useI18n<T extends Record<string, string>>(messages?: Record<string, T>): I18nResult<T>;
|
|
2448
|
+
interface I18nResult<T extends LocalizedStrings[keyof LocalizedStrings]> {
|
|
2449
|
+
formatMessage: (id: keyof T | MessageDescriptor, values?: Record<string, any>) => string;
|
|
2450
|
+
locale: Locale;
|
|
2451
|
+
}
|
|
2452
|
+
interface MessageDescriptor {
|
|
2453
|
+
id: string;
|
|
2454
|
+
defaultMessage?: string;
|
|
2455
|
+
}
|
|
2456
|
+
/**
|
|
2457
|
+
* Defines a set of messages for use with the `useI18n` hook.
|
|
2458
|
+
*
|
|
2459
|
+
* @param messages An object containing message descriptors.
|
|
2460
|
+
* @returns An object containing the message descriptors with their keys as
|
|
2461
|
+
* property names.
|
|
2462
|
+
*/
|
|
2463
|
+
declare const defineMessages: <T extends Record<string, {
|
|
2464
|
+
id: string;
|
|
2465
|
+
}>>(messages: T) => T;
|
|
2466
|
+
|
|
2467
|
+
/**
|
|
2468
|
+
* A hook that uses a MutationObserver to watch for changes to the DOM.
|
|
2469
|
+
*
|
|
2470
|
+
* @example
|
|
2471
|
+
* ```tsx
|
|
2472
|
+
* const targetRef = React.useRef<HTMLDivElement>(null);
|
|
2473
|
+
*
|
|
2474
|
+
* useMutationObserver(targetRef.current, { attributes: true }, (mutations) => {
|
|
2475
|
+
* console.log(mutations);
|
|
2476
|
+
* // do something with the mutations
|
|
2477
|
+
* // ...
|
|
2478
|
+
* });
|
|
2479
|
+
* ```;
|
|
2480
|
+
*
|
|
2481
|
+
* @param target The element to observe for changes.
|
|
2482
|
+
* @param options The options to pass to the MutationObserver.
|
|
2483
|
+
* @param callback The callback to call when a mutation occurs.
|
|
2484
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
|
|
2485
|
+
*/
|
|
2486
|
+
declare function useMutationObserver(target: Element | null, options: MutationObserverInit, callback: MutationCallback): MutationObserver | null;
|
|
2487
|
+
|
|
2488
|
+
declare type SetValue<T> = Dispatch<SetStateAction<T>>;
|
|
2489
|
+
/**
|
|
2490
|
+
* A hook to persist a value to localStorage.
|
|
2491
|
+
*
|
|
2492
|
+
* @example
|
|
2493
|
+
* ```tsx
|
|
2494
|
+
* function MyComponent() {
|
|
2495
|
+
* const [value, setValue] = useLocalStorage("my-value", "default-value");
|
|
2496
|
+
* return (
|
|
2497
|
+
* <input value={value} onChange={e => setValue(e.target.value)} />
|
|
2498
|
+
* );
|
|
2499
|
+
* }
|
|
2500
|
+
* ```;
|
|
2501
|
+
*
|
|
2502
|
+
* @param key The localStorage key to use
|
|
2503
|
+
* @param initialValue The initial value to use if the key is not found in
|
|
2504
|
+
* localStorage
|
|
2505
|
+
*/
|
|
2506
|
+
declare function useLocalStorage<T>(key: string, initialValue: T): [T, SetValue<T>];
|
|
2507
|
+
|
|
2508
|
+
/**
|
|
2509
|
+
* A hook that provides text selection functionality for a given HTML element.
|
|
2510
|
+
*
|
|
2511
|
+
* ```jsx
|
|
2512
|
+
* function MyComponent() {
|
|
2513
|
+
* const ref = useRef();
|
|
2514
|
+
* const [selection, setSelection] = useState();
|
|
2515
|
+
*
|
|
2516
|
+
* useTextSelection({
|
|
2517
|
+
* ref,
|
|
2518
|
+
* onSelectionChange: setSelection,
|
|
2519
|
+
* });
|
|
2520
|
+
*
|
|
2521
|
+
* return (
|
|
2522
|
+
* <div ref={ref}>
|
|
2523
|
+
* <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
|
|
2524
|
+
* </div>
|
|
2525
|
+
* );
|
|
2526
|
+
* }
|
|
2527
|
+
* ```
|
|
2528
|
+
*/
|
|
2529
|
+
declare function useTextSelection({ ref, onSelectionChange, onSelectionEnd, isDisabled, }: TextSelectionProps): void;
|
|
2530
|
+
interface TextSelectionProps {
|
|
2531
|
+
ref: React.RefObject<HTMLElement>;
|
|
2532
|
+
onSelectionChange: (selection: Selection) => void;
|
|
2533
|
+
onSelectionEnd?: (selection: Selection) => void;
|
|
2534
|
+
isDisabled?: boolean;
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
/**
|
|
2538
|
+
* Returns the current device type based on the window width.
|
|
2539
|
+
*
|
|
2540
|
+
* ```jsx
|
|
2541
|
+
* const device = useDevice();
|
|
2542
|
+
*
|
|
2543
|
+
* if (device === "mobile") {
|
|
2544
|
+
* return <MobileComponent />;
|
|
2545
|
+
* } else if (device === "tablet") {
|
|
2546
|
+
* return <TabletComponent />;
|
|
2547
|
+
* } else {
|
|
2548
|
+
* return <DesktopComponent />;
|
|
2549
|
+
* }
|
|
2550
|
+
* ```
|
|
2551
|
+
*
|
|
2552
|
+
* @param element - The element to use to get the owner window. Defaults to
|
|
2553
|
+
* `document.body`.
|
|
2554
|
+
*/
|
|
2555
|
+
declare function useDevice(element?: Element | null | undefined): "desktop" | "tablet" | "mobile";
|
|
2556
|
+
|
|
2557
|
+
/**
|
|
2558
|
+
* Custom hook for accessing PortalContainerProviderContext. This hook allows
|
|
2559
|
+
* components to either use a specified portal container or fallback to a
|
|
2560
|
+
* default provided via context.
|
|
2561
|
+
*
|
|
2562
|
+
* @param _portalContainer - An optional HTML element that can be specified as
|
|
2563
|
+
* an override.
|
|
2564
|
+
* @returns The portal container element where components should be rendered,
|
|
2565
|
+
* either the overridden container, one from context or undefined.
|
|
2566
|
+
*/
|
|
2567
|
+
declare function usePortalContainer(_portalContainer?: HTMLElement): HTMLElement | undefined;
|
|
2568
|
+
|
|
2569
|
+
interface DynamicListOptions<T> extends ListOptions<T> {
|
|
2570
|
+
onListChange?: (items: T[]) => void;
|
|
2571
|
+
onSelectionChange?: (selectedKeys: Selection$1) => void;
|
|
2572
|
+
getKey?: (item: T) => Key$1;
|
|
2573
|
+
}
|
|
2574
|
+
declare function useDynamicListData<T>(options: DynamicListOptions<T>): ListData<T>;
|
|
2575
|
+
|
|
2576
|
+
export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, ActionButton, type ActionButtonProps, ActionIconButton, type ActionIconButtonProps, AlertDialog, type AlertDialogProps, AudioPlayer, type AudioPlayerProps, Avatar, type AvatarProps, type BlockProps, Box, type BoxProps, ButtonSelect, type ButtonSelectProps, Checkbox, type CheckboxProps, ColorInput, type ColorInputProps, type ColorPreset, ColorPresetInlineInput, type ColorPresetInlineInputProps, ColorSwatch, type ColorSwatchProps, ComboBox, type ComboBoxProps, DateFormat, type DateFormatProps, Dialog, type DialogProps, DialogTitle, type DialogTitleProps, DomNodeRenderer, type DomNodeRendererProps, Drawer, type DrawerProps, Editor, type EditorHandle, type EditorProps, FileUpload, type FileUploadProps, FreehandCanvas, type FreehandCanvasProps, Group, type GroupProps, I18nProvider, type I18nResult, IconColorInput, IconColorInputButton, type IconColorInputProps, IconSelect, type IconSelectProps, ImageDropZone, type ImageDropZoneProps, ImageGallery, type ImageGalleryProps, InlineAlert, type InlineAlertProps, Link, type LinkProps, ListBox, type ListBoxProps, type ListOption, Markdown, type MarkdownProps, Menu, type MenuItem, type MenuProps, type MessageDescriptor, MessageFormat, type MessageFormatProps, Modal, ModalClose, ModalContent, type ModalContentProps, type ModalProps, ModalTrigger, NumberFormat, type NumberFormatProps, NumberInput, type NumberInputProps, Pagination, type PaginationProps, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, type PopoverTriggerProps, Portal, PortalContainerProvider, type PortalProps, Preview, type PreviewProps, ProgressBar, type ProgressBarProps, ProgressSpinner, type ProgressSpinnerProps, RadioGroup, type RadioGroupProps, Reaction, type ReactionProps, type Rect, ScrollControlButton, type ScrollControlButtonProps, SearchInput, type SearchInputProps, Select, type SelectProps, Separator, type SeparatorProps, Slider, type SliderProps, type StylingProps, Switch, type SwitchProps, TabItem, type TabItemProps, Tabs, type TabsProps, TagGroup, type TagGroupProps, Text, TextInput, type TextInputProps, type TextProps, ThemeProvider, type ThemeProviderProps, ToggleButton, type ToggleButtonProps, ToggleIconButton, type ToggleIconButtonProps, Toolbar, type ToolbarProps, Tooltip, type TooltipProps, Transform, type TransformProps, Transition, type TransitionProps, defineMessages, isInsideOverlayContent, isRect, useDevice, useDynamicListData, useI18n, useImage, useIntersectionObserver, useIsFirstRender, useLocalStorage, useMutationObserver, usePortalContainer, useResizeObserver, useTextSelection, useUndoRedo, useUserPreferences };
|