@yamada-ui/react 2.3.4-dev-20261125051132 → 2.3.4-dev-20261125052246
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/popover/use-popover.cjs +1 -0
- package/dist/cjs/components/popover/use-popover.cjs.map +1 -1
- package/dist/cjs/components/tooltip/use-tooltip.cjs +3 -2
- package/dist/cjs/components/tooltip/use-tooltip.cjs.map +1 -1
- package/dist/esm/components/popover/use-popover.js +1 -0
- package/dist/esm/components/popover/use-popover.js.map +1 -1
- package/dist/esm/components/tooltip/use-tooltip.js +3 -2
- package/dist/esm/components/tooltip/use-tooltip.js.map +1 -1
- package/dist/types/components/autocomplete/autocomplete.style.d.ts +1 -1
- package/dist/types/components/calendar/calendar.style.d.ts +2 -2
- package/dist/types/components/carousel/carousel.style.d.ts +2 -2
- package/dist/types/components/chart/polar-chart.style.d.ts +1 -1
- package/dist/types/components/checkbox-card/checkbox-card.d.ts +3 -3
- package/dist/types/components/checkbox-card/checkbox-card.style.d.ts +1 -1
- package/dist/types/components/data-list/data-list.style.d.ts +1 -1
- package/dist/types/components/empty-state/empty-state.style.d.ts +2 -2
- package/dist/types/components/number-input/number-input.style.d.ts +1 -1
- package/dist/types/components/radio-card/radio-card.d.ts +3 -3
- package/dist/types/components/radio-card/radio-card.style.d.ts +1 -1
- package/dist/types/components/reorder/reorder.style.d.ts +1 -1
- package/dist/types/components/resizable/resizable.style.d.ts +2 -2
- package/dist/types/components/steps/steps.style.d.ts +1 -1
- package/dist/types/components/timeline/timeline.d.ts +1 -1
- package/dist/types/components/timeline/timeline.style.d.ts +1 -1
- package/dist/types/providers/i18n-provider/i18n-provider.d.ts +1 -1
- package/package.json +2 -2
|
@@ -52,6 +52,7 @@ const usePopover = ({ autoFocus = true, autoUpdate, modal = false, blockScrollOn
|
|
|
52
52
|
});
|
|
53
53
|
}, []);
|
|
54
54
|
const onKeyDown = (0, react.useCallback)((ev) => {
|
|
55
|
+
if ((0, require_utils_index.utils_exports.isComposing)(ev.nativeEvent)) return;
|
|
55
56
|
require_dom.runKeyAction(ev, { Escape: () => {
|
|
56
57
|
if (!closeOnEsc) return;
|
|
57
58
|
onClose();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-popover.cjs","names":["useEnvironment","useId","useRef","useDisclosure","usePopper","useCallback","getEventRelatedTarget","mergeRefs","popperProps","useSplitProps"],"sources":["../../../../src/components/popover/use-popover.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FocusEvent, KeyboardEvent, RefObject } from \"react\"\nimport type { Direction, PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport type { UsePopperProps } from \"../../hooks/use-popper\"\nimport type { Dict } from \"../../utils\"\nimport type { UsePopupAnimationProps } from \"./popover\"\nimport { useCallback, useEffect, useId, useRef } from \"react\"\nimport { useEnvironment, useSplitProps } from \"../../core\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useEventListener } from \"../../hooks/use-event-listener\"\nimport { useFocusOnShow } from \"../../hooks/use-focus\"\nimport { useOutsideClick } from \"../../hooks/use-outside-click\"\nimport { popperProps, usePopper } from \"../../hooks/use-popper\"\nimport {\n ariaAttr,\n assignRef,\n contains,\n dataAttr,\n focusTransfer,\n focusTrap,\n getEventRelatedTarget,\n handlerAll,\n mergeRefs,\n runKeyAction,\n scrollLock,\n setAttribute,\n useSafeLayoutEffect,\n useUnmountEffect,\n} from \"../../utils\"\n\nexport interface UsePopoverProps\n extends Omit<UseDisclosureProps, \"timing\">, UsePopperProps<\"button\"> {\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 * If `true`, scrolling will be disabled on the `body` when the modal opens.\n *\n * @default false\n */\n blockScrollOnMount?: boolean\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`, the popover will hide on pressing Esc key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the popover will hide on scroll.\n *\n * @default false\n */\n closeOnScroll?: boolean\n /**\n * If `true`, the popover will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The `ref` of the element that should receive focus when the popover opens.\n */\n initialFocusRef?: RefObject<HTMLElement | null>\n /**\n * If `true`, the popover will be modal.\n *\n * - scrolling is blocked.\n * - focus is trapped within the popover.\n *\n * @default false\n */\n modal?: boolean\n /**\n * If `true`, the popover will be opened when click on the field.\n *\n * @default true\n */\n openOnClick?: boolean\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end'\n */\n placement?: Direction\n /**\n * If `true`, the focus will be transferred to the popover content when the tab key is pressed.\n *\n * @default true\n */\n transferFocus?: boolean\n /**\n * Update the position of the floating element, re-rendering the component if required.\n */\n updateRef?: RefObject<() => void>\n}\n\nexport const usePopover = ({\n autoFocus = true,\n autoUpdate,\n modal = false,\n blockScrollOnMount = modal,\n closeOnBlur = true,\n closeOnEsc = true,\n closeOnScroll,\n defaultOpen,\n disabled,\n elements,\n flip,\n gutter,\n initialFocusRef,\n matchWidth,\n middleware,\n offset,\n open: openProp,\n openOnClick = true,\n placement = \"end\",\n platform,\n preventOverflow,\n strategy,\n transferFocus = true,\n transform,\n updateRef,\n whileElementsMounted,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n}: UsePopoverProps = {}) => {\n const { getDocument } = useEnvironment()\n const headerId = useId()\n const bodyId = useId()\n const contentId = useId()\n const anchorRef = useRef<HTMLElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const contentRef = useRef<HTMLElement>(null)\n const openTimeout = useRef<NodeJS.Timeout>(undefined)\n const closeTimeout = useRef<NodeJS.Timeout>(undefined)\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const { refs, update, getPopperProps } = usePopper<\"button\">({\n autoUpdate,\n elements,\n flip,\n gutter,\n matchWidth,\n middleware,\n offset,\n open,\n placement,\n platform,\n preventOverflow,\n strategy,\n transform,\n whileElementsMounted,\n })\n\n assignRef(updateRef, update)\n\n const onRestoreFocus = useCallback(() => {\n clearTimeout(closeTimeout.current)\n closeTimeout.current = setTimeout(() => {\n triggerRef.current?.focus()\n })\n }, [])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLElement>) => {\n runKeyAction(ev, {\n Escape: () => {\n if (!closeOnEsc) return\n\n onClose()\n onRestoreFocus()\n },\n })\n },\n [closeOnEsc, onClose, onRestoreFocus],\n )\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLDivElement>) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const popup = relatedTarget?.closest(\"[data-popup]\")\n\n if (popup) return\n if (contains(triggerRef.current, relatedTarget)) return\n if (contains(contentRef.current, relatedTarget)) return\n\n if (closeOnBlur) onClose()\n },\n [closeOnBlur, onClose],\n )\n\n useEventListener(getDocument(), \"scroll\", () => {\n if (open && closeOnScroll) onClose()\n })\n\n useFocusOnShow(contentRef, {\n focusTarget: initialFocusRef,\n shouldFocus: autoFocus,\n visible: open,\n })\n\n useOutsideClick({\n ref: [contentRef, triggerRef],\n enabled: open && closeOnBlur,\n handler: onClose,\n })\n\n useSafeLayoutEffect(() => {\n const el = contentRef.current\n const hasHeader = !!getDocument()?.getElementById(headerId)\n const hasBody = !!getDocument()?.getElementById(bodyId)\n\n if (el && hasHeader) setAttribute(el, \"aria-labelledby\", headerId)\n if (el && hasBody) setAttribute(el, \"aria-describedby\", bodyId)\n }, [open, headerId, bodyId])\n\n useEffect(() => {\n if (!open || !modal) return\n\n return focusTrap(contentRef.current)\n }, [open, modal])\n\n useEffect(() => {\n if (!open || !blockScrollOnMount) return\n\n return scrollLock(contentRef.current)\n }, [open, modal, blockScrollOnMount])\n\n useEffect(() => {\n if (!open || modal || !transferFocus) return\n\n return focusTransfer(contentRef.current, triggerRef.current)\n }, [open, modal, transferFocus])\n\n useUnmountEffect(() => {\n clearTimeout(openTimeout.current)\n clearTimeout(closeTimeout.current)\n })\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n \"aria-controls\": open ? contentId : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": open,\n \"aria-haspopup\": \"dialog\",\n role: \"button\",\n ...props,\n ref: mergeRefs(ref, triggerRef, (node) => {\n if (anchorRef.current == null) refs.setReference(node)\n }),\n onBlur: handlerAll(props.onBlur, (ev) =>\n !contains(contentRef.current, getEventRelatedTarget(ev)) && closeOnBlur\n ? onClose()\n : void 0,\n ),\n onClick: handlerAll(\n props.onClick,\n !open ? (!disabled && openOnClick ? onOpen : undefined) : onClose,\n ),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [\n closeOnBlur,\n contentId,\n disabled,\n onClose,\n onKeyDown,\n onOpen,\n open,\n openOnClick,\n refs,\n ],\n )\n\n const getAnchorProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => ({\n ...props,\n ref: mergeRefs(ref, anchorRef, refs.setReference),\n }),\n [refs.setReference],\n )\n\n const getPositionerProps: PropGetter = useCallback(\n (props) => getPopperProps(props),\n [getPopperProps],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => ({\n id: contentId,\n \"aria-hidden\": !open,\n \"aria-modal\": modal ? \"true\" : undefined,\n \"data-close\": dataAttr(!open),\n \"data-open\": dataAttr(open),\n \"data-popup\": dataAttr(true),\n role: \"dialog\",\n tabIndex: -1,\n ...props,\n ref: mergeRefs(ref, contentRef),\n onBlur: handlerAll(props.onBlur, onBlur),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [contentId, open, modal, onBlur, onKeyDown],\n )\n\n const getHeaderProps: PropGetter = useCallback(\n (props) => ({ id: headerId, ...props }),\n [headerId],\n )\n\n const getBodyProps: PropGetter = useCallback(\n (props) => ({ id: bodyId, ...props }),\n [bodyId],\n )\n\n const getFooterProps: PropGetter = useCallback((props) => ({ ...props }), [])\n\n const getCloseTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n ...props,\n onClick: handlerAll(props.onClick, () => {\n onClose()\n onRestoreFocus()\n }),\n }),\n [onClose, onRestoreFocus],\n )\n\n return {\n open,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n onClose,\n onOpen,\n }\n}\n\nexport type UsePopoverReturn = ReturnType<typeof usePopover>\n\nexport const popoverProps: (\n | keyof UsePopoverProps\n | keyof UsePopupAnimationProps\n)[] = [\n ...popperProps,\n \"autoFocus\",\n \"transferFocus\",\n \"blockScrollOnMount\",\n \"closeOnBlur\",\n \"closeOnEsc\",\n \"closeOnScroll\",\n \"openOnClick\",\n \"disabled\",\n \"initialFocusRef\",\n \"modal\",\n \"updateRef\",\n \"defaultOpen\",\n \"onOpen\",\n \"onClose\",\n \"animationScheme\",\n \"duration\",\n]\n\nexport const usePopoverProps = <\n Y extends Dict = Dict,\n M extends keyof UsePopoverProps | keyof UsePopupAnimationProps =\n | keyof UsePopoverProps\n | keyof UsePopupAnimationProps,\n>(\n props: Y,\n omitKeys?: M[],\n) => {\n return useSplitProps(\n props,\n popoverProps.filter((key) => !omitKeys?.includes(key as M)),\n ) as unknown as [\n keyof UsePopoverProps | keyof UsePopupAnimationProps extends M\n ? UsePopoverProps & UsePopupAnimationProps\n : Omit<UsePopoverProps & UsePopupAnimationProps, M>,\n Omit<\n Y,\n keyof UsePopoverProps | keyof UsePopupAnimationProps extends M\n ? keyof UsePopoverProps | keyof UsePopupAnimationProps\n : Exclude<keyof UsePopoverProps | keyof UsePopupAnimationProps, M>\n >,\n ]\n}\n"],"mappings":";;;;;;;;;;;;;;AA2GA,MAAa,cAAc,EACzB,YAAY,MACZ,YACA,QAAQ,OACR,qBAAqB,OACrB,cAAc,MACd,aAAa,MACb,eAC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A;EACA;EACA;CACF;AACF;AAIA,MAAa,eAGP;CACJ,GAAGG,+BAAAA;CACH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,mBAMX,OACA,aACG;CACH,OAAOC,cAAAA,cACL,OACA,aAAa,QAAQ,QAAQ,CAAC,UAAU,SAAS,GAAQ,CAAC,CAC5D;AAWF"}
|
|
1
|
+
{"version":3,"file":"use-popover.cjs","names":["useEnvironment","useId","useRef","useDisclosure","usePopper","useCallback","getEventRelatedTarget","mergeRefs","popperProps","useSplitProps"],"sources":["../../../../src/components/popover/use-popover.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FocusEvent, KeyboardEvent, RefObject } from \"react\"\nimport type { Direction, PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport type { UsePopperProps } from \"../../hooks/use-popper\"\nimport type { Dict } from \"../../utils\"\nimport type { UsePopupAnimationProps } from \"./popover\"\nimport { useCallback, useEffect, useId, useRef } from \"react\"\nimport { useEnvironment, useSplitProps } from \"../../core\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useEventListener } from \"../../hooks/use-event-listener\"\nimport { useFocusOnShow } from \"../../hooks/use-focus\"\nimport { useOutsideClick } from \"../../hooks/use-outside-click\"\nimport { popperProps, usePopper } from \"../../hooks/use-popper\"\nimport {\n ariaAttr,\n assignRef,\n contains,\n dataAttr,\n focusTransfer,\n focusTrap,\n getEventRelatedTarget,\n handlerAll,\n isComposing,\n mergeRefs,\n runKeyAction,\n scrollLock,\n setAttribute,\n useSafeLayoutEffect,\n useUnmountEffect,\n} from \"../../utils\"\n\nexport interface UsePopoverProps\n extends Omit<UseDisclosureProps, \"timing\">, UsePopperProps<\"button\"> {\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 * If `true`, scrolling will be disabled on the `body` when the modal opens.\n *\n * @default false\n */\n blockScrollOnMount?: boolean\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`, the popover will hide on pressing Esc key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the popover will hide on scroll.\n *\n * @default false\n */\n closeOnScroll?: boolean\n /**\n * If `true`, the popover will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The `ref` of the element that should receive focus when the popover opens.\n */\n initialFocusRef?: RefObject<HTMLElement | null>\n /**\n * If `true`, the popover will be modal.\n *\n * - scrolling is blocked.\n * - focus is trapped within the popover.\n *\n * @default false\n */\n modal?: boolean\n /**\n * If `true`, the popover will be opened when click on the field.\n *\n * @default true\n */\n openOnClick?: boolean\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end'\n */\n placement?: Direction\n /**\n * If `true`, the focus will be transferred to the popover content when the tab key is pressed.\n *\n * @default true\n */\n transferFocus?: boolean\n /**\n * Update the position of the floating element, re-rendering the component if required.\n */\n updateRef?: RefObject<() => void>\n}\n\nexport const usePopover = ({\n autoFocus = true,\n autoUpdate,\n modal = false,\n blockScrollOnMount = modal,\n closeOnBlur = true,\n closeOnEsc = true,\n closeOnScroll,\n defaultOpen,\n disabled,\n elements,\n flip,\n gutter,\n initialFocusRef,\n matchWidth,\n middleware,\n offset,\n open: openProp,\n openOnClick = true,\n placement = \"end\",\n platform,\n preventOverflow,\n strategy,\n transferFocus = true,\n transform,\n updateRef,\n whileElementsMounted,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n}: UsePopoverProps = {}) => {\n const { getDocument } = useEnvironment()\n const headerId = useId()\n const bodyId = useId()\n const contentId = useId()\n const anchorRef = useRef<HTMLElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const contentRef = useRef<HTMLElement>(null)\n const openTimeout = useRef<NodeJS.Timeout>(undefined)\n const closeTimeout = useRef<NodeJS.Timeout>(undefined)\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const { refs, update, getPopperProps } = usePopper<\"button\">({\n autoUpdate,\n elements,\n flip,\n gutter,\n matchWidth,\n middleware,\n offset,\n open,\n placement,\n platform,\n preventOverflow,\n strategy,\n transform,\n whileElementsMounted,\n })\n\n assignRef(updateRef, update)\n\n const onRestoreFocus = useCallback(() => {\n clearTimeout(closeTimeout.current)\n closeTimeout.current = setTimeout(() => {\n triggerRef.current?.focus()\n })\n }, [])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLElement>) => {\n if (isComposing(ev.nativeEvent)) return\n\n runKeyAction(ev, {\n Escape: () => {\n if (!closeOnEsc) return\n\n onClose()\n onRestoreFocus()\n },\n })\n },\n [closeOnEsc, onClose, onRestoreFocus],\n )\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLDivElement>) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const popup = relatedTarget?.closest(\"[data-popup]\")\n\n if (popup) return\n if (contains(triggerRef.current, relatedTarget)) return\n if (contains(contentRef.current, relatedTarget)) return\n\n if (closeOnBlur) onClose()\n },\n [closeOnBlur, onClose],\n )\n\n useEventListener(getDocument(), \"scroll\", () => {\n if (open && closeOnScroll) onClose()\n })\n\n useFocusOnShow(contentRef, {\n focusTarget: initialFocusRef,\n shouldFocus: autoFocus,\n visible: open,\n })\n\n useOutsideClick({\n ref: [contentRef, triggerRef],\n enabled: open && closeOnBlur,\n handler: onClose,\n })\n\n useSafeLayoutEffect(() => {\n const el = contentRef.current\n const hasHeader = !!getDocument()?.getElementById(headerId)\n const hasBody = !!getDocument()?.getElementById(bodyId)\n\n if (el && hasHeader) setAttribute(el, \"aria-labelledby\", headerId)\n if (el && hasBody) setAttribute(el, \"aria-describedby\", bodyId)\n }, [open, headerId, bodyId])\n\n useEffect(() => {\n if (!open || !modal) return\n\n return focusTrap(contentRef.current)\n }, [open, modal])\n\n useEffect(() => {\n if (!open || !blockScrollOnMount) return\n\n return scrollLock(contentRef.current)\n }, [open, modal, blockScrollOnMount])\n\n useEffect(() => {\n if (!open || modal || !transferFocus) return\n\n return focusTransfer(contentRef.current, triggerRef.current)\n }, [open, modal, transferFocus])\n\n useUnmountEffect(() => {\n clearTimeout(openTimeout.current)\n clearTimeout(closeTimeout.current)\n })\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n \"aria-controls\": open ? contentId : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": open,\n \"aria-haspopup\": \"dialog\",\n role: \"button\",\n ...props,\n ref: mergeRefs(ref, triggerRef, (node) => {\n if (anchorRef.current == null) refs.setReference(node)\n }),\n onBlur: handlerAll(props.onBlur, (ev) =>\n !contains(contentRef.current, getEventRelatedTarget(ev)) && closeOnBlur\n ? onClose()\n : void 0,\n ),\n onClick: handlerAll(\n props.onClick,\n !open ? (!disabled && openOnClick ? onOpen : undefined) : onClose,\n ),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [\n closeOnBlur,\n contentId,\n disabled,\n onClose,\n onKeyDown,\n onOpen,\n open,\n openOnClick,\n refs,\n ],\n )\n\n const getAnchorProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => ({\n ...props,\n ref: mergeRefs(ref, anchorRef, refs.setReference),\n }),\n [refs.setReference],\n )\n\n const getPositionerProps: PropGetter = useCallback(\n (props) => getPopperProps(props),\n [getPopperProps],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => ({\n id: contentId,\n \"aria-hidden\": !open,\n \"aria-modal\": modal ? \"true\" : undefined,\n \"data-close\": dataAttr(!open),\n \"data-open\": dataAttr(open),\n \"data-popup\": dataAttr(true),\n role: \"dialog\",\n tabIndex: -1,\n ...props,\n ref: mergeRefs(ref, contentRef),\n onBlur: handlerAll(props.onBlur, onBlur),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [contentId, open, modal, onBlur, onKeyDown],\n )\n\n const getHeaderProps: PropGetter = useCallback(\n (props) => ({ id: headerId, ...props }),\n [headerId],\n )\n\n const getBodyProps: PropGetter = useCallback(\n (props) => ({ id: bodyId, ...props }),\n [bodyId],\n )\n\n const getFooterProps: PropGetter = useCallback((props) => ({ ...props }), [])\n\n const getCloseTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n ...props,\n onClick: handlerAll(props.onClick, () => {\n onClose()\n onRestoreFocus()\n }),\n }),\n [onClose, onRestoreFocus],\n )\n\n return {\n open,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n onClose,\n onOpen,\n }\n}\n\nexport type UsePopoverReturn = ReturnType<typeof usePopover>\n\nexport const popoverProps: (\n | keyof UsePopoverProps\n | keyof UsePopupAnimationProps\n)[] = [\n ...popperProps,\n \"autoFocus\",\n \"transferFocus\",\n \"blockScrollOnMount\",\n \"closeOnBlur\",\n \"closeOnEsc\",\n \"closeOnScroll\",\n \"openOnClick\",\n \"disabled\",\n \"initialFocusRef\",\n \"modal\",\n \"updateRef\",\n \"defaultOpen\",\n \"onOpen\",\n \"onClose\",\n \"animationScheme\",\n \"duration\",\n]\n\nexport const usePopoverProps = <\n Y extends Dict = Dict,\n M extends keyof UsePopoverProps | keyof UsePopupAnimationProps =\n | keyof UsePopoverProps\n | keyof UsePopupAnimationProps,\n>(\n props: Y,\n omitKeys?: M[],\n) => {\n return useSplitProps(\n props,\n popoverProps.filter((key) => !omitKeys?.includes(key as M)),\n ) as unknown as [\n keyof UsePopoverProps | keyof UsePopupAnimationProps extends M\n ? UsePopoverProps & UsePopupAnimationProps\n : Omit<UsePopoverProps & UsePopupAnimationProps, M>,\n Omit<\n Y,\n keyof UsePopoverProps | keyof UsePopupAnimationProps extends M\n ? keyof UsePopoverProps | keyof UsePopupAnimationProps\n : Exclude<keyof UsePopoverProps | keyof UseP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AA,GAfiDA,MAAAA,YAAAA,EAChD,QAAQ,CAAC,OAAO;GACf,GAAG;GACH,UAAA,GAAA,oBAAA,cAAS,WAAA,CAAW,MAAM,eAAe;IACvC,QAAQ;IACR,eAAe;GACjB,CAAC;EACH,IACA,CAAC,SAAS,cAAc,CAOL;EACnB;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;AAIA,MAAa,eAGP;CACJ,GAAGG,+BAAAA;CACH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,mBAMX,OACA,aACG;CACH,OAAOC,cAAAA,cACL,OACA,aAAa,QAAQ,QAAQ,CAAC,UAAU,SAAS,GAAQ,CAAC,CAC5D;AAWF"}
|
|
@@ -52,8 +52,9 @@ const useTooltip = (props = {}) => {
|
|
|
52
52
|
onForceClose();
|
|
53
53
|
}, closeDelay);
|
|
54
54
|
}, [closeDelay, onForceClose]);
|
|
55
|
-
require_hooks_use_event_listener_index.useEventListener(() => (0, require_utils_index.utils_exports.getDocument)(triggerRef.current), "keydown", (
|
|
56
|
-
if (
|
|
55
|
+
require_hooks_use_event_listener_index.useEventListener(() => (0, require_utils_index.utils_exports.getDocument)(triggerRef.current), "keydown", (ev) => {
|
|
56
|
+
if ((0, require_utils_index.utils_exports.isComposing)(ev)) return;
|
|
57
|
+
if (closeOnEsc && ev.key === "Escape") onDelayClose();
|
|
57
58
|
});
|
|
58
59
|
require_hooks_use_event_listener_index.useEventListener(() => (0, require_utils_index.utils_exports.getDocument)(triggerRef.current), "scroll", () => {
|
|
59
60
|
if (open && closeOnScroll) onForceClose();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-tooltip.cjs","names":["usePopperProps","useId","useRef","useDisclosure","usePopper","useCallback","mergeProps","popperProps","useSplitProps"],"sources":["../../../../src/components/tooltip/use-tooltip.tsx"],"sourcesContent":["\"use client\"\n\nimport type { PointerEvent } from \"react\"\nimport type { PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport type { UsePopperProps } from \"../../hooks/use-popper\"\nimport type { Dict } from \"../../utils\"\nimport { useCallback, useId, useRef } from \"react\"\nimport { mergeProps, useSplitProps } from \"../../core\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useEventListener } from \"../../hooks/use-event-listener\"\nimport { useOutsideClick } from \"../../hooks/use-outside-click\"\nimport { popperProps, usePopper, usePopperProps } from \"../../hooks/use-popper\"\nimport {\n dataAttr,\n getDocument,\n getWindow,\n handlerAll,\n useUnmountEffect,\n} from \"../../utils\"\n\nexport interface UseTooltipProps\n extends Omit<UseDisclosureProps, \"timing\">, UsePopperProps<\"button\"> {\n /**\n * The delay before hiding the tooltip.\n *\n * @default 100\n */\n closeDelay?: number\n /**\n * If `true`, the tooltip will hide on click.\n *\n * @default true\n */\n closeOnClick?: boolean\n /**\n * If `true`, the tooltip will hide on pressing Esc key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the tooltip will hide on scroll.\n *\n * @default false\n */\n closeOnScroll?: boolean\n /**\n * If `true`, the tooltip will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The delay before showing the tooltip.\n *\n * @default 400\n */\n openDelay?: number\n}\n\nexport const useTooltip = (props: UseTooltipProps = {}) => {\n const [\n popperProps,\n {\n closeDelay = 0,\n closeOnClick = true,\n closeOnEsc = true,\n closeOnScroll,\n defaultOpen,\n disabled,\n open: openProp,\n openDelay = 0,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n },\n ] = usePopperProps(props, [\"open\"])\n const describedbyId = useId()\n const triggerRef = useRef<HTMLButtonElement>(null)\n const openTimeout = useRef<NodeJS.Timeout>(undefined)\n const closeTimeout = useRef<NodeJS.Timeout>(undefined)\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const { getPopperProps, getReferenceProps } = usePopper({\n open,\n ...popperProps,\n })\n\n const onForceClose = useCallback(() => {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current)\n\n closeTimeout.current = undefined\n }\n\n onClose()\n }, [onClose])\n\n const onDelayOpen = useCallback(() => {\n if (!disabled && !openTimeout.current) {\n if (open) onForceClose()\n\n openTimeout.current = getWindow(triggerRef.current).setTimeout(\n onOpen,\n openDelay,\n )\n }\n }, [disabled, open, onForceClose, onOpen, openDelay])\n\n const onDelayClose = useCallback(() => {\n if (openTimeout.current) {\n clearTimeout(openTimeout.current)\n openTimeout.current = undefined\n }\n\n closeTimeout.current = getWindow(triggerRef.current).setTimeout(() => {\n onForceClose()\n }, closeDelay)\n }, [closeDelay, onForceClose])\n\n useEventListener(\n () => getDocument(triggerRef.current),\n \"keydown\",\n (
|
|
1
|
+
{"version":3,"file":"use-tooltip.cjs","names":["usePopperProps","useId","useRef","useDisclosure","usePopper","useCallback","mergeProps","popperProps","useSplitProps"],"sources":["../../../../src/components/tooltip/use-tooltip.tsx"],"sourcesContent":["\"use client\"\n\nimport type { PointerEvent } from \"react\"\nimport type { PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport type { UsePopperProps } from \"../../hooks/use-popper\"\nimport type { Dict } from \"../../utils\"\nimport { useCallback, useId, useRef } from \"react\"\nimport { mergeProps, useSplitProps } from \"../../core\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useEventListener } from \"../../hooks/use-event-listener\"\nimport { useOutsideClick } from \"../../hooks/use-outside-click\"\nimport { popperProps, usePopper, usePopperProps } from \"../../hooks/use-popper\"\nimport {\n dataAttr,\n getDocument,\n getWindow,\n handlerAll,\n isComposing,\n useUnmountEffect,\n} from \"../../utils\"\n\nexport interface UseTooltipProps\n extends Omit<UseDisclosureProps, \"timing\">, UsePopperProps<\"button\"> {\n /**\n * The delay before hiding the tooltip.\n *\n * @default 100\n */\n closeDelay?: number\n /**\n * If `true`, the tooltip will hide on click.\n *\n * @default true\n */\n closeOnClick?: boolean\n /**\n * If `true`, the tooltip will hide on pressing Esc key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the tooltip will hide on scroll.\n *\n * @default false\n */\n closeOnScroll?: boolean\n /**\n * If `true`, the tooltip will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The delay before showing the tooltip.\n *\n * @default 400\n */\n openDelay?: number\n}\n\nexport const useTooltip = (props: UseTooltipProps = {}) => {\n const [\n popperProps,\n {\n closeDelay = 0,\n closeOnClick = true,\n closeOnEsc = true,\n closeOnScroll,\n defaultOpen,\n disabled,\n open: openProp,\n openDelay = 0,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n },\n ] = usePopperProps(props, [\"open\"])\n const describedbyId = useId()\n const triggerRef = useRef<HTMLButtonElement>(null)\n const openTimeout = useRef<NodeJS.Timeout>(undefined)\n const closeTimeout = useRef<NodeJS.Timeout>(undefined)\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const { getPopperProps, getReferenceProps } = usePopper({\n open,\n ...popperProps,\n })\n\n const onForceClose = useCallback(() => {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current)\n\n closeTimeout.current = undefined\n }\n\n onClose()\n }, [onClose])\n\n const onDelayOpen = useCallback(() => {\n if (!disabled && !openTimeout.current) {\n if (open) onForceClose()\n\n openTimeout.current = getWindow(triggerRef.current).setTimeout(\n onOpen,\n openDelay,\n )\n }\n }, [disabled, open, onForceClose, onOpen, openDelay])\n\n const onDelayClose = useCallback(() => {\n if (openTimeout.current) {\n clearTimeout(openTimeout.current)\n openTimeout.current = undefined\n }\n\n closeTimeout.current = getWindow(triggerRef.current).setTimeout(() => {\n onForceClose()\n }, closeDelay)\n }, [closeDelay, onForceClose])\n\n useEventListener(\n () => getDocument(triggerRef.current),\n \"keydown\",\n (ev) => {\n if (isComposing(ev)) return\n\n if (closeOnEsc && ev.key === \"Escape\") onDelayClose()\n },\n )\n\n useEventListener(\n () => getDocument(triggerRef.current),\n \"scroll\",\n () => {\n if (open && closeOnScroll) onForceClose()\n },\n )\n\n useOutsideClick({\n ref: triggerRef,\n enabled: open,\n handler: () => {\n onDelayClose()\n },\n })\n\n useUnmountEffect(() => {\n clearTimeout(openTimeout.current)\n clearTimeout(closeTimeout.current)\n })\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => {\n return getReferenceProps(\n mergeProps(\n props,\n {\n ref: triggerRef,\n \"aria-describedby\": open ? describedbyId : undefined,\n },\n {\n onBlur: onDelayClose,\n onClick: closeOnClick ? onDelayClose : undefined,\n onFocus: onDelayOpen,\n onPointerEnter: (ev: PointerEvent<HTMLButtonElement>) => {\n if (ev.pointerType !== \"touch\") onDelayOpen()\n },\n onPointerLeave: (ev: PointerEvent<HTMLButtonElement>) => {\n if (ev.pointerType !== \"touch\") onDelayClose()\n },\n },\n )(),\n )\n },\n [\n getReferenceProps,\n describedbyId,\n onDelayOpen,\n open,\n closeOnClick,\n onDelayClose,\n ],\n )\n\n const getPositionerProps: PropGetter = useCallback(\n (props) => {\n return getPopperProps(props)\n },\n [getPopperProps],\n )\n\n const getContentProps: PropGetter = useCallback(\n (props = {}) => ({\n id: describedbyId,\n \"data-close\": dataAttr(!open),\n \"data-open\": dataAttr(open),\n role: \"tooltip\",\n onPointerLeave: handlerAll(props.onPointerLeave, onDelayClose),\n ...props,\n }),\n [describedbyId, onDelayClose, open],\n )\n\n return {\n open,\n getContentProps,\n getPositionerProps,\n getTriggerProps,\n onClose: onForceClose,\n onDelayClose,\n onDelayOpen,\n onOpen,\n }\n}\n\nexport type UseTooltipReturn = ReturnType<typeof useTooltip>\n\nexport const tooltipProps: (keyof UseTooltipProps)[] = [\n ...popperProps,\n \"open\",\n \"defaultOpen\",\n \"onOpen\",\n \"onClose\",\n \"closeDelay\",\n \"closeOnClick\",\n \"closeOnEsc\",\n \"closeOnScroll\",\n \"disabled\",\n \"openDelay\",\n]\n\nexport const useTooltipProps = <\n Y extends Dict = Dict,\n M extends keyof UseTooltipProps = keyof UseTooltipProps,\n>(\n props: Y,\n omitKeys?: M[],\n) => {\n return useSplitProps(\n props,\n tooltipProps.filter((key) => !omitKeys?.includes(key as M)),\n ) as unknown as [\n keyof UseTooltipProps extends M\n ? UseTooltipProps\n : Omit<UseTooltipProps, M>,\n Omit<\n Y,\n keyof UseTooltipProps extends M\n ? keyof UseTooltipProps\n : Exclude<keyof UseTooltipProps, M>\n >,\n ]\n}\n"],"mappings":";;;;;;;;;;AA8DA,MAAa,cAAc,QAAyB,CAAC,MAAM;CACzD,MAAM,CACJ,aACA,EACE,aAAa,GACb,eAAe,MACf,aAAa,MACb,eACA,aACA,UACA,MAAM,UACN,YAAY,GACZ,SAAS,aACT,QAAQ,gBAERA,+BAAAA,eAAe,OAAO,CAAC,MAAM,CAAC;CAClC,MAAM,iBAAA,GAAgBC,MAAAA,MAAAA,CAAM;CAC5B,MAAM,cAAA,GAAaC,MAAAA,OAAAA,CAA0B,IAAI;CACjD,MAAM,eAAA,GAAcA,MAAAA,OAAAA,CAAuB,KAAA,CAAS;CACpD,MAAM,gBAAA,GAAeA,MAAAA,OAAAA,CAAuB,KAAA,CAAS;CACrD,MAAM,EAAE,MAAM,SAAS,WAAWC,uBAAAA,cAAc;EAC9C;EACA,MAAM;EACN,SAAS;EACT,QAAQ;CACV,CAAC;CACD,MAAM,EAAE,gBAAgB,sBAAsBC,+BAAAA,UAAU;EACtD;EACA,GAAG;CACL,CAAC;CAED,MAAM,gBAAA,GAAeC,MAAAA,YAAAA,OAAkB;EACrC,IAAI,aAAa,SAAS;GACxB,aAAa,aAAa,OAAO;GAEjC,aAAa,UAAU,KAAA;EACzB;EAEA,QAAQ;CACV,GAAG,CAAC,OAAO,CAAC;CAEZ,MAAM,eAAA,GAAcA,MAAAA,YAAAA,OAAkB;EACpC,IAAI,CAAC,YAAY,CAAC,YAAY,SAAS;GACrC,IA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SAAS,aAAa;GAC/C;EACF,CACF,CAAC,CAAC,CACJ;CACF,GACA;EACE;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAEA,MAAM,sBAAA,GAAiCD,MAAAA,YAAAA,EACpC,UAAU;EACT,OAAO,eAAe,KAAK;CAC7B,GACA,CAAC,cAAc,CACjB;CAcA,OAAO;EACL;EACA,kBAAA,GAdkCA,MAAAA,YAAAA,EACjC,QAAQ,CAAC,OAAO;GACf,IAAI;GACJ,eAAA,GAAA,oBAAA,cAAc,SAAA,CAAS,CAAC,IAAI;GAC5B,cAAA,GAAA,oBAAA,cAAa,SAAA,CAAS,IAAI;GAC1B,MAAM;GACN,iBAAA,GAAA,oBAAA,cAAgB,WAAA,CAAW,MAAM,gBAAgB,YAAY;GAC7D,GAAG;EACL,IACA;GAAC;GAAe;GAAc;EAAI,CAKpB;EACd;EACA;EACA,SAAS;EACT;EACA;EACA;CACF;AACF;AAIA,MAAa,eAA0C;CACrD,GAAGE,+BAAAA;CACH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,mBAIX,OACA,aACG;CACH,OAAOC,cAAAA,cACL,OACA,aAAa,QAAQ,QAAQ,CAAC,UAAU,SAAS,GAAQ,CAAC,CAC5D;AAWF"}
|
|
@@ -52,6 +52,7 @@ const usePopover = ({ autoFocus = true, autoUpdate, modal = false, blockScrollOn
|
|
|
52
52
|
});
|
|
53
53
|
}, []);
|
|
54
54
|
const onKeyDown = useCallback((ev) => {
|
|
55
|
+
if ((0, utils_exports.isComposing)(ev.nativeEvent)) return;
|
|
55
56
|
runKeyAction(ev, { Escape: () => {
|
|
56
57
|
if (!closeOnEsc) return;
|
|
57
58
|
onClose();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-popover.js","names":["contains","focusTrap","scrollLock","focusTransfer","ariaAttr","handlerAll","dataAttr"],"sources":["../../../../src/components/popover/use-popover.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FocusEvent, KeyboardEvent, RefObject } from \"react\"\nimport type { Direction, PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport type { UsePopperProps } from \"../../hooks/use-popper\"\nimport type { Dict } from \"../../utils\"\nimport type { UsePopupAnimationProps } from \"./popover\"\nimport { useCallback, useEffect, useId, useRef } from \"react\"\nimport { useEnvironment, useSplitProps } from \"../../core\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useEventListener } from \"../../hooks/use-event-listener\"\nimport { useFocusOnShow } from \"../../hooks/use-focus\"\nimport { useOutsideClick } from \"../../hooks/use-outside-click\"\nimport { popperProps, usePopper } from \"../../hooks/use-popper\"\nimport {\n ariaAttr,\n assignRef,\n contains,\n dataAttr,\n focusTransfer,\n focusTrap,\n getEventRelatedTarget,\n handlerAll,\n mergeRefs,\n runKeyAction,\n scrollLock,\n setAttribute,\n useSafeLayoutEffect,\n useUnmountEffect,\n} from \"../../utils\"\n\nexport interface UsePopoverProps\n extends Omit<UseDisclosureProps, \"timing\">, UsePopperProps<\"button\"> {\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 * If `true`, scrolling will be disabled on the `body` when the modal opens.\n *\n * @default false\n */\n blockScrollOnMount?: boolean\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`, the popover will hide on pressing Esc key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the popover will hide on scroll.\n *\n * @default false\n */\n closeOnScroll?: boolean\n /**\n * If `true`, the popover will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The `ref` of the element that should receive focus when the popover opens.\n */\n initialFocusRef?: RefObject<HTMLElement | null>\n /**\n * If `true`, the popover will be modal.\n *\n * - scrolling is blocked.\n * - focus is trapped within the popover.\n *\n * @default false\n */\n modal?: boolean\n /**\n * If `true`, the popover will be opened when click on the field.\n *\n * @default true\n */\n openOnClick?: boolean\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end'\n */\n placement?: Direction\n /**\n * If `true`, the focus will be transferred to the popover content when the tab key is pressed.\n *\n * @default true\n */\n transferFocus?: boolean\n /**\n * Update the position of the floating element, re-rendering the component if required.\n */\n updateRef?: RefObject<() => void>\n}\n\nexport const usePopover = ({\n autoFocus = true,\n autoUpdate,\n modal = false,\n blockScrollOnMount = modal,\n closeOnBlur = true,\n closeOnEsc = true,\n closeOnScroll,\n defaultOpen,\n disabled,\n elements,\n flip,\n gutter,\n initialFocusRef,\n matchWidth,\n middleware,\n offset,\n open: openProp,\n openOnClick = true,\n placement = \"end\",\n platform,\n preventOverflow,\n strategy,\n transferFocus = true,\n transform,\n updateRef,\n whileElementsMounted,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n}: UsePopoverProps = {}) => {\n const { getDocument } = useEnvironment()\n const headerId = useId()\n const bodyId = useId()\n const contentId = useId()\n const anchorRef = useRef<HTMLElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const contentRef = useRef<HTMLElement>(null)\n const openTimeout = useRef<NodeJS.Timeout>(undefined)\n const closeTimeout = useRef<NodeJS.Timeout>(undefined)\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const { refs, update, getPopperProps } = usePopper<\"button\">({\n autoUpdate,\n elements,\n flip,\n gutter,\n matchWidth,\n middleware,\n offset,\n open,\n placement,\n platform,\n preventOverflow,\n strategy,\n transform,\n whileElementsMounted,\n })\n\n assignRef(updateRef, update)\n\n const onRestoreFocus = useCallback(() => {\n clearTimeout(closeTimeout.current)\n closeTimeout.current = setTimeout(() => {\n triggerRef.current?.focus()\n })\n }, [])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLElement>) => {\n runKeyAction(ev, {\n Escape: () => {\n if (!closeOnEsc) return\n\n onClose()\n onRestoreFocus()\n },\n })\n },\n [closeOnEsc, onClose, onRestoreFocus],\n )\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLDivElement>) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const popup = relatedTarget?.closest(\"[data-popup]\")\n\n if (popup) return\n if (contains(triggerRef.current, relatedTarget)) return\n if (contains(contentRef.current, relatedTarget)) return\n\n if (closeOnBlur) onClose()\n },\n [closeOnBlur, onClose],\n )\n\n useEventListener(getDocument(), \"scroll\", () => {\n if (open && closeOnScroll) onClose()\n })\n\n useFocusOnShow(contentRef, {\n focusTarget: initialFocusRef,\n shouldFocus: autoFocus,\n visible: open,\n })\n\n useOutsideClick({\n ref: [contentRef, triggerRef],\n enabled: open && closeOnBlur,\n handler: onClose,\n })\n\n useSafeLayoutEffect(() => {\n const el = contentRef.current\n const hasHeader = !!getDocument()?.getElementById(headerId)\n const hasBody = !!getDocument()?.getElementById(bodyId)\n\n if (el && hasHeader) setAttribute(el, \"aria-labelledby\", headerId)\n if (el && hasBody) setAttribute(el, \"aria-describedby\", bodyId)\n }, [open, headerId, bodyId])\n\n useEffect(() => {\n if (!open || !modal) return\n\n return focusTrap(contentRef.current)\n }, [open, modal])\n\n useEffect(() => {\n if (!open || !blockScrollOnMount) return\n\n return scrollLock(contentRef.current)\n }, [open, modal, blockScrollOnMount])\n\n useEffect(() => {\n if (!open || modal || !transferFocus) return\n\n return focusTransfer(contentRef.current, triggerRef.current)\n }, [open, modal, transferFocus])\n\n useUnmountEffect(() => {\n clearTimeout(openTimeout.current)\n clearTimeout(closeTimeout.current)\n })\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n \"aria-controls\": open ? contentId : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": open,\n \"aria-haspopup\": \"dialog\",\n role: \"button\",\n ...props,\n ref: mergeRefs(ref, triggerRef, (node) => {\n if (anchorRef.current == null) refs.setReference(node)\n }),\n onBlur: handlerAll(props.onBlur, (ev) =>\n !contains(contentRef.current, getEventRelatedTarget(ev)) && closeOnBlur\n ? onClose()\n : void 0,\n ),\n onClick: handlerAll(\n props.onClick,\n !open ? (!disabled && openOnClick ? onOpen : undefined) : onClose,\n ),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [\n closeOnBlur,\n contentId,\n disabled,\n onClose,\n onKeyDown,\n onOpen,\n open,\n openOnClick,\n refs,\n ],\n )\n\n const getAnchorProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => ({\n ...props,\n ref: mergeRefs(ref, anchorRef, refs.setReference),\n }),\n [refs.setReference],\n )\n\n const getPositionerProps: PropGetter = useCallback(\n (props) => getPopperProps(props),\n [getPopperProps],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => ({\n id: contentId,\n \"aria-hidden\": !open,\n \"aria-modal\": modal ? \"true\" : undefined,\n \"data-close\": dataAttr(!open),\n \"data-open\": dataAttr(open),\n \"data-popup\": dataAttr(true),\n role: \"dialog\",\n tabIndex: -1,\n ...props,\n ref: mergeRefs(ref, contentRef),\n onBlur: handlerAll(props.onBlur, onBlur),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [contentId, open, modal, onBlur, onKeyDown],\n )\n\n const getHeaderProps: PropGetter = useCallback(\n (props) => ({ id: headerId, ...props }),\n [headerId],\n )\n\n const getBodyProps: PropGetter = useCallback(\n (props) => ({ id: bodyId, ...props }),\n [bodyId],\n )\n\n const getFooterProps: PropGetter = useCallback((props) => ({ ...props }), [])\n\n const getCloseTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n ...props,\n onClick: handlerAll(props.onClick, () => {\n onClose()\n onRestoreFocus()\n }),\n }),\n [onClose, onRestoreFocus],\n )\n\n return {\n open,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n onClose,\n onOpen,\n }\n}\n\nexport type UsePopoverReturn = ReturnType<typeof usePopover>\n\nexport const popoverProps: (\n | keyof UsePopoverProps\n | keyof UsePopupAnimationProps\n)[] = [\n ...popperProps,\n \"autoFocus\",\n \"transferFocus\",\n \"blockScrollOnMount\",\n \"closeOnBlur\",\n \"closeOnEsc\",\n \"closeOnScroll\",\n \"openOnClick\",\n \"disabled\",\n \"initialFocusRef\",\n \"modal\",\n \"updateRef\",\n \"defaultOpen\",\n \"onOpen\",\n \"onClose\",\n \"animationScheme\",\n \"duration\",\n]\n\nexport const usePopoverProps = <\n Y extends Dict = Dict,\n M extends keyof UsePopoverProps | keyof UsePopupAnimationProps =\n | keyof UsePopoverProps\n | keyof UsePopupAnimationProps,\n>(\n props: Y,\n omitKeys?: M[],\n) => {\n return useSplitProps(\n props,\n popoverProps.filter((key) => !omitKeys?.includes(key as M)),\n ) as unknown as [\n keyof UsePopoverProps | keyof UsePopupAnimationProps extends M\n ? UsePopoverProps & UsePopupAnimationProps\n : Omit<UsePopoverProps & UsePopupAnimationProps, M>,\n Omit<\n Y,\n keyof UsePopoverProps | keyof UsePopupAnimationProps extends M\n ? keyof UsePopoverProps | keyof UsePopupAnimationProps\n : Exclude<keyof UsePopoverProps | keyof UsePopupAnimationProps, M>\n >,\n ]\n}\n"],"mappings":";;;;;;;;;;;;;;AA2GA,MAAa,cAAc,EACzB,YAAY,MACZ,YACA,QAAQ,OACR,qBAAqB,OACrB,cAAc,MACd,aAAa,MACb,eACA,aACA,UACA,UACA,MACA,QACA,iBACA,YACA,YACA,QACA,MAAM,UACN,cAAc,MACd,YAAY,OACZ,UACA,iBACA,UACA,gBAAgB,MAChB,WACA,WACA,sBACA,SAAS,aACT,QAAQ,eACW,CAAC,MAAM;CAC1B,MAAM,EAAE,gBAAgB,eAAe;CACvC,MAAM,WAAW,MAAM;CACvB,MAAM,SAAS,MAAM;CACrB,MAAM,YAAY,MAAM;CACxB,MAAM,YAAY,OAAoB,IAAI;CAC1C,MAAM,aAAa,OAA0B,IAAI;CAC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,CAAC;CAa5E,OAAO;EACL;EACA;EACA;EACA,sBAfiD,aAChD,QAAQ,CAAC,OAAO;GACf,GAAG;GACH,UAAA,GAASA,cAAAA,WAAAA,CAAW,MAAM,eAAe;IACvC,QAAQ;IACR,eAAe;GACjB,CAAC;EACH,IACA,CAAC,SAAS,cAAc,CAOL;EACnB;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF;AAIA,MAAa,eAGP;CACJ,GAAG;CACH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,mBAMX,OACA,aACG;CACH,OAAO,cACL,OACA,aAAa,QAAQ,QAAQ,CAAC,UAAU,SAAS,GAAQ,CAAC,CAC5D;AAWF"}
|
|
1
|
+
{"version":3,"file":"use-popover.js","names":["isComposing","contains","focusTrap","scrollLock","focusTransfer","ariaAttr","handlerAll","dataAttr"],"sources":["../../../../src/components/popover/use-popover.tsx"],"sourcesContent":["\"use client\"\n\nimport type { FocusEvent, KeyboardEvent, RefObject } from \"react\"\nimport type { Direction, PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport type { UsePopperProps } from \"../../hooks/use-popper\"\nimport type { Dict } from \"../../utils\"\nimport type { UsePopupAnimationProps } from \"./popover\"\nimport { useCallback, useEffect, useId, useRef } from \"react\"\nimport { useEnvironment, useSplitProps } from \"../../core\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useEventListener } from \"../../hooks/use-event-listener\"\nimport { useFocusOnShow } from \"../../hooks/use-focus\"\nimport { useOutsideClick } from \"../../hooks/use-outside-click\"\nimport { popperProps, usePopper } from \"../../hooks/use-popper\"\nimport {\n ariaAttr,\n assignRef,\n contains,\n dataAttr,\n focusTransfer,\n focusTrap,\n getEventRelatedTarget,\n handlerAll,\n isComposing,\n mergeRefs,\n runKeyAction,\n scrollLock,\n setAttribute,\n useSafeLayoutEffect,\n useUnmountEffect,\n} from \"../../utils\"\n\nexport interface UsePopoverProps\n extends Omit<UseDisclosureProps, \"timing\">, UsePopperProps<\"button\"> {\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 * If `true`, scrolling will be disabled on the `body` when the modal opens.\n *\n * @default false\n */\n blockScrollOnMount?: boolean\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`, the popover will hide on pressing Esc key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the popover will hide on scroll.\n *\n * @default false\n */\n closeOnScroll?: boolean\n /**\n * If `true`, the popover will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The `ref` of the element that should receive focus when the popover opens.\n */\n initialFocusRef?: RefObject<HTMLElement | null>\n /**\n * If `true`, the popover will be modal.\n *\n * - scrolling is blocked.\n * - focus is trapped within the popover.\n *\n * @default false\n */\n modal?: boolean\n /**\n * If `true`, the popover will be opened when click on the field.\n *\n * @default true\n */\n openOnClick?: boolean\n /**\n * The placement of the popper relative to its reference.\n *\n * @default 'end'\n */\n placement?: Direction\n /**\n * If `true`, the focus will be transferred to the popover content when the tab key is pressed.\n *\n * @default true\n */\n transferFocus?: boolean\n /**\n * Update the position of the floating element, re-rendering the component if required.\n */\n updateRef?: RefObject<() => void>\n}\n\nexport const usePopover = ({\n autoFocus = true,\n autoUpdate,\n modal = false,\n blockScrollOnMount = modal,\n closeOnBlur = true,\n closeOnEsc = true,\n closeOnScroll,\n defaultOpen,\n disabled,\n elements,\n flip,\n gutter,\n initialFocusRef,\n matchWidth,\n middleware,\n offset,\n open: openProp,\n openOnClick = true,\n placement = \"end\",\n platform,\n preventOverflow,\n strategy,\n transferFocus = true,\n transform,\n updateRef,\n whileElementsMounted,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n}: UsePopoverProps = {}) => {\n const { getDocument } = useEnvironment()\n const headerId = useId()\n const bodyId = useId()\n const contentId = useId()\n const anchorRef = useRef<HTMLElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const contentRef = useRef<HTMLElement>(null)\n const openTimeout = useRef<NodeJS.Timeout>(undefined)\n const closeTimeout = useRef<NodeJS.Timeout>(undefined)\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const { refs, update, getPopperProps } = usePopper<\"button\">({\n autoUpdate,\n elements,\n flip,\n gutter,\n matchWidth,\n middleware,\n offset,\n open,\n placement,\n platform,\n preventOverflow,\n strategy,\n transform,\n whileElementsMounted,\n })\n\n assignRef(updateRef, update)\n\n const onRestoreFocus = useCallback(() => {\n clearTimeout(closeTimeout.current)\n closeTimeout.current = setTimeout(() => {\n triggerRef.current?.focus()\n })\n }, [])\n\n const onKeyDown = useCallback(\n (ev: KeyboardEvent<HTMLElement>) => {\n if (isComposing(ev.nativeEvent)) return\n\n runKeyAction(ev, {\n Escape: () => {\n if (!closeOnEsc) return\n\n onClose()\n onRestoreFocus()\n },\n })\n },\n [closeOnEsc, onClose, onRestoreFocus],\n )\n\n const onBlur = useCallback(\n (ev: FocusEvent<HTMLDivElement>) => {\n const relatedTarget = getEventRelatedTarget(ev)\n const popup = relatedTarget?.closest(\"[data-popup]\")\n\n if (popup) return\n if (contains(triggerRef.current, relatedTarget)) return\n if (contains(contentRef.current, relatedTarget)) return\n\n if (closeOnBlur) onClose()\n },\n [closeOnBlur, onClose],\n )\n\n useEventListener(getDocument(), \"scroll\", () => {\n if (open && closeOnScroll) onClose()\n })\n\n useFocusOnShow(contentRef, {\n focusTarget: initialFocusRef,\n shouldFocus: autoFocus,\n visible: open,\n })\n\n useOutsideClick({\n ref: [contentRef, triggerRef],\n enabled: open && closeOnBlur,\n handler: onClose,\n })\n\n useSafeLayoutEffect(() => {\n const el = contentRef.current\n const hasHeader = !!getDocument()?.getElementById(headerId)\n const hasBody = !!getDocument()?.getElementById(bodyId)\n\n if (el && hasHeader) setAttribute(el, \"aria-labelledby\", headerId)\n if (el && hasBody) setAttribute(el, \"aria-describedby\", bodyId)\n }, [open, headerId, bodyId])\n\n useEffect(() => {\n if (!open || !modal) return\n\n return focusTrap(contentRef.current)\n }, [open, modal])\n\n useEffect(() => {\n if (!open || !blockScrollOnMount) return\n\n return scrollLock(contentRef.current)\n }, [open, modal, blockScrollOnMount])\n\n useEffect(() => {\n if (!open || modal || !transferFocus) return\n\n return focusTransfer(contentRef.current, triggerRef.current)\n }, [open, modal, transferFocus])\n\n useUnmountEffect(() => {\n clearTimeout(openTimeout.current)\n clearTimeout(closeTimeout.current)\n })\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n ({ ref, ...props } = {}) => ({\n \"aria-controls\": open ? contentId : undefined,\n \"aria-disabled\": ariaAttr(disabled),\n \"aria-expanded\": open,\n \"aria-haspopup\": \"dialog\",\n role: \"button\",\n ...props,\n ref: mergeRefs(ref, triggerRef, (node) => {\n if (anchorRef.current == null) refs.setReference(node)\n }),\n onBlur: handlerAll(props.onBlur, (ev) =>\n !contains(contentRef.current, getEventRelatedTarget(ev)) && closeOnBlur\n ? onClose()\n : void 0,\n ),\n onClick: handlerAll(\n props.onClick,\n !open ? (!disabled && openOnClick ? onOpen : undefined) : onClose,\n ),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [\n closeOnBlur,\n contentId,\n disabled,\n onClose,\n onKeyDown,\n onOpen,\n open,\n openOnClick,\n refs,\n ],\n )\n\n const getAnchorProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => ({\n ...props,\n ref: mergeRefs(ref, anchorRef, refs.setReference),\n }),\n [refs.setReference],\n )\n\n const getPositionerProps: PropGetter = useCallback(\n (props) => getPopperProps(props),\n [getPopperProps],\n )\n\n const getContentProps: PropGetter = useCallback(\n ({ ref, ...props } = {}) => ({\n id: contentId,\n \"aria-hidden\": !open,\n \"aria-modal\": modal ? \"true\" : undefined,\n \"data-close\": dataAttr(!open),\n \"data-open\": dataAttr(open),\n \"data-popup\": dataAttr(true),\n role: \"dialog\",\n tabIndex: -1,\n ...props,\n ref: mergeRefs(ref, contentRef),\n onBlur: handlerAll(props.onBlur, onBlur),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown),\n }),\n [contentId, open, modal, onBlur, onKeyDown],\n )\n\n const getHeaderProps: PropGetter = useCallback(\n (props) => ({ id: headerId, ...props }),\n [headerId],\n )\n\n const getBodyProps: PropGetter = useCallback(\n (props) => ({ id: bodyId, ...props }),\n [bodyId],\n )\n\n const getFooterProps: PropGetter = useCallback((props) => ({ ...props }), [])\n\n const getCloseTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => ({\n ...props,\n onClick: handlerAll(props.onClick, () => {\n onClose()\n onRestoreFocus()\n }),\n }),\n [onClose, onRestoreFocus],\n )\n\n return {\n open,\n getAnchorProps,\n getBodyProps,\n getCloseTriggerProps,\n getContentProps,\n getFooterProps,\n getHeaderProps,\n getPositionerProps,\n getTriggerProps,\n onClose,\n onOpen,\n }\n}\n\nexport type UsePopoverReturn = ReturnType<typeof usePopover>\n\nexport const popoverProps: (\n | keyof UsePopoverProps\n | keyof UsePopupAnimationProps\n)[] = [\n ...popperProps,\n \"autoFocus\",\n \"transferFocus\",\n \"blockScrollOnMount\",\n \"closeOnBlur\",\n \"closeOnEsc\",\n \"closeOnScroll\",\n \"openOnClick\",\n \"disabled\",\n \"initialFocusRef\",\n \"modal\",\n \"updateRef\",\n \"defaultOpen\",\n \"onOpen\",\n \"onClose\",\n \"animationScheme\",\n \"duration\",\n]\n\nexport const usePopoverProps = <\n Y extends Dict = Dict,\n M extends keyof UsePopoverProps | keyof UsePopupAnimationProps =\n | keyof UsePopoverProps\n | keyof UsePopupAnimationProps,\n>(\n props: Y,\n omitKeys?: M[],\n) => {\n return useSplitProps(\n props,\n popoverProps.filter((key) => !omitKeys?.includes(key as M)),\n ) as unknown as [\n keyof UsePopoverProps | keyof UsePopupAnimationProps extends M\n ? UsePopoverProps & UsePopupAnimationProps\n : Omit<UsePopoverProps & UsePopupAnimationProps, M>,\n Omit<\n Y,\n keyof UsePopoverProps | keyof UsePopupAnimationProps extends M\n ? keyof UsePopoverProps | keyof UsePopupAnimationProps\n : Exclude<keyof UsePopoverProps | keyof UsePopupAnimationProps, M>\n >,\n ]\n}\n"],"mappings":";;;;;;;;;;;;;;AA4GA,MAAa,cAAc,EACzB,YAAY,MACZ,YACA,QAAQ,OACR,qBAAqB,OACrB,cAAc,MACd,aAAa,MACb,eACA,aACA,UACA,UACA,MACA,QACA,iBACA,YACA,YACA,QACA,MAAM,UACN,cAAc,MACd,YAAY,OACZ,UACA,iBACA,UACA,gBAAgB,MAChB,WACA,WACA,sBACA,SAAS,aACT,QAAQ,eACW,CAAC,MAAM;CAC1B,MAAM,EAAE,gBAAgB,eAAe;CACvC,MAAM,WAAW,MAAM;CACvB,MAAM,SAAS,MAAM;CACrB,MAAM,YAAY,MAAM;CACxB,MAAM,YAAY,OAAoB,IAAI;CAC1C,MAAM,aAAa,OAA0B,IAAI;CACjD,MAAM,aAAa,OAAoB,IAAI;CAC3C,MAAM,cAAc,OAAuB,KAAA,CAAS;CACpD,MAAM,eAAe,OAAuB,KAAA,CAAS;CACrD,MAAM,EAAE,MAAM,SAAS,WAAW,cAAc;EAC9C;EACA,MAAM;EACN,SAAS;EACT,QAAQ;CACV,CAAC;CACD,MAAM,EAAE,MAAM,QAAQ,mBAAmB,UAAoB;EAC3D;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,UAAU,WAAW,MAAM;CAE3B,MAAM,iBAAiB,kBAAkB;EACvC,aAAa,aAAa,OAAO;EACjC,aAAa,UAAU,iBAAiB;GACtC,WAAW,SAAS,MAAM;EAC5B,CAAC;CACH,GAAG,CAAC,CAAC;CAEL,MAAM,YAAY,aACf,OAAmC;EAClC,KAAA,GAAIA,cAAAA,YAAAA,CAAY,GAAG,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ltip = (props = {}) => {
|
|
|
52
52
|
onForceClose();
|
|
53
53
|
}, closeDelay);
|
|
54
54
|
}, [closeDelay, onForceClose]);
|
|
55
|
-
useEventListener(() => (0, utils_exports.getDocument)(triggerRef.current), "keydown", (
|
|
56
|
-
if (
|
|
55
|
+
useEventListener(() => (0, utils_exports.getDocument)(triggerRef.current), "keydown", (ev) => {
|
|
56
|
+
if ((0, utils_exports.isComposing)(ev)) return;
|
|
57
|
+
if (closeOnEsc && ev.key === "Escape") onDelayClose();
|
|
57
58
|
});
|
|
58
59
|
useEventListener(() => (0, utils_exports.getDocument)(triggerRef.current), "scroll", () => {
|
|
59
60
|
if (open && closeOnScroll) onForceClose();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-tooltip.js","names":["getWindow","getDocument","dataAttr","handlerAll"],"sources":["../../../../src/components/tooltip/use-tooltip.tsx"],"sourcesContent":["\"use client\"\n\nimport type { PointerEvent } from \"react\"\nimport type { PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport type { UsePopperProps } from \"../../hooks/use-popper\"\nimport type { Dict } from \"../../utils\"\nimport { useCallback, useId, useRef } from \"react\"\nimport { mergeProps, useSplitProps } from \"../../core\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useEventListener } from \"../../hooks/use-event-listener\"\nimport { useOutsideClick } from \"../../hooks/use-outside-click\"\nimport { popperProps, usePopper, usePopperProps } from \"../../hooks/use-popper\"\nimport {\n dataAttr,\n getDocument,\n getWindow,\n handlerAll,\n useUnmountEffect,\n} from \"../../utils\"\n\nexport interface UseTooltipProps\n extends Omit<UseDisclosureProps, \"timing\">, UsePopperProps<\"button\"> {\n /**\n * The delay before hiding the tooltip.\n *\n * @default 100\n */\n closeDelay?: number\n /**\n * If `true`, the tooltip will hide on click.\n *\n * @default true\n */\n closeOnClick?: boolean\n /**\n * If `true`, the tooltip will hide on pressing Esc key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the tooltip will hide on scroll.\n *\n * @default false\n */\n closeOnScroll?: boolean\n /**\n * If `true`, the tooltip will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The delay before showing the tooltip.\n *\n * @default 400\n */\n openDelay?: number\n}\n\nexport const useTooltip = (props: UseTooltipProps = {}) => {\n const [\n popperProps,\n {\n closeDelay = 0,\n closeOnClick = true,\n closeOnEsc = true,\n closeOnScroll,\n defaultOpen,\n disabled,\n open: openProp,\n openDelay = 0,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n },\n ] = usePopperProps(props, [\"open\"])\n const describedbyId = useId()\n const triggerRef = useRef<HTMLButtonElement>(null)\n const openTimeout = useRef<NodeJS.Timeout>(undefined)\n const closeTimeout = useRef<NodeJS.Timeout>(undefined)\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const { getPopperProps, getReferenceProps } = usePopper({\n open,\n ...popperProps,\n })\n\n const onForceClose = useCallback(() => {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current)\n\n closeTimeout.current = undefined\n }\n\n onClose()\n }, [onClose])\n\n const onDelayOpen = useCallback(() => {\n if (!disabled && !openTimeout.current) {\n if (open) onForceClose()\n\n openTimeout.current = getWindow(triggerRef.current).setTimeout(\n onOpen,\n openDelay,\n )\n }\n }, [disabled, open, onForceClose, onOpen, openDelay])\n\n const onDelayClose = useCallback(() => {\n if (openTimeout.current) {\n clearTimeout(openTimeout.current)\n openTimeout.current = undefined\n }\n\n closeTimeout.current = getWindow(triggerRef.current).setTimeout(() => {\n onForceClose()\n }, closeDelay)\n }, [closeDelay, onForceClose])\n\n useEventListener(\n () => getDocument(triggerRef.current),\n \"keydown\",\n (
|
|
1
|
+
{"version":3,"file":"use-tooltip.js","names":["getWindow","getDocument","isComposing","dataAttr","handlerAll"],"sources":["../../../../src/components/tooltip/use-tooltip.tsx"],"sourcesContent":["\"use client\"\n\nimport type { PointerEvent } from \"react\"\nimport type { PropGetter } from \"../../core\"\nimport type { UseDisclosureProps } from \"../../hooks/use-disclosure\"\nimport type { UsePopperProps } from \"../../hooks/use-popper\"\nimport type { Dict } from \"../../utils\"\nimport { useCallback, useId, useRef } from \"react\"\nimport { mergeProps, useSplitProps } from \"../../core\"\nimport { useDisclosure } from \"../../hooks/use-disclosure\"\nimport { useEventListener } from \"../../hooks/use-event-listener\"\nimport { useOutsideClick } from \"../../hooks/use-outside-click\"\nimport { popperProps, usePopper, usePopperProps } from \"../../hooks/use-popper\"\nimport {\n dataAttr,\n getDocument,\n getWindow,\n handlerAll,\n isComposing,\n useUnmountEffect,\n} from \"../../utils\"\n\nexport interface UseTooltipProps\n extends Omit<UseDisclosureProps, \"timing\">, UsePopperProps<\"button\"> {\n /**\n * The delay before hiding the tooltip.\n *\n * @default 100\n */\n closeDelay?: number\n /**\n * If `true`, the tooltip will hide on click.\n *\n * @default true\n */\n closeOnClick?: boolean\n /**\n * If `true`, the tooltip will hide on pressing Esc key.\n *\n * @default true\n */\n closeOnEsc?: boolean\n /**\n * If `true`, the tooltip will hide on scroll.\n *\n * @default false\n */\n closeOnScroll?: boolean\n /**\n * If `true`, the tooltip will be disabled.\n *\n * @default false\n */\n disabled?: boolean\n /**\n * The delay before showing the tooltip.\n *\n * @default 400\n */\n openDelay?: number\n}\n\nexport const useTooltip = (props: UseTooltipProps = {}) => {\n const [\n popperProps,\n {\n closeDelay = 0,\n closeOnClick = true,\n closeOnEsc = true,\n closeOnScroll,\n defaultOpen,\n disabled,\n open: openProp,\n openDelay = 0,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n },\n ] = usePopperProps(props, [\"open\"])\n const describedbyId = useId()\n const triggerRef = useRef<HTMLButtonElement>(null)\n const openTimeout = useRef<NodeJS.Timeout>(undefined)\n const closeTimeout = useRef<NodeJS.Timeout>(undefined)\n const { open, onClose, onOpen } = useDisclosure({\n defaultOpen,\n open: openProp,\n onClose: onCloseProp,\n onOpen: onOpenProp,\n })\n const { getPopperProps, getReferenceProps } = usePopper({\n open,\n ...popperProps,\n })\n\n const onForceClose = useCallback(() => {\n if (closeTimeout.current) {\n clearTimeout(closeTimeout.current)\n\n closeTimeout.current = undefined\n }\n\n onClose()\n }, [onClose])\n\n const onDelayOpen = useCallback(() => {\n if (!disabled && !openTimeout.current) {\n if (open) onForceClose()\n\n openTimeout.current = getWindow(triggerRef.current).setTimeout(\n onOpen,\n openDelay,\n )\n }\n }, [disabled, open, onForceClose, onOpen, openDelay])\n\n const onDelayClose = useCallback(() => {\n if (openTimeout.current) {\n clearTimeout(openTimeout.current)\n openTimeout.current = undefined\n }\n\n closeTimeout.current = getWindow(triggerRef.current).setTimeout(() => {\n onForceClose()\n }, closeDelay)\n }, [closeDelay, onForceClose])\n\n useEventListener(\n () => getDocument(triggerRef.current),\n \"keydown\",\n (ev) => {\n if (isComposing(ev)) return\n\n if (closeOnEsc && ev.key === \"Escape\") onDelayClose()\n },\n )\n\n useEventListener(\n () => getDocument(triggerRef.current),\n \"scroll\",\n () => {\n if (open && closeOnScroll) onForceClose()\n },\n )\n\n useOutsideClick({\n ref: triggerRef,\n enabled: open,\n handler: () => {\n onDelayClose()\n },\n })\n\n useUnmountEffect(() => {\n clearTimeout(openTimeout.current)\n clearTimeout(closeTimeout.current)\n })\n\n const getTriggerProps: PropGetter<\"button\"> = useCallback(\n (props = {}) => {\n return getReferenceProps(\n mergeProps(\n props,\n {\n ref: triggerRef,\n \"aria-describedby\": open ? describedbyId : undefined,\n },\n {\n onBlur: onDelayClose,\n onClick: closeOnClick ? onDelayClose : undefined,\n onFocus: onDelayOpen,\n onPointerEnter: (ev: PointerEvent<HTMLButtonElement>) => {\n if (ev.pointerType !== \"touch\") onDelayOpen()\n },\n onPointerLeave: (ev: PointerEvent<HTMLButtonElement>) => {\n if (ev.pointerType !== \"touch\") onDelayClose()\n },\n },\n )(),\n )\n },\n [\n getReferenceProps,\n describedbyId,\n onDelayOpen,\n open,\n closeOnClick,\n onDelayClose,\n ],\n )\n\n const getPositionerProps: PropGetter = useCallback(\n (props) => {\n return getPopperProps(props)\n },\n [getPopperProps],\n )\n\n const getContentProps: PropGetter = useCallback(\n (props = {}) => ({\n id: describedbyId,\n \"data-close\": dataAttr(!open),\n \"data-open\": dataAttr(open),\n role: \"tooltip\",\n onPointerLeave: handlerAll(props.onPointerLeave, onDelayClose),\n ...props,\n }),\n [describedbyId, onDelayClose, open],\n )\n\n return {\n open,\n getContentProps,\n getPositionerProps,\n getTriggerProps,\n onClose: onForceClose,\n onDelayClose,\n onDelayOpen,\n onOpen,\n }\n}\n\nexport type UseTooltipReturn = ReturnType<typeof useTooltip>\n\nexport const tooltipProps: (keyof UseTooltipProps)[] = [\n ...popperProps,\n \"open\",\n \"defaultOpen\",\n \"onOpen\",\n \"onClose\",\n \"closeDelay\",\n \"closeOnClick\",\n \"closeOnEsc\",\n \"closeOnScroll\",\n \"disabled\",\n \"openDelay\",\n]\n\nexport const useTooltipProps = <\n Y extends Dict = Dict,\n M extends keyof UseTooltipProps = keyof UseTooltipProps,\n>(\n props: Y,\n omitKeys?: M[],\n) => {\n return useSplitProps(\n props,\n tooltipProps.filter((key) => !omitKeys?.includes(key as M)),\n ) as unknown as [\n keyof UseTooltipProps extends M\n ? UseTooltipProps\n : Omit<UseTooltipProps, M>,\n Omit<\n Y,\n keyof UseTooltipProps extends M\n ? keyof UseTooltipProps\n : Exclude<keyof UseTooltipProps, M>\n >,\n ]\n}\n"],"mappings":";;;;;;;;;;AA8DA,MAAa,cAAc,QAAyB,CAAC,MAAM;CACzD,MAAM,CACJ,aACA,EACE,aAAa,GACb,eAAe,MACf,aAAa,MACb,eACA,aACA,UACA,MAAM,UACN,YAAY,GACZ,SAAS,aACT,QAAQ,gBAER,eAAe,OAAO,CAAC,MAAM,CAAC;CAClC,MAAM,gBAAgB,MAAM;CAC5B,MAAM,aAAa,OAA0B,IAAI;CACjD,MAAM,cAAc,OAAuB,KAAA,CAAS;CACpD,MA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a,OAAO;CACnC,CAAC;CAED,MAAM,kBAAwC,aAC3C,QAAQ,CAAC,MAAM;EACd,OAAO,kBACL,WACE,OACA;GACE,KAAK;GACL,oBAAoB,OAAO,gBAAgB,KAAA;EAC7C,GACA;GACE,QAAQ;GACR,SAAS,eAAe,eAAe,KAAA;GACvC,SAAS;GACT,iBAAiB,OAAwC;IACvD,IAAI,GAAG,gBAAgB,SAAS,YAAY;GAC9C;GACA,iBAAiB,OAAwC;IACvD,IAAI,GAAG,gBAAgB,SAAS,aAAa;GAC/C;EACF,CACF,CAAC,CAAC,CACJ;CACF,GACA;EACE;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAEA,MAAM,qBAAiC,aACpC,UAAU;EACT,OAAO,eAAe,KAAK;CAC7B,GACA,CAAC,cAAc,CACjB;CAcA,OAAO;EACL;EACA,iBAdkC,aACjC,QAAQ,CAAC,OAAO;GACf,IAAI;GACJ,eAAA,GAAcE,cAAAA,SAAAA,CAAS,CAAC,IAAI;GAC5B,cAAA,GAAaA,cAAAA,SAAAA,CAAS,IAAI;GAC1B,MAAM;GACN,iBAAA,GAAgBC,cAAAA,WAAAA,CAAW,MAAM,gBAAgB,YAAY;GAC7D,GAAG;EACL,IACA;GAAC;GAAe;GAAc;EAAI,CAKpB;EACd;EACA;EACA,SAAS;EACT;EACA;EACA;CACF;AACF;AAIA,MAAa,eAA0C;CACrD,GAAG;CACH;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,mBAIX,OACA,aACG;CACH,OAAO,cACL,OACA,aAAa,QAAQ,QAAQ,CAAC,UAAU,SAAS,GAAQ,CAAC,CAC5D;AAWF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.type.js";
|
|
2
2
|
import { CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
|
|
3
3
|
import "../../index.js";
|
|
4
|
-
export declare const autocompleteStyle: ComponentSlotStyle<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "
|
|
4
|
+
export declare const autocompleteStyle: ComponentSlotStyle<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "indicator" | "field" | "valueText" | "empty", CSSPropObject<CSSSlotObject<"input" | "label" | "option" | "content" | "group" | "separator" | "icon" | "root" | "indicator" | "field" | "valueText" | "empty">>, {
|
|
5
5
|
xs: {
|
|
6
6
|
empty: {
|
|
7
7
|
gap: "1.5";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.type.js";
|
|
2
2
|
import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.type.js";
|
|
3
3
|
import "../../index.js";
|
|
4
|
-
export declare const calendarStyle: ComponentSlotStyle<"button" | "select" | "cell" | "navigation" | "row" | "separator" | "next" | "prev" | "root" | "
|
|
4
|
+
export declare const calendarStyle: ComponentSlotStyle<"button" | "select" | "cell" | "navigation" | "row" | "separator" | "next" | "prev" | "root" | "day" | "month" | "months" | "years" | "week" | "weeks" | "weekday" | "control", {
|
|
5
5
|
/**
|
|
6
6
|
* If `true`, the calendar will be fixed rows.
|
|
7
7
|
*
|
|
@@ -73,5 +73,5 @@ export declare const calendarStyle: ComponentSlotStyle<"button" | "select" | "ce
|
|
|
73
73
|
"--font-size": "fontSizes.xl";
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
|
-
}, CSSModifierObject<CSSSlotObject<"button" | "select" | "cell" | "navigation" | "row" | "separator" | "next" | "prev" | "root" | "
|
|
76
|
+
}, CSSModifierObject<CSSSlotObject<"button" | "select" | "cell" | "navigation" | "row" | "separator" | "next" | "prev" | "root" | "day" | "month" | "months" | "years" | "week" | "weeks" | "weekday" | "control">>>;
|
|
77
77
|
export type CalendarStyle = typeof calendarStyle;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.type.js";
|
|
2
2
|
import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
|
|
3
3
|
import "../../index.js";
|
|
4
|
-
export declare const carouselStyle: ComponentSlotStyle<"list" | "next" | "prev" | "root" | "
|
|
4
|
+
export declare const carouselStyle: ComponentSlotStyle<"list" | "next" | "prev" | "root" | "trigger" | "item" | "indicator" | "indicators", CSSPropObject<CSSSlotObject<"list" | "next" | "prev" | "root" | "trigger" | "item" | "indicator" | "indicators">>, {
|
|
5
5
|
sm: {
|
|
6
6
|
root: {
|
|
7
7
|
h: "sm";
|
|
@@ -17,5 +17,5 @@ export declare const carouselStyle: ComponentSlotStyle<"list" | "next" | "prev"
|
|
|
17
17
|
h: "lg";
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
}, CSSModifierObject<CSSSlotObject<"list" | "next" | "prev" | "root" | "
|
|
20
|
+
}, CSSModifierObject<CSSSlotObject<"list" | "next" | "prev" | "root" | "trigger" | "item" | "indicator" | "indicators">>>;
|
|
21
21
|
export type CarouselStyle = typeof carouselStyle;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.type.js";
|
|
2
2
|
import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
|
|
3
3
|
import "../../index.js";
|
|
4
|
-
export declare const polarChartStyle: ComponentSlotStyle<"label" | "grid" | "dot" | "root" | "
|
|
4
|
+
export declare const polarChartStyle: ComponentSlotStyle<"label" | "grid" | "dot" | "root" | "activeDot" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "labelLine" | "labelList" | "pie" | "radar" | "radial" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector", CSSPropObject<CSSSlotObject<"label" | "grid" | "dot" | "root" | "activeDot" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "labelLine" | "labelList" | "pie" | "radar" | "radial" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector">>, CSSModifierObject<CSSSlotObject<"label" | "grid" | "dot" | "root" | "activeDot" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "labelLine" | "labelList" | "pie" | "radar" | "radial" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector">>, CSSModifierObject<CSSSlotObject<"label" | "grid" | "dot" | "root" | "activeDot" | "angleAxis" | "angleAxisLabel" | "angleAxisLine" | "angleAxisTick" | "angleAxisTickLine" | "labelLine" | "labelList" | "pie" | "radar" | "radial" | "radialBackground" | "radiusAxis" | "radiusAxisLabel" | "radiusAxisLine" | "radiusAxisTick" | "radiusAxisTickLine" | "sector">>>;
|
|
5
5
|
export type PolarChartStyle = typeof polarChartStyle;
|
|
@@ -63,7 +63,7 @@ export interface CheckboxCardRootProps<Y extends string = string> extends Merge<
|
|
|
63
63
|
*/
|
|
64
64
|
rootProps?: HTMLStyledProps<"label">;
|
|
65
65
|
}
|
|
66
|
-
declare const component: <H extends "fragment" | As = "div", R extends import("@yamada-ui/utils").Dict = import("@yamada-ui/utils").Dict<any>>(el: H | import("react").FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "
|
|
66
|
+
declare const component: <H extends "fragment" | As = "div", R extends import("@yamada-ui/utils").Dict = import("@yamada-ui/utils").Dict<any>>(el: H | import("react").FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "indicator" | "description" | "addon", {
|
|
67
67
|
justify: {
|
|
68
68
|
end: {
|
|
69
69
|
addon: {
|
|
@@ -209,7 +209,7 @@ declare const component: <H extends "fragment" | As = "div", R extends import("@
|
|
|
209
209
|
};
|
|
210
210
|
};
|
|
211
211
|
};
|
|
212
|
-
}>>> | undefined, { name, className, ...options }?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? import("react").FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, CheckboxCardPropsContext: import("react").Context<Partial<CheckboxCardRootProps<string>> | undefined>, useCheckboxCardPropsContext: () => Partial<CheckboxCardRootProps<string>> | undefined, useRootComponentProps: <Y extends import("@yamada-ui/utils").Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "
|
|
212
|
+
}>>> | undefined, { name, className, ...options }?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? import("react").FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, CheckboxCardPropsContext: import("react").Context<Partial<CheckboxCardRootProps<string>> | undefined>, useCheckboxCardPropsContext: () => Partial<CheckboxCardRootProps<string>> | undefined, useRootComponentProps: <Y extends import("@yamada-ui/utils").Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "indicator" | "description" | "addon", {
|
|
213
213
|
justify: {
|
|
214
214
|
end: {
|
|
215
215
|
addon: {
|
|
@@ -355,7 +355,7 @@ declare const component: <H extends "fragment" | As = "div", R extends import("@
|
|
|
355
355
|
};
|
|
356
356
|
};
|
|
357
357
|
};
|
|
358
|
-
}>>> | undefined, { className, withContext, transferProps }?: UseComponentPropsOptions<R>) => [CSSSlotObject, Merge<WithoutThemeProps<Y, ComponentSlotStyle<"group" | "root" | "
|
|
358
|
+
}>>> | undefined, { className, withContext, transferProps }?: UseComponentPropsOptions<R>) => [CSSSlotObject, Merge<WithoutThemeProps<Y, ComponentSlotStyle<"group" | "root" | "indicator" | "description" | "addon", {
|
|
359
359
|
justify: {
|
|
360
360
|
end: {
|
|
361
361
|
addon: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.type.js";
|
|
2
2
|
import "../../index.js";
|
|
3
|
-
export declare const checkboxCardStyle: ComponentSlotStyle<"group" | "root" | "
|
|
3
|
+
export declare const checkboxCardStyle: ComponentSlotStyle<"group" | "root" | "indicator" | "description" | "addon", {
|
|
4
4
|
/**
|
|
5
5
|
* The justify indicator of the component
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.type.js";
|
|
2
2
|
import "../../index.js";
|
|
3
|
-
export declare const dataListStyle: ComponentSlotStyle<"term" | "root" | "
|
|
3
|
+
export declare const dataListStyle: ComponentSlotStyle<"term" | "root" | "item" | "description", {
|
|
4
4
|
/**
|
|
5
5
|
* The orientation of the data list.
|
|
6
6
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.type.js";
|
|
2
2
|
import { CSSModifierObject, CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
|
|
3
3
|
import "../../index.js";
|
|
4
|
-
export declare const emptyState: ComponentSlotStyle<"title" | "content" | "root" | "
|
|
4
|
+
export declare const emptyState: ComponentSlotStyle<"title" | "content" | "root" | "indicator" | "description", CSSPropObject<CSSSlotObject<"title" | "content" | "root" | "indicator" | "description">>, {
|
|
5
5
|
sm: {
|
|
6
6
|
content: {
|
|
7
7
|
gap: "xs";
|
|
@@ -47,5 +47,5 @@ export declare const emptyState: ComponentSlotStyle<"title" | "content" | "root"
|
|
|
47
47
|
fontSize: "xl";
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
|
-
}, CSSModifierObject<CSSSlotObject<"title" | "content" | "root" | "
|
|
50
|
+
}, CSSModifierObject<CSSSlotObject<"title" | "content" | "root" | "indicator" | "description">>>;
|
|
51
51
|
export type EmptyState = typeof emptyState;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.type.js";
|
|
2
2
|
import { CSSPropObject, CSSSlotObject } from "../../core/css/index.type.js";
|
|
3
3
|
import "../../index.js";
|
|
4
|
-
export declare const numberInputStyle: ComponentSlotStyle<"button" | "root" | "
|
|
4
|
+
export declare const numberInputStyle: ComponentSlotStyle<"button" | "root" | "control" | "field" | "decrement" | "increment", CSSPropObject<CSSSlotObject<"button" | "root" | "control" | "field" | "decrement" | "increment">>, {
|
|
5
5
|
xs: {
|
|
6
6
|
control: {
|
|
7
7
|
boxSize: "calc({--height} - {spaces.2})";
|
|
@@ -55,7 +55,7 @@ export interface RadioCardRootProps<Y extends string = string> extends Merge<HTM
|
|
|
55
55
|
*/
|
|
56
56
|
rootProps?: HTMLStyledProps<"label">;
|
|
57
57
|
}
|
|
58
|
-
declare const component: <H extends "fragment" | As = "div", R extends import("@yamada-ui/utils").Dict = import("@yamada-ui/utils").Dict<any>>(el: H | import("react").FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "
|
|
58
|
+
declare const component: <H extends "fragment" | As = "div", R extends import("@yamada-ui/utils").Dict = import("@yamada-ui/utils").Dict<any>>(el: H | import("react").FC<R>, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "indicator" | "description" | "addon", {
|
|
59
59
|
justify: {
|
|
60
60
|
end: {
|
|
61
61
|
addon: {
|
|
@@ -228,7 +228,7 @@ declare const component: <H extends "fragment" | As = "div", R extends import("@
|
|
|
228
228
|
};
|
|
229
229
|
};
|
|
230
230
|
};
|
|
231
|
-
}>>> | undefined, { name, className, ...options }?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? import("react").FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, RadioCardPropsContext: import("react").Context<Partial<RadioCardRootProps<string>> | undefined>, useRadioCardPropsContext: () => Partial<RadioCardRootProps<string>> | undefined, useRootComponentProps: <Y extends import("@yamada-ui/utils").Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "
|
|
231
|
+
}>>> | undefined, { name, className, ...options }?: ComponentOptions) => (initialProps?: InitialProps<R>, ...superProps: SuperProps<R>[]) => H extends "fragment" ? import("react").FunctionComponent<R> : Component<Exclude<H, "fragment">, R>, RadioCardPropsContext: import("react").Context<Partial<RadioCardRootProps<string>> | undefined>, useRadioCardPropsContext: () => Partial<RadioCardRootProps<string>> | undefined, useRootComponentProps: <Y extends import("@yamada-ui/utils").Dict = {}, R extends keyof Y = keyof Y>(props: Y, slot?: ComponentSlot<ComponentSlotName<ComponentSlotStyle<"group" | "root" | "indicator" | "description" | "addon", {
|
|
232
232
|
justify: {
|
|
233
233
|
end: {
|
|
234
234
|
addon: {
|
|
@@ -401,7 +401,7 @@ declare const component: <H extends "fragment" | As = "div", R extends import("@
|
|
|
401
401
|
};
|
|
402
402
|
};
|
|
403
403
|
};
|
|
404
|
-
}>>> | undefined, { className, withContext, transferProps }?: UseComponentPropsOptions<R>) => [CSSSlotObject, Merge<WithoutThemeProps<Y, ComponentSlotStyle<"group" | "root" | "
|
|
404
|
+
}>>> | undefined, { className, withContext, transferProps }?: UseComponentPropsOptions<R>) => [CSSSlotObject, Merge<WithoutThemeProps<Y, ComponentSlotStyle<"group" | "root" | "indicator" | "description" | "addon", {
|
|
405
405
|
justify: {
|
|
406
406
|
end: {
|
|
407
407
|
addon: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.type.js";
|
|
2
2
|
import "../../index.js";
|
|
3
|
-
export declare const radioCardStyle: ComponentSlotStyle<"group" | "root" | "
|
|
3
|
+
export declare const radioCardStyle: ComponentSlotStyle<"group" | "root" | "indicator" | "description" | "addon", {
|
|
4
4
|
/**
|
|
5
5
|
* The justify indicator of the component
|
|
6
6
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.type.js";
|
|
2
2
|
import "../../index.js";
|
|
3
|
-
export declare const reorderStyle: ComponentSlotStyle<"root" | "
|
|
3
|
+
export declare const reorderStyle: ComponentSlotStyle<"root" | "trigger" | "item", {
|
|
4
4
|
/**
|
|
5
5
|
* The orientation of the reorder.
|
|
6
6
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.type.js";
|
|
2
2
|
import { CSSModifierObject, CSSSlotObject } from "../../core/css/index.type.js";
|
|
3
3
|
import "../../index.js";
|
|
4
|
-
export declare const resizableStyle: ComponentSlotStyle<"icon" | "root" | "
|
|
4
|
+
export declare const resizableStyle: ComponentSlotStyle<"icon" | "root" | "trigger" | "item", {
|
|
5
5
|
/**
|
|
6
6
|
* The orientation of the resizable.
|
|
7
7
|
*
|
|
@@ -19,7 +19,7 @@ export declare const resizableStyle: ComponentSlotStyle<"icon" | "root" | "item"
|
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
}, CSSModifierObject<CSSSlotObject<"icon" | "root" | "
|
|
22
|
+
}, CSSModifierObject<CSSSlotObject<"icon" | "root" | "trigger" | "item">>, {
|
|
23
23
|
border: {
|
|
24
24
|
icon: {
|
|
25
25
|
bg: "colorScheme.muted";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.type.js";
|
|
2
2
|
import "../../index.js";
|
|
3
|
-
export declare const stepsStyle: ComponentSlotStyle<"title" | "list" | "separator" | "root" | "
|
|
3
|
+
export declare const stepsStyle: ComponentSlotStyle<"title" | "list" | "separator" | "root" | "item" | "indicator" | "description", {
|
|
4
4
|
/**
|
|
5
5
|
* The orientation of the steps.
|
|
6
6
|
*
|
|
@@ -61,7 +61,7 @@ declare const TimelinePropsContext: import("react").Context<Partial<TimelineRoot
|
|
|
61
61
|
*
|
|
62
62
|
* @see https://yamada-ui.com/docs/components/timeline
|
|
63
63
|
*/
|
|
64
|
-
export declare const TimelineRoot: Component<({ variant: variantProp, children, index, items, ...rest }: WithoutThemeProps<TimelineRootProps, ComponentSlotStyle<"title" | "content" | "root" | "
|
|
64
|
+
export declare const TimelineRoot: Component<({ variant: variantProp, children, index, items, ...rest }: WithoutThemeProps<TimelineRootProps, ComponentSlotStyle<"title" | "content" | "root" | "item" | "indicator" | "description" | "connector", {
|
|
65
65
|
align: {
|
|
66
66
|
center: {
|
|
67
67
|
content: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentSlotStyle } from "../../core/system/index.type.js";
|
|
2
2
|
import "../../index.js";
|
|
3
|
-
export declare const timelineStyle: ComponentSlotStyle<"title" | "content" | "root" | "
|
|
3
|
+
export declare const timelineStyle: ComponentSlotStyle<"title" | "content" | "root" | "item" | "indicator" | "description" | "connector", {
|
|
4
4
|
/**
|
|
5
5
|
* The alignment of the timeline.
|
|
6
6
|
*
|
|
@@ -123,7 +123,7 @@ declare const I18nContext: import("react").Context<I18nContext<{
|
|
|
123
123
|
readonly toggle: {
|
|
124
124
|
readonly "Toggle button": "Toggle button";
|
|
125
125
|
};
|
|
126
|
-
}, "progress" | "select" | "table" | "toggle" | "slider" | "
|
|
126
|
+
}, "progress" | "select" | "table" | "toggle" | "slider" | "breadcrumb" | "calendar" | "autocomplete" | "avatar" | "carousel" | "closeButton" | "colorPicker" | "colorSelector" | "colorSwatch" | "datePicker" | "hueSlider" | "numberInput" | "pagination" | "passwordInput" | "saturationSlider" | "sidebar" | "stat" | "tag" | "progress.Loading..." | "progress.{value} percent" | "select.Clear value" | "table.Clear sorting" | "table.Page size" | "table.Select all rows" | "table.Select row" | "table.Sort ascending" | "table.Sort descending" | "toggle.Toggle button" | "slider.Slider thumb" | "breadcrumb.Breadcrumb" | "breadcrumb.Ellipsis" | "calendar.Choose the month" | "calendar.Choose the year" | "calendar.Go to the next month" | "calendar.Go to the previous month" | "calendar.Today" | "autocomplete.Clear value" | "autocomplete.No results found" | "avatar.Avatar Icon" | "carousel.Go to next slide" | "carousel.Go to previous slide" | "carousel.Go to {page} slide" | "carousel.Slides" | "carousel.{page} of {total}" | "closeButton.Close" | "colorPicker.Pick a color" | "colorSelector.Pick a color" | "colorSwatch.Color swatch group" | "datePicker.Clear value" | "hueSlider.Blue" | "hueSlider.Cyan" | "hueSlider.Green" | "hueSlider.Magenta" | "hueSlider.Red" | "hueSlider.Yellow" | "numberInput.Decrease" | "numberInput.Increase" | "pagination.Go to first page" | "pagination.Go to last page" | "pagination.Go to next page" | "pagination.Go to page {value}" | "pagination.Go to previous page" | "pagination.Pagination" | "pagination.{value} / {total}" | "pagination.{value} of {total}" | "passwordInput.Password strength meter" | "passwordInput.Toggle password visibility" | "saturationSlider.Saturation and brightness thumb" | "saturationSlider.Saturation {saturation}%, Brightness {brightness}%" | "sidebar.Close sidebar" | "sidebar.Open sidebar" | "stat.Decreased by" | "stat.Increased by" | "tag.Close tag">>;
|
|
127
127
|
export interface I18nProviderProps {
|
|
128
128
|
children?: ReactNode;
|
|
129
129
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yamada-ui/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.3.4-dev-
|
|
4
|
+
"version": "2.3.4-dev-20261125052246",
|
|
5
5
|
"description": "React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"yamada",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"@emotion/utils": "^1.4.2",
|
|
127
127
|
"@floating-ui/react-dom": "^2.1.9",
|
|
128
128
|
"@tanstack/react-table": "^8.21.3",
|
|
129
|
-
"@yamada-ui/utils": "2.4.0-dev-
|
|
129
|
+
"@yamada-ui/utils": "2.4.0-dev-20261125052246",
|
|
130
130
|
"copy-to-clipboard": "3.3.3",
|
|
131
131
|
"csstype": "^3.2.3",
|
|
132
132
|
"dayjs": "^1.11.23",
|