@sanity/ui 2.0.0-alpha.16 → 2.0.0-alpha.17

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 (40) hide show
  1. package/dist/index.d.ts +79 -1
  2. package/dist/index.esm.js +4 -4
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.js +4 -4
  5. package/dist/index.js.map +1 -1
  6. package/package.json +2 -2
  7. package/src/components/autocomplete/autocomplete.tsx +6 -0
  8. package/src/components/dialog/dialog.tsx +2 -0
  9. package/src/components/hotkeys/hotkeys.tsx +2 -0
  10. package/src/components/menu/menu.tsx +2 -0
  11. package/src/components/menu/menuButton.tsx +2 -0
  12. package/src/components/toast/toast.tsx +4 -0
  13. package/src/primitives/_selectable/style.ts +2 -0
  14. package/src/primitives/avatar/avatar.tsx +2 -0
  15. package/src/primitives/badge/badge.tsx +2 -0
  16. package/src/primitives/box/box.tsx +3 -0
  17. package/src/primitives/button/styles.ts +1 -0
  18. package/src/primitives/card/card.tsx +3 -0
  19. package/src/primitives/card/styles.ts +2 -0
  20. package/src/primitives/checkbox/checkbox.tsx +2 -0
  21. package/src/primitives/code/code.tsx +1 -0
  22. package/src/primitives/container/container.tsx +2 -0
  23. package/src/primitives/flex/flex.tsx +2 -0
  24. package/src/primitives/grid/grid.tsx +2 -0
  25. package/src/primitives/heading/heading.tsx +2 -0
  26. package/src/primitives/inline/inline.tsx +3 -0
  27. package/src/primitives/kbd/kbd.tsx +2 -0
  28. package/src/primitives/label/label.tsx +2 -0
  29. package/src/primitives/popover/popover.tsx +6 -1
  30. package/src/primitives/radio/radio.tsx +2 -0
  31. package/src/primitives/select/select.tsx +2 -0
  32. package/src/primitives/select/styles.ts +2 -0
  33. package/src/primitives/spinner/spinner.tsx +2 -0
  34. package/src/primitives/stack/stack.tsx +2 -0
  35. package/src/primitives/switch/switch.tsx +4 -0
  36. package/src/primitives/text/text.tsx +3 -0
  37. package/src/primitives/textArea/textArea.tsx +3 -0
  38. package/src/primitives/textInput/textInput.tsx +2 -0
  39. package/src/primitives/tooltip/tooltip.tsx +3 -0
  40. package/src/primitives/types.ts +4 -0
package/dist/index.d.ts CHANGED
@@ -44,6 +44,9 @@ export declare type ArrayPropPrimitive = string | number | boolean | undefined |
44
44
  export declare function attemptFocus(element: HTMLElement): boolean
45
45
 
46
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
+ *
47
50
  * @public
48
51
  */
49
52
  export declare const Autocomplete: <Option extends BaseAutocompleteOption>(
@@ -128,6 +131,7 @@ export declare interface AutocompleteProps<
128
131
  onSelect?: (value: string) => void
129
132
  /** @beta */
130
133
  openButton?: boolean | AutocompleteOpenButtonProps
134
+ /** The options to render. */
131
135
  options?: Option[]
132
136
  padding?: number | number[]
133
137
  popover?: Omit<PopoverProps, 'content' | 'onMouseEnter' | 'onMouseLeave' | 'open'> &
@@ -136,6 +140,7 @@ export declare interface AutocompleteProps<
136
140
  radius?: Radius | Radius[]
137
141
  /** @beta */
138
142
  relatedElements?: HTMLElement[]
143
+ /** The callback function for rendering each option. */
139
144
  renderOption?: (option: Option) => ReactElement
140
145
  /** @beta */
141
146
  renderPopover?: (
@@ -150,6 +155,7 @@ export declare interface AutocompleteProps<
150
155
  ) => ReactNode
151
156
  renderValue?: (value: string, option?: Option) => string
152
157
  suffix?: ReactNode
158
+ /** The current value. */
153
159
  value?: string
154
160
  }
155
161
 
@@ -219,6 +225,8 @@ export declare interface AutocompleteValueChangeMsg {
219
225
  }
220
226
 
221
227
  /**
228
+ * Avatars are used to represent people and other agents (e.g. bots).
229
+ *
222
230
  * @public
223
231
  */
224
232
  export declare const Avatar: ForwardRefExoticComponent<
@@ -303,6 +311,8 @@ export declare interface AvatarStackProps {
303
311
  export declare type AvatarStatus = 'online' | 'editing' | 'inactive'
304
312
 
305
313
  /**
314
+ * Badges are used to tag resources.
315
+ *
306
316
  * @public
307
317
  */
308
318
  export declare const Badge: ForwardRefExoticComponent<
@@ -412,6 +422,9 @@ export declare interface BoundaryElementProviderProps {
412
422
  }
413
423
 
414
424
  /**
425
+ * The `Box` component is a basic layout wrapper component which provides utility properties
426
+ * for flex, margins and padding.
427
+ *
415
428
  * @public
416
429
  */
417
430
  export declare const Box: ForwardRefExoticComponent<
@@ -539,6 +552,9 @@ export declare type ButtonTone = 'default' | 'primary' | 'positive' | 'caution'
539
552
  export declare type ButtonWidth = 'fill'
540
553
 
541
554
  /**
555
+ * The `Card` component acts much like a `Box`, but with a background and foreground color.
556
+ * Components within a `Card` inherit its colors.
557
+ *
542
558
  * @public
543
559
  */
544
560
  export declare const Card: ForwardRefExoticComponent<
@@ -584,6 +600,8 @@ export declare interface CardStyleProps {
584
600
  export declare type CardTone = ThemeColorToneKey | 'inherit'
585
601
 
586
602
  /**
603
+ * Checkboxes allow the user to select one or more items from a set.
604
+ *
587
605
  * @public
588
606
  */
589
607
  export declare const Checkbox: ForwardRefExoticComponent<
@@ -616,6 +634,7 @@ export declare const Code: ForwardRefExoticComponent<
616
634
  */
617
635
  export declare interface CodeProps {
618
636
  as?: React.ElementType | keyof JSX.IntrinsicElements
637
+ /** Define the language to use for syntax highlighting. */
619
638
  language?: string
620
639
  size?: number | number[]
621
640
  weight?: string
@@ -801,6 +820,8 @@ export declare interface ColorTokens extends Partial<Record<ColorConfigBaseTone,
801
820
  export declare type ColorTokenValue = [ColorConfigValue, ColorConfigValue]
802
821
 
803
822
  /**
823
+ * The `Container` component wraps content layout in a defined set of widths.
824
+ *
804
825
  * @public
805
826
  */
806
827
  export declare const Container: ForwardRefExoticComponent<
@@ -839,6 +860,8 @@ export declare type Delay =
839
860
  }>
840
861
 
841
862
  /**
863
+ * The Dialog component.
864
+ *
842
865
  * @public
843
866
  */
844
867
  export declare const Dialog: ForwardRefExoticComponent<
@@ -997,6 +1020,8 @@ export declare function _fillCSSObject(
997
1020
  ): CSSObject
998
1021
 
999
1022
  /**
1023
+ * The `Flex` component is a wrapper component for flexible elements (`Box`, `Card` and `Flex`).
1024
+ *
1000
1025
  * @public
1001
1026
  */
1002
1027
  export declare const Flex: ForwardRefExoticComponent<
@@ -1085,6 +1110,8 @@ export declare function _getResponsiveSpace(
1085
1110
  ): CSSObject[] | null
1086
1111
 
1087
1112
  /**
1113
+ * The `Grid` component is for building 2-dimensional layers (based on CSS grid).
1114
+ *
1088
1115
  * @public
1089
1116
  */
1090
1117
  export declare const Grid: ForwardRefExoticComponent<
@@ -1148,6 +1175,8 @@ export declare interface GridProps extends Omit<BoxProps, 'display'>, Responsive
1148
1175
  export declare function _hasFocus(element: HTMLElement): boolean
1149
1176
 
1150
1177
  /**
1178
+ * Typographic headings.
1179
+ *
1151
1180
  * @public
1152
1181
  */
1153
1182
  export declare const Heading: ForwardRefExoticComponent<
@@ -1199,6 +1228,8 @@ export declare interface HeadingSkeletonProps extends SkeletonProps {
1199
1228
  export declare function hexToRgb(hex: string): RGB
1200
1229
 
1201
1230
  /**
1231
+ * Represent hotkeys (a keyboard combination) with semantic `<kbd>` elements.
1232
+ *
1202
1233
  * @public
1203
1234
  */
1204
1235
  export declare const Hotkeys: ForwardRefExoticComponent<
@@ -1231,6 +1262,8 @@ export declare interface HSL {
1231
1262
  export declare function hslToRgb(hsl: HSL): RGB
1232
1263
 
1233
1264
  /**
1265
+ * The `Inline` component is a layout utility for aligning and spacing items horizontally.
1266
+ *
1234
1267
  * @public
1235
1268
  */
1236
1269
  export declare const Inline: ForwardRefExoticComponent<
@@ -1241,6 +1274,7 @@ export declare const Inline: ForwardRefExoticComponent<
1241
1274
  * @public
1242
1275
  */
1243
1276
  export declare interface InlineProps extends Omit<BoxProps, 'display'> {
1277
+ /** The spacing between children. */
1244
1278
  space?: number | number[]
1245
1279
  }
1246
1280
 
@@ -1314,6 +1348,8 @@ export declare function isHTMLTextAreaElement(element: unknown): element is HTML
1314
1348
  export declare function _isScrollable(el: Node): boolean
1315
1349
 
1316
1350
  /**
1351
+ * Used to define some text as keyboard input.
1352
+ *
1317
1353
  * @public
1318
1354
  */
1319
1355
  export declare const KBD: ForwardRefExoticComponent<
@@ -1331,6 +1367,8 @@ export declare interface KBDProps {
1331
1367
  }
1332
1368
 
1333
1369
  /**
1370
+ * Typographic labels.
1371
+ *
1334
1372
  * @public
1335
1373
  */
1336
1374
  export declare const Label: ForwardRefExoticComponent<
@@ -1434,6 +1472,8 @@ export declare interface _MediaStore {
1434
1472
  }
1435
1473
 
1436
1474
  /**
1475
+ * The `Menu` component is a building block for application menus.
1476
+ *
1437
1477
  * @public
1438
1478
  */
1439
1479
  export declare const Menu: ForwardRefExoticComponent<
@@ -1442,6 +1482,8 @@ export declare const Menu: ForwardRefExoticComponent<
1442
1482
  >
1443
1483
 
1444
1484
  /**
1485
+ * The `MenuButton` component follows the WAI-ARIA specification for menu buttons.
1486
+ *
1445
1487
  * @public
1446
1488
  */
1447
1489
  export declare const MenuButton: ForwardRefExoticComponent<
@@ -1918,7 +1960,11 @@ export declare type Placement =
1918
1960
  | 'left-start'
1919
1961
  | 'left-end'
1920
1962
 
1921
- /** @public */
1963
+ /**
1964
+ * The `Popover` component is used to display some content on top of another.
1965
+ *
1966
+ * @public
1967
+ */
1922
1968
  export declare const Popover: MemoExoticComponent<
1923
1969
  ForwardRefExoticComponent<
1924
1970
  Omit<
@@ -1955,6 +2001,7 @@ export declare interface PopoverProps
1955
2001
  overflow?: BoxOverflow
1956
2002
  padding?: number | number[]
1957
2003
  placement?: Placement
2004
+ /** Whether or not to render the popover in a portal element. */
1958
2005
  portal?: boolean | string
1959
2006
  preventOverflow?: boolean
1960
2007
  referenceBoundary?: HTMLElement | null
@@ -2022,6 +2069,8 @@ export declare interface PortalProviderProps {
2022
2069
  }
2023
2070
 
2024
2071
  /**
2072
+ * The `Radio` component allows the user to select one option from a set.
2073
+ *
2025
2074
  * @public
2026
2075
  */
2027
2076
  export declare const Radio: ForwardRefExoticComponent<
@@ -2110,6 +2159,7 @@ export declare function responsiveCodeFontStyle(
2110
2159
  * @public
2111
2160
  */
2112
2161
  export declare interface ResponsiveFlexItemProps {
2162
+ /** Sets the flex CSS attribute. The property is responsive. */
2113
2163
  flex?: FlexValue | FlexValue[]
2114
2164
  }
2115
2165
 
@@ -2187,8 +2237,11 @@ export declare function responsiveLabelFont(
2187
2237
  * @public
2188
2238
  */
2189
2239
  export declare interface ResponsiveMarginProps {
2240
+ /** Applies margins to all sides. The property is responsive. */
2190
2241
  margin?: number | number[]
2242
+ /** Applies margins to the left and right sides. The property is responsive. */
2191
2243
  marginX?: number | number[]
2244
+ /** Applies margins to the top and bottom sides. The property is responsive. */
2192
2245
  marginY?: number | number[]
2193
2246
  marginTop?: number | number[]
2194
2247
  marginRight?: number | number[]
@@ -2315,6 +2368,8 @@ declare function screen_2(b: RGB | RGBA, s: RGB | RGBA): RGB
2315
2368
  export {screen_2 as screen}
2316
2369
 
2317
2370
  /**
2371
+ * The `Select` component provides control of options.
2372
+ *
2318
2373
  * @public
2319
2374
  */
2320
2375
  export declare const Select: ForwardRefExoticComponent<
@@ -2356,6 +2411,8 @@ export declare interface SkeletonProps extends ResponsiveRadiusProps, Omit<BoxPr
2356
2411
  }
2357
2412
 
2358
2413
  /**
2414
+ * Indicate that something is loading for an indeterminate amount of time.
2415
+ *
2359
2416
  * @public
2360
2417
  */
2361
2418
  export declare const Spinner: ForwardRefExoticComponent<
@@ -2388,6 +2445,8 @@ export declare interface SrOnlyProps {
2388
2445
  }
2389
2446
 
2390
2447
  /**
2448
+ * The `Stack` component is used to place elements on top of each other.
2449
+ *
2391
2450
  * @public
2392
2451
  */
2393
2452
  export declare const Stack: ForwardRefExoticComponent<
@@ -2447,6 +2506,10 @@ export declare interface Styles {
2447
2506
  }
2448
2507
 
2449
2508
  /**
2509
+ * The `Switch` component allows the user to toggle a setting on and off.
2510
+ *
2511
+ * Extends all properties of an `<input type="checkbox" />` element, except type.
2512
+ *
2450
2513
  * @public
2451
2514
  */
2452
2515
  export declare const Switch: ForwardRefExoticComponent<
@@ -2532,6 +2595,8 @@ export declare interface TabProps {
2532
2595
  }
2533
2596
 
2534
2597
  /**
2598
+ * The `Text` component is an agile, themed typographic element.
2599
+ *
2535
2600
  * @public
2536
2601
  */
2537
2602
  declare const Text_2: ForwardRefExoticComponent<
@@ -2546,6 +2611,9 @@ export {Text_2 as Text}
2546
2611
  export declare type TextAlign = 'left' | 'right' | 'center' | 'justify' | 'initial'
2547
2612
 
2548
2613
  /**
2614
+ * A multiline text input.
2615
+ *
2616
+
2549
2617
  * @public
2550
2618
  */
2551
2619
  export declare const TextArea: ForwardRefExoticComponent<
@@ -2565,6 +2633,8 @@ export declare interface TextAreaProps extends ResponsiveRadiusProps {
2565
2633
  }
2566
2634
 
2567
2635
  /**
2636
+ * Single line text input.
2637
+ *
2568
2638
  * @public
2569
2639
  */
2570
2640
  export declare const TextInput: ForwardRefExoticComponent<
@@ -2628,6 +2698,7 @@ export declare interface TextProps {
2628
2698
  accent?: boolean
2629
2699
  align?: TextAlign | TextAlign[]
2630
2700
  as?: React.ElementType | keyof JSX.IntrinsicElements
2701
+ /** When `true` the text color will be muted. */
2631
2702
  muted?: boolean
2632
2703
  size?: number | number[]
2633
2704
  /**
@@ -3309,6 +3380,10 @@ export declare interface TMP_Theme {
3309
3380
  }
3310
3381
 
3311
3382
  /**
3383
+ * The `Toast` component gives feedback to users when an action has taken place.
3384
+ *
3385
+ * Toasts can be closed with a close button, or auto-dismiss after a certain timeout.
3386
+ *
3312
3387
  * @public
3313
3388
  */
3314
3389
  export declare function Toast(
@@ -3402,6 +3477,8 @@ export declare type TokenValueNode =
3402
3477
  | TokenBlendModeValueNode
3403
3478
 
3404
3479
  /**
3480
+ * Tooltips display information when hovering, focusing or tapping.
3481
+ *
3405
3482
  * @public
3406
3483
  */
3407
3484
  export declare const Tooltip: ForwardRefExoticComponent<
@@ -3463,6 +3540,7 @@ export declare interface TooltipProps extends Omit<LayerProps, 'as'> {
3463
3540
  fallbackPlacements?: Placement[]
3464
3541
  padding?: number | number[]
3465
3542
  placement?: Placement
3543
+ /** Whether or not to render the tooltip in a portal element. */
3466
3544
  portal?: boolean | string
3467
3545
  scheme?: ThemeColorSchemeKey
3468
3546
  shadow?: number | number[]
package/dist/index.esm.js CHANGED
@@ -5439,7 +5439,7 @@ function buttonBaseStyles(_ref24) {
5439
5439
  let {
5440
5440
  $width
5441
5441
  } = _ref24;
5442
- return css(_b$k || (_b$k = __template$x(["\n -webkit-font-smoothing: inherit;\n appearance: none;\n display: inline-flex;\n align-items: center;\n font: inherit;\n border: 0;\n outline: none;\n user-select: none;\n text-decoration: none;\n border: 0;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n text-align: left;\n position: relative;\n\n ", "\n\n & > span {\n display: block;\n flex: 1;\n min-width: 0;\n border-radius: inherit;\n }\n\n &::-moz-focus-inner {\n border: 0;\n padding: 0;\n }\n "])), $width === "fill" && css(_a$x || (_a$x = __template$x(["\n width: -webkit-fill-available;\n width: stretch;\n "]))));
5442
+ return css(_b$k || (_b$k = __template$x(["\n -webkit-font-smoothing: inherit;\n appearance: none;\n display: inline-flex;\n align-items: center;\n font: inherit;\n border: 0;\n outline: none;\n user-select: none;\n text-decoration: none;\n border: 0;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n text-align: left;\n position: relative;\n\n ", "\n\n & > span {\n display: block;\n flex: 1;\n min-width: 0;\n border-radius: inherit;\n }\n\n &::-moz-focus-inner {\n border: 0;\n padding: 0;\n }\n "])), $width === "fill" && css(_a$x || (_a$x = __template$x(["\n width: -moz-available;\n width: -webkit-fill-available;\n width: stretch;\n "]))));
5443
5443
  }
5444
5444
  const buttonTheme = {
5445
5445
  border: {
@@ -5617,7 +5617,7 @@ function cardBaseStyle(props) {
5617
5617
  theme
5618
5618
  } = props;
5619
5619
  const space = theme.sanity.space;
5620
- return css(_b$j || (_b$j = __template$v(["\n ", "\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n outline: none;\n text-decoration: none;\n }\n\n /* &:is(pre) */\n &[data-as='pre'] {\n font: inherit;\n }\n "])), $checkered && css(_a$v || (_a$v = __template$v(["\n background-size: ", "px ", "px;\n background-position: 50% 50%;\n background-image: var(--card-bg-image);\n "])), space[3], space[3]));
5620
+ return css(_b$j || (_b$j = __template$v(["\n ", "\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: -moz-available;\n width: -webkit-fill-available;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n outline: none;\n text-decoration: none;\n }\n\n /* &:is(pre) */\n &[data-as='pre'] {\n font: inherit;\n }\n "])), $checkered && css(_a$v || (_a$v = __template$v(["\n background-size: ", "px ", "px;\n background-position: 50% 50%;\n background-image: var(--card-bg-image);\n "])), space[3], space[3]));
5621
5621
  }
5622
5622
  function cardColorStyle(props) {
5623
5623
  var _a2, _b2;
@@ -7315,7 +7315,7 @@ var __template$j = (cooked, raw) => __freeze$j(__defProp$j(cooked, "raw", {
7315
7315
  }));
7316
7316
  var _a$j, _b$c, _c$7, _d$5;
7317
7317
  function rootStyle() {
7318
- return css(_a$j || (_a$j = __template$j(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
7318
+ return css(_a$j || (_a$j = __template$j(["\n position: relative;\n width: -moz-available;\n width: -webkit-fill-available;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
7319
7319
  }
7320
7320
  function inputBaseStyle(props) {
7321
7321
  const {
@@ -9497,7 +9497,7 @@ var __template$7 = (cooked, raw) => __freeze$7(__defProp$7(cooked, "raw", {
9497
9497
  }));
9498
9498
  var _a$7, _b$4;
9499
9499
  function selectableBaseStyle() {
9500
- return css(_a$7 || (_a$7 = __template$7(["\n background-color: inherit;\n color: inherit;\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n text-decoration: none;\n }\n "])));
9500
+ return css(_a$7 || (_a$7 = __template$7(["\n background-color: inherit;\n color: inherit;\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: -moz-available;\n width: -webkit-fill-available;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n text-decoration: none;\n }\n "])));
9501
9501
  }
9502
9502
  function selectableColorStyle(props) {
9503
9503
  var _a2, _b2;