@sanity/ui 5.0.0-alpha.7 → 5.0.0-alpha.8
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 +248 -79
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- package/src/cli/install.ts +2 -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 +2 -1
- 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 +1 -1
- package/src/components/dialog/dialog.props.ts +13 -4
- package/src/components/eyebrow/eyebrow.props.ts +6 -2
- package/src/components/flex/flex.props.ts +6 -2
- package/src/components/grid/grid.props.ts +6 -2
- package/src/components/h-stack/hStack.props.ts +3 -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/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.props.ts +14 -4
- package/src/components/press-area/pressArea.props.ts +3 -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.props.ts +7 -2
- package/src/components/text/text.props.ts +6 -2
- package/src/components/tooltip/tooltip.props.ts +12 -4
- 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/version.ts +2 -2
package/README.md
CHANGED
package/dist/cli/install.js
CHANGED
|
@@ -23,7 +23,8 @@ function exactFromRange(range) {
|
|
|
23
23
|
*
|
|
24
24
|
* Icons is already a dependency, so the package manager installs it either way.
|
|
25
25
|
* It is listed explicitly because apps import icons directly to pass to
|
|
26
|
-
* components (
|
|
26
|
+
* components (`import {AddIcon} from '@sanity/icons/Add'`, then
|
|
27
|
+
* `<Button iconStart={AddIcon} />`), and under pnpm an import that
|
|
27
28
|
* isn't in the app's own package.json doesn't resolve. Dependencies the app
|
|
28
29
|
* never imports itself (react-refractor, clsx) are left to the package manager.
|
|
29
30
|
* React/react-dom are peers that belong to the host app, so they are left out
|
package/dist/index.d.ts
CHANGED
|
@@ -44,9 +44,14 @@ export declare function Box<T extends ElementType = "div">({
|
|
|
44
44
|
export declare interface BoxProps<
|
|
45
45
|
T extends React.ElementType = "div",
|
|
46
46
|
> extends LayoutProps {
|
|
47
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* HTML element or component to render.
|
|
49
|
+
*/
|
|
48
50
|
as?: T;
|
|
49
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* CSS `display` property.
|
|
53
|
+
* @remarks Does not include `'flex'` or `'grid'`. Use the Flex or Grid components for those.
|
|
54
|
+
*/
|
|
50
55
|
display?: Responsive<DisplayBlock>;
|
|
51
56
|
}
|
|
52
57
|
|
|
@@ -71,23 +76,41 @@ declare type ButtonLevel = (typeof BUTTON_LEVEL)[number];
|
|
|
71
76
|
|
|
72
77
|
/** @public */
|
|
73
78
|
export declare interface ButtonProps<T extends React.ElementType = "button"> {
|
|
74
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* HTML element to render.
|
|
81
|
+
*/
|
|
75
82
|
as?: InteractiveAs<T>;
|
|
76
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* Sets padding and gap together to specify size.
|
|
85
|
+
*/
|
|
77
86
|
density?: ButtonDensity;
|
|
78
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* Sets Button to fill the width of its container.
|
|
89
|
+
*/
|
|
79
90
|
fullWidth?: Responsive<boolean>;
|
|
80
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* Shows an icon in the start position (left side in left-to-right languages).
|
|
93
|
+
*/
|
|
81
94
|
iconStart?: React.ElementType | React.ReactNode;
|
|
82
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* Shows an icon in the end position (right side in left-to-right languages).
|
|
97
|
+
*/
|
|
83
98
|
iconEnd?: React.ElementType | React.ReactNode;
|
|
84
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* Sets the importance of Button's action.
|
|
101
|
+
*/
|
|
85
102
|
level?: ButtonLevel;
|
|
86
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* Places Button into a loading state.
|
|
105
|
+
*/
|
|
87
106
|
loading?: boolean;
|
|
88
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* Sets Button's text label.
|
|
109
|
+
*/
|
|
89
110
|
text?: string;
|
|
90
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* Sets Button's semantic meaning and related color.
|
|
113
|
+
*/
|
|
91
114
|
tone?: ButtonTone;
|
|
92
115
|
}
|
|
93
116
|
|
|
@@ -104,9 +127,13 @@ export declare function Card<T extends ElementType = "div">({
|
|
|
104
127
|
/** @public */
|
|
105
128
|
export declare interface CardProps<T extends React.ElementType = "div">
|
|
106
129
|
extends MarginProps, ToneProps {
|
|
107
|
-
/**
|
|
130
|
+
/**
|
|
131
|
+
* HTML element or component to render.
|
|
132
|
+
*/
|
|
108
133
|
as?: T;
|
|
109
|
-
/**
|
|
134
|
+
/**
|
|
135
|
+
* Sets padding, gap, and border-radius together to specify size. This prop is used in place of separate `padding`, `gap`, and `border-radius` props.
|
|
136
|
+
*/
|
|
110
137
|
density?: Responsive<Density>;
|
|
111
138
|
}
|
|
112
139
|
|
|
@@ -116,11 +143,19 @@ export declare function Checkbox(props: CheckboxProps): JSX.Element;
|
|
|
116
143
|
/** @beta */
|
|
117
144
|
export declare interface CheckboxProps
|
|
118
145
|
extends React.ComponentProps<"input">, MarginProps {
|
|
119
|
-
/**
|
|
146
|
+
/**
|
|
147
|
+
* Applies error styling to the checkbox mark.
|
|
148
|
+
* @remarks Use when form validation fails. Pair with a visible error message. The prop is visual only.
|
|
149
|
+
*/
|
|
120
150
|
error?: boolean;
|
|
121
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* Renders the "mixed state" mark (a horizontal line).
|
|
153
|
+
* @remarks Use when the checkbox controls a group with some-but-not-all children checked.
|
|
154
|
+
*/
|
|
122
155
|
indeterminate?: boolean;
|
|
123
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* Visible label next to the checkbox.
|
|
158
|
+
*/
|
|
124
159
|
label: React.ReactNode;
|
|
125
160
|
}
|
|
126
161
|
|
|
@@ -140,11 +175,18 @@ export declare interface CodeProps<T extends CodeTag = "pre"> extends Omit<
|
|
|
140
175
|
TypographyProps,
|
|
141
176
|
"align" | "truncate" | "tone"
|
|
142
177
|
> {
|
|
143
|
-
/**
|
|
178
|
+
/**
|
|
179
|
+
* HTML element or component to render.
|
|
180
|
+
* @remarks The defined element wraps an inner `<code>` tag.
|
|
181
|
+
*/
|
|
144
182
|
as?: T;
|
|
145
|
-
/**
|
|
183
|
+
/**
|
|
184
|
+
* Refractor language for syntax highlighting.
|
|
185
|
+
*/
|
|
146
186
|
language?: string;
|
|
147
|
-
/**
|
|
187
|
+
/**
|
|
188
|
+
* Sets font size.
|
|
189
|
+
*/
|
|
148
190
|
size?: Responsive<CodeSize>;
|
|
149
191
|
}
|
|
150
192
|
|
|
@@ -166,9 +208,13 @@ declare const CONTAINER_SIZE: readonly [0, 1, 2, 3, 4, 5];
|
|
|
166
208
|
export declare interface ContainerProps<
|
|
167
209
|
T extends React.ElementType = "div",
|
|
168
210
|
> extends LayoutProps {
|
|
169
|
-
/**
|
|
211
|
+
/**
|
|
212
|
+
* HTML element or component to render.
|
|
213
|
+
*/
|
|
170
214
|
as?: T;
|
|
171
|
-
/**
|
|
215
|
+
/**
|
|
216
|
+
* Maximum width of the container.
|
|
217
|
+
*/
|
|
172
218
|
size?: Responsive<ContainerSize>;
|
|
173
219
|
}
|
|
174
220
|
|
|
@@ -203,13 +249,22 @@ export declare interface DialogProps extends Omit<
|
|
|
203
249
|
React.ComponentProps<"dialog">,
|
|
204
250
|
"open"
|
|
205
251
|
> {
|
|
206
|
-
/**
|
|
252
|
+
/**
|
|
253
|
+
* Text for the dialog heading.
|
|
254
|
+
* @remarks Recommended for accessibility. The component sets `aria-labelledby` to the heading when you give this prop.
|
|
255
|
+
*/
|
|
207
256
|
header?: string;
|
|
208
|
-
/**
|
|
257
|
+
/**
|
|
258
|
+
* A function to call alongside the native `close` event.
|
|
259
|
+
* @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.
|
|
260
|
+
*/
|
|
209
261
|
onClose: React.ReactEventHandler<HTMLDialogElement>;
|
|
210
|
-
/**
|
|
262
|
+
/**
|
|
263
|
+
* Toggles the dialog's open state.
|
|
264
|
+
* @remarks `true` calls `showModal()` on the element. `false` calls `close()`.
|
|
265
|
+
*/
|
|
211
266
|
open?: boolean;
|
|
212
|
-
/**
|
|
267
|
+
/** Sets the max width of the dialog */
|
|
213
268
|
size?: Responsive<ContainerSize>;
|
|
214
269
|
}
|
|
215
270
|
|
|
@@ -257,9 +312,13 @@ declare const EYEBROW_SIZE: readonly [0, 1, 2, 3, 4];
|
|
|
257
312
|
export declare interface EyebrowProps<
|
|
258
313
|
T extends React.ElementType = "span",
|
|
259
314
|
> extends TypographyProps {
|
|
260
|
-
/**
|
|
315
|
+
/**
|
|
316
|
+
* HTML element to render.
|
|
317
|
+
*/
|
|
261
318
|
as?: T;
|
|
262
|
-
/**
|
|
319
|
+
/**
|
|
320
|
+
* Sets font size. Uses the same scale as Label.
|
|
321
|
+
*/
|
|
263
322
|
size?: Responsive<EyebrowSize>;
|
|
264
323
|
}
|
|
265
324
|
|
|
@@ -311,9 +370,13 @@ export declare type FlexParentProps = {
|
|
|
311
370
|
/** @public */
|
|
312
371
|
export declare interface FlexProps<T extends React.ElementType = "div">
|
|
313
372
|
extends FlexParentProps, GapProps, LayoutProps {
|
|
314
|
-
/**
|
|
373
|
+
/**
|
|
374
|
+
* HTML element or component to render.
|
|
375
|
+
*/
|
|
315
376
|
as?: T;
|
|
316
|
-
/**
|
|
377
|
+
/**
|
|
378
|
+
* CSS `display` property.
|
|
379
|
+
*/
|
|
317
380
|
display?: Responsive<DisplayFlex>;
|
|
318
381
|
}
|
|
319
382
|
|
|
@@ -387,9 +450,13 @@ export declare type GridParentProps = {
|
|
|
387
450
|
/** @public */
|
|
388
451
|
export declare interface GridProps<T extends React.ElementType = "div">
|
|
389
452
|
extends GridParentProps, GapProps, LayoutProps {
|
|
390
|
-
/**
|
|
453
|
+
/**
|
|
454
|
+
* HTML element or component to render.
|
|
455
|
+
*/
|
|
391
456
|
as?: T;
|
|
392
|
-
/**
|
|
457
|
+
/**
|
|
458
|
+
* CSS `display` property.
|
|
459
|
+
*/
|
|
393
460
|
display?: Responsive<DisplayGrid>;
|
|
394
461
|
}
|
|
395
462
|
|
|
@@ -407,9 +474,15 @@ declare const HEADING_TAG: readonly ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
|
407
474
|
|
|
408
475
|
/** @public */
|
|
409
476
|
export declare interface HeadingProps extends TypographyProps {
|
|
410
|
-
/**
|
|
477
|
+
/**
|
|
478
|
+
* Semantic heading element to render.
|
|
479
|
+
* @remarks Always set this explicitly.
|
|
480
|
+
*/
|
|
411
481
|
as?: HeadingTag;
|
|
412
|
-
/**
|
|
482
|
+
/**
|
|
483
|
+
* Sets font size.
|
|
484
|
+
* @remarks Independent of `as`.
|
|
485
|
+
*/
|
|
413
486
|
size?: Responsive<HeadingSize>;
|
|
414
487
|
}
|
|
415
488
|
|
|
@@ -436,7 +509,9 @@ export declare function HStack<T extends ElementType = "div">(
|
|
|
436
509
|
export declare interface HStackProps<
|
|
437
510
|
T extends React.ElementType = "div",
|
|
438
511
|
> extends Pick<GapProps, "gap"> {
|
|
439
|
-
/**
|
|
512
|
+
/**
|
|
513
|
+
* HTML element or component to render.
|
|
514
|
+
*/
|
|
440
515
|
as?: T;
|
|
441
516
|
}
|
|
442
517
|
|
|
@@ -458,9 +533,14 @@ export declare interface IconButtonProps<
|
|
|
458
533
|
ButtonProps<T>,
|
|
459
534
|
"as" | "density" | "level" | "loading" | "tone"
|
|
460
535
|
> {
|
|
461
|
-
/**
|
|
536
|
+
/**
|
|
537
|
+
* Accessible name for the button.
|
|
538
|
+
* @remarks Because IconButtons have no visible text, this is required.
|
|
539
|
+
*/
|
|
462
540
|
"aria-label": string;
|
|
463
|
-
/**
|
|
541
|
+
/**
|
|
542
|
+
* Icon to render.
|
|
543
|
+
*/
|
|
464
544
|
icon: React_2.ComponentType<SVGProps<SVGSVGElement>>;
|
|
465
545
|
}
|
|
466
546
|
|
|
@@ -471,9 +551,13 @@ export declare interface IconProps
|
|
|
471
551
|
Pick<TypographyProps, "muted">,
|
|
472
552
|
MarginProps,
|
|
473
553
|
ToneProps {
|
|
474
|
-
/**
|
|
554
|
+
/**
|
|
555
|
+
* The icon component to render.
|
|
556
|
+
*/
|
|
475
557
|
icon: React.ComponentType<SVGProps<SVGSVGElement>>;
|
|
476
|
-
/**
|
|
558
|
+
/**
|
|
559
|
+
* Sets icon size.
|
|
560
|
+
*/
|
|
477
561
|
size?: Responsive<IconSize>;
|
|
478
562
|
}
|
|
479
563
|
|
|
@@ -491,9 +575,13 @@ export declare function Indicator<T extends ElementType = "span">({
|
|
|
491
575
|
export declare interface IndicatorProps<
|
|
492
576
|
T extends React.ElementType = "span",
|
|
493
577
|
> extends ToneProps {
|
|
494
|
-
/**
|
|
578
|
+
/**
|
|
579
|
+
* HTML element to render.
|
|
580
|
+
*/
|
|
495
581
|
as?: T;
|
|
496
|
-
/**
|
|
582
|
+
/**
|
|
583
|
+
* Accessible label.
|
|
584
|
+
*/
|
|
497
585
|
label?: string;
|
|
498
586
|
}
|
|
499
587
|
|
|
@@ -507,7 +595,9 @@ export declare function IndicatorStack<T extends ElementType = "div">(
|
|
|
507
595
|
export declare interface IndicatorStackProps<
|
|
508
596
|
T extends React.ElementType = "div",
|
|
509
597
|
> {
|
|
510
|
-
/**
|
|
598
|
+
/**
|
|
599
|
+
* HTML element to render.
|
|
600
|
+
*/
|
|
511
601
|
as?: T;
|
|
512
602
|
}
|
|
513
603
|
|
|
@@ -522,9 +612,13 @@ export declare function Inline<T extends ElementType = "div">(
|
|
|
522
612
|
export declare interface InlineProps<
|
|
523
613
|
T extends React.ElementType = "div",
|
|
524
614
|
> extends PaddingProps {
|
|
525
|
-
/**
|
|
615
|
+
/**
|
|
616
|
+
* HTML element or component to render.
|
|
617
|
+
*/
|
|
526
618
|
as?: T;
|
|
527
|
-
/**
|
|
619
|
+
/**
|
|
620
|
+
* Space between children.
|
|
621
|
+
*/
|
|
528
622
|
gap?: Responsive<SpaceInherit>;
|
|
529
623
|
}
|
|
530
624
|
|
|
@@ -553,8 +647,14 @@ export declare function Label(props: LabelProps): JSX.Element;
|
|
|
553
647
|
/** @beta */
|
|
554
648
|
export declare interface LabelProps
|
|
555
649
|
extends React.ComponentProps<"label">, MarginProps {
|
|
556
|
-
/**
|
|
650
|
+
/**
|
|
651
|
+
* Renders the label in a muted color.
|
|
652
|
+
*/
|
|
557
653
|
disabled?: boolean;
|
|
654
|
+
/**
|
|
655
|
+
* Renders the label in the error color.
|
|
656
|
+
* @remarks Use when the linked input has a validation error.
|
|
657
|
+
*/
|
|
558
658
|
error?: boolean;
|
|
559
659
|
}
|
|
560
660
|
|
|
@@ -579,12 +679,12 @@ export declare function Link({ underlined, ...props }: LinkProps): JSX.Element;
|
|
|
579
679
|
|
|
580
680
|
/** @beta */
|
|
581
681
|
export declare interface LinkProps extends React.ComponentProps<"a"> {
|
|
582
|
-
/**
|
|
682
|
+
/**
|
|
683
|
+
* Sets the link to `target="_blank"` and `rel="noopener noreferrer"`.
|
|
684
|
+
*/
|
|
583
685
|
openInNewTab?: boolean;
|
|
584
686
|
/**
|
|
585
|
-
*
|
|
586
|
-
*
|
|
587
|
-
* @defaultValue true
|
|
687
|
+
* Underlines the link.
|
|
588
688
|
*/
|
|
589
689
|
underlined?: boolean;
|
|
590
690
|
}
|
|
@@ -604,9 +704,13 @@ declare function ListButtonItem<T extends ElementType = "button">({
|
|
|
604
704
|
export declare interface ListButtonItemProps<
|
|
605
705
|
T extends React_2.ElementType = "button",
|
|
606
706
|
> extends ListItemProps {
|
|
607
|
-
/**
|
|
707
|
+
/**
|
|
708
|
+
* Element or component to render for the press target.
|
|
709
|
+
*/
|
|
608
710
|
as?: InteractiveAs<T>;
|
|
609
|
-
/**
|
|
711
|
+
/**
|
|
712
|
+
* Marks the row as the current selection.
|
|
713
|
+
*/
|
|
610
714
|
selected?: boolean;
|
|
611
715
|
}
|
|
612
716
|
|
|
@@ -616,11 +720,17 @@ declare function ListItemImage(props: ComponentProps<"img">): JSX.Element;
|
|
|
616
720
|
|
|
617
721
|
/** @beta */
|
|
618
722
|
export declare interface ListItemProps extends React_2.ComponentProps<"li"> {
|
|
619
|
-
/**
|
|
723
|
+
/**
|
|
724
|
+
* Sets horizontal padding, gap, and minimum row height together.
|
|
725
|
+
*/
|
|
620
726
|
density?: Responsive<Density>;
|
|
621
|
-
/**
|
|
727
|
+
/**
|
|
728
|
+
* Slot at the left edge of the row.
|
|
729
|
+
*/
|
|
622
730
|
start?: React_2.ReactNode;
|
|
623
|
-
/**
|
|
731
|
+
/**
|
|
732
|
+
* Slot at the right edge of the row.
|
|
733
|
+
*/
|
|
624
734
|
end?: React_2.ReactNode;
|
|
625
735
|
}
|
|
626
736
|
|
|
@@ -633,11 +743,17 @@ declare function ListItemText<T extends ElementType = "div">(
|
|
|
633
743
|
export declare interface ListItemTextProps<
|
|
634
744
|
T extends React_2.ElementType = "div",
|
|
635
745
|
> {
|
|
636
|
-
/**
|
|
746
|
+
/**
|
|
747
|
+
* HTML element to render.
|
|
748
|
+
*/
|
|
637
749
|
as?: T;
|
|
638
|
-
/**
|
|
750
|
+
/**
|
|
751
|
+
* Main label.
|
|
752
|
+
*/
|
|
639
753
|
title?: React_2.ReactNode;
|
|
640
|
-
/**
|
|
754
|
+
/**
|
|
755
|
+
* Text below the title.
|
|
756
|
+
*/
|
|
641
757
|
subtitle?: React_2.ReactNode;
|
|
642
758
|
}
|
|
643
759
|
|
|
@@ -646,7 +762,9 @@ export declare interface ListProps<T extends ListTag = "ul"> extends Pick<
|
|
|
646
762
|
GapProps,
|
|
647
763
|
"gap"
|
|
648
764
|
> {
|
|
649
|
-
/**
|
|
765
|
+
/**
|
|
766
|
+
* HTML element to render.
|
|
767
|
+
*/
|
|
650
768
|
as?: T;
|
|
651
769
|
}
|
|
652
770
|
|
|
@@ -754,13 +872,23 @@ export declare interface PopoverProps
|
|
|
754
872
|
extends
|
|
755
873
|
Omit<React.ComponentProps<"div">, "children" | "content">,
|
|
756
874
|
PlacementProps {
|
|
757
|
-
/**
|
|
875
|
+
/**
|
|
876
|
+
* Shared anchor identifier.
|
|
877
|
+
* @remarks Set the same value on a Tooltip and a Popover to point both at one trigger.
|
|
878
|
+
*/
|
|
758
879
|
anchorName?: React.ReactNode;
|
|
759
|
-
/**
|
|
880
|
+
/**
|
|
881
|
+
* The trigger element.
|
|
882
|
+
* @remarks Popover clones it and attaches the `popovertarget` attribute that opens the floating layer.
|
|
883
|
+
*/
|
|
760
884
|
children: React.ReactElement<Record<string, unknown>>;
|
|
761
|
-
/**
|
|
885
|
+
/**
|
|
886
|
+
* The floating content.
|
|
887
|
+
*/
|
|
762
888
|
content?: React.ReactNode;
|
|
763
|
-
/**
|
|
889
|
+
/**
|
|
890
|
+
* Renders the content into `document.body` through a React portal instead of inline.
|
|
891
|
+
*/
|
|
764
892
|
portal?: boolean;
|
|
765
893
|
}
|
|
766
894
|
|
|
@@ -807,7 +935,9 @@ export declare function PressArea<T extends ElementType = "button">(
|
|
|
807
935
|
export declare interface PressAreaProps<
|
|
808
936
|
T extends React.ElementType = "button",
|
|
809
937
|
> {
|
|
810
|
-
/**
|
|
938
|
+
/**
|
|
939
|
+
* Element or component to render.
|
|
940
|
+
*/
|
|
811
941
|
as?: InteractiveAs<T>;
|
|
812
942
|
}
|
|
813
943
|
|
|
@@ -817,9 +947,14 @@ export declare function Radio(props: RadioProps): JSX.Element;
|
|
|
817
947
|
/** @beta */
|
|
818
948
|
export declare interface RadioProps
|
|
819
949
|
extends React.ComponentProps<"input">, MarginProps {
|
|
820
|
-
/**
|
|
950
|
+
/**
|
|
951
|
+
* Applies error styling to the radio mark.
|
|
952
|
+
* @remarks Use when form validation fails. Pair with a visible error message. The prop is visual only.
|
|
953
|
+
*/
|
|
821
954
|
error?: boolean;
|
|
822
|
-
/**
|
|
955
|
+
/**
|
|
956
|
+
* Visible label next to the radio.
|
|
957
|
+
*/
|
|
823
958
|
label: React.ReactNode;
|
|
824
959
|
}
|
|
825
960
|
|
|
@@ -867,12 +1002,18 @@ export declare function SkipToContent(props: SkipToContentProps): JSX.Element;
|
|
|
867
1002
|
/** @beta */
|
|
868
1003
|
export declare interface SkipToContentProps extends React.ComponentProps<"a"> {
|
|
869
1004
|
/**
|
|
870
|
-
*
|
|
1005
|
+
* Same-page fragment to jump to.
|
|
1006
|
+
* @remarks Note: The hash character # is required for proper linking.
|
|
871
1007
|
*/
|
|
872
1008
|
href: string;
|
|
873
|
-
/**
|
|
1009
|
+
/**
|
|
1010
|
+
* Visible and announced text.
|
|
1011
|
+
*/
|
|
874
1012
|
label: string;
|
|
875
|
-
/**
|
|
1013
|
+
/**
|
|
1014
|
+
* Not accepted.
|
|
1015
|
+
* @remarks Pass text via `label`.
|
|
1016
|
+
*/
|
|
876
1017
|
children?: never;
|
|
877
1018
|
}
|
|
878
1019
|
|
|
@@ -922,6 +1063,9 @@ export declare function Spinner({ size, ...props }: SpinnerProps): JSX.Element;
|
|
|
922
1063
|
|
|
923
1064
|
/** @public */
|
|
924
1065
|
export declare interface SpinnerProps extends React.ComponentProps<"svg"> {
|
|
1066
|
+
/**
|
|
1067
|
+
* Size of the spinner icon.
|
|
1068
|
+
*/
|
|
925
1069
|
size?: Responsive<IconSize>;
|
|
926
1070
|
}
|
|
927
1071
|
|
|
@@ -931,9 +1075,14 @@ export declare function Switch(props: SwitchProps): JSX.Element;
|
|
|
931
1075
|
/** @beta */
|
|
932
1076
|
export declare interface SwitchProps
|
|
933
1077
|
extends React.ComponentProps<"input">, MarginProps {
|
|
934
|
-
/**
|
|
1078
|
+
/**
|
|
1079
|
+
* Applies error styling to the switch track.
|
|
1080
|
+
* @remarks Use when form validation fails. Pair with a visible error message. The prop is visual only.
|
|
1081
|
+
*/
|
|
935
1082
|
error?: boolean;
|
|
936
|
-
/**
|
|
1083
|
+
/**
|
|
1084
|
+
* Visible label next to the switch.
|
|
1085
|
+
*/
|
|
937
1086
|
label: React.ReactNode;
|
|
938
1087
|
}
|
|
939
1088
|
|
|
@@ -956,9 +1105,13 @@ export declare type TextAlign = (typeof TEXT_ALIGN)[number];
|
|
|
956
1105
|
export declare interface TextProps<
|
|
957
1106
|
T extends React.ElementType = "span",
|
|
958
1107
|
> extends TypographyProps {
|
|
959
|
-
/**
|
|
1108
|
+
/**
|
|
1109
|
+
* HTML element to render.
|
|
1110
|
+
*/
|
|
960
1111
|
as?: T;
|
|
961
|
-
/**
|
|
1112
|
+
/**
|
|
1113
|
+
* Sets font size.
|
|
1114
|
+
*/
|
|
962
1115
|
size?: Responsive<TextSize>;
|
|
963
1116
|
}
|
|
964
1117
|
|
|
@@ -994,7 +1147,9 @@ export declare function TooltipGroup<T extends ElementType = "div">(
|
|
|
994
1147
|
export declare interface TooltipGroupProps<
|
|
995
1148
|
T extends React.ElementType = "div",
|
|
996
1149
|
> {
|
|
997
|
-
/**
|
|
1150
|
+
/**
|
|
1151
|
+
* HTML element to render.
|
|
1152
|
+
*/
|
|
998
1153
|
as?: T;
|
|
999
1154
|
}
|
|
1000
1155
|
|
|
@@ -1003,13 +1158,21 @@ export declare interface TooltipProps
|
|
|
1003
1158
|
extends
|
|
1004
1159
|
Omit<React.ComponentProps<"div">, "children" | "content">,
|
|
1005
1160
|
PlacementProps {
|
|
1006
|
-
/**
|
|
1161
|
+
/**
|
|
1162
|
+
* Shared anchor identifier.
|
|
1163
|
+
*/
|
|
1007
1164
|
anchorName?: React.ReactNode;
|
|
1008
|
-
/**
|
|
1165
|
+
/**
|
|
1166
|
+
* The trigger element.
|
|
1167
|
+
*/
|
|
1009
1168
|
children: React.ReactElement<Record<string, unknown>>;
|
|
1010
|
-
/**
|
|
1169
|
+
/**
|
|
1170
|
+
* The tooltip label.
|
|
1171
|
+
*/
|
|
1011
1172
|
content?: React.ReactNode;
|
|
1012
|
-
/**
|
|
1173
|
+
/**
|
|
1174
|
+
* Renders the label into `document.body` through a React portal instead of inline.
|
|
1175
|
+
*/
|
|
1013
1176
|
portal?: boolean;
|
|
1014
1177
|
}
|
|
1015
1178
|
|
|
@@ -1047,9 +1210,13 @@ export declare function VisuallyHidden<T extends ElementType = "span">(
|
|
|
1047
1210
|
export declare interface VisuallyHiddenProps<
|
|
1048
1211
|
T extends React.ElementType = "span",
|
|
1049
1212
|
> {
|
|
1050
|
-
/**
|
|
1213
|
+
/**
|
|
1214
|
+
* HTML element to render.
|
|
1215
|
+
*/
|
|
1051
1216
|
as?: T;
|
|
1052
|
-
/**
|
|
1217
|
+
/**
|
|
1218
|
+
* If true, the element becomes visible on `:focus-visible`.
|
|
1219
|
+
*/
|
|
1053
1220
|
visibleOnFocus?: boolean;
|
|
1054
1221
|
}
|
|
1055
1222
|
|
|
@@ -1062,7 +1229,9 @@ export declare function VStack<T extends ElementType = "div">(
|
|
|
1062
1229
|
export declare interface VStackProps<
|
|
1063
1230
|
T extends React.ElementType = "div",
|
|
1064
1231
|
> extends Pick<GapProps, "gap"> {
|
|
1065
|
-
/**
|
|
1232
|
+
/**
|
|
1233
|
+
* HTML element or component to render.
|
|
1234
|
+
*/
|
|
1066
1235
|
as?: T;
|
|
1067
1236
|
}
|
|
1068
1237
|
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,10 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
4
|
import clsx from "clsx";
|
|
5
5
|
import { isValidElement, useRef, useEffect, lazy, Suspense, useId, Children, useSyncExternalStore, useState, cloneElement, Activity } from "react";
|
|
6
|
-
import { SpinnerIcon
|
|
6
|
+
import { SpinnerIcon } from "@sanity/icons/Spinner";
|
|
7
|
+
import { CheckmarkIcon } from "@sanity/icons/Checkmark";
|
|
8
|
+
import { RemoveIcon } from "@sanity/icons/Remove";
|
|
9
|
+
import { CloseIcon } from "@sanity/icons/Close";
|
|
7
10
|
import { createPortal } from "react-dom";
|
|
8
11
|
const PREFIX = "sui", BREAKPOINTS_LENGTH = 6;
|
|
9
12
|
function getProps(componentProps, propDefs) {
|
|
@@ -96,7 +99,7 @@ function getCompositeValue(propValue, propDef, key) {
|
|
|
96
99
|
compositeValue = mapping?.[propValue];
|
|
97
100
|
return compositeValue;
|
|
98
101
|
}
|
|
99
|
-
const HASH = "
|
|
102
|
+
const HASH = "ff7a34";
|
|
100
103
|
function suffixClassName(className) {
|
|
101
104
|
return `${className}-${HASH}`;
|
|
102
105
|
}
|