@sanity/ui 5.0.0-alpha.1 → 5.0.0-alpha.10
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/README.md +1 -1
- package/dist/cli/install.js +2 -1
- package/dist/index.d.ts +362 -76
- package/dist/index.js +420 -158
- package/dist/index.js.map +1 -1
- package/dist/polyfills.d.ts +1 -0
- package/dist/polyfills.js +5 -0
- package/dist/polyfills.js.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +9 -3
- package/src/cli/install.ts +2 -1
- package/src/components/badge/Badge.tsx +53 -0
- package/src/components/badge/badge.css +6 -0
- package/src/components/badge/badge.props.ts +31 -0
- package/src/components/box/Box.tsx +6 -1
- package/src/components/box/box.props.ts +7 -2
- package/src/components/button/button.props.ts +27 -9
- package/src/components/card/card.props.ts +6 -2
- package/src/components/checkbox/Checkbox.tsx +3 -2
- package/src/components/checkbox/checkbox.props.ts +11 -3
- package/src/components/code/code.props.ts +10 -3
- package/src/components/container/container.props.ts +6 -2
- package/src/components/dialog/Dialog.tsx +139 -0
- package/src/components/dialog/dialog.css +49 -0
- package/src/components/dialog/dialog.props.ts +45 -0
- package/src/components/eyebrow/Eyebrow.tsx +1 -1
- package/src/components/eyebrow/eyebrow.props.ts +6 -2
- package/src/components/flex/Flex.tsx +6 -1
- package/src/components/flex/flex.props.ts +6 -2
- package/src/components/grid/Grid.tsx +6 -1
- package/src/components/grid/grid.props.ts +6 -2
- package/src/components/h-stack/hStack.props.ts +3 -1
- package/src/components/heading/Heading.tsx +1 -1
- package/src/components/heading/heading.props.ts +8 -2
- package/src/components/icon/icon.props.ts +6 -2
- package/src/components/icon-button/iconButton.props.ts +7 -2
- package/src/components/index.css +3 -0
- package/src/components/indicator/indicator.props.ts +6 -2
- package/src/components/indicator-stack/indicatorStack.props.ts +3 -1
- package/src/components/inline/inline.props.ts +6 -2
- package/src/components/label/label.props.ts +7 -1
- package/src/components/link/link.props.ts +4 -4
- package/src/components/list/list.props.ts +27 -9
- package/src/components/popover/Popover.tsx +85 -0
- package/src/components/popover/popover.css +21 -0
- package/src/components/popover/popover.props.ts +38 -0
- package/src/components/press-area/pressArea.props.ts +3 -1
- package/src/components/radio/Radio.tsx +1 -1
- package/src/components/radio/radio.props.ts +7 -2
- package/src/components/skip-to-content/skipToContent.props.ts +9 -3
- package/src/components/spinner/Spinner.tsx +1 -1
- package/src/components/spinner/spinner.props.ts +3 -0
- package/src/components/switch/Switch.tsx +1 -1
- package/src/components/switch/switch.props.ts +7 -2
- package/src/components/text/Text.tsx +1 -1
- package/src/components/text/text.props.ts +6 -2
- package/src/components/tooltip/Tooltip.tsx +59 -55
- package/src/components/tooltip/tooltip.css +19 -40
- package/src/components/tooltip/tooltip.props.ts +24 -8
- package/src/components/tooltip-group/TooltipGroup.tsx +2 -5
- package/src/components/tooltip-group/tooltipGroup.props.ts +3 -1
- package/src/components/v-stack/vStack.props.ts +3 -1
- package/src/components/visually-hidden/visuallyHidden.props.ts +6 -2
- package/src/css/classes/generic/display.css +8 -8
- package/src/css/classes/generic/placement.css +31 -0
- package/src/css/classes/local/animation.css +4 -0
- package/src/css/classes/local/index.css +2 -0
- package/src/css/classes/local/top-anchor.css +4 -0
- package/src/css/global/reset.css +20 -18
- package/src/css/tokens/semantic.css +4 -0
- package/src/hooks/useIsClient.ts +10 -0
- package/src/index.ts +5 -0
- package/src/polyfills.ts +15 -0
- package/src/utils/mergeTriggerProps.ts +66 -0
- package/src/utils/renderPortal.tsx +14 -0
- package/src/version.ts +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
2
|
import { ComponentPropsWithRef } from "react";
|
|
3
3
|
import { ElementType } from "react";
|
|
4
4
|
import { JSX } from "react";
|
|
@@ -16,6 +16,31 @@ declare const ALIGN_ITEMS: readonly [
|
|
|
16
16
|
/** @public */
|
|
17
17
|
export declare type AlignItems = (typeof ALIGN_ITEMS)[number];
|
|
18
18
|
|
|
19
|
+
/** @public */
|
|
20
|
+
export declare function Badge<T extends ElementType = "span">({
|
|
21
|
+
tone,
|
|
22
|
+
...props
|
|
23
|
+
}: BadgeProps<T> &
|
|
24
|
+
Omit<ComponentPropsWithRef<T>, keyof BadgeProps<T>>): JSX.Element;
|
|
25
|
+
|
|
26
|
+
/** @public */
|
|
27
|
+
export declare interface BadgeProps<
|
|
28
|
+
T extends React.ElementType = "span",
|
|
29
|
+
> extends ToneProps {
|
|
30
|
+
/**
|
|
31
|
+
* HTML element to render.
|
|
32
|
+
*/
|
|
33
|
+
as?: T;
|
|
34
|
+
/**
|
|
35
|
+
* Shows an icon in the start position (left side in left-to-right languages).
|
|
36
|
+
*/
|
|
37
|
+
iconStart?: React.ElementType | React.ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* Sets Badge's text label. Use instead of children unless you have a special use case.
|
|
40
|
+
*/
|
|
41
|
+
text?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
19
44
|
declare type BorderProps = {
|
|
20
45
|
/** CSS **border** property */
|
|
21
46
|
border?: Responsive<boolean>;
|
|
@@ -34,6 +59,8 @@ declare type BorderProps = {
|
|
|
34
59
|
/** @public */
|
|
35
60
|
export declare function Box<T extends ElementType = "div">({
|
|
36
61
|
display,
|
|
62
|
+
minHeight,
|
|
63
|
+
minWidth,
|
|
37
64
|
...props
|
|
38
65
|
}: BoxProps<T> &
|
|
39
66
|
Omit<ComponentPropsWithRef<T>, keyof BoxProps<T>>): JSX.Element;
|
|
@@ -42,9 +69,14 @@ export declare function Box<T extends ElementType = "div">({
|
|
|
42
69
|
export declare interface BoxProps<
|
|
43
70
|
T extends React.ElementType = "div",
|
|
44
71
|
> extends LayoutProps {
|
|
45
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* HTML element or component to render.
|
|
74
|
+
*/
|
|
46
75
|
as?: T;
|
|
47
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* CSS `display` property.
|
|
78
|
+
* @remarks Does not include `'flex'` or `'grid'`. Use the Flex or Grid components for those.
|
|
79
|
+
*/
|
|
48
80
|
display?: Responsive<DisplayBlock>;
|
|
49
81
|
}
|
|
50
82
|
|
|
@@ -69,23 +101,41 @@ declare type ButtonLevel = (typeof BUTTON_LEVEL)[number];
|
|
|
69
101
|
|
|
70
102
|
/** @public */
|
|
71
103
|
export declare interface ButtonProps<T extends React.ElementType = "button"> {
|
|
72
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* HTML element to render.
|
|
106
|
+
*/
|
|
73
107
|
as?: InteractiveAs<T>;
|
|
74
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Sets padding and gap together to specify size.
|
|
110
|
+
*/
|
|
75
111
|
density?: ButtonDensity;
|
|
76
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Sets Button to fill the width of its container.
|
|
114
|
+
*/
|
|
77
115
|
fullWidth?: Responsive<boolean>;
|
|
78
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* Shows an icon in the start position (left side in left-to-right languages).
|
|
118
|
+
*/
|
|
79
119
|
iconStart?: React.ElementType | React.ReactNode;
|
|
80
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* Shows an icon in the end position (right side in left-to-right languages).
|
|
122
|
+
*/
|
|
81
123
|
iconEnd?: React.ElementType | React.ReactNode;
|
|
82
|
-
/**
|
|
124
|
+
/**
|
|
125
|
+
* Sets the importance of Button's action.
|
|
126
|
+
*/
|
|
83
127
|
level?: ButtonLevel;
|
|
84
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* Places Button into a loading state.
|
|
130
|
+
*/
|
|
85
131
|
loading?: boolean;
|
|
86
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* Sets Button's text label.
|
|
134
|
+
*/
|
|
87
135
|
text?: string;
|
|
88
|
-
/**
|
|
136
|
+
/**
|
|
137
|
+
* Sets Button's semantic meaning and related color.
|
|
138
|
+
*/
|
|
89
139
|
tone?: ButtonTone;
|
|
90
140
|
}
|
|
91
141
|
|
|
@@ -102,9 +152,13 @@ export declare function Card<T extends ElementType = "div">({
|
|
|
102
152
|
/** @public */
|
|
103
153
|
export declare interface CardProps<T extends React.ElementType = "div">
|
|
104
154
|
extends MarginProps, ToneProps {
|
|
105
|
-
/**
|
|
155
|
+
/**
|
|
156
|
+
* HTML element or component to render.
|
|
157
|
+
*/
|
|
106
158
|
as?: T;
|
|
107
|
-
/**
|
|
159
|
+
/**
|
|
160
|
+
* Sets padding, gap, and border-radius together to specify size. This prop is used in place of separate `padding`, `gap`, and `border-radius` props.
|
|
161
|
+
*/
|
|
108
162
|
density?: Responsive<Density>;
|
|
109
163
|
}
|
|
110
164
|
|
|
@@ -114,11 +168,19 @@ export declare function Checkbox(props: CheckboxProps): JSX.Element;
|
|
|
114
168
|
/** @beta */
|
|
115
169
|
export declare interface CheckboxProps
|
|
116
170
|
extends React.ComponentProps<"input">, MarginProps {
|
|
117
|
-
/**
|
|
171
|
+
/**
|
|
172
|
+
* Applies error styling to the checkbox mark.
|
|
173
|
+
* @remarks Use when form validation fails. Pair with a visible error message. The prop is visual only.
|
|
174
|
+
*/
|
|
118
175
|
error?: boolean;
|
|
119
|
-
/**
|
|
176
|
+
/**
|
|
177
|
+
* Renders the "mixed state" mark (a horizontal line).
|
|
178
|
+
* @remarks Use when the checkbox controls a group with some-but-not-all children checked.
|
|
179
|
+
*/
|
|
120
180
|
indeterminate?: boolean;
|
|
121
|
-
/**
|
|
181
|
+
/**
|
|
182
|
+
* Visible label next to the checkbox.
|
|
183
|
+
*/
|
|
122
184
|
label: React.ReactNode;
|
|
123
185
|
}
|
|
124
186
|
|
|
@@ -138,11 +200,18 @@ export declare interface CodeProps<T extends CodeTag = "pre"> extends Omit<
|
|
|
138
200
|
TypographyProps,
|
|
139
201
|
"align" | "truncate" | "tone"
|
|
140
202
|
> {
|
|
141
|
-
/**
|
|
203
|
+
/**
|
|
204
|
+
* HTML element or component to render.
|
|
205
|
+
* @remarks The defined element wraps an inner `<code>` tag.
|
|
206
|
+
*/
|
|
142
207
|
as?: T;
|
|
143
|
-
/**
|
|
208
|
+
/**
|
|
209
|
+
* Refractor language for syntax highlighting.
|
|
210
|
+
*/
|
|
144
211
|
language?: string;
|
|
145
|
-
/**
|
|
212
|
+
/**
|
|
213
|
+
* Sets font size.
|
|
214
|
+
*/
|
|
146
215
|
size?: Responsive<CodeSize>;
|
|
147
216
|
}
|
|
148
217
|
|
|
@@ -164,9 +233,13 @@ declare const CONTAINER_SIZE: readonly [0, 1, 2, 3, 4, 5];
|
|
|
164
233
|
export declare interface ContainerProps<
|
|
165
234
|
T extends React.ElementType = "div",
|
|
166
235
|
> extends LayoutProps {
|
|
167
|
-
/**
|
|
236
|
+
/**
|
|
237
|
+
* HTML element or component to render.
|
|
238
|
+
*/
|
|
168
239
|
as?: T;
|
|
169
|
-
/**
|
|
240
|
+
/**
|
|
241
|
+
* Maximum width of the container.
|
|
242
|
+
*/
|
|
170
243
|
size?: Responsive<ContainerSize>;
|
|
171
244
|
}
|
|
172
245
|
|
|
@@ -178,6 +251,58 @@ declare const DENSITY: readonly ["compact", "regular", "loose"];
|
|
|
178
251
|
/** @public */
|
|
179
252
|
export declare type Density = (typeof DENSITY)[number];
|
|
180
253
|
|
|
254
|
+
/**
|
|
255
|
+
* @beta
|
|
256
|
+
*
|
|
257
|
+
* Renders a modal dialog element — should not be used for nonmodal dialogs.
|
|
258
|
+
* Modal dialogs make their containing documents inert, and render on the topmost
|
|
259
|
+
* layer within that containing document; they must be dimissed before the containing
|
|
260
|
+
* document and its contents become unblocked. They also trap focus within the bounds
|
|
261
|
+
* of the dialog element and its descendants.
|
|
262
|
+
*
|
|
263
|
+
* For more on dialogs and modality, refer to the HTML specification for the dialog element:
|
|
264
|
+
* https://html.spec.whatwg.org/dev/interactive-elements.html#the-dialog-element
|
|
265
|
+
*/
|
|
266
|
+
export declare const Dialog: typeof DialogRoot;
|
|
267
|
+
|
|
268
|
+
declare function DialogContent(props: ComponentProps<"div">): JSX.Element;
|
|
269
|
+
|
|
270
|
+
declare function DialogFooter(props: ComponentProps<"div">): JSX.Element;
|
|
271
|
+
|
|
272
|
+
/** @beta */
|
|
273
|
+
export declare interface DialogProps extends Omit<
|
|
274
|
+
React.ComponentProps<"dialog">,
|
|
275
|
+
"open"
|
|
276
|
+
> {
|
|
277
|
+
/**
|
|
278
|
+
* Text for the dialog heading.
|
|
279
|
+
* @remarks Recommended for accessibility. The component sets `aria-labelledby` to the heading when you give this prop.
|
|
280
|
+
*/
|
|
281
|
+
header?: string;
|
|
282
|
+
/**
|
|
283
|
+
* A function to call alongside the native `close` event.
|
|
284
|
+
* @remarks Use it to set `open` back to `false`. It runs for every close cause: the Escape key, a backdrop click, the close button, or a programmatic close.
|
|
285
|
+
*/
|
|
286
|
+
onClose: React.ReactEventHandler<HTMLDialogElement>;
|
|
287
|
+
/**
|
|
288
|
+
* Toggles the dialog's open state.
|
|
289
|
+
* @remarks `true` calls `showModal()` on the element. `false` calls `close()`.
|
|
290
|
+
*/
|
|
291
|
+
open?: boolean;
|
|
292
|
+
/** Sets the max width of the dialog */
|
|
293
|
+
size?: Responsive<ContainerSize>;
|
|
294
|
+
/** CSS length value used to set the Dialog’s distance from the top of the viewport; Dialog is centered if not provided */
|
|
295
|
+
topAnchor?: string;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
declare function DialogRoot({ open, size, ...props }: DialogProps): JSX.Element;
|
|
299
|
+
|
|
300
|
+
declare namespace DialogRoot {
|
|
301
|
+
var displayName: string;
|
|
302
|
+
var Content: typeof DialogContent;
|
|
303
|
+
var Footer: typeof DialogFooter;
|
|
304
|
+
}
|
|
305
|
+
|
|
181
306
|
declare const DISPLAY_BLOCK: readonly ["block", "inline-block", "none"];
|
|
182
307
|
|
|
183
308
|
declare const DISPLAY_FLEX: readonly ["flex", "inline-flex", "none"];
|
|
@@ -214,9 +339,13 @@ declare const EYEBROW_SIZE: readonly [0, 1, 2, 3, 4];
|
|
|
214
339
|
export declare interface EyebrowProps<
|
|
215
340
|
T extends React.ElementType = "span",
|
|
216
341
|
> extends TypographyProps {
|
|
217
|
-
/**
|
|
342
|
+
/**
|
|
343
|
+
* HTML element to render.
|
|
344
|
+
*/
|
|
218
345
|
as?: T;
|
|
219
|
-
/**
|
|
346
|
+
/**
|
|
347
|
+
* Sets font size. Uses the same scale as Label.
|
|
348
|
+
*/
|
|
220
349
|
size?: Responsive<EyebrowSize>;
|
|
221
350
|
}
|
|
222
351
|
|
|
@@ -226,6 +355,8 @@ export declare type EyebrowSize = (typeof EYEBROW_SIZE)[number];
|
|
|
226
355
|
/** @public */
|
|
227
356
|
export declare function Flex<T extends ElementType = "div">({
|
|
228
357
|
display,
|
|
358
|
+
minHeight,
|
|
359
|
+
minWidth,
|
|
229
360
|
...props
|
|
230
361
|
}: FlexProps<T> &
|
|
231
362
|
Omit<ComponentPropsWithRef<T>, keyof FlexProps<T>>): JSX.Element;
|
|
@@ -266,9 +397,13 @@ export declare type FlexParentProps = {
|
|
|
266
397
|
/** @public */
|
|
267
398
|
export declare interface FlexProps<T extends React.ElementType = "div">
|
|
268
399
|
extends FlexParentProps, GapProps, LayoutProps {
|
|
269
|
-
/**
|
|
400
|
+
/**
|
|
401
|
+
* HTML element or component to render.
|
|
402
|
+
*/
|
|
270
403
|
as?: T;
|
|
271
|
-
/**
|
|
404
|
+
/**
|
|
405
|
+
* CSS `display` property.
|
|
406
|
+
*/
|
|
272
407
|
display?: Responsive<DisplayFlex>;
|
|
273
408
|
}
|
|
274
409
|
|
|
@@ -293,6 +428,8 @@ export declare type GapProps = {
|
|
|
293
428
|
/** @public */
|
|
294
429
|
export declare function Grid<T extends ElementType = "div">({
|
|
295
430
|
display,
|
|
431
|
+
minHeight,
|
|
432
|
+
minWidth,
|
|
296
433
|
...props
|
|
297
434
|
}: GridProps<T> &
|
|
298
435
|
Omit<ComponentPropsWithRef<T>, keyof GridProps<T>>): JSX.Element;
|
|
@@ -340,9 +477,13 @@ export declare type GridParentProps = {
|
|
|
340
477
|
/** @public */
|
|
341
478
|
export declare interface GridProps<T extends React.ElementType = "div">
|
|
342
479
|
extends GridParentProps, GapProps, LayoutProps {
|
|
343
|
-
/**
|
|
480
|
+
/**
|
|
481
|
+
* HTML element or component to render.
|
|
482
|
+
*/
|
|
344
483
|
as?: T;
|
|
345
|
-
/**
|
|
484
|
+
/**
|
|
485
|
+
* CSS `display` property.
|
|
486
|
+
*/
|
|
346
487
|
display?: Responsive<DisplayGrid>;
|
|
347
488
|
}
|
|
348
489
|
|
|
@@ -360,9 +501,15 @@ declare const HEADING_TAG: readonly ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
|
360
501
|
|
|
361
502
|
/** @public */
|
|
362
503
|
export declare interface HeadingProps extends TypographyProps {
|
|
363
|
-
/**
|
|
504
|
+
/**
|
|
505
|
+
* Semantic heading element to render.
|
|
506
|
+
* @remarks Always set this explicitly.
|
|
507
|
+
*/
|
|
364
508
|
as?: HeadingTag;
|
|
365
|
-
/**
|
|
509
|
+
/**
|
|
510
|
+
* Sets font size.
|
|
511
|
+
* @remarks Independent of `as`.
|
|
512
|
+
*/
|
|
366
513
|
size?: Responsive<HeadingSize>;
|
|
367
514
|
}
|
|
368
515
|
|
|
@@ -389,7 +536,9 @@ export declare function HStack<T extends ElementType = "div">(
|
|
|
389
536
|
export declare interface HStackProps<
|
|
390
537
|
T extends React.ElementType = "div",
|
|
391
538
|
> extends Pick<GapProps, "gap"> {
|
|
392
|
-
/**
|
|
539
|
+
/**
|
|
540
|
+
* HTML element or component to render.
|
|
541
|
+
*/
|
|
393
542
|
as?: T;
|
|
394
543
|
}
|
|
395
544
|
|
|
@@ -411,9 +560,14 @@ export declare interface IconButtonProps<
|
|
|
411
560
|
ButtonProps<T>,
|
|
412
561
|
"as" | "density" | "level" | "loading" | "tone"
|
|
413
562
|
> {
|
|
414
|
-
/**
|
|
563
|
+
/**
|
|
564
|
+
* Accessible name for the button.
|
|
565
|
+
* @remarks Because IconButtons have no visible text, this is required.
|
|
566
|
+
*/
|
|
415
567
|
"aria-label": string;
|
|
416
|
-
/**
|
|
568
|
+
/**
|
|
569
|
+
* Icon to render.
|
|
570
|
+
*/
|
|
417
571
|
icon: React_2.ComponentType<SVGProps<SVGSVGElement>>;
|
|
418
572
|
}
|
|
419
573
|
|
|
@@ -424,9 +578,13 @@ export declare interface IconProps
|
|
|
424
578
|
Pick<TypographyProps, "muted">,
|
|
425
579
|
MarginProps,
|
|
426
580
|
ToneProps {
|
|
427
|
-
/**
|
|
581
|
+
/**
|
|
582
|
+
* The icon component to render.
|
|
583
|
+
*/
|
|
428
584
|
icon: React.ComponentType<SVGProps<SVGSVGElement>>;
|
|
429
|
-
/**
|
|
585
|
+
/**
|
|
586
|
+
* Sets icon size.
|
|
587
|
+
*/
|
|
430
588
|
size?: Responsive<IconSize>;
|
|
431
589
|
}
|
|
432
590
|
|
|
@@ -444,9 +602,13 @@ export declare function Indicator<T extends ElementType = "span">({
|
|
|
444
602
|
export declare interface IndicatorProps<
|
|
445
603
|
T extends React.ElementType = "span",
|
|
446
604
|
> extends ToneProps {
|
|
447
|
-
/**
|
|
605
|
+
/**
|
|
606
|
+
* HTML element to render.
|
|
607
|
+
*/
|
|
448
608
|
as?: T;
|
|
449
|
-
/**
|
|
609
|
+
/**
|
|
610
|
+
* Accessible label.
|
|
611
|
+
*/
|
|
450
612
|
label?: string;
|
|
451
613
|
}
|
|
452
614
|
|
|
@@ -460,7 +622,9 @@ export declare function IndicatorStack<T extends ElementType = "div">(
|
|
|
460
622
|
export declare interface IndicatorStackProps<
|
|
461
623
|
T extends React.ElementType = "div",
|
|
462
624
|
> {
|
|
463
|
-
/**
|
|
625
|
+
/**
|
|
626
|
+
* HTML element to render.
|
|
627
|
+
*/
|
|
464
628
|
as?: T;
|
|
465
629
|
}
|
|
466
630
|
|
|
@@ -475,9 +639,13 @@ export declare function Inline<T extends ElementType = "div">(
|
|
|
475
639
|
export declare interface InlineProps<
|
|
476
640
|
T extends React.ElementType = "div",
|
|
477
641
|
> extends PaddingProps {
|
|
478
|
-
/**
|
|
642
|
+
/**
|
|
643
|
+
* HTML element or component to render.
|
|
644
|
+
*/
|
|
479
645
|
as?: T;
|
|
480
|
-
/**
|
|
646
|
+
/**
|
|
647
|
+
* Space between children.
|
|
648
|
+
*/
|
|
481
649
|
gap?: Responsive<SpaceInherit>;
|
|
482
650
|
}
|
|
483
651
|
|
|
@@ -506,8 +674,14 @@ export declare function Label(props: LabelProps): JSX.Element;
|
|
|
506
674
|
/** @beta */
|
|
507
675
|
export declare interface LabelProps
|
|
508
676
|
extends React.ComponentProps<"label">, MarginProps {
|
|
509
|
-
/**
|
|
677
|
+
/**
|
|
678
|
+
* Renders the label in a muted color.
|
|
679
|
+
*/
|
|
510
680
|
disabled?: boolean;
|
|
681
|
+
/**
|
|
682
|
+
* Renders the label in the error color.
|
|
683
|
+
* @remarks Use when the linked input has a validation error.
|
|
684
|
+
*/
|
|
511
685
|
error?: boolean;
|
|
512
686
|
}
|
|
513
687
|
|
|
@@ -532,12 +706,12 @@ export declare function Link({ underlined, ...props }: LinkProps): JSX.Element;
|
|
|
532
706
|
|
|
533
707
|
/** @beta */
|
|
534
708
|
export declare interface LinkProps extends React.ComponentProps<"a"> {
|
|
535
|
-
/**
|
|
709
|
+
/**
|
|
710
|
+
* Sets the link to `target="_blank"` and `rel="noopener noreferrer"`.
|
|
711
|
+
*/
|
|
536
712
|
openInNewTab?: boolean;
|
|
537
713
|
/**
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
* @defaultValue true
|
|
714
|
+
* Underlines the link.
|
|
541
715
|
*/
|
|
542
716
|
underlined?: boolean;
|
|
543
717
|
}
|
|
@@ -557,9 +731,13 @@ declare function ListButtonItem<T extends ElementType = "button">({
|
|
|
557
731
|
export declare interface ListButtonItemProps<
|
|
558
732
|
T extends React_2.ElementType = "button",
|
|
559
733
|
> extends ListItemProps {
|
|
560
|
-
/**
|
|
734
|
+
/**
|
|
735
|
+
* Element or component to render for the press target.
|
|
736
|
+
*/
|
|
561
737
|
as?: InteractiveAs<T>;
|
|
562
|
-
/**
|
|
738
|
+
/**
|
|
739
|
+
* Marks the row as the current selection.
|
|
740
|
+
*/
|
|
563
741
|
selected?: boolean;
|
|
564
742
|
}
|
|
565
743
|
|
|
@@ -569,11 +747,17 @@ declare function ListItemImage(props: ComponentProps<"img">): JSX.Element;
|
|
|
569
747
|
|
|
570
748
|
/** @beta */
|
|
571
749
|
export declare interface ListItemProps extends React_2.ComponentProps<"li"> {
|
|
572
|
-
/**
|
|
750
|
+
/**
|
|
751
|
+
* Sets horizontal padding, gap, and minimum row height together.
|
|
752
|
+
*/
|
|
573
753
|
density?: Responsive<Density>;
|
|
574
|
-
/**
|
|
754
|
+
/**
|
|
755
|
+
* Slot at the left edge of the row.
|
|
756
|
+
*/
|
|
575
757
|
start?: React_2.ReactNode;
|
|
576
|
-
/**
|
|
758
|
+
/**
|
|
759
|
+
* Slot at the right edge of the row.
|
|
760
|
+
*/
|
|
577
761
|
end?: React_2.ReactNode;
|
|
578
762
|
}
|
|
579
763
|
|
|
@@ -586,11 +770,17 @@ declare function ListItemText<T extends ElementType = "div">(
|
|
|
586
770
|
export declare interface ListItemTextProps<
|
|
587
771
|
T extends React_2.ElementType = "div",
|
|
588
772
|
> {
|
|
589
|
-
/**
|
|
773
|
+
/**
|
|
774
|
+
* HTML element to render.
|
|
775
|
+
*/
|
|
590
776
|
as?: T;
|
|
591
|
-
/**
|
|
777
|
+
/**
|
|
778
|
+
* Main label.
|
|
779
|
+
*/
|
|
592
780
|
title?: React_2.ReactNode;
|
|
593
|
-
/**
|
|
781
|
+
/**
|
|
782
|
+
* Text below the title.
|
|
783
|
+
*/
|
|
594
784
|
subtitle?: React_2.ReactNode;
|
|
595
785
|
}
|
|
596
786
|
|
|
@@ -599,7 +789,9 @@ export declare interface ListProps<T extends ListTag = "ul"> extends Pick<
|
|
|
599
789
|
GapProps,
|
|
600
790
|
"gap"
|
|
601
791
|
> {
|
|
602
|
-
/**
|
|
792
|
+
/**
|
|
793
|
+
* HTML element to render.
|
|
794
|
+
*/
|
|
603
795
|
as?: T;
|
|
604
796
|
}
|
|
605
797
|
|
|
@@ -697,6 +889,43 @@ export declare type PlacementProps = {
|
|
|
697
889
|
placement?: Placement;
|
|
698
890
|
};
|
|
699
891
|
|
|
892
|
+
/** @beta */
|
|
893
|
+
export declare const Popover: typeof PopoverRoot & {
|
|
894
|
+
forwardsTriggerProps: boolean;
|
|
895
|
+
};
|
|
896
|
+
|
|
897
|
+
/** @beta */
|
|
898
|
+
export declare interface PopoverProps
|
|
899
|
+
extends
|
|
900
|
+
Omit<React.ComponentProps<"div">, "children" | "content">,
|
|
901
|
+
PlacementProps {
|
|
902
|
+
/**
|
|
903
|
+
* Shared anchor identifier.
|
|
904
|
+
* @remarks Set the same value on a Tooltip and a Popover to point both at one trigger.
|
|
905
|
+
*/
|
|
906
|
+
anchorName?: React.ReactNode;
|
|
907
|
+
/**
|
|
908
|
+
* The trigger element.
|
|
909
|
+
* @remarks Popover clones it and attaches the `popovertarget` attribute that opens the floating layer.
|
|
910
|
+
*/
|
|
911
|
+
children: React.ReactElement<Record<string, unknown>>;
|
|
912
|
+
/**
|
|
913
|
+
* The floating content.
|
|
914
|
+
*/
|
|
915
|
+
content?: React.ReactNode;
|
|
916
|
+
/**
|
|
917
|
+
* Renders the content into `document.body` through a React portal instead of inline.
|
|
918
|
+
*/
|
|
919
|
+
portal?: boolean;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
declare function PopoverRoot({
|
|
923
|
+
placement,
|
|
924
|
+
...props
|
|
925
|
+
}: PopoverProps & {
|
|
926
|
+
triggerProps?: Record<string, unknown>;
|
|
927
|
+
}): JSX.Element;
|
|
928
|
+
|
|
700
929
|
declare const POSITION: readonly [
|
|
701
930
|
"absolute",
|
|
702
931
|
"fixed",
|
|
@@ -733,7 +962,9 @@ export declare function PressArea<T extends ElementType = "button">(
|
|
|
733
962
|
export declare interface PressAreaProps<
|
|
734
963
|
T extends React.ElementType = "button",
|
|
735
964
|
> {
|
|
736
|
-
/**
|
|
965
|
+
/**
|
|
966
|
+
* Element or component to render.
|
|
967
|
+
*/
|
|
737
968
|
as?: InteractiveAs<T>;
|
|
738
969
|
}
|
|
739
970
|
|
|
@@ -743,9 +974,14 @@ export declare function Radio(props: RadioProps): JSX.Element;
|
|
|
743
974
|
/** @beta */
|
|
744
975
|
export declare interface RadioProps
|
|
745
976
|
extends React.ComponentProps<"input">, MarginProps {
|
|
746
|
-
/**
|
|
977
|
+
/**
|
|
978
|
+
* Applies error styling to the radio mark.
|
|
979
|
+
* @remarks Use when form validation fails. Pair with a visible error message. The prop is visual only.
|
|
980
|
+
*/
|
|
747
981
|
error?: boolean;
|
|
748
|
-
/**
|
|
982
|
+
/**
|
|
983
|
+
* Visible label next to the radio.
|
|
984
|
+
*/
|
|
749
985
|
label: React.ReactNode;
|
|
750
986
|
}
|
|
751
987
|
|
|
@@ -793,12 +1029,18 @@ export declare function SkipToContent(props: SkipToContentProps): JSX.Element;
|
|
|
793
1029
|
/** @beta */
|
|
794
1030
|
export declare interface SkipToContentProps extends React.ComponentProps<"a"> {
|
|
795
1031
|
/**
|
|
796
|
-
*
|
|
1032
|
+
* Same-page fragment to jump to.
|
|
1033
|
+
* @remarks Note: The hash character # is required for proper linking.
|
|
797
1034
|
*/
|
|
798
1035
|
href: string;
|
|
799
|
-
/**
|
|
1036
|
+
/**
|
|
1037
|
+
* Visible and announced text.
|
|
1038
|
+
*/
|
|
800
1039
|
label: string;
|
|
801
|
-
/**
|
|
1040
|
+
/**
|
|
1041
|
+
* Not accepted.
|
|
1042
|
+
* @remarks Pass text via `label`.
|
|
1043
|
+
*/
|
|
802
1044
|
children?: never;
|
|
803
1045
|
}
|
|
804
1046
|
|
|
@@ -848,6 +1090,9 @@ export declare function Spinner({ size, ...props }: SpinnerProps): JSX.Element;
|
|
|
848
1090
|
|
|
849
1091
|
/** @public */
|
|
850
1092
|
export declare interface SpinnerProps extends React.ComponentProps<"svg"> {
|
|
1093
|
+
/**
|
|
1094
|
+
* Size of the spinner icon.
|
|
1095
|
+
*/
|
|
851
1096
|
size?: Responsive<IconSize>;
|
|
852
1097
|
}
|
|
853
1098
|
|
|
@@ -857,9 +1102,14 @@ export declare function Switch(props: SwitchProps): JSX.Element;
|
|
|
857
1102
|
/** @beta */
|
|
858
1103
|
export declare interface SwitchProps
|
|
859
1104
|
extends React.ComponentProps<"input">, MarginProps {
|
|
860
|
-
/**
|
|
1105
|
+
/**
|
|
1106
|
+
* Applies error styling to the switch track.
|
|
1107
|
+
* @remarks Use when form validation fails. Pair with a visible error message. The prop is visual only.
|
|
1108
|
+
*/
|
|
861
1109
|
error?: boolean;
|
|
862
|
-
/**
|
|
1110
|
+
/**
|
|
1111
|
+
* Visible label next to the switch.
|
|
1112
|
+
*/
|
|
863
1113
|
label: React.ReactNode;
|
|
864
1114
|
}
|
|
865
1115
|
|
|
@@ -882,9 +1132,13 @@ export declare type TextAlign = (typeof TEXT_ALIGN)[number];
|
|
|
882
1132
|
export declare interface TextProps<
|
|
883
1133
|
T extends React.ElementType = "span",
|
|
884
1134
|
> extends TypographyProps {
|
|
885
|
-
/**
|
|
1135
|
+
/**
|
|
1136
|
+
* HTML element to render.
|
|
1137
|
+
*/
|
|
886
1138
|
as?: T;
|
|
887
|
-
/**
|
|
1139
|
+
/**
|
|
1140
|
+
* Sets font size.
|
|
1141
|
+
*/
|
|
888
1142
|
size?: Responsive<TextSize>;
|
|
889
1143
|
}
|
|
890
1144
|
|
|
@@ -907,8 +1161,8 @@ declare type ToneProps = {
|
|
|
907
1161
|
tone?: Tone;
|
|
908
1162
|
};
|
|
909
1163
|
|
|
910
|
-
/** @
|
|
911
|
-
export declare
|
|
1164
|
+
/** @beta */
|
|
1165
|
+
export declare const Tooltip: typeof TooltipRoot;
|
|
912
1166
|
|
|
913
1167
|
/** @public */
|
|
914
1168
|
export declare function TooltipGroup<T extends ElementType = "div">(
|
|
@@ -920,19 +1174,42 @@ export declare function TooltipGroup<T extends ElementType = "div">(
|
|
|
920
1174
|
export declare interface TooltipGroupProps<
|
|
921
1175
|
T extends React.ElementType = "div",
|
|
922
1176
|
> {
|
|
923
|
-
/**
|
|
1177
|
+
/**
|
|
1178
|
+
* HTML element to render.
|
|
1179
|
+
*/
|
|
924
1180
|
as?: T;
|
|
925
1181
|
}
|
|
926
1182
|
|
|
927
|
-
/** @
|
|
1183
|
+
/** @beta */
|
|
928
1184
|
export declare interface TooltipProps
|
|
929
|
-
extends
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
/**
|
|
933
|
-
|
|
1185
|
+
extends
|
|
1186
|
+
Omit<React.ComponentProps<"div">, "children" | "content">,
|
|
1187
|
+
PlacementProps {
|
|
1188
|
+
/**
|
|
1189
|
+
* Shared anchor identifier.
|
|
1190
|
+
*/
|
|
1191
|
+
anchorName?: React.ReactNode;
|
|
1192
|
+
/**
|
|
1193
|
+
* The trigger element.
|
|
1194
|
+
*/
|
|
1195
|
+
children: React.ReactElement<Record<string, unknown>>;
|
|
1196
|
+
/**
|
|
1197
|
+
* The tooltip label.
|
|
1198
|
+
*/
|
|
1199
|
+
content?: React.ReactNode;
|
|
1200
|
+
/**
|
|
1201
|
+
* Renders the label into `document.body` through a React portal instead of inline.
|
|
1202
|
+
*/
|
|
1203
|
+
portal?: boolean;
|
|
934
1204
|
}
|
|
935
1205
|
|
|
1206
|
+
declare function TooltipRoot({
|
|
1207
|
+
placement,
|
|
1208
|
+
...props
|
|
1209
|
+
}: TooltipProps & {
|
|
1210
|
+
triggerProps?: Record<string, unknown>;
|
|
1211
|
+
}): JSX.Element;
|
|
1212
|
+
|
|
936
1213
|
/** @public */
|
|
937
1214
|
export declare interface TypographyProps extends MarginProps, ToneProps {
|
|
938
1215
|
/** CSS **text-align** property */
|
|
@@ -947,6 +1224,9 @@ export declare interface TypographyProps extends MarginProps, ToneProps {
|
|
|
947
1224
|
weight?: FontWeight;
|
|
948
1225
|
}
|
|
949
1226
|
|
|
1227
|
+
/** @public */
|
|
1228
|
+
export declare function useIsClient(): boolean;
|
|
1229
|
+
|
|
950
1230
|
/** @public */
|
|
951
1231
|
export declare function VisuallyHidden<T extends ElementType = "span">(
|
|
952
1232
|
props: VisuallyHiddenProps<T> &
|
|
@@ -957,9 +1237,13 @@ export declare function VisuallyHidden<T extends ElementType = "span">(
|
|
|
957
1237
|
export declare interface VisuallyHiddenProps<
|
|
958
1238
|
T extends React.ElementType = "span",
|
|
959
1239
|
> {
|
|
960
|
-
/**
|
|
1240
|
+
/**
|
|
1241
|
+
* HTML element to render.
|
|
1242
|
+
*/
|
|
961
1243
|
as?: T;
|
|
962
|
-
/**
|
|
1244
|
+
/**
|
|
1245
|
+
* If true, the element becomes visible on `:focus-visible`.
|
|
1246
|
+
*/
|
|
963
1247
|
visibleOnFocus?: boolean;
|
|
964
1248
|
}
|
|
965
1249
|
|
|
@@ -972,7 +1256,9 @@ export declare function VStack<T extends ElementType = "div">(
|
|
|
972
1256
|
export declare interface VStackProps<
|
|
973
1257
|
T extends React.ElementType = "div",
|
|
974
1258
|
> extends Pick<GapProps, "gap"> {
|
|
975
|
-
/**
|
|
1259
|
+
/**
|
|
1260
|
+
* HTML element or component to render.
|
|
1261
|
+
*/
|
|
976
1262
|
as?: T;
|
|
977
1263
|
}
|
|
978
1264
|
|