@x12i/ui 0.0.0-stage → 1.1.0
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/LICENSE +21 -0
- package/README.md +144 -3
- package/dist/date.d.ts +69 -0
- package/dist/date.js +223 -0
- package/dist/date.js.map +1 -0
- package/dist/index.d.ts +1265 -0
- package/dist/index.js +2554 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +4373 -0
- package/dist/types-DOvvpwkA.d.ts +11 -0
- package/package.json +68 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1265 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentPropsWithRef, ReactNode, CSSProperties, ReactElement } from 'react';
|
|
3
|
+
import { C as ControlSize, S as SpaceKey, a as StatusTone } from './types-DOvvpwkA.js';
|
|
4
|
+
import { Toggle as Toggle$1 } from '@base-ui/react/toggle';
|
|
5
|
+
import { ToggleGroup as ToggleGroup$1 } from '@base-ui/react/toggle-group';
|
|
6
|
+
import { Checkbox as Checkbox$1 } from '@base-ui/react/checkbox';
|
|
7
|
+
import { CheckboxGroup as CheckboxGroup$1 } from '@base-ui/react/checkbox-group';
|
|
8
|
+
import { Field as Field$1 } from '@base-ui/react/field';
|
|
9
|
+
import { Fieldset as Fieldset$1 } from '@base-ui/react/fieldset';
|
|
10
|
+
import { Input as Input$1 } from '@base-ui/react/input';
|
|
11
|
+
import { NumberField } from '@base-ui/react/number-field';
|
|
12
|
+
import { OTPField } from '@base-ui/react/otp-field';
|
|
13
|
+
import { Radio as Radio$1 } from '@base-ui/react/radio';
|
|
14
|
+
import { RadioGroup as RadioGroup$1 } from '@base-ui/react/radio-group';
|
|
15
|
+
import { Select as Select$1 } from '@base-ui/react/select';
|
|
16
|
+
import { Slider as Slider$1 } from '@base-ui/react/slider';
|
|
17
|
+
import { Switch as Switch$1 } from '@base-ui/react/switch';
|
|
18
|
+
import { Meter as Meter$1 } from '@base-ui/react/meter';
|
|
19
|
+
import { Progress as Progress$1 } from '@base-ui/react/progress';
|
|
20
|
+
import { Avatar as Avatar$1 } from '@base-ui/react/avatar';
|
|
21
|
+
import { ScrollArea as ScrollArea$1 } from '@base-ui/react/scroll-area';
|
|
22
|
+
import { Collapsible as Collapsible$1 } from '@base-ui/react/collapsible';
|
|
23
|
+
import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
|
|
24
|
+
import { Accordion as Accordion$1 } from '@base-ui/react/accordion';
|
|
25
|
+
import { Toolbar as Toolbar$1 } from '@base-ui/react/toolbar';
|
|
26
|
+
import { AlertDialog as AlertDialog$1 } from '@base-ui/react/alert-dialog';
|
|
27
|
+
import { Dialog as Dialog$1 } from '@base-ui/react/dialog';
|
|
28
|
+
import { Drawer as Drawer$1 } from '@base-ui/react/drawer';
|
|
29
|
+
import { Popover as Popover$1 } from '@base-ui/react/popover';
|
|
30
|
+
import * as _base_ui_react from '@base-ui/react';
|
|
31
|
+
import { ContextMenu as ContextMenu$1 } from '@base-ui/react/context-menu';
|
|
32
|
+
import { Menu as Menu$1 } from '@base-ui/react/menu';
|
|
33
|
+
import { DensityName, ThemeName } from '@x12i/tokens';
|
|
34
|
+
|
|
35
|
+
type BadgeVariant = "soft" | "solid" | "outline";
|
|
36
|
+
type BadgeTone = "neutral" | "accent" | "success" | "warning" | "danger" | "info";
|
|
37
|
+
interface BadgeProps extends ComponentPropsWithRef<"span"> {
|
|
38
|
+
variant?: BadgeVariant;
|
|
39
|
+
/** Status tones use the same colors as charts, diagrams and report callouts. */
|
|
40
|
+
tone?: BadgeTone;
|
|
41
|
+
size?: "sm" | "md";
|
|
42
|
+
}
|
|
43
|
+
declare function Badge({ variant, tone, size, className, ...props }: BadgeProps): react.JSX.Element;
|
|
44
|
+
|
|
45
|
+
type ButtonVariant = "solid" | "soft" | "outline" | "ghost";
|
|
46
|
+
type ButtonTone = "accent" | "neutral";
|
|
47
|
+
interface ButtonProps extends ComponentPropsWithRef<"button"> {
|
|
48
|
+
/** Visual weight. `solid` is the primary action; use one per view. */
|
|
49
|
+
variant?: ButtonVariant;
|
|
50
|
+
/** `accent` marks the primary action and the finding; `neutral` stays grey. */
|
|
51
|
+
tone?: ButtonTone;
|
|
52
|
+
size?: ControlSize;
|
|
53
|
+
/**
|
|
54
|
+
* Shows a spinner and blocks activation while keeping focus and layout. The
|
|
55
|
+
* button stays focusable so keyboard users do not lose their place.
|
|
56
|
+
*/
|
|
57
|
+
loading?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Accessible name for the spinner, for example "Saving". Pass a translated
|
|
60
|
+
* string; components never contain user-facing text.
|
|
61
|
+
*/
|
|
62
|
+
loadingLabel?: string;
|
|
63
|
+
/** Render the child element (for example an anchor) with button styling. */
|
|
64
|
+
asChild?: boolean;
|
|
65
|
+
}
|
|
66
|
+
declare function Button({ variant, tone, size, loading, loadingLabel, asChild, disabled, type, className, children, onClick, ref, ...props }: ButtonProps): react.JSX.Element;
|
|
67
|
+
|
|
68
|
+
interface ButtonGroupProps extends ComponentPropsWithRef<"div"> {
|
|
69
|
+
orientation?: "horizontal" | "vertical";
|
|
70
|
+
/**
|
|
71
|
+
* Joins the buttons into one segmented control with shared borders. Turn it
|
|
72
|
+
* off to keep them separate and only group them semantically.
|
|
73
|
+
*/
|
|
74
|
+
attached?: boolean;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Groups related buttons. It is a `role="group"`: give it an `aria-label` when
|
|
78
|
+
* the buttons need a shared name, for example "Text alignment".
|
|
79
|
+
*/
|
|
80
|
+
declare function ButtonGroup({ orientation, attached, ...props }: ButtonGroupProps): react.JSX.Element;
|
|
81
|
+
|
|
82
|
+
type CopyStatus = "idle" | "copied" | "failed";
|
|
83
|
+
interface CopyButtonProps extends Omit<ButtonProps, "onClick" | "children" | "asChild" | "aria-label" | "loading" | "loadingLabel"> {
|
|
84
|
+
/** The text to copy, or a function that returns it at click time. */
|
|
85
|
+
text: string | (() => string);
|
|
86
|
+
/** Accessible name while idle, for example "Copy code". */
|
|
87
|
+
label: string;
|
|
88
|
+
/** Announced after a successful copy, for example "Copied". */
|
|
89
|
+
copiedLabel: string;
|
|
90
|
+
/** Announced when the clipboard is unavailable or refused. */
|
|
91
|
+
failedLabel?: string;
|
|
92
|
+
/** Milliseconds before the button returns to idle. Defaults to 2000. */
|
|
93
|
+
timeout?: number;
|
|
94
|
+
/** Called with the copied text. (Not `onCopy`, which is the DOM clipboard event.) */
|
|
95
|
+
onCopied?: (value: string) => void;
|
|
96
|
+
onCopyError?: (error: unknown) => void;
|
|
97
|
+
/** Visible text. Leave it out for an icon-only button. */
|
|
98
|
+
children?: ReactNode;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Copies text to the clipboard. The result is announced through a polite live
|
|
102
|
+
* region (the button's own name stays constant, so it is never read twice) and
|
|
103
|
+
* shown with an icon, so color is not the only signal.
|
|
104
|
+
*/
|
|
105
|
+
declare function CopyButton({ text: source, label, copiedLabel, failedLabel, timeout, onCopied, onCopyError, children, variant, tone, ...props }: CopyButtonProps): react.JSX.Element;
|
|
106
|
+
|
|
107
|
+
type KbdProps = ComponentPropsWithRef<"kbd">;
|
|
108
|
+
/** A keyboard key, for shortcut hints: `<Kbd>Esc</Kbd>`. */
|
|
109
|
+
declare function Kbd(props: KbdProps): react.JSX.Element;
|
|
110
|
+
interface KbdGroupProps extends ComponentPropsWithRef<"span"> {
|
|
111
|
+
/** Shown between keys. Hidden from assistive technology. Defaults to "+". */
|
|
112
|
+
separator?: ReactNode;
|
|
113
|
+
}
|
|
114
|
+
/** Several keys that are pressed together: `<KbdGroup><Kbd>Ctrl</Kbd><Kbd>K</Kbd></KbdGroup>`. */
|
|
115
|
+
declare function KbdGroup({ separator, children, ...props }: KbdGroupProps): react.JSX.Element;
|
|
116
|
+
|
|
117
|
+
interface LinkProps extends ComponentPropsWithRef<"a"> {
|
|
118
|
+
/** `accent` uses the link color; `neutral` inherits the surrounding text color. */
|
|
119
|
+
tone?: "accent" | "neutral";
|
|
120
|
+
/** When the underline shows. Keep `always` inside running text. */
|
|
121
|
+
underline?: "always" | "hover" | "none";
|
|
122
|
+
/**
|
|
123
|
+
* Marks the link as leaving the app: opens in a new tab with
|
|
124
|
+
* `rel="noopener noreferrer"` and shows an icon.
|
|
125
|
+
*/
|
|
126
|
+
external?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Visually hidden text announced after an external link, for example "(opens
|
|
129
|
+
* in a new tab)". Pass a translated string; components contain no text.
|
|
130
|
+
*/
|
|
131
|
+
externalLabel?: string;
|
|
132
|
+
/** Render the child element (a router link, say) with link styling. */
|
|
133
|
+
asChild?: boolean;
|
|
134
|
+
}
|
|
135
|
+
declare function Link({ tone, underline, external, externalLabel, asChild, children, ...props }: LinkProps): react.JSX.Element;
|
|
136
|
+
|
|
137
|
+
type ToggleVariant = "outline" | "soft" | "ghost";
|
|
138
|
+
interface ToggleProps<Value extends string = string> extends Toggle$1.Props<Value> {
|
|
139
|
+
variant?: ToggleVariant;
|
|
140
|
+
size?: ControlSize;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* A two-state button (`aria-pressed`). Pressed state is shown by color, a
|
|
144
|
+
* border and a bottom bar, so it never relies on color alone. Inside a
|
|
145
|
+
* `ToggleGroup` give each toggle a `value`.
|
|
146
|
+
*/
|
|
147
|
+
declare function Toggle<Value extends string = string>({ variant, size, ...props }: ToggleProps<Value>): react.JSX.Element;
|
|
148
|
+
interface ToggleGroupProps<Value extends string = string> extends ToggleGroup$1.Props<Value> {
|
|
149
|
+
/** Joins the toggles into one segmented control. Defaults to true. */
|
|
150
|
+
attached?: boolean;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* A set of toggles with arrow-key navigation and either single selection
|
|
154
|
+
* (default) or `multiple`. Name it with `aria-label`.
|
|
155
|
+
*/
|
|
156
|
+
declare function ToggleGroup<Value extends string = string>({ attached, orientation, ...props }: ToggleGroupProps<Value>): react.JSX.Element;
|
|
157
|
+
|
|
158
|
+
interface CheckboxProps extends Checkbox$1.Root.Props {
|
|
159
|
+
/** Visible label. Clicking it toggles the checkbox. */
|
|
160
|
+
label?: ReactNode;
|
|
161
|
+
/** Help text under the label, announced with the checkbox. */
|
|
162
|
+
description?: ReactNode;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* A checkbox with an optional label and description. Without a `label`, give it
|
|
166
|
+
* an `aria-label`, or put it inside a `Field`. Supports `indeterminate` for
|
|
167
|
+
* "select all" parents.
|
|
168
|
+
*/
|
|
169
|
+
declare function Checkbox({ label, description, disabled, ...props }: CheckboxProps): react.JSX.Element;
|
|
170
|
+
type CheckboxGroupProps = CheckboxGroup$1.Props;
|
|
171
|
+
/**
|
|
172
|
+
* Manages the checked values of several checkboxes (`value`, `onValueChange`).
|
|
173
|
+
* Name the group with `aria-label` or wrap it in a `Fieldset`.
|
|
174
|
+
*/
|
|
175
|
+
declare function CheckboxGroup(props: CheckboxGroupProps): react.JSX.Element;
|
|
176
|
+
|
|
177
|
+
interface ComboboxOption {
|
|
178
|
+
value: string;
|
|
179
|
+
/** The text shown and matched against what the user types. */
|
|
180
|
+
label: string;
|
|
181
|
+
disabled?: boolean;
|
|
182
|
+
}
|
|
183
|
+
interface ComboboxCommonProps {
|
|
184
|
+
options: ComboboxOption[];
|
|
185
|
+
placeholder?: string;
|
|
186
|
+
size?: ControlSize;
|
|
187
|
+
invalid?: boolean;
|
|
188
|
+
disabled?: boolean;
|
|
189
|
+
readOnly?: boolean;
|
|
190
|
+
required?: boolean;
|
|
191
|
+
name?: string;
|
|
192
|
+
className?: string;
|
|
193
|
+
style?: CSSProperties;
|
|
194
|
+
/** Text shown when nothing matches what the user typed, for example "No results". */
|
|
195
|
+
emptyLabel: string;
|
|
196
|
+
/** Name of the button that clears the value, for example "Clear". */
|
|
197
|
+
clearLabel: string;
|
|
198
|
+
/** Name of the button that opens the list, for example "Show options". */
|
|
199
|
+
openLabel: string;
|
|
200
|
+
/** Accessible name when the combobox is not inside a `Field`. */
|
|
201
|
+
"aria-label"?: string;
|
|
202
|
+
"aria-labelledby"?: string;
|
|
203
|
+
"aria-describedby"?: string;
|
|
204
|
+
}
|
|
205
|
+
interface ComboboxProps extends ComboboxCommonProps {
|
|
206
|
+
/** The selected option's `value`, or null for none. Pass it to control the component. */
|
|
207
|
+
value?: string | null;
|
|
208
|
+
defaultValue?: string | null;
|
|
209
|
+
onValueChange?: (value: string | null) => void;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* A searchable single-choice list. Typing filters the options; arrow keys move
|
|
213
|
+
* through them and Enter picks one. Use `Select` when the list is short and
|
|
214
|
+
* search is not needed.
|
|
215
|
+
*/
|
|
216
|
+
declare function Combobox({ options, value, defaultValue, onValueChange, placeholder, size, invalid, disabled, readOnly, required, name, className, style, emptyLabel, clearLabel, openLabel, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, }: ComboboxProps): react.JSX.Element;
|
|
217
|
+
interface MultiComboboxProps extends ComboboxCommonProps {
|
|
218
|
+
value?: string[];
|
|
219
|
+
defaultValue?: string[];
|
|
220
|
+
onValueChange?: (value: string[]) => void;
|
|
221
|
+
/** Name of a chip's remove button, for example `(label) => "Remove " + label`. */
|
|
222
|
+
removeLabel: (optionLabel: string) => string;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* A searchable multi-choice list. Selected options appear as removable chips
|
|
226
|
+
* inside the field; Backspace in the empty input removes the last one.
|
|
227
|
+
*/
|
|
228
|
+
declare function MultiCombobox({ options, value, defaultValue, onValueChange, placeholder, size, invalid, disabled, readOnly, required, name, className, style, emptyLabel, clearLabel, openLabel, removeLabel, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, }: MultiComboboxProps): react.JSX.Element;
|
|
229
|
+
|
|
230
|
+
interface FieldProps extends Omit<Field$1.Root.Props, "children"> {
|
|
231
|
+
/** The visible label. Clicking it focuses the control. */
|
|
232
|
+
label?: ReactNode;
|
|
233
|
+
/** Help text under the label. It is announced with the control. */
|
|
234
|
+
description?: ReactNode;
|
|
235
|
+
/**
|
|
236
|
+
* An error message. A truthy error marks the field invalid, sets
|
|
237
|
+
* `aria-invalid` on the control and announces the message politely.
|
|
238
|
+
*/
|
|
239
|
+
error?: ReactNode;
|
|
240
|
+
/**
|
|
241
|
+
* Draws a required marker next to the label. The marker is decorative: put
|
|
242
|
+
* `required` on the control as well, so assistive technology hears it.
|
|
243
|
+
*/
|
|
244
|
+
required?: boolean;
|
|
245
|
+
/** `horizontal` puts the control beside its label, which suits checkboxes and switches. */
|
|
246
|
+
orientation?: "vertical" | "horizontal";
|
|
247
|
+
/** The control: an `Input`, `Select`, `Checkbox`... Base UI wires its label and description. */
|
|
248
|
+
children: ReactNode;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Label, control, description and error as one accessible unit. The label,
|
|
252
|
+
* description and error are linked to the control through Base UI's field
|
|
253
|
+
* context, so no ids need to be passed around.
|
|
254
|
+
*/
|
|
255
|
+
declare function Field({ label, description, error, required, orientation, invalid, children, ...props }: FieldProps): react.JSX.Element;
|
|
256
|
+
type FieldLabelProps = Field$1.Label.Props;
|
|
257
|
+
type FieldDescriptionProps = Field$1.Description.Props;
|
|
258
|
+
type FieldErrorProps = Field$1.Error.Props;
|
|
259
|
+
/** Parts for custom layouts inside `Field.Root`-style structures. */
|
|
260
|
+
declare function FieldLabel(props: FieldLabelProps): react.JSX.Element;
|
|
261
|
+
declare function FieldDescription(props: FieldDescriptionProps): react.JSX.Element;
|
|
262
|
+
declare function FieldError(props: FieldErrorProps): react.JSX.Element;
|
|
263
|
+
interface FieldsetProps extends Omit<Fieldset$1.Root.Props, "children"> {
|
|
264
|
+
/** The group's name, read before each control inside it. */
|
|
265
|
+
legend: ReactNode;
|
|
266
|
+
/** Help text under the legend. */
|
|
267
|
+
description?: ReactNode;
|
|
268
|
+
children: ReactNode;
|
|
269
|
+
}
|
|
270
|
+
/** Groups related controls (radios, checkboxes, an address) under one legend. */
|
|
271
|
+
declare function Fieldset({ legend, description, children, ...props }: FieldsetProps): react.JSX.Element;
|
|
272
|
+
|
|
273
|
+
interface InputProps extends Omit<Input$1.Props, "size"> {
|
|
274
|
+
size?: ControlSize;
|
|
275
|
+
/** Marks the input invalid outside a `Field` (inside one, the field does it). */
|
|
276
|
+
invalid?: boolean;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* A text input. Inside a `Field` it is labelled and described automatically;
|
|
280
|
+
* on its own, give it an `aria-label`.
|
|
281
|
+
*/
|
|
282
|
+
declare function Input({ size, invalid, ...props }: InputProps): react.JSX.Element;
|
|
283
|
+
interface InputGroupProps extends ComponentPropsWithRef<"div"> {
|
|
284
|
+
size?: ControlSize;
|
|
285
|
+
invalid?: boolean;
|
|
286
|
+
disabled?: boolean;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Wraps an `Input` with `InputAddon`s (a currency sign, an icon, a button). The
|
|
290
|
+
* group draws the border and the focus ring, so the parts read as one control.
|
|
291
|
+
*/
|
|
292
|
+
declare function InputGroup({ size, invalid, disabled, ...props }: InputGroupProps): react.JSX.Element;
|
|
293
|
+
type InputAddonProps = ComponentPropsWithRef<"span">;
|
|
294
|
+
/** Static text or an icon next to an input. Decorative addons should be `aria-hidden`. */
|
|
295
|
+
declare function InputAddon(props: InputAddonProps): react.JSX.Element;
|
|
296
|
+
interface PasswordInputProps extends Omit<InputProps, "type"> {
|
|
297
|
+
/** Name of the reveal button while the password is hidden, for example "Show password". */
|
|
298
|
+
showLabel: string;
|
|
299
|
+
/** Name of the reveal button while the password is visible, for example "Hide password". */
|
|
300
|
+
hideLabel: string;
|
|
301
|
+
/** Extra content before the input, usually a lock icon. */
|
|
302
|
+
startAddon?: ReactNode;
|
|
303
|
+
}
|
|
304
|
+
/** A password input with a button that reveals the text. */
|
|
305
|
+
declare function PasswordInput({ showLabel, hideLabel, startAddon, size, invalid, disabled, ...props }: PasswordInputProps): react.JSX.Element;
|
|
306
|
+
|
|
307
|
+
interface NumberInputProps extends Omit<NumberField.Root.Props, "children"> {
|
|
308
|
+
size?: ControlSize;
|
|
309
|
+
invalid?: boolean;
|
|
310
|
+
/** Name of the decrease button, for example "Decrease". */
|
|
311
|
+
decrementLabel: string;
|
|
312
|
+
/** Name of the increase button, for example "Increase". */
|
|
313
|
+
incrementLabel: string;
|
|
314
|
+
placeholder?: string;
|
|
315
|
+
/** Accessible name when the input is not inside a `Field`. */
|
|
316
|
+
"aria-label"?: string;
|
|
317
|
+
"aria-labelledby"?: string;
|
|
318
|
+
"aria-describedby"?: string;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* A number input with stepper buttons. Arrow keys step, Shift+Arrow takes a
|
|
322
|
+
* large step, and the value is parsed and formatted with `Intl` using `locale`
|
|
323
|
+
* and `format`.
|
|
324
|
+
*/
|
|
325
|
+
declare function NumberInput({ size, invalid, decrementLabel, incrementLabel, placeholder, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...props }: NumberInputProps): react.JSX.Element;
|
|
326
|
+
|
|
327
|
+
interface OTPInputProps extends Omit<OTPField.Root.Props, "children"> {
|
|
328
|
+
size?: ControlSize;
|
|
329
|
+
invalid?: boolean;
|
|
330
|
+
/**
|
|
331
|
+
* Name of the whole code, for example "Verification code". It is read with
|
|
332
|
+
* the first box. Not needed inside a `Field`, whose label does this job.
|
|
333
|
+
*/
|
|
334
|
+
label?: string;
|
|
335
|
+
/**
|
|
336
|
+
* Name of the other boxes, for example `(i, n) => "Digit " + (i + 1) + " of " + n`.
|
|
337
|
+
* The first box is named by `label` or by the surrounding `Field`, so it is
|
|
338
|
+
* never passed to this function.
|
|
339
|
+
*/
|
|
340
|
+
getInputLabel: (index: number, length: number) => string;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* A one-time-code input: one box per character with automatic advance, paste
|
|
344
|
+
* of the whole code, and Backspace to step back. `onValueComplete` fires when
|
|
345
|
+
* every box is filled.
|
|
346
|
+
*/
|
|
347
|
+
declare function OTPInput({ size, invalid, length, label, getInputLabel, id, ...props }: OTPInputProps): react.JSX.Element;
|
|
348
|
+
|
|
349
|
+
interface RadioGroupProps<Value = string> extends RadioGroup$1.Props<Value> {
|
|
350
|
+
/** Lay the radios out in a row instead of a column. */
|
|
351
|
+
orientation?: "vertical" | "horizontal";
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* A set of radios where exactly one is chosen. Arrow keys move and select. Name
|
|
355
|
+
* the group with `aria-label` or wrap it in a `Fieldset`.
|
|
356
|
+
*/
|
|
357
|
+
declare function RadioGroup<Value = string>({ orientation, ...props }: RadioGroupProps<Value>): react.JSX.Element;
|
|
358
|
+
interface RadioProps<Value = string> extends Radio$1.Root.Props<Value> {
|
|
359
|
+
label?: ReactNode;
|
|
360
|
+
description?: ReactNode;
|
|
361
|
+
}
|
|
362
|
+
/** One option in a `RadioGroup`. */
|
|
363
|
+
declare function Radio<Value = string>({ label, description, disabled, ...props }: RadioProps<Value>): react.JSX.Element;
|
|
364
|
+
|
|
365
|
+
interface SelectOption<Value extends string | number = string> {
|
|
366
|
+
value: Value;
|
|
367
|
+
/** What the option shows. Use `textValue` when this is not plain text. */
|
|
368
|
+
label: ReactNode;
|
|
369
|
+
disabled?: boolean;
|
|
370
|
+
/** Plain text for typeahead and for form submission. Defaults to `label` when it is a string. */
|
|
371
|
+
textValue?: string;
|
|
372
|
+
}
|
|
373
|
+
interface SelectGroup<Value extends string | number = string> {
|
|
374
|
+
/** The group's heading, announced when focus enters the group. */
|
|
375
|
+
label: string;
|
|
376
|
+
options: SelectOption<Value>[];
|
|
377
|
+
}
|
|
378
|
+
type SelectItems<Value extends string | number = string> = Array<SelectOption<Value> | SelectGroup<Value>>;
|
|
379
|
+
interface SelectProps<Value extends string | number = string> extends Omit<Select$1.Root.Props<Value, false>, "items" | "children" | "multiple"> {
|
|
380
|
+
options: SelectItems<Value>;
|
|
381
|
+
/** Shown while nothing is selected. */
|
|
382
|
+
placeholder?: string;
|
|
383
|
+
size?: ControlSize;
|
|
384
|
+
invalid?: boolean;
|
|
385
|
+
className?: string;
|
|
386
|
+
style?: CSSProperties;
|
|
387
|
+
/** Accessible name when the select is not inside a `Field`. */
|
|
388
|
+
"aria-label"?: string;
|
|
389
|
+
"aria-labelledby"?: string;
|
|
390
|
+
"aria-describedby"?: string;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* A single-choice dropdown. Typeahead, arrow keys, Home/End and Escape work as
|
|
394
|
+
* in a native select, and the value is submitted with forms through `name`.
|
|
395
|
+
* For long or searchable lists use `Combobox`.
|
|
396
|
+
*/
|
|
397
|
+
declare function Select<Value extends string | number = string>({ options, placeholder, size, invalid, className, style, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...props }: SelectProps<Value>): react.JSX.Element;
|
|
398
|
+
|
|
399
|
+
interface SliderProps<Value extends number | readonly number[] = number> extends Omit<Slider$1.Root.Props<Value>, "children"> {
|
|
400
|
+
/**
|
|
401
|
+
* Name for each thumb. A range slider has two thumbs, so it needs distinct
|
|
402
|
+
* names, for example `(i) => (i === 0 ? "Minimum price" : "Maximum price")`.
|
|
403
|
+
*/
|
|
404
|
+
getThumbLabel?: (index: number, count: number) => string;
|
|
405
|
+
/** Shows the current value(s) after the track. */
|
|
406
|
+
showValue?: boolean;
|
|
407
|
+
/** Accessible name of a single-thumb slider that is not inside a `Field`. */
|
|
408
|
+
"aria-label"?: string;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* A slider for a number or a range. Pass a number for one thumb or an array of
|
|
412
|
+
* numbers for several. Arrow keys step, Page Up/Down take a large step, Home
|
|
413
|
+
* and End jump to the ends.
|
|
414
|
+
*/
|
|
415
|
+
declare function Slider<Value extends number | readonly number[] = number>({ getThumbLabel, showValue, "aria-label": ariaLabel, ...props }: SliderProps<Value>): react.JSX.Element;
|
|
416
|
+
|
|
417
|
+
interface SwitchProps extends Switch$1.Root.Props {
|
|
418
|
+
label?: ReactNode;
|
|
419
|
+
description?: ReactNode;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* An on/off switch for a setting that applies immediately. Use a checkbox when
|
|
423
|
+
* the choice is submitted later with a form. Without a `label`, give it an
|
|
424
|
+
* `aria-label`.
|
|
425
|
+
*/
|
|
426
|
+
declare function Switch({ label, description, disabled, ...props }: SwitchProps): react.JSX.Element;
|
|
427
|
+
|
|
428
|
+
interface TextareaProps extends Omit<Field$1.Control.Props, "render" | "size" | "type" | "rows"> {
|
|
429
|
+
size?: ControlSize;
|
|
430
|
+
invalid?: boolean;
|
|
431
|
+
rows?: number;
|
|
432
|
+
/** Grows with its content (uses CSS `field-sizing`; falls back to `rows`). */
|
|
433
|
+
autoResize?: boolean;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* A multi-line input. It is a Base UI field control, so inside a `Field` it is
|
|
437
|
+
* labelled, described and validated like any other control.
|
|
438
|
+
*/
|
|
439
|
+
declare function Textarea({ size, invalid, rows, autoResize, ...props }: TextareaProps): react.JSX.Element;
|
|
440
|
+
|
|
441
|
+
interface DividerProps extends Omit<ComponentPropsWithRef<"hr">, "children"> {
|
|
442
|
+
orientation?: "horizontal" | "vertical";
|
|
443
|
+
/**
|
|
444
|
+
* A decorative divider is hidden from assistive technology. Use it when the
|
|
445
|
+
* surrounding structure already separates the content.
|
|
446
|
+
*/
|
|
447
|
+
decorative?: boolean;
|
|
448
|
+
}
|
|
449
|
+
/** A separator. Native `<hr>` already has the separator role, so no ARIA role is added. */
|
|
450
|
+
declare function Divider({ orientation, decorative, className, ...props }: DividerProps): react.JSX.Element;
|
|
451
|
+
|
|
452
|
+
interface IconButtonProps extends Omit<ButtonProps, "children" | "aria-label" | "aria-labelledby" | "asChild"> {
|
|
453
|
+
/**
|
|
454
|
+
* Accessible name. Required: an icon-only button without a name is a
|
|
455
|
+
* TypeScript error. Pass a translated string.
|
|
456
|
+
*/
|
|
457
|
+
label: string;
|
|
458
|
+
/** The icon. It is hidden from assistive technology by the label. */
|
|
459
|
+
children: ReactNode;
|
|
460
|
+
}
|
|
461
|
+
declare function IconButton({ label, children, ...props }: IconButtonProps): react.JSX.Element;
|
|
462
|
+
|
|
463
|
+
type Align$1 = "start" | "center" | "end" | "stretch" | "baseline";
|
|
464
|
+
type Justify = "start" | "center" | "end" | "between" | "around";
|
|
465
|
+
interface FlexProps extends ComponentPropsWithRef<"div"> {
|
|
466
|
+
/** Space between children, from the space scale. */
|
|
467
|
+
gap?: SpaceKey;
|
|
468
|
+
align?: Align$1;
|
|
469
|
+
justify?: Justify;
|
|
470
|
+
wrap?: boolean;
|
|
471
|
+
/** Render the child element instead of a div. */
|
|
472
|
+
asChild?: boolean;
|
|
473
|
+
}
|
|
474
|
+
type StackProps = FlexProps;
|
|
475
|
+
/** Lays children out in a column. */
|
|
476
|
+
declare function Stack({ gap, ...props }: StackProps): react.JSX.Element;
|
|
477
|
+
type InlineProps = FlexProps;
|
|
478
|
+
/** Lays children out in a row, aligned to the center and wrapping by default. */
|
|
479
|
+
declare function Inline({ gap, align, wrap, ...props }: InlineProps): react.JSX.Element;
|
|
480
|
+
|
|
481
|
+
interface SpinnerProps extends Omit<ComponentPropsWithRef<"span">, "children"> {
|
|
482
|
+
/** Icon size, from the icon size tokens. */
|
|
483
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
484
|
+
/**
|
|
485
|
+
* Accessible name, for example "Loading". When omitted the spinner is
|
|
486
|
+
* decorative and hidden from assistive technology. Strings are never baked
|
|
487
|
+
* into components, so pass a translated label.
|
|
488
|
+
*/
|
|
489
|
+
label?: string;
|
|
490
|
+
}
|
|
491
|
+
declare function Spinner({ size, label, className, ref, ...props }: SpinnerProps): react.JSX.Element;
|
|
492
|
+
|
|
493
|
+
interface VisuallyHiddenProps extends ComponentPropsWithRef<"span"> {
|
|
494
|
+
/** Render the child element instead of a span. */
|
|
495
|
+
asChild?: boolean;
|
|
496
|
+
}
|
|
497
|
+
/** Hides content visually but keeps it available to assistive technology. */
|
|
498
|
+
declare function VisuallyHidden({ asChild, className, ...props }: VisuallyHiddenProps): react.JSX.Element;
|
|
499
|
+
|
|
500
|
+
type Dismissal = {
|
|
501
|
+
onDismiss?: undefined;
|
|
502
|
+
dismissLabel?: string;
|
|
503
|
+
} | {
|
|
504
|
+
/** Shows a close button. */
|
|
505
|
+
onDismiss: () => void;
|
|
506
|
+
/** Name of the close button, for example "Dismiss". Required with `onDismiss`. */
|
|
507
|
+
dismissLabel: string;
|
|
508
|
+
};
|
|
509
|
+
type AlertProps = Omit<ComponentPropsWithRef<"div">, "title"> & Dismissal & {
|
|
510
|
+
tone?: StatusTone;
|
|
511
|
+
title?: ReactNode;
|
|
512
|
+
/** Replaces the tone's icon. Pass `false` for none. */
|
|
513
|
+
icon?: ReactNode | false;
|
|
514
|
+
/** A button or link shown after the message. */
|
|
515
|
+
action?: ReactNode;
|
|
516
|
+
};
|
|
517
|
+
/**
|
|
518
|
+
* A message about the state of the page or a process. Danger alerts use
|
|
519
|
+
* `role="alert"` and interrupt assistive technology; every other tone uses
|
|
520
|
+
* `role="status"` and waits politely. Override with the `role` prop. The tone
|
|
521
|
+
* is carried by an icon and the title as well as color.
|
|
522
|
+
*/
|
|
523
|
+
declare function Alert({ tone, title, icon, action, onDismiss, dismissLabel, role, children, ...props }: AlertProps): react.JSX.Element;
|
|
524
|
+
interface CalloutProps extends Omit<ComponentPropsWithRef<"aside">, "title"> {
|
|
525
|
+
tone?: StatusTone;
|
|
526
|
+
title?: ReactNode;
|
|
527
|
+
icon?: ReactNode | false;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* A highlighted aside inside content: a note, a tip, a warning. Unlike `Alert`
|
|
531
|
+
* it is part of the page and is not announced when it appears. The same shape
|
|
532
|
+
* is used by the editor's callout block and by reports.
|
|
533
|
+
*/
|
|
534
|
+
declare function Callout({ tone, title, icon, children, ...props }: CalloutProps): react.JSX.Element;
|
|
535
|
+
|
|
536
|
+
type BarTone = "accent" | "success" | "warning" | "danger";
|
|
537
|
+
interface ProgressProps extends Omit<Progress$1.Root.Props, "children"> {
|
|
538
|
+
/** Visible label. Without one, pass `aria-label`. */
|
|
539
|
+
label?: ReactNode;
|
|
540
|
+
/** Shows the formatted value, for example "40%". */
|
|
541
|
+
showValue?: boolean;
|
|
542
|
+
size?: "sm" | "md" | "lg";
|
|
543
|
+
tone?: BarTone;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Progress of a task. `value` is a number between `min` and `max`, or `null`
|
|
547
|
+
* for an indeterminate task. The bar never shows color alone: the value text
|
|
548
|
+
* and the accessible value stay in sync.
|
|
549
|
+
*/
|
|
550
|
+
declare function Progress({ label, showValue, size, tone, ...props }: ProgressProps): react.JSX.Element;
|
|
551
|
+
interface MeterProps extends Omit<Meter$1.Root.Props, "children"> {
|
|
552
|
+
label?: ReactNode;
|
|
553
|
+
showValue?: boolean;
|
|
554
|
+
size?: "sm" | "md" | "lg";
|
|
555
|
+
tone?: BarTone;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* A gauge for a known quantity inside a range, such as disk usage. Use
|
|
559
|
+
* `Progress` instead for a task that moves toward completion.
|
|
560
|
+
*/
|
|
561
|
+
declare function Meter({ label, showValue, size, tone, ...props }: MeterProps): react.JSX.Element;
|
|
562
|
+
|
|
563
|
+
type CircleTone = "accent" | "success" | "warning" | "danger";
|
|
564
|
+
interface ProgressCircleProps extends Omit<Progress$1.Root.Props, "children"> {
|
|
565
|
+
/** Visible label under the ring. Without one, pass `aria-label`. */
|
|
566
|
+
label?: ReactNode;
|
|
567
|
+
/**
|
|
568
|
+
* Shows the formatted value, for example "40%", in the middle of the ring.
|
|
569
|
+
* Not shown at `sm`, where the ring is too small to hold text.
|
|
570
|
+
*/
|
|
571
|
+
showValue?: boolean;
|
|
572
|
+
/** Replaces the value in the middle of the ring, for example an icon. */
|
|
573
|
+
children?: ReactNode;
|
|
574
|
+
size?: "sm" | "md" | "lg";
|
|
575
|
+
tone?: CircleTone;
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Progress of a task as a ring. It reports the same role, value and text as
|
|
579
|
+
* `Progress`, so use it where a bar does not fit: a card corner, a table cell,
|
|
580
|
+
* a toolbar. `value` is a number between `min` and `max`, or `null` while the
|
|
581
|
+
* amount is unknown, which turns the ring into a quiet spinner.
|
|
582
|
+
*
|
|
583
|
+
* The ring starts at the top and runs clockwise in every language. It never
|
|
584
|
+
* carries meaning by color alone: the value is exposed to assistive technology
|
|
585
|
+
* and can be shown in the middle.
|
|
586
|
+
*/
|
|
587
|
+
declare function ProgressCircle({ label, showValue, children, size, tone, value, min, max, ...props }: ProgressCircleProps): react.JSX.Element;
|
|
588
|
+
|
|
589
|
+
interface AnimatedNumberProps extends Omit<ComponentPropsWithRef<"span">, "children"> {
|
|
590
|
+
value: number;
|
|
591
|
+
/** `Intl.NumberFormatOptions`, for example `{ style: "currency", currency: "EUR" }`. */
|
|
592
|
+
format?: Intl.NumberFormatOptions;
|
|
593
|
+
/** The locale for digits and separators. Defaults to the user's runtime locale. */
|
|
594
|
+
locale?: Intl.LocalesArgument;
|
|
595
|
+
/** Milliseconds. Defaults to the theme's `--kit-duration-slow`. */
|
|
596
|
+
duration?: number;
|
|
597
|
+
/**
|
|
598
|
+
* Count up from this number the first time the component appears. Without
|
|
599
|
+
* it the first render shows `value`, so the real number is in the page
|
|
600
|
+
* before any script runs. With it, that first render shows `from` instead.
|
|
601
|
+
*/
|
|
602
|
+
from?: number;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* A number that counts to its new value instead of jumping. Put it anywhere a
|
|
606
|
+
* number goes, for example in a `Stat`.
|
|
607
|
+
*
|
|
608
|
+
* - Screen readers get only the final number, once. The counting text is
|
|
609
|
+
* hidden from them.
|
|
610
|
+
* - With `prefers-reduced-motion: reduce` it jumps straight to the value.
|
|
611
|
+
* - Digits are tabular, so the width does not jitter.
|
|
612
|
+
* - A new `value` in the middle of a count continues from what is on screen.
|
|
613
|
+
*/
|
|
614
|
+
declare function AnimatedNumber({ value, format, locale, duration, from, ...props }: AnimatedNumberProps): react.JSX.Element;
|
|
615
|
+
|
|
616
|
+
interface SkeletonProps extends ComponentPropsWithRef<"div"> {
|
|
617
|
+
variant?: "text" | "rect" | "circle";
|
|
618
|
+
/** CSS length or number of pixels. Defaults to the full width (text, rect) or the avatar size (circle). */
|
|
619
|
+
width?: CSSProperties["inlineSize"];
|
|
620
|
+
height?: CSSProperties["blockSize"];
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* A placeholder shape shown while content loads. It is hidden from assistive
|
|
624
|
+
* technology: mark the loading region itself with `aria-busy="true"` and give
|
|
625
|
+
* a status message elsewhere.
|
|
626
|
+
*/
|
|
627
|
+
declare function Skeleton({ variant, width, height, style, ...props }: SkeletonProps): react.JSX.Element;
|
|
628
|
+
interface SkeletonTextProps extends ComponentPropsWithRef<"div"> {
|
|
629
|
+
lines?: number;
|
|
630
|
+
}
|
|
631
|
+
/** Several text-line skeletons; the last one is shorter, like a paragraph. */
|
|
632
|
+
declare function SkeletonText({ lines, ...props }: SkeletonTextProps): react.JSX.Element;
|
|
633
|
+
|
|
634
|
+
interface EmptyStateProps extends Omit<ComponentPropsWithRef<"div">, "title"> {
|
|
635
|
+
/** A decorative illustration or icon. It is hidden from assistive technology. */
|
|
636
|
+
icon?: ReactNode;
|
|
637
|
+
title: ReactNode;
|
|
638
|
+
description?: ReactNode;
|
|
639
|
+
/** The next step: a `Button` or a link. */
|
|
640
|
+
action?: ReactNode;
|
|
641
|
+
/** The title's heading level, so it fits the page outline. Defaults to 3. */
|
|
642
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* What to show when a list, table or search has nothing to display. It says
|
|
646
|
+
* what is missing and offers the next step.
|
|
647
|
+
*/
|
|
648
|
+
declare function EmptyState({ icon, title, description, action, headingLevel, ...props }: EmptyStateProps): react.JSX.Element;
|
|
649
|
+
|
|
650
|
+
interface CardProps extends ComponentPropsWithRef<"div"> {
|
|
651
|
+
/** `outlined` has a border, `raised` a shadow, `flat` a quiet background. */
|
|
652
|
+
variant?: "outlined" | "raised" | "flat";
|
|
653
|
+
padding?: "none" | "sm" | "md" | "lg";
|
|
654
|
+
/** Adds hover and focus styling for a card that is, or contains, the action. */
|
|
655
|
+
interactive?: boolean;
|
|
656
|
+
/** Render the child element (a link, an article) as the card. */
|
|
657
|
+
asChild?: boolean;
|
|
658
|
+
}
|
|
659
|
+
/** A surface that groups related content. Compose it with the `Card*` parts. */
|
|
660
|
+
declare function Card({ variant, padding, interactive, asChild, ...props }: CardProps): react.JSX.Element;
|
|
661
|
+
type CardSectionProps = ComponentPropsWithRef<"div">;
|
|
662
|
+
declare function CardHeader(props: CardSectionProps): react.JSX.Element;
|
|
663
|
+
interface CardTitleProps extends ComponentPropsWithRef<"h3"> {
|
|
664
|
+
/** Heading level, so the title fits the page outline. Defaults to 3. */
|
|
665
|
+
level?: 2 | 3 | 4 | 5 | 6;
|
|
666
|
+
}
|
|
667
|
+
declare function CardTitle({ level, ...props }: CardTitleProps): react.JSX.Element;
|
|
668
|
+
declare function CardDescription(props: ComponentPropsWithRef<"p">): react.JSX.Element;
|
|
669
|
+
declare function CardContent(props: CardSectionProps): react.JSX.Element;
|
|
670
|
+
declare function CardFooter(props: CardSectionProps): react.JSX.Element;
|
|
671
|
+
|
|
672
|
+
type AvatarSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
673
|
+
/** First letters of the first and last words, using whole characters (not UTF-16 halves). */
|
|
674
|
+
declare function getInitials(name: string): string;
|
|
675
|
+
interface AvatarProps extends Omit<Avatar$1.Root.Props, "children"> {
|
|
676
|
+
/** Image URL. If it fails to load, the initials show instead. */
|
|
677
|
+
src?: string;
|
|
678
|
+
/**
|
|
679
|
+
* Person's name. Used for the initials and, unless `alt` is set, as the
|
|
680
|
+
* accessible name of the image.
|
|
681
|
+
*/
|
|
682
|
+
name?: string;
|
|
683
|
+
/** Overrides the accessible name. Pass `""` when the name is shown next to the avatar. */
|
|
684
|
+
alt?: string;
|
|
685
|
+
size?: AvatarSize;
|
|
686
|
+
shape?: "circle" | "square";
|
|
687
|
+
/** Shown instead of initials, for example an icon. */
|
|
688
|
+
fallback?: ReactNode;
|
|
689
|
+
}
|
|
690
|
+
/** A person or entity: an image with initials as the fallback. */
|
|
691
|
+
declare function Avatar({ src, name, alt, size, shape, fallback, ...props }: AvatarProps): react.JSX.Element;
|
|
692
|
+
interface AvatarGroupProps extends ComponentPropsWithRef<"div"> {
|
|
693
|
+
/** Most avatars to show before collapsing the rest into "+N". Defaults to 4. */
|
|
694
|
+
max?: number;
|
|
695
|
+
/** Name of the "+N" chip, for example `(n) => n + " more people"`. Required when it can appear. */
|
|
696
|
+
overflowLabel?: (hidden: number) => string;
|
|
697
|
+
size?: AvatarSize;
|
|
698
|
+
}
|
|
699
|
+
/** Overlapping avatars with a "+N" chip for the rest. */
|
|
700
|
+
declare function AvatarGroup({ max, overflowLabel, size, children, ...props }: AvatarGroupProps): react.JSX.Element;
|
|
701
|
+
|
|
702
|
+
type RemoveProps = {
|
|
703
|
+
onRemove?: undefined;
|
|
704
|
+
removeLabel?: string;
|
|
705
|
+
} | {
|
|
706
|
+
/** Shows a remove button. */
|
|
707
|
+
onRemove: () => void;
|
|
708
|
+
/** Name of the remove button, for example "Remove design". Required with `onRemove`. */
|
|
709
|
+
removeLabel: string;
|
|
710
|
+
};
|
|
711
|
+
type TagProps = ComponentPropsWithRef<"span"> & RemoveProps & {
|
|
712
|
+
tone?: StatusTone;
|
|
713
|
+
size?: "sm" | "md";
|
|
714
|
+
/** Decorative leading content, such as an icon or a color dot. */
|
|
715
|
+
icon?: ReactNode;
|
|
716
|
+
};
|
|
717
|
+
/**
|
|
718
|
+
* A label that categorises or filters, optionally removable. Use `Badge` for a
|
|
719
|
+
* status and `Tag` for something the user can add or take away.
|
|
720
|
+
*/
|
|
721
|
+
declare function Tag({ tone, size, icon, onRemove, removeLabel, children, ...props }: TagProps): react.JSX.Element;
|
|
722
|
+
|
|
723
|
+
type StatTrend = "up" | "down" | "flat";
|
|
724
|
+
type StatIntent = "positive" | "negative" | "neutral";
|
|
725
|
+
interface StatProps extends ComponentPropsWithRef<"dl"> {
|
|
726
|
+
label: ReactNode;
|
|
727
|
+
value: ReactNode;
|
|
728
|
+
/** The change, for example "12.4%". */
|
|
729
|
+
delta?: ReactNode;
|
|
730
|
+
trend?: StatTrend;
|
|
731
|
+
/**
|
|
732
|
+
* Whether the change is good or bad. Defaults to `positive` for up and
|
|
733
|
+
* `negative` for down; set it when the opposite is true (cost going down).
|
|
734
|
+
*/
|
|
735
|
+
intent?: StatIntent;
|
|
736
|
+
/**
|
|
737
|
+
* Spoken before the delta, for example "Increased by". The arrow icon is
|
|
738
|
+
* decorative, so this is what tells a screen reader the direction.
|
|
739
|
+
*/
|
|
740
|
+
trendLabel?: string;
|
|
741
|
+
/** A short note under the value, for example "vs. last month". */
|
|
742
|
+
help?: ReactNode;
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* One headline number with its label and change. It is a description list, so
|
|
746
|
+
* the label and value stay linked for assistive technology. Direction is shown
|
|
747
|
+
* with an arrow and text, never color alone.
|
|
748
|
+
*/
|
|
749
|
+
declare function Stat({ label, value, delta, trend, intent, trendLabel, help, ...props }: StatProps): react.JSX.Element;
|
|
750
|
+
|
|
751
|
+
interface TableContainerProps extends ComponentPropsWithRef<"div"> {
|
|
752
|
+
/**
|
|
753
|
+
* Name of the scrollable region, for example "Invoices". A region that can
|
|
754
|
+
* scroll must be focusable and named so keyboard users can reach it.
|
|
755
|
+
*/
|
|
756
|
+
label: string;
|
|
757
|
+
}
|
|
758
|
+
/** Wraps a wide table so it scrolls horizontally without breaking the page. */
|
|
759
|
+
declare function TableContainer({ label, ...props }: TableContainerProps): react.JSX.Element;
|
|
760
|
+
interface TableProps extends ComponentPropsWithRef<"table"> {
|
|
761
|
+
striped?: boolean;
|
|
762
|
+
/** Keeps the header visible while the body scrolls inside a height-limited container. */
|
|
763
|
+
stickyHeader?: boolean;
|
|
764
|
+
/** Overrides the density for this table only. */
|
|
765
|
+
density?: "compact" | "default" | "comfortable";
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* A static, semantic table for small and medium datasets. For sorting,
|
|
769
|
+
* filtering, selection and large data use `DataGrid` from `@x12i/data`.
|
|
770
|
+
*/
|
|
771
|
+
declare function Table({ striped, stickyHeader, density, ...props }: TableProps): react.JSX.Element;
|
|
772
|
+
declare function TableCaption(props: ComponentPropsWithRef<"caption">): react.JSX.Element;
|
|
773
|
+
declare function TableHead(props: ComponentPropsWithRef<"thead">): react.JSX.Element;
|
|
774
|
+
declare function TableBody(props: ComponentPropsWithRef<"tbody">): react.JSX.Element;
|
|
775
|
+
declare function TableFoot(props: ComponentPropsWithRef<"tfoot">): react.JSX.Element;
|
|
776
|
+
interface TableRowProps extends ComponentPropsWithRef<"tr"> {
|
|
777
|
+
/** Styles the row as selected. Selection semantics belong to the control inside it. */
|
|
778
|
+
selected?: boolean;
|
|
779
|
+
}
|
|
780
|
+
declare function TableRow({ selected, ...props }: TableRowProps): react.JSX.Element;
|
|
781
|
+
type Align = "start" | "center" | "end" | "numeric";
|
|
782
|
+
interface TableHeaderCellProps extends Omit<ComponentPropsWithRef<"th">, "align"> {
|
|
783
|
+
align?: Align;
|
|
784
|
+
/** Marks the column as sorted, for `aria-sort`. */
|
|
785
|
+
sort?: "ascending" | "descending" | "none";
|
|
786
|
+
}
|
|
787
|
+
declare function TableHeaderCell({ align, sort, scope, ...props }: TableHeaderCellProps): react.JSX.Element;
|
|
788
|
+
interface TableCellProps extends Omit<ComponentPropsWithRef<"td">, "align"> {
|
|
789
|
+
/** `numeric` right-aligns (start-aligned in RTL it mirrors) and uses tabular digits. */
|
|
790
|
+
align?: Align;
|
|
791
|
+
}
|
|
792
|
+
declare function TableCell({ align, ...props }: TableCellProps): react.JSX.Element;
|
|
793
|
+
|
|
794
|
+
interface ScrollAreaProps extends ScrollArea$1.Root.Props {
|
|
795
|
+
/**
|
|
796
|
+
* Name of the scrollable region, for example "Chat messages". Required: a
|
|
797
|
+
* scrollable region is focusable so keyboard users can scroll it, and a
|
|
798
|
+
* focusable region needs a name.
|
|
799
|
+
*/
|
|
800
|
+
label: string;
|
|
801
|
+
/** Which scrollbars to draw. Defaults to `vertical`. */
|
|
802
|
+
orientation?: "vertical" | "horizontal" | "both";
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* A scroll container with themed scrollbars. The viewport is focusable and
|
|
806
|
+
* named, and scrolls with the arrow keys, Page Up/Down, Home and End.
|
|
807
|
+
*/
|
|
808
|
+
declare function ScrollArea({ label, orientation, children, ...props }: ScrollAreaProps): react.JSX.Element;
|
|
809
|
+
|
|
810
|
+
type CollapsibleProps = Collapsible$1.Root.Props;
|
|
811
|
+
/** Shows and hides one region of content. Compose with the trigger and panel. */
|
|
812
|
+
declare function Collapsible(props: CollapsibleProps): react.JSX.Element;
|
|
813
|
+
type CollapsibleTriggerProps = Collapsible$1.Trigger.Props;
|
|
814
|
+
/** The button that toggles the panel. It carries `aria-expanded` and `aria-controls`. */
|
|
815
|
+
declare function CollapsibleTrigger({ children, ...props }: CollapsibleTriggerProps): react.JSX.Element;
|
|
816
|
+
type CollapsiblePanelProps = Collapsible$1.Panel.Props;
|
|
817
|
+
declare function CollapsiblePanel(props: CollapsiblePanelProps): react.JSX.Element;
|
|
818
|
+
|
|
819
|
+
interface TabsProps extends Tabs$1.Root.Props {
|
|
820
|
+
/** `line` underlines the active tab; `pill` highlights it. */
|
|
821
|
+
variant?: "line" | "pill";
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* Tabs with automatic activation: arrow keys move focus and select, Home and
|
|
825
|
+
* End jump to the ends. Compose with `TabList`, `Tab` and `TabPanel`.
|
|
826
|
+
*/
|
|
827
|
+
declare function Tabs({ variant, ...props }: TabsProps): react.JSX.Element;
|
|
828
|
+
type TabListProps = Tabs$1.List.Props;
|
|
829
|
+
/** The row of tabs. Name it with `aria-label` when the page has more than one set of tabs. */
|
|
830
|
+
declare function TabList({ children, ...props }: TabListProps): react.JSX.Element;
|
|
831
|
+
type TabProps = Tabs$1.Tab.Props;
|
|
832
|
+
declare function Tab(props: TabProps): react.JSX.Element;
|
|
833
|
+
type TabPanelProps = Tabs$1.Panel.Props;
|
|
834
|
+
declare function TabPanel(props: TabPanelProps): react.JSX.Element;
|
|
835
|
+
|
|
836
|
+
interface BreadcrumbItemData {
|
|
837
|
+
label: ReactNode;
|
|
838
|
+
/** Omit for the current page, which renders as plain text. */
|
|
839
|
+
href?: string;
|
|
840
|
+
}
|
|
841
|
+
interface BreadcrumbProps extends Omit<ComponentPropsWithRef<"nav">, "children"> {
|
|
842
|
+
/** Name of the landmark, for example "Breadcrumb". Pass a translated string. */
|
|
843
|
+
label: string;
|
|
844
|
+
/** From the root to the current page. The last item is the current page. */
|
|
845
|
+
items: BreadcrumbItemData[];
|
|
846
|
+
/**
|
|
847
|
+
* Renders a link, so a router's link component can be used. Receives the
|
|
848
|
+
* href and the label.
|
|
849
|
+
*/
|
|
850
|
+
renderLink?: (item: {
|
|
851
|
+
href: string;
|
|
852
|
+
label: ReactNode;
|
|
853
|
+
}) => ReactNode;
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* Where the user is in a hierarchy. The last item is marked
|
|
857
|
+
* `aria-current="page"`; the separators are decorative and mirror in RTL.
|
|
858
|
+
*/
|
|
859
|
+
declare function Breadcrumb({ label, items, renderLink, ...props }: BreadcrumbProps): react.JSX.Element;
|
|
860
|
+
|
|
861
|
+
type PaginationItem = number | "ellipsis-start" | "ellipsis-end";
|
|
862
|
+
/**
|
|
863
|
+
* The page numbers to show: always the first and last page, the current page
|
|
864
|
+
* with `siblingCount` neighbours on each side, and an ellipsis for each gap.
|
|
865
|
+
* The list has a stable length, so the control does not change width while the
|
|
866
|
+
* user pages through.
|
|
867
|
+
*/
|
|
868
|
+
declare function getPaginationRange(page: number, pageCount: number, siblingCount?: number): PaginationItem[];
|
|
869
|
+
interface PaginationProps extends Omit<ComponentPropsWithRef<"nav">, "onChange"> {
|
|
870
|
+
/** Current page, starting at 1. */
|
|
871
|
+
page: number;
|
|
872
|
+
pageCount: number;
|
|
873
|
+
onPageChange: (page: number) => void;
|
|
874
|
+
/** Page numbers shown on each side of the current page. Defaults to 1. */
|
|
875
|
+
siblingCount?: number;
|
|
876
|
+
/** Name of the landmark, for example "Pagination". */
|
|
877
|
+
label: string;
|
|
878
|
+
previousLabel: string;
|
|
879
|
+
nextLabel: string;
|
|
880
|
+
/** Name of a page button, for example `(n) => "Page " + n`. */
|
|
881
|
+
getPageLabel: (page: number) => string;
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Page navigation. The current page has `aria-current="page"`. Previous and
|
|
885
|
+
* next are disabled at the ends instead of disappearing, so the layout holds.
|
|
886
|
+
*/
|
|
887
|
+
declare function Pagination({ page, pageCount, onPageChange, siblingCount, label, previousLabel, nextLabel, getPageLabel, ...props }: PaginationProps): react.JSX.Element;
|
|
888
|
+
|
|
889
|
+
type AccordionProps<Value = string> = Accordion$1.Root.Props<Value>;
|
|
890
|
+
/**
|
|
891
|
+
* A stack of sections that expand and collapse. One section is open at a time
|
|
892
|
+
* unless `multiple` is set. Arrow keys move between headers.
|
|
893
|
+
*/
|
|
894
|
+
declare function Accordion<Value = string>(props: AccordionProps<Value>): react.JSX.Element;
|
|
895
|
+
interface AccordionItemProps extends Omit<Accordion$1.Item.Props, "children" | "title"> {
|
|
896
|
+
/** The header text. It is the button that toggles the section. */
|
|
897
|
+
title: ReactNode;
|
|
898
|
+
children: ReactNode;
|
|
899
|
+
/** The heading level of the header, so it fits the page outline. Defaults to 3. */
|
|
900
|
+
headingLevel?: 2 | 3 | 4 | 5 | 6;
|
|
901
|
+
}
|
|
902
|
+
declare function AccordionItem({ title, children, headingLevel, ...props }: AccordionItemProps): react.JSX.Element;
|
|
903
|
+
|
|
904
|
+
interface SegmentedOption<Value extends string = string> {
|
|
905
|
+
value: Value;
|
|
906
|
+
label: ReactNode;
|
|
907
|
+
disabled?: boolean;
|
|
908
|
+
}
|
|
909
|
+
interface SegmentedControlProps<Value extends string = string> extends Omit<RadioGroup$1.Props<Value>, "children" | "render"> {
|
|
910
|
+
options: SegmentedOption<Value>[];
|
|
911
|
+
size?: ControlSize;
|
|
912
|
+
/** Stretch the segments to fill the available width. */
|
|
913
|
+
fullWidth?: boolean;
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Switches between a few views of the same content (Day / Week / Month). It is
|
|
917
|
+
* a radio group, so arrow keys select and exactly one option is always chosen.
|
|
918
|
+
* Use `Tabs` when each option reveals a different panel of content.
|
|
919
|
+
*/
|
|
920
|
+
declare function SegmentedControl<Value extends string = string>({ options, size, fullWidth, ...props }: SegmentedControlProps<Value>): react.JSX.Element;
|
|
921
|
+
|
|
922
|
+
type StepStatus = "complete" | "current" | "upcoming";
|
|
923
|
+
interface StepperStep {
|
|
924
|
+
id: string;
|
|
925
|
+
label: ReactNode;
|
|
926
|
+
description?: ReactNode;
|
|
927
|
+
}
|
|
928
|
+
interface StepperProps extends ComponentPropsWithRef<"ol"> {
|
|
929
|
+
steps: StepperStep[];
|
|
930
|
+
/** Index of the current step, starting at 0. Earlier steps are complete. */
|
|
931
|
+
current: number;
|
|
932
|
+
orientation?: "horizontal" | "vertical";
|
|
933
|
+
/**
|
|
934
|
+
* Spoken after each step's label, for example
|
|
935
|
+
* `(status) => status === "complete" ? "Completed" : status === "current" ? "Current step" : "Not started"`.
|
|
936
|
+
* Required for assistive technology to hear progress.
|
|
937
|
+
*/
|
|
938
|
+
getStatusLabel: (status: StepStatus) => string;
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* Where the user is in a multi-step process. It is a display, not navigation:
|
|
942
|
+
* put the controls that move between steps (Back, Next) outside it. The
|
|
943
|
+
* current step has `aria-current="step"`, and each step's status is spoken as
|
|
944
|
+
* text and drawn as an icon, not just a color.
|
|
945
|
+
*/
|
|
946
|
+
declare function Stepper({ steps, current, orientation, getStatusLabel, ...props }: StepperProps): react.JSX.Element;
|
|
947
|
+
|
|
948
|
+
type ToolbarProps = Toolbar$1.Root.Props;
|
|
949
|
+
/**
|
|
950
|
+
* A row of controls with one tab stop and arrow-key navigation (roving focus).
|
|
951
|
+
* Name it with `aria-label`.
|
|
952
|
+
*/
|
|
953
|
+
declare function Toolbar(props: ToolbarProps): react.JSX.Element;
|
|
954
|
+
type ToolbarGroupProps = Toolbar$1.Group.Props;
|
|
955
|
+
declare function ToolbarGroup(props: ToolbarGroupProps): react.JSX.Element;
|
|
956
|
+
interface ToolbarButtonProps extends Omit<Toolbar$1.Button.Props, "render">, Pick<ButtonProps, "variant" | "tone" | "size"> {
|
|
957
|
+
}
|
|
958
|
+
/** A button that takes part in the toolbar's arrow-key navigation. */
|
|
959
|
+
declare function ToolbarButton({ variant, tone, size, ...props }: ToolbarButtonProps): react.JSX.Element;
|
|
960
|
+
type ToolbarSeparatorProps = Toolbar$1.Separator.Props;
|
|
961
|
+
declare function ToolbarSeparator(props: ToolbarSeparatorProps): react.JSX.Element;
|
|
962
|
+
|
|
963
|
+
type DialogSize = "sm" | "md" | "lg" | "xl" | "full";
|
|
964
|
+
type DialogProps = Dialog$1.Root.Props;
|
|
965
|
+
/**
|
|
966
|
+
* A modal dialog. Focus moves into it when it opens, stays inside, and returns
|
|
967
|
+
* to the trigger when it closes; Escape closes it. Compose with
|
|
968
|
+
* `DialogTrigger`, `DialogContent`, `DialogTitle` and the other parts.
|
|
969
|
+
*/
|
|
970
|
+
declare const Dialog: <Payload>(props: Dialog$1.Root.Props<Payload>) => React.JSX.Element;
|
|
971
|
+
type DialogTriggerProps = Dialog$1.Trigger.Props;
|
|
972
|
+
declare function DialogTrigger(props: DialogTriggerProps): react.JSX.Element;
|
|
973
|
+
interface DialogContentProps extends Dialog$1.Popup.Props {
|
|
974
|
+
size?: DialogSize;
|
|
975
|
+
/**
|
|
976
|
+
* Name of the corner close button, for example "Close". Leave it out to hide
|
|
977
|
+
* the button; the dialog must then contain its own `DialogClose` action.
|
|
978
|
+
*/
|
|
979
|
+
closeLabel?: string;
|
|
980
|
+
}
|
|
981
|
+
/** The dialog panel with its backdrop. It must contain a `DialogTitle`. */
|
|
982
|
+
declare function DialogContent({ size, closeLabel, children, ...props }: DialogContentProps): react.JSX.Element;
|
|
983
|
+
declare function DialogTitle(props: Dialog$1.Title.Props): react.JSX.Element;
|
|
984
|
+
declare function DialogDescription(props: Dialog$1.Description.Props): react.JSX.Element;
|
|
985
|
+
declare function DialogHeader(props: ComponentPropsWithRef<"div">): react.JSX.Element;
|
|
986
|
+
declare function DialogBody(props: ComponentPropsWithRef<"div">): react.JSX.Element;
|
|
987
|
+
declare function DialogFooter(props: ComponentPropsWithRef<"div">): react.JSX.Element;
|
|
988
|
+
/** Closes the dialog. Use `render={<Button />}` to style it as a button. */
|
|
989
|
+
declare function DialogClose(props: Dialog$1.Close.Props): react.JSX.Element;
|
|
990
|
+
type AlertDialogProps = AlertDialog$1.Root.Props;
|
|
991
|
+
/**
|
|
992
|
+
* A dialog that interrupts to ask for a decision (delete, discard). It cannot
|
|
993
|
+
* be dismissed by clicking outside, has no corner close button, and announces
|
|
994
|
+
* itself as an alert dialog.
|
|
995
|
+
*/
|
|
996
|
+
declare const AlertDialog: typeof AlertDialog$1.Root;
|
|
997
|
+
declare function AlertDialogTrigger(props: AlertDialog$1.Trigger.Props): react.JSX.Element;
|
|
998
|
+
interface AlertDialogContentProps extends AlertDialog$1.Popup.Props {
|
|
999
|
+
size?: "sm" | "md";
|
|
1000
|
+
}
|
|
1001
|
+
declare function AlertDialogContent({ size, ...props }: AlertDialogContentProps): react.JSX.Element;
|
|
1002
|
+
declare function AlertDialogTitle(props: AlertDialog$1.Title.Props): react.JSX.Element;
|
|
1003
|
+
declare function AlertDialogDescription(props: AlertDialog$1.Description.Props): react.JSX.Element;
|
|
1004
|
+
declare function AlertDialogFooter(props: ComponentPropsWithRef<"div">): react.JSX.Element;
|
|
1005
|
+
/** Closes the alert dialog: wire both the cancel and the confirm buttons through it. */
|
|
1006
|
+
declare function AlertDialogClose(props: AlertDialog$1.Close.Props): react.JSX.Element;
|
|
1007
|
+
|
|
1008
|
+
type DrawerSide = "start" | "end" | "top" | "bottom";
|
|
1009
|
+
type DrawerProps = Omit<Drawer$1.Root.Props, "swipeDirection"> & {
|
|
1010
|
+
/** The edge the drawer slides in from. `start` and `end` follow the text direction. */
|
|
1011
|
+
side?: DrawerSide;
|
|
1012
|
+
};
|
|
1013
|
+
/**
|
|
1014
|
+
* A panel that slides in from an edge and can be swiped away on touch devices.
|
|
1015
|
+
* It behaves like a modal dialog: focus is trapped, Escape closes it, and
|
|
1016
|
+
* focus returns to the trigger. Swipe direction follows the document's `dir`.
|
|
1017
|
+
*/
|
|
1018
|
+
declare function Drawer({ side, ...props }: DrawerProps): react.JSX.Element;
|
|
1019
|
+
declare function DrawerTrigger(props: Drawer$1.Trigger.Props): react.JSX.Element;
|
|
1020
|
+
interface DrawerContentProps extends Drawer$1.Popup.Props {
|
|
1021
|
+
side?: DrawerSide;
|
|
1022
|
+
/** Name of the corner close button. Leave it out to hide the button. */
|
|
1023
|
+
closeLabel?: string;
|
|
1024
|
+
}
|
|
1025
|
+
/** The drawer panel and its backdrop. It must contain a `DrawerTitle`. */
|
|
1026
|
+
declare function DrawerContent({ side, closeLabel, children, ...props }: DrawerContentProps): react.JSX.Element;
|
|
1027
|
+
declare function DrawerTitle(props: Drawer$1.Title.Props): react.JSX.Element;
|
|
1028
|
+
declare function DrawerDescription(props: Drawer$1.Description.Props): react.JSX.Element;
|
|
1029
|
+
declare function DrawerHeader(props: ComponentPropsWithRef<"div">): react.JSX.Element;
|
|
1030
|
+
declare function DrawerBody(props: ComponentPropsWithRef<"div">): react.JSX.Element;
|
|
1031
|
+
declare function DrawerFooter(props: ComponentPropsWithRef<"div">): react.JSX.Element;
|
|
1032
|
+
declare function DrawerClose(props: Drawer$1.Close.Props): react.JSX.Element;
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* Where a floating panel sits relative to its trigger. `side` also accepts
|
|
1036
|
+
* `inline-start` and `inline-end`, which follow the text direction, so a menu
|
|
1037
|
+
* that opens "to the end" opens leftwards in RTL without extra code.
|
|
1038
|
+
*/
|
|
1039
|
+
type PositionProps = Pick<Popover$1.Positioner.Props, "side" | "align" | "sideOffset" | "alignOffset" | "collisionPadding" | "anchor">;
|
|
1040
|
+
|
|
1041
|
+
type PopoverProps = Popover$1.Root.Props;
|
|
1042
|
+
/**
|
|
1043
|
+
* A floating panel anchored to a trigger, for rich content or a small form.
|
|
1044
|
+
* Escape and outside click close it; focus moves into it and returns to the
|
|
1045
|
+
* trigger. Use `Tooltip` for a short, non-interactive hint.
|
|
1046
|
+
*/
|
|
1047
|
+
declare const Popover: typeof Popover$1.Root;
|
|
1048
|
+
declare function PopoverTrigger(props: Popover$1.Trigger.Props): react.JSX.Element;
|
|
1049
|
+
interface PopoverContentProps extends Popover$1.Popup.Props, PositionProps {
|
|
1050
|
+
/** Draws an arrow pointing at the trigger. */
|
|
1051
|
+
arrow?: boolean;
|
|
1052
|
+
}
|
|
1053
|
+
declare function PopoverContent({ side, align, sideOffset, alignOffset, collisionPadding, anchor, arrow, children, ...props }: PopoverContentProps): react.JSX.Element;
|
|
1054
|
+
declare function PopoverTitle(props: Popover$1.Title.Props): react.JSX.Element;
|
|
1055
|
+
declare function PopoverDescription(props: Popover$1.Description.Props): react.JSX.Element;
|
|
1056
|
+
declare function PopoverClose(props: Popover$1.Close.Props): react.JSX.Element;
|
|
1057
|
+
|
|
1058
|
+
/**
|
|
1059
|
+
* Shares open and close delays between tooltips, so moving from one trigger to
|
|
1060
|
+
* the next shows the second tooltip immediately. Wrap the app once.
|
|
1061
|
+
*/
|
|
1062
|
+
declare const TooltipProvider: react.FC<_base_ui_react.TooltipProviderProps>;
|
|
1063
|
+
interface TooltipProps extends Omit<PositionProps, "anchor"> {
|
|
1064
|
+
/**
|
|
1065
|
+
* Short, plain text. A tooltip is not focusable and disappears when the
|
|
1066
|
+
* pointer or focus leaves, so never put actions or required information in
|
|
1067
|
+
* it, and never use it as the only name of an icon button.
|
|
1068
|
+
*/
|
|
1069
|
+
content: ReactNode;
|
|
1070
|
+
/** The element the tooltip describes. It must accept a ref and DOM props. */
|
|
1071
|
+
children: ReactElement<{
|
|
1072
|
+
"aria-describedby"?: string;
|
|
1073
|
+
}>;
|
|
1074
|
+
/** Milliseconds before it opens on hover. Defaults to 600. */
|
|
1075
|
+
delay?: number;
|
|
1076
|
+
closeDelay?: number;
|
|
1077
|
+
disabled?: boolean;
|
|
1078
|
+
open?: boolean;
|
|
1079
|
+
defaultOpen?: boolean;
|
|
1080
|
+
onOpenChange?: (open: boolean) => void;
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* A short hint shown on hover and keyboard focus. While it is open the
|
|
1084
|
+
* trigger is linked to it with `aria-describedby` and the panel has
|
|
1085
|
+
* `role="tooltip"`. Escape closes it.
|
|
1086
|
+
*/
|
|
1087
|
+
declare function Tooltip({ content, children, side, align, sideOffset, alignOffset, collisionPadding, delay, closeDelay, disabled, open, defaultOpen, onOpenChange, }: TooltipProps): react.JSX.Element;
|
|
1088
|
+
|
|
1089
|
+
type MenuProps = Menu$1.Root.Props;
|
|
1090
|
+
/**
|
|
1091
|
+
* A menu of actions opened from a button. Arrow keys move, Home/End jump,
|
|
1092
|
+
* typing jumps to a matching item, Enter or Space activates, Escape closes.
|
|
1093
|
+
* Use `Select` to choose a value instead of run a command.
|
|
1094
|
+
*/
|
|
1095
|
+
declare const Menu: typeof Menu$1.Root;
|
|
1096
|
+
declare function MenuTrigger(props: Menu$1.Trigger.Props): react.JSX.Element;
|
|
1097
|
+
interface MenuContentProps extends Menu$1.Popup.Props, PositionProps {
|
|
1098
|
+
}
|
|
1099
|
+
declare function MenuContent({ side, align, sideOffset, alignOffset, collisionPadding, anchor, ...props }: MenuContentProps): react.JSX.Element;
|
|
1100
|
+
interface MenuItemProps extends Menu$1.Item.Props {
|
|
1101
|
+
/** Decorative icon before the label. */
|
|
1102
|
+
icon?: ReactNode;
|
|
1103
|
+
/** A shortcut hint such as `<Kbd>⌘K</Kbd>`. It is decorative; the shortcut must work elsewhere. */
|
|
1104
|
+
shortcut?: ReactNode;
|
|
1105
|
+
/** `danger` marks a destructive action. The label must still say what it does. */
|
|
1106
|
+
tone?: "default" | "danger";
|
|
1107
|
+
}
|
|
1108
|
+
/** One action. Also works inside `ContextMenuContent`. */
|
|
1109
|
+
declare function MenuItem({ icon, shortcut, tone, children, ...props }: MenuItemProps): react.JSX.Element;
|
|
1110
|
+
declare function MenuCheckboxItem({ children, ...props }: Menu$1.CheckboxItem.Props): react.JSX.Element;
|
|
1111
|
+
declare function MenuRadioGroup(props: Menu$1.RadioGroup.Props): react.JSX.Element;
|
|
1112
|
+
declare function MenuRadioItem({ children, ...props }: Menu$1.RadioItem.Props): react.JSX.Element;
|
|
1113
|
+
declare function MenuGroup(props: Menu$1.Group.Props): react.JSX.Element;
|
|
1114
|
+
/** The heading of a `MenuGroup`, announced when focus enters the group. */
|
|
1115
|
+
declare function MenuLabel(props: Menu$1.GroupLabel.Props): react.JSX.Element;
|
|
1116
|
+
declare function MenuSeparator(props: Menu$1.Separator.Props): react.JSX.Element;
|
|
1117
|
+
/** A nested menu. Open it with the arrow key that points away from the parent. */
|
|
1118
|
+
declare const SubMenu: typeof ContextMenu$1.SubmenuRoot;
|
|
1119
|
+
declare function SubMenuTrigger({ icon, children, ...props }: Menu$1.SubmenuTrigger.Props & {
|
|
1120
|
+
icon?: ReactNode;
|
|
1121
|
+
}): react.JSX.Element;
|
|
1122
|
+
declare function SubMenuContent({ side, align, sideOffset, alignOffset, collisionPadding, ...props }: MenuContentProps): react.JSX.Element;
|
|
1123
|
+
/**
|
|
1124
|
+
* A menu opened by right-click, long-press or the context-menu key on an
|
|
1125
|
+
* area. It must never be the only way to reach an action: also offer the
|
|
1126
|
+
* action in a visible control.
|
|
1127
|
+
*/
|
|
1128
|
+
declare const ContextMenu: typeof ContextMenu$1.Root;
|
|
1129
|
+
declare function ContextMenuTrigger(props: ContextMenu$1.Trigger.Props): react.JSX.Element;
|
|
1130
|
+
declare function ContextMenuContent({ side, align, sideOffset, alignOffset, collisionPadding, ...props }: Omit<MenuContentProps, "anchor">): react.JSX.Element;
|
|
1131
|
+
|
|
1132
|
+
type ToastPlacement = "top-start" | "top" | "top-end" | "bottom-start" | "bottom" | "bottom-end";
|
|
1133
|
+
interface ToastOptions {
|
|
1134
|
+
title?: ReactNode;
|
|
1135
|
+
description?: ReactNode;
|
|
1136
|
+
tone?: StatusTone;
|
|
1137
|
+
/** Milliseconds before it closes itself. `0` keeps it until dismissed. Defaults to the provider's. */
|
|
1138
|
+
timeout?: number;
|
|
1139
|
+
/** `high` is announced assertively (use it for errors); `low` waits politely. */
|
|
1140
|
+
priority?: "low" | "high";
|
|
1141
|
+
/** One optional action, for example "Undo". */
|
|
1142
|
+
action?: {
|
|
1143
|
+
label: string;
|
|
1144
|
+
onClick: () => void;
|
|
1145
|
+
};
|
|
1146
|
+
onClose?: () => void;
|
|
1147
|
+
}
|
|
1148
|
+
interface ToastProviderProps {
|
|
1149
|
+
children: ReactNode;
|
|
1150
|
+
/** Name of the dismiss button on each toast, for example "Dismiss notification". */
|
|
1151
|
+
closeLabel: string;
|
|
1152
|
+
/** Name of the region that holds the toasts, for example "Notifications". */
|
|
1153
|
+
regionLabel: string;
|
|
1154
|
+
/** Default milliseconds before a toast closes. Defaults to 5000. */
|
|
1155
|
+
timeout?: number;
|
|
1156
|
+
/** Most toasts shown at once. Defaults to 3. */
|
|
1157
|
+
limit?: number;
|
|
1158
|
+
placement?: ToastPlacement;
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Hosts transient messages. Toasts pause while hovered or focused, are
|
|
1162
|
+
* announced through a live region, and can be dismissed from the keyboard
|
|
1163
|
+
* (F6 jumps to the region). Do not put anything essential in a toast: it
|
|
1164
|
+
* disappears. Use `Alert` for messages that must stay.
|
|
1165
|
+
*/
|
|
1166
|
+
declare function ToastProvider({ children, closeLabel, regionLabel, timeout, limit, placement, }: ToastProviderProps): react.JSX.Element;
|
|
1167
|
+
interface ToastApi {
|
|
1168
|
+
/** Shows a toast and returns its id. */
|
|
1169
|
+
show: (options: ToastOptions) => string;
|
|
1170
|
+
update: (id: string, options: ToastOptions) => void;
|
|
1171
|
+
close: (id?: string) => void;
|
|
1172
|
+
/**
|
|
1173
|
+
* Shows a loading toast and updates it when the promise settles. The tone
|
|
1174
|
+
* follows the outcome (success or danger), so the messages take no `tone`.
|
|
1175
|
+
* The returned promise settles like the one passed in, so a rejection must
|
|
1176
|
+
* still be handled by the caller.
|
|
1177
|
+
*/
|
|
1178
|
+
promise: <Value>(promise: Promise<Value>, messages: {
|
|
1179
|
+
loading: PromiseToastMessage;
|
|
1180
|
+
success: PromiseToastMessage | ((value: Value) => PromiseToastMessage);
|
|
1181
|
+
error: PromiseToastMessage | ((error: unknown) => PromiseToastMessage);
|
|
1182
|
+
}) => Promise<Value>;
|
|
1183
|
+
}
|
|
1184
|
+
type PromiseToastMessage = Omit<ToastOptions, "tone">;
|
|
1185
|
+
/** Read the toast API anywhere under `ToastProvider`. */
|
|
1186
|
+
declare function useToast(): ToastApi;
|
|
1187
|
+
|
|
1188
|
+
interface SplitButtonProps extends Pick<ButtonProps, "variant" | "tone" | "size" | "disabled" | "loading" | "loadingLabel" | "onClick" | "type"> {
|
|
1189
|
+
/** The primary action's label. */
|
|
1190
|
+
children: ReactNode;
|
|
1191
|
+
/** Name of the arrow button that opens the other actions, for example "More actions". */
|
|
1192
|
+
menuLabel: string;
|
|
1193
|
+
/** The other actions: `MenuItem`s. */
|
|
1194
|
+
menu: ReactNode;
|
|
1195
|
+
}
|
|
1196
|
+
/**
|
|
1197
|
+
* A primary action with a menu of related ones, for example "Save" with "Save
|
|
1198
|
+
* as draft" and "Save and close". The two parts are separate tab stops, so
|
|
1199
|
+
* the primary action stays one keypress away.
|
|
1200
|
+
*/
|
|
1201
|
+
declare function SplitButton({ children, menuLabel, menu, variant, tone, size, disabled, loading, loadingLabel, onClick, type, }: SplitButtonProps): react.JSX.Element;
|
|
1202
|
+
|
|
1203
|
+
interface DensityContextValue {
|
|
1204
|
+
density: DensityName;
|
|
1205
|
+
setDensity: (density: DensityName) => void;
|
|
1206
|
+
}
|
|
1207
|
+
interface DensityProviderProps extends Omit<ComponentPropsWithRef<"div">, "children" | "onChange"> {
|
|
1208
|
+
children?: ReactNode;
|
|
1209
|
+
/** Controlled density. */
|
|
1210
|
+
density?: DensityName;
|
|
1211
|
+
defaultDensity?: DensityName;
|
|
1212
|
+
onDensityChange?: (density: DensityName) => void;
|
|
1213
|
+
/**
|
|
1214
|
+
* `root` sets `data-density` on `<html>` and renders no wrapper element.
|
|
1215
|
+
* `subtree` (default) renders a wrapper that scopes the density to its children.
|
|
1216
|
+
*/
|
|
1217
|
+
scope?: "root" | "subtree";
|
|
1218
|
+
/**
|
|
1219
|
+
* localStorage key that remembers the choice, or `null` for none. Defaults
|
|
1220
|
+
* to the shared key for `root` and to none for `subtree`.
|
|
1221
|
+
*/
|
|
1222
|
+
storageKey?: string | null;
|
|
1223
|
+
}
|
|
1224
|
+
/** Compact, default and comfortable density from one set of components. */
|
|
1225
|
+
declare function DensityProvider({ children, density: densityProp, defaultDensity, onDensityChange, scope, storageKey, className, ...props }: DensityProviderProps): react.JSX.Element;
|
|
1226
|
+
/** Reads and changes the density of the nearest `DensityProvider`. */
|
|
1227
|
+
declare function useDensity(): DensityContextValue;
|
|
1228
|
+
|
|
1229
|
+
/** A theme name, or `system` to follow the operating system preference. */
|
|
1230
|
+
type ThemeChoice = ThemeName | "system";
|
|
1231
|
+
interface ThemeContextValue {
|
|
1232
|
+
/** The user's choice, which can be `system`. */
|
|
1233
|
+
theme: ThemeChoice;
|
|
1234
|
+
/** The theme in effect. `system` resolves to `light` or `dark`. */
|
|
1235
|
+
resolvedTheme: ThemeName;
|
|
1236
|
+
setTheme: (theme: ThemeChoice) => void;
|
|
1237
|
+
}
|
|
1238
|
+
interface ThemeProviderProps extends Omit<ComponentPropsWithRef<"div">, "children" | "onChange"> {
|
|
1239
|
+
children?: ReactNode;
|
|
1240
|
+
/** Controlled theme. */
|
|
1241
|
+
theme?: ThemeChoice;
|
|
1242
|
+
/** Initial theme when uncontrolled. Defaults to following the system. */
|
|
1243
|
+
defaultTheme?: ThemeChoice;
|
|
1244
|
+
onThemeChange?: (theme: ThemeChoice) => void;
|
|
1245
|
+
/**
|
|
1246
|
+
* `root` sets `data-theme` on `<html>` and renders no wrapper element.
|
|
1247
|
+
* `subtree` (default) renders a wrapper that scopes the theme to its children.
|
|
1248
|
+
*/
|
|
1249
|
+
scope?: "root" | "subtree";
|
|
1250
|
+
/**
|
|
1251
|
+
* localStorage key that remembers the choice, or `null` for none. Defaults
|
|
1252
|
+
* to the shared key for `root` and to none for `subtree`.
|
|
1253
|
+
*/
|
|
1254
|
+
storageKey?: string | null;
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Sets the theme for the page or for a subtree. Pair a `root` provider with
|
|
1258
|
+
* `getNoFlashScript()` from `@x12i/themes` to avoid a flash on first paint.
|
|
1259
|
+
*/
|
|
1260
|
+
declare function ThemeProvider({ children, theme: themeProp, defaultTheme, onThemeChange, scope, storageKey, className, ...props }: ThemeProviderProps): react.JSX.Element;
|
|
1261
|
+
/** Reads and changes the theme of the nearest `ThemeProvider`. */
|
|
1262
|
+
declare function useTheme(): ThemeContextValue;
|
|
1263
|
+
|
|
1264
|
+
export { Accordion, AccordionItem, Alert, AlertDialog, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogTitle, AlertDialogTrigger, AnimatedNumber, Avatar, AvatarGroup, Badge, Breadcrumb, Button, ButtonGroup, Callout, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxGroup, Collapsible, CollapsiblePanel, CollapsibleTrigger, Combobox, ContextMenu, ContextMenuContent, ContextMenuTrigger, ControlSize, CopyButton, DensityProvider, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Divider, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, EmptyState, Field, FieldDescription, FieldError, FieldLabel, Fieldset, IconButton, Inline, Input, InputAddon, InputGroup, Kbd, KbdGroup, Link, Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuTrigger, Meter, MultiCombobox, NumberInput, OTPInput, Pagination, PasswordInput, Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, Progress, ProgressCircle, Radio, RadioGroup, ScrollArea, SegmentedControl, Select, Skeleton, SkeletonText, Slider, SpaceKey, Spinner, SplitButton, Stack, Stat, StatusTone, Stepper, SubMenu, SubMenuContent, SubMenuTrigger, Switch, Tab, TabList, TabPanel, Table, TableBody, TableCaption, TableCell, TableContainer, TableFoot, TableHead, TableHeaderCell, TableRow, Tabs, Tag, Textarea, ThemeProvider, ToastProvider, Toggle, ToggleGroup, Toolbar, ToolbarButton, ToolbarGroup, ToolbarSeparator, Tooltip, TooltipProvider, VisuallyHidden, getInitials, getPaginationRange, useDensity, useTheme, useToast };
|
|
1265
|
+
export type { AccordionItemProps, AccordionProps, AlertDialogContentProps, AlertDialogProps, AlertProps, Align$1 as Align, AnimatedNumberProps, AvatarGroupProps, AvatarProps, AvatarSize, BadgeProps, BadgeTone, BadgeVariant, BreadcrumbItemData, BreadcrumbProps, ButtonGroupProps, ButtonProps, ButtonTone, ButtonVariant, CalloutProps, CardProps, CardSectionProps, CardTitleProps, CheckboxGroupProps, CheckboxProps, CollapsiblePanelProps, CollapsibleProps, CollapsibleTriggerProps, ComboboxOption, ComboboxProps, CopyButtonProps, CopyStatus, DensityContextValue, DensityProviderProps, DialogContentProps, DialogProps, DialogSize, DialogTriggerProps, DividerProps, DrawerContentProps, DrawerProps, DrawerSide, EmptyStateProps, FieldDescriptionProps, FieldErrorProps, FieldLabelProps, FieldProps, FieldsetProps, IconButtonProps, InlineProps, InputAddonProps, InputGroupProps, InputProps, Justify, KbdGroupProps, KbdProps, LinkProps, MenuContentProps, MenuItemProps, MenuProps, MeterProps, MultiComboboxProps, NumberInputProps, OTPInputProps, PaginationItem, PaginationProps, PasswordInputProps, PopoverContentProps, PopoverProps, PositionProps, ProgressCircleProps, ProgressProps, PromiseToastMessage, RadioGroupProps, RadioProps, ScrollAreaProps, SegmentedControlProps, SegmentedOption, SelectGroup, SelectItems, SelectOption, SelectProps, SkeletonProps, SkeletonTextProps, SliderProps, SpinnerProps, SplitButtonProps, StackProps, StatIntent, StatProps, StatTrend, StepStatus, StepperProps, StepperStep, SwitchProps, TabListProps, TabPanelProps, TabProps, TableCellProps, TableContainerProps, TableHeaderCellProps, TableProps, TableRowProps, TabsProps, TagProps, TextareaProps, ThemeChoice, ThemeContextValue, ThemeProviderProps, ToastApi, ToastOptions, ToastPlacement, ToastProviderProps, ToggleGroupProps, ToggleProps, ToggleVariant, ToolbarButtonProps, ToolbarGroupProps, ToolbarProps, ToolbarSeparatorProps, TooltipProps, VisuallyHiddenProps };
|