@plexui/ui 0.32.0 → 0.34.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.
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../src/components/ContextMenu/shared.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAA;AAC1C,iFAAiF;AACjF,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAA;AAC9C;4EAC4E;AAC5E,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAA;AAC1C,qGAAqG;AACrG,MAAM,cAAc,GAAG,EAAE,CAAA;AAUzB,MAAM,EAAE,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,EAAE;IACzC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IACvC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,CAAC,CAAA;IACtC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAA;AACpE,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAoB,EAAE,MAAc;IACrE,MAAM,GAAG,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAA;IAC3C,MAAM,IAAI,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAA;IAC9E,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAA;IACvC,MAAM,KAAK,GAAG,IAAI,CAAC,G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AU,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAA;IACjR,MAAM,GAAG,GAAG,kDAAkD,KAAK,aAAa,MAAM,kBAAkB,KAAK,IAAI,MAAM,uCAAuC,KAAK,IAAI,MAAM,MAAM,IAAI,WAAW,CAAA;IAClM,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,kBAAkB,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;AAC1F,CAAC","sourcesContent":["/** A touch held this long opens the menu, as a UIKit long press (0.5 s). */\nexport const CONTEXT_MENU_LONG_PRESS = 500\n/** A touch that moves farther than this before then scrolls or drags instead. */\nexport const CONTEXT_MENU_LONG_PRESS_SLOP = 10\n/** The kit's gap between the preview and the menu: iOS 27 Context Menu 125:58750, Alignment=Vertical, the menu at\n * 176.5 under a content area that ends at 160.5 (the iOS 26 kit had 18). */\nexport const CONTEXT_MENU_PREVIEW_GAP = 16\n/** The kit's preview corner (Content Area, radius 30), for an element without corners of its own. */\nconst PREVIEW_RADIUS = 30\n\ntype Rect = { x: number; y: number; width: number; height: number }\n\n/** Where the menu opens: at the pointer, under the element for the keyboard, or beside a touch-and-hold preview. */\nexport type ContextMenuPresentation =\n | { kind: \"pointer\"; rect: Rect }\n | { kind: \"keyboard\"; rect: Rect }\n | { kind: \"preview\"; rect: Rect; radius: number; align: \"start\" | \"end\" }\n\nconst px = (value: string, base: number) => {\n const number = Number.parseFloat(value)\n if (!Number.isFinite(number)) return 0\n return value.trim().endsWith(\"%\") ? (number / 100) * base : number\n}\n\n/**\n * The preview of a touch and hold: the element's box and corner (its own, or `--context-menu-preview-radius`), and\n * the edge the menu keeps to, the one on the side of the touch, as the kit's Side=Leading and Side=Trailing.\n */\nexport function contextMenuPreview(element: HTMLElement, touchX: number): ContextMenuPresentation {\n const box = element.getBoundingClientRect()\n const rect = { x: box.left, y: box.top, width: box.width, height: box.height }\n const style = getComputedStyle(element)\n const short = Math.min(rect.width, rect.height)\n const own = px(style.borderTopLeftRadius, short)\n const fallback = px(style.getPropertyValue(\"--context-menu-preview-radius\"), short) || PREVIEW_RADIUS\n const radius = Math.min(own > 0 ? own : fallback, short / 2)\n const width = element.ownerDocument.defaultView?.innerWidth ?? rect.x + rect.width\n return { kind: \"preview\", rect, radius, align: touchX < width / 2 ? \"start\" : \"end\" }\n}\n\n/** The menu's side, alignment and offsets for a presentation. */\nexport function contextMenuPlacement(presentation: ContextMenuPresentation | null) {\n if (presentation?.kind === \"preview\")\n return { side: \"bottom\" as const, align: presentation.align, sideOffset: CONTEXT_MENU_PREVIEW_GAP, alignOffset: 0 }\n if (presentation?.kind === \"keyboard\") return { side: \"bottom\" as const, align: \"start\" as const, sideOffset: 5, alignOffset: 0 }\n // As a desktop context menu, its corner at the pointer.\n return { side: \"bottom\" as const, align: \"start\" as const, sideOffset: 2, alignOffset: 0 }\n}\n\nconst round = (value: number) => Math.round(value * 100) / 100\n\n/**\n * The dimming covers the page but the element: an SVG mask with the element's rounded box cut out, written to\n * `--context-menu-hole`, so the element stays clear above the dimmed, blurred page.\n */\nexport function contextMenuHoleMask(preview: Extract<ContextMenuPresentation, { kind: \"preview\" }>, viewport?: { width: number; height: number }) {\n const width = round(viewport?.width ?? window.innerWidth)\n const height = round(viewport?.height ?? window.innerHeight)\n const x = round(preview.rect.x)\n const y = round(preview.rect.y)\n const w = round(preview.rect.width)\n const h = round(preview.rect.height)\n const r = round(preview.radius)\n const hole = `M${x + r} ${y}H${round(x + w - r)}A${r} ${r} 0 0 1 ${x + w} ${round(y + r)}V${round(y + h - r)}A${r} ${r} 0 0 1 ${round(x + w - r)} ${round(y + h)}H${round(x + r)}A${r} ${r} 0 0 1 ${x} ${round(y + h - r)}V${round(y + r)}A${r} ${r} 0 0 1 ${round(x + r)} ${y}Z`\n const svg = `<svg xmlns='http://www.w3.org/2000/svg' width='${width}' height='${height}' viewBox='0 0 ${width} ${height}'><path fill-rule='evenodd' d='M0 0H${width}V${height}H0Z${hole}'/></svg>`\n return { \"--context-menu-hole\": `url(\"data:image/svg+xml,${encodeURIComponent(svg)}\")` }\n}\n"]}
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../src/components/ContextMenu/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAA;AAEjG;4EAC4E;AAC5E,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAA;AAC1C,qGAAqG;AACrG,MAAM,cAAc,GAAG,EAAE,CAAA;AAazB,MAAM,EAAE,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,EAAE;IACzC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IACvC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,CAAC,CAAA;IACtC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAA;AACpE,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAoB,EAAE,MAAc;IACrE,MAAM,GAAG,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAA;IAC3C,MAAM,IAAI,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAA;IAC9E,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAA;IACvC,MAAM,KAAK,GAAG,IAAI,CAAC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,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IACjE,IAAI,MAAM,GAAG,IAAI,CAAA;IACjB,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,IAAI,CAAC,IAAI;gBAAE,SAAS,EAAE,MAAM,EAAE,CAAA;YAC9B,OAAM;QACR,CAAC;QACD,MAAM,GAAG,KAAK,CAAA;QACd,SAAS,EAAE,MAAM,EAAE,CAAA;QACnB,iBAAiB,CAAC,OAAO,EAAE,GAAG,EAAE;YAC9B,IAAI,QAAQ;gBAAE,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAA;;gBACzD,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;QAChD,CAAC,CAAC,CAAA;QACF,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC5D,CAAC,CAAA;AACH,CAAC","sourcesContent":["export { CONTEXT_MENU_LONG_PRESS, CONTEXT_MENU_LONG_PRESS_SLOP } from \"../../lib/contextMenuHold\"\n\n/** The kit's gap between the preview and the menu: iOS 27 Context Menu 125:58750, Alignment=Vertical, the menu at\n * 176.5 under a content area that ends at 160.5 (the iOS 26 kit had 18). */\nexport const CONTEXT_MENU_PREVIEW_GAP = 16\n/** The kit's preview corner (Content Area, radius 30), for an element without corners of its own. */\nconst PREVIEW_RADIUS = 30\n\ntype Rect = { x: number; y: number; width: number; height: number }\n\n/**\n * Where the menu opens: at the pointer, under the element for the keyboard, or beside a touch-and-hold preview. A\n * preview's `rect` is where it stands, `shift` how far it moved up so that the menu stands whole below it, once known.\n */\nexport type ContextMenuPresentation =\n | { kind: \"pointer\"; rect: Rect }\n | { kind: \"keyboard\"; rect: Rect }\n | { kind: \"preview\"; rect: Rect; radius: number; align: \"start\" | \"end\"; shift?: number }\n\nconst px = (value: string, base: number) => {\n const number = Number.parseFloat(value)\n if (!Number.isFinite(number)) return 0\n return value.trim().endsWith(\"%\") ? (number / 100) * base : number\n}\n\n/**\n * The preview of a touch and hold: the element's box and corner (its own, or `--context-menu-preview-radius`), and\n * the edge the menu keeps to, the one on the side of the touch, as the kit's Side=Leading and Side=Trailing.\n */\nexport function contextMenuPreview(element: HTMLElement, touchX: number): ContextMenuPresentation {\n const box = element.getBoundingClientRect()\n const rect = { x: box.left, y: box.top, width: box.width, height: box.height }\n const style = getComputedStyle(element)\n const short = Math.min(rect.width, rect.height)\n const own = px(style.borderTopLeftRadius, short)\n const fallback = px(style.getPropertyValue(\"--context-menu-preview-radius\"), short) || PREVIEW_RADIUS\n const radius = Math.min(own > 0 ? own : fallback, short / 2)\n const width = element.ownerDocument.defaultView?.innerWidth ?? rect.x + rect.width\n return { kind: \"preview\", rect, radius, align: touchX < width / 2 ? \"start\" : \"end\" }\n}\n\n/** The menu's side, alignment and offsets for a presentation. */\nexport function contextMenuPlacement(presentation: ContextMenuPresentation | null) {\n if (presentation?.kind === \"preview\")\n return { side: \"bottom\" as const, align: presentation.align, sideOffset: CONTEXT_MENU_PREVIEW_GAP, alignOffset: 0 }\n if (presentation?.kind === \"keyboard\") return { side: \"bottom\" as const, align: \"start\" as const, sideOffset: 5, alignOffset: 0 }\n // As a desktop context menu, its corner at the pointer.\n return { side: \"bottom\" as const, align: \"start\" as const, sideOffset: 2, alignOffset: 0 }\n}\n\nconst round = (value: number) => Math.round(value * 100) / 100\n\n/**\n * The dimming covers the page but the element: the element's rounded box is cut out of it, so the element stays\n * clear above the dimmed, blurred page. `--context-menu-hole` draws the cut (an SVG mask), and\n * `--context-menu-hole-clip` the same shape as a clip path, through which a press reaches the element: a mask leaves\n * the dimming pressable, a clip path does not.\n */\nexport function contextMenuHoleMask(preview: Extract<ContextMenuPresentation, { kind: \"preview\" }>, viewport?: { width: number; height: number }) {\n const width = round(viewport?.width ?? window.innerWidth)\n const height = round(viewport?.height ?? window.innerHeight)\n const x = round(preview.rect.x)\n const y = round(preview.rect.y)\n const w = round(preview.rect.width)\n const h = round(preview.rect.height)\n const r = round(preview.radius)\n const hole = `M${x + r} ${y}H${round(x + w - r)}A${r} ${r} 0 0 1 ${x + w} ${round(y + r)}V${round(y + h - r)}A${r} ${r} 0 0 1 ${round(x + w - r)} ${round(y + h)}H${round(x + r)}A${r} ${r} 0 0 1 ${x} ${round(y + h - r)}V${round(y + r)}A${r} ${r} 0 0 1 ${round(x + r)} ${y}Z`\n const path = `M0 0H${width}V${height}H0Z${hole}`\n const svg = `<svg xmlns='http://www.w3.org/2000/svg' width='${width}' height='${height}' viewBox='0 0 ${width} ${height}'><path fill-rule='evenodd' d='${path}'/></svg>`\n return {\n \"--context-menu-hole\": `url(\"data:image/svg+xml,${encodeURIComponent(svg)}\")`,\n \"--context-menu-hole-clip\": `path(evenodd, \"${path}\")`,\n }\n}\n\n/**\n * How far the preview moves up so that a menu `height` tall stands whole below it, as iOS moves a lifted preview:\n * within `room` (the top and bottom the menu keeps to), and no higher than `ceiling`, the top of a box that clips\n * the element. Nothing when the menu fits. When no move lets it stand whole below, nothing either if it stands whole\n * above the element, where it then opens; else as far as the room above lets it, and the menu scrolls. All on the\n * screen: `scale` is the one a PhoneLayout is drawn at, which the gap takes too.\n */\nexport function contextMenuPreviewShift(rect: Rect, height: number, room: { top: number; bottom: number }, ceiling = -Infinity, scale = 1) {\n const gap = CONTEXT_MENU_PREVIEW_GAP * scale\n const missing = rect.y + rect.height + gap + height - room.bottom\n if (missing <= 0) return 0\n const allowed = Math.max(0, rect.y - Math.max(room.top, ceiling))\n if (missing <= allowed) return round(missing)\n return rect.y - gap - height >= room.top ? 0 : round(allowed)\n}\n\n/** The top of the nearest box that clips the element: moved above it, the element would not be seen. */\nexport function contextMenuClipTop(element: HTMLElement) {\n const view = element.ownerDocument.defaultView\n let top = -Infinity\n for (let node = element.parentElement; node && node !== element.ownerDocument.documentElement; node = node.parentElement) {\n const style = view?.getComputedStyle(node)\n if (style && (style.overflowX !== \"visible\" || style.overflowY !== \"visible\"))\n top = Math.max(top, node.getBoundingClientRect().top + node.clientTop)\n }\n return top\n}\n\n/** A menu's height without the limit of the room it is given: the panel, and what its items scroll out of sight. */\nexport function contextMenuNaturalHeight(content: HTMLElement) {\n const hidden = (element: Element) => (element instanceof HTMLElement ? Math.max(0, element.scrollHeight - element.clientHeight) : 0)\n return [...content.children].reduce((height, child) => height + hidden(child), content.offsetHeight + hidden(content))\n}\n\n/**\n * The name of the element a menu is for, which names the menu, in the order of accessible names: the text it is\n * labelled by, its own label, its text, or the text of a picture it is or shows.\n */\nexport function contextMenuName(element: HTMLElement) {\n const text = (value: string | null | undefined) => (value ?? \"\").replace(/\\s+/g, \" \").trim()\n const doc = element.ownerDocument\n const ids = text(element.getAttribute(\"aria-labelledby\")).split(\" \").filter(Boolean)\n const labelled = text(ids.map((id) => doc.getElementById(id)?.textContent ?? \"\").join(\" \"))\n if (labelled) return labelled\n const label = text(element.getAttribute(\"aria-label\"))\n if (label) return label\n const picture = element.matches(\"img[alt]\") ? element : element.querySelector(\"img[alt]\")\n return text(element.textContent) || text(picture?.getAttribute(\"alt\"))\n}\n\n/**\n * The box the anchor and the dimming lie in when they portal into a PhoneLayout, which is their containing block:\n * its padding box on the screen, and its scale when the frame is drawn smaller or larger. Null for the window.\n */\nexport type ContextMenuFrame = { left: number; top: number; scaleX: number; scaleY: number; width: number; height: number }\n\nexport function contextMenuFrame(box: HTMLElement | null | undefined): ContextMenuFrame | null {\n if (!box) return null\n const rect = box.getBoundingClientRect()\n const scaleX = box.offsetWidth > 0 ? rect.width / box.offsetWidth : 1\n const scaleY = box.offsetHeight > 0 ? rect.height / box.offsetHeight : 1\n return {\n left: rect.left + box.clientLeft * scaleX,\n top: rect.top + box.clientTop * scaleY,\n scaleX,\n scaleY,\n width: box.clientWidth,\n height: box.clientHeight,\n }\n}\n\n/** A rectangle on the screen in the coordinates of the frame, or as it is for the window. */\nexport const contextMenuInFrame = (rect: Rect, frame: ContextMenuFrame | null): Rect =>\n frame\n ? {\n x: round((rect.x - frame.left) / frame.scaleX),\n y: round((rect.y - frame.top) / frame.scaleY),\n width: round(rect.width / frame.scaleX),\n height: round(rect.height / frame.scaleY),\n }\n : rect\n\n/** The duration and easing of a motion token (`--motion-enter` with `--cubic-enter`), 0 where motion is reduced. */\nconst motion = (element: HTMLElement, name: \"enter\" | \"exit\") => {\n const style = getComputedStyle(element)\n const value = style.getPropertyValue(`--motion-${name}`).trim()\n const number = Number.parseFloat(value)\n const duration = !Number.isFinite(number) ? 0 : value.endsWith(\"ms\") ? number : value.endsWith(\"s\") ? number * 1000 : 0\n return { duration, easing: style.getPropertyValue(`--cubic-${name}`).trim() || \"ease\" }\n}\n\n/** The parts of a computed `translate` (`none`, or x, y and z lengths, a `calc()` among them). */\nconst translateParts = (value: string) => {\n const parts: string[] = []\n let depth = 0\n let part = \"\"\n for (const char of value.trim()) {\n if (char === \"(\") depth += 1\n if (char === \")\") depth -= 1\n if (char === \" \" && depth === 0) {\n if (part) parts.push(part)\n part = \"\"\n } else part += char\n }\n if (part) parts.push(part)\n return parts\n}\n\n/**\n * How large the element's pixels are drawn on the screen: the scale of the nearest box around it with a height, such\n * as a PhoneLayout drawn smaller. Read from its parents, which a transition or animation of the element's own does not\n * move.\n */\nconst screenScale = (element: HTMLElement) => {\n for (let node = element.parentElement; node; node = node.parentElement) {\n if (node.offsetHeight > 0) {\n const scale = node.getBoundingClientRect().height / node.offsetHeight\n return scale > 0 && Number.isFinite(scale) ? scale : 1\n }\n }\n return 1\n}\n\n/**\n * Changes the element's `translate` without a transition of its own (`transition: all` or one on `translate`): the\n * move has its own glide, and a drag measures the element right after it is put back. The transition the change\n * starts is cancelled, which shows the new value at once and leaves the element's own style as it was.\n */\nconst withoutTransition = (element: HTMLElement, change: () => void) => {\n change()\n // Reading the style starts the element's transition, if it has one\n void getComputedStyle(element).getPropertyValue(\"translate\")\n for (const animation of element.getAnimations?.() ?? []) {\n if (\"transitionProperty\" in animation && animation.transitionProperty === \"translate\") animation.cancel()\n }\n}\n\n/**\n * Moves the element up by `shift` pixels of the screen while its preview stands, gliding there as the dimming comes in\n * (or at once, for a menu held open that is placed again), and returns how to put it back: gliding as the dimming\n * goes, or at once for a drag that measures where the element stands; called again at once, it stops that glide. An\n * animation, not a transition, so the element's own styles stay; the move adds to a `translate` the element has.\n */\nexport function liftContextMenuPreview(element: HTMLElement, shift: number, smooth = true): (glide: boolean) => void {\n const previous = element.style.getPropertyValue(\"translate\")\n const computed = getComputedStyle(element).getPropertyValue(\"translate\").trim()\n const own = computed && computed !== \"none\" ? translateParts(computed) : []\n const rest = own.length > 0 ? computed : \"none\"\n const by = round(shift / screenScale(element))\n const raised = own.length > 0 ? [own[0], `calc(${own[1] ?? \"0px\"} - ${by}px)`, ...own.slice(2)].join(\" \") : `0 ${-by}px`\n withoutTransition(element, () => element.style.setProperty(\"translate\", raised))\n const glide = (from: string, to: string, name: \"enter\" | \"exit\") => {\n const { duration, easing } = motion(element, name)\n return duration > 0 && typeof element.animate === \"function\"\n ? element.animate([{ translate: from }, { translate: to }], { duration, easing })\n : undefined\n }\n let animation = smooth ? glide(rest, raised, \"enter\") : undefined\n let lifted = true\n return (back) => {\n if (!lifted) {\n if (!back) animation?.cancel()\n return\n }\n lifted = false\n animation?.cancel()\n withoutTransition(element, () => {\n if (previous) element.style.setProperty(\"translate\", previous)\n else element.style.removeProperty(\"translate\")\n })\n animation = back ? glide(raised, rest, \"exit\") : undefined\n }\n}\n"]}
@@ -1,8 +1,9 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import clsx from "clsx";
4
4
  import { Dialog as RadixDialog } from "radix-ui";
5
5
  import { Children, cloneElement, createContext, Fragment, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, } from "react";
6
+ import { createPortal } from "react-dom";
6
7
  import { FloatingBoundaryProvider, useFloatingBoundaryRegistration, useFloatingBoundaryScope } from "../../hooks/useFloatingBoundary.js";
7
8
  import { useEscCloseStack } from "../../hooks/useEscCloseStack.js";
8
9
  import { inToastRegion } from "../../lib/toastRegion.js";
@@ -64,7 +65,12 @@ const Content = ({ children, width = 480, showClose = true, pill = false, classN
64
65
  const setEdges = useCallback((next) => setEdgesState((current) => sameScrollEdges(current, next) ? current : next), []);
65
66
  const scroll = useMemo(() => ({ edges, setEdges }), [edges, setEdges]);
66
67
  const toolbarHost = useMemo(() => ({ kind: "dialog", scrolled: edges.scrolled, contentBelow: edges.contentBelow }), [edges]);
67
- const sheet = useMemo(() => (mobileVariant === "sheet" ? { showClose } : null), [mobileVariant, showClose]);
68
+ // Where a phone Sheet's description goes: the first text of the content, under the bar. Dialog.Body offers
69
+ // its top; a Dialog.DescriptionSlot of the content's own, such as a scroller inside a form, comes first.
70
+ const [bodySlot, setBodySlot] = useState(null);
71
+ const [ownSlot, setOwnSlot] = useState(null);
72
+ const descriptionSlot = ownSlot ?? bodySlot;
73
+ const sheet = useMemo(() => (mobileVariant === "sheet" ? { showClose, descriptionSlot, setBodySlot, setOwnSlot } : null), [mobileVariant, showClose, descriptionSlot]);
68
74
  const boundary = useFloatingBoundaryScope();
69
75
  const setRoot = boundary.setRoot;
70
76
  const setPanelRef = useCallback((node) => { setPanel(node); setRoot(node); }, [setRoot]);
@@ -156,16 +162,20 @@ const headerParts = (children, prefix = "") => Children.toArray(children).flatMa
156
162
  return [prefix ? cloneElement(part, { key: `${prefix}${String(part.key)}` }) : part];
157
163
  });
158
164
  const isHeaderAction = (part) => isValidElement(part) && part.type === HeaderAction;
165
+ const isDescription = (part) => isValidElement(part) && part.type === Description;
159
166
  const Header = ({ children, className, background = "glass" }) => {
160
167
  const sheet = useContext(DialogSheetContext);
161
168
  const phone = usePhoneLayout();
162
169
  const scrolled = useContext(DialogScrollContext)?.edges.scrolled;
163
170
  if (sheet && phone) {
164
171
  const parts = headerParts(children);
172
+ const descriptions = parts.filter(isDescription);
173
+ // The description reads as the first text of the content, at the top of Dialog.Body when there is one
174
+ const description = descriptions.length > 0 && _jsx("div", { className: s.SheetDescription, children: descriptions });
165
175
  // On a phone the header of a Sheet is its Toolbar (iOS 27 kit Sheets 507-24684, Toolbar - Top - iPhone
166
- // 1-54520): Close at the leading edge, the title centered on the row of controls, the header actions at the
167
- // trailing edge, all on one 44px row under the grabber.
168
- return (_jsx(Toolbar, { background: background, className: className, "data-dialog-bar": "", children: _jsxs(DialogBarContext.Provider, { value: true, children: [sheet.showClose && (_jsx(Toolbar.Leading, { className: s.BarClose, children: _jsx(RadixDialog.Close, { asChild: true, children: _jsx(NavigationButton, { action: "close", variant: "ghost", "aria-label": "Close dialog" }) }) })), _jsx("div", { className: clsx(t.Heading, s.BarHeading), children: parts.filter((part) => !isHeaderAction(part)) }), parts.filter(isHeaderAction)] }) }));
176
+ // 1-54520): Close at the leading edge, the title alone centered on the row of controls, the header actions
177
+ // at the trailing edge, all on one 44px row under the grabber.
178
+ return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { background: background, className: className, "data-dialog-bar": "", children: _jsxs(DialogBarContext.Provider, { value: true, children: [sheet.showClose && (_jsx(Toolbar.Leading, { className: s.BarClose, children: _jsx(RadixDialog.Close, { asChild: true, children: _jsx(NavigationButton, { action: "close", variant: "ghost", "aria-label": "Close dialog" }) }) })), _jsx("div", { className: clsx(t.Heading, s.BarHeading), children: parts.filter((part) => !isHeaderAction(part) && !isDescription(part)) }), parts.filter(isHeaderAction)] }) }), description && (sheet.descriptionSlot ? createPortal(description, sheet.descriptionSlot) : description)] }));
169
179
  }
170
180
  return _jsx("div", { className: clsx(s.Header, className), "data-background": background, "data-scrolled": scrolled ? "" : undefined, children: children });
171
181
  };
@@ -178,6 +188,10 @@ const HeaderAction = ({ children, className }) => {
178
188
  /** The scrolling part between Header and Footer: with it, only the body scrolls */
179
189
  const Body = ({ children, className }) => {
180
190
  const setEdges = useContext(DialogScrollContext)?.setEdges;
191
+ const sheet = useContext(DialogSheetContext);
192
+ const phone = usePhoneLayout();
193
+ // A phone Sheet's description starts the body (Dialog.Header portals it here)
194
+ const setDescriptionSlot = sheet && phone ? sheet.setBodySlot : null;
181
195
  const element = useRef(null);
182
196
  useLayoutEffect(() => {
183
197
  const body = element.current;
@@ -186,7 +200,18 @@ const Body = ({ children, className }) => {
186
200
  const stop = observeScrollEdges(body, setEdges);
187
201
  return () => { stop(); setEdges(NO_SCROLL_EDGES); };
188
202
  }, [setEdges]);
189
- return _jsx("div", { ref: element, className: clsx(s.Body, className), children: children });
203
+ return (_jsxs("div", { ref: element, className: clsx(s.Body, className), children: [setDescriptionSlot && _jsx("div", { ref: setDescriptionSlot, className: s.SheetDescriptionSlot }), children] }));
204
+ };
205
+ /**
206
+ * Where a phone Sheet's description goes in content of your own, such as a scroller inside a form so that Enter
207
+ * submits: the description starts it, as it starts Dialog.Body, and it comes before the body's place. It renders
208
+ * nothing outside a phone Sheet.
209
+ */
210
+ const DescriptionSlot = () => {
211
+ const sheet = useContext(DialogSheetContext);
212
+ const phone = usePhoneLayout();
213
+ const setOwnSlot = sheet && phone ? sheet.setOwnSlot : null;
214
+ return setOwnSlot ? _jsx("div", { ref: setOwnSlot, className: s.SheetDescriptionSlot }) : null;
190
215
  };
191
216
  const Footer = ({ children, className, mobileLayout, background = "soft" }) => {
192
217
  const setFooter = useFloatingBoundaryRegistration()?.setFooter;
@@ -202,7 +227,8 @@ const Description = ({ children, className }) => {
202
227
  const element = useRef(null);
203
228
  const [shown, setShown] = useState(false);
204
229
  useLayoutEffect(() => {
205
- // In the bar a description the reader sees is the title's second line (Toolbar's subtitle); one that is only
230
+ // The header leaves its own descriptions out of the bar. One the bar still holds, inside a part of the
231
+ // header's own, is the title's second line (Toolbar's subtitle) when the reader sees it; one that is only
206
232
  // read out, visually hidden, leaves the title on its one line.
207
233
  const node = element.current;
208
234
  // A measurement of the laid-out description, which only an effect after layout can read
@@ -224,6 +250,7 @@ Dialog.Body = Body;
224
250
  Dialog.Footer = Footer;
225
251
  Dialog.Title = Title;
226
252
  Dialog.Description = Description;
253
+ Dialog.DescriptionSlot = DescriptionSlot;
227
254
  Dialog.Close = Close;
228
255
  Dialog.Steps = Steps;
229
256
  //# sourceMappingURL=Dialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,cAAc,EACd,WAAW,EACX,UAAU,EACV,SAAS,EACT,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AACrI,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAC5H,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAwC,MAAM,oBAAoB,CAAA;AACtG,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAoB,MAAM,uBAAuB,CAAA;AAC9G,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAA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,CAAA;AACpB,MAAM,CAAC,WAAW,GAAG,WAAW,CAAA;AAChC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;AACpB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { Dialog as RadixDialog } from \"radix-ui\"\nimport {\n Children,\n cloneElement,\n createContext,\n Fragment,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n} from \"react\"\nimport { FloatingBoundaryProvider, useFloatingBoundaryRegistration, useFloatingBoundaryScope } from \"../../hooks/useFloatingBoundary\"\nimport { useEscCloseStack } from \"../../hooks/useEscCloseStack\"\nimport { inToastRegion } from \"../../lib/toastRegion\"\nimport { cancelableKeyCopy, dataAttributes, keepMovedFocus, preventDefaultHandler, toCssVariables } from \"../../lib/helpers\"\nimport { useStableCallback } from \"../../hooks/useStableCallback\"\nimport { NavigationButton } from \"../Button/NavigationButton\"\nimport { Toolbar, ToolbarHostContext, type BarBackground, type ToolbarHost } from \"../Toolbar/Toolbar\"\nimport { NO_SCROLL_EDGES, observeScrollEdges, sameScrollEdges, type ScrollEdges } from \"../../lib/scrollEdges\"\nimport { TransitionGroup } from \"../Transition\"\nimport { createExitGuard, overlayTiming, overlayTimingLarge } from \"../Transition/shared\"\nimport { attachSheetDrag } from \"./sheetDrag\"\nimport { watchDialogViewport } from \"./dialogViewport\"\nimport { enterStep, leaveStep, releaseStepHeight, settleStepHeight, STEP_TIMING } from \"./dialogSteps\"\nimport { PhoneLayoutContext, usePhoneLayout, type PhoneLayoutValue } from \"../PhoneLayout/PhoneLayout\"\nimport { usePopoverDismissableSurface } from \"../Popover/deferredOutsidePress\"\nimport s from \"@plexui/styles/components/Dialog/Dialog.module.css\"\nimport t from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\ntype DialogContextValue = {\n open: boolean\n setOpen: (nextState: boolean) => void\n}\n\nconst DOUBLE_CLICK = 300\n\nconst DialogContext = createContext<DialogContextValue | null>(null)\n\nconst useDialogContext = () => {\n const context = useContext(DialogContext)\n\n if (!context) {\n throw new Error(\"Dialog compound components must be used inside <Dialog>\")\n }\n\n return context\n}\n\nexport type DialogProps = {\n open?: boolean\n onOpenChange?: (open: boolean) => void\n children: ReactNode\n}\n\nexport const Dialog = ({\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n children,\n}: DialogProps) => {\n const [open, setOpen] = useState<boolean>(false)\n const isOpen = controlledOpen ?? open\n\n const handleOpenChange = useCallback(\n (nextState: boolean) => {\n controlledOnOpenChange?.(nextState)\n setOpen(nextState)\n },\n [controlledOnOpenChange],\n )\n\n const store = useMemo<DialogContextValue>(\n () => ({\n open: isOpen,\n setOpen: handleOpenChange,\n }),\n [isOpen, handleOpenChange],\n )\n\n return (\n <DialogContext value={store}>\n <RadixDialog.Root open={isOpen} onOpenChange={handleOpenChange}>\n {children}\n </RadixDialog.Root>\n </DialogContext>\n )\n}\n\nconst Trigger = ({ children }: { children: ReactNode }) => {\n return <RadixDialog.Trigger asChild>{children}</RadixDialog.Trigger>\n}\n\nexport type DialogPlacement = \"center\" | \"top\" | \"bottom\" | \"start\" | \"end\" | \"fullscreen\"\n\n/** A press or a focus outside the dialog; `event.detail.originalEvent` is the browser's event. */\nexport type DialogInteractOutsideEvent = CustomEvent<{ originalEvent: PointerEvent | FocusEvent }>\n\n/** Class, style and data attributes for one of the dialog's layers. */\nexport type DialogLayerProps = {\n className?: string\n style?: CSSProperties\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined\n}\n\nexport type DialogContentProps = {\n children: ReactNode\n width?: number | string\n showClose?: boolean\n /**\n * Rounder panel and a round close button, for dialogs that sit beside pill controls.\n * @default false\n */\n pill?: boolean\n className?: string\n /**\n * Where the panel sits: centered, near the top (search, command lists),\n * a sheet along the bottom, a full-height panel on the start or end side,\n * or the whole screen.\n * @default center\n */\n placement?: DialogPlacement\n /** Placement at 767px and below, such as a bottom sheet on phones. @default placement */\n mobilePlacement?: Extract<DialogPlacement, \"center\" | \"bottom\" | \"fullscreen\">\n /** Mobile presentation at 767px and below. Sheets default to bottom placement. */\n mobileVariant?: \"alert\" | \"sheet\"\n /** Mobile panel palette; dark mode uses elevated surfaces. @default \"plain\" */\n surface?: \"plain\" | \"grouped\"\n /**\n * Called when focus moves into the dialog on open. Call\n * `event.preventDefault()` to focus something else yourself.\n */\n onOpenAutoFocus?: (event: Event) => void\n /** Called when focus returns on close. Call `event.preventDefault()` to keep it elsewhere. */\n onCloseAutoFocus?: (event: Event) => void\n /**\n * Called on Escape before the dialog closes. Call `event.preventDefault()` to keep it open, such as for a form\n * with unsaved changes.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n /**\n * Called on a press or a focus outside the dialog before it closes. Call `event.preventDefault()` to keep it open,\n * such as for a press on a developer panel over the page.\n */\n onInteractOutside?: (event: DialogInteractOutsideEvent) => void\n /** Stack order of the overlay and the dialog. @default 50 */\n zIndex?: number\n /** Class, style and data attributes for the fixed layer that holds the panel. Data attributes of Content land here too. */\n rootProps?: DialogLayerProps\n /** Class, style and data attributes for the overlay. */\n overlayProps?: DialogLayerProps\n /**\n * `phone` lays the dialog out as on a phone at any window width. Inside a PhoneLayout it always is.\n * @default \"auto\"\n */\n layout?: \"auto\" | \"phone\"\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined\n}\n\nconst Content = ({\n children,\n width = 480,\n showClose = true,\n pill = false,\n className,\n placement = \"center\",\n mobilePlacement: requestedMobilePlacement,\n mobileVariant,\n surface = \"plain\",\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n onInteractOutside,\n zIndex,\n rootProps,\n overlayProps,\n layout = \"auto\",\n ...rest\n}: DialogContentProps) => {\n const { open, setOpen } = useDialogContext()\n const outerPhoneLayout = useContext(PhoneLayoutContext)\n // A dialog laid out as on a phone by its own prop, outside a PhoneLayout, keeps the window: what it holds and\n // the dialogs it opens are phone ones too.\n const phoneLayout = useMemo<PhoneLayoutValue | null>(\n () => outerPhoneLayout ?? (layout === \"phone\" ? { container: null } : null),\n [outerPhoneLayout, layout],\n )\n const [content, setContent] = useState<HTMLDivElement | null>(null)\n useDialogViewport(content, outerPhoneLayout?.container ?? null)\n const overlaySurfaceRef = usePopoverDismissableSurface()\n const mobilePlacement =\n mobileVariant === \"alert\"\n ? \"center\"\n : requestedMobilePlacement ?? (mobileVariant === \"sheet\" ? \"bottom\" : undefined)\n const [exitGuard] = useState(createExitGuard)\n const [panel, setPanel] = useState<HTMLDivElement | null>(null)\n // Dialog.Body reports where content lies under the bars: they show their lines with it.\n const [edges, setEdgesState] = useState(NO_SCROLL_EDGES)\n const setEdges = useCallback((next: ScrollEdges) => setEdgesState((current) => sameScrollEdges(current, next) ? current : next), [])\n const scroll = useMemo(() => ({ edges, setEdges }), [edges, setEdges])\n const toolbarHost = useMemo<ToolbarHost>(() => ({ kind: \"dialog\", scrolled: edges.scrolled, contentBelow: edges.contentBelow }), [edges])\n const sheet = useMemo<DialogSheetValue | null>(() => (mobileVariant === \"sheet\" ? { showClose } : null), [mobileVariant, showClose])\n const boundary = useFloatingBoundaryScope()\n const setRoot = boundary.setRoot\n const setPanelRef = useCallback((node: HTMLDivElement | null) => { setPanel(node); setRoot(node) }, [setRoot])\n const openedAt = useRef(0)\n const crossesScreen =\n placement === \"bottom\" || placement === \"start\" || placement === \"end\" || placement === \"fullscreen\" || mobilePlacement === \"bottom\" || mobilePlacement === \"fullscreen\"\n\n // The content of a closing dialog is frozen for its exit, so this reads the owner's latest\n // handler: state that changes together with the close decides where focus returns.\n const handleCloseAutoFocus = useStableCallback((event: Event) => {\n onCloseAutoFocus?.(event)\n keepMovedFocus(event)\n })\n\n useEscCloseStack(open, (event) => {\n if (onEscapeKeyDown) {\n const request = cancelableKeyCopy(event)\n onEscapeKeyDown(request)\n if (request.defaultPrevented) return\n }\n setOpen(false)\n })\n\n useEffect(() => {\n if (open) openedAt.current = performance.now()\n }, [open])\n\n useEffect(() => {\n if (!panel || mobilePlacement !== \"bottom\") return undefined\n return attachSheetDrag(panel, () => setOpen(false))\n }, [panel, mobilePlacement, setOpen])\n\n useLayoutEffect(() => {\n if (!panel) return\n const update = () => {\n // A phone Toolbar takes the place of the header or footer bar on its side: one the dialog places itself\n // before the bar its header becomes.\n const header = panel.querySelector<HTMLElement>(`:scope > ${TOP_TOOLBAR}:not([data-dialog-bar])`)\n ?? panel.querySelector<HTMLElement>(`:scope > ${TOP_TOOLBAR}`)\n ?? panel.querySelector<HTMLElement>(`:scope > .${s.Header}`)\n const footer = panel.querySelector<HTMLElement>(`:scope > ${BOTTOM_TOOLBAR}`) ?? panel.querySelector<HTMLElement>(`:scope > .${s.Footer}`)\n panel.style.setProperty(\"--dialog-header-height\", `${header?.offsetHeight ?? 0}px`)\n panel.style.setProperty(\"--dialog-footer-height\", `${footer?.offsetHeight ?? 0}px`)\n }\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n const observeBars = () => {\n observer?.disconnect()\n panel.querySelectorAll<HTMLElement>(`:scope > .${s.Header}, :scope > .${s.Footer}, :scope > [data-toolbar]`)\n .forEach((bar) => observer?.observe(bar, { box: \"border-box\" }))\n update()\n }\n observeBars()\n // A form can add or remove its action bar while the dialog stays open.\n const children = new MutationObserver(observeBars)\n children.observe(panel, { childList: true })\n return () => { observer?.disconnect(); children.disconnect() }\n }, [panel])\n\n const layerStyle = toCssVariables({ \"dialog-z-index\": zIndex === undefined ? undefined : String(zIndex) })\n\n return (\n <FloatingBoundaryProvider value={boundary}>\n <PhoneLayoutContext value={phoneLayout}>\n <RadixDialog.Portal forceMount container={outerPhoneLayout?.container ?? undefined}>\n {/* Portaled out of any phone layout, a phone dialog carries its own scope, above its transition: the phone\n rules of the style sheet start there. */}\n <PhoneScope enabled={phoneLayout !== null && !outerPhoneLayout?.container}>\n {/* A dialog mounted open enters too, as `open` set with the mount does */}\n <TransitionGroup\n {...(crossesScreen ? overlayTimingLarge : overlayTiming)}\n {...exitGuard.transition}\n className={s.Transition}\n overlay\n preventInitialTransition={false}\n >\n {open && (\n <div key=\"dialog\">\n <RadixDialog.Overlay\n {...overlayProps}\n ref={overlaySurfaceRef}\n className={clsx(s.Overlay, overlayProps?.className)}\n style={{ ...layerStyle, ...overlayProps?.style }}\n />\n <RadixDialog.Content\n {...dataAttributes(rest)}\n {...rootProps}\n ref={setContent}\n forceMount\n className={clsx(s.Content, rootProps?.className)}\n data-plex-dialog=\"\"\n style={{ ...toCssVariables({ \"dialog-width\": width }), ...layerStyle, ...rootProps?.style }}\n data-placement={placement === \"center\" ? undefined : placement}\n data-mobile-placement={mobilePlacement}\n data-mobile-variant={mobileVariant}\n data-surface={surface}\n data-pill={pill ? \"\" : undefined}\n onEscapeKeyDown={preventDefaultHandler}\n onInteractOutside={(event) => {\n // A press or focus in a toast is not outside: the toast region is a layer above the dialog. The\n // Toaster stops these before Radix sees them; this holds when the Toaster mounted after the dialog.\n if (inToastRegion(event.detail.originalEvent.target)) return event.preventDefault()\n onInteractOutside?.(event)\n if (event.defaultPrevented) return\n // The second click of a double click lands on the overlay: it must not undo the first\n if (performance.now() - openedAt.current < DOUBLE_CLICK) event.preventDefault()\n else exitGuard.onInteractOutside(event)\n }}\n onOpenAutoFocus={onOpenAutoFocus}\n onCloseAutoFocus={handleCloseAutoFocus}\n >\n <div ref={setPanelRef} className={clsx(s.Panel, className)}>\n {showClose && (\n <RadixDialog.Close asChild>\n <NavigationButton action=\"close\" variant=\"ghost\" className={s.CloseButton} aria-label=\"Close dialog\" />\n </RadixDialog.Close>\n )}\n <DialogScrollContext.Provider value={scroll}>\n <DialogSheetContext.Provider value={sheet}>\n {/* A dialog opened from a header action is not inside that header's bar */}\n <DialogBarContext.Provider value={false}>\n <ToolbarHostContext.Provider value={toolbarHost}>{children}</ToolbarHostContext.Provider>\n </DialogBarContext.Provider>\n </DialogSheetContext.Provider>\n </DialogScrollContext.Provider>\n </div>\n </RadixDialog.Content>\n </div>\n )}\n </TransitionGroup>\n </PhoneScope>\n </RadixDialog.Portal>\n </PhoneLayoutContext>\n </FloatingBoundaryProvider>\n )\n}\n\ntype DialogScrollValue = { edges: ScrollEdges; setEdges: (edges: ScrollEdges) => void }\nconst DialogScrollContext = createContext<DialogScrollValue | null>(null)\n// What the header of a Sheet needs from its Content to become the Sheet's bar on a phone\ntype DialogSheetValue = { showClose: boolean }\nconst DialogSheetContext = createContext<DialogSheetValue | null>(null)\n// Inside that bar: the title, the description and the header actions take the Toolbar's parts\nconst DialogBarContext = createContext(false)\n\nconst PhoneScope = ({ enabled, children }: { enabled: boolean; children: ReactNode }) =>\n enabled ? <div className={s.PhoneScope} data-plex-layout=\"phone\">{children}</div> : children\n\nconst useDialogViewport = (content: HTMLElement | null, container: HTMLElement | null) => {\n useLayoutEffect(() => (content ? watchDialogViewport(content, container) : undefined), [content, container])\n}\nconst TOP_TOOLBAR = '[data-toolbar][data-placement=\"top\"]'\nconst BOTTOM_TOOLBAR = '[data-toolbar][data-placement=\"bottom\"]'\n\ntype DialogSlotProps = {\n children: ReactNode\n className?: string\n}\n\n/** How a Sheet's bar meets the content scrolled under it; see `BarBackground`. */\nexport type DialogBarBackground = BarBackground\nexport type DialogHeaderProps = DialogSlotProps & {\n /** How the bar meets the content scrolled under it in a phone Sheet. @default \"glass\" */\n background?: DialogBarBackground\n}\n\n// The header's own parts, fragments opened up, so its actions can stand at the end of the bar. A part from a\n// fragment keeps the fragment's key before its own, so two parts never share a key.\nconst headerParts = (children: ReactNode, prefix = \"\"): ReactNode[] =>\n Children.toArray(children).flatMap((part) => {\n if (!isValidElement<{ children?: ReactNode }>(part)) return [part]\n if (part.type === Fragment) return headerParts(part.props.children, `${prefix}${String(part.key)}/`)\n return [prefix ? cloneElement(part, { key: `${prefix}${String(part.key)}` }) : part]\n })\nconst isHeaderAction = (part: ReactNode): part is ReactElement => isValidElement(part) && part.type === HeaderAction\n\nconst Header = ({ children, className, background = \"glass\" }: DialogHeaderProps) => {\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n const scrolled = useContext(DialogScrollContext)?.edges.scrolled\n if (sheet && phone) {\n const parts = headerParts(children)\n // On a phone the header of a Sheet is its Toolbar (iOS 27 kit Sheets 507-24684, Toolbar - Top - iPhone\n // 1-54520): Close at the leading edge, the title centered on the row of controls, the header actions at the\n // trailing edge, all on one 44px row under the grabber.\n return (\n <Toolbar background={background} className={className} data-dialog-bar=\"\">\n <DialogBarContext.Provider value={true}>\n {sheet.showClose && (\n <Toolbar.Leading className={s.BarClose}>\n <RadixDialog.Close asChild>\n <NavigationButton action=\"close\" variant=\"ghost\" aria-label=\"Close dialog\" />\n </RadixDialog.Close>\n </Toolbar.Leading>\n )}\n <div className={clsx(t.Heading, s.BarHeading)}>{parts.filter((part) => !isHeaderAction(part))}</div>\n {parts.filter(isHeaderAction)}\n </DialogBarContext.Provider>\n </Toolbar>\n )\n }\n return <div className={clsx(s.Header, className)} data-background={background} data-scrolled={scrolled ? \"\" : undefined}>{children}</div>\n}\n\nconst HeaderAction = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n if (bar) return <Toolbar.Trailing className={className}>{children}</Toolbar.Trailing>\n return <div className={clsx(s.HeaderAction, className)}>{children}</div>\n}\n\n/** The scrolling part between Header and Footer: with it, only the body scrolls */\nconst Body = ({ children, className }: DialogSlotProps) => {\n const setEdges = useContext(DialogScrollContext)?.setEdges\n const element = useRef<HTMLDivElement | null>(null)\n useLayoutEffect(() => {\n const body = element.current\n if (!body || !setEdges) return\n const stop = observeScrollEdges(body, setEdges)\n return () => { stop(); setEdges(NO_SCROLL_EDGES) }\n }, [setEdges])\n return <div ref={element} className={clsx(s.Body, className)}>{children}</div>\n}\n\nexport type DialogFooterProps = DialogSlotProps & {\n /** How the bar meets the content scrolled under it in a phone Sheet. @default \"soft\" */\n background?: DialogBarBackground\n /** Override the mobile action layout. Alerts default to inline; sheets to stacked. */\n mobileLayout?: \"inline\" | \"stacked\"\n}\n\nconst Footer = ({ children, className, mobileLayout, background = \"soft\" }: DialogFooterProps) => {\n const setFooter = useFloatingBoundaryRegistration()?.setFooter\n const contentBelow = useContext(DialogScrollContext)?.edges.contentBelow\n return (\n <div\n ref={setFooter}\n className={clsx(s.Footer, className)}\n data-mobile-layout={mobileLayout}\n data-background={background}\n data-content-below={contentBelow ? \"\" : undefined}\n >\n {children}\n </div>\n )\n}\n\nconst Title = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n return <RadixDialog.Title className={clsx(bar ? t.Title : s.Title, className)}>{children}</RadixDialog.Title>\n}\n\nconst Description = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n const element = useRef<HTMLParagraphElement | null>(null)\n const [shown, setShown] = useState(false)\n useLayoutEffect(() => {\n // In the bar a description the reader sees is the title's second line (Toolbar's subtitle); one that is only\n // read out, visually hidden, leaves the title on its one line.\n const node = element.current\n // A measurement of the laid-out description, which only an effect after layout can read\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setShown(bar && !!node && node.offsetHeight > 1 && node.offsetWidth > 1)\n }, [bar, children, className])\n return (\n <RadixDialog.Description ref={element} className={clsx(bar && shown ? t.Subtitle : s.Description, className)}>\n {children}\n </RadixDialog.Description>\n )\n}\n\nexport type DialogStepsProps = {\n /** The step on screen. A new value brings its content in. */\n step: string | number\n /**\n * `forward` brings the new step in from the trailing edge over the one before, as a push on iOS; `back` returns to\n * a step before it.\n * @default \"forward\"\n */\n direction?: \"forward\" | \"back\"\n children: ReactNode\n className?: string\n}\n\n/** The steps of a flow inside a dialog, such as a sign-in that asks for an email and then a code. */\nconst Steps = ({ step, direction = \"forward\", children, className }: DialogStepsProps) => (\n <div className={clsx(s.Steps, className)} data-direction={direction}>\n <TransitionGroup {...STEP_TIMING} as=\"div\" overlay className={s.Step} onEnter={enterStep} onExit={leaveStep} onExitActive={settleStepHeight} onExitComplete={releaseStepHeight}>\n <div key={step} data-dialog-step=\"\" tabIndex={-1}>{children}</div>\n </TransitionGroup>\n </div>\n)\n\nconst Close = ({ children }: { children: ReactNode }) => {\n return <RadixDialog.Close asChild>{children}</RadixDialog.Close>\n}\n\nDialog.Trigger = Trigger\nDialog.Content = Content\nDialog.Header = Header\nDialog.HeaderAction = HeaderAction\nDialog.Body = Body\nDialog.Footer = Footer\nDialog.Title = Title\nDialog.Description = Description\nDialog.Close = Close\nDialog.Steps = Steps\n"]}
1
+ {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,cAAc,EACd,WAAW,EACX,UAAU,EACV,SAAS,EACT,eAAe,EACf,OAAO,EACP,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AACrI,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAC5H,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAwC,MAAM,oBAAoB,CAAA;AACtG,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAoB,MAAM,uBA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,EAA2B,EAAE,EAAE;IACtD,OAAO,KAAC,WAAW,CAAC,KAAK,IAAC,OAAO,kBAAE,QAAQ,GAAqB,CAAA;AAClE,CAAC,CAAA;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA;AACxB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA;AACxB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAA;AACtB,MAAM,CAAC,YAAY,GAAG,YAAY,CAAA;AAClC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAA;AAClB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAA;AACtB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;AACpB,MAAM,CAAC,WAAW,GAAG,WAAW,CAAA;AAChC,MAAM,CAAC,eAAe,GAAG,eAAe,CAAA;AACxC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;AACpB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { Dialog as RadixDialog } from \"radix-ui\"\nimport {\n Children,\n cloneElement,\n createContext,\n Fragment,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n} from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { FloatingBoundaryProvider, useFloatingBoundaryRegistration, useFloatingBoundaryScope } from \"../../hooks/useFloatingBoundary\"\nimport { useEscCloseStack } from \"../../hooks/useEscCloseStack\"\nimport { inToastRegion } from \"../../lib/toastRegion\"\nimport { cancelableKeyCopy, dataAttributes, keepMovedFocus, preventDefaultHandler, toCssVariables } from \"../../lib/helpers\"\nimport { useStableCallback } from \"../../hooks/useStableCallback\"\nimport { NavigationButton } from \"../Button/NavigationButton\"\nimport { Toolbar, ToolbarHostContext, type BarBackground, type ToolbarHost } from \"../Toolbar/Toolbar\"\nimport { NO_SCROLL_EDGES, observeScrollEdges, sameScrollEdges, type ScrollEdges } from \"../../lib/scrollEdges\"\nimport { TransitionGroup } from \"../Transition\"\nimport { createExitGuard, overlayTiming, overlayTimingLarge } from \"../Transition/shared\"\nimport { attachSheetDrag } from \"./sheetDrag\"\nimport { watchDialogViewport } from \"./dialogViewport\"\nimport { enterStep, leaveStep, releaseStepHeight, settleStepHeight, STEP_TIMING } from \"./dialogSteps\"\nimport { PhoneLayoutContext, usePhoneLayout, type PhoneLayoutValue } from \"../PhoneLayout/PhoneLayout\"\nimport { usePopoverDismissableSurface } from \"../Popover/deferredOutsidePress\"\nimport s from \"@plexui/styles/components/Dialog/Dialog.module.css\"\nimport t from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\ntype DialogContextValue = {\n open: boolean\n setOpen: (nextState: boolean) => void\n}\n\nconst DOUBLE_CLICK = 300\n\nconst DialogContext = createContext<DialogContextValue | null>(null)\n\nconst useDialogContext = () => {\n const context = useContext(DialogContext)\n\n if (!context) {\n throw new Error(\"Dialog compound components must be used inside <Dialog>\")\n }\n\n return context\n}\n\nexport type DialogProps = {\n open?: boolean\n onOpenChange?: (open: boolean) => void\n children: ReactNode\n}\n\nexport const Dialog = ({\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n children,\n}: DialogProps) => {\n const [open, setOpen] = useState<boolean>(false)\n const isOpen = controlledOpen ?? open\n\n const handleOpenChange = useCallback(\n (nextState: boolean) => {\n controlledOnOpenChange?.(nextState)\n setOpen(nextState)\n },\n [controlledOnOpenChange],\n )\n\n const store = useMemo<DialogContextValue>(\n () => ({\n open: isOpen,\n setOpen: handleOpenChange,\n }),\n [isOpen, handleOpenChange],\n )\n\n return (\n <DialogContext value={store}>\n <RadixDialog.Root open={isOpen} onOpenChange={handleOpenChange}>\n {children}\n </RadixDialog.Root>\n </DialogContext>\n )\n}\n\nconst Trigger = ({ children }: { children: ReactNode }) => {\n return <RadixDialog.Trigger asChild>{children}</RadixDialog.Trigger>\n}\n\nexport type DialogPlacement = \"center\" | \"top\" | \"bottom\" | \"start\" | \"end\" | \"fullscreen\"\n\n/** A press or a focus outside the dialog; `event.detail.originalEvent` is the browser's event. */\nexport type DialogInteractOutsideEvent = CustomEvent<{ originalEvent: PointerEvent | FocusEvent }>\n\n/** Class, style and data attributes for one of the dialog's layers. */\nexport type DialogLayerProps = {\n className?: string\n style?: CSSProperties\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined\n}\n\nexport type DialogContentProps = {\n children: ReactNode\n width?: number | string\n showClose?: boolean\n /**\n * Rounder panel and a round close button, for dialogs that sit beside pill controls.\n * @default false\n */\n pill?: boolean\n className?: string\n /**\n * Where the panel sits: centered, near the top (search, command lists),\n * a sheet along the bottom, a full-height panel on the start or end side,\n * or the whole screen.\n * @default center\n */\n placement?: DialogPlacement\n /** Placement at 767px and below, such as a bottom sheet on phones. @default placement */\n mobilePlacement?: Extract<DialogPlacement, \"center\" | \"bottom\" | \"fullscreen\">\n /** Mobile presentation at 767px and below. Sheets default to bottom placement. */\n mobileVariant?: \"alert\" | \"sheet\"\n /** Mobile panel palette; dark mode uses elevated surfaces. @default \"plain\" */\n surface?: \"plain\" | \"grouped\"\n /**\n * Called when focus moves into the dialog on open. Call\n * `event.preventDefault()` to focus something else yourself.\n */\n onOpenAutoFocus?: (event: Event) => void\n /** Called when focus returns on close. Call `event.preventDefault()` to keep it elsewhere. */\n onCloseAutoFocus?: (event: Event) => void\n /**\n * Called on Escape before the dialog closes. Call `event.preventDefault()` to keep it open, such as for a form\n * with unsaved changes.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n /**\n * Called on a press or a focus outside the dialog before it closes. Call `event.preventDefault()` to keep it open,\n * such as for a press on a developer panel over the page.\n */\n onInteractOutside?: (event: DialogInteractOutsideEvent) => void\n /** Stack order of the overlay and the dialog. @default 50 */\n zIndex?: number\n /** Class, style and data attributes for the fixed layer that holds the panel. Data attributes of Content land here too. */\n rootProps?: DialogLayerProps\n /** Class, style and data attributes for the overlay. */\n overlayProps?: DialogLayerProps\n /**\n * `phone` lays the dialog out as on a phone at any window width. Inside a PhoneLayout it always is.\n * @default \"auto\"\n */\n layout?: \"auto\" | \"phone\"\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined\n}\n\nconst Content = ({\n children,\n width = 480,\n showClose = true,\n pill = false,\n className,\n placement = \"center\",\n mobilePlacement: requestedMobilePlacement,\n mobileVariant,\n surface = \"plain\",\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n onInteractOutside,\n zIndex,\n rootProps,\n overlayProps,\n layout = \"auto\",\n ...rest\n}: DialogContentProps) => {\n const { open, setOpen } = useDialogContext()\n const outerPhoneLayout = useContext(PhoneLayoutContext)\n // A dialog laid out as on a phone by its own prop, outside a PhoneLayout, keeps the window: what it holds and\n // the dialogs it opens are phone ones too.\n const phoneLayout = useMemo<PhoneLayoutValue | null>(\n () => outerPhoneLayout ?? (layout === \"phone\" ? { container: null } : null),\n [outerPhoneLayout, layout],\n )\n const [content, setContent] = useState<HTMLDivElement | null>(null)\n useDialogViewport(content, outerPhoneLayout?.container ?? null)\n const overlaySurfaceRef = usePopoverDismissableSurface()\n const mobilePlacement =\n mobileVariant === \"alert\"\n ? \"center\"\n : requestedMobilePlacement ?? (mobileVariant === \"sheet\" ? \"bottom\" : undefined)\n const [exitGuard] = useState(createExitGuard)\n const [panel, setPanel] = useState<HTMLDivElement | null>(null)\n // Dialog.Body reports where content lies under the bars: they show their lines with it.\n const [edges, setEdgesState] = useState(NO_SCROLL_EDGES)\n const setEdges = useCallback((next: ScrollEdges) => setEdgesState((current) => sameScrollEdges(current, next) ? current : next), [])\n const scroll = useMemo(() => ({ edges, setEdges }), [edges, setEdges])\n const toolbarHost = useMemo<ToolbarHost>(() => ({ kind: \"dialog\", scrolled: edges.scrolled, contentBelow: edges.contentBelow }), [edges])\n // Where a phone Sheet's description goes: the first text of the content, under the bar. Dialog.Body offers\n // its top; a Dialog.DescriptionSlot of the content's own, such as a scroller inside a form, comes first.\n const [bodySlot, setBodySlot] = useState<HTMLElement | null>(null)\n const [ownSlot, setOwnSlot] = useState<HTMLElement | null>(null)\n const descriptionSlot = ownSlot ?? bodySlot\n const sheet = useMemo<DialogSheetValue | null>(\n () => (mobileVariant === \"sheet\" ? { showClose, descriptionSlot, setBodySlot, setOwnSlot } : null),\n [mobileVariant, showClose, descriptionSlot],\n )\n const boundary = useFloatingBoundaryScope()\n const setRoot = boundary.setRoot\n const setPanelRef = useCallback((node: HTMLDivElement | null) => { setPanel(node); setRoot(node) }, [setRoot])\n const openedAt = useRef(0)\n const crossesScreen =\n placement === \"bottom\" || placement === \"start\" || placement === \"end\" || placement === \"fullscreen\" || mobilePlacement === \"bottom\" || mobilePlacement === \"fullscreen\"\n\n // The content of a closing dialog is frozen for its exit, so this reads the owner's latest\n // handler: state that changes together with the close decides where focus returns.\n const handleCloseAutoFocus = useStableCallback((event: Event) => {\n onCloseAutoFocus?.(event)\n keepMovedFocus(event)\n })\n\n useEscCloseStack(open, (event) => {\n if (onEscapeKeyDown) {\n const request = cancelableKeyCopy(event)\n onEscapeKeyDown(request)\n if (request.defaultPrevented) return\n }\n setOpen(false)\n })\n\n useEffect(() => {\n if (open) openedAt.current = performance.now()\n }, [open])\n\n useEffect(() => {\n if (!panel || mobilePlacement !== \"bottom\") return undefined\n return attachSheetDrag(panel, () => setOpen(false))\n }, [panel, mobilePlacement, setOpen])\n\n useLayoutEffect(() => {\n if (!panel) return\n const update = () => {\n // A phone Toolbar takes the place of the header or footer bar on its side: one the dialog places itself\n // before the bar its header becomes.\n const header = panel.querySelector<HTMLElement>(`:scope > ${TOP_TOOLBAR}:not([data-dialog-bar])`)\n ?? panel.querySelector<HTMLElement>(`:scope > ${TOP_TOOLBAR}`)\n ?? panel.querySelector<HTMLElement>(`:scope > .${s.Header}`)\n const footer = panel.querySelector<HTMLElement>(`:scope > ${BOTTOM_TOOLBAR}`) ?? panel.querySelector<HTMLElement>(`:scope > .${s.Footer}`)\n panel.style.setProperty(\"--dialog-header-height\", `${header?.offsetHeight ?? 0}px`)\n panel.style.setProperty(\"--dialog-footer-height\", `${footer?.offsetHeight ?? 0}px`)\n }\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n const observeBars = () => {\n observer?.disconnect()\n panel.querySelectorAll<HTMLElement>(`:scope > .${s.Header}, :scope > .${s.Footer}, :scope > [data-toolbar]`)\n .forEach((bar) => observer?.observe(bar, { box: \"border-box\" }))\n update()\n }\n observeBars()\n // A form can add or remove its action bar while the dialog stays open.\n const children = new MutationObserver(observeBars)\n children.observe(panel, { childList: true })\n return () => { observer?.disconnect(); children.disconnect() }\n }, [panel])\n\n const layerStyle = toCssVariables({ \"dialog-z-index\": zIndex === undefined ? undefined : String(zIndex) })\n\n return (\n <FloatingBoundaryProvider value={boundary}>\n <PhoneLayoutContext value={phoneLayout}>\n <RadixDialog.Portal forceMount container={outerPhoneLayout?.container ?? undefined}>\n {/* Portaled out of any phone layout, a phone dialog carries its own scope, above its transition: the phone\n rules of the style sheet start there. */}\n <PhoneScope enabled={phoneLayout !== null && !outerPhoneLayout?.container}>\n {/* A dialog mounted open enters too, as `open` set with the mount does */}\n <TransitionGroup\n {...(crossesScreen ? overlayTimingLarge : overlayTiming)}\n {...exitGuard.transition}\n className={s.Transition}\n overlay\n preventInitialTransition={false}\n >\n {open && (\n <div key=\"dialog\">\n <RadixDialog.Overlay\n {...overlayProps}\n ref={overlaySurfaceRef}\n className={clsx(s.Overlay, overlayProps?.className)}\n style={{ ...layerStyle, ...overlayProps?.style }}\n />\n <RadixDialog.Content\n {...dataAttributes(rest)}\n {...rootProps}\n ref={setContent}\n forceMount\n className={clsx(s.Content, rootProps?.className)}\n data-plex-dialog=\"\"\n style={{ ...toCssVariables({ \"dialog-width\": width }), ...layerStyle, ...rootProps?.style }}\n data-placement={placement === \"center\" ? undefined : placement}\n data-mobile-placement={mobilePlacement}\n data-mobile-variant={mobileVariant}\n data-surface={surface}\n data-pill={pill ? \"\" : undefined}\n onEscapeKeyDown={preventDefaultHandler}\n onInteractOutside={(event) => {\n // A press or focus in a toast is not outside: the toast region is a layer above the dialog. The\n // Toaster stops these before Radix sees them; this holds when the Toaster mounted after the dialog.\n if (inToastRegion(event.detail.originalEvent.target)) return event.preventDefault()\n onInteractOutside?.(event)\n if (event.defaultPrevented) return\n // The second click of a double click lands on the overlay: it must not undo the first\n if (performance.now() - openedAt.current < DOUBLE_CLICK) event.preventDefault()\n else exitGuard.onInteractOutside(event)\n }}\n onOpenAutoFocus={onOpenAutoFocus}\n onCloseAutoFocus={handleCloseAutoFocus}\n >\n <div ref={setPanelRef} className={clsx(s.Panel, className)}>\n {showClose && (\n <RadixDialog.Close asChild>\n <NavigationButton action=\"close\" variant=\"ghost\" className={s.CloseButton} aria-label=\"Close dialog\" />\n </RadixDialog.Close>\n )}\n <DialogScrollContext.Provider value={scroll}>\n <DialogSheetContext.Provider value={sheet}>\n {/* A dialog opened from a header action is not inside that header's bar */}\n <DialogBarContext.Provider value={false}>\n <ToolbarHostContext.Provider value={toolbarHost}>{children}</ToolbarHostContext.Provider>\n </DialogBarContext.Provider>\n </DialogSheetContext.Provider>\n </DialogScrollContext.Provider>\n </div>\n </RadixDialog.Content>\n </div>\n )}\n </TransitionGroup>\n </PhoneScope>\n </RadixDialog.Portal>\n </PhoneLayoutContext>\n </FloatingBoundaryProvider>\n )\n}\n\ntype DialogScrollValue = { edges: ScrollEdges; setEdges: (edges: ScrollEdges) => void }\nconst DialogScrollContext = createContext<DialogScrollValue | null>(null)\n// What the header of a Sheet needs from its Content to become the Sheet's bar on a phone\ntype DialogSheetValue = {\n showClose: boolean\n descriptionSlot: HTMLElement | null\n setBodySlot: (slot: HTMLElement | null) => void\n setOwnSlot: (slot: HTMLElement | null) => void\n}\nconst DialogSheetContext = createContext<DialogSheetValue | null>(null)\n// Inside that bar: the title, the description and the header actions take the Toolbar's parts\nconst DialogBarContext = createContext(false)\n\nconst PhoneScope = ({ enabled, children }: { enabled: boolean; children: ReactNode }) =>\n enabled ? <div className={s.PhoneScope} data-plex-layout=\"phone\">{children}</div> : children\n\nconst useDialogViewport = (content: HTMLElement | null, container: HTMLElement | null) => {\n useLayoutEffect(() => (content ? watchDialogViewport(content, container) : undefined), [content, container])\n}\nconst TOP_TOOLBAR = '[data-toolbar][data-placement=\"top\"]'\nconst BOTTOM_TOOLBAR = '[data-toolbar][data-placement=\"bottom\"]'\n\ntype DialogSlotProps = {\n children: ReactNode\n className?: string\n}\n\n/** How a Sheet's bar meets the content scrolled under it; see `BarBackground`. */\nexport type DialogBarBackground = BarBackground\nexport type DialogHeaderProps = DialogSlotProps & {\n /** How the bar meets the content scrolled under it in a phone Sheet. @default \"glass\" */\n background?: DialogBarBackground\n}\n\n// The header's own parts, fragments opened up, so its actions can stand at the end of the bar. A part from a\n// fragment keeps the fragment's key before its own, so two parts never share a key.\nconst headerParts = (children: ReactNode, prefix = \"\"): ReactNode[] =>\n Children.toArray(children).flatMap((part) => {\n if (!isValidElement<{ children?: ReactNode }>(part)) return [part]\n if (part.type === Fragment) return headerParts(part.props.children, `${prefix}${String(part.key)}/`)\n return [prefix ? cloneElement(part, { key: `${prefix}${String(part.key)}` }) : part]\n })\nconst isHeaderAction = (part: ReactNode): part is ReactElement => isValidElement(part) && part.type === HeaderAction\nconst isDescription = (part: ReactNode): part is ReactElement => isValidElement(part) && part.type === Description\n\nconst Header = ({ children, className, background = \"glass\" }: DialogHeaderProps) => {\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n const scrolled = useContext(DialogScrollContext)?.edges.scrolled\n if (sheet && phone) {\n const parts = headerParts(children)\n const descriptions = parts.filter(isDescription)\n // The description reads as the first text of the content, at the top of Dialog.Body when there is one\n const description = descriptions.length > 0 && <div className={s.SheetDescription}>{descriptions}</div>\n // On a phone the header of a Sheet is its Toolbar (iOS 27 kit Sheets 507-24684, Toolbar - Top - iPhone\n // 1-54520): Close at the leading edge, the title alone centered on the row of controls, the header actions\n // at the trailing edge, all on one 44px row under the grabber.\n return (\n <>\n <Toolbar background={background} className={className} data-dialog-bar=\"\">\n <DialogBarContext.Provider value={true}>\n {sheet.showClose && (\n <Toolbar.Leading className={s.BarClose}>\n <RadixDialog.Close asChild>\n <NavigationButton action=\"close\" variant=\"ghost\" aria-label=\"Close dialog\" />\n </RadixDialog.Close>\n </Toolbar.Leading>\n )}\n <div className={clsx(t.Heading, s.BarHeading)}>{parts.filter((part) => !isHeaderAction(part) && !isDescription(part))}</div>\n {parts.filter(isHeaderAction)}\n </DialogBarContext.Provider>\n </Toolbar>\n {description && (sheet.descriptionSlot ? createPortal(description, sheet.descriptionSlot) : description)}\n </>\n )\n }\n return <div className={clsx(s.Header, className)} data-background={background} data-scrolled={scrolled ? \"\" : undefined}>{children}</div>\n}\n\nconst HeaderAction = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n if (bar) return <Toolbar.Trailing className={className}>{children}</Toolbar.Trailing>\n return <div className={clsx(s.HeaderAction, className)}>{children}</div>\n}\n\n/** The scrolling part between Header and Footer: with it, only the body scrolls */\nconst Body = ({ children, className }: DialogSlotProps) => {\n const setEdges = useContext(DialogScrollContext)?.setEdges\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n // A phone Sheet's description starts the body (Dialog.Header portals it here)\n const setDescriptionSlot = sheet && phone ? sheet.setBodySlot : null\n const element = useRef<HTMLDivElement | null>(null)\n useLayoutEffect(() => {\n const body = element.current\n if (!body || !setEdges) return\n const stop = observeScrollEdges(body, setEdges)\n return () => { stop(); setEdges(NO_SCROLL_EDGES) }\n }, [setEdges])\n return (\n <div ref={element} className={clsx(s.Body, className)}>\n {setDescriptionSlot && <div ref={setDescriptionSlot} className={s.SheetDescriptionSlot} />}\n {children}\n </div>\n )\n}\n\n/**\n * Where a phone Sheet's description goes in content of your own, such as a scroller inside a form so that Enter\n * submits: the description starts it, as it starts Dialog.Body, and it comes before the body's place. It renders\n * nothing outside a phone Sheet.\n */\nconst DescriptionSlot = () => {\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n const setOwnSlot = sheet && phone ? sheet.setOwnSlot : null\n return setOwnSlot ? <div ref={setOwnSlot} className={s.SheetDescriptionSlot} /> : null\n}\n\nexport type DialogFooterProps = DialogSlotProps & {\n /** How the bar meets the content scrolled under it in a phone Sheet. @default \"soft\" */\n background?: DialogBarBackground\n /** Override the mobile action layout. Alerts default to inline; sheets to stacked. */\n mobileLayout?: \"inline\" | \"stacked\"\n}\n\nconst Footer = ({ children, className, mobileLayout, background = \"soft\" }: DialogFooterProps) => {\n const setFooter = useFloatingBoundaryRegistration()?.setFooter\n const contentBelow = useContext(DialogScrollContext)?.edges.contentBelow\n return (\n <div\n ref={setFooter}\n className={clsx(s.Footer, className)}\n data-mobile-layout={mobileLayout}\n data-background={background}\n data-content-below={contentBelow ? \"\" : undefined}\n >\n {children}\n </div>\n )\n}\n\nconst Title = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n return <RadixDialog.Title className={clsx(bar ? t.Title : s.Title, className)}>{children}</RadixDialog.Title>\n}\n\nconst Description = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n const element = useRef<HTMLParagraphElement | null>(null)\n const [shown, setShown] = useState(false)\n useLayoutEffect(() => {\n // The header leaves its own descriptions out of the bar. One the bar still holds, inside a part of the\n // header's own, is the title's second line (Toolbar's subtitle) when the reader sees it; one that is only\n // read out, visually hidden, leaves the title on its one line.\n const node = element.current\n // A measurement of the laid-out description, which only an effect after layout can read\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setShown(bar && !!node && node.offsetHeight > 1 && node.offsetWidth > 1)\n }, [bar, children, className])\n return (\n <RadixDialog.Description ref={element} className={clsx(bar && shown ? t.Subtitle : s.Description, className)}>\n {children}\n </RadixDialog.Description>\n )\n}\n\nexport type DialogStepsProps = {\n /** The step on screen. A new value brings its content in. */\n step: string | number\n /**\n * `forward` brings the new step in from the trailing edge over the one before, as a push on iOS; `back` returns to\n * a step before it.\n * @default \"forward\"\n */\n direction?: \"forward\" | \"back\"\n children: ReactNode\n className?: string\n}\n\n/** The steps of a flow inside a dialog, such as a sign-in that asks for an email and then a code. */\nconst Steps = ({ step, direction = \"forward\", children, className }: DialogStepsProps) => (\n <div className={clsx(s.Steps, className)} data-direction={direction}>\n <TransitionGroup {...STEP_TIMING} as=\"div\" overlay className={s.Step} onEnter={enterStep} onExit={leaveStep} onExitActive={settleStepHeight} onExitComplete={releaseStepHeight}>\n <div key={step} data-dialog-step=\"\" tabIndex={-1}>{children}</div>\n </TransitionGroup>\n </div>\n)\n\nconst Close = ({ children }: { children: ReactNode }) => {\n return <RadixDialog.Close asChild>{children}</RadixDialog.Close>\n}\n\nDialog.Trigger = Trigger\nDialog.Content = Content\nDialog.Header = Header\nDialog.HeaderAction = HeaderAction\nDialog.Body = Body\nDialog.Footer = Footer\nDialog.Title = Title\nDialog.Description = Description\nDialog.DescriptionSlot = DescriptionSlot\nDialog.Close = Close\nDialog.Steps = Steps\n"]}
@@ -23,7 +23,7 @@ import s from "@plexui/styles/components/Menu/Menu.module.css";
23
23
  // Inside a PhoneLayout a menu opens in its box, laid out as on a phone and kept within it; in a Dialog laid out as on a
24
24
  // phone outside one it opens over the window, in a phone scope of its own (plan 176)
25
25
  const COLLISION_PADDING = { bottom: 30, top: 30, left: 12, right: 12 };
26
- const useMenuPhoneLayout = (open) => {
26
+ export const useMenuPhoneLayout = (open) => {
27
27
  const floatingBoundary = useFloatingBoundary(open, COLLISION_PADDING);
28
28
  const phoneLayout = useContext(PhoneLayoutContext);
29
29
  const container = phoneLayout?.container ?? null;
@@ -280,7 +280,7 @@ const Content = ({ children, side, sideOffset, align, alignOffset, width, minWid
280
280
  "menu-width": width,
281
281
  "menu-min-width": isHorizontal ? "auto" : minWidth,
282
282
  "menu-max-height": maxHeight,
283
- }), children: children }, "dropdown")) }) }) }));
283
+ }), children: isHorizontal ? children : _jsx("div", { className: s.Items, children: children }) }, "dropdown")) }) }) }));
284
284
  };
285
285
  // Keep Radix's public trigger registration, attributes and ref while owning
286
286
  // activation. Its pointerdown-only behavior cannot commit touch/AT clicks.