@yamada-ui/popover 1.4.3-dev-20241116143410 → 1.4.3-dev-20241117115416

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. package/dist/{chunk-ILSO62AM.mjs → chunk-454CM6LT.mjs} +2 -2
  2. package/dist/{chunk-RPAOBMYJ.mjs → chunk-5XOZKPK7.mjs} +3 -3
  3. package/dist/{chunk-QVEEOMV4.mjs → chunk-62XMD3XG.mjs} +5 -6
  4. package/dist/chunk-62XMD3XG.mjs.map +1 -0
  5. package/dist/{chunk-7HM7C5EL.mjs → chunk-7QWRXZGF.mjs} +2 -2
  6. package/dist/{chunk-VVVFWCB4.mjs → chunk-DM7BMTAI.mjs} +5 -6
  7. package/dist/chunk-DM7BMTAI.mjs.map +1 -0
  8. package/dist/{chunk-JTIVIKPS.mjs → chunk-DSIIS6RK.mjs} +9 -10
  9. package/dist/chunk-DSIIS6RK.mjs.map +1 -0
  10. package/dist/{chunk-TKYA7E3C.mjs → chunk-MAIEILC4.mjs} +2 -2
  11. package/dist/{chunk-Y5OMCSRM.mjs → chunk-ZWCBPNYU.mjs} +2 -2
  12. package/dist/index.js +12 -15
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.mjs +8 -8
  15. package/dist/popover-anchor.js +8 -9
  16. package/dist/popover-anchor.js.map +1 -1
  17. package/dist/popover-anchor.mjs +2 -2
  18. package/dist/popover-body.js +10 -12
  19. package/dist/popover-body.js.map +1 -1
  20. package/dist/popover-body.mjs +2 -2
  21. package/dist/popover-close-button.js +8 -9
  22. package/dist/popover-close-button.js.map +1 -1
  23. package/dist/popover-close-button.mjs +2 -2
  24. package/dist/popover-content.js +8 -9
  25. package/dist/popover-content.js.map +1 -1
  26. package/dist/popover-content.mjs +3 -3
  27. package/dist/popover-footer.js +8 -9
  28. package/dist/popover-footer.js.map +1 -1
  29. package/dist/popover-footer.mjs +2 -2
  30. package/dist/popover-header.js +10 -12
  31. package/dist/popover-header.js.map +1 -1
  32. package/dist/popover-header.mjs +2 -2
  33. package/dist/popover-trigger.js +8 -9
  34. package/dist/popover-trigger.js.map +1 -1
  35. package/dist/popover-trigger.mjs +2 -2
  36. package/dist/popover.d.mts +2 -2
  37. package/dist/popover.d.ts +2 -2
  38. package/dist/popover.js +8 -9
  39. package/dist/popover.js.map +1 -1
  40. package/dist/popover.mjs +1 -1
  41. package/package.json +4 -4
  42. package/dist/chunk-JTIVIKPS.mjs.map +0 -1
  43. package/dist/chunk-QVEEOMV4.mjs.map +0 -1
  44. package/dist/chunk-VVVFWCB4.mjs.map +0 -1
  45. /package/dist/{chunk-ILSO62AM.mjs.map → chunk-454CM6LT.mjs.map} +0 -0
  46. /package/dist/{chunk-RPAOBMYJ.mjs.map → chunk-5XOZKPK7.mjs.map} +0 -0
  47. /package/dist/{chunk-7HM7C5EL.mjs.map → chunk-7QWRXZGF.mjs.map} +0 -0
  48. /package/dist/{chunk-TKYA7E3C.mjs.map → chunk-MAIEILC4.mjs.map} +0 -0
  49. /package/dist/{chunk-Y5OMCSRM.mjs.map → chunk-ZWCBPNYU.mjs.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/popover-content.tsx","../src/popover.tsx","../src/popover-close-button.tsx"],"sourcesContent":["import type { CSSUIObject, CSSUIProps, HTMLUIProps } from \"@yamada-ui/core\"\nimport type { MotionPropsWithoutChildren } from \"@yamada-ui/motion\"\nimport type { PropsWithChildren } from \"react\"\nimport type { PopoverProps } from \"./popover\"\nimport { ui } from \"@yamada-ui/core\"\nimport { motion, motionForwardRef } from \"@yamada-ui/motion\"\nimport { scaleFadeProps, slideFadeProps } from \"@yamada-ui/transitions\"\nimport { cx, findChildren, funcAll, getValidChildren } from \"@yamada-ui/utils\"\nimport { useMemo } from \"react\"\nimport { usePopover } from \"./popover\"\nimport { PopoverCloseButton } from \"./popover-close-button\"\n\nexport interface PopoverContentProps\n extends MotionPropsWithoutChildren<\"section\">,\n PropsWithChildren {\n /**\n * The props of the container element.\n */\n containerProps?: Omit<HTMLUIProps, \"children\">\n}\n\nconst getPopoverContentProps = (\n animation: PopoverProps[\"animation\"] = \"scale\",\n duration?: PopoverProps[\"duration\"],\n) => {\n const custom = {\n duration,\n enter: { visibility: \"visible\" },\n reverse: true,\n transitionEnd: { exit: { visibility: \"hidden\" } },\n }\n\n switch (animation) {\n case \"scale\":\n return {\n ...scaleFadeProps,\n custom: { ...custom, scale: 0.95 },\n }\n case \"top\":\n return {\n ...slideFadeProps,\n custom: { ...custom, offsetX: 0, offsetY: -16 },\n }\n case \"right\":\n return {\n ...slideFadeProps,\n custom: { ...custom, offsetX: 16, offsetY: 0 },\n }\n case \"left\":\n return {\n ...slideFadeProps,\n custom: { ...custom, offsetX: -16, offsetY: 0 },\n }\n case \"bottom\":\n return {\n ...slideFadeProps,\n custom: { ...custom, offsetX: 0, offsetY: 16 },\n }\n }\n}\n\nexport const PopoverContent = motionForwardRef<PopoverContentProps, \"section\">(\n (\n {\n as = \"section\",\n className,\n children,\n maxW,\n maxWidth,\n minW,\n minWidth,\n w,\n width,\n z,\n zIndex,\n containerProps,\n __css,\n ...rest\n },\n ref,\n ) => {\n const {\n animation,\n closeOnButton,\n duration,\n isOpen,\n styles,\n getPopoverProps,\n getPopperProps,\n onAnimationComplete,\n } = usePopover()\n\n const validChildren = getValidChildren(children)\n const [customPopoverCloseButton, ...cloneChildren] = findChildren(\n validChildren,\n PopoverCloseButton,\n )\n\n const Component = useMemo(() => motion(as), [as])\n\n const css = __css ?? styles.container ?? {}\n\n const computedCSS: CSSUIObject = {\n display: \"flex\",\n flexDirection: \"column\",\n outline: 0,\n position: \"relative\",\n w: \"100%\",\n ...css,\n }\n\n width ??= w\n width ??= (css.width ?? css.w) as CSSUIProps[\"width\"]\n minWidth ??= minW\n minWidth ??= (css.minWidth ?? css.minW) as CSSUIProps[\"minWidth\"]\n maxWidth ??= maxW\n maxWidth ??= (css.maxWidth ?? css.maxW) as CSSUIProps[\"maxWidth\"]\n\n zIndex ??= z\n zIndex ??= (css.zIndex ?? css.z) as CSSUIProps[\"zIndex\"]\n\n return (\n <ui.div\n {...getPopperProps({\n style: { visibility: isOpen ? \"visible\" : \"hidden\" },\n })}\n className=\"ui-popover\"\n maxWidth={maxWidth}\n minWidth={minWidth}\n outline=\"none\"\n width={width}\n zIndex={zIndex}\n {...containerProps}\n >\n <Component\n className={cx(\"ui-popover__content\", className)}\n {...(animation !== \"none\"\n ? getPopoverContentProps(animation, duration)\n : {})}\n {...getPopoverProps(rest, ref)}\n animate={isOpen ? \"enter\" : \"exit\"}\n exit=\"exit\"\n initial=\"exit\"\n onAnimationComplete={funcAll(\n onAnimationComplete,\n rest.onAnimationComplete,\n )}\n __css={computedCSS}\n >\n {customPopoverCloseButton ??\n (closeOnButton ? <PopoverCloseButton /> : null)}\n\n {cloneChildren}\n </Component>\n </ui.div>\n )\n },\n)\n\nPopoverContent.displayName = \"PopoverContent\"\nPopoverContent.__ui__ = \"PopoverContent\"\n","import type {\n CSSUIObject,\n FC,\n HTMLUIPropsWithRef,\n PropGetter,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { MotionProps, MotionTransitionProps } from \"@yamada-ui/motion\"\nimport type { LazyMode } from \"@yamada-ui/use-disclosure\"\nimport type { UsePopperProps } from \"@yamada-ui/use-popper\"\nimport type {\n ComponentProps,\n PropsWithChildren,\n RefAttributes,\n RefObject,\n} from \"react\"\nimport { omitThemeProps, useComponentMultiStyle } from \"@yamada-ui/core\"\nimport { useAnimationObserver } from \"@yamada-ui/use-animation\"\nimport { useDisclosure, useLazyDisclosure } from \"@yamada-ui/use-disclosure\"\nimport {\n useFocusOnHide,\n useFocusOnPointerDown,\n useFocusOnShow,\n} from \"@yamada-ui/use-focus\"\nimport { popperProperties, usePopper } from \"@yamada-ui/use-popper\"\nimport {\n createContext,\n getEventRelatedTarget,\n handlerAll,\n isContains,\n mergeRefs,\n runIfFunc,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef } from \"react\"\n\nexport type PopoverProperty = (typeof popoverProperties)[number]\n\nexport const popoverProperties = [\n ...popperProperties,\n \"isOpen\",\n \"defaultIsOpen\",\n \"onOpen\",\n \"onClose\",\n \"initialFocusRef\",\n \"restoreFocus\",\n \"autoFocus\",\n \"closeOnBlur\",\n \"closeOnEsc\",\n \"closeOnButton\",\n \"trigger\",\n \"openDelay\",\n \"closeDelay\",\n \"isLazy\",\n \"lazyBehavior\",\n \"animation\",\n \"duration\",\n] as const\n\nexport interface ComboBoxProps\n extends Omit<\n PopoverOptions,\n | \"autoFocus\"\n | \"closeOnButton\"\n | \"initialFocusRef\"\n | \"relatedRef\"\n | \"restoreFocus\"\n | \"trigger\"\n >,\n Omit<UsePopperProps, \"enabled\"> {}\n\ninterface PopoverOptions {\n /**\n * The animation of the popover.\n *\n * @default 'scale'\n */\n animation?: \"bottom\" | \"left\" | \"none\" | \"right\" | \"scale\" | \"top\"\n /**\n * If `true`, focus will be transferred to the first interactive element when the popover opens.\n *\n * @default true\n */\n autoFocus?: boolean\n /**\n * The number of delay time to close.\n *\n * @default 200\n */\n closeDelay?: number\n /**\n * If `true`, the popover will close when you blur out it by clicking outside or tabbing out.\n *\n * @default true\n */\n closeOnBlur?: boolean\n /**\n * If `true`, display the popover close button.\n *\n * @default true\n */\n closeOnButton?: boolean\n /**\n * If `true`, the popover will close when you hit the `Esc` key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the popover will be initially opened.\n */\n defaultIsOpen?: boolean\n /**\n * The animation duration.\n */\n duration?: MotionTransitionProps[\"duration\"]\n /**\n * The `ref` of the element that should receive focus when the popover opens.\n */\n initialFocusRef?: RefObject<{ focus(): void }>\n /**\n * If `true`, the PopoverContent rendering will be deferred until the popover is open.\n *\n * @default false\n */\n isLazy?: boolean\n /**\n * If `true`, the popover will be opened.\n */\n isOpen?: boolean\n /**\n * The lazy behavior of popover's content when not visible. Only works when `isLazy={true}`\n *\n * - `unmount`: The popover's content is always unmounted when not open.\n * - `keepMounted`: The popover's content initially unmounted, but stays mounted when popover is open.\n *\n * @default 'unmount'\n */\n lazyBehavior?: LazyMode\n /**\n * The number of delay time to open.\n *\n * @default 200\n */\n openDelay?: number\n /**\n * The `ref` of the element related to the popover.\n * This is used during the `onBlur` event.\n */\n relatedRef?: RefObject<HTMLElement>\n /**\n * If `true`, focus will be returned to the element that triggers the popover when it closes.\n *\n * @default true\n */\n restoreFocus?: boolean\n /**\n * The interaction that triggers the popover.\n *\n * - `hover`: means the popover will open when you hover with mouse or focus with keyboard on the popover trigger.\n * - `click`: means the popover will open on click or press `Enter` to `Space` on keyboard.\n *\n * @default 'click'\n */\n trigger?: \"click\" | \"contextmenu\" | \"hover\" | \"never\"\n /**\n * Callback fired when the popover closes.\n */\n onClose?: () => void\n /**\n * Callback fired when the popover opens.\n */\n onOpen?: () => void\n}\n\nexport interface PopoverProps\n extends ThemeProps<\"Popover\">,\n Omit<UsePopperProps, \"enabled\">,\n PropsWithChildren<PopoverOptions> {}\n\ninterface PopoverContext\n extends Pick<\n PopoverOptions,\n \"animation\" | \"closeOnButton\" | \"duration\" | \"isOpen\" | \"onClose\"\n > {\n id: string\n describedbyId: string\n forceUpdate: () => undefined | void\n labelledbyId: string\n styles: { [key: string]: CSSUIObject | undefined }\n getAnchorProps: PropGetter\n getPopoverProps: PropGetter<MotionProps<\"section\">, MotionProps<\"section\">>\n getPopperProps: PropGetter<ComponentProps<\"div\">>\n getTriggerProps: PropGetter\n onAnimationComplete: () => void\n}\n\nconst [PopoverProvider, usePopover] = createContext<PopoverContext>({\n name: \"PopoverContext\",\n errorMessage: `usePopoverContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Popover />\"`,\n})\n\nexport { usePopover }\n\n/**\n * `Popover` is a component that floats around an element to display information.\n *\n * @see Docs https://yamada-ui.com/components/overlay/popover\n */\nexport const Popover: FC<PopoverProps> = (props) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Popover\", props)\n const {\n animation = \"scale\",\n autoFocus = true,\n children,\n closeDelay = 200,\n closeOnBlur = true,\n closeOnButton = true,\n closeOnEsc = true,\n duration,\n initialFocusRef,\n isLazy,\n lazyBehavior = \"unmount\",\n openDelay = 200,\n relatedRef,\n restoreFocus = true,\n trigger = \"click\",\n ...rest\n } = omitThemeProps(mergedProps)\n const id = useId()\n const labelledbyId = useId()\n const describedbyId = useId()\n const { isOpen, onClose, onOpen, onToggle } = useDisclosure(mergedProps)\n const anchorRef = useRef<HTMLElement>(null)\n const triggerRef = useRef<HTMLElement>(null)\n const popoverRef = useRef<HTMLElement>(null)\n const { present, onAnimationComplete } = useAnimationObserver({\n ref: popoverRef,\n isOpen,\n })\n const openTimeout = useRef<number | undefined>(undefined)\n const closeTimeout = useRef<number | undefined>(undefined)\n const isHoveringRef = useRef(false)\n const hasBeenOpened = useRef(false)\n const { forceUpdate, referenceRef, transformOrigin, getPopperProps } =\n usePopper({\n ...rest,\n enabled: isOpen,\n })\n\n if (isOpen) hasBeenOpened.current = true\n\n useEffect(() => {\n return () => {\n if (openTimeout.current) clearTimeout(openTimeout.current)\n\n if (closeTimeout.current) clearTimeout(closeTimeout.current)\n }\n }, [])\n\n useFocusOnPointerDown({\n ref: triggerRef,\n enabled: isOpen,\n })\n\n useFocusOnHide(popoverRef, {\n focusRef: triggerRef,\n shouldFocus:\n restoreFocus && (trigger === \"click\" || trigger === \"contextmenu\"),\n visible: isOpen,\n })\n\n useFocusOnShow(popoverRef, {\n focusRef: initialFocusRef,\n shouldFocus:\n autoFocus && (trigger === \"click\" || trigger === \"contextmenu\"),\n visible: isOpen,\n })\n\n const shouldRenderChildren = useLazyDisclosure({\n enabled: isLazy,\n isSelected: present,\n mode: lazyBehavior,\n wasSelected: hasBeenOpened.current,\n })\n\n const getPopoverProps: PropGetter<\n MotionProps<\"section\">,\n MotionProps<\"section\">\n > = useCallback(\n (props = {}, ref = null) => {\n const popoverProps: MotionProps & RefAttributes<any> = {\n id,\n \"aria-describedby\": describedbyId,\n \"aria-hidden\": !isOpen,\n \"aria-labelledby\": labelledbyId,\n role: \"dialog\",\n ...props,\n ref: mergeRefs(popoverRef, ref),\n style: {\n ...props.style,\n transformOrigin,\n },\n children: shouldRenderChildren ? props.children : null,\n tabIndex: -1,\n onBlur: handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const targetIsPopover = isContains(popoverRef.current, relatedTarget)\n const targetIsTrigger = isContains(triggerRef.current, relatedTarget)\n const targetIsRelated = relatedRef?.current\n ? isContains(relatedRef.current, relatedTarget)\n : false\n\n const isValidBlur =\n !targetIsPopover && !targetIsTrigger && !targetIsRelated\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n }),\n onKeyDown: handlerAll(props.onKeyDown, (ev) => {\n if (closeOnEsc && ev.key === \"Escape\") onClose()\n }),\n }\n\n if (trigger === \"hover\") {\n popoverProps.onMouseEnter = handlerAll(props.onMouseEnter, () => {\n isHoveringRef.current = true\n })\n\n popoverProps.onMouseLeave = handlerAll(props.onMouseLeave, (ev) => {\n if (ev.nativeEvent.relatedTarget === null) return\n\n isHoveringRef.current = false\n\n if (closeOnBlur) setTimeout(onClose, closeDelay)\n })\n }\n\n return popoverProps\n },\n [\n closeDelay,\n closeOnBlur,\n closeOnEsc,\n isOpen,\n onClose,\n shouldRenderChildren,\n transformOrigin,\n trigger,\n relatedRef,\n id,\n labelledbyId,\n describedbyId,\n ],\n )\n\n const maybeReferenceRef = useCallback(\n (node: Element) => {\n if (anchorRef.current == null) referenceRef(node)\n },\n [referenceRef],\n )\n\n const getTriggerProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n const triggerProps: HTMLUIPropsWithRef = {\n \"aria-controls\": isOpen ? id : undefined,\n \"aria-expanded\": isOpen,\n role: \"button\",\n ...props,\n ref: mergeRefs(triggerRef, ref, maybeReferenceRef),\n }\n\n if (trigger === \"click\") {\n triggerProps.onClick = handlerAll(props.onClick, onToggle)\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n }\n\n if (trigger === \"contextmenu\") {\n triggerProps.onContextMenu = handlerAll(props.onContextMenu, (ev) => {\n ev.preventDefault()\n onOpen()\n })\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n }\n\n if (trigger === \"hover\") {\n triggerProps.onFocus = handlerAll(props.onFocus, () => {\n if (openTimeout.current === undefined) onOpen()\n })\n\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n\n triggerProps.onKeyDown = handlerAll(props.onKeyDown, (ev) => {\n if (ev.key === \"Escape\") onClose()\n })\n\n triggerProps.onMouseEnter = handlerAll(props.onMouseEnter, () => {\n isHoveringRef.current = true\n openTimeout.current = window.setTimeout(onOpen, openDelay)\n })\n\n triggerProps.onMouseLeave = handlerAll(props.onMouseLeave, () => {\n isHoveringRef.current = false\n\n if (openTimeout.current) {\n clearTimeout(openTimeout.current)\n openTimeout.current = undefined\n }\n\n closeTimeout.current = window.setTimeout(() => {\n if (!isHoveringRef.current) onClose()\n }, closeDelay)\n })\n }\n\n return triggerProps\n },\n [\n closeDelay,\n closeOnBlur,\n isOpen,\n maybeReferenceRef,\n onClose,\n onOpen,\n onToggle,\n openDelay,\n trigger,\n id,\n ],\n )\n\n const getAnchorProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n return {\n ...props,\n ref: mergeRefs(ref, anchorRef, referenceRef),\n }\n },\n [anchorRef, referenceRef],\n )\n\n return (\n <PopoverProvider\n value={{\n id,\n animation,\n closeOnButton,\n describedbyId,\n duration,\n forceUpdate,\n isOpen,\n labelledbyId,\n styles,\n getAnchorProps,\n getPopoverProps,\n getPopperProps,\n getTriggerProps,\n onAnimationComplete,\n onClose,\n }}\n >\n {runIfFunc(children, {\n forceUpdate,\n isOpen,\n onClose,\n })}\n </PopoverProvider>\n )\n}\n\nPopover.displayName = \"Popover\"\nPopover.__ui__ = \"Popover\"\n","import type { CloseButtonProps } from \"@yamada-ui/close-button\"\nimport type { CSSUIObject } from \"@yamada-ui/core\"\nimport { CloseButton } from \"@yamada-ui/close-button\"\nimport { forwardRef } from \"@yamada-ui/core\"\nimport { cx, handlerAll } from \"@yamada-ui/utils\"\nimport { usePopover } from \"./popover\"\n\nexport interface PopoverCloseButtonProps extends CloseButtonProps {}\n\nexport const PopoverCloseButton = forwardRef<PopoverCloseButtonProps, \"button\">(\n ({ onClick, ...rest }, ref) => {\n const { id, styles, onClose } = usePopover()\n\n const css: CSSUIObject = {\n position: \"absolute\",\n ...styles.closeButton,\n }\n\n return (\n <CloseButton\n ref={ref}\n className={cx(\"ui-popover__close-button\")}\n size=\"sm\"\n aria-controls={id}\n aria-label=\"Close popover\"\n onClick={handlerAll(onClick, (ev) => {\n ev.stopPropagation()\n onClose?.()\n })}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nPopoverCloseButton.displayName = \"PopoverCloseButton\"\nPopoverCloseButton.__ui__ = \"PopoverCloseButton\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,IAAAA,eAAmB;AACnB,oBAAyC;AACzC,yBAA+C;AAC/C,IAAAC,gBAA4D;AAC5D,IAAAC,gBAAwB;;;ACQxB,kBAAuD;AACvD,2BAAqC;AACrC,4BAAiD;AACjD,uBAIO;AACP,wBAA4C;AAC5C,mBAOO;AACP,mBAAsD;AAualD;AAnaG,IAAM,oBAAoB;AAAA,EAC/B,GAAG;AAAA,EACH;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,E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A,IACF;AAAA,EAEJ;AACF;AAEA,eAAe,cAAc;AAC7B,eAAe,SAAS;","names":["import_core","import_utils","import_react","props","import_core","import_utils","import_jsx_runtime","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../src/popover-content.tsx","../src/popover.tsx","../src/popover-close-button.tsx"],"sourcesContent":["import type { CSSUIObject, CSSUIProps, HTMLUIProps } from \"@yamada-ui/core\"\nimport type { MotionPropsWithoutChildren } from \"@yamada-ui/motion\"\nimport type { PropsWithChildren } from \"react\"\nimport type { PopoverProps } from \"./popover\"\nimport { ui } from \"@yamada-ui/core\"\nimport { motion, motionForwardRef } from \"@yamada-ui/motion\"\nimport { scaleFadeProps, slideFadeProps } from \"@yamada-ui/transitions\"\nimport { cx, findChildren, funcAll, getValidChildren } from \"@yamada-ui/utils\"\nimport { useMemo } from \"react\"\nimport { usePopover } from \"./popover\"\nimport { PopoverCloseButton } from \"./popover-close-button\"\n\nexport interface PopoverContentProps\n extends MotionPropsWithoutChildren<\"section\">,\n PropsWithChildren {\n /**\n * The props of the container element.\n */\n containerProps?: Omit<HTMLUIProps, \"children\">\n}\n\nconst getPopoverContentProps = (\n animation: PopoverProps[\"animation\"] = \"scale\",\n duration?: PopoverProps[\"duration\"],\n) => {\n const custom = {\n duration,\n enter: { visibility: \"visible\" },\n reverse: true,\n transitionEnd: { exit: { visibility: \"hidden\" } },\n }\n\n switch (animation) {\n case \"scale\":\n return {\n ...scaleFadeProps,\n custom: { ...custom, scale: 0.95 },\n }\n case \"top\":\n return {\n ...slideFadeProps,\n custom: { ...custom, offsetX: 0, offsetY: -16 },\n }\n case \"right\":\n return {\n ...slideFadeProps,\n custom: { ...custom, offsetX: 16, offsetY: 0 },\n }\n case \"left\":\n return {\n ...slideFadeProps,\n custom: { ...custom, offsetX: -16, offsetY: 0 },\n }\n case \"bottom\":\n return {\n ...slideFadeProps,\n custom: { ...custom, offsetX: 0, offsetY: 16 },\n }\n }\n}\n\nexport const PopoverContent = motionForwardRef<PopoverContentProps, \"section\">(\n (\n {\n as = \"section\",\n className,\n children,\n maxW,\n maxWidth,\n minW,\n minWidth,\n w,\n width,\n z,\n zIndex,\n containerProps,\n __css,\n ...rest\n },\n ref,\n ) => {\n const {\n animation,\n closeOnButton,\n duration,\n isOpen,\n styles,\n getPopoverProps,\n getPopperProps,\n onAnimationComplete,\n } = usePopover()\n\n const validChildren = getValidChildren(children)\n const [customPopoverCloseButton, ...cloneChildren] = findChildren(\n validChildren,\n PopoverCloseButton,\n )\n\n const Component = useMemo(() => motion(as), [as])\n\n const css = __css ?? styles.container ?? {}\n\n const computedCSS: CSSUIObject = {\n display: \"flex\",\n flexDirection: \"column\",\n outline: 0,\n position: \"relative\",\n w: \"100%\",\n ...css,\n }\n\n width ??= w\n width ??= (css.width ?? css.w) as CSSUIProps[\"width\"]\n minWidth ??= minW\n minWidth ??= (css.minWidth ?? css.minW) as CSSUIProps[\"minWidth\"]\n maxWidth ??= maxW\n maxWidth ??= (css.maxWidth ?? css.maxW) as CSSUIProps[\"maxWidth\"]\n\n zIndex ??= z\n zIndex ??= (css.zIndex ?? css.z) as CSSUIProps[\"zIndex\"]\n\n return (\n <ui.div\n {...getPopperProps({\n style: { visibility: isOpen ? \"visible\" : \"hidden\" },\n })}\n className=\"ui-popover\"\n maxWidth={maxWidth}\n minWidth={minWidth}\n outline=\"none\"\n width={width}\n zIndex={zIndex}\n {...containerProps}\n >\n <Component\n className={cx(\"ui-popover__content\", className)}\n {...(animation !== \"none\"\n ? getPopoverContentProps(animation, duration)\n : {})}\n {...getPopoverProps(rest, ref)}\n animate={isOpen ? \"enter\" : \"exit\"}\n exit=\"exit\"\n initial=\"exit\"\n onAnimationComplete={funcAll(\n onAnimationComplete,\n rest.onAnimationComplete,\n )}\n __css={computedCSS}\n >\n {customPopoverCloseButton ??\n (closeOnButton ? <PopoverCloseButton /> : null)}\n\n {cloneChildren}\n </Component>\n </ui.div>\n )\n },\n)\n\nPopoverContent.displayName = \"PopoverContent\"\nPopoverContent.__ui__ = \"PopoverContent\"\n","import type {\n CSSUIObject,\n FC,\n HTMLUIPropsWithRef,\n PropGetter,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { MotionProps, MotionTransitionProps } from \"@yamada-ui/motion\"\nimport type { LazyMode } from \"@yamada-ui/use-disclosure\"\nimport type { UsePopperProps } from \"@yamada-ui/use-popper\"\nimport type {\n ComponentProps,\n PropsWithChildren,\n RefAttributes,\n RefObject,\n} from \"react\"\nimport { omitThemeProps, useComponentMultiStyle } from \"@yamada-ui/core\"\nimport { useAnimationObserver } from \"@yamada-ui/use-animation\"\nimport { useDisclosure, useLazyDisclosure } from \"@yamada-ui/use-disclosure\"\nimport {\n useFocusOnHide,\n useFocusOnPointerDown,\n useFocusOnShow,\n} from \"@yamada-ui/use-focus\"\nimport { popperProperties, usePopper } from \"@yamada-ui/use-popper\"\nimport {\n createContext,\n getEventRelatedTarget,\n handlerAll,\n isContains,\n mergeRefs,\n runIfFunc,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef } from \"react\"\n\nexport type PopoverProperty = (typeof popoverProperties)[number]\n\nexport const popoverProperties = [\n ...popperProperties,\n \"isOpen\",\n \"defaultIsOpen\",\n \"onOpen\",\n \"onClose\",\n \"initialFocusRef\",\n \"restoreFocus\",\n \"autoFocus\",\n \"closeOnBlur\",\n \"closeOnEsc\",\n \"closeOnButton\",\n \"trigger\",\n \"openDelay\",\n \"closeDelay\",\n \"isLazy\",\n \"lazyBehavior\",\n \"animation\",\n \"duration\",\n] as const\n\nexport interface ComboBoxProps\n extends Omit<\n PopoverOptions,\n | \"autoFocus\"\n | \"closeOnButton\"\n | \"initialFocusRef\"\n | \"relatedRef\"\n | \"restoreFocus\"\n | \"trigger\"\n >,\n Omit<UsePopperProps, \"enabled\"> {}\n\ninterface PopoverOptions {\n /**\n * The animation of the popover.\n *\n * @default 'scale'\n */\n animation?: \"bottom\" | \"left\" | \"none\" | \"right\" | \"scale\" | \"top\"\n /**\n * If `true`, focus will be transferred to the first interactive element when the popover opens.\n *\n * @default true\n */\n autoFocus?: boolean\n /**\n * The number of delay time to close.\n *\n * @default 200\n */\n closeDelay?: number\n /**\n * If `true`, the popover will close when you blur out it by clicking outside or tabbing out.\n *\n * @default true\n */\n closeOnBlur?: boolean\n /**\n * If `true`, display the popover close button.\n *\n * @default true\n */\n closeOnButton?: boolean\n /**\n * If `true`, the popover will close when you hit the `Esc` key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the popover will be initially opened.\n */\n defaultIsOpen?: boolean\n /**\n * The animation duration.\n */\n duration?: MotionTransitionProps[\"duration\"]\n /**\n * The `ref` of the element that should receive focus when the popover opens.\n */\n initialFocusRef?: RefObject<{ focus(): void }>\n /**\n * If `true`, the PopoverContent rendering will be deferred until the popover is open.\n *\n * @default false\n */\n isLazy?: boolean\n /**\n * If `true`, the popover will be opened.\n */\n isOpen?: boolean\n /**\n * The lazy behavior of popover's content when not visible. Only works when `isLazy={true}`\n *\n * - `unmount`: The popover's content is always unmounted when not open.\n * - `keepMounted`: The popover's content initially unmounted, but stays mounted when popover is open.\n *\n * @default 'unmount'\n */\n lazyBehavior?: LazyMode\n /**\n * The number of delay time to open.\n *\n * @default 200\n */\n openDelay?: number\n /**\n * The `ref` of the element related to the popover.\n * This is used during the `onBlur` event.\n */\n relatedRef?: RefObject<HTMLElement>\n /**\n * If `true`, focus will be returned to the element that triggers the popover when it closes.\n *\n * @default true\n */\n restoreFocus?: boolean\n /**\n * The interaction that triggers the popover.\n *\n * - `hover`: means the popover will open when you hover with mouse or focus with keyboard on the popover trigger.\n * - `click`: means the popover will open on click or press `Enter` to `Space` on keyboard.\n *\n * @default 'click'\n */\n trigger?: \"click\" | \"contextmenu\" | \"hover\" | \"never\"\n /**\n * Callback fired when the popover closes.\n */\n onClose?: () => void\n /**\n * Callback fired when the popover opens.\n */\n onOpen?: () => void\n}\n\nexport interface PopoverProps\n extends ThemeProps<\"Popover\">,\n Omit<UsePopperProps, \"enabled\">,\n PropsWithChildren<PopoverOptions> {}\n\ninterface PopoverContext\n extends Pick<\n PopoverOptions,\n \"animation\" | \"closeOnButton\" | \"duration\" | \"isOpen\" | \"onClose\"\n > {\n id: string\n bodyRef: RefObject<HTMLElement>\n forceUpdate: () => undefined | void\n headerRef: RefObject<HTMLElement>\n styles: { [key: string]: CSSUIObject | undefined }\n getAnchorProps: PropGetter\n getPopoverProps: PropGetter<MotionProps<\"section\">, MotionProps<\"section\">>\n getPopperProps: PropGetter<ComponentProps<\"div\">>\n getTriggerProps: PropGetter\n onAnimationComplete: () => void\n}\n\nconst [PopoverProvider, usePopover] = createContext<PopoverContext>({\n name: \"PopoverContext\",\n errorMessage: `usePopoverContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Popover />\"`,\n})\n\nexport { usePopover }\n\n/**\n * `Popover` is a component that floats around an element to display information.\n *\n * @see Docs https://yamada-ui.com/components/overlay/popover\n */\nexport const Popover: FC<PopoverProps> = (props) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Popover\", props)\n const {\n animation = \"scale\",\n autoFocus = true,\n children,\n closeDelay = 200,\n closeOnBlur = true,\n closeOnButton = true,\n closeOnEsc = true,\n duration,\n initialFocusRef,\n isLazy,\n lazyBehavior = \"unmount\",\n openDelay = 200,\n relatedRef,\n restoreFocus = true,\n trigger = \"click\",\n ...rest\n } = omitThemeProps(mergedProps)\n const id = useId()\n const { isOpen, onClose, onOpen, onToggle } = useDisclosure(mergedProps)\n const anchorRef = useRef<HTMLElement>(null)\n const triggerRef = useRef<HTMLElement>(null)\n const headerRef = useRef<HTMLElement>(null)\n const bodyRef = useRef<HTMLElement>(null)\n const popoverRef = useRef<HTMLElement>(null)\n const { present, onAnimationComplete } = useAnimationObserver({\n ref: popoverRef,\n isOpen,\n })\n const openTimeout = useRef<number | undefined>(undefined)\n const closeTimeout = useRef<number | undefined>(undefined)\n const isHoveringRef = useRef(false)\n const hasBeenOpened = useRef(false)\n const { forceUpdate, referenceRef, transformOrigin, getPopperProps } =\n usePopper({\n ...rest,\n enabled: isOpen,\n })\n\n if (isOpen) hasBeenOpened.current = true\n\n useEffect(() => {\n return () => {\n if (openTimeout.current) clearTimeout(openTimeout.current)\n\n if (closeTimeout.current) clearTimeout(closeTimeout.current)\n }\n }, [])\n\n useFocusOnPointerDown({\n ref: triggerRef,\n enabled: isOpen,\n })\n\n useFocusOnHide(popoverRef, {\n focusRef: triggerRef,\n shouldFocus:\n restoreFocus && (trigger === \"click\" || trigger === \"contextmenu\"),\n visible: isOpen,\n })\n\n useFocusOnShow(popoverRef, {\n focusRef: initialFocusRef,\n shouldFocus:\n autoFocus && (trigger === \"click\" || trigger === \"contextmenu\"),\n visible: isOpen,\n })\n\n const shouldRenderChildren = useLazyDisclosure({\n enabled: isLazy,\n isSelected: present,\n mode: lazyBehavior,\n wasSelected: hasBeenOpened.current,\n })\n\n const getPopoverProps: PropGetter<\n MotionProps<\"section\">,\n MotionProps<\"section\">\n > = useCallback(\n (props = {}, ref = null) => {\n const popoverProps: MotionProps & RefAttributes<any> = {\n id,\n \"aria-describedby\": bodyRef.current?.id,\n \"aria-hidden\": !isOpen,\n \"aria-labelledby\": headerRef.current?.id,\n role: \"dialog\",\n ...props,\n ref: mergeRefs(popoverRef, ref),\n style: {\n ...props.style,\n transformOrigin,\n },\n children: shouldRenderChildren ? props.children : null,\n tabIndex: -1,\n onBlur: handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const targetIsPopover = isContains(popoverRef.current, relatedTarget)\n const targetIsTrigger = isContains(triggerRef.current, relatedTarget)\n const targetIsRelated = relatedRef?.current\n ? isContains(relatedRef.current, relatedTarget)\n : false\n\n const isValidBlur =\n !targetIsPopover && !targetIsTrigger && !targetIsRelated\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n }),\n onKeyDown: handlerAll(props.onKeyDown, (ev) => {\n if (closeOnEsc && ev.key === \"Escape\") onClose()\n }),\n }\n\n if (trigger === \"hover\") {\n popoverProps.onMouseEnter = handlerAll(props.onMouseEnter, () => {\n isHoveringRef.current = true\n })\n\n popoverProps.onMouseLeave = handlerAll(props.onMouseLeave, (ev) => {\n if (ev.nativeEvent.relatedTarget === null) return\n\n isHoveringRef.current = false\n\n if (closeOnBlur) setTimeout(onClose, closeDelay)\n })\n }\n\n return popoverProps\n },\n [\n closeDelay,\n closeOnBlur,\n closeOnEsc,\n isOpen,\n onClose,\n shouldRenderChildren,\n transformOrigin,\n trigger,\n relatedRef,\n id,\n ],\n )\n\n const maybeReferenceRef = useCallback(\n (node: Element) => {\n if (anchorRef.current == null) referenceRef(node)\n },\n [referenceRef],\n )\n\n const getTriggerProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n const triggerProps: HTMLUIPropsWithRef = {\n \"aria-controls\": isOpen ? id : undefined,\n \"aria-expanded\": isOpen,\n role: \"button\",\n ...props,\n ref: mergeRefs(triggerRef, ref, maybeReferenceRef),\n }\n\n if (trigger === \"click\") {\n triggerProps.onClick = handlerAll(props.onClick, onToggle)\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n }\n\n if (trigger === \"contextmenu\") {\n triggerProps.onContextMenu = handlerAll(props.onContextMenu, (ev) => {\n ev.preventDefault()\n onOpen()\n })\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n }\n\n if (trigger === \"hover\") {\n triggerProps.onFocus = handlerAll(props.onFocus, () => {\n if (openTimeout.current === undefined) onOpen()\n })\n\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n\n triggerProps.onKeyDown = handlerAll(props.onKeyDown, (ev) => {\n if (ev.key === \"Escape\") onClose()\n })\n\n triggerProps.onMouseEnter = handlerAll(props.onMouseEnter, () => {\n isHoveringRef.current = true\n openTimeout.current = window.setTimeout(onOpen, openDelay)\n })\n\n triggerProps.onMouseLeave = handlerAll(props.onMouseLeave, () => {\n isHoveringRef.current = false\n\n if (openTimeout.current) {\n clearTimeout(openTimeout.current)\n openTimeout.current = undefined\n }\n\n closeTimeout.current = window.setTimeout(() => {\n if (!isHoveringRef.current) onClose()\n }, closeDelay)\n })\n }\n\n return triggerProps\n },\n [\n closeDelay,\n closeOnBlur,\n isOpen,\n maybeReferenceRef,\n onClose,\n onOpen,\n onToggle,\n openDelay,\n trigger,\n id,\n ],\n )\n\n const getAnchorProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n return {\n ...props,\n ref: mergeRefs(ref, anchorRef, referenceRef),\n }\n },\n [anchorRef, referenceRef],\n )\n\n return (\n <PopoverProvider\n value={{\n id,\n animation,\n bodyRef,\n closeOnButton,\n duration,\n forceUpdate,\n headerRef,\n isOpen,\n styles,\n getAnchorProps,\n getPopoverProps,\n getPopperProps,\n getTriggerProps,\n onAnimationComplete,\n onClose,\n }}\n >\n {runIfFunc(children, {\n forceUpdate,\n isOpen,\n onClose,\n })}\n </PopoverProvider>\n )\n}\n\nPopover.displayName = \"Popover\"\nPopover.__ui__ = \"Popover\"\n","import type { CloseButtonProps } from \"@yamada-ui/close-button\"\nimport type { CSSUIObject } from \"@yamada-ui/core\"\nimport { CloseButton } from \"@yamada-ui/close-button\"\nimport { forwardRef } from \"@yamada-ui/core\"\nimport { cx, handlerAll } from \"@yamada-ui/utils\"\nimport { usePopover } from \"./popover\"\n\nexport interface PopoverCloseButtonProps extends CloseButtonProps {}\n\nexport const PopoverCloseButton = forwardRef<PopoverCloseButtonProps, \"button\">(\n ({ onClick, ...rest }, ref) => {\n const { id, styles, onClose } = usePopover()\n\n const css: CSSUIObject = {\n position: \"absolute\",\n ...styles.closeButton,\n }\n\n return (\n <CloseButton\n ref={ref}\n className={cx(\"ui-popover__close-button\")}\n size=\"sm\"\n aria-controls={id}\n aria-label=\"Close popover\"\n onClick={handlerAll(onClick, (ev) => {\n ev.stopPropagation()\n onClose?.()\n })}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nPopoverCloseButton.displayName = \"PopoverCloseButton\"\nPopoverCloseButton.__ui__ = \"PopoverCloseButton\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,IAAAA,eAAmB;AACnB,oBAAyC;AACzC,yBAA+C;AAC/C,IAAAC,gBAA4D;AAC5D,IAAAC,gBAAwB;;;ACQxB,kBAAuD;AACvD,2BAAqC;AACrC,4BAAiD;AACjD,uBAIO;AACP,wBAA4C;AAC5C,mBAOO;AACP,mBAAsD;AAqalD;AAjaG,IAAM,oBAAoB;AAAA,EAC/B,GAAG;AAAA,EACH;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AA4IA,IAAM,CAAC,iBAAiB,UAAU,QAAI,4BAA8B;AAAA,EAClE,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AASM,IAAM,UAA4B,CAAC,UAAU;AAClD,QAAM,CAAC,QAAQ,WAAW,QAAI,oCAAuB,WAAW,KAAK;AACrE,QAAM;AAAA,IACJ,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ;AAAA,IACA,aAAa;AAAA,IACb,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf,YAAY;AAAA,IACZ;AAAA,IACA,eAAe;AAAA,IACf,UAAU;AAAA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AAJ,YAAgB,IAAI;AAClC,6CAAa;AACb,8CAAc,SAAI,aAAJ,YAAgB,IAAI;AAElC,uCAAW;AACX,wCAAY,SAAI,WAAJ,YAAc,IAAI;AAE9B,WACE;AAAA,MAAC,gBAAG;AAAA,MAAH;AAAA,QACE,GAAG,eAAe;AAAA,UACjB,OAAO,EAAE,YAAY,SAAS,YAAY,SAAS;AAAA,QACrD,CAAC;AAAA,QACD,WAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA,SAAQ;AAAA,QACR;AAAA,QACA;AAAA,QACC,GAAG;AAAA,QAEJ;AAAA,UAAC;AAAA;AAAA,YACC,eAAW,kBAAG,uBAAuB,SAAS;AAAA,YAC7C,GAAI,cAAc,SACf,uBAAuB,WAAW,QAAQ,IAC1C,CAAC;AAAA,YACJ,GAAG,gBAAgB,MAAM,GAAG;AAAA,YAC7B,SAAS,SAAS,UAAU;AAAA,YAC5B,MAAK;AAAA,YACL,SAAQ;AAAA,YACR,yBAAqB;AAAA,cACnB;AAAA,cACA,KAAK;AAAA,YACP;AAAA,YACA,OAAO;AAAA,YAEN;AAAA,4EACE,gBAAgB,6CAAC,sBAAmB,IAAK;AAAA,cAE3C;AAAA;AAAA;AAAA,QACH;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,eAAe,cAAc;AAC7B,eAAe,SAAS;","names":["import_core","import_utils","import_react","props","import_core","import_utils","import_jsx_runtime","import_jsx_runtime"]}
@@ -1,9 +1,9 @@
1
1
  "use client"
2
2
  import {
3
3
  PopoverContent
4
- } from "./chunk-RPAOBMYJ.mjs";
5
- import "./chunk-Y5OMCSRM.mjs";
6
- import "./chunk-JTIVIKPS.mjs";
4
+ } from "./chunk-5XOZKPK7.mjs";
5
+ import "./chunk-ZWCBPNYU.mjs";
6
+ import "./chunk-DSIIS6RK.mjs";
7
7
  export {
8
8
  PopoverContent
9
9
  };
@@ -81,11 +81,11 @@ var Popover = (props) => {
81
81
  ...rest
82
82
  } = (0, import_core.omitThemeProps)(mergedProps);
83
83
  const id = (0, import_react.useId)();
84
- const labelledbyId = (0, import_react.useId)();
85
- const describedbyId = (0, import_react.useId)();
86
84
  const { isOpen, onClose, onOpen, onToggle } = (0, import_use_disclosure.useDisclosure)(mergedProps);
87
85
  const anchorRef = (0, import_react.useRef)(null);
88
86
  const triggerRef = (0, import_react.useRef)(null);
87
+ const headerRef = (0, import_react.useRef)(null);
88
+ const bodyRef = (0, import_react.useRef)(null);
89
89
  const popoverRef = (0, import_react.useRef)(null);
90
90
  const { present, onAnimationComplete } = (0, import_use_animation.useAnimationObserver)({
91
91
  ref: popoverRef,
@@ -128,11 +128,12 @@ var Popover = (props) => {
128
128
  });
129
129
  const getPopoverProps = (0, import_react.useCallback)(
130
130
  (props2 = {}, ref = null) => {
131
+ var _a, _b;
131
132
  const popoverProps = {
132
133
  id,
133
- "aria-describedby": describedbyId,
134
+ "aria-describedby": (_a = bodyRef.current) == null ? void 0 : _a.id,
134
135
  "aria-hidden": !isOpen,
135
- "aria-labelledby": labelledbyId,
136
+ "aria-labelledby": (_b = headerRef.current) == null ? void 0 : _b.id,
136
137
  role: "dialog",
137
138
  ...props2,
138
139
  ref: (0, import_utils.mergeRefs)(popoverRef, ref),
@@ -176,9 +177,7 @@ var Popover = (props) => {
176
177
  transformOrigin,
177
178
  trigger,
178
179
  relatedRef,
179
- id,
180
- labelledbyId,
181
- describedbyId
180
+ id
182
181
  ]
183
182
  );
184
183
  const maybeReferenceRef = (0, import_react.useCallback)(
@@ -272,12 +271,12 @@ var Popover = (props) => {
272
271
  value: {
273
272
  id,
274
273
  animation,
274
+ bodyRef,
275
275
  closeOnButton,
276
- describedbyId,
277
276
  duration,
278
277
  forceUpdate,
278
+ headerRef,
279
279
  isOpen,
280
- labelledbyId,
281
280
  styles,
282
281
  getAnchorProps,
283
282
  getPopoverProps,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/popover-footer.tsx","../src/popover.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { usePopover } from \"./popover\"\n\nexport interface PopoverFooterProps extends HTMLUIProps<\"footer\"> {}\n\nexport const PopoverFooter = forwardRef<PopoverFooterProps, \"footer\">(\n ({ className, ...rest }, ref) => {\n const { styles } = usePopover()\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"flex\",\n justifyContent: \"flex-start\",\n ...styles.footer,\n }\n\n return (\n <ui.footer\n ref={ref}\n className={cx(\"ui-popover__footer\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nPopoverFooter.displayName = \"PopoverFooter\"\nPopoverFooter.__ui__ = \"PopoverFooter\"\n","import type {\n CSSUIObject,\n FC,\n HTMLUIPropsWithRef,\n PropGetter,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { MotionProps, MotionTransitionProps } from \"@yamada-ui/motion\"\nimport type { LazyMode } from \"@yamada-ui/use-disclosure\"\nimport type { UsePopperProps } from \"@yamada-ui/use-popper\"\nimport type {\n ComponentProps,\n PropsWithChildren,\n RefAttributes,\n RefObject,\n} from \"react\"\nimport { omitThemeProps, useComponentMultiStyle } from \"@yamada-ui/core\"\nimport { useAnimationObserver } from \"@yamada-ui/use-animation\"\nimport { useDisclosure, useLazyDisclosure } from \"@yamada-ui/use-disclosure\"\nimport {\n useFocusOnHide,\n useFocusOnPointerDown,\n useFocusOnShow,\n} from \"@yamada-ui/use-focus\"\nimport { popperProperties, usePopper } from \"@yamada-ui/use-popper\"\nimport {\n createContext,\n getEventRelatedTarget,\n handlerAll,\n isContains,\n mergeRefs,\n runIfFunc,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef } from \"react\"\n\nexport type PopoverProperty = (typeof popoverProperties)[number]\n\nexport const popoverProperties = [\n ...popperProperties,\n \"isOpen\",\n \"defaultIsOpen\",\n \"onOpen\",\n \"onClose\",\n \"initialFocusRef\",\n \"restoreFocus\",\n \"autoFocus\",\n \"closeOnBlur\",\n \"closeOnEsc\",\n \"closeOnButton\",\n \"trigger\",\n \"openDelay\",\n \"closeDelay\",\n \"isLazy\",\n \"lazyBehavior\",\n \"animation\",\n \"duration\",\n] as const\n\nexport interface ComboBoxProps\n extends Omit<\n PopoverOptions,\n | \"autoFocus\"\n | \"closeOnButton\"\n | \"initialFocusRef\"\n | \"relatedRef\"\n | \"restoreFocus\"\n | \"trigger\"\n >,\n Omit<UsePopperProps, \"enabled\"> {}\n\ninterface PopoverOptions {\n /**\n * The animation of the popover.\n *\n * @default 'scale'\n */\n animation?: \"bottom\" | \"left\" | \"none\" | \"right\" | \"scale\" | \"top\"\n /**\n * If `true`, focus will be transferred to the first interactive element when the popover opens.\n *\n * @default true\n */\n autoFocus?: boolean\n /**\n * The number of delay time to close.\n *\n * @default 200\n */\n closeDelay?: number\n /**\n * If `true`, the popover will close when you blur out it by clicking outside or tabbing out.\n *\n * @default true\n */\n closeOnBlur?: boolean\n /**\n * If `true`, display the popover close button.\n *\n * @default true\n */\n closeOnButton?: boolean\n /**\n * If `true`, the popover will close when you hit the `Esc` key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the popover will be initially opened.\n */\n defaultIsOpen?: boolean\n /**\n * The animation duration.\n */\n duration?: MotionTransitionProps[\"duration\"]\n /**\n * The `ref` of the element that should receive focus when the popover opens.\n */\n initialFocusRef?: RefObject<{ focus(): void }>\n /**\n * If `true`, the PopoverContent rendering will be deferred until the popover is open.\n *\n * @default false\n */\n isLazy?: boolean\n /**\n * If `true`, the popover will be opened.\n */\n isOpen?: boolean\n /**\n * The lazy behavior of popover's content when not visible. Only works when `isLazy={true}`\n *\n * - `unmount`: The popover's content is always unmounted when not open.\n * - `keepMounted`: The popover's content initially unmounted, but stays mounted when popover is open.\n *\n * @default 'unmount'\n */\n lazyBehavior?: LazyMode\n /**\n * The number of delay time to open.\n *\n * @default 200\n */\n openDelay?: number\n /**\n * The `ref` of the element related to the popover.\n * This is used during the `onBlur` event.\n */\n relatedRef?: RefObject<HTMLElement>\n /**\n * If `true`, focus will be returned to the element that triggers the popover when it closes.\n *\n * @default true\n */\n restoreFocus?: boolean\n /**\n * The interaction that triggers the popover.\n *\n * - `hover`: means the popover will open when you hover with mouse or focus with keyboard on the popover trigger.\n * - `click`: means the popover will open on click or press `Enter` to `Space` on keyboard.\n *\n * @default 'click'\n */\n trigger?: \"click\" | \"contextmenu\" | \"hover\" | \"never\"\n /**\n * Callback fired when the popover closes.\n */\n onClose?: () => void\n /**\n * Callback fired when the popover opens.\n */\n onOpen?: () => void\n}\n\nexport interface PopoverProps\n extends ThemeProps<\"Popover\">,\n Omit<UsePopperProps, \"enabled\">,\n PropsWithChildren<PopoverOptions> {}\n\ninterface PopoverContext\n extends Pick<\n PopoverOptions,\n \"animation\" | \"closeOnButton\" | \"duration\" | \"isOpen\" | \"onClose\"\n > {\n id: string\n describedbyId: string\n forceUpdate: () => undefined | void\n labelledbyId: string\n styles: { [key: string]: CSSUIObject | undefined }\n getAnchorProps: PropGetter\n getPopoverProps: PropGetter<MotionProps<\"section\">, MotionProps<\"section\">>\n getPopperProps: PropGetter<ComponentProps<\"div\">>\n getTriggerProps: PropGetter\n onAnimationComplete: () => void\n}\n\nconst [PopoverProvider, usePopover] = createContext<PopoverContext>({\n name: \"PopoverContext\",\n errorMessage: `usePopoverContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Popover />\"`,\n})\n\nexport { usePopover }\n\n/**\n * `Popover` is a component that floats around an element to display information.\n *\n * @see Docs https://yamada-ui.com/components/overlay/popover\n */\nexport const Popover: FC<PopoverProps> = (props) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Popover\", props)\n const {\n animation = \"scale\",\n autoFocus = true,\n children,\n closeDelay = 200,\n closeOnBlur = true,\n closeOnButton = true,\n closeOnEsc = true,\n duration,\n initialFocusRef,\n isLazy,\n lazyBehavior = \"unmount\",\n openDelay = 200,\n relatedRef,\n restoreFocus = true,\n trigger = \"click\",\n ...rest\n } = omitThemeProps(mergedProps)\n const id = useId()\n const labelledbyId = useId()\n const describedbyId = useId()\n const { isOpen, onClose, onOpen, onToggle } = useDisclosure(mergedProps)\n const anchorRef = useRef<HTMLElement>(null)\n const triggerRef = useRef<HTMLElement>(null)\n const popoverRef = useRef<HTMLElement>(null)\n const { present, onAnimationComplete } = useAnimationObserver({\n ref: popoverRef,\n isOpen,\n })\n const openTimeout = useRef<number | undefined>(undefined)\n const closeTimeout = useRef<number | undefined>(undefined)\n const isHoveringRef = useRef(false)\n const hasBeenOpened = useRef(false)\n const { forceUpdate, referenceRef, transformOrigin, getPopperProps } =\n usePopper({\n ...rest,\n enabled: isOpen,\n })\n\n if (isOpen) hasBeenOpened.current = true\n\n useEffect(() => {\n return () => {\n if (openTimeout.current) clearTimeout(openTimeout.current)\n\n if (closeTimeout.current) clearTimeout(closeTimeout.current)\n }\n }, [])\n\n useFocusOnPointerDown({\n ref: triggerRef,\n enabled: isOpen,\n })\n\n useFocusOnHide(popoverRef, {\n focusRef: triggerRef,\n shouldFocus:\n restoreFocus && (trigger === \"click\" || trigger === \"contextmenu\"),\n visible: isOpen,\n })\n\n useFocusOnShow(popoverRef, {\n focusRef: initialFocusRef,\n shouldFocus:\n autoFocus && (trigger === \"click\" || trigger === \"contextmenu\"),\n visible: isOpen,\n })\n\n const shouldRenderChildren = useLazyDisclosure({\n enabled: isLazy,\n isSelected: present,\n mode: lazyBehavior,\n wasSelected: hasBeenOpened.current,\n })\n\n const getPopoverProps: PropGetter<\n MotionProps<\"section\">,\n MotionProps<\"section\">\n > = useCallback(\n (props = {}, ref = null) => {\n const popoverProps: MotionProps & RefAttributes<any> = {\n id,\n \"aria-describedby\": describedbyId,\n \"aria-hidden\": !isOpen,\n \"aria-labelledby\": labelledbyId,\n role: \"dialog\",\n ...props,\n ref: mergeRefs(popoverRef, ref),\n style: {\n ...props.style,\n transformOrigin,\n },\n children: shouldRenderChildren ? props.children : null,\n tabIndex: -1,\n onBlur: handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const targetIsPopover = isContains(popoverRef.current, relatedTarget)\n const targetIsTrigger = isContains(triggerRef.current, relatedTarget)\n const targetIsRelated = relatedRef?.current\n ? isContains(relatedRef.current, relatedTarget)\n : false\n\n const isValidBlur =\n !targetIsPopover && !targetIsTrigger && !targetIsRelated\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n }),\n onKeyDown: handlerAll(props.onKeyDown, (ev) => {\n if (closeOnEsc && ev.key === \"Escape\") onClose()\n }),\n }\n\n if (trigger === \"hover\") {\n popoverProps.onMouseEnter = handlerAll(props.onMouseEnter, () => {\n isHoveringRef.current = true\n })\n\n popoverProps.onMouseLeave = handlerAll(props.onMouseLeave, (ev) => {\n if (ev.nativeEvent.relatedTarget === null) return\n\n isHoveringRef.current = false\n\n if (closeOnBlur) setTimeout(onClose, closeDelay)\n })\n }\n\n return popoverProps\n },\n [\n closeDelay,\n closeOnBlur,\n closeOnEsc,\n isOpen,\n onClose,\n shouldRenderChildren,\n transformOrigin,\n trigger,\n relatedRef,\n id,\n labelledbyId,\n describedbyId,\n ],\n )\n\n const maybeReferenceRef = useCallback(\n (node: Element) => {\n if (anchorRef.current == null) referenceRef(node)\n },\n [referenceRef],\n )\n\n const getTriggerProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n const triggerProps: HTMLUIPropsWithRef = {\n \"aria-controls\": isOpen ? id : undefined,\n \"aria-expanded\": isOpen,\n role: \"button\",\n ...props,\n ref: mergeRefs(triggerRef, ref, maybeReferenceRef),\n }\n\n if (trigger === \"click\") {\n triggerProps.onClick = handlerAll(props.onClick, onToggle)\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n }\n\n if (trigger === \"contextmenu\") {\n triggerProps.onContextMenu = handlerAll(props.onContextMenu, (ev) => {\n ev.preventDefault()\n onOpen()\n })\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n }\n\n if (trigger === \"hover\") {\n triggerProps.onFocus = handlerAll(props.onFocus, () => {\n if (openTimeout.current === undefined) onOpen()\n })\n\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n\n triggerProps.onKeyDown = handlerAll(props.onKeyDown, (ev) => {\n if (ev.key === \"Escape\") onClose()\n })\n\n triggerProps.onMouseEnter = handlerAll(props.onMouseEnter, () => {\n isHoveringRef.current = true\n openTimeout.current = window.setTimeout(onOpen, openDelay)\n })\n\n triggerProps.onMouseLeave = handlerAll(props.onMouseLeave, () => {\n isHoveringRef.current = false\n\n if (openTimeout.current) {\n clearTimeout(openTimeout.current)\n openTimeout.current = undefined\n }\n\n closeTimeout.current = window.setTimeout(() => {\n if (!isHoveringRef.current) onClose()\n }, closeDelay)\n })\n }\n\n return triggerProps\n },\n [\n closeDelay,\n closeOnBlur,\n isOpen,\n maybeReferenceRef,\n onClose,\n onOpen,\n onToggle,\n openDelay,\n trigger,\n id,\n ],\n )\n\n const getAnchorProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n return {\n ...props,\n ref: mergeRefs(ref, anchorRef, referenceRef),\n }\n },\n [anchorRef, referenceRef],\n )\n\n return (\n <PopoverProvider\n value={{\n id,\n animation,\n closeOnButton,\n describedbyId,\n duration,\n forceUpdate,\n isOpen,\n labelledbyId,\n styles,\n getAnchorProps,\n getPopoverProps,\n getPopperProps,\n getTriggerProps,\n onAnimationComplete,\n onClose,\n }}\n >\n {runIfFunc(children, {\n forceUpdate,\n isOpen,\n onClose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M,EAAE,OAAO,IAAI,WAAW;AAE9B,UAAM,MAAmB;AAAA,MACvB,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,gBAAgB;AAAA,MAChB,GAAG,OAAO;AAAA,IACZ;AAEA,WACE;AAAA,MAAC,gBAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,sBAAsB,SAAS;AAAA,QAC7C,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,cAAc,cAAc;AAC5B,cAAc,SAAS;","names":["import_core","import_utils","props","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../src/popover-footer.tsx","../src/popover.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { usePopover } from \"./popover\"\n\nexport interface PopoverFooterProps extends HTMLUIProps<\"footer\"> {}\n\nexport const PopoverFooter = forwardRef<PopoverFooterProps, \"footer\">(\n ({ className, ...rest }, ref) => {\n const { styles } = usePopover()\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"flex\",\n justifyContent: \"flex-start\",\n ...styles.footer,\n }\n\n return (\n <ui.footer\n ref={ref}\n className={cx(\"ui-popover__footer\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nPopoverFooter.displayName = \"PopoverFooter\"\nPopoverFooter.__ui__ = \"PopoverFooter\"\n","import type {\n CSSUIObject,\n FC,\n HTMLUIPropsWithRef,\n PropGetter,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { MotionProps, MotionTransitionProps } from \"@yamada-ui/motion\"\nimport type { LazyMode } from \"@yamada-ui/use-disclosure\"\nimport type { UsePopperProps } from \"@yamada-ui/use-popper\"\nimport type {\n ComponentProps,\n PropsWithChildren,\n RefAttributes,\n RefObject,\n} from \"react\"\nimport { omitThemeProps, useComponentMultiStyle } from \"@yamada-ui/core\"\nimport { useAnimationObserver } from \"@yamada-ui/use-animation\"\nimport { useDisclosure, useLazyDisclosure } from \"@yamada-ui/use-disclosure\"\nimport {\n useFocusOnHide,\n useFocusOnPointerDown,\n useFocusOnShow,\n} from \"@yamada-ui/use-focus\"\nimport { popperProperties, usePopper } from \"@yamada-ui/use-popper\"\nimport {\n createContext,\n getEventRelatedTarget,\n handlerAll,\n isContains,\n mergeRefs,\n runIfFunc,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef } from \"react\"\n\nexport type PopoverProperty = (typeof popoverProperties)[number]\n\nexport const popoverProperties = [\n ...popperProperties,\n \"isOpen\",\n \"defaultIsOpen\",\n \"onOpen\",\n \"onClose\",\n \"initialFocusRef\",\n \"restoreFocus\",\n \"autoFocus\",\n \"closeOnBlur\",\n \"closeOnEsc\",\n \"closeOnButton\",\n \"trigger\",\n \"openDelay\",\n \"closeDelay\",\n \"isLazy\",\n \"lazyBehavior\",\n \"animation\",\n \"duration\",\n] as const\n\nexport interface ComboBoxProps\n extends Omit<\n PopoverOptions,\n | \"autoFocus\"\n | \"closeOnButton\"\n | \"initialFocusRef\"\n | \"relatedRef\"\n | \"restoreFocus\"\n | \"trigger\"\n >,\n Omit<UsePopperProps, \"enabled\"> {}\n\ninterface PopoverOptions {\n /**\n * The animation of the popover.\n *\n * @default 'scale'\n */\n animation?: \"bottom\" | \"left\" | \"none\" | \"right\" | \"scale\" | \"top\"\n /**\n * If `true`, focus will be transferred to the first interactive element when the popover opens.\n *\n * @default true\n */\n autoFocus?: boolean\n /**\n * The number of delay time to close.\n *\n * @default 200\n */\n closeDelay?: number\n /**\n * If `true`, the popover will close when you blur out it by clicking outside or tabbing out.\n *\n * @default true\n */\n closeOnBlur?: boolean\n /**\n * If `true`, display the popover close button.\n *\n * @default true\n */\n closeOnButton?: boolean\n /**\n * If `true`, the popover will close when you hit the `Esc` key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the popover will be initially opened.\n */\n defaultIsOpen?: boolean\n /**\n * The animation duration.\n */\n duration?: MotionTransitionProps[\"duration\"]\n /**\n * The `ref` of the element that should receive focus when the popover opens.\n */\n initialFocusRef?: RefObject<{ focus(): void }>\n /**\n * If `true`, the PopoverContent rendering will be deferred until the popover is open.\n *\n * @default false\n */\n isLazy?: boolean\n /**\n * If `true`, the popover will be opened.\n */\n isOpen?: boolean\n /**\n * The lazy behavior of popover's content when not visible. Only works when `isLazy={true}`\n *\n * - `unmount`: The popover's content is always unmounted when not open.\n * - `keepMounted`: The popover's content initially unmounted, but stays mounted when popover is open.\n *\n * @default 'unmount'\n */\n lazyBehavior?: LazyMode\n /**\n * The number of delay time to open.\n *\n * @default 200\n */\n openDelay?: number\n /**\n * The `ref` of the element related to the popover.\n * This is used during the `onBlur` event.\n */\n relatedRef?: RefObject<HTMLElement>\n /**\n * If `true`, focus will be returned to the element that triggers the popover when it closes.\n *\n * @default true\n */\n restoreFocus?: boolean\n /**\n * The interaction that triggers the popover.\n *\n * - `hover`: means the popover will open when you hover with mouse or focus with keyboard on the popover trigger.\n * - `click`: means the popover will open on click or press `Enter` to `Space` on keyboard.\n *\n * @default 'click'\n */\n trigger?: \"click\" | \"contextmenu\" | \"hover\" | \"never\"\n /**\n * Callback fired when the popover closes.\n */\n onClose?: () => void\n /**\n * Callback fired when the popover opens.\n */\n onOpen?: () => void\n}\n\nexport interface PopoverProps\n extends ThemeProps<\"Popover\">,\n Omit<UsePopperProps, \"enabled\">,\n PropsWithChildren<PopoverOptions> {}\n\ninterface PopoverContext\n extends Pick<\n PopoverOptions,\n \"animation\" | \"closeOnButton\" | \"duration\" | \"isOpen\" | \"onClose\"\n > {\n id: string\n bodyRef: RefObject<HTMLElement>\n forceUpdate: () => undefined | void\n headerRef: RefObject<HTMLElement>\n styles: { [key: string]: CSSUIObject | undefined }\n getAnchorProps: PropGetter\n getPopoverProps: PropGetter<MotionProps<\"section\">, MotionProps<\"section\">>\n getPopperProps: PropGetter<ComponentProps<\"div\">>\n getTriggerProps: PropGetter\n onAnimationComplete: () => void\n}\n\nconst [PopoverProvider, usePopover] = createContext<PopoverContext>({\n name: \"PopoverContext\",\n errorMessage: `usePopoverContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Popover />\"`,\n})\n\nexport { usePopover }\n\n/**\n * `Popover` is a component that floats around an element to display information.\n *\n * @see Docs https://yamada-ui.com/components/overlay/popover\n */\nexport const Popover: FC<PopoverProps> = (props) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Popover\", props)\n const {\n animation = \"scale\",\n autoFocus = true,\n children,\n closeDelay = 200,\n closeOnBlur = true,\n closeOnButton = true,\n closeOnEsc = true,\n duration,\n initialFocusRef,\n isLazy,\n lazyBehavior = \"unmount\",\n openDelay = 200,\n relatedRef,\n restoreFocus = true,\n trigger = \"click\",\n ...rest\n } = omitThemeProps(mergedProps)\n const id = useId()\n const { isOpen, onClose, onOpen, onToggle } = useDisclosure(mergedProps)\n const anchorRef = useRef<HTMLElement>(null)\n const triggerRef = useRef<HTMLElement>(null)\n const headerRef = useRef<HTMLElement>(null)\n const bodyRef = useRef<HTMLElement>(null)\n const popoverRef = useRef<HTMLElement>(null)\n const { present, onAnimationComplete } = useAnimationObserver({\n ref: popoverRef,\n isOpen,\n })\n const openTimeout = useRef<number | undefined>(undefined)\n const closeTimeout = useRef<number | undefined>(undefined)\n const isHoveringRef = useRef(false)\n const hasBeenOpened = useRef(false)\n const { forceUpdate, referenceRef, transformOrigin, getPopperProps } =\n usePopper({\n ...rest,\n enabled: isOpen,\n })\n\n if (isOpen) hasBeenOpened.current = true\n\n useEffect(() => {\n return () => {\n if (openTimeout.current) clearTimeout(openTimeout.current)\n\n if (closeTimeout.current) clearTimeout(closeTimeout.current)\n }\n }, [])\n\n useFocusOnPointerDown({\n ref: triggerRef,\n enabled: isOpen,\n })\n\n useFocusOnHide(popoverRef, {\n focusRef: triggerRef,\n shouldFocus:\n restoreFocus && (trigger === \"click\" || trigger === \"contextmenu\"),\n visible: isOpen,\n })\n\n useFocusOnShow(popoverRef, {\n focusRef: initialFocusRef,\n shouldFocus:\n autoFocus && (trigger === \"click\" || trigger === \"contextmenu\"),\n visible: isOpen,\n })\n\n const shouldRenderChildren = useLazyDisclosure({\n enabled: isLazy,\n isSelected: present,\n mode: lazyBehavior,\n wasSelected: hasBeenOpened.current,\n })\n\n const getPopoverProps: PropGetter<\n MotionProps<\"section\">,\n MotionProps<\"section\">\n > = useCallback(\n (props = {}, ref = null) => {\n const popoverProps: MotionProps & RefAttributes<any> = {\n id,\n \"aria-describedby\": bodyRef.current?.id,\n \"aria-hidden\": !isOpen,\n \"aria-labelledby\": headerRef.current?.id,\n role: \"dialog\",\n ...props,\n ref: mergeRefs(popoverRef, ref),\n style: {\n ...props.style,\n transformOrigin,\n },\n children: shouldRenderChildren ? props.children : null,\n tabIndex: -1,\n onBlur: handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const targetIsPopover = isContains(popoverRef.current, relatedTarget)\n const targetIsTrigger = isContains(triggerRef.current, relatedTarget)\n const targetIsRelated = relatedRef?.current\n ? isContains(relatedRef.current, relatedTarget)\n : false\n\n const isValidBlur =\n !targetIsPopover && !targetIsTrigger && !targetIsRelated\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n }),\n onKeyDown: handlerAll(props.onKeyDown, (ev) => {\n if (closeOnEsc && ev.key === \"Escape\") onClose()\n }),\n }\n\n if (trigger === \"hover\") {\n popoverProps.onMouseEnter = handlerAll(props.onMouseEnter, () => {\n isHoveringRef.current = true\n })\n\n popoverProps.onMouseLeave = handlerAll(props.onMouseLeave, (ev) => {\n if (ev.nativeEvent.relatedTarget === null) return\n\n isHoveringRef.current = false\n\n if (closeOnBlur) setTimeout(onClose, closeDelay)\n })\n }\n\n return popoverProps\n },\n [\n closeDelay,\n closeOnBlur,\n closeOnEsc,\n isOpen,\n onClose,\n shouldRenderChildren,\n transformOrigin,\n trigger,\n relatedRef,\n id,\n ],\n )\n\n const maybeReferenceRef = useCallback(\n (node: Element) => {\n if (anchorRef.current == null) referenceRef(node)\n },\n [referenceRef],\n )\n\n const getTriggerProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n const triggerProps: HTMLUIPropsWithRef = {\n \"aria-controls\": isOpen ? id : undefined,\n \"aria-expanded\": isOpen,\n role: \"button\",\n ...props,\n ref: mergeRefs(triggerRef, ref, maybeReferenceRef),\n }\n\n if (trigger === \"click\") {\n triggerProps.onClick = handlerAll(props.onClick, onToggle)\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n }\n\n if (trigger === \"contextmenu\") {\n triggerProps.onContextMenu = handlerAll(props.onContextMenu, (ev) => {\n ev.preventDefault()\n onOpen()\n })\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n }\n\n if (trigger === \"hover\") {\n triggerProps.onFocus = handlerAll(props.onFocus, () => {\n if (openTimeout.current === undefined) onOpen()\n })\n\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n\n triggerProps.onKeyDown = handlerAll(props.onKeyDown, (ev) => {\n if (ev.key === \"Escape\") onClose()\n })\n\n triggerProps.onMouseEnter = handlerAll(props.onMouseEnter, () => {\n isHoveringRef.current = true\n openTimeout.current = window.setTimeout(onOpen, openDelay)\n })\n\n triggerProps.onMouseLeave = handlerAll(props.onMouseLeave, () => {\n isHoveringRef.current = false\n\n if (openTimeout.current) {\n clearTimeout(openTimeout.current)\n openTimeout.current = undefined\n }\n\n closeTimeout.current = window.setTimeout(() => {\n if (!isHoveringRef.current) onClose()\n }, closeDelay)\n })\n }\n\n return triggerProps\n },\n [\n closeDelay,\n closeOnBlur,\n isOpen,\n maybeReferenceRef,\n onClose,\n onOpen,\n onToggle,\n openDelay,\n trigger,\n id,\n ],\n )\n\n const getAnchorProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n return {\n ...props,\n ref: mergeRefs(ref, anchorRef, referenceRef),\n }\n },\n [anchorRef, referenceRef],\n )\n\n return (\n <PopoverProvider\n value={{\n id,\n animation,\n bodyRef,\n closeOnButton,\n duration,\n forceUpdate,\n headerRef,\n isOpen,\n styles,\n getAnchorProps,\n getPopoverProps,\n getPopperProps,\n getTriggerProps,\n onAnimationComplete,\n onClose,\n }}\n >\n {runIfFunc(children, {\n forceUpdate,\n isOpen,\n onClose,\n })}\n </PopoverProvider>\n )\n}\n\nPopover.displayName = \"Popover\"\nPopover.__ui__ = \"Popover\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,eAA+B;AAC/B,IAAAC,gBAAmB;;;ACcnB,kBAAuD;AACvD,2BAAqC;AACrC,4BAAiD;AACjD,uBAIO;AACP,wBAA4C;AAC5C,mBAOO;AACP,mBAAsD;AAqalD;AAjaG,IAAM,oBAAoB;AAAA,EAC/B,GAAG;AAAA,EACH;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AA4IA,IAAM,CAAC,iBAAiB,UAAU,QAAI,4BAA8B;AAAA,EAClE,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AASM,IAAM,UAA4B,CAAC,UAAU;AAClD,QAAM,CAAC,QAAQ,WAAW,QAAI,oCAAuB,WAAW,KAAK;AACrE,QAAM;AAAA,IACJ,YAAY;AAAA,IAC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AA,MAC7C;AAAA,IACF;AAAA,IACA,CAAC,WAAW,YAAY;AAAA,EAC1B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEC,sCAAU,UAAU;AAAA,QACnB;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA;AAAA,EACH;AAEJ;AAEA,QAAQ,cAAc;AACtB,QAAQ,SAAS;;;ADhdX,IAAAC,sBAAA;AAZC,IAAM,oBAAgB;AAAA,EAC3B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,UAAM,EAAE,OAAO,IAAI,WAAW;AAE9B,UAAM,MAAmB;AAAA,MACvB,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,gBAAgB;AAAA,MAChB,GAAG,OAAO;AAAA,IACZ;AAEA,WACE;AAAA,MAAC,gBAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,sBAAsB,SAAS;AAAA,QAC7C,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,cAAc,cAAc;AAC5B,cAAc,SAAS;","names":["import_core","import_utils","props","import_jsx_runtime"]}
@@ -1,8 +1,8 @@
1
1
  "use client"
2
2
  import {
3
3
  PopoverFooter
4
- } from "./chunk-TKYA7E3C.mjs";
5
- import "./chunk-JTIVIKPS.mjs";
4
+ } from "./chunk-MAIEILC4.mjs";
5
+ import "./chunk-DSIIS6RK.mjs";
6
6
  export {
7
7
  PopoverFooter
8
8
  };
@@ -81,11 +81,11 @@ var Popover = (props) => {
81
81
  ...rest
82
82
  } = (0, import_core.omitThemeProps)(mergedProps);
83
83
  const id = (0, import_react.useId)();
84
- const labelledbyId = (0, import_react.useId)();
85
- const describedbyId = (0, import_react.useId)();
86
84
  const { isOpen, onClose, onOpen, onToggle } = (0, import_use_disclosure.useDisclosure)(mergedProps);
87
85
  const anchorRef = (0, import_react.useRef)(null);
88
86
  const triggerRef = (0, import_react.useRef)(null);
87
+ const headerRef = (0, import_react.useRef)(null);
88
+ const bodyRef = (0, import_react.useRef)(null);
89
89
  const popoverRef = (0, import_react.useRef)(null);
90
90
  const { present, onAnimationComplete } = (0, import_use_animation.useAnimationObserver)({
91
91
  ref: popoverRef,
@@ -128,11 +128,12 @@ var Popover = (props) => {
128
128
  });
129
129
  const getPopoverProps = (0, import_react.useCallback)(
130
130
  (props2 = {}, ref = null) => {
131
+ var _a, _b;
131
132
  const popoverProps = {
132
133
  id,
133
- "aria-describedby": describedbyId,
134
+ "aria-describedby": (_a = bodyRef.current) == null ? void 0 : _a.id,
134
135
  "aria-hidden": !isOpen,
135
- "aria-labelledby": labelledbyId,
136
+ "aria-labelledby": (_b = headerRef.current) == null ? void 0 : _b.id,
136
137
  role: "dialog",
137
138
  ...props2,
138
139
  ref: (0, import_utils.mergeRefs)(popoverRef, ref),
@@ -176,9 +177,7 @@ var Popover = (props) => {
176
177
  transformOrigin,
177
178
  trigger,
178
179
  relatedRef,
179
- id,
180
- labelledbyId,
181
- describedbyId
180
+ id
182
181
  ]
183
182
  );
184
183
  const maybeReferenceRef = (0, import_react.useCallback)(
@@ -272,12 +271,12 @@ var Popover = (props) => {
272
271
  value: {
273
272
  id,
274
273
  animation,
274
+ bodyRef,
275
275
  closeOnButton,
276
- describedbyId,
277
276
  duration,
278
277
  forceUpdate,
278
+ headerRef,
279
279
  isOpen,
280
- labelledbyId,
281
280
  styles,
282
281
  getAnchorProps,
283
282
  getPopoverProps,
@@ -301,7 +300,7 @@ Popover.__ui__ = "Popover";
301
300
  var import_jsx_runtime2 = require("react/jsx-runtime");
302
301
  var PopoverHeader = (0, import_core2.forwardRef)(
303
302
  ({ className, ...rest }, ref) => {
304
- const { labelledbyId, styles } = usePopover();
303
+ const { headerRef, styles } = usePopover();
305
304
  const css = {
306
305
  alignItems: "center",
307
306
  display: "flex",
@@ -311,8 +310,7 @@ var PopoverHeader = (0, import_core2.forwardRef)(
311
310
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
312
311
  import_core2.ui.header,
313
312
  {
314
- id: labelledbyId,
315
- ref,
313
+ ref: (0, import_utils2.mergeRefs)(headerRef, ref),
316
314
  className: (0, import_utils2.cx)("ui-popover__header", className),
317
315
  __css: css,
318
316
  ...rest
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/popover-header.tsx","../src/popover.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { usePopover } from \"./popover\"\n\nexport interface PopoverHeaderProps extends HTMLUIProps<\"header\"> {}\n\nexport const PopoverHeader = forwardRef<PopoverHeaderProps, \"header\">(\n ({ className, ...rest }, ref) => {\n const { labelledbyId, styles } = usePopover()\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"flex\",\n justifyContent: \"flex-start\",\n ...styles.header,\n }\n\n return (\n <ui.header\n id={labelledbyId}\n ref={ref}\n className={cx(\"ui-popover__header\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nPopoverHeader.displayName = \"PopoverHeader\"\nPopoverHeader.__ui__ = \"PopoverHeader\"\n","import type {\n CSSUIObject,\n FC,\n HTMLUIPropsWithRef,\n PropGetter,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { MotionProps, MotionTransitionProps } from \"@yamada-ui/motion\"\nimport type { LazyMode } from \"@yamada-ui/use-disclosure\"\nimport type { UsePopperProps } from \"@yamada-ui/use-popper\"\nimport type {\n ComponentProps,\n PropsWithChildren,\n RefAttributes,\n RefObject,\n} from \"react\"\nimport { omitThemeProps, useComponentMultiStyle } from \"@yamada-ui/core\"\nimport { useAnimationObserver } from \"@yamada-ui/use-animation\"\nimport { useDisclosure, useLazyDisclosure } from \"@yamada-ui/use-disclosure\"\nimport {\n useFocusOnHide,\n useFocusOnPointerDown,\n useFocusOnShow,\n} from \"@yamada-ui/use-focus\"\nimport { popperProperties, usePopper } from \"@yamada-ui/use-popper\"\nimport {\n createContext,\n getEventRelatedTarget,\n handlerAll,\n isContains,\n mergeRefs,\n runIfFunc,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef } from \"react\"\n\nexport type PopoverProperty = (typeof popoverProperties)[number]\n\nexport const popoverProperties = [\n ...popperProperties,\n \"isOpen\",\n \"defaultIsOpen\",\n \"onOpen\",\n \"onClose\",\n \"initialFocusRef\",\n \"restoreFocus\",\n \"autoFocus\",\n \"closeOnBlur\",\n \"closeOnEsc\",\n \"closeOnButton\",\n \"trigger\",\n \"openDelay\",\n \"closeDelay\",\n \"isLazy\",\n \"lazyBehavior\",\n \"animation\",\n \"duration\",\n] as const\n\nexport interface ComboBoxProps\n extends Omit<\n PopoverOptions,\n | \"autoFocus\"\n | \"closeOnButton\"\n | \"initialFocusRef\"\n | \"relatedRef\"\n | \"restoreFocus\"\n | \"trigger\"\n >,\n Omit<UsePopperProps, \"enabled\"> {}\n\ninterface PopoverOptions {\n /**\n * The animation of the popover.\n *\n * @default 'scale'\n */\n animation?: \"bottom\" | \"left\" | \"none\" | \"right\" | \"scale\" | \"top\"\n /**\n * If `true`, focus will be transferred to the first interactive element when the popover opens.\n *\n * @default true\n */\n autoFocus?: boolean\n /**\n * The number of delay time to close.\n *\n * @default 200\n */\n closeDelay?: number\n /**\n * If `true`, the popover will close when you blur out it by clicking outside or tabbing out.\n *\n * @default true\n */\n closeOnBlur?: boolean\n /**\n * If `true`, display the popover close button.\n *\n * @default true\n */\n closeOnButton?: boolean\n /**\n * If `true`, the popover will close when you hit the `Esc` key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the popover will be initially opened.\n */\n defaultIsOpen?: boolean\n /**\n * The animation duration.\n */\n duration?: MotionTransitionProps[\"duration\"]\n /**\n * The `ref` of the element that should receive focus when the popover opens.\n */\n initialFocusRef?: RefObject<{ focus(): void }>\n /**\n * If `true`, the PopoverContent rendering will be deferred until the popover is open.\n *\n * @default false\n */\n isLazy?: boolean\n /**\n * If `true`, the popover will be opened.\n */\n isOpen?: boolean\n /**\n * The lazy behavior of popover's content when not visible. Only works when `isLazy={true}`\n *\n * - `unmount`: The popover's content is always unmounted when not open.\n * - `keepMounted`: The popover's content initially unmounted, but stays mounted when popover is open.\n *\n * @default 'unmount'\n */\n lazyBehavior?: LazyMode\n /**\n * The number of delay time to open.\n *\n * @default 200\n */\n openDelay?: number\n /**\n * The `ref` of the element related to the popover.\n * This is used during the `onBlur` event.\n */\n relatedRef?: RefObject<HTMLElement>\n /**\n * If `true`, focus will be returned to the element that triggers the popover when it closes.\n *\n * @default true\n */\n restoreFocus?: boolean\n /**\n * The interaction that triggers the popover.\n *\n * - `hover`: means the popover will open when you hover with mouse or focus with keyboard on the popover trigger.\n * - `click`: means the popover will open on click or press `Enter` to `Space` on keyboard.\n *\n * @default 'click'\n */\n trigger?: \"click\" | \"contextmenu\" | \"hover\" | \"never\"\n /**\n * Callback fired when the popover closes.\n */\n onClose?: () => void\n /**\n * Callback fired when the popover opens.\n */\n onOpen?: () => void\n}\n\nexport interface PopoverProps\n extends ThemeProps<\"Popover\">,\n Omit<UsePopperProps, \"enabled\">,\n PropsWithChildren<PopoverOptions> {}\n\ninterface PopoverContext\n extends Pick<\n PopoverOptions,\n \"animation\" | \"closeOnButton\" | \"duration\" | \"isOpen\" | \"onClose\"\n > {\n id: string\n describedbyId: string\n forceUpdate: () => undefined | void\n labelledbyId: string\n styles: { [key: string]: CSSUIObject | undefined }\n getAnchorProps: PropGetter\n getPopoverProps: PropGetter<MotionProps<\"section\">, MotionProps<\"section\">>\n getPopperProps: PropGetter<ComponentProps<\"div\">>\n getTriggerProps: PropGetter\n onAnimationComplete: () => void\n}\n\nconst [PopoverProvider, usePopover] = createContext<PopoverContext>({\n name: \"PopoverContext\",\n errorMessage: `usePopoverContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Popover />\"`,\n})\n\nexport { usePopover }\n\n/**\n * `Popover` is a component that floats around an element to display information.\n *\n * @see Docs https://yamada-ui.com/components/overlay/popover\n */\nexport const Popover: FC<PopoverProps> = (props) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Popover\", props)\n const {\n animation = \"scale\",\n autoFocus = true,\n children,\n closeDelay = 200,\n closeOnBlur = true,\n closeOnButton = true,\n closeOnEsc = true,\n duration,\n initialFocusRef,\n isLazy,\n lazyBehavior = \"unmount\",\n openDelay = 200,\n relatedRef,\n restoreFocus = true,\n trigger = \"click\",\n ...rest\n } = omitThemeProps(mergedProps)\n const id = useId()\n const labelledbyId = useId()\n const describedbyId = useId()\n const { isOpen, onClose, onOpen, onToggle } = useDisclosure(mergedProps)\n const anchorRef = useRef<HTMLElement>(null)\n const triggerRef = useRef<HTMLElement>(null)\n const popoverRef = useRef<HTMLElement>(null)\n const { present, onAnimationComplete } = useAnimationObserver({\n ref: popoverRef,\n isOpen,\n })\n const openTimeout = useRef<number | undefined>(undefined)\n const closeTimeout = useRef<number | undefined>(undefined)\n const isHoveringRef = useRef(false)\n const hasBeenOpened = useRef(false)\n const { forceUpdate, referenceRef, transformOrigin, getPopperProps } =\n usePopper({\n ...rest,\n enabled: isOpen,\n })\n\n if (isOpen) hasBeenOpened.current = true\n\n useEffect(() => {\n return () => {\n if (openTimeout.current) clearTimeout(openTimeout.current)\n\n if (closeTimeout.current) clearTimeout(closeTimeout.current)\n }\n }, [])\n\n useFocusOnPointerDown({\n ref: triggerRef,\n enabled: isOpen,\n })\n\n useFocusOnHide(popoverRef, {\n focusRef: triggerRef,\n shouldFocus:\n restoreFocus && (trigger === \"click\" || trigger === \"contextmenu\"),\n visible: isOpen,\n })\n\n useFocusOnShow(popoverRef, {\n focusRef: initialFocusRef,\n shouldFocus:\n autoFocus && (trigger === \"click\" || trigger === \"contextmenu\"),\n visible: isOpen,\n })\n\n const shouldRenderChildren = useLazyDisclosure({\n enabled: isLazy,\n isSelected: present,\n mode: lazyBehavior,\n wasSelected: hasBeenOpened.current,\n })\n\n const getPopoverProps: PropGetter<\n MotionProps<\"section\">,\n MotionProps<\"section\">\n > = useCallback(\n (props = {}, ref = null) => {\n const popoverProps: MotionProps & RefAttributes<any> = {\n id,\n \"aria-describedby\": describedbyId,\n \"aria-hidden\": !isOpen,\n \"aria-labelledby\": labelledbyId,\n role: \"dialog\",\n ...props,\n ref: mergeRefs(popoverRef, ref),\n style: {\n ...props.style,\n transformOrigin,\n },\n children: shouldRenderChildren ? props.children : null,\n tabIndex: -1,\n onBlur: handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const targetIsPopover = isContains(popoverRef.current, relatedTarget)\n const targetIsTrigger = isContains(triggerRef.current, relatedTarget)\n const targetIsRelated = relatedRef?.current\n ? isContains(relatedRef.current, relatedTarget)\n : false\n\n const isValidBlur =\n !targetIsPopover && !targetIsTrigger && !targetIsRelated\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n }),\n onKeyDown: handlerAll(props.onKeyDown, (ev) => {\n if (closeOnEsc && ev.key === \"Escape\") onClose()\n }),\n }\n\n if (trigger === \"hover\") {\n popoverProps.onMouseEnter = handlerAll(props.onMouseEnter, () => {\n isHoveringRef.current = true\n })\n\n popoverProps.onMouseLeave = handlerAll(props.onMouseLeave, (ev) => {\n if (ev.nativeEvent.relatedTarget === null) return\n\n isHoveringRef.current = false\n\n if (closeOnBlur) setTimeout(onClose, closeDelay)\n })\n }\n\n return popoverProps\n },\n [\n closeDelay,\n closeOnBlur,\n closeOnEsc,\n isOpen,\n onClose,\n shouldRenderChildren,\n transformOrigin,\n trigger,\n relatedRef,\n id,\n labelledbyId,\n describedbyId,\n ],\n )\n\n const maybeReferenceRef = useCallback(\n (node: Element) => {\n if (anchorRef.current == null) referenceRef(node)\n },\n [referenceRef],\n )\n\n const getTriggerProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n const triggerProps: HTMLUIPropsWithRef = {\n \"aria-controls\": isOpen ? id : undefined,\n \"aria-expanded\": isOpen,\n role: \"button\",\n ...props,\n ref: mergeRefs(triggerRef, ref, maybeReferenceRef),\n }\n\n if (trigger === \"click\") {\n triggerProps.onClick = handlerAll(props.onClick, onToggle)\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n }\n\n if (trigger === \"contextmenu\") {\n triggerProps.onContextMenu = handlerAll(props.onContextMenu, (ev) => {\n ev.preventDefault()\n onOpen()\n })\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n }\n\n if (trigger === \"hover\") {\n triggerProps.onFocus = handlerAll(props.onFocus, () => {\n if (openTimeout.current === undefined) onOpen()\n })\n\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n\n triggerProps.onKeyDown = handlerAll(props.onKeyDown, (ev) => {\n if (ev.key === \"Escape\") onClose()\n })\n\n triggerProps.onMouseEnter = handlerAll(props.onMouseEnter, () => {\n isHoveringRef.current = true\n openTimeout.current = window.setTimeout(onOpen, openDelay)\n })\n\n triggerProps.onMouseLeave = handlerAll(props.onMouseLeave, () => {\n isHoveringRef.current = false\n\n if (openTimeout.current) {\n clearTimeout(openTimeout.current)\n openTimeout.current = undefined\n }\n\n closeTimeout.current = window.setTimeout(() => {\n if (!isHoveringRef.current) onClose()\n }, closeDelay)\n })\n }\n\n return triggerProps\n },\n [\n closeDelay,\n closeOnBlur,\n isOpen,\n maybeReferenceRef,\n onClose,\n onOpen,\n onToggle,\n openDelay,\n trigger,\n id,\n ],\n )\n\n const getAnchorProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n return {\n ...props,\n ref: mergeRefs(ref, anchorRef, referenceRef),\n }\n },\n [anchorRef, referenceRef],\n )\n\n return (\n <PopoverProvider\n value={{\n id,\n animation,\n closeOnButton,\n describedbyId,\n duration,\n forceUpdate,\n isOpen,\n labelledbyId,\n styles,\n getAnchorProps,\n getPopoverProps,\n getPopperProps,\n getTriggerProps,\n onAnimationComplete,\n onClose,\n }}\n >\n {runIfFunc(children, {\n forceUpdate,\n isOpen,\n onClose,\n })}\n </PopoverProvider>\n )\n}\n\nPopover.displayName = \"Popover\"\nPopover.__ui__ = \"Popover\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,eAA+B;AAC/B,IAAAC,gBAAmB;;;ACcnB,kBAAuD;AACvD,2BAAqC;AACrC,4BAAiD;AACjD,uBAIO;AACP,wBAA4C;AAC5C,mBAOO;AACP,mBAAsD;AAualD;AAnaG,IAAM,oBAAoB;AAAA,EAC/B,GAAG;AAAA,EACH;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AA4IA,IAAM,CAAC,iBAAiB,UAAU,QAAI,4BAA8B;AAAA,EAClE,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AASM,IAAM,UAA4B,CAAC,UAAU;AAClD,QAAM,CAAC,QAAQ,WAAW,QAAI,oCAAuB,WAAW,KAAK;AACrE,QAAM;AAAA,IACJ,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ;AAAA,IACA,aAAa;AAA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IAAC;AAAA;AAAA,MACC,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MAEC,sCAAU,UAAU;AAAA,QACnB;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA;AAAA,EACH;AAEJ;AAEA,QAAQ,cAAc;AACtB,QAAQ,SAAS;;;ADldX,IAAAC,sBAAA;AAZC,IAAM,oBAAgB;AAAA,EAC3B,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,UAAM,EAAE,cAAc,OAAO,IAAI,WAAW;AAE5C,UAAM,MAAmB;AAAA,MACvB,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,gBAAgB;AAAA,MAChB,GAAG,OAAO;AAAA,IACZ;AAEA,WACE;AAAA,MAAC,gBAAG;AAAA,MAAH;AAAA,QACC,IAAI;AAAA,QACJ;AAAA,QACA,eAAW,kBAAG,sBAAsB,SAAS;AAAA,QAC7C,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,cAAc,cAAc;AAC5B,cAAc,SAAS;","names":["import_core","import_utils","props","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../src/popover-header.tsx","../src/popover.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { cx, mergeRefs } from \"@yamada-ui/utils\"\nimport { usePopover } from \"./popover\"\n\nexport interface PopoverHeaderProps extends HTMLUIProps<\"header\"> {}\n\nexport const PopoverHeader = forwardRef<PopoverHeaderProps, \"header\">(\n ({ className, ...rest }, ref) => {\n const { headerRef, styles } = usePopover()\n\n const css: CSSUIObject = {\n alignItems: \"center\",\n display: \"flex\",\n justifyContent: \"flex-start\",\n ...styles.header,\n }\n\n return (\n <ui.header\n ref={mergeRefs(headerRef, ref)}\n className={cx(\"ui-popover__header\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nPopoverHeader.displayName = \"PopoverHeader\"\nPopoverHeader.__ui__ = \"PopoverHeader\"\n","import type {\n CSSUIObject,\n FC,\n HTMLUIPropsWithRef,\n PropGetter,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport type { MotionProps, MotionTransitionProps } from \"@yamada-ui/motion\"\nimport type { LazyMode } from \"@yamada-ui/use-disclosure\"\nimport type { UsePopperProps } from \"@yamada-ui/use-popper\"\nimport type {\n ComponentProps,\n PropsWithChildren,\n RefAttributes,\n RefObject,\n} from \"react\"\nimport { omitThemeProps, useComponentMultiStyle } from \"@yamada-ui/core\"\nimport { useAnimationObserver } from \"@yamada-ui/use-animation\"\nimport { useDisclosure, useLazyDisclosure } from \"@yamada-ui/use-disclosure\"\nimport {\n useFocusOnHide,\n useFocusOnPointerDown,\n useFocusOnShow,\n} from \"@yamada-ui/use-focus\"\nimport { popperProperties, usePopper } from \"@yamada-ui/use-popper\"\nimport {\n createContext,\n getEventRelatedTarget,\n handlerAll,\n isContains,\n mergeRefs,\n runIfFunc,\n} from \"@yamada-ui/utils\"\nimport { useCallback, useEffect, useId, useRef } from \"react\"\n\nexport type PopoverProperty = (typeof popoverProperties)[number]\n\nexport const popoverProperties = [\n ...popperProperties,\n \"isOpen\",\n \"defaultIsOpen\",\n \"onOpen\",\n \"onClose\",\n \"initialFocusRef\",\n \"restoreFocus\",\n \"autoFocus\",\n \"closeOnBlur\",\n \"closeOnEsc\",\n \"closeOnButton\",\n \"trigger\",\n \"openDelay\",\n \"closeDelay\",\n \"isLazy\",\n \"lazyBehavior\",\n \"animation\",\n \"duration\",\n] as const\n\nexport interface ComboBoxProps\n extends Omit<\n PopoverOptions,\n | \"autoFocus\"\n | \"closeOnButton\"\n | \"initialFocusRef\"\n | \"relatedRef\"\n | \"restoreFocus\"\n | \"trigger\"\n >,\n Omit<UsePopperProps, \"enabled\"> {}\n\ninterface PopoverOptions {\n /**\n * The animation of the popover.\n *\n * @default 'scale'\n */\n animation?: \"bottom\" | \"left\" | \"none\" | \"right\" | \"scale\" | \"top\"\n /**\n * If `true`, focus will be transferred to the first interactive element when the popover opens.\n *\n * @default true\n */\n autoFocus?: boolean\n /**\n * The number of delay time to close.\n *\n * @default 200\n */\n closeDelay?: number\n /**\n * If `true`, the popover will close when you blur out it by clicking outside or tabbing out.\n *\n * @default true\n */\n closeOnBlur?: boolean\n /**\n * If `true`, display the popover close button.\n *\n * @default true\n */\n closeOnButton?: boolean\n /**\n * If `true`, the popover will close when you hit the `Esc` key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the popover will be initially opened.\n */\n defaultIsOpen?: boolean\n /**\n * The animation duration.\n */\n duration?: MotionTransitionProps[\"duration\"]\n /**\n * The `ref` of the element that should receive focus when the popover opens.\n */\n initialFocusRef?: RefObject<{ focus(): void }>\n /**\n * If `true`, the PopoverContent rendering will be deferred until the popover is open.\n *\n * @default false\n */\n isLazy?: boolean\n /**\n * If `true`, the popover will be opened.\n */\n isOpen?: boolean\n /**\n * The lazy behavior of popover's content when not visible. Only works when `isLazy={true}`\n *\n * - `unmount`: The popover's content is always unmounted when not open.\n * - `keepMounted`: The popover's content initially unmounted, but stays mounted when popover is open.\n *\n * @default 'unmount'\n */\n lazyBehavior?: LazyMode\n /**\n * The number of delay time to open.\n *\n * @default 200\n */\n openDelay?: number\n /**\n * The `ref` of the element related to the popover.\n * This is used during the `onBlur` event.\n */\n relatedRef?: RefObject<HTMLElement>\n /**\n * If `true`, focus will be returned to the element that triggers the popover when it closes.\n *\n * @default true\n */\n restoreFocus?: boolean\n /**\n * The interaction that triggers the popover.\n *\n * - `hover`: means the popover will open when you hover with mouse or focus with keyboard on the popover trigger.\n * - `click`: means the popover will open on click or press `Enter` to `Space` on keyboard.\n *\n * @default 'click'\n */\n trigger?: \"click\" | \"contextmenu\" | \"hover\" | \"never\"\n /**\n * Callback fired when the popover closes.\n */\n onClose?: () => void\n /**\n * Callback fired when the popover opens.\n */\n onOpen?: () => void\n}\n\nexport interface PopoverProps\n extends ThemeProps<\"Popover\">,\n Omit<UsePopperProps, \"enabled\">,\n PropsWithChildren<PopoverOptions> {}\n\ninterface PopoverContext\n extends Pick<\n PopoverOptions,\n \"animation\" | \"closeOnButton\" | \"duration\" | \"isOpen\" | \"onClose\"\n > {\n id: string\n bodyRef: RefObject<HTMLElement>\n forceUpdate: () => undefined | void\n headerRef: RefObject<HTMLElement>\n styles: { [key: string]: CSSUIObject | undefined }\n getAnchorProps: PropGetter\n getPopoverProps: PropGetter<MotionProps<\"section\">, MotionProps<\"section\">>\n getPopperProps: PropGetter<ComponentProps<\"div\">>\n getTriggerProps: PropGetter\n onAnimationComplete: () => void\n}\n\nconst [PopoverProvider, usePopover] = createContext<PopoverContext>({\n name: \"PopoverContext\",\n errorMessage: `usePopoverContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Popover />\"`,\n})\n\nexport { usePopover }\n\n/**\n * `Popover` is a component that floats around an element to display information.\n *\n * @see Docs https://yamada-ui.com/components/overlay/popover\n */\nexport const Popover: FC<PopoverProps> = (props) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Popover\", props)\n const {\n animation = \"scale\",\n autoFocus = true,\n children,\n closeDelay = 200,\n closeOnBlur = true,\n closeOnButton = true,\n closeOnEsc = true,\n duration,\n initialFocusRef,\n isLazy,\n lazyBehavior = \"unmount\",\n openDelay = 200,\n relatedRef,\n restoreFocus = true,\n trigger = \"click\",\n ...rest\n } = omitThemeProps(mergedProps)\n const id = useId()\n const { isOpen, onClose, onOpen, onToggle } = useDisclosure(mergedProps)\n const anchorRef = useRef<HTMLElement>(null)\n const triggerRef = useRef<HTMLElement>(null)\n const headerRef = useRef<HTMLElement>(null)\n const bodyRef = useRef<HTMLElement>(null)\n const popoverRef = useRef<HTMLElement>(null)\n const { present, onAnimationComplete } = useAnimationObserver({\n ref: popoverRef,\n isOpen,\n })\n const openTimeout = useRef<number | undefined>(undefined)\n const closeTimeout = useRef<number | undefined>(undefined)\n const isHoveringRef = useRef(false)\n const hasBeenOpened = useRef(false)\n const { forceUpdate, referenceRef, transformOrigin, getPopperProps } =\n usePopper({\n ...rest,\n enabled: isOpen,\n })\n\n if (isOpen) hasBeenOpened.current = true\n\n useEffect(() => {\n return () => {\n if (openTimeout.current) clearTimeout(openTimeout.current)\n\n if (closeTimeout.current) clearTimeout(closeTimeout.current)\n }\n }, [])\n\n useFocusOnPointerDown({\n ref: triggerRef,\n enabled: isOpen,\n })\n\n useFocusOnHide(popoverRef, {\n focusRef: triggerRef,\n shouldFocus:\n restoreFocus && (trigger === \"click\" || trigger === \"contextmenu\"),\n visible: isOpen,\n })\n\n useFocusOnShow(popoverRef, {\n focusRef: initialFocusRef,\n shouldFocus:\n autoFocus && (trigger === \"click\" || trigger === \"contextmenu\"),\n visible: isOpen,\n })\n\n const shouldRenderChildren = useLazyDisclosure({\n enabled: isLazy,\n isSelected: present,\n mode: lazyBehavior,\n wasSelected: hasBeenOpened.current,\n })\n\n const getPopoverProps: PropGetter<\n MotionProps<\"section\">,\n MotionProps<\"section\">\n > = useCallback(\n (props = {}, ref = null) => {\n const popoverProps: MotionProps & RefAttributes<any> = {\n id,\n \"aria-describedby\": bodyRef.current?.id,\n \"aria-hidden\": !isOpen,\n \"aria-labelledby\": headerRef.current?.id,\n role: \"dialog\",\n ...props,\n ref: mergeRefs(popoverRef, ref),\n style: {\n ...props.style,\n transformOrigin,\n },\n children: shouldRenderChildren ? props.children : null,\n tabIndex: -1,\n onBlur: handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const targetIsPopover = isContains(popoverRef.current, relatedTarget)\n const targetIsTrigger = isContains(triggerRef.current, relatedTarget)\n const targetIsRelated = relatedRef?.current\n ? isContains(relatedRef.current, relatedTarget)\n : false\n\n const isValidBlur =\n !targetIsPopover && !targetIsTrigger && !targetIsRelated\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n }),\n onKeyDown: handlerAll(props.onKeyDown, (ev) => {\n if (closeOnEsc && ev.key === \"Escape\") onClose()\n }),\n }\n\n if (trigger === \"hover\") {\n popoverProps.onMouseEnter = handlerAll(props.onMouseEnter, () => {\n isHoveringRef.current = true\n })\n\n popoverProps.onMouseLeave = handlerAll(props.onMouseLeave, (ev) => {\n if (ev.nativeEvent.relatedTarget === null) return\n\n isHoveringRef.current = false\n\n if (closeOnBlur) setTimeout(onClose, closeDelay)\n })\n }\n\n return popoverProps\n },\n [\n closeDelay,\n closeOnBlur,\n closeOnEsc,\n isOpen,\n onClose,\n shouldRenderChildren,\n transformOrigin,\n trigger,\n relatedRef,\n id,\n ],\n )\n\n const maybeReferenceRef = useCallback(\n (node: Element) => {\n if (anchorRef.current == null) referenceRef(node)\n },\n [referenceRef],\n )\n\n const getTriggerProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n const triggerProps: HTMLUIPropsWithRef = {\n \"aria-controls\": isOpen ? id : undefined,\n \"aria-expanded\": isOpen,\n role: \"button\",\n ...props,\n ref: mergeRefs(triggerRef, ref, maybeReferenceRef),\n }\n\n if (trigger === \"click\") {\n triggerProps.onClick = handlerAll(props.onClick, onToggle)\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n }\n\n if (trigger === \"contextmenu\") {\n triggerProps.onContextMenu = handlerAll(props.onContextMenu, (ev) => {\n ev.preventDefault()\n onOpen()\n })\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n }\n\n if (trigger === \"hover\") {\n triggerProps.onFocus = handlerAll(props.onFocus, () => {\n if (openTimeout.current === undefined) onOpen()\n })\n\n triggerProps.onBlur = handlerAll(props.onBlur, (ev) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const isValidBlur = !isContains(popoverRef.current, relatedTarget)\n\n if (isOpen && closeOnBlur && isValidBlur) onClose()\n })\n\n triggerProps.onKeyDown = handlerAll(props.onKeyDown, (ev) => {\n if (ev.key === \"Escape\") onClose()\n })\n\n triggerProps.onMouseEnter = handlerAll(props.onMouseEnter, () => {\n isHoveringRef.current = true\n openTimeout.current = window.setTimeout(onOpen, openDelay)\n })\n\n triggerProps.onMouseLeave = handlerAll(props.onMouseLeave, () => {\n isHoveringRef.current = false\n\n if (openTimeout.current) {\n clearTimeout(openTimeout.current)\n openTimeout.current = undefined\n }\n\n closeTimeout.current = window.setTimeout(() => {\n if (!isHoveringRef.current) onClose()\n }, closeDelay)\n })\n }\n\n return triggerProps\n },\n [\n closeDelay,\n closeOnBlur,\n isOpen,\n maybeReferenceRef,\n onClose,\n onOpen,\n onToggle,\n openDelay,\n trigger,\n id,\n ],\n )\n\n const getAnchorProps: PropGetter = useCallback(\n (props = {}, ref = null) => {\n return {\n ...props,\n ref: mergeRefs(ref, anchorRef, referenceRef),\n }\n },\n [anchorRef, referenceRef],\n )\n\n return (\n <PopoverProvider\n value={{\n id,\n animation,\n bodyRef,\n closeOnButton,\n duration,\n forceUpdate,\n headerRef,\n isOpen,\n styles,\n getAnchorProps,\n getPopoverProps,\n getPopperProps,\n getTriggerProps,\n onAnimationComplete,\n onClose,\n }}\n >\n {runIfFunc(children, {\n forceUpdate,\n isOpen,\n onClose,\n })}\n </PopoverProvider>\n )\n}\n\nPopover.displayName = \"Popover\"\nPopover.__ui__ = \"Popover\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,eAA+B;AAC/B,IAAAC,gBAA8B;;;ACc9B,kBAAuD;AACvD,2BAAqC;AACrC,4BAAiD;AACjD,uBAIO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AAK,yBAAU,WAAW,GAAG;AAAA,QAC7B,eAAW,kBAAG,sBAAsB,SAAS;AAAA,QAC7C,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,cAAc,cAAc;AAC5B,cAAc,SAAS;","names":["import_core","import_utils","props","import_jsx_runtime"]}
@@ -1,8 +1,8 @@
1
1
  "use client"
2
2
  import {
3
3
  PopoverHeader
4
- } from "./chunk-QVEEOMV4.mjs";
5
- import "./chunk-JTIVIKPS.mjs";
4
+ } from "./chunk-62XMD3XG.mjs";
5
+ import "./chunk-DSIIS6RK.mjs";
6
6
  export {
7
7
  PopoverHeader
8
8
  };
@@ -80,11 +80,11 @@ var Popover = (props) => {
80
80
  ...rest
81
81
  } = (0, import_core.omitThemeProps)(mergedProps);
82
82
  const id = (0, import_react.useId)();
83
- const labelledbyId = (0, import_react.useId)();
84
- const describedbyId = (0, import_react.useId)();
85
83
  const { isOpen, onClose, onOpen, onToggle } = (0, import_use_disclosure.useDisclosure)(mergedProps);
86
84
  const anchorRef = (0, import_react.useRef)(null);
87
85
  const triggerRef = (0, import_react.useRef)(null);
86
+ const headerRef = (0, import_react.useRef)(null);
87
+ const bodyRef = (0, import_react.useRef)(null);
88
88
  const popoverRef = (0, import_react.useRef)(null);
89
89
  const { present, onAnimationComplete } = (0, import_use_animation.useAnimationObserver)({
90
90
  ref: popoverRef,
@@ -127,11 +127,12 @@ var Popover = (props) => {
127
127
  });
128
128
  const getPopoverProps = (0, import_react.useCallback)(
129
129
  (props2 = {}, ref = null) => {
130
+ var _a, _b;
130
131
  const popoverProps = {
131
132
  id,
132
- "aria-describedby": describedbyId,
133
+ "aria-describedby": (_a = bodyRef.current) == null ? void 0 : _a.id,
133
134
  "aria-hidden": !isOpen,
134
- "aria-labelledby": labelledbyId,
135
+ "aria-labelledby": (_b = headerRef.current) == null ? void 0 : _b.id,
135
136
  role: "dialog",
136
137
  ...props2,
137
138
  ref: (0, import_utils.mergeRefs)(popoverRef, ref),
@@ -175,9 +176,7 @@ var Popover = (props) => {
175
176
  transformOrigin,
176
177
  trigger,
177
178
  relatedRef,
178
- id,
179
- labelledbyId,
180
- describedbyId
179
+ id
181
180
  ]
182
181
  );
183
182
  const maybeReferenceRef = (0, import_react.useCallback)(
@@ -271,12 +270,12 @@ var Popover = (props) => {
271
270
  value: {
272
271
  id,
273
272
  animation,
273
+ bodyRef,
274
274
  closeOnButton,
275
- describedbyId,
276
275
  duration,
277
276
  forceUpdate,
277
+ headerRef,
278
278
  isOpen,
279
- labelledbyId,
280
279
  styles,
281
280
  getAnchorProps,
282
281
  getPopoverProps,