@sanity/ui 4.3.2 → 4.4.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.
- package/dist/{arrow-CZ-Lw1QO.js → arrow-B8L6YB-v.js} +28 -7
- package/dist/arrow-B8L6YB-v.js.map +1 -0
- package/dist/autocomplete.d.ts +1 -1
- package/dist/autocomplete.js +6 -6
- package/dist/breadcrumbs.d.ts.map +1 -1
- package/dist/breadcrumbs.js +9 -9
- package/dist/breadcrumbs.js.map +1 -1
- package/dist/{button-Wii-24Xu.js → button-dhq4ViVg.js} +7 -7
- package/dist/button-dhq4ViVg.js.map +1 -0
- package/dist/code.js +2 -2
- package/dist/{codeFontStyle-84SMhFtI.js → codeFontStyle-B-bhR3hF.js} +2 -2
- package/dist/{codeFontStyle-84SMhFtI.js.map → codeFontStyle-B-bhR3hF.js.map} +1 -1
- package/dist/elementSizeObserver-pevZfdGa.js +45 -0
- package/dist/elementSizeObserver-pevZfdGa.js.map +1 -0
- package/dist/{flex-CpiAc-4D.js → flex-BqQXaSxS.js} +5 -12
- package/dist/flex-BqQXaSxS.js.map +1 -0
- package/dist/{grid-BVZEj_Xe.js → grid-Bpb2bIJ6.js} +5 -15
- package/dist/grid-Bpb2bIJ6.js.map +1 -0
- package/dist/{helpers-C8xxXAQC.js → helpers-XThPpWje.js} +16 -4
- package/dist/helpers-XThPpWje.js.map +1 -0
- package/dist/{hotkeys-DEMStMQ5.js → hotkeys-sG9yO97K.js} +4 -4
- package/dist/{hotkeys-DEMStMQ5.js.map → hotkeys-sG9yO97K.js.map} +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +137 -121
- package/dist/index.js.map +1 -1
- package/dist/{layer-B0tlPeLT.js → layer-AWzYcY_j.js} +3 -3
- package/dist/{layer-B0tlPeLT.js.map → layer-AWzYcY_j.js.map} +1 -1
- package/dist/menu.d.ts +1 -1
- package/dist/menu.js +7 -7
- package/dist/{popover-DR6UQQvq.js → popover-C72hePrK.js} +125 -51
- package/dist/popover-C72hePrK.js.map +1 -0
- package/dist/{popover-CMlQeKn0.d.ts → popover-HDVgZg5e.d.ts} +22 -1
- package/dist/popover-HDVgZg5e.d.ts.map +1 -0
- package/dist/popover.d.ts +1 -1
- package/dist/popover.js +1 -1
- package/dist/{responsiveFont-CilwaORG.js → responsiveFont-B08q0jwm.js} +6 -4
- package/dist/responsiveFont-B08q0jwm.js.map +1 -0
- package/dist/{stack-SbGBZ0x3.js → stack-Cv-WM-7p.js} +4 -4
- package/dist/{stack-SbGBZ0x3.js.map → stack-Cv-WM-7p.js.map} +1 -1
- package/dist/{textInput-Yp5lnvZK.js → textInput-Ddxi4mkC.js} +5 -5
- package/dist/{textInput-Yp5lnvZK.js.map → textInput-Ddxi4mkC.js.map} +1 -1
- package/dist/toast.js +5 -5
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +165 -128
- package/dist/tooltip.js.map +1 -1
- package/dist/{useClickOutsideEvent-wGLGWBZN.js → useClickOutsideEvent-CC1zgOmv.js} +2 -2
- package/dist/{useClickOutsideEvent-wGLGWBZN.js.map → useClickOutsideEvent-CC1zgOmv.js.map} +1 -1
- package/dist/{useLayer-CUKYjJYq.js → useLayer-B0i19TTM.js} +31 -38
- package/dist/useLayer-B0i19TTM.js.map +1 -0
- package/package.json +5 -4
- package/dist/arrow-CZ-Lw1QO.js.map +0 -1
- package/dist/button-Wii-24Xu.js.map +0 -1
- package/dist/flex-CpiAc-4D.js.map +0 -1
- package/dist/grid-BVZEj_Xe.js.map +0 -1
- package/dist/helpers-C8xxXAQC.js.map +0 -1
- package/dist/popover-CMlQeKn0.d.ts.map +0 -1
- package/dist/popover-DR6UQQvq.js.map +0 -1
- package/dist/responsiveFont-CilwaORG.js.map +0 -1
- package/dist/useElementSize-BJvbGHq8.js +0 -51
- package/dist/useElementSize-BJvbGHq8.js.map +0 -1
- package/dist/useLayer-CUKYjJYq.js.map +0 -1
package/dist/tooltip.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { _ as useTheme_v2, d as createGlobalScopedContext, i as usePrefersReducedMotion, s as Card } from "./useLayer-
|
|
2
|
+
import { l as POPOVER_MOTION_PROPS, n as _getArrayProp } from "./helpers-XThPpWje.js";
|
|
3
|
+
import { _ as useTheme_v2, d as createGlobalScopedContext, i as usePrefersReducedMotion, s as Card } from "./useLayer-B0i19TTM.js";
|
|
4
4
|
import { i as origin, n as AnimateActivity, r as getTransformOrigin, t as getElementRef } from "./getElementRef-Jw7gY0eV.js";
|
|
5
|
-
import { a as
|
|
6
|
-
import { t as Layer } from "./layer-
|
|
5
|
+
import { a as resolvePortalElement, n as Portal, o as useBoundaryElement, r as usePortal, t as Arrow } from "./arrow-B8L6YB-v.js";
|
|
6
|
+
import { t as Layer } from "./layer-AWzYcY_j.js";
|
|
7
7
|
import { c } from "react/compiler-runtime";
|
|
8
8
|
import { clsx } from "clsx/lite";
|
|
9
|
-
import { Activity, cloneElement, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
9
|
+
import { Activity, cloneElement, useContext, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useRef, useState } from "react";
|
|
10
10
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
import { arrow, autoUpdate, flip, offset, shift, useFloating } from "@floating-ui/react-dom";
|
|
11
|
+
import { arrow, autoUpdate, detectOverflow, flip, offset, shift, size, useFloating } from "@floating-ui/react-dom";
|
|
12
12
|
import { motion } from "motion/react";
|
|
13
13
|
import { useEffectEvent } from "use-effect-event";
|
|
14
14
|
/**
|
|
@@ -181,90 +181,85 @@ function useTooltipDelayGroup() {
|
|
|
181
181
|
* @public
|
|
182
182
|
*/
|
|
183
183
|
function Tooltip(props) {
|
|
184
|
-
let $ = c(
|
|
184
|
+
let $ = c(122), boundaryElementContext = useBoundaryElement(), { layer } = useTheme_v2(), { animate: t0, arrow: t1, boundaryElement: _boundaryElement, children: childProp, content, disabled, fallbackPlacements: _fallbackPlacementsProp, padding: t2, placement: t3, portal: portalProp, radius: t4, ref: forwardedRef, scheme, shadow: t5, zOffset: _zOffset, delay, ...restProps } = props, _animate = t0 !== void 0 && t0, arrowProp = t1 !== void 0 && t1, padding = t2 === void 0 ? 2 : t2, placementProp = t3 === void 0 ? "bottom" : t3, radius = t4 === void 0 ? 2 : t4, shadow = t5 === void 0 ? 2 : t5, boundaryElement = _boundaryElement ?? boundaryElementContext?.element, fallbackPlacementsProp = _fallbackPlacementsProp ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"], zOffset = _zOffset ?? layer.tooltip.zOffset, animate = !usePrefersReducedMotion() && _animate, t6;
|
|
185
185
|
$[0] === fallbackPlacementsProp ? t6 = $[1] : (t6 = _getArrayProp(fallbackPlacementsProp), $[0] = fallbackPlacementsProp, $[1] = t6);
|
|
186
|
-
let fallbackPlacements = t6, ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null),
|
|
186
|
+
let fallbackPlacements = t6, ref = useRef(null), [referenceElement, setReferenceElement] = useState(null), arrowRef = useRef(null), t7;
|
|
187
187
|
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t7 = () => ref.current, $[2] = t7) : t7 = $[2], useImperativeHandle(forwardedRef, t7);
|
|
188
|
-
let portal = usePortal(),
|
|
189
|
-
$[3] !==
|
|
188
|
+
let portal = usePortal(), portalName = typeof portalProp == "string" ? portalProp : void 0, t8;
|
|
189
|
+
$[3] !== portal || $[4] !== portalName ? (t8 = resolvePortalElement(portal, portalName), $[3] = portal, $[4] = portalName, $[5] = t8) : t8 = $[5];
|
|
190
|
+
let portalElement = t8, t9;
|
|
191
|
+
$[6] !== animate || $[7] !== arrowProp || $[8] !== boundaryElement || $[9] !== fallbackPlacements || $[10] !== portalElement ? (t9 = {
|
|
190
192
|
animate,
|
|
191
193
|
arrowProp,
|
|
192
194
|
arrowRef,
|
|
193
195
|
boundaryElement,
|
|
194
196
|
fallbackPlacements,
|
|
197
|
+
portalElement,
|
|
195
198
|
rootBoundary: "viewport"
|
|
196
|
-
}, $[
|
|
197
|
-
let middleware = useMiddleware(
|
|
198
|
-
$[
|
|
199
|
-
let
|
|
200
|
-
$[
|
|
199
|
+
}, $[6] = animate, $[7] = arrowProp, $[8] = boundaryElement, $[9] = fallbackPlacements, $[10] = portalElement, $[11] = t9) : t9 = $[11];
|
|
200
|
+
let middleware = useMiddleware(t9), t10;
|
|
201
|
+
$[12] === referenceElement ? t10 = $[13] : (t10 = { reference: referenceElement }, $[12] = referenceElement, $[13] = t10);
|
|
202
|
+
let t11;
|
|
203
|
+
$[14] !== middleware || $[15] !== placementProp || $[16] !== t10 ? (t11 = {
|
|
201
204
|
middleware,
|
|
202
205
|
placement: placementProp,
|
|
203
206
|
whileElementsMounted: autoUpdate,
|
|
204
|
-
elements:
|
|
205
|
-
}, $[
|
|
206
|
-
let { floatingStyles, placement, middlewareData, refs, update } = useFloating(
|
|
207
|
-
$[
|
|
208
|
-
let
|
|
209
|
-
$[
|
|
207
|
+
elements: t10
|
|
208
|
+
}, $[14] = middleware, $[15] = placementProp, $[16] = t10, $[17] = t11) : t11 = $[17];
|
|
209
|
+
let { floatingStyles, placement, middlewareData, refs, update } = useFloating(t11), t12;
|
|
210
|
+
$[18] === update ? t12 = $[19] : (t12 = () => update(), $[18] = update, $[19] = t12);
|
|
211
|
+
let reposition = useEffectEvent(t12), t13;
|
|
212
|
+
$[20] !== boundaryElement || $[21] !== portalElement || $[22] !== reposition ? (t13 = () => {
|
|
213
|
+
(boundaryElement || portalElement) && reposition();
|
|
214
|
+
}, $[20] = boundaryElement, $[21] = portalElement, $[22] = reposition, $[23] = t13) : t13 = $[23];
|
|
215
|
+
let t14;
|
|
216
|
+
$[24] !== boundaryElement || $[25] !== portalElement ? (t14 = [boundaryElement, portalElement], $[24] = boundaryElement, $[25] = portalElement, $[26] = t14) : t14 = $[26], useLayoutEffect(t13, t14);
|
|
217
|
+
let arrowX = middlewareData.arrow?.x, arrowY = middlewareData.arrow?.y, originX = middlewareData["@sanity/ui/origin"]?.originX, originY = middlewareData["@sanity/ui/origin"]?.originY, tooltipId = useId(), [isOpen, setIsOpen] = useDelayedState(!1), delayGroupContext = useTooltipDelayGroup(), t15;
|
|
218
|
+
$[27] === delayGroupContext ? t15 = $[28] : (t15 = delayGroupContext || {}, $[27] = delayGroupContext, $[28] = t15);
|
|
219
|
+
let { setIsGroupActive, setOpenTooltipId } = t15, suppressed = disabled || !content, showTooltip = !suppressed && (isOpen || delayGroupContext?.openTooltipId === tooltipId), isInsideGroup = delayGroupContext !== null, openDelayProp = typeof delay == "number" ? delay : delay?.open || 0, closeDelayProp = typeof delay == "number" ? delay : delay?.close || 0, openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp, closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp, t16;
|
|
220
|
+
$[29] !== closeDelay || $[30] !== isInsideGroup || $[31] !== openDelay || $[32] !== setIsGroupActive || $[33] !== setIsOpen || $[34] !== setOpenTooltipId || $[35] !== tooltipId ? (t16 = (open, immediate) => {
|
|
210
221
|
if (isInsideGroup) {
|
|
211
222
|
if (open) {
|
|
212
223
|
let groupedOpenDelay = immediate ? 0 : openDelay;
|
|
213
224
|
setIsGroupActive?.(open, groupedOpenDelay), setOpenTooltipId?.(tooltipId, groupedOpenDelay);
|
|
214
225
|
} else setIsGroupActive?.(open, closeDelay > 200 ? closeDelay : 200), setOpenTooltipId?.(null, immediate ? 0 : closeDelay);
|
|
215
226
|
} else setIsOpen(open, immediate ? 0 : open ? openDelay : closeDelay);
|
|
216
|
-
}, $[
|
|
217
|
-
let handleIsOpenChange =
|
|
218
|
-
$[
|
|
219
|
-
handleIsOpenChange(!1), childProp?.props?.onBlur?.(e);
|
|
220
|
-
}, $[
|
|
221
|
-
let handleBlur =
|
|
222
|
-
$[
|
|
227
|
+
}, $[29] = closeDelay, $[30] = isInsideGroup, $[31] = openDelay, $[32] = setIsGroupActive, $[33] = setIsOpen, $[34] = setOpenTooltipId, $[35] = tooltipId, $[36] = t16) : t16 = $[36];
|
|
228
|
+
let handleIsOpenChange = t16, t17;
|
|
229
|
+
$[37] !== childProp?.props || $[38] !== handleIsOpenChange || $[39] !== suppressed ? (t17 = (e) => {
|
|
230
|
+
handleIsOpenChange(!1, suppressed), childProp?.props?.onBlur?.(e);
|
|
231
|
+
}, $[37] = childProp?.props, $[38] = handleIsOpenChange, $[39] = suppressed, $[40] = t17) : t17 = $[40], childProp?.props;
|
|
232
|
+
let handleBlur = t17, t18;
|
|
233
|
+
$[41] !== childProp?.props || $[42] !== handleIsOpenChange ? (t18 = (e_0) => {
|
|
223
234
|
handleIsOpenChange(!1, !0), childProp?.props.onClick?.(e_0);
|
|
224
|
-
}, $[
|
|
225
|
-
let handleClick =
|
|
226
|
-
$[
|
|
235
|
+
}, $[41] = childProp?.props, $[42] = handleIsOpenChange, $[43] = t18) : t18 = $[43], childProp?.props;
|
|
236
|
+
let handleClick = t18, t19;
|
|
237
|
+
$[44] !== childProp?.props || $[45] !== handleIsOpenChange ? (t19 = (e_1) => {
|
|
227
238
|
handleIsOpenChange(!1, !0), childProp?.props.onContextMenu?.(e_1);
|
|
228
|
-
}, $[
|
|
229
|
-
let handleContextMenu =
|
|
230
|
-
$[
|
|
239
|
+
}, $[44] = childProp?.props, $[45] = handleIsOpenChange, $[46] = t19) : t19 = $[46], childProp?.props;
|
|
240
|
+
let handleContextMenu = t19, t20;
|
|
241
|
+
$[47] !== childProp?.props || $[48] !== handleIsOpenChange ? (t20 = (e_2) => {
|
|
231
242
|
handleIsOpenChange(!0), childProp?.props?.onFocus?.(e_2);
|
|
232
|
-
}, $[
|
|
233
|
-
let handleFocus =
|
|
234
|
-
$[
|
|
243
|
+
}, $[47] = childProp?.props, $[48] = handleIsOpenChange, $[49] = t20) : t20 = $[49], childProp?.props;
|
|
244
|
+
let handleFocus = t20, t21;
|
|
245
|
+
$[50] !== childProp?.props || $[51] !== handleIsOpenChange ? (t21 = (e_3) => {
|
|
235
246
|
handleIsOpenChange(!0), childProp?.props?.onMouseEnter?.(e_3);
|
|
236
|
-
}, $[
|
|
237
|
-
let handleMouseEnter =
|
|
238
|
-
$[
|
|
239
|
-
handleIsOpenChange(!1), childProp?.props?.onMouseLeave?.(e_4);
|
|
240
|
-
}, $[
|
|
241
|
-
let handleMouseLeave =
|
|
242
|
-
$[
|
|
247
|
+
}, $[50] = childProp?.props, $[51] = handleIsOpenChange, $[52] = t21) : t21 = $[52], childProp?.props;
|
|
248
|
+
let handleMouseEnter = t21, t22;
|
|
249
|
+
$[53] !== childProp?.props || $[54] !== handleIsOpenChange || $[55] !== suppressed ? (t22 = (e_4) => {
|
|
250
|
+
handleIsOpenChange(!1, suppressed), childProp?.props?.onMouseLeave?.(e_4);
|
|
251
|
+
}, $[53] = childProp?.props, $[54] = handleIsOpenChange, $[55] = suppressed, $[56] = t22) : t22 = $[56], childProp?.props;
|
|
252
|
+
let handleMouseLeave = t22, t23;
|
|
253
|
+
$[57] !== handleIsOpenChange || $[58] !== isInsideGroup || $[59] !== referenceElement || $[60] !== showTooltip ? (t23 = {
|
|
243
254
|
handleIsOpenChange,
|
|
244
255
|
referenceElement,
|
|
245
256
|
showTooltip,
|
|
246
257
|
isInsideGroup
|
|
247
|
-
}, $[
|
|
248
|
-
let t20, t21;
|
|
249
|
-
$[47] !== disabled || $[48] !== handleIsOpenChange || $[49] !== showTooltip ? (t20 = () => {
|
|
250
|
-
disabled && showTooltip && handleIsOpenChange(!1);
|
|
251
|
-
}, t21 = [
|
|
252
|
-
disabled,
|
|
253
|
-
handleIsOpenChange,
|
|
254
|
-
showTooltip
|
|
255
|
-
], $[47] = disabled, $[48] = handleIsOpenChange, $[49] = showTooltip, $[50] = t20, $[51] = t21) : (t20 = $[50], t21 = $[51]), useEffect(t20, t21);
|
|
256
|
-
let t22, t23;
|
|
257
|
-
$[52] !== content || $[53] !== handleIsOpenChange || $[54] !== showTooltip ? (t22 = () => {
|
|
258
|
-
!content && showTooltip && handleIsOpenChange(!1);
|
|
259
|
-
}, t23 = [
|
|
260
|
-
content,
|
|
261
|
-
handleIsOpenChange,
|
|
262
|
-
showTooltip
|
|
263
|
-
], $[52] = content, $[53] = handleIsOpenChange, $[54] = showTooltip, $[55] = t22, $[56] = t23) : (t22 = $[55], t23 = $[56]), useEffect(t22, t23);
|
|
258
|
+
}, $[57] = handleIsOpenChange, $[58] = isInsideGroup, $[59] = referenceElement, $[60] = showTooltip, $[61] = t23) : t23 = $[61], useCloseOnMouseLeave(t23);
|
|
264
259
|
let t24;
|
|
265
|
-
$[
|
|
260
|
+
$[62] === handleIsOpenChange ? t24 = $[63] : (t24 = () => handleIsOpenChange(!1, !0), $[62] = handleIsOpenChange, $[63] = t24);
|
|
266
261
|
let onWindowEscape = useEffectEvent(t24), t25;
|
|
267
|
-
$[
|
|
262
|
+
$[64] !== onWindowEscape || $[65] !== showTooltip ? (t25 = () => {
|
|
268
263
|
if (!showTooltip) return;
|
|
269
264
|
let handleWindowKeyDown = function handleWindowKeyDown(event) {
|
|
270
265
|
event.key === "Escape" && onWindowEscape();
|
|
@@ -272,32 +267,25 @@ function Tooltip(props) {
|
|
|
272
267
|
return window.addEventListener("keydown", handleWindowKeyDown), () => {
|
|
273
268
|
window.removeEventListener("keydown", handleWindowKeyDown);
|
|
274
269
|
};
|
|
275
|
-
}, $[
|
|
270
|
+
}, $[64] = onWindowEscape, $[65] = showTooltip, $[66] = t25) : t25 = $[66];
|
|
276
271
|
let t26;
|
|
277
|
-
$[
|
|
272
|
+
$[67] === showTooltip ? t26 = $[68] : (t26 = [showTooltip], $[67] = showTooltip, $[68] = t26), useEffect(t25, t26);
|
|
278
273
|
let t27;
|
|
279
|
-
$[
|
|
280
|
-
let availableWidths = [...boundaryElement ? [boundaryElement.offsetWidth] : [], portalElement?.offsetWidth || document.body.offsetWidth];
|
|
281
|
-
setTooltipMaxWidth(Math.min(...availableWidths) - 8);
|
|
282
|
-
}, $[64] = boundaryElement, $[65] = portalElement?.offsetWidth, $[66] = t27) : t27 = $[66];
|
|
283
|
-
let t28;
|
|
284
|
-
$[67] !== boundaryElement || $[68] !== portalElement ? (t28 = [boundaryElement, portalElement], $[67] = boundaryElement, $[68] = portalElement, $[69] = t28) : t28 = $[69], useLayoutEffect(t27, t28);
|
|
285
|
-
let t29;
|
|
286
|
-
$[70] === update ? t29 = $[71] : (t29 = (arrowEl) => {
|
|
274
|
+
$[69] === update ? t27 = $[70] : (t27 = (arrowEl) => {
|
|
287
275
|
arrowRef.current = arrowEl, update();
|
|
288
|
-
}, $[
|
|
289
|
-
let setArrow =
|
|
290
|
-
$[
|
|
276
|
+
}, $[69] = update, $[70] = t27);
|
|
277
|
+
let setArrow = t27, t28;
|
|
278
|
+
$[71] === refs ? t28 = $[72] : (t28 = (node) => {
|
|
291
279
|
ref.current = node, refs.setFloating(node);
|
|
292
|
-
}, $[
|
|
293
|
-
let setFloating =
|
|
280
|
+
}, $[71] = refs, $[72] = t28);
|
|
281
|
+
let setFloating = t28, t29;
|
|
294
282
|
bb0: {
|
|
295
283
|
if (!childProp) {
|
|
296
|
-
|
|
284
|
+
t29 = null;
|
|
297
285
|
break bb0;
|
|
298
286
|
}
|
|
299
|
-
let
|
|
300
|
-
$[
|
|
287
|
+
let t30;
|
|
288
|
+
$[73] !== childProp || $[74] !== handleBlur || $[75] !== handleClick || $[76] !== handleContextMenu || $[77] !== handleFocus || $[78] !== handleMouseEnter || $[79] !== handleMouseLeave ? (t30 = cloneElement(childProp, {
|
|
301
289
|
onBlur: handleBlur,
|
|
302
290
|
onFocus: handleFocus,
|
|
303
291
|
onMouseEnter: handleMouseEnter,
|
|
@@ -305,23 +293,17 @@ function Tooltip(props) {
|
|
|
305
293
|
onClick: handleClick,
|
|
306
294
|
onContextMenu: handleContextMenu,
|
|
307
295
|
ref: setReferenceElement
|
|
308
|
-
}), $[
|
|
296
|
+
}), $[73] = childProp, $[74] = handleBlur, $[75] = handleClick, $[76] = handleContextMenu, $[77] = handleFocus, $[78] = handleMouseEnter, $[79] = handleMouseLeave, $[80] = t30) : t30 = $[80], t29 = t30;
|
|
309
297
|
}
|
|
310
|
-
let child =
|
|
311
|
-
$[
|
|
312
|
-
let
|
|
313
|
-
if ($[
|
|
314
|
-
let
|
|
315
|
-
return $[
|
|
298
|
+
let child = t29, t30;
|
|
299
|
+
$[81] === childProp ? t30 = $[82] : (t30 = childProp ? getElementRef(childProp) : null, $[81] = childProp, $[82] = t30);
|
|
300
|
+
let t31, t32;
|
|
301
|
+
if ($[83] === referenceElement ? (t31 = $[84], t32 = $[85]) : (t31 = () => referenceElement, t32 = [referenceElement], $[83] = referenceElement, $[84] = t31, $[85] = t32), useImperativeHandle(t30, t31, t32), !child) {
|
|
302
|
+
let t33;
|
|
303
|
+
return $[86] === Symbol.for("react.memo_cache_sentinel") ? (t33 = /* @__PURE__ */ jsx(Fragment$1, {}), $[86] = t33) : t33 = $[86], t33;
|
|
316
304
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
$[88] !== floatingStyles || $[89] !== t37 ? (t38 = {
|
|
320
|
-
...floatingStyles,
|
|
321
|
-
maxWidth: t37
|
|
322
|
-
}, $[88] = floatingStyles, $[89] = t37, $[90] = t38) : t38 = $[90];
|
|
323
|
-
let t39;
|
|
324
|
-
$[91] !== animate || $[92] !== arrowProp || $[93] !== arrowX || $[94] !== arrowY || $[95] !== content || $[96] !== originX || $[97] !== originY || $[98] !== padding || $[99] !== placement || $[100] !== radius || $[101] !== restProps || $[102] !== scheme || $[103] !== setArrow || $[104] !== setFloating || $[105] !== shadow ? (t39 = /* @__PURE__ */ jsx(TooltipCard, {
|
|
305
|
+
let T0 = Layer, t34 = clsx(tooltipLayer, restProps.className), t35;
|
|
306
|
+
$[87] !== animate || $[88] !== arrowProp || $[89] !== arrowX || $[90] !== arrowY || $[91] !== content || $[92] !== originX || $[93] !== originY || $[94] !== padding || $[95] !== placement || $[96] !== radius || $[97] !== restProps || $[98] !== scheme || $[99] !== setArrow || $[100] !== setFloating || $[101] !== shadow ? (t35 = /* @__PURE__ */ jsx(TooltipCard, {
|
|
325
307
|
...restProps,
|
|
326
308
|
animate,
|
|
327
309
|
arrow: arrowProp,
|
|
@@ -337,61 +319,116 @@ function Tooltip(props) {
|
|
|
337
319
|
scheme,
|
|
338
320
|
shadow,
|
|
339
321
|
children: content
|
|
340
|
-
}), $[
|
|
341
|
-
let
|
|
342
|
-
$[
|
|
322
|
+
}), $[87] = animate, $[88] = arrowProp, $[89] = arrowX, $[90] = arrowY, $[91] = content, $[92] = originX, $[93] = originY, $[94] = padding, $[95] = placement, $[96] = radius, $[97] = restProps, $[98] = scheme, $[99] = setArrow, $[100] = setFloating, $[101] = shadow, $[102] = t35) : t35 = $[102];
|
|
323
|
+
let t36;
|
|
324
|
+
$[103] !== T0 || $[104] !== floatingStyles || $[105] !== restProps || $[106] !== setFloating || $[107] !== t34 || $[108] !== t35 || $[109] !== zOffset ? (t36 = /* @__PURE__ */ jsx(T0, {
|
|
343
325
|
"data-ui": "Tooltip",
|
|
344
326
|
...restProps,
|
|
345
|
-
className:
|
|
327
|
+
className: t34,
|
|
346
328
|
ref: setFloating,
|
|
347
|
-
style:
|
|
329
|
+
style: floatingStyles,
|
|
348
330
|
zOffset,
|
|
349
|
-
children:
|
|
350
|
-
}), $[
|
|
351
|
-
let tooltip =
|
|
352
|
-
$[
|
|
353
|
-
__unstable_name:
|
|
331
|
+
children: t35
|
|
332
|
+
}), $[103] = T0, $[104] = floatingStyles, $[105] = restProps, $[106] = setFloating, $[107] = t34, $[108] = t35, $[109] = zOffset, $[110] = t36) : t36 = $[110];
|
|
333
|
+
let tooltip = t36, t37;
|
|
334
|
+
$[111] !== portalName || $[112] !== portalProp || $[113] !== tooltip ? (t37 = portalProp ? /* @__PURE__ */ jsx(Portal, {
|
|
335
|
+
__unstable_name: portalName,
|
|
354
336
|
children: tooltip
|
|
355
|
-
}) : tooltip, $[
|
|
356
|
-
let tooltipNode =
|
|
357
|
-
$[
|
|
337
|
+
}) : tooltip, $[111] = portalName, $[112] = portalProp, $[113] = tooltip, $[114] = t37) : t37 = $[114];
|
|
338
|
+
let tooltipNode = t37, t38;
|
|
339
|
+
$[115] !== animate || $[116] !== showTooltip || $[117] !== tooltipNode ? (t38 = animate ? /* @__PURE__ */ jsx(AnimateActivity, {
|
|
358
340
|
layoutMode: "default",
|
|
359
341
|
mode: showTooltip ? "visible" : "hidden",
|
|
360
342
|
children: tooltipNode
|
|
361
343
|
}) : /* @__PURE__ */ jsx(Activity, {
|
|
362
344
|
mode: showTooltip ? "visible" : "hidden",
|
|
363
345
|
children: tooltipNode
|
|
364
|
-
}), $[
|
|
365
|
-
let
|
|
366
|
-
return $[
|
|
346
|
+
}), $[115] = animate, $[116] = showTooltip, $[117] = tooltipNode, $[118] = t38) : t38 = $[118];
|
|
347
|
+
let t39 = disabled ? null : t38, t40;
|
|
348
|
+
return $[119] !== child || $[120] !== t39 ? (t40 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t39, child] }), $[119] = child, $[120] = t39, $[121] = t40) : t40 = $[121], t40;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* A ref that always holds the latest `value`, updated before any layout effect of the same commit
|
|
352
|
+
* runs (the same mechanism `use-effect-event` uses), for callbacks that run outside render.
|
|
353
|
+
*/
|
|
354
|
+
function useLatestRef(value) {
|
|
355
|
+
let $ = c(3), ref = useRef(value), t0, t1;
|
|
356
|
+
return $[0] === value ? (t0 = $[1], t1 = $[2]) : (t0 = () => {
|
|
357
|
+
ref.current = value;
|
|
358
|
+
}, t1 = [value], $[0] = value, $[1] = t0, $[2] = t1), useInsertionEffect(t0, t1), ref;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Derivable middleware options that read the boundary element from a ref. Floating UI evaluates
|
|
362
|
+
* them inside `computePosition`, which is when the ref is read — never during render.
|
|
363
|
+
*
|
|
364
|
+
* Built at module scope, like `sizeMiddleware` below: a `ref.current` read inside a callback
|
|
365
|
+
* created during render makes the React Compiler skip the calling function, since it cannot tell
|
|
366
|
+
* when the callback runs.
|
|
367
|
+
*/
|
|
368
|
+
function withBoundary(boundaryRef, options) {
|
|
369
|
+
return () => ({
|
|
370
|
+
...options,
|
|
371
|
+
boundary: boundaryRef.current || void 0
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Caps the tooltip width to the room it is positioned in: the boundary element (or the clipping
|
|
376
|
+
* ancestors when there is none), always within the viewport, and the portal element's width.
|
|
377
|
+
* Floating UI measures inside its own positioning pass — only while the tooltip is shown, never
|
|
378
|
+
* during render or on mount — and the width is written straight to the element, so no state or
|
|
379
|
+
* layout effect is involved. Placed after `shift` so `availableWidth` is the full clipping width
|
|
380
|
+
* for top and bottom placements; for left and right placements it is the room on that side.
|
|
381
|
+
*/
|
|
382
|
+
function sizeMiddleware({ boundaryRef, portalRef, rootBoundary }) {
|
|
383
|
+
return size(() => ({
|
|
384
|
+
boundary: boundaryRef.current || void 0,
|
|
385
|
+
rootBoundary,
|
|
386
|
+
padding: 4,
|
|
387
|
+
async apply(state) {
|
|
388
|
+
let { availableWidth, elements } = state, portalElement = portalRef.current, maxWidth = availableWidth;
|
|
389
|
+
if (portalElement) {
|
|
390
|
+
let overflow = await detectOverflow(state, {
|
|
391
|
+
boundary: portalElement,
|
|
392
|
+
rootBoundary,
|
|
393
|
+
padding: 4
|
|
394
|
+
}), portalWidth = state.rects.floating.width - overflow.left - overflow.right;
|
|
395
|
+
portalWidth > 0 && (maxWidth = Math.min(maxWidth, portalWidth));
|
|
396
|
+
}
|
|
397
|
+
elements.floating.style.maxWidth = `${Math.max(0, maxWidth)}px`;
|
|
398
|
+
}
|
|
399
|
+
}));
|
|
367
400
|
}
|
|
368
401
|
function useMiddleware(t0) {
|
|
369
|
-
let $ = c(
|
|
370
|
-
if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !==
|
|
402
|
+
let $ = c(22), { animate, arrowProp, arrowRef, boundaryElement, fallbackPlacements, portalElement, rootBoundary } = t0, boundaryRef = useLatestRef(boundaryElement), portalRef = useLatestRef(portalElement), ret;
|
|
403
|
+
if ($[0] !== animate || $[1] !== arrowProp || $[2] !== arrowRef || $[3] !== boundaryRef || $[4] !== fallbackPlacements || $[5] !== portalRef || $[6] !== rootBoundary) {
|
|
371
404
|
ret = [];
|
|
372
|
-
let t1
|
|
373
|
-
$[
|
|
374
|
-
boundary: t1,
|
|
405
|
+
let t1;
|
|
406
|
+
$[8] !== boundaryRef || $[9] !== fallbackPlacements || $[10] !== rootBoundary ? (t1 = flip(withBoundary(boundaryRef, {
|
|
375
407
|
fallbackPlacements,
|
|
376
408
|
padding: 4,
|
|
377
409
|
rootBoundary
|
|
378
|
-
}), $[
|
|
410
|
+
})), $[8] = boundaryRef, $[9] = fallbackPlacements, $[10] = rootBoundary, $[11] = t1) : t1 = $[11], ret.push(t1);
|
|
411
|
+
let t2;
|
|
412
|
+
$[12] === Symbol.for("react.memo_cache_sentinel") ? (t2 = offset({ mainAxis: 4 }), $[12] = t2) : t2 = $[12], ret.push(t2);
|
|
379
413
|
let t3;
|
|
380
|
-
$[
|
|
381
|
-
let t4 = boundaryElement || void 0, t5;
|
|
382
|
-
if ($[12] !== rootBoundary || $[13] !== t4 ? (t5 = shift({
|
|
383
|
-
boundary: t4,
|
|
414
|
+
$[13] !== boundaryRef || $[14] !== rootBoundary ? (t3 = shift(withBoundary(boundaryRef, {
|
|
384
415
|
rootBoundary,
|
|
385
416
|
padding: 4
|
|
386
|
-
}), $[
|
|
387
|
-
|
|
388
|
-
|
|
417
|
+
})), $[13] = boundaryRef, $[14] = rootBoundary, $[15] = t3) : t3 = $[15], ret.push(t3);
|
|
418
|
+
let t4;
|
|
419
|
+
if ($[16] !== boundaryRef || $[17] !== portalRef || $[18] !== rootBoundary ? (t4 = sizeMiddleware({
|
|
420
|
+
boundaryRef,
|
|
421
|
+
portalRef,
|
|
422
|
+
rootBoundary
|
|
423
|
+
}), $[16] = boundaryRef, $[17] = portalRef, $[18] = rootBoundary, $[19] = t4) : t4 = $[19], ret.push(t4), arrowProp) {
|
|
424
|
+
let t5;
|
|
425
|
+
$[20] === arrowRef ? t5 = $[21] : (t5 = arrow({
|
|
389
426
|
element: arrowRef,
|
|
390
427
|
padding: 4
|
|
391
|
-
}), $[
|
|
428
|
+
}), $[20] = arrowRef, $[21] = t5), ret.push(t5);
|
|
392
429
|
}
|
|
393
|
-
animate && ret.push(origin), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] =
|
|
394
|
-
} else ret = $[
|
|
430
|
+
animate && ret.push(origin), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] = boundaryRef, $[4] = fallbackPlacements, $[5] = portalRef, $[6] = rootBoundary, $[7] = ret;
|
|
431
|
+
} else ret = $[7];
|
|
395
432
|
return ret;
|
|
396
433
|
}
|
|
397
434
|
/**
|