@sanity/ui 2.11.10 → 2.12.0-canary.1

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.
@@ -0,0 +1,993 @@
1
+ import {BaseTheme} from '@sanity/ui/theme'
2
+ import {DetailedHTMLProps} from 'react'
3
+ import {FastOmit} from 'styled-components'
4
+ import {ForwardRefExoticComponent} from 'react'
5
+ import {HTMLAttributes} from 'react'
6
+ import {HTMLProps} from 'react'
7
+ import {IStyledComponentBase} from 'styled-components/dist/types'
8
+ import {MutableRefObject} from 'react'
9
+ import {NamedExoticComponent} from 'react'
10
+ import {RefAttributes} from 'react'
11
+ import {RefCallback} from 'react'
12
+ import {RootTheme} from '@sanity/ui/theme'
13
+ import {Theme_v2} from '@sanity/ui/theme'
14
+ import {ThemeColorButtonModeKey} from '@sanity/ui/theme'
15
+ import {ThemeColorCardToneKey} from '@sanity/ui/theme'
16
+ import {ThemeColorSchemeKey} from '@sanity/ui/theme'
17
+ import {ThemeColorStateToneKey} from '@sanity/ui/theme'
18
+ import {ThemeFontWeightKey} from '@sanity/ui/theme'
19
+
20
+ /**
21
+ * The `Box` component is a basic layout wrapper component which provides utility properties
22
+ * for flex, margins and padding.
23
+ *
24
+ * @public
25
+ */
26
+ export declare const Box: ForwardRefExoticComponent<
27
+ Omit<BoxProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'as'>, 'ref'> &
28
+ RefAttributes<HTMLDivElement>
29
+ >
30
+
31
+ /**
32
+ * @public
33
+ */
34
+ declare type BoxDisplay = 'none' | 'block' | 'grid' | 'flex' | 'inline-block'
35
+
36
+ /**
37
+ * @public
38
+ */
39
+ declare type BoxHeight = 'stretch' | 'fill'
40
+
41
+ /**
42
+ * @public
43
+ */
44
+ declare type BoxOverflow = 'visible' | 'hidden' | 'auto'
45
+
46
+ /**
47
+ * @public
48
+ */
49
+ declare interface BoxProps
50
+ extends ResponsiveFlexItemProps,
51
+ ResponsiveBoxProps,
52
+ ResponsiveGridItemProps,
53
+ ResponsiveMarginProps,
54
+ ResponsivePaddingProps {
55
+ as?: React.ElementType | keyof React.JSX.IntrinsicElements
56
+ forwardedAs?: React.ElementType | keyof React.JSX.IntrinsicElements
57
+ }
58
+
59
+ /**
60
+ * @public
61
+ */
62
+ declare type BoxSizing = 'content' | 'border'
63
+
64
+ /**
65
+ * @public
66
+ */
67
+ export declare const Button: ForwardRefExoticComponent<
68
+ Omit<ButtonProps & Omit<HTMLProps<HTMLButtonElement>, 'width' | 'as'>, 'ref'> &
69
+ RefAttributes<HTMLButtonElement>
70
+ >
71
+
72
+ /**
73
+ * @public
74
+ */
75
+ declare type ButtonMode = ThemeColorButtonModeKey
76
+
77
+ /**
78
+ * @public
79
+ */
80
+ declare interface ButtonProps extends ResponsivePaddingProps, ResponsiveRadiusProps {
81
+ as?: React.ElementType | keyof React.JSX.IntrinsicElements
82
+ fontSize?: number | number[]
83
+ mode?: ButtonMode
84
+ icon?: React.ElementType | React.ReactNode
85
+ iconRight?: React.ElementType | React.ReactNode
86
+ justify?: FlexJustify | FlexJustify[]
87
+ /**
88
+ * @beta Do not use in production, as this might change.
89
+ */
90
+ loading?: boolean
91
+ selected?: boolean
92
+ space?: number | number[]
93
+ textAlign?: ButtonTextAlign
94
+ muted?: boolean
95
+ text?: React.ReactNode
96
+ tone?: ButtonTone
97
+ type?: 'button' | 'reset' | 'submit'
98
+ width?: ButtonWidth
99
+ }
100
+
101
+ /**
102
+ * @public
103
+ */
104
+ declare type ButtonTextAlign = 'left' | 'right' | 'center'
105
+
106
+ /**
107
+ * @public
108
+ */
109
+ declare type ButtonTone = ThemeColorStateToneKey
110
+
111
+ /**
112
+ * @public
113
+ */
114
+ declare type ButtonWidth = 'fill'
115
+
116
+ /**
117
+ * The `Card` component acts much like a `Box`, but with a background and foreground color.
118
+ * Components within a `Card` inherit its colors.
119
+ *
120
+ * @public
121
+ */
122
+ export declare const Card: ForwardRefExoticComponent<
123
+ Omit<CardProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'as'>, 'ref'> &
124
+ RefAttributes<HTMLDivElement>
125
+ >
126
+
127
+ /**
128
+ * @public
129
+ */
130
+ declare interface CardProps
131
+ extends BoxProps,
132
+ ResponsiveBorderProps,
133
+ ResponsiveRadiusProps,
134
+ ResponsiveShadowProps {
135
+ /**
136
+ * Do not use in production.
137
+ * @beta
138
+ */
139
+ __unstable_checkered?: boolean
140
+ /**
141
+ * Do not use in production.
142
+ * @beta
143
+ */
144
+ __unstable_focusRing?: boolean
145
+ muted?: boolean
146
+ pressed?: boolean
147
+ scheme?: ThemeColorSchemeKey
148
+ tone?: CardTone
149
+ }
150
+
151
+ /**
152
+ * @public
153
+ */
154
+ declare type CardTone = ThemeColorCardToneKey | 'inherit'
155
+
156
+ /**
157
+ * @public
158
+ */
159
+ declare type Delay =
160
+ | number
161
+ | Partial<{
162
+ open: number
163
+ close: number
164
+ }>
165
+
166
+ /**
167
+ * The `Flex` component is a wrapper component for flexible elements (`Box`, `Card` and `Flex`).
168
+ *
169
+ * @public
170
+ */
171
+ export declare const Flex: ForwardRefExoticComponent<
172
+ Omit<FlexProps & Omit<HTMLProps<HTMLDivElement>, 'wrap' | 'as'>, 'ref'> &
173
+ RefAttributes<HTMLDivElement>
174
+ >
175
+
176
+ /**
177
+ * @public
178
+ */
179
+ declare type FlexAlign = 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch'
180
+
181
+ /**
182
+ * @public
183
+ */
184
+ declare type FlexDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse'
185
+
186
+ /**
187
+ * @public
188
+ */
189
+ declare type FlexJustify =
190
+ | 'flex-start'
191
+ | 'flex-end'
192
+ | 'center'
193
+ | 'space-between'
194
+ | 'space-around'
195
+ | 'space-evenly'
196
+
197
+ /**
198
+ * @public
199
+ */
200
+ declare interface FlexProps
201
+ extends Omit<BoxProps, 'display'>,
202
+ ResponsiveFlexProps,
203
+ ResponsiveFlexItemProps {
204
+ gap?: number | number[]
205
+ }
206
+
207
+ /**
208
+ * @public
209
+ */
210
+ declare type FlexValue = number | 'none' | 'auto' | 'initial'
211
+
212
+ /**
213
+ * @public
214
+ */
215
+ declare type FlexWrap = 'wrap' | 'wrap-reverse' | 'nowrap'
216
+
217
+ /**
218
+ * The `Grid` component is for building 2-dimensional layers (based on CSS grid).
219
+ *
220
+ * @public
221
+ */
222
+ export declare const Grid: ForwardRefExoticComponent<
223
+ Omit<GridProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'as' | 'rows'>, 'ref'> &
224
+ RefAttributes<HTMLDivElement>
225
+ >
226
+
227
+ /**
228
+ * @public
229
+ */
230
+ declare type GridAutoCols = 'auto' | 'min' | 'max' | 'fr'
231
+
232
+ /**
233
+ * @public
234
+ */
235
+ declare type GridAutoFlow = 'row' | 'column' | 'row dense' | 'column dense'
236
+
237
+ /**
238
+ * @public
239
+ */
240
+ declare type GridAutoRows = 'auto' | 'min' | 'max' | 'fr'
241
+
242
+ /**
243
+ * @public
244
+ */
245
+ declare type GridItemColumn = 'auto' | 'full' | number
246
+
247
+ /**
248
+ * @public
249
+ */
250
+ declare type GridItemColumnEnd = 'auto' | number
251
+
252
+ /**
253
+ * @public
254
+ */
255
+ declare type GridItemColumnStart = 'auto' | number
256
+
257
+ /**
258
+ * @public
259
+ */
260
+ declare type GridItemRow = 'auto' | 'full' | number
261
+
262
+ /**
263
+ * @public
264
+ */
265
+ declare type GridItemRowEnd = 'auto' | number
266
+
267
+ /**
268
+ * @public
269
+ */
270
+ declare type GridItemRowStart = 'auto' | number
271
+
272
+ /**
273
+ * @public
274
+ */
275
+ declare interface GridProps extends Omit<BoxProps, 'display'>, ResponsiveGridProps {}
276
+
277
+ /**
278
+ * Represent hotkeys (a keyboard combination) with semantic `<kbd>` elements.
279
+ *
280
+ * @public
281
+ */
282
+ export declare const Hotkeys: ForwardRefExoticComponent<
283
+ HotkeysProps & Omit<HTMLProps<HTMLElement>, 'size' | 'ref' | 'as'> & RefAttributes<HTMLElement>
284
+ >
285
+
286
+ /**
287
+ * @public
288
+ */
289
+ declare interface HotkeysProps {
290
+ fontSize?: number | number[]
291
+ padding?: number | number[]
292
+ radius?: Radius | Radius[]
293
+ space?: number | number[]
294
+ keys?: string[]
295
+ }
296
+
297
+ /**
298
+ * @public
299
+ */
300
+ declare interface InlineProps extends Omit<BoxProps, 'display'> {
301
+ /** The spacing between children. */
302
+ space?: number | number[]
303
+ }
304
+
305
+ /**
306
+ * @internal
307
+ */
308
+ export declare function isHTMLAnchorElement(element: unknown): element is HTMLAnchorElement
309
+
310
+ /**
311
+ * @internal
312
+ */
313
+ export declare function isHTMLElement(node: unknown): node is HTMLElement
314
+
315
+ /**
316
+ * @public
317
+ */
318
+ declare interface LayerProps {
319
+ as?: React.ElementType | keyof React.JSX.IntrinsicElements
320
+ /** A callback that fires when the layer becomes the top layer when it was not the top layer before. */
321
+ onActivate?: (props: {activeElement: HTMLElement | null}) => void
322
+ zOffset?: number | number[]
323
+ }
324
+
325
+ /**
326
+ * @public
327
+ */
328
+ export declare function LayerProvider(props: LayerProviderProps): React.JSX.Element
329
+
330
+ export declare namespace LayerProvider {
331
+ var displayName: string
332
+ }
333
+
334
+ /**
335
+ * @public
336
+ */
337
+ declare interface LayerProviderProps {
338
+ children?: React.ReactNode
339
+ zOffset?: number | number[]
340
+ }
341
+
342
+ /**
343
+ * The `Menu` component is a building block for application menus.
344
+ *
345
+ * @public
346
+ */
347
+ export declare const Menu: ForwardRefExoticComponent<
348
+ Omit<MenuProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'role' | 'tabIndex' | 'as'>, 'ref'> &
349
+ RefAttributes<HTMLDivElement>
350
+ >
351
+
352
+ /**
353
+ * @public
354
+ */
355
+ export declare const MenuDivider: IStyledComponentBase<
356
+ 'web',
357
+ FastOmit<DetailedHTMLProps<HTMLAttributes<HTMLHRElement>, HTMLHRElement>, never>
358
+ > &
359
+ string
360
+
361
+ /**
362
+ * @public
363
+ */
364
+ export declare function MenuGroup(
365
+ props: Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'popover' | 'ref' | 'tabIndex'> &
366
+ MenuGroupProps,
367
+ ): React.JSX.Element
368
+
369
+ export declare namespace MenuGroup {
370
+ var displayName: string
371
+ }
372
+
373
+ /**
374
+ * @public
375
+ */
376
+ declare interface MenuGroupProps {
377
+ as?: React.ElementType | keyof React.JSX.IntrinsicElements
378
+ fontSize?: number | number[]
379
+ icon?: React.ElementType | React.ReactNode
380
+ menu?: Omit<
381
+ MenuProps,
382
+ | 'onClickOutside'
383
+ | 'onEscape'
384
+ | 'onItemClick'
385
+ | 'onKeyDown'
386
+ | 'onMouseEnter'
387
+ | 'registerElement'
388
+ | 'shouldFocus'
389
+ | 'onBlurCapture'
390
+ >
391
+ padding?: number | number[]
392
+ popover?: Omit<PopoverProps, 'content' | 'open'>
393
+ radius?: Radius | Radius[]
394
+ space?: number | number[]
395
+ text: React.ReactNode
396
+ tone?: SelectableTone
397
+ }
398
+
399
+ /**
400
+ * @public
401
+ */
402
+ export declare const MenuItem: ForwardRefExoticComponent<
403
+ MenuItemProps &
404
+ Omit<HTMLProps<HTMLDivElement>, 'selected' | 'height' | 'tabIndex' | 'ref' | 'as'> &
405
+ RefAttributes<HTMLDivElement>
406
+ >
407
+
408
+ /**
409
+ * @public
410
+ */
411
+ export declare interface MenuItemProps extends ResponsivePaddingProps, ResponsiveRadiusProps {
412
+ as?: React.ElementType | keyof React.JSX.IntrinsicElements
413
+ fontSize?: number | number[]
414
+ hotkeys?: string[]
415
+ icon?: React.ElementType | React.ReactNode
416
+ iconRight?: React.ElementType | React.ReactNode
417
+ pressed?: boolean
418
+ selected?: boolean
419
+ space?: number | number[]
420
+ text?: React.ReactNode
421
+ tone?: SelectableTone
422
+ }
423
+
424
+ /**
425
+ * @public
426
+ */
427
+ declare interface MenuProps extends ResponsivePaddingProps {
428
+ /**
429
+ * @deprecated Use `shouldFocus="first"` instead.
430
+ */
431
+ 'focusFirst'?: boolean
432
+ /**
433
+ * @deprecated Use `shouldFocus="last"` instead.
434
+ */
435
+ 'focusLast'?: boolean
436
+ 'onClickOutside'?: (event: MouseEvent) => void
437
+ 'onEscape'?: () => void
438
+ 'onItemClick'?: () => void
439
+ 'onItemSelect'?: (index: number) => void
440
+ 'originElement'?: HTMLElement | null
441
+ 'registerElement'?: (el: HTMLElement) => () => void
442
+ 'shouldFocus'?: 'first' | 'last' | null
443
+ 'space'?: number | number[]
444
+ 'aria-labelledby'?: string
445
+ 'onBlurCapture'?: (event: FocusEvent) => void
446
+ }
447
+
448
+ /**
449
+ * Placement of floating UI elements.
450
+ *
451
+ * @public
452
+ */
453
+ declare type Placement =
454
+ | 'top'
455
+ | 'top-start'
456
+ | 'top-end'
457
+ | 'right'
458
+ | 'right-start'
459
+ | 'right-end'
460
+ | 'bottom'
461
+ | 'bottom-start'
462
+ | 'bottom-end'
463
+ | 'left'
464
+ | 'left-start'
465
+ | 'left-end'
466
+
467
+ /**
468
+ * The `Popover` component is used to display some content on top of another.
469
+ *
470
+ * @public
471
+ */
472
+ export declare const Popover: NamedExoticComponent<
473
+ Omit<
474
+ PopoverProps & Omit<HTMLProps<HTMLDivElement>, 'content' | 'width' | 'children' | 'as'>,
475
+ 'ref'
476
+ > &
477
+ RefAttributes<HTMLDivElement>
478
+ >
479
+
480
+ /**
481
+ * @beta
482
+ */
483
+ export declare type PopoverMargins = [number, number, number, number]
484
+
485
+ /** @public */
486
+ declare interface PopoverProps
487
+ extends Omit<LayerProps, 'as'>,
488
+ ResponsiveRadiusProps,
489
+ ResponsiveShadowProps {
490
+ /** @beta */
491
+ __unstable_margins?: PopoverMargins
492
+ /**
493
+ * Whether the popover should animate in and out.
494
+ *
495
+ * @beta
496
+ * @defaultValue false
497
+ */
498
+ animate?: boolean
499
+ arrow?: boolean
500
+ /** @deprecated Use `floatingBoundary` and/or `referenceBoundary` instead */
501
+ boundaryElement?: HTMLElement | null
502
+ children?: React.JSX.Element
503
+ /**
504
+ * When `true`, prevent overflow within the current boundary:
505
+ * - by flipping on its side axis
506
+ * - by resizing
507
+ /*
508
+ * Note that:
509
+ * - setting `preventOverflow` to `true` also prevents overflow on its side axis
510
+ * - setting `matchReferenceWidth` to `true` also causes the popover to resize
511
+ *
512
+ * @defaultValue false
513
+ */
514
+ constrainSize?: boolean
515
+ content?: React.ReactNode
516
+ disabled?: boolean
517
+ fallbackPlacements?: Placement[]
518
+ floatingBoundary?: HTMLElement | null
519
+ /**
520
+ * When `true`, set the maximum width to match the reference element, and also prevent overflow within
521
+ * the current boundary by resizing.
522
+ *
523
+ * Note that setting `constrainSize` to `true` also causes the popover to resize
524
+ *
525
+ * @defaultValue false
526
+ */
527
+ matchReferenceWidth?: boolean
528
+ open?: boolean
529
+ overflow?: BoxOverflow
530
+ padding?: number | number[]
531
+ placement?: Placement
532
+ /** Whether or not to render the popover in a portal element. */
533
+ portal?: boolean | string
534
+ preventOverflow?: boolean
535
+ referenceBoundary?: HTMLElement | null
536
+ /**
537
+ * When defined, the popover will be positioned relative to this element.
538
+ * The children of the popover won't be rendered.
539
+ */
540
+ referenceElement?: HTMLElement | null
541
+ scheme?: ThemeColorSchemeKey
542
+ tone?: CardTone
543
+ /** @beta */
544
+ updateRef?:
545
+ | MutableRefObject<PopoverUpdateCallback | undefined>
546
+ | RefCallback<PopoverUpdateCallback | undefined>
547
+ width?: PopoverWidth | PopoverWidth[]
548
+ }
549
+
550
+ /** @beta */
551
+ declare type PopoverUpdateCallback = () => void
552
+
553
+ /** @public */
554
+ declare type PopoverWidth = number | 'auto'
555
+
556
+ /**
557
+ * @public
558
+ */
559
+ export declare function Portal(props: PortalProps): React.ReactPortal | null
560
+
561
+ export declare namespace Portal {
562
+ var displayName: string
563
+ }
564
+
565
+ /**
566
+ * @public
567
+ */
568
+ declare interface PortalProps {
569
+ children: React.ReactNode
570
+ /**
571
+ * @beta This API might change. DO NOT USE IN PRODUCTION.
572
+ */
573
+ __unstable_name?: string
574
+ }
575
+
576
+ /**
577
+ * @public
578
+ */
579
+ export declare function PortalProvider(props: PortalProviderProps): React.JSX.Element
580
+
581
+ export declare namespace PortalProvider {
582
+ var displayName: string
583
+ }
584
+
585
+ /**
586
+ * @public
587
+ */
588
+ declare interface PortalProviderProps {
589
+ /**
590
+ * @deprecated Use `<BoundaryElementProvider element={...} />` instead
591
+ */
592
+ boundaryElement?: HTMLElement | null
593
+ children: React.ReactNode
594
+ element?: HTMLElement | null
595
+ /**
596
+ * @beta
597
+ */
598
+ __unstable_elements?: Record<string, HTMLElement | null | undefined>
599
+ }
600
+
601
+ /**
602
+ * @public
603
+ */
604
+ declare type Radius = number | 'full'
605
+
606
+ /**
607
+ * @public
608
+ */
609
+ declare interface ResponsiveBorderProps {
610
+ border?: boolean | boolean[]
611
+ borderTop?: boolean | boolean[]
612
+ borderRight?: boolean | boolean[]
613
+ borderBottom?: boolean | boolean[]
614
+ borderLeft?: boolean | boolean[]
615
+ }
616
+
617
+ /**
618
+ * @public
619
+ */
620
+ declare interface ResponsiveBoxProps {
621
+ display?: BoxDisplay | BoxDisplay[]
622
+ height?: BoxHeight | BoxHeight[]
623
+ overflow?: BoxOverflow | BoxOverflow[]
624
+ sizing?: BoxSizing | BoxSizing[]
625
+ }
626
+
627
+ /**
628
+ * @public
629
+ */
630
+ declare interface ResponsiveFlexItemProps {
631
+ /** Sets the flex CSS attribute. The property is responsive. */
632
+ flex?: FlexValue | FlexValue[]
633
+ }
634
+
635
+ /**
636
+ * @public
637
+ */
638
+ declare interface ResponsiveFlexProps {
639
+ align?: FlexAlign | FlexAlign[]
640
+ direction?: FlexDirection | FlexDirection[]
641
+ justify?: FlexJustify | FlexJustify[]
642
+ wrap?: FlexWrap | FlexWrap[]
643
+ }
644
+
645
+ /**
646
+ * @public
647
+ */
648
+ declare interface ResponsiveGridItemProps {
649
+ column?: GridItemColumn | GridItemColumn[]
650
+ columnStart?: GridItemColumnStart | GridItemColumnStart[]
651
+ columnEnd?: GridItemColumnEnd | GridItemColumnEnd[]
652
+ row?: GridItemRow | GridItemRow[]
653
+ rowStart?: GridItemRowStart | GridItemRowStart[]
654
+ rowEnd?: GridItemRowEnd | GridItemRowEnd[]
655
+ }
656
+
657
+ /**
658
+ * @public
659
+ */
660
+ declare interface ResponsiveGridProps {
661
+ autoRows?: GridAutoRows | GridAutoRows[]
662
+ autoCols?: GridAutoCols | GridAutoCols[]
663
+ autoFlow?: GridAutoFlow | GridAutoFlow[]
664
+ columns?: number | number[]
665
+ gap?: number | number[]
666
+ gapX?: number | number[]
667
+ gapY?: number | number[]
668
+ rows?: number | number[]
669
+ }
670
+
671
+ /**
672
+ * @public
673
+ */
674
+ declare interface ResponsiveMarginProps {
675
+ /** Applies margins to all sides. The property is responsive. */
676
+ margin?: number | number[]
677
+ /** Applies margins to the left and right sides. The property is responsive. */
678
+ marginX?: number | number[]
679
+ /** Applies margins to the top and bottom sides. The property is responsive. */
680
+ marginY?: number | number[]
681
+ marginTop?: number | number[]
682
+ marginRight?: number | number[]
683
+ marginBottom?: number | number[]
684
+ marginLeft?: number | number[]
685
+ }
686
+
687
+ /**
688
+ * @public
689
+ */
690
+ declare interface ResponsivePaddingProps {
691
+ padding?: number | number[]
692
+ paddingX?: number | number[]
693
+ paddingY?: number | number[]
694
+ paddingTop?: number | number[]
695
+ paddingRight?: number | number[]
696
+ paddingBottom?: number | number[]
697
+ paddingLeft?: number | number[]
698
+ }
699
+
700
+ /**
701
+ * @public
702
+ */
703
+ declare interface ResponsiveRadiusProps {
704
+ radius?: Radius | Radius[]
705
+ }
706
+
707
+ /**
708
+ * @public
709
+ */
710
+ declare interface ResponsiveShadowProps {
711
+ shadow?: number | number[]
712
+ }
713
+
714
+ /**
715
+ * @public
716
+ */
717
+ declare type SelectableTone = ThemeColorStateToneKey
718
+
719
+ /**
720
+ * Indicate that something is loading for an indeterminate amount of time.
721
+ *
722
+ * @public
723
+ */
724
+ export declare const Spinner: ForwardRefExoticComponent<
725
+ Omit<SpinnerProps & Omit<HTMLProps<HTMLDivElement>, 'size' | 'as'>, 'ref'> &
726
+ RefAttributes<HTMLDivElement>
727
+ >
728
+
729
+ /**
730
+ * @public
731
+ */
732
+ declare interface SpinnerProps {
733
+ muted?: boolean
734
+ size?: number | number[]
735
+ }
736
+
737
+ /**
738
+ * The `Stack` component is used to place elements on top of each other.
739
+ *
740
+ * @public
741
+ */
742
+ export declare const Stack: ForwardRefExoticComponent<
743
+ StackProps & Omit<HTMLProps<HTMLDivElement>, 'ref' | 'as'> & RefAttributes<HTMLDivElement>
744
+ >
745
+
746
+ /**
747
+ * @public
748
+ */
749
+ declare interface StackProps extends BoxProps {
750
+ as?: React.ElementType | keyof React.JSX.IntrinsicElements
751
+ space?: number | number[]
752
+ }
753
+
754
+ /**
755
+ * @public
756
+ * @deprecated Use `buildTheme` from `@sanity/ui/theme` instead.
757
+ */
758
+ export declare const studioTheme: BaseTheme
759
+
760
+ /**
761
+ * @public
762
+ */
763
+ export declare const Tab: ForwardRefExoticComponent<
764
+ Omit<
765
+ TabProps &
766
+ Omit<
767
+ HTMLProps<HTMLButtonElement>,
768
+ 'label' | 'id' | 'type' | 'width' | 'aria-controls' | 'as'
769
+ >,
770
+ 'ref'
771
+ > &
772
+ RefAttributes<HTMLButtonElement>
773
+ >
774
+
775
+ /**
776
+ * @public
777
+ */
778
+ export declare const TabList: ForwardRefExoticComponent<
779
+ Omit<TabListProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'as'>, 'ref'> &
780
+ RefAttributes<unknown>
781
+ >
782
+
783
+ /**
784
+ * @public
785
+ */
786
+ declare interface TabListProps extends Omit<InlineProps, 'as' | 'height'> {
787
+ children: Array<React.JSX.Element | null | undefined | false>
788
+ }
789
+
790
+ /**
791
+ * @public
792
+ */
793
+ declare interface TabProps {
794
+ /**
795
+ * The `id` of the correlating `TabPanel` component.
796
+ */
797
+ 'aria-controls': string
798
+ 'id': string
799
+ 'icon'?: React.ElementType | React.ReactNode
800
+ 'focused'?: boolean
801
+ 'fontSize'?: number | number[]
802
+ 'label'?: React.ReactNode
803
+ 'padding'?: number | number[]
804
+ 'selected'?: boolean
805
+ 'tone'?: ButtonTone
806
+ }
807
+
808
+ /**
809
+ * The `Text` component is an agile, themed typographic element.
810
+ *
811
+ * @public
812
+ */
813
+ declare const Text_2: ForwardRefExoticComponent<
814
+ Omit<TextProps & Omit<HTMLProps<HTMLDivElement>, 'size' | 'as'>, 'ref'> &
815
+ RefAttributes<HTMLDivElement>
816
+ >
817
+ export {Text_2 as Text}
818
+
819
+ /**
820
+ * @public
821
+ */
822
+ declare type TextAlign = 'left' | 'right' | 'center' | 'justify' | 'initial'
823
+
824
+ /**
825
+ * Single line text input.
826
+ *
827
+ * @public
828
+ */
829
+ export declare const TextInput: ForwardRefExoticComponent<
830
+ Omit<TextInputProps & Omit<HTMLProps<HTMLInputElement>, 'type' | 'as' | 'prefix'>, 'ref'> &
831
+ RefAttributes<HTMLInputElement>
832
+ >
833
+
834
+ /**
835
+ * @public
836
+ */
837
+ declare type TextInputClearButtonProps = Omit<ButtonProps, 'as'> &
838
+ Omit<React.HTMLProps<HTMLButtonElement>, 'as' | 'onClick' | 'onMouseDown' | 'ref'>
839
+
840
+ /**
841
+ * @public
842
+ */
843
+ declare interface TextInputProps {
844
+ /**
845
+ * @beta
846
+ */
847
+ __unstable_disableFocusRing?: boolean
848
+ border?: boolean
849
+ /**
850
+ * @beta
851
+ */
852
+ clearButton?: boolean | TextInputClearButtonProps
853
+ customValidity?: string
854
+ fontSize?: number | number[]
855
+ icon?: React.ElementType | React.ReactNode
856
+ iconRight?: React.ElementType | React.ReactNode
857
+ /**
858
+ * @beta
859
+ */
860
+ onClear?: () => void
861
+ padding?: number | number[]
862
+ prefix?: React.ReactNode
863
+ radius?: Radius | Radius[]
864
+ space?: number | number[]
865
+ suffix?: React.ReactNode
866
+ type?: TextInputType
867
+ weight?: ThemeFontWeightKey
868
+ }
869
+
870
+ /**
871
+ * @public
872
+ */
873
+ declare type TextInputType =
874
+ | 'search'
875
+ | 'date'
876
+ | 'datetime-local'
877
+ | 'email'
878
+ | 'url'
879
+ | 'month'
880
+ | 'number'
881
+ | 'password'
882
+ | 'tel'
883
+ | 'time'
884
+ | 'text'
885
+ | 'week'
886
+ | 'color'
887
+
888
+ /**
889
+ * @public
890
+ */
891
+ declare interface TextProps {
892
+ accent?: boolean
893
+ align?: TextAlign | TextAlign[]
894
+ as?: React.ElementType | keyof React.JSX.IntrinsicElements
895
+ /** When `true` the text color will be muted. */
896
+ muted?: boolean
897
+ size?: number | number[]
898
+ /**
899
+ * Controls how overflowing text is treated.
900
+ * Use `textOverflow="ellipsis"` to render text as a single line which is concatenated with a `…` symbol.
901
+ * @beta
902
+ */
903
+ textOverflow?: 'ellipsis'
904
+ weight?: ThemeFontWeightKey
905
+ }
906
+
907
+ /**
908
+ * @public
909
+ */
910
+ export declare function ThemeProvider(props: ThemeProviderProps): React.JSX.Element
911
+
912
+ export declare namespace ThemeProvider {
913
+ var displayName: string
914
+ }
915
+
916
+ /**
917
+ * @public
918
+ */
919
+ declare interface ThemeProviderProps {
920
+ children?: React.ReactNode
921
+ scheme?: ThemeColorSchemeKey
922
+ theme?: RootTheme
923
+ tone?: ThemeColorCardToneKey
924
+ }
925
+
926
+ /**
927
+ * Tooltips display information when hovering, focusing or tapping.
928
+ *
929
+ * @public
930
+ */
931
+ export declare const Tooltip: ForwardRefExoticComponent<
932
+ Omit<TooltipProps & Omit<HTMLProps<HTMLDivElement>, 'content' | 'children' | 'as'>, 'ref'> &
933
+ RefAttributes<HTMLDivElement>
934
+ >
935
+
936
+ /**
937
+ * @public
938
+ */
939
+ declare interface TooltipProps extends Omit<LayerProps, 'as'> {
940
+ /** @deprecated Use `fallbackPlacements` instead. */
941
+ allowedAutoPlacements?: Placement[]
942
+ arrow?: boolean
943
+ boundaryElement?: HTMLElement | null
944
+ children?: React.JSX.Element
945
+ content?: React.ReactNode
946
+ disabled?: boolean
947
+ fallbackPlacements?: Placement[]
948
+ padding?: number | number[]
949
+ placement?: Placement
950
+ /** Whether or not to render the tooltip in a portal element. */
951
+ portal?: boolean | string
952
+ radius?: number | number[]
953
+ scheme?: ThemeColorSchemeKey
954
+ shadow?: number | number[]
955
+ /**
956
+ * Adds a delay to open or close the tooltip.
957
+ *
958
+ * If only a `number` is passed, it will be used for both opening and closing.
959
+ *
960
+ * If an object `{open: number; close:number}` is passed, it can be used to set different delays for each action.
961
+ *
962
+ * @public
963
+ * @defaultValue 0
964
+ */
965
+ delay?: Delay
966
+ /**
967
+ * Whether the tooltip should animate in and out.
968
+ *
969
+ * @beta
970
+ * @defaultValue false
971
+ */
972
+ animate?: boolean
973
+ }
974
+
975
+ /**
976
+ * Returns true if a dark color scheme is preferred, false if a light color scheme is preferred or the preference is not known.
977
+ *
978
+ * @param getServerSnapshot - Only called during server-side rendering, and hydration if using hydrateRoot. Since the server environment doesn't have access to the DOM, we can't determine the current value of the media query and we assume `(prefers-color-scheme: light)` since it's the most common scheme (https://react.dev/reference/react/useSyncExternalStore#adding-support-for-server-rendering)
979
+ *
980
+ * If you persist the detected preference in a cookie or a header then you may implement your own server snapshot to read it.
981
+ * Chrome supports reading the `prefers-color-scheme` media query from a header if the server response: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-CH-Prefers-Color-Scheme
982
+ * @example https://gist.github.com/stipsan/13c0cccf8dfc34f4b44bb1b984baf7df
983
+ *
984
+ * @public
985
+ */
986
+ export declare function usePrefersDark(getServerSnapshot?: () => boolean): boolean
987
+
988
+ /**
989
+ * @public
990
+ */
991
+ export declare function useTheme_v2(): Theme_v2
992
+
993
+ export {}