@depup/react-aria-components 1.19.0-depup.27 → 1.20.0-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PreviewTrigger/package.json +5 -0
- package/README.md +2 -2
- package/TokenField/package.json +5 -0
- package/changes.json +1 -1
- package/dist/exports/GridList.cjs.map +1 -1
- package/dist/exports/GridList.js.map +1 -1
- package/dist/exports/GridList.mjs.map +1 -1
- package/dist/exports/PreviewTrigger.cjs +26 -0
- package/dist/exports/PreviewTrigger.cjs.map +1 -0
- package/dist/exports/PreviewTrigger.js +21 -0
- package/dist/exports/PreviewTrigger.js.map +1 -0
- package/dist/exports/PreviewTrigger.mjs +21 -0
- package/dist/exports/PreviewTrigger.mjs.map +1 -0
- package/dist/exports/TokenField.cjs +31 -0
- package/dist/exports/TokenField.cjs.map +1 -0
- package/dist/exports/TokenField.js +21 -0
- package/dist/exports/TokenField.js.map +1 -0
- package/dist/exports/TokenField.mjs +21 -0
- package/dist/exports/TokenField.mjs.map +1 -0
- package/dist/exports/Tree.cjs.map +1 -1
- package/dist/exports/Tree.js.map +1 -1
- package/dist/exports/Tree.mjs.map +1 -1
- package/dist/exports/index.cjs +12 -0
- package/dist/exports/index.cjs.map +1 -1
- package/dist/exports/index.js +7 -1
- package/dist/exports/index.js.map +1 -1
- package/dist/exports/index.mjs +7 -1
- package/dist/exports/index.mjs.map +1 -1
- package/dist/private/Checkbox.cjs.map +1 -1
- package/dist/private/Checkbox.js.map +1 -1
- package/dist/private/Checkbox.mjs.map +1 -1
- package/dist/private/ComboBox.cjs +21 -2
- package/dist/private/ComboBox.cjs.map +1 -1
- package/dist/private/ComboBox.js +21 -2
- package/dist/private/ComboBox.js.map +1 -1
- package/dist/private/ComboBox.mjs +21 -2
- package/dist/private/ComboBox.mjs.map +1 -1
- package/dist/private/Dialog.cjs +15 -1
- package/dist/private/Dialog.cjs.map +1 -1
- package/dist/private/Dialog.js +15 -1
- package/dist/private/Dialog.js.map +1 -1
- package/dist/private/Dialog.mjs +15 -1
- package/dist/private/Dialog.mjs.map +1 -1
- package/dist/private/DragAndDrop.cjs +1 -0
- package/dist/private/DragAndDrop.cjs.map +1 -1
- package/dist/private/DragAndDrop.js +1 -0
- package/dist/private/DragAndDrop.js.map +1 -1
- package/dist/private/DragAndDrop.mjs +1 -0
- package/dist/private/DragAndDrop.mjs.map +1 -1
- package/dist/private/DropZone.cjs +5 -2
- package/dist/private/DropZone.cjs.map +1 -1
- package/dist/private/DropZone.js +5 -3
- package/dist/private/DropZone.js.map +1 -1
- package/dist/private/DropZone.mjs +5 -2
- package/dist/private/DropZone.mjs.map +1 -1
- package/dist/private/FileTrigger.cjs +1 -0
- package/dist/private/FileTrigger.cjs.map +1 -1
- package/dist/private/FileTrigger.js +1 -0
- package/dist/private/FileTrigger.js.map +1 -1
- package/dist/private/FileTrigger.mjs +1 -0
- package/dist/private/FileTrigger.mjs.map +1 -1
- package/dist/private/GridLayout.cjs +3 -1
- package/dist/private/GridLayout.cjs.map +1 -1
- package/dist/private/GridLayout.js +3 -1
- package/dist/private/GridLayout.js.map +1 -1
- package/dist/private/GridLayout.mjs +3 -1
- package/dist/private/GridLayout.mjs.map +1 -1
- package/dist/private/GridList.cjs +12 -1
- package/dist/private/GridList.cjs.map +1 -1
- package/dist/private/GridList.js +12 -1
- package/dist/private/GridList.js.map +1 -1
- package/dist/private/GridList.mjs +12 -1
- package/dist/private/GridList.mjs.map +1 -1
- package/dist/private/ListBox.cjs +9 -1
- package/dist/private/ListBox.cjs.map +1 -1
- package/dist/private/ListBox.js +9 -1
- package/dist/private/ListBox.js.map +1 -1
- package/dist/private/ListBox.mjs +9 -1
- package/dist/private/ListBox.mjs.map +1 -1
- package/dist/private/Menu.cjs +4 -2
- package/dist/private/Menu.cjs.map +1 -1
- package/dist/private/Menu.js +4 -2
- package/dist/private/Menu.js.map +1 -1
- package/dist/private/Menu.mjs +4 -2
- package/dist/private/Menu.mjs.map +1 -1
- package/dist/private/Meter.cjs +2 -1
- package/dist/private/Meter.cjs.map +1 -1
- package/dist/private/Meter.js +2 -1
- package/dist/private/Meter.js.map +1 -1
- package/dist/private/Meter.mjs +2 -1
- package/dist/private/Meter.mjs.map +1 -1
- package/dist/private/Modal.cjs +2 -0
- package/dist/private/Modal.cjs.map +1 -1
- package/dist/private/Modal.js +2 -0
- package/dist/private/Modal.js.map +1 -1
- package/dist/private/Modal.mjs +2 -0
- package/dist/private/Modal.mjs.map +1 -1
- package/dist/private/Popover.cjs +34 -9
- package/dist/private/Popover.cjs.map +1 -1
- package/dist/private/Popover.js +34 -9
- package/dist/private/Popover.js.map +1 -1
- package/dist/private/Popover.mjs +34 -9
- package/dist/private/Popover.mjs.map +1 -1
- package/dist/private/PreviewTrigger.cjs +88 -0
- package/dist/private/PreviewTrigger.cjs.map +1 -0
- package/dist/private/PreviewTrigger.js +80 -0
- package/dist/private/PreviewTrigger.js.map +1 -0
- package/dist/private/PreviewTrigger.mjs +79 -0
- package/dist/private/PreviewTrigger.mjs.map +1 -0
- package/dist/private/ProgressBar.cjs +6 -1
- package/dist/private/ProgressBar.cjs.map +1 -1
- package/dist/private/ProgressBar.js +6 -1
- package/dist/private/ProgressBar.js.map +1 -1
- package/dist/private/ProgressBar.mjs +6 -1
- package/dist/private/ProgressBar.mjs.map +1 -1
- package/dist/private/Select.cjs.map +1 -1
- package/dist/private/Select.js.map +1 -1
- package/dist/private/Select.mjs.map +1 -1
- package/dist/private/Table.cjs +26 -14
- package/dist/private/Table.cjs.map +1 -1
- package/dist/private/Table.js +26 -14
- package/dist/private/Table.js.map +1 -1
- package/dist/private/Table.mjs +26 -14
- package/dist/private/Table.mjs.map +1 -1
- package/dist/private/TableLayout.cjs +3 -1
- package/dist/private/TableLayout.cjs.map +1 -1
- package/dist/private/TableLayout.js +3 -1
- package/dist/private/TableLayout.js.map +1 -1
- package/dist/private/TableLayout.mjs +3 -1
- package/dist/private/TableLayout.mjs.map +1 -1
- package/dist/private/TagGroup.cjs +1 -0
- package/dist/private/TagGroup.cjs.map +1 -1
- package/dist/private/TagGroup.js +1 -0
- package/dist/private/TagGroup.js.map +1 -1
- package/dist/private/TagGroup.mjs +1 -0
- package/dist/private/TagGroup.mjs.map +1 -1
- package/dist/private/ToggleButton.cjs.map +1 -1
- package/dist/private/ToggleButton.js.map +1 -1
- package/dist/private/ToggleButton.mjs.map +1 -1
- package/dist/private/TokenField.cjs +207 -0
- package/dist/private/TokenField.cjs.map +1 -0
- package/dist/private/TokenField.js +197 -0
- package/dist/private/TokenField.js.map +1 -0
- package/dist/private/TokenField.mjs +195 -0
- package/dist/private/TokenField.mjs.map +1 -0
- package/dist/private/Tooltip.cjs +10 -2
- package/dist/private/Tooltip.cjs.map +1 -1
- package/dist/private/Tooltip.js +10 -2
- package/dist/private/Tooltip.js.map +1 -1
- package/dist/private/Tooltip.mjs +10 -2
- package/dist/private/Tooltip.mjs.map +1 -1
- package/dist/private/Tree.cjs +11 -1
- package/dist/private/Tree.cjs.map +1 -1
- package/dist/private/Tree.js +11 -1
- package/dist/private/Tree.js.map +1 -1
- package/dist/private/Tree.mjs +11 -1
- package/dist/private/Tree.mjs.map +1 -1
- package/dist/private/Virtualizer.cjs +18 -16
- package/dist/private/Virtualizer.cjs.map +1 -1
- package/dist/private/Virtualizer.js +18 -16
- package/dist/private/Virtualizer.js.map +1 -1
- package/dist/private/Virtualizer.mjs +18 -16
- package/dist/private/Virtualizer.mjs.map +1 -1
- package/dist/private/useDragAndDrop.cjs +7 -0
- package/dist/private/useDragAndDrop.cjs.map +1 -1
- package/dist/private/useDragAndDrop.js +7 -0
- package/dist/private/useDragAndDrop.js.map +1 -1
- package/dist/private/useDragAndDrop.mjs +7 -0
- package/dist/private/useDragAndDrop.mjs.map +1 -1
- package/dist/private/utils.cjs.map +1 -1
- package/dist/private/utils.js.map +1 -1
- package/dist/private/utils.mjs.map +1 -1
- package/dist/types/exports/GridList.d.ts +1 -1
- package/dist/types/exports/PreviewTrigger.d.ts +3 -0
- package/dist/types/exports/TokenField.d.ts +5 -0
- package/dist/types/exports/Tree.d.ts +1 -1
- package/dist/types/exports/index.d.ts +7 -2
- package/dist/types/src/ComboBox.d.ts +4 -1
- package/dist/types/src/GridList.d.ts +12 -1
- package/dist/types/src/ListBox.d.ts +1 -1
- package/dist/types/src/Popover.d.ts +7 -0
- package/dist/types/src/PreviewTrigger.d.ts +23 -0
- package/dist/types/src/Select.d.ts +1 -1
- package/dist/types/src/Table.d.ts +24 -0
- package/dist/types/src/TokenField.d.ts +111 -0
- package/dist/types/src/Tree.d.ts +7 -5
- package/dist/types/src/Virtualizer.d.ts +4 -0
- package/dist/types/src/utils.d.ts +19 -5
- package/i18n/ar-AE.js +1 -1
- package/i18n/ar-AE.mjs +1 -1
- package/i18n/bg-BG.js +1 -1
- package/i18n/bg-BG.mjs +1 -1
- package/i18n/cs-CZ.js +1 -1
- package/i18n/cs-CZ.mjs +1 -1
- package/i18n/da-DK.js +1 -1
- package/i18n/da-DK.mjs +1 -1
- package/i18n/de-DE.js +1 -1
- package/i18n/de-DE.mjs +1 -1
- package/i18n/el-GR.js +1 -1
- package/i18n/el-GR.mjs +1 -1
- package/i18n/en-US.js +1 -1
- package/i18n/en-US.mjs +1 -1
- package/i18n/es-ES.js +1 -1
- package/i18n/es-ES.mjs +1 -1
- package/i18n/et-EE.js +1 -1
- package/i18n/et-EE.mjs +1 -1
- package/i18n/fi-FI.js +1 -1
- package/i18n/fi-FI.mjs +1 -1
- package/i18n/fr-FR.js +1 -1
- package/i18n/fr-FR.mjs +1 -1
- package/i18n/he-IL.js +1 -1
- package/i18n/he-IL.mjs +1 -1
- package/i18n/hr-HR.js +1 -1
- package/i18n/hr-HR.mjs +1 -1
- package/i18n/hu-HU.js +1 -1
- package/i18n/hu-HU.mjs +1 -1
- package/i18n/it-IT.js +1 -1
- package/i18n/it-IT.mjs +1 -1
- package/i18n/ja-JP.js +1 -1
- package/i18n/ja-JP.mjs +1 -1
- package/i18n/ko-KR.js +1 -1
- package/i18n/ko-KR.mjs +1 -1
- package/i18n/lt-LT.js +1 -1
- package/i18n/lt-LT.mjs +1 -1
- package/i18n/lv-LV.js +1 -1
- package/i18n/lv-LV.mjs +1 -1
- package/i18n/nb-NO.js +1 -1
- package/i18n/nb-NO.mjs +1 -1
- package/i18n/nl-NL.js +1 -1
- package/i18n/nl-NL.mjs +1 -1
- package/i18n/pl-PL.js +1 -1
- package/i18n/pl-PL.mjs +1 -1
- package/i18n/pt-BR.js +1 -1
- package/i18n/pt-BR.mjs +1 -1
- package/i18n/pt-PT.js +1 -1
- package/i18n/pt-PT.mjs +1 -1
- package/i18n/ro-RO.js +1 -1
- package/i18n/ro-RO.mjs +1 -1
- package/i18n/ru-RU.js +1 -1
- package/i18n/ru-RU.mjs +1 -1
- package/i18n/sk-SK.js +1 -1
- package/i18n/sk-SK.mjs +1 -1
- package/i18n/sl-SI.js +1 -1
- package/i18n/sl-SI.mjs +1 -1
- package/i18n/sr-SP.js +1 -1
- package/i18n/sr-SP.mjs +1 -1
- package/i18n/sv-SE.js +1 -1
- package/i18n/sv-SE.mjs +1 -1
- package/i18n/tr-TR.js +1 -1
- package/i18n/tr-TR.mjs +1 -1
- package/i18n/uk-UA.js +1 -1
- package/i18n/uk-UA.mjs +1 -1
- package/i18n/zh-CN.js +1 -1
- package/i18n/zh-CN.mjs +1 -1
- package/i18n/zh-TW.js +1 -1
- package/i18n/zh-TW.mjs +1 -1
- package/package.json +32 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;AAwIM,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAAkD;AAE5F,iFAAiF;AACjF,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAAoC;AAKrE,MAAM,4CAAwB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,QAC3E,KAAmB,EACnB,GAA8B;IAE9B,CAAC,OAAO,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WAAW,MAAM,KAAK;sBAC3D,gCAAC,CAAA,GAAA,yCAAkB,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;uBAAE;YAAW,KAAK;QAAQ;OAC1E,yBAEH,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;;IAIzC,yGAAyG;IACzG,IAAI,CAAC,cACH,qBACE,gCAAC,CAAA,GAAA,cAAM;QACJ,GAAG,KAAK;QACT,oBAAoB;QACpB,WAAW;QACX,iBAAiB;OAChB,CAAC,MAAM,UAAU,IAAI,MAAM,MAAM,kBAChC,gCAAC;QAAI,eAAY;QAAY,GAAG,aAAa;QAAE,OAAO;YAAC,UAAU;YAAS,OAAO;QAAC;sBAEpF,gCAAC;QAAI,KAAK;QAAc,OAAO;YAAC,SAAS;QAAU;qBACjD,gCAAC,0CAAoB,QAAQ;QAAC,OAAO;OAClC;QAaU;IANrB,qEAAqE;IACrE,qBACE,gCAAC,CAAA,GAAA,cAAM;QACJ,GAAG,KAAK;QACT,oBAAoB;QACpB,WAAW;QACX,iBAAiB,CAAA,OAAA,qCAAA,sCAAA,2BAA4B,qBAAA,+BAAA,SAAU,OAAO,cAA7C,kBAAA,OAAiD;OACjE;AAGP","sources":["packages/react-aria-components/src/Popover.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n AriaLabelingProps,\n forwardRefType,\n GlobalDOMAttributes,\n RefObject\n} from '@react-types/shared';\nimport {AriaPopoverProps, usePopover} from 'react-aria/usePopover';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {DismissButton, Overlay} from 'react-aria/Overlay';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {focusSafely} from 'react-aria/private/interactions/focusSafely';\nimport {getInteractionModality} from 'react-aria/private/interactions/useFocusVisible';\nimport {isFocusWithin} from 'react-aria/private/utils/shadowdom/DOMFunctions';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {\n OverlayTriggerProps,\n OverlayTriggerState,\n useOverlayTriggerState\n} from 'react-stately/useOverlayTriggerState';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PlacementAxis, PositionProps} from 'react-aria/useOverlayPosition';\nimport React, {\n Context,\n createContext,\n ForwardedRef,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {useEnterAnimation, useExitAnimation} from 'react-aria/private/utils/animation';\nimport {useIsHidden} from 'react-aria/private/collections/Hidden';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\n\nexport interface PopoverProps\n extends\n Omit<PositionProps, 'isOpen'>,\n Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'groupRef' | 'offset' | 'arrowSize'>,\n OverlayTriggerProps,\n RenderProps<PopoverRenderProps>,\n SlotProps,\n AriaLabelingProps,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-Popover'\n */\n className?: ClassNameOrFunction<PopoverRenderProps>;\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string;\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>;\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean;\n /**\n * Whether the popover is currently performing an exit animation.\n */\n isExiting?: boolean;\n /**\n * The container element in which the overlay portal will be placed. This may have unknown\n * behavior depending on where it is portalled to.\n *\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element;\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n *\n * @default 8\n */\n offset?: number;\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n *\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null;\n /**\n * The placement of the popover relative to the trigger.\n *\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null;\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n *\n * @selector [data-entering]\n */\n isEntering: boolean;\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n *\n * @selector [data-exiting]\n */\n isExiting: boolean;\n}\n\ninterface PopoverContextValue extends PopoverProps {\n /** Contexts to clear. */\n clearContexts?: Context<any>[];\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverContextValue, HTMLElement>>(null);\n\n// Stores a ref for the portal container for a group of popovers (e.g. submenus).\nconst PopoverGroupContext = createContext<RefObject<Element | null> | null>(null);\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(function Popover(\n props: PopoverProps,\n ref: ForwardedRef<HTMLElement>\n) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state =\n props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n let isHidden = useIsHidden();\n let {direction} = useLocale();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting}\n dir={direction}\n />\n );\n});\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState;\n isEntering?: boolean;\n isExiting: boolean;\n UNSTABLE_portalContainer?: Element;\n trigger?: string;\n dir?: 'ltr' | 'rtl';\n clearContexts?: Context<any>[];\n}\n\nfunction PopoverInner({\n state,\n isExiting,\n UNSTABLE_portalContainer,\n clearContexts,\n ...props\n}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let containerRef = useRef<HTMLDivElement | null>(null);\n let groupCtx = useContext(PopoverGroupContext);\n let isSubPopover = groupCtx && props.trigger === 'SubmenuTrigger';\n\n let {popoverProps, underlayProps, arrowProps, placement, triggerAnchorPoint} = usePopover(\n {\n ...props,\n offset: props.offset ?? 8,\n arrowRef,\n // If this is a submenu/subdialog, use the root popover's container\n // to detect outside interaction and add aria-hidden.\n groupRef: isSubPopover ? groupCtx! : containerRef\n },\n state\n );\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n let isEntering = useEnterAnimation(ref, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Popover',\n values: {\n trigger: props.trigger || null,\n placement,\n isEntering,\n isExiting\n }\n });\n\n // Automatically render Popover with role=dialog except when isNonModal is true,\n // or a dialog is already nested inside the popover.\n let shouldBeDialog = !props.isNonModal || props.trigger === 'SubmenuTrigger';\n let [isDialog, setDialog] = useState(false);\n useLayoutEffect(() => {\n if (ref.current) {\n setDialog(shouldBeDialog && !ref.current.querySelector('[role=dialog]'));\n }\n }, [ref, shouldBeDialog]);\n\n // Focus the popover itself on mount, unless a child element is already focused.\n // Skip this for submenus since hovering a submenutrigger should keep focus on the trigger\n useEffect(() => {\n if (\n isDialog &&\n (props.trigger !== 'SubmenuTrigger' || getInteractionModality() !== 'pointer') &&\n ref.current &&\n !isFocusWithin(ref.current)\n ) {\n focusSafely(ref.current);\n }\n }, [isDialog, ref, props.trigger]);\n\n let children = useMemo(() => {\n let children = renderProps.children;\n if (clearContexts) {\n for (let Context of clearContexts) {\n children = <Context.Provider value={null}>{children}</Context.Provider>;\n }\n }\n return children;\n }, [renderProps.children, clearContexts]);\n\n let [triggerWidth, setTriggerWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (props.triggerRef.current) {\n setTriggerWidth(props.triggerRef.current.getBoundingClientRect().width + 'px');\n }\n }, [props.triggerRef]);\n\n useLayoutEffect(onResize, [onResize]);\n useResizeObserver({\n ref: renderProps.style?.['--trigger-width'] ? undefined : props.triggerRef,\n onResize: onResize\n });\n\n let style = {\n ...popoverProps.style,\n '--trigger-anchor-point': triggerAnchorPoint\n ? `${triggerAnchorPoint.x}px ${triggerAnchorPoint.y}px`\n : undefined,\n ...renderProps.style,\n '--trigger-width': renderProps.style?.['--trigger-width'] || triggerWidth\n };\n\n let overlay = (\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), popoverProps)}\n {...renderProps}\n role={isDialog ? 'dialog' : undefined}\n tabIndex={isDialog ? -1 : undefined}\n aria-label={props['aria-label']}\n aria-labelledby={props['aria-labelledby']}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n dir={props.dir}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </dom.div>\n );\n\n // If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.\n if (!isSubPopover) {\n return (\n <Overlay\n {...props}\n shouldContainFocus={isDialog}\n isExiting={isExiting}\n portalContainer={UNSTABLE_portalContainer}>\n {!props.isNonModal && state.isOpen && (\n <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />\n )}\n <div ref={containerRef} style={{display: 'contents'}}>\n <PopoverGroupContext.Provider value={containerRef}>\n {overlay}\n </PopoverGroupContext.Provider>\n </div>\n </Overlay>\n );\n }\n\n // Submenus/subdialogs are mounted into the root popover's container.\n return (\n <Overlay\n {...props}\n shouldContainFocus={isDialog}\n isExiting={isExiting}\n portalContainer={UNSTABLE_portalContainer ?? groupCtx?.current ?? undefined}>\n {overlay}\n </Overlay>\n );\n}\n"],"names":[],"version":3,"file":"Popover.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;AA+IM,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAAkD;AAE5F,iFAAiF;AACjF,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAAoC;AAKrE,MAAM,4CAAwB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,QAC3E,KAAmB,EACnB,GAA8B;IAE9B,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,eAAe,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wCAAyB;IACvD,IAAI,aAAa,CAAA,GAAA,6BAAqB,EAAE;IACxC,IAAI,QACF,MAAM,MAAM,IAAI,QAAQ,MAAM,WAAW,IAAI,QAAQ,CAAC,eA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,CAAC,kBAAkB;QACzC,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,OAAO;QACP,KAAK,MAAM,GAAG;QACd,gBAAc,MAAM,OAAO;QAC3B,kBAAgB;QAChB,iBAAe,cAAc;QAC7B,gBAAc,aAAa;OAE1B,CAAC,MAAM,UAAU,kBAAI,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;sBAC3D,gCAAC,CAAA,GAAA,yCAAkB,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;uBAAE;YAAW,KAAK;QAAQ;OAC1E,yBAEH,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;;IAGzC,qCAAqC;IAErC,yGAAyG;IACzG,IAAI,CAAC,cACH,sCAAsC;IACtC,qBACE,gCAAC,CAAA,GAAA,cAAM;QACJ,GAAG,KAAK;QACT,oBAAoB,YAAY,MAAM,OAAO,KAAK;QAClD,WAAW;QACX,iBAAiB;OAEhB,CAAC,MAAM,UAAU,IAAI,MAAM,MAAM,kBAChC,gCAAC;QAAI,eAAY;QAAY,GAAG,aAAa;QAAE,OAAO;YAAC,UAAU;YAAS,OAAO;QAAC;sBAEpF,gCAAC;QAAI,KAAK;QAAc,OAAO;YAAC,SAAS;QAAU;qBACjD,gCAAC,0CAAoB,QAAQ;QAAC,OAAO;OAClC;QAeU;IAPrB,qEAAqE;IACrE,sCAAsC;IACtC,qBACE,gCAAC,CAAA,GAAA,cAAM;QACJ,GAAG,KAAK;QACT,oBAAoB,YAAY,MAAM,OAAO,KAAK;QAClD,WAAW;QACX,iBAAiB,CAAA,OAAA,qCAAA,sCAAA,2BAA4B,qBAAA,+BAAA,SAAU,OAAO,cAA7C,kBAAA,OAAiD;OACjE;AAGL,qCAAqC;AACvC","sources":["packages/react-aria-components/src/Popover.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n AriaLabelingProps,\n forwardRefType,\n GlobalDOMAttributes,\n RefObject\n} from '@react-types/shared';\nimport {AriaPopoverProps, usePopover} from 'react-aria/usePopover';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {DismissButton, Overlay} from 'react-aria/Overlay';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {focusSafely} from 'react-aria/private/interactions/focusSafely';\nimport {getInteractionModality} from 'react-aria/private/interactions/useFocusVisible';\nimport {isFocusWithin} from 'react-aria/private/utils/shadowdom/DOMFunctions';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {\n OverlayTriggerProps,\n OverlayTriggerState,\n useOverlayTriggerState\n} from 'react-stately/useOverlayTriggerState';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PlacementAxis, PositionProps} from 'react-aria/useOverlayPosition';\nimport React, {\n Context,\n createContext,\n ForwardedRef,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {useEnterAnimation, useExitAnimation} from 'react-aria/private/utils/animation';\nimport {useIsHidden} from 'react-aria/private/collections/Hidden';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\n\nexport interface PopoverProps\n extends\n Omit<PositionProps, 'isOpen'>,\n Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'groupRef' | 'offset' | 'arrowSize'>,\n OverlayTriggerProps,\n RenderProps<PopoverRenderProps>,\n SlotProps,\n AriaLabelingProps,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-Popover'\n */\n className?: ClassNameOrFunction<PopoverRenderProps>;\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string;\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>;\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean;\n /**\n * Whether the popover is currently performing an exit animation.\n */\n isExiting?: boolean;\n /**\n * Whether the popover should appear and disappear without an entry or exit animation. This is\n * used by components such as PreviewTrigger to skip animations when quickly swapping between\n * overlays.\n */\n shouldSkipAnimation?: boolean;\n /**\n * The container element in which the overlay portal will be placed. This may have unknown\n * behavior depending on where it is portalled to.\n *\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element;\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n *\n * @default 8\n */\n offset?: number;\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n *\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null;\n /**\n * The placement of the popover relative to the trigger.\n *\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null;\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n *\n * @selector [data-entering]\n */\n isEntering: boolean;\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n *\n * @selector [data-exiting]\n */\n isExiting: boolean;\n}\n\ninterface PopoverContextValue extends PopoverProps {\n id?: string;\n /** Contexts to clear. */\n clearContexts?: Context<any>[];\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverContextValue, HTMLElement>>(null);\n\n// Stores a ref for the portal container for a group of popovers (e.g. submenus).\nconst PopoverGroupContext = createContext<RefObject<Element | null> | null>(null);\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(function Popover(\n props: PopoverProps,\n ref: ForwardedRef<HTMLElement>\n) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state =\n props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n // Skip the automatic exit animation when closing instantly (e.g. swapping between previews\n // during warmup). An explicitly provided isExiting prop still takes precedence.\n let exitAnimation = useExitAnimation(ref, state.isOpen);\n let isExiting = props.isExiting || (!props.shouldSkipAnimation && exitAnimation) || false;\n let isHidden = useIsHidden();\n let {direction} = useLocale();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting}\n dir={direction}\n />\n );\n});\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState;\n isEntering?: boolean;\n isExiting: boolean;\n shouldSkipAnimation?: boolean;\n UNSTABLE_portalContainer?: Element;\n trigger?: string;\n dir?: 'ltr' | 'rtl';\n clearContexts?: Context<any>[];\n id?: string;\n}\n\nfunction PopoverInner({\n state,\n isExiting,\n UNSTABLE_portalContainer,\n clearContexts,\n ...props\n}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let containerRef = useRef<HTMLDivElement | null>(null);\n let groupCtx = useContext(PopoverGroupContext);\n let isSubPopover = groupCtx && props.trigger === 'SubmenuTrigger';\n\n let {popoverProps, underlayProps, arrowProps, placement, triggerAnchorPoint} = usePopover(\n {\n ...props,\n offset: props.offset ?? 8,\n arrowRef,\n // If this is a submenu/subdialog, use the root popover's container\n // to detect outside interaction and add aria-hidden.\n groupRef: isSubPopover ? groupCtx! : containerRef\n },\n state\n );\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n // Skip the automatic entry animation when opening instantly (e.g. swapping between previews\n // during warmup). An explicitly provided isEntering prop still takes precedence.\n let enterAnimation = useEnterAnimation(ref, !!placement);\n // oxlint-disable-next-line react/react-compiler\n let isEntering = props.isEntering || (!props.shouldSkipAnimation && enterAnimation) || false;\n // oxlint-disable-next-line react/react-compiler\n let renderProps = useRenderProps({\n // oxlint-disable-next-line react/react-compiler\n ...props,\n defaultClassName: 'react-aria-Popover',\n // oxlint-disable-next-line react/react-compiler\n values: {\n // oxlint-disable-next-line react/react-compiler\n trigger: props.trigger || null,\n placement,\n // oxlint-disable-next-line react/react-compiler\n isEntering,\n isExiting\n }\n });\n\n // Automatically render Popover with role=dialog except when isNonModal is true,\n // or a dialog is already nested inside the popover.\n let shouldBeDialog =\n // oxlint-disable-next-line react/react-compiler\n !props.isNonModal || props.trigger === 'SubmenuTrigger' || props.trigger === 'PreviewTrigger';\n // oxlint-disable-next-line react/react-compiler\n let [isDialog, setDialog] = useState(props.trigger === 'PreviewTrigger');\n useLayoutEffect(() => {\n if (ref.current) {\n setDialog(shouldBeDialog && !ref.current.querySelector('[role=dialog]'));\n }\n }, [ref, shouldBeDialog]);\n\n // Focus the popover itself on mount, unless a child element is already focused.\n // Skip this for submenus since hovering a submenutrigger should keep focus on the trigger\n // oxlint-disable react/react-compiler\n useEffect(() => {\n if (\n isDialog &&\n props.trigger !== 'PreviewTrigger' &&\n (props.trigger !== 'SubmenuTrigger' || getInteractionModality() !== 'pointer') &&\n ref.current &&\n !isFocusWithin(ref.current)\n ) {\n focusSafely(ref.current);\n }\n }, [isDialog, ref, props.trigger]);\n // oxlint-enable react/react-compiler\n\n let children = useMemo(() => {\n let children = renderProps.children;\n if (clearContexts) {\n for (let Context of clearContexts) {\n children = <Context.Provider value={null}>{children}</Context.Provider>;\n }\n }\n return children;\n }, [renderProps.children, clearContexts]);\n\n let [triggerWidth, setTriggerWidth] = useState<string | null>(null);\n // oxlint-disable-next-line react/react-compiler\n let onResize = useCallback(() => {\n if (props.triggerRef.current) {\n setTriggerWidth(props.triggerRef.current.getBoundingClientRect().width + 'px');\n }\n }, [props.triggerRef]);\n\n useLayoutEffect(onResize, [onResize]);\n // oxlint-disable-next-line react/react-compiler\n useResizeObserver({\n // oxlint-disable-next-line react/react-compiler\n ref: renderProps.style?.['--trigger-width'] ? undefined : props.triggerRef,\n onResize: onResize\n });\n\n let style = {\n ...popoverProps.style,\n '--trigger-anchor-point': triggerAnchorPoint\n ? `${triggerAnchorPoint.x}px ${triggerAnchorPoint.y}px`\n : undefined,\n ...renderProps.style,\n '--trigger-width': renderProps.style?.['--trigger-width'] || triggerWidth\n };\n\n // oxlint-disable react/react-compiler\n let overlay = (\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), popoverProps)}\n {...renderProps}\n id={isDialog ? props.id : undefined}\n role={isDialog ? 'dialog' : undefined}\n tabIndex={isDialog ? -1 : undefined}\n aria-label={props['aria-label']}\n aria-labelledby={props['aria-labelledby']}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n dir={props.dir}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {/* oxlint-disable-next-line react/react-compiler */}\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </dom.div>\n );\n // oxlint-enable react/react-compiler\n\n // If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.\n if (!isSubPopover) {\n // oxlint-disable react/react-compiler\n return (\n <Overlay\n {...props}\n shouldContainFocus={isDialog && props.trigger !== 'PreviewTrigger'}\n isExiting={isExiting}\n portalContainer={UNSTABLE_portalContainer}>\n {/* oxlint-disable-next-line react/react-compiler */}\n {!props.isNonModal && state.isOpen && (\n <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />\n )}\n <div ref={containerRef} style={{display: 'contents'}}>\n <PopoverGroupContext.Provider value={containerRef}>\n {overlay}\n </PopoverGroupContext.Provider>\n </div>\n </Overlay>\n );\n // oxlint-enable react/react-compiler\n }\n\n // Submenus/subdialogs are mounted into the root popover's container.\n // oxlint-disable react/react-compiler\n return (\n <Overlay\n {...props}\n shouldContainFocus={isDialog && props.trigger !== 'PreviewTrigger'}\n isExiting={isExiting}\n portalContainer={UNSTABLE_portalContainer ?? groupCtx?.current ?? undefined}>\n {overlay}\n </Overlay>\n );\n // oxlint-enable react/react-compiler\n}\n"],"names":[],"version":3,"file":"Popover.js.map"}
|
package/dist/private/Popover.mjs
CHANGED
|
@@ -51,7 +51,10 @@ const $542a13ca2fa5b484$export$5b6b19405a83ff9d = /*#__PURE__*/ (0, $g4jvP$forwa
|
|
|
51
51
|
let contextState = (0, $g4jvP$useContext)((0, $f2ff30fde7b014be$export$d2f961adcb0afbe));
|
|
52
52
|
let localState = (0, $g4jvP$useOverlayTriggerState)(props);
|
|
53
53
|
let state = props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;
|
|
54
|
-
|
|
54
|
+
// Skip the automatic exit animation when closing instantly (e.g. swapping between previews
|
|
55
|
+
// during warmup). An explicitly provided isExiting prop still takes precedence.
|
|
56
|
+
let exitAnimation = (0, $g4jvP$useExitAnimation)(ref, state.isOpen);
|
|
57
|
+
let isExiting = props.isExiting || !props.shouldSkipAnimation && exitAnimation || false;
|
|
55
58
|
let isHidden = (0, $g4jvP$useIsHidden)();
|
|
56
59
|
let { direction: direction } = (0, $g4jvP$useLocale)();
|
|
57
60
|
// If we are in a hidden tree, we still need to preserve our children.
|
|
@@ -92,21 +95,32 @@ function $542a13ca2fa5b484$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
92
95
|
groupRef: isSubPopover ? groupCtx : containerRef
|
|
93
96
|
}, state);
|
|
94
97
|
let ref = props.popoverRef;
|
|
95
|
-
|
|
98
|
+
// Skip the automatic entry animation when opening instantly (e.g. swapping between previews
|
|
99
|
+
// during warmup). An explicitly provided isEntering prop still takes precedence.
|
|
100
|
+
let enterAnimation = (0, $g4jvP$useEnterAnimation)(ref, !!placement);
|
|
101
|
+
// oxlint-disable-next-line react/react-compiler
|
|
102
|
+
let isEntering = props.isEntering || !props.shouldSkipAnimation && enterAnimation || false;
|
|
103
|
+
// oxlint-disable-next-line react/react-compiler
|
|
96
104
|
let renderProps = (0, $7230ffa83bc0c2cf$export$4d86445c2cf5e3)({
|
|
105
|
+
// oxlint-disable-next-line react/react-compiler
|
|
97
106
|
...props,
|
|
98
107
|
defaultClassName: 'react-aria-Popover',
|
|
108
|
+
// oxlint-disable-next-line react/react-compiler
|
|
99
109
|
values: {
|
|
110
|
+
// oxlint-disable-next-line react/react-compiler
|
|
100
111
|
trigger: props.trigger || null,
|
|
101
112
|
placement: placement,
|
|
102
|
-
isEntering:
|
|
113
|
+
isEntering: // oxlint-disable-next-line react/react-compiler
|
|
114
|
+
isEntering,
|
|
103
115
|
isExiting: isExiting
|
|
104
116
|
}
|
|
105
117
|
});
|
|
106
118
|
// Automatically render Popover with role=dialog except when isNonModal is true,
|
|
107
119
|
// or a dialog is already nested inside the popover.
|
|
108
|
-
let shouldBeDialog =
|
|
109
|
-
|
|
120
|
+
let shouldBeDialog = // oxlint-disable-next-line react/react-compiler
|
|
121
|
+
!props.isNonModal || props.trigger === 'SubmenuTrigger' || props.trigger === 'PreviewTrigger';
|
|
122
|
+
// oxlint-disable-next-line react/react-compiler
|
|
123
|
+
let [isDialog, setDialog] = (0, $g4jvP$useState)(props.trigger === 'PreviewTrigger');
|
|
110
124
|
(0, $g4jvP$useLayoutEffect)(()=>{
|
|
111
125
|
if (ref.current) setDialog(shouldBeDialog && !ref.current.querySelector('[role=dialog]'));
|
|
112
126
|
}, [
|
|
@@ -115,13 +129,15 @@ function $542a13ca2fa5b484$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
115
129
|
]);
|
|
116
130
|
// Focus the popover itself on mount, unless a child element is already focused.
|
|
117
131
|
// Skip this for submenus since hovering a submenutrigger should keep focus on the trigger
|
|
132
|
+
// oxlint-disable react/react-compiler
|
|
118
133
|
(0, $g4jvP$useEffect)(()=>{
|
|
119
|
-
if (isDialog && (props.trigger !== 'SubmenuTrigger' || (0, $g4jvP$getInteractionModality)() !== 'pointer') && ref.current && !(0, $g4jvP$isFocusWithin)(ref.current)) (0, $g4jvP$focusSafely)(ref.current);
|
|
134
|
+
if (isDialog && props.trigger !== 'PreviewTrigger' && (props.trigger !== 'SubmenuTrigger' || (0, $g4jvP$getInteractionModality)() !== 'pointer') && ref.current && !(0, $g4jvP$isFocusWithin)(ref.current)) (0, $g4jvP$focusSafely)(ref.current);
|
|
120
135
|
}, [
|
|
121
136
|
isDialog,
|
|
122
137
|
ref,
|
|
123
138
|
props.trigger
|
|
124
139
|
]);
|
|
140
|
+
// oxlint-enable react/react-compiler
|
|
125
141
|
let children = (0, $g4jvP$useMemo)(()=>{
|
|
126
142
|
let children = renderProps.children;
|
|
127
143
|
if (clearContexts) for (let Context of clearContexts)children = /*#__PURE__*/ (0, $g4jvP$react).createElement(Context.Provider, {
|
|
@@ -133,6 +149,7 @@ function $542a13ca2fa5b484$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
133
149
|
clearContexts
|
|
134
150
|
]);
|
|
135
151
|
let [triggerWidth, setTriggerWidth] = (0, $g4jvP$useState)(null);
|
|
152
|
+
// oxlint-disable-next-line react/react-compiler
|
|
136
153
|
let onResize = (0, $g4jvP$useCallback)(()=>{
|
|
137
154
|
if (props.triggerRef.current) setTriggerWidth(props.triggerRef.current.getBoundingClientRect().width + 'px');
|
|
138
155
|
}, [
|
|
@@ -141,7 +158,9 @@ function $542a13ca2fa5b484$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
141
158
|
(0, $g4jvP$useLayoutEffect)(onResize, [
|
|
142
159
|
onResize
|
|
143
160
|
]);
|
|
161
|
+
// oxlint-disable-next-line react/react-compiler
|
|
144
162
|
(0, $g4jvP$useResizeObserver)({
|
|
163
|
+
// oxlint-disable-next-line react/react-compiler
|
|
145
164
|
ref: renderProps.style?.['--trigger-width'] ? undefined : props.triggerRef,
|
|
146
165
|
onResize: onResize
|
|
147
166
|
});
|
|
@@ -151,11 +170,13 @@ function $542a13ca2fa5b484$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
151
170
|
...renderProps.style,
|
|
152
171
|
'--trigger-width': renderProps.style?.['--trigger-width'] || triggerWidth
|
|
153
172
|
};
|
|
173
|
+
// oxlint-disable react/react-compiler
|
|
154
174
|
let overlay = /*#__PURE__*/ (0, $g4jvP$react).createElement((0, $7230ffa83bc0c2cf$export$df3a06d6289f983e).div, {
|
|
155
175
|
...(0, $g4jvP$mergeProps)((0, $g4jvP$filterDOMProps)(props, {
|
|
156
176
|
global: true
|
|
157
177
|
}), popoverProps),
|
|
158
178
|
...renderProps,
|
|
179
|
+
id: isDialog ? props.id : undefined,
|
|
159
180
|
role: isDialog ? 'dialog' : undefined,
|
|
160
181
|
tabIndex: isDialog ? -1 : undefined,
|
|
161
182
|
"aria-label": props['aria-label'],
|
|
@@ -179,10 +200,12 @@ function $542a13ca2fa5b484$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
179
200
|
}, children), /*#__PURE__*/ (0, $g4jvP$react).createElement((0, $g4jvP$DismissButton), {
|
|
180
201
|
onDismiss: state.close
|
|
181
202
|
}));
|
|
203
|
+
// oxlint-enable react/react-compiler
|
|
182
204
|
// If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.
|
|
183
|
-
if (!isSubPopover)
|
|
205
|
+
if (!isSubPopover) // oxlint-disable react/react-compiler
|
|
206
|
+
return /*#__PURE__*/ (0, $g4jvP$react).createElement((0, $g4jvP$Overlay), {
|
|
184
207
|
...props,
|
|
185
|
-
shouldContainFocus: isDialog,
|
|
208
|
+
shouldContainFocus: isDialog && props.trigger !== 'PreviewTrigger',
|
|
186
209
|
isExiting: isExiting,
|
|
187
210
|
portalContainer: UNSTABLE_portalContainer
|
|
188
211
|
}, !props.isNonModal && state.isOpen && /*#__PURE__*/ (0, $g4jvP$react).createElement("div", {
|
|
@@ -201,12 +224,14 @@ function $542a13ca2fa5b484$var$PopoverInner({ state: state, isExiting: isExiting
|
|
|
201
224
|
value: containerRef
|
|
202
225
|
}, overlay)));
|
|
203
226
|
// Submenus/subdialogs are mounted into the root popover's container.
|
|
227
|
+
// oxlint-disable react/react-compiler
|
|
204
228
|
return /*#__PURE__*/ (0, $g4jvP$react).createElement((0, $g4jvP$Overlay), {
|
|
205
229
|
...props,
|
|
206
|
-
shouldContainFocus: isDialog,
|
|
230
|
+
shouldContainFocus: isDialog && props.trigger !== 'PreviewTrigger',
|
|
207
231
|
isExiting: isExiting,
|
|
208
232
|
portalContainer: UNSTABLE_portalContainer ?? groupCtx?.current ?? undefined
|
|
209
233
|
}, overlay);
|
|
234
|
+
// oxlint-enable react/react-compiler
|
|
210
235
|
}
|
|
211
236
|
|
|
212
237
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;AAwIM,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAAkD;AAE5F,iFAAiF;AACjF,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAAo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Y;QAAE,WAAW,MAAM,KAAK;sBAC3D,gCAAC,CAAA,GAAA,yCAAkB,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;uBAAE;YAAW,KAAK;QAAQ;OAC1E,yBAEH,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;;IAIzC,yGAAyG;IACzG,IAAI,CAAC,cACH,qBACE,gCAAC,CAAA,GAAA,cAAM;QACJ,GAAG,KAAK;QACT,oBAAoB;QACpB,WAAW;QACX,iBAAiB;OAChB,CAAC,MAAM,UAAU,IAAI,MAAM,MAAM,kBAChC,gCAAC;QAAI,eAAY;QAAY,GAAG,aAAa;QAAE,OAAO;YAAC,UAAU;YAAS,OAAO;QAAC;sBAEpF,gCAAC;QAAI,KAAK;QAAc,OAAO;YAAC,SAAS;QAAU;qBACjD,gCAAC,0CAAoB,QAAQ;QAAC,OAAO;OAClC;IAOX,qEAAqE;IACrE,qBACE,gCAAC,CAAA,GAAA,cAAM;QACJ,GAAG,KAAK;QACT,oBAAoB;QACpB,WAAW;QACX,iBAAiB,4BAA4B,UAAU,WAAW;OACjE;AAGP","sources":["packages/react-aria-components/src/Popover.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n AriaLabelingProps,\n forwardRefType,\n GlobalDOMAttributes,\n RefObject\n} from '@react-types/shared';\nimport {AriaPopoverProps, usePopover} from 'react-aria/usePopover';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {DismissButton, Overlay} from 'react-aria/Overlay';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {focusSafely} from 'react-aria/private/interactions/focusSafely';\nimport {getInteractionModality} from 'react-aria/private/interactions/useFocusVisible';\nimport {isFocusWithin} from 'react-aria/private/utils/shadowdom/DOMFunctions';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {\n OverlayTriggerProps,\n OverlayTriggerState,\n useOverlayTriggerState\n} from 'react-stately/useOverlayTriggerState';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PlacementAxis, PositionProps} from 'react-aria/useOverlayPosition';\nimport React, {\n Context,\n createContext,\n ForwardedRef,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {useEnterAnimation, useExitAnimation} from 'react-aria/private/utils/animation';\nimport {useIsHidden} from 'react-aria/private/collections/Hidden';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\n\nexport interface PopoverProps\n extends\n Omit<PositionProps, 'isOpen'>,\n Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'groupRef' | 'offset' | 'arrowSize'>,\n OverlayTriggerProps,\n RenderProps<PopoverRenderProps>,\n SlotProps,\n AriaLabelingProps,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-Popover'\n */\n className?: ClassNameOrFunction<PopoverRenderProps>;\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string;\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>;\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean;\n /**\n * Whether the popover is currently performing an exit animation.\n */\n isExiting?: boolean;\n /**\n * The container element in which the overlay portal will be placed. This may have unknown\n * behavior depending on where it is portalled to.\n *\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element;\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n *\n * @default 8\n */\n offset?: number;\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n *\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null;\n /**\n * The placement of the popover relative to the trigger.\n *\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null;\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n *\n * @selector [data-entering]\n */\n isEntering: boolean;\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n *\n * @selector [data-exiting]\n */\n isExiting: boolean;\n}\n\ninterface PopoverContextValue extends PopoverProps {\n /** Contexts to clear. */\n clearContexts?: Context<any>[];\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverContextValue, HTMLElement>>(null);\n\n// Stores a ref for the portal container for a group of popovers (e.g. submenus).\nconst PopoverGroupContext = createContext<RefObject<Element | null> | null>(null);\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(function Popover(\n props: PopoverProps,\n ref: ForwardedRef<HTMLElement>\n) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state =\n props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n let isExiting = useExitAnimation(ref, state.isOpen) || props.isExiting || false;\n let isHidden = useIsHidden();\n let {direction} = useLocale();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting}\n dir={direction}\n />\n );\n});\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState;\n isEntering?: boolean;\n isExiting: boolean;\n UNSTABLE_portalContainer?: Element;\n trigger?: string;\n dir?: 'ltr' | 'rtl';\n clearContexts?: Context<any>[];\n}\n\nfunction PopoverInner({\n state,\n isExiting,\n UNSTABLE_portalContainer,\n clearContexts,\n ...props\n}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let containerRef = useRef<HTMLDivElement | null>(null);\n let groupCtx = useContext(PopoverGroupContext);\n let isSubPopover = groupCtx && props.trigger === 'SubmenuTrigger';\n\n let {popoverProps, underlayProps, arrowProps, placement, triggerAnchorPoint} = usePopover(\n {\n ...props,\n offset: props.offset ?? 8,\n arrowRef,\n // If this is a submenu/subdialog, use the root popover's container\n // to detect outside interaction and add aria-hidden.\n groupRef: isSubPopover ? groupCtx! : containerRef\n },\n state\n );\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n let isEntering = useEnterAnimation(ref, !!placement) || props.isEntering || false;\n let renderProps = useRenderProps({\n ...props,\n defaultClassName: 'react-aria-Popover',\n values: {\n trigger: props.trigger || null,\n placement,\n isEntering,\n isExiting\n }\n });\n\n // Automatically render Popover with role=dialog except when isNonModal is true,\n // or a dialog is already nested inside the popover.\n let shouldBeDialog = !props.isNonModal || props.trigger === 'SubmenuTrigger';\n let [isDialog, setDialog] = useState(false);\n useLayoutEffect(() => {\n if (ref.current) {\n setDialog(shouldBeDialog && !ref.current.querySelector('[role=dialog]'));\n }\n }, [ref, shouldBeDialog]);\n\n // Focus the popover itself on mount, unless a child element is already focused.\n // Skip this for submenus since hovering a submenutrigger should keep focus on the trigger\n useEffect(() => {\n if (\n isDialog &&\n (props.trigger !== 'SubmenuTrigger' || getInteractionModality() !== 'pointer') &&\n ref.current &&\n !isFocusWithin(ref.current)\n ) {\n focusSafely(ref.current);\n }\n }, [isDialog, ref, props.trigger]);\n\n let children = useMemo(() => {\n let children = renderProps.children;\n if (clearContexts) {\n for (let Context of clearContexts) {\n children = <Context.Provider value={null}>{children}</Context.Provider>;\n }\n }\n return children;\n }, [renderProps.children, clearContexts]);\n\n let [triggerWidth, setTriggerWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (props.triggerRef.current) {\n setTriggerWidth(props.triggerRef.current.getBoundingClientRect().width + 'px');\n }\n }, [props.triggerRef]);\n\n useLayoutEffect(onResize, [onResize]);\n useResizeObserver({\n ref: renderProps.style?.['--trigger-width'] ? undefined : props.triggerRef,\n onResize: onResize\n });\n\n let style = {\n ...popoverProps.style,\n '--trigger-anchor-point': triggerAnchorPoint\n ? `${triggerAnchorPoint.x}px ${triggerAnchorPoint.y}px`\n : undefined,\n ...renderProps.style,\n '--trigger-width': renderProps.style?.['--trigger-width'] || triggerWidth\n };\n\n let overlay = (\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), popoverProps)}\n {...renderProps}\n role={isDialog ? 'dialog' : undefined}\n tabIndex={isDialog ? -1 : undefined}\n aria-label={props['aria-label']}\n aria-labelledby={props['aria-labelledby']}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n dir={props.dir}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </dom.div>\n );\n\n // If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.\n if (!isSubPopover) {\n return (\n <Overlay\n {...props}\n shouldContainFocus={isDialog}\n isExiting={isExiting}\n portalContainer={UNSTABLE_portalContainer}>\n {!props.isNonModal && state.isOpen && (\n <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />\n )}\n <div ref={containerRef} style={{display: 'contents'}}>\n <PopoverGroupContext.Provider value={containerRef}>\n {overlay}\n </PopoverGroupContext.Provider>\n </div>\n </Overlay>\n );\n }\n\n // Submenus/subdialogs are mounted into the root popover's container.\n return (\n <Overlay\n {...props}\n shouldContainFocus={isDialog}\n isExiting={isExiting}\n portalContainer={UNSTABLE_portalContainer ?? groupCtx?.current ?? undefined}>\n {overlay}\n </Overlay>\n );\n}\n"],"names":[],"version":3,"file":"Popover.mjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;AA+IM,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAAkD;AAE5F,iFAAiF;AACjF,MAAM,0DAAsB,CAAA,GAAA,oBAAY,EAAoC;AAKrE,MAAM,4CAAwB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB,SAAS,QAC3E,KAAmB,EACnB,GAA8B;IAE9B,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,eAAe,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,wCAAyB;IACvD,IAAI,aAAa,CAAA,GAAA,6BAAqB,EAAE;IACxC,IAAI,QACF,MAAM,MAAM,IAAI,QAAQ,MAAM,WAAW,IAAI,QAAQ,CAAC,eAAe,aAAa;IACpF,2FAA2F;IAC3F,gFAAgF;IAChF,IAAI,gBAAg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AE1B,CAAC,MAAM,UAAU,kBAAI,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;sBAC3D,gCAAC,CAAA,GAAA,yCAAkB,EAAE,QAAQ;QAAC,OAAO;YAAC,GAAG,UAAU;uBAAE;YAAW,KAAK;QAAQ;OAC1E,yBAEH,gCAAC,CAAA,GAAA,oBAAY;QAAE,WAAW,MAAM,KAAK;;IAGzC,qCAAqC;IAErC,yGAAyG;IACzG,IAAI,CAAC,cACH,sCAAsC;IACtC,qBACE,gCAAC,CAAA,GAAA,cAAM;QACJ,GAAG,KAAK;QACT,oBAAoB,YAAY,MAAM,OAAO,KAAK;QAClD,WAAW;QACX,iBAAiB;OAEhB,CAAC,MAAM,UAAU,IAAI,MAAM,MAAM,kBAChC,gCAAC;QAAI,eAAY;QAAY,GAAG,aAAa;QAAE,OAAO;YAAC,UAAU;YAAS,OAAO;QAAC;sBAEpF,gCAAC;QAAI,KAAK;QAAc,OAAO;YAAC,SAAS;QAAU;qBACjD,gCAAC,0CAAoB,QAAQ;QAAC,OAAO;OAClC;IAQX,qEAAqE;IACrE,sCAAsC;IACtC,qBACE,gCAAC,CAAA,GAAA,cAAM;QACJ,GAAG,KAAK;QACT,oBAAoB,YAAY,MAAM,OAAO,KAAK;QAClD,WAAW;QACX,iBAAiB,4BAA4B,UAAU,WAAW;OACjE;AAGL,qCAAqC;AACvC","sources":["packages/react-aria-components/src/Popover.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n AriaLabelingProps,\n forwardRefType,\n GlobalDOMAttributes,\n RefObject\n} from '@react-types/shared';\nimport {AriaPopoverProps, usePopover} from 'react-aria/usePopover';\nimport {\n ClassNameOrFunction,\n ContextValue,\n dom,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {DismissButton, Overlay} from 'react-aria/Overlay';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {focusSafely} from 'react-aria/private/interactions/focusSafely';\nimport {getInteractionModality} from 'react-aria/private/interactions/useFocusVisible';\nimport {isFocusWithin} from 'react-aria/private/utils/shadowdom/DOMFunctions';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {OverlayArrowContext} from './OverlayArrow';\nimport {\n OverlayTriggerProps,\n OverlayTriggerState,\n useOverlayTriggerState\n} from 'react-stately/useOverlayTriggerState';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PlacementAxis, PositionProps} from 'react-aria/useOverlayPosition';\nimport React, {\n Context,\n createContext,\n ForwardedRef,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport {useEnterAnimation, useExitAnimation} from 'react-aria/private/utils/animation';\nimport {useIsHidden} from 'react-aria/private/collections/Hidden';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useResizeObserver} from 'react-aria/private/utils/useResizeObserver';\n\nexport interface PopoverProps\n extends\n Omit<PositionProps, 'isOpen'>,\n Omit<AriaPopoverProps, 'popoverRef' | 'triggerRef' | 'groupRef' | 'offset' | 'arrowSize'>,\n OverlayTriggerProps,\n RenderProps<PopoverRenderProps>,\n SlotProps,\n AriaLabelingProps,\n GlobalDOMAttributes<HTMLDivElement> {\n /**\n * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n * element. A function may be provided to compute the class based on component state.\n *\n * @default 'react-aria-Popover'\n */\n className?: ClassNameOrFunction<PopoverRenderProps>;\n /**\n * The name of the component that triggered the popover. This is reflected on the element\n * as the `data-trigger` attribute, and can be used to provide specific\n * styles for the popover depending on which element triggered it.\n */\n trigger?: string;\n /**\n * The ref for the element which the popover positions itself with respect to.\n *\n * When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc.,\n * this is set automatically. It is only required when used standalone.\n */\n triggerRef?: RefObject<Element | null>;\n /**\n * Whether the popover is currently performing an entry animation.\n */\n isEntering?: boolean;\n /**\n * Whether the popover is currently performing an exit animation.\n */\n isExiting?: boolean;\n /**\n * Whether the popover should appear and disappear without an entry or exit animation. This is\n * used by components such as PreviewTrigger to skip animations when quickly swapping between\n * overlays.\n */\n shouldSkipAnimation?: boolean;\n /**\n * The container element in which the overlay portal will be placed. This may have unknown\n * behavior depending on where it is portalled to.\n *\n * @deprecated - Use a parent UNSAFE_PortalProvider to set your portal container instead.\n * @default document.body\n */\n UNSTABLE_portalContainer?: Element;\n /**\n * The additional offset applied along the main axis between the element and its\n * anchor element.\n *\n * @default 8\n */\n offset?: number;\n}\n\nexport interface PopoverRenderProps {\n /**\n * The name of the component that triggered the popover, e.g. \"DialogTrigger\" or \"ComboBox\".\n *\n * @selector [data-trigger=\"...\"]\n */\n trigger: string | null;\n /**\n * The placement of the popover relative to the trigger.\n *\n * @selector [data-placement=\"left | right | top | bottom\"]\n */\n placement: PlacementAxis | null;\n /**\n * Whether the popover is currently entering. Use this to apply animations.\n *\n * @selector [data-entering]\n */\n isEntering: boolean;\n /**\n * Whether the popover is currently exiting. Use this to apply animations.\n *\n * @selector [data-exiting]\n */\n isExiting: boolean;\n}\n\ninterface PopoverContextValue extends PopoverProps {\n id?: string;\n /** Contexts to clear. */\n clearContexts?: Context<any>[];\n}\n\nexport const PopoverContext = createContext<ContextValue<PopoverContextValue, HTMLElement>>(null);\n\n// Stores a ref for the portal container for a group of popovers (e.g. submenus).\nconst PopoverGroupContext = createContext<RefObject<Element | null> | null>(null);\n\n/**\n * A popover is an overlay element positioned relative to a trigger.\n */\nexport const Popover = /*#__PURE__*/ (forwardRef as forwardRefType)(function Popover(\n props: PopoverProps,\n ref: ForwardedRef<HTMLElement>\n) {\n [props, ref] = useContextProps(props, ref, PopoverContext);\n let contextState = useContext(OverlayTriggerStateContext);\n let localState = useOverlayTriggerState(props);\n let state =\n props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n // Skip the automatic exit animation when closing instantly (e.g. swapping between previews\n // during warmup). An explicitly provided isExiting prop still takes precedence.\n let exitAnimation = useExitAnimation(ref, state.isOpen);\n let isExiting = props.isExiting || (!props.shouldSkipAnimation && exitAnimation) || false;\n let isHidden = useIsHidden();\n let {direction} = useLocale();\n\n // If we are in a hidden tree, we still need to preserve our children.\n if (isHidden) {\n let children = props.children;\n if (typeof children === 'function') {\n children = children({\n trigger: props.trigger || null,\n placement: 'bottom',\n isEntering: false,\n isExiting: false,\n defaultChildren: null\n });\n }\n\n return <>{children}</>;\n }\n\n if (state && !state.isOpen && !isExiting) {\n return null;\n }\n\n return (\n <PopoverInner\n {...props}\n triggerRef={props.triggerRef!}\n state={state}\n popoverRef={ref}\n isExiting={isExiting}\n dir={direction}\n />\n );\n});\n\ninterface PopoverInnerProps extends AriaPopoverProps, RenderProps<PopoverRenderProps>, SlotProps {\n state: OverlayTriggerState;\n isEntering?: boolean;\n isExiting: boolean;\n shouldSkipAnimation?: boolean;\n UNSTABLE_portalContainer?: Element;\n trigger?: string;\n dir?: 'ltr' | 'rtl';\n clearContexts?: Context<any>[];\n id?: string;\n}\n\nfunction PopoverInner({\n state,\n isExiting,\n UNSTABLE_portalContainer,\n clearContexts,\n ...props\n}: PopoverInnerProps) {\n // Calculate the arrow size internally (and remove props.arrowSize from PopoverProps)\n // Referenced from: packages/@react-spectrum/tooltip/src/TooltipTrigger.tsx\n let arrowRef = useRef<HTMLDivElement>(null);\n let containerRef = useRef<HTMLDivElement | null>(null);\n let groupCtx = useContext(PopoverGroupContext);\n let isSubPopover = groupCtx && props.trigger === 'SubmenuTrigger';\n\n let {popoverProps, underlayProps, arrowProps, placement, triggerAnchorPoint} = usePopover(\n {\n ...props,\n offset: props.offset ?? 8,\n arrowRef,\n // If this is a submenu/subdialog, use the root popover's container\n // to detect outside interaction and add aria-hidden.\n groupRef: isSubPopover ? groupCtx! : containerRef\n },\n state\n );\n\n let ref = props.popoverRef as RefObject<HTMLDivElement | null>;\n // Skip the automatic entry animation when opening instantly (e.g. swapping between previews\n // during warmup). An explicitly provided isEntering prop still takes precedence.\n let enterAnimation = useEnterAnimation(ref, !!placement);\n // oxlint-disable-next-line react/react-compiler\n let isEntering = props.isEntering || (!props.shouldSkipAnimation && enterAnimation) || false;\n // oxlint-disable-next-line react/react-compiler\n let renderProps = useRenderProps({\n // oxlint-disable-next-line react/react-compiler\n ...props,\n defaultClassName: 'react-aria-Popover',\n // oxlint-disable-next-line react/react-compiler\n values: {\n // oxlint-disable-next-line react/react-compiler\n trigger: props.trigger || null,\n placement,\n // oxlint-disable-next-line react/react-compiler\n isEntering,\n isExiting\n }\n });\n\n // Automatically render Popover with role=dialog except when isNonModal is true,\n // or a dialog is already nested inside the popover.\n let shouldBeDialog =\n // oxlint-disable-next-line react/react-compiler\n !props.isNonModal || props.trigger === 'SubmenuTrigger' || props.trigger === 'PreviewTrigger';\n // oxlint-disable-next-line react/react-compiler\n let [isDialog, setDialog] = useState(props.trigger === 'PreviewTrigger');\n useLayoutEffect(() => {\n if (ref.current) {\n setDialog(shouldBeDialog && !ref.current.querySelector('[role=dialog]'));\n }\n }, [ref, shouldBeDialog]);\n\n // Focus the popover itself on mount, unless a child element is already focused.\n // Skip this for submenus since hovering a submenutrigger should keep focus on the trigger\n // oxlint-disable react/react-compiler\n useEffect(() => {\n if (\n isDialog &&\n props.trigger !== 'PreviewTrigger' &&\n (props.trigger !== 'SubmenuTrigger' || getInteractionModality() !== 'pointer') &&\n ref.current &&\n !isFocusWithin(ref.current)\n ) {\n focusSafely(ref.current);\n }\n }, [isDialog, ref, props.trigger]);\n // oxlint-enable react/react-compiler\n\n let children = useMemo(() => {\n let children = renderProps.children;\n if (clearContexts) {\n for (let Context of clearContexts) {\n children = <Context.Provider value={null}>{children}</Context.Provider>;\n }\n }\n return children;\n }, [renderProps.children, clearContexts]);\n\n let [triggerWidth, setTriggerWidth] = useState<string | null>(null);\n // oxlint-disable-next-line react/react-compiler\n let onResize = useCallback(() => {\n if (props.triggerRef.current) {\n setTriggerWidth(props.triggerRef.current.getBoundingClientRect().width + 'px');\n }\n }, [props.triggerRef]);\n\n useLayoutEffect(onResize, [onResize]);\n // oxlint-disable-next-line react/react-compiler\n useResizeObserver({\n // oxlint-disable-next-line react/react-compiler\n ref: renderProps.style?.['--trigger-width'] ? undefined : props.triggerRef,\n onResize: onResize\n });\n\n let style = {\n ...popoverProps.style,\n '--trigger-anchor-point': triggerAnchorPoint\n ? `${triggerAnchorPoint.x}px ${triggerAnchorPoint.y}px`\n : undefined,\n ...renderProps.style,\n '--trigger-width': renderProps.style?.['--trigger-width'] || triggerWidth\n };\n\n // oxlint-disable react/react-compiler\n let overlay = (\n <dom.div\n {...mergeProps(filterDOMProps(props, {global: true}), popoverProps)}\n {...renderProps}\n id={isDialog ? props.id : undefined}\n role={isDialog ? 'dialog' : undefined}\n tabIndex={isDialog ? -1 : undefined}\n aria-label={props['aria-label']}\n aria-labelledby={props['aria-labelledby']}\n ref={ref}\n slot={props.slot || undefined}\n style={style}\n dir={props.dir}\n data-trigger={props.trigger}\n data-placement={placement}\n data-entering={isEntering || undefined}\n data-exiting={isExiting || undefined}>\n {/* oxlint-disable-next-line react/react-compiler */}\n {!props.isNonModal && <DismissButton onDismiss={state.close} />}\n <OverlayArrowContext.Provider value={{...arrowProps, placement, ref: arrowRef}}>\n {children}\n </OverlayArrowContext.Provider>\n <DismissButton onDismiss={state.close} />\n </dom.div>\n );\n // oxlint-enable react/react-compiler\n\n // If this is a root popover, render an extra div to act as the portal container for submenus/subdialogs.\n if (!isSubPopover) {\n // oxlint-disable react/react-compiler\n return (\n <Overlay\n {...props}\n shouldContainFocus={isDialog && props.trigger !== 'PreviewTrigger'}\n isExiting={isExiting}\n portalContainer={UNSTABLE_portalContainer}>\n {/* oxlint-disable-next-line react/react-compiler */}\n {!props.isNonModal && state.isOpen && (\n <div data-testid=\"underlay\" {...underlayProps} style={{position: 'fixed', inset: 0}} />\n )}\n <div ref={containerRef} style={{display: 'contents'}}>\n <PopoverGroupContext.Provider value={containerRef}>\n {overlay}\n </PopoverGroupContext.Provider>\n </div>\n </Overlay>\n );\n // oxlint-enable react/react-compiler\n }\n\n // Submenus/subdialogs are mounted into the root popover's container.\n // oxlint-disable react/react-compiler\n return (\n <Overlay\n {...props}\n shouldContainFocus={isDialog && props.trigger !== 'PreviewTrigger'}\n isExiting={isExiting}\n portalContainer={UNSTABLE_portalContainer ?? groupCtx?.current ?? undefined}>\n {overlay}\n </Overlay>\n );\n // oxlint-enable react/react-compiler\n}\n"],"names":[],"version":3,"file":"Popover.mjs.map"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
var $88595bf043e542ec$exports = require("./Dialog.cjs");
|
|
2
|
+
var $74e35a768d38d46b$exports = require("./Popover.cjs");
|
|
3
|
+
var $048d76b84370f141$exports = require("./utils.cjs");
|
|
4
|
+
var $3aRaU$reactariausePreviewTrigger = require("react-aria/usePreviewTrigger");
|
|
5
|
+
var $3aRaU$reactariaprivateinteractionsuseFocusable = require("react-aria/private/interactions/useFocusable");
|
|
6
|
+
var $3aRaU$react = require("react");
|
|
7
|
+
var $3aRaU$reactstatelyuseTooltipTriggerState = require("react-stately/useTooltipTriggerState");
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
function $parcel$interopDefault(a) {
|
|
11
|
+
return a && a.__esModule ? a.default : a;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function $parcel$export(e, n, v, s) {
|
|
15
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
$parcel$export(module.exports, "PreviewTrigger", function () { return $d080a2b6a6742393$export$60a5cf113499de66; });
|
|
19
|
+
/*
|
|
20
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
21
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
22
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
23
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
24
|
+
*
|
|
25
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
26
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
27
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
28
|
+
* governing permissions and limitations under the License.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
function $d080a2b6a6742393$export$60a5cf113499de66(props) {
|
|
37
|
+
let state = (0, $3aRaU$reactstatelyuseTooltipTriggerState.useTooltipTriggerState)({
|
|
38
|
+
...props,
|
|
39
|
+
delay: props.delay ?? 600,
|
|
40
|
+
closeDelay: props.closeDelay ?? 200
|
|
41
|
+
});
|
|
42
|
+
let triggerRef = (0, $3aRaU$react.useRef)(null);
|
|
43
|
+
let popoverRef = (0, $3aRaU$react.useRef)(null);
|
|
44
|
+
let { triggerProps: triggerProps, popoverProps: popoverProps } = (0, $3aRaU$reactariausePreviewTrigger.usePreviewTrigger)({
|
|
45
|
+
...props,
|
|
46
|
+
triggerRef: triggerRef,
|
|
47
|
+
popoverRef: popoverRef
|
|
48
|
+
}, state);
|
|
49
|
+
// The Popover and usePopover expect an OverlayTriggerState. Adapt the TooltipTriggerState (which
|
|
50
|
+
// provides the warmup/cooldown delay behavior) to that interface.
|
|
51
|
+
let overlayState = (0, $3aRaU$react.useMemo)(()=>({
|
|
52
|
+
isOpen: state.isOpen,
|
|
53
|
+
open: ()=>state.open(),
|
|
54
|
+
close: ()=>state.close(),
|
|
55
|
+
setOpen: (isOpen)=>isOpen ? state.open() : state.close(),
|
|
56
|
+
toggle: ()=>state.isOpen ? state.close() : state.open(),
|
|
57
|
+
point: null,
|
|
58
|
+
setPoint: ()=>{}
|
|
59
|
+
}), [
|
|
60
|
+
state
|
|
61
|
+
]);
|
|
62
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($3aRaU$react))).createElement((0, $048d76b84370f141$exports.Provider), {
|
|
63
|
+
values: [
|
|
64
|
+
[
|
|
65
|
+
(0, $88595bf043e542ec$exports.OverlayTriggerStateContext),
|
|
66
|
+
overlayState
|
|
67
|
+
],
|
|
68
|
+
[
|
|
69
|
+
(0, $74e35a768d38d46b$exports.PopoverContext),
|
|
70
|
+
{
|
|
71
|
+
trigger: 'PreviewTrigger',
|
|
72
|
+
triggerRef: triggerRef,
|
|
73
|
+
ref: popoverRef,
|
|
74
|
+
isNonModal: true,
|
|
75
|
+
// Skip enter/exit animations when swapping between previews during the warmup period.
|
|
76
|
+
shouldSkipAnimation: state.shouldSkipAnimation,
|
|
77
|
+
...popoverProps
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
]
|
|
81
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($3aRaU$react))).createElement((0, $3aRaU$reactariaprivateinteractionsuseFocusable.FocusableProvider), {
|
|
82
|
+
...triggerProps,
|
|
83
|
+
ref: triggerRef
|
|
84
|
+
}, props.children));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
//# sourceMappingURL=PreviewTrigger.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAiCM,SAAS,0CAAe,KAA0B;IACvD,IAAI,QAAQ,CAAA,GAAA,gEAAqB,EAAE;QACjC,GAAG,KAAK;QACR,OAAO,MAAM,KAAK,IAAI;QACtB,YAAY,MAAM,UAAU,IAAI;IAClC;IACA,IAAI,aAAa,CAAA,GAAA,mBAAK,EAAoB;IAC1C,IAAI,aAAa,CAAA,GAAA,mBAAK,EAAe;IACrC,IAAI,gBAAC,YAAY,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,mDAAgB,EAAE;QAAC,GAAG,KAAK;oBAAE;oBAAY;IAAU,GAAG;IAEzF,iGAAiG;IACjG,kEAAkE;IAClE,IAAI,eAAe,CAAA,GAAA,oBAAM,EACvB,IAAO,CAAA;YACL,QAAQ,MAAM,MAAM;YACpB,MAAM,IAAM,MAAM,IAAI;YACtB,OAAO,IAAM,MAAM,KAAK;YACxB,SAAS,CAAA,SAAW,SAAS,MAAM,IAAI,KAAK,MAAM,KAAK;YACvD,QAAQ,IAAO,MAAM,MAAM,GAAG,MAAM,KAAK,KAAK,MAAM,IAAI;YACxD,OAAO;YACP,UAAU,KAAO;QACnB,CAAA,GACA;QAAC;KAAM;IAGT,qBACE,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,oDAAyB;gBAAG;aAAa;YAC1C;gBACE,CAAA,GAAA,wCAAa;gBACb;oBACE,SAAS;gCACT;oBACA,KAAK;oBACL,YAAY;oBACZ,sFAAsF;oBACtF,qBAAqB,MAAM,mBAAmB;oBAC9C,GAAG,YAAY;gBACjB;aACD;SACF;qBACD,0DAAC,CAAA,GAAA,iEAAgB;QAAG,GAAG,YAAY;QAAE,KAAK;OACvC,MAAM,QAAQ;AAIvB","sources":["packages/react-aria-components/src/PreviewTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaPreviewTriggerProps, usePreviewTrigger} from 'react-aria/usePreviewTrigger';\nimport {FocusableElement} from '@react-types/shared';\nimport {FocusableProvider} from 'react-aria/private/interactions/useFocusable';\nimport {OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PopoverContext} from './Popover';\nimport {Provider} from './utils';\nimport React, {JSX, ReactNode, useMemo, useRef} from 'react';\nimport {useTooltipTriggerState} from 'react-stately/useTooltipTriggerState';\n\nexport interface PreviewTriggerProps extends AriaPreviewTriggerProps {\n /** The trigger and Popover that make up the preview trigger. */\n children: ReactNode;\n /**\n * The delay time in milliseconds before the preview opens.\n *\n * @default 600\n */\n delay?: number;\n /**\n * The delay time in milliseconds before the preview closes.\n *\n * @default 200\n */\n closeDelay?: number;\n}\n\n/**\n * A PreviewTrigger displays a non-modal popover on hover, focus, or long press. Unlike a tooltip,\n * the popover may contain interactive content.\n */\nexport function PreviewTrigger(props: PreviewTriggerProps): JSX.Element {\n let state = useTooltipTriggerState({\n ...props,\n delay: props.delay ?? 600,\n closeDelay: props.closeDelay ?? 200\n });\n let triggerRef = useRef<FocusableElement>(null);\n let popoverRef = useRef<HTMLElement>(null);\n let {triggerProps, popoverProps} = usePreviewTrigger({...props, triggerRef, popoverRef}, state);\n\n // The Popover and usePopover expect an OverlayTriggerState. Adapt the TooltipTriggerState (which\n // provides the warmup/cooldown delay behavior) to that interface.\n let overlayState = useMemo<OverlayTriggerState>(\n () => ({\n isOpen: state.isOpen,\n open: () => state.open(),\n close: () => state.close(),\n setOpen: isOpen => (isOpen ? state.open() : state.close()),\n toggle: () => (state.isOpen ? state.close() : state.open()),\n point: null,\n setPoint: () => {}\n }),\n [state]\n );\n\n return (\n <Provider\n values={[\n [OverlayTriggerStateContext, overlayState],\n [\n PopoverContext,\n {\n trigger: 'PreviewTrigger',\n triggerRef,\n ref: popoverRef,\n isNonModal: true,\n // Skip enter/exit animations when swapping between previews during the warmup period.\n shouldSkipAnimation: state.shouldSkipAnimation,\n ...popoverProps\n }\n ]\n ]}>\n <FocusableProvider {...triggerProps} ref={triggerRef}>\n {props.children}\n </FocusableProvider>\n </Provider>\n );\n}\n"],"names":[],"version":3,"file":"PreviewTrigger.cjs.map"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {OverlayTriggerStateContext as $acf8e70c2f419f18$export$d2f961adcb0afbe} from "./Dialog.js";
|
|
2
|
+
import {PopoverContext as $03df2f2d3cffb62f$export$9b9a0cd73afb7ca4} from "./Popover.js";
|
|
3
|
+
import {Provider as $b7b7a92703138c9b$export$2881499e37b75b9a} from "./utils.js";
|
|
4
|
+
import {usePreviewTrigger as $gmnOE$usePreviewTrigger} from "react-aria/usePreviewTrigger";
|
|
5
|
+
import {FocusableProvider as $gmnOE$FocusableProvider} from "react-aria/private/interactions/useFocusable";
|
|
6
|
+
import $gmnOE$react, {useRef as $gmnOE$useRef, useMemo as $gmnOE$useMemo} from "react";
|
|
7
|
+
import {useTooltipTriggerState as $gmnOE$useTooltipTriggerState} from "react-stately/useTooltipTriggerState";
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
11
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
13
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
16
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
17
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
18
|
+
* governing permissions and limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
function $7e17edf2fd1a9983$export$60a5cf113499de66(props) {
|
|
27
|
+
var _props_delay, _props_closeDelay;
|
|
28
|
+
let state = (0, $gmnOE$useTooltipTriggerState)({
|
|
29
|
+
...props,
|
|
30
|
+
delay: (_props_delay = props.delay) !== null && _props_delay !== void 0 ? _props_delay : 600,
|
|
31
|
+
closeDelay: (_props_closeDelay = props.closeDelay) !== null && _props_closeDelay !== void 0 ? _props_closeDelay : 200
|
|
32
|
+
});
|
|
33
|
+
let triggerRef = (0, $gmnOE$useRef)(null);
|
|
34
|
+
let popoverRef = (0, $gmnOE$useRef)(null);
|
|
35
|
+
let { triggerProps: triggerProps, popoverProps: popoverProps } = (0, $gmnOE$usePreviewTrigger)({
|
|
36
|
+
...props,
|
|
37
|
+
triggerRef: triggerRef,
|
|
38
|
+
popoverRef: popoverRef
|
|
39
|
+
}, state);
|
|
40
|
+
// The Popover and usePopover expect an OverlayTriggerState. Adapt the TooltipTriggerState (which
|
|
41
|
+
// provides the warmup/cooldown delay behavior) to that interface.
|
|
42
|
+
let overlayState = (0, $gmnOE$useMemo)(()=>({
|
|
43
|
+
isOpen: state.isOpen,
|
|
44
|
+
open: ()=>state.open(),
|
|
45
|
+
close: ()=>state.close(),
|
|
46
|
+
setOpen: (isOpen)=>isOpen ? state.open() : state.close(),
|
|
47
|
+
toggle: ()=>state.isOpen ? state.close() : state.open(),
|
|
48
|
+
point: null,
|
|
49
|
+
setPoint: ()=>{}
|
|
50
|
+
}), [
|
|
51
|
+
state
|
|
52
|
+
]);
|
|
53
|
+
return /*#__PURE__*/ (0, $gmnOE$react).createElement((0, $b7b7a92703138c9b$export$2881499e37b75b9a), {
|
|
54
|
+
values: [
|
|
55
|
+
[
|
|
56
|
+
(0, $acf8e70c2f419f18$export$d2f961adcb0afbe),
|
|
57
|
+
overlayState
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
(0, $03df2f2d3cffb62f$export$9b9a0cd73afb7ca4),
|
|
61
|
+
{
|
|
62
|
+
trigger: 'PreviewTrigger',
|
|
63
|
+
triggerRef: triggerRef,
|
|
64
|
+
ref: popoverRef,
|
|
65
|
+
isNonModal: true,
|
|
66
|
+
// Skip enter/exit animations when swapping between previews during the warmup period.
|
|
67
|
+
shouldSkipAnimation: state.shouldSkipAnimation,
|
|
68
|
+
...popoverProps
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
]
|
|
72
|
+
}, /*#__PURE__*/ (0, $gmnOE$react).createElement((0, $gmnOE$FocusableProvider), {
|
|
73
|
+
...triggerProps,
|
|
74
|
+
ref: triggerRef
|
|
75
|
+
}, props.children));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
export {$7e17edf2fd1a9983$export$60a5cf113499de66 as PreviewTrigger};
|
|
80
|
+
//# sourceMappingURL=PreviewTrigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAiCM,SAAS,0CAAe,KAA0B;QAG9C,cACK;IAHd,IAAI,QAAQ,CAAA,GAAA,6BAAqB,EAAE;QACjC,GAAG,KAAK;QACR,OAAO,CAAA,eAAA,MAAM,KAAK,cAAX,0BAAA,eAAe;QACtB,YAAY,CAAA,oBAAA,MAAM,UAAU,cAAhB,+BAAA,oBAAoB;IAClC;IACA,IAAI,aAAa,CAAA,GAAA,aAAK,EAAoB;IAC1C,IAAI,aAAa,CAAA,GAAA,aAAK,EAAe;IACrC,IAAI,gBAAC,YAAY,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE;QAAC,GAAG,KAAK;oBAAE;oBAAY;IAAU,GAAG;IAEzF,iGAAiG;IACjG,kEAAkE;IAClE,IAAI,eAAe,CAAA,GAAA,cAAM,EACvB,IAAO,CAAA;YACL,QAAQ,MAAM,MAAM;YACpB,MAAM,IAAM,MAAM,IAAI;YACtB,OAAO,IAAM,MAAM,KAAK;YACxB,SAAS,CAAA,SAAW,SAAS,MAAM,IAAI,KAAK,MAAM,KAAK;YACvD,QAAQ,IAAO,MAAM,MAAM,GAAG,MAAM,KAAK,KAAK,MAAM,IAAI;YACxD,OAAO;YACP,UAAU,KAAO;QACnB,CAAA,GACA;QAAC;KAAM;IAGT,qBACE,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,wCAAyB;gBAAG;aAAa;YAC1C;gBACE,CAAA,GAAA,yCAAa;gBACb;oBACE,SAAS;gCACT;oBACA,KAAK;oBACL,YAAY;oBACZ,sFAAsF;oBACtF,qBAAqB,MAAM,mBAAmB;oBAC9C,GAAG,YAAY;gBACjB;aACD;SACF;qBACD,gCAAC,CAAA,GAAA,wBAAgB;QAAG,GAAG,YAAY;QAAE,KAAK;OACvC,MAAM,QAAQ;AAIvB","sources":["packages/react-aria-components/src/PreviewTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaPreviewTriggerProps, usePreviewTrigger} from 'react-aria/usePreviewTrigger';\nimport {FocusableElement} from '@react-types/shared';\nimport {FocusableProvider} from 'react-aria/private/interactions/useFocusable';\nimport {OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PopoverContext} from './Popover';\nimport {Provider} from './utils';\nimport React, {JSX, ReactNode, useMemo, useRef} from 'react';\nimport {useTooltipTriggerState} from 'react-stately/useTooltipTriggerState';\n\nexport interface PreviewTriggerProps extends AriaPreviewTriggerProps {\n /** The trigger and Popover that make up the preview trigger. */\n children: ReactNode;\n /**\n * The delay time in milliseconds before the preview opens.\n *\n * @default 600\n */\n delay?: number;\n /**\n * The delay time in milliseconds before the preview closes.\n *\n * @default 200\n */\n closeDelay?: number;\n}\n\n/**\n * A PreviewTrigger displays a non-modal popover on hover, focus, or long press. Unlike a tooltip,\n * the popover may contain interactive content.\n */\nexport function PreviewTrigger(props: PreviewTriggerProps): JSX.Element {\n let state = useTooltipTriggerState({\n ...props,\n delay: props.delay ?? 600,\n closeDelay: props.closeDelay ?? 200\n });\n let triggerRef = useRef<FocusableElement>(null);\n let popoverRef = useRef<HTMLElement>(null);\n let {triggerProps, popoverProps} = usePreviewTrigger({...props, triggerRef, popoverRef}, state);\n\n // The Popover and usePopover expect an OverlayTriggerState. Adapt the TooltipTriggerState (which\n // provides the warmup/cooldown delay behavior) to that interface.\n let overlayState = useMemo<OverlayTriggerState>(\n () => ({\n isOpen: state.isOpen,\n open: () => state.open(),\n close: () => state.close(),\n setOpen: isOpen => (isOpen ? state.open() : state.close()),\n toggle: () => (state.isOpen ? state.close() : state.open()),\n point: null,\n setPoint: () => {}\n }),\n [state]\n );\n\n return (\n <Provider\n values={[\n [OverlayTriggerStateContext, overlayState],\n [\n PopoverContext,\n {\n trigger: 'PreviewTrigger',\n triggerRef,\n ref: popoverRef,\n isNonModal: true,\n // Skip enter/exit animations when swapping between previews during the warmup period.\n shouldSkipAnimation: state.shouldSkipAnimation,\n ...popoverProps\n }\n ]\n ]}>\n <FocusableProvider {...triggerProps} ref={triggerRef}>\n {props.children}\n </FocusableProvider>\n </Provider>\n );\n}\n"],"names":[],"version":3,"file":"PreviewTrigger.js.map"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {OverlayTriggerStateContext as $f2ff30fde7b014be$export$d2f961adcb0afbe} from "./Dialog.mjs";
|
|
2
|
+
import {PopoverContext as $542a13ca2fa5b484$export$9b9a0cd73afb7ca4} from "./Popover.mjs";
|
|
3
|
+
import {Provider as $7230ffa83bc0c2cf$export$2881499e37b75b9a} from "./utils.mjs";
|
|
4
|
+
import {usePreviewTrigger as $evW8Q$usePreviewTrigger} from "react-aria/usePreviewTrigger";
|
|
5
|
+
import {FocusableProvider as $evW8Q$FocusableProvider} from "react-aria/private/interactions/useFocusable";
|
|
6
|
+
import $evW8Q$react, {useRef as $evW8Q$useRef, useMemo as $evW8Q$useMemo} from "react";
|
|
7
|
+
import {useTooltipTriggerState as $evW8Q$useTooltipTriggerState} from "react-stately/useTooltipTriggerState";
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
11
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
13
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
16
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
17
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
18
|
+
* governing permissions and limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
function $32e5dbc959387ef1$export$60a5cf113499de66(props) {
|
|
27
|
+
let state = (0, $evW8Q$useTooltipTriggerState)({
|
|
28
|
+
...props,
|
|
29
|
+
delay: props.delay ?? 600,
|
|
30
|
+
closeDelay: props.closeDelay ?? 200
|
|
31
|
+
});
|
|
32
|
+
let triggerRef = (0, $evW8Q$useRef)(null);
|
|
33
|
+
let popoverRef = (0, $evW8Q$useRef)(null);
|
|
34
|
+
let { triggerProps: triggerProps, popoverProps: popoverProps } = (0, $evW8Q$usePreviewTrigger)({
|
|
35
|
+
...props,
|
|
36
|
+
triggerRef: triggerRef,
|
|
37
|
+
popoverRef: popoverRef
|
|
38
|
+
}, state);
|
|
39
|
+
// The Popover and usePopover expect an OverlayTriggerState. Adapt the TooltipTriggerState (which
|
|
40
|
+
// provides the warmup/cooldown delay behavior) to that interface.
|
|
41
|
+
let overlayState = (0, $evW8Q$useMemo)(()=>({
|
|
42
|
+
isOpen: state.isOpen,
|
|
43
|
+
open: ()=>state.open(),
|
|
44
|
+
close: ()=>state.close(),
|
|
45
|
+
setOpen: (isOpen)=>isOpen ? state.open() : state.close(),
|
|
46
|
+
toggle: ()=>state.isOpen ? state.close() : state.open(),
|
|
47
|
+
point: null,
|
|
48
|
+
setPoint: ()=>{}
|
|
49
|
+
}), [
|
|
50
|
+
state
|
|
51
|
+
]);
|
|
52
|
+
return /*#__PURE__*/ (0, $evW8Q$react).createElement((0, $7230ffa83bc0c2cf$export$2881499e37b75b9a), {
|
|
53
|
+
values: [
|
|
54
|
+
[
|
|
55
|
+
(0, $f2ff30fde7b014be$export$d2f961adcb0afbe),
|
|
56
|
+
overlayState
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
(0, $542a13ca2fa5b484$export$9b9a0cd73afb7ca4),
|
|
60
|
+
{
|
|
61
|
+
trigger: 'PreviewTrigger',
|
|
62
|
+
triggerRef: triggerRef,
|
|
63
|
+
ref: popoverRef,
|
|
64
|
+
isNonModal: true,
|
|
65
|
+
// Skip enter/exit animations when swapping between previews during the warmup period.
|
|
66
|
+
shouldSkipAnimation: state.shouldSkipAnimation,
|
|
67
|
+
...popoverProps
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
]
|
|
71
|
+
}, /*#__PURE__*/ (0, $evW8Q$react).createElement((0, $evW8Q$FocusableProvider), {
|
|
72
|
+
...triggerProps,
|
|
73
|
+
ref: triggerRef
|
|
74
|
+
}, props.children));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
export {$32e5dbc959387ef1$export$60a5cf113499de66 as PreviewTrigger};
|
|
79
|
+
//# sourceMappingURL=PreviewTrigger.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAiCM,SAAS,0CAAe,KAA0B;IACvD,IAAI,QAAQ,CAAA,GAAA,6BAAqB,EAAE;QACjC,GAAG,KAAK;QACR,OAAO,MAAM,KAAK,IAAI;QACtB,YAAY,MAAM,UAAU,IAAI;IAClC;IACA,IAAI,aAAa,CAAA,GAAA,aAAK,EAAoB;IAC1C,IAAI,aAAa,CAAA,GAAA,aAAK,EAAe;IACrC,IAAI,gBAAC,YAAY,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE;QAAC,GAAG,KAAK;oBAAE;oBAAY;IAAU,GAAG;IAEzF,iGAAiG;IACjG,kEAAkE;IAClE,IAAI,eAAe,CAAA,GAAA,cAAM,EACvB,IAAO,CAAA;YACL,QAAQ,MAAM,MAAM;YACpB,MAAM,IAAM,MAAM,IAAI;YACtB,OAAO,IAAM,MAAM,KAAK;YACxB,SAAS,CAAA,SAAW,SAAS,MAAM,IAAI,KAAK,MAAM,KAAK;YACvD,QAAQ,IAAO,MAAM,MAAM,GAAG,MAAM,KAAK,KAAK,MAAM,IAAI;YACxD,OAAO;YACP,UAAU,KAAO;QACnB,CAAA,GACA;QAAC;KAAM;IAGT,qBACE,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,wCAAyB;gBAAG;aAAa;YAC1C;gBACE,CAAA,GAAA,yCAAa;gBACb;oBACE,SAAS;gCACT;oBACA,KAAK;oBACL,YAAY;oBACZ,sFAAsF;oBACtF,qBAAqB,MAAM,mBAAmB;oBAC9C,GAAG,YAAY;gBACjB;aACD;SACF;qBACD,gCAAC,CAAA,GAAA,wBAAgB;QAAG,GAAG,YAAY;QAAE,KAAK;OACvC,MAAM,QAAQ;AAIvB","sources":["packages/react-aria-components/src/PreviewTrigger.tsx"],"sourcesContent":["/*\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaPreviewTriggerProps, usePreviewTrigger} from 'react-aria/usePreviewTrigger';\nimport {FocusableElement} from '@react-types/shared';\nimport {FocusableProvider} from 'react-aria/private/interactions/useFocusable';\nimport {OverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PopoverContext} from './Popover';\nimport {Provider} from './utils';\nimport React, {JSX, ReactNode, useMemo, useRef} from 'react';\nimport {useTooltipTriggerState} from 'react-stately/useTooltipTriggerState';\n\nexport interface PreviewTriggerProps extends AriaPreviewTriggerProps {\n /** The trigger and Popover that make up the preview trigger. */\n children: ReactNode;\n /**\n * The delay time in milliseconds before the preview opens.\n *\n * @default 600\n */\n delay?: number;\n /**\n * The delay time in milliseconds before the preview closes.\n *\n * @default 200\n */\n closeDelay?: number;\n}\n\n/**\n * A PreviewTrigger displays a non-modal popover on hover, focus, or long press. Unlike a tooltip,\n * the popover may contain interactive content.\n */\nexport function PreviewTrigger(props: PreviewTriggerProps): JSX.Element {\n let state = useTooltipTriggerState({\n ...props,\n delay: props.delay ?? 600,\n closeDelay: props.closeDelay ?? 200\n });\n let triggerRef = useRef<FocusableElement>(null);\n let popoverRef = useRef<HTMLElement>(null);\n let {triggerProps, popoverProps} = usePreviewTrigger({...props, triggerRef, popoverRef}, state);\n\n // The Popover and usePopover expect an OverlayTriggerState. Adapt the TooltipTriggerState (which\n // provides the warmup/cooldown delay behavior) to that interface.\n let overlayState = useMemo<OverlayTriggerState>(\n () => ({\n isOpen: state.isOpen,\n open: () => state.open(),\n close: () => state.close(),\n setOpen: isOpen => (isOpen ? state.open() : state.close()),\n toggle: () => (state.isOpen ? state.close() : state.open()),\n point: null,\n setPoint: () => {}\n }),\n [state]\n );\n\n return (\n <Provider\n values={[\n [OverlayTriggerStateContext, overlayState],\n [\n PopoverContext,\n {\n trigger: 'PreviewTrigger',\n triggerRef,\n ref: popoverRef,\n isNonModal: true,\n // Skip enter/exit animations when swapping between previews during the warmup period.\n shouldSkipAnimation: state.shouldSkipAnimation,\n ...popoverProps\n }\n ]\n ]}>\n <FocusableProvider {...triggerProps} ref={triggerRef}>\n {props.children}\n </FocusableProvider>\n </Provider>\n );\n}\n"],"names":[],"version":3,"file":"PreviewTrigger.mjs.map"}
|
|
@@ -44,8 +44,13 @@ const $ffc270943183f850$export$c17561cb55d4db30 = /*#__PURE__*/ (0, $gDBFy$react
|
|
|
44
44
|
...props,
|
|
45
45
|
label: label
|
|
46
46
|
});
|
|
47
|
+
let range = maxValue - minValue;
|
|
47
48
|
// Calculate the width of the progress bar as a percentage
|
|
48
|
-
let percentage =
|
|
49
|
+
let percentage = undefined;
|
|
50
|
+
if (!isIndeterminate) {
|
|
51
|
+
if (range === 0) percentage = 0;
|
|
52
|
+
else percentage = (value - minValue) / range * 100;
|
|
53
|
+
}
|
|
49
54
|
let renderProps = (0, $048d76b84370f141$exports.useRenderProps)({
|
|
50
55
|
...props,
|
|
51
56
|
defaultClassName: 'react-aria-ProgressBar',
|