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

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 (46) hide show
  1. package/dist/index.d.ts +83 -1
  2. package/dist/index.esm.js +35 -22
  3. package/dist/index.esm.js.map +1 -1
  4. package/dist/index.js +35 -22
  5. package/dist/index.js.map +1 -1
  6. package/package.json +5 -7
  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 +16 -9
  15. package/src/primitives/avatar/avatarCounter.tsx +3 -3
  16. package/src/primitives/avatar/styles.ts +1 -1
  17. package/src/primitives/badge/badge.tsx +2 -0
  18. package/src/primitives/box/box.tsx +3 -0
  19. package/src/primitives/button/__workshop__/sanityUploadButton.tsx +2 -1
  20. package/src/primitives/button/styles.ts +1 -0
  21. package/src/primitives/card/card.tsx +3 -0
  22. package/src/primitives/card/styles.ts +2 -0
  23. package/src/primitives/checkbox/checkbox.tsx +2 -0
  24. package/src/primitives/code/code.tsx +1 -0
  25. package/src/primitives/container/container.tsx +2 -0
  26. package/src/primitives/flex/flex.tsx +2 -0
  27. package/src/primitives/grid/grid.tsx +2 -0
  28. package/src/primitives/heading/heading.tsx +2 -0
  29. package/src/primitives/inline/inline.tsx +3 -0
  30. package/src/primitives/kbd/kbd.tsx +2 -0
  31. package/src/primitives/label/label.tsx +2 -0
  32. package/src/primitives/popover/popover.tsx +6 -1
  33. package/src/primitives/radio/radio.tsx +2 -0
  34. package/src/primitives/select/select.tsx +2 -0
  35. package/src/primitives/select/styles.ts +2 -0
  36. package/src/primitives/spinner/spinner.tsx +2 -0
  37. package/src/primitives/stack/stack.tsx +2 -0
  38. package/src/primitives/switch/switch.tsx +4 -0
  39. package/src/primitives/text/text.tsx +3 -0
  40. package/src/primitives/textArea/textArea.tsx +3 -0
  41. package/src/primitives/textInput/textInput.tsx +2 -0
  42. package/src/primitives/tooltip/tooltip.test.tsx +67 -0
  43. package/src/primitives/tooltip/tooltip.tsx +28 -5
  44. package/src/primitives/types.ts +4 -0
  45. package/src/theme/lib/theme/avatar.ts +2 -0
  46. package/src/theme/studioTheme/theme.ts +4 -4
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<
@@ -255,6 +263,8 @@ export declare interface AvatarProps {
255
263
  arrowPosition?: AvatarPosition
256
264
  as?: React.ElementType | keyof JSX.IntrinsicElements
257
265
  color?: ThemeColorSpotKey
266
+ /** @beta */
267
+ hideInnerStroke?: boolean
258
268
  initials?: string
259
269
  onImageLoadError?: (event: Error) => void
260
270
  size?: AvatarSize | AvatarSize[]
@@ -303,6 +313,8 @@ export declare interface AvatarStackProps {
303
313
  export declare type AvatarStatus = 'online' | 'editing' | 'inactive'
304
314
 
305
315
  /**
316
+ * Badges are used to tag resources.
317
+ *
306
318
  * @public
307
319
  */
308
320
  export declare const Badge: ForwardRefExoticComponent<
@@ -412,6 +424,9 @@ export declare interface BoundaryElementProviderProps {
412
424
  }
413
425
 
414
426
  /**
427
+ * The `Box` component is a basic layout wrapper component which provides utility properties
428
+ * for flex, margins and padding.
429
+ *
415
430
  * @public
416
431
  */
417
432
  export declare const Box: ForwardRefExoticComponent<
@@ -539,6 +554,9 @@ export declare type ButtonTone = 'default' | 'primary' | 'positive' | 'caution'
539
554
  export declare type ButtonWidth = 'fill'
540
555
 
541
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
+ *
542
560
  * @public
543
561
  */
544
562
  export declare const Card: ForwardRefExoticComponent<
@@ -584,6 +602,8 @@ export declare interface CardStyleProps {
584
602
  export declare type CardTone = ThemeColorToneKey | 'inherit'
585
603
 
586
604
  /**
605
+ * Checkboxes allow the user to select one or more items from a set.
606
+ *
587
607
  * @public
588
608
  */
589
609
  export declare const Checkbox: ForwardRefExoticComponent<
@@ -616,6 +636,7 @@ export declare const Code: ForwardRefExoticComponent<
616
636
  */
617
637
  export declare interface CodeProps {
618
638
  as?: React.ElementType | keyof JSX.IntrinsicElements
639
+ /** Define the language to use for syntax highlighting. */
619
640
  language?: string
620
641
  size?: number | number[]
621
642
  weight?: string
@@ -801,6 +822,8 @@ export declare interface ColorTokens extends Partial<Record<ColorConfigBaseTone,
801
822
  export declare type ColorTokenValue = [ColorConfigValue, ColorConfigValue]
802
823
 
803
824
  /**
825
+ * The `Container` component wraps content layout in a defined set of widths.
826
+ *
804
827
  * @public
805
828
  */
806
829
  export declare const Container: ForwardRefExoticComponent<
@@ -839,6 +862,8 @@ export declare type Delay =
839
862
  }>
840
863
 
841
864
  /**
865
+ * The Dialog component.
866
+ *
842
867
  * @public
843
868
  */
844
869
  export declare const Dialog: ForwardRefExoticComponent<
@@ -997,6 +1022,8 @@ export declare function _fillCSSObject(
997
1022
  ): CSSObject
998
1023
 
999
1024
  /**
1025
+ * The `Flex` component is a wrapper component for flexible elements (`Box`, `Card` and `Flex`).
1026
+ *
1000
1027
  * @public
1001
1028
  */
1002
1029
  export declare const Flex: ForwardRefExoticComponent<
@@ -1085,6 +1112,8 @@ export declare function _getResponsiveSpace(
1085
1112
  ): CSSObject[] | null
1086
1113
 
1087
1114
  /**
1115
+ * The `Grid` component is for building 2-dimensional layers (based on CSS grid).
1116
+ *
1088
1117
  * @public
1089
1118
  */
1090
1119
  export declare const Grid: ForwardRefExoticComponent<
@@ -1148,6 +1177,8 @@ export declare interface GridProps extends Omit<BoxProps, 'display'>, Responsive
1148
1177
  export declare function _hasFocus(element: HTMLElement): boolean
1149
1178
 
1150
1179
  /**
1180
+ * Typographic headings.
1181
+ *
1151
1182
  * @public
1152
1183
  */
1153
1184
  export declare const Heading: ForwardRefExoticComponent<
@@ -1199,6 +1230,8 @@ export declare interface HeadingSkeletonProps extends SkeletonProps {
1199
1230
  export declare function hexToRgb(hex: string): RGB
1200
1231
 
1201
1232
  /**
1233
+ * Represent hotkeys (a keyboard combination) with semantic `<kbd>` elements.
1234
+ *
1202
1235
  * @public
1203
1236
  */
1204
1237
  export declare const Hotkeys: ForwardRefExoticComponent<
@@ -1231,6 +1264,8 @@ export declare interface HSL {
1231
1264
  export declare function hslToRgb(hsl: HSL): RGB
1232
1265
 
1233
1266
  /**
1267
+ * The `Inline` component is a layout utility for aligning and spacing items horizontally.
1268
+ *
1234
1269
  * @public
1235
1270
  */
1236
1271
  export declare const Inline: ForwardRefExoticComponent<
@@ -1241,6 +1276,7 @@ export declare const Inline: ForwardRefExoticComponent<
1241
1276
  * @public
1242
1277
  */
1243
1278
  export declare interface InlineProps extends Omit<BoxProps, 'display'> {
1279
+ /** The spacing between children. */
1244
1280
  space?: number | number[]
1245
1281
  }
1246
1282
 
@@ -1314,6 +1350,8 @@ export declare function isHTMLTextAreaElement(element: unknown): element is HTML
1314
1350
  export declare function _isScrollable(el: Node): boolean
1315
1351
 
1316
1352
  /**
1353
+ * Used to define some text as keyboard input.
1354
+ *
1317
1355
  * @public
1318
1356
  */
1319
1357
  export declare const KBD: ForwardRefExoticComponent<
@@ -1331,6 +1369,8 @@ export declare interface KBDProps {
1331
1369
  }
1332
1370
 
1333
1371
  /**
1372
+ * Typographic labels.
1373
+ *
1334
1374
  * @public
1335
1375
  */
1336
1376
  export declare const Label: ForwardRefExoticComponent<
@@ -1434,6 +1474,8 @@ export declare interface _MediaStore {
1434
1474
  }
1435
1475
 
1436
1476
  /**
1477
+ * The `Menu` component is a building block for application menus.
1478
+ *
1437
1479
  * @public
1438
1480
  */
1439
1481
  export declare const Menu: ForwardRefExoticComponent<
@@ -1442,6 +1484,8 @@ export declare const Menu: ForwardRefExoticComponent<
1442
1484
  >
1443
1485
 
1444
1486
  /**
1487
+ * The `MenuButton` component follows the WAI-ARIA specification for menu buttons.
1488
+ *
1445
1489
  * @public
1446
1490
  */
1447
1491
  export declare const MenuButton: ForwardRefExoticComponent<
@@ -1918,7 +1962,11 @@ export declare type Placement =
1918
1962
  | 'left-start'
1919
1963
  | 'left-end'
1920
1964
 
1921
- /** @public */
1965
+ /**
1966
+ * The `Popover` component is used to display some content on top of another.
1967
+ *
1968
+ * @public
1969
+ */
1922
1970
  export declare const Popover: MemoExoticComponent<
1923
1971
  ForwardRefExoticComponent<
1924
1972
  Omit<
@@ -1955,6 +2003,7 @@ export declare interface PopoverProps
1955
2003
  overflow?: BoxOverflow
1956
2004
  padding?: number | number[]
1957
2005
  placement?: Placement
2006
+ /** Whether or not to render the popover in a portal element. */
1958
2007
  portal?: boolean | string
1959
2008
  preventOverflow?: boolean
1960
2009
  referenceBoundary?: HTMLElement | null
@@ -2022,6 +2071,8 @@ export declare interface PortalProviderProps {
2022
2071
  }
2023
2072
 
2024
2073
  /**
2074
+ * The `Radio` component allows the user to select one option from a set.
2075
+ *
2025
2076
  * @public
2026
2077
  */
2027
2078
  export declare const Radio: ForwardRefExoticComponent<
@@ -2110,6 +2161,7 @@ export declare function responsiveCodeFontStyle(
2110
2161
  * @public
2111
2162
  */
2112
2163
  export declare interface ResponsiveFlexItemProps {
2164
+ /** Sets the flex CSS attribute. The property is responsive. */
2113
2165
  flex?: FlexValue | FlexValue[]
2114
2166
  }
2115
2167
 
@@ -2187,8 +2239,11 @@ export declare function responsiveLabelFont(
2187
2239
  * @public
2188
2240
  */
2189
2241
  export declare interface ResponsiveMarginProps {
2242
+ /** Applies margins to all sides. The property is responsive. */
2190
2243
  margin?: number | number[]
2244
+ /** Applies margins to the left and right sides. The property is responsive. */
2191
2245
  marginX?: number | number[]
2246
+ /** Applies margins to the top and bottom sides. The property is responsive. */
2192
2247
  marginY?: number | number[]
2193
2248
  marginTop?: number | number[]
2194
2249
  marginRight?: number | number[]
@@ -2315,6 +2370,8 @@ declare function screen_2(b: RGB | RGBA, s: RGB | RGBA): RGB
2315
2370
  export {screen_2 as screen}
2316
2371
 
2317
2372
  /**
2373
+ * The `Select` component provides control of options.
2374
+ *
2318
2375
  * @public
2319
2376
  */
2320
2377
  export declare const Select: ForwardRefExoticComponent<
@@ -2356,6 +2413,8 @@ export declare interface SkeletonProps extends ResponsiveRadiusProps, Omit<BoxPr
2356
2413
  }
2357
2414
 
2358
2415
  /**
2416
+ * Indicate that something is loading for an indeterminate amount of time.
2417
+ *
2359
2418
  * @public
2360
2419
  */
2361
2420
  export declare const Spinner: ForwardRefExoticComponent<
@@ -2388,6 +2447,8 @@ export declare interface SrOnlyProps {
2388
2447
  }
2389
2448
 
2390
2449
  /**
2450
+ * The `Stack` component is used to place elements on top of each other.
2451
+ *
2391
2452
  * @public
2392
2453
  */
2393
2454
  export declare const Stack: ForwardRefExoticComponent<
@@ -2447,6 +2508,10 @@ export declare interface Styles {
2447
2508
  }
2448
2509
 
2449
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
+ *
2450
2515
  * @public
2451
2516
  */
2452
2517
  export declare const Switch: ForwardRefExoticComponent<
@@ -2532,6 +2597,8 @@ export declare interface TabProps {
2532
2597
  }
2533
2598
 
2534
2599
  /**
2600
+ * The `Text` component is an agile, themed typographic element.
2601
+ *
2535
2602
  * @public
2536
2603
  */
2537
2604
  declare const Text_2: ForwardRefExoticComponent<
@@ -2546,6 +2613,9 @@ export {Text_2 as Text}
2546
2613
  export declare type TextAlign = 'left' | 'right' | 'center' | 'justify' | 'initial'
2547
2614
 
2548
2615
  /**
2616
+ * A multiline text input.
2617
+ *
2618
+
2549
2619
  * @public
2550
2620
  */
2551
2621
  export declare const TextArea: ForwardRefExoticComponent<
@@ -2565,6 +2635,8 @@ export declare interface TextAreaProps extends ResponsiveRadiusProps {
2565
2635
  }
2566
2636
 
2567
2637
  /**
2638
+ * Single line text input.
2639
+ *
2568
2640
  * @public
2569
2641
  */
2570
2642
  export declare const TextInput: ForwardRefExoticComponent<
@@ -2628,6 +2700,7 @@ export declare interface TextProps {
2628
2700
  accent?: boolean
2629
2701
  align?: TextAlign | TextAlign[]
2630
2702
  as?: React.ElementType | keyof JSX.IntrinsicElements
2703
+ /** When `true` the text color will be muted. */
2631
2704
  muted?: boolean
2632
2705
  size?: number | number[]
2633
2706
  /**
@@ -2673,7 +2746,9 @@ export declare interface Theme {
2673
2746
  */
2674
2747
  export declare interface ThemeAvatar {
2675
2748
  sizes: {
2749
+ /** Distance between avatars in an <AvatarStack> component (px) */
2676
2750
  distance: number
2751
+ /** Diameter (px) */
2677
2752
  size: number
2678
2753
  }[]
2679
2754
  focusRing: FocusRing
@@ -3309,6 +3384,10 @@ export declare interface TMP_Theme {
3309
3384
  }
3310
3385
 
3311
3386
  /**
3387
+ * The `Toast` component gives feedback to users when an action has taken place.
3388
+ *
3389
+ * Toasts can be closed with a close button, or auto-dismiss after a certain timeout.
3390
+ *
3312
3391
  * @public
3313
3392
  */
3314
3393
  export declare function Toast(
@@ -3402,6 +3481,8 @@ export declare type TokenValueNode =
3402
3481
  | TokenBlendModeValueNode
3403
3482
 
3404
3483
  /**
3484
+ * Tooltips display information when hovering, focusing or tapping.
3485
+ *
3405
3486
  * @public
3406
3487
  */
3407
3488
  export declare const Tooltip: ForwardRefExoticComponent<
@@ -3463,6 +3544,7 @@ export declare interface TooltipProps extends Omit<LayerProps, 'as'> {
3463
3544
  fallbackPlacements?: Placement[]
3464
3545
  padding?: number | number[]
3465
3546
  placement?: Placement
3547
+ /** Whether or not to render the tooltip in a portal element. */
3466
3548
  portal?: boolean | string
3467
3549
  scheme?: ThemeColorSchemeKey
3468
3550
  shadow?: number | number[]
package/dist/index.esm.js CHANGED
@@ -3823,16 +3823,16 @@ const studioTheme = {
3823
3823
  avatar: {
3824
3824
  sizes: [{
3825
3825
  distance: -3,
3826
- size: 25
3826
+ size: 23
3827
3827
  }, {
3828
3828
  distance: -6,
3829
- size: 35
3829
+ size: 33
3830
3830
  }, {
3831
3831
  distance: -9,
3832
- size: 55
3832
+ size: 53
3833
3833
  }],
3834
3834
  focusRing: {
3835
- offset: 1,
3835
+ offset: 0,
3836
3836
  width: 1
3837
3837
  }
3838
3838
  },
@@ -5004,7 +5004,7 @@ function avatarBgStrokeStyle() {
5004
5004
  }
5005
5005
  function avatarStrokeStyle() {
5006
5006
  return {
5007
- strokeWidth: "3px",
5007
+ strokeWidth: "2px",
5008
5008
  '[data-status="editing"] &': {
5009
5009
  strokeDasharray: "2 4",
5010
5010
  strokeLinecap: "round"
@@ -5026,6 +5026,7 @@ const Avatar = forwardRef(function Avatar2(props, ref) {
5026
5026
  onImageLoadError,
5027
5027
  arrowPosition: arrowPositionProp,
5028
5028
  animateArrowFrom,
5029
+ hideInnerStroke,
5029
5030
  status = "online",
5030
5031
  size: sizeProp = 0,
5031
5032
  ...restProps
@@ -5100,7 +5101,7 @@ const Avatar = forwardRef(function Avatar2(props, ref) {
5100
5101
  cy: _radius,
5101
5102
  r: _radius,
5102
5103
  fill: "url(#".concat(imageId, ")")
5103
- }), /* @__PURE__ */jsx(BgStroke, {
5104
+ }), !hideInnerStroke && /* @__PURE__ */jsx(BgStroke, {
5104
5105
  cx: _radius,
5105
5106
  cy: _radius,
5106
5107
  rx: _radius,
@@ -5119,9 +5120,8 @@ const Avatar = forwardRef(function Avatar2(props, ref) {
5119
5120
  children: /* @__PURE__ */jsx(Text, {
5120
5121
  as: "span",
5121
5122
  size: initialsSize,
5122
- children: /* @__PURE__ */jsx("strong", {
5123
- children: initials
5124
- })
5123
+ weight: "medium",
5124
+ children: initials
5125
5125
  })
5126
5126
  })
5127
5127
  })]
@@ -5155,7 +5155,7 @@ function _avatarCounterBaseStyle(props) {
5155
5155
  const {
5156
5156
  theme
5157
5157
  } = props;
5158
- return css(_a$A || (_a$A = __template$A(["\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n user-select: none;\n color: inherit;\n color: var(--card-fg-color);\n background: var(--card-bg-color);\n box-shadow:\n 0 0 0 1px var(--card-bg-color),\n inset 0 0 0 1.5px var(--card-hairline-hard-color);\n padding: 0 ", ";\n\n &:not([hidden]) {\n display: flex;\n }\n "])), rem(theme.sanity.space[2]));
5158
+ return css(_a$A || (_a$A = __template$A(["\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n user-select: none;\n color: inherit;\n color: var(--card-fg-color);\n background: var(--card-bg-color);\n box-shadow:\n 0 0 0 1px var(--card-bg-color),\n inset 0 0 0 1px var(--card-hairline-hard-color);\n padding: 0 ", ";\n\n &:not([hidden]) {\n display: flex;\n }\n "])), rem(theme.sanity.space[2]));
5159
5159
  }
5160
5160
  const Root$C = styled.div(_responsiveAvatarCounterSizeStyle, _avatarCounterBaseStyle);
5161
5161
  const AvatarCounter = forwardRef(function AvatarCounter2(props, ref) {
@@ -5172,9 +5172,8 @@ const AvatarCounter = forwardRef(function AvatarCounter2(props, ref) {
5172
5172
  children: /* @__PURE__ */jsx(Text, {
5173
5173
  as: "span",
5174
5174
  size: counterSize,
5175
- children: /* @__PURE__ */jsx("strong", {
5176
- children: count
5177
- })
5175
+ weight: "medium",
5176
+ children: count
5178
5177
  })
5179
5178
  });
5180
5179
  });
@@ -5439,7 +5438,7 @@ function buttonBaseStyles(_ref24) {
5439
5438
  let {
5440
5439
  $width
5441
5440
  } = _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 "]))));
5441
+ 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
5442
  }
5444
5443
  const buttonTheme = {
5445
5444
  border: {
@@ -5617,7 +5616,7 @@ function cardBaseStyle(props) {
5617
5616
  theme
5618
5617
  } = props;
5619
5618
  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]));
5619
+ 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
5620
  }
5622
5621
  function cardColorStyle(props) {
5623
5622
  var _a2, _b2;
@@ -7315,7 +7314,7 @@ var __template$j = (cooked, raw) => __freeze$j(__defProp$j(cooked, "raw", {
7315
7314
  }));
7316
7315
  var _a$j, _b$c, _c$7, _d$5;
7317
7316
  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 "])));
7317
+ 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
7318
  }
7320
7319
  function inputBaseStyle(props) {
7321
7320
  const {
@@ -7981,19 +7980,21 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
7981
7980
  const closeDelayProp = typeof delay === "number" ? delay : (delay == null ? void 0 : delay.close) || 0;
7982
7981
  const openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp;
7983
7982
  const closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp;
7984
- const handleIsOpenChange = useCallback(open => {
7983
+ const handleIsOpenChange = useCallback((open, immediate) => {
7985
7984
  if (isInsideGroup) {
7986
7985
  if (open) {
7987
- delayGroupContext.setIsGroupActive(open, openDelay);
7988
- delayGroupContext.setOpenTooltipId(tooltipId, openDelay);
7986
+ const groupedOpenDelay = immediate ? 0 : openDelay;
7987
+ delayGroupContext.setIsGroupActive(open, groupedOpenDelay);
7988
+ delayGroupContext.setOpenTooltipId(tooltipId, groupedOpenDelay);
7989
7989
  } else {
7990
7990
  const minimumGroupDeactivateDelay = 200;
7991
7991
  const groupDeactivateDelay = closeDelay > minimumGroupDeactivateDelay ? closeDelay : minimumGroupDeactivateDelay;
7992
7992
  delayGroupContext.setIsGroupActive(open, groupDeactivateDelay);
7993
- delayGroupContext.setOpenTooltipId(null, closeDelay);
7993
+ delayGroupContext.setOpenTooltipId(null, immediate ? 0 : closeDelay);
7994
7994
  }
7995
7995
  } else {
7996
- setIsOpen(open, open ? openDelay : closeDelay);
7996
+ const standaloneDelay = immediate ? 0 : open ? openDelay : closeDelay;
7997
+ setIsOpen(open, standaloneDelay);
7997
7998
  }
7998
7999
  }, [isInsideGroup, delayGroupContext, openDelay, tooltipId, closeDelay, setIsOpen]);
7999
8000
  const handleBlur = useCallback(() => handleIsOpenChange(false), [handleIsOpenChange]);
@@ -8022,6 +8023,18 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
8022
8023
  if (!content) handleIsOpenChange(false);
8023
8024
  }, [content, handleIsOpenChange]);
8024
8025
  useEffect(() => refs.setReference(referenceElement), [referenceElement, refs]);
8026
+ useEffect(() => {
8027
+ if (!showTooltip) return;
8028
+ function handleWindowKeyDown(event) {
8029
+ if (event.key === "Escape") {
8030
+ handleIsOpenChange(false, true);
8031
+ }
8032
+ }
8033
+ window.addEventListener("keydown", handleWindowKeyDown);
8034
+ return () => {
8035
+ window.removeEventListener("keydown", handleWindowKeyDown);
8036
+ };
8037
+ }, [handleIsOpenChange, showTooltip]);
8025
8038
  const setArrow = useCallback(arrowEl => {
8026
8039
  arrowRef.current = arrowEl;
8027
8040
  update();
@@ -9497,7 +9510,7 @@ var __template$7 = (cooked, raw) => __freeze$7(__defProp$7(cooked, "raw", {
9497
9510
  }));
9498
9511
  var _a$7, _b$4;
9499
9512
  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 "])));
9513
+ 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
9514
  }
9502
9515
  function selectableColorStyle(props) {
9503
9516
  var _a2, _b2;