@mirohq/design-system-dialog 0.1.0-dialog.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -23,13 +23,31 @@ const useDialogContext = () => {
23
23
  return context;
24
24
  };
25
25
 
26
+ const POPUP_SELECTOR = '[role="listbox"], [role="menu"], [role="tree"], [role="grid"], [role="dialog"], [role="alertdialog"]';
27
+ function innerOverlayHoldsFocus(content) {
28
+ if (content === null) return false;
29
+ const active = document.activeElement;
30
+ if (active === null || active === document.body) return false;
31
+ const popup = active.closest(POPUP_SELECTOR);
32
+ if (popup === null) return !content.contains(active);
33
+ return popup !== content && !designSystemUseOverlay.isLayerElement(popup);
34
+ }
35
+ function focusIsOnExpandedPopupControl(content) {
36
+ if (content === null) return false;
37
+ const active = document.activeElement;
38
+ if (active === null || !content.contains(active)) return false;
39
+ if (active.getAttribute("aria-expanded") !== "true") return false;
40
+ const popup = active.getAttribute("aria-haspopup");
41
+ return popup !== null && popup !== "false";
42
+ }
43
+
26
44
  const Root = ({ children, ...options }) => {
27
45
  var _a, _b, _c, _d, _e;
28
46
  const depth = ((_b = (_a = react.useContext(DialogContext)) == null ? void 0 : _a.depth) != null ? _b : 0) + 1;
29
47
  const generatedId = designSystemUseId.useId();
30
48
  const id = (_c = options.id) != null ? _c : generatedId;
31
49
  const role = (_d = options.role) != null ? _d : "dialog";
32
- const modal = (_e = options.modal) != null ? _e : true;
50
+ const modal = role === "alertdialog" || ((_e = options.modal) != null ? _e : true);
33
51
  const animated = options.animated === true;
34
52
  const controlled = options.open !== void 0;
35
53
  const [uncontrolledOpen, setUncontrolledOpen] = react.useState(
@@ -72,6 +90,10 @@ const Root = ({ children, ...options }) => {
72
90
  onEscapeRef.current = (event) => {
73
91
  var _a2, _b2;
74
92
  if (!designSystemUseOverlay.isTopmostLayer(id)) return;
93
+ const content = document.getElementById("".concat(id, "-content"));
94
+ if (innerOverlayHoldsFocus(content) || focusIsOnExpandedPopupControl(content)) {
95
+ return;
96
+ }
75
97
  (_b2 = (_a2 = optionsRef.current).onEscapeKeyDown) == null ? void 0 : _b2.call(_a2, event);
76
98
  if (event.defaultPrevented) return;
77
99
  if (optionsRef.current.closeOnEscape === false) return;
@@ -343,8 +365,8 @@ const Content$1 = react.forwardRef(
343
365
  designSystemUseScrollLock.useScrollLock(modal, container != null ? container : void 0);
344
366
  designSystemUseFocusTrap.useFocusTrap(contentRef, {
345
367
  // Only a modal dialog traps, and only while topmost — a nested dialog
346
- // owns focus while open.
347
- enabled: () => modal && designSystemUseOverlay.isTopmostLayer(id),
368
+ // owns focus while open, and so does an inner overlay that holds it.
369
+ enabled: () => modal && designSystemUseOverlay.isTopmostLayer(id) && !innerOverlayHoldsFocus(contentRef.current),
348
370
  // The Close part is the cycle's last stop wherever it renders (SPEC).
349
371
  last: () => closeRef.current
350
372
  });
@@ -352,14 +374,20 @@ const Content$1 = react.forwardRef(
352
374
  if (!open) return;
353
375
  const element = contentRef.current;
354
376
  if (element === null) return;
355
- if (parts.title || document.getElementById(ids.title) !== null) return;
356
- if (element.hasAttribute("aria-label") || element.hasAttribute("aria-labelledby")) {
357
- return;
377
+ const named = parts.title || document.getElementById(ids.title) !== null || element.hasAttribute("aria-label") || element.hasAttribute("aria-labelledby");
378
+ if (!named) {
379
+ console.warn(
380
+ "[Dialog] the dialog resolves no accessible name: render a <Dialog.Title>, or give Content an aria-label when it truly cannot have one."
381
+ );
358
382
  }
359
- console.warn(
360
- "[Dialog] the dialog resolves no accessible name: render a <Dialog.Title>, or give Content an aria-label when it truly cannot have one."
361
- );
362
- }, [open, parts.title, ids.title]);
383
+ if (role !== "alertdialog") return;
384
+ const described = parts.description || document.getElementById(ids.description) !== null || element.hasAttribute("aria-describedby");
385
+ if (!described) {
386
+ console.warn(
387
+ "[Dialog] the alert dialog resolves no accessible description: render a <Dialog.Description>, or give Content an aria-describedby."
388
+ );
389
+ }
390
+ }, [open, role, parts.title, parts.description, ids.title, ids.description]);
363
391
  const labelling = {};
364
392
  if (parts.title && props["aria-labelledby"] == null) {
365
393
  labelling["aria-labelledby"] = ids.title;
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sources":["../src/primitive/context.tsx","../src/primitive/root.tsx","../src/primitive/trigger.tsx","../src/primitive/portal.tsx","../src/primitive/backdrop.tsx","../src/primitive/viewport.tsx","../src/primitive/content.tsx","../src/primitive/title.tsx","../src/primitive/description.tsx","../src/primitive/close.tsx","../src/primitive/use-dialog.ts","../src/styles/animation.ts","../src/partials/backdrop.tsx","../src/partials/close.tsx","../src/partials/parts.tsx","../src/partials/content.tsx","../src/partials/portal.tsx","../src/partials/trigger.tsx","../src/dialog.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { Dispatch, RefObject, SetStateAction } from 'react'\n\nimport type { DialogRole, DialogState } from './types'\n\n/**\n * The cross-part ids, derived from the one base id so the trigger's\n * aria-controls, the Content's id, and the labelledby/describedby always\n * agree.\n */\nexport interface DialogIds {\n content: string\n title: string\n description: string\n}\n\n// Which optional parts are currently present: Content only references the\n// rendered Title/Description.\nexport interface PartsPresence {\n title: boolean\n description: boolean\n}\n\nexport interface DialogContextValue {\n state: DialogState\n open: boolean\n /** Whether the dialog occupies the tree: open or mid-exit (`closing`) — the\n * Portal's unmount gate. */\n mounted: boolean\n modal: boolean\n role: DialogRole\n id: string\n ids: DialogIds\n // Nesting level (1 = top-level). Decides the topmost dialog of a stack for\n // Escape, focus, and assistive-tech containment.\n depth: number\n // The element the Portal teleported into, or null for the page body —\n // Content scopes the scroll lock to it. The root provides null; Portal\n // re-provides the context with the field filled in.\n container: HTMLElement | null\n // The rendered Backdrop element, shared because Backdrop and Content are\n // sibling layers: Content's stack entry excepts its own backdrop from the\n // containment so it stays pressable while its dialog is topmost.\n backdropRef: RefObject<HTMLDivElement>\n // The rendered Trigger element — the close's focus-restore fallback when\n // nothing was focused before opening (a pointer press leaves focus on the\n // body: the DS Button suppresses mousedown's native focus).\n triggerRef: RefObject<HTMLButtonElement>\n // The rendered Close element — how the focus containment keeps the part\n // the cycle's last stop (an id would duplicate if Close ever doubled).\n closeRef: RefObject<HTMLButtonElement>\n parts: PartsPresence\n setParts: Dispatch<SetStateAction<PartsPresence>>\n toggle: () => void\n close: () => void\n interactOutside: (event: MouseEvent) => void\n exitComplete: () => void\n}\n\nexport const DialogContext = createContext<DialogContextValue | undefined>(\n undefined\n)\n\nexport const useDialogContext = (): DialogContextValue => {\n const context = useContext(DialogContext)\n if (context === undefined) {\n throw new Error('Dialog parts must be rendered within a <Dialog> root')\n }\n return context\n}\n","// <Root> — owns the open state and renders no DOM.\nimport React, { useContext, useEffect, useRef, useState } from 'react'\nimport type { ReactNode } from 'react'\nimport { useId } from '@mirohq/design-system-use-id'\nimport { useBrowserNavigation } from '@mirohq/design-system-use-browser-navigation'\nimport { isTopmostLayer } from '@mirohq/design-system-use-overlay'\n\nimport { DialogContext } from './context'\nimport type { PartsPresence } from './context'\nimport type { BackNavigationPayload, DialogOptions, DialogState } from './types'\n\nexport interface RootProps extends DialogOptions {\n children?: ReactNode\n}\n\nexport const Root = ({ children, ...options }: RootProps): ReactNode => {\n // Nesting derives from the parent dialog's context (undefined = top-level).\n const depth = (useContext(DialogContext)?.depth ?? 0) + 1\n const generatedId = useId()\n // `?? generatedId`: an explicit `id={undefined}` must not knock out the\n // fallback — ids also key the dialog stack, so they must exist.\n const id = options.id ?? generatedId\n const role = options.role ?? 'dialog'\n const modal = options.modal ?? true\n const animated = options.animated === true\n\n const controlled = options.open !== undefined\n const [uncontrolledOpen, setUncontrolledOpen] = useState(\n options.defaultOpen === true\n )\n const open = controlled ? options.open === true : uncontrolledOpen\n\n // Controlled-ness follows the prop live: mirroring the prop keeps the\n // uncontrolled value current, so dropping the prop hands the state back\n // right where it stands.\n if (controlled && uncontrolledOpen !== open) setUncontrolledOpen(open)\n\n // The exit window: only an `animated` close passes through `closing`, and\n // reopening interrupts it. Adjusted during render — an effect would let an\n // unmounted frame slip between the close and the exit.\n const [exiting, setExiting] = useState(false)\n const previousOpen = useRef(open)\n if (previousOpen.current !== open) {\n previousOpen.current = open\n if (open) {\n if (exiting) setExiting(false)\n } else if (animated) {\n setExiting(true)\n }\n }\n\n const state: DialogState = open ? 'open' : exiting ? 'closing' : 'closed'\n\n // Read through a ref so the document-level listeners and the history guard\n // follow the open state alone — fresh callback identities must not re-bind\n // listeners or churn real session-history entries.\n const optionsRef = useRef(options)\n optionsRef.current = options\n\n // onOpenChange reports once per transition-or-intent: every interaction\n // that asks for a different value reports it immediately — a controlled\n // dialog stays put, but the ask is not silent (`open` + `onOpenChange`\n // works on its own, like the Radix-based overlays) — and a change the\n // prop drives by itself reports from the effect. The already-reported\n // check keeps a granted intent from echoing when the prop answers it.\n // No call on mount.\n const reportedOpen = useRef(open)\n const resolvedOpen = useRef(open)\n useEffect(() => {\n if (resolvedOpen.current === open) return\n resolvedOpen.current = open\n if (reportedOpen.current === open) return\n reportedOpen.current = open\n optionsRef.current.onOpenChange?.(open)\n })\n\n const setOpen = (next: boolean): void => {\n if (open === next) return\n reportedOpen.current = next\n optionsRef.current.onOpenChange?.(next)\n // A controlled dialog never moves on its own — the consumer decides at\n // the source (this report and the dismissal callbacks) and answers\n // through the prop.\n if (!controlled) setUncontrolledOpen(next)\n }\n\n // Escape is a document-level concern, not a part's — it must work wherever\n // focus is. The handler lives on a ref so the listener binds per open\n // window, not per render; a `closing` dialog has already detached it.\n const onEscapeRef = useRef<(event: KeyboardEvent) => void>(() => {})\n onEscapeRef.current = (event: KeyboardEvent): void => {\n // Only the topmost dialog answers Escape — a nested stack closes one\n // layer at a time.\n if (!isTopmostLayer(id)) return\n optionsRef.current.onEscapeKeyDown?.(event)\n if (event.defaultPrevented) return\n if (optionsRef.current.closeOnEscape === false) return\n setOpen(false)\n }\n\n useEffect(() => {\n if (!open) return\n const onKeyDown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') onEscapeRef.current(event)\n }\n document.addEventListener('keydown', onKeyDown, true)\n return () => document.removeEventListener('keydown', onKeyDown, true)\n }, [open])\n\n // closeOnBack: while open, a guard entry in the session history turns the\n // host's Back into a dismissal instead of a navigation — and the entry a\n // Back press spends survives in the forward stack, so the host's Forward\n // reopens what Back closed. It lives on the root — the guard concerns the\n // dialog's openness, not any rendered part.\n const onBackRef = useRef<() => boolean>(() => false)\n onBackRef.current = (): boolean => {\n // The host's back has no cancelable event — synthesize the veto payload\n // so the callback contract matches the other dismissals.\n const payload: BackNavigationPayload = {\n defaultPrevented: false,\n preventDefault() {\n payload.defaultPrevented = true\n },\n }\n optionsRef.current.onBackNavigation?.(payload)\n if (payload.defaultPrevented === true) return false\n // A controlled dialog only records the request (onOpenChange reports the\n // intent) — the consumer follows through the prop, and the guard re-arms\n // until it does.\n setOpen(false)\n return !controlled\n }\n\n // `backNavigate`'s mirror, decided the same way — and reachable from the\n // animated `closing` state too: Forward interrupts the exit.\n const onForwardRef = useRef<() => boolean>(() => false)\n onForwardRef.current = (): boolean => {\n const payload: BackNavigationPayload = {\n defaultPrevented: false,\n preventDefault() {\n payload.defaultPrevented = true\n },\n }\n optionsRef.current.onForwardNavigation?.(payload)\n if (payload.defaultPrevented === true) return false\n if (optionsRef.current.closeOnBack !== true) return false\n setOpen(true)\n return !controlled\n }\n\n useBrowserNavigation({\n enabled: options.closeOnBack === true,\n open,\n onBack: () => onBackRef.current(),\n onForward: () => onForwardRef.current(),\n // The dialog's nesting depth is what a returning dialog recognizes its\n // own spent entry by: the instance is new after a remount, but the\n // position in the stack is the same.\n claim: `dialog:${depth}`,\n })\n\n // A press that starts inside the dialog window never counts as outside,\n // wherever it releases: a text-selection drag out of the window dispatches\n // its click on the layer around it (a click targets the press's and the\n // release's common ancestor), so the click's target alone can't tell a\n // dismissal from a drag. Each press records its origin instead.\n const insidePressRef = useRef(false)\n useEffect(() => {\n if (!open) return\n const contentId = `${id}-content`\n const onPointerDown = (event: Event): void => {\n const content = document.getElementById(contentId)\n insidePressRef.current =\n content !== null &&\n event.target instanceof Node &&\n content.contains(event.target)\n }\n document.addEventListener('pointerdown', onPointerDown, true)\n return () =>\n document.removeEventListener('pointerdown', onPointerDown, true)\n }, [open, id])\n\n const interactOutside = (event: MouseEvent): void => {\n if (insidePressRef.current) return\n // An outside press is an intent, not a close command: the consumer may\n // veto it, and the role's dismissal setting gates it — an alert dialog\n // interrupts for a response, so it doesn't dismiss unless opted in.\n options.onInteractOutside?.(event)\n if (event.defaultPrevented) return\n if (!(options.closeOnInteractOutside ?? role === 'dialog')) return\n setOpen(false)\n }\n const interactOutsideRef = useRef(interactOutside)\n interactOutsideRef.current = interactOutside\n\n const backdropRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const closeRef = useRef<HTMLButtonElement>(null)\n\n // A non-modal dialog coexists with the page: no layer intercepts the\n // press, so the outside interaction is read from the document. Presses\n // inside the window are inside; the trigger's own press stays a plain\n // toggle — counting it as outside would close and immediately reopen.\n useEffect(() => {\n if (!open || modal) return\n const contentId = `${id}-content`\n const onClick = (event: MouseEvent): void => {\n if (!isTopmostLayer(id)) return\n if (!(event.target instanceof Node)) return\n if (document.getElementById(contentId)?.contains(event.target) === true)\n return\n if (triggerRef.current?.contains(event.target) === true) return\n interactOutsideRef.current(event)\n }\n document.addEventListener('click', onClick)\n return () => document.removeEventListener('click', onClick)\n }, [open, modal, id])\n\n const [parts, setParts] = useState<PartsPresence>({\n title: false,\n description: false,\n })\n\n return (\n <DialogContext.Provider\n value={{\n state,\n open,\n mounted: state !== 'closed',\n modal,\n role,\n id,\n ids: {\n content: `${id}-content`,\n title: `${id}-title`,\n description: `${id}-description`,\n },\n depth,\n container: null,\n backdropRef,\n triggerRef,\n closeRef,\n parts,\n setParts,\n toggle: () => setOpen(!open),\n close: () => setOpen(false),\n interactOutside,\n exitComplete: () => setExiting(false),\n }}\n >\n {children}\n </DialogContext.Provider>\n )\n}\n","// <Trigger> — toggles the dialog; focus returns here on close.\nimport React, { forwardRef } from 'react'\nimport type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { composeHandlers, mergeRefs } from '@mirohq/design-system-utils'\n\nimport { useDialogContext } from './context'\n\nexport interface TriggerProps extends ComponentProps<typeof Primitive.button> {}\n\nexport const Trigger = forwardRef<HTMLButtonElement, TriggerProps>(\n ({ asChild = false, ...props }, forwardedRef) => {\n const { open, state, ids, toggle, triggerRef } = useDialogContext()\n const consumer = composeHandlers(\n { onClick: toggle },\n asChild ? props : { type: 'button' as const, ...props }\n )\n\n return (\n <Primitive.button\n {...consumer}\n aria-haspopup='dialog'\n aria-expanded={open}\n // A dangling aria-controls id is an a11y defect — only while open.\n aria-controls={open ? ids.content : undefined}\n data-state={state}\n asChild={asChild}\n ref={mergeRefs([triggerRef, forwardedRef])}\n />\n )\n }\n)\n","// <Portal> — teleports the layers out of the tree while open.\nimport React from 'react'\nimport type { ReactNode } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { DialogContext, useDialogContext } from './context'\n\nexport interface PortalProps {\n children?: ReactNode\n /** The element to portal into. @default document.body */\n container?: HTMLElement | null\n}\n\nexport const Portal = ({ children, container }: PortalProps): ReactNode => {\n const context = useDialogContext()\n // `mounted`, not `open`: an animated dialog stays in the tree through\n // `closing` so its exit visual can play before everything unmounts.\n if (!context.mounted || typeof document === 'undefined') return null\n // Re-provide the context with the scoped container (null = page body) so\n // Content locks the right scroll surface.\n return createPortal(\n <DialogContext.Provider\n value={{ ...context, container: container ?? null }}\n >\n {children}\n </DialogContext.Provider>,\n container ?? document.body\n )\n}\n","// <Backdrop> — the layer behind the dialog window.\nimport React, { forwardRef } from 'react'\nimport type { ComponentProps, MouseEvent } from 'react'\nimport { composeHandlers, mergeRefs } from '@mirohq/design-system-utils'\nimport { isTopmostLayer } from '@mirohq/design-system-use-overlay'\n\nimport { useDialogContext } from './context'\n\nexport interface BackdropProps extends ComponentProps<'div'> {}\n\nexport const Backdrop = forwardRef<HTMLDivElement, BackdropProps>(\n (props, forwardedRef) => {\n const { modal, state, id, container, backdropRef, interactOutside } =\n useDialogContext()\n\n // Only a modal dialog dims the page — non-modal coexists with it.\n if (!modal) return null\n\n const consumer = composeHandlers(\n {\n // Only the topmost dialog of a stack answers an outside press.\n onClick: (event: MouseEvent<HTMLElement>) => {\n if (isTopmostLayer(id)) interactOutside(event.nativeEvent)\n },\n },\n props\n )\n\n return (\n // role=presentation: the backdrop is a purely visual layer; its press\n // is the pointer half of an outside dismissal, with Escape as the\n // keyboard path (jsx-a11y's keyboard pairing doesn't apply).\n <div\n role='presentation'\n {...consumer}\n data-state={state}\n // A scoped dialog (Portal container) pins to the container, not the\n // page — the styled layer switches positioning on this attribute.\n data-scoped={container === null ? undefined : ''}\n ref={mergeRefs([backdropRef, forwardedRef])}\n />\n )\n }\n)\n","// <Viewport> — the positioning + scroll layer around the dialog window.\nimport React, { forwardRef } from 'react'\nimport type { ComponentProps, MouseEvent } from 'react'\nimport { composeHandlers } from '@mirohq/design-system-utils'\nimport { isTopmostLayer } from '@mirohq/design-system-use-overlay'\n\nimport { useDialogContext } from './context'\n\nexport interface ViewportProps extends ComponentProps<'div'> {\n /** Marks the layer full-screen: the window fills it edge to edge, so the\n * layer drops its own inset. @default false */\n fullScreen?: boolean\n}\n\nexport const Viewport = forwardRef<HTMLDivElement, ViewportProps>(\n ({ fullScreen, ...props }, forwardedRef) => {\n const { state, id, modal, container, interactOutside } = useDialogContext()\n\n const consumer = composeHandlers(\n {\n // Box presses bubble up here — only a press that started on the\n // viewport itself is an outside interaction, and only the topmost\n // dialog of a stack answers it.\n onClick: (event: MouseEvent<HTMLElement>) => {\n if (event.target !== event.currentTarget) return\n if (!isTopmostLayer(id)) return\n interactOutside(event.nativeEvent)\n },\n },\n props\n )\n\n return (\n // role=presentation: a purely presentational positioning wrapper — the\n // press it answers is the pointer half of an outside dismissal, with\n // Escape as the keyboard path.\n <div\n role='presentation'\n {...consumer}\n data-state={state}\n // A scoped dialog (Portal container) pins to the container, not the\n // page — the styled layer switches positioning on this attribute.\n data-scoped={container === null ? undefined : ''}\n // A non-modal dialog coexists with the page — without this marker the\n // styled layer stops intercepting pointer presses.\n data-modal={modal ? '' : undefined}\n // A full-screen window fills the layer edge to edge — the styled\n // layer drops its inset on this attribute.\n data-full-screen={fullScreen === true ? '' : undefined}\n ref={forwardedRef}\n />\n )\n }\n)\n","// <Content> — the dialog window: focus moves in on open, restores on close,\n// traps while modal.\nimport React, { forwardRef, useEffect, useRef } from 'react'\nimport type { ComponentProps, RefObject } from 'react'\nimport { mergeRefs } from '@mirohq/design-system-utils'\nimport { useFocusTrap } from '@mirohq/design-system-use-focus-trap'\nimport { useScrollLock } from '@mirohq/design-system-use-scroll-lock'\nimport {\n isTopmostLayer,\n useOverlay,\n useOverlayExit,\n} from '@mirohq/design-system-use-overlay'\n\nimport { useDialogContext } from './context'\n\nexport interface ContentProps extends ComponentProps<'div'> {\n /** The element to focus when the dialog opens. @default the dialog window */\n initialFocus?: RefObject<HTMLElement>\n}\n\nexport const Content = forwardRef<HTMLDivElement, ContentProps>(\n ({ initialFocus, ...props }, forwardedRef) => {\n const {\n state,\n open,\n modal,\n role,\n id,\n ids,\n depth,\n container,\n backdropRef,\n triggerRef,\n closeRef,\n parts,\n exitComplete,\n } = useDialogContext()\n const contentRef = useRef<HTMLDivElement>(null)\n\n // The open window: the stack entry, containment, initial focus, and the\n // focus restore — released the moment a close starts, not when the exit\n // visual finishes.\n useOverlay(contentRef, {\n enabled: open,\n id,\n depth,\n modal,\n backdrop: () => backdropRef.current,\n initialFocus,\n // A pointer press opens without focusing the trigger (the DS Button\n // suppresses mousedown's native focus), so the close would find only\n // the body to restore to — fall back to the trigger, the invoker APG\n // says focus returns to.\n restoreFocus: () => triggerRef.current,\n })\n\n // The exit window: a Content rendered while not open only happens in\n // `closing` — the still-painting layer leaves the page's interaction and\n // its finished visual reports the unmount.\n useOverlayExit(contentRef, {\n exiting: !open,\n boundary: container,\n backdrop: () => backdropRef.current,\n onExitComplete: exitComplete,\n })\n\n // The lock spans the whole mount — through `closing` too: releasing it\n // mid-exit would bring the scrollbar back and reflow the page under the\n // still-painting layer. A scoped dialog locks its portal container; a\n // page dialog locks the body. The context's `null` container means the\n // page body — the hook's default — not its \"no target yet\".\n useScrollLock(modal, container ?? undefined)\n\n useFocusTrap(contentRef, {\n // Only a modal dialog traps, and only while topmost — a nested dialog\n // owns focus while open.\n enabled: () => modal && isTopmostLayer(id),\n // The Close part is the cycle's last stop wherever it renders (SPEC).\n last: () => closeRef.current,\n })\n\n // The constraint is \"never neither\": a rendered Title or an accessible\n // label on the window. Read from the DOM — it is committed before this\n // effect, while the Title's presence registration is not, and a label\n // arriving through any prop spread counts too.\n useEffect(() => {\n if (!open) return\n const element = contentRef.current\n if (element === null) return\n if (parts.title || document.getElementById(ids.title) !== null) return\n if (\n element.hasAttribute('aria-label') ||\n element.hasAttribute('aria-labelledby')\n ) {\n return\n }\n console.warn(\n '[Dialog] the dialog resolves no accessible name: render a ' +\n '<Dialog.Title>, or give Content an aria-label when it truly ' +\n 'cannot have one.'\n )\n }, [open, parts.title, ids.title])\n\n // The ARIA relationships always follow what is rendered — an omitted part\n // never leaves a dangling reference, and a consumer-supplied value wins\n // over the derived one.\n const labelling: Record<string, string> = {}\n if (parts.title && props['aria-labelledby'] == null) {\n labelling['aria-labelledby'] = ids.title\n }\n if (parts.description && props['aria-describedby'] == null) {\n labelling['aria-describedby'] = ids.description\n }\n\n return (\n // A neutral element with the role, not <dialog>: the window is the\n // initial focus target, so it carries tabindex — which HTML forbids on\n // <dialog> — and the native element only pays off via showModal(),\n // which this contract deliberately doesn't use.\n <div\n {...props}\n {...labelling}\n role={role}\n id={ids.content}\n aria-modal={modal || undefined}\n // The initial focus target: focusable in script, not in the tab order.\n tabIndex={-1}\n data-state={state}\n ref={mergeRefs([contentRef, forwardedRef])}\n />\n )\n }\n)\n","// <Title> — the dialog's accessible name.\nimport React, { forwardRef, useEffect } from 'react'\nimport type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nimport { useDialogContext } from './context'\n\nexport interface TitleProps extends ComponentProps<typeof Primitive.h2> {}\n\nexport const Title = forwardRef<HTMLHeadingElement, TitleProps>(\n ({ asChild = false, ...props }, forwardedRef) => {\n const { ids, setParts } = useDialogContext()\n\n // Presence drives the ARIA relationships on Content — a Title can appear\n // or disappear at any time, open or closed.\n useEffect(() => {\n setParts(parts => (parts.title ? parts : { ...parts, title: true }))\n return () =>\n setParts(parts => (parts.title ? { ...parts, title: false } : parts))\n }, [setParts])\n\n return (\n <Primitive.h2\n {...props}\n id={ids.title}\n asChild={asChild}\n ref={forwardedRef}\n />\n )\n }\n)\n","// <Description> — the dialog's accessible description.\nimport React, { forwardRef, useEffect } from 'react'\nimport type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nimport { useDialogContext } from './context'\n\nexport interface DescriptionProps extends ComponentProps<typeof Primitive.p> {}\n\nexport const Description = forwardRef<HTMLParagraphElement, DescriptionProps>(\n ({ asChild = false, ...props }, forwardedRef) => {\n const { ids, setParts } = useDialogContext()\n\n // Presence drives the ARIA relationships on Content — a Description can\n // appear or disappear at any time, open or closed.\n useEffect(() => {\n setParts(parts =>\n parts.description ? parts : { ...parts, description: true }\n )\n return () =>\n setParts(parts =>\n parts.description ? { ...parts, description: false } : parts\n )\n }, [setParts])\n\n return (\n <Primitive.p\n {...props}\n id={ids.description}\n asChild={asChild}\n ref={forwardedRef}\n />\n )\n }\n)\n","// <Close> — the visible in-dialog close affordance.\nimport React, { forwardRef } from 'react'\nimport type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { composeHandlers, mergeRefs } from '@mirohq/design-system-utils'\n\nimport { useDialogContext } from './context'\n\nexport interface CloseProps extends ComponentProps<typeof Primitive.button> {}\n\nexport const Close = forwardRef<HTMLButtonElement, CloseProps>(\n ({ asChild = false, ...props }, forwardedRef) => {\n const { close, closeRef } = useDialogContext()\n const consumer = composeHandlers(\n { onClick: close },\n asChild ? props : { type: 'button' as const, ...props }\n )\n\n return (\n <Primitive.button\n {...consumer}\n asChild={asChild}\n // Registered so the focus containment keeps it the cycle's last stop\n // wherever it renders.\n ref={mergeRefs([closeRef, forwardedRef])}\n />\n )\n }\n)\n","// useDialog — imperative access to the nearest <Dialog> root from anywhere in\n// its subtree: the same state a part reads, plus open/close/toggle.\nimport { useDialogContext } from './context'\nimport type { DialogState } from './types'\n\nexport interface UseDialogResult {\n id: string\n isOpen: boolean\n state: DialogState\n modal: boolean\n open: () => void\n close: () => void\n toggle: () => void\n}\n\nexport const useDialog = (): UseDialogResult => {\n const context = useDialogContext()\n\n return {\n id: context.id,\n isOpen: context.open,\n state: context.state,\n modal: context.modal,\n // Idempotent: toggle() would close an already-open dialog.\n open: () => {\n if (!context.open) context.toggle()\n },\n close: context.close,\n toggle: context.toggle,\n }\n}\n","// Must stay under the exit-watch fallback ceiling (500ms), or a closing\n// dialog would be cut short instead of finishing its animation.\nexport const ANIMATION_DURATION = '250ms'\n\nexport const MOTION = '@media (prefers-reduced-motion: no-preference)'\n","import { keyframes, styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nimport { Backdrop as BackdropPrimitive } from '../primitive'\nimport { ANIMATION_DURATION, MOTION } from '../styles/animation'\n\nconst fadeIn = keyframes({\n from: { opacity: 0 },\n to: { opacity: 1 },\n})\n\nconst fadeOut = keyframes({\n from: { opacity: 1 },\n to: { opacity: 0 },\n})\n\nexport const Backdrop = styled(BackdropPrimitive, {\n position: 'fixed',\n inset: 0,\n zIndex: '$dialog',\n backgroundColor: '$background-alpha-neutrals-overlay',\n // A scoped dialog (Portal container) pins to the container, not the page.\n '&[data-scoped]': {\n position: 'absolute',\n },\n\n [MOTION]: {\n animation: `${fadeIn} ${ANIMATION_DURATION} ease-out`,\n // `forwards` holds the final frame until the unmount lands.\n '&[data-state=\"closing\"]': {\n animation: `${fadeOut} ${ANIMATION_DURATION} ease-out forwards`,\n },\n },\n})\nexport type BackdropProps = StrictComponentProps<typeof Backdrop>\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nimport { Close as ClosePrimitive } from '../primitive'\n\n// Positioning only: the corner pin is the dialog's anatomy; the button's\n// visual comes from what the consumer composes in (typically an IconButton\n// via `asChild`).\nexport const Close = styled(ClosePrimitive, {\n position: 'absolute',\n top: '$300',\n right: '$300',\n})\nexport type CloseProps = StrictComponentProps<typeof Close>\n","import type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nimport {\n Description as DescriptionPrimitive,\n Title as TitlePrimitive,\n} from '../primitive'\n\n// The window owns the default inset; each part escapes it with negative\n// margins and lays its spec'd box with its own padding, so the parts sit\n// edge to edge while bare content stays padded.\n\nexport const Banner = styled(Primitive.div, {\n margin: '-$500 -$500 0',\n // The floor yields on short screens (text zoom, 400% reflow): the media\n // must not eat the space the title and actions need.\n minHeight: 'min(300px, 40vh)',\n borderTopLeftRadius: '$100',\n borderTopRightRadius: '$100',\n overflow: 'hidden',\n backgroundColor: '$background-primary-subtle',\n // Media dropped in fills the slot with no hand-made styles.\n '& > img, & > video': {\n display: 'block',\n width: '100%',\n height: '100%',\n objectFit: 'contain',\n },\n})\nexport type BannerProps = ComponentProps<typeof Banner>\n\nexport const Title = styled(TitlePrimitive, {\n fontFamily: '$heading',\n fontSize: '$300',\n lineHeight: 1.35,\n fontWeight: 400,\n fontFeatureSettings: \"'ss01'\",\n padding: '$400 $1200 $100 $500',\n margin: '-$500 -$500 0',\n // A banner before it already consumed the window's top inset, so the title\n // must not escape it a second time.\n [`${Banner} ~ &`]: {\n marginTop: 0,\n },\n})\nexport type TitleProps = ComponentProps<typeof Title>\n\nexport const Description = styled(DescriptionPrimitive, {\n fontFamily: '$body',\n fontSize: '$200',\n lineHeight: 1.5,\n padding: '$200 $500',\n margin: '0 -$500',\n // As the last part, its own $200 plus the window's $500 would overshoot\n // the $500 closing inset.\n '&:last-child': {\n marginBottom: '-$200',\n },\n})\nexport type DescriptionProps = ComponentProps<typeof Description>\n\nexport const Actions = styled(Primitive.div, {\n display: 'flex',\n gap: '$100',\n // The window's inset supplies the $500 closing edge below the row.\n padding: '$200 $500 0',\n margin: '0 -$500',\n})\nexport type ActionsProps = ComponentProps<typeof Actions>\n","import React, { forwardRef } from 'react'\nimport type { ElementRef, RefObject } from 'react'\nimport { keyframes, styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nimport {\n Content as ContentPrimitive,\n Viewport as ViewportPrimitive,\n} from '../primitive'\nimport { Actions, Banner, Description, Title } from './parts'\nimport { Close } from './close'\nimport { ANIMATION_DURATION, MOTION } from '../styles/animation'\n\nconst scaleIn = keyframes({\n from: { opacity: 0, transform: 'scale(0.8)' },\n to: { opacity: 1, transform: 'scale(1)' },\n})\n\nconst scaleOut = keyframes({\n from: { opacity: 1, transform: 'scale(1)' },\n to: { opacity: 0, transform: 'scale(0.8)' },\n})\n\nconst StyledViewport = styled(ViewportPrimitive, {\n position: 'fixed',\n inset: 0,\n zIndex: '$dialog',\n display: 'flex',\n overflow: 'auto',\n padding: '$300',\n '&[data-scoped]': {\n position: 'absolute',\n },\n '&[data-full-screen]': {\n padding: 0,\n },\n '&:not([data-modal])': {\n pointerEvents: 'none',\n },\n})\n\nconst StyledContent = styled(ContentPrimitive, {\n position: 'relative',\n margin: 'auto',\n boxSizing: 'border-box',\n width: 'fit-content',\n // The floors yield to the screen: WCAG 1.4.10 reflow requires the window\n // to fit a 320px viewport (400% zoom), so neither bound may exceed the\n // layer's width.\n minWidth: 'min(560px, 100%)',\n maxWidth: 'min(960px, 100%)',\n backgroundColor: '$background-neutrals',\n color: '$text-neutrals',\n borderRadius: '$100',\n boxShadow: '$elevation-300',\n overflowWrap: 'break-word',\n outline: 'none',\n // The window stays interactive when its (non-modal) layer stops\n // intercepting presses.\n pointerEvents: 'auto',\n padding: '$500',\n\n [`&:has(${Title})`]: {\n paddingTop: 0,\n [`& ${Banner}`]: { marginTop: 0 },\n [`& ${Title}`]: { marginTop: 0 },\n },\n [`&:has(${Actions})`]: {\n paddingBottom: 0,\n [`& ${Actions}`]: { paddingBottom: '$500' },\n [`& ${Description}:last-child`]: { marginBottom: 0, paddingBottom: '$500' },\n },\n\n [MOTION]: {\n animation: `${scaleIn} ${ANIMATION_DURATION} ease-out`,\n '&[data-state=\"closing\"]': {\n animation: `${scaleOut} ${ANIMATION_DURATION} ease-out forwards`,\n },\n },\n\n variants: {\n scroll: {\n viewport: {},\n window: {\n maxHeight: '100%',\n overflow: 'auto',\n [`& ${Title}`]: {\n position: 'sticky',\n top: 0,\n backgroundColor: '$background-neutrals',\n },\n [`& ${Close}`]: {\n position: 'sticky',\n top: '$300',\n right: 'auto',\n float: 'right',\n marginRight: '-$200',\n zIndex: 1,\n },\n [`& ${Banner}`]: {\n overflow: 'visible',\n },\n },\n },\n\n flat: {\n true: {\n padding: 0,\n overflow: 'hidden',\n [`& ${Banner}`]: { margin: 0 },\n [`& ${Title}`]: { margin: 0 },\n [`& ${Description}`]: { margin: 0 },\n [`& ${Description}:last-child`]: { paddingBottom: '$500' },\n [`& ${Actions}`]: { margin: 0, paddingBottom: '$500' },\n },\n },\n\n fullScreen: {\n true: {\n width: '100%',\n height: '100%',\n minWidth: 0,\n maxWidth: 'none',\n margin: 0,\n borderRadius: 0,\n },\n },\n },\n\n compoundVariants: [\n {\n flat: true,\n scroll: 'window',\n css: { overflow: 'auto' },\n },\n ],\n\n defaultVariants: {\n scroll: 'viewport',\n },\n})\n\nexport interface ContentProps\n extends StrictComponentProps<typeof StyledContent> {\n /** The element to focus when the dialog opens. @default the dialog window */\n initialFocus?: RefObject<HTMLElement>\n}\n\nexport const Content = forwardRef<\n ElementRef<typeof StyledContent>,\n ContentProps\n>(({ fullScreen, ...props }, forwardedRef) => (\n <StyledViewport fullScreen={fullScreen === true}>\n <StyledContent {...props} fullScreen={fullScreen} ref={forwardedRef} />\n </StyledViewport>\n))\n","import { Portal as PortalPrimitive } from '../primitive'\nimport type { PortalProps as PortalPrimitiveProps } from '../primitive'\n\n// Unstyled part — passes straight through to the primitive.\nexport interface PortalProps extends PortalPrimitiveProps {}\nexport const Portal = PortalPrimitive\n","import { Trigger as TriggerPrimitive } from '../primitive'\nimport type { TriggerProps as TriggerPrimitiveProps } from '../primitive'\n\n// Unstyled part — passes straight through to the primitive.\nexport interface TriggerProps extends TriggerPrimitiveProps {}\nexport const Trigger = TriggerPrimitive\n","import React from 'react'\nimport type { ReactNode } from 'react'\n\nimport type { DialogOptions } from './primitive'\nimport { Root } from './primitive'\nimport { Backdrop } from './partials/backdrop'\nimport { Close } from './partials/close'\nimport { Content } from './partials/content'\nimport { Actions, Banner, Description, Title } from './partials/parts'\nimport { Portal } from './partials/portal'\nimport { Trigger } from './partials/trigger'\n\nexport interface DialogProps extends DialogOptions {\n children?: ReactNode\n}\n\n// The root owns the open state and renders no DOM.\nexport const Dialog: ((props: DialogProps) => ReactNode) & Parts = props => (\n <Root {...props} />\n)\n\n// Parts\n// -----------------------------------------------------------------------------\n\nexport interface Parts {\n Trigger: typeof Trigger\n Portal: typeof Portal\n Backdrop: typeof Backdrop\n Content: typeof Content\n Banner: typeof Banner\n Title: typeof Title\n Description: typeof Description\n Actions: typeof Actions\n Close: typeof Close\n}\n\nDialog.Trigger = Trigger\nDialog.Portal = Portal\nDialog.Backdrop = Backdrop\nDialog.Content = Content\nDialog.Banner = Banner\nDialog.Title = Title\nDialog.Description = Description\nDialog.Actions = Actions\nDialog.Close = Close\n"],"names":["createContext","useContext","useId","useState","useRef","useEffect","_a","_b","isTopmostLayer","useBrowserNavigation","jsx","Trigger","forwardRef","composeHandlers","Primitive","mergeRefs","Portal","createPortal","Backdrop","Content","useOverlay","useOverlayExit","useScrollLock","useFocusTrap","Title","Description","Close","keyframes","styled","BackdropPrimitive","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AU,OAAA;AACjB,MAAA,CAAO,KAAA,GAAQ,KAAA;;;;;"}
1
+ {"version":3,"file":"main.js","sources":["../src/primitive/context.tsx","../src/primitive/inner-overlay.ts","../src/primitive/root.tsx","../src/primitive/trigger.tsx","../src/primitive/portal.tsx","../src/primitive/backdrop.tsx","../src/primitive/viewport.tsx","../src/primitive/content.tsx","../src/primitive/title.tsx","../src/primitive/description.tsx","../src/primitive/close.tsx","../src/primitive/use-dialog.ts","../src/styles/animation.ts","../src/partials/backdrop.tsx","../src/partials/close.tsx","../src/partials/parts.tsx","../src/partials/content.tsx","../src/partials/portal.tsx","../src/partials/trigger.tsx","../src/dialog.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { Dispatch, RefObject, SetStateAction } from 'react'\n\nimport type { DialogRole, DialogState } from './types'\n\n/**\n * The cross-part ids, derived from the one base id so the trigger's\n * aria-controls, the Content's id, and the labelledby/describedby always\n * agree.\n */\nexport interface DialogIds {\n content: string\n title: string\n description: string\n}\n\n// Which optional parts are currently present: Content only references the\n// rendered Title/Description.\nexport interface PartsPresence {\n title: boolean\n description: boolean\n}\n\nexport interface DialogContextValue {\n state: DialogState\n open: boolean\n /** Whether the dialog occupies the tree: open or mid-exit (`closing`) — the\n * Portal's unmount gate. */\n mounted: boolean\n modal: boolean\n role: DialogRole\n id: string\n ids: DialogIds\n // Nesting level (1 = top-level). Decides the topmost dialog of a stack for\n // Escape, focus, and assistive-tech containment.\n depth: number\n // The element the Portal teleported into, or null for the page body —\n // Content scopes the scroll lock to it. The root provides null; Portal\n // re-provides the context with the field filled in.\n container: HTMLElement | null\n // The rendered Backdrop element, shared because Backdrop and Content are\n // sibling layers: Content's stack entry excepts its own backdrop from the\n // containment so it stays pressable while its dialog is topmost.\n backdropRef: RefObject<HTMLDivElement>\n // The rendered Trigger element — the close's focus-restore fallback when\n // nothing was focused before opening (a pointer press leaves focus on the\n // body: the DS Button suppresses mousedown's native focus).\n triggerRef: RefObject<HTMLButtonElement>\n // The rendered Close element — how the focus containment keeps the part\n // the cycle's last stop (an id would duplicate if Close ever doubled).\n closeRef: RefObject<HTMLButtonElement>\n parts: PartsPresence\n setParts: Dispatch<SetStateAction<PartsPresence>>\n toggle: () => void\n close: () => void\n interactOutside: (event: MouseEvent) => void\n exitComplete: () => void\n}\n\nexport const DialogContext = createContext<DialogContextValue | undefined>(\n undefined\n)\n\nexport const useDialogContext = (): DialogContextValue => {\n const context = useContext(DialogContext)\n if (context === undefined) {\n throw new Error('Dialog parts must be rendered within a <Dialog> root')\n }\n return context\n}\n","// A popup opened inside the dialog — the DS Select, Popover, DropdownMenu or\n// Combobox, a product's own dropdown, a third-party picker — owns the keyboard\n// while it holds focus, and most of them never register in the shared layer\n// stack, so `isTopmostLayer` still names the dialog. Ownership is read from\n// where focus is instead: the ARIA popup roles (`aria-haspopup`'s values) mark\n// the layer focus sits in, and the stack tells a registered layer from a\n// popup that never registered. Cooperation is not required — any well-formed\n// ARIA popup works.\nimport { isLayerElement } from '@mirohq/design-system-use-overlay'\n\nconst POPUP_SELECTOR =\n '[role=\"listbox\"], [role=\"menu\"], [role=\"tree\"], [role=\"grid\"], ' +\n '[role=\"dialog\"], [role=\"alertdialog\"]'\n\n/**\n * Focus sits in a popup that is neither the dialog window nor a registered\n * layer — an open Select listbox, a Popover, a menu — wherever it renders,\n * inside the window or portalled out of it. The body (focus in browser\n * chrome, or nowhere) doesn't count: the dialog re-enters from there.\n */\nexport function innerOverlayHoldsFocus(content: Element | null): boolean {\n if (content === null) return false\n const active = document.activeElement\n if (active === null || active === document.body) return false\n const popup = active.closest(POPUP_SELECTOR)\n if (popup === null) return !content.contains(active)\n return popup !== content && !isLayerElement(popup)\n}\n\n/**\n * Focus sits on a control inside the window whose popup is expanded — a\n * combobox keeps focus on its input while its list is open — so the popup\n * owns Escape. `aria-expanded` alone isn't enough: a disclosure or accordion\n * trigger is expanded too and has no popup to close, so `aria-haspopup` must\n * name one.\n */\nexport function focusIsOnExpandedPopupControl(\n content: Element | null\n): boolean {\n if (content === null) return false\n const active = document.activeElement\n if (active === null || !content.contains(active)) return false\n if (active.getAttribute('aria-expanded') !== 'true') return false\n const popup = active.getAttribute('aria-haspopup')\n return popup !== null && popup !== 'false'\n}\n","// <Root> — owns the open state and renders no DOM.\nimport React, { useContext, useEffect, useRef, useState } from 'react'\nimport type { ReactNode } from 'react'\nimport { useId } from '@mirohq/design-system-use-id'\nimport { useBrowserNavigation } from '@mirohq/design-system-use-browser-navigation'\nimport { isTopmostLayer } from '@mirohq/design-system-use-overlay'\n\nimport { DialogContext } from './context'\nimport type { PartsPresence } from './context'\nimport {\n focusIsOnExpandedPopupControl,\n innerOverlayHoldsFocus,\n} from './inner-overlay'\nimport type { BackNavigationPayload, DialogOptions, DialogState } from './types'\n\nexport interface RootProps extends DialogOptions {\n children?: ReactNode\n}\n\nexport const Root = ({ children, ...options }: RootProps): ReactNode => {\n // Nesting derives from the parent dialog's context (undefined = top-level).\n const depth = (useContext(DialogContext)?.depth ?? 0) + 1\n const generatedId = useId()\n // `?? generatedId`: an explicit `id={undefined}` must not knock out the\n // fallback — ids also key the dialog stack, so they must exist.\n const id = options.id ?? generatedId\n const role = options.role ?? 'dialog'\n // An alert dialog is modal by definition (APG): the prop can't opt out.\n const modal = role === 'alertdialog' || (options.modal ?? true)\n const animated = options.animated === true\n\n const controlled = options.open !== undefined\n const [uncontrolledOpen, setUncontrolledOpen] = useState(\n options.defaultOpen === true\n )\n const open = controlled ? options.open === true : uncontrolledOpen\n\n // Controlled-ness follows the prop live: mirroring the prop keeps the\n // uncontrolled value current, so dropping the prop hands the state back\n // right where it stands.\n if (controlled && uncontrolledOpen !== open) setUncontrolledOpen(open)\n\n // The exit window: only an `animated` close passes through `closing`, and\n // reopening interrupts it. Adjusted during render — an effect would let an\n // unmounted frame slip between the close and the exit.\n const [exiting, setExiting] = useState(false)\n const previousOpen = useRef(open)\n if (previousOpen.current !== open) {\n previousOpen.current = open\n if (open) {\n if (exiting) setExiting(false)\n } else if (animated) {\n setExiting(true)\n }\n }\n\n const state: DialogState = open ? 'open' : exiting ? 'closing' : 'closed'\n\n // Read through a ref so the document-level listeners and the history guard\n // follow the open state alone — fresh callback identities must not re-bind\n // listeners or churn real session-history entries.\n const optionsRef = useRef(options)\n optionsRef.current = options\n\n // onOpenChange reports once per transition-or-intent: every interaction\n // that asks for a different value reports it immediately — a controlled\n // dialog stays put, but the ask is not silent (`open` + `onOpenChange`\n // works on its own, like the Radix-based overlays) — and a change the\n // prop drives by itself reports from the effect. The already-reported\n // check keeps a granted intent from echoing when the prop answers it.\n // No call on mount.\n const reportedOpen = useRef(open)\n const resolvedOpen = useRef(open)\n useEffect(() => {\n if (resolvedOpen.current === open) return\n resolvedOpen.current = open\n if (reportedOpen.current === open) return\n reportedOpen.current = open\n optionsRef.current.onOpenChange?.(open)\n })\n\n const setOpen = (next: boolean): void => {\n if (open === next) return\n reportedOpen.current = next\n optionsRef.current.onOpenChange?.(next)\n // A controlled dialog never moves on its own — the consumer decides at\n // the source (this report and the dismissal callbacks) and answers\n // through the prop.\n if (!controlled) setUncontrolledOpen(next)\n }\n\n // Escape is a document-level concern, not a part's — it must work wherever\n // focus is. The handler lives on a ref so the listener binds per open\n // window, not per render; a `closing` dialog has already detached it.\n const onEscapeRef = useRef<(event: KeyboardEvent) => void>(() => {})\n onEscapeRef.current = (event: KeyboardEvent): void => {\n // Only the topmost dialog answers Escape — a nested stack closes one\n // layer at a time — and an inner overlay holding focus answers first.\n if (!isTopmostLayer(id)) return\n const content = document.getElementById(`${id}-content`)\n if (\n innerOverlayHoldsFocus(content) ||\n focusIsOnExpandedPopupControl(content)\n ) {\n return\n }\n optionsRef.current.onEscapeKeyDown?.(event)\n if (event.defaultPrevented) return\n if (optionsRef.current.closeOnEscape === false) return\n setOpen(false)\n }\n\n useEffect(() => {\n if (!open) return\n const onKeyDown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') onEscapeRef.current(event)\n }\n document.addEventListener('keydown', onKeyDown, true)\n return () => document.removeEventListener('keydown', onKeyDown, true)\n }, [open])\n\n // closeOnBack: while open, a guard entry in the session history turns the\n // host's Back into a dismissal instead of a navigation — and the entry a\n // Back press spends survives in the forward stack, so the host's Forward\n // reopens what Back closed. It lives on the root — the guard concerns the\n // dialog's openness, not any rendered part.\n const onBackRef = useRef<() => boolean>(() => false)\n onBackRef.current = (): boolean => {\n // The host's back has no cancelable event — synthesize the veto payload\n // so the callback contract matches the other dismissals.\n const payload: BackNavigationPayload = {\n defaultPrevented: false,\n preventDefault() {\n payload.defaultPrevented = true\n },\n }\n optionsRef.current.onBackNavigation?.(payload)\n if (payload.defaultPrevented === true) return false\n // A controlled dialog only records the request (onOpenChange reports the\n // intent) — the consumer follows through the prop, and the guard re-arms\n // until it does.\n setOpen(false)\n return !controlled\n }\n\n // `backNavigate`'s mirror, decided the same way — and reachable from the\n // animated `closing` state too: Forward interrupts the exit.\n const onForwardRef = useRef<() => boolean>(() => false)\n onForwardRef.current = (): boolean => {\n const payload: BackNavigationPayload = {\n defaultPrevented: false,\n preventDefault() {\n payload.defaultPrevented = true\n },\n }\n optionsRef.current.onForwardNavigation?.(payload)\n if (payload.defaultPrevented === true) return false\n if (optionsRef.current.closeOnBack !== true) return false\n setOpen(true)\n return !controlled\n }\n\n useBrowserNavigation({\n enabled: options.closeOnBack === true,\n open,\n onBack: () => onBackRef.current(),\n onForward: () => onForwardRef.current(),\n // The dialog's nesting depth is what a returning dialog recognizes its\n // own spent entry by: the instance is new after a remount, but the\n // position in the stack is the same.\n claim: `dialog:${depth}`,\n })\n\n // A press that starts inside the dialog window never counts as outside,\n // wherever it releases: a text-selection drag out of the window dispatches\n // its click on the layer around it (a click targets the press's and the\n // release's common ancestor), so the click's target alone can't tell a\n // dismissal from a drag. Each press records its origin instead.\n const insidePressRef = useRef(false)\n useEffect(() => {\n if (!open) return\n const contentId = `${id}-content`\n const onPointerDown = (event: Event): void => {\n const content = document.getElementById(contentId)\n insidePressRef.current =\n content !== null &&\n event.target instanceof Node &&\n content.contains(event.target)\n }\n document.addEventListener('pointerdown', onPointerDown, true)\n return () =>\n document.removeEventListener('pointerdown', onPointerDown, true)\n }, [open, id])\n\n const interactOutside = (event: MouseEvent): void => {\n if (insidePressRef.current) return\n // An outside press is an intent, not a close command: the consumer may\n // veto it, and the role's dismissal setting gates it — an alert dialog\n // interrupts for a response, so it doesn't dismiss unless opted in.\n options.onInteractOutside?.(event)\n if (event.defaultPrevented) return\n if (!(options.closeOnInteractOutside ?? role === 'dialog')) return\n setOpen(false)\n }\n const interactOutsideRef = useRef(interactOutside)\n interactOutsideRef.current = interactOutside\n\n const backdropRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const closeRef = useRef<HTMLButtonElement>(null)\n\n // A non-modal dialog coexists with the page: no layer intercepts the\n // press, so the outside interaction is read from the document. Presses\n // inside the window are inside; the trigger's own press stays a plain\n // toggle — counting it as outside would close and immediately reopen.\n useEffect(() => {\n if (!open || modal) return\n const contentId = `${id}-content`\n const onClick = (event: MouseEvent): void => {\n if (!isTopmostLayer(id)) return\n if (!(event.target instanceof Node)) return\n if (document.getElementById(contentId)?.contains(event.target) === true)\n return\n if (triggerRef.current?.contains(event.target) === true) return\n interactOutsideRef.current(event)\n }\n document.addEventListener('click', onClick)\n return () => document.removeEventListener('click', onClick)\n }, [open, modal, id])\n\n const [parts, setParts] = useState<PartsPresence>({\n title: false,\n description: false,\n })\n\n return (\n <DialogContext.Provider\n value={{\n state,\n open,\n mounted: state !== 'closed',\n modal,\n role,\n id,\n ids: {\n content: `${id}-content`,\n title: `${id}-title`,\n description: `${id}-description`,\n },\n depth,\n container: null,\n backdropRef,\n triggerRef,\n closeRef,\n parts,\n setParts,\n toggle: () => setOpen(!open),\n close: () => setOpen(false),\n interactOutside,\n exitComplete: () => setExiting(false),\n }}\n >\n {children}\n </DialogContext.Provider>\n )\n}\n","// <Trigger> — toggles the dialog; focus returns here on close.\nimport React, { forwardRef } from 'react'\nimport type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { composeHandlers, mergeRefs } from '@mirohq/design-system-utils'\n\nimport { useDialogContext } from './context'\n\nexport interface TriggerProps extends ComponentProps<typeof Primitive.button> {}\n\nexport const Trigger = forwardRef<HTMLButtonElement, TriggerProps>(\n ({ asChild = false, ...props }, forwardedRef) => {\n const { open, state, ids, toggle, triggerRef } = useDialogContext()\n const consumer = composeHandlers(\n { onClick: toggle },\n asChild ? props : { type: 'button' as const, ...props }\n )\n\n return (\n <Primitive.button\n {...consumer}\n aria-haspopup='dialog'\n aria-expanded={open}\n // A dangling aria-controls id is an a11y defect — only while open.\n aria-controls={open ? ids.content : undefined}\n data-state={state}\n asChild={asChild}\n ref={mergeRefs([triggerRef, forwardedRef])}\n />\n )\n }\n)\n","// <Portal> — teleports the layers out of the tree while open.\nimport React from 'react'\nimport type { ReactNode } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { DialogContext, useDialogContext } from './context'\n\nexport interface PortalProps {\n children?: ReactNode\n /** The element to portal into. @default document.body */\n container?: HTMLElement | null\n}\n\nexport const Portal = ({ children, container }: PortalProps): ReactNode => {\n const context = useDialogContext()\n // `mounted`, not `open`: an animated dialog stays in the tree through\n // `closing` so its exit visual can play before everything unmounts.\n if (!context.mounted || typeof document === 'undefined') return null\n // Re-provide the context with the scoped container (null = page body) so\n // Content locks the right scroll surface.\n return createPortal(\n <DialogContext.Provider\n value={{ ...context, container: container ?? null }}\n >\n {children}\n </DialogContext.Provider>,\n container ?? document.body\n )\n}\n","// <Backdrop> — the layer behind the dialog window.\nimport React, { forwardRef } from 'react'\nimport type { ComponentProps, MouseEvent } from 'react'\nimport { composeHandlers, mergeRefs } from '@mirohq/design-system-utils'\nimport { isTopmostLayer } from '@mirohq/design-system-use-overlay'\n\nimport { useDialogContext } from './context'\n\nexport interface BackdropProps extends ComponentProps<'div'> {}\n\nexport const Backdrop = forwardRef<HTMLDivElement, BackdropProps>(\n (props, forwardedRef) => {\n const { modal, state, id, container, backdropRef, interactOutside } =\n useDialogContext()\n\n // Only a modal dialog dims the page — non-modal coexists with it.\n if (!modal) return null\n\n const consumer = composeHandlers(\n {\n // Only the topmost dialog of a stack answers an outside press.\n onClick: (event: MouseEvent<HTMLElement>) => {\n if (isTopmostLayer(id)) interactOutside(event.nativeEvent)\n },\n },\n props\n )\n\n return (\n // role=presentation: the backdrop is a purely visual layer; its press\n // is the pointer half of an outside dismissal, with Escape as the\n // keyboard path (jsx-a11y's keyboard pairing doesn't apply).\n <div\n role='presentation'\n {...consumer}\n data-state={state}\n // A scoped dialog (Portal container) pins to the container, not the\n // page — the styled layer switches positioning on this attribute.\n data-scoped={container === null ? undefined : ''}\n ref={mergeRefs([backdropRef, forwardedRef])}\n />\n )\n }\n)\n","// <Viewport> — the positioning + scroll layer around the dialog window.\nimport React, { forwardRef } from 'react'\nimport type { ComponentProps, MouseEvent } from 'react'\nimport { composeHandlers } from '@mirohq/design-system-utils'\nimport { isTopmostLayer } from '@mirohq/design-system-use-overlay'\n\nimport { useDialogContext } from './context'\n\nexport interface ViewportProps extends ComponentProps<'div'> {\n /** Marks the layer full-screen: the window fills it edge to edge, so the\n * layer drops its own inset. @default false */\n fullScreen?: boolean\n}\n\nexport const Viewport = forwardRef<HTMLDivElement, ViewportProps>(\n ({ fullScreen, ...props }, forwardedRef) => {\n const { state, id, modal, container, interactOutside } = useDialogContext()\n\n const consumer = composeHandlers(\n {\n // Box presses bubble up here — only a press that started on the\n // viewport itself is an outside interaction, and only the topmost\n // dialog of a stack answers it.\n onClick: (event: MouseEvent<HTMLElement>) => {\n if (event.target !== event.currentTarget) return\n if (!isTopmostLayer(id)) return\n interactOutside(event.nativeEvent)\n },\n },\n props\n )\n\n return (\n // role=presentation: a purely presentational positioning wrapper — the\n // press it answers is the pointer half of an outside dismissal, with\n // Escape as the keyboard path.\n <div\n role='presentation'\n {...consumer}\n data-state={state}\n // A scoped dialog (Portal container) pins to the container, not the\n // page — the styled layer switches positioning on this attribute.\n data-scoped={container === null ? undefined : ''}\n // A non-modal dialog coexists with the page — without this marker the\n // styled layer stops intercepting pointer presses.\n data-modal={modal ? '' : undefined}\n // A full-screen window fills the layer edge to edge — the styled\n // layer drops its inset on this attribute.\n data-full-screen={fullScreen === true ? '' : undefined}\n ref={forwardedRef}\n />\n )\n }\n)\n","// <Content> — the dialog window: focus moves in on open, restores on close,\n// traps while modal.\nimport React, { forwardRef, useEffect, useRef } from 'react'\nimport type { ComponentProps, RefObject } from 'react'\nimport { mergeRefs } from '@mirohq/design-system-utils'\nimport { useFocusTrap } from '@mirohq/design-system-use-focus-trap'\nimport { useScrollLock } from '@mirohq/design-system-use-scroll-lock'\nimport {\n isTopmostLayer,\n useOverlay,\n useOverlayExit,\n} from '@mirohq/design-system-use-overlay'\n\nimport { useDialogContext } from './context'\nimport { innerOverlayHoldsFocus } from './inner-overlay'\n\nexport interface ContentProps extends ComponentProps<'div'> {\n /** The element to focus when the dialog opens. @default the dialog window */\n initialFocus?: RefObject<HTMLElement>\n}\n\nexport const Content = forwardRef<HTMLDivElement, ContentProps>(\n ({ initialFocus, ...props }, forwardedRef) => {\n const {\n state,\n open,\n modal,\n role,\n id,\n ids,\n depth,\n container,\n backdropRef,\n triggerRef,\n closeRef,\n parts,\n exitComplete,\n } = useDialogContext()\n const contentRef = useRef<HTMLDivElement>(null)\n\n // The open window: the stack entry, containment, initial focus, and the\n // focus restore — released the moment a close starts, not when the exit\n // visual finishes.\n useOverlay(contentRef, {\n enabled: open,\n id,\n depth,\n modal,\n backdrop: () => backdropRef.current,\n initialFocus,\n // A pointer press opens without focusing the trigger (the DS Button\n // suppresses mousedown's native focus), so the close would find only\n // the body to restore to — fall back to the trigger, the invoker APG\n // says focus returns to.\n restoreFocus: () => triggerRef.current,\n })\n\n // The exit window: a Content rendered while not open only happens in\n // `closing` — the still-painting layer leaves the page's interaction and\n // its finished visual reports the unmount.\n useOverlayExit(contentRef, {\n exiting: !open,\n boundary: container,\n backdrop: () => backdropRef.current,\n onExitComplete: exitComplete,\n })\n\n // The lock spans the whole mount — through `closing` too: releasing it\n // mid-exit would bring the scrollbar back and reflow the page under the\n // still-painting layer. A scoped dialog locks its portal container; a\n // page dialog locks the body. The context's `null` container means the\n // page body — the hook's default — not its \"no target yet\".\n useScrollLock(modal, container ?? undefined)\n\n useFocusTrap(contentRef, {\n // Only a modal dialog traps, and only while topmost — a nested dialog\n // owns focus while open, and so does an inner overlay that holds it.\n enabled: () =>\n modal &&\n isTopmostLayer(id) &&\n !innerOverlayHoldsFocus(contentRef.current),\n // The Close part is the cycle's last stop wherever it renders (SPEC).\n last: () => closeRef.current,\n })\n\n // The constraint is \"never neither\": a rendered Title or an accessible\n // label on the window. Read from the DOM — it is committed before this\n // effect, while the Title's presence registration is not, and a label\n // arriving through any prop spread counts too.\n useEffect(() => {\n if (!open) return\n const element = contentRef.current\n if (element === null) return\n const named =\n parts.title ||\n document.getElementById(ids.title) !== null ||\n element.hasAttribute('aria-label') ||\n element.hasAttribute('aria-labelledby')\n if (!named) {\n console.warn(\n '[Dialog] the dialog resolves no accessible name: render a ' +\n '<Dialog.Title>, or give Content an aria-label when it truly ' +\n 'cannot have one.'\n )\n }\n // APG makes the description mandatory for an alert dialog only.\n if (role !== 'alertdialog') return\n const described =\n parts.description ||\n document.getElementById(ids.description) !== null ||\n element.hasAttribute('aria-describedby')\n if (!described) {\n console.warn(\n '[Dialog] the alert dialog resolves no accessible description: ' +\n 'render a <Dialog.Description>, or give Content an ' +\n 'aria-describedby.'\n )\n }\n }, [open, role, parts.title, parts.description, ids.title, ids.description])\n\n // The ARIA relationships always follow what is rendered — an omitted part\n // never leaves a dangling reference, and a consumer-supplied value wins\n // over the derived one.\n const labelling: Record<string, string> = {}\n if (parts.title && props['aria-labelledby'] == null) {\n labelling['aria-labelledby'] = ids.title\n }\n if (parts.description && props['aria-describedby'] == null) {\n labelling['aria-describedby'] = ids.description\n }\n\n return (\n // A neutral element with the role, not <dialog>: the window is the\n // initial focus target, so it carries tabindex — which HTML forbids on\n // <dialog> — and the native element only pays off via showModal(),\n // which this contract deliberately doesn't use.\n <div\n {...props}\n {...labelling}\n role={role}\n id={ids.content}\n aria-modal={modal || undefined}\n // The initial focus target: focusable in script, not in the tab order.\n tabIndex={-1}\n data-state={state}\n ref={mergeRefs([contentRef, forwardedRef])}\n />\n )\n }\n)\n","// <Title> — the dialog's accessible name.\nimport React, { forwardRef, useEffect } from 'react'\nimport type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nimport { useDialogContext } from './context'\n\nexport interface TitleProps extends ComponentProps<typeof Primitive.h2> {}\n\nexport const Title = forwardRef<HTMLHeadingElement, TitleProps>(\n ({ asChild = false, ...props }, forwardedRef) => {\n const { ids, setParts } = useDialogContext()\n\n // Presence drives the ARIA relationships on Content — a Title can appear\n // or disappear at any time, open or closed.\n useEffect(() => {\n setParts(parts => (parts.title ? parts : { ...parts, title: true }))\n return () =>\n setParts(parts => (parts.title ? { ...parts, title: false } : parts))\n }, [setParts])\n\n return (\n <Primitive.h2\n {...props}\n id={ids.title}\n asChild={asChild}\n ref={forwardedRef}\n />\n )\n }\n)\n","// <Description> — the dialog's accessible description.\nimport React, { forwardRef, useEffect } from 'react'\nimport type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nimport { useDialogContext } from './context'\n\nexport interface DescriptionProps extends ComponentProps<typeof Primitive.p> {}\n\nexport const Description = forwardRef<HTMLParagraphElement, DescriptionProps>(\n ({ asChild = false, ...props }, forwardedRef) => {\n const { ids, setParts } = useDialogContext()\n\n // Presence drives the ARIA relationships on Content — a Description can\n // appear or disappear at any time, open or closed.\n useEffect(() => {\n setParts(parts =>\n parts.description ? parts : { ...parts, description: true }\n )\n return () =>\n setParts(parts =>\n parts.description ? { ...parts, description: false } : parts\n )\n }, [setParts])\n\n return (\n <Primitive.p\n {...props}\n id={ids.description}\n asChild={asChild}\n ref={forwardedRef}\n />\n )\n }\n)\n","// <Close> — the visible in-dialog close affordance.\nimport React, { forwardRef } from 'react'\nimport type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { composeHandlers, mergeRefs } from '@mirohq/design-system-utils'\n\nimport { useDialogContext } from './context'\n\nexport interface CloseProps extends ComponentProps<typeof Primitive.button> {}\n\nexport const Close = forwardRef<HTMLButtonElement, CloseProps>(\n ({ asChild = false, ...props }, forwardedRef) => {\n const { close, closeRef } = useDialogContext()\n const consumer = composeHandlers(\n { onClick: close },\n asChild ? props : { type: 'button' as const, ...props }\n )\n\n return (\n <Primitive.button\n {...consumer}\n asChild={asChild}\n // Registered so the focus containment keeps it the cycle's last stop\n // wherever it renders.\n ref={mergeRefs([closeRef, forwardedRef])}\n />\n )\n }\n)\n","// useDialog — imperative access to the nearest <Dialog> root from anywhere in\n// its subtree: the same state a part reads, plus open/close/toggle.\nimport { useDialogContext } from './context'\nimport type { DialogState } from './types'\n\nexport interface UseDialogResult {\n id: string\n isOpen: boolean\n state: DialogState\n modal: boolean\n open: () => void\n close: () => void\n toggle: () => void\n}\n\nexport const useDialog = (): UseDialogResult => {\n const context = useDialogContext()\n\n return {\n id: context.id,\n isOpen: context.open,\n state: context.state,\n modal: context.modal,\n // Idempotent: toggle() would close an already-open dialog.\n open: () => {\n if (!context.open) context.toggle()\n },\n close: context.close,\n toggle: context.toggle,\n }\n}\n","// Must stay under the exit-watch fallback ceiling (500ms), or a closing\n// dialog would be cut short instead of finishing its animation.\nexport const ANIMATION_DURATION = '250ms'\n\nexport const MOTION = '@media (prefers-reduced-motion: no-preference)'\n","import { keyframes, styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nimport { Backdrop as BackdropPrimitive } from '../primitive'\nimport { ANIMATION_DURATION, MOTION } from '../styles/animation'\n\nconst fadeIn = keyframes({\n from: { opacity: 0 },\n to: { opacity: 1 },\n})\n\nconst fadeOut = keyframes({\n from: { opacity: 1 },\n to: { opacity: 0 },\n})\n\nexport const Backdrop = styled(BackdropPrimitive, {\n position: 'fixed',\n inset: 0,\n zIndex: '$dialog',\n backgroundColor: '$background-alpha-neutrals-overlay',\n // A scoped dialog (Portal container) pins to the container, not the page.\n '&[data-scoped]': {\n position: 'absolute',\n },\n\n [MOTION]: {\n animation: `${fadeIn} ${ANIMATION_DURATION} ease-out`,\n // `forwards` holds the final frame until the unmount lands.\n '&[data-state=\"closing\"]': {\n animation: `${fadeOut} ${ANIMATION_DURATION} ease-out forwards`,\n },\n },\n})\nexport type BackdropProps = StrictComponentProps<typeof Backdrop>\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nimport { Close as ClosePrimitive } from '../primitive'\n\n// Positioning only: the corner pin is the dialog's anatomy; the button's\n// visual comes from what the consumer composes in (typically an IconButton\n// via `asChild`).\nexport const Close = styled(ClosePrimitive, {\n position: 'absolute',\n top: '$300',\n right: '$300',\n})\nexport type CloseProps = StrictComponentProps<typeof Close>\n","import type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nimport {\n Description as DescriptionPrimitive,\n Title as TitlePrimitive,\n} from '../primitive'\n\n// The window owns the default inset; each part escapes it with negative\n// margins and lays its spec'd box with its own padding, so the parts sit\n// edge to edge while bare content stays padded.\n\nexport const Banner = styled(Primitive.div, {\n margin: '-$500 -$500 0',\n // The floor yields on short screens (text zoom, 400% reflow): the media\n // must not eat the space the title and actions need.\n minHeight: 'min(300px, 40vh)',\n borderTopLeftRadius: '$100',\n borderTopRightRadius: '$100',\n overflow: 'hidden',\n backgroundColor: '$background-primary-subtle',\n // Media dropped in fills the slot with no hand-made styles.\n '& > img, & > video': {\n display: 'block',\n width: '100%',\n height: '100%',\n objectFit: 'contain',\n },\n})\nexport type BannerProps = ComponentProps<typeof Banner>\n\nexport const Title = styled(TitlePrimitive, {\n fontFamily: '$heading',\n fontSize: '$300',\n lineHeight: 1.35,\n fontWeight: 400,\n fontFeatureSettings: \"'ss01'\",\n padding: '$400 $1200 $100 $500',\n margin: '-$500 -$500 0',\n // A banner before it already consumed the window's top inset, so the title\n // must not escape it a second time.\n [`${Banner} ~ &`]: {\n marginTop: 0,\n },\n})\nexport type TitleProps = ComponentProps<typeof Title>\n\nexport const Description = styled(DescriptionPrimitive, {\n fontFamily: '$body',\n fontSize: '$200',\n lineHeight: 1.5,\n padding: '$200 $500',\n margin: '0 -$500',\n // As the last part, its own $200 plus the window's $500 would overshoot\n // the $500 closing inset.\n '&:last-child': {\n marginBottom: '-$200',\n },\n})\nexport type DescriptionProps = ComponentProps<typeof Description>\n\nexport const Actions = styled(Primitive.div, {\n display: 'flex',\n gap: '$100',\n // The window's inset supplies the $500 closing edge below the row.\n padding: '$200 $500 0',\n margin: '0 -$500',\n})\nexport type ActionsProps = ComponentProps<typeof Actions>\n","import React, { forwardRef } from 'react'\nimport type { ElementRef, RefObject } from 'react'\nimport { keyframes, styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nimport {\n Content as ContentPrimitive,\n Viewport as ViewportPrimitive,\n} from '../primitive'\nimport { Actions, Banner, Description, Title } from './parts'\nimport { Close } from './close'\nimport { ANIMATION_DURATION, MOTION } from '../styles/animation'\n\nconst scaleIn = keyframes({\n from: { opacity: 0, transform: 'scale(0.8)' },\n to: { opacity: 1, transform: 'scale(1)' },\n})\n\nconst scaleOut = keyframes({\n from: { opacity: 1, transform: 'scale(1)' },\n to: { opacity: 0, transform: 'scale(0.8)' },\n})\n\nconst StyledViewport = styled(ViewportPrimitive, {\n position: 'fixed',\n inset: 0,\n zIndex: '$dialog',\n display: 'flex',\n overflow: 'auto',\n padding: '$300',\n '&[data-scoped]': {\n position: 'absolute',\n },\n '&[data-full-screen]': {\n padding: 0,\n },\n '&:not([data-modal])': {\n pointerEvents: 'none',\n },\n})\n\nconst StyledContent = styled(ContentPrimitive, {\n position: 'relative',\n margin: 'auto',\n boxSizing: 'border-box',\n width: 'fit-content',\n // The floors yield to the screen: WCAG 1.4.10 reflow requires the window\n // to fit a 320px viewport (400% zoom), so neither bound may exceed the\n // layer's width.\n minWidth: 'min(560px, 100%)',\n maxWidth: 'min(960px, 100%)',\n backgroundColor: '$background-neutrals',\n color: '$text-neutrals',\n borderRadius: '$100',\n boxShadow: '$elevation-300',\n overflowWrap: 'break-word',\n outline: 'none',\n // The window stays interactive when its (non-modal) layer stops\n // intercepting presses.\n pointerEvents: 'auto',\n padding: '$500',\n\n [`&:has(${Title})`]: {\n paddingTop: 0,\n [`& ${Banner}`]: { marginTop: 0 },\n [`& ${Title}`]: { marginTop: 0 },\n },\n [`&:has(${Actions})`]: {\n paddingBottom: 0,\n [`& ${Actions}`]: { paddingBottom: '$500' },\n [`& ${Description}:last-child`]: { marginBottom: 0, paddingBottom: '$500' },\n },\n\n [MOTION]: {\n animation: `${scaleIn} ${ANIMATION_DURATION} ease-out`,\n '&[data-state=\"closing\"]': {\n animation: `${scaleOut} ${ANIMATION_DURATION} ease-out forwards`,\n },\n },\n\n variants: {\n scroll: {\n viewport: {},\n window: {\n maxHeight: '100%',\n overflow: 'auto',\n [`& ${Title}`]: {\n position: 'sticky',\n top: 0,\n backgroundColor: '$background-neutrals',\n },\n [`& ${Close}`]: {\n position: 'sticky',\n top: '$300',\n right: 'auto',\n float: 'right',\n marginRight: '-$200',\n zIndex: 1,\n },\n [`& ${Banner}`]: {\n overflow: 'visible',\n },\n },\n },\n\n flat: {\n true: {\n padding: 0,\n overflow: 'hidden',\n [`& ${Banner}`]: { margin: 0 },\n [`& ${Title}`]: { margin: 0 },\n [`& ${Description}`]: { margin: 0 },\n [`& ${Description}:last-child`]: { paddingBottom: '$500' },\n [`& ${Actions}`]: { margin: 0, paddingBottom: '$500' },\n },\n },\n\n fullScreen: {\n true: {\n width: '100%',\n height: '100%',\n minWidth: 0,\n maxWidth: 'none',\n margin: 0,\n borderRadius: 0,\n },\n },\n },\n\n compoundVariants: [\n {\n flat: true,\n scroll: 'window',\n css: { overflow: 'auto' },\n },\n ],\n\n defaultVariants: {\n scroll: 'viewport',\n },\n})\n\nexport interface ContentProps\n extends StrictComponentProps<typeof StyledContent> {\n /** The element to focus when the dialog opens. @default the dialog window */\n initialFocus?: RefObject<HTMLElement>\n}\n\nexport const Content = forwardRef<\n ElementRef<typeof StyledContent>,\n ContentProps\n>(({ fullScreen, ...props }, forwardedRef) => (\n <StyledViewport fullScreen={fullScreen === true}>\n <StyledContent {...props} fullScreen={fullScreen} ref={forwardedRef} />\n </StyledViewport>\n))\n","import { Portal as PortalPrimitive } from '../primitive'\nimport type { PortalProps as PortalPrimitiveProps } from '../primitive'\n\n// Unstyled part — passes straight through to the primitive.\nexport interface PortalProps extends PortalPrimitiveProps {}\nexport const Portal = PortalPrimitive\n","import { Trigger as TriggerPrimitive } from '../primitive'\nimport type { TriggerProps as TriggerPrimitiveProps } from '../primitive'\n\n// Unstyled part — passes straight through to the primitive.\nexport interface TriggerProps extends TriggerPrimitiveProps {}\nexport const Trigger = TriggerPrimitive\n","import React from 'react'\nimport type { ReactNode } from 'react'\n\nimport type { DialogOptions } from './primitive'\nimport { Root } from './primitive'\nimport { Backdrop } from './partials/backdrop'\nimport { Close } from './partials/close'\nimport { Content } from './partials/content'\nimport { Actions, Banner, Description, Title } from './partials/parts'\nimport { Portal } from './partials/portal'\nimport { Trigger } from './partials/trigger'\n\nexport interface DialogProps extends DialogOptions {\n children?: ReactNode\n}\n\n// The root owns the open state and renders no DOM.\nexport const Dialog: ((props: DialogProps) => ReactNode) & Parts = props => (\n <Root {...props} />\n)\n\n// Parts\n// -----------------------------------------------------------------------------\n\nexport interface Parts {\n Trigger: typeof Trigger\n Portal: typeof Portal\n Backdrop: typeof Backdrop\n Content: typeof Content\n Banner: typeof Banner\n Title: typeof Title\n Description: typeof Description\n Actions: typeof Actions\n Close: typeof Close\n}\n\nDialog.Trigger = Trigger\nDialog.Portal = Portal\nDialog.Backdrop = Backdrop\nDialog.Content = Content\nDialog.Banner = Banner\nDialog.Title = Title\nDialog.Description = Description\nDialog.Actions = Actions\nDialog.Close = Close\n"],"names":["createContext","useContext","isLayerElement","useId","useState","useRef","useEffect","_a","_b","isTopmostLayer","useBrowserNavigation","jsx","Trigger","forwardRef","composeHandlers","Primitive","mergeRefs","Portal","createPortal","Backdrop","Content","useOverlay","useOverlayExit","useScrollLock","useFocusTrap","Title","Description","Close","keyframes","styled","BackdropPrimitive","ClosePrimitive","TitlePrimitive","DescriptionPrimitive","ViewportPrimitive","ContentPrimitive","PortalPrimitive","TriggerPrimitive"],"mappings":";;;;;;;;;;;;;;AA2DO,MAAM,aAAA,GAAgBA,mBAAA;AAAA,EAC3B;AACF,CAAA;AAEO,MAAM,mBAAmB,MAA0B;AACxD,EAAA,MAAM,OAAA,GAAUC,iBAAW,aAAa,CAAA;AACxC,EAAA,IAAI,YAAY,MAAA,EAAW;AACzB,IAAA,MAAM,IAAI,MAAM,sDAAsD,CAAA;AAAA,EACxE;AACA,EAAA,OAAO,OAAA;AACT,CAAA;;AC3DA,MAAM,cAAA,GACJ,sGAAA;AASK,SAAS,uBAAuB,OAAA,EAAkC;AACvE,EAAA,IAAI,OAAA,KAAY,MAAM,OAAO,KAAA;AAC7B,EAAA,MAAM,SAAS,QAAA,CAAS,aAAA;AACxB,EAAA,IAAI,MAAA,KAAW,IAAA,IAAQ,MAAA,KAAW,QAAA,CAAS,MAAM,OAAO,KAAA;AACxD,EAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,OAAA,CAAQ,cAAc,CAAA;AAC3C,EAAA,IAAI,UAAU,IAAA,EAAM,OAAO,CAAC,OAAA,CAAQ,SAAS,MAAM,CAAA;AACnD,EAAA,OAAO,KAAA,KAAU,OAAA,IAAW,CAACC,qCAAA,CAAe,KAAK,CAAA;AACnD;AASO,SAAS,8BACd,OAAA,EACS;AACT,EAAA,IAAI,OAAA,KAAY,MAAM,OAAO,KAAA;AAC7B,EAAA,MAAM,SAAS,QAAA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,cAAA,CAAC,cAAA,EAAA,EAAe,YAAY,UAAA,KAAe,IAAA,EACzC,yCAAC,aAAA,EAAA,EAAe,GAAG,OAAO,UAAA,EAAwB,GAAA,EAAK,YAAA,EAAc,CAAA,EACvE,CACD,CAAA;;ACtJM,MAAM,MAAA,GAASyB,QAAA;;ACAf,MAAM,OAAA,GAAUC,SAAA;;ACYhB,MAAM,MAAA,GAAsD,CAAA,KAAA,qBACjE1B,cAAA,CAAC,IAAA,EAAA,EAAM,GAAG,KAAA,EAAO;AAkBnB,MAAA,CAAO,OAAA,GAAU,OAAA;AACjB,MAAA,CAAO,MAAA,GAAS,MAAA;AAChB,MAAA,CAAO,QAAA,GAAW,QAAA;AAClB,MAAA,CAAO,OAAA,GAAU,OAAA;AACjB,MAAA,CAAO,MAAA,GAAS,MAAA;AAChB,MAAA,CAAO,KAAA,GAAQ,KAAA;AACf,MAAA,CAAO,WAAA,GAAc,WAAA;AACrB,MAAA,CAAO,OAAA,GAAU,OAAA;AACjB,MAAA,CAAO,KAAA,GAAQ,KAAA;;;;;"}
package/dist/module.js CHANGED
@@ -2,7 +2,7 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import { createContext, useContext, useState, useRef, useEffect, forwardRef } from 'react';
3
3
  import { useId } from '@mirohq/design-system-use-id';
4
4
  import { useBrowserNavigation } from '@mirohq/design-system-use-browser-navigation';
5
- import { isTopmostLayer, useOverlay, useOverlayExit } from '@mirohq/design-system-use-overlay';
5
+ import { isLayerElement, isTopmostLayer, useOverlay, useOverlayExit } from '@mirohq/design-system-use-overlay';
6
6
  import { Primitive } from '@mirohq/design-system-primitive';
7
7
  import { composeHandlers, mergeRefs } from '@mirohq/design-system-utils';
8
8
  import { createPortal } from 'react-dom';
@@ -21,13 +21,31 @@ const useDialogContext = () => {
21
21
  return context;
22
22
  };
23
23
 
24
+ const POPUP_SELECTOR = '[role="listbox"], [role="menu"], [role="tree"], [role="grid"], [role="dialog"], [role="alertdialog"]';
25
+ function innerOverlayHoldsFocus(content) {
26
+ if (content === null) return false;
27
+ const active = document.activeElement;
28
+ if (active === null || active === document.body) return false;
29
+ const popup = active.closest(POPUP_SELECTOR);
30
+ if (popup === null) return !content.contains(active);
31
+ return popup !== content && !isLayerElement(popup);
32
+ }
33
+ function focusIsOnExpandedPopupControl(content) {
34
+ if (content === null) return false;
35
+ const active = document.activeElement;
36
+ if (active === null || !content.contains(active)) return false;
37
+ if (active.getAttribute("aria-expanded") !== "true") return false;
38
+ const popup = active.getAttribute("aria-haspopup");
39
+ return popup !== null && popup !== "false";
40
+ }
41
+
24
42
  const Root = ({ children, ...options }) => {
25
43
  var _a, _b, _c, _d, _e;
26
44
  const depth = ((_b = (_a = useContext(DialogContext)) == null ? void 0 : _a.depth) != null ? _b : 0) + 1;
27
45
  const generatedId = useId();
28
46
  const id = (_c = options.id) != null ? _c : generatedId;
29
47
  const role = (_d = options.role) != null ? _d : "dialog";
30
- const modal = (_e = options.modal) != null ? _e : true;
48
+ const modal = role === "alertdialog" || ((_e = options.modal) != null ? _e : true);
31
49
  const animated = options.animated === true;
32
50
  const controlled = options.open !== void 0;
33
51
  const [uncontrolledOpen, setUncontrolledOpen] = useState(
@@ -70,6 +88,10 @@ const Root = ({ children, ...options }) => {
70
88
  onEscapeRef.current = (event) => {
71
89
  var _a2, _b2;
72
90
  if (!isTopmostLayer(id)) return;
91
+ const content = document.getElementById("".concat(id, "-content"));
92
+ if (innerOverlayHoldsFocus(content) || focusIsOnExpandedPopupControl(content)) {
93
+ return;
94
+ }
73
95
  (_b2 = (_a2 = optionsRef.current).onEscapeKeyDown) == null ? void 0 : _b2.call(_a2, event);
74
96
  if (event.defaultPrevented) return;
75
97
  if (optionsRef.current.closeOnEscape === false) return;
@@ -341,8 +363,8 @@ const Content$1 = forwardRef(
341
363
  useScrollLock(modal, container != null ? container : void 0);
342
364
  useFocusTrap(contentRef, {
343
365
  // Only a modal dialog traps, and only while topmost — a nested dialog
344
- // owns focus while open.
345
- enabled: () => modal && isTopmostLayer(id),
366
+ // owns focus while open, and so does an inner overlay that holds it.
367
+ enabled: () => modal && isTopmostLayer(id) && !innerOverlayHoldsFocus(contentRef.current),
346
368
  // The Close part is the cycle's last stop wherever it renders (SPEC).
347
369
  last: () => closeRef.current
348
370
  });
@@ -350,14 +372,20 @@ const Content$1 = forwardRef(
350
372
  if (!open) return;
351
373
  const element = contentRef.current;
352
374
  if (element === null) return;
353
- if (parts.title || document.getElementById(ids.title) !== null) return;
354
- if (element.hasAttribute("aria-label") || element.hasAttribute("aria-labelledby")) {
355
- return;
375
+ const named = parts.title || document.getElementById(ids.title) !== null || element.hasAttribute("aria-label") || element.hasAttribute("aria-labelledby");
376
+ if (!named) {
377
+ console.warn(
378
+ "[Dialog] the dialog resolves no accessible name: render a <Dialog.Title>, or give Content an aria-label when it truly cannot have one."
379
+ );
356
380
  }
357
- console.warn(
358
- "[Dialog] the dialog resolves no accessible name: render a <Dialog.Title>, or give Content an aria-label when it truly cannot have one."
359
- );
360
- }, [open, parts.title, ids.title]);
381
+ if (role !== "alertdialog") return;
382
+ const described = parts.description || document.getElementById(ids.description) !== null || element.hasAttribute("aria-describedby");
383
+ if (!described) {
384
+ console.warn(
385
+ "[Dialog] the alert dialog resolves no accessible description: render a <Dialog.Description>, or give Content an aria-describedby."
386
+ );
387
+ }
388
+ }, [open, role, parts.title, parts.description, ids.title, ids.description]);
361
389
  const labelling = {};
362
390
  if (parts.title && props["aria-labelledby"] == null) {
363
391
  labelling["aria-labelledby"] = ids.title;
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sources":["../src/primitive/context.tsx","../src/primitive/root.tsx","../src/primitive/trigger.tsx","../src/primitive/portal.tsx","../src/primitive/backdrop.tsx","../src/primitive/viewport.tsx","../src/primitive/content.tsx","../src/primitive/title.tsx","../src/primitive/description.tsx","../src/primitive/close.tsx","../src/primitive/use-dialog.ts","../src/styles/animation.ts","../src/partials/backdrop.tsx","../src/partials/close.tsx","../src/partials/parts.tsx","../src/partials/content.tsx","../src/partials/portal.tsx","../src/partials/trigger.tsx","../src/dialog.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { Dispatch, RefObject, SetStateAction } from 'react'\n\nimport type { DialogRole, DialogState } from './types'\n\n/**\n * The cross-part ids, derived from the one base id so the trigger's\n * aria-controls, the Content's id, and the labelledby/describedby always\n * agree.\n */\nexport interface DialogIds {\n content: string\n title: string\n description: string\n}\n\n// Which optional parts are currently present: Content only references the\n// rendered Title/Description.\nexport interface PartsPresence {\n title: boolean\n description: boolean\n}\n\nexport interface DialogContextValue {\n state: DialogState\n open: boolean\n /** Whether the dialog occupies the tree: open or mid-exit (`closing`) — the\n * Portal's unmount gate. */\n mounted: boolean\n modal: boolean\n role: DialogRole\n id: string\n ids: DialogIds\n // Nesting level (1 = top-level). Decides the topmost dialog of a stack for\n // Escape, focus, and assistive-tech containment.\n depth: number\n // The element the Portal teleported into, or null for the page body —\n // Content scopes the scroll lock to it. The root provides null; Portal\n // re-provides the context with the field filled in.\n container: HTMLElement | null\n // The rendered Backdrop element, shared because Backdrop and Content are\n // sibling layers: Content's stack entry excepts its own backdrop from the\n // containment so it stays pressable while its dialog is topmost.\n backdropRef: RefObject<HTMLDivElement>\n // The rendered Trigger element — the close's focus-restore fallback when\n // nothing was focused before opening (a pointer press leaves focus on the\n // body: the DS Button suppresses mousedown's native focus).\n triggerRef: RefObject<HTMLButtonElement>\n // The rendered Close element — how the focus containment keeps the part\n // the cycle's last stop (an id would duplicate if Close ever doubled).\n closeRef: RefObject<HTMLButtonElement>\n parts: PartsPresence\n setParts: Dispatch<SetStateAction<PartsPresence>>\n toggle: () => void\n close: () => void\n interactOutside: (event: MouseEvent) => void\n exitComplete: () => void\n}\n\nexport const DialogContext = createContext<DialogContextValue | undefined>(\n undefined\n)\n\nexport const useDialogContext = (): DialogContextValue => {\n const context = useContext(DialogContext)\n if (context === undefined) {\n throw new Error('Dialog parts must be rendered within a <Dialog> root')\n }\n return context\n}\n","// <Root> — owns the open state and renders no DOM.\nimport React, { useContext, useEffect, useRef, useState } from 'react'\nimport type { ReactNode } from 'react'\nimport { useId } from '@mirohq/design-system-use-id'\nimport { useBrowserNavigation } from '@mirohq/design-system-use-browser-navigation'\nimport { isTopmostLayer } from '@mirohq/design-system-use-overlay'\n\nimport { DialogContext } from './context'\nimport type { PartsPresence } from './context'\nimport type { BackNavigationPayload, DialogOptions, DialogState } from './types'\n\nexport interface RootProps extends DialogOptions {\n children?: ReactNode\n}\n\nexport const Root = ({ children, ...options }: RootProps): ReactNode => {\n // Nesting derives from the parent dialog's context (undefined = top-level).\n const depth = (useContext(DialogContext)?.depth ?? 0) + 1\n const generatedId = useId()\n // `?? generatedId`: an explicit `id={undefined}` must not knock out the\n // fallback — ids also key the dialog stack, so they must exist.\n const id = options.id ?? generatedId\n const role = options.role ?? 'dialog'\n const modal = options.modal ?? true\n const animated = options.animated === true\n\n const controlled = options.open !== undefined\n const [uncontrolledOpen, setUncontrolledOpen] = useState(\n options.defaultOpen === true\n )\n const open = controlled ? options.open === true : uncontrolledOpen\n\n // Controlled-ness follows the prop live: mirroring the prop keeps the\n // uncontrolled value current, so dropping the prop hands the state back\n // right where it stands.\n if (controlled && uncontrolledOpen !== open) setUncontrolledOpen(open)\n\n // The exit window: only an `animated` close passes through `closing`, and\n // reopening interrupts it. Adjusted during render — an effect would let an\n // unmounted frame slip between the close and the exit.\n const [exiting, setExiting] = useState(false)\n const previousOpen = useRef(open)\n if (previousOpen.current !== open) {\n previousOpen.current = open\n if (open) {\n if (exiting) setExiting(false)\n } else if (animated) {\n setExiting(true)\n }\n }\n\n const state: DialogState = open ? 'open' : exiting ? 'closing' : 'closed'\n\n // Read through a ref so the document-level listeners and the history guard\n // follow the open state alone — fresh callback identities must not re-bind\n // listeners or churn real session-history entries.\n const optionsRef = useRef(options)\n optionsRef.current = options\n\n // onOpenChange reports once per transition-or-intent: every interaction\n // that asks for a different value reports it immediately — a controlled\n // dialog stays put, but the ask is not silent (`open` + `onOpenChange`\n // works on its own, like the Radix-based overlays) — and a change the\n // prop drives by itself reports from the effect. The already-reported\n // check keeps a granted intent from echoing when the prop answers it.\n // No call on mount.\n const reportedOpen = useRef(open)\n const resolvedOpen = useRef(open)\n useEffect(() => {\n if (resolvedOpen.current === open) return\n resolvedOpen.current = open\n if (reportedOpen.current === open) return\n reportedOpen.current = open\n optionsRef.current.onOpenChange?.(open)\n })\n\n const setOpen = (next: boolean): void => {\n if (open === next) return\n reportedOpen.current = next\n optionsRef.current.onOpenChange?.(next)\n // A controlled dialog never moves on its own — the consumer decides at\n // the source (this report and the dismissal callbacks) and answers\n // through the prop.\n if (!controlled) setUncontrolledOpen(next)\n }\n\n // Escape is a document-level concern, not a part's — it must work wherever\n // focus is. The handler lives on a ref so the listener binds per open\n // window, not per render; a `closing` dialog has already detached it.\n const onEscapeRef = useRef<(event: KeyboardEvent) => void>(() => {})\n onEscapeRef.current = (event: KeyboardEvent): void => {\n // Only the topmost dialog answers Escape — a nested stack closes one\n // layer at a time.\n if (!isTopmostLayer(id)) return\n optionsRef.current.onEscapeKeyDown?.(event)\n if (event.defaultPrevented) return\n if (optionsRef.current.closeOnEscape === false) return\n setOpen(false)\n }\n\n useEffect(() => {\n if (!open) return\n const onKeyDown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') onEscapeRef.current(event)\n }\n document.addEventListener('keydown', onKeyDown, true)\n return () => document.removeEventListener('keydown', onKeyDown, true)\n }, [open])\n\n // closeOnBack: while open, a guard entry in the session history turns the\n // host's Back into a dismissal instead of a navigation — and the entry a\n // Back press spends survives in the forward stack, so the host's Forward\n // reopens what Back closed. It lives on the root — the guard concerns the\n // dialog's openness, not any rendered part.\n const onBackRef = useRef<() => boolean>(() => false)\n onBackRef.current = (): boolean => {\n // The host's back has no cancelable event — synthesize the veto payload\n // so the callback contract matches the other dismissals.\n const payload: BackNavigationPayload = {\n defaultPrevented: false,\n preventDefault() {\n payload.defaultPrevented = true\n },\n }\n optionsRef.current.onBackNavigation?.(payload)\n if (payload.defaultPrevented === true) return false\n // A controlled dialog only records the request (onOpenChange reports the\n // intent) — the consumer follows through the prop, and the guard re-arms\n // until it does.\n setOpen(false)\n return !controlled\n }\n\n // `backNavigate`'s mirror, decided the same way — and reachable from the\n // animated `closing` state too: Forward interrupts the exit.\n const onForwardRef = useRef<() => boolean>(() => false)\n onForwardRef.current = (): boolean => {\n const payload: BackNavigationPayload = {\n defaultPrevented: false,\n preventDefault() {\n payload.defaultPrevented = true\n },\n }\n optionsRef.current.onForwardNavigation?.(payload)\n if (payload.defaultPrevented === true) return false\n if (optionsRef.current.closeOnBack !== true) return false\n setOpen(true)\n return !controlled\n }\n\n useBrowserNavigation({\n enabled: options.closeOnBack === true,\n open,\n onBack: () => onBackRef.current(),\n onForward: () => onForwardRef.current(),\n // The dialog's nesting depth is what a returning dialog recognizes its\n // own spent entry by: the instance is new after a remount, but the\n // position in the stack is the same.\n claim: `dialog:${depth}`,\n })\n\n // A press that starts inside the dialog window never counts as outside,\n // wherever it releases: a text-selection drag out of the window dispatches\n // its click on the layer around it (a click targets the press's and the\n // release's common ancestor), so the click's target alone can't tell a\n // dismissal from a drag. Each press records its origin instead.\n const insidePressRef = useRef(false)\n useEffect(() => {\n if (!open) return\n const contentId = `${id}-content`\n const onPointerDown = (event: Event): void => {\n const content = document.getElementById(contentId)\n insidePressRef.current =\n content !== null &&\n event.target instanceof Node &&\n content.contains(event.target)\n }\n document.addEventListener('pointerdown', onPointerDown, true)\n return () =>\n document.removeEventListener('pointerdown', onPointerDown, true)\n }, [open, id])\n\n const interactOutside = (event: MouseEvent): void => {\n if (insidePressRef.current) return\n // An outside press is an intent, not a close command: the consumer may\n // veto it, and the role's dismissal setting gates it — an alert dialog\n // interrupts for a response, so it doesn't dismiss unless opted in.\n options.onInteractOutside?.(event)\n if (event.defaultPrevented) return\n if (!(options.closeOnInteractOutside ?? role === 'dialog')) return\n setOpen(false)\n }\n const interactOutsideRef = useRef(interactOutside)\n interactOutsideRef.current = interactOutside\n\n const backdropRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const closeRef = useRef<HTMLButtonElement>(null)\n\n // A non-modal dialog coexists with the page: no layer intercepts the\n // press, so the outside interaction is read from the document. Presses\n // inside the window are inside; the trigger's own press stays a plain\n // toggle — counting it as outside would close and immediately reopen.\n useEffect(() => {\n if (!open || modal) return\n const contentId = `${id}-content`\n const onClick = (event: MouseEvent): void => {\n if (!isTopmostLayer(id)) return\n if (!(event.target instanceof Node)) return\n if (document.getElementById(contentId)?.contains(event.target) === true)\n return\n if (triggerRef.current?.contains(event.target) === true) return\n interactOutsideRef.current(event)\n }\n document.addEventListener('click', onClick)\n return () => document.removeEventListener('click', onClick)\n }, [open, modal, id])\n\n const [parts, setParts] = useState<PartsPresence>({\n title: false,\n description: false,\n })\n\n return (\n <DialogContext.Provider\n value={{\n state,\n open,\n mounted: state !== 'closed',\n modal,\n role,\n id,\n ids: {\n content: `${id}-content`,\n title: `${id}-title`,\n description: `${id}-description`,\n },\n depth,\n container: null,\n backdropRef,\n triggerRef,\n closeRef,\n parts,\n setParts,\n toggle: () => setOpen(!open),\n close: () => setOpen(false),\n interactOutside,\n exitComplete: () => setExiting(false),\n }}\n >\n {children}\n </DialogContext.Provider>\n )\n}\n","// <Trigger> — toggles the dialog; focus returns here on close.\nimport React, { forwardRef } from 'react'\nimport type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { composeHandlers, mergeRefs } from '@mirohq/design-system-utils'\n\nimport { useDialogContext } from './context'\n\nexport interface TriggerProps extends ComponentProps<typeof Primitive.button> {}\n\nexport const Trigger = forwardRef<HTMLButtonElement, TriggerProps>(\n ({ asChild = false, ...props }, forwardedRef) => {\n const { open, state, ids, toggle, triggerRef } = useDialogContext()\n const consumer = composeHandlers(\n { onClick: toggle },\n asChild ? props : { type: 'button' as const, ...props }\n )\n\n return (\n <Primitive.button\n {...consumer}\n aria-haspopup='dialog'\n aria-expanded={open}\n // A dangling aria-controls id is an a11y defect — only while open.\n aria-controls={open ? ids.content : undefined}\n data-state={state}\n asChild={asChild}\n ref={mergeRefs([triggerRef, forwardedRef])}\n />\n )\n }\n)\n","// <Portal> — teleports the layers out of the tree while open.\nimport React from 'react'\nimport type { ReactNode } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { DialogContext, useDialogContext } from './context'\n\nexport interface PortalProps {\n children?: ReactNode\n /** The element to portal into. @default document.body */\n container?: HTMLElement | null\n}\n\nexport const Portal = ({ children, container }: PortalProps): ReactNode => {\n const context = useDialogContext()\n // `mounted`, not `open`: an animated dialog stays in the tree through\n // `closing` so its exit visual can play before everything unmounts.\n if (!context.mounted || typeof document === 'undefined') return null\n // Re-provide the context with the scoped container (null = page body) so\n // Content locks the right scroll surface.\n return createPortal(\n <DialogContext.Provider\n value={{ ...context, container: container ?? null }}\n >\n {children}\n </DialogContext.Provider>,\n container ?? document.body\n )\n}\n","// <Backdrop> — the layer behind the dialog window.\nimport React, { forwardRef } from 'react'\nimport type { ComponentProps, MouseEvent } from 'react'\nimport { composeHandlers, mergeRefs } from '@mirohq/design-system-utils'\nimport { isTopmostLayer } from '@mirohq/design-system-use-overlay'\n\nimport { useDialogContext } from './context'\n\nexport interface BackdropProps extends ComponentProps<'div'> {}\n\nexport const Backdrop = forwardRef<HTMLDivElement, BackdropProps>(\n (props, forwardedRef) => {\n const { modal, state, id, container, backdropRef, interactOutside } =\n useDialogContext()\n\n // Only a modal dialog dims the page — non-modal coexists with it.\n if (!modal) return null\n\n const consumer = composeHandlers(\n {\n // Only the topmost dialog of a stack answers an outside press.\n onClick: (event: MouseEvent<HTMLElement>) => {\n if (isTopmostLayer(id)) interactOutside(event.nativeEvent)\n },\n },\n props\n )\n\n return (\n // role=presentation: the backdrop is a purely visual layer; its press\n // is the pointer half of an outside dismissal, with Escape as the\n // keyboard path (jsx-a11y's keyboard pairing doesn't apply).\n <div\n role='presentation'\n {...consumer}\n data-state={state}\n // A scoped dialog (Portal container) pins to the container, not the\n // page — the styled layer switches positioning on this attribute.\n data-scoped={container === null ? undefined : ''}\n ref={mergeRefs([backdropRef, forwardedRef])}\n />\n )\n }\n)\n","// <Viewport> — the positioning + scroll layer around the dialog window.\nimport React, { forwardRef } from 'react'\nimport type { ComponentProps, MouseEvent } from 'react'\nimport { composeHandlers } from '@mirohq/design-system-utils'\nimport { isTopmostLayer } from '@mirohq/design-system-use-overlay'\n\nimport { useDialogContext } from './context'\n\nexport interface ViewportProps extends ComponentProps<'div'> {\n /** Marks the layer full-screen: the window fills it edge to edge, so the\n * layer drops its own inset. @default false */\n fullScreen?: boolean\n}\n\nexport const Viewport = forwardRef<HTMLDivElement, ViewportProps>(\n ({ fullScreen, ...props }, forwardedRef) => {\n const { state, id, modal, container, interactOutside } = useDialogContext()\n\n const consumer = composeHandlers(\n {\n // Box presses bubble up here — only a press that started on the\n // viewport itself is an outside interaction, and only the topmost\n // dialog of a stack answers it.\n onClick: (event: MouseEvent<HTMLElement>) => {\n if (event.target !== event.currentTarget) return\n if (!isTopmostLayer(id)) return\n interactOutside(event.nativeEvent)\n },\n },\n props\n )\n\n return (\n // role=presentation: a purely presentational positioning wrapper — the\n // press it answers is the pointer half of an outside dismissal, with\n // Escape as the keyboard path.\n <div\n role='presentation'\n {...consumer}\n data-state={state}\n // A scoped dialog (Portal container) pins to the container, not the\n // page — the styled layer switches positioning on this attribute.\n data-scoped={container === null ? undefined : ''}\n // A non-modal dialog coexists with the page — without this marker the\n // styled layer stops intercepting pointer presses.\n data-modal={modal ? '' : undefined}\n // A full-screen window fills the layer edge to edge — the styled\n // layer drops its inset on this attribute.\n data-full-screen={fullScreen === true ? '' : undefined}\n ref={forwardedRef}\n />\n )\n }\n)\n","// <Content> — the dialog window: focus moves in on open, restores on close,\n// traps while modal.\nimport React, { forwardRef, useEffect, useRef } from 'react'\nimport type { ComponentProps, RefObject } from 'react'\nimport { mergeRefs } from '@mirohq/design-system-utils'\nimport { useFocusTrap } from '@mirohq/design-system-use-focus-trap'\nimport { useScrollLock } from '@mirohq/design-system-use-scroll-lock'\nimport {\n isTopmostLayer,\n useOverlay,\n useOverlayExit,\n} from '@mirohq/design-system-use-overlay'\n\nimport { useDialogContext } from './context'\n\nexport interface ContentProps extends ComponentProps<'div'> {\n /** The element to focus when the dialog opens. @default the dialog window */\n initialFocus?: RefObject<HTMLElement>\n}\n\nexport const Content = forwardRef<HTMLDivElement, ContentProps>(\n ({ initialFocus, ...props }, forwardedRef) => {\n const {\n state,\n open,\n modal,\n role,\n id,\n ids,\n depth,\n container,\n backdropRef,\n triggerRef,\n closeRef,\n parts,\n exitComplete,\n } = useDialogContext()\n const contentRef = useRef<HTMLDivElement>(null)\n\n // The open window: the stack entry, containment, initial focus, and the\n // focus restore — released the moment a close starts, not when the exit\n // visual finishes.\n useOverlay(contentRef, {\n enabled: open,\n id,\n depth,\n modal,\n backdrop: () => backdropRef.current,\n initialFocus,\n // A pointer press opens without focusing the trigger (the DS Button\n // suppresses mousedown's native focus), so the close would find only\n // the body to restore to — fall back to the trigger, the invoker APG\n // says focus returns to.\n restoreFocus: () => triggerRef.current,\n })\n\n // The exit window: a Content rendered while not open only happens in\n // `closing` — the still-painting layer leaves the page's interaction and\n // its finished visual reports the unmount.\n useOverlayExit(contentRef, {\n exiting: !open,\n boundary: container,\n backdrop: () => backdropRef.current,\n onExitComplete: exitComplete,\n })\n\n // The lock spans the whole mount — through `closing` too: releasing it\n // mid-exit would bring the scrollbar back and reflow the page under the\n // still-painting layer. A scoped dialog locks its portal container; a\n // page dialog locks the body. The context's `null` container means the\n // page body — the hook's default — not its \"no target yet\".\n useScrollLock(modal, container ?? undefined)\n\n useFocusTrap(contentRef, {\n // Only a modal dialog traps, and only while topmost — a nested dialog\n // owns focus while open.\n enabled: () => modal && isTopmostLayer(id),\n // The Close part is the cycle's last stop wherever it renders (SPEC).\n last: () => closeRef.current,\n })\n\n // The constraint is \"never neither\": a rendered Title or an accessible\n // label on the window. Read from the DOM — it is committed before this\n // effect, while the Title's presence registration is not, and a label\n // arriving through any prop spread counts too.\n useEffect(() => {\n if (!open) return\n const element = contentRef.current\n if (element === null) return\n if (parts.title || document.getElementById(ids.title) !== null) return\n if (\n element.hasAttribute('aria-label') ||\n element.hasAttribute('aria-labelledby')\n ) {\n return\n }\n console.warn(\n '[Dialog] the dialog resolves no accessible name: render a ' +\n '<Dialog.Title>, or give Content an aria-label when it truly ' +\n 'cannot have one.'\n )\n }, [open, parts.title, ids.title])\n\n // The ARIA relationships always follow what is rendered — an omitted part\n // never leaves a dangling reference, and a consumer-supplied value wins\n // over the derived one.\n const labelling: Record<string, string> = {}\n if (parts.title && props['aria-labelledby'] == null) {\n labelling['aria-labelledby'] = ids.title\n }\n if (parts.description && props['aria-describedby'] == null) {\n labelling['aria-describedby'] = ids.description\n }\n\n return (\n // A neutral element with the role, not <dialog>: the window is the\n // initial focus target, so it carries tabindex — which HTML forbids on\n // <dialog> — and the native element only pays off via showModal(),\n // which this contract deliberately doesn't use.\n <div\n {...props}\n {...labelling}\n role={role}\n id={ids.content}\n aria-modal={modal || undefined}\n // The initial focus target: focusable in script, not in the tab order.\n tabIndex={-1}\n data-state={state}\n ref={mergeRefs([contentRef, forwardedRef])}\n />\n )\n }\n)\n","// <Title> — the dialog's accessible name.\nimport React, { forwardRef, useEffect } from 'react'\nimport type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nimport { useDialogContext } from './context'\n\nexport interface TitleProps extends ComponentProps<typeof Primitive.h2> {}\n\nexport const Title = forwardRef<HTMLHeadingElement, TitleProps>(\n ({ asChild = false, ...props }, forwardedRef) => {\n const { ids, setParts } = useDialogContext()\n\n // Presence drives the ARIA relationships on Content — a Title can appear\n // or disappear at any time, open or closed.\n useEffect(() => {\n setParts(parts => (parts.title ? parts : { ...parts, title: true }))\n return () =>\n setParts(parts => (parts.title ? { ...parts, title: false } : parts))\n }, [setParts])\n\n return (\n <Primitive.h2\n {...props}\n id={ids.title}\n asChild={asChild}\n ref={forwardedRef}\n />\n )\n }\n)\n","// <Description> — the dialog's accessible description.\nimport React, { forwardRef, useEffect } from 'react'\nimport type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nimport { useDialogContext } from './context'\n\nexport interface DescriptionProps extends ComponentProps<typeof Primitive.p> {}\n\nexport const Description = forwardRef<HTMLParagraphElement, DescriptionProps>(\n ({ asChild = false, ...props }, forwardedRef) => {\n const { ids, setParts } = useDialogContext()\n\n // Presence drives the ARIA relationships on Content — a Description can\n // appear or disappear at any time, open or closed.\n useEffect(() => {\n setParts(parts =>\n parts.description ? parts : { ...parts, description: true }\n )\n return () =>\n setParts(parts =>\n parts.description ? { ...parts, description: false } : parts\n )\n }, [setParts])\n\n return (\n <Primitive.p\n {...props}\n id={ids.description}\n asChild={asChild}\n ref={forwardedRef}\n />\n )\n }\n)\n","// <Close> — the visible in-dialog close affordance.\nimport React, { forwardRef } from 'react'\nimport type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { composeHandlers, mergeRefs } from '@mirohq/design-system-utils'\n\nimport { useDialogContext } from './context'\n\nexport interface CloseProps extends ComponentProps<typeof Primitive.button> {}\n\nexport const Close = forwardRef<HTMLButtonElement, CloseProps>(\n ({ asChild = false, ...props }, forwardedRef) => {\n const { close, closeRef } = useDialogContext()\n const consumer = composeHandlers(\n { onClick: close },\n asChild ? props : { type: 'button' as const, ...props }\n )\n\n return (\n <Primitive.button\n {...consumer}\n asChild={asChild}\n // Registered so the focus containment keeps it the cycle's last stop\n // wherever it renders.\n ref={mergeRefs([closeRef, forwardedRef])}\n />\n )\n }\n)\n","// useDialog — imperative access to the nearest <Dialog> root from anywhere in\n// its subtree: the same state a part reads, plus open/close/toggle.\nimport { useDialogContext } from './context'\nimport type { DialogState } from './types'\n\nexport interface UseDialogResult {\n id: string\n isOpen: boolean\n state: DialogState\n modal: boolean\n open: () => void\n close: () => void\n toggle: () => void\n}\n\nexport const useDialog = (): UseDialogResult => {\n const context = useDialogContext()\n\n return {\n id: context.id,\n isOpen: context.open,\n state: context.state,\n modal: context.modal,\n // Idempotent: toggle() would close an already-open dialog.\n open: () => {\n if (!context.open) context.toggle()\n },\n close: context.close,\n toggle: context.toggle,\n }\n}\n","// Must stay under the exit-watch fallback ceiling (500ms), or a closing\n// dialog would be cut short instead of finishing its animation.\nexport const ANIMATION_DURATION = '250ms'\n\nexport const MOTION = '@media (prefers-reduced-motion: no-preference)'\n","import { keyframes, styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nimport { Backdrop as BackdropPrimitive } from '../primitive'\nimport { ANIMATION_DURATION, MOTION } from '../styles/animation'\n\nconst fadeIn = keyframes({\n from: { opacity: 0 },\n to: { opacity: 1 },\n})\n\nconst fadeOut = keyframes({\n from: { opacity: 1 },\n to: { opacity: 0 },\n})\n\nexport const Backdrop = styled(BackdropPrimitive, {\n position: 'fixed',\n inset: 0,\n zIndex: '$dialog',\n backgroundColor: '$background-alpha-neutrals-overlay',\n // A scoped dialog (Portal container) pins to the container, not the page.\n '&[data-scoped]': {\n position: 'absolute',\n },\n\n [MOTION]: {\n animation: `${fadeIn} ${ANIMATION_DURATION} ease-out`,\n // `forwards` holds the final frame until the unmount lands.\n '&[data-state=\"closing\"]': {\n animation: `${fadeOut} ${ANIMATION_DURATION} ease-out forwards`,\n },\n },\n})\nexport type BackdropProps = StrictComponentProps<typeof Backdrop>\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nimport { Close as ClosePrimitive } from '../primitive'\n\n// Positioning only: the corner pin is the dialog's anatomy; the button's\n// visual comes from what the consumer composes in (typically an IconButton\n// via `asChild`).\nexport const Close = styled(ClosePrimitive, {\n position: 'absolute',\n top: '$300',\n right: '$300',\n})\nexport type CloseProps = StrictComponentProps<typeof Close>\n","import type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nimport {\n Description as DescriptionPrimitive,\n Title as TitlePrimitive,\n} from '../primitive'\n\n// The window owns the default inset; each part escapes it with negative\n// margins and lays its spec'd box with its own padding, so the parts sit\n// edge to edge while bare content stays padded.\n\nexport const Banner = styled(Primitive.div, {\n margin: '-$500 -$500 0',\n // The floor yields on short screens (text zoom, 400% reflow): the media\n // must not eat the space the title and actions need.\n minHeight: 'min(300px, 40vh)',\n borderTopLeftRadius: '$100',\n borderTopRightRadius: '$100',\n overflow: 'hidden',\n backgroundColor: '$background-primary-subtle',\n // Media dropped in fills the slot with no hand-made styles.\n '& > img, & > video': {\n display: 'block',\n width: '100%',\n height: '100%',\n objectFit: 'contain',\n },\n})\nexport type BannerProps = ComponentProps<typeof Banner>\n\nexport const Title = styled(TitlePrimitive, {\n fontFamily: '$heading',\n fontSize: '$300',\n lineHeight: 1.35,\n fontWeight: 400,\n fontFeatureSettings: \"'ss01'\",\n padding: '$400 $1200 $100 $500',\n margin: '-$500 -$500 0',\n // A banner before it already consumed the window's top inset, so the title\n // must not escape it a second time.\n [`${Banner} ~ &`]: {\n marginTop: 0,\n },\n})\nexport type TitleProps = ComponentProps<typeof Title>\n\nexport const Description = styled(DescriptionPrimitive, {\n fontFamily: '$body',\n fontSize: '$200',\n lineHeight: 1.5,\n padding: '$200 $500',\n margin: '0 -$500',\n // As the last part, its own $200 plus the window's $500 would overshoot\n // the $500 closing inset.\n '&:last-child': {\n marginBottom: '-$200',\n },\n})\nexport type DescriptionProps = ComponentProps<typeof Description>\n\nexport const Actions = styled(Primitive.div, {\n display: 'flex',\n gap: '$100',\n // The window's inset supplies the $500 closing edge below the row.\n padding: '$200 $500 0',\n margin: '0 -$500',\n})\nexport type ActionsProps = ComponentProps<typeof Actions>\n","import React, { forwardRef } from 'react'\nimport type { ElementRef, RefObject } from 'react'\nimport { keyframes, styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nimport {\n Content as ContentPrimitive,\n Viewport as ViewportPrimitive,\n} from '../primitive'\nimport { Actions, Banner, Description, Title } from './parts'\nimport { Close } from './close'\nimport { ANIMATION_DURATION, MOTION } from '../styles/animation'\n\nconst scaleIn = keyframes({\n from: { opacity: 0, transform: 'scale(0.8)' },\n to: { opacity: 1, transform: 'scale(1)' },\n})\n\nconst scaleOut = keyframes({\n from: { opacity: 1, transform: 'scale(1)' },\n to: { opacity: 0, transform: 'scale(0.8)' },\n})\n\nconst StyledViewport = styled(ViewportPrimitive, {\n position: 'fixed',\n inset: 0,\n zIndex: '$dialog',\n display: 'flex',\n overflow: 'auto',\n padding: '$300',\n '&[data-scoped]': {\n position: 'absolute',\n },\n '&[data-full-screen]': {\n padding: 0,\n },\n '&:not([data-modal])': {\n pointerEvents: 'none',\n },\n})\n\nconst StyledContent = styled(ContentPrimitive, {\n position: 'relative',\n margin: 'auto',\n boxSizing: 'border-box',\n width: 'fit-content',\n // The floors yield to the screen: WCAG 1.4.10 reflow requires the window\n // to fit a 320px viewport (400% zoom), so neither bound may exceed the\n // layer's width.\n minWidth: 'min(560px, 100%)',\n maxWidth: 'min(960px, 100%)',\n backgroundColor: '$background-neutrals',\n color: '$text-neutrals',\n borderRadius: '$100',\n boxShadow: '$elevation-300',\n overflowWrap: 'break-word',\n outline: 'none',\n // The window stays interactive when its (non-modal) layer stops\n // intercepting presses.\n pointerEvents: 'auto',\n padding: '$500',\n\n [`&:has(${Title})`]: {\n paddingTop: 0,\n [`& ${Banner}`]: { marginTop: 0 },\n [`& ${Title}`]: { marginTop: 0 },\n },\n [`&:has(${Actions})`]: {\n paddingBottom: 0,\n [`& ${Actions}`]: { paddingBottom: '$500' },\n [`& ${Description}:last-child`]: { marginBottom: 0, paddingBottom: '$500' },\n },\n\n [MOTION]: {\n animation: `${scaleIn} ${ANIMATION_DURATION} ease-out`,\n '&[data-state=\"closing\"]': {\n animation: `${scaleOut} ${ANIMATION_DURATION} ease-out forwards`,\n },\n },\n\n variants: {\n scroll: {\n viewport: {},\n window: {\n maxHeight: '100%',\n overflow: 'auto',\n [`& ${Title}`]: {\n position: 'sticky',\n top: 0,\n backgroundColor: '$background-neutrals',\n },\n [`& ${Close}`]: {\n position: 'sticky',\n top: '$300',\n right: 'auto',\n float: 'right',\n marginRight: '-$200',\n zIndex: 1,\n },\n [`& ${Banner}`]: {\n overflow: 'visible',\n },\n },\n },\n\n flat: {\n true: {\n padding: 0,\n overflow: 'hidden',\n [`& ${Banner}`]: { margin: 0 },\n [`& ${Title}`]: { margin: 0 },\n [`& ${Description}`]: { margin: 0 },\n [`& ${Description}:last-child`]: { paddingBottom: '$500' },\n [`& ${Actions}`]: { margin: 0, paddingBottom: '$500' },\n },\n },\n\n fullScreen: {\n true: {\n width: '100%',\n height: '100%',\n minWidth: 0,\n maxWidth: 'none',\n margin: 0,\n borderRadius: 0,\n },\n },\n },\n\n compoundVariants: [\n {\n flat: true,\n scroll: 'window',\n css: { overflow: 'auto' },\n },\n ],\n\n defaultVariants: {\n scroll: 'viewport',\n },\n})\n\nexport interface ContentProps\n extends StrictComponentProps<typeof StyledContent> {\n /** The element to focus when the dialog opens. @default the dialog window */\n initialFocus?: RefObject<HTMLElement>\n}\n\nexport const Content = forwardRef<\n ElementRef<typeof StyledContent>,\n ContentProps\n>(({ fullScreen, ...props }, forwardedRef) => (\n <StyledViewport fullScreen={fullScreen === true}>\n <StyledContent {...props} fullScreen={fullScreen} ref={forwardedRef} />\n </StyledViewport>\n))\n","import { Portal as PortalPrimitive } from '../primitive'\nimport type { PortalProps as PortalPrimitiveProps } from '../primitive'\n\n// Unstyled part — passes straight through to the primitive.\nexport interface PortalProps extends PortalPrimitiveProps {}\nexport const Portal = PortalPrimitive\n","import { Trigger as TriggerPrimitive } from '../primitive'\nimport type { TriggerProps as TriggerPrimitiveProps } from '../primitive'\n\n// Unstyled part — passes straight through to the primitive.\nexport interface TriggerProps extends TriggerPrimitiveProps {}\nexport const Trigger = TriggerPrimitive\n","import React from 'react'\nimport type { ReactNode } from 'react'\n\nimport type { DialogOptions } from './primitive'\nimport { Root } from './primitive'\nimport { Backdrop } from './partials/backdrop'\nimport { Close } from './partials/close'\nimport { Content } from './partials/content'\nimport { Actions, Banner, Description, Title } from './partials/parts'\nimport { Portal } from './partials/portal'\nimport { Trigger } from './partials/trigger'\n\nexport interface DialogProps extends DialogOptions {\n children?: ReactNode\n}\n\n// The root owns the open state and renders no DOM.\nexport const Dialog: ((props: DialogProps) => ReactNode) & Parts = props => (\n <Root {...props} />\n)\n\n// Parts\n// -----------------------------------------------------------------------------\n\nexport interface Parts {\n Trigger: typeof Trigger\n Portal: typeof Portal\n Backdrop: typeof Backdrop\n Content: typeof Content\n Banner: typeof Banner\n Title: typeof Title\n Description: typeof Description\n Actions: typeof Actions\n Close: typeof Close\n}\n\nDialog.Trigger = Trigger\nDialog.Portal = Portal\nDialog.Backdrop = Backdrop\nDialog.Content = Content\nDialog.Banner = Banner\nDialog.Title = Title\nDialog.Description = Description\nDialog.Actions = Actions\nDialog.Close = Close\n"],"names":["_a","_b","Trigger","Portal","Backdrop","Content","Title","Description","Close","BackdropPrimitive","ClosePrimitive","TitlePrimitive","DescriptionPrimitive","ViewportPrimitive","ContentPrimitive","PortalPrimitive","TriggerPrimitive"],"mappings":";;;;;;;;;;;;AA2DO,MAAM,aAAA,GAAgB,aAAA;AAAA,EAC3B;AACF,CAAA;AAEO,MAAM,mBAAmB,MAA0B;AACxD,EAAA,MAAM,OAAA,GAAU,WAAW,aAAa,CAAA;AACxC,EAAA,IAAI,YAAY,MAAA,EAAW;AACzB,IAAA,MAAM,IAAI,MAAM,sDAAsD,CAAA;AAAA,EACxE;AACA,EAAA,OAAO,OAAA;AACT,CAAA;;ACtDO,MAAM,OAAO,CAAC,EAAE,QAAA,EAAU,GAAG,SAAQ,KAA4B;AAfxE,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA;AAiBE,EAAA,MAAM,UAAS,EAAA,GAAA,CAAA,EAAA,GAAA,UA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,EAAe,GAAG,OAAO,UAAA,EAAwB,GAAA,EAAK,YAAA,EAAc,CAAA,EACvE,CACD,CAAA;;ACtJM,MAAM,MAAA,GAASC,QAAA;;ACAf,MAAM,OAAA,GAAUC,SAAA;;ACYhB,MAAM,MAAA,GAAsD,CAAA,KAAA,qBACjE,GAAA,CAAC,IAAA,EAAA,EAAM,GAAG,KAAA,EAAO;AAkBnB,MAAA,CAAO,OAAA,GAAU,OAAA;AACjB,MAAA,CAAO,MAAA,GAAS,MAAA;AAChB,MAAA,CAAO,QAAA,GAAW,QAAA;AAClB,MAAA,CAAO,OAAA,GAAU,OAAA;AACjB,MAAA,CAAO,MAAA,GAAS,MAAA;AAChB,MAAA,CAAO,KAAA,GAAQ,KAAA;AACf,MAAA,CAAO,WAAA,GAAc,WAAA;AACrB,MAAA,CAAO,OAAA,GAAU,OAAA;AACjB,MAAA,CAAO,KAAA,GAAQ,KAAA;;;;"}
1
+ {"version":3,"file":"module.js","sources":["../src/primitive/context.tsx","../src/primitive/inner-overlay.ts","../src/primitive/root.tsx","../src/primitive/trigger.tsx","../src/primitive/portal.tsx","../src/primitive/backdrop.tsx","../src/primitive/viewport.tsx","../src/primitive/content.tsx","../src/primitive/title.tsx","../src/primitive/description.tsx","../src/primitive/close.tsx","../src/primitive/use-dialog.ts","../src/styles/animation.ts","../src/partials/backdrop.tsx","../src/partials/close.tsx","../src/partials/parts.tsx","../src/partials/content.tsx","../src/partials/portal.tsx","../src/partials/trigger.tsx","../src/dialog.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { Dispatch, RefObject, SetStateAction } from 'react'\n\nimport type { DialogRole, DialogState } from './types'\n\n/**\n * The cross-part ids, derived from the one base id so the trigger's\n * aria-controls, the Content's id, and the labelledby/describedby always\n * agree.\n */\nexport interface DialogIds {\n content: string\n title: string\n description: string\n}\n\n// Which optional parts are currently present: Content only references the\n// rendered Title/Description.\nexport interface PartsPresence {\n title: boolean\n description: boolean\n}\n\nexport interface DialogContextValue {\n state: DialogState\n open: boolean\n /** Whether the dialog occupies the tree: open or mid-exit (`closing`) — the\n * Portal's unmount gate. */\n mounted: boolean\n modal: boolean\n role: DialogRole\n id: string\n ids: DialogIds\n // Nesting level (1 = top-level). Decides the topmost dialog of a stack for\n // Escape, focus, and assistive-tech containment.\n depth: number\n // The element the Portal teleported into, or null for the page body —\n // Content scopes the scroll lock to it. The root provides null; Portal\n // re-provides the context with the field filled in.\n container: HTMLElement | null\n // The rendered Backdrop element, shared because Backdrop and Content are\n // sibling layers: Content's stack entry excepts its own backdrop from the\n // containment so it stays pressable while its dialog is topmost.\n backdropRef: RefObject<HTMLDivElement>\n // The rendered Trigger element — the close's focus-restore fallback when\n // nothing was focused before opening (a pointer press leaves focus on the\n // body: the DS Button suppresses mousedown's native focus).\n triggerRef: RefObject<HTMLButtonElement>\n // The rendered Close element — how the focus containment keeps the part\n // the cycle's last stop (an id would duplicate if Close ever doubled).\n closeRef: RefObject<HTMLButtonElement>\n parts: PartsPresence\n setParts: Dispatch<SetStateAction<PartsPresence>>\n toggle: () => void\n close: () => void\n interactOutside: (event: MouseEvent) => void\n exitComplete: () => void\n}\n\nexport const DialogContext = createContext<DialogContextValue | undefined>(\n undefined\n)\n\nexport const useDialogContext = (): DialogContextValue => {\n const context = useContext(DialogContext)\n if (context === undefined) {\n throw new Error('Dialog parts must be rendered within a <Dialog> root')\n }\n return context\n}\n","// A popup opened inside the dialog — the DS Select, Popover, DropdownMenu or\n// Combobox, a product's own dropdown, a third-party picker — owns the keyboard\n// while it holds focus, and most of them never register in the shared layer\n// stack, so `isTopmostLayer` still names the dialog. Ownership is read from\n// where focus is instead: the ARIA popup roles (`aria-haspopup`'s values) mark\n// the layer focus sits in, and the stack tells a registered layer from a\n// popup that never registered. Cooperation is not required — any well-formed\n// ARIA popup works.\nimport { isLayerElement } from '@mirohq/design-system-use-overlay'\n\nconst POPUP_SELECTOR =\n '[role=\"listbox\"], [role=\"menu\"], [role=\"tree\"], [role=\"grid\"], ' +\n '[role=\"dialog\"], [role=\"alertdialog\"]'\n\n/**\n * Focus sits in a popup that is neither the dialog window nor a registered\n * layer — an open Select listbox, a Popover, a menu — wherever it renders,\n * inside the window or portalled out of it. The body (focus in browser\n * chrome, or nowhere) doesn't count: the dialog re-enters from there.\n */\nexport function innerOverlayHoldsFocus(content: Element | null): boolean {\n if (content === null) return false\n const active = document.activeElement\n if (active === null || active === document.body) return false\n const popup = active.closest(POPUP_SELECTOR)\n if (popup === null) return !content.contains(active)\n return popup !== content && !isLayerElement(popup)\n}\n\n/**\n * Focus sits on a control inside the window whose popup is expanded — a\n * combobox keeps focus on its input while its list is open — so the popup\n * owns Escape. `aria-expanded` alone isn't enough: a disclosure or accordion\n * trigger is expanded too and has no popup to close, so `aria-haspopup` must\n * name one.\n */\nexport function focusIsOnExpandedPopupControl(\n content: Element | null\n): boolean {\n if (content === null) return false\n const active = document.activeElement\n if (active === null || !content.contains(active)) return false\n if (active.getAttribute('aria-expanded') !== 'true') return false\n const popup = active.getAttribute('aria-haspopup')\n return popup !== null && popup !== 'false'\n}\n","// <Root> — owns the open state and renders no DOM.\nimport React, { useContext, useEffect, useRef, useState } from 'react'\nimport type { ReactNode } from 'react'\nimport { useId } from '@mirohq/design-system-use-id'\nimport { useBrowserNavigation } from '@mirohq/design-system-use-browser-navigation'\nimport { isTopmostLayer } from '@mirohq/design-system-use-overlay'\n\nimport { DialogContext } from './context'\nimport type { PartsPresence } from './context'\nimport {\n focusIsOnExpandedPopupControl,\n innerOverlayHoldsFocus,\n} from './inner-overlay'\nimport type { BackNavigationPayload, DialogOptions, DialogState } from './types'\n\nexport interface RootProps extends DialogOptions {\n children?: ReactNode\n}\n\nexport const Root = ({ children, ...options }: RootProps): ReactNode => {\n // Nesting derives from the parent dialog's context (undefined = top-level).\n const depth = (useContext(DialogContext)?.depth ?? 0) + 1\n const generatedId = useId()\n // `?? generatedId`: an explicit `id={undefined}` must not knock out the\n // fallback — ids also key the dialog stack, so they must exist.\n const id = options.id ?? generatedId\n const role = options.role ?? 'dialog'\n // An alert dialog is modal by definition (APG): the prop can't opt out.\n const modal = role === 'alertdialog' || (options.modal ?? true)\n const animated = options.animated === true\n\n const controlled = options.open !== undefined\n const [uncontrolledOpen, setUncontrolledOpen] = useState(\n options.defaultOpen === true\n )\n const open = controlled ? options.open === true : uncontrolledOpen\n\n // Controlled-ness follows the prop live: mirroring the prop keeps the\n // uncontrolled value current, so dropping the prop hands the state back\n // right where it stands.\n if (controlled && uncontrolledOpen !== open) setUncontrolledOpen(open)\n\n // The exit window: only an `animated` close passes through `closing`, and\n // reopening interrupts it. Adjusted during render — an effect would let an\n // unmounted frame slip between the close and the exit.\n const [exiting, setExiting] = useState(false)\n const previousOpen = useRef(open)\n if (previousOpen.current !== open) {\n previousOpen.current = open\n if (open) {\n if (exiting) setExiting(false)\n } else if (animated) {\n setExiting(true)\n }\n }\n\n const state: DialogState = open ? 'open' : exiting ? 'closing' : 'closed'\n\n // Read through a ref so the document-level listeners and the history guard\n // follow the open state alone — fresh callback identities must not re-bind\n // listeners or churn real session-history entries.\n const optionsRef = useRef(options)\n optionsRef.current = options\n\n // onOpenChange reports once per transition-or-intent: every interaction\n // that asks for a different value reports it immediately — a controlled\n // dialog stays put, but the ask is not silent (`open` + `onOpenChange`\n // works on its own, like the Radix-based overlays) — and a change the\n // prop drives by itself reports from the effect. The already-reported\n // check keeps a granted intent from echoing when the prop answers it.\n // No call on mount.\n const reportedOpen = useRef(open)\n const resolvedOpen = useRef(open)\n useEffect(() => {\n if (resolvedOpen.current === open) return\n resolvedOpen.current = open\n if (reportedOpen.current === open) return\n reportedOpen.current = open\n optionsRef.current.onOpenChange?.(open)\n })\n\n const setOpen = (next: boolean): void => {\n if (open === next) return\n reportedOpen.current = next\n optionsRef.current.onOpenChange?.(next)\n // A controlled dialog never moves on its own — the consumer decides at\n // the source (this report and the dismissal callbacks) and answers\n // through the prop.\n if (!controlled) setUncontrolledOpen(next)\n }\n\n // Escape is a document-level concern, not a part's — it must work wherever\n // focus is. The handler lives on a ref so the listener binds per open\n // window, not per render; a `closing` dialog has already detached it.\n const onEscapeRef = useRef<(event: KeyboardEvent) => void>(() => {})\n onEscapeRef.current = (event: KeyboardEvent): void => {\n // Only the topmost dialog answers Escape — a nested stack closes one\n // layer at a time — and an inner overlay holding focus answers first.\n if (!isTopmostLayer(id)) return\n const content = document.getElementById(`${id}-content`)\n if (\n innerOverlayHoldsFocus(content) ||\n focusIsOnExpandedPopupControl(content)\n ) {\n return\n }\n optionsRef.current.onEscapeKeyDown?.(event)\n if (event.defaultPrevented) return\n if (optionsRef.current.closeOnEscape === false) return\n setOpen(false)\n }\n\n useEffect(() => {\n if (!open) return\n const onKeyDown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') onEscapeRef.current(event)\n }\n document.addEventListener('keydown', onKeyDown, true)\n return () => document.removeEventListener('keydown', onKeyDown, true)\n }, [open])\n\n // closeOnBack: while open, a guard entry in the session history turns the\n // host's Back into a dismissal instead of a navigation — and the entry a\n // Back press spends survives in the forward stack, so the host's Forward\n // reopens what Back closed. It lives on the root — the guard concerns the\n // dialog's openness, not any rendered part.\n const onBackRef = useRef<() => boolean>(() => false)\n onBackRef.current = (): boolean => {\n // The host's back has no cancelable event — synthesize the veto payload\n // so the callback contract matches the other dismissals.\n const payload: BackNavigationPayload = {\n defaultPrevented: false,\n preventDefault() {\n payload.defaultPrevented = true\n },\n }\n optionsRef.current.onBackNavigation?.(payload)\n if (payload.defaultPrevented === true) return false\n // A controlled dialog only records the request (onOpenChange reports the\n // intent) — the consumer follows through the prop, and the guard re-arms\n // until it does.\n setOpen(false)\n return !controlled\n }\n\n // `backNavigate`'s mirror, decided the same way — and reachable from the\n // animated `closing` state too: Forward interrupts the exit.\n const onForwardRef = useRef<() => boolean>(() => false)\n onForwardRef.current = (): boolean => {\n const payload: BackNavigationPayload = {\n defaultPrevented: false,\n preventDefault() {\n payload.defaultPrevented = true\n },\n }\n optionsRef.current.onForwardNavigation?.(payload)\n if (payload.defaultPrevented === true) return false\n if (optionsRef.current.closeOnBack !== true) return false\n setOpen(true)\n return !controlled\n }\n\n useBrowserNavigation({\n enabled: options.closeOnBack === true,\n open,\n onBack: () => onBackRef.current(),\n onForward: () => onForwardRef.current(),\n // The dialog's nesting depth is what a returning dialog recognizes its\n // own spent entry by: the instance is new after a remount, but the\n // position in the stack is the same.\n claim: `dialog:${depth}`,\n })\n\n // A press that starts inside the dialog window never counts as outside,\n // wherever it releases: a text-selection drag out of the window dispatches\n // its click on the layer around it (a click targets the press's and the\n // release's common ancestor), so the click's target alone can't tell a\n // dismissal from a drag. Each press records its origin instead.\n const insidePressRef = useRef(false)\n useEffect(() => {\n if (!open) return\n const contentId = `${id}-content`\n const onPointerDown = (event: Event): void => {\n const content = document.getElementById(contentId)\n insidePressRef.current =\n content !== null &&\n event.target instanceof Node &&\n content.contains(event.target)\n }\n document.addEventListener('pointerdown', onPointerDown, true)\n return () =>\n document.removeEventListener('pointerdown', onPointerDown, true)\n }, [open, id])\n\n const interactOutside = (event: MouseEvent): void => {\n if (insidePressRef.current) return\n // An outside press is an intent, not a close command: the consumer may\n // veto it, and the role's dismissal setting gates it — an alert dialog\n // interrupts for a response, so it doesn't dismiss unless opted in.\n options.onInteractOutside?.(event)\n if (event.defaultPrevented) return\n if (!(options.closeOnInteractOutside ?? role === 'dialog')) return\n setOpen(false)\n }\n const interactOutsideRef = useRef(interactOutside)\n interactOutsideRef.current = interactOutside\n\n const backdropRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const closeRef = useRef<HTMLButtonElement>(null)\n\n // A non-modal dialog coexists with the page: no layer intercepts the\n // press, so the outside interaction is read from the document. Presses\n // inside the window are inside; the trigger's own press stays a plain\n // toggle — counting it as outside would close and immediately reopen.\n useEffect(() => {\n if (!open || modal) return\n const contentId = `${id}-content`\n const onClick = (event: MouseEvent): void => {\n if (!isTopmostLayer(id)) return\n if (!(event.target instanceof Node)) return\n if (document.getElementById(contentId)?.contains(event.target) === true)\n return\n if (triggerRef.current?.contains(event.target) === true) return\n interactOutsideRef.current(event)\n }\n document.addEventListener('click', onClick)\n return () => document.removeEventListener('click', onClick)\n }, [open, modal, id])\n\n const [parts, setParts] = useState<PartsPresence>({\n title: false,\n description: false,\n })\n\n return (\n <DialogContext.Provider\n value={{\n state,\n open,\n mounted: state !== 'closed',\n modal,\n role,\n id,\n ids: {\n content: `${id}-content`,\n title: `${id}-title`,\n description: `${id}-description`,\n },\n depth,\n container: null,\n backdropRef,\n triggerRef,\n closeRef,\n parts,\n setParts,\n toggle: () => setOpen(!open),\n close: () => setOpen(false),\n interactOutside,\n exitComplete: () => setExiting(false),\n }}\n >\n {children}\n </DialogContext.Provider>\n )\n}\n","// <Trigger> — toggles the dialog; focus returns here on close.\nimport React, { forwardRef } from 'react'\nimport type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { composeHandlers, mergeRefs } from '@mirohq/design-system-utils'\n\nimport { useDialogContext } from './context'\n\nexport interface TriggerProps extends ComponentProps<typeof Primitive.button> {}\n\nexport const Trigger = forwardRef<HTMLButtonElement, TriggerProps>(\n ({ asChild = false, ...props }, forwardedRef) => {\n const { open, state, ids, toggle, triggerRef } = useDialogContext()\n const consumer = composeHandlers(\n { onClick: toggle },\n asChild ? props : { type: 'button' as const, ...props }\n )\n\n return (\n <Primitive.button\n {...consumer}\n aria-haspopup='dialog'\n aria-expanded={open}\n // A dangling aria-controls id is an a11y defect — only while open.\n aria-controls={open ? ids.content : undefined}\n data-state={state}\n asChild={asChild}\n ref={mergeRefs([triggerRef, forwardedRef])}\n />\n )\n }\n)\n","// <Portal> — teleports the layers out of the tree while open.\nimport React from 'react'\nimport type { ReactNode } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { DialogContext, useDialogContext } from './context'\n\nexport interface PortalProps {\n children?: ReactNode\n /** The element to portal into. @default document.body */\n container?: HTMLElement | null\n}\n\nexport const Portal = ({ children, container }: PortalProps): ReactNode => {\n const context = useDialogContext()\n // `mounted`, not `open`: an animated dialog stays in the tree through\n // `closing` so its exit visual can play before everything unmounts.\n if (!context.mounted || typeof document === 'undefined') return null\n // Re-provide the context with the scoped container (null = page body) so\n // Content locks the right scroll surface.\n return createPortal(\n <DialogContext.Provider\n value={{ ...context, container: container ?? null }}\n >\n {children}\n </DialogContext.Provider>,\n container ?? document.body\n )\n}\n","// <Backdrop> — the layer behind the dialog window.\nimport React, { forwardRef } from 'react'\nimport type { ComponentProps, MouseEvent } from 'react'\nimport { composeHandlers, mergeRefs } from '@mirohq/design-system-utils'\nimport { isTopmostLayer } from '@mirohq/design-system-use-overlay'\n\nimport { useDialogContext } from './context'\n\nexport interface BackdropProps extends ComponentProps<'div'> {}\n\nexport const Backdrop = forwardRef<HTMLDivElement, BackdropProps>(\n (props, forwardedRef) => {\n const { modal, state, id, container, backdropRef, interactOutside } =\n useDialogContext()\n\n // Only a modal dialog dims the page — non-modal coexists with it.\n if (!modal) return null\n\n const consumer = composeHandlers(\n {\n // Only the topmost dialog of a stack answers an outside press.\n onClick: (event: MouseEvent<HTMLElement>) => {\n if (isTopmostLayer(id)) interactOutside(event.nativeEvent)\n },\n },\n props\n )\n\n return (\n // role=presentation: the backdrop is a purely visual layer; its press\n // is the pointer half of an outside dismissal, with Escape as the\n // keyboard path (jsx-a11y's keyboard pairing doesn't apply).\n <div\n role='presentation'\n {...consumer}\n data-state={state}\n // A scoped dialog (Portal container) pins to the container, not the\n // page — the styled layer switches positioning on this attribute.\n data-scoped={container === null ? undefined : ''}\n ref={mergeRefs([backdropRef, forwardedRef])}\n />\n )\n }\n)\n","// <Viewport> — the positioning + scroll layer around the dialog window.\nimport React, { forwardRef } from 'react'\nimport type { ComponentProps, MouseEvent } from 'react'\nimport { composeHandlers } from '@mirohq/design-system-utils'\nimport { isTopmostLayer } from '@mirohq/design-system-use-overlay'\n\nimport { useDialogContext } from './context'\n\nexport interface ViewportProps extends ComponentProps<'div'> {\n /** Marks the layer full-screen: the window fills it edge to edge, so the\n * layer drops its own inset. @default false */\n fullScreen?: boolean\n}\n\nexport const Viewport = forwardRef<HTMLDivElement, ViewportProps>(\n ({ fullScreen, ...props }, forwardedRef) => {\n const { state, id, modal, container, interactOutside } = useDialogContext()\n\n const consumer = composeHandlers(\n {\n // Box presses bubble up here — only a press that started on the\n // viewport itself is an outside interaction, and only the topmost\n // dialog of a stack answers it.\n onClick: (event: MouseEvent<HTMLElement>) => {\n if (event.target !== event.currentTarget) return\n if (!isTopmostLayer(id)) return\n interactOutside(event.nativeEvent)\n },\n },\n props\n )\n\n return (\n // role=presentation: a purely presentational positioning wrapper — the\n // press it answers is the pointer half of an outside dismissal, with\n // Escape as the keyboard path.\n <div\n role='presentation'\n {...consumer}\n data-state={state}\n // A scoped dialog (Portal container) pins to the container, not the\n // page — the styled layer switches positioning on this attribute.\n data-scoped={container === null ? undefined : ''}\n // A non-modal dialog coexists with the page — without this marker the\n // styled layer stops intercepting pointer presses.\n data-modal={modal ? '' : undefined}\n // A full-screen window fills the layer edge to edge — the styled\n // layer drops its inset on this attribute.\n data-full-screen={fullScreen === true ? '' : undefined}\n ref={forwardedRef}\n />\n )\n }\n)\n","// <Content> — the dialog window: focus moves in on open, restores on close,\n// traps while modal.\nimport React, { forwardRef, useEffect, useRef } from 'react'\nimport type { ComponentProps, RefObject } from 'react'\nimport { mergeRefs } from '@mirohq/design-system-utils'\nimport { useFocusTrap } from '@mirohq/design-system-use-focus-trap'\nimport { useScrollLock } from '@mirohq/design-system-use-scroll-lock'\nimport {\n isTopmostLayer,\n useOverlay,\n useOverlayExit,\n} from '@mirohq/design-system-use-overlay'\n\nimport { useDialogContext } from './context'\nimport { innerOverlayHoldsFocus } from './inner-overlay'\n\nexport interface ContentProps extends ComponentProps<'div'> {\n /** The element to focus when the dialog opens. @default the dialog window */\n initialFocus?: RefObject<HTMLElement>\n}\n\nexport const Content = forwardRef<HTMLDivElement, ContentProps>(\n ({ initialFocus, ...props }, forwardedRef) => {\n const {\n state,\n open,\n modal,\n role,\n id,\n ids,\n depth,\n container,\n backdropRef,\n triggerRef,\n closeRef,\n parts,\n exitComplete,\n } = useDialogContext()\n const contentRef = useRef<HTMLDivElement>(null)\n\n // The open window: the stack entry, containment, initial focus, and the\n // focus restore — released the moment a close starts, not when the exit\n // visual finishes.\n useOverlay(contentRef, {\n enabled: open,\n id,\n depth,\n modal,\n backdrop: () => backdropRef.current,\n initialFocus,\n // A pointer press opens without focusing the trigger (the DS Button\n // suppresses mousedown's native focus), so the close would find only\n // the body to restore to — fall back to the trigger, the invoker APG\n // says focus returns to.\n restoreFocus: () => triggerRef.current,\n })\n\n // The exit window: a Content rendered while not open only happens in\n // `closing` — the still-painting layer leaves the page's interaction and\n // its finished visual reports the unmount.\n useOverlayExit(contentRef, {\n exiting: !open,\n boundary: container,\n backdrop: () => backdropRef.current,\n onExitComplete: exitComplete,\n })\n\n // The lock spans the whole mount — through `closing` too: releasing it\n // mid-exit would bring the scrollbar back and reflow the page under the\n // still-painting layer. A scoped dialog locks its portal container; a\n // page dialog locks the body. The context's `null` container means the\n // page body — the hook's default — not its \"no target yet\".\n useScrollLock(modal, container ?? undefined)\n\n useFocusTrap(contentRef, {\n // Only a modal dialog traps, and only while topmost — a nested dialog\n // owns focus while open, and so does an inner overlay that holds it.\n enabled: () =>\n modal &&\n isTopmostLayer(id) &&\n !innerOverlayHoldsFocus(contentRef.current),\n // The Close part is the cycle's last stop wherever it renders (SPEC).\n last: () => closeRef.current,\n })\n\n // The constraint is \"never neither\": a rendered Title or an accessible\n // label on the window. Read from the DOM — it is committed before this\n // effect, while the Title's presence registration is not, and a label\n // arriving through any prop spread counts too.\n useEffect(() => {\n if (!open) return\n const element = contentRef.current\n if (element === null) return\n const named =\n parts.title ||\n document.getElementById(ids.title) !== null ||\n element.hasAttribute('aria-label') ||\n element.hasAttribute('aria-labelledby')\n if (!named) {\n console.warn(\n '[Dialog] the dialog resolves no accessible name: render a ' +\n '<Dialog.Title>, or give Content an aria-label when it truly ' +\n 'cannot have one.'\n )\n }\n // APG makes the description mandatory for an alert dialog only.\n if (role !== 'alertdialog') return\n const described =\n parts.description ||\n document.getElementById(ids.description) !== null ||\n element.hasAttribute('aria-describedby')\n if (!described) {\n console.warn(\n '[Dialog] the alert dialog resolves no accessible description: ' +\n 'render a <Dialog.Description>, or give Content an ' +\n 'aria-describedby.'\n )\n }\n }, [open, role, parts.title, parts.description, ids.title, ids.description])\n\n // The ARIA relationships always follow what is rendered — an omitted part\n // never leaves a dangling reference, and a consumer-supplied value wins\n // over the derived one.\n const labelling: Record<string, string> = {}\n if (parts.title && props['aria-labelledby'] == null) {\n labelling['aria-labelledby'] = ids.title\n }\n if (parts.description && props['aria-describedby'] == null) {\n labelling['aria-describedby'] = ids.description\n }\n\n return (\n // A neutral element with the role, not <dialog>: the window is the\n // initial focus target, so it carries tabindex — which HTML forbids on\n // <dialog> — and the native element only pays off via showModal(),\n // which this contract deliberately doesn't use.\n <div\n {...props}\n {...labelling}\n role={role}\n id={ids.content}\n aria-modal={modal || undefined}\n // The initial focus target: focusable in script, not in the tab order.\n tabIndex={-1}\n data-state={state}\n ref={mergeRefs([contentRef, forwardedRef])}\n />\n )\n }\n)\n","// <Title> — the dialog's accessible name.\nimport React, { forwardRef, useEffect } from 'react'\nimport type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nimport { useDialogContext } from './context'\n\nexport interface TitleProps extends ComponentProps<typeof Primitive.h2> {}\n\nexport const Title = forwardRef<HTMLHeadingElement, TitleProps>(\n ({ asChild = false, ...props }, forwardedRef) => {\n const { ids, setParts } = useDialogContext()\n\n // Presence drives the ARIA relationships on Content — a Title can appear\n // or disappear at any time, open or closed.\n useEffect(() => {\n setParts(parts => (parts.title ? parts : { ...parts, title: true }))\n return () =>\n setParts(parts => (parts.title ? { ...parts, title: false } : parts))\n }, [setParts])\n\n return (\n <Primitive.h2\n {...props}\n id={ids.title}\n asChild={asChild}\n ref={forwardedRef}\n />\n )\n }\n)\n","// <Description> — the dialog's accessible description.\nimport React, { forwardRef, useEffect } from 'react'\nimport type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nimport { useDialogContext } from './context'\n\nexport interface DescriptionProps extends ComponentProps<typeof Primitive.p> {}\n\nexport const Description = forwardRef<HTMLParagraphElement, DescriptionProps>(\n ({ asChild = false, ...props }, forwardedRef) => {\n const { ids, setParts } = useDialogContext()\n\n // Presence drives the ARIA relationships on Content — a Description can\n // appear or disappear at any time, open or closed.\n useEffect(() => {\n setParts(parts =>\n parts.description ? parts : { ...parts, description: true }\n )\n return () =>\n setParts(parts =>\n parts.description ? { ...parts, description: false } : parts\n )\n }, [setParts])\n\n return (\n <Primitive.p\n {...props}\n id={ids.description}\n asChild={asChild}\n ref={forwardedRef}\n />\n )\n }\n)\n","// <Close> — the visible in-dialog close affordance.\nimport React, { forwardRef } from 'react'\nimport type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { composeHandlers, mergeRefs } from '@mirohq/design-system-utils'\n\nimport { useDialogContext } from './context'\n\nexport interface CloseProps extends ComponentProps<typeof Primitive.button> {}\n\nexport const Close = forwardRef<HTMLButtonElement, CloseProps>(\n ({ asChild = false, ...props }, forwardedRef) => {\n const { close, closeRef } = useDialogContext()\n const consumer = composeHandlers(\n { onClick: close },\n asChild ? props : { type: 'button' as const, ...props }\n )\n\n return (\n <Primitive.button\n {...consumer}\n asChild={asChild}\n // Registered so the focus containment keeps it the cycle's last stop\n // wherever it renders.\n ref={mergeRefs([closeRef, forwardedRef])}\n />\n )\n }\n)\n","// useDialog — imperative access to the nearest <Dialog> root from anywhere in\n// its subtree: the same state a part reads, plus open/close/toggle.\nimport { useDialogContext } from './context'\nimport type { DialogState } from './types'\n\nexport interface UseDialogResult {\n id: string\n isOpen: boolean\n state: DialogState\n modal: boolean\n open: () => void\n close: () => void\n toggle: () => void\n}\n\nexport const useDialog = (): UseDialogResult => {\n const context = useDialogContext()\n\n return {\n id: context.id,\n isOpen: context.open,\n state: context.state,\n modal: context.modal,\n // Idempotent: toggle() would close an already-open dialog.\n open: () => {\n if (!context.open) context.toggle()\n },\n close: context.close,\n toggle: context.toggle,\n }\n}\n","// Must stay under the exit-watch fallback ceiling (500ms), or a closing\n// dialog would be cut short instead of finishing its animation.\nexport const ANIMATION_DURATION = '250ms'\n\nexport const MOTION = '@media (prefers-reduced-motion: no-preference)'\n","import { keyframes, styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nimport { Backdrop as BackdropPrimitive } from '../primitive'\nimport { ANIMATION_DURATION, MOTION } from '../styles/animation'\n\nconst fadeIn = keyframes({\n from: { opacity: 0 },\n to: { opacity: 1 },\n})\n\nconst fadeOut = keyframes({\n from: { opacity: 1 },\n to: { opacity: 0 },\n})\n\nexport const Backdrop = styled(BackdropPrimitive, {\n position: 'fixed',\n inset: 0,\n zIndex: '$dialog',\n backgroundColor: '$background-alpha-neutrals-overlay',\n // A scoped dialog (Portal container) pins to the container, not the page.\n '&[data-scoped]': {\n position: 'absolute',\n },\n\n [MOTION]: {\n animation: `${fadeIn} ${ANIMATION_DURATION} ease-out`,\n // `forwards` holds the final frame until the unmount lands.\n '&[data-state=\"closing\"]': {\n animation: `${fadeOut} ${ANIMATION_DURATION} ease-out forwards`,\n },\n },\n})\nexport type BackdropProps = StrictComponentProps<typeof Backdrop>\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nimport { Close as ClosePrimitive } from '../primitive'\n\n// Positioning only: the corner pin is the dialog's anatomy; the button's\n// visual comes from what the consumer composes in (typically an IconButton\n// via `asChild`).\nexport const Close = styled(ClosePrimitive, {\n position: 'absolute',\n top: '$300',\n right: '$300',\n})\nexport type CloseProps = StrictComponentProps<typeof Close>\n","import type { ComponentProps } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nimport {\n Description as DescriptionPrimitive,\n Title as TitlePrimitive,\n} from '../primitive'\n\n// The window owns the default inset; each part escapes it with negative\n// margins and lays its spec'd box with its own padding, so the parts sit\n// edge to edge while bare content stays padded.\n\nexport const Banner = styled(Primitive.div, {\n margin: '-$500 -$500 0',\n // The floor yields on short screens (text zoom, 400% reflow): the media\n // must not eat the space the title and actions need.\n minHeight: 'min(300px, 40vh)',\n borderTopLeftRadius: '$100',\n borderTopRightRadius: '$100',\n overflow: 'hidden',\n backgroundColor: '$background-primary-subtle',\n // Media dropped in fills the slot with no hand-made styles.\n '& > img, & > video': {\n display: 'block',\n width: '100%',\n height: '100%',\n objectFit: 'contain',\n },\n})\nexport type BannerProps = ComponentProps<typeof Banner>\n\nexport const Title = styled(TitlePrimitive, {\n fontFamily: '$heading',\n fontSize: '$300',\n lineHeight: 1.35,\n fontWeight: 400,\n fontFeatureSettings: \"'ss01'\",\n padding: '$400 $1200 $100 $500',\n margin: '-$500 -$500 0',\n // A banner before it already consumed the window's top inset, so the title\n // must not escape it a second time.\n [`${Banner} ~ &`]: {\n marginTop: 0,\n },\n})\nexport type TitleProps = ComponentProps<typeof Title>\n\nexport const Description = styled(DescriptionPrimitive, {\n fontFamily: '$body',\n fontSize: '$200',\n lineHeight: 1.5,\n padding: '$200 $500',\n margin: '0 -$500',\n // As the last part, its own $200 plus the window's $500 would overshoot\n // the $500 closing inset.\n '&:last-child': {\n marginBottom: '-$200',\n },\n})\nexport type DescriptionProps = ComponentProps<typeof Description>\n\nexport const Actions = styled(Primitive.div, {\n display: 'flex',\n gap: '$100',\n // The window's inset supplies the $500 closing edge below the row.\n padding: '$200 $500 0',\n margin: '0 -$500',\n})\nexport type ActionsProps = ComponentProps<typeof Actions>\n","import React, { forwardRef } from 'react'\nimport type { ElementRef, RefObject } from 'react'\nimport { keyframes, styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nimport {\n Content as ContentPrimitive,\n Viewport as ViewportPrimitive,\n} from '../primitive'\nimport { Actions, Banner, Description, Title } from './parts'\nimport { Close } from './close'\nimport { ANIMATION_DURATION, MOTION } from '../styles/animation'\n\nconst scaleIn = keyframes({\n from: { opacity: 0, transform: 'scale(0.8)' },\n to: { opacity: 1, transform: 'scale(1)' },\n})\n\nconst scaleOut = keyframes({\n from: { opacity: 1, transform: 'scale(1)' },\n to: { opacity: 0, transform: 'scale(0.8)' },\n})\n\nconst StyledViewport = styled(ViewportPrimitive, {\n position: 'fixed',\n inset: 0,\n zIndex: '$dialog',\n display: 'flex',\n overflow: 'auto',\n padding: '$300',\n '&[data-scoped]': {\n position: 'absolute',\n },\n '&[data-full-screen]': {\n padding: 0,\n },\n '&:not([data-modal])': {\n pointerEvents: 'none',\n },\n})\n\nconst StyledContent = styled(ContentPrimitive, {\n position: 'relative',\n margin: 'auto',\n boxSizing: 'border-box',\n width: 'fit-content',\n // The floors yield to the screen: WCAG 1.4.10 reflow requires the window\n // to fit a 320px viewport (400% zoom), so neither bound may exceed the\n // layer's width.\n minWidth: 'min(560px, 100%)',\n maxWidth: 'min(960px, 100%)',\n backgroundColor: '$background-neutrals',\n color: '$text-neutrals',\n borderRadius: '$100',\n boxShadow: '$elevation-300',\n overflowWrap: 'break-word',\n outline: 'none',\n // The window stays interactive when its (non-modal) layer stops\n // intercepting presses.\n pointerEvents: 'auto',\n padding: '$500',\n\n [`&:has(${Title})`]: {\n paddingTop: 0,\n [`& ${Banner}`]: { marginTop: 0 },\n [`& ${Title}`]: { marginTop: 0 },\n },\n [`&:has(${Actions})`]: {\n paddingBottom: 0,\n [`& ${Actions}`]: { paddingBottom: '$500' },\n [`& ${Description}:last-child`]: { marginBottom: 0, paddingBottom: '$500' },\n },\n\n [MOTION]: {\n animation: `${scaleIn} ${ANIMATION_DURATION} ease-out`,\n '&[data-state=\"closing\"]': {\n animation: `${scaleOut} ${ANIMATION_DURATION} ease-out forwards`,\n },\n },\n\n variants: {\n scroll: {\n viewport: {},\n window: {\n maxHeight: '100%',\n overflow: 'auto',\n [`& ${Title}`]: {\n position: 'sticky',\n top: 0,\n backgroundColor: '$background-neutrals',\n },\n [`& ${Close}`]: {\n position: 'sticky',\n top: '$300',\n right: 'auto',\n float: 'right',\n marginRight: '-$200',\n zIndex: 1,\n },\n [`& ${Banner}`]: {\n overflow: 'visible',\n },\n },\n },\n\n flat: {\n true: {\n padding: 0,\n overflow: 'hidden',\n [`& ${Banner}`]: { margin: 0 },\n [`& ${Title}`]: { margin: 0 },\n [`& ${Description}`]: { margin: 0 },\n [`& ${Description}:last-child`]: { paddingBottom: '$500' },\n [`& ${Actions}`]: { margin: 0, paddingBottom: '$500' },\n },\n },\n\n fullScreen: {\n true: {\n width: '100%',\n height: '100%',\n minWidth: 0,\n maxWidth: 'none',\n margin: 0,\n borderRadius: 0,\n },\n },\n },\n\n compoundVariants: [\n {\n flat: true,\n scroll: 'window',\n css: { overflow: 'auto' },\n },\n ],\n\n defaultVariants: {\n scroll: 'viewport',\n },\n})\n\nexport interface ContentProps\n extends StrictComponentProps<typeof StyledContent> {\n /** The element to focus when the dialog opens. @default the dialog window */\n initialFocus?: RefObject<HTMLElement>\n}\n\nexport const Content = forwardRef<\n ElementRef<typeof StyledContent>,\n ContentProps\n>(({ fullScreen, ...props }, forwardedRef) => (\n <StyledViewport fullScreen={fullScreen === true}>\n <StyledContent {...props} fullScreen={fullScreen} ref={forwardedRef} />\n </StyledViewport>\n))\n","import { Portal as PortalPrimitive } from '../primitive'\nimport type { PortalProps as PortalPrimitiveProps } from '../primitive'\n\n// Unstyled part — passes straight through to the primitive.\nexport interface PortalProps extends PortalPrimitiveProps {}\nexport const Portal = PortalPrimitive\n","import { Trigger as TriggerPrimitive } from '../primitive'\nimport type { TriggerProps as TriggerPrimitiveProps } from '../primitive'\n\n// Unstyled part — passes straight through to the primitive.\nexport interface TriggerProps extends TriggerPrimitiveProps {}\nexport const Trigger = TriggerPrimitive\n","import React from 'react'\nimport type { ReactNode } from 'react'\n\nimport type { DialogOptions } from './primitive'\nimport { Root } from './primitive'\nimport { Backdrop } from './partials/backdrop'\nimport { Close } from './partials/close'\nimport { Content } from './partials/content'\nimport { Actions, Banner, Description, Title } from './partials/parts'\nimport { Portal } from './partials/portal'\nimport { Trigger } from './partials/trigger'\n\nexport interface DialogProps extends DialogOptions {\n children?: ReactNode\n}\n\n// The root owns the open state and renders no DOM.\nexport const Dialog: ((props: DialogProps) => ReactNode) & Parts = props => (\n <Root {...props} />\n)\n\n// Parts\n// -----------------------------------------------------------------------------\n\nexport interface Parts {\n Trigger: typeof Trigger\n Portal: typeof Portal\n Backdrop: typeof Backdrop\n Content: typeof Content\n Banner: typeof Banner\n Title: typeof Title\n Description: typeof Description\n Actions: typeof Actions\n Close: typeof Close\n}\n\nDialog.Trigger = Trigger\nDialog.Portal = Portal\nDialog.Backdrop = Backdrop\nDialog.Content = Content\nDialog.Banner = Banner\nDialog.Title = Title\nDialog.Description = Description\nDialog.Actions = Actions\nDialog.Close = Close\n"],"names":["_a","_b","Trigger","Portal","Backdrop","Content","Title","Description","Close","BackdropPrimitive","ClosePrimitive","TitlePrimitive","DescriptionPrimitive","ViewportPrimitive","ContentPrimitive","PortalPrimitive","TriggerPrimitive"],"mappings":";;;;;;;;;;;;AA2DO,MAAM,aAAA,GAAgB,aAAA;AAAA,EAC3B;AACF,CAAA;AAEO,MAAM,mBAAmB,MAA0B;AACxD,EAAA,MAAM,OAAA,GAAU,WAAW,aAAa,CAAA;AACxC,EAAA,IAAI,YAAY,MAAA,EAAW;AACzB,IAAA,MAAM,IAAI,MAAM,sDAAsD,CAAA;AAAA,EACxE;AACA,EAAA,OAAO,OAAA;AACT,CAAA;;AC3DA,MAAM,cAAA,GACJ,sGAAA;AASK,SAAS,uBAAuB,OAAA,EAAkC;AACvE,EAAA,IAAI,OAAA,KAAY,MAAM,OAAO,KAAA;AAC7B,EAAA,MAAM,SAAS,QAAA,CAAS,aAAA;AACxB,EAAA,IAAI,MAAA,KAAW,IAAA,IAAQ,MAAA,K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A,MACR,GAAA,EAAK,EAAE,QAAA,EAAU,MAAA;AAAO;AAC1B,GACF;AAAA,EAEA,eAAA,EAAiB;AAAA,IACf,MAAA,EAAQ;AAAA;AAEZ,CAAC,CAAA;AAQM,MAAM,OAAA,GAAU,WAGrB,CAAC,EAAE,YAAY,GAAG,KAAA,EAAM,EAAG,YAAA,qBAC3B,GAAA,CAAC,cAAA,EAAA,EAAe,YAAY,UAAA,KAAe,IAAA,EACzC,8BAAC,aAAA,EAAA,EAAe,GAAG,OAAO,UAAA,EAAwB,GAAA,EAAK,YAAA,EAAc,CAAA,EACvE,CACD,CAAA;;ACtJM,MAAM,MAAA,GAASC,QAAA;;ACAf,MAAM,OAAA,GAAUC,SAAA;;ACYhB,MAAM,MAAA,GAAsD,CAAA,KAAA,qBACjE,GAAA,CAAC,IAAA,EAAA,EAAM,GAAG,KAAA,EAAO;AAkBnB,MAAA,CAAO,OAAA,GAAU,OAAA;AACjB,MAAA,CAAO,MAAA,GAAS,MAAA;AAChB,MAAA,CAAO,QAAA,GAAW,QAAA;AAClB,MAAA,CAAO,OAAA,GAAU,OAAA;AACjB,MAAA,CAAO,MAAA,GAAS,MAAA;AAChB,MAAA,CAAO,KAAA,GAAQ,KAAA;AACf,MAAA,CAAO,WAAA,GAAc,WAAA;AACrB,MAAA,CAAO,OAAA,GAAU,OAAA;AACjB,MAAA,CAAO,KAAA,GAAQ,KAAA;;;;"}
package/dist/types.d.ts CHANGED
@@ -40,7 +40,10 @@ interface DialogOptions extends DialogCallbacks {
40
40
  open?: boolean;
41
41
  /** Initial open state for the uncontrolled dialog. @default false */
42
42
  defaultOpen?: boolean;
43
- /** Marks the dialog modal: `aria-modal`, focus trap, scroll lock. @default true */
43
+ /**
44
+ * Marks the dialog modal: `aria-modal`, focus trap, scroll lock. Ignored
45
+ * for `role='alertdialog'`, which is always modal. @default true
46
+ */
44
47
  modal?: boolean;
45
48
  /** The ARIA pattern: a plain dialog or an alert dialog for urgent
46
49
  * interruptions. @default 'dialog' */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirohq/design-system-dialog",
3
- "version": "0.1.0-dialog.0",
3
+ "version": "0.1.0",
4
4
  "description": "React dialog following the WAI-ARIA APG modal dialog pattern",
5
5
  "author": "Miro",
6
6
  "source": "src/index.ts",
@@ -28,13 +28,17 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@mirohq/design-system-primitive": "^2.2.1",
31
- "@mirohq/design-system-stitches": "^3.3.34-dialog.0",
32
- "@mirohq/design-system-use-browser-navigation": "^0.2.0-dialog.0",
33
- "@mirohq/design-system-use-focus-trap": "^0.1.1-dialog.0",
31
+ "@mirohq/design-system-stitches": "^3.3.34",
32
+ "@mirohq/design-system-use-browser-navigation": "^0.2.0",
33
+ "@mirohq/design-system-use-focus-trap": "^0.1.1",
34
34
  "@mirohq/design-system-use-id": "^1.1.1",
35
- "@mirohq/design-system-use-overlay": "^0.2.0-dialog.0",
35
+ "@mirohq/design-system-use-overlay": "^0.2.0",
36
36
  "@mirohq/design-system-use-scroll-lock": "^0.1.0",
37
- "@mirohq/design-system-utils": "^1.5.0-dialog.0"
37
+ "@mirohq/design-system-utils": "^1.5.0"
38
+ },
39
+ "devDependencies": {
40
+ "@mirohq/design-system-popover": "^6.3.51",
41
+ "@mirohq/design-system-select": "^1.3.55"
38
42
  },
39
43
  "scripts": {
40
44
  "build": "rollup -c ../../../rollup.config.js",