@radix-ui/react-popover 1.1.21 → 1.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _radix_ui_react_context from '@radix-ui/react-context';
2
2
  import * as React from 'react';
3
3
  import { DismissableLayer } from '@radix-ui/react-dismissable-layer';
4
- import { FocusScope } from '@radix-ui/react-focus-scope';
4
+ import { FocusScope, FocusScopeBranchRegistry } from '@radix-ui/react-focus-scope';
5
5
  import * as PopperPrimitive from '@radix-ui/react-popper';
6
6
  import { Portal } from '@radix-ui/react-portal';
7
7
  import { Primitive } from '@radix-ui/react-primitive';
@@ -45,7 +45,7 @@ interface PopoverContentProps extends PopoverContentTypeProps {
45
45
  forceMount?: true;
46
46
  }
47
47
  declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLDivElement>>;
48
- interface PopoverContentTypeProps extends Omit<PopoverContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {
48
+ interface PopoverContentTypeProps extends Omit<PopoverContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents' | 'branchRegistry' | 'branchNodes'> {
49
49
  }
50
50
  type FocusScopeProps = React.ComponentPropsWithoutRef<typeof FocusScope>;
51
51
  type DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;
@@ -66,6 +66,19 @@ interface PopoverContentImplProps extends Omit<PopperContentProps, 'onPlaced'>,
66
66
  * Can be prevented.
67
67
  */
68
68
  onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];
69
+ /**
70
+ * Branch nodes registered by nested, portalled layers. Passed to the trapped
71
+ * `FocusScope` so focus isn't reclaimed from them. Only provided by the modal
72
+ * variant.
73
+ * @internal
74
+ */
75
+ branchNodes?: HTMLElement[];
76
+ /**
77
+ * Registry that nested, portalled layers use to register themselves as branches of this modal
78
+ * `Popover`. Only provided by the modal variant.
79
+ * @internal
80
+ */
81
+ branchRegistry?: FocusScopeBranchRegistry;
69
82
  }
70
83
  type PrimitiveHeading2Props = React.ComponentPropsWithoutRef<typeof Primitive.h2>;
71
84
  interface PopoverTitleProps extends PrimitiveHeading2Props {
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _radix_ui_react_context from '@radix-ui/react-context';
2
2
  import * as React from 'react';
3
3
  import { DismissableLayer } from '@radix-ui/react-dismissable-layer';
4
- import { FocusScope } from '@radix-ui/react-focus-scope';
4
+ import { FocusScope, FocusScopeBranchRegistry } from '@radix-ui/react-focus-scope';
5
5
  import * as PopperPrimitive from '@radix-ui/react-popper';
6
6
  import { Portal } from '@radix-ui/react-portal';
7
7
  import { Primitive } from '@radix-ui/react-primitive';
@@ -45,7 +45,7 @@ interface PopoverContentProps extends PopoverContentTypeProps {
45
45
  forceMount?: true;
46
46
  }
47
47
  declare const PopoverContent: React.ForwardRefExoticComponent<PopoverContentProps & React.RefAttributes<HTMLDivElement>>;
48
- interface PopoverContentTypeProps extends Omit<PopoverContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {
48
+ interface PopoverContentTypeProps extends Omit<PopoverContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents' | 'branchRegistry' | 'branchNodes'> {
49
49
  }
50
50
  type FocusScopeProps = React.ComponentPropsWithoutRef<typeof FocusScope>;
51
51
  type DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;
@@ -66,6 +66,19 @@ interface PopoverContentImplProps extends Omit<PopperContentProps, 'onPlaced'>,
66
66
  * Can be prevented.
67
67
  */
68
68
  onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];
69
+ /**
70
+ * Branch nodes registered by nested, portalled layers. Passed to the trapped
71
+ * `FocusScope` so focus isn't reclaimed from them. Only provided by the modal
72
+ * variant.
73
+ * @internal
74
+ */
75
+ branchNodes?: HTMLElement[];
76
+ /**
77
+ * Registry that nested, portalled layers use to register themselves as branches of this modal
78
+ * `Popover`. Only provided by the modal variant.
79
+ * @internal
80
+ */
81
+ branchRegistry?: FocusScopeBranchRegistry;
69
82
  }
70
83
  type PrimitiveHeading2Props = React.ComponentPropsWithoutRef<typeof Primitive.h2>;
71
84
  interface PopoverTitleProps extends PrimitiveHeading2Props {
package/dist/index.js CHANGED
@@ -187,38 +187,52 @@ var PopoverContentModal = /* @__PURE__ */ React.forwardRef(
187
187
  const contentRef = React.useRef(null);
188
188
  const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, contentRef);
189
189
  const isRightClickOutsideRef = React.useRef(false);
190
+ const { nodes: branchNodes, registry: branchRegistry } = (0, import_react_focus_scope.useFocusScopeBranchRegistry)();
190
191
  React.useEffect(() => {
191
192
  const content = contentRef.current;
192
193
  if (content) return (0, import_aria_hidden.hideOthers)(content);
193
194
  }, []);
194
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_remove_scroll.RemoveScroll, { as: Slot, allowPinchZoom: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
195
- PopoverContentImpl,
195
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
196
+ import_react_remove_scroll.RemoveScroll,
196
197
  {
197
- ...props,
198
- ref: composedRefs,
199
- trapFocus: context.open,
200
- disableOutsidePointerEvents: true,
201
- onCloseAutoFocus: (0, import_primitive.composeEventHandlers)(props.onCloseAutoFocus, (event) => {
202
- event.preventDefault();
203
- if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();
204
- }),
205
- onPointerDownOutside: (0, import_primitive.composeEventHandlers)(
206
- props.onPointerDownOutside,
207
- (event) => {
208
- const originalEvent = event.detail.originalEvent;
209
- const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
210
- const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
211
- isRightClickOutsideRef.current = isRightClick;
212
- },
213
- { checkForDefaultPrevented: false }
198
+ as: Slot,
199
+ allowPinchZoom: true,
200
+ shards: React.useMemo(
201
+ () => [contentRef, ...branchNodes.map((node) => ({ current: node }))],
202
+ [contentRef, branchNodes]
214
203
  ),
215
- onFocusOutside: (0, import_primitive.composeEventHandlers)(
216
- props.onFocusOutside,
217
- (event) => event.preventDefault(),
218
- { checkForDefaultPrevented: false }
204
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
205
+ PopoverContentImpl,
206
+ {
207
+ ...props,
208
+ ref: composedRefs,
209
+ branchNodes,
210
+ branchRegistry,
211
+ trapFocus: context.open,
212
+ disableOutsidePointerEvents: true,
213
+ onCloseAutoFocus: (0, import_primitive.composeEventHandlers)(props.onCloseAutoFocus, (event) => {
214
+ event.preventDefault();
215
+ if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();
216
+ }),
217
+ onPointerDownOutside: (0, import_primitive.composeEventHandlers)(
218
+ props.onPointerDownOutside,
219
+ (event) => {
220
+ const originalEvent = event.detail.originalEvent;
221
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
222
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
223
+ isRightClickOutsideRef.current = isRightClick;
224
+ },
225
+ { checkForDefaultPrevented: false }
226
+ ),
227
+ onFocusOutside: (0, import_primitive.composeEventHandlers)(
228
+ props.onFocusOutside,
229
+ (event) => event.preventDefault(),
230
+ { checkForDefaultPrevented: false }
231
+ )
232
+ }
219
233
  )
220
234
  }
221
- ) });
235
+ );
222
236
  }, "PopoverContentModal")
223
237
  );
224
238
  var PopoverContentNonModal = /* @__PURE__ */ React.forwardRef(
@@ -276,10 +290,16 @@ var PopoverContentImpl = /* @__PURE__ */ React.forwardRef(
276
290
  onFocusOutside,
277
291
  onInteractOutside,
278
292
  "aria-describedby": ariaDescribedby,
293
+ branchNodes,
294
+ branchRegistry,
295
+ children,
279
296
  ...contentProps
280
297
  } = props;
281
298
  const context = usePopoverContext(CONTENT_NAME, __scopePopover);
282
299
  const popperScope = usePopperScope(__scopePopover);
300
+ const [contentNode, setContentNode] = React.useState(null);
301
+ const composedRefs = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, setContentNode);
302
+ (0, import_react_focus_scope.useFocusScopeBranch)(contentNode);
283
303
  (0, import_react_focus_guards.useFocusGuards)();
284
304
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
285
305
  import_react_focus_scope.FocusScope,
@@ -287,6 +307,7 @@ var PopoverContentImpl = /* @__PURE__ */ React.forwardRef(
287
307
  asChild: true,
288
308
  loop: true,
289
309
  trapped: trapFocus,
310
+ branches: branchNodes,
290
311
  onMountAutoFocus: onOpenAutoFocus,
291
312
  onUnmountAutoFocus: onCloseAutoFocus,
292
313
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -310,7 +331,7 @@ var PopoverContentImpl = /* @__PURE__ */ React.forwardRef(
310
331
  "aria-describedby": context.descriptionPresent ? concatAriaDescribedby(ariaDescribedby, context.descriptionId) : ariaDescribedby,
311
332
  ...popperScope,
312
333
  ...contentProps,
313
- ref: forwardedRef,
334
+ ref: composedRefs,
314
335
  style: {
315
336
  ...contentProps.style,
316
337
  // re-namespace exposed content custom properties
@@ -321,7 +342,8 @@ var PopoverContentImpl = /* @__PURE__ */ React.forwardRef(
321
342
  "--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
322
343
  "--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
323
344
  }
324
- }
345
+ },
346
+ children: branchRegistry ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_focus_scope.FocusScopeBranchProvider, { value: branchRegistry, children }) : children
325
347
  }
326
348
  )
327
349
  }
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts", "../src/popover.tsx"],
4
- "sourcesContent": ["'use client';\nexport {\n createPopoverScope,\n //\n Popover,\n PopoverAnchor,\n PopoverTrigger,\n PopoverPortal,\n PopoverContent,\n PopoverTitle,\n PopoverDescription,\n PopoverClose,\n PopoverArrow,\n //\n Root,\n Anchor,\n Trigger,\n Portal,\n Content,\n Title,\n Description,\n Close,\n Arrow,\n} from './popover';\nexport type {\n PopoverProps,\n PopoverAnchorProps,\n PopoverTriggerProps,\n PopoverPortalProps,\n PopoverContentProps,\n PopoverTitleProps,\n PopoverDescriptionProps,\n PopoverCloseProps,\n PopoverArrowProps,\n} from './popover';\n", "import * as React from 'react';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { FocusScope } from '@radix-ui/react-focus-scope';\nimport { useId } from '@radix-ui/react-id';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { createSlot } from '@radix-ui/react-slot';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { hideOthers } from 'aria-hidden';\nimport { RemoveScroll } from 'react-remove-scroll';\n\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Popover\n * -----------------------------------------------------------------------------------------------*/\n\nconst POPOVER_NAME = 'Popover';\n\ntype ScopedProps<P> = P & { __scopePopover?: Scope };\nconst [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [\n createPopperScope,\n]);\nconst usePopperScope = createPopperScope();\n\ninterface PopoverContextValue {\n triggerRef: React.RefObject<HTMLButtonElement | null>;\n contentId: string;\n titleId: string;\n descriptionId: string;\n titlePresent: boolean;\n descriptionPresent: boolean;\n setTitleCount: React.Dispatch<React.SetStateAction<number>>;\n setDescriptionCount: React.Dispatch<React.SetStateAction<number>>;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n hasCustomAnchor: boolean;\n onCustomAnchorAdd(): void;\n onCustomAnchorRemove(): void;\n modal: boolean;\n}\n\nconst [PopoverProvider, usePopoverContext] =\n createPopoverContext<PopoverContextValue>(POPOVER_NAME);\n\ninterface PopoverProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n modal?: boolean;\n}\n\nconst Popover: React.FC<PopoverProps> = (props: ScopedProps<PopoverProps>) => {\n const {\n __scopePopover,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = false,\n } = props;\n const popperScope = usePopperScope(__scopePopover);\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);\n const [titleCount, setTitleCount] = React.useState(0);\n const [descriptionCount, setDescriptionCount] = React.useState(0);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: POPOVER_NAME,\n });\n\n return (\n <PopperPrimitive.Root {...popperScope}>\n <PopoverProvider\n scope={__scopePopover}\n contentId={useId()}\n titleId={useId()}\n descriptionId={useId()}\n titlePresent={titleCount > 0}\n descriptionPresent={descriptionCount > 0}\n setTitleCount={setTitleCount}\n setDescriptionCount={setDescriptionCount}\n triggerRef={triggerRef}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n hasCustomAnchor={hasCustomAnchor}\n onCustomAnchorAdd={React.useCallback(() => setHasCustomAnchor(true), [])}\n onCustomAnchorRemove={React.useCallback(() => setHasCustomAnchor(false), [])}\n modal={modal}\n >\n {children}\n </PopoverProvider>\n </PopperPrimitive.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopoverAnchor';\n\ntype PopoverAnchorElement = React.ComponentRef<typeof PopperPrimitive.Anchor>;\ntype PopperAnchorProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Anchor>;\ninterface PopoverAnchorProps extends PopperAnchorProps {}\n\nconst PopoverAnchor = /* @__PURE__ */ React.forwardRef<PopoverAnchorElement, PopoverAnchorProps>(\n function PopoverAnchor(props: ScopedProps<PopoverAnchorProps>, forwardedRef) {\n const { __scopePopover, ...anchorProps } = props;\n const context = usePopoverContext(ANCHOR_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n const { onCustomAnchorAdd, onCustomAnchorRemove } = context;\n\n React.useEffect(() => {\n onCustomAnchorAdd();\n return () => onCustomAnchorRemove();\n }, [onCustomAnchorAdd, onCustomAnchorRemove]);\n\n return <PopperPrimitive.Anchor {...popperScope} {...anchorProps} ref={forwardedRef} />;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'PopoverTrigger';\n\ntype PopoverTriggerElement = React.ComponentRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface PopoverTriggerProps extends PrimitiveButtonProps {}\n\nconst PopoverTrigger = /* @__PURE__ */ React.forwardRef<PopoverTriggerElement, PopoverTriggerProps>(\n function PopoverTrigger(props: ScopedProps<PopoverTriggerProps>, forwardedRef) {\n const { __scopePopover, ...triggerProps } = props;\n const context = usePopoverContext(TRIGGER_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n\n const trigger = (\n <Primitive.button\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={context.open}\n aria-controls={context.open ? context.contentId : undefined}\n data-state={getState(context.open)}\n {...triggerProps}\n ref={composedTriggerRef}\n onClick={composeEventHandlers(props.onClick, context.onOpenToggle)}\n />\n );\n\n return context.hasCustomAnchor ? (\n trigger\n ) : (\n <PopperPrimitive.Anchor asChild {...popperScope}>\n {trigger}\n </PopperPrimitive.Anchor>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'PopoverPortal';\n\ntype PortalContextValue = { forceMount?: true };\nconst [PortalProvider, usePortalContext] = createPopoverContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;\ninterface PopoverPortalProps {\n children?: React.ReactNode;\n /**\n * Specify a container element to portal the content into.\n */\n container?: PortalProps['container'];\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst PopoverPortal: React.FC<PopoverPortalProps> = (props: ScopedProps<PopoverPortalProps>) => {\n const { __scopePopover, forceMount, children, container } = props;\n const context = usePopoverContext(PORTAL_NAME, __scopePopover);\n return (\n <PortalProvider scope={__scopePopover} forceMount={forceMount}>\n <Presence present={forceMount || context.open}>\n <PortalPrimitive asChild container={container}>\n {children}\n </PortalPrimitive>\n </Presence>\n </PortalProvider>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopoverContent';\n\ninterface PopoverContentProps extends PopoverContentTypeProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst PopoverContent = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentProps\n>(\n // blank line to reduce diff noise\n function PopoverContent(props: ScopedProps<PopoverContentProps>, forwardedRef) {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n return (\n <Presence present={forceMount || context.open}>\n {context.modal ? (\n <PopoverContentModal {...contentProps} ref={forwardedRef} />\n ) : (\n <PopoverContentNonModal {...contentProps} ref={forwardedRef} />\n )}\n </Presence>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Slot = createSlot('PopoverContent.RemoveScroll');\n\ntype PopoverContentTypeElement = PopoverContentImplElement;\ninterface PopoverContentTypeProps extends Omit<\n PopoverContentImplProps,\n 'trapFocus' | 'disableOutsidePointerEvents'\n> {}\n\nconst PopoverContentModal = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentTypeProps\n>(\n // blank line to reduce diff noise\n function PopoverContentModal(props: ScopedProps<PopoverContentTypeProps>, forwardedRef) {\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const isRightClickOutsideRef = React.useRef(false);\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n const content = contentRef.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n <RemoveScroll as={Slot} allowPinchZoom>\n <PopoverContentImpl\n {...props}\n ref={composedRefs}\n // we make sure we're not trapping once it's been closed\n // (closed !== unmounted when animating out)\n trapFocus={context.open}\n disableOutsidePointerEvents\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault();\n if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();\n })}\n onPointerDownOutside={composeEventHandlers(\n props.onPointerDownOutside,\n (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n\n isRightClickOutsideRef.current = isRightClick;\n },\n { checkForDefaultPrevented: false },\n )}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault(),\n { checkForDefaultPrevented: false },\n )}\n />\n </RemoveScroll>\n );\n },\n);\n\nconst PopoverContentNonModal = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentTypeProps\n>(\n // blank line to reduce diff noise\n function PopoverContentNonModal(props: ScopedProps<PopoverContentTypeProps>, forwardedRef) {\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n const hasInteractedOutsideRef = React.useRef(false);\n const hasPointerDownOutsideRef = React.useRef(false);\n\n return (\n <PopoverContentImpl\n {...props}\n ref={forwardedRef}\n trapFocus={false}\n disableOutsidePointerEvents={false}\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n hasPointerDownOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented) {\n hasInteractedOutsideRef.current = true;\n if (event.detail.originalEvent.type === 'pointerdown') {\n hasPointerDownOutsideRef.current = true;\n }\n }\n\n // Prevent dismissing when clicking the trigger.\n // As the trigger is already setup to close, without doing so would\n // cause it to close and immediately open.\n const target = event.target as HTMLElement;\n const targetIsTrigger = context.triggerRef.current?.contains(target);\n if (targetIsTrigger) event.preventDefault();\n\n // On Safari if the trigger is inside a container with tabIndex={0}, when clicked\n // we will get the pointer down outside event on the trigger, but then a subsequent\n // focus outside event on the container, we ignore any focus outside event when we've\n // already had a pointer down outside event.\n if (event.detail.originalEvent.type === 'focusin' && hasPointerDownOutsideRef.current) {\n event.preventDefault();\n }\n }}\n />\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype PopoverContentImplElement = React.ComponentRef<typeof PopperPrimitive.Content>;\ntype FocusScopeProps = React.ComponentPropsWithoutRef<typeof FocusScope>;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype PopperContentProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ninterface PopoverContentImplProps\n extends Omit<PopperContentProps, 'onPlaced'>, Omit<DismissableLayerProps, 'onDismiss'> {\n /**\n * Whether focus should be trapped within the `Popover`\n * (default: false)\n */\n trapFocus?: FocusScopeProps['trapped'];\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];\n}\n\nconst PopoverContentImpl = /* @__PURE__ */ React.forwardRef<\n PopoverContentImplElement,\n PopoverContentImplProps\n>(\n // blank line to reduce diff noise\n function PopoverContentImpl(props: ScopedProps<PopoverContentImplProps>, forwardedRef) {\n const {\n __scopePopover,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n 'aria-describedby': ariaDescribedby,\n ...contentProps\n } = props;\n const context = usePopoverContext(CONTENT_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n\n // Make sure the whole tree has focus guards as our `Popover` may be\n // the last element in the DOM (because of the `Portal`)\n useFocusGuards();\n\n return (\n <FocusScope\n asChild\n loop\n trapped={trapFocus}\n onMountAutoFocus={onOpenAutoFocus}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n <DismissableLayer\n asChild\n disableOutsidePointerEvents={disableOutsidePointerEvents}\n onInteractOutside={onInteractOutside}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={onFocusOutside}\n onDismiss={() => context.onOpenChange(false)}\n deferPointerDownOutside\n >\n <PopperPrimitive.Content\n data-state={getState(context.open)}\n role=\"dialog\"\n id={context.contentId}\n aria-labelledby={context.titlePresent ? context.titleId : undefined}\n aria-describedby={\n context.descriptionPresent\n ? concatAriaDescribedby(ariaDescribedby, context.descriptionId)\n : ariaDescribedby\n }\n {...popperScope}\n {...contentProps}\n ref={forwardedRef}\n style={{\n ...contentProps.style,\n // re-namespace exposed content custom properties\n ...{\n '--radix-popover-content-transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-popover-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-popover-content-available-height': 'var(--radix-popper-available-height)',\n '--radix-popover-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-popover-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n </DismissableLayer>\n </FocusScope>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTitle\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverTitleElement = React.ComponentRef<typeof Primitive.h2>;\ntype PrimitiveHeading2Props = React.ComponentPropsWithoutRef<typeof Primitive.h2>;\ninterface PopoverTitleProps extends PrimitiveHeading2Props {}\n\nconst PopoverTitle = /* @__PURE__ */ React.forwardRef<PopoverTitleElement, PopoverTitleProps>(\n function PopoverTitle(props: ScopedProps<PopoverTitleProps>, forwardedRef) {\n const { __scopePopover, ...titleProps } = props;\n const context = usePopoverContext('PopoverTitle', __scopePopover);\n const { setTitleCount } = context;\n useLayoutEffect(() => {\n setTitleCount((count) => count + 1);\n return () => setTitleCount((count) => count - 1);\n }, [setTitleCount]);\n\n return <Primitive.h2 id={context.titleId} {...titleProps} ref={forwardedRef} />;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverDescription\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverDescriptionElement = React.ComponentRef<typeof Primitive.p>;\ntype PrimitiveParagraphProps = React.ComponentPropsWithoutRef<typeof Primitive.p>;\ninterface PopoverDescriptionProps extends PrimitiveParagraphProps {}\n\nconst PopoverDescription = /* @__PURE__ */ React.forwardRef<\n PopoverDescriptionElement,\n PopoverDescriptionProps\n>(function PopoverDescription(props: ScopedProps<PopoverDescriptionProps>, forwardedRef) {\n const { __scopePopover, ...descriptionProps } = props;\n const context = usePopoverContext('PopoverDescription', __scopePopover);\n const { setDescriptionCount } = context;\n useLayoutEffect(() => {\n setDescriptionCount((count) => count + 1);\n return () => setDescriptionCount((count) => count - 1);\n }, [setDescriptionCount]);\n\n return <Primitive.p id={context.descriptionId} {...descriptionProps} ref={forwardedRef} />;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'PopoverClose';\n\ntype PopoverCloseElement = React.ComponentRef<typeof Primitive.button>;\ninterface PopoverCloseProps extends PrimitiveButtonProps {}\n\nconst PopoverClose = /* @__PURE__ */ React.forwardRef<PopoverCloseElement, PopoverCloseProps>(\n function PopoverClose(props: ScopedProps<PopoverCloseProps>, forwardedRef) {\n const { __scopePopover, ...closeProps } = props;\n const context = usePopoverContext(CLOSE_NAME, __scopePopover);\n return (\n <Primitive.button\n type=\"button\"\n {...closeProps}\n ref={forwardedRef}\n onClick={composeEventHandlers(props.onClick, () => context.onOpenChange(false))}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverArrow\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverArrowElement = React.ComponentRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;\ninterface PopoverArrowProps extends PopperArrowProps {}\n\nconst PopoverArrow = /* @__PURE__ */ React.forwardRef<PopoverArrowElement, PopoverArrowProps>(\n function PopoverArrow(props: ScopedProps<PopoverArrowProps>, forwardedRef) {\n const { __scopePopover, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopePopover);\n return <PopperPrimitive.Arrow {...popperScope} {...arrowProps} ref={forwardedRef} />;\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\n// TODO: Move to primitive once that package exposed individual sub-modules\nfunction concatAriaDescribedby(...values: unknown[]): string | undefined {\n const ids = new Set<string>();\n for (const value of values) {\n if (typeof value !== 'string') continue;\n for (const id of String(value).trim().split(/\\s+/)) {\n if (id) ids.add(id);\n }\n }\n\n return ids.size > 0 ? Array.from(ids).join(' ') : undefined;\n}\n\nexport {\n createPopoverScope,\n //\n Popover,\n PopoverAnchor,\n PopoverTrigger,\n PopoverPortal,\n PopoverContent,\n PopoverTitle,\n PopoverDescription,\n PopoverClose,\n PopoverArrow,\n //\n Popover as Root,\n PopoverAnchor as Anchor,\n PopoverTrigger as Trigger,\n PopoverPortal as Portal,\n PopoverContent as Content,\n PopoverTitle as Title,\n PopoverDescription as Description,\n PopoverClose as Close,\n PopoverArrow as Arrow,\n};\nexport type {\n PopoverProps,\n PopoverAnchorProps,\n PopoverTriggerProps,\n PopoverPortalProps,\n PopoverContentProps,\n PopoverTitleProps,\n PopoverDescriptionProps,\n PopoverCloseProps,\n PopoverArrowProps,\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,qCAAgC;AAChC,uBAAqC;AACrC,gCAAgC;AAChC,2BAAmC;AACnC,qCAAiC;AACjC,gCAA+B;AAC/B,+BAA2B;AAC3B,sBAAsB;AACtB,sBAAiC;AACjC,0BAAkC;AAClC,0BAA0C;AAC1C,4BAAyB;AACzB,6BAA0B;AAC1B,wBAA2B;AAC3B,0CAAqC;AACrC,yBAA2B;AAC3B,iCAA6B;AAoEvB;AA5DN,IAAM,eAAe;AAGrB,IAAM,CAAC,sBAAsB,kBAAkB,QAAI,yCAAmB,cAAc;AAAA,EAClF;AACF,CAAC;AACD,IAAM,qBAAiB,uCAAkB;AAoBzC,IAAM,CAAC,iBAAiB,iBAAiB,IACvC,qBAA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AAA,QACC,MAAK;AAAA,QACJ,GAAG;AAAA,QACJ,KAAK;AAAA,QACL,aAAS,uCAAqB,MAAM,SAAS,MAAM,QAAQ,aAAa,KAAK,CAAC;AAAA;AAAA,IAChF;AAAA,EAEJ,GAXA;AAYF;AAUA,IAAM,eAA+B,gBAAM;AAAA,EACzC,gCAASC,cAAa,OAAuC,cAAc;AACzE,UAAM,EAAE,gBAAgB,GAAG,WAAW,IAAI;AAC1C,UAAM,cAAc,eAAe,cAAc;AACjD,WAAO,4CAAiB,uBAAhB,EAAuB,GAAG,aAAc,GAAG,YAAY,KAAK,cAAc;AAAA,EACpF,GAJA;AAKF;AAIA,SAAS,SAAS,MAAe;AAC/B,SAAO,OAAO,SAAS;AACzB;AAFS;AAKT,SAAS,yBAAyB,QAAuC;AACvE,QAAM,MAAM,oBAAI,IAAY;AAC5B,aAAW,SAAS,QAAQ;AAC1B,QAAI,OAAO,UAAU,SAAU;AAC/B,eAAW,MAAM,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG;AAClD,UAAI,GAAI,KAAI,IAAI,EAAE;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,IAAI,OAAO,IAAI,MAAM,KAAK,GAAG,EAAE,KAAK,GAAG,IAAI;AACpD;AAVS;",
4
+ "sourcesContent": ["'use client';\nexport {\n createPopoverScope,\n //\n Popover,\n PopoverAnchor,\n PopoverTrigger,\n PopoverPortal,\n PopoverContent,\n PopoverTitle,\n PopoverDescription,\n PopoverClose,\n PopoverArrow,\n //\n Root,\n Anchor,\n Trigger,\n Portal,\n Content,\n Title,\n Description,\n Close,\n Arrow,\n} from './popover';\nexport type {\n PopoverProps,\n PopoverAnchorProps,\n PopoverTriggerProps,\n PopoverPortalProps,\n PopoverContentProps,\n PopoverTitleProps,\n PopoverDescriptionProps,\n PopoverCloseProps,\n PopoverArrowProps,\n} from './popover';\n", "import * as React from 'react';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport {\n FocusScope,\n FocusScopeBranchProvider,\n useFocusScopeBranch,\n useFocusScopeBranchRegistry,\n} from '@radix-ui/react-focus-scope';\nimport type { FocusScopeBranchRegistry } from '@radix-ui/react-focus-scope';\nimport { useId } from '@radix-ui/react-id';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { createSlot } from '@radix-ui/react-slot';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { hideOthers } from 'aria-hidden';\nimport { RemoveScroll } from 'react-remove-scroll';\n\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Popover\n * -----------------------------------------------------------------------------------------------*/\n\nconst POPOVER_NAME = 'Popover';\n\ntype ScopedProps<P> = P & { __scopePopover?: Scope };\nconst [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [\n createPopperScope,\n]);\nconst usePopperScope = createPopperScope();\n\ninterface PopoverContextValue {\n triggerRef: React.RefObject<HTMLButtonElement | null>;\n contentId: string;\n titleId: string;\n descriptionId: string;\n titlePresent: boolean;\n descriptionPresent: boolean;\n setTitleCount: React.Dispatch<React.SetStateAction<number>>;\n setDescriptionCount: React.Dispatch<React.SetStateAction<number>>;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n hasCustomAnchor: boolean;\n onCustomAnchorAdd(): void;\n onCustomAnchorRemove(): void;\n modal: boolean;\n}\n\nconst [PopoverProvider, usePopoverContext] =\n createPopoverContext<PopoverContextValue>(POPOVER_NAME);\n\ninterface PopoverProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n modal?: boolean;\n}\n\nconst Popover: React.FC<PopoverProps> = (props: ScopedProps<PopoverProps>) => {\n const {\n __scopePopover,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = false,\n } = props;\n const popperScope = usePopperScope(__scopePopover);\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);\n const [titleCount, setTitleCount] = React.useState(0);\n const [descriptionCount, setDescriptionCount] = React.useState(0);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: POPOVER_NAME,\n });\n\n return (\n <PopperPrimitive.Root {...popperScope}>\n <PopoverProvider\n scope={__scopePopover}\n contentId={useId()}\n titleId={useId()}\n descriptionId={useId()}\n titlePresent={titleCount > 0}\n descriptionPresent={descriptionCount > 0}\n setTitleCount={setTitleCount}\n setDescriptionCount={setDescriptionCount}\n triggerRef={triggerRef}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n hasCustomAnchor={hasCustomAnchor}\n onCustomAnchorAdd={React.useCallback(() => setHasCustomAnchor(true), [])}\n onCustomAnchorRemove={React.useCallback(() => setHasCustomAnchor(false), [])}\n modal={modal}\n >\n {children}\n </PopoverProvider>\n </PopperPrimitive.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopoverAnchor';\n\ntype PopoverAnchorElement = React.ComponentRef<typeof PopperPrimitive.Anchor>;\ntype PopperAnchorProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Anchor>;\ninterface PopoverAnchorProps extends PopperAnchorProps {}\n\nconst PopoverAnchor = /* @__PURE__ */ React.forwardRef<PopoverAnchorElement, PopoverAnchorProps>(\n function PopoverAnchor(props: ScopedProps<PopoverAnchorProps>, forwardedRef) {\n const { __scopePopover, ...anchorProps } = props;\n const context = usePopoverContext(ANCHOR_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n const { onCustomAnchorAdd, onCustomAnchorRemove } = context;\n\n React.useEffect(() => {\n onCustomAnchorAdd();\n return () => onCustomAnchorRemove();\n }, [onCustomAnchorAdd, onCustomAnchorRemove]);\n\n return <PopperPrimitive.Anchor {...popperScope} {...anchorProps} ref={forwardedRef} />;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'PopoverTrigger';\n\ntype PopoverTriggerElement = React.ComponentRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface PopoverTriggerProps extends PrimitiveButtonProps {}\n\nconst PopoverTrigger = /* @__PURE__ */ React.forwardRef<PopoverTriggerElement, PopoverTriggerProps>(\n function PopoverTrigger(props: ScopedProps<PopoverTriggerProps>, forwardedRef) {\n const { __scopePopover, ...triggerProps } = props;\n const context = usePopoverContext(TRIGGER_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n\n const trigger = (\n <Primitive.button\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={context.open}\n aria-controls={context.open ? context.contentId : undefined}\n data-state={getState(context.open)}\n {...triggerProps}\n ref={composedTriggerRef}\n onClick={composeEventHandlers(props.onClick, context.onOpenToggle)}\n />\n );\n\n return context.hasCustomAnchor ? (\n trigger\n ) : (\n <PopperPrimitive.Anchor asChild {...popperScope}>\n {trigger}\n </PopperPrimitive.Anchor>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'PopoverPortal';\n\ntype PortalContextValue = { forceMount?: true };\nconst [PortalProvider, usePortalContext] = createPopoverContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;\ninterface PopoverPortalProps {\n children?: React.ReactNode;\n /**\n * Specify a container element to portal the content into.\n */\n container?: PortalProps['container'];\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst PopoverPortal: React.FC<PopoverPortalProps> = (props: ScopedProps<PopoverPortalProps>) => {\n const { __scopePopover, forceMount, children, container } = props;\n const context = usePopoverContext(PORTAL_NAME, __scopePopover);\n return (\n <PortalProvider scope={__scopePopover} forceMount={forceMount}>\n <Presence present={forceMount || context.open}>\n <PortalPrimitive asChild container={container}>\n {children}\n </PortalPrimitive>\n </Presence>\n </PortalProvider>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopoverContent';\n\ninterface PopoverContentProps extends PopoverContentTypeProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst PopoverContent = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentProps\n>(\n // blank line to reduce diff noise\n function PopoverContent(props: ScopedProps<PopoverContentProps>, forwardedRef) {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n return (\n <Presence present={forceMount || context.open}>\n {context.modal ? (\n <PopoverContentModal {...contentProps} ref={forwardedRef} />\n ) : (\n <PopoverContentNonModal {...contentProps} ref={forwardedRef} />\n )}\n </Presence>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Slot = createSlot('PopoverContent.RemoveScroll');\n\ntype PopoverContentTypeElement = PopoverContentImplElement;\ninterface PopoverContentTypeProps extends Omit<\n PopoverContentImplProps,\n 'trapFocus' | 'disableOutsidePointerEvents' | 'branchRegistry' | 'branchNodes'\n> {}\n\nconst PopoverContentModal = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentTypeProps\n>(\n // blank line to reduce diff noise\n function PopoverContentModal(props: ScopedProps<PopoverContentTypeProps>, forwardedRef) {\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const isRightClickOutsideRef = React.useRef(false);\n\n // Allows nested portalled layers to register themselves as branches of this\n // modal `Popover` so focus isn't reclaimed and scroll isn't locked for\n // them. See: https://github.com/radix-ui/primitives/issues/3423\n const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry();\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n const content = contentRef.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n <RemoveScroll\n as={Slot}\n allowPinchZoom\n shards={React.useMemo(\n () => [contentRef, ...branchNodes.map((node) => ({ current: node }))],\n [contentRef, branchNodes],\n )}\n >\n <PopoverContentImpl\n {...props}\n ref={composedRefs}\n branchNodes={branchNodes}\n branchRegistry={branchRegistry}\n // we make sure we're not trapping once it's been closed\n // (closed !== unmounted when animating out)\n trapFocus={context.open}\n disableOutsidePointerEvents\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault();\n if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();\n })}\n onPointerDownOutside={composeEventHandlers(\n props.onPointerDownOutside,\n (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n\n isRightClickOutsideRef.current = isRightClick;\n },\n { checkForDefaultPrevented: false },\n )}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault(),\n { checkForDefaultPrevented: false },\n )}\n />\n </RemoveScroll>\n );\n },\n);\n\nconst PopoverContentNonModal = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentTypeProps\n>(\n // blank line to reduce diff noise\n function PopoverContentNonModal(props: ScopedProps<PopoverContentTypeProps>, forwardedRef) {\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n const hasInteractedOutsideRef = React.useRef(false);\n const hasPointerDownOutsideRef = React.useRef(false);\n\n return (\n <PopoverContentImpl\n {...props}\n ref={forwardedRef}\n trapFocus={false}\n disableOutsidePointerEvents={false}\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n hasPointerDownOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented) {\n hasInteractedOutsideRef.current = true;\n if (event.detail.originalEvent.type === 'pointerdown') {\n hasPointerDownOutsideRef.current = true;\n }\n }\n\n // Prevent dismissing when clicking the trigger.\n // As the trigger is already setup to close, without doing so would\n // cause it to close and immediately open.\n const target = event.target as HTMLElement;\n const targetIsTrigger = context.triggerRef.current?.contains(target);\n if (targetIsTrigger) event.preventDefault();\n\n // On Safari if the trigger is inside a container with tabIndex={0}, when clicked\n // we will get the pointer down outside event on the trigger, but then a subsequent\n // focus outside event on the container, we ignore any focus outside event when we've\n // already had a pointer down outside event.\n if (event.detail.originalEvent.type === 'focusin' && hasPointerDownOutsideRef.current) {\n event.preventDefault();\n }\n }}\n />\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype PopoverContentImplElement = React.ComponentRef<typeof PopperPrimitive.Content>;\ntype FocusScopeProps = React.ComponentPropsWithoutRef<typeof FocusScope>;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype PopperContentProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ninterface PopoverContentImplProps\n extends Omit<PopperContentProps, 'onPlaced'>, Omit<DismissableLayerProps, 'onDismiss'> {\n /**\n * Whether focus should be trapped within the `Popover`\n * (default: false)\n */\n trapFocus?: FocusScopeProps['trapped'];\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];\n\n /**\n * Branch nodes registered by nested, portalled layers. Passed to the trapped\n * `FocusScope` so focus isn't reclaimed from them. Only provided by the modal\n * variant.\n * @internal\n */\n branchNodes?: HTMLElement[];\n\n /**\n * Registry that nested, portalled layers use to register themselves as branches of this modal\n * `Popover`. Only provided by the modal variant.\n * @internal\n */\n branchRegistry?: FocusScopeBranchRegistry;\n}\n\nconst PopoverContentImpl = /* @__PURE__ */ React.forwardRef<\n PopoverContentImplElement,\n PopoverContentImplProps\n>(\n // blank line to reduce diff noise\n function PopoverContentImpl(props: ScopedProps<PopoverContentImplProps>, forwardedRef) {\n const {\n __scopePopover,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n 'aria-describedby': ariaDescribedby,\n branchNodes,\n branchRegistry,\n children,\n ...contentProps\n } = props;\n const context = usePopoverContext(CONTENT_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n\n // When this `Popover` is nested inside a modal layer (eg. a `Dialog`) but\n // portalled outside of it, register its content with the ancestor layer so\n // focus isn't reclaimed and scroll isn't locked for it. No-ops when there\n // is no ancestor layer. See:\n // https://github.com/radix-ui/primitives/issues/3423\n const [contentNode, setContentNode] = React.useState<PopoverContentImplElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, setContentNode);\n useFocusScopeBranch(contentNode);\n\n // Make sure the whole tree has focus guards as our `Popover` may be\n // the last element in the DOM (because of the `Portal`)\n useFocusGuards();\n\n return (\n <FocusScope\n asChild\n loop\n trapped={trapFocus}\n branches={branchNodes}\n onMountAutoFocus={onOpenAutoFocus}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n <DismissableLayer\n asChild\n disableOutsidePointerEvents={disableOutsidePointerEvents}\n onInteractOutside={onInteractOutside}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={onFocusOutside}\n onDismiss={() => context.onOpenChange(false)}\n deferPointerDownOutside\n >\n <PopperPrimitive.Content\n data-state={getState(context.open)}\n role=\"dialog\"\n id={context.contentId}\n aria-labelledby={context.titlePresent ? context.titleId : undefined}\n aria-describedby={\n context.descriptionPresent\n ? concatAriaDescribedby(ariaDescribedby, context.descriptionId)\n : ariaDescribedby\n }\n {...popperScope}\n {...contentProps}\n ref={composedRefs}\n style={{\n ...contentProps.style,\n // re-namespace exposed content custom properties\n ...{\n '--radix-popover-content-transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-popover-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-popover-content-available-height': 'var(--radix-popper-available-height)',\n '--radix-popover-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-popover-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n >\n {branchRegistry ? (\n <FocusScopeBranchProvider value={branchRegistry}>{children}</FocusScopeBranchProvider>\n ) : (\n children\n )}\n </PopperPrimitive.Content>\n </DismissableLayer>\n </FocusScope>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTitle\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverTitleElement = React.ComponentRef<typeof Primitive.h2>;\ntype PrimitiveHeading2Props = React.ComponentPropsWithoutRef<typeof Primitive.h2>;\ninterface PopoverTitleProps extends PrimitiveHeading2Props {}\n\nconst PopoverTitle = /* @__PURE__ */ React.forwardRef<PopoverTitleElement, PopoverTitleProps>(\n function PopoverTitle(props: ScopedProps<PopoverTitleProps>, forwardedRef) {\n const { __scopePopover, ...titleProps } = props;\n const context = usePopoverContext('PopoverTitle', __scopePopover);\n const { setTitleCount } = context;\n useLayoutEffect(() => {\n setTitleCount((count) => count + 1);\n return () => setTitleCount((count) => count - 1);\n }, [setTitleCount]);\n\n return <Primitive.h2 id={context.titleId} {...titleProps} ref={forwardedRef} />;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverDescription\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverDescriptionElement = React.ComponentRef<typeof Primitive.p>;\ntype PrimitiveParagraphProps = React.ComponentPropsWithoutRef<typeof Primitive.p>;\ninterface PopoverDescriptionProps extends PrimitiveParagraphProps {}\n\nconst PopoverDescription = /* @__PURE__ */ React.forwardRef<\n PopoverDescriptionElement,\n PopoverDescriptionProps\n>(function PopoverDescription(props: ScopedProps<PopoverDescriptionProps>, forwardedRef) {\n const { __scopePopover, ...descriptionProps } = props;\n const context = usePopoverContext('PopoverDescription', __scopePopover);\n const { setDescriptionCount } = context;\n useLayoutEffect(() => {\n setDescriptionCount((count) => count + 1);\n return () => setDescriptionCount((count) => count - 1);\n }, [setDescriptionCount]);\n\n return <Primitive.p id={context.descriptionId} {...descriptionProps} ref={forwardedRef} />;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'PopoverClose';\n\ntype PopoverCloseElement = React.ComponentRef<typeof Primitive.button>;\ninterface PopoverCloseProps extends PrimitiveButtonProps {}\n\nconst PopoverClose = /* @__PURE__ */ React.forwardRef<PopoverCloseElement, PopoverCloseProps>(\n function PopoverClose(props: ScopedProps<PopoverCloseProps>, forwardedRef) {\n const { __scopePopover, ...closeProps } = props;\n const context = usePopoverContext(CLOSE_NAME, __scopePopover);\n return (\n <Primitive.button\n type=\"button\"\n {...closeProps}\n ref={forwardedRef}\n onClick={composeEventHandlers(props.onClick, () => context.onOpenChange(false))}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverArrow\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverArrowElement = React.ComponentRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;\ninterface PopoverArrowProps extends PopperArrowProps {}\n\nconst PopoverArrow = /* @__PURE__ */ React.forwardRef<PopoverArrowElement, PopoverArrowProps>(\n function PopoverArrow(props: ScopedProps<PopoverArrowProps>, forwardedRef) {\n const { __scopePopover, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopePopover);\n return <PopperPrimitive.Arrow {...popperScope} {...arrowProps} ref={forwardedRef} />;\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\n// TODO: Move to primitive once that package exposed individual sub-modules\nfunction concatAriaDescribedby(...values: unknown[]): string | undefined {\n const ids = new Set<string>();\n for (const value of values) {\n if (typeof value !== 'string') continue;\n for (const id of String(value).trim().split(/\\s+/)) {\n if (id) ids.add(id);\n }\n }\n\n return ids.size > 0 ? Array.from(ids).join(' ') : undefined;\n}\n\nexport {\n createPopoverScope,\n //\n Popover,\n PopoverAnchor,\n PopoverTrigger,\n PopoverPortal,\n PopoverContent,\n PopoverTitle,\n PopoverDescription,\n PopoverClose,\n PopoverArrow,\n //\n Popover as Root,\n PopoverAnchor as Anchor,\n PopoverTrigger as Trigger,\n PopoverPortal as Portal,\n PopoverContent as Content,\n PopoverTitle as Title,\n PopoverDescription as Description,\n PopoverClose as Close,\n PopoverArrow as Arrow,\n};\nexport type {\n PopoverProps,\n PopoverAnchorProps,\n PopoverTriggerProps,\n PopoverPortal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AK;AAAA,QACJ,GAAG;AAAA,QACJ,KAAK;AAAA,QACL,aAAS,uCAAqB,MAAM,SAAS,MAAM,QAAQ,aAAa,KAAK,CAAC;AAAA;AAAA,IAChF;AAAA,EAEJ,GAXA;AAYF;AAUA,IAAM,eAA+B,gBAAM;AAAA,EACzC,gCAASC,cAAa,OAAuC,cAAc;AACzE,UAAM,EAAE,gBAAgB,GAAG,WAAW,IAAI;AAC1C,UAAM,cAAc,eAAe,cAAc;AACjD,WAAO,4CAAiB,uBAAhB,EAAuB,GAAG,aAAc,GAAG,YAAY,KAAK,cAAc;AAAA,EACpF,GAJA;AAKF;AAIA,SAAS,SAAS,MAAe;AAC/B,SAAO,OAAO,SAAS;AACzB;AAFS;AAKT,SAAS,yBAAyB,QAAuC;AACvE,QAAM,MAAM,oBAAI,IAAY;AAC5B,aAAW,SAAS,QAAQ;AAC1B,QAAI,OAAO,UAAU,SAAU;AAC/B,eAAW,MAAM,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG;AAClD,UAAI,GAAI,KAAI,IAAI,EAAE;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,IAAI,OAAO,IAAI,MAAM,KAAK,GAAG,EAAE,KAAK,GAAG,IAAI;AACpD;AAVS;",
6
6
  "names": ["PopoverAnchor", "PopoverTrigger", "PortalPrimitive", "PopoverContent", "PopoverContentModal", "PopoverContentNonModal", "PopoverContentImpl", "PopoverTitle", "PopoverDescription", "PopoverClose", "PopoverArrow"]
7
7
  }
package/dist/index.mjs CHANGED
@@ -10,7 +10,12 @@ import { useComposedRefs } from "@radix-ui/react-compose-refs";
10
10
  import { createContextScope } from "@radix-ui/react-context";
11
11
  import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
12
12
  import { useFocusGuards } from "@radix-ui/react-focus-guards";
13
- import { FocusScope } from "@radix-ui/react-focus-scope";
13
+ import {
14
+ FocusScope,
15
+ FocusScopeBranchProvider,
16
+ useFocusScopeBranch,
17
+ useFocusScopeBranchRegistry
18
+ } from "@radix-ui/react-focus-scope";
14
19
  import { useId } from "@radix-ui/react-id";
15
20
  import * as PopperPrimitive from "@radix-ui/react-popper";
16
21
  import { createPopperScope } from "@radix-ui/react-popper";
@@ -135,38 +140,52 @@ var PopoverContentModal = /* @__PURE__ */ React.forwardRef(
135
140
  const contentRef = React.useRef(null);
136
141
  const composedRefs = useComposedRefs(forwardedRef, contentRef);
137
142
  const isRightClickOutsideRef = React.useRef(false);
143
+ const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry();
138
144
  React.useEffect(() => {
139
145
  const content = contentRef.current;
140
146
  if (content) return hideOthers(content);
141
147
  }, []);
142
- return /* @__PURE__ */ jsx(RemoveScroll, { as: Slot, allowPinchZoom: true, children: /* @__PURE__ */ jsx(
143
- PopoverContentImpl,
148
+ return /* @__PURE__ */ jsx(
149
+ RemoveScroll,
144
150
  {
145
- ...props,
146
- ref: composedRefs,
147
- trapFocus: context.open,
148
- disableOutsidePointerEvents: true,
149
- onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
150
- event.preventDefault();
151
- if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();
152
- }),
153
- onPointerDownOutside: composeEventHandlers(
154
- props.onPointerDownOutside,
155
- (event) => {
156
- const originalEvent = event.detail.originalEvent;
157
- const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
158
- const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
159
- isRightClickOutsideRef.current = isRightClick;
160
- },
161
- { checkForDefaultPrevented: false }
151
+ as: Slot,
152
+ allowPinchZoom: true,
153
+ shards: React.useMemo(
154
+ () => [contentRef, ...branchNodes.map((node) => ({ current: node }))],
155
+ [contentRef, branchNodes]
162
156
  ),
163
- onFocusOutside: composeEventHandlers(
164
- props.onFocusOutside,
165
- (event) => event.preventDefault(),
166
- { checkForDefaultPrevented: false }
157
+ children: /* @__PURE__ */ jsx(
158
+ PopoverContentImpl,
159
+ {
160
+ ...props,
161
+ ref: composedRefs,
162
+ branchNodes,
163
+ branchRegistry,
164
+ trapFocus: context.open,
165
+ disableOutsidePointerEvents: true,
166
+ onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
167
+ event.preventDefault();
168
+ if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();
169
+ }),
170
+ onPointerDownOutside: composeEventHandlers(
171
+ props.onPointerDownOutside,
172
+ (event) => {
173
+ const originalEvent = event.detail.originalEvent;
174
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
175
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
176
+ isRightClickOutsideRef.current = isRightClick;
177
+ },
178
+ { checkForDefaultPrevented: false }
179
+ ),
180
+ onFocusOutside: composeEventHandlers(
181
+ props.onFocusOutside,
182
+ (event) => event.preventDefault(),
183
+ { checkForDefaultPrevented: false }
184
+ )
185
+ }
167
186
  )
168
187
  }
169
- ) });
188
+ );
170
189
  }, "PopoverContentModal")
171
190
  );
172
191
  var PopoverContentNonModal = /* @__PURE__ */ React.forwardRef(
@@ -224,10 +243,16 @@ var PopoverContentImpl = /* @__PURE__ */ React.forwardRef(
224
243
  onFocusOutside,
225
244
  onInteractOutside,
226
245
  "aria-describedby": ariaDescribedby,
246
+ branchNodes,
247
+ branchRegistry,
248
+ children,
227
249
  ...contentProps
228
250
  } = props;
229
251
  const context = usePopoverContext(CONTENT_NAME, __scopePopover);
230
252
  const popperScope = usePopperScope(__scopePopover);
253
+ const [contentNode, setContentNode] = React.useState(null);
254
+ const composedRefs = useComposedRefs(forwardedRef, setContentNode);
255
+ useFocusScopeBranch(contentNode);
231
256
  useFocusGuards();
232
257
  return /* @__PURE__ */ jsx(
233
258
  FocusScope,
@@ -235,6 +260,7 @@ var PopoverContentImpl = /* @__PURE__ */ React.forwardRef(
235
260
  asChild: true,
236
261
  loop: true,
237
262
  trapped: trapFocus,
263
+ branches: branchNodes,
238
264
  onMountAutoFocus: onOpenAutoFocus,
239
265
  onUnmountAutoFocus: onCloseAutoFocus,
240
266
  children: /* @__PURE__ */ jsx(
@@ -258,7 +284,7 @@ var PopoverContentImpl = /* @__PURE__ */ React.forwardRef(
258
284
  "aria-describedby": context.descriptionPresent ? concatAriaDescribedby(ariaDescribedby, context.descriptionId) : ariaDescribedby,
259
285
  ...popperScope,
260
286
  ...contentProps,
261
- ref: forwardedRef,
287
+ ref: composedRefs,
262
288
  style: {
263
289
  ...contentProps.style,
264
290
  // re-namespace exposed content custom properties
@@ -269,7 +295,8 @@ var PopoverContentImpl = /* @__PURE__ */ React.forwardRef(
269
295
  "--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
270
296
  "--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
271
297
  }
272
- }
298
+ },
299
+ children: branchRegistry ? /* @__PURE__ */ jsx(FocusScopeBranchProvider, { value: branchRegistry, children }) : children
273
300
  }
274
301
  )
275
302
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/popover.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { FocusScope } from '@radix-ui/react-focus-scope';\nimport { useId } from '@radix-ui/react-id';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { createSlot } from '@radix-ui/react-slot';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { hideOthers } from 'aria-hidden';\nimport { RemoveScroll } from 'react-remove-scroll';\n\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Popover\n * -----------------------------------------------------------------------------------------------*/\n\nconst POPOVER_NAME = 'Popover';\n\ntype ScopedProps<P> = P & { __scopePopover?: Scope };\nconst [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [\n createPopperScope,\n]);\nconst usePopperScope = createPopperScope();\n\ninterface PopoverContextValue {\n triggerRef: React.RefObject<HTMLButtonElement | null>;\n contentId: string;\n titleId: string;\n descriptionId: string;\n titlePresent: boolean;\n descriptionPresent: boolean;\n setTitleCount: React.Dispatch<React.SetStateAction<number>>;\n setDescriptionCount: React.Dispatch<React.SetStateAction<number>>;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n hasCustomAnchor: boolean;\n onCustomAnchorAdd(): void;\n onCustomAnchorRemove(): void;\n modal: boolean;\n}\n\nconst [PopoverProvider, usePopoverContext] =\n createPopoverContext<PopoverContextValue>(POPOVER_NAME);\n\ninterface PopoverProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n modal?: boolean;\n}\n\nconst Popover: React.FC<PopoverProps> = (props: ScopedProps<PopoverProps>) => {\n const {\n __scopePopover,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = false,\n } = props;\n const popperScope = usePopperScope(__scopePopover);\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);\n const [titleCount, setTitleCount] = React.useState(0);\n const [descriptionCount, setDescriptionCount] = React.useState(0);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: POPOVER_NAME,\n });\n\n return (\n <PopperPrimitive.Root {...popperScope}>\n <PopoverProvider\n scope={__scopePopover}\n contentId={useId()}\n titleId={useId()}\n descriptionId={useId()}\n titlePresent={titleCount > 0}\n descriptionPresent={descriptionCount > 0}\n setTitleCount={setTitleCount}\n setDescriptionCount={setDescriptionCount}\n triggerRef={triggerRef}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n hasCustomAnchor={hasCustomAnchor}\n onCustomAnchorAdd={React.useCallback(() => setHasCustomAnchor(true), [])}\n onCustomAnchorRemove={React.useCallback(() => setHasCustomAnchor(false), [])}\n modal={modal}\n >\n {children}\n </PopoverProvider>\n </PopperPrimitive.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopoverAnchor';\n\ntype PopoverAnchorElement = React.ComponentRef<typeof PopperPrimitive.Anchor>;\ntype PopperAnchorProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Anchor>;\ninterface PopoverAnchorProps extends PopperAnchorProps {}\n\nconst PopoverAnchor = /* @__PURE__ */ React.forwardRef<PopoverAnchorElement, PopoverAnchorProps>(\n function PopoverAnchor(props: ScopedProps<PopoverAnchorProps>, forwardedRef) {\n const { __scopePopover, ...anchorProps } = props;\n const context = usePopoverContext(ANCHOR_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n const { onCustomAnchorAdd, onCustomAnchorRemove } = context;\n\n React.useEffect(() => {\n onCustomAnchorAdd();\n return () => onCustomAnchorRemove();\n }, [onCustomAnchorAdd, onCustomAnchorRemove]);\n\n return <PopperPrimitive.Anchor {...popperScope} {...anchorProps} ref={forwardedRef} />;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'PopoverTrigger';\n\ntype PopoverTriggerElement = React.ComponentRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface PopoverTriggerProps extends PrimitiveButtonProps {}\n\nconst PopoverTrigger = /* @__PURE__ */ React.forwardRef<PopoverTriggerElement, PopoverTriggerProps>(\n function PopoverTrigger(props: ScopedProps<PopoverTriggerProps>, forwardedRef) {\n const { __scopePopover, ...triggerProps } = props;\n const context = usePopoverContext(TRIGGER_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n\n const trigger = (\n <Primitive.button\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={context.open}\n aria-controls={context.open ? context.contentId : undefined}\n data-state={getState(context.open)}\n {...triggerProps}\n ref={composedTriggerRef}\n onClick={composeEventHandlers(props.onClick, context.onOpenToggle)}\n />\n );\n\n return context.hasCustomAnchor ? (\n trigger\n ) : (\n <PopperPrimitive.Anchor asChild {...popperScope}>\n {trigger}\n </PopperPrimitive.Anchor>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'PopoverPortal';\n\ntype PortalContextValue = { forceMount?: true };\nconst [PortalProvider, usePortalContext] = createPopoverContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;\ninterface PopoverPortalProps {\n children?: React.ReactNode;\n /**\n * Specify a container element to portal the content into.\n */\n container?: PortalProps['container'];\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst PopoverPortal: React.FC<PopoverPortalProps> = (props: ScopedProps<PopoverPortalProps>) => {\n const { __scopePopover, forceMount, children, container } = props;\n const context = usePopoverContext(PORTAL_NAME, __scopePopover);\n return (\n <PortalProvider scope={__scopePopover} forceMount={forceMount}>\n <Presence present={forceMount || context.open}>\n <PortalPrimitive asChild container={container}>\n {children}\n </PortalPrimitive>\n </Presence>\n </PortalProvider>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopoverContent';\n\ninterface PopoverContentProps extends PopoverContentTypeProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst PopoverContent = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentProps\n>(\n // blank line to reduce diff noise\n function PopoverContent(props: ScopedProps<PopoverContentProps>, forwardedRef) {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n return (\n <Presence present={forceMount || context.open}>\n {context.modal ? (\n <PopoverContentModal {...contentProps} ref={forwardedRef} />\n ) : (\n <PopoverContentNonModal {...contentProps} ref={forwardedRef} />\n )}\n </Presence>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Slot = createSlot('PopoverContent.RemoveScroll');\n\ntype PopoverContentTypeElement = PopoverContentImplElement;\ninterface PopoverContentTypeProps extends Omit<\n PopoverContentImplProps,\n 'trapFocus' | 'disableOutsidePointerEvents'\n> {}\n\nconst PopoverContentModal = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentTypeProps\n>(\n // blank line to reduce diff noise\n function PopoverContentModal(props: ScopedProps<PopoverContentTypeProps>, forwardedRef) {\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const isRightClickOutsideRef = React.useRef(false);\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n const content = contentRef.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n <RemoveScroll as={Slot} allowPinchZoom>\n <PopoverContentImpl\n {...props}\n ref={composedRefs}\n // we make sure we're not trapping once it's been closed\n // (closed !== unmounted when animating out)\n trapFocus={context.open}\n disableOutsidePointerEvents\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault();\n if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();\n })}\n onPointerDownOutside={composeEventHandlers(\n props.onPointerDownOutside,\n (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n\n isRightClickOutsideRef.current = isRightClick;\n },\n { checkForDefaultPrevented: false },\n )}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault(),\n { checkForDefaultPrevented: false },\n )}\n />\n </RemoveScroll>\n );\n },\n);\n\nconst PopoverContentNonModal = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentTypeProps\n>(\n // blank line to reduce diff noise\n function PopoverContentNonModal(props: ScopedProps<PopoverContentTypeProps>, forwardedRef) {\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n const hasInteractedOutsideRef = React.useRef(false);\n const hasPointerDownOutsideRef = React.useRef(false);\n\n return (\n <PopoverContentImpl\n {...props}\n ref={forwardedRef}\n trapFocus={false}\n disableOutsidePointerEvents={false}\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n hasPointerDownOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented) {\n hasInteractedOutsideRef.current = true;\n if (event.detail.originalEvent.type === 'pointerdown') {\n hasPointerDownOutsideRef.current = true;\n }\n }\n\n // Prevent dismissing when clicking the trigger.\n // As the trigger is already setup to close, without doing so would\n // cause it to close and immediately open.\n const target = event.target as HTMLElement;\n const targetIsTrigger = context.triggerRef.current?.contains(target);\n if (targetIsTrigger) event.preventDefault();\n\n // On Safari if the trigger is inside a container with tabIndex={0}, when clicked\n // we will get the pointer down outside event on the trigger, but then a subsequent\n // focus outside event on the container, we ignore any focus outside event when we've\n // already had a pointer down outside event.\n if (event.detail.originalEvent.type === 'focusin' && hasPointerDownOutsideRef.current) {\n event.preventDefault();\n }\n }}\n />\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype PopoverContentImplElement = React.ComponentRef<typeof PopperPrimitive.Content>;\ntype FocusScopeProps = React.ComponentPropsWithoutRef<typeof FocusScope>;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype PopperContentProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ninterface PopoverContentImplProps\n extends Omit<PopperContentProps, 'onPlaced'>, Omit<DismissableLayerProps, 'onDismiss'> {\n /**\n * Whether focus should be trapped within the `Popover`\n * (default: false)\n */\n trapFocus?: FocusScopeProps['trapped'];\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];\n}\n\nconst PopoverContentImpl = /* @__PURE__ */ React.forwardRef<\n PopoverContentImplElement,\n PopoverContentImplProps\n>(\n // blank line to reduce diff noise\n function PopoverContentImpl(props: ScopedProps<PopoverContentImplProps>, forwardedRef) {\n const {\n __scopePopover,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n 'aria-describedby': ariaDescribedby,\n ...contentProps\n } = props;\n const context = usePopoverContext(CONTENT_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n\n // Make sure the whole tree has focus guards as our `Popover` may be\n // the last element in the DOM (because of the `Portal`)\n useFocusGuards();\n\n return (\n <FocusScope\n asChild\n loop\n trapped={trapFocus}\n onMountAutoFocus={onOpenAutoFocus}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n <DismissableLayer\n asChild\n disableOutsidePointerEvents={disableOutsidePointerEvents}\n onInteractOutside={onInteractOutside}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={onFocusOutside}\n onDismiss={() => context.onOpenChange(false)}\n deferPointerDownOutside\n >\n <PopperPrimitive.Content\n data-state={getState(context.open)}\n role=\"dialog\"\n id={context.contentId}\n aria-labelledby={context.titlePresent ? context.titleId : undefined}\n aria-describedby={\n context.descriptionPresent\n ? concatAriaDescribedby(ariaDescribedby, context.descriptionId)\n : ariaDescribedby\n }\n {...popperScope}\n {...contentProps}\n ref={forwardedRef}\n style={{\n ...contentProps.style,\n // re-namespace exposed content custom properties\n ...{\n '--radix-popover-content-transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-popover-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-popover-content-available-height': 'var(--radix-popper-available-height)',\n '--radix-popover-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-popover-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n </DismissableLayer>\n </FocusScope>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTitle\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverTitleElement = React.ComponentRef<typeof Primitive.h2>;\ntype PrimitiveHeading2Props = React.ComponentPropsWithoutRef<typeof Primitive.h2>;\ninterface PopoverTitleProps extends PrimitiveHeading2Props {}\n\nconst PopoverTitle = /* @__PURE__ */ React.forwardRef<PopoverTitleElement, PopoverTitleProps>(\n function PopoverTitle(props: ScopedProps<PopoverTitleProps>, forwardedRef) {\n const { __scopePopover, ...titleProps } = props;\n const context = usePopoverContext('PopoverTitle', __scopePopover);\n const { setTitleCount } = context;\n useLayoutEffect(() => {\n setTitleCount((count) => count + 1);\n return () => setTitleCount((count) => count - 1);\n }, [setTitleCount]);\n\n return <Primitive.h2 id={context.titleId} {...titleProps} ref={forwardedRef} />;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverDescription\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverDescriptionElement = React.ComponentRef<typeof Primitive.p>;\ntype PrimitiveParagraphProps = React.ComponentPropsWithoutRef<typeof Primitive.p>;\ninterface PopoverDescriptionProps extends PrimitiveParagraphProps {}\n\nconst PopoverDescription = /* @__PURE__ */ React.forwardRef<\n PopoverDescriptionElement,\n PopoverDescriptionProps\n>(function PopoverDescription(props: ScopedProps<PopoverDescriptionProps>, forwardedRef) {\n const { __scopePopover, ...descriptionProps } = props;\n const context = usePopoverContext('PopoverDescription', __scopePopover);\n const { setDescriptionCount } = context;\n useLayoutEffect(() => {\n setDescriptionCount((count) => count + 1);\n return () => setDescriptionCount((count) => count - 1);\n }, [setDescriptionCount]);\n\n return <Primitive.p id={context.descriptionId} {...descriptionProps} ref={forwardedRef} />;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'PopoverClose';\n\ntype PopoverCloseElement = React.ComponentRef<typeof Primitive.button>;\ninterface PopoverCloseProps extends PrimitiveButtonProps {}\n\nconst PopoverClose = /* @__PURE__ */ React.forwardRef<PopoverCloseElement, PopoverCloseProps>(\n function PopoverClose(props: ScopedProps<PopoverCloseProps>, forwardedRef) {\n const { __scopePopover, ...closeProps } = props;\n const context = usePopoverContext(CLOSE_NAME, __scopePopover);\n return (\n <Primitive.button\n type=\"button\"\n {...closeProps}\n ref={forwardedRef}\n onClick={composeEventHandlers(props.onClick, () => context.onOpenChange(false))}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverArrow\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverArrowElement = React.ComponentRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;\ninterface PopoverArrowProps extends PopperArrowProps {}\n\nconst PopoverArrow = /* @__PURE__ */ React.forwardRef<PopoverArrowElement, PopoverArrowProps>(\n function PopoverArrow(props: ScopedProps<PopoverArrowProps>, forwardedRef) {\n const { __scopePopover, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopePopover);\n return <PopperPrimitive.Arrow {...popperScope} {...arrowProps} ref={forwardedRef} />;\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\n// TODO: Move to primitive once that package exposed individual sub-modules\nfunction concatAriaDescribedby(...values: unknown[]): string | undefined {\n const ids = new Set<string>();\n for (const value of values) {\n if (typeof value !== 'string') continue;\n for (const id of String(value).trim().split(/\\s+/)) {\n if (id) ids.add(id);\n }\n }\n\n return ids.size > 0 ? Array.from(ids).join(' ') : undefined;\n}\n\nexport {\n createPopoverScope,\n //\n Popover,\n PopoverAnchor,\n PopoverTrigger,\n PopoverPortal,\n PopoverContent,\n PopoverTitle,\n PopoverDescription,\n PopoverClose,\n PopoverArrow,\n //\n Popover as Root,\n PopoverAnchor as Anchor,\n PopoverTrigger as Trigger,\n PopoverPortal as Portal,\n PopoverContent as Content,\n PopoverTitle as Title,\n PopoverDescription as Description,\n PopoverClose as Close,\n PopoverArrow as Arrow,\n};\nexport type {\n PopoverProps,\n PopoverAnchorProps,\n PopoverTriggerProps,\n PopoverPortalProps,\n PopoverContentProps,\n PopoverTitleProps,\n PopoverDescriptionProps,\n PopoverCloseProps,\n PopoverArrowProps,\n};\n"],
5
- "mappings": ";;;;;AAAA,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAChC,SAAS,4BAA4B;AACrC,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AACnC,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAC3B,SAAS,aAAa;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EACvD,GAAG,CAAC,mBAAmB,CAAC;AAExB,SAAO,oBAAC,UAAU,GAAV,EAAY,IAAI,QAAQ,eAAgB,GAAG,kBAAkB,KAAK,cAAc;AAC1F,GAVE,qBAUD;AAMD,IAAM,aAAa;AAKnB,IAAM,eAA+B,gBAAM;AAAA,EACzC,gCAASC,cAAa,OAAuC,cAAc;AACzE,UAAM,EAAE,gBAAgB,GAAG,WAAW,IAAI;AAC1C,UAAM,UAAU,kBAAkB,YAAY,cAAc;AAC5D,WACE;AAAA,MAAC,UAAU;AAAA,MAAV;AAAA,QACC,MAAK;AAAA,QACJ,GAAG;AAAA,QACJ,KAAK;AAAA,QACL,SAAS,qBAAqB,MAAM,SAAS,MAAM,QAAQ,aAAa,KAAK,CAAC;AAAA;AAAA,IAChF;AAAA,EAEJ,GAXA;AAYF;AAUA,IAAM,eAA+B,gBAAM;AAAA,EACzC,gCAASC,cAAa,OAAuC,cAAc;AACzE,UAAM,EAAE,gBAAgB,GAAG,WAAW,IAAI;AAC1C,UAAM,cAAc,eAAe,cAAc;AACjD,WAAO,oBAAiB,uBAAhB,EAAuB,GAAG,aAAc,GAAG,YAAY,KAAK,cAAc;AAAA,EACpF,GAJA;AAKF;AAIA,SAAS,SAAS,MAAe;AAC/B,SAAO,OAAO,SAAS;AACzB;AAFS;AAKT,SAAS,yBAAyB,QAAuC;AACvE,QAAM,MAAM,oBAAI,IAAY;AAC5B,aAAW,SAAS,QAAQ;AAC1B,QAAI,OAAO,UAAU,SAAU;AAC/B,eAAW,MAAM,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG;AAClD,UAAI,GAAI,KAAI,IAAI,EAAE;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,IAAI,OAAO,IAAI,MAAM,KAAK,GAAG,EAAE,KAAK,GAAG,IAAI;AACpD;AAVS;",
4
+ "sourcesContent": ["import * as React from 'react';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport {\n FocusScope,\n FocusScopeBranchProvider,\n useFocusScopeBranch,\n useFocusScopeBranchRegistry,\n} from '@radix-ui/react-focus-scope';\nimport type { FocusScopeBranchRegistry } from '@radix-ui/react-focus-scope';\nimport { useId } from '@radix-ui/react-id';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { createSlot } from '@radix-ui/react-slot';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { hideOthers } from 'aria-hidden';\nimport { RemoveScroll } from 'react-remove-scroll';\n\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Popover\n * -----------------------------------------------------------------------------------------------*/\n\nconst POPOVER_NAME = 'Popover';\n\ntype ScopedProps<P> = P & { __scopePopover?: Scope };\nconst [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [\n createPopperScope,\n]);\nconst usePopperScope = createPopperScope();\n\ninterface PopoverContextValue {\n triggerRef: React.RefObject<HTMLButtonElement | null>;\n contentId: string;\n titleId: string;\n descriptionId: string;\n titlePresent: boolean;\n descriptionPresent: boolean;\n setTitleCount: React.Dispatch<React.SetStateAction<number>>;\n setDescriptionCount: React.Dispatch<React.SetStateAction<number>>;\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpenToggle(): void;\n hasCustomAnchor: boolean;\n onCustomAnchorAdd(): void;\n onCustomAnchorRemove(): void;\n modal: boolean;\n}\n\nconst [PopoverProvider, usePopoverContext] =\n createPopoverContext<PopoverContextValue>(POPOVER_NAME);\n\ninterface PopoverProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n modal?: boolean;\n}\n\nconst Popover: React.FC<PopoverProps> = (props: ScopedProps<PopoverProps>) => {\n const {\n __scopePopover,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = false,\n } = props;\n const popperScope = usePopperScope(__scopePopover);\n const triggerRef = React.useRef<HTMLButtonElement>(null);\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);\n const [titleCount, setTitleCount] = React.useState(0);\n const [descriptionCount, setDescriptionCount] = React.useState(0);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: POPOVER_NAME,\n });\n\n return (\n <PopperPrimitive.Root {...popperScope}>\n <PopoverProvider\n scope={__scopePopover}\n contentId={useId()}\n titleId={useId()}\n descriptionId={useId()}\n titlePresent={titleCount > 0}\n descriptionPresent={descriptionCount > 0}\n setTitleCount={setTitleCount}\n setDescriptionCount={setDescriptionCount}\n triggerRef={triggerRef}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n hasCustomAnchor={hasCustomAnchor}\n onCustomAnchorAdd={React.useCallback(() => setHasCustomAnchor(true), [])}\n onCustomAnchorRemove={React.useCallback(() => setHasCustomAnchor(false), [])}\n modal={modal}\n >\n {children}\n </PopoverProvider>\n </PopperPrimitive.Root>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopoverAnchor';\n\ntype PopoverAnchorElement = React.ComponentRef<typeof PopperPrimitive.Anchor>;\ntype PopperAnchorProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Anchor>;\ninterface PopoverAnchorProps extends PopperAnchorProps {}\n\nconst PopoverAnchor = /* @__PURE__ */ React.forwardRef<PopoverAnchorElement, PopoverAnchorProps>(\n function PopoverAnchor(props: ScopedProps<PopoverAnchorProps>, forwardedRef) {\n const { __scopePopover, ...anchorProps } = props;\n const context = usePopoverContext(ANCHOR_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n const { onCustomAnchorAdd, onCustomAnchorRemove } = context;\n\n React.useEffect(() => {\n onCustomAnchorAdd();\n return () => onCustomAnchorRemove();\n }, [onCustomAnchorAdd, onCustomAnchorRemove]);\n\n return <PopperPrimitive.Anchor {...popperScope} {...anchorProps} ref={forwardedRef} />;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'PopoverTrigger';\n\ntype PopoverTriggerElement = React.ComponentRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface PopoverTriggerProps extends PrimitiveButtonProps {}\n\nconst PopoverTrigger = /* @__PURE__ */ React.forwardRef<PopoverTriggerElement, PopoverTriggerProps>(\n function PopoverTrigger(props: ScopedProps<PopoverTriggerProps>, forwardedRef) {\n const { __scopePopover, ...triggerProps } = props;\n const context = usePopoverContext(TRIGGER_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n\n const trigger = (\n <Primitive.button\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-expanded={context.open}\n aria-controls={context.open ? context.contentId : undefined}\n data-state={getState(context.open)}\n {...triggerProps}\n ref={composedTriggerRef}\n onClick={composeEventHandlers(props.onClick, context.onOpenToggle)}\n />\n );\n\n return context.hasCustomAnchor ? (\n trigger\n ) : (\n <PopperPrimitive.Anchor asChild {...popperScope}>\n {trigger}\n </PopperPrimitive.Anchor>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'PopoverPortal';\n\ntype PortalContextValue = { forceMount?: true };\nconst [PortalProvider, usePortalContext] = createPopoverContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;\ninterface PopoverPortalProps {\n children?: React.ReactNode;\n /**\n * Specify a container element to portal the content into.\n */\n container?: PortalProps['container'];\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst PopoverPortal: React.FC<PopoverPortalProps> = (props: ScopedProps<PopoverPortalProps>) => {\n const { __scopePopover, forceMount, children, container } = props;\n const context = usePopoverContext(PORTAL_NAME, __scopePopover);\n return (\n <PortalProvider scope={__scopePopover} forceMount={forceMount}>\n <Presence present={forceMount || context.open}>\n <PortalPrimitive asChild container={container}>\n {children}\n </PortalPrimitive>\n </Presence>\n </PortalProvider>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopoverContent';\n\ninterface PopoverContentProps extends PopoverContentTypeProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst PopoverContent = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentProps\n>(\n // blank line to reduce diff noise\n function PopoverContent(props: ScopedProps<PopoverContentProps>, forwardedRef) {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n return (\n <Presence present={forceMount || context.open}>\n {context.modal ? (\n <PopoverContentModal {...contentProps} ref={forwardedRef} />\n ) : (\n <PopoverContentNonModal {...contentProps} ref={forwardedRef} />\n )}\n </Presence>\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Slot = createSlot('PopoverContent.RemoveScroll');\n\ntype PopoverContentTypeElement = PopoverContentImplElement;\ninterface PopoverContentTypeProps extends Omit<\n PopoverContentImplProps,\n 'trapFocus' | 'disableOutsidePointerEvents' | 'branchRegistry' | 'branchNodes'\n> {}\n\nconst PopoverContentModal = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentTypeProps\n>(\n // blank line to reduce diff noise\n function PopoverContentModal(props: ScopedProps<PopoverContentTypeProps>, forwardedRef) {\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n const contentRef = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const isRightClickOutsideRef = React.useRef(false);\n\n // Allows nested portalled layers to register themselves as branches of this\n // modal `Popover` so focus isn't reclaimed and scroll isn't locked for\n // them. See: https://github.com/radix-ui/primitives/issues/3423\n const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry();\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n const content = contentRef.current;\n if (content) return hideOthers(content);\n }, []);\n\n return (\n <RemoveScroll\n as={Slot}\n allowPinchZoom\n shards={React.useMemo(\n () => [contentRef, ...branchNodes.map((node) => ({ current: node }))],\n [contentRef, branchNodes],\n )}\n >\n <PopoverContentImpl\n {...props}\n ref={composedRefs}\n branchNodes={branchNodes}\n branchRegistry={branchRegistry}\n // we make sure we're not trapping once it's been closed\n // (closed !== unmounted when animating out)\n trapFocus={context.open}\n disableOutsidePointerEvents\n onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault();\n if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();\n })}\n onPointerDownOutside={composeEventHandlers(\n props.onPointerDownOutside,\n (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n\n isRightClickOutsideRef.current = isRightClick;\n },\n { checkForDefaultPrevented: false },\n )}\n // When focus is trapped, a `focusout` event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault(),\n { checkForDefaultPrevented: false },\n )}\n />\n </RemoveScroll>\n );\n },\n);\n\nconst PopoverContentNonModal = /* @__PURE__ */ React.forwardRef<\n PopoverContentTypeElement,\n PopoverContentTypeProps\n>(\n // blank line to reduce diff noise\n function PopoverContentNonModal(props: ScopedProps<PopoverContentTypeProps>, forwardedRef) {\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n const hasInteractedOutsideRef = React.useRef(false);\n const hasPointerDownOutsideRef = React.useRef(false);\n\n return (\n <PopoverContentImpl\n {...props}\n ref={forwardedRef}\n trapFocus={false}\n disableOutsidePointerEvents={false}\n onCloseAutoFocus={(event) => {\n props.onCloseAutoFocus?.(event);\n\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n // Always prevent auto focus because we either focus manually or want user agent focus\n event.preventDefault();\n }\n\n hasInteractedOutsideRef.current = false;\n hasPointerDownOutsideRef.current = false;\n }}\n onInteractOutside={(event) => {\n props.onInteractOutside?.(event);\n\n if (!event.defaultPrevented) {\n hasInteractedOutsideRef.current = true;\n if (event.detail.originalEvent.type === 'pointerdown') {\n hasPointerDownOutsideRef.current = true;\n }\n }\n\n // Prevent dismissing when clicking the trigger.\n // As the trigger is already setup to close, without doing so would\n // cause it to close and immediately open.\n const target = event.target as HTMLElement;\n const targetIsTrigger = context.triggerRef.current?.contains(target);\n if (targetIsTrigger) event.preventDefault();\n\n // On Safari if the trigger is inside a container with tabIndex={0}, when clicked\n // we will get the pointer down outside event on the trigger, but then a subsequent\n // focus outside event on the container, we ignore any focus outside event when we've\n // already had a pointer down outside event.\n if (event.detail.originalEvent.type === 'focusin' && hasPointerDownOutsideRef.current) {\n event.preventDefault();\n }\n }}\n />\n );\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype PopoverContentImplElement = React.ComponentRef<typeof PopperPrimitive.Content>;\ntype FocusScopeProps = React.ComponentPropsWithoutRef<typeof FocusScope>;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype PopperContentProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ninterface PopoverContentImplProps\n extends Omit<PopperContentProps, 'onPlaced'>, Omit<DismissableLayerProps, 'onDismiss'> {\n /**\n * Whether focus should be trapped within the `Popover`\n * (default: false)\n */\n trapFocus?: FocusScopeProps['trapped'];\n\n /**\n * Event handler called when auto-focusing on open.\n * Can be prevented.\n */\n onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];\n\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];\n\n /**\n * Branch nodes registered by nested, portalled layers. Passed to the trapped\n * `FocusScope` so focus isn't reclaimed from them. Only provided by the modal\n * variant.\n * @internal\n */\n branchNodes?: HTMLElement[];\n\n /**\n * Registry that nested, portalled layers use to register themselves as branches of this modal\n * `Popover`. Only provided by the modal variant.\n * @internal\n */\n branchRegistry?: FocusScopeBranchRegistry;\n}\n\nconst PopoverContentImpl = /* @__PURE__ */ React.forwardRef<\n PopoverContentImplElement,\n PopoverContentImplProps\n>(\n // blank line to reduce diff noise\n function PopoverContentImpl(props: ScopedProps<PopoverContentImplProps>, forwardedRef) {\n const {\n __scopePopover,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n 'aria-describedby': ariaDescribedby,\n branchNodes,\n branchRegistry,\n children,\n ...contentProps\n } = props;\n const context = usePopoverContext(CONTENT_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n\n // When this `Popover` is nested inside a modal layer (eg. a `Dialog`) but\n // portalled outside of it, register its content with the ancestor layer so\n // focus isn't reclaimed and scroll isn't locked for it. No-ops when there\n // is no ancestor layer. See:\n // https://github.com/radix-ui/primitives/issues/3423\n const [contentNode, setContentNode] = React.useState<PopoverContentImplElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, setContentNode);\n useFocusScopeBranch(contentNode);\n\n // Make sure the whole tree has focus guards as our `Popover` may be\n // the last element in the DOM (because of the `Portal`)\n useFocusGuards();\n\n return (\n <FocusScope\n asChild\n loop\n trapped={trapFocus}\n branches={branchNodes}\n onMountAutoFocus={onOpenAutoFocus}\n onUnmountAutoFocus={onCloseAutoFocus}\n >\n <DismissableLayer\n asChild\n disableOutsidePointerEvents={disableOutsidePointerEvents}\n onInteractOutside={onInteractOutside}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={onFocusOutside}\n onDismiss={() => context.onOpenChange(false)}\n deferPointerDownOutside\n >\n <PopperPrimitive.Content\n data-state={getState(context.open)}\n role=\"dialog\"\n id={context.contentId}\n aria-labelledby={context.titlePresent ? context.titleId : undefined}\n aria-describedby={\n context.descriptionPresent\n ? concatAriaDescribedby(ariaDescribedby, context.descriptionId)\n : ariaDescribedby\n }\n {...popperScope}\n {...contentProps}\n ref={composedRefs}\n style={{\n ...contentProps.style,\n // re-namespace exposed content custom properties\n ...{\n '--radix-popover-content-transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-popover-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-popover-content-available-height': 'var(--radix-popper-available-height)',\n '--radix-popover-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-popover-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n >\n {branchRegistry ? (\n <FocusScopeBranchProvider value={branchRegistry}>{children}</FocusScopeBranchProvider>\n ) : (\n children\n )}\n </PopperPrimitive.Content>\n </DismissableLayer>\n </FocusScope>\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTitle\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverTitleElement = React.ComponentRef<typeof Primitive.h2>;\ntype PrimitiveHeading2Props = React.ComponentPropsWithoutRef<typeof Primitive.h2>;\ninterface PopoverTitleProps extends PrimitiveHeading2Props {}\n\nconst PopoverTitle = /* @__PURE__ */ React.forwardRef<PopoverTitleElement, PopoverTitleProps>(\n function PopoverTitle(props: ScopedProps<PopoverTitleProps>, forwardedRef) {\n const { __scopePopover, ...titleProps } = props;\n const context = usePopoverContext('PopoverTitle', __scopePopover);\n const { setTitleCount } = context;\n useLayoutEffect(() => {\n setTitleCount((count) => count + 1);\n return () => setTitleCount((count) => count - 1);\n }, [setTitleCount]);\n\n return <Primitive.h2 id={context.titleId} {...titleProps} ref={forwardedRef} />;\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverDescription\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverDescriptionElement = React.ComponentRef<typeof Primitive.p>;\ntype PrimitiveParagraphProps = React.ComponentPropsWithoutRef<typeof Primitive.p>;\ninterface PopoverDescriptionProps extends PrimitiveParagraphProps {}\n\nconst PopoverDescription = /* @__PURE__ */ React.forwardRef<\n PopoverDescriptionElement,\n PopoverDescriptionProps\n>(function PopoverDescription(props: ScopedProps<PopoverDescriptionProps>, forwardedRef) {\n const { __scopePopover, ...descriptionProps } = props;\n const context = usePopoverContext('PopoverDescription', __scopePopover);\n const { setDescriptionCount } = context;\n useLayoutEffect(() => {\n setDescriptionCount((count) => count + 1);\n return () => setDescriptionCount((count) => count - 1);\n }, [setDescriptionCount]);\n\n return <Primitive.p id={context.descriptionId} {...descriptionProps} ref={forwardedRef} />;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'PopoverClose';\n\ntype PopoverCloseElement = React.ComponentRef<typeof Primitive.button>;\ninterface PopoverCloseProps extends PrimitiveButtonProps {}\n\nconst PopoverClose = /* @__PURE__ */ React.forwardRef<PopoverCloseElement, PopoverCloseProps>(\n function PopoverClose(props: ScopedProps<PopoverCloseProps>, forwardedRef) {\n const { __scopePopover, ...closeProps } = props;\n const context = usePopoverContext(CLOSE_NAME, __scopePopover);\n return (\n <Primitive.button\n type=\"button\"\n {...closeProps}\n ref={forwardedRef}\n onClick={composeEventHandlers(props.onClick, () => context.onOpenChange(false))}\n />\n );\n },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverArrow\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverArrowElement = React.ComponentRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;\ninterface PopoverArrowProps extends PopperArrowProps {}\n\nconst PopoverArrow = /* @__PURE__ */ React.forwardRef<PopoverArrowElement, PopoverArrowProps>(\n function PopoverArrow(props: ScopedProps<PopoverArrowProps>, forwardedRef) {\n const { __scopePopover, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopePopover);\n return <PopperPrimitive.Arrow {...popperScope} {...arrowProps} ref={forwardedRef} />;\n },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n return open ? 'open' : 'closed';\n}\n\n// TODO: Move to primitive once that package exposed individual sub-modules\nfunction concatAriaDescribedby(...values: unknown[]): string | undefined {\n const ids = new Set<string>();\n for (const value of values) {\n if (typeof value !== 'string') continue;\n for (const id of String(value).trim().split(/\\s+/)) {\n if (id) ids.add(id);\n }\n }\n\n return ids.size > 0 ? Array.from(ids).join(' ') : undefined;\n}\n\nexport {\n createPopoverScope,\n //\n Popover,\n PopoverAnchor,\n PopoverTrigger,\n PopoverPortal,\n PopoverContent,\n PopoverTitle,\n PopoverDescription,\n PopoverClose,\n PopoverArrow,\n //\n Popover as Root,\n PopoverAnchor as Anchor,\n PopoverTrigger as Trigger,\n PopoverPortal as Portal,\n PopoverContent as Content,\n PopoverTitle as Title,\n PopoverDescription as Description,\n PopoverClose as Close,\n PopoverArrow as Arrow,\n};\nexport type {\n PopoverProps,\n PopoverAnchorProps,\n PopoverTriggerProps,\n PopoverPortalProps,\n Pop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AqB,MAAM,SAAS,MAAM,QAAQ,aAAa,KAAK,CAAC;AAAA;AAAA,IAChF;AAAA,EAEJ,GAXA;AAYF;AAUA,IAAM,eAA+B,gBAAM;AAAA,EACzC,gCAASC,cAAa,OAAuC,cAAc;AACzE,UAAM,EAAE,gBAAgB,GAAG,WAAW,IAAI;AAC1C,UAAM,cAAc,eAAe,cAAc;AACjD,WAAO,oBAAiB,uBAAhB,EAAuB,GAAG,aAAc,GAAG,YAAY,KAAK,cAAc;AAAA,EACpF,GAJA;AAKF;AAIA,SAAS,SAAS,MAAe;AAC/B,SAAO,OAAO,SAAS;AACzB;AAFS;AAKT,SAAS,yBAAyB,QAAuC;AACvE,QAAM,MAAM,oBAAI,IAAY;AAC5B,aAAW,SAAS,QAAQ;AAC1B,QAAI,OAAO,UAAU,SAAU;AAC/B,eAAW,MAAM,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG;AAClD,UAAI,GAAI,KAAI,IAAI,EAAE;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,IAAI,OAAO,IAAI,MAAM,KAAK,GAAG,EAAE,KAAK,GAAG,IAAI;AACpD;AAVS;",
6
6
  "names": ["PopoverAnchor", "PopoverTrigger", "PopoverContent", "PopoverContentModal", "PopoverContentNonModal", "PopoverContentImpl", "PopoverTitle", "PopoverDescription", "PopoverClose", "PopoverArrow"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-popover",
3
- "version": "1.1.21",
3
+ "version": "1.1.22",
4
4
  "license": "MIT",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./dist/index.js",
@@ -13,20 +13,20 @@
13
13
  "dependencies": {
14
14
  "aria-hidden": "^1.2.4",
15
15
  "react-remove-scroll": "^2.7.2",
16
- "@radix-ui/react-compose-refs": "1.1.4",
17
16
  "@radix-ui/primitive": "1.1.7",
18
- "@radix-ui/react-dismissable-layer": "1.1.17",
17
+ "@radix-ui/react-compose-refs": "1.1.4",
19
18
  "@radix-ui/react-focus-guards": "1.1.5",
19
+ "@radix-ui/react-focus-scope": "1.1.15",
20
20
  "@radix-ui/react-context": "1.2.1",
21
- "@radix-ui/react-focus-scope": "1.1.14",
22
- "@radix-ui/react-id": "1.1.3",
23
- "@radix-ui/react-popper": "1.3.5",
24
- "@radix-ui/react-portal": "1.1.15",
25
- "@radix-ui/react-primitive": "2.1.8",
26
- "@radix-ui/react-slot": "1.3.1",
27
- "@radix-ui/react-use-controllable-state": "1.2.5",
21
+ "@radix-ui/react-dismissable-layer": "1.1.18",
22
+ "@radix-ui/react-portal": "1.1.16",
28
23
  "@radix-ui/react-presence": "1.1.9",
29
- "@radix-ui/react-use-layout-effect": "1.1.3"
24
+ "@radix-ui/react-popper": "1.3.6",
25
+ "@radix-ui/react-primitive": "2.1.9",
26
+ "@radix-ui/react-slot": "1.3.2",
27
+ "@radix-ui/react-use-controllable-state": "1.2.5",
28
+ "@radix-ui/react-use-layout-effect": "1.1.3",
29
+ "@radix-ui/react-id": "1.1.3"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/react": "^19.2.17",