@sanity/ui 4.0.0-static.45 → 4.0.0-static.46
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 +12 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/core/primitives/popover/Popover.tsx +3 -10
- package/src/core/primitives/tooltip/Tooltip.test.tsx +42 -42
- package/src/core/primitives/tooltip/Tooltip.tsx +3 -10
- package/src/core/utils/AnimateActivity.tsx +0 -78
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,
|
|
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";
|
|
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 {
|
|
8
|
+
import { 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,24 +469,6 @@ 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
|
-
}
|
|
490
472
|
function getGlobalScope() {
|
|
491
473
|
if (typeof globalThis < "u") return globalThis;
|
|
492
474
|
if (typeof window < "u") return window;
|
|
@@ -1059,7 +1041,7 @@ function ViewportOverlay() {
|
|
|
1059
1041
|
} }), $[0] = zIndex, $[1] = t0) : t0 = $[1], t0;
|
|
1060
1042
|
}
|
|
1061
1043
|
function Popover(props) {
|
|
1062
|
-
const $ = c(
|
|
1044
|
+
const $ = c(113), t0 = props;
|
|
1063
1045
|
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;
|
|
1064
1046
|
if ($[0] !== t0) {
|
|
1065
1047
|
const {
|
|
@@ -1188,7 +1170,7 @@ function Popover(props) {
|
|
|
1188
1170
|
t28
|
|
1189
1171
|
] }), $[97] = t26, $[98] = t28, $[99] = t29) : t29 = $[99];
|
|
1190
1172
|
const node_0 = t29;
|
|
1191
|
-
let children = node_0;
|
|
1173
|
+
let children = open ? node_0 : null;
|
|
1192
1174
|
if (open && portal) {
|
|
1193
1175
|
let resolvedTone = tone;
|
|
1194
1176
|
if (tone === "inherit") {
|
|
@@ -1202,12 +1184,12 @@ function Popover(props) {
|
|
|
1202
1184
|
$[104] !== t302 || $[105] !== t32 ? (t33 = /* @__PURE__ */ jsx(Portal, { __unstable_name: t302, children: t32 }), $[104] = t302, $[105] = t32, $[106] = t33) : t33 = $[106], children = t33;
|
|
1203
1185
|
}
|
|
1204
1186
|
let t30;
|
|
1205
|
-
$[107] !== animate || $[108] !== children
|
|
1187
|
+
$[107] !== animate || $[108] !== children ? (t30 = animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children, $[107] = animate, $[108] = children, $[109] = t30) : t30 = $[109];
|
|
1206
1188
|
let t31;
|
|
1207
|
-
return $[
|
|
1189
|
+
return $[110] !== child || $[111] !== t30 ? (t31 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1208
1190
|
t30,
|
|
1209
1191
|
child
|
|
1210
|
-
] }), $[
|
|
1192
|
+
] }), $[110] = child, $[111] = t30, $[112] = t31) : t31 = $[112], t31;
|
|
1211
1193
|
}
|
|
1212
1194
|
function useMiddleware$1(t0) {
|
|
1213
1195
|
const $ = c(36), {
|
|
@@ -4526,7 +4508,7 @@ function TooltipLayer(props) {
|
|
|
4526
4508
|
}
|
|
4527
4509
|
const DEFAULT_TOOLTIP_ELEMENT = "div";
|
|
4528
4510
|
function Tooltip(props) {
|
|
4529
|
-
const $ = c(
|
|
4511
|
+
const $ = c(143), t0 = props;
|
|
4530
4512
|
let _boundaryElement, _fallbackPlacements, childProp, className, content2, delay, disabled, forwardedRef, portalProp, rest, scheme, t1, t2, t3, t4, t5, t6, t7, t8, t9;
|
|
4531
4513
|
$[0] !== t0 ? ({
|
|
4532
4514
|
animate: t1,
|
|
@@ -4720,7 +4702,7 @@ function Tooltip(props) {
|
|
|
4720
4702
|
let t40;
|
|
4721
4703
|
$[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];
|
|
4722
4704
|
const node_0 = t40;
|
|
4723
|
-
let children = node_0;
|
|
4705
|
+
let children = showTooltip ? node_0 : null;
|
|
4724
4706
|
if (showTooltip && portalProp) {
|
|
4725
4707
|
let resolvedTone = tone;
|
|
4726
4708
|
if (tone === "inherit") {
|
|
@@ -4734,12 +4716,12 @@ function Tooltip(props) {
|
|
|
4734
4716
|
$[134] !== t412 || $[135] !== t43 ? (t44 = /* @__PURE__ */ jsx(Portal, { __unstable_name: t412, children: t43 }), $[134] = t412, $[135] = t43, $[136] = t44) : t44 = $[136], children = t44;
|
|
4735
4717
|
}
|
|
4736
4718
|
let t41;
|
|
4737
|
-
$[137] !== animate || $[138] !== children
|
|
4719
|
+
$[137] !== animate || $[138] !== children ? (t41 = animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children, $[137] = animate, $[138] = children, $[139] = t41) : t41 = $[139];
|
|
4738
4720
|
let t42;
|
|
4739
|
-
return $[
|
|
4721
|
+
return $[140] !== child || $[141] !== t41 ? (t42 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4740
4722
|
t41,
|
|
4741
4723
|
child
|
|
4742
|
-
] }), $[
|
|
4724
|
+
] }), $[140] = child, $[141] = t41, $[142] = t42) : t42 = $[142], t42;
|
|
4743
4725
|
}
|
|
4744
4726
|
function useMiddleware(t0) {
|
|
4745
4727
|
const $ = c(17), {
|