@sanity/ui 4.0.3 → 4.0.5
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-CHE8-_G7.js → arrow-BaqZdFUX.js} +5 -5
- package/dist/arrow-BaqZdFUX.js.map +1 -0
- package/dist/autocomplete.js +8 -8
- package/dist/autocomplete.js.map +1 -1
- package/dist/breadcrumbs.js +8 -8
- package/dist/breadcrumbs.js.map +1 -1
- package/dist/{button-D6Z-yLlP.js → button-DpAiERt1.js} +7 -7
- package/dist/button-DpAiERt1.js.map +1 -0
- package/dist/code.js +3 -3
- package/dist/code.js.map +1 -1
- package/dist/{codeFontStyle-DYUujk7K.js → codeFontStyle-aWvllgWi.js} +2 -2
- package/dist/codeFontStyle-aWvllgWi.js.map +1 -0
- package/dist/element-BYgCE_iK.js.map +1 -1
- package/dist/factory-BA3gEfyI.js.map +1 -1
- package/dist/{flex-C-5JHi1C.js → flex-C6SsHFy8.js} +4 -4
- package/dist/flex-C6SsHFy8.js.map +1 -0
- package/dist/getElementRef-5HZQ-Owu.js.map +1 -1
- package/dist/getScopedTheme-C-sZsyAz.js.map +1 -1
- package/dist/getTheme_v2-y09KqtEb.js.map +1 -1
- package/dist/{grid-BXHFJhf_.js → grid-3kBnMOwF.js} +4 -4
- package/dist/grid-3kBnMOwF.js.map +1 -0
- package/dist/{helpers-bwfx1e-Y.js → helpers-JV5y3U_M.js} +21 -7
- package/dist/helpers-JV5y3U_M.js.map +1 -0
- package/dist/{hotkeys-Bvex-n5O.js → hotkeys-BYRfM-HW.js} +11 -11
- package/dist/hotkeys-BYRfM-HW.js.map +1 -0
- package/dist/index.js +61 -61
- package/dist/index.js.map +1 -1
- package/dist/{layer-B98ynOf2.js → layer-DsScTlqC.js} +4 -4
- package/dist/layer-DsScTlqC.js.map +1 -0
- package/dist/menu.js +10 -10
- package/dist/menu.js.map +1 -1
- package/dist/{popover-PorX5Jv9.js → popover-C2DFbwZu.js} +43 -41
- package/dist/popover-C2DFbwZu.js.map +1 -0
- package/dist/popover.js +1 -1
- package/dist/refractor-CC48DwHi.js.map +1 -1
- package/dist/{responsiveFont-hN1mZFjm.js → responsiveFont-BwYElGq4.js} +2 -2
- package/dist/responsiveFont-BwYElGq4.js.map +1 -0
- package/dist/{stack-C2HKTF-l.js → stack-wyPeapSx.js} +6 -6
- package/dist/stack-wyPeapSx.js.map +1 -0
- package/dist/{textInput-VH0sQqrm.js → textInput-DW447nYT.js} +15 -15
- package/dist/textInput-DW447nYT.js.map +1 -0
- package/dist/theme.js.map +1 -1
- package/dist/toast.js +11 -11
- package/dist/toast.js.map +1 -1
- package/dist/tooltip.js +6 -6
- package/dist/tooltip.js.map +1 -1
- package/dist/{useClickOutsideEvent-lEVhDFCQ.js → useClickOutsideEvent-DbLUuPQ6.js} +2 -2
- package/dist/useClickOutsideEvent-DbLUuPQ6.js.map +1 -0
- package/dist/useElementSize-BJvbGHq8.js.map +1 -1
- package/dist/{useLayer-BAVfmbNN.js → useLayer-Dhme0dcp.js} +12 -12
- package/dist/useLayer-Dhme0dcp.js.map +1 -0
- package/package.json +6 -6
- package/dist/arrow-CHE8-_G7.js.map +0 -1
- package/dist/button-D6Z-yLlP.js.map +0 -1
- package/dist/codeFontStyle-DYUujk7K.js.map +0 -1
- package/dist/flex-C-5JHi1C.js.map +0 -1
- package/dist/grid-BXHFJhf_.js.map +0 -1
- package/dist/helpers-bwfx1e-Y.js.map +0 -1
- package/dist/hotkeys-Bvex-n5O.js.map +0 -1
- package/dist/layer-B98ynOf2.js.map +0 -1
- package/dist/popover-PorX5Jv9.js.map +0 -1
- package/dist/responsiveFont-hN1mZFjm.js.map +0 -1
- package/dist/stack-C2HKTF-l.js.map +0 -1
- package/dist/textInput-VH0sQqrm.js.map +0 -1
- package/dist/useClickOutsideEvent-lEVhDFCQ.js.map +0 -1
- package/dist/useLayer-BAVfmbNN.js.map +0 -1
package/dist/tooltip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","names":["SetStateAction","useCallback","useEffect","useRef","useState","useDelayedState","initialState","$","_c","state","setState","delayedAction","undefined","t0","Symbol","for","nextState","delay","action","current","clearTimeout","setTimeout","onStateChange","t1","t2","t3","Placement","DEFAULT_TOOLTIP_ARROW_WIDTH","DEFAULT_TOOLTIP_ARROW_HEIGHT","DEFAULT_TOOLTIP_ARROW_RADIUS","DEFAULT_TOOLTIP_DISTANCE","DEFAULT_TOOLTIP_PADDING","DEFAULT_FALLBACK_PLACEMENTS","Record","motion","React","CSSProperties","useMemo","styled","ThemeColorSchemeKey","POPOVER_MOTION_PROPS","Placement","Radius","Arrow","Card","DEFAULT_TOOLTIP_ARROW_HEIGHT","DEFAULT_TOOLTIP_ARROW_RADIUS","DEFAULT_TOOLTIP_ARROW_WIDTH","MotionCard","create","TooltipCard","props","$","_c","animate","arrow","arrowRef","arrowX","arrowY","children","originX","originY","padding","placement","radius","ref","restProps","scheme","shadow","style","t0","undefined","t1","willChange","rootStyle","t2","t3","t4","left","top","right","bottom","arrowStyle","t5","t6","t7","t8","t9","card","transition","createGlobalScopedContext","TooltipDelayGroupContextValue","TooltipDelayGroupContext","useContext","TooltipDelayGroupContext","TooltipDelayGroupContextValue","useTooltipDelayGroup","value","arrow","autoUpdate","flip","Middleware","offset","RootBoundary","shift","useFloating","Activity","cloneElement","useCallback","useEffect","useId","useImperativeHandle","useLayoutEffect","useMemo","useRef","useState","styled","useEffectEvent","ThemeColorSchemeKey","useDelayedState","usePrefersReducedMotion","origin","_getArrayProp","useTheme_v2","Placement","AnimateActivity","useBoundaryElement","getElementRef","Layer","LayerProps","Portal","usePortal","Delay","DEFAULT_FALLBACK_PLACEMENTS","DEFAULT_TOOLTIP_DISTANCE","DEFAULT_TOOLTIP_PADDING","TooltipCard","useTooltipDelayGroup","TooltipProps","Omit","allowedAutoPlacements","boundaryElement","HTMLElement","children","React","JSX","Element","content","ReactNode","disabled","fallbackPlacements","padding","placement","portal","radius","scheme","shadow","delay","animate","StyledTooltip","Tooltip","props","$","_c","boundaryElementContext","layer","_boundaryElement","_fallbackPlacementsProp","_zOffset","childProp","forwardedRef","portalProp","restProps","t0","t1","t2","t3","t4","t5","ref","zOffset","_animate","undefined","arrowProp","placementProp","element","fallbackPlacementsProp","tooltip","prefersReducedMotion","t6","referenceElement","setReferenceElement","arrowRef","tooltipMaxWidth","setTooltipMaxWidth","t7","Symbol","for","current","portalElement","elements","t8","rootBoundary","middleware","useMiddleware","t9","reference","t10","whileElementsMounted","floatingStyles","middlewareData","refs","update","arrowX","x","arrowY","y","originX","originY","tooltipId","isOpen","setIsOpen","delayGroupContext","t11","setIsGroupActive","setOpenTooltipId","showTooltip","openTooltipId","isInsideGroup","openDelayProp","open","closeDelayProp","close","openDelay","closeDelay","t12","immediate","groupedOpenDelay","groupDeactivateDelay","standaloneDelay","handleIsOpenChange","t13","e","onBlur","handleBlur","t14","e_0","onClick","handleClick","t15","e_1","onContextMenu","handleContextMenu","t16","e_2","onFocus","handleFocus","t17","e_3","onMouseEnter","handleMouseEnter","t18","e_4","onMouseLeave","handleMouseLeave","t19","useCloseOnMouseLeave","t20","t21","t22","t23","t24","t25","handleWindowKeyDown","event","key","window","addEventListener","removeEventListener","t26","offsetWidth","availableWidths","document","body","Math","min","t27","t28","arrowEl","setArrow","t29","node","setFloating","t30","bb0","t31","child","t32","t33","t34","t35","maxWidth","t36","t37","t38","tooltipNode","t39","t40","ret","boundary","push","mainAxis","target","teardown","isHoveringReference","Node","contains","onMouseMove","handleMouseMove","useMemo","useDelayedState","Delay","TooltipDelayGroupContext","TooltipDelayGroupContextValue","TooltipDelayGroupProviderProps","children","React","ReactNode","delay","TooltipDelayGroupProvider","props","$","_c","isGroupActive","setIsGroupActive","openTooltipId","setOpenTooltipId","openDelay","open","closeDelay","close","t0","t1","value","t2"],"sources":["../src/core/hooks/useDelayedState.ts","../src/core/primitives/tooltip/constants.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 {motion} from 'motion/react'\nimport React, {CSSProperties, useMemo} from 'react'\nimport {styled} from 'styled-components'\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\nconst MotionCard = styled(motion.create(Card))`\n will-change: transform;\n`\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 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 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 variants={POPOVER_MOTION_PROPS.card}\n transition={POPOVER_MOTION_PROPS.transition}\n initial={animate ? ['hidden', 'initial'] : undefined}\n animate={animate ? ['visible', 'scaleIn'] : undefined}\n exit={animate ? ['hidden', 'scaleOut'] : 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 {\n Activity,\n cloneElement,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport {styled} from 'styled-components'\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\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\nconst StyledTooltip = styled(Layer)`\n pointer-events: none;\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-compiler\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 <StyledTooltip\n data-ui=\"Tooltip\"\n {...restProps}\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 </StyledTooltip>\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 }, [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,SAAOK,gBAAAC,cAAA;CAAA,IAAAC,IAAAC,EAAA,CAAA,GAGL,CAAAC,OAAAC,YAA0BN,SAASE,YAAY,GAC/CK,gBAAsBR,OAAmCS,KAAAA,CAAS,GAACC;CAAA,AAAAN,EAAA,OAAAO,OAAAC,IAAA,2BAAA,KAEjCF,MAAAG,WAAAC,UAAA;EAChC,IAAAC,eAAe;GACbR,SAASM,SAAS;EAAC;EASrB,IALA,AAEEL,cAAaQ,aADbC,aAAaT,cAAaQ,OAAQ,GACVP,KAAAA,IAGtB,CAACK,OAAK,OAASC,OAAO;EAC1BP,cAAaQ,UAAWE,WAAWH,QAAQD,KAAK;CAA3B,GACtBV,EAAA,KAAAM,MAAAA,KAAAN,EAAA;CAbD,IAAAe,gBAAsBT,IAahBU,IAAAC;CAENtB,AAFMK,EAAA,OAAAO,OAAAC,IAAA,2BAAA,KAEIQ,iBACD;EACL,AAAIZ,cAAaQ,WACfC,aAAaT,cAAaQ,OAAQ;CACnC,GAEFK,KAAA,CAAA,GAAEjB,EAAA,KAAAgB,IAAAhB,EAAA,KAAAiB,OAAAD,KAAAhB,EAAA,IAAAiB,KAAAjB,EAAA,KANLL,UAAUqB,IAMPC,EAAE;CAAC,IAAAC;CAEuB,OAFvBlB,EAAA,OAAAE,QAEuBgB,KAAAlB,EAAA,MAAtBkB,KAAA,CAAChB,OAAOa,aAAa,GAACf,EAAA,KAAAE,O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kE,iBAAAlE,EAAA,OAAAgE,eAAElD,KAAA,CAACoD,eAAeF,WAAW,GAAChE,EAAA,KAAAkE,eAAAlE,EAAA,KAAAgE,aAAAhE,EAAA,KAAAc,MAAAA,KAAAd,EAAA,IAX/BrD,UAAUkE,IAWPC,EAA4B;AAAC;;;;;;AC7dlC,SAAOyJ,0BAAAC,OAAA;CAAA,IAAAC,IAAAC,EAAA,CAAA,GAGL,EAAAP,UAAAG,UAA0BE,OAC1B,CAAAG,eAAAC,oBAA0Cd,gBAAgB,EAAK,GAC/D,CAAAe,eAAAC,oBAA0ChB,gBAA+B,IAAI,GAE7EiB,YAAkB,OAAOT,SAAU,WAAjBA,QAAoCA,OAAKU,QAAL,GACtDC,aAAmB,OAAOX,SAAU,WAAjBA,QAAoCA,OAAKY,SAAL,GAQxCC,KAAAR,gBAAA,IAAAI,WAA6BK;CAAA,AAAAX,EAAA,OAAAQ,cAAAR,EAAA,OAAAI,iBAAAJ,EAAA,OAAAG,oBAAAH,EAAA,OAAAK,oBAAAL,EAAA,OAAAU,MALnCC,KAAA;EAAAR;EAAAC;EAAAC;EAAAC,WAKMI;EAA6BF;CAE1C,GAACR,EAAA,KAAAQ,YAAAR,EAAA,KAAAI,eAAAJ,EAAA,KAAAG,kBAAAH,EAAA,KAAAK,kBAAAL,EAAA,KAAAU,IAAAV,EAAA,KAAAW,MAAAA,KAAAX,EAAA;CARH,IAAAY,QACSD,IASRE;CAGgG,OAHhGb,EAAA,OAAAN,YAAAM,EAAA,OAAAY,SAGCC,KAAA,oBAAA,yBAAA,UAAA;EAA0CD;EAAQlB;CAAS,CAAA,GAAoCM,EAAA,KAAAN,UAAAM,EAAA,KAAAY,OAAAZ,EAAA,KAAAa,MAAAA,KAAAb,EAAA,IAA/Fa;AAA+F"}
|
|
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 )","animate ? ['hidden', 'initial'] : undefined","animate ? ['visible', 'scaleIn'] : undefined","animate ? ['hidden', 'scaleOut'] : undefined","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 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 variants={POPOVER_MOTION_PROPS.card}\n transition={POPOVER_MOTION_PROPS.transition}\n initial={animate ? ['hidden', 'initial'] : undefined}\n animate={animate ? ['visible', 'scaleIn'] : undefined}\n exit={animate ? ['hidden', 'scaleOut'] : 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 = false","arrowProp = false","padding = 2","placementProp = 'bottom'","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>","<StyledTooltip\n data-ui=\"Tooltip\"\n {...restProps}\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 </StyledTooltip>","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/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 {motion} from 'motion/react'\nimport React, {CSSProperties, useMemo} from 'react'\nimport {styled} from 'styled-components'\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\nconst MotionCard = styled(motion.create(Card))`\n will-change: transform;\n`\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 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 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 variants={POPOVER_MOTION_PROPS.card}\n transition={POPOVER_MOTION_PROPS.transition}\n initial={animate ? ['hidden', 'initial'] : undefined}\n animate={animate ? ['visible', 'scaleIn'] : undefined}\n exit={animate ? ['hidden', 'scaleOut'] : 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 {\n Activity,\n cloneElement,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport {styled} from 'styled-components'\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\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\nconst StyledTooltip = styled(Layer)`\n pointer-events: none;\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 <StyledTooltip\n data-ui=\"Tooltip\"\n {...restProps}\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 </StyledTooltip>\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,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EAAA,OAAR,SAA1C,KAAA,oBAACC,yBAAAA,UAAD;EAA0C;EAAQ;CAA4C,CAAA,GAA5C,EAAA,KAAA,UAAR,EAAA,KAAA,+BAA1CD;AAEJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as EMPTY_ARRAY } from "./helpers-
|
|
1
|
+
import { o as EMPTY_ARRAY } from "./helpers-JV5y3U_M.js";
|
|
2
2
|
import { c } from "react/compiler-runtime";
|
|
3
3
|
import { useDebugValue, useEffect } from "react";
|
|
4
4
|
import { useEffectEvent } from "use-effect-event";
|
|
@@ -33,4 +33,4 @@ function _temp() {
|
|
|
33
33
|
}
|
|
34
34
|
export { useClickOutsideEvent as t };
|
|
35
35
|
|
|
36
|
-
//# sourceMappingURL=useClickOutsideEvent-
|
|
36
|
+
//# sourceMappingURL=useClickOutsideEvent-DbLUuPQ6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClickOutsideEvent-DbLUuPQ6.js","names":["() => EMPTY_ARRAY","elementsArg: () => ClickOutsideEventElements = () => EMPTY_ARRAY","(evt: MouseEvent) => {\n if (!listener) {\n return\n }\n\n const target = evt.target\n\n if (!(target instanceof Node)) {\n return\n }\n\n const resolvedBoundaryElement = boundaryElement?.()\n\n if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target)) {\n return\n }\n\n const elements = elementsArg().flat()\n\n for (const el of elements) {\n if (!el) continue\n\n if (target === el || el.contains(target)) {\n return\n }\n }\n\n listener(evt)\n }","() => {\n if (!hasListener) return undefined\n\n const handleEvent = (evt: MouseEvent) => onEvent(evt)\n\n document.addEventListener('mousedown', handleEvent)\n\n return () => {\n document.removeEventListener('mousedown', handleEvent)\n }\n // oxlint-disable-next-line react/exhaustive-effect-dependencies\n }","evt","[hasListener]"],"sources":["../src/core/hooks/useClickOutsideEvent.ts"],"sourcesContent":["import {useDebugValue, useEffect} 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`. This public hook runs in the fiber of whatever component calls it\n// (consumers may call it from `forwardRef` or `memo` components).\nimport {useEffectEvent} from 'use-effect-event'\n\nimport {EMPTY_ARRAY} from '../constants'\n\n/**\n * @public\n */\nexport type ClickOutsideEventListener = (event: MouseEvent) => void\n\n/**\n * @public\n */\nexport type ClickOutsideEventElements = (HTMLElement | null | (HTMLElement | null)[])[]\n\n/**\n * @public\n */\nexport function useClickOutsideEvent(\n listener: ClickOutsideEventListener | false | undefined,\n elementsArg: () => ClickOutsideEventElements = () => EMPTY_ARRAY,\n boundaryElement?: () => HTMLElement | null,\n): void {\n /**\n * The `useEffectEvent` hook allow us to always see the latest value of `listener`, `elementsArg` and `boundaryElement` without needing to\n * juggle `useState`, `useRef` and `useState` to make sure the `mousedown` event listener isn't constantly being added and removed.\n */\n const onEvent = useEffectEvent((evt: MouseEvent) => {\n if (!listener) {\n return\n }\n\n const target = evt.target\n\n if (!(target instanceof Node)) {\n return\n }\n\n const resolvedBoundaryElement = boundaryElement?.()\n\n if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target)) {\n return\n }\n\n const elements = elementsArg().flat()\n\n for (const el of elements) {\n if (!el) continue\n\n if (target === el || el.contains(target)) {\n return\n }\n }\n\n listener(evt)\n })\n\n const hasListener = Boolean(listener)\n\n useEffect(() => {\n if (!hasListener) return undefined\n\n const handleEvent = (evt: MouseEvent) => onEvent(evt)\n\n document.addEventListener('mousedown', handleEvent)\n\n return () => {\n document.removeEventListener('mousedown', handleEvent)\n }\n // oxlint-disable-next-line react/exhaustive-effect-dependencies\n }, [hasListener])\n\n useDebugValue(listener ? 'MouseDown On' : 'MouseDown Off')\n}\n"],"mappings":";;;;;;;AAwBA,SAAgB,qBACd,UAAA,IAEA,iBACM;eAFN,cAAA,OAAA,KAAA,IAA+CA,QAA/CC,IAO+BC;CAWG,AAAA,EAAA,OAAA,mBAAA,EAAA,OAMf,eAAA,EAAA,OAhBZ,YADwB,MAAC,QAAoB;EAClD,IAAI,CAAC,UACH;EAGF,IAAM,SAAS,IAAI;EAEnB,IAAI,EAAE,kBAAkB,OACtB;EAGF,IAAM,0BAA0B,kBAAkB;EAElD,IAAI,2BAA2B,CAAC,wBAAwB,SAAS,MAAM,GACrE;EAGF,IAAM,WAAW,YAAY,CAAC,CAAC,KAAK;EAEpC,KAAK,IAAM,MAAM,UACV,WAED,WAAW,MAAM,GAAG,SAAS,MAAM,IACrC;EAIJ,SAAS,GAAG;CACd,GAjBkC,EAAA,KAAA,iBAMf,EAAA,KAAA,aAhBZ,EAAA,KAAA;CADP,IAAM,UAAU,eAAeA,EA4B9B,GAEK,cAAc,EAAQ,UAElBC;CACH,AAAA,EAAA,OAAA,eAAA,EAAA,OAEoC,WAHjC,WAAM;EACd,IAAI,CAAC,aAAa;EAElB,IAAM,eAAe,UAAoB,QAAQC,KAAG;EAIpD,OAFA,SAAS,iBAAiB,aAAa,WAAW,SAErC;GACX,SAAS,oBAAoB,aAAa,WAAW;EACvD;CAEF,GAVO,EAAA,KAAA,aAEoC,EAAA,KAAA;CAQxCC,IAAAA;CAEH,AAFI,EAAA,OAAA,2BAAD,KAAA,CAAC,WAAW,GAAX,EAAA,KAAA,yBAXJ,UAAUF,IAWPE,EAAa,GAEhB,cAAc,WAAW,iBAAiB,eAAe;AAC3D;AArDiD,SAAA,QAAA;CAAM,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useElementSize-BJvbGHq8.js","names":["
|
|
1
|
+
{"version":3,"file":"useElementSize-BJvbGHq8.js","names":["() => {\n if (!element) return undefined\n\n return _elementSizeObserver.subscribe(element, setSize)\n }","[element]"],"sources":["../src/core/observers/elementSizeObserver.ts","../src/core/hooks/useElementSize.ts"],"sourcesContent":["/**\n * @beta\n */\nexport interface ElementRectValue {\n width: number\n height: number\n}\n\n/**\n * @beta\n */\nexport interface ElementSize {\n content: ElementRectValue\n border: ElementRectValue\n\n /** @deprecated INTERNAL ONLY */\n _contentRect: DOMRectReadOnly\n}\n\n/**\n * @internal\n */\nexport type _ElementSizeSubscriber = (elementRect: ElementSize) => void\n\n/**\n * @internal\n */\nexport interface _ElementSizeObserver {\n subscribe: (element: HTMLElement, subscriber: _ElementSizeSubscriber) => () => void\n}\n\n/**\n * @internal\n */\nexport interface _ElementSizeListener {\n subscribe: (element: HTMLElement, subscriber: _ElementSizeSubscriber) => () => void\n}\n\n// Initialize element size observer\n// NOTE: this should NOT have size effects\n/**\n * @internal\n */\nexport const _elementSizeObserver = _createElementSizeObserver()\n\nfunction _createElementRectValueListener(): _ElementSizeListener {\n return {\n subscribe(element, subscriber) {\n const resizeObserver = new ResizeObserver(([entry]) => {\n subscriber({\n // oxlint-disable-next-line no-deprecated\n _contentRect: entry.contentRect,\n border: {\n width: entry.borderBoxSize[0].inlineSize,\n height: entry.borderBoxSize[0].blockSize,\n },\n content: {\n width: entry.contentRect.width,\n height: entry.contentRect.height,\n },\n })\n })\n\n resizeObserver.observe(element)\n\n return () => {\n resizeObserver.unobserve(element)\n resizeObserver.disconnect()\n }\n },\n }\n}\n\nfunction _createElementSizeObserver(): _ElementSizeObserver {\n const disposeCache = new WeakMap<HTMLElement, () => void>()\n const subscribersCache = new WeakMap<HTMLElement, _ElementSizeSubscriber[]>()\n\n return {\n subscribe(element, subscriber) {\n const subscribers = subscribersCache.get(element) || []\n\n let dispose = disposeCache.get(element)\n\n if (!subscribersCache.has(element)) {\n subscribersCache.set(element, subscribers)\n\n const listener = _createElementRectValueListener()\n\n // listen\n dispose = listener.subscribe(element, (elementRect) => {\n for (const sub of subscribers) {\n sub(elementRect)\n }\n })\n }\n\n subscribers.push(subscriber)\n\n return () => {\n // dispose\n\n const idx = subscribers.indexOf(subscriber)\n\n if (idx > -1) {\n subscribers.splice(idx, 1)\n }\n\n if (subscribers.length === 0) {\n // unlisten\n if (dispose) dispose()\n }\n }\n },\n }\n}\n","import {useEffect, useState} from 'react'\n\nimport {_elementSizeObserver, ElementSize} from '../observers/elementSizeObserver'\n\n/**\n * Subscribe to the size of a DOM element.\n * @beta\n */\nexport function useElementSize(element: HTMLElement | null): ElementSize | null {\n const [size, setSize] = useState<ElementSize | null>(null)\n\n useEffect(() => {\n if (!element) return undefined\n\n return _elementSizeObserver.subscribe(element, setSize)\n }, [element])\n\n return size\n}\n"],"mappings":";;;;;AA2CA,MAAa,uBAAuB,2BAA2B;AAE/D,SAAS,kCAAwD;CAC/D,OAAO,EACL,UAAU,SAAS,YAAY;EAC7B,IAAM,iBAAiB,IAAI,gBAAgB,CAAC,WAAW;GACrD,WAAW;IAET,cAAc,MAAM;IACpB,QAAQ;KACN,OAAO,MAAM,cAAc,EAAE,CAAC;KAC9B,QAAQ,MAAM,cAAc,EAAE,CAAC;IACjC;IACA,SAAS;KACP,OAAO,MAAM,YAAY;KACzB,QAAQ,MAAM,YAAY;IAC5B;GACF,CAAC;EACH,CAAC;EAID,OAFA,eAAe,QAAQ,OAAO,SAEjB;GAEX,AADA,eAAe,UAAU,OAAO,GAChC,eAAe,WAAW;EAC5B;CACF,EACF;AACF;AAEA,SAAS,6BAAmD;CAC1D,IAAM,+BAAe,IAAI,QAAiC,GACpD,mCAAmB,IAAI,QAA+C;CAE5E,OAAO,EACL,UAAU,SAAS,YAAY;EAC7B,IAAM,cAAc,iBAAiB,IAAI,OAAO,KAAK,CAAC,GAElD,UAAU,aAAa,IAAI,OAAO;EAiBtC,OAfK,iBAAiB,IAAI,OAAO,MAC/B,iBAAiB,IAAI,SAAS,WAAW,GAKzC,UAHiB,gCAGP,CAAA,CAAS,UAAU,UAAU,gBAAgB;GACrD,KAAK,IAAM,OAAO,aAChB,IAAI,WAAW;EAEnB,CAAC,IAGH,YAAY,KAAK,UAAU,SAEd;GAGX,IAAM,MAAM,YAAY,QAAQ,UAAU;GAM1C,AAJI,MAAM,MACR,YAAY,OAAO,KAAK,CAAC,GAGvB,YAAY,WAAW,KAErB,WAAS,QAAQ;EAEzB;CACF,EACF;AACF;;;;;AC1GA,SAAgB,eAAe,SAAiD;eACxE,CAAC,MAAM,WAAW,SAA6B,IAAI,GAE/CA,IAIPC;CAEH,OALO,EAAA,OAAA,oCADG,WAAM;EACT,aAEL,OAAO,qBAAqB,UAAU,SAAS,OAAO;CACxD,GAAG,KAAA,CAAC,OAAO,GAHJ,EAAA,KAAA,gCADP,UAAUD,IAIPC,EAAS,GAEL;AACT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as rem, i as _responsive, n as _getArrayProp, o as EMPTY_ARRAY, r as _getResponsiveSpace, s as EMPTY_RECORD } from "./helpers-
|
|
1
|
+
import { a as rem, i as _responsive, n as _getArrayProp, o as EMPTY_ARRAY, r as _getResponsiveSpace, s as EMPTY_RECORD } from "./helpers-JV5y3U_M.js";
|
|
2
2
|
import { t as getTheme_v2 } from "./getTheme_v2-y09KqtEb.js";
|
|
3
3
|
import { t as getScopedTheme } from "./getScopedTheme-C-sZsyAz.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
@@ -118,7 +118,7 @@ function responsivePaddingStyle(props) {
|
|
|
118
118
|
}
|
|
119
119
|
const StyledBox = /* @__PURE__ */ styled.div.withConfig({
|
|
120
120
|
displayName: "StyledBox",
|
|
121
|
-
componentId: "sc-
|
|
121
|
+
componentId: "sc-ok8ezo-0"
|
|
122
122
|
})(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle), Box = function Box(props) {
|
|
123
123
|
let $ = c(110), flex, gridColumn, gridColumnEnd, gridColumnStart, gridRow, gridRowEnd, gridRowStart, height, marginBottom, marginLeft, marginRight, marginTop, marginX, marginY, overflow, paddingBottom, paddingLeft, paddingRight, paddingTop, paddingX, paddingY, ref, restProps, sizing, t0, t1, t2, t3;
|
|
124
124
|
$[0] === props ? (flex = $[1], gridColumn = $[2], gridColumnEnd = $[3], gridColumnStart = $[4], gridRow = $[5], gridRowEnd = $[6], gridRowStart = $[7], height = $[8], marginBottom = $[9], marginLeft = $[10], marginRight = $[11], marginTop = $[12], marginX = $[13], marginY = $[14], overflow = $[15], paddingBottom = $[16], paddingLeft = $[17], paddingRight = $[18], paddingTop = $[19], paddingX = $[20], paddingY = $[21], ref = $[22], restProps = $[23], sizing = $[24], t0 = $[25], t1 = $[26], t2 = $[27], t3 = $[28]) : ({as: t0, ref, gridColumn, gridColumnStart, gridColumnEnd, display: t1, flex, height, margin: t2, marginX, marginY, marginTop, marginRight, marginBottom, marginLeft, overflow, padding: t3, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft, gridRow, gridRowStart, gridRowEnd, sizing, ...restProps} = props, $[0] = props, $[1] = flex, $[2] = gridColumn, $[3] = gridColumnEnd, $[4] = gridColumnStart, $[5] = gridRow, $[6] = gridRowEnd, $[7] = gridRowStart, $[8] = height, $[9] = marginBottom, $[10] = marginLeft, $[11] = marginRight, $[12] = marginTop, $[13] = marginX, $[14] = marginY, $[15] = overflow, $[16] = paddingBottom, $[17] = paddingLeft, $[18] = paddingRight, $[19] = paddingTop, $[20] = paddingX, $[21] = paddingY, $[22] = ref, $[23] = restProps, $[24] = sizing, $[25] = t0, $[26] = t1, $[27] = t2, $[28] = t3);
|
|
@@ -485,7 +485,7 @@ function cardColorStyle(props) {
|
|
|
485
485
|
}
|
|
486
486
|
const StyledCard = /* @__PURE__ */ styled(Box).withConfig({
|
|
487
487
|
displayName: "StyledCard",
|
|
488
|
-
componentId: "sc-
|
|
488
|
+
componentId: "sc-immb6s-0"
|
|
489
489
|
})(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle);
|
|
490
490
|
function CardComponent(props) {
|
|
491
491
|
let $ = c(57), asProp, border, borderBottom, borderLeft, borderRight, borderTop, muted, pressed, ref, restProps, scheme, selected, shadow, t0, t1, t2, t3;
|
|
@@ -648,14 +648,14 @@ const LayerContext = createGlobalScopedContext("@sanity/ui/context/layer", null)
|
|
|
648
648
|
* @public
|
|
649
649
|
*/
|
|
650
650
|
function LayerProvider(props) {
|
|
651
|
-
let $ = c(
|
|
651
|
+
let $ = c(20), { children, zOffset: t0 } = props, zOffsetProp = t0 === void 0 ? 0 : t0, parentContextValue = useContext(LayerContext), t1;
|
|
652
652
|
$[0] === parentContextValue ? t1 = $[1] : (t1 = parentContextValue && getLayerContext(parentContextValue), $[0] = parentContextValue, $[1] = t1);
|
|
653
653
|
let parent = t1, parentRegisterChild = parent?.registerChild, level = (parent?.level ?? 0) + 1, t2;
|
|
654
654
|
$[2] === zOffsetProp ? t2 = $[3] : (t2 = _getArrayProp(zOffsetProp), $[2] = zOffsetProp, $[3] = t2);
|
|
655
655
|
let zOffset = t2, maxMediaIndex = zOffset.length - 1, mediaIndex = Math.min(useMediaIndex(), maxMediaIndex), zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex], t3;
|
|
656
656
|
$[4] === Symbol.for("react.memo_cache_sentinel") ? (t3 = {}, $[4] = t3) : t3 = $[4];
|
|
657
657
|
let [, setChildLayers] = useState(t3), [size, setSize] = useState(0), isTopLayer = size === 0, t4;
|
|
658
|
-
$[5]
|
|
658
|
+
$[5] === parentRegisterChild ? t4 = $[6] : (t4 = (childLevel) => {
|
|
659
659
|
let parentDispose = parentRegisterChild?.(childLevel);
|
|
660
660
|
return childLevel === void 0 ? setSize(_temp) : setChildLayers((state) => {
|
|
661
661
|
let prevLen = state[childLevel] ?? 0, nextState = {
|
|
@@ -669,23 +669,23 @@ function LayerProvider(props) {
|
|
|
669
669
|
return nextState_0[childLevel] === 1 ? (delete nextState_0[childLevel], setSize(Object.keys(nextState_0).length)) : nextState_0[childLevel] = nextState_0[childLevel] - 1, nextState_0;
|
|
670
670
|
}), parentDispose?.();
|
|
671
671
|
};
|
|
672
|
-
}, $[5] = parentRegisterChild, $[6] =
|
|
672
|
+
}, $[5] = parentRegisterChild, $[6] = t4);
|
|
673
673
|
let registerChild = t4, t5, t6;
|
|
674
|
-
$[
|
|
674
|
+
$[7] !== level || $[8] !== parentRegisterChild ? (t5 = () => parentRegisterChild?.(level), t6 = [level, parentRegisterChild], $[7] = level, $[8] = parentRegisterChild, $[9] = t5, $[10] = t6) : (t5 = $[9], t6 = $[10]), useEffect(t5, t6);
|
|
675
675
|
let t7;
|
|
676
|
-
$[
|
|
676
|
+
$[11] !== isTopLayer || $[12] !== level || $[13] !== registerChild || $[14] !== size || $[15] !== zIndex ? (t7 = {
|
|
677
677
|
version: 0,
|
|
678
678
|
isTopLayer,
|
|
679
679
|
level,
|
|
680
680
|
registerChild,
|
|
681
681
|
size,
|
|
682
682
|
zIndex
|
|
683
|
-
}, $[
|
|
683
|
+
}, $[11] = isTopLayer, $[12] = level, $[13] = registerChild, $[14] = size, $[15] = zIndex, $[16] = t7) : t7 = $[16];
|
|
684
684
|
let value = t7, t8;
|
|
685
|
-
return $[
|
|
685
|
+
return $[17] !== children || $[18] !== value ? (t8 = /* @__PURE__ */ jsx(LayerContext.Provider, {
|
|
686
686
|
value,
|
|
687
687
|
children
|
|
688
|
-
}), $[
|
|
688
|
+
}), $[17] = children, $[18] = value, $[19] = t8) : t8 = $[19], t8;
|
|
689
689
|
}
|
|
690
690
|
function _temp2(v_0) {
|
|
691
691
|
return v_0 - 1;
|
|
@@ -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-Dhme0dcp.js.map
|