@partrunner-ai/ui 2.0.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 +35 -0
- package/TRADEMARKS.md +12 -0
- package/dist/index.cjs +5666 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1601 -0
- package/dist/index.d.ts +1601 -0
- package/dist/index.js +5553 -0
- package/dist/index.js.map +1 -0
- package/package.json +76 -0
- package/styles/fonts/LICENSE-Barlow.txt +93 -0
- package/styles/fonts/LICENSE-Bebas-Neue.txt +93 -0
- package/styles/fonts/barlow-latin-400-normal.woff2 +0 -0
- package/styles/fonts/barlow-latin-500-normal.woff2 +0 -0
- package/styles/fonts/barlow-latin-600-normal.woff2 +0 -0
- package/styles/fonts/barlow-latin-700-normal.woff2 +0 -0
- package/styles/fonts/bebas-neue-latin-400-normal.woff2 +0 -0
- package/styles/light.css +3390 -0
- package/styles/theme.css +3445 -0
- package/styles/ui.css +3200 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1601 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ButtonHTMLAttributes, ReactElement, ReactNode, HTMLAttributes, RefObject, Ref, InputHTMLAttributes, AriaAttributes, LabelHTMLAttributes, TextareaHTMLAttributes, FieldsetHTMLAttributes, SelectHTMLAttributes, CSSProperties, HTMLAttributeAnchorTarget, ComponentType, TableHTMLAttributes, TdHTMLAttributes, ThHTMLAttributes, RefAttributes, SetStateAction } from 'react';
|
|
3
|
+
import { LucideIcon } from 'lucide-react';
|
|
4
|
+
|
|
5
|
+
type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'glass' | 'danger' | 'success' | 'link';
|
|
6
|
+
type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'icon';
|
|
7
|
+
/**
|
|
8
|
+
* Either a lucide component, which we size for you, or an already-rendered node.
|
|
9
|
+
*
|
|
10
|
+
* Both forms are useful: pass a component for package-owned sizing or a
|
|
11
|
+
* rendered element when the caller owns its exact treatment.
|
|
12
|
+
*/
|
|
13
|
+
type ButtonIcon = LucideIcon | ReactElement;
|
|
14
|
+
interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
15
|
+
variant?: ButtonVariant;
|
|
16
|
+
size?: ButtonSize;
|
|
17
|
+
/** Swaps the leading icon for a spinner and blocks interaction. */
|
|
18
|
+
loading?: boolean;
|
|
19
|
+
icon?: ButtonIcon;
|
|
20
|
+
iconPosition?: 'left' | 'right';
|
|
21
|
+
fullWidth?: boolean;
|
|
22
|
+
/** Disables the tactile press scale when motion would be distracting. */
|
|
23
|
+
static?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Render the child instead of a `<button>`, keeping the styling. This is how
|
|
26
|
+
* an app plugs in its own router link — the package cannot know whether that
|
|
27
|
+
* is next/link, react-router or a plain anchor.
|
|
28
|
+
*/
|
|
29
|
+
asChild?: boolean;
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The shared button.
|
|
34
|
+
*
|
|
35
|
+
* Styling lives in `styles/ui.css` as plain CSS over the `--pr-*` scale, not as
|
|
36
|
+
* Tailwind classes. Consumers span Tailwind v3 and v4, and shipping utility
|
|
37
|
+
* classes would force every host to scan node_modules
|
|
38
|
+
* and to agree on a Tailwind major. CSS over custom properties works in both,
|
|
39
|
+
* and in an app with no Tailwind at all.
|
|
40
|
+
*/
|
|
41
|
+
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Tones come straight from the scale. The six named ones are the same palette
|
|
45
|
+
* the app launcher tiles use (`--pr-tone-*`), so a badge and a tile for the same
|
|
46
|
+
* thing agree without either app picking a hex.
|
|
47
|
+
*/
|
|
48
|
+
type BadgeTone = 'neutral' | 'yellow' | 'blue' | 'amber' | 'purple' | 'green' | 'rose' | 'danger' | 'success' | 'warning' | 'info';
|
|
49
|
+
type BadgeSize = 'xs' | 'sm' | 'md';
|
|
50
|
+
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
51
|
+
tone?: BadgeTone;
|
|
52
|
+
/** Solid reads as a status you must act on; the default tint is informational. */
|
|
53
|
+
solid?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Transparent, with the tone carried by the border and the text. For a badge on
|
|
56
|
+
* an already-tinted surface, where a second fill reads as two overlapping chips.
|
|
57
|
+
*/
|
|
58
|
+
outline?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* A leading dot in the tone's own colour. Reads as live status — "connected",
|
|
61
|
+
* "3 pending" — rather than as a label.
|
|
62
|
+
*/
|
|
63
|
+
dot?: boolean;
|
|
64
|
+
size?: BadgeSize;
|
|
65
|
+
icon?: LucideIcon;
|
|
66
|
+
children?: ReactNode;
|
|
67
|
+
}
|
|
68
|
+
declare const Badge: react.ForwardRefExoticComponent<BadgeProps & react.RefAttributes<HTMLSpanElement>>;
|
|
69
|
+
|
|
70
|
+
type CardPadding = 'none' | 'sm' | 'md' | 'lg';
|
|
71
|
+
/**
|
|
72
|
+
* The same tone vocabulary `Badge` and the launcher tiles use, over the shared
|
|
73
|
+
* `--pr-tone-*` pairs — so a tinted card, the badge inside it and the tile that
|
|
74
|
+
* links to it all land on the same colour.
|
|
75
|
+
*
|
|
76
|
+
* `neutral` is the default surface, which is why it is not a class.
|
|
77
|
+
*/
|
|
78
|
+
type CardTone = 'neutral' | 'yellow' | 'blue' | 'amber' | 'purple' | 'green' | 'rose';
|
|
79
|
+
interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
80
|
+
padding?: CardPadding;
|
|
81
|
+
/** Sits on `elevated` instead of `surface` — for popovers and menus. */
|
|
82
|
+
raised?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* A resting shadow under the card, without changing its surface.
|
|
85
|
+
*
|
|
86
|
+
* Different from `raised`, which lifts the card onto `elevated` for a popover.
|
|
87
|
+
* This is a softer way to separate cards from the page while they remain on
|
|
88
|
+
* the same semantic surface.
|
|
89
|
+
*/
|
|
90
|
+
shadow?: boolean;
|
|
91
|
+
/** Hover and focus affordances for a whole-card link or button. */
|
|
92
|
+
interactive?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Uses a translucent, blurred surface derived from the active theme. This is
|
|
95
|
+
* the package-owned Crystal-style surface; it never assumes a light backdrop.
|
|
96
|
+
*/
|
|
97
|
+
glass?: boolean;
|
|
98
|
+
tone?: CardTone;
|
|
99
|
+
/**
|
|
100
|
+
* Keeps a hue-matched outline around a toned card. The existing borderless
|
|
101
|
+
* tone remains the default for backwards compatibility.
|
|
102
|
+
*/
|
|
103
|
+
toneBorder?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Washes the tone across the surface instead of tinting it flat. Only means
|
|
106
|
+
* anything with a `tone` — a gradient from the surface to itself is the surface.
|
|
107
|
+
*/
|
|
108
|
+
gradient?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Render the child instead of a `<div>`, keeping the styling — for a card that
|
|
111
|
+
* is itself a link. Same contract as `Button`.
|
|
112
|
+
*/
|
|
113
|
+
asChild?: boolean;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The surface everything else sits on.
|
|
117
|
+
*
|
|
118
|
+
* `raised` is the reason `elevated` had to become a real token: on a dark theme
|
|
119
|
+
* a shadow reads as nothing, so a raised card can only be distinguished by being
|
|
120
|
+
* lighter than the one beneath it.
|
|
121
|
+
*/
|
|
122
|
+
declare const Card: react.ForwardRefExoticComponent<CardProps & react.RefAttributes<HTMLDivElement>>;
|
|
123
|
+
interface CardHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
124
|
+
title?: ReactNode;
|
|
125
|
+
description?: ReactNode;
|
|
126
|
+
/** Right-aligned slot for actions. */
|
|
127
|
+
actions?: ReactNode;
|
|
128
|
+
}
|
|
129
|
+
declare const CardHeader: react.ForwardRefExoticComponent<CardHeaderProps & react.RefAttributes<HTMLDivElement>>;
|
|
130
|
+
interface CardTitleProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
131
|
+
}
|
|
132
|
+
declare const CardTitle: react.ForwardRefExoticComponent<CardTitleProps & react.RefAttributes<HTMLHeadingElement>>;
|
|
133
|
+
interface CardDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
134
|
+
}
|
|
135
|
+
declare const CardDescription: react.ForwardRefExoticComponent<CardDescriptionProps & react.RefAttributes<HTMLParagraphElement>>;
|
|
136
|
+
interface CardContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
137
|
+
/**
|
|
138
|
+
* Runs the body to the card's edges while the header keeps its padding.
|
|
139
|
+
*
|
|
140
|
+
* For a body that is its own bounded surface — a table, a chart, an image — where
|
|
141
|
+
* the card's inset reads as a gap around a thing that should meet the border, but
|
|
142
|
+
* the title above it still needs breathing room.
|
|
143
|
+
*
|
|
144
|
+
* `padding="none"` on the `Card` cannot express this: the padding lives on the card,
|
|
145
|
+
* so removing it takes the header's inset with it and the title ends up flush
|
|
146
|
+
* against the edge. This cancels the card's padding for the body alone, reading the
|
|
147
|
+
* amount from `--pr-card-pad` so it stays correct at every padding size.
|
|
148
|
+
*/
|
|
149
|
+
bleed?: boolean;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The body below a header. It carries no padding of its own — the `Card` owns
|
|
153
|
+
* that — only the separation from whatever sits above it.
|
|
154
|
+
*/
|
|
155
|
+
declare const CardContent: react.ForwardRefExoticComponent<CardContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
156
|
+
|
|
157
|
+
type DialogSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '4xl';
|
|
158
|
+
interface DialogProps {
|
|
159
|
+
open: boolean;
|
|
160
|
+
onClose: () => void;
|
|
161
|
+
title: ReactNode;
|
|
162
|
+
/** Rendered under the title and wired to `aria-describedby`. */
|
|
163
|
+
description?: ReactNode;
|
|
164
|
+
size?: DialogSize;
|
|
165
|
+
/** Pinned to the bottom, outside the scrolling body. */
|
|
166
|
+
footer?: ReactNode;
|
|
167
|
+
/** Escape and backdrop clicks stop closing it — for a destructive confirm. */
|
|
168
|
+
dismissible?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Keep Escape and the close button, but ignore clicks on the backdrop. For a
|
|
171
|
+
* long form where a stray click outside would throw away typing.
|
|
172
|
+
*
|
|
173
|
+
* `dismissible={false}` is the stricter thing: it removes every exit but your
|
|
174
|
+
* own footer button.
|
|
175
|
+
*/
|
|
176
|
+
closeOnBackdrop?: boolean;
|
|
177
|
+
/** Drop the header's close button while keeping Escape and the backdrop. */
|
|
178
|
+
hideClose?: boolean;
|
|
179
|
+
closeLabel?: string;
|
|
180
|
+
/** Replaces the whole title/close row. The dialog still owns the labelling. */
|
|
181
|
+
headerSlot?: ReactNode;
|
|
182
|
+
/** Extra classes on the scrolling body, for a form that manages its own padding. */
|
|
183
|
+
bodyClassName?: string;
|
|
184
|
+
/**
|
|
185
|
+
* Focus this on open instead of the first control in the body. Point it at the
|
|
186
|
+
* title when landing on a field would be wrong — a destructive confirm, say.
|
|
187
|
+
*/
|
|
188
|
+
initialFocusRef?: RefObject<HTMLElement | null>;
|
|
189
|
+
className?: string;
|
|
190
|
+
children?: ReactNode;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Modal dialog.
|
|
194
|
+
*
|
|
195
|
+
* The behaviour — portal, layer stack, focus trap, background `inert`, scroll
|
|
196
|
+
* lock — lives in `DialogLayer`; this owns the chrome. See that file for why a
|
|
197
|
+
* stack is needed rather than per-component effects.
|
|
198
|
+
*/
|
|
199
|
+
declare function Dialog({ open, onClose, title, description, size, closeOnBackdrop, hideClose, headerSlot, bodyClassName, footer, dismissible, closeLabel, initialFocusRef, className, children, }: DialogProps): react.JSX.Element;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Unstyled modal layer: portal, stack, focus trap, background inert.
|
|
203
|
+
*
|
|
204
|
+
* Three behaviors beyond `aria-modal` require a shared stack rather than a
|
|
205
|
+
* component-local effect:
|
|
206
|
+
*
|
|
207
|
+
* 1. LAYERS. A dialog can open a dialog. Escape must close the topmost, and the
|
|
208
|
+
* focus trap must follow it, so the registry is module-level and every handler
|
|
209
|
+
* reads the top of it.
|
|
210
|
+
* 2. BACKGROUND INERT. Trapping Tab stops keyboard escape but leaves the page
|
|
211
|
+
* behind reachable by a screen reader's virtual cursor and by pointer. Every
|
|
212
|
+
* body child outside the active layer gets `inert` + `aria-hidden`, with its
|
|
213
|
+
* prior value saved so it is restored rather than assumed.
|
|
214
|
+
* 3. OWNED PORTALS. A select or date-picker that renders into its own portal is
|
|
215
|
+
* visually inside the dialog but not a DOM descendant of it. Without
|
|
216
|
+
* `registerDialogLayerPortal` it would be treated as outside — tabbing into a
|
|
217
|
+
* dropdown would walk straight out of the trap, and the dropdown itself would
|
|
218
|
+
* be made inert.
|
|
219
|
+
*
|
|
220
|
+
* Styling belongs to the caller; `Dialog` is the styled one.
|
|
221
|
+
*/
|
|
222
|
+
interface DialogLayerProps {
|
|
223
|
+
open: boolean;
|
|
224
|
+
onClose: () => void;
|
|
225
|
+
children: ReactNode;
|
|
226
|
+
rootClassName?: string;
|
|
227
|
+
backdropClassName?: string;
|
|
228
|
+
panelClassName?: string;
|
|
229
|
+
ariaLabel?: string;
|
|
230
|
+
ariaLabelledBy?: string;
|
|
231
|
+
ariaDescribedBy?: string;
|
|
232
|
+
/** Dialog semantics for regular modals or confirmations. */
|
|
233
|
+
role?: 'dialog' | 'alertdialog';
|
|
234
|
+
/** Native attributes and event handlers forwarded to the modal panel. */
|
|
235
|
+
panelProps?: Omit<HTMLAttributes<HTMLDivElement>, 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'className' | 'role'>;
|
|
236
|
+
/** Access the rendered panel without owning its portal or focus behavior. */
|
|
237
|
+
panelRef?: Ref<HTMLDivElement>;
|
|
238
|
+
/** Focus this on open instead of the first focusable in the panel. */
|
|
239
|
+
initialFocusRef?: RefObject<HTMLElement | null>;
|
|
240
|
+
/**
|
|
241
|
+
* Pick the element to focus, given the panel. Wins over `initialFocusRef`.
|
|
242
|
+
* Needed when the target is not known until the panel exists — `Dialog` uses it
|
|
243
|
+
* to reach the first control in the BODY rather than the first in DOM order,
|
|
244
|
+
* which would be the close button in the header.
|
|
245
|
+
*/
|
|
246
|
+
resolveInitialFocus?: (panel: HTMLElement) => HTMLElement | null;
|
|
247
|
+
/**
|
|
248
|
+
* Runs immediately before the layer applies its default focus. Prevent the
|
|
249
|
+
* event when the consumer has deliberately focused another element.
|
|
250
|
+
*/
|
|
251
|
+
onOpenAutoFocus?: (event: DialogLayerAutoFocusEvent) => void;
|
|
252
|
+
/** When false, Escape and backdrop clicks do not close. Default true. */
|
|
253
|
+
dismissible?: boolean;
|
|
254
|
+
/**
|
|
255
|
+
* When false, only the backdrop stops closing it — Escape still works. Narrower
|
|
256
|
+
* than `dismissible`, for a form where a stray outside click would lose typing.
|
|
257
|
+
*/
|
|
258
|
+
closeOnBackdrop?: boolean;
|
|
259
|
+
}
|
|
260
|
+
interface DialogLayerAutoFocusEvent {
|
|
261
|
+
readonly defaultPrevented: boolean;
|
|
262
|
+
preventDefault(): void;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Tell the layer stack that `portal` belongs to the dialog containing `owner`.
|
|
266
|
+
*
|
|
267
|
+
* For a control that renders its overlay elsewhere in the DOM — a combobox, a
|
|
268
|
+
* date-picker — so it participates in the focus trap instead of being treated as
|
|
269
|
+
* background and made inert. The body-level portal root is also placed above its
|
|
270
|
+
* owning dialog without requiring each consumer to coordinate z-index values.
|
|
271
|
+
* Returns the deregistration function and restores the portal's prior stack style.
|
|
272
|
+
*/
|
|
273
|
+
declare function registerDialogLayerPortal(owner: HTMLElement, portal: HTMLElement): () => void;
|
|
274
|
+
declare function DialogLayer({ open, onClose, children, rootClassName, backdropClassName, panelClassName, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, panelProps, panelRef: forwardedPanelRef, initialFocusRef, resolveInitialFocus, onOpenAutoFocus, dismissible, closeOnBackdrop, }: DialogLayerProps): react.ReactPortal | null;
|
|
275
|
+
|
|
276
|
+
type DialogPrimitiveSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '4xl';
|
|
277
|
+
interface DialogRootProps {
|
|
278
|
+
children?: ReactNode;
|
|
279
|
+
/** Controlled open state. */
|
|
280
|
+
open?: boolean;
|
|
281
|
+
/** Initial state when the root is uncontrolled. */
|
|
282
|
+
defaultOpen?: boolean;
|
|
283
|
+
onOpenChange?: (open: boolean) => void;
|
|
284
|
+
/** When false, Escape, the backdrop, and the automatic close control are disabled. */
|
|
285
|
+
dismissible?: boolean;
|
|
286
|
+
/** Keep Escape and explicit close controls while protecting backdrop clicks. */
|
|
287
|
+
closeOnBackdrop?: boolean;
|
|
288
|
+
}
|
|
289
|
+
declare function DialogRoot({ children, open: controlledOpen, defaultOpen, onOpenChange, dismissible, closeOnBackdrop, }: DialogRootProps): react.JSX.Element;
|
|
290
|
+
interface DialogTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
291
|
+
asChild?: boolean;
|
|
292
|
+
}
|
|
293
|
+
declare const DialogTrigger: react.ForwardRefExoticComponent<DialogTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
294
|
+
interface DialogCloseProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
295
|
+
asChild?: boolean;
|
|
296
|
+
}
|
|
297
|
+
declare const DialogClose: react.ForwardRefExoticComponent<DialogCloseProps & react.RefAttributes<HTMLButtonElement>>;
|
|
298
|
+
interface DialogSurfaceProps extends HTMLAttributes<HTMLDivElement> {
|
|
299
|
+
size?: DialogPrimitiveSize;
|
|
300
|
+
showCloseButton?: boolean;
|
|
301
|
+
closeLabel?: string;
|
|
302
|
+
initialFocusRef?: RefObject<HTMLElement | null>;
|
|
303
|
+
onOpenAutoFocus?: (event: DialogLayerAutoFocusEvent) => void;
|
|
304
|
+
/** @internal Shared by the alert-dialog and sheet surfaces. */
|
|
305
|
+
surfaceRole?: 'dialog' | 'alertdialog';
|
|
306
|
+
/** @internal */
|
|
307
|
+
rootClassName?: string;
|
|
308
|
+
/** @internal */
|
|
309
|
+
backdropClassName?: string;
|
|
310
|
+
/** @internal */
|
|
311
|
+
panelClassName?: string;
|
|
312
|
+
/** @internal */
|
|
313
|
+
closeClassName?: string;
|
|
314
|
+
}
|
|
315
|
+
type DialogContentProps = Omit<DialogSurfaceProps, 'surfaceRole' | 'rootClassName' | 'backdropClassName' | 'panelClassName' | 'closeClassName'>;
|
|
316
|
+
declare const DialogContent: react.ForwardRefExoticComponent<DialogContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
317
|
+
type DialogHeaderProps = HTMLAttributes<HTMLDivElement>;
|
|
318
|
+
declare const DialogHeader: react.ForwardRefExoticComponent<DialogHeaderProps & react.RefAttributes<HTMLDivElement>>;
|
|
319
|
+
type DialogTitleProps = HTMLAttributes<HTMLHeadingElement>;
|
|
320
|
+
declare const DialogTitle: react.ForwardRefExoticComponent<DialogTitleProps & react.RefAttributes<HTMLHeadingElement>>;
|
|
321
|
+
type DialogDescriptionProps = HTMLAttributes<HTMLParagraphElement>;
|
|
322
|
+
declare const DialogDescription: react.ForwardRefExoticComponent<DialogDescriptionProps & react.RefAttributes<HTMLParagraphElement>>;
|
|
323
|
+
type DialogFooterProps = HTMLAttributes<HTMLDivElement>;
|
|
324
|
+
declare const DialogFooter: react.ForwardRefExoticComponent<DialogFooterProps & react.RefAttributes<HTMLDivElement>>;
|
|
325
|
+
|
|
326
|
+
type AlertDialogRootProps = Omit<DialogRootProps, 'dismissible' | 'closeOnBackdrop'>;
|
|
327
|
+
/** A confirmation layer that cannot be dismissed accidentally. */
|
|
328
|
+
declare function AlertDialogRoot(props: AlertDialogRootProps): react.JSX.Element;
|
|
329
|
+
declare const AlertDialogTrigger: react.ForwardRefExoticComponent<DialogTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
330
|
+
type AlertDialogTriggerProps = DialogTriggerProps;
|
|
331
|
+
type AlertDialogContentProps = Omit<DialogSurfaceProps, 'surfaceRole' | 'rootClassName' | 'backdropClassName' | 'panelClassName' | 'closeClassName' | 'showCloseButton'>;
|
|
332
|
+
declare const AlertDialogContent: react.ForwardRefExoticComponent<AlertDialogContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
333
|
+
type AlertDialogHeaderProps = HTMLAttributes<HTMLDivElement>;
|
|
334
|
+
declare const AlertDialogHeader: react.ForwardRefExoticComponent<AlertDialogHeaderProps & react.RefAttributes<HTMLDivElement>>;
|
|
335
|
+
type AlertDialogTitleProps = HTMLAttributes<HTMLHeadingElement>;
|
|
336
|
+
declare const AlertDialogTitle: react.ForwardRefExoticComponent<AlertDialogTitleProps & react.RefAttributes<HTMLHeadingElement>>;
|
|
337
|
+
type AlertDialogDescriptionProps = HTMLAttributes<HTMLParagraphElement>;
|
|
338
|
+
declare const AlertDialogDescription: react.ForwardRefExoticComponent<AlertDialogDescriptionProps & react.RefAttributes<HTMLParagraphElement>>;
|
|
339
|
+
type AlertDialogFooterProps = HTMLAttributes<HTMLDivElement>;
|
|
340
|
+
declare const AlertDialogFooter: react.ForwardRefExoticComponent<AlertDialogFooterProps & react.RefAttributes<HTMLDivElement>>;
|
|
341
|
+
type AlertDialogMediaProps = HTMLAttributes<HTMLDivElement>;
|
|
342
|
+
declare const AlertDialogMedia: react.ForwardRefExoticComponent<AlertDialogMediaProps & react.RefAttributes<HTMLDivElement>>;
|
|
343
|
+
type AlertDialogActionProps = ButtonProps;
|
|
344
|
+
declare const AlertDialogAction: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
345
|
+
type AlertDialogCancelProps = ButtonProps;
|
|
346
|
+
declare const AlertDialogCancel: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
347
|
+
|
|
348
|
+
type SheetSide = 'top' | 'right' | 'bottom' | 'left';
|
|
349
|
+
type SheetWidth = 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
350
|
+
declare const SheetRoot: typeof DialogRoot;
|
|
351
|
+
type SheetRootProps = DialogRootProps;
|
|
352
|
+
declare const SheetTrigger: react.ForwardRefExoticComponent<DialogTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
353
|
+
type SheetTriggerProps = DialogTriggerProps;
|
|
354
|
+
declare const SheetClose: react.ForwardRefExoticComponent<DialogCloseProps & react.RefAttributes<HTMLButtonElement>>;
|
|
355
|
+
type SheetCloseProps = DialogCloseProps;
|
|
356
|
+
interface SheetContentProps extends Omit<DialogSurfaceProps, 'size' | 'surfaceRole' | 'rootClassName' | 'backdropClassName' | 'panelClassName' | 'closeClassName'> {
|
|
357
|
+
side?: SheetSide;
|
|
358
|
+
width?: SheetWidth;
|
|
359
|
+
}
|
|
360
|
+
declare const SheetContent: react.ForwardRefExoticComponent<SheetContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
361
|
+
type SheetHeaderProps = HTMLAttributes<HTMLDivElement>;
|
|
362
|
+
declare const SheetHeader: react.ForwardRefExoticComponent<SheetHeaderProps & react.RefAttributes<HTMLDivElement>>;
|
|
363
|
+
type SheetTitleProps = HTMLAttributes<HTMLHeadingElement>;
|
|
364
|
+
declare const SheetTitle: react.ForwardRefExoticComponent<SheetTitleProps & react.RefAttributes<HTMLHeadingElement>>;
|
|
365
|
+
type SheetDescriptionProps = HTMLAttributes<HTMLParagraphElement>;
|
|
366
|
+
declare const SheetDescription: react.ForwardRefExoticComponent<SheetDescriptionProps & react.RefAttributes<HTMLParagraphElement>>;
|
|
367
|
+
type SheetFooterProps = HTMLAttributes<HTMLDivElement>;
|
|
368
|
+
declare const SheetFooter: react.ForwardRefExoticComponent<SheetFooterProps & react.RefAttributes<HTMLDivElement>>;
|
|
369
|
+
|
|
370
|
+
type InputSize = 'sm' | 'md' | 'lg';
|
|
371
|
+
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
372
|
+
label?: ReactNode;
|
|
373
|
+
/** Guidance shown under the field. Hidden while `error` is set. */
|
|
374
|
+
hint?: ReactNode;
|
|
375
|
+
/** Presence marks the field invalid; the text replaces `hint`. */
|
|
376
|
+
error?: ReactNode;
|
|
377
|
+
inputSize?: InputSize;
|
|
378
|
+
leading?: ReactNode;
|
|
379
|
+
trailing?: ReactNode;
|
|
380
|
+
fullWidth?: boolean;
|
|
381
|
+
containerClassName?: string;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Text field with its label, hint and error wired up.
|
|
385
|
+
*
|
|
386
|
+
* The wiring is the point. Hand-rolled fields tend to render an error in a
|
|
387
|
+
* `<span>` next to the input with nothing connecting them, so a screen reader
|
|
388
|
+
* reads the field as valid and never announces why it was rejected. Here the
|
|
389
|
+
* id is generated when not supplied, `aria-describedby` points at whichever of
|
|
390
|
+
* hint/error is showing, and `aria-invalid` follows `error`.
|
|
391
|
+
*/
|
|
392
|
+
declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
|
|
393
|
+
|
|
394
|
+
/** `picker` also covers native input clears, including the owning form's reset. */
|
|
395
|
+
type FileDropzoneSelectionSource = 'picker' | 'drop';
|
|
396
|
+
interface FileDropzoneProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'children' | 'defaultValue' | 'onChange' | 'size' | 'type' | 'value'> {
|
|
397
|
+
label: ReactNode;
|
|
398
|
+
description?: ReactNode;
|
|
399
|
+
hint?: ReactNode;
|
|
400
|
+
error?: ReactNode;
|
|
401
|
+
browseLabel?: ReactNode;
|
|
402
|
+
/**
|
|
403
|
+
* External file candidates. The component applies `accept` and `multiple` before it
|
|
404
|
+
* syncs visual and native form state. Prop synchronization does not emit callbacks.
|
|
405
|
+
*/
|
|
406
|
+
selectedFiles?: readonly File[];
|
|
407
|
+
/**
|
|
408
|
+
* Receives picker, drop, and form-reset replacements after native synchronization.
|
|
409
|
+
* Synchronizing `selectedFiles` does not call this callback.
|
|
410
|
+
*/
|
|
411
|
+
onFilesSelected: (files: File[], source: FileDropzoneSelectionSource) => void;
|
|
412
|
+
/**
|
|
413
|
+
* Receives picker or drop candidates rejected by `accept` or the single-file limit.
|
|
414
|
+
* Synchronizing `selectedFiles` does not call this callback.
|
|
415
|
+
*/
|
|
416
|
+
onFilesRejected?: (files: File[], source: FileDropzoneSelectionSource) => void;
|
|
417
|
+
fullWidth?: boolean;
|
|
418
|
+
containerClassName?: string;
|
|
419
|
+
}
|
|
420
|
+
declare const FileDropzone: react.ForwardRefExoticComponent<FileDropzoneProps & react.RefAttributes<HTMLInputElement>>;
|
|
421
|
+
|
|
422
|
+
type FormFieldControlProps = {
|
|
423
|
+
id?: string;
|
|
424
|
+
disabled?: boolean;
|
|
425
|
+
required?: boolean;
|
|
426
|
+
'aria-describedby'?: string;
|
|
427
|
+
'aria-labelledby'?: string;
|
|
428
|
+
'aria-invalid'?: AriaAttributes['aria-invalid'];
|
|
429
|
+
'aria-required'?: AriaAttributes['aria-required'];
|
|
430
|
+
};
|
|
431
|
+
interface LabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
|
|
432
|
+
/** Adds the canonical decorative required mark. The control still owns `required`. */
|
|
433
|
+
required?: boolean;
|
|
434
|
+
}
|
|
435
|
+
declare const Label: react.ForwardRefExoticComponent<LabelProps & react.RefAttributes<HTMLLabelElement>>;
|
|
436
|
+
interface FormFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
437
|
+
/** The single control whose accessible state FormField owns. */
|
|
438
|
+
children: ReactElement<FormFieldControlProps>;
|
|
439
|
+
label?: ReactNode;
|
|
440
|
+
/** Guidance shown under the control. Hidden while `error` is present. */
|
|
441
|
+
hint?: ReactNode;
|
|
442
|
+
/** Presence marks the control invalid and replaces `hint`. */
|
|
443
|
+
error?: ReactNode;
|
|
444
|
+
required?: boolean;
|
|
445
|
+
disabled?: boolean;
|
|
446
|
+
fullWidth?: boolean;
|
|
447
|
+
/** Used when the child does not already carry an id. */
|
|
448
|
+
controlId?: string;
|
|
449
|
+
}
|
|
450
|
+
declare function FormField({ children, label, hint, error, required, disabled, fullWidth, controlId, className, ...rest }: FormFieldProps): react.JSX.Element;
|
|
451
|
+
|
|
452
|
+
type TextareaSize = InputSize;
|
|
453
|
+
interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
454
|
+
label?: ReactNode;
|
|
455
|
+
hint?: ReactNode;
|
|
456
|
+
error?: ReactNode;
|
|
457
|
+
textareaSize?: TextareaSize;
|
|
458
|
+
fullWidth?: boolean;
|
|
459
|
+
containerClassName?: string;
|
|
460
|
+
}
|
|
461
|
+
declare const Textarea: react.ForwardRefExoticComponent<TextareaProps & react.RefAttributes<HTMLTextAreaElement>>;
|
|
462
|
+
|
|
463
|
+
interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {
|
|
464
|
+
label?: ReactNode;
|
|
465
|
+
description?: ReactNode;
|
|
466
|
+
error?: ReactNode;
|
|
467
|
+
containerClassName?: string;
|
|
468
|
+
indeterminate?: boolean;
|
|
469
|
+
}
|
|
470
|
+
declare const Checkbox: react.ForwardRefExoticComponent<CheckboxProps & react.RefAttributes<HTMLInputElement>>;
|
|
471
|
+
|
|
472
|
+
interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {
|
|
473
|
+
label?: ReactNode;
|
|
474
|
+
description?: ReactNode;
|
|
475
|
+
error?: ReactNode;
|
|
476
|
+
containerClassName?: string;
|
|
477
|
+
}
|
|
478
|
+
declare const Switch: react.ForwardRefExoticComponent<SwitchProps & react.RefAttributes<HTMLInputElement>>;
|
|
479
|
+
|
|
480
|
+
interface ChoiceOption {
|
|
481
|
+
value: string;
|
|
482
|
+
label: ReactNode;
|
|
483
|
+
description?: ReactNode;
|
|
484
|
+
disabled?: boolean;
|
|
485
|
+
}
|
|
486
|
+
type ChoiceGroupOrientation = 'vertical' | 'horizontal';
|
|
487
|
+
interface ChoiceGroupBaseProps extends Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, 'onChange' | 'onSelect'> {
|
|
488
|
+
name: string;
|
|
489
|
+
label: ReactNode;
|
|
490
|
+
options: readonly ChoiceOption[];
|
|
491
|
+
hint?: ReactNode;
|
|
492
|
+
error?: ReactNode;
|
|
493
|
+
orientation?: ChoiceGroupOrientation;
|
|
494
|
+
required?: boolean;
|
|
495
|
+
}
|
|
496
|
+
interface CheckboxGroupProps extends ChoiceGroupBaseProps {
|
|
497
|
+
value: readonly string[];
|
|
498
|
+
onValueChange: (value: string[]) => void;
|
|
499
|
+
}
|
|
500
|
+
interface RadioGroupProps extends ChoiceGroupBaseProps {
|
|
501
|
+
value: string | null;
|
|
502
|
+
onValueChange: (value: string) => void;
|
|
503
|
+
}
|
|
504
|
+
declare function CheckboxGroup({ value, onValueChange, ...props }: CheckboxGroupProps): react.JSX.Element;
|
|
505
|
+
declare function RadioGroup({ value, onValueChange, ...props }: RadioGroupProps): react.JSX.Element;
|
|
506
|
+
|
|
507
|
+
interface ValidationSummaryError {
|
|
508
|
+
fieldId: string;
|
|
509
|
+
label: ReactNode;
|
|
510
|
+
message: ReactNode;
|
|
511
|
+
}
|
|
512
|
+
interface ValidationSummaryProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
513
|
+
errors: readonly ValidationSummaryError[];
|
|
514
|
+
title?: ReactNode;
|
|
515
|
+
/** Focuses the summary after an unsuccessful submit. Off by default to avoid stealing focus. */
|
|
516
|
+
focusOnMount?: boolean;
|
|
517
|
+
}
|
|
518
|
+
declare const ValidationSummary: react.ForwardRefExoticComponent<ValidationSummaryProps & react.RefAttributes<HTMLElement>>;
|
|
519
|
+
|
|
520
|
+
type SpinnerSize = 'sm' | 'md' | 'lg';
|
|
521
|
+
/**
|
|
522
|
+
* `muted` is the standalone spinner sitting on a surface. `inherit` takes the colour
|
|
523
|
+
* of whatever contains it — for a spinner inside a coloured control, or one an app
|
|
524
|
+
* needs to tint.
|
|
525
|
+
*/
|
|
526
|
+
type SpinnerTone = 'muted' | 'inherit';
|
|
527
|
+
interface SpinnerProps extends HTMLAttributes<HTMLSpanElement> {
|
|
528
|
+
size?: SpinnerSize;
|
|
529
|
+
/**
|
|
530
|
+
* Announced to assistive tech. A spinner with no accessible name is a
|
|
531
|
+
* silent wait — the screen stops responding and nothing says why.
|
|
532
|
+
*/
|
|
533
|
+
label?: string;
|
|
534
|
+
/**
|
|
535
|
+
* Where the colour comes from. Defaults to `muted`.
|
|
536
|
+
*
|
|
537
|
+
* `inherit` emits no colour rule at all rather than setting `color: currentColor`,
|
|
538
|
+
* which matters because package CSS is unlayered: a declaration here — even
|
|
539
|
+
* `currentColor` — outranks a Tailwind `text-*` utility in `@layer utilities`, so a
|
|
540
|
+
* consumer could not tint the spinner. Absence composes; a value fights.
|
|
541
|
+
*
|
|
542
|
+
* This preserves caller-owned colour utilities instead of silently replacing
|
|
543
|
+
* them with the muted default.
|
|
544
|
+
*/
|
|
545
|
+
tone?: SpinnerTone;
|
|
546
|
+
}
|
|
547
|
+
declare const Spinner: react.ForwardRefExoticComponent<SpinnerProps & react.RefAttributes<HTMLSpanElement>>;
|
|
548
|
+
interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
549
|
+
icon?: LucideIcon;
|
|
550
|
+
title: ReactNode;
|
|
551
|
+
description?: ReactNode;
|
|
552
|
+
/** The way out — usually the action that would create the missing thing. */
|
|
553
|
+
action?: ReactNode;
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Nobody owns this today and three apps inline it, which is why the copy and
|
|
557
|
+
* spacing drift between screens that are all saying "there is nothing here".
|
|
558
|
+
*/
|
|
559
|
+
declare const EmptyState: react.ForwardRefExoticComponent<EmptyStateProps & react.RefAttributes<HTMLDivElement>>;
|
|
560
|
+
|
|
561
|
+
interface MultiSelectOption {
|
|
562
|
+
value: string;
|
|
563
|
+
label: string;
|
|
564
|
+
/** Additional matching text that stays out of the visible label and chips. */
|
|
565
|
+
searchText?: string;
|
|
566
|
+
/** Optional menu-only content before the label, such as a status dot or icon. */
|
|
567
|
+
leading?: ReactNode;
|
|
568
|
+
}
|
|
569
|
+
type MultiSelectVariant = 'field' | 'filter';
|
|
570
|
+
interface MultiSelectProps extends Pick<AriaAttributes, 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-invalid' | 'aria-required'> {
|
|
571
|
+
options: ReadonlyArray<MultiSelectOption>;
|
|
572
|
+
value: string[];
|
|
573
|
+
onChange: (next: string[]) => void;
|
|
574
|
+
/** Controlled popup visibility. Pair with onOpenChange. */
|
|
575
|
+
open?: boolean;
|
|
576
|
+
/** Initial popup visibility when the field is uncontrolled. */
|
|
577
|
+
defaultOpen?: boolean;
|
|
578
|
+
/** Called whenever an interaction requests a popup visibility change. */
|
|
579
|
+
onOpenChange?: (open: boolean) => void;
|
|
580
|
+
/** Reports the raw package-owned search input for remote option loading. */
|
|
581
|
+
onQueryChange?: (query: string) => void;
|
|
582
|
+
/**
|
|
583
|
+
* A field renders removable chips. A filter renders one compact summary so a
|
|
584
|
+
* toolbar does not grow as selections accumulate.
|
|
585
|
+
*/
|
|
586
|
+
variant?: MultiSelectVariant;
|
|
587
|
+
placeholder?: string;
|
|
588
|
+
/**
|
|
589
|
+
* A search box inside the menu. Defaults to true for fields and false for
|
|
590
|
+
* filters; it is worth enabling past a dozen options.
|
|
591
|
+
*/
|
|
592
|
+
searchable?: boolean;
|
|
593
|
+
loading?: boolean;
|
|
594
|
+
disabled?: boolean;
|
|
595
|
+
required?: boolean;
|
|
596
|
+
id?: string;
|
|
597
|
+
/**
|
|
598
|
+
* Chips shown before the rest collapse into a "+N". Keeps the trigger one line
|
|
599
|
+
* tall instead of growing as selections pile up.
|
|
600
|
+
*/
|
|
601
|
+
maxVisible?: number;
|
|
602
|
+
loadingLabel?: ReactNode;
|
|
603
|
+
emptyLabel?: ReactNode;
|
|
604
|
+
searchLabel?: string;
|
|
605
|
+
removeLabel?: (label: string) => string;
|
|
606
|
+
/** Optional first menu row that resets the selection to the unfiltered state. */
|
|
607
|
+
clearLabel?: ReactNode;
|
|
608
|
+
fullWidth?: boolean;
|
|
609
|
+
className?: string;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Multiple choice from a known list. Fields expose removable chips; filters
|
|
613
|
+
* collapse the same state into one toolbar-safe summary.
|
|
614
|
+
*
|
|
615
|
+
* The trigger is a composite widget rather than a `<button>`, which matters: chips
|
|
616
|
+
* carry their own remove control, and an interactive element inside a button is
|
|
617
|
+
* neither focusable nor announced. So the container takes `role="combobox"` and the
|
|
618
|
+
* chips' remove buttons are real buttons within it.
|
|
619
|
+
*
|
|
620
|
+
* The menu portals through `useAnchoredMenu`, so it escapes a dialog's scrolling
|
|
621
|
+
* body rather than being clipped by it.
|
|
622
|
+
*/
|
|
623
|
+
declare function MultiSelect({ options, value, onChange, open: controlledOpen, defaultOpen, onOpenChange, onQueryChange, variant, placeholder, searchable, loading, disabled, maxVisible, loadingLabel, emptyLabel, searchLabel, removeLabel, clearLabel, fullWidth, className, id, required, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'aria-required': ariaRequired, }: MultiSelectProps): react.JSX.Element;
|
|
624
|
+
|
|
625
|
+
interface ComboboxOption {
|
|
626
|
+
value: string;
|
|
627
|
+
label: string;
|
|
628
|
+
}
|
|
629
|
+
interface ComboboxProps extends Pick<AriaAttributes, 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-invalid' | 'aria-required'> {
|
|
630
|
+
/** The chosen option. Carries its label so the trigger renders without a refetch. */
|
|
631
|
+
value: ComboboxOption | null;
|
|
632
|
+
onChange: (next: ComboboxOption | null) => void;
|
|
633
|
+
/** Called with the trimmed query, debounced. Async so it can hit a server. */
|
|
634
|
+
onSearch: (query: string) => Promise<ComboboxOption[]>;
|
|
635
|
+
placeholder?: string;
|
|
636
|
+
disabled?: boolean;
|
|
637
|
+
required?: boolean;
|
|
638
|
+
id?: string;
|
|
639
|
+
/** Hides the clear button — for a field that must always hold a value. */
|
|
640
|
+
clearable?: boolean;
|
|
641
|
+
loadingLabel?: ReactNode;
|
|
642
|
+
emptyLabel?: ReactNode;
|
|
643
|
+
clearLabel?: string;
|
|
644
|
+
/** Milliseconds before a keystroke becomes a request. */
|
|
645
|
+
debounceMs?: number;
|
|
646
|
+
fullWidth?: boolean;
|
|
647
|
+
className?: string;
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* A select whose options come from a server.
|
|
651
|
+
*
|
|
652
|
+
* For catalogues too large to ship to the client — a fleet list, a driver list —
|
|
653
|
+
* where the value is one option and the search has to be asynchronous.
|
|
654
|
+
*
|
|
655
|
+
* Two things it handles that a hand-rolled one usually does not. Responses are
|
|
656
|
+
* matched to the request that asked for them, so a slow reply for "ab" cannot
|
|
657
|
+
* overwrite the results for "abc" that arrived first. And the menu renders in a
|
|
658
|
+
* portal registered with `DialogLayer`, so it escapes the scrolling body of a dialog
|
|
659
|
+
* instead of being clipped by it — which is where these fields normally live.
|
|
660
|
+
*/
|
|
661
|
+
declare function Combobox({ value, onChange, onSearch, placeholder, disabled, clearable, loadingLabel, emptyLabel, clearLabel, debounceMs, fullWidth, className, id, required, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'aria-required': ariaRequired, }: ComboboxProps): react.JSX.Element;
|
|
662
|
+
|
|
663
|
+
type SelectSize = 'sm' | 'md' | 'lg';
|
|
664
|
+
interface SelectOption {
|
|
665
|
+
value: string;
|
|
666
|
+
label: string;
|
|
667
|
+
disabled?: boolean;
|
|
668
|
+
}
|
|
669
|
+
interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
|
|
670
|
+
/** Pass options, or pass `<option>` children — not both. */
|
|
671
|
+
options?: ReadonlyArray<SelectOption>;
|
|
672
|
+
/** Shown while nothing is chosen, as a disabled first entry. */
|
|
673
|
+
placeholder?: string;
|
|
674
|
+
label?: ReactNode;
|
|
675
|
+
/** Guidance shown under the field. Hidden while `error` is set. */
|
|
676
|
+
hint?: ReactNode;
|
|
677
|
+
/** Presence marks the field invalid; the text replaces `hint`. */
|
|
678
|
+
error?: ReactNode;
|
|
679
|
+
selectSize?: SelectSize;
|
|
680
|
+
fullWidth?: boolean;
|
|
681
|
+
containerClassName?: string;
|
|
682
|
+
children?: ReactNode;
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* A native `<select>`, wired up the way `Input` is.
|
|
686
|
+
*
|
|
687
|
+
* Deliberately native. A listbox built out of divs has to re-implement typeahead,
|
|
688
|
+
* virtual focus, scroll-into-view and every mobile picker by hand, and gets one of
|
|
689
|
+
* them wrong; `<select>` has all of it and costs nothing. The trade is that the
|
|
690
|
+
* open menu cannot be styled — only its colors carry, via `option`, which is why
|
|
691
|
+
* the stylesheet states them explicitly — and that is a real limitation and the
|
|
692
|
+
* reason apps reach for a Radix listbox instead — see the PR for that decision.
|
|
693
|
+
*
|
|
694
|
+
* The API mirrors `Input` exactly — `label`, `hint`, `error`, `fullWidth`,
|
|
695
|
+
* `containerClassName`, a size prop and the same bare-rendering rule — so a form
|
|
696
|
+
* built from both lays out and validates the same way rather than needing two
|
|
697
|
+
* mental models.
|
|
698
|
+
*/
|
|
699
|
+
declare const Select: react.ForwardRefExoticComponent<SelectProps & react.RefAttributes<HTMLSelectElement>>;
|
|
700
|
+
|
|
701
|
+
type RichSelectSize = 'sm' | 'md' | 'lg';
|
|
702
|
+
interface RichSelectProps {
|
|
703
|
+
children: ReactNode;
|
|
704
|
+
value?: string | null;
|
|
705
|
+
defaultValue?: string;
|
|
706
|
+
onValueChange?: (value: string) => void;
|
|
707
|
+
/** Controlled popup visibility. Pair with onOpenChange. */
|
|
708
|
+
open?: boolean;
|
|
709
|
+
/** Initial popup visibility when the root is uncontrolled. */
|
|
710
|
+
defaultOpen?: boolean;
|
|
711
|
+
/** Called whenever an interaction requests a popup visibility change. */
|
|
712
|
+
onOpenChange?: (open: boolean) => void;
|
|
713
|
+
disabled?: boolean;
|
|
714
|
+
required?: boolean;
|
|
715
|
+
id?: string;
|
|
716
|
+
name?: string;
|
|
717
|
+
align?: 'left' | 'right';
|
|
718
|
+
matchTriggerWidth?: boolean;
|
|
719
|
+
'aria-label'?: string;
|
|
720
|
+
'aria-labelledby'?: string;
|
|
721
|
+
'aria-describedby'?: string;
|
|
722
|
+
'aria-invalid'?: boolean | 'true' | 'false';
|
|
723
|
+
'aria-required'?: boolean | 'true' | 'false';
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Compound single-select module for rich option content.
|
|
727
|
+
*
|
|
728
|
+
* The root owns value state, item discovery, search, typeahead, keyboard movement,
|
|
729
|
+
* portal anchoring, and dialog ownership. Apps only compose the visible pieces.
|
|
730
|
+
*/
|
|
731
|
+
declare function RichSelect({ children, value: controlledValue, defaultValue, onValueChange, open: controlledOpen, defaultOpen, onOpenChange, disabled, required, id: providedId, name, align, matchTriggerWidth, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, 'aria-required': ariaRequired, }: RichSelectProps): react.JSX.Element;
|
|
732
|
+
interface RichSelectTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
733
|
+
asChild?: boolean;
|
|
734
|
+
selectSize?: RichSelectSize;
|
|
735
|
+
fullWidth?: boolean;
|
|
736
|
+
}
|
|
737
|
+
declare const RichSelectTrigger: react.ForwardRefExoticComponent<RichSelectTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
738
|
+
interface RichSelectValueProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
739
|
+
placeholder?: ReactNode;
|
|
740
|
+
children?: ReactNode | ((value: string | null) => ReactNode);
|
|
741
|
+
}
|
|
742
|
+
declare const RichSelectValue: react.ForwardRefExoticComponent<RichSelectValueProps & react.RefAttributes<HTMLSpanElement>>;
|
|
743
|
+
type RichSelectContentProps = HTMLAttributes<HTMLDivElement>;
|
|
744
|
+
declare const RichSelectContent: react.ForwardRefExoticComponent<RichSelectContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
745
|
+
interface RichSelectSearchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'value' | 'onChange'> {
|
|
746
|
+
onQueryChange?: (query: string) => void;
|
|
747
|
+
}
|
|
748
|
+
declare const RichSelectSearch: react.ForwardRefExoticComponent<RichSelectSearchProps & react.RefAttributes<HTMLInputElement>>;
|
|
749
|
+
interface RichSelectItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
750
|
+
value: string;
|
|
751
|
+
textValue?: string;
|
|
752
|
+
disabled?: boolean;
|
|
753
|
+
}
|
|
754
|
+
declare const RichSelectItem: react.ForwardRefExoticComponent<RichSelectItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
755
|
+
type RichSelectGroupProps = HTMLAttributes<HTMLDivElement>;
|
|
756
|
+
declare const RichSelectGroup: react.ForwardRefExoticComponent<RichSelectGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
757
|
+
type RichSelectLabelProps = HTMLAttributes<HTMLDivElement>;
|
|
758
|
+
declare const RichSelectLabel: react.ForwardRefExoticComponent<RichSelectLabelProps & react.RefAttributes<HTMLDivElement>>;
|
|
759
|
+
type RichSelectSeparatorProps = HTMLAttributes<HTMLDivElement>;
|
|
760
|
+
declare const RichSelectSeparator: react.ForwardRefExoticComponent<RichSelectSeparatorProps & react.RefAttributes<HTMLDivElement>>;
|
|
761
|
+
type RichSelectEmptyProps = HTMLAttributes<HTMLParagraphElement>;
|
|
762
|
+
declare const RichSelectEmpty: react.ForwardRefExoticComponent<RichSelectEmptyProps & react.RefAttributes<HTMLParagraphElement>>;
|
|
763
|
+
|
|
764
|
+
/**
|
|
765
|
+
* A calendar-only ISO date (`YYYY-MM-DD`). It deliberately has no time or zone.
|
|
766
|
+
* Runtime parsing validates the shape and the actual Gregorian date.
|
|
767
|
+
*/
|
|
768
|
+
type CalendarDate = string;
|
|
769
|
+
interface CalendarRange {
|
|
770
|
+
start: CalendarDate | null;
|
|
771
|
+
end: CalendarDate | null;
|
|
772
|
+
}
|
|
773
|
+
type CalendarDisabledDates = readonly CalendarDate[] | ((date: CalendarDate) => boolean);
|
|
774
|
+
interface CalendarSharedProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'> {
|
|
775
|
+
locale?: string;
|
|
776
|
+
min?: CalendarDate;
|
|
777
|
+
max?: CalendarDate;
|
|
778
|
+
disabledDates?: CalendarDisabledDates;
|
|
779
|
+
month?: CalendarDate;
|
|
780
|
+
defaultMonth?: CalendarDate;
|
|
781
|
+
onMonthChange?: (month: CalendarDate) => void;
|
|
782
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
783
|
+
showOutsideDays?: boolean;
|
|
784
|
+
showActions?: boolean;
|
|
785
|
+
clearLabel?: ReactNode;
|
|
786
|
+
resetLabel?: ReactNode;
|
|
787
|
+
previousMonthLabel?: string;
|
|
788
|
+
nextMonthLabel?: string;
|
|
789
|
+
previousYearLabel?: string;
|
|
790
|
+
nextYearLabel?: string;
|
|
791
|
+
disabled?: boolean;
|
|
792
|
+
required?: boolean;
|
|
793
|
+
autoFocus?: boolean;
|
|
794
|
+
}
|
|
795
|
+
interface CalendarSingleProps extends CalendarSharedProps {
|
|
796
|
+
mode?: 'single';
|
|
797
|
+
value?: CalendarDate | null;
|
|
798
|
+
defaultValue?: CalendarDate | null;
|
|
799
|
+
onValueChange?: (value: CalendarDate | null) => void;
|
|
800
|
+
}
|
|
801
|
+
interface CalendarRangeProps extends CalendarSharedProps {
|
|
802
|
+
mode: 'range';
|
|
803
|
+
value?: CalendarRange;
|
|
804
|
+
defaultValue?: CalendarRange;
|
|
805
|
+
onValueChange?: (value: CalendarRange) => void;
|
|
806
|
+
}
|
|
807
|
+
type CalendarProps = CalendarSingleProps | CalendarRangeProps;
|
|
808
|
+
/** Parse a calendar date at UTC midnight so host timezone changes cannot shift the day. */
|
|
809
|
+
declare function parseCalendarDate(value: CalendarDate | null | undefined): Date | null;
|
|
810
|
+
/** Serialize UTC calendar fields only; never convert through a local timezone. */
|
|
811
|
+
declare function serializeCalendarDate(date: Date): CalendarDate;
|
|
812
|
+
declare function isCalendarDate(value: string): boolean;
|
|
813
|
+
declare function formatCalendarDate(value: CalendarDate, locale?: string, options?: Intl.DateTimeFormatOptions): string;
|
|
814
|
+
/**
|
|
815
|
+
* Accessible date-only calendar. Values are serialized as `YYYY-MM-DD`; selection,
|
|
816
|
+
* comparisons, navigation, and formatting use UTC calendar fields so deploying an
|
|
817
|
+
* app in another timezone never changes the selected day.
|
|
818
|
+
*/
|
|
819
|
+
declare const Calendar: react.ForwardRefExoticComponent<CalendarProps & react.RefAttributes<HTMLDivElement>>;
|
|
820
|
+
|
|
821
|
+
type DatePickerSize = 'sm' | 'md' | 'lg';
|
|
822
|
+
interface DatePickerSharedProps {
|
|
823
|
+
id?: string;
|
|
824
|
+
locale?: string;
|
|
825
|
+
min?: CalendarDate;
|
|
826
|
+
max?: CalendarDate;
|
|
827
|
+
disabledDates?: CalendarDisabledDates;
|
|
828
|
+
month?: CalendarDate;
|
|
829
|
+
defaultMonth?: CalendarDate;
|
|
830
|
+
onMonthChange?: (month: CalendarDate) => void;
|
|
831
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
832
|
+
showOutsideDays?: boolean;
|
|
833
|
+
disabled?: boolean;
|
|
834
|
+
required?: boolean;
|
|
835
|
+
placeholder?: ReactNode;
|
|
836
|
+
clearLabel?: ReactNode;
|
|
837
|
+
resetLabel?: ReactNode;
|
|
838
|
+
formatOptions?: Intl.DateTimeFormatOptions;
|
|
839
|
+
rangeSeparator?: ReactNode;
|
|
840
|
+
align?: 'left' | 'right';
|
|
841
|
+
datePickerSize?: DatePickerSize;
|
|
842
|
+
fullWidth?: boolean;
|
|
843
|
+
className?: string;
|
|
844
|
+
contentClassName?: string;
|
|
845
|
+
contentStyle?: CSSProperties;
|
|
846
|
+
calendarClassName?: string;
|
|
847
|
+
'aria-label'?: string;
|
|
848
|
+
'aria-labelledby'?: string;
|
|
849
|
+
'aria-describedby'?: string;
|
|
850
|
+
'aria-invalid'?: boolean | 'true' | 'false';
|
|
851
|
+
'aria-required'?: boolean | 'true' | 'false';
|
|
852
|
+
}
|
|
853
|
+
interface DatePickerSingleProps extends DatePickerSharedProps {
|
|
854
|
+
mode?: 'single';
|
|
855
|
+
value?: CalendarDate | null;
|
|
856
|
+
defaultValue?: CalendarDate | null;
|
|
857
|
+
onValueChange?: (value: CalendarDate | null) => void;
|
|
858
|
+
name?: string;
|
|
859
|
+
startName?: never;
|
|
860
|
+
endName?: never;
|
|
861
|
+
}
|
|
862
|
+
interface DatePickerRangeProps extends DatePickerSharedProps {
|
|
863
|
+
mode: 'range';
|
|
864
|
+
value?: CalendarRange;
|
|
865
|
+
defaultValue?: CalendarRange;
|
|
866
|
+
onValueChange?: (value: CalendarRange) => void;
|
|
867
|
+
name?: never;
|
|
868
|
+
startName?: string;
|
|
869
|
+
endName?: string;
|
|
870
|
+
}
|
|
871
|
+
type DatePickerProps = DatePickerSingleProps | DatePickerRangeProps;
|
|
872
|
+
/**
|
|
873
|
+
* Anchored date-only picker backed by `Calendar`. Hidden form fields always submit
|
|
874
|
+
* the same `YYYY-MM-DD` values exposed by `onValueChange`; no timezone conversion
|
|
875
|
+
* happens between display, state, and form serialization.
|
|
876
|
+
*/
|
|
877
|
+
declare function DatePicker(props: DatePickerProps): react.JSX.Element;
|
|
878
|
+
|
|
879
|
+
interface SlotProps {
|
|
880
|
+
children?: React.ReactNode;
|
|
881
|
+
/**
|
|
882
|
+
* Wrap the child's own children — the escape hatch for decorations that must
|
|
883
|
+
* live INSIDE the slotted element. A button with an icon rendered `asChild`
|
|
884
|
+
* needs `<a class="pr-btn"><Icon/>Text</a>`, not an icon next to the anchor.
|
|
885
|
+
*/
|
|
886
|
+
decorate?: (childChildren: React.ReactNode) => React.ReactNode;
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Extra props are forwarded verbatim to the child. Expressed as an intersection
|
|
890
|
+
* rather than an index signature on the interface, which would widen `decorate`
|
|
891
|
+
* to `unknown` and make it uncallable.
|
|
892
|
+
*/
|
|
893
|
+
type SlotAllProps = SlotProps & Record<string, unknown>;
|
|
894
|
+
/**
|
|
895
|
+
* `forwardRef`, not a plain function component: the peer range still includes
|
|
896
|
+
* React 18, where `ref` is not a regular prop and would be dropped silently.
|
|
897
|
+
*/
|
|
898
|
+
declare const Slot: react.ForwardRefExoticComponent<Omit<SlotAllProps, "ref"> & react.RefAttributes<unknown>>;
|
|
899
|
+
|
|
900
|
+
type TabsOrientation = 'horizontal' | 'vertical';
|
|
901
|
+
type TabsActivationMode = 'automatic' | 'manual';
|
|
902
|
+
type TabsListVariant = 'default' | 'line';
|
|
903
|
+
interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue'> {
|
|
904
|
+
value?: string;
|
|
905
|
+
defaultValue?: string;
|
|
906
|
+
onValueChange?: (value: string) => void;
|
|
907
|
+
orientation?: TabsOrientation;
|
|
908
|
+
activationMode?: TabsActivationMode;
|
|
909
|
+
dir?: 'ltr' | 'rtl';
|
|
910
|
+
}
|
|
911
|
+
/**
|
|
912
|
+
* Compound tabs with one selection and keyboard-navigation owner.
|
|
913
|
+
*
|
|
914
|
+
* Apps compose labels and panels; the root owns controlled/uncontrolled state,
|
|
915
|
+
* ARIA relationships, roving focus, activation mode, and orientation.
|
|
916
|
+
*/
|
|
917
|
+
declare const Tabs: react.ForwardRefExoticComponent<TabsProps & react.RefAttributes<HTMLDivElement>>;
|
|
918
|
+
interface TabsListProps extends HTMLAttributes<HTMLDivElement> {
|
|
919
|
+
variant?: TabsListVariant;
|
|
920
|
+
}
|
|
921
|
+
declare const TabsList: react.ForwardRefExoticComponent<TabsListProps & react.RefAttributes<HTMLDivElement>>;
|
|
922
|
+
interface TabsTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
923
|
+
value: string;
|
|
924
|
+
}
|
|
925
|
+
declare const TabsTrigger: react.ForwardRefExoticComponent<TabsTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
926
|
+
interface TabsContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
927
|
+
value: string;
|
|
928
|
+
/** Keep an inactive panel mounted while retaining native hidden semantics. */
|
|
929
|
+
forceMount?: boolean;
|
|
930
|
+
}
|
|
931
|
+
declare const TabsContent: react.ForwardRefExoticComponent<TabsContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
932
|
+
|
|
933
|
+
interface NavigationTabItemBase {
|
|
934
|
+
href: string;
|
|
935
|
+
label: ReactNode;
|
|
936
|
+
/** Optional compact count or status shown after the label. */
|
|
937
|
+
badge?: ReactNode;
|
|
938
|
+
/** Show the package-owned badge placeholder while its value loads. */
|
|
939
|
+
badgeLoading?: boolean;
|
|
940
|
+
/** Optional accessible replacement for the visible badge value. */
|
|
941
|
+
badgeAriaLabel?: string;
|
|
942
|
+
/** Explicit native browsing context, including internal links opened in a new tab. */
|
|
943
|
+
target?: HTMLAttributeAnchorTarget;
|
|
944
|
+
rel?: string;
|
|
945
|
+
}
|
|
946
|
+
type NavigationTabItem = NavigationTabItemBase & ({
|
|
947
|
+
external: true;
|
|
948
|
+
/** External destinations are native anchors and never own the current route. */
|
|
949
|
+
exact?: never;
|
|
950
|
+
} | {
|
|
951
|
+
external?: false;
|
|
952
|
+
/** Match only this route instead of its descendant routes. */
|
|
953
|
+
exact?: boolean;
|
|
954
|
+
});
|
|
955
|
+
interface NavigationTabsLinkProps {
|
|
956
|
+
href: string;
|
|
957
|
+
className?: string;
|
|
958
|
+
children: ReactNode;
|
|
959
|
+
target?: HTMLAttributeAnchorTarget;
|
|
960
|
+
rel?: string;
|
|
961
|
+
'aria-current'?: 'page';
|
|
962
|
+
'data-active'?: string;
|
|
963
|
+
'data-slot'?: string;
|
|
964
|
+
'data-state'?: 'active' | 'inactive';
|
|
965
|
+
}
|
|
966
|
+
type NavigationTabsLinkComponent = ComponentType<NavigationTabsLinkProps>;
|
|
967
|
+
interface NavigationTabsProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {
|
|
968
|
+
/** Current route path from the host router. Query and hash values are ignored. */
|
|
969
|
+
currentPath: string;
|
|
970
|
+
items: readonly NavigationTabItem[];
|
|
971
|
+
/** Router-aware link. Defaults to a native anchor. */
|
|
972
|
+
LinkComponent?: NavigationTabsLinkComponent;
|
|
973
|
+
}
|
|
974
|
+
/** Resolve one current route owner. The most specific matching href wins. */
|
|
975
|
+
declare function resolveActiveNavigationHref(currentPath: string, items: readonly NavigationTabItem[]): string | null;
|
|
976
|
+
/**
|
|
977
|
+
* Horizontal route navigation with native link semantics.
|
|
978
|
+
*
|
|
979
|
+
* Use this for routes, not in-panel tabs. The app owns routing and supplies its
|
|
980
|
+
* current path; the component owns active-route resolution, overflow, badges,
|
|
981
|
+
* focus styling, and keeping the current item visible on narrow screens.
|
|
982
|
+
*/
|
|
983
|
+
declare const NavigationTabs: react.ForwardRefExoticComponent<NavigationTabsProps & react.RefAttributes<HTMLElement>>;
|
|
984
|
+
|
|
985
|
+
interface TableRootProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
986
|
+
/** Wraps the table in a named, keyboard-reachable horizontal scroll region. */
|
|
987
|
+
overflow?: boolean;
|
|
988
|
+
/** Accessible name for the overflow region. Falls back to the table name. */
|
|
989
|
+
scrollLabel?: string;
|
|
990
|
+
/** Consumer layout classes for the overflow region, without targeting internals. */
|
|
991
|
+
containerClassName?: string;
|
|
992
|
+
density?: TableDensity;
|
|
993
|
+
stickyFirstColumn?: boolean;
|
|
994
|
+
/**
|
|
995
|
+
* Caps the height and pins the header row while the body scrolls under it.
|
|
996
|
+
* A number is pixels; a string is used as-is.
|
|
997
|
+
*
|
|
998
|
+
* The alternative — a header `<table>` beside a body `<table>` in a scroll box —
|
|
999
|
+
* misaligns by the scrollbar width as soon as the rows overflow, because only the
|
|
1000
|
+
* body loses that width. One table cannot drift from itself.
|
|
1001
|
+
*/
|
|
1002
|
+
maxHeight?: number | string;
|
|
1003
|
+
}
|
|
1004
|
+
type TableHeaderProps = HTMLAttributes<HTMLTableSectionElement>;
|
|
1005
|
+
declare const TableHeader: react.ForwardRefExoticComponent<TableHeaderProps & react.RefAttributes<HTMLTableSectionElement>>;
|
|
1006
|
+
type TableBodyProps = HTMLAttributes<HTMLTableSectionElement>;
|
|
1007
|
+
declare const TableBody: react.ForwardRefExoticComponent<TableBodyProps & react.RefAttributes<HTMLTableSectionElement>>;
|
|
1008
|
+
type TableFooterProps = HTMLAttributes<HTMLTableSectionElement>;
|
|
1009
|
+
declare const TableFooter: react.ForwardRefExoticComponent<TableFooterProps & react.RefAttributes<HTMLTableSectionElement>>;
|
|
1010
|
+
interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {
|
|
1011
|
+
/** Adds package-owned focus and hover treatment even when activation is delegated. */
|
|
1012
|
+
interactive?: boolean;
|
|
1013
|
+
}
|
|
1014
|
+
declare const TableRow: react.ForwardRefExoticComponent<TableRowProps & react.RefAttributes<HTMLTableRowElement>>;
|
|
1015
|
+
type TableHeadProps = ThHTMLAttributes<HTMLTableCellElement>;
|
|
1016
|
+
declare const TableHead: react.ForwardRefExoticComponent<TableHeadProps & react.RefAttributes<HTMLTableCellElement>>;
|
|
1017
|
+
type TableCellProps = TdHTMLAttributes<HTMLTableCellElement>;
|
|
1018
|
+
declare const TableCell: react.ForwardRefExoticComponent<TableCellProps & react.RefAttributes<HTMLTableCellElement>>;
|
|
1019
|
+
type TableCaptionProps = HTMLAttributes<HTMLTableCaptionElement>;
|
|
1020
|
+
declare const TableCaption: react.ForwardRefExoticComponent<TableCaptionProps & react.RefAttributes<HTMLTableCaptionElement>>;
|
|
1021
|
+
|
|
1022
|
+
/** `left` and `right` are aliases for the logical `start` and `end` values. */
|
|
1023
|
+
type TableAlign = 'start' | 'left' | 'center' | 'end' | 'right';
|
|
1024
|
+
/**
|
|
1025
|
+
* `compact` is for a table nested inside a card that is itself a row of something
|
|
1026
|
+
* else — a breakdown under a summary. The apps have both kinds and they are not the
|
|
1027
|
+
* same component with different data: a nested table at page-level padding pushes
|
|
1028
|
+
* the card it sits in off the screen. It is also the migration-friendly choice for
|
|
1029
|
+
* existing dense tables that use compact type and short rows.
|
|
1030
|
+
*/
|
|
1031
|
+
type TableDensity = 'default' | 'compact';
|
|
1032
|
+
interface TableColumn<T> {
|
|
1033
|
+
/** Identity of the column, and the fallback for reading the cell out of the row. */
|
|
1034
|
+
key: string;
|
|
1035
|
+
header: ReactNode;
|
|
1036
|
+
/** Without this the cell renders `row[key]` as text. */
|
|
1037
|
+
render?: (row: T, index: number) => ReactNode;
|
|
1038
|
+
align?: TableAlign;
|
|
1039
|
+
className?: string;
|
|
1040
|
+
headerClassName?: string;
|
|
1041
|
+
/**
|
|
1042
|
+
* Hidden below `sm`. A table with twelve columns is unreadable on a phone long
|
|
1043
|
+
* before it is incomplete, so the way out is dropping columns, not shrinking type.
|
|
1044
|
+
*/
|
|
1045
|
+
hideOnMobile?: boolean;
|
|
1046
|
+
}
|
|
1047
|
+
interface TableProps<T> {
|
|
1048
|
+
columns: TableColumn<T>[];
|
|
1049
|
+
rows: T[];
|
|
1050
|
+
/**
|
|
1051
|
+
* Stable identity per row. Defaults to the index, which is fine for a static
|
|
1052
|
+
* list and wrong the moment rows are sorted or filtered — React reuses the DOM
|
|
1053
|
+
* for the wrong row and any focus or open menu inside it follows.
|
|
1054
|
+
*/
|
|
1055
|
+
getRowKey?: (row: T, index: number) => string | number;
|
|
1056
|
+
onRowClick?: (row: T) => void;
|
|
1057
|
+
/** Reports the row receiving focus so a companion preview can follow it. */
|
|
1058
|
+
onRowFocus?: (row: T, index: number) => void;
|
|
1059
|
+
/** Reports pointer preview separately from row activation. */
|
|
1060
|
+
onRowMouseEnter?: (row: T, index: number) => void;
|
|
1061
|
+
/**
|
|
1062
|
+
* Extra classes on the row, derived from the row.
|
|
1063
|
+
*
|
|
1064
|
+
* This is for rows that are still there but no longer live — a revoked link, an
|
|
1065
|
+
* expired invoice — which every table greys out in its own way. Not a styling
|
|
1066
|
+
* escape hatch: if a whole table needs different rows, that is `className`.
|
|
1067
|
+
*/
|
|
1068
|
+
getRowClassName?: (row: T, index: number) => string | undefined;
|
|
1069
|
+
/**
|
|
1070
|
+
* What a row announces to a screen reader. Only used with `onRowClick`, because
|
|
1071
|
+
* a row that does nothing has nothing to announce.
|
|
1072
|
+
*/
|
|
1073
|
+
getRowAriaLabel?: (row: T) => string;
|
|
1074
|
+
/** Replaces the whole table with a skeleton of the same shape. */
|
|
1075
|
+
loading?: boolean;
|
|
1076
|
+
/** Shown instead of the table when `rows` is empty. A string becomes the title. */
|
|
1077
|
+
empty?: ReactNode;
|
|
1078
|
+
/** Shown instead of the table, and takes precedence over `empty`. */
|
|
1079
|
+
error?: ReactNode;
|
|
1080
|
+
/**
|
|
1081
|
+
* Pins the first column while the rest scrolls, below `sm` only. For a table
|
|
1082
|
+
* whose first column is the thing you are reading across from.
|
|
1083
|
+
*/
|
|
1084
|
+
stickyFirstColumn?: boolean;
|
|
1085
|
+
/**
|
|
1086
|
+
* Caps the table's height and pins the header row while the body scrolls under it.
|
|
1087
|
+
* Accepts a CSS length; a number is treated as pixels.
|
|
1088
|
+
*
|
|
1089
|
+
* Use this instead of splitting the header and body into two `<table>` elements,
|
|
1090
|
+
* which is the usual way to get a sticky header and is subtly broken: the body
|
|
1091
|
+
* table sits in the scroll container and the header table does not, so once the
|
|
1092
|
+
* rows overflow, the scrollbar takes width from the body alone and the columns
|
|
1093
|
+
* drift apart by exactly that much. It looks fine until there is enough data to
|
|
1094
|
+
* scroll, and looks fine anywhere overlay scrollbars hide the gap — so it tends to
|
|
1095
|
+
* ship. One table cannot drift from itself.
|
|
1096
|
+
*/
|
|
1097
|
+
maxHeight?: number | string;
|
|
1098
|
+
/** Announced on the scroll region, and the hint shown above a sticky table. */
|
|
1099
|
+
label?: string;
|
|
1100
|
+
className?: string;
|
|
1101
|
+
/** Drops the surrounding surface, for a table already inside a Card. */
|
|
1102
|
+
bare?: boolean;
|
|
1103
|
+
density?: TableDensity;
|
|
1104
|
+
}
|
|
1105
|
+
/** Explicit name for the existing data-driven interface. `TableProps` remains supported. */
|
|
1106
|
+
type DataTableProps<T> = TableProps<T>;
|
|
1107
|
+
/**
|
|
1108
|
+
* `T` is deliberately unconstrained.
|
|
1109
|
+
*
|
|
1110
|
+
* The obvious constraint is `T extends Record<string, unknown>`, but that makes
|
|
1111
|
+
* the component unusable for most interface-shaped rows because TypeScript
|
|
1112
|
+
* does not give an `interface` the implicit index
|
|
1113
|
+
* signature it gives an object type alias. An interface-shaped row array is not
|
|
1114
|
+
* assignable to `Record<string, unknown>[]`.
|
|
1115
|
+
*
|
|
1116
|
+
* The untyped key lookup therefore stays inside this implementation.
|
|
1117
|
+
*/
|
|
1118
|
+
declare function DataTable<T>({ columns, rows, getRowKey, onRowClick, onRowFocus, onRowMouseEnter, getRowClassName, getRowAriaLabel, loading, empty, error, stickyFirstColumn, maxHeight, label, className, bare, density, }: TableProps<T>): react.JSX.Element;
|
|
1119
|
+
interface TableComponent {
|
|
1120
|
+
<T>(props: TableProps<T>): ReactElement | null;
|
|
1121
|
+
(props: TableRootProps & RefAttributes<HTMLTableElement>): ReactElement | null;
|
|
1122
|
+
displayName?: string;
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* One compatible table seam with two depths:
|
|
1126
|
+
*
|
|
1127
|
+
* - `columns` + `rows` keeps the data-driven interface for straightforward data.
|
|
1128
|
+
* - native children unlock the compound semantic primitives for TanStack, spans,
|
|
1129
|
+
* skeleton rows, drag-and-drop, and app-owned cells.
|
|
1130
|
+
*/
|
|
1131
|
+
declare const Table: TableComponent;
|
|
1132
|
+
|
|
1133
|
+
/** Alignment options shared with the anchored positioning engine. */
|
|
1134
|
+
type DropdownMenuAlign = 'start' | 'center' | 'end';
|
|
1135
|
+
interface DropdownMenuProps {
|
|
1136
|
+
children: ReactNode;
|
|
1137
|
+
/** Controlled visibility. Pair with onOpenChange. */
|
|
1138
|
+
open?: boolean;
|
|
1139
|
+
/** Initial visibility when the menu is uncontrolled. */
|
|
1140
|
+
defaultOpen?: boolean;
|
|
1141
|
+
onOpenChange?: (open: boolean) => void;
|
|
1142
|
+
/** Viewport height the menu may occupy before it scrolls. Defaults to 280px. */
|
|
1143
|
+
maxHeight?: number;
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* An actions menu hung off a trigger.
|
|
1147
|
+
*
|
|
1148
|
+
* The package keeps its menu implementation independent of a consumer's
|
|
1149
|
+
* component vendor and Tailwind version. It shares the positioning engine
|
|
1150
|
+
* behind `Select` and `Combobox`, so a
|
|
1151
|
+
* menu opened inside a dialog escapes the dialog's scroll container and is still
|
|
1152
|
+
* recognised by the dialog's focus trap instead of being fought by it.
|
|
1153
|
+
*
|
|
1154
|
+
* Unlike a select, this is a menu: rows take real DOM focus rather than
|
|
1155
|
+
* `aria-activedescendant`, which is what the menu pattern specifies and what screen
|
|
1156
|
+
* readers announce correctly.
|
|
1157
|
+
*/
|
|
1158
|
+
declare function DropdownMenu({ children, open: controlledOpen, defaultOpen, onOpenChange, maxHeight, }: DropdownMenuProps): react.JSX.Element;
|
|
1159
|
+
interface DropdownMenuTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
1160
|
+
asChild?: boolean;
|
|
1161
|
+
}
|
|
1162
|
+
declare const DropdownMenuTrigger: react.ForwardRefExoticComponent<DropdownMenuTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
1163
|
+
interface DropdownMenuContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
1164
|
+
align?: DropdownMenuAlign;
|
|
1165
|
+
}
|
|
1166
|
+
declare const DropdownMenuContent: react.ForwardRefExoticComponent<DropdownMenuContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
1167
|
+
interface DropdownMenuItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
1168
|
+
disabled?: boolean;
|
|
1169
|
+
/**
|
|
1170
|
+
* Fires for both click and keyboard activation, then the menu closes.
|
|
1171
|
+
*
|
|
1172
|
+
* `preventDefault()` on the passed event keeps the menu open, which is how a row
|
|
1173
|
+
* that toggles something stays put.
|
|
1174
|
+
*/
|
|
1175
|
+
onSelect?: (event: {
|
|
1176
|
+
preventDefault: () => void;
|
|
1177
|
+
defaultPrevented: boolean;
|
|
1178
|
+
}) => void;
|
|
1179
|
+
/** Render the child instead of a `<div>` — for a row that is a real link. */
|
|
1180
|
+
asChild?: boolean;
|
|
1181
|
+
/** A destructive row, over the semantic danger tone rather than a local red. */
|
|
1182
|
+
destructive?: boolean;
|
|
1183
|
+
/** Leading slot, usually a 16px lucide icon. */
|
|
1184
|
+
icon?: ReactNode;
|
|
1185
|
+
}
|
|
1186
|
+
declare const DropdownMenuItem: react.ForwardRefExoticComponent<DropdownMenuItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
1187
|
+
interface DropdownMenuCheckboxItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
1188
|
+
checked?: boolean;
|
|
1189
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
1190
|
+
disabled?: boolean;
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* A row that toggles instead of navigating, so it deliberately does not close the
|
|
1194
|
+
* menu — the point of a checkbox row is ticking several without reopening.
|
|
1195
|
+
*/
|
|
1196
|
+
declare const DropdownMenuCheckboxItem: react.ForwardRefExoticComponent<DropdownMenuCheckboxItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
1197
|
+
interface DropdownMenuRadioGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
1198
|
+
value?: string;
|
|
1199
|
+
onValueChange?: (value: string) => void;
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* A single-choice set of rows.
|
|
1203
|
+
*
|
|
1204
|
+
* The group owns the value so the rows do not each have to be told which one is
|
|
1205
|
+
* current — the same reason `RichSelect` collects its items rather than having each
|
|
1206
|
+
* one wire itself up.
|
|
1207
|
+
*/
|
|
1208
|
+
declare const DropdownMenuRadioGroup: react.ForwardRefExoticComponent<DropdownMenuRadioGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
1209
|
+
interface DropdownMenuRadioItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
1210
|
+
value: string;
|
|
1211
|
+
disabled?: boolean;
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* One choice in a `DropdownMenuRadioGroup`.
|
|
1215
|
+
*
|
|
1216
|
+
* Unlike `DropdownMenuCheckboxItem`, this **closes** the menu. The asymmetry is
|
|
1217
|
+
* deliberate rather than an oversight: ticking checkboxes is a series of edits and
|
|
1218
|
+
* reopening between each one is the annoyance that row exists to avoid, whereas
|
|
1219
|
+
* picking one of several options is a completed choice and leaving the menu open
|
|
1220
|
+
* afterwards just makes the user dismiss it.
|
|
1221
|
+
*/
|
|
1222
|
+
declare const DropdownMenuRadioItem: react.ForwardRefExoticComponent<DropdownMenuRadioItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
1223
|
+
type DropdownMenuLabelProps = HTMLAttributes<HTMLDivElement>;
|
|
1224
|
+
declare const DropdownMenuLabel: react.ForwardRefExoticComponent<DropdownMenuLabelProps & react.RefAttributes<HTMLDivElement>>;
|
|
1225
|
+
type DropdownMenuSeparatorProps = HTMLAttributes<HTMLDivElement>;
|
|
1226
|
+
declare const DropdownMenuSeparator: react.ForwardRefExoticComponent<DropdownMenuSeparatorProps & react.RefAttributes<HTMLDivElement>>;
|
|
1227
|
+
type DropdownMenuGroupProps = HTMLAttributes<HTMLDivElement>;
|
|
1228
|
+
declare const DropdownMenuGroup: react.ForwardRefExoticComponent<DropdownMenuGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
1229
|
+
|
|
1230
|
+
type PopoverAlign = 'start' | 'center' | 'end';
|
|
1231
|
+
/**
|
|
1232
|
+
* `none` emits no padding class at all rather than `padding: 0` — see the note above
|
|
1233
|
+
* `.pr-popover__content--pad-md`. A panel holding its own list or calendar owns its
|
|
1234
|
+
* insets, and a base padding it cannot switch off is a 12px surprise at every one of
|
|
1235
|
+
* those call sites.
|
|
1236
|
+
*/
|
|
1237
|
+
type PopoverPadding = 'md' | 'none';
|
|
1238
|
+
interface PopoverProps {
|
|
1239
|
+
children: ReactNode;
|
|
1240
|
+
open?: boolean;
|
|
1241
|
+
defaultOpen?: boolean;
|
|
1242
|
+
onOpenChange?: (open: boolean) => void;
|
|
1243
|
+
/** Viewport height the panel may occupy before it scrolls. Defaults to 280px. */
|
|
1244
|
+
maxHeight?: number;
|
|
1245
|
+
/**
|
|
1246
|
+
* Size the panel to its trigger instead of to its content. Default false.
|
|
1247
|
+
*
|
|
1248
|
+
* A filter or picker panel can line up with a full-width field rather than
|
|
1249
|
+
* shrinking to its longest row.
|
|
1250
|
+
*/
|
|
1251
|
+
matchTriggerWidth?: boolean;
|
|
1252
|
+
}
|
|
1253
|
+
/**
|
|
1254
|
+
* Free-form content anchored to a trigger.
|
|
1255
|
+
*
|
|
1256
|
+
* The difference from `DropdownMenu` is only what is inside it: a popover holds
|
|
1257
|
+
* arbitrary interactive content — a calendar, a filter form, a checkbox list — so it
|
|
1258
|
+
* has no row roles, no arrow-key ring, and its focus is left to whatever the app puts
|
|
1259
|
+
* in it. Positioning, portalling and dialog-layer ownership are the same engine, which
|
|
1260
|
+
* is the part that has to be shared: a popover rendered inline gets clipped by the
|
|
1261
|
+
* scrolling body of any dialog it opens in, and that is exactly where filters live.
|
|
1262
|
+
*/
|
|
1263
|
+
declare function Popover({ children, open: controlledOpen, defaultOpen, onOpenChange, maxHeight, matchTriggerWidth, }: PopoverProps): react.JSX.Element;
|
|
1264
|
+
interface PopoverTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
1265
|
+
asChild?: boolean;
|
|
1266
|
+
}
|
|
1267
|
+
declare const PopoverTrigger: react.ForwardRefExoticComponent<PopoverTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
1268
|
+
interface PopoverContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
1269
|
+
align?: PopoverAlign;
|
|
1270
|
+
/**
|
|
1271
|
+
* Inset around the content. Pass `none` for a panel that owns its own spacing —
|
|
1272
|
+
* a command list, a calendar, a table of rows that need to reach the edges.
|
|
1273
|
+
*/
|
|
1274
|
+
padding?: PopoverPadding;
|
|
1275
|
+
/**
|
|
1276
|
+
* Move focus into the panel when it opens. Default true.
|
|
1277
|
+
*
|
|
1278
|
+
* A popover holding a form or a calendar has to take focus or a keyboard user
|
|
1279
|
+
* cannot reach it — it is in a portal at the end of `body`, so Tab does not walk
|
|
1280
|
+
* into it from the trigger. Pass `false` for a purely informational panel, where
|
|
1281
|
+
* stealing focus is the wrong thing.
|
|
1282
|
+
*/
|
|
1283
|
+
autoFocus?: boolean;
|
|
1284
|
+
}
|
|
1285
|
+
declare const PopoverContent: react.ForwardRefExoticComponent<PopoverContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
1286
|
+
type PopoverHeaderProps = HTMLAttributes<HTMLDivElement>;
|
|
1287
|
+
declare const PopoverHeader: react.ForwardRefExoticComponent<PopoverHeaderProps & react.RefAttributes<HTMLDivElement>>;
|
|
1288
|
+
type PopoverTitleProps = HTMLAttributes<HTMLHeadingElement>;
|
|
1289
|
+
declare const PopoverTitle: react.ForwardRefExoticComponent<PopoverTitleProps & react.RefAttributes<HTMLHeadingElement>>;
|
|
1290
|
+
type PopoverDescriptionProps = HTMLAttributes<HTMLParagraphElement>;
|
|
1291
|
+
declare const PopoverDescription: react.ForwardRefExoticComponent<PopoverDescriptionProps & react.RefAttributes<HTMLParagraphElement>>;
|
|
1292
|
+
|
|
1293
|
+
type SeparatorOrientation = 'horizontal' | 'vertical';
|
|
1294
|
+
interface SeparatorProps extends HTMLAttributes<HTMLDivElement> {
|
|
1295
|
+
orientation?: SeparatorOrientation;
|
|
1296
|
+
/**
|
|
1297
|
+
* Purely visual, and hidden from assistive technology. Default true.
|
|
1298
|
+
*
|
|
1299
|
+
* Most separators are decoration between regions that are already
|
|
1300
|
+
* distinguishable — a heading and a body, a toolbar and a table. Announcing each of
|
|
1301
|
+
* those as a structural separator is noise, so the accessible role is opt-in.
|
|
1302
|
+
*/
|
|
1303
|
+
decorative?: boolean;
|
|
1304
|
+
}
|
|
1305
|
+
/**
|
|
1306
|
+
* A one-pixel rule on the semantic border token.
|
|
1307
|
+
*
|
|
1308
|
+
* `vertical` stretches to its flex parent rather than taking a fixed height, so
|
|
1309
|
+
* toolbar controls determine the divider's height.
|
|
1310
|
+
*/
|
|
1311
|
+
declare const Separator: react.ForwardRefExoticComponent<SeparatorProps & react.RefAttributes<HTMLDivElement>>;
|
|
1312
|
+
|
|
1313
|
+
interface PaginationSummary {
|
|
1314
|
+
/** Current one-based page. */
|
|
1315
|
+
page: number;
|
|
1316
|
+
pageSize: number;
|
|
1317
|
+
totalItems: number;
|
|
1318
|
+
pageCount: number;
|
|
1319
|
+
/** One-based index of the first visible item, or zero when the result is empty. */
|
|
1320
|
+
start: number;
|
|
1321
|
+
/** One-based index of the last visible item, or zero when the result is empty. */
|
|
1322
|
+
end: number;
|
|
1323
|
+
}
|
|
1324
|
+
interface PaginationLabels {
|
|
1325
|
+
previous: string;
|
|
1326
|
+
next: string;
|
|
1327
|
+
summary: (value: PaginationSummary) => ReactNode;
|
|
1328
|
+
}
|
|
1329
|
+
interface PaginationProps {
|
|
1330
|
+
/** Current page. Pagination is controlled and pages are one-based. */
|
|
1331
|
+
page: number;
|
|
1332
|
+
pageSize: number;
|
|
1333
|
+
totalItems: number;
|
|
1334
|
+
onPageChange: (page: number) => void;
|
|
1335
|
+
/** Blocks both controls. Apps can use this while loading a requested page. */
|
|
1336
|
+
disabled?: boolean;
|
|
1337
|
+
labels?: Partial<PaginationLabels>;
|
|
1338
|
+
className?: string;
|
|
1339
|
+
'aria-label'?: string;
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Controlled previous/next pagination for result sets.
|
|
1343
|
+
*
|
|
1344
|
+
* The caller owns data and page state. This module owns the range math, valid
|
|
1345
|
+
* callback bounds, responsive presentation, and accessible announcements.
|
|
1346
|
+
*/
|
|
1347
|
+
declare function Pagination({ page, pageSize, totalItems, onPageChange, disabled, labels, className, 'aria-label': ariaLabel, }: PaginationProps): react.JSX.Element;
|
|
1348
|
+
|
|
1349
|
+
type SkeletonShape = 'block' | 'text' | 'circle';
|
|
1350
|
+
interface SkeletonProps extends HTMLAttributes<HTMLDivElement> {
|
|
1351
|
+
/**
|
|
1352
|
+
* `text` carries a line height and a slightly tighter radius; `circle` is for an
|
|
1353
|
+
* avatar placeholder. `block` is the default rectangle.
|
|
1354
|
+
*/
|
|
1355
|
+
shape?: SkeletonShape;
|
|
1356
|
+
/** Convenience for the common `style={{ width }}`; accepts any CSS length. */
|
|
1357
|
+
width?: number | string;
|
|
1358
|
+
height?: number | string;
|
|
1359
|
+
/** Repeats the placeholder, with the last line shortened when `shape` is `text`. */
|
|
1360
|
+
lines?: number;
|
|
1361
|
+
}
|
|
1362
|
+
/**
|
|
1363
|
+
* A loading placeholder.
|
|
1364
|
+
*
|
|
1365
|
+
* It pulses opacity rather than sliding a gradient across itself. A moving highlight
|
|
1366
|
+
* has to know which way the surface is lit, so it needs one value in light mode and a
|
|
1367
|
+
* different one in dark; opacity over the semantic surface needs neither and cannot
|
|
1368
|
+
* drift from the theme.
|
|
1369
|
+
*
|
|
1370
|
+
* Every instance is `aria-hidden` and the group is a live region marked busy, so a
|
|
1371
|
+
* screen reader announces "loading" once instead of reading out a dozen empty boxes.
|
|
1372
|
+
*/
|
|
1373
|
+
declare const Skeleton: react.ForwardRefExoticComponent<SkeletonProps & react.RefAttributes<HTMLDivElement>>;
|
|
1374
|
+
|
|
1375
|
+
interface StepperStep {
|
|
1376
|
+
/** Visible step name. Also the accessible name of the step control. */
|
|
1377
|
+
label: ReactNode;
|
|
1378
|
+
}
|
|
1379
|
+
interface StepperProps extends HTMLAttributes<HTMLElement> {
|
|
1380
|
+
steps: ReadonlyArray<StepperStep | string>;
|
|
1381
|
+
/** Zero-based index of the step in progress. */
|
|
1382
|
+
current: number;
|
|
1383
|
+
/**
|
|
1384
|
+
* Makes COMPLETED steps navigable. Only completed ones: going back is
|
|
1385
|
+
* revisiting an answer, going forward is skipping validation, so future
|
|
1386
|
+
* steps never become buttons no matter what the handler would allow.
|
|
1387
|
+
*/
|
|
1388
|
+
onStepSelect?: (index: number) => void;
|
|
1389
|
+
/** Accessible name of the whole sequence. */
|
|
1390
|
+
label?: string;
|
|
1391
|
+
/** Announced after a completed step's name. */
|
|
1392
|
+
doneLabel?: string;
|
|
1393
|
+
}
|
|
1394
|
+
/**
|
|
1395
|
+
* The Crystal wizard sequence: done steps on the brand accent, the current one
|
|
1396
|
+
* inverted in ink, future ones ghosted. Field-proven in the onboarding
|
|
1397
|
+
* prototype, where every app had grown its own copy.
|
|
1398
|
+
*
|
|
1399
|
+
* Labels collapse on narrow viewports (CSS), so the dots alone must carry the
|
|
1400
|
+
* sequence — which is why each dot keeps its number or check glyph.
|
|
1401
|
+
*/
|
|
1402
|
+
declare const Stepper: react.ForwardRefExoticComponent<StepperProps & react.RefAttributes<HTMLElement>>;
|
|
1403
|
+
interface ProgressDotsProps extends HTMLAttributes<HTMLDivElement> {
|
|
1404
|
+
count: number;
|
|
1405
|
+
/** Zero-based index of the step in progress. */
|
|
1406
|
+
current: number;
|
|
1407
|
+
/** Accessible summary; receives 1-based position. */
|
|
1408
|
+
label?: (current: number, count: number) => string;
|
|
1409
|
+
}
|
|
1410
|
+
/**
|
|
1411
|
+
* The mobile counterpart of `Stepper`: no labels, the active step stretched
|
|
1412
|
+
* into a pill. One image to assistive tech — announcing six unlabeled dots
|
|
1413
|
+
* one by one says less than "Paso 2 de 6" does.
|
|
1414
|
+
*/
|
|
1415
|
+
declare const ProgressDots: react.ForwardRefExoticComponent<ProgressDotsProps & react.RefAttributes<HTMLDivElement>>;
|
|
1416
|
+
|
|
1417
|
+
interface OtpInputProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
|
|
1418
|
+
/** Digits collected so far; length ≤ `length`. Controlled. */
|
|
1419
|
+
value: string;
|
|
1420
|
+
onValueChange: (value: string) => void;
|
|
1421
|
+
/** Fires once when the final digit lands. */
|
|
1422
|
+
onComplete?: (value: string) => void;
|
|
1423
|
+
length?: number;
|
|
1424
|
+
disabled?: boolean;
|
|
1425
|
+
invalid?: boolean;
|
|
1426
|
+
/** Accessible name of the group. */
|
|
1427
|
+
label?: string;
|
|
1428
|
+
/** Accessible name per box; receives 1-based position. */
|
|
1429
|
+
digitLabel?: (digit: number, length: number) => string;
|
|
1430
|
+
}
|
|
1431
|
+
/**
|
|
1432
|
+
* One box per digit, because a code arrives as digits: typing auto-advances,
|
|
1433
|
+
* Backspace walks back, and pasting the whole code from SMS/mail distributes it
|
|
1434
|
+
* — the three behaviours every hand-rolled OTP field forgets at least one of.
|
|
1435
|
+
*
|
|
1436
|
+
* `autocomplete="one-time-code"` sits on the first box so the platform can
|
|
1437
|
+
* offer the SMS code; the paste handler takes it from there.
|
|
1438
|
+
*/
|
|
1439
|
+
declare const OtpInput: react.ForwardRefExoticComponent<OtpInputProps & react.RefAttributes<HTMLDivElement>>;
|
|
1440
|
+
|
|
1441
|
+
interface ProgressRingProps extends HTMLAttributes<HTMLDivElement> {
|
|
1442
|
+
/** 0–100. Values outside the range clamp rather than distort the ring. */
|
|
1443
|
+
value: number;
|
|
1444
|
+
/** Outer diameter in px. */
|
|
1445
|
+
size?: number;
|
|
1446
|
+
strokeWidth?: number;
|
|
1447
|
+
/** Announced to assistive tech. */
|
|
1448
|
+
label?: string;
|
|
1449
|
+
/** The percentage in the centre. On by default — a bare ring is decoration. */
|
|
1450
|
+
showValue?: boolean;
|
|
1451
|
+
}
|
|
1452
|
+
/**
|
|
1453
|
+
* Completion as a ring, stroked with the brand sweep (the same three stops as
|
|
1454
|
+
* `--pr-accent-gradient`). SVG gradients cannot consume a CSS background
|
|
1455
|
+
* image, so the stops reference the individual accent variables instead.
|
|
1456
|
+
*/
|
|
1457
|
+
declare const ProgressRing: react.ForwardRefExoticComponent<ProgressRingProps & react.RefAttributes<HTMLDivElement>>;
|
|
1458
|
+
type ProgressBarSize = 'xs' | 'sm' | 'md';
|
|
1459
|
+
interface ProgressBarProps extends HTMLAttributes<HTMLDivElement> {
|
|
1460
|
+
/** 0–100. */
|
|
1461
|
+
value: number;
|
|
1462
|
+
size?: ProgressBarSize;
|
|
1463
|
+
/** Announced to assistive tech. */
|
|
1464
|
+
label?: string;
|
|
1465
|
+
/**
|
|
1466
|
+
* Turns the fill `success` on completion. On by default because the bar's
|
|
1467
|
+
* whole job is answering "am I done" — an app tracking something with no
|
|
1468
|
+
* finish line turns it off.
|
|
1469
|
+
*/
|
|
1470
|
+
completeTone?: boolean;
|
|
1471
|
+
}
|
|
1472
|
+
/** The quiet linear counterpart of `ProgressRing`, for table rows and cards. */
|
|
1473
|
+
declare const ProgressBar: react.ForwardRefExoticComponent<ProgressBarProps & react.RefAttributes<HTMLDivElement>>;
|
|
1474
|
+
|
|
1475
|
+
interface CopyFieldProps extends HTMLAttributes<HTMLDivElement> {
|
|
1476
|
+
/** The text that gets copied — shown verbatim in the field. */
|
|
1477
|
+
value: string;
|
|
1478
|
+
/** Accessible name of the copy control. Stable — the confirmation is announced
|
|
1479
|
+
* through the live region instead of renaming a focused button. */
|
|
1480
|
+
copyLabel?: string;
|
|
1481
|
+
/** Announced once the value lands on the clipboard. */
|
|
1482
|
+
copiedLabel?: string;
|
|
1483
|
+
/** Announced when clipboard access is unavailable and the text was selected instead. */
|
|
1484
|
+
fallbackLabel?: string;
|
|
1485
|
+
/** How long the confirmation shows, in ms. */
|
|
1486
|
+
resetAfter?: number;
|
|
1487
|
+
}
|
|
1488
|
+
/**
|
|
1489
|
+
* A read-only value with its copy affordance attached — invite links, API keys,
|
|
1490
|
+
* tracking IDs. The confirmation is announced through a live region because the
|
|
1491
|
+
* icon swap alone is invisible to assistive tech.
|
|
1492
|
+
*
|
|
1493
|
+
* Clipboard access needs a secure context; when it is unavailable the control
|
|
1494
|
+
* falls back to selecting the text so the user can copy by hand.
|
|
1495
|
+
*/
|
|
1496
|
+
declare const CopyField: react.ForwardRefExoticComponent<CopyFieldProps & react.RefAttributes<HTMLDivElement>>;
|
|
1497
|
+
|
|
1498
|
+
type AmbientBackgroundVariant = 'page' | 'login';
|
|
1499
|
+
interface AmbientBackgroundProps extends HTMLAttributes<HTMLDivElement> {
|
|
1500
|
+
/** `login` runs the glows larger and warmer for hero/auth screens. */
|
|
1501
|
+
variant?: AmbientBackgroundVariant;
|
|
1502
|
+
}
|
|
1503
|
+
/**
|
|
1504
|
+
* The Crystal ambient glow — a warm accent bloom top-right and a cool one
|
|
1505
|
+
* bottom-left, fixed behind the page. Three apps had inlined this with
|
|
1506
|
+
* identical values, which is exactly the argument for owning it here.
|
|
1507
|
+
*
|
|
1508
|
+
* Purely decorative: hidden from assistive tech, `pointer-events: none`,
|
|
1509
|
+
* layered behind in-flow content (`z-index: -1`), and explicitly dimmed under
|
|
1510
|
+
* `.dark` — the accent is a fixed brand token, so without the override the
|
|
1511
|
+
* glows would come out brighter over a dark page.
|
|
1512
|
+
*/
|
|
1513
|
+
declare const AmbientBackground: react.ForwardRefExoticComponent<AmbientBackgroundProps & react.RefAttributes<HTMLDivElement>>;
|
|
1514
|
+
|
|
1515
|
+
interface TooltipProps {
|
|
1516
|
+
/** The tooltip text. A tooltip with no content renders nothing and adds no handlers. */
|
|
1517
|
+
content: ReactNode;
|
|
1518
|
+
/** The single element the tooltip describes. It must accept a ref and DOM handlers. */
|
|
1519
|
+
children: ReactElement;
|
|
1520
|
+
/** Hover delay in ms before it appears. Default 200. Focus always shows immediately. */
|
|
1521
|
+
delay?: number;
|
|
1522
|
+
/** Horizontal alignment against the trigger. Default 'center'. */
|
|
1523
|
+
align?: 'start' | 'center' | 'end';
|
|
1524
|
+
/** Render the tooltip but keep it from ever opening — for a disabled affordance. */
|
|
1525
|
+
disabled?: boolean;
|
|
1526
|
+
className?: string;
|
|
1527
|
+
}
|
|
1528
|
+
/**
|
|
1529
|
+
* A hover and focus hint.
|
|
1530
|
+
*
|
|
1531
|
+
* This one is a single component taking `content`, not a Root/Trigger/Content trio.
|
|
1532
|
+
* Compound APIs are useful when callers compose popup content, as in
|
|
1533
|
+
* `DropdownMenu` and `Popover`; a tooltip body is one run of descriptive text.
|
|
1534
|
+
*
|
|
1535
|
+
* It describes rather than labels: the trigger keeps whatever accessible name it
|
|
1536
|
+
* already had and gains `aria-describedby`. A tooltip is not a substitute for a label
|
|
1537
|
+
* on an icon-only button — that button still needs its own `aria-label`, because a
|
|
1538
|
+
* tooltip never opens for a touch user at all.
|
|
1539
|
+
*/
|
|
1540
|
+
declare function Tooltip({ content, children, delay, align, disabled, className, }: TooltipProps): react.JSX.Element;
|
|
1541
|
+
|
|
1542
|
+
interface MenuPosition {
|
|
1543
|
+
maxHeight: number;
|
|
1544
|
+
top?: number;
|
|
1545
|
+
bottom?: number;
|
|
1546
|
+
/** Horizontal anchor: one of `left` / `right`, in px from the viewport edge. */
|
|
1547
|
+
left?: number;
|
|
1548
|
+
right?: number;
|
|
1549
|
+
/** Fixed width matching the trigger, or content width with a minimum. */
|
|
1550
|
+
width?: number;
|
|
1551
|
+
minWidth?: number;
|
|
1552
|
+
maxWidth?: number;
|
|
1553
|
+
}
|
|
1554
|
+
interface AnchoredMenuOptions {
|
|
1555
|
+
/** Controlled visibility. Pair with onOpenChange. */
|
|
1556
|
+
open?: boolean;
|
|
1557
|
+
/** Initial visibility when the menu is uncontrolled. */
|
|
1558
|
+
defaultOpen?: boolean;
|
|
1559
|
+
/** Called whenever an interaction requests a visibility change. */
|
|
1560
|
+
onOpenChange?: (open: boolean) => void;
|
|
1561
|
+
/** Menu takes the trigger's width. False sizes it to its content. Default true. */
|
|
1562
|
+
matchTriggerWidth?: boolean;
|
|
1563
|
+
/**
|
|
1564
|
+
* Horizontal alignment against the trigger. Default 'left'.
|
|
1565
|
+
*
|
|
1566
|
+
* `center` is only meaningful with `matchTriggerWidth: false` — a menu the same
|
|
1567
|
+
* width as its trigger is already centred on it. It resolves to a `left` in
|
|
1568
|
+
* viewport coordinates rather than a transform, so the clamp below can keep a
|
|
1569
|
+
* content-sized popover on screen.
|
|
1570
|
+
*/
|
|
1571
|
+
align?: 'left' | 'center' | 'right';
|
|
1572
|
+
/** Maximum viewport height reserved for the popup. Defaults to 280px. */
|
|
1573
|
+
maxHeight?: number;
|
|
1574
|
+
/** Space that triggers vertical flipping when the opposite side is roomier. */
|
|
1575
|
+
minimumSpace?: number;
|
|
1576
|
+
}
|
|
1577
|
+
/**
|
|
1578
|
+
* Positions a dropdown against a trigger, in `fixed` coordinates computed from the
|
|
1579
|
+
* trigger's rect.
|
|
1580
|
+
*
|
|
1581
|
+
* The point is the portal. Rendered inline, a menu is clipped by any ancestor with
|
|
1582
|
+
* `overflow: hidden|auto` or a `transform` — most often the scrolling body of a
|
|
1583
|
+
* dialog, which is exactly where selects live. Rendering to `document.body` in fixed
|
|
1584
|
+
* coordinates escapes all of that, at the cost of having to recompute on scroll and
|
|
1585
|
+
* resize, which this does.
|
|
1586
|
+
*
|
|
1587
|
+
* It flips above the trigger when there is not enough room below, and it registers
|
|
1588
|
+
* itself with `DialogLayer` as an owned portal — otherwise the dialog's focus trap
|
|
1589
|
+
* treats the open menu as outside itself and fights it.
|
|
1590
|
+
*/
|
|
1591
|
+
declare function useAnchoredMenu<T extends HTMLElement>(options?: AnchoredMenuOptions): {
|
|
1592
|
+
open: boolean;
|
|
1593
|
+
setOpen: (nextState: SetStateAction<boolean>) => void;
|
|
1594
|
+
triggerRef: react.MutableRefObject<T | null>;
|
|
1595
|
+
menuRef: react.MutableRefObject<HTMLDivElement | null>;
|
|
1596
|
+
pos: MenuPosition | null;
|
|
1597
|
+
};
|
|
1598
|
+
/** Turns a computed position into inline styles for the fixed container. */
|
|
1599
|
+
declare function menuStyle(pos: MenuPosition | null): CSSProperties;
|
|
1600
|
+
|
|
1601
|
+
export { AlertDialogAction, type AlertDialogActionProps, AlertDialogCancel, type AlertDialogCancelProps, AlertDialogContent, type AlertDialogContentProps, AlertDialogDescription, type AlertDialogDescriptionProps, AlertDialogFooter, type AlertDialogFooterProps, AlertDialogHeader, type AlertDialogHeaderProps, AlertDialogMedia, type AlertDialogMediaProps, AlertDialogRoot, type AlertDialogRootProps, AlertDialogTitle, type AlertDialogTitleProps, AlertDialogTrigger, type AlertDialogTriggerProps, AmbientBackground, type AmbientBackgroundProps, type AmbientBackgroundVariant, type AnchoredMenuOptions, Badge, type BadgeProps, type BadgeSize, type BadgeTone, Button, type ButtonIcon, type ButtonProps, type ButtonSize, type ButtonVariant, Calendar, type CalendarDate, type CalendarDisabledDates, type CalendarProps, type CalendarRange, type CalendarRangeProps, type CalendarSharedProps, type CalendarSingleProps, Card, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardHeader, type CardHeaderProps, type CardPadding, type CardProps, CardTitle, type CardTitleProps, type CardTone, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, type ChoiceGroupOrientation, type ChoiceOption, Combobox, type ComboboxOption, type ComboboxProps, CopyField, type CopyFieldProps, DataTable, type DataTableProps, DatePicker, type DatePickerProps, type DatePickerRangeProps, type DatePickerSingleProps, type DatePickerSize, Dialog, DialogClose, type DialogCloseProps, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, DialogLayer, type DialogLayerAutoFocusEvent, type DialogLayerProps, type DialogPrimitiveSize, type DialogProps, DialogRoot, type DialogRootProps, type DialogSize, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerProps, DropdownMenu, type DropdownMenuAlign, DropdownMenuCheckboxItem, type DropdownMenuCheckboxItemProps, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, type DropdownMenuGroupProps, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, type DropdownMenuProps, DropdownMenuRadioGroup, type DropdownMenuRadioGroupProps, DropdownMenuRadioItem, type DropdownMenuRadioItemProps, DropdownMenuSeparator, type DropdownMenuSeparatorProps, DropdownMenuTrigger, type DropdownMenuTriggerProps, EmptyState, type EmptyStateProps, FileDropzone, type FileDropzoneProps, type FileDropzoneSelectionSource, FormField, type FormFieldProps, Input, type InputProps, type InputSize, Label, type LabelProps, type MenuPosition, MultiSelect, type MultiSelectOption, type MultiSelectProps, type MultiSelectVariant, type NavigationTabItem, NavigationTabs, type NavigationTabsLinkComponent, type NavigationTabsLinkProps, type NavigationTabsProps, OtpInput, type OtpInputProps, Pagination, type PaginationLabels, type PaginationProps, type PaginationSummary, Popover, type PopoverAlign, PopoverContent, type PopoverContentProps, PopoverDescription, type PopoverDescriptionProps, PopoverHeader, type PopoverHeaderProps, type PopoverPadding, type PopoverProps, PopoverTitle, type PopoverTitleProps, PopoverTrigger, type PopoverTriggerProps, ProgressBar, type ProgressBarProps, type ProgressBarSize, ProgressDots, type ProgressDotsProps, ProgressRing, type ProgressRingProps, RadioGroup, type RadioGroupProps, RichSelect, RichSelectContent, type RichSelectContentProps, RichSelectEmpty, type RichSelectEmptyProps, RichSelectGroup, type RichSelectGroupProps, RichSelectItem, type RichSelectItemProps, RichSelectLabel, type RichSelectLabelProps, type RichSelectProps, RichSelectSearch, type RichSelectSearchProps, RichSelectSeparator, type RichSelectSeparatorProps, type RichSelectSize, RichSelectTrigger, type RichSelectTriggerProps, RichSelectValue, type RichSelectValueProps, Select, type SelectOption, type SelectProps, type SelectSize, Separator, type SeparatorOrientation, type SeparatorProps, SheetClose, type SheetCloseProps, SheetContent, type SheetContentProps, SheetDescription, type SheetDescriptionProps, SheetFooter, type SheetFooterProps, SheetHeader, type SheetHeaderProps, SheetRoot, type SheetRootProps, type SheetSide, SheetTitle, type SheetTitleProps, SheetTrigger, type SheetTriggerProps, type SheetWidth, Skeleton, type SkeletonProps, type SkeletonShape, Slot, type SlotAllProps, type SlotProps, Spinner, type SpinnerProps, type SpinnerSize, Stepper, type StepperProps, type StepperStep, Switch, type SwitchProps, Table, type TableAlign, TableBody, type TableBodyProps, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, type TableColumn, type TableDensity, TableFooter, type TableFooterProps, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, type TableProps, type TableRootProps, TableRow, type TableRowProps, Tabs, type TabsActivationMode, TabsContent, type TabsContentProps, TabsList, type TabsListProps, type TabsListVariant, type TabsOrientation, type TabsProps, TabsTrigger, type TabsTriggerProps, Textarea, type TextareaProps, type TextareaSize, Tooltip, type TooltipProps, ValidationSummary, type ValidationSummaryError, type ValidationSummaryProps, formatCalendarDate, isCalendarDate, menuStyle, parseCalendarDate, registerDialogLayerPortal, resolveActiveNavigationHref, serializeCalendarDate, useAnchoredMenu };
|