@sanity/ui 2.9.1 → 2.10.0

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 (112) hide show
  1. package/dist/index.d.mts +29 -33
  2. package/dist/index.d.ts +29 -33
  3. package/dist/index.esm.js +44 -26
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +44 -26
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +44 -26
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/theme.d.mts +1 -1
  10. package/dist/theme.d.ts +1 -1
  11. package/dist/theme.esm.js.map +1 -1
  12. package/dist/theme.js.map +1 -1
  13. package/dist/theme.mjs.map +1 -1
  14. package/package.json +31 -25
  15. package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +1 -1
  16. package/src/core/components/autocomplete/autocomplete.tsx +4 -3
  17. package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
  18. package/src/core/components/dialog/dialog.tsx +1 -1
  19. package/src/core/components/dialog/dialogProvider.tsx +1 -1
  20. package/src/core/components/menu/__workshop__/asComponent.tsx +1 -1
  21. package/src/core/components/menu/menu.test.tsx +0 -2
  22. package/src/core/components/menu/menuButton.tsx +2 -2
  23. package/src/core/components/menu/menuGroup.tsx +2 -2
  24. package/src/core/components/menu/menuItem.tsx +1 -0
  25. package/src/core/components/tab/tabList.tsx +2 -2
  26. package/src/core/components/toast/toast.test.tsx +0 -1
  27. package/src/core/components/toast/toast.tsx +1 -1
  28. package/src/core/components/toast/toastProvider.tsx +3 -2
  29. package/src/core/components/tree/tree.tsx +1 -1
  30. package/src/core/components/tree/treeGroup.tsx +1 -1
  31. package/src/core/components/tree/treeItem.tsx +1 -1
  32. package/src/core/hooks/useDelayedState.ts +1 -1
  33. package/src/core/hooks/usePrefersDark.hydration.test.tsx +0 -1
  34. package/src/core/hooks/usePrefersReducedMotion.hydration.test.tsx +0 -1
  35. package/src/core/lib/globalScope.ts +0 -1
  36. package/src/core/primitives/avatar/avatar.tsx +1 -1
  37. package/src/core/primitives/avatar/avatarStack.tsx +1 -1
  38. package/src/core/primitives/badge/badge.tsx +1 -1
  39. package/src/core/primitives/box/box.tsx +1 -1
  40. package/src/core/primitives/button/button.tsx +1 -1
  41. package/src/core/primitives/card/__workshop__/asComponent.tsx +1 -1
  42. package/src/core/primitives/code/code.tsx +1 -2
  43. package/src/core/primitives/heading/heading.tsx +1 -1
  44. package/src/core/primitives/inline/inline.tsx +0 -1
  45. package/src/core/primitives/kbd/kbd.tsx +1 -1
  46. package/src/core/primitives/label/label.tsx +1 -1
  47. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +1 -1
  48. package/src/core/primitives/popover/__workshop__/TestStory.tsx +2 -2
  49. package/src/core/primitives/popover/popover.tsx +4 -5
  50. package/src/core/primitives/stack/stack.tsx +1 -1
  51. package/src/core/primitives/text/text.tsx +1 -1
  52. package/src/core/primitives/tooltip/tooltip.tsx +1 -2
  53. package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +1 -1
  54. package/src/core/theme/__workshop__/build/story.tsx +1 -3
  55. package/src/core/theme/__workshop__/debug/story.tsx +0 -2
  56. package/src/core/theme/theme.test.tsx +0 -1
  57. package/src/core/theme/themeColorProvider.tsx +1 -1
  58. package/src/core/theme/themeProvider.tsx +1 -1
  59. package/src/core/utils/arrow/arrow.tsx +1 -1
  60. package/src/core/utils/boundaryElement/boundaryElement.test.tsx +0 -1
  61. package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +3 -1
  62. package/src/core/utils/elementQuery/elementQuery.tsx +1 -1
  63. package/src/core/utils/layer/layer.test.tsx +0 -1
  64. package/src/core/utils/layer/layer.tsx +9 -1
  65. package/src/core/utils/layer/layerProvider.tsx +1 -1
  66. package/src/core/utils/portal/portal.test.tsx +0 -1
  67. package/src/core/utils/portal/portalProvider.tsx +1 -1
  68. package/src/core/utils/srOnly/srOnly.tsx +1 -1
  69. package/src/core/utils/virtualList/virtualList.tsx +10 -3
  70. package/src/theme/build/merge.ts +0 -2
  71. package/src/theme/system/css.ts +1 -2
  72. package/src/core/components/autocomplete/__workshop__/.eslintrc +0 -5
  73. package/src/core/components/breadcrumbs/__workshop__/.eslintrc +0 -5
  74. package/src/core/components/dialog/__workshop__/.eslintrc +0 -5
  75. package/src/core/components/hotkeys/__workshop__/.eslintrc +0 -5
  76. package/src/core/components/menu/__workshop__/.eslintrc +0 -5
  77. package/src/core/components/skeleton/__workshop__/.eslintrc +0 -5
  78. package/src/core/components/tab/__workshop__/.eslintrc +0 -5
  79. package/src/core/components/toast/__workshop__/.eslintrc +0 -5
  80. package/src/core/components/tree/__workshop__/.eslintrc +0 -5
  81. package/src/core/hooks/useElementRect/__workshop__/.eslintrc +0 -5
  82. package/src/core/hooks/useMediaIndex/__workshop__/.eslintrc +0 -5
  83. package/src/core/primitives/avatar/__workshop__/.eslintrc +0 -5
  84. package/src/core/primitives/badge/__workshop__/.eslintrc +0 -5
  85. package/src/core/primitives/box/__workshop__/.eslintrc +0 -5
  86. package/src/core/primitives/button/__workshop__/.eslintrc +0 -5
  87. package/src/core/primitives/card/__workshop__/.eslintrc +0 -5
  88. package/src/core/primitives/checkbox/__workshop__/.eslintrc +0 -5
  89. package/src/core/primitives/code/__workshop__/.eslintrc +0 -5
  90. package/src/core/primitives/container/__workshop__/.eslintrc +0 -5
  91. package/src/core/primitives/flex/__workshop__/.eslintrc +0 -5
  92. package/src/core/primitives/grid/__workshop__/.eslintrc +0 -5
  93. package/src/core/primitives/heading/__workshop__/.eslintrc +0 -5
  94. package/src/core/primitives/inline/__workshop__/.eslintrc +0 -5
  95. package/src/core/primitives/kbd/__workshop__/.eslintrc +0 -5
  96. package/src/core/primitives/label/__workshop__/.eslintrc +0 -5
  97. package/src/core/primitives/popover/__workshop__/.eslintrc +0 -5
  98. package/src/core/primitives/radio/__workshop__/.eslintrc +0 -5
  99. package/src/core/primitives/select/__workshop__/.eslintrc +0 -5
  100. package/src/core/primitives/spinner/__workshop__/.eslintrc +0 -5
  101. package/src/core/primitives/stack/__workshop__/.eslintrc +0 -5
  102. package/src/core/primitives/switch/__workshop__/.eslintrc +0 -5
  103. package/src/core/primitives/text/__workshop__/.eslintrc +0 -5
  104. package/src/core/primitives/textArea/__workshop__/.eslintrc +0 -5
  105. package/src/core/primitives/textInput/__workshop__/.eslintrc +0 -5
  106. package/src/core/primitives/tooltip/__workshop__/.eslintrc +0 -5
  107. package/src/core/theme/__workshop__/.eslintrc +0 -5
  108. package/src/core/utils/boundaryElement/__workshop__/.eslintrc +0 -5
  109. package/src/core/utils/elementQuery/__workshop__/.eslintrc +0 -5
  110. package/src/core/utils/layer/__workshop__/.eslintrc +0 -5
  111. package/src/core/utils/portal/__workshop__/.eslintrc +0 -5
  112. package/src/core/utils/virtualList/__workshop__/.eslintrc +0 -5
package/dist/index.js CHANGED
@@ -3889,7 +3889,7 @@ const Popover = react.memo(react.forwardRef(function(props, forwardedRef) {
3889
3889
  react.useEffect(() => {
3890
3890
  maxWidthRef.current = maxWidth;
3891
3891
  }, [maxWidth]);
3892
- const referenceWidthRef = react.useRef();
3892
+ const referenceWidthRef = react.useRef(void 0);
3893
3893
  react.useEffect(() => {
3894
3894
  const floatingElement = ref.current;
3895
3895
  if (!open || !floatingElement) return;
@@ -4687,7 +4687,7 @@ function _temp3(v_0) {
4687
4687
  return v_0 === 0 || v_0 === 1 ? 0 : v_0 === 2 ? 1 : v_0 - 1;
4688
4688
  }
4689
4689
  function useDelayedState(initialState) {
4690
- const $ = reactCompilerRuntime.c(3), [state, setState] = react.useState(initialState), delayedAction = react.useRef();
4690
+ const $ = reactCompilerRuntime.c(3), [state, setState] = react.useState(initialState), delayedAction = react.useRef(void 0);
4691
4691
  let t0;
4692
4692
  $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = (nextState, delay) => {
4693
4693
  const action = () => {
@@ -5210,7 +5210,26 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
5210
5210
  inputElement: inputElementRef.current,
5211
5211
  onMouseEnter: handlePopoverMouseEnter,
5212
5212
  onMouseLeave: handlePopoverMouseLeave
5213
- }, resultsPopoverElementRef) : filteredOptionsLen === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(Popover, { arrow: !1, constrainSize: !0, content, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius, ref: resultsPopoverElementRef, referenceElement: inputElementRef.current, ...popover }), [content, expanded, filteredOptionsLen, handlePopoverMouseEnter, handlePopoverMouseLeave, popover, radius, renderPopover]);
5213
+ }, resultsPopoverElementRef) : filteredOptionsLen === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(
5214
+ Popover,
5215
+ {
5216
+ arrow: !1,
5217
+ constrainSize: !0,
5218
+ content,
5219
+ fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS,
5220
+ matchReferenceWidth: !0,
5221
+ onMouseEnter: handlePopoverMouseEnter,
5222
+ onMouseLeave: handlePopoverMouseLeave,
5223
+ open: expanded,
5224
+ overflow: "auto",
5225
+ placement: AUTOCOMPLETE_POPOVER_PLACEMENT,
5226
+ portal: !0,
5227
+ radius,
5228
+ ref: resultsPopoverElementRef,
5229
+ referenceElement: inputElementRef.current,
5230
+ ...popover
5231
+ }
5232
+ ), [content, expanded, filteredOptionsLen, handlePopoverMouseEnter, handlePopoverMouseLeave, popover, radius, renderPopover]);
5214
5233
  return /* @__PURE__ */ jsxRuntime.jsxs(Root$9, { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
5215
5234
  input,
5216
5235
  results
@@ -5456,7 +5475,7 @@ const Dialog = react.forwardRef(function(props, ref) {
5456
5475
  }
5457
5476
  isHTMLElement(event.target) && (focusedElementRef.current = event.target);
5458
5477
  }, $[22] = onFocus, $[23] = t7) : t7 = $[23];
5459
- const handleFocus = t7, labelId = `${id}_label`, rootClickTimeoutRef = react.useRef();
5478
+ const handleFocus = t7, labelId = `${id}_label`, rootClickTimeoutRef = react.useRef(void 0);
5460
5479
  let t8;
5461
5480
  $[24] !== boundaryElement || $[25] !== portalElement ? (t8 = () => {
5462
5481
  rootClickTimeoutRef.current && clearTimeout(rootClickTimeoutRef.current), rootClickTimeoutRef.current = setTimeout(() => {
@@ -6593,24 +6612,23 @@ function ToastProvider(props) {
6593
6612
  }, t7 = [1, 1, 0], $[4] = t6, $[5] = t7) : (t6 = $[4], t7 = $[5]);
6594
6613
  let t8;
6595
6614
  $[6] === Symbol.for("react.memo_cache_sentinel") ? (t8 = [1, 0, 0], $[6] = t8) : t8 = $[6];
6596
- let t9;
6597
- $[7] !== prefersReducedMotion ? (t9 = {
6615
+ const t9 = prefersReducedMotion ? 0 : 0.2;
6616
+ let t10;
6617
+ $[7] !== t9 ? (t10 = {
6598
6618
  initial: t4,
6599
6619
  animate: t6,
6600
6620
  exit: {
6601
6621
  opacity: t7,
6602
6622
  [POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: t8,
6603
6623
  scale: 0.5,
6604
- transition: prefersReducedMotion ? {
6605
- duration: 0
6606
- } : {
6607
- duration: 0.2
6624
+ transition: {
6625
+ duration: t9
6608
6626
  }
6609
6627
  }
6610
- }, $[7] = prefersReducedMotion, $[8] = t9) : t9 = $[8], t3 = t9;
6628
+ }, $[7] = t9, $[8] = t10) : t10 = $[8], t3 = t10;
6611
6629
  const variants = t3;
6612
- let t10, t11;
6613
- $[9] === Symbol.for("react.memo_cache_sentinel") ? (t11 = {
6630
+ let t11, t12;
6631
+ $[9] === Symbol.for("react.memo_cache_sentinel") ? (t12 = {
6614
6632
  version: 0,
6615
6633
  push: (params) => {
6616
6634
  const setState = (state_0) => react.startTransition(() => _setState(state_0)), id = params.id || generateToastId(), duration = params.duration || 5e3, dismiss = () => {
@@ -6635,23 +6653,23 @@ function ToastProvider(props) {
6635
6653
  timeoutId: setTimeout(dismiss, duration)
6636
6654
  }, id;
6637
6655
  }
6638
- }, $[9] = t11) : t11 = $[9], t10 = t11;
6639
- const value = t10;
6640
- let t12, t13;
6641
- $[10] === Symbol.for("react.memo_cache_sentinel") ? (t12 = () => () => {
6656
+ }, $[9] = t12) : t12 = $[9], t11 = t12;
6657
+ const value = t11;
6658
+ let t13, t14;
6659
+ $[10] === Symbol.for("react.memo_cache_sentinel") ? (t13 = () => () => {
6642
6660
  for (const {
6643
6661
  timeoutId: timeoutId_0
6644
6662
  } of Object.values(toastsRef.current))
6645
6663
  clearTimeout(timeoutId_0);
6646
6664
  toastsRef.current = {};
6647
- }, t13 = [], $[10] = t12, $[11] = t13) : (t12 = $[10], t13 = $[11]), react.useEffect(t12, t13);
6648
- let t14;
6649
- $[12] !== mounted || $[13] !== padding || $[14] !== paddingX || $[15] !== paddingY || $[16] !== prefersReducedMotion || $[17] !== state || $[18] !== variants || $[19] !== zOffset ? (t14 = mounted && /* @__PURE__ */ jsxRuntime.jsx(Root$1, { "data-ui": "ToastProvider", zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(ToastContainer, { children: /* @__PURE__ */ jsxRuntime.jsx(Box, { padding, paddingX, paddingY, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: !1, children: state.map((t152) => {
6665
+ }, t14 = [], $[10] = t13, $[11] = t14) : (t13 = $[10], t14 = $[11]), react.useEffect(t13, t14);
6666
+ let t15;
6667
+ $[12] !== mounted || $[13] !== padding || $[14] !== paddingX || $[15] !== paddingY || $[16] !== prefersReducedMotion || $[17] !== state || $[18] !== variants || $[19] !== zOffset ? (t15 = mounted && /* @__PURE__ */ jsxRuntime.jsx(Root$1, { "data-ui": "ToastProvider", zOffset, children: /* @__PURE__ */ jsxRuntime.jsx(ToastContainer, { children: /* @__PURE__ */ jsxRuntime.jsx(Box, { padding, paddingX, paddingY, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: !1, children: state.map((t162) => {
6650
6668
  const {
6651
6669
  dismiss: dismiss_0,
6652
6670
  id: id_0,
6653
6671
  params: params_0
6654
- } = t152;
6672
+ } = t162;
6655
6673
  return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.motion.div, { layout: "position", initial: "initial", animate: "animate", exit: "exit", variants, transition: prefersReducedMotion ? {
6656
6674
  duration: 0
6657
6675
  } : {
@@ -6659,12 +6677,12 @@ function ToastProvider(props) {
6659
6677
  damping: 30,
6660
6678
  stiffness: 400
6661
6679
  }, children: /* @__PURE__ */ jsxRuntime.jsx(Toast, { closable: params_0.closable, description: params_0.description, onClose: dismiss_0, status: params_0.status, title: params_0.title, duration: params_0.duration }) }, id_0);
6662
- }) }) }) }) }), $[12] = mounted, $[13] = padding, $[14] = paddingX, $[15] = paddingY, $[16] = prefersReducedMotion, $[17] = state, $[18] = variants, $[19] = zOffset, $[20] = t14) : t14 = $[20];
6663
- let t15;
6664
- return $[21] !== children || $[22] !== t14 ? (t15 = /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
6680
+ }) }) }) }) }), $[12] = mounted, $[13] = padding, $[14] = paddingX, $[15] = paddingY, $[16] = prefersReducedMotion, $[17] = state, $[18] = variants, $[19] = zOffset, $[20] = t15) : t15 = $[20];
6681
+ let t16;
6682
+ return $[21] !== children || $[22] !== t15 ? (t16 = /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value, children: [
6665
6683
  children,
6666
- t14
6667
- ] }), $[21] = children, $[22] = t14, $[23] = t15) : t15 = $[23], t15;
6684
+ t15
6685
+ ] }), $[21] = children, $[22] = t15, $[23] = t16) : t16 = $[23], t16;
6668
6686
  }
6669
6687
  ToastProvider.displayName = "ToastProvider";
6670
6688
  function useToast() {