@sanity/ui 4.1.0 → 4.2.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-C6TlkggA.js → arrow-BmX6qbAS.js} +57 -49
- package/dist/arrow-BmX6qbAS.js.map +1 -0
- package/dist/autocomplete.d.ts +2 -2
- package/dist/autocomplete.d.ts.map +1 -1
- package/dist/autocomplete.js +5 -5
- package/dist/breadcrumbs.d.ts +2 -2
- package/dist/breadcrumbs.d.ts.map +1 -1
- package/dist/breadcrumbs.js +10 -5
- package/dist/breadcrumbs.js.map +1 -1
- package/dist/{button-D3iEd7Je.js → button-BNyKSDyA.js} +6 -5
- package/dist/button-BNyKSDyA.js.map +1 -0
- package/dist/code.d.ts +2 -2
- package/dist/code.d.ts.map +1 -1
- package/dist/{factory-BA3gEfyI.js → factory-BzXTX8_Q.js} +2 -2
- package/dist/{factory-BA3gEfyI.js.map → factory-BzXTX8_Q.js.map} +1 -1
- package/dist/{flex-CySCBzQm.js → flex-DmbDG2ks.js} +2 -2
- package/dist/{flex-CySCBzQm.js.map → flex-DmbDG2ks.js.map} +1 -1
- package/dist/{getElementRef-5HZQ-Owu.js → getElementRef-Jw7gY0eV.js} +13 -2
- package/dist/getElementRef-Jw7gY0eV.js.map +1 -0
- package/dist/{grid-I2TNptX-.js → grid-6JSgMj1O.js} +2 -2
- package/dist/{grid-I2TNptX-.js.map → grid-6JSgMj1O.js.map} +1 -1
- package/dist/{hotkeys-Bi6Q5963.js → hotkeys-CaHsQlsO.js} +9 -6
- package/dist/hotkeys-CaHsQlsO.js.map +1 -0
- package/dist/index.d.ts +156 -156
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +83 -159
- package/dist/index.js.map +1 -1
- package/dist/{layer-BK7xWHcE.js → layer-Bl5R3uNR.js} +4 -4
- package/dist/{layer-BK7xWHcE.js.map → layer-Bl5R3uNR.js.map} +1 -1
- package/dist/menu.d.ts +6 -6
- package/dist/menu.d.ts.map +1 -1
- package/dist/menu.js +6 -6
- package/dist/menu.js.map +1 -1
- package/dist/{popover-CdBTZDvj.js → popover-B7-28L8y.js} +44 -40
- package/dist/popover-B7-28L8y.js.map +1 -0
- package/dist/popover-CMlQeKn0.d.ts.map +1 -1
- package/dist/popover.js +1 -1
- package/dist/{stack-BGFEokua.js → stack-rsNFPq2-.js} +2 -2
- package/dist/{stack-BGFEokua.js.map → stack-rsNFPq2-.js.map} +1 -1
- package/dist/styles.css +135 -24
- package/dist/{textInput-Bu3QuADZ.js → textInput-pSfQjkmx.js} +23 -19
- package/dist/textInput-pSfQjkmx.js.map +1 -0
- package/dist/theme.d.ts +33 -33
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +4 -4
- package/dist/toast.d.ts.map +1 -1
- package/dist/toast.js +6 -5
- package/dist/toast.js.map +1 -1
- package/dist/tooltip.d.ts +5 -5
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +28 -27
- package/dist/tooltip.js.map +1 -1
- package/dist/{useLayer-jUJIz8mh.js → useLayer-D1usxIE0.js} +2 -2
- package/dist/{useLayer-jUJIz8mh.js.map → useLayer-D1usxIE0.js.map} +1 -1
- package/package.json +10 -9
- package/dist/arrow-C6TlkggA.js.map +0 -1
- package/dist/button-D3iEd7Je.js.map +0 -1
- package/dist/getElementRef-5HZQ-Owu.js.map +0 -1
- package/dist/hotkeys-Bi6Q5963.js.map +0 -1
- package/dist/popover-CdBTZDvj.js.map +0 -1
- package/dist/textInput-Bu3QuADZ.js.map +0 -1
package/dist/tooltip.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { c as POPOVER_MOTION_PROPS, n as _getArrayProp } from "./helpers-C8xxXAQC.js";
|
|
3
|
-
import { _ as useTheme_v2, d as createGlobalScopedContext, i as usePrefersReducedMotion, s as Card } from "./useLayer-
|
|
4
|
-
import { n as AnimateActivity, r as
|
|
5
|
-
import { a as useBoundaryElement, n as Portal, r as usePortal, t as Arrow } from "./arrow-
|
|
6
|
-
import { t as Layer } from "./layer-
|
|
3
|
+
import { _ as useTheme_v2, d as createGlobalScopedContext, i as usePrefersReducedMotion, s as Card } from "./useLayer-D1usxIE0.js";
|
|
4
|
+
import { i as origin, n as AnimateActivity, r as getTransformOrigin, t as getElementRef } from "./getElementRef-Jw7gY0eV.js";
|
|
5
|
+
import { a as useBoundaryElement, n as Portal, r as usePortal, t as Arrow } from "./arrow-BmX6qbAS.js";
|
|
6
|
+
import { t as Layer } from "./layer-Bl5R3uNR.js";
|
|
7
7
|
import { c } from "react/compiler-runtime";
|
|
8
8
|
import { clsx } from "clsx/lite";
|
|
9
9
|
import { Activity, cloneElement, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
@@ -122,35 +122,36 @@ const MotionCard = motion.create(Card);
|
|
|
122
122
|
* @internal
|
|
123
123
|
*/
|
|
124
124
|
function TooltipCard(props) {
|
|
125
|
-
let $ = c(
|
|
125
|
+
let $ = c(47), animate, arrow, arrowRef, arrowX, arrowY, children, className, originX, originY, padding, placement, radius, ref, restProps, scheme, shadow, style;
|
|
126
126
|
$[0] === props ? (animate = $[1], arrow = $[2], arrowRef = $[3], arrowX = $[4], arrowY = $[5], children = $[6], className = $[7], originX = $[8], originY = $[9], padding = $[10], placement = $[11], radius = $[12], ref = $[13], restProps = $[14], scheme = $[15], shadow = $[16], style = $[17]) : ({animate, arrow, arrowRef, arrowX, arrowY, children, className, originX, originY, padding, placement, radius, ref, scheme, shadow, style, ...restProps} = props, $[0] = props, $[1] = animate, $[2] = arrow, $[3] = arrowRef, $[4] = arrowX, $[5] = arrowY, $[6] = children, $[7] = className, $[8] = originX, $[9] = originY, $[10] = padding, $[11] = placement, $[12] = radius, $[13] = ref, $[14] = restProps, $[15] = scheme, $[16] = shadow, $[17] = style);
|
|
127
|
-
let t0
|
|
128
|
-
$[18] !== originX || $[19] !== originY
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
127
|
+
let t0;
|
|
128
|
+
$[18] !== originX || $[19] !== originY ? (t0 = getTransformOrigin(originX, originY), $[18] = originX, $[19] = originY, $[20] = t0) : t0 = $[20];
|
|
129
|
+
let t1 = animate ? "transform" : void 0, t2;
|
|
130
|
+
$[21] !== style || $[22] !== t0 || $[23] !== t1 ? (t2 = {
|
|
131
|
+
transformOrigin: t0,
|
|
132
|
+
willChange: t1,
|
|
132
133
|
...style
|
|
133
|
-
}, $[
|
|
134
|
-
let rootStyle =
|
|
135
|
-
$[
|
|
136
|
-
left:
|
|
137
|
-
top:
|
|
134
|
+
}, $[21] = style, $[22] = t0, $[23] = t1, $[24] = t2) : t2 = $[24];
|
|
135
|
+
let rootStyle = t2, t3 = arrowX === null ? void 0 : arrowX, t4 = arrowY === null ? void 0 : arrowY, t5;
|
|
136
|
+
$[25] !== t3 || $[26] !== t4 ? (t5 = {
|
|
137
|
+
left: t3,
|
|
138
|
+
top: t4,
|
|
138
139
|
right: void 0,
|
|
139
140
|
bottom: void 0
|
|
140
|
-
}, $[
|
|
141
|
-
let arrowStyle =
|
|
142
|
-
$[
|
|
143
|
-
let
|
|
144
|
-
$[
|
|
141
|
+
}, $[25] = t3, $[26] = t4, $[27] = t5) : t5 = $[27];
|
|
142
|
+
let arrowStyle = t5, t6;
|
|
143
|
+
$[28] === className ? t6 = $[29] : (t6 = clsx(tooltipCard, className), $[28] = className, $[29] = t6);
|
|
144
|
+
let t7 = animate ? POPOVER_MOTION_PROPS : void 0, t8;
|
|
145
|
+
$[30] !== arrow || $[31] !== arrowRef || $[32] !== arrowStyle ? (t8 = arrow && /* @__PURE__ */ jsx(Arrow, {
|
|
145
146
|
ref: arrowRef,
|
|
146
147
|
style: arrowStyle,
|
|
147
148
|
width: 15,
|
|
148
149
|
height: 6,
|
|
149
150
|
radius: 2
|
|
150
|
-
}), $[
|
|
151
|
-
let
|
|
152
|
-
return $[
|
|
153
|
-
className:
|
|
151
|
+
}), $[30] = arrow, $[31] = arrowRef, $[32] = arrowStyle, $[33] = t8) : t8 = $[33];
|
|
152
|
+
let t9;
|
|
153
|
+
return $[34] !== children || $[35] !== padding || $[36] !== placement || $[37] !== radius || $[38] !== ref || $[39] !== restProps || $[40] !== rootStyle || $[41] !== scheme || $[42] !== shadow || $[43] !== t6 || $[44] !== t7 || $[45] !== t8 ? (t9 = /* @__PURE__ */ jsxs(MotionCard, {
|
|
154
|
+
className: t6,
|
|
154
155
|
"data-ui": "Tooltip__card",
|
|
155
156
|
...restProps,
|
|
156
157
|
"data-placement": placement,
|
|
@@ -160,9 +161,9 @@ function TooltipCard(props) {
|
|
|
160
161
|
scheme,
|
|
161
162
|
shadow,
|
|
162
163
|
style: rootStyle,
|
|
163
|
-
...
|
|
164
|
-
children: [children,
|
|
165
|
-
}), $[
|
|
164
|
+
...t7,
|
|
165
|
+
children: [children, t8]
|
|
166
|
+
}), $[34] = children, $[35] = padding, $[36] = placement, $[37] = radius, $[38] = ref, $[39] = restProps, $[40] = rootStyle, $[41] = scheme, $[42] = shadow, $[43] = t6, $[44] = t7, $[45] = t8, $[46] = t9) : t9 = $[46], t9;
|
|
166
167
|
}
|
|
167
168
|
/**
|
|
168
169
|
* @beta
|
package/dist/tooltip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","names":["(nextState: SetStateAction<S>, delay?: number) => {\n const action = () => {\n setState(nextState)\n }\n\n // A new state change has been initiated, cancel the previous one.\n if (delayedAction.current) {\n clearTimeout(delayedAction.current)\n delayedAction.current = undefined\n }\n\n if (!delay) return action()\n delayedAction.current = setTimeout(action, delay)\n }","useCallback((nextState: SetStateAction<S>, delay?: number) => {\n const action = () => {\n setState(nextState)\n }\n\n // A new state change has been initiated, cancel the previous one.\n if (delayedAction.current) {\n clearTimeout(delayedAction.current)\n delayedAction.current = undefined\n }\n\n if (!delay) return action()\n delayedAction.current = setTimeout(action, delay)\n }, [])","() => {\n return () => {\n if (delayedAction.current) {\n clearTimeout(delayedAction.current)\n }\n }\n }","[]","[state, onStateChange]","{\n originX,\n originY,\n willChange: animate ? 'transform' : undefined,\n ...style,\n }","animate ? 'transform' : undefined","useMemo(\n () => ({\n originX,\n originY,\n willChange: animate ? 'transform' : undefined,\n ...style,\n }),\n [animate, originX, originY, style],\n )","{\n left: arrowX !== null ? arrowX : undefined,\n top: arrowY !== null ? arrowY : undefined,\n right: undefined,\n bottom: undefined,\n }","arrowX !== null ? arrowX : undefined","arrowY !== null ? arrowY : undefined","useMemo(\n () => ({\n left: arrowX !== null ? arrowX : undefined,\n top: arrowY !== null ? arrowY : undefined,\n right: undefined,\n bottom: undefined,\n }),\n [arrowX, arrowY],\n )","clsx(tooltipCard, className)","arrow && (\n <Arrow\n ref={arrowRef}\n style={arrowStyle}\n width={DEFAULT_TOOLTIP_ARROW_WIDTH}\n height={DEFAULT_TOOLTIP_ARROW_HEIGHT}\n radius={DEFAULT_TOOLTIP_ARROW_RADIUS}\n />\n )","<MotionCard\n className={clsx(tooltipCard, className)}\n data-ui=\"Tooltip__card\"\n {...restProps}\n data-placement={placement}\n padding={padding}\n radius={radius}\n ref={ref}\n scheme={scheme}\n shadow={shadow}\n style={rootStyle}\n {...(animate ? POPOVER_MOTION_PROPS : undefined)}\n >\n {children}\n\n {arrow && (\n <Arrow\n ref={arrowRef}\n style={arrowStyle}\n width={DEFAULT_TOOLTIP_ARROW_WIDTH}\n height={DEFAULT_TOOLTIP_ARROW_HEIGHT}\n radius={DEFAULT_TOOLTIP_ARROW_RADIUS}\n />\n )}\n </MotionCard>","animate ? POPOVER_MOTION_PROPS : undefined","_animate = false","arrowProp = false","placementProp = 'bottom'","padding = 2","radius = 2","shadow = 2","_getArrayProp(fallbackPlacementsProp)","() => ref.current","{\n animate,\n arrowProp,\n arrowRef,\n boundaryElement,\n fallbackPlacements,\n rootBoundary,\n }","{reference: referenceElement}","{\n middleware,\n placement: placementProp,\n whileElementsMounted: autoUpdate,\n elements: {reference: referenceElement},\n }","delayGroupContext || {}","(open: boolean, immediate?: boolean) => {\n if (isInsideGroup) {\n // When it's inside a group, the open or close status will be handled by the group.\n if (open) {\n const groupedOpenDelay = immediate ? 0 : openDelay\n\n setIsGroupActive?.(open, groupedOpenDelay)\n setOpenTooltipId?.(tooltipId, groupedOpenDelay)\n } else {\n const minimumGroupDeactivateDelay = 200 // We should provide some delay to allow the user to reach the next tooltip.\n const groupDeactivateDelay =\n closeDelay > minimumGroupDeactivateDelay ? closeDelay : minimumGroupDeactivateDelay\n\n setIsGroupActive?.(open, groupDeactivateDelay)\n setOpenTooltipId?.(null, immediate ? 0 : closeDelay)\n }\n } else {\n const standaloneDelay = immediate ? 0 : open ? openDelay : closeDelay\n\n // When it's not inside a group, the open or close status will be handled by the tooltip itself.\n setIsOpen(open, standaloneDelay)\n }\n }","useCallback(\n (open: boolean, immediate?: boolean) => {\n if (isInsideGroup) {\n // When it's inside a group, the open or close status will be handled by the group.\n if (open) {\n const groupedOpenDelay = immediate ? 0 : openDelay\n\n setIsGroupActive?.(open, groupedOpenDelay)\n setOpenTooltipId?.(tooltipId, groupedOpenDelay)\n } else {\n const minimumGroupDeactivateDelay = 200 // We should provide some delay to allow the user to reach the next tooltip.\n const groupDeactivateDelay =\n closeDelay > minimumGroupDeactivateDelay ? closeDelay : minimumGroupDeactivateDelay\n\n setIsGroupActive?.(open, groupDeactivateDelay)\n setOpenTooltipId?.(null, immediate ? 0 : closeDelay)\n }\n } else {\n const standaloneDelay = immediate ? 0 : open ? openDelay : closeDelay\n\n // When it's not inside a group, the open or close status will be handled by the tooltip itself.\n setIsOpen(open, standaloneDelay)\n }\n },\n [\n isInsideGroup,\n openDelay,\n setIsGroupActive,\n setOpenTooltipId,\n tooltipId,\n closeDelay,\n setIsOpen,\n ],\n )","(e: FocusEvent) => {\n handleIsOpenChange(false)\n childProp?.props?.onBlur?.(e)\n }","props","useCallback(\n (e: FocusEvent) => {\n handleIsOpenChange(false)\n childProp?.props?.onBlur?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )","(e: MouseEvent) => {\n handleIsOpenChange(false, true)\n childProp?.props.onClick?.(e)\n }","e","useCallback(\n (e: MouseEvent) => {\n handleIsOpenChange(false, true)\n childProp?.props.onClick?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )","(e: MouseEvent) => {\n handleIsOpenChange(false, true)\n childProp?.props.onContextMenu?.(e)\n }","useCallback(\n (e: MouseEvent) => {\n handleIsOpenChange(false, true)\n childProp?.props.onContextMenu?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )","(e: FocusEvent) => {\n handleIsOpenChange(true)\n childProp?.props?.onFocus?.(e)\n }","useCallback(\n (e: FocusEvent) => {\n handleIsOpenChange(true)\n childProp?.props?.onFocus?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )","(e: MouseEvent) => {\n handleIsOpenChange(true)\n childProp?.props?.onMouseEnter?.(e)\n }","useCallback(\n (e: MouseEvent) => {\n handleIsOpenChange(true)\n childProp?.props?.onMouseEnter?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )","(e: MouseEvent) => {\n handleIsOpenChange(false)\n childProp?.props?.onMouseLeave?.(e)\n }","useCallback(\n (e: MouseEvent) => {\n handleIsOpenChange(false)\n childProp?.props?.onMouseLeave?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )","{handleIsOpenChange, referenceElement, showTooltip, isInsideGroup}","() => {\n if (disabled && showTooltip) handleIsOpenChange(false)\n }","[disabled, handleIsOpenChange, showTooltip]","() => {\n if (!content && showTooltip) handleIsOpenChange(false)\n }","[content, handleIsOpenChange, showTooltip]","() => {\n // If the user clicks on escape key, close the tooltip.\n if (!showTooltip) return\n\n function handleWindowKeyDown(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n handleIsOpenChange(false, true)\n }\n }\n\n window.addEventListener('keydown', handleWindowKeyDown)\n\n // oxlint-disable-next-line consistent-return\n return () => {\n window.removeEventListener('keydown', handleWindowKeyDown)\n }\n }","[handleIsOpenChange, showTooltip]","() => {\n // Get the maximum tooltip width (sans tooltip padding)\n // Tooltip width should never exceed the width of either any supplied boundary or portal element.\n // If both portal and boundary elements are provided, use the smaller width of the two.\n const availableWidths = [\n ...(boundaryElement ? [boundaryElement.offsetWidth] : []),\n portalElement?.offsetWidth || document.body.offsetWidth,\n ]\n\n // oxlint-disable-next-line react/set-state-in-effect\n setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2)\n }","offsetWidth","[boundaryElement, portalElement]","(arrowEl: HTMLDivElement | null) => {\n arrowRef.current = arrowEl\n update()\n }","useCallback(\n (arrowEl: HTMLDivElement | null) => {\n arrowRef.current = arrowEl\n update()\n },\n [update],\n )","(node: HTMLDivElement | null) => {\n ref.current = node\n refs.setFloating(node)\n }","useCallback(\n (node: HTMLDivElement | null) => {\n ref.current = node\n refs.setFloating(node)\n },\n [refs],\n )","useMemo(() => {\n if (!childProp) return null\n\n return cloneElement(childProp, {\n onBlur: handleBlur,\n onFocus: handleFocus,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n onClick: handleClick,\n onContextMenu: handleContextMenu,\n ref: setReferenceElement,\n })\n }, [\n childProp,\n handleBlur,\n handleClick,\n handleContextMenu,\n handleFocus,\n handleMouseEnter,\n handleMouseLeave,\n ])","cloneElement(childProp, {\n onBlur: handleBlur,\n onFocus: handleFocus,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n onClick: handleClick,\n onContextMenu: handleContextMenu,\n ref: setReferenceElement,\n })","childProp ? getElementRef(childProp) : null","() => referenceElement","[\n referenceElement,\n ]","<></>","{\n ...floatingStyles,\n maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : undefined,\n }","tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : undefined","<TooltipCard\n {...restProps}\n animate={animate}\n arrow={arrowProp}\n arrowRef={setArrow}\n arrowX={arrowX}\n arrowY={arrowY}\n originX={originX}\n originY={originY}\n padding={padding}\n placement={placement}\n radius={radius}\n ref={setFloating}\n scheme={scheme}\n shadow={shadow}\n >\n {content}\n </TooltipCard>","<Layer\n data-ui=\"Tooltip\"\n {...restProps}\n className={clsx(tooltipLayer, restProps.className)}\n ref={setFloating}\n style={{\n ...floatingStyles,\n maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : undefined,\n }}\n zOffset={zOffset}\n >\n <TooltipCard\n {...restProps}\n animate={animate}\n arrow={arrowProp}\n arrowRef={setArrow}\n arrowX={arrowX}\n arrowY={arrowY}\n originX={originX}\n originY={originY}\n padding={padding}\n placement={placement}\n radius={radius}\n ref={setFloating}\n scheme={scheme}\n shadow={shadow}\n >\n {content}\n </TooltipCard>\n </Layer>","Layer","clsx(tooltipLayer, restProps.className)","\"Tooltip\"","portalProp ? (\n <Portal __unstable_name={typeof portalProp === 'string' ? portalProp : undefined}>\n {tooltip}\n </Portal>\n ) : (\n tooltip\n )","animate ? (\n <AnimateActivity layoutMode=\"default\" mode={showTooltip ? 'visible' : 'hidden'}>\n {tooltipNode}\n </AnimateActivity>\n ) : (\n <Activity mode={showTooltip ? 'visible' : 'hidden'}>{tooltipNode}</Activity>\n )","<>\n {/* the tooltip */}\n {animate ? (\n <AnimateActivity layoutMode=\"default\" mode={showTooltip ? 'visible' : 'hidden'}>\n {tooltipNode}\n </AnimateActivity>\n ) : (\n <Activity mode={showTooltip ? 'visible' : 'hidden'}>{tooltipNode}</Activity>\n )}\n\n {/* the referred element */}\n {child}\n </>","{\n animate,\n arrowProp,\n arrowRef,\n boundaryElement,\n fallbackPlacements,\n rootBoundary,\n}: {\n animate: boolean\n arrowProp: boolean\n arrowRef: React.RefObject<HTMLDivElement | null>\n boundaryElement: HTMLElement | null\n fallbackPlacements: Placement[]\n rootBoundary: RootBoundary\n}","flip({\n boundary: boundaryElement || undefined,\n fallbackPlacements,\n padding: DEFAULT_TOOLTIP_PADDING,\n rootBoundary,\n })","boundaryElement || undefined","offset({mainAxis: DEFAULT_TOOLTIP_DISTANCE})","shift({\n boundary: boundaryElement || undefined,\n rootBoundary,\n padding: DEFAULT_TOOLTIP_PADDING,\n })","arrow({element: arrowRef, padding: DEFAULT_TOOLTIP_PADDING})","useMemo(() => {\n const ret: Middleware[] = []\n\n // Flip the floating element when leaving the boundary box\n ret.push(\n flip({\n boundary: boundaryElement || undefined,\n fallbackPlacements,\n padding: DEFAULT_TOOLTIP_PADDING,\n rootBoundary,\n }),\n )\n\n // Define distance between reference and floating element\n ret.push(offset({mainAxis: DEFAULT_TOOLTIP_DISTANCE}))\n\n // Shift the tooltip so its sits with the boundary element\n ret.push(\n shift({\n boundary: boundaryElement || undefined,\n rootBoundary,\n padding: DEFAULT_TOOLTIP_PADDING,\n }),\n )\n\n // Place arrow\n if (arrowProp) {\n ret.push(arrow({element: arrowRef, padding: DEFAULT_TOOLTIP_PADDING}))\n }\n\n // Determine the origin to scale from.\n // Must be placed after `@sanity/ui/size` and `shift` middleware.\n if (animate) {\n ret.push(origin)\n }\n\n return ret\n }, [animate, arrowProp, arrowRef, boundaryElement, fallbackPlacements, rootBoundary])","{\n handleIsOpenChange,\n referenceElement,\n showTooltip,\n isInsideGroup,\n}: {\n handleIsOpenChange: (open: boolean, immediate?: boolean) => void\n referenceElement: HTMLElement | null\n showTooltip: boolean\n isInsideGroup: boolean\n}","(target: EventTarget | null, teardown: () => void) => {\n if (!referenceElement) return\n\n const isHoveringReference =\n referenceElement === target || (target instanceof Node && referenceElement.contains(target))\n\n if (!isHoveringReference) {\n handleIsOpenChange(false)\n // Allow removing the event listener eagerly, to avoid race conditions\n teardown()\n }\n }","() => {\n if (!showTooltip || isInsideGroup) return\n\n const handleMouseMove = (event: MouseEvent) => {\n onMouseMove(event.target, () => window.removeEventListener('mousemove', handleMouseMove))\n }\n\n window.addEventListener('mousemove', handleMouseMove)\n\n // oxlint-disable-next-line consistent-return\n return () => window.removeEventListener('mousemove', handleMouseMove)\n // oxlint-disable-next-line react/exhaustive-effect-dependencies\n }","[isInsideGroup, showTooltip]","{\n setIsGroupActive: setIsGroupActive,\n openTooltipId: openTooltipId,\n setOpenTooltipId: setOpenTooltipId,\n // When the group is active, we want the next tooltip to open immediately.\n openDelay: isGroupActive ? 1 : openDelay,\n closeDelay: closeDelay,\n }","isGroupActive ? 1 : openDelay","useMemo(\n () => ({\n setIsGroupActive: setIsGroupActive,\n openTooltipId: openTooltipId,\n setOpenTooltipId: setOpenTooltipId,\n // When the group is active, we want the next tooltip to open immediately.\n openDelay: isGroupActive ? 1 : openDelay,\n closeDelay: closeDelay,\n }),\n [closeDelay, isGroupActive, openDelay, openTooltipId, setIsGroupActive, setOpenTooltipId],\n )","<TooltipDelayGroupContext.Provider value={value}>{children}</TooltipDelayGroupContext.Provider>","TooltipDelayGroupContext.Provider"],"sources":["../src/core/hooks/useDelayedState.ts","../src/core/primitives/tooltip/constants.ts","../src/core/primitives/tooltip/tooltip.css.ts","../src/core/primitives/tooltip/tooltipCard.tsx","../src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx","../src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts","../src/core/primitives/tooltip/tooltip.tsx","../src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx"],"sourcesContent":["import {SetStateAction, useCallback, useEffect, useRef, useState} from 'react'\n\n/**\n * @beta\n */\nexport function useDelayedState<S>(\n initialState: S | (() => S),\n): [S, (nextState: SetStateAction<S>, delay?: number) => void] {\n const [state, setState] = useState(initialState)\n const delayedAction = useRef<NodeJS.Timeout | undefined>(undefined)\n\n const onStateChange = useCallback((nextState: SetStateAction<S>, delay?: number) => {\n const action = () => {\n setState(nextState)\n }\n\n // A new state change has been initiated, cancel the previous one.\n if (delayedAction.current) {\n clearTimeout(delayedAction.current)\n delayedAction.current = undefined\n }\n\n if (!delay) return action()\n delayedAction.current = setTimeout(action, delay)\n }, [])\n\n useEffect(() => {\n return () => {\n if (delayedAction.current) {\n clearTimeout(delayedAction.current)\n }\n }\n }, [])\n\n return [state, onStateChange]\n}\n","import {Placement} from '@floating-ui/react-dom'\n\nexport const DEFAULT_TOOLTIP_ARROW_WIDTH = 15\nexport const DEFAULT_TOOLTIP_ARROW_HEIGHT = 6\nexport const DEFAULT_TOOLTIP_ARROW_RADIUS = 2\n\nexport const DEFAULT_TOOLTIP_DISTANCE = 4\nexport const DEFAULT_TOOLTIP_PADDING = 4\n\nexport const DEFAULT_FALLBACK_PLACEMENTS: Record<Placement, Placement[]> = {\n 'top': ['top-end', 'top-start', 'bottom', 'left', 'right'],\n 'top-start': ['top', 'top-end', 'bottom-start', 'left-start', 'right-start'],\n 'top-end': ['top', 'top-start', 'bottom-end', 'left-end', 'right-end'],\n 'bottom': ['bottom-end', 'bottom-start', 'top', 'left', 'right'],\n 'bottom-start': ['bottom', 'bottom-end', 'top-start', 'left-start', 'right-start'],\n 'bottom-end': ['bottom', 'bottom-start', 'top-end', 'left-end', 'right-end'],\n 'left': ['left-end', 'left-start', 'right', 'top', 'bottom'],\n 'left-start': ['left', 'left-end', 'right-start', 'top-start', 'bottom-start'],\n 'left-end': ['left', 'left-start', 'right-end', 'top-end', 'bottom-end'],\n 'right': ['right-end', 'right-start', 'left', 'top', 'bottom'],\n 'right-start': ['right', 'right-end', 'left-start', 'top-start', 'bottom-start'],\n 'right-end': ['right', 'right-start', 'left-end', 'top-end', 'bottom-end'],\n}\n","import {style} from '@vanilla-extract/css'\n\nexport const tooltipLayer = style({\n pointerEvents: 'none',\n})\n\nexport const tooltipCard = style({\n willChange: 'transform',\n})\n","import {clsx} from 'clsx/lite'\nimport {motion} from 'motion/react'\nimport React, {CSSProperties, useMemo} from 'react'\n\nimport {ThemeColorSchemeKey} from '../../../theme/system/color/_system'\nimport {POPOVER_MOTION_PROPS} from '../../constants'\nimport {Placement} from '../../types/placement'\nimport {Radius} from '../../types/radius'\nimport {Arrow} from '../../utils/arrow/arrow'\nimport {Card} from '../card/card'\nimport {\n DEFAULT_TOOLTIP_ARROW_HEIGHT,\n DEFAULT_TOOLTIP_ARROW_RADIUS,\n DEFAULT_TOOLTIP_ARROW_WIDTH,\n} from './constants'\n\nimport {tooltipCard} from './tooltip.css'\n\nconst MotionCard = motion.create(Card)\n\n/**\n * @internal\n */\nexport function TooltipCard(\n props: {\n animate?: boolean\n arrow: boolean\n arrowRef: React.Ref<HTMLDivElement>\n arrowX?: number\n arrowY?: number\n originX?: number\n originY?: number\n padding?: number | number[]\n placement?: Placement\n radius?: Radius | Radius[]\n scheme?: ThemeColorSchemeKey\n shadow?: number | number[]\n } & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'width'>,\n) {\n const {\n animate,\n arrow,\n arrowRef,\n arrowX,\n arrowY,\n children,\n className,\n originX,\n originY,\n padding,\n placement,\n radius,\n ref,\n scheme,\n shadow,\n style,\n ...restProps\n } = props\n\n const rootStyle: CSSProperties = useMemo(\n () => ({\n originX,\n originY,\n willChange: animate ? 'transform' : undefined,\n ...style,\n }),\n [animate, originX, originY, style],\n )\n\n const arrowStyle: CSSProperties = useMemo(\n () => ({\n left: arrowX !== null ? arrowX : undefined,\n top: arrowY !== null ? arrowY : undefined,\n right: undefined,\n bottom: undefined,\n }),\n [arrowX, arrowY],\n )\n\n return (\n <MotionCard\n className={clsx(tooltipCard, className)}\n data-ui=\"Tooltip__card\"\n {...restProps}\n data-placement={placement}\n padding={padding}\n radius={radius}\n ref={ref}\n scheme={scheme}\n shadow={shadow}\n style={rootStyle}\n {...(animate ? POPOVER_MOTION_PROPS : undefined)}\n >\n {children}\n\n {arrow && (\n <Arrow\n ref={arrowRef}\n style={arrowStyle}\n width={DEFAULT_TOOLTIP_ARROW_WIDTH}\n height={DEFAULT_TOOLTIP_ARROW_HEIGHT}\n radius={DEFAULT_TOOLTIP_ARROW_RADIUS}\n />\n )}\n </MotionCard>\n )\n}\n","import {createGlobalScopedContext} from '../../../lib/createGlobalScopedContext'\nimport {TooltipDelayGroupContextValue} from './types'\n\n/**\n * @beta\n */\nexport const TooltipDelayGroupContext =\n createGlobalScopedContext<TooltipDelayGroupContextValue | null>(\n '@sanity/ui/context/tooltipDelayGroup',\n null,\n )\n","import {useContext} from 'react'\n\nimport {TooltipDelayGroupContext} from './tooltipDelayGroupContext'\nimport {TooltipDelayGroupContextValue} from './types'\n\n/**\n * @beta\n */\nexport function useTooltipDelayGroup(): TooltipDelayGroupContextValue | null {\n const value = useContext(TooltipDelayGroupContext)\n\n return value\n}\n","import {\n arrow,\n autoUpdate,\n flip,\n type Middleware,\n offset,\n type RootBoundary,\n shift,\n useFloating,\n} from '@floating-ui/react-dom'\nimport {clsx} from 'clsx/lite'\nimport {\n Activity,\n cloneElement,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\n// TODO: switch to `useEffectEvent` from `react` once\n// https://github.com/facebook/react/issues/34818 is fixed in the lowest React\n// version we support: on React 19.2 the native hook never sees values past\n// the first render when the calling component is wrapped in `forwardRef` or\n// `memo`, and consumers may wrap `Tooltip` in `memo`.\nimport {useEffectEvent} from 'use-effect-event'\n\nimport type {ThemeColorSchemeKey} from '../../../theme/system/color/_system'\nimport {useDelayedState} from '../../hooks/useDelayedState'\nimport {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'\nimport {origin} from '../../middleware/origin'\nimport {_getArrayProp} from '../../styles/helpers'\nimport {useTheme_v2} from '../../theme/useTheme'\nimport type {Placement} from '../../types/placement'\nimport {AnimateActivity} from '../../utils/animateActivity'\nimport {useBoundaryElement} from '../../utils/boundaryElement/useBoundaryElement'\nimport {getElementRef} from '../../utils/getElementRef'\nimport {Layer, type LayerProps} from '../../utils/layer/layer'\nimport {Portal} from '../../utils/portal/portal'\nimport {usePortal} from '../../utils/portal/usePortal'\nimport type {Delay} from '../types'\nimport {\n DEFAULT_FALLBACK_PLACEMENTS,\n DEFAULT_TOOLTIP_DISTANCE,\n DEFAULT_TOOLTIP_PADDING,\n} from './constants'\nimport {TooltipCard} from './tooltipCard'\nimport {useTooltipDelayGroup} from './tooltipDelayGroup/useTooltipDelayGroup'\n\nimport {tooltipLayer} from './tooltip.css'\n\n/**\n * @public\n */\nexport interface TooltipProps extends Omit<LayerProps, 'as'> {\n /** @deprecated Use `fallbackPlacements` instead. */\n allowedAutoPlacements?: never\n arrow?: boolean\n boundaryElement?: HTMLElement | null\n children?: React.JSX.Element\n content?: React.ReactNode\n disabled?: boolean\n fallbackPlacements?: Placement[]\n padding?: number | number[]\n placement?: Placement\n /** Whether or not to render the tooltip in a portal element. */\n portal?: boolean | string\n radius?: number | number[]\n scheme?: ThemeColorSchemeKey\n shadow?: number | number[]\n /**\n * Adds a delay to open or close the tooltip.\n *\n * If only a `number` is passed, it will be used for both opening and closing.\n *\n * If an object `{open: number; close:number}` is passed, it can be used to set different delays for each action.\n *\n * @public\n * @defaultValue 0\n */\n delay?: Delay\n /**\n * Whether the tooltip should animate in and out.\n *\n * @beta\n * @defaultValue false\n */\n animate?: boolean\n}\n\n/**\n * Tooltips display information when hovering, focusing or tapping.\n *\n * @public\n */\nexport function Tooltip(\n props: TooltipProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'children' | 'content'>,\n) {\n const boundaryElementContext = useBoundaryElement()\n const {layer} = useTheme_v2()\n const {\n animate: _animate = false,\n arrow: arrowProp = false,\n boundaryElement: _boundaryElement,\n children: childProp,\n content,\n disabled,\n fallbackPlacements: _fallbackPlacementsProp,\n padding = 2,\n placement: placementProp = 'bottom',\n portal: portalProp,\n radius = 2,\n ref: forwardedRef,\n scheme,\n shadow = 2,\n zOffset: _zOffset,\n delay,\n ...restProps\n } = props\n const boundaryElement = _boundaryElement ?? boundaryElementContext?.element\n const fallbackPlacementsProp =\n _fallbackPlacementsProp ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? 'bottom']\n const zOffset = _zOffset ?? layer.tooltip.zOffset\n const prefersReducedMotion = usePrefersReducedMotion()\n const animate = prefersReducedMotion ? false : _animate\n const fallbackPlacements = _getArrayProp(fallbackPlacementsProp)\n const ref = useRef<HTMLDivElement | null>(null)\n const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null)\n const arrowRef = useRef<HTMLDivElement | null>(null)\n const rootBoundary: RootBoundary = 'viewport'\n const [tooltipMaxWidth, setTooltipMaxWidth] = useState(0)\n\n useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(forwardedRef, () => ref.current)\n\n const portal = usePortal()\n const portalElement =\n typeof portalProp === 'string' ? portal.elements?.[portalProp] || null : portal.element\n\n const middleware = useMiddleware({\n animate,\n arrowProp,\n arrowRef,\n boundaryElement,\n fallbackPlacements,\n rootBoundary,\n })\n\n const {floatingStyles, placement, middlewareData, refs, update} = useFloating({\n middleware,\n placement: placementProp,\n whileElementsMounted: autoUpdate,\n elements: {reference: referenceElement},\n })\n\n const arrowX = middlewareData.arrow?.x\n const arrowY = middlewareData.arrow?.y\n\n const originX = middlewareData['@sanity/ui/origin']?.originX\n const originY = middlewareData['@sanity/ui/origin']?.originY\n\n const tooltipId = useId()\n const [isOpen, setIsOpen] = useDelayedState(false)\n const delayGroupContext = useTooltipDelayGroup()\n const {setIsGroupActive, setOpenTooltipId} = delayGroupContext || {}\n const showTooltip = isOpen || delayGroupContext?.openTooltipId === tooltipId\n\n const isInsideGroup = delayGroupContext !== null\n const openDelayProp = typeof delay === 'number' ? delay : delay?.open || 0\n const closeDelayProp = typeof delay === 'number' ? delay : delay?.close || 0\n\n const openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp\n const closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp\n\n const handleIsOpenChange = useCallback(\n (open: boolean, immediate?: boolean) => {\n if (isInsideGroup) {\n // When it's inside a group, the open or close status will be handled by the group.\n if (open) {\n const groupedOpenDelay = immediate ? 0 : openDelay\n\n setIsGroupActive?.(open, groupedOpenDelay)\n setOpenTooltipId?.(tooltipId, groupedOpenDelay)\n } else {\n const minimumGroupDeactivateDelay = 200 // We should provide some delay to allow the user to reach the next tooltip.\n const groupDeactivateDelay =\n closeDelay > minimumGroupDeactivateDelay ? closeDelay : minimumGroupDeactivateDelay\n\n setIsGroupActive?.(open, groupDeactivateDelay)\n setOpenTooltipId?.(null, immediate ? 0 : closeDelay)\n }\n } else {\n const standaloneDelay = immediate ? 0 : open ? openDelay : closeDelay\n\n // When it's not inside a group, the open or close status will be handled by the tooltip itself.\n setIsOpen(open, standaloneDelay)\n }\n },\n [\n isInsideGroup,\n openDelay,\n setIsGroupActive,\n setOpenTooltipId,\n tooltipId,\n closeDelay,\n setIsOpen,\n ],\n )\n\n const handleBlur = useCallback(\n (e: FocusEvent) => {\n handleIsOpenChange(false)\n childProp?.props?.onBlur?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )\n const handleClick = useCallback(\n (e: MouseEvent) => {\n handleIsOpenChange(false, true)\n childProp?.props.onClick?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )\n const handleContextMenu = useCallback(\n (e: MouseEvent) => {\n handleIsOpenChange(false, true)\n childProp?.props.onContextMenu?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )\n const handleFocus = useCallback(\n (e: FocusEvent) => {\n handleIsOpenChange(true)\n childProp?.props?.onFocus?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )\n const handleMouseEnter = useCallback(\n (e: MouseEvent) => {\n handleIsOpenChange(true)\n childProp?.props?.onMouseEnter?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )\n const handleMouseLeave = useCallback(\n (e: MouseEvent) => {\n handleIsOpenChange(false)\n childProp?.props?.onMouseLeave?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )\n\n // Handle closing the tooltip when the mouse leaves the referenceElement\n useCloseOnMouseLeave({handleIsOpenChange, referenceElement, showTooltip, isInsideGroup})\n\n // Close when `disabled` changes to `true`\n useEffect(() => {\n if (disabled && showTooltip) handleIsOpenChange(false)\n }, [disabled, handleIsOpenChange, showTooltip])\n\n // Close when `content` changes to falsy\n useEffect(() => {\n if (!content && showTooltip) handleIsOpenChange(false)\n }, [content, handleIsOpenChange, showTooltip])\n\n useEffect(() => {\n // If the user clicks on escape key, close the tooltip.\n if (!showTooltip) return\n\n function handleWindowKeyDown(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n handleIsOpenChange(false, true)\n }\n }\n\n window.addEventListener('keydown', handleWindowKeyDown)\n\n // oxlint-disable-next-line consistent-return\n return () => {\n window.removeEventListener('keydown', handleWindowKeyDown)\n }\n }, [handleIsOpenChange, showTooltip])\n\n // // Set the max width of the tooltip based on boundaries and portals\n useLayoutEffect(() => {\n // Get the maximum tooltip width (sans tooltip padding)\n // Tooltip width should never exceed the width of either any supplied boundary or portal element.\n // If both portal and boundary elements are provided, use the smaller width of the two.\n const availableWidths = [\n ...(boundaryElement ? [boundaryElement.offsetWidth] : []),\n portalElement?.offsetWidth || document.body.offsetWidth,\n ]\n\n // oxlint-disable-next-line react/set-state-in-effect\n setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2)\n }, [boundaryElement, portalElement])\n\n const setArrow = useCallback(\n (arrowEl: HTMLDivElement | null) => {\n arrowRef.current = arrowEl\n update()\n },\n [update],\n )\n\n const setFloating = useCallback(\n (node: HTMLDivElement | null) => {\n ref.current = node\n refs.setFloating(node)\n },\n [refs],\n )\n\n const child = useMemo(() => {\n if (!childProp) return null\n\n return cloneElement(childProp, {\n onBlur: handleBlur,\n onFocus: handleFocus,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n onClick: handleClick,\n onContextMenu: handleContextMenu,\n ref: setReferenceElement,\n })\n }, [\n childProp,\n handleBlur,\n handleClick,\n handleContextMenu,\n handleFocus,\n handleMouseEnter,\n handleMouseLeave,\n ])\n\n // If there's a child then we need to set the reference element to the cloned child ref\n // and if child changes we make sure to update or remove the reference element.\n useImperativeHandle(childProp ? getElementRef(childProp) : null, () => referenceElement, [\n referenceElement,\n ])\n\n if (!child) return <></>\n\n if (disabled) return child\n\n const tooltip = (\n <Layer\n data-ui=\"Tooltip\"\n {...restProps}\n className={clsx(tooltipLayer, restProps.className)}\n ref={setFloating}\n style={{\n ...floatingStyles,\n maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : undefined,\n }}\n zOffset={zOffset}\n >\n <TooltipCard\n {...restProps}\n animate={animate}\n arrow={arrowProp}\n arrowRef={setArrow}\n arrowX={arrowX}\n arrowY={arrowY}\n originX={originX}\n originY={originY}\n padding={padding}\n placement={placement}\n radius={radius}\n ref={setFloating}\n scheme={scheme}\n shadow={shadow}\n >\n {content}\n </TooltipCard>\n </Layer>\n )\n\n const tooltipNode = portalProp ? (\n <Portal __unstable_name={typeof portalProp === 'string' ? portalProp : undefined}>\n {tooltip}\n </Portal>\n ) : (\n tooltip\n )\n\n return (\n <>\n {/* the tooltip */}\n {animate ? (\n <AnimateActivity layoutMode=\"default\" mode={showTooltip ? 'visible' : 'hidden'}>\n {tooltipNode}\n </AnimateActivity>\n ) : (\n <Activity mode={showTooltip ? 'visible' : 'hidden'}>{tooltipNode}</Activity>\n )}\n\n {/* the referred element */}\n {child}\n </>\n )\n}\n\nfunction useMiddleware({\n animate,\n arrowProp,\n arrowRef,\n boundaryElement,\n fallbackPlacements,\n rootBoundary,\n}: {\n animate: boolean\n arrowProp: boolean\n arrowRef: React.RefObject<HTMLDivElement | null>\n boundaryElement: HTMLElement | null\n fallbackPlacements: Placement[]\n rootBoundary: RootBoundary\n}) {\n return useMemo(() => {\n const ret: Middleware[] = []\n\n // Flip the floating element when leaving the boundary box\n ret.push(\n flip({\n boundary: boundaryElement || undefined,\n fallbackPlacements,\n padding: DEFAULT_TOOLTIP_PADDING,\n rootBoundary,\n }),\n )\n\n // Define distance between reference and floating element\n ret.push(offset({mainAxis: DEFAULT_TOOLTIP_DISTANCE}))\n\n // Shift the tooltip so its sits with the boundary element\n ret.push(\n shift({\n boundary: boundaryElement || undefined,\n rootBoundary,\n padding: DEFAULT_TOOLTIP_PADDING,\n }),\n )\n\n // Place arrow\n if (arrowProp) {\n ret.push(arrow({element: arrowRef, padding: DEFAULT_TOOLTIP_PADDING}))\n }\n\n // Determine the origin to scale from.\n // Must be placed after `@sanity/ui/size` and `shift` middleware.\n if (animate) {\n ret.push(origin)\n }\n\n return ret\n }, [animate, arrowProp, arrowRef, boundaryElement, fallbackPlacements, rootBoundary])\n}\n\n/**\n * As `useEffectEvent` should never be passed to other components or hooks, this custom hook groups together the `useEffectEvent` and the `useEffect` hook using it.\n * @see https://19.react.dev/learn/separating-events-from-effects#reading-latest-props-and-state-with-effect-events:~:text=Never%20pass%20them%20to%20other%20components%20or%20Hooks\n */\nfunction useCloseOnMouseLeave({\n handleIsOpenChange,\n referenceElement,\n showTooltip,\n isInsideGroup,\n}: {\n handleIsOpenChange: (open: boolean, immediate?: boolean) => void\n referenceElement: HTMLElement | null\n showTooltip: boolean\n isInsideGroup: boolean\n}) {\n // Since we don't want the `mouseevent` events to be attached and removed if the `referenceElement` is changed\n // we use a \"effect event\" (https://19.react.dev/learn/separating-events-from-effects#reading-latest-props-and-state-with-effect-events)\n // in order to always see the latest `referenceElement` value inside the event handler itself.\n const onMouseMove = useEffectEvent((target: EventTarget | null, teardown: () => void) => {\n if (!referenceElement) return\n\n const isHoveringReference =\n referenceElement === target || (target instanceof Node && referenceElement.contains(target))\n\n if (!isHoveringReference) {\n handleIsOpenChange(false)\n // Allow removing the event listener eagerly, to avoid race conditions\n teardown()\n }\n })\n\n // Detect whether the mouse is moving outside of the reference element. This is sometimes\n // necessary, because the tooltip might not always close as it should (e.g. when clicking\n // the reference element triggers a CPU-heavy operation.)\n useEffect(() => {\n if (!showTooltip || isInsideGroup) return\n\n const handleMouseMove = (event: MouseEvent) => {\n onMouseMove(event.target, () => window.removeEventListener('mousemove', handleMouseMove))\n }\n\n window.addEventListener('mousemove', handleMouseMove)\n\n // oxlint-disable-next-line consistent-return\n return () => window.removeEventListener('mousemove', handleMouseMove)\n // oxlint-disable-next-line react/exhaustive-effect-dependencies\n }, [isInsideGroup, showTooltip])\n}\n","import {useMemo} from 'react'\n\nimport {useDelayedState} from '../../../hooks/useDelayedState'\nimport {Delay} from '../../types'\nimport {TooltipDelayGroupContext} from './tooltipDelayGroupContext'\nimport {TooltipDelayGroupContextValue} from './types'\n\n/**\n * @public\n * */\nexport interface TooltipDelayGroupProviderProps {\n children?: React.ReactNode\n /**\n * Handles the delays to open or close a tooltip inside a group\n *\n * If only a `number` is passed, it will be used for both opening and closing.\n *\n * If an object `{open: number; close:number}` is passed, it can be used to set different delays for each action.\n *\n * @public\n */\n delay: Delay\n}\n\n/**\n * @public\n * Provides context for a group of tooltip elements that should share a delay\n * which temporarily becomes 1 ms after the first floating element of the group opens.\n */\nexport function TooltipDelayGroupProvider(\n props: TooltipDelayGroupProviderProps,\n): React.JSX.Element {\n const {children, delay} = props\n const [isGroupActive, setIsGroupActive] = useDelayedState(false)\n const [openTooltipId, setOpenTooltipId] = useDelayedState<string | null>(null)\n\n const openDelay = typeof delay === 'number' ? delay : delay?.open || 0\n const closeDelay = typeof delay === 'number' ? delay : delay?.close || 0\n\n const value: TooltipDelayGroupContextValue = useMemo(\n () => ({\n setIsGroupActive: setIsGroupActive,\n openTooltipId: openTooltipId,\n setOpenTooltipId: setOpenTooltipId,\n // When the group is active, we want the next tooltip to open immediately.\n openDelay: isGroupActive ? 1 : openDelay,\n closeDelay: closeDelay,\n }),\n [closeDelay, isGroupActive, openDelay, openTooltipId, setIsGroupActive, setOpenTooltipId],\n )\n\n return (\n <TooltipDelayGroupContext.Provider value={value}>{children}</TooltipDelayGroupContext.Provider>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAKA,SAAgB,gBACd,cAC6D;eACvD,CAAC,OAAO,YAAY,SAAS,YAAY,GACzC,gBAAgB,OAAmC,KAAA,CAAS,GAEhCA;qDAAC,MAAA,WAA8B,UAAmB;EAClF,IAAM,eAAe;GACnB,SAAS,SAAS;EACpB;EAQA,IALA,AAEE,cAAc,aADd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e,WAAW,GAA1B,EAAA,KAAA,eAAe,EAAA,KAAA,qCAZnB,UAAUD,IAYPC,EAA4B;AACjC;;;;;;AC9dA,SAAgB,0BACd,OACmB;eACb,EAAC,UAAU,UAAS,OACpB,CAAC,eAAe,oBAAoB,gBAAgB,EAAK,GACzD,CAAC,eAAe,oBAAoB,gBAA+B,IAAI,GAEvE,YAAY,OAAO,SAAU,WAAW,QAAQ,OAAO,QAAQ,GAC/D,aAAa,OAAO,SAAU,WAAW,QAAQ,OAAO,SAAS,GAQxD,KAAA,gBAAgB,IAAI,WAL1BC;CAMO,AAAA,EAAA,OAAA,cAAA,EAAA,OAJG,iBAAA,EAAA,OADG,oBAAA,EAAA,OAEA,oBAAA,EAAA,OAEPC,MALN,KAAA;EACa;EACH;EACG;EAElB,WAAWA;EACC;CACd,GADc,EAAA,KAAA,YAJG,EAAA,KAAA,eADG,EAAA,KAAA,kBAEA,EAAA,KAAA,kBAEPA,EAAAA,KAAAA;CANf,IAAM,QAAuCC,IAa3CC;CADF,OACoD,EAAA,OAAA,YAAA,EAAA,OAAR,SAA1C,KAAA,oBAACC,yBAAAA,UAAD;EAA0C;EAAQ;CAA4C,CAAA,GAA5C,EAAA,KAAA,UAAR,EAAA,KAAA,+BAA1CD;AAEJ"}
|
|
1
|
+
{"version":3,"file":"tooltip.js","names":["(nextState: SetStateAction<S>, delay?: number) => {\n const action = () => {\n setState(nextState)\n }\n\n // A new state change has been initiated, cancel the previous one.\n if (delayedAction.current) {\n clearTimeout(delayedAction.current)\n delayedAction.current = undefined\n }\n\n if (!delay) return action()\n delayedAction.current = setTimeout(action, delay)\n }","useCallback((nextState: SetStateAction<S>, delay?: number) => {\n const action = () => {\n setState(nextState)\n }\n\n // A new state change has been initiated, cancel the previous one.\n if (delayedAction.current) {\n clearTimeout(delayedAction.current)\n delayedAction.current = undefined\n }\n\n if (!delay) return action()\n delayedAction.current = setTimeout(action, delay)\n }, [])","() => {\n return () => {\n if (delayedAction.current) {\n clearTimeout(delayedAction.current)\n }\n }\n }","[]","[state, onStateChange]","getTransformOrigin(originX, originY)","{\n transformOrigin: getTransformOrigin(originX, originY),\n willChange: animate ? 'transform' : undefined,\n ...style,\n }","animate ? 'transform' : undefined","useMemo(\n () => ({\n transformOrigin: getTransformOrigin(originX, originY),\n willChange: animate ? 'transform' : undefined,\n ...style,\n }),\n [animate, originX, originY, style],\n )","{\n left: arrowX !== null ? arrowX : undefined,\n top: arrowY !== null ? arrowY : undefined,\n right: undefined,\n bottom: undefined,\n }","arrowX !== null ? arrowX : undefined","arrowY !== null ? arrowY : undefined","useMemo(\n () => ({\n left: arrowX !== null ? arrowX : undefined,\n top: arrowY !== null ? arrowY : undefined,\n right: undefined,\n bottom: undefined,\n }),\n [arrowX, arrowY],\n )","clsx(tooltipCard, className)","arrow && (\n <Arrow\n ref={arrowRef}\n style={arrowStyle}\n width={DEFAULT_TOOLTIP_ARROW_WIDTH}\n height={DEFAULT_TOOLTIP_ARROW_HEIGHT}\n radius={DEFAULT_TOOLTIP_ARROW_RADIUS}\n />\n )","<MotionCard\n className={clsx(tooltipCard, className)}\n data-ui=\"Tooltip__card\"\n {...restProps}\n data-placement={placement}\n padding={padding}\n radius={radius}\n ref={ref}\n scheme={scheme}\n shadow={shadow}\n style={rootStyle}\n {...(animate ? POPOVER_MOTION_PROPS : undefined)}\n >\n {children}\n\n {arrow && (\n <Arrow\n ref={arrowRef}\n style={arrowStyle}\n width={DEFAULT_TOOLTIP_ARROW_WIDTH}\n height={DEFAULT_TOOLTIP_ARROW_HEIGHT}\n radius={DEFAULT_TOOLTIP_ARROW_RADIUS}\n />\n )}\n </MotionCard>","animate ? POPOVER_MOTION_PROPS : undefined","_animate = false","arrowProp = false","placementProp = 'bottom'","padding = 2","radius = 2","shadow = 2","_getArrayProp(fallbackPlacementsProp)","() => ref.current","{\n animate,\n arrowProp,\n arrowRef,\n boundaryElement,\n fallbackPlacements,\n rootBoundary,\n }","{reference: referenceElement}","{\n middleware,\n placement: placementProp,\n whileElementsMounted: autoUpdate,\n elements: {reference: referenceElement},\n }","delayGroupContext || {}","(open: boolean, immediate?: boolean) => {\n if (isInsideGroup) {\n // When it's inside a group, the open or close status will be handled by the group.\n if (open) {\n const groupedOpenDelay = immediate ? 0 : openDelay\n\n setIsGroupActive?.(open, groupedOpenDelay)\n setOpenTooltipId?.(tooltipId, groupedOpenDelay)\n } else {\n const minimumGroupDeactivateDelay = 200 // We should provide some delay to allow the user to reach the next tooltip.\n const groupDeactivateDelay =\n closeDelay > minimumGroupDeactivateDelay ? closeDelay : minimumGroupDeactivateDelay\n\n setIsGroupActive?.(open, groupDeactivateDelay)\n setOpenTooltipId?.(null, immediate ? 0 : closeDelay)\n }\n } else {\n const standaloneDelay = immediate ? 0 : open ? openDelay : closeDelay\n\n // When it's not inside a group, the open or close status will be handled by the tooltip itself.\n setIsOpen(open, standaloneDelay)\n }\n }","useCallback(\n (open: boolean, immediate?: boolean) => {\n if (isInsideGroup) {\n // When it's inside a group, the open or close status will be handled by the group.\n if (open) {\n const groupedOpenDelay = immediate ? 0 : openDelay\n\n setIsGroupActive?.(open, groupedOpenDelay)\n setOpenTooltipId?.(tooltipId, groupedOpenDelay)\n } else {\n const minimumGroupDeactivateDelay = 200 // We should provide some delay to allow the user to reach the next tooltip.\n const groupDeactivateDelay =\n closeDelay > minimumGroupDeactivateDelay ? closeDelay : minimumGroupDeactivateDelay\n\n setIsGroupActive?.(open, groupDeactivateDelay)\n setOpenTooltipId?.(null, immediate ? 0 : closeDelay)\n }\n } else {\n const standaloneDelay = immediate ? 0 : open ? openDelay : closeDelay\n\n // When it's not inside a group, the open or close status will be handled by the tooltip itself.\n setIsOpen(open, standaloneDelay)\n }\n },\n [\n isInsideGroup,\n openDelay,\n setIsGroupActive,\n setOpenTooltipId,\n tooltipId,\n closeDelay,\n setIsOpen,\n ],\n )","(e: FocusEvent) => {\n handleIsOpenChange(false)\n childProp?.props?.onBlur?.(e)\n }","props","useCallback(\n (e: FocusEvent) => {\n handleIsOpenChange(false)\n childProp?.props?.onBlur?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )","(e: MouseEvent) => {\n handleIsOpenChange(false, true)\n childProp?.props.onClick?.(e)\n }","e","useCallback(\n (e: MouseEvent) => {\n handleIsOpenChange(false, true)\n childProp?.props.onClick?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )","(e: MouseEvent) => {\n handleIsOpenChange(false, true)\n childProp?.props.onContextMenu?.(e)\n }","useCallback(\n (e: MouseEvent) => {\n handleIsOpenChange(false, true)\n childProp?.props.onContextMenu?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )","(e: FocusEvent) => {\n handleIsOpenChange(true)\n childProp?.props?.onFocus?.(e)\n }","useCallback(\n (e: FocusEvent) => {\n handleIsOpenChange(true)\n childProp?.props?.onFocus?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )","(e: MouseEvent) => {\n handleIsOpenChange(true)\n childProp?.props?.onMouseEnter?.(e)\n }","useCallback(\n (e: MouseEvent) => {\n handleIsOpenChange(true)\n childProp?.props?.onMouseEnter?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )","(e: MouseEvent) => {\n handleIsOpenChange(false)\n childProp?.props?.onMouseLeave?.(e)\n }","useCallback(\n (e: MouseEvent) => {\n handleIsOpenChange(false)\n childProp?.props?.onMouseLeave?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )","{handleIsOpenChange, referenceElement, showTooltip, isInsideGroup}","() => {\n if (disabled && showTooltip) handleIsOpenChange(false)\n }","[disabled, handleIsOpenChange, showTooltip]","() => {\n if (!content && showTooltip) handleIsOpenChange(false)\n }","[content, handleIsOpenChange, showTooltip]","() => {\n // If the user clicks on escape key, close the tooltip.\n if (!showTooltip) return\n\n function handleWindowKeyDown(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n handleIsOpenChange(false, true)\n }\n }\n\n window.addEventListener('keydown', handleWindowKeyDown)\n\n // oxlint-disable-next-line consistent-return\n return () => {\n window.removeEventListener('keydown', handleWindowKeyDown)\n }\n }","[handleIsOpenChange, showTooltip]","() => {\n // Get the maximum tooltip width (sans tooltip padding)\n // Tooltip width should never exceed the width of either any supplied boundary or portal element.\n // If both portal and boundary elements are provided, use the smaller width of the two.\n const availableWidths = [\n ...(boundaryElement ? [boundaryElement.offsetWidth] : []),\n portalElement?.offsetWidth || document.body.offsetWidth,\n ]\n\n // oxlint-disable-next-line react/set-state-in-effect\n setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2)\n }","offsetWidth","[boundaryElement, portalElement]","(arrowEl: HTMLDivElement | null) => {\n arrowRef.current = arrowEl\n update()\n }","useCallback(\n (arrowEl: HTMLDivElement | null) => {\n arrowRef.current = arrowEl\n update()\n },\n [update],\n )","(node: HTMLDivElement | null) => {\n ref.current = node\n refs.setFloating(node)\n }","useCallback(\n (node: HTMLDivElement | null) => {\n ref.current = node\n refs.setFloating(node)\n },\n [refs],\n )","useMemo(() => {\n if (!childProp) return null\n\n return cloneElement(childProp, {\n onBlur: handleBlur,\n onFocus: handleFocus,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n onClick: handleClick,\n onContextMenu: handleContextMenu,\n ref: setReferenceElement,\n })\n }, [\n childProp,\n handleBlur,\n handleClick,\n handleContextMenu,\n handleFocus,\n handleMouseEnter,\n handleMouseLeave,\n ])","cloneElement(childProp, {\n onBlur: handleBlur,\n onFocus: handleFocus,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n onClick: handleClick,\n onContextMenu: handleContextMenu,\n ref: setReferenceElement,\n })","childProp ? getElementRef(childProp) : null","() => referenceElement","[\n referenceElement,\n ]","<></>","{\n ...floatingStyles,\n maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : undefined,\n }","tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : undefined","<TooltipCard\n {...restProps}\n animate={animate}\n arrow={arrowProp}\n arrowRef={setArrow}\n arrowX={arrowX}\n arrowY={arrowY}\n originX={originX}\n originY={originY}\n padding={padding}\n placement={placement}\n radius={radius}\n ref={setFloating}\n scheme={scheme}\n shadow={shadow}\n >\n {content}\n </TooltipCard>","<Layer\n data-ui=\"Tooltip\"\n {...restProps}\n className={clsx(tooltipLayer, restProps.className)}\n ref={setFloating}\n style={{\n ...floatingStyles,\n maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : undefined,\n }}\n zOffset={zOffset}\n >\n <TooltipCard\n {...restProps}\n animate={animate}\n arrow={arrowProp}\n arrowRef={setArrow}\n arrowX={arrowX}\n arrowY={arrowY}\n originX={originX}\n originY={originY}\n padding={padding}\n placement={placement}\n radius={radius}\n ref={setFloating}\n scheme={scheme}\n shadow={shadow}\n >\n {content}\n </TooltipCard>\n </Layer>","Layer","clsx(tooltipLayer, restProps.className)","\"Tooltip\"","portalProp ? (\n <Portal __unstable_name={typeof portalProp === 'string' ? portalProp : undefined}>\n {tooltip}\n </Portal>\n ) : (\n tooltip\n )","animate ? (\n <AnimateActivity layoutMode=\"default\" mode={showTooltip ? 'visible' : 'hidden'}>\n {tooltipNode}\n </AnimateActivity>\n ) : (\n <Activity mode={showTooltip ? 'visible' : 'hidden'}>{tooltipNode}</Activity>\n )","<>\n {/* the tooltip */}\n {animate ? (\n <AnimateActivity layoutMode=\"default\" mode={showTooltip ? 'visible' : 'hidden'}>\n {tooltipNode}\n </AnimateActivity>\n ) : (\n <Activity mode={showTooltip ? 'visible' : 'hidden'}>{tooltipNode}</Activity>\n )}\n\n {/* the referred element */}\n {child}\n </>","{\n animate,\n arrowProp,\n arrowRef,\n boundaryElement,\n fallbackPlacements,\n rootBoundary,\n}: {\n animate: boolean\n arrowProp: boolean\n arrowRef: React.RefObject<HTMLDivElement | null>\n boundaryElement: HTMLElement | null\n fallbackPlacements: Placement[]\n rootBoundary: RootBoundary\n}","flip({\n boundary: boundaryElement || undefined,\n fallbackPlacements,\n padding: DEFAULT_TOOLTIP_PADDING,\n rootBoundary,\n })","boundaryElement || undefined","offset({mainAxis: DEFAULT_TOOLTIP_DISTANCE})","shift({\n boundary: boundaryElement || undefined,\n rootBoundary,\n padding: DEFAULT_TOOLTIP_PADDING,\n })","arrow({element: arrowRef, padding: DEFAULT_TOOLTIP_PADDING})","useMemo(() => {\n const ret: Middleware[] = []\n\n // Flip the floating element when leaving the boundary box\n ret.push(\n flip({\n boundary: boundaryElement || undefined,\n fallbackPlacements,\n padding: DEFAULT_TOOLTIP_PADDING,\n rootBoundary,\n }),\n )\n\n // Define distance between reference and floating element\n ret.push(offset({mainAxis: DEFAULT_TOOLTIP_DISTANCE}))\n\n // Shift the tooltip so its sits with the boundary element\n ret.push(\n shift({\n boundary: boundaryElement || undefined,\n rootBoundary,\n padding: DEFAULT_TOOLTIP_PADDING,\n }),\n )\n\n // Place arrow\n if (arrowProp) {\n ret.push(arrow({element: arrowRef, padding: DEFAULT_TOOLTIP_PADDING}))\n }\n\n // Determine the origin to scale from.\n // Must be placed after `@sanity/ui/size` and `shift` middleware.\n if (animate) {\n ret.push(origin)\n }\n\n return ret\n }, [animate, arrowProp, arrowRef, boundaryElement, fallbackPlacements, rootBoundary])","{\n handleIsOpenChange,\n referenceElement,\n showTooltip,\n isInsideGroup,\n}: {\n handleIsOpenChange: (open: boolean, immediate?: boolean) => void\n referenceElement: HTMLElement | null\n showTooltip: boolean\n isInsideGroup: boolean\n}","(target: EventTarget | null, teardown: () => void) => {\n if (!referenceElement) return\n\n const isHoveringReference =\n referenceElement === target || (target instanceof Node && referenceElement.contains(target))\n\n if (!isHoveringReference) {\n handleIsOpenChange(false)\n // Allow removing the event listener eagerly, to avoid race conditions\n teardown()\n }\n }","() => {\n if (!showTooltip || isInsideGroup) return\n\n const handleMouseMove = (event: MouseEvent) => {\n onMouseMove(event.target, () => window.removeEventListener('mousemove', handleMouseMove))\n }\n\n window.addEventListener('mousemove', handleMouseMove)\n\n // oxlint-disable-next-line consistent-return\n return () => window.removeEventListener('mousemove', handleMouseMove)\n // oxlint-disable-next-line react/exhaustive-effect-dependencies\n }","[isInsideGroup, showTooltip]","{\n setIsGroupActive: setIsGroupActive,\n openTooltipId: openTooltipId,\n setOpenTooltipId: setOpenTooltipId,\n // When the group is active, we want the next tooltip to open immediately.\n openDelay: isGroupActive ? 1 : openDelay,\n closeDelay: closeDelay,\n }","isGroupActive ? 1 : openDelay","useMemo(\n () => ({\n setIsGroupActive: setIsGroupActive,\n openTooltipId: openTooltipId,\n setOpenTooltipId: setOpenTooltipId,\n // When the group is active, we want the next tooltip to open immediately.\n openDelay: isGroupActive ? 1 : openDelay,\n closeDelay: closeDelay,\n }),\n [closeDelay, isGroupActive, openDelay, openTooltipId, setIsGroupActive, setOpenTooltipId],\n )","<TooltipDelayGroupContext.Provider value={value}>{children}</TooltipDelayGroupContext.Provider>","TooltipDelayGroupContext.Provider"],"sources":["../src/core/hooks/useDelayedState.ts","../src/core/primitives/tooltip/constants.ts","../src/core/primitives/tooltip/tooltip.css.ts","../src/core/primitives/tooltip/tooltipCard.tsx","../src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupContext.tsx","../src/core/primitives/tooltip/tooltipDelayGroup/useTooltipDelayGroup.ts","../src/core/primitives/tooltip/tooltip.tsx","../src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx"],"sourcesContent":["import {SetStateAction, useCallback, useEffect, useRef, useState} from 'react'\n\n/**\n * @beta\n */\nexport function useDelayedState<S>(\n initialState: S | (() => S),\n): [S, (nextState: SetStateAction<S>, delay?: number) => void] {\n const [state, setState] = useState(initialState)\n const delayedAction = useRef<NodeJS.Timeout | undefined>(undefined)\n\n const onStateChange = useCallback((nextState: SetStateAction<S>, delay?: number) => {\n const action = () => {\n setState(nextState)\n }\n\n // A new state change has been initiated, cancel the previous one.\n if (delayedAction.current) {\n clearTimeout(delayedAction.current)\n delayedAction.current = undefined\n }\n\n if (!delay) return action()\n delayedAction.current = setTimeout(action, delay)\n }, [])\n\n useEffect(() => {\n return () => {\n if (delayedAction.current) {\n clearTimeout(delayedAction.current)\n }\n }\n }, [])\n\n return [state, onStateChange]\n}\n","import {Placement} from '@floating-ui/react-dom'\n\nexport const DEFAULT_TOOLTIP_ARROW_WIDTH = 15\nexport const DEFAULT_TOOLTIP_ARROW_HEIGHT = 6\nexport const DEFAULT_TOOLTIP_ARROW_RADIUS = 2\n\nexport const DEFAULT_TOOLTIP_DISTANCE = 4\nexport const DEFAULT_TOOLTIP_PADDING = 4\n\nexport const DEFAULT_FALLBACK_PLACEMENTS: Record<Placement, Placement[]> = {\n 'top': ['top-end', 'top-start', 'bottom', 'left', 'right'],\n 'top-start': ['top', 'top-end', 'bottom-start', 'left-start', 'right-start'],\n 'top-end': ['top', 'top-start', 'bottom-end', 'left-end', 'right-end'],\n 'bottom': ['bottom-end', 'bottom-start', 'top', 'left', 'right'],\n 'bottom-start': ['bottom', 'bottom-end', 'top-start', 'left-start', 'right-start'],\n 'bottom-end': ['bottom', 'bottom-start', 'top-end', 'left-end', 'right-end'],\n 'left': ['left-end', 'left-start', 'right', 'top', 'bottom'],\n 'left-start': ['left', 'left-end', 'right-start', 'top-start', 'bottom-start'],\n 'left-end': ['left', 'left-start', 'right-end', 'top-end', 'bottom-end'],\n 'right': ['right-end', 'right-start', 'left', 'top', 'bottom'],\n 'right-start': ['right', 'right-end', 'left-start', 'top-start', 'bottom-start'],\n 'right-end': ['right', 'right-start', 'left-end', 'top-end', 'bottom-end'],\n}\n","import {style} from '@vanilla-extract/css'\n\nexport const tooltipLayer = style({\n pointerEvents: 'none',\n})\n\nexport const tooltipCard = style({\n willChange: 'transform',\n})\n","import {clsx} from 'clsx/lite'\nimport {motion} from 'motion/react'\nimport React, {CSSProperties, useMemo} from 'react'\n\nimport {ThemeColorSchemeKey} from '../../../theme/system/color/_system'\nimport {POPOVER_MOTION_PROPS} from '../../constants'\nimport {getTransformOrigin} from '../../middleware/origin'\nimport {Placement} from '../../types/placement'\nimport {Radius} from '../../types/radius'\nimport {Arrow} from '../../utils/arrow/arrow'\nimport {Card} from '../card/card'\nimport {\n DEFAULT_TOOLTIP_ARROW_HEIGHT,\n DEFAULT_TOOLTIP_ARROW_RADIUS,\n DEFAULT_TOOLTIP_ARROW_WIDTH,\n} from './constants'\n\nimport {tooltipCard} from './tooltip.css'\n\nconst MotionCard = motion.create(Card)\n\n/**\n * @internal\n */\nexport function TooltipCard(\n props: {\n animate?: boolean\n arrow: boolean\n arrowRef: React.Ref<HTMLDivElement>\n arrowX?: number\n arrowY?: number\n originX?: number\n originY?: number\n padding?: number | number[]\n placement?: Placement\n radius?: Radius | Radius[]\n scheme?: ThemeColorSchemeKey\n shadow?: number | number[]\n } & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'width'>,\n) {\n const {\n animate,\n arrow,\n arrowRef,\n arrowX,\n arrowY,\n children,\n className,\n originX,\n originY,\n padding,\n placement,\n radius,\n ref,\n scheme,\n shadow,\n style,\n ...restProps\n } = props\n\n const rootStyle: CSSProperties = useMemo(\n () => ({\n transformOrigin: getTransformOrigin(originX, originY),\n willChange: animate ? 'transform' : undefined,\n ...style,\n }),\n [animate, originX, originY, style],\n )\n\n const arrowStyle: CSSProperties = useMemo(\n () => ({\n left: arrowX !== null ? arrowX : undefined,\n top: arrowY !== null ? arrowY : undefined,\n right: undefined,\n bottom: undefined,\n }),\n [arrowX, arrowY],\n )\n\n return (\n <MotionCard\n className={clsx(tooltipCard, className)}\n data-ui=\"Tooltip__card\"\n {...restProps}\n data-placement={placement}\n padding={padding}\n radius={radius}\n ref={ref}\n scheme={scheme}\n shadow={shadow}\n style={rootStyle}\n {...(animate ? POPOVER_MOTION_PROPS : undefined)}\n >\n {children}\n\n {arrow && (\n <Arrow\n ref={arrowRef}\n style={arrowStyle}\n width={DEFAULT_TOOLTIP_ARROW_WIDTH}\n height={DEFAULT_TOOLTIP_ARROW_HEIGHT}\n radius={DEFAULT_TOOLTIP_ARROW_RADIUS}\n />\n )}\n </MotionCard>\n )\n}\n","import {createGlobalScopedContext} from '../../../lib/createGlobalScopedContext'\nimport {TooltipDelayGroupContextValue} from './types'\n\n/**\n * @beta\n */\nexport const TooltipDelayGroupContext =\n createGlobalScopedContext<TooltipDelayGroupContextValue | null>(\n '@sanity/ui/context/tooltipDelayGroup',\n null,\n )\n","import {useContext} from 'react'\n\nimport {TooltipDelayGroupContext} from './tooltipDelayGroupContext'\nimport {TooltipDelayGroupContextValue} from './types'\n\n/**\n * @beta\n */\nexport function useTooltipDelayGroup(): TooltipDelayGroupContextValue | null {\n const value = useContext(TooltipDelayGroupContext)\n\n return value\n}\n","import {\n arrow,\n autoUpdate,\n flip,\n type Middleware,\n offset,\n type RootBoundary,\n shift,\n useFloating,\n} from '@floating-ui/react-dom'\nimport {clsx} from 'clsx/lite'\nimport {\n Activity,\n cloneElement,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\n// TODO: switch to `useEffectEvent` from `react` once\n// https://github.com/facebook/react/issues/34818 is fixed in the lowest React\n// version we support: on React 19.2 the native hook never sees values past\n// the first render when the calling component is wrapped in `forwardRef` or\n// `memo`, and consumers may wrap `Tooltip` in `memo`.\nimport {useEffectEvent} from 'use-effect-event'\n\nimport type {ThemeColorSchemeKey} from '../../../theme/system/color/_system'\nimport {useDelayedState} from '../../hooks/useDelayedState'\nimport {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'\nimport {origin} from '../../middleware/origin'\nimport {_getArrayProp} from '../../styles/helpers'\nimport {useTheme_v2} from '../../theme/useTheme'\nimport type {Placement} from '../../types/placement'\nimport {AnimateActivity} from '../../utils/animateActivity'\nimport {useBoundaryElement} from '../../utils/boundaryElement/useBoundaryElement'\nimport {getElementRef} from '../../utils/getElementRef'\nimport {Layer, type LayerProps} from '../../utils/layer/layer'\nimport {Portal} from '../../utils/portal/portal'\nimport {usePortal} from '../../utils/portal/usePortal'\nimport type {Delay} from '../types'\nimport {\n DEFAULT_FALLBACK_PLACEMENTS,\n DEFAULT_TOOLTIP_DISTANCE,\n DEFAULT_TOOLTIP_PADDING,\n} from './constants'\nimport {TooltipCard} from './tooltipCard'\nimport {useTooltipDelayGroup} from './tooltipDelayGroup/useTooltipDelayGroup'\n\nimport {tooltipLayer} from './tooltip.css'\n\n/**\n * @public\n */\nexport interface TooltipProps extends Omit<LayerProps, 'as'> {\n /** @deprecated Use `fallbackPlacements` instead. */\n allowedAutoPlacements?: never\n arrow?: boolean\n boundaryElement?: HTMLElement | null\n children?: React.JSX.Element\n content?: React.ReactNode\n disabled?: boolean\n fallbackPlacements?: Placement[]\n padding?: number | number[]\n placement?: Placement\n /** Whether or not to render the tooltip in a portal element. */\n portal?: boolean | string\n radius?: number | number[]\n scheme?: ThemeColorSchemeKey\n shadow?: number | number[]\n /**\n * Adds a delay to open or close the tooltip.\n *\n * If only a `number` is passed, it will be used for both opening and closing.\n *\n * If an object `{open: number; close:number}` is passed, it can be used to set different delays for each action.\n *\n * @public\n * @defaultValue 0\n */\n delay?: Delay\n /**\n * Whether the tooltip should animate in and out.\n *\n * @beta\n * @defaultValue false\n */\n animate?: boolean\n}\n\n/**\n * Tooltips display information when hovering, focusing or tapping.\n *\n * @public\n */\nexport function Tooltip(\n props: TooltipProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'children' | 'content'>,\n) {\n const boundaryElementContext = useBoundaryElement()\n const {layer} = useTheme_v2()\n const {\n animate: _animate = false,\n arrow: arrowProp = false,\n boundaryElement: _boundaryElement,\n children: childProp,\n content,\n disabled,\n fallbackPlacements: _fallbackPlacementsProp,\n padding = 2,\n placement: placementProp = 'bottom',\n portal: portalProp,\n radius = 2,\n ref: forwardedRef,\n scheme,\n shadow = 2,\n zOffset: _zOffset,\n delay,\n ...restProps\n } = props\n const boundaryElement = _boundaryElement ?? boundaryElementContext?.element\n const fallbackPlacementsProp =\n _fallbackPlacementsProp ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? 'bottom']\n const zOffset = _zOffset ?? layer.tooltip.zOffset\n const prefersReducedMotion = usePrefersReducedMotion()\n const animate = prefersReducedMotion ? false : _animate\n const fallbackPlacements = _getArrayProp(fallbackPlacementsProp)\n const ref = useRef<HTMLDivElement | null>(null)\n const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null)\n const arrowRef = useRef<HTMLDivElement | null>(null)\n const rootBoundary: RootBoundary = 'viewport'\n const [tooltipMaxWidth, setTooltipMaxWidth] = useState(0)\n\n useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(forwardedRef, () => ref.current)\n\n const portal = usePortal()\n const portalElement =\n typeof portalProp === 'string' ? portal.elements?.[portalProp] || null : portal.element\n\n const middleware = useMiddleware({\n animate,\n arrowProp,\n arrowRef,\n boundaryElement,\n fallbackPlacements,\n rootBoundary,\n })\n\n const {floatingStyles, placement, middlewareData, refs, update} = useFloating({\n middleware,\n placement: placementProp,\n whileElementsMounted: autoUpdate,\n elements: {reference: referenceElement},\n })\n\n const arrowX = middlewareData.arrow?.x\n const arrowY = middlewareData.arrow?.y\n\n const originX = middlewareData['@sanity/ui/origin']?.originX\n const originY = middlewareData['@sanity/ui/origin']?.originY\n\n const tooltipId = useId()\n const [isOpen, setIsOpen] = useDelayedState(false)\n const delayGroupContext = useTooltipDelayGroup()\n const {setIsGroupActive, setOpenTooltipId} = delayGroupContext || {}\n const showTooltip = isOpen || delayGroupContext?.openTooltipId === tooltipId\n\n const isInsideGroup = delayGroupContext !== null\n const openDelayProp = typeof delay === 'number' ? delay : delay?.open || 0\n const closeDelayProp = typeof delay === 'number' ? delay : delay?.close || 0\n\n const openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp\n const closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp\n\n const handleIsOpenChange = useCallback(\n (open: boolean, immediate?: boolean) => {\n if (isInsideGroup) {\n // When it's inside a group, the open or close status will be handled by the group.\n if (open) {\n const groupedOpenDelay = immediate ? 0 : openDelay\n\n setIsGroupActive?.(open, groupedOpenDelay)\n setOpenTooltipId?.(tooltipId, groupedOpenDelay)\n } else {\n const minimumGroupDeactivateDelay = 200 // We should provide some delay to allow the user to reach the next tooltip.\n const groupDeactivateDelay =\n closeDelay > minimumGroupDeactivateDelay ? closeDelay : minimumGroupDeactivateDelay\n\n setIsGroupActive?.(open, groupDeactivateDelay)\n setOpenTooltipId?.(null, immediate ? 0 : closeDelay)\n }\n } else {\n const standaloneDelay = immediate ? 0 : open ? openDelay : closeDelay\n\n // When it's not inside a group, the open or close status will be handled by the tooltip itself.\n setIsOpen(open, standaloneDelay)\n }\n },\n [\n isInsideGroup,\n openDelay,\n setIsGroupActive,\n setOpenTooltipId,\n tooltipId,\n closeDelay,\n setIsOpen,\n ],\n )\n\n const handleBlur = useCallback(\n (e: FocusEvent) => {\n handleIsOpenChange(false)\n childProp?.props?.onBlur?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )\n const handleClick = useCallback(\n (e: MouseEvent) => {\n handleIsOpenChange(false, true)\n childProp?.props.onClick?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )\n const handleContextMenu = useCallback(\n (e: MouseEvent) => {\n handleIsOpenChange(false, true)\n childProp?.props.onContextMenu?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )\n const handleFocus = useCallback(\n (e: FocusEvent) => {\n handleIsOpenChange(true)\n childProp?.props?.onFocus?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )\n const handleMouseEnter = useCallback(\n (e: MouseEvent) => {\n handleIsOpenChange(true)\n childProp?.props?.onMouseEnter?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )\n const handleMouseLeave = useCallback(\n (e: MouseEvent) => {\n handleIsOpenChange(false)\n childProp?.props?.onMouseLeave?.(e)\n },\n [childProp?.props, handleIsOpenChange],\n )\n\n // Handle closing the tooltip when the mouse leaves the referenceElement\n useCloseOnMouseLeave({handleIsOpenChange, referenceElement, showTooltip, isInsideGroup})\n\n // Close when `disabled` changes to `true`\n useEffect(() => {\n if (disabled && showTooltip) handleIsOpenChange(false)\n }, [disabled, handleIsOpenChange, showTooltip])\n\n // Close when `content` changes to falsy\n useEffect(() => {\n if (!content && showTooltip) handleIsOpenChange(false)\n }, [content, handleIsOpenChange, showTooltip])\n\n useEffect(() => {\n // If the user clicks on escape key, close the tooltip.\n if (!showTooltip) return\n\n function handleWindowKeyDown(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n handleIsOpenChange(false, true)\n }\n }\n\n window.addEventListener('keydown', handleWindowKeyDown)\n\n // oxlint-disable-next-line consistent-return\n return () => {\n window.removeEventListener('keydown', handleWindowKeyDown)\n }\n }, [handleIsOpenChange, showTooltip])\n\n // // Set the max width of the tooltip based on boundaries and portals\n useLayoutEffect(() => {\n // Get the maximum tooltip width (sans tooltip padding)\n // Tooltip width should never exceed the width of either any supplied boundary or portal element.\n // If both portal and boundary elements are provided, use the smaller width of the two.\n const availableWidths = [\n ...(boundaryElement ? [boundaryElement.offsetWidth] : []),\n portalElement?.offsetWidth || document.body.offsetWidth,\n ]\n\n // oxlint-disable-next-line react/set-state-in-effect\n setTooltipMaxWidth(Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2)\n }, [boundaryElement, portalElement])\n\n const setArrow = useCallback(\n (arrowEl: HTMLDivElement | null) => {\n arrowRef.current = arrowEl\n update()\n },\n [update],\n )\n\n const setFloating = useCallback(\n (node: HTMLDivElement | null) => {\n ref.current = node\n refs.setFloating(node)\n },\n [refs],\n )\n\n const child = useMemo(() => {\n if (!childProp) return null\n\n return cloneElement(childProp, {\n onBlur: handleBlur,\n onFocus: handleFocus,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n onClick: handleClick,\n onContextMenu: handleContextMenu,\n ref: setReferenceElement,\n })\n }, [\n childProp,\n handleBlur,\n handleClick,\n handleContextMenu,\n handleFocus,\n handleMouseEnter,\n handleMouseLeave,\n ])\n\n // If there's a child then we need to set the reference element to the cloned child ref\n // and if child changes we make sure to update or remove the reference element.\n useImperativeHandle(childProp ? getElementRef(childProp) : null, () => referenceElement, [\n referenceElement,\n ])\n\n if (!child) return <></>\n\n if (disabled) return child\n\n const tooltip = (\n <Layer\n data-ui=\"Tooltip\"\n {...restProps}\n className={clsx(tooltipLayer, restProps.className)}\n ref={setFloating}\n style={{\n ...floatingStyles,\n maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : undefined,\n }}\n zOffset={zOffset}\n >\n <TooltipCard\n {...restProps}\n animate={animate}\n arrow={arrowProp}\n arrowRef={setArrow}\n arrowX={arrowX}\n arrowY={arrowY}\n originX={originX}\n originY={originY}\n padding={padding}\n placement={placement}\n radius={radius}\n ref={setFloating}\n scheme={scheme}\n shadow={shadow}\n >\n {content}\n </TooltipCard>\n </Layer>\n )\n\n const tooltipNode = portalProp ? (\n <Portal __unstable_name={typeof portalProp === 'string' ? portalProp : undefined}>\n {tooltip}\n </Portal>\n ) : (\n tooltip\n )\n\n return (\n <>\n {/* the tooltip */}\n {animate ? (\n <AnimateActivity layoutMode=\"default\" mode={showTooltip ? 'visible' : 'hidden'}>\n {tooltipNode}\n </AnimateActivity>\n ) : (\n <Activity mode={showTooltip ? 'visible' : 'hidden'}>{tooltipNode}</Activity>\n )}\n\n {/* the referred element */}\n {child}\n </>\n )\n}\n\nfunction useMiddleware({\n animate,\n arrowProp,\n arrowRef,\n boundaryElement,\n fallbackPlacements,\n rootBoundary,\n}: {\n animate: boolean\n arrowProp: boolean\n arrowRef: React.RefObject<HTMLDivElement | null>\n boundaryElement: HTMLElement | null\n fallbackPlacements: Placement[]\n rootBoundary: RootBoundary\n}) {\n return useMemo(() => {\n const ret: Middleware[] = []\n\n // Flip the floating element when leaving the boundary box\n ret.push(\n flip({\n boundary: boundaryElement || undefined,\n fallbackPlacements,\n padding: DEFAULT_TOOLTIP_PADDING,\n rootBoundary,\n }),\n )\n\n // Define distance between reference and floating element\n ret.push(offset({mainAxis: DEFAULT_TOOLTIP_DISTANCE}))\n\n // Shift the tooltip so its sits with the boundary element\n ret.push(\n shift({\n boundary: boundaryElement || undefined,\n rootBoundary,\n padding: DEFAULT_TOOLTIP_PADDING,\n }),\n )\n\n // Place arrow\n if (arrowProp) {\n ret.push(arrow({element: arrowRef, padding: DEFAULT_TOOLTIP_PADDING}))\n }\n\n // Determine the origin to scale from.\n // Must be placed after `@sanity/ui/size` and `shift` middleware.\n if (animate) {\n ret.push(origin)\n }\n\n return ret\n }, [animate, arrowProp, arrowRef, boundaryElement, fallbackPlacements, rootBoundary])\n}\n\n/**\n * As `useEffectEvent` should never be passed to other components or hooks, this custom hook groups together the `useEffectEvent` and the `useEffect` hook using it.\n * @see https://19.react.dev/learn/separating-events-from-effects#reading-latest-props-and-state-with-effect-events:~:text=Never%20pass%20them%20to%20other%20components%20or%20Hooks\n */\nfunction useCloseOnMouseLeave({\n handleIsOpenChange,\n referenceElement,\n showTooltip,\n isInsideGroup,\n}: {\n handleIsOpenChange: (open: boolean, immediate?: boolean) => void\n referenceElement: HTMLElement | null\n showTooltip: boolean\n isInsideGroup: boolean\n}) {\n // Since we don't want the `mouseevent` events to be attached and removed if the `referenceElement` is changed\n // we use a \"effect event\" (https://19.react.dev/learn/separating-events-from-effects#reading-latest-props-and-state-with-effect-events)\n // in order to always see the latest `referenceElement` value inside the event handler itself.\n const onMouseMove = useEffectEvent((target: EventTarget | null, teardown: () => void) => {\n if (!referenceElement) return\n\n const isHoveringReference =\n referenceElement === target || (target instanceof Node && referenceElement.contains(target))\n\n if (!isHoveringReference) {\n handleIsOpenChange(false)\n // Allow removing the event listener eagerly, to avoid race conditions\n teardown()\n }\n })\n\n // Detect whether the mouse is moving outside of the reference element. This is sometimes\n // necessary, because the tooltip might not always close as it should (e.g. when clicking\n // the reference element triggers a CPU-heavy operation.)\n useEffect(() => {\n if (!showTooltip || isInsideGroup) return\n\n const handleMouseMove = (event: MouseEvent) => {\n onMouseMove(event.target, () => window.removeEventListener('mousemove', handleMouseMove))\n }\n\n window.addEventListener('mousemove', handleMouseMove)\n\n // oxlint-disable-next-line consistent-return\n return () => window.removeEventListener('mousemove', handleMouseMove)\n // oxlint-disable-next-line react/exhaustive-effect-dependencies\n }, [isInsideGroup, showTooltip])\n}\n","import {useMemo} from 'react'\n\nimport {useDelayedState} from '../../../hooks/useDelayedState'\nimport {Delay} from '../../types'\nimport {TooltipDelayGroupContext} from './tooltipDelayGroupContext'\nimport {TooltipDelayGroupContextValue} from './types'\n\n/**\n * @public\n * */\nexport interface TooltipDelayGroupProviderProps {\n children?: React.ReactNode\n /**\n * Handles the delays to open or close a tooltip inside a group\n *\n * If only a `number` is passed, it will be used for both opening and closing.\n *\n * If an object `{open: number; close:number}` is passed, it can be used to set different delays for each action.\n *\n * @public\n */\n delay: Delay\n}\n\n/**\n * @public\n * Provides context for a group of tooltip elements that should share a delay\n * which temporarily becomes 1 ms after the first floating element of the group opens.\n */\nexport function TooltipDelayGroupProvider(\n props: TooltipDelayGroupProviderProps,\n): React.JSX.Element {\n const {children, delay} = props\n const [isGroupActive, setIsGroupActive] = useDelayedState(false)\n const [openTooltipId, setOpenTooltipId] = useDelayedState<string | null>(null)\n\n const openDelay = typeof delay === 'number' ? delay : delay?.open || 0\n const closeDelay = typeof delay === 'number' ? delay : delay?.close || 0\n\n const value: TooltipDelayGroupContextValue = useMemo(\n () => ({\n setIsGroupActive: setIsGroupActive,\n openTooltipId: openTooltipId,\n setOpenTooltipId: setOpenTooltipId,\n // When the group is active, we want the next tooltip to open immediately.\n openDelay: isGroupActive ? 1 : openDelay,\n closeDelay: closeDelay,\n }),\n [closeDelay, isGroupActive, openDelay, openTooltipId, setIsGroupActive, setOpenTooltipId],\n )\n\n return (\n <TooltipDelayGroupContext.Provider value={value}>{children}</TooltipDelayGroupContext.Provider>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAKA,SAAgB,gBACd,cAC6D;eACvD,CAAC,OAAO,YAAY,SAAS,YAAY,GACzC,gBAAgB,OAAmC,KAAA,CAAS,GAEhCA;qDAAC,MAAA,WAA8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Aa,eAAe,SAGvC,OAAO,oBAAoB,aAAa,eAAe;CAEtE,GAXsB,EAAA,KAAA,eAGlB,EAAA,KAAA,aAHG,EAAA,KAAA;CAWJC,IAAAA;CAZH,AAYI,EAAA,OAAA,iBAAA,EAAA,OAAe,eAAhB,KAAA,CAAC,eAAe,WAAW,GAA1B,EAAA,KAAA,eAAe,EAAA,KAAA,qCAZnB,UAAUD,IAYPC,EAA4B;AACjC;;;;;;AC9dA,SAAgB,0BACd,OACmB;eACb,EAAC,UAAU,UAAS,OACpB,CAAC,eAAe,oBAAoB,gBAAgB,EAAK,GACzD,CAAC,eAAe,oBAAoB,gBAA+B,IAAI,GAEvE,YAAY,OAAO,SAAU,WAAW,QAAQ,OAAO,QAAQ,GAC/D,aAAa,OAAO,SAAU,WAAW,QAAQ,OAAO,SAAS,GAQxD,KAAA,gBAAgB,IAAI,WAL1BC;CAMO,AAAA,EAAA,OAAA,cAAA,EAAA,OAJG,iBAAA,EAAA,OADG,oBAAA,EAAA,OAEA,oBAAA,EAAA,OAEPC,MALN,KAAA;EACa;EACH;EACG;EAElB,WAAWA;EACC;CACd,GADc,EAAA,KAAA,YAJG,EAAA,KAAA,eADG,EAAA,KAAA,kBAEA,EAAA,KAAA,kBAEPA,EAAAA,KAAAA;CANf,IAAM,QAAuCC,IAa3CC;CADF,OACoD,EAAA,OAAA,YAAA,EAAA,OAAR,SAA1C,KAAA,oBAACC,yBAAAA,UAAD;EAA0C;EAAQ;CAA4C,CAAA,GAA5C,EAAA,KAAA,UAAR,EAAA,KAAA,+BAA1CD;AAEJ"}
|
|
@@ -635,7 +635,7 @@ function _temp$1() {
|
|
|
635
635
|
return !1;
|
|
636
636
|
}
|
|
637
637
|
function isRecord(value) {
|
|
638
|
-
return
|
|
638
|
+
return !(!value || typeof value != "object" || Array.isArray(value));
|
|
639
639
|
}
|
|
640
640
|
function getLayerContext(contextValue) {
|
|
641
641
|
if (!isRecord(contextValue) || contextValue.version !== 0) throw Error("the context value is not compatible");
|
|
@@ -709,4 +709,4 @@ function useLayer() {
|
|
|
709
709
|
}
|
|
710
710
|
export { useTheme_v2 as _, useMatchMedia as a, responsivePaddingStyle as b, ThemeColorProvider as c, createGlobalScopedContext as d, globalScope as f, useTheme$1 as g, _cardColorStyle as h, usePrefersReducedMotion as i, useRootTheme as l, focusRingStyle as m, LayerProvider as n, useMediaIndex as o, focusRingBorderStyle as p, isRecord as r, Card as s, useLayer as t, ThemeProvider$1 as u, responsiveRadiusStyle as v, flexItemStyle as x, Box as y };
|
|
711
711
|
|
|
712
|
-
//# sourceMappingURL=useLayer-
|
|
712
|
+
//# sourceMappingURL=useLayer-D1usxIE0.js.map
|