@sanity/ui 4.3.3 → 4.4.1
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-A3jQ7LS0.js} +29 -8
- package/dist/arrow-A3jQ7LS0.js.map +1 -0
- package/dist/autocomplete.d.ts +1 -1
- package/dist/autocomplete.js +12 -19
- package/dist/autocomplete.js.map +1 -1
- 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 +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +141 -140
- 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 +16 -39
- package/dist/menu.js.map +1 -1
- package/dist/{popover-DR6UQQvq.js → popover-B0kvwaep.js} +125 -51
- package/dist/popover-B0kvwaep.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 -2
- 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 +161 -140
- 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 +9 -9
- 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-A3jQ7LS0.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,35 +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
|
-
setTooltipMaxWidth(measureAvailableWidth(boundaryElement, portalElement) - 8);
|
|
281
|
-
}, $[64] = boundaryElement, $[65] = portalElement, $[66] = t27) : t27 = $[66];
|
|
282
|
-
let measureTooltipMaxWidth = useEffectEvent(t27), t28;
|
|
283
|
-
$[67] !== disabled || $[68] !== measureTooltipMaxWidth || $[69] !== showTooltip ? (t28 = () => {
|
|
284
|
-
showTooltip && !disabled && measureTooltipMaxWidth();
|
|
285
|
-
}, $[67] = disabled, $[68] = measureTooltipMaxWidth, $[69] = showTooltip, $[70] = t28) : t28 = $[70];
|
|
286
|
-
let t29;
|
|
287
|
-
$[71] !== disabled || $[72] !== showTooltip ? (t29 = [disabled, showTooltip], $[71] = disabled, $[72] = showTooltip, $[73] = t29) : t29 = $[73], useLayoutEffect(t28, t29);
|
|
288
|
-
let t30;
|
|
289
|
-
$[74] === update ? t30 = $[75] : (t30 = (arrowEl) => {
|
|
274
|
+
$[69] === update ? t27 = $[70] : (t27 = (arrowEl) => {
|
|
290
275
|
arrowRef.current = arrowEl, update();
|
|
291
|
-
}, $[
|
|
292
|
-
let setArrow =
|
|
293
|
-
$[
|
|
276
|
+
}, $[69] = update, $[70] = t27);
|
|
277
|
+
let setArrow = t27, t28;
|
|
278
|
+
$[71] === refs ? t28 = $[72] : (t28 = (node) => {
|
|
294
279
|
ref.current = node, refs.setFloating(node);
|
|
295
|
-
}, $[
|
|
296
|
-
let setFloating =
|
|
280
|
+
}, $[71] = refs, $[72] = t28);
|
|
281
|
+
let setFloating = t28, t29;
|
|
297
282
|
bb0: {
|
|
298
283
|
if (!childProp) {
|
|
299
|
-
|
|
284
|
+
t29 = null;
|
|
300
285
|
break bb0;
|
|
301
286
|
}
|
|
302
|
-
let
|
|
303
|
-
$[
|
|
287
|
+
let t30;
|
|
288
|
+
$[73] !== childProp || $[74] !== handleBlur || $[75] !== handleClick || $[76] !== handleContextMenu || $[77] !== handleFocus || $[78] !== handleMouseEnter || $[79] !== handleMouseLeave ? (t30 = cloneElement(childProp, {
|
|
304
289
|
onBlur: handleBlur,
|
|
305
290
|
onFocus: handleFocus,
|
|
306
291
|
onMouseEnter: handleMouseEnter,
|
|
@@ -308,23 +293,17 @@ function Tooltip(props) {
|
|
|
308
293
|
onClick: handleClick,
|
|
309
294
|
onContextMenu: handleContextMenu,
|
|
310
295
|
ref: setReferenceElement
|
|
311
|
-
}), $[
|
|
296
|
+
}), $[73] = childProp, $[74] = handleBlur, $[75] = handleClick, $[76] = handleContextMenu, $[77] = handleFocus, $[78] = handleMouseEnter, $[79] = handleMouseLeave, $[80] = t30) : t30 = $[80], t29 = t30;
|
|
312
297
|
}
|
|
313
|
-
let child =
|
|
314
|
-
$[
|
|
315
|
-
let
|
|
316
|
-
if ($[
|
|
317
|
-
let
|
|
318
|
-
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;
|
|
319
304
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
$[92] !== floatingStyles || $[93] !== t38 ? (t39 = {
|
|
323
|
-
...floatingStyles,
|
|
324
|
-
maxWidth: t38
|
|
325
|
-
}, $[92] = floatingStyles, $[93] = t38, $[94] = t39) : t39 = $[94];
|
|
326
|
-
let t40;
|
|
327
|
-
$[95] !== animate || $[96] !== arrowProp || $[97] !== arrowX || $[98] !== arrowY || $[99] !== content || $[100] !== originX || $[101] !== originY || $[102] !== padding || $[103] !== placement || $[104] !== radius || $[105] !== restProps || $[106] !== scheme || $[107] !== setArrow || $[108] !== setFloating || $[109] !== shadow ? (t40 = /* @__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, {
|
|
328
307
|
...restProps,
|
|
329
308
|
animate,
|
|
330
309
|
arrow: arrowProp,
|
|
@@ -340,74 +319,116 @@ function Tooltip(props) {
|
|
|
340
319
|
scheme,
|
|
341
320
|
shadow,
|
|
342
321
|
children: content
|
|
343
|
-
}), $[
|
|
344
|
-
let
|
|
345
|
-
$[
|
|
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, {
|
|
346
325
|
"data-ui": "Tooltip",
|
|
347
326
|
...restProps,
|
|
348
|
-
className:
|
|
327
|
+
className: t34,
|
|
349
328
|
ref: setFloating,
|
|
350
|
-
style:
|
|
329
|
+
style: floatingStyles,
|
|
351
330
|
zOffset,
|
|
352
|
-
children:
|
|
353
|
-
}), $[
|
|
354
|
-
let tooltip =
|
|
355
|
-
$[
|
|
356
|
-
__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,
|
|
357
336
|
children: tooltip
|
|
358
|
-
}) : tooltip, $[
|
|
359
|
-
let tooltipNode =
|
|
360
|
-
$[
|
|
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, {
|
|
361
340
|
layoutMode: "default",
|
|
362
341
|
mode: showTooltip ? "visible" : "hidden",
|
|
363
342
|
children: tooltipNode
|
|
364
343
|
}) : /* @__PURE__ */ jsx(Activity, {
|
|
365
344
|
mode: showTooltip ? "visible" : "hidden",
|
|
366
345
|
children: tooltipNode
|
|
367
|
-
}), $[
|
|
368
|
-
let
|
|
369
|
-
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;
|
|
370
359
|
}
|
|
371
360
|
/**
|
|
372
|
-
*
|
|
373
|
-
*
|
|
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.
|
|
374
363
|
*
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
378
|
-
|
|
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.
|
|
379
381
|
*/
|
|
380
|
-
function
|
|
381
|
-
|
|
382
|
-
|
|
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
|
+
}));
|
|
383
400
|
}
|
|
384
401
|
function useMiddleware(t0) {
|
|
385
|
-
let $ = c(
|
|
386
|
-
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) {
|
|
387
404
|
ret = [];
|
|
388
|
-
let t1
|
|
389
|
-
$[
|
|
390
|
-
boundary: t1,
|
|
405
|
+
let t1;
|
|
406
|
+
$[8] !== boundaryRef || $[9] !== fallbackPlacements || $[10] !== rootBoundary ? (t1 = flip(withBoundary(boundaryRef, {
|
|
391
407
|
fallbackPlacements,
|
|
392
408
|
padding: 4,
|
|
393
409
|
rootBoundary
|
|
394
|
-
}), $[
|
|
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);
|
|
395
413
|
let t3;
|
|
396
|
-
$[
|
|
397
|
-
let t4 = boundaryElement || void 0, t5;
|
|
398
|
-
if ($[12] !== rootBoundary || $[13] !== t4 ? (t5 = shift({
|
|
399
|
-
boundary: t4,
|
|
414
|
+
$[13] !== boundaryRef || $[14] !== rootBoundary ? (t3 = shift(withBoundary(boundaryRef, {
|
|
400
415
|
rootBoundary,
|
|
401
416
|
padding: 4
|
|
402
|
-
}), $[
|
|
403
|
-
|
|
404
|
-
|
|
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({
|
|
405
426
|
element: arrowRef,
|
|
406
427
|
padding: 4
|
|
407
|
-
}), $[
|
|
428
|
+
}), $[20] = arrowRef, $[21] = t5), ret.push(t5);
|
|
408
429
|
}
|
|
409
|
-
animate && ret.push(origin), $[0] = animate, $[1] = arrowProp, $[2] = arrowRef, $[3] =
|
|
410
|
-
} 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];
|
|
411
432
|
return ret;
|
|
412
433
|
}
|
|
413
434
|
/**
|