@sanity/ui 4.0.0-static.44 → 4.0.0-static.45

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.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { c } from "react/compiler-runtime";
3
3
  import { SpinnerIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon, CheckmarkIcon, RemoveIcon } from "@sanity/icons";
4
- import { isValidElement, useDebugValue, useSyncExternalStore, createContext, use, useRef, useImperativeHandle, useEffect, useState, cloneElement, useReducer, useEffectEvent, Children, Fragment as Fragment$1, startTransition, useId, lazy, Suspense, useLayoutEffect, Component } from "react";
4
+ import { isValidElement, useDebugValue, useSyncExternalStore, useState, Activity, createContext, use, useRef, useImperativeHandle, useEffect, cloneElement, useReducer, useEffectEvent, Children, Fragment as Fragment$1, startTransition, useId, lazy, Suspense, useLayoutEffect, Component } from "react";
5
5
  import { box, text, textOverflow, animatedSpinnerIcon, spinner, button, buttonLoadingBox, _arrow, vars, _arrowSvg, _arrowStrokeMask, _arrowStroke, _arrowShape, card, BREAKPOINTS, popoverCard, popover, _selectable, stack, textInput, textInputPrefix, textInputElement, _inputElement, _inputPresentation, textInputSuffix, breadcrumbs, container as container$1, dialogCard, dialogHeader, dialogContent, dialogScrollerShadowTop, dialogScroller, dialogScrollerShadowBottom, dialogFooter, dialog, dialogContainer, kbd, menu, menuDivider, toast, toastLayer, treeItem, label, avatar, avatarArrow, avatarInitials, avatarImage, avatarImageOutline, avatarCounter, avatarStack, badge, checkbox, checkboxInput, checkboxPresentation, code, heading, radio, radioInput, radioPresentation, select, selectPresentation, skeleton, codeSkeleton, headingSkeleton, labelSkeleton, textSkeleton, srOnly, _switch, _switchElement, _switchPresentation, _switchTrack, _switchThumb, textArea, tooltip, root } from "@sanity/ui/css";
6
6
  import { isValidElementType } from "react-is";
7
7
  import { detectOverflow, useFloating, autoPlacement, flip, offset, shift, arrow, hide, autoUpdate } from "@floating-ui/react-dom";
8
- import { motion, AnimatePresence } from "motion/react";
8
+ import { invariant, PresenceChild, motion, AnimatePresence } from "motion/react";
9
9
  import { createPortal } from "react-dom";
10
10
  import { assignInlineVars } from "@vanilla-extract/dynamic";
11
11
  import { ResizeObserver } from "@juggle/resize-observer";
@@ -469,6 +469,24 @@ const origin = {
469
469
  function clamp(num, min, max) {
470
470
  return Math.min(Math.max(num, min), max);
471
471
  }
472
+ function AnimateActivity(t0) {
473
+ const $ = c(9), {
474
+ mode: modeFromProps,
475
+ layoutMode,
476
+ children
477
+ } = t0, [mode, setMode] = useState(modeFromProps), isPresent = modeFromProps === "visible";
478
+ if (isPresent && mode !== "visible")
479
+ return setMode("visible"), null;
480
+ let t1;
481
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = () => setMode("hidden"), $[0] = t1) : t1 = $[0];
482
+ const onExitComplete = t1;
483
+ invariant(!!Activity, "Activity component not found - upgrade to React 19.2.0 or higher");
484
+ const t2 = isPresent ? void 0 : onExitComplete, t3 = layoutMode === "pop" ? "popLayout" : "sync", t4 = children;
485
+ let t5;
486
+ $[1] !== isPresent || $[2] !== t2 || $[3] !== t3 || $[4] !== t4 ? (t5 = /* @__PURE__ */ jsx(PresenceChild, { isPresent, onExitComplete: t2, presenceAffectsLayout: !1, mode: t3, children: t4 }), $[1] = isPresent, $[2] = t2, $[3] = t3, $[4] = t4, $[5] = t5) : t5 = $[5];
487
+ let t6;
488
+ return $[6] !== mode || $[7] !== t5 ? (t6 = /* @__PURE__ */ jsx(Activity, { mode, children: t5 }), $[6] = mode, $[7] = t5, $[8] = t6) : t6 = $[8], t6;
489
+ }
472
490
  function getGlobalScope() {
473
491
  if (typeof globalThis < "u") return globalThis;
474
492
  if (typeof window < "u") return window;
@@ -1041,7 +1059,7 @@ function ViewportOverlay() {
1041
1059
  } }), $[0] = zIndex, $[1] = t0) : t0 = $[1], t0;
1042
1060
  }
1043
1061
  function Popover(props) {
1044
- const $ = c(113), t0 = props;
1062
+ const $ = c(114), t0 = props;
1045
1063
  let _fallbackPlacements, _floatingBoundary, _referenceBoundary, childProp, className, content2, disabled, forwardedRef, matchReferenceWidth, modal, open, padding, portal, referenceElement, rest, scheme, t1, t10, t11, t12, t13, t14, t2, t3, t4, t5, t6, t7, t8, t9, updateRef;
1046
1064
  if ($[0] !== t0) {
1047
1065
  const {
@@ -1170,7 +1188,7 @@ function Popover(props) {
1170
1188
  t28
1171
1189
  ] }), $[97] = t26, $[98] = t28, $[99] = t29) : t29 = $[99];
1172
1190
  const node_0 = t29;
1173
- let children = open ? node_0 : null;
1191
+ let children = node_0;
1174
1192
  if (open && portal) {
1175
1193
  let resolvedTone = tone;
1176
1194
  if (tone === "inherit") {
@@ -1184,12 +1202,12 @@ function Popover(props) {
1184
1202
  $[104] !== t302 || $[105] !== t32 ? (t33 = /* @__PURE__ */ jsx(Portal, { __unstable_name: t302, children: t32 }), $[104] = t302, $[105] = t32, $[106] = t33) : t33 = $[106], children = t33;
1185
1203
  }
1186
1204
  let t30;
1187
- $[107] !== animate || $[108] !== children ? (t30 = animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children, $[107] = animate, $[108] = children, $[109] = t30) : t30 = $[109];
1205
+ $[107] !== animate || $[108] !== children || $[109] !== open ? (t30 = animate ? /* @__PURE__ */ jsx(AnimateActivity, { mode: open ? "visible" : "hidden", layoutMode: "default", children }) : /* @__PURE__ */ jsx(Activity, { mode: open ? "visible" : "hidden", children }), $[107] = animate, $[108] = children, $[109] = open, $[110] = t30) : t30 = $[110];
1188
1206
  let t31;
1189
- return $[110] !== child || $[111] !== t30 ? (t31 = /* @__PURE__ */ jsxs(Fragment, { children: [
1207
+ return $[111] !== child || $[112] !== t30 ? (t31 = /* @__PURE__ */ jsxs(Fragment, { children: [
1190
1208
  t30,
1191
1209
  child
1192
- ] }), $[110] = child, $[111] = t30, $[112] = t31) : t31 = $[112], t31;
1210
+ ] }), $[111] = child, $[112] = t30, $[113] = t31) : t31 = $[113], t31;
1193
1211
  }
1194
1212
  function useMiddleware$1(t0) {
1195
1213
  const $ = c(36), {
@@ -4508,7 +4526,7 @@ function TooltipLayer(props) {
4508
4526
  }
4509
4527
  const DEFAULT_TOOLTIP_ELEMENT = "div";
4510
4528
  function Tooltip(props) {
4511
- const $ = c(143), t0 = props;
4529
+ const $ = c(144), t0 = props;
4512
4530
  let _boundaryElement, _fallbackPlacements, childProp, className, content2, delay, disabled, forwardedRef, portalProp, rest, scheme, t1, t2, t3, t4, t5, t6, t7, t8, t9;
4513
4531
  $[0] !== t0 ? ({
4514
4532
  animate: t1,
@@ -4702,7 +4720,7 @@ function Tooltip(props) {
4702
4720
  let t40;
4703
4721
  $[109] !== animate || $[110] !== arrowProp || $[111] !== arrowX || $[112] !== arrowY || $[113] !== as || $[114] !== content2 || $[115] !== originX || $[116] !== originY || $[117] !== padding || $[118] !== placement || $[119] !== radius || $[120] !== rest || $[121] !== scheme || $[122] !== setArrow || $[123] !== setFloating || $[124] !== shadow || $[125] !== t37 || $[126] !== t39 || $[127] !== tone || $[128] !== zOffset ? (t40 = /* @__PURE__ */ jsx(TooltipLayer, { "data-ui": "Tooltip", ...rest, animate, arrow: arrowProp, arrowRef: setArrow, arrowX, arrowY, as, className: t37, originX, originY, padding, placement, radius, ref: setFloating, scheme, shadow, style: t39, tone, zOffset, children: content2 }), $[109] = animate, $[110] = arrowProp, $[111] = arrowX, $[112] = arrowY, $[113] = as, $[114] = content2, $[115] = originX, $[116] = originY, $[117] = padding, $[118] = placement, $[119] = radius, $[120] = rest, $[121] = scheme, $[122] = setArrow, $[123] = setFloating, $[124] = shadow, $[125] = t37, $[126] = t39, $[127] = tone, $[128] = zOffset, $[129] = t40) : t40 = $[129];
4704
4722
  const node_0 = t40;
4705
- let children = showTooltip ? node_0 : null;
4723
+ let children = node_0;
4706
4724
  if (showTooltip && portalProp) {
4707
4725
  let resolvedTone = tone;
4708
4726
  if (tone === "inherit") {
@@ -4716,12 +4734,12 @@ function Tooltip(props) {
4716
4734
  $[134] !== t412 || $[135] !== t43 ? (t44 = /* @__PURE__ */ jsx(Portal, { __unstable_name: t412, children: t43 }), $[134] = t412, $[135] = t43, $[136] = t44) : t44 = $[136], children = t44;
4717
4735
  }
4718
4736
  let t41;
4719
- $[137] !== animate || $[138] !== children ? (t41 = animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children, $[137] = animate, $[138] = children, $[139] = t41) : t41 = $[139];
4737
+ $[137] !== animate || $[138] !== children || $[139] !== showTooltip ? (t41 = animate ? /* @__PURE__ */ jsx(AnimateActivity, { mode: showTooltip ? "visible" : "hidden", layoutMode: "default", children }) : /* @__PURE__ */ jsx(Activity, { mode: showTooltip ? "visible" : "hidden", children }), $[137] = animate, $[138] = children, $[139] = showTooltip, $[140] = t41) : t41 = $[140];
4720
4738
  let t42;
4721
- return $[140] !== child || $[141] !== t41 ? (t42 = /* @__PURE__ */ jsxs(Fragment, { children: [
4739
+ return $[141] !== child || $[142] !== t41 ? (t42 = /* @__PURE__ */ jsxs(Fragment, { children: [
4722
4740
  t41,
4723
4741
  child
4724
- ] }), $[140] = child, $[141] = t41, $[142] = t42) : t42 = $[142], t42;
4742
+ ] }), $[141] = child, $[142] = t41, $[143] = t42) : t42 = $[143], t42;
4725
4743
  }
4726
4744
  function useMiddleware(t0) {
4727
4745
  const $ = c(17), {