@sanity/ui 2.0.0-alpha.2 → 2.0.0-alpha.21

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.
Files changed (96) hide show
  1. package/dist/index.cjs.mjs +28 -0
  2. package/dist/index.d.ts +476 -12
  3. package/dist/index.esm.js +1326 -524
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +1353 -523
  6. package/dist/index.js.map +1 -1
  7. package/package.json +6 -8
  8. package/src/components/autocomplete/autocomplete.tsx +6 -0
  9. package/src/components/dialog/constants.ts +4 -0
  10. package/src/components/dialog/dialog.tsx +79 -15
  11. package/src/components/hotkeys/hotkeys.tsx +2 -0
  12. package/src/components/menu/menu.tsx +2 -0
  13. package/src/components/menu/menuButton.tsx +2 -0
  14. package/src/components/menu/menuGroup.tsx +22 -23
  15. package/src/components/menu/menuItem.tsx +29 -35
  16. package/src/components/tab/tab.tsx +4 -1
  17. package/src/components/toast/toast.tsx +4 -0
  18. package/src/primitives/_selectable/style.ts +2 -1
  19. package/src/primitives/avatar/avatar.tsx +16 -9
  20. package/src/primitives/avatar/avatarCounter.tsx +3 -3
  21. package/src/primitives/avatar/styles.ts +1 -1
  22. package/src/primitives/badge/badge.tsx +7 -3
  23. package/src/primitives/box/box.tsx +3 -0
  24. package/src/primitives/button/__workshop__/sanityUploadButton.tsx +2 -1
  25. package/src/primitives/button/button.tsx +7 -3
  26. package/src/primitives/button/styles.ts +9 -2
  27. package/src/primitives/card/card.tsx +4 -0
  28. package/src/primitives/card/styles.ts +2 -0
  29. package/src/primitives/checkbox/checkbox.tsx +2 -0
  30. package/src/primitives/code/code.tsx +1 -0
  31. package/src/primitives/container/container.tsx +2 -0
  32. package/src/primitives/flex/flex.tsx +2 -0
  33. package/src/primitives/grid/grid.tsx +2 -0
  34. package/src/primitives/heading/heading.tsx +2 -0
  35. package/src/primitives/inline/inline.tsx +3 -0
  36. package/src/primitives/kbd/kbd.tsx +2 -0
  37. package/src/primitives/label/label.tsx +2 -0
  38. package/src/primitives/popover/popover.tsx +6 -1
  39. package/src/primitives/radio/radio.tsx +2 -0
  40. package/src/primitives/select/select.tsx +2 -0
  41. package/src/primitives/select/styles.ts +2 -0
  42. package/src/primitives/spinner/spinner.tsx +2 -0
  43. package/src/primitives/stack/stack.tsx +2 -0
  44. package/src/primitives/switch/switch.tsx +4 -0
  45. package/src/primitives/text/text.tsx +3 -0
  46. package/src/primitives/textArea/textArea.tsx +4 -1
  47. package/src/primitives/textInput/textInput.tsx +10 -1
  48. package/src/primitives/tooltip/__workshop__/customPortal.tsx +99 -0
  49. package/src/primitives/tooltip/__workshop__/index.ts +15 -0
  50. package/src/primitives/tooltip/__workshop__/overflowingBoundary.tsx +73 -0
  51. package/src/primitives/tooltip/__workshop__/resizableBoundary.tsx +85 -0
  52. package/src/primitives/tooltip/constants.ts +1 -0
  53. package/src/primitives/tooltip/tooltip.test.tsx +192 -0
  54. package/src/primitives/tooltip/tooltip.tsx +109 -33
  55. package/src/primitives/types.ts +4 -0
  56. package/src/styles/input/textInputStyle.ts +11 -6
  57. package/src/theme/_internal/__workshop__/build/story.tsx +288 -0
  58. package/src/theme/_internal/__workshop__/build/theme.ts +3 -0
  59. package/src/theme/_internal/__workshop__/index.ts +14 -0
  60. package/src/theme/_internal/build/buildTheme.test.ts +78 -0
  61. package/src/theme/_internal/build/buildTheme.ts +16 -0
  62. package/src/theme/_internal/build/colorTheme/buildColorTheme.test.ts +185 -0
  63. package/src/theme/_internal/build/colorTheme/buildColorTheme.ts +164 -0
  64. package/src/theme/_internal/build/colorTheme/renderColorTheme.ts +242 -0
  65. package/src/theme/_internal/build/colorTheme/resolveColorTokens.ts +121 -0
  66. package/src/theme/_internal/build/defaults/colorPalette.ts +8 -0
  67. package/src/theme/_internal/build/defaults/colorTokens.ts +147 -0
  68. package/src/theme/_internal/build/helpers.ts +65 -0
  69. package/src/theme/_internal/build/index.ts +1 -0
  70. package/src/theme/_internal/config/helpers.ts +47 -0
  71. package/src/theme/_internal/config/index.ts +3 -0
  72. package/src/theme/_internal/config/token/index.ts +2 -0
  73. package/src/theme/_internal/config/token/parseTokenKey.test.ts +72 -0
  74. package/src/theme/_internal/config/token/parseTokenKey.ts +88 -0
  75. package/src/theme/_internal/config/token/parseTokenValue.test.ts +45 -0
  76. package/src/theme/_internal/config/token/parseTokenValue.ts +123 -0
  77. package/src/theme/_internal/config/types.ts +137 -0
  78. package/src/theme/_internal/constants.ts +48 -0
  79. package/src/theme/_internal/helpers.ts +19 -0
  80. package/src/theme/_internal/index.ts +5 -0
  81. package/src/theme/_internal/types.ts +91 -0
  82. package/src/theme/index.ts +1 -0
  83. package/src/theme/lib/color-fns/blend/multiply.ts +2 -2
  84. package/src/theme/lib/color-fns/blend/screen.ts +2 -2
  85. package/src/theme/lib/color-fns/convert.ts +15 -1
  86. package/src/theme/lib/color-fns/parse.ts +7 -3
  87. package/src/theme/lib/color-fns/types.ts +11 -0
  88. package/src/theme/lib/theme/avatar.ts +2 -0
  89. package/src/theme/lib/theme/color/_legacy/createColorTheme.ts +7 -0
  90. package/src/theme/lib/theme/color/_legacy/index.ts +1 -0
  91. package/src/theme/lib/theme/color/_legacy/legacyColor.ts +3997 -0
  92. package/src/theme/studioTheme/color.ts +98 -82
  93. package/src/theme/studioTheme/helpers.ts +15 -1
  94. package/src/theme/studioTheme/theme.ts +5 -5
  95. package/src/theme/studioTheme/tints.ts +244 -84
  96. package/src/types/button.ts +5 -0
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  import {AnimationEventHandler} from 'react'
4
4
  import {AriaRole} from 'react'
5
5
  import {ClipboardEventHandler} from 'react'
6
+ import {ColorTint} from '@sanity/color'
6
7
  import {Component} from 'react'
7
8
  import {CompositionEventHandler} from 'react'
8
9
  import {CSSProperties} from 'react'
@@ -43,12 +44,16 @@ export declare type ArrayPropPrimitive = string | number | boolean | undefined |
43
44
  export declare function attemptFocus(element: HTMLElement): boolean
44
45
 
45
46
  /**
47
+ * The Autocomplete component is typically used for search components.
48
+ * It consists of a text input for writing a query, and properties for rendering suggestions.
49
+ *
46
50
  * @public
47
51
  */
48
52
  export declare const Autocomplete: <Option extends BaseAutocompleteOption>(
49
53
  props: AutocompleteProps<Option> &
50
54
  Omit<
51
55
  HTMLProps<HTMLInputElement>,
56
+ | 'type'
52
57
  | 'value'
53
58
  | 'ref'
54
59
  | 'id'
@@ -66,7 +71,6 @@ export declare const Autocomplete: <Option extends BaseAutocompleteOption>(
66
71
  | 'onSelect'
67
72
  | 'as'
68
73
  | 'autoComplete'
69
- | 'type'
70
74
  > & {
71
75
  ref?: Ref<HTMLInputElement> | undefined
72
76
  },
@@ -127,6 +131,7 @@ export declare interface AutocompleteProps<
127
131
  onSelect?: (value: string) => void
128
132
  /** @beta */
129
133
  openButton?: boolean | AutocompleteOpenButtonProps
134
+ /** The options to render. */
130
135
  options?: Option[]
131
136
  padding?: number | number[]
132
137
  popover?: Omit<PopoverProps, 'content' | 'onMouseEnter' | 'onMouseLeave' | 'open'> &
@@ -135,6 +140,7 @@ export declare interface AutocompleteProps<
135
140
  radius?: Radius | Radius[]
136
141
  /** @beta */
137
142
  relatedElements?: HTMLElement[]
143
+ /** The callback function for rendering each option. */
138
144
  renderOption?: (option: Option) => ReactElement
139
145
  /** @beta */
140
146
  renderPopover?: (
@@ -149,6 +155,7 @@ export declare interface AutocompleteProps<
149
155
  ) => ReactNode
150
156
  renderValue?: (value: string, option?: Option) => string
151
157
  suffix?: ReactNode
158
+ /** The current value. */
152
159
  value?: string
153
160
  }
154
161
 
@@ -218,6 +225,8 @@ export declare interface AutocompleteValueChangeMsg {
218
225
  }
219
226
 
220
227
  /**
228
+ * Avatars are used to represent people and other agents (e.g. bots).
229
+ *
221
230
  * @public
222
231
  */
223
232
  export declare const Avatar: ForwardRefExoticComponent<
@@ -250,6 +259,8 @@ export declare type AvatarPosition = 'top' | 'bottom' | 'inside'
250
259
  * @public
251
260
  */
252
261
  export declare interface AvatarProps {
262
+ /** @beta */
263
+ __unstable_hideInnerStroke?: boolean
253
264
  animateArrowFrom?: AvatarPosition
254
265
  arrowPosition?: AvatarPosition
255
266
  as?: React.ElementType | keyof JSX.IntrinsicElements
@@ -302,6 +313,8 @@ export declare interface AvatarStackProps {
302
313
  export declare type AvatarStatus = 'online' | 'editing' | 'inactive'
303
314
 
304
315
  /**
316
+ * Badges are used to tag resources.
317
+ *
305
318
  * @public
306
319
  */
307
320
  export declare const Badge: ForwardRefExoticComponent<
@@ -335,6 +348,25 @@ export declare interface BaseAutocompleteOption {
335
348
  value: string
336
349
  }
337
350
 
351
+ export declare interface BaseColorTokens {
352
+ _blend?: ColorBlendModeTokenValue
353
+ _hue?: ColorHueValue
354
+ bg?: ColorTokenValue
355
+ fg?: ColorTokenValue
356
+ border?: ColorTokenValue
357
+ focusRing?: ColorTokenValue
358
+ shadow?: {
359
+ outline?: ColorTokenValue
360
+ umbra?: ColorTokenValue
361
+ penumbra?: ColorTokenValue
362
+ ambient?: ColorTokenValue
363
+ }
364
+ skeleton?: {
365
+ from?: ColorTokenValue
366
+ to?: ColorTokenValue
367
+ }
368
+ }
369
+
338
370
  /**
339
371
  * @public
340
372
  */
@@ -392,6 +424,9 @@ export declare interface BoundaryElementProviderProps {
392
424
  }
393
425
 
394
426
  /**
427
+ * The `Box` component is a basic layout wrapper component which provides utility properties
428
+ * for flex, margins and padding.
429
+ *
395
430
  * @public
396
431
  */
397
432
  export declare const Box: ForwardRefExoticComponent<
@@ -443,7 +478,7 @@ export declare type BoxSizing = 'content' | 'border'
443
478
  */
444
479
  export declare const Breadcrumbs: ForwardRefExoticComponent<
445
480
  BreadcrumbsProps &
446
- Omit<HTMLProps<HTMLOListElement>, 'ref' | 'as' | 'type'> &
481
+ Omit<HTMLProps<HTMLOListElement>, 'type' | 'ref' | 'as'> &
447
482
  RefAttributes<HTMLOListElement>
448
483
  >
449
484
 
@@ -456,19 +491,29 @@ export declare interface BreadcrumbsProps {
456
491
  space?: number | number[]
457
492
  }
458
493
 
494
+ /** @internal */
495
+ export declare function buildTheme(config?: ThemeConfig): TMP_Theme
496
+
459
497
  /**
460
498
  * @public
461
499
  */
462
500
  export declare const Button: ForwardRefExoticComponent<
463
- Omit<ButtonProps & Omit<HTMLProps<HTMLButtonElement>, 'as'>, 'ref'> &
501
+ Omit<ButtonProps & Omit<HTMLProps<HTMLButtonElement>, 'width' | 'as'>, 'ref'> &
464
502
  RefAttributes<HTMLButtonElement>
465
503
  >
466
504
 
505
+ export declare interface ButtonColorTokens
506
+ extends Partial<Record<ColorButtonMode, ButtonModeColorTokens>> {
507
+ _hue?: ColorHueValue
508
+ }
509
+
467
510
  /**
468
511
  * @public
469
512
  */
470
513
  export declare type ButtonMode = 'default' | 'ghost' | 'bleed'
471
514
 
515
+ export declare type ButtonModeColorTokens = Partial<Record<'*' | ColorState, StateColorTokens>>
516
+
472
517
  /**
473
518
  * @public
474
519
  */
@@ -490,6 +535,7 @@ export declare interface ButtonProps extends ResponsivePaddingProps, ResponsiveR
490
535
  text?: React.ReactNode
491
536
  tone?: ButtonTone
492
537
  type?: 'button' | 'reset' | 'submit'
538
+ width?: ButtonWidth
493
539
  }
494
540
 
495
541
  /**
@@ -505,6 +551,14 @@ export declare type ButtonTone = 'default' | 'primary' | 'positive' | 'caution'
505
551
  /**
506
552
  * @public
507
553
  */
554
+ export declare type ButtonWidth = 'fill'
555
+
556
+ /**
557
+ * The `Card` component acts much like a `Box`, but with a background and foreground color.
558
+ * Components within a `Card` inherit its colors.
559
+ *
560
+ * @public
561
+ */
508
562
  export declare const Card: ForwardRefExoticComponent<
509
563
  Omit<CardProps & Omit<HTMLProps<HTMLDivElement>, 'height' | 'as'>, 'ref'> &
510
564
  RefAttributes<HTMLDivElement>
@@ -548,10 +602,12 @@ export declare interface CardStyleProps {
548
602
  export declare type CardTone = ThemeColorToneKey | 'inherit'
549
603
 
550
604
  /**
605
+ * Checkboxes allow the user to select one or more items from a set.
606
+ *
551
607
  * @public
552
608
  */
553
609
  export declare const Checkbox: ForwardRefExoticComponent<
554
- Omit<Omit<HTMLProps<HTMLInputElement>, 'as' | 'type'> & CheckboxProps, 'ref'> &
610
+ Omit<Omit<HTMLProps<HTMLInputElement>, 'type' | 'as'> & CheckboxProps, 'ref'> &
555
611
  RefAttributes<HTMLInputElement>
556
612
  >
557
613
 
@@ -580,6 +636,7 @@ export declare const Code: ForwardRefExoticComponent<
580
636
  */
581
637
  export declare interface CodeProps {
582
638
  as?: React.ElementType | keyof JSX.IntrinsicElements
639
+ /** Define the language to use for syntax highlighting. */
583
640
  language?: string
584
641
  size?: number | number[]
585
642
  weight?: string
@@ -605,7 +662,168 @@ export declare interface CodeSkeletonProps extends SkeletonProps {
605
662
  size?: number | number[]
606
663
  }
607
664
 
665
+ export declare const COLOR_BASE_TONES: readonly [
666
+ 'transparent',
667
+ 'default',
668
+ 'primary',
669
+ 'positive',
670
+ 'caution',
671
+ 'critical',
672
+ ]
673
+
674
+ export declare const COLOR_BLEND_MODES: readonly ['multiply', 'screen']
675
+
676
+ export declare const COLOR_BUTTON_MODES: readonly ['default', 'ghost', 'bleed']
677
+
678
+ export declare const COLOR_CONFIG_BASE_KEYS: readonly [
679
+ '_hue',
680
+ 'bg',
681
+ 'fg',
682
+ 'border',
683
+ 'focusRing',
684
+ 'muted/fg',
685
+ 'link/fg',
686
+ 'code/bg',
687
+ 'code/fg',
688
+ 'shadow/outline',
689
+ 'shadow/umbra',
690
+ 'shadow/penumbra',
691
+ 'shadow/ambient',
692
+ 'skeleton/from',
693
+ 'skeleton/to',
694
+ ]
695
+
696
+ export declare const COLOR_CONFIG_BASE_TONES: readonly [
697
+ '*',
698
+ 'transparent',
699
+ 'default',
700
+ 'primary',
701
+ 'positive',
702
+ 'caution',
703
+ 'critical',
704
+ ]
705
+
706
+ export declare const COLOR_CONFIG_BLEND_KEYS: readonly ['_blend']
707
+
708
+ export declare const COLOR_CONFIG_STATE_KEYS: readonly [
709
+ '_hue',
710
+ 'bg',
711
+ 'fg',
712
+ 'border',
713
+ 'focusRing',
714
+ 'muted/fg',
715
+ 'link/fg',
716
+ 'code/bg',
717
+ 'code/fg',
718
+ 'skeleton/from',
719
+ 'skeleton/to',
720
+ ]
721
+
722
+ export declare const COLOR_CONFIG_STATE_TONES: readonly [
723
+ '*',
724
+ 'default',
725
+ 'primary',
726
+ 'positive',
727
+ 'caution',
728
+ 'critical',
729
+ ]
730
+
731
+ export declare const COLOR_HUES: readonly [
732
+ 'gray',
733
+ 'cyan',
734
+ 'blue',
735
+ 'purple',
736
+ 'magenta',
737
+ 'red',
738
+ 'orange',
739
+ 'yellow',
740
+ 'green',
741
+ ]
742
+
743
+ export declare const COLOR_STATE_TONES: readonly [
744
+ 'default',
745
+ 'primary',
746
+ 'positive',
747
+ 'caution',
748
+ 'critical',
749
+ ]
750
+
751
+ export declare const COLOR_STATES: readonly [
752
+ 'enabled',
753
+ 'hovered',
754
+ 'pressed',
755
+ 'selected',
756
+ 'disabled',
757
+ ]
758
+
759
+ export declare const COLOR_TINTS: readonly [
760
+ '50',
761
+ '100',
762
+ '200',
763
+ '300',
764
+ '400',
765
+ '500',
766
+ '600',
767
+ '700',
768
+ '800',
769
+ '900',
770
+ '950',
771
+ ]
772
+
773
+ export declare type ColorBaseTone = (typeof COLOR_BASE_TONES)[number]
774
+
775
+ export declare type ColorBlendModeTokenValue = [ColorBlendModeValue, ColorBlendModeValue]
776
+
777
+ export declare type ColorBlendModeValue = (typeof COLOR_BLEND_MODES)[number]
778
+
779
+ export declare type ColorButtonMode = (typeof COLOR_BUTTON_MODES)[number]
780
+
781
+ export declare type ColorConfigBaseKey = (typeof COLOR_CONFIG_BASE_KEYS)[number]
782
+
783
+ export declare type ColorConfigBaseTone = (typeof COLOR_CONFIG_BASE_TONES)[number]
784
+
785
+ export declare type ColorConfigBlendKey = (typeof COLOR_CONFIG_BLEND_KEYS)[number]
786
+
787
+ export declare type ColorConfigOpacityValue = `0` | `0.${number}` | `1`
788
+
789
+ export declare type ColorConfigStateKey = (typeof COLOR_CONFIG_STATE_KEYS)[number]
790
+
791
+ export declare type ColorConfigStateTone = (typeof COLOR_CONFIG_STATE_TONES)[number]
792
+
793
+ export declare type ColorConfigValue =
794
+ | `black`
795
+ | `white`
796
+ | `black/${ColorConfigOpacityValue}`
797
+ | `white/${ColorConfigOpacityValue}`
798
+ | `${ColorHueValue}`
799
+ | `${ColorHueValue}/${ColorTintValue}`
800
+ | `${ColorHueValue}/${ColorTintValue}/${ColorConfigOpacityValue}`
801
+ | `${ColorTintValue}`
802
+ | `${ColorTintValue}/${ColorConfigOpacityValue}`
803
+ | ColorBlendModeValue
804
+
805
+ export declare type ColorHueValue = (typeof COLOR_HUES)[number]
806
+
807
+ export declare type ColorState = (typeof COLOR_STATES)[number]
808
+
809
+ export declare type ColorStateTone = (typeof COLOR_STATE_TONES)[number]
810
+
811
+ export declare interface ColorThemeConfig {
812
+ palette?: TMP_ColorPalette
813
+ tokens?: ColorTokens
814
+ }
815
+
816
+ export declare type ColorTintValue = (typeof COLOR_TINTS)[number]
817
+
818
+ export declare interface ColorTokens extends Partial<Record<ColorConfigBaseTone, BaseColorTokens>> {
819
+ button?: Partial<Record<ColorConfigStateTone, ButtonColorTokens>>
820
+ }
821
+
822
+ export declare type ColorTokenValue = [ColorConfigValue, ColorConfigValue]
823
+
608
824
  /**
825
+ * The `Container` component wraps content layout in a defined set of widths.
826
+ *
609
827
  * @public
610
828
  */
611
829
  export declare const Container: ForwardRefExoticComponent<
@@ -644,6 +862,8 @@ export declare type Delay =
644
862
  }>
645
863
 
646
864
  /**
865
+ * The Dialog component.
866
+ *
647
867
  * @public
648
868
  */
649
869
  export declare const Dialog: ForwardRefExoticComponent<
@@ -802,6 +1022,8 @@ export declare function _fillCSSObject(
802
1022
  ): CSSObject
803
1023
 
804
1024
  /**
1025
+ * The `Flex` component is a wrapper component for flexible elements (`Box`, `Card` and `Flex`).
1026
+ *
805
1027
  * @public
806
1028
  */
807
1029
  export declare const Flex: ForwardRefExoticComponent<
@@ -890,6 +1112,8 @@ export declare function _getResponsiveSpace(
890
1112
  ): CSSObject[] | null
891
1113
 
892
1114
  /**
1115
+ * The `Grid` component is for building 2-dimensional layers (based on CSS grid).
1116
+ *
893
1117
  * @public
894
1118
  */
895
1119
  export declare const Grid: ForwardRefExoticComponent<
@@ -953,6 +1177,8 @@ export declare interface GridProps extends Omit<BoxProps, 'display'>, Responsive
953
1177
  export declare function _hasFocus(element: HTMLElement): boolean
954
1178
 
955
1179
  /**
1180
+ * Typographic headings.
1181
+ *
956
1182
  * @public
957
1183
  */
958
1184
  export declare const Heading: ForwardRefExoticComponent<
@@ -1004,6 +1230,8 @@ export declare interface HeadingSkeletonProps extends SkeletonProps {
1004
1230
  export declare function hexToRgb(hex: string): RGB
1005
1231
 
1006
1232
  /**
1233
+ * Represent hotkeys (a keyboard combination) with semantic `<kbd>` elements.
1234
+ *
1007
1235
  * @public
1008
1236
  */
1009
1237
  export declare const Hotkeys: ForwardRefExoticComponent<
@@ -1036,6 +1264,8 @@ export declare interface HSL {
1036
1264
  export declare function hslToRgb(hsl: HSL): RGB
1037
1265
 
1038
1266
  /**
1267
+ * The `Inline` component is a layout utility for aligning and spacing items horizontally.
1268
+ *
1039
1269
  * @public
1040
1270
  */
1041
1271
  export declare const Inline: ForwardRefExoticComponent<
@@ -1046,9 +1276,34 @@ export declare const Inline: ForwardRefExoticComponent<
1046
1276
  * @public
1047
1277
  */
1048
1278
  export declare interface InlineProps extends Omit<BoxProps, 'display'> {
1279
+ /** The spacing between children. */
1049
1280
  space?: number | number[]
1050
1281
  }
1051
1282
 
1283
+ export declare function isColorBlendModeValue(str: string): str is ColorBlendModeValue
1284
+
1285
+ export declare function isColorButtonMode(str: string): str is ColorButtonMode
1286
+
1287
+ export declare function isColorConfigBaseKey(str: string): str is ColorConfigBaseKey
1288
+
1289
+ export declare function isColorConfigBaseTone(str: string): str is ColorConfigBaseTone
1290
+
1291
+ export declare function isColorConfigBlendKey(str: string): str is ColorConfigBlendKey
1292
+
1293
+ export declare function isColorConfigStateKey(str: string): str is ColorConfigStateKey
1294
+
1295
+ export declare function isColorConfigStateTone(str: string): str is ColorConfigStateTone
1296
+
1297
+ export declare function isColorHueValue(str: string): str is ColorHueValue
1298
+
1299
+ export declare function isColorOpacityValue(str: string): str is ColorConfigOpacityValue
1300
+
1301
+ export declare function isColorTintValue(str: string): str is ColorTintValue
1302
+
1303
+ export declare function isColorTokenValue(str: string): str is ColorConfigValue
1304
+
1305
+ export declare function isColorValue(str: string): str is 'black' | 'white'
1306
+
1052
1307
  /**
1053
1308
  * @internal
1054
1309
  */
@@ -1095,6 +1350,8 @@ export declare function isHTMLTextAreaElement(element: unknown): element is HTML
1095
1350
  export declare function _isScrollable(el: Node): boolean
1096
1351
 
1097
1352
  /**
1353
+ * Used to define some text as keyboard input.
1354
+ *
1098
1355
  * @public
1099
1356
  */
1100
1357
  export declare const KBD: ForwardRefExoticComponent<
@@ -1112,6 +1369,8 @@ export declare interface KBDProps {
1112
1369
  }
1113
1370
 
1114
1371
  /**
1372
+ * Typographic labels.
1373
+ *
1115
1374
  * @public
1116
1375
  */
1117
1376
  export declare const Label: ForwardRefExoticComponent<
@@ -1215,6 +1474,8 @@ export declare interface _MediaStore {
1215
1474
  }
1216
1475
 
1217
1476
  /**
1477
+ * The `Menu` component is a building block for application menus.
1478
+ *
1218
1479
  * @public
1219
1480
  */
1220
1481
  export declare const Menu: ForwardRefExoticComponent<
@@ -1223,6 +1484,8 @@ export declare const Menu: ForwardRefExoticComponent<
1223
1484
  >
1224
1485
 
1225
1486
  /**
1487
+ * The `MenuButton` component follows the WAI-ARIA specification for menu buttons.
1488
+ *
1226
1489
  * @public
1227
1490
  */
1228
1491
  export declare const MenuButton: ForwardRefExoticComponent<
@@ -1664,12 +1927,16 @@ export declare interface MenuProps extends ResponsivePaddingProps {
1664
1927
  * Source: https://www.w3.org/TR/compositing-1/#blendingmultiply
1665
1928
  * @internal
1666
1929
  */
1667
- export declare function multiply(b: RGB, s: RGB): RGB
1930
+ export declare function multiply(b: RGB | RGBA, s: RGB | RGBA): RGB
1668
1931
 
1669
1932
  /**
1670
1933
  * @internal
1671
1934
  */
1672
- export declare function parseColor(color: unknown): RGB
1935
+ export declare function parseColor(color: unknown): RGB | RGBA
1936
+
1937
+ export declare function parseTokenKey(str: string): TokenKeyNode | undefined
1938
+
1939
+ export declare function parseTokenValue(str: string): TokenValueNode | undefined
1673
1940
 
1674
1941
  /**
1675
1942
  * @public
@@ -1695,7 +1962,11 @@ export declare type Placement =
1695
1962
  | 'left-start'
1696
1963
  | 'left-end'
1697
1964
 
1698
- /** @public */
1965
+ /**
1966
+ * The `Popover` component is used to display some content on top of another.
1967
+ *
1968
+ * @public
1969
+ */
1699
1970
  export declare const Popover: MemoExoticComponent<
1700
1971
  ForwardRefExoticComponent<
1701
1972
  Omit<
@@ -1732,6 +2003,7 @@ export declare interface PopoverProps
1732
2003
  overflow?: BoxOverflow
1733
2004
  padding?: number | number[]
1734
2005
  placement?: Placement
2006
+ /** Whether or not to render the popover in a portal element. */
1735
2007
  portal?: boolean | string
1736
2008
  preventOverflow?: boolean
1737
2009
  referenceBoundary?: HTMLElement | null
@@ -1799,10 +2071,12 @@ export declare interface PortalProviderProps {
1799
2071
  }
1800
2072
 
1801
2073
  /**
2074
+ * The `Radio` component allows the user to select one option from a set.
2075
+ *
1802
2076
  * @public
1803
2077
  */
1804
2078
  export declare const Radio: ForwardRefExoticComponent<
1805
- Omit<Omit<HTMLProps<HTMLInputElement>, 'as' | 'type'> & RadioProps, 'ref'> &
2079
+ Omit<Omit<HTMLProps<HTMLInputElement>, 'type' | 'as'> & RadioProps, 'ref'> &
1806
2080
  RefAttributes<HTMLInputElement>
1807
2081
  >
1808
2082
 
@@ -1887,6 +2161,7 @@ export declare function responsiveCodeFontStyle(
1887
2161
  * @public
1888
2162
  */
1889
2163
  export declare interface ResponsiveFlexItemProps {
2164
+ /** Sets the flex CSS attribute. The property is responsive. */
1890
2165
  flex?: FlexValue | FlexValue[]
1891
2166
  }
1892
2167
 
@@ -1964,8 +2239,11 @@ export declare function responsiveLabelFont(
1964
2239
  * @public
1965
2240
  */
1966
2241
  export declare interface ResponsiveMarginProps {
2242
+ /** Applies margins to all sides. The property is responsive. */
1967
2243
  margin?: number | number[]
2244
+ /** Applies margins to the left and right sides. The property is responsive. */
1968
2245
  marginX?: number | number[]
2246
+ /** Applies margins to the top and bottom sides. The property is responsive. */
1969
2247
  marginY?: number | number[]
1970
2248
  marginTop?: number | number[]
1971
2249
  marginRight?: number | number[]
@@ -2044,6 +2322,17 @@ export declare interface RGB {
2044
2322
  r: number
2045
2323
  g: number
2046
2324
  b: number
2325
+ a?: undefined
2326
+ }
2327
+
2328
+ /**
2329
+ * @internal
2330
+ */
2331
+ export declare interface RGBA {
2332
+ r: number
2333
+ g: number
2334
+ b: number
2335
+ a: number
2047
2336
  }
2048
2337
 
2049
2338
  /**
@@ -2051,6 +2340,11 @@ export declare interface RGB {
2051
2340
  */
2052
2341
  export declare function rgba(color: unknown, a: number): string
2053
2342
 
2343
+ /**
2344
+ * @internal
2345
+ */
2346
+ export declare function rgbaToRGBA(rgba: string): RGBA
2347
+
2054
2348
  /**
2055
2349
  * @internal
2056
2350
  */
@@ -2072,10 +2366,12 @@ export declare type RootTheme = BaseTheme<Styles>
2072
2366
  * Source: https://www.w3.org/TR/compositing-1/#blendingscreen
2073
2367
  * @internal
2074
2368
  */
2075
- declare function screen_2(b: RGB, s: RGB): RGB
2369
+ declare function screen_2(b: RGB | RGBA, s: RGB | RGBA): RGB
2076
2370
  export {screen_2 as screen}
2077
2371
 
2078
2372
  /**
2373
+ * The `Select` component provides control of options.
2374
+ *
2079
2375
  * @public
2080
2376
  */
2081
2377
  export declare const Select: ForwardRefExoticComponent<
@@ -2117,6 +2413,8 @@ export declare interface SkeletonProps extends ResponsiveRadiusProps, Omit<BoxPr
2117
2413
  }
2118
2414
 
2119
2415
  /**
2416
+ * Indicate that something is loading for an indeterminate amount of time.
2417
+ *
2120
2418
  * @public
2121
2419
  */
2122
2420
  export declare const Spinner: ForwardRefExoticComponent<
@@ -2149,6 +2447,8 @@ export declare interface SrOnlyProps {
2149
2447
  }
2150
2448
 
2151
2449
  /**
2450
+ * The `Stack` component is used to place elements on top of each other.
2451
+ *
2152
2452
  * @public
2153
2453
  */
2154
2454
  export declare const Stack: ForwardRefExoticComponent<
@@ -2163,6 +2463,32 @@ export declare interface StackProps extends BoxProps {
2163
2463
  space?: number | number[]
2164
2464
  }
2165
2465
 
2466
+ export declare interface StateColorTokens {
2467
+ _blend?: ColorBlendModeTokenValue
2468
+ _hue?: ColorHueValue
2469
+ bg?: ColorTokenValue
2470
+ bg2?: ColorTokenValue
2471
+ fg?: ColorTokenValue
2472
+ border?: ColorTokenValue
2473
+ muted?: {
2474
+ fg?: ColorTokenValue
2475
+ }
2476
+ accent?: {
2477
+ fg?: ColorTokenValue
2478
+ }
2479
+ link?: {
2480
+ fg?: ColorTokenValue
2481
+ }
2482
+ code?: {
2483
+ bg?: ColorTokenValue
2484
+ fg?: ColorTokenValue
2485
+ }
2486
+ skeleton?: {
2487
+ from?: ColorTokenValue
2488
+ to?: ColorTokenValue
2489
+ }
2490
+ }
2491
+
2166
2492
  /**
2167
2493
  * @public
2168
2494
  */
@@ -2182,10 +2508,14 @@ export declare interface Styles {
2182
2508
  }
2183
2509
 
2184
2510
  /**
2511
+ * The `Switch` component allows the user to toggle a setting on and off.
2512
+ *
2513
+ * Extends all properties of an `<input type="checkbox" />` element, except type.
2514
+ *
2185
2515
  * @public
2186
2516
  */
2187
2517
  export declare const Switch: ForwardRefExoticComponent<
2188
- Omit<Omit<HTMLProps<HTMLInputElement>, 'as' | 'type'> & SwitchProps, 'ref'> &
2518
+ Omit<Omit<HTMLProps<HTMLInputElement>, 'type' | 'as'> & SwitchProps, 'ref'> &
2189
2519
  RefAttributes<HTMLInputElement>
2190
2520
  >
2191
2521
 
@@ -2201,7 +2531,11 @@ export declare interface SwitchProps {
2201
2531
  */
2202
2532
  export declare const Tab: ForwardRefExoticComponent<
2203
2533
  Omit<
2204
- TabProps & Omit<HTMLProps<HTMLButtonElement>, 'label' | 'id' | 'aria-controls' | 'as' | 'type'>,
2534
+ TabProps &
2535
+ Omit<
2536
+ HTMLProps<HTMLButtonElement>,
2537
+ 'type' | 'label' | 'width' | 'id' | 'aria-controls' | 'as'
2538
+ >,
2205
2539
  'ref'
2206
2540
  > &
2207
2541
  RefAttributes<HTMLButtonElement>
@@ -2263,6 +2597,8 @@ export declare interface TabProps {
2263
2597
  }
2264
2598
 
2265
2599
  /**
2600
+ * The `Text` component is an agile, themed typographic element.
2601
+ *
2266
2602
  * @public
2267
2603
  */
2268
2604
  declare const Text_2: ForwardRefExoticComponent<
@@ -2277,6 +2613,9 @@ export {Text_2 as Text}
2277
2613
  export declare type TextAlign = 'left' | 'right' | 'center' | 'justify' | 'initial'
2278
2614
 
2279
2615
  /**
2616
+ * A multiline text input.
2617
+ *
2618
+
2280
2619
  * @public
2281
2620
  */
2282
2621
  export declare const TextArea: ForwardRefExoticComponent<
@@ -2296,10 +2635,12 @@ export declare interface TextAreaProps extends ResponsiveRadiusProps {
2296
2635
  }
2297
2636
 
2298
2637
  /**
2638
+ * Single line text input.
2639
+ *
2299
2640
  * @public
2300
2641
  */
2301
2642
  export declare const TextInput: ForwardRefExoticComponent<
2302
- Omit<TextInputProps & Omit<HTMLProps<HTMLInputElement>, 'prefix' | 'as' | 'type'>, 'ref'> &
2643
+ Omit<TextInputProps & Omit<HTMLProps<HTMLInputElement>, 'type' | 'prefix' | 'as'>, 'ref'> &
2303
2644
  RefAttributes<HTMLInputElement>
2304
2645
  >
2305
2646
 
@@ -2313,6 +2654,10 @@ export declare type TextInputClearButtonProps = Omit<ButtonProps, 'as'> &
2313
2654
  * @public
2314
2655
  */
2315
2656
  export declare interface TextInputProps {
2657
+ /**
2658
+ * @beta
2659
+ */
2660
+ __unstable_disableFocusRing?: boolean
2316
2661
  border?: boolean
2317
2662
  /**
2318
2663
  * @beta
@@ -2359,6 +2704,7 @@ export declare interface TextProps {
2359
2704
  accent?: boolean
2360
2705
  align?: TextAlign | TextAlign[]
2361
2706
  as?: React.ElementType | keyof JSX.IntrinsicElements
2707
+ /** When `true` the text color will be muted. */
2362
2708
  muted?: boolean
2363
2709
  size?: number | number[]
2364
2710
  /**
@@ -2404,7 +2750,9 @@ export declare interface Theme {
2404
2750
  */
2405
2751
  export declare interface ThemeAvatar {
2406
2752
  sizes: {
2753
+ /** Distance between avatars in an <AvatarStack> component (px) */
2407
2754
  distance: number
2755
+ /** Diameter (px) */
2408
2756
  size: number
2409
2757
  }[]
2410
2758
  focusRing: FocusRing
@@ -2826,6 +3174,10 @@ export declare type ThemeColorToneKey =
2826
3174
  | 'caution'
2827
3175
  | 'critical'
2828
3176
 
3177
+ export declare interface ThemeConfig {
3178
+ color?: ColorThemeConfig
3179
+ }
3180
+
2829
3181
  /**
2830
3182
  * @public
2831
3183
  */
@@ -2968,7 +3320,78 @@ export declare interface ThemeShadow {
2968
3320
  ambient: BoxShadow
2969
3321
  }
2970
3322
 
3323
+ export declare interface TMP_BaseColorTheme {
3324
+ _blend: ColorBlendModeValue
3325
+ dark: boolean
3326
+ base: {
3327
+ bg: string
3328
+ fg: string
3329
+ border: string
3330
+ focusRing: string
3331
+ shadow: {
3332
+ outline: string
3333
+ umbra: string
3334
+ penumbra: string
3335
+ ambient: string
3336
+ }
3337
+ skeleton: {
3338
+ from: string
3339
+ to: string
3340
+ }
3341
+ }
3342
+ button: TMP_ButtonColorTheme
3343
+ }
3344
+
3345
+ export declare type TMP_ButtonColorTheme = Record<ColorStateTone, TMP_ButtonModesColorTheme>
3346
+
3347
+ export declare type TMP_ButtonModesColorTheme = Record<ColorButtonMode, TMP_ButtonStatesColorTheme>
3348
+
3349
+ export declare type TMP_ButtonStatesColorTheme = Record<ColorState, TMP_StateColorTheme>
3350
+
3351
+ export declare type TMP_ColorPalette = {
3352
+ black: string | ColorTint
3353
+ white: string | ColorTint
3354
+ } & Record<ColorHueValue, Record<ColorTintValue, string | ColorTint>>
3355
+
3356
+ export declare type TMP_ColorTheme = Record<ColorBaseTone, TMP_BaseColorTheme>
3357
+
3358
+ export declare interface TMP_StateColorTheme {
3359
+ _blend: ColorBlendModeValue
3360
+ bg: string
3361
+ bg2?: string
3362
+ fg: string
3363
+ border: string
3364
+ muted: {
3365
+ fg: string
3366
+ }
3367
+ accent: {
3368
+ fg: string
3369
+ }
3370
+ link: {
3371
+ fg: string
3372
+ }
3373
+ code: {
3374
+ bg: string
3375
+ fg: string
3376
+ }
3377
+ skeleton?: {
3378
+ from: string
3379
+ to: string
3380
+ }
3381
+ }
3382
+
3383
+ export declare interface TMP_Theme {
3384
+ color: {
3385
+ light: TMP_ColorTheme
3386
+ dark: TMP_ColorTheme
3387
+ }
3388
+ }
3389
+
2971
3390
  /**
3391
+ * The `Toast` component gives feedback to users when an action has taken place.
3392
+ *
3393
+ * Toasts can be closed with a close button, or auto-dismiss after a certain timeout.
3394
+ *
2972
3395
  * @public
2973
3396
  */
2974
3397
  export declare function Toast(
@@ -3023,7 +3446,47 @@ export declare interface ToastProviderProps {
3023
3446
  zOffset?: number | number[]
3024
3447
  }
3025
3448
 
3449
+ export declare interface TokenBaseKeyNode {
3450
+ type: 'base'
3451
+ tone: ColorConfigBaseTone
3452
+ key: ColorConfigBaseKey | ColorConfigBlendKey
3453
+ }
3454
+
3455
+ export declare interface TokenBlendModeValueNode {
3456
+ type: 'blendMode'
3457
+ value?: ColorBlendModeValue
3458
+ }
3459
+
3460
+ export declare interface TokenButtonKeyNode {
3461
+ type: 'button'
3462
+ tone: ColorConfigStateTone
3463
+ mode: ColorButtonMode
3464
+ key: ColorConfigStateKey | ColorConfigBlendKey
3465
+ }
3466
+
3467
+ export declare interface TokenColorValueNode {
3468
+ type: 'color'
3469
+ key?: 'black' | 'white' | `${ColorHueValue}/${ColorTintValue}` | ColorTintValue
3470
+ hue?: ColorHueValue
3471
+ tint?: ColorTintValue
3472
+ opacity?: number
3473
+ }
3474
+
3475
+ export declare interface TokenHueValueNode {
3476
+ type: 'hue'
3477
+ value?: ColorHueValue
3478
+ }
3479
+
3480
+ export declare type TokenKeyNode = TokenBaseKeyNode | TokenButtonKeyNode
3481
+
3482
+ export declare type TokenValueNode =
3483
+ | TokenColorValueNode
3484
+ | TokenHueValueNode
3485
+ | TokenBlendModeValueNode
3486
+
3026
3487
  /**
3488
+ * Tooltips display information when hovering, focusing or tapping.
3489
+ *
3027
3490
  * @public
3028
3491
  */
3029
3492
  export declare const Tooltip: ForwardRefExoticComponent<
@@ -3085,6 +3548,7 @@ export declare interface TooltipProps extends Omit<LayerProps, 'as'> {
3085
3548
  fallbackPlacements?: Placement[]
3086
3549
  padding?: number | number[]
3087
3550
  placement?: Placement
3551
+ /** Whether or not to render the tooltip in a portal element. */
3088
3552
  portal?: boolean | string
3089
3553
  scheme?: ThemeColorSchemeKey
3090
3554
  shadow?: number | number[]