@acronis-platform/ui-react 5.5.4 → 5.5.6

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.
@@ -6,8 +6,8 @@ var n = {
6
6
  right: 5,
7
7
  bottom: 5,
8
8
  left: 5
9
- };
10
- function r(e, t) {
9
+ }, r = 16;
10
+ function i(e, t) {
11
11
  if (!t) return e;
12
12
  let r = {
13
13
  top: e?.top ?? n.top,
@@ -21,51 +21,53 @@ function r(e, t) {
21
21
  right: r.right + (t?.right ?? 0)
22
22
  };
23
23
  }
24
- function i(n, r, i, a) {
25
- let o = e(i, r), [s, c] = t.useState({
26
- height: o ?? 0,
24
+ function a(n, i, a, o) {
25
+ let s = e(a, i), [c, l] = t.useState({
26
+ height: s ?? 0,
27
27
  margin: {}
28
28
  });
29
29
  return t.useLayoutEffect(() => {
30
- c({
31
- height: o ?? 0,
30
+ l({
31
+ height: s ?? 0,
32
32
  margin: {}
33
33
  });
34
- }, [o, a]), t.useLayoutEffect(() => {
35
- if (r == null) return;
34
+ }, [s, o]), t.useLayoutEffect(() => {
35
+ if (i == null) return;
36
36
  let e = n.current;
37
37
  if (!e) return;
38
38
  let t = () => {
39
39
  let t = e.querySelector(".recharts-surface"), n = Array.from(e.querySelectorAll(".recharts-xAxis-tick-labels text"));
40
40
  if (!t || !n.length) return;
41
- let r = t.getBoundingClientRect();
42
- if (!r.width || !r.height) return;
43
- let i = n.map((e) => e.getBoundingClientRect()), a = Math.min(...i.map((e) => e.left)), s = Math.max(...i.map((e) => e.right)), l = Math.max(...i.map((e) => e.bottom)), u = e.querySelector(".recharts-legend-wrapper")?.getBoundingClientRect(), d = Math.min(r.bottom, u ? u.top - 8 : r.bottom);
44
- c((e) => {
45
- let t = Math.ceil(Math.max(0, r.left - a)), n = Math.ceil(Math.max(0, s - r.right)), i = Math.max(0, (e.margin.left ?? 0) + (t ? t + 16 : 0)), c = Math.max(0, (e.margin.right ?? 0) + (n ? n + 16 : 0)), u = Math.max(o ?? 0, Math.ceil(e.height - (d - l))), f = i || c ? {
46
- left: i || void 0,
47
- right: c || void 0
41
+ let i = t.getBoundingClientRect();
42
+ if (!i.width || !i.height) return;
43
+ let a = n.map((e) => e.getBoundingClientRect()).filter(({ width: e, height: t }) => e > 0 && t > 0);
44
+ if (!a.length) return;
45
+ let o = Math.min(...a.map((e) => e.left)), c = Math.max(...a.map((e) => e.right)), u = Math.max(...a.map((e) => e.bottom)), d = e.querySelector(".recharts-legend-wrapper")?.getBoundingClientRect(), f = Math.min(i.bottom, d ? d.top - 8 : i.bottom);
46
+ l((e) => {
47
+ let t = Math.ceil(i.left - o + r), n = Math.ceil(c - i.right + r), a = Math.ceil(u - f), l = Math.max(0, (e.margin.left ?? 0) + t), d = Math.max(0, (e.margin.right ?? 0) + n), p = Math.max(s ?? 0, e.height + a), m = l || d ? {
48
+ left: l || void 0,
49
+ right: d || void 0
48
50
  } : {};
49
- return e.height === u && e.margin.left === f.left && e.margin.right === f.right ? e : {
50
- height: u,
51
- margin: f
51
+ return e.height === p && e.margin.left === m.left && e.margin.right === m.right ? e : {
52
+ height: p,
53
+ margin: m
52
54
  };
53
55
  });
54
56
  };
55
57
  t();
56
- let i = new ResizeObserver(t);
57
- return i.observe(e), () => i.disconnect();
58
+ let a = new ResizeObserver(t);
59
+ return a.observe(e), () => a.disconnect();
58
60
  }, [
59
- r,
61
+ i,
60
62
  n,
61
- o,
62
- a
63
+ s,
64
+ o
63
65
  ]), {
64
- height: s.height || void 0,
65
- margin: s.margin.left || s.margin.right ? s.margin : void 0
66
+ height: c.height || void 0,
67
+ margin: c.margin.left || c.margin.right ? c.margin : void 0
66
68
  };
67
69
  }
68
70
  //#endregion
69
- export { r as mergeXAxisLayoutMargin, i as useXAxisLayout };
71
+ export { i as mergeXAxisLayoutMargin, a as useXAxisLayout };
70
72
 
71
73
  //# sourceMappingURL=use-x-axis-layout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-x-axis-layout.js","names":[],"sources":["../../../../src/components/ui/chart/use-x-axis-layout.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { resolveXAxisHeight } from './chart-format';\n\nexport type XAxisLayout = {\n height: number | undefined;\n margin: { left?: number; right?: number } | undefined;\n};\n\ntype ChartMargin = {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n};\n\ntype MeasuredXAxisLayout = {\n height: number;\n margin: { left?: number; right?: number };\n};\n\nconst RECHARTS_DEFAULT_MARGIN = { top: 5, right: 5, bottom: 5, left: 5 } as const;\n\n/**\n * Add the measured endpoint clearance without turning recharts' per-side\n * defaults into zeroes. Recharts applies its 5px defaults only when the whole\n * margin prop is absent, so a partial left/right margin must be completed here.\n */\nexport function mergeXAxisLayoutMargin(\n baseMargin: ChartMargin | undefined,\n xAxisMargin: XAxisLayout['margin']\n): ChartMargin | undefined {\n if (!xAxisMargin) return baseMargin;\n\n const margin = {\n top: baseMargin?.top ?? RECHARTS_DEFAULT_MARGIN.top,\n right: baseMargin?.right ?? RECHARTS_DEFAULT_MARGIN.right,\n bottom: baseMargin?.bottom ?? RECHARTS_DEFAULT_MARGIN.bottom,\n left: baseMargin?.left ?? RECHARTS_DEFAULT_MARGIN.left,\n };\n\n return {\n ...margin,\n left: margin.left + (xAxisMargin?.left ?? 0),\n right: margin.right + (xAxisMargin?.right ?? 0),\n };\n}\n\n/**\n * Fits a rotated X-axis tick row to the geometry that recharts actually\n * rendered. Estimating from character count leaves conspicuous empty space for\n * narrow glyphs and short endpoint labels; measuring the SVG lets the axis use\n * precisely the room its labels need.\n */\nexport function useXAxisLayout(\n containerRef: React.RefObject<HTMLElement | null>,\n angle: number | undefined,\n label: string | undefined,\n layoutKey: string\n): XAxisLayout {\n const fallbackHeight = resolveXAxisHeight(label, angle);\n const [layout, setLayout] = React.useState<MeasuredXAxisLayout>({\n height: fallbackHeight ?? 0,\n margin: {},\n });\n\n React.useLayoutEffect(() => {\n setLayout({ height: fallbackHeight ?? 0, margin: {} });\n }, [fallbackHeight, layoutKey]);\n\n React.useLayoutEffect(() => {\n if (angle == null) return;\n\n const container = containerRef.current;\n if (!container) return;\n\n const measure = () => {\n const surface = container.querySelector<SVGSVGElement>('.recharts-surface');\n const ticks = Array.from(\n container.querySelectorAll<SVGTextElement>(\n '.recharts-xAxis-tick-labels text'\n )\n );\n if (!surface || !ticks.length) return;\n\n const surfaceBounds = surface.getBoundingClientRect();\n if (!surfaceBounds.width || !surfaceBounds.height) return;\n\n const tickBounds = ticks.map((tick) => tick.getBoundingClientRect());\n const left = Math.min(...tickBounds.map((bounds) => bounds.left));\n const right = Math.max(...tickBounds.map((bounds) => bounds.right));\n const bottom = Math.max(...tickBounds.map((bounds) => bounds.bottom));\n const legendBounds = container\n .querySelector<HTMLElement>('.recharts-legend-wrapper')\n ?.getBoundingClientRect();\n // Recharts' legend is absolutely positioned inside the same responsive\n // area. It can therefore overlap labels well before the SVG's own lower\n // edge. Keep a small, intentional gap to it rather than making the tick\n // row consume every pixel down to that edge.\n const bottomBoundary = Math.min(\n surfaceBounds.bottom,\n legendBounds ? legendBounds.top - 8 : surfaceBounds.bottom\n );\n\n setLayout((current) => {\n const leftOverflow = Math.ceil(Math.max(0, surfaceBounds.left - left));\n const rightOverflow = Math.ceil(Math.max(0, right - surfaceBounds.right));\n const nextLeft = Math.max(\n 0,\n (current.margin.left ?? 0) +\n (leftOverflow ? leftOverflow + 16 : 0)\n );\n const nextRight = Math.max(\n 0,\n (current.margin.right ?? 0) +\n (rightOverflow ? rightOverflow + 16 : 0)\n );\n // The bottom of the surface is the X-axis allocation boundary. The\n // measured distance tells us how much of the provisional height is\n // unused (or how much is still missing), rather than guessing from a\n // string's character count.\n const minimumHeight = fallbackHeight ?? 0;\n const nextHeight = Math.max(\n minimumHeight,\n Math.ceil(current.height - (bottomBoundary - bottom))\n );\n const nextMargin =\n nextLeft || nextRight\n ? { left: nextLeft || undefined, right: nextRight || undefined }\n : {};\n if (\n current.height === nextHeight &&\n current.margin.left === nextMargin.left &&\n current.margin.right === nextMargin.right\n ) {\n return current;\n }\n return { height: nextHeight, margin: nextMargin };\n });\n };\n\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(container);\n return () => observer.disconnect();\n }, [angle, containerRef, fallbackHeight, layoutKey]);\n\n return {\n height: layout.height || undefined,\n margin:\n layout.margin.left || layout.margin.right ? layout.margin : undefined,\n };\n}\n"],"mappings":";;;AAqBA,IAAM,IAA0B;CAAE,KAAK;CAAG,OAAO;CAAG,QAAQ;CAAG,MAAM;AAAE;AAOvE,SAAgB,EACd,GACA,GACyB;CACzB,IAAI,CAAC,GAAa,OAAO;CAEzB,IAAM,IAAS;EACb,KAAK,GAAY,OAAO,EAAwB;EAChD,OAAO,GAAY,SAAS,EAAwB;EACpD,QAAQ,GAAY,UAAU,EAAwB;EACtD,MAAM,GAAY,QAAQ,EAAwB;CACpD;CAEA,OAAO;EACL,GAAG;EACH,MAAM,EAAO,QAAQ,GAAa,QAAQ;EAC1C,OAAO,EAAO,SAAS,GAAa,SAAS;CAC/C;AACF;AAQA,SAAgB,EACd,GACA,GACA,GACA,GACa;CACb,IAAM,IAAiB,EAAmB,GAAO,CAAK,GAChD,CAAC,GAAQ,KAAa,EAAM,SAA8B;EAC9D,QAAQ,KAAkB;EAC1B,QAAQ,CAAC;CACX,CAAC;CAmFD,OAjFA,EAAM,sBAAsB;EAC1B,EAAU;GAAE,QAAQ,KAAkB;GAAG,QAAQ,CAAC;EAAE,CAAC;CACvD,GAAG,CAAC,GAAgB,CAAS,CAAC,GAE9B,EAAM,sBAAsB;EAC1B,IAAI,KAAS,MAAM;EAEnB,IAAM,IAAY,EAAa;EAC/B,IAAI,CAAC,GAAW;EAEhB,IAAM,UAAgB;GACpB,IAAM,IAAU,EAAU,cAA6B,mBAAmB,GACpE,IAAQ,MAAM,KAClB,EAAU,iBACR,kCACF,CACF;GACA,IAAI,CAAC,KAAW,CAAC,EAAM,QAAQ;GAE/B,IAAM,IAAgB,EAAQ,sBAAsB;GACpD,IAAI,CAAC,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,UAAU,KAAA;EACzB,QACE,EAAO,OAAO,QAAQ,EAAO,OAAO,QAAQ,EAAO,SAAS,KAAA;CAChE;AACF"}
1
+ {"version":3,"file":"use-x-axis-layout.js","names":[],"sources":["../../../../src/components/ui/chart/use-x-axis-layout.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { resolveXAxisHeight } from './chart-format';\n\nexport type XAxisLayout = {\n height: number | undefined;\n margin: { left?: number; right?: number } | undefined;\n};\n\ntype ChartMargin = {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n};\n\ntype MeasuredXAxisLayout = {\n height: number;\n margin: { left?: number; right?: number };\n};\n\nconst RECHARTS_DEFAULT_MARGIN = { top: 5, right: 5, bottom: 5, left: 5 } as const;\n// Keep rotated endpoint labels this far inside the chart surface. Signed\n// adjustments converge on this gap after each container resize.\nconst X_AXIS_LABEL_CLEARANCE = 16;\n\n/**\n * Add the measured endpoint clearance without turning recharts' per-side\n * defaults into zeroes. Recharts applies its 5px defaults only when the whole\n * margin prop is absent, so a partial left/right margin must be completed here.\n */\nexport function mergeXAxisLayoutMargin(\n baseMargin: ChartMargin | undefined,\n xAxisMargin: XAxisLayout['margin']\n): ChartMargin | undefined {\n if (!xAxisMargin) return baseMargin;\n\n const margin = {\n top: baseMargin?.top ?? RECHARTS_DEFAULT_MARGIN.top,\n right: baseMargin?.right ?? RECHARTS_DEFAULT_MARGIN.right,\n bottom: baseMargin?.bottom ?? RECHARTS_DEFAULT_MARGIN.bottom,\n left: baseMargin?.left ?? RECHARTS_DEFAULT_MARGIN.left,\n };\n\n return {\n ...margin,\n left: margin.left + (xAxisMargin?.left ?? 0),\n right: margin.right + (xAxisMargin?.right ?? 0),\n };\n}\n\n/**\n * Fits a rotated X-axis tick row to the geometry that recharts actually\n * rendered. Estimating from character count leaves conspicuous empty space for\n * narrow glyphs and short endpoint labels; measuring the SVG lets the axis use\n * precisely the room its labels need.\n */\nexport function useXAxisLayout(\n containerRef: React.RefObject<HTMLElement | null>,\n angle: number | undefined,\n label: string | undefined,\n layoutKey: string\n): XAxisLayout {\n const fallbackHeight = resolveXAxisHeight(label, angle);\n const [layout, setLayout] = React.useState<MeasuredXAxisLayout>({\n height: fallbackHeight ?? 0,\n margin: {},\n });\n\n React.useLayoutEffect(() => {\n setLayout({ height: fallbackHeight ?? 0, margin: {} });\n }, [fallbackHeight, layoutKey]);\n\n React.useLayoutEffect(() => {\n if (angle == null) return;\n\n const container = containerRef.current;\n if (!container) return;\n\n const measure = () => {\n const surface = container.querySelector<SVGSVGElement>('.recharts-surface');\n const ticks = Array.from(\n container.querySelectorAll<SVGTextElement>(\n '.recharts-xAxis-tick-labels text'\n )\n );\n if (!surface || !ticks.length) return;\n\n const surfaceBounds = surface.getBoundingClientRect();\n if (!surfaceBounds.width || !surfaceBounds.height) return;\n\n const tickBounds = ticks\n .map((tick) => tick.getBoundingClientRect())\n .filter(({ width, height }) => width > 0 && height > 0);\n if (!tickBounds.length) return;\n\n const left = Math.min(...tickBounds.map((bounds) => bounds.left));\n const right = Math.max(...tickBounds.map((bounds) => bounds.right));\n const bottom = Math.max(...tickBounds.map((bounds) => bounds.bottom));\n const legendBounds = container\n .querySelector<HTMLElement>('.recharts-legend-wrapper')\n ?.getBoundingClientRect();\n // Recharts' legend is absolutely positioned inside the same responsive\n // area. It can therefore overlap labels well before the SVG's own lower\n // edge. Keep a small, intentional gap to it rather than making the tick\n // row consume every pixel down to that edge.\n const bottomBoundary = Math.min(\n surfaceBounds.bottom,\n legendBounds ? legendBounds.top - 8 : surfaceBounds.bottom\n );\n\n setLayout((current) => {\n const leftAdjustment = Math.ceil(\n surfaceBounds.left - left + X_AXIS_LABEL_CLEARANCE\n );\n const rightAdjustment = Math.ceil(\n right - surfaceBounds.right + X_AXIS_LABEL_CLEARANCE\n );\n const bottomAdjustment = Math.ceil(bottom - bottomBoundary);\n const nextLeft = Math.max(\n 0,\n (current.margin.left ?? 0) + leftAdjustment\n );\n const nextRight = Math.max(\n 0,\n (current.margin.right ?? 0) + rightAdjustment\n );\n // The bottom of the surface is the X-axis allocation boundary. The\n // measured distance tells us how much of the provisional height is\n // unused (or how much is still missing), rather than guessing from a\n // string's character count.\n const minimumHeight = fallbackHeight ?? 0;\n const nextHeight = Math.max(\n minimumHeight,\n current.height + bottomAdjustment\n );\n const nextMargin =\n nextLeft || nextRight\n ? { left: nextLeft || undefined, right: nextRight || undefined }\n : {};\n if (\n current.height === nextHeight &&\n current.margin.left === nextMargin.left &&\n current.margin.right === nextMargin.right\n ) {\n return current;\n }\n return { height: nextHeight, margin: nextMargin };\n });\n };\n\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(container);\n return () => observer.disconnect();\n }, [angle, containerRef, fallbackHeight, layoutKey]);\n\n return {\n height: layout.height || undefined,\n margin:\n layout.margin.left || layout.margin.right ? layout.margin : undefined,\n };\n}\n"],"mappings":";;;AAqBA,IAAM,IAA0B;CAAE,KAAK;CAAG,OAAO;CAAG,QAAQ;CAAG,MAAM;AAAE,GAGjE,IAAyB;AAO/B,SAAgB,EACd,GACA,GACyB;CACzB,IAAI,CAAC,GAAa,OAAO;CAEzB,IAAM,IAAS;EACb,KAAK,GAAY,OAAO,EAAwB;EAChD,OAAO,GAAY,SAAS,EAAwB;EACpD,QAAQ,GAAY,UAAU,EAAwB;EACtD,MAAM,GAAY,QAAQ,EAAwB;CACpD;CAEA,OAAO;EACL,GAAG;EACH,MAAM,EAAO,QAAQ,GAAa,QAAQ;EAC1C,OAAO,EAAO,SAAS,GAAa,SAAS;CAC/C;AACF;AAQA,SAAgB,EACd,GACA,GACA,GACA,GACa;CACb,IAAM,IAAiB,EAAmB,GAAO,CAAK,GAChD,CAAC,GAAQ,KAAa,EAAM,SAA8B;EAC9D,QAAQ,KAAkB;EAC1B,QAAQ,CAAC;CACX,CAAC;CA0FD,OAxFA,EAAM,sBAAsB;EAC1B,EAAU;GAAE,QAAQ,KAAkB;GAAG,QAAQ,CAAC;EAAE,CAAC;CACvD,GAAG,CAAC,GAAgB,CA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O,KAAa,KAAA;IAAU,IAC7D,CAAC;IAQP,OANE,EAAQ,WAAW,KACnB,EAAQ,OAAO,SAAS,EAAW,QACnC,EAAQ,OAAO,UAAU,EAAW,QAE7B,IAEF;KAAE,QAAQ;KAAY,QAAQ;IAAW;GAClD,CAAC;EACH;EAEA,EAAQ;EACR,IAAM,IAAW,IAAI,eAAe,CAAO;EAE3C,OADA,EAAS,QAAQ,CAAS,SACb,EAAS,WAAW;CACnC,GAAG;EAAC;EAAO;EAAc;EAAgB;CAAS,CAAC,GAE5C;EACL,QAAQ,EAAO,UAAU,KAAA;EACzB,QACE,EAAO,OAAO,QAAQ,EAAO,OAAO,QAAQ,EAAO,SAAS,KAAA;CAChE;AACF"}
@@ -11,7 +11,7 @@ import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
11
11
  import { TimesIcon as f } from "@acronis-platform/icons-react/stroke-mono";
12
12
  import { Dialog as p } from "@base-ui/react/dialog";
13
13
  //#region src/components/ui/dialog/dialog.tsx
14
- var m = n("fixed left-1/2 top-1/2 z-50 flex max-h-[calc(100dvh-96px)] w-full min-w-[var(--ui-dialog-container-width-min)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-[var(--ui-dialog-container-border-radius)] bg-[var(--ui-dialog-container-color)] text-foreground shadow-lg duration-200 data-[open]:animate-in data-[open]:fade-in-0 data-[open]:zoom-in-95 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95", {
14
+ var m = n("fixed left-1/2 top-1/2 z-50 flex max-h-[calc(100dvh-96px)] w-full min-w-[var(--ui-dialog-container-width-min)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-[var(--ui-dialog-container-border-radius)] bg-[var(--ui-dialog-container-color)] text-foreground shadow-lg duration-200 transition-[scale] after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:bg-[color-mix(in_oklab,var(--ui-background-backdrop-screen)_36%,transparent)] dark:after:bg-[color-mix(in_oklab,var(--ui-background-backdrop-screen)_80%,transparent)] after:opacity-0 after:transition-opacity after:duration-200 after:content-[\"\"] data-[open]:animate-in data-[open]:fade-in-0 data-[open]:zoom-in-95 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95 data-[nested-dialog-open]:scale-[0.96] data-[nested-dialog-open]:after:opacity-100 dark:data-[nested]:border dark:data-[nested]:border-[var(--ui-dialog-header-border-color)]", {
15
15
  variants: { size: {
16
16
  sm: "max-w-[min(var(--ui-dialog-container-size-sm),calc(100dvw-96px))]",
17
17
  large: "max-w-[min(832px,calc(100dvw-96px))]"
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","names":[],"sources":["../../../../src/components/ui/dialog/dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Dialog as DialogPrimitive } from '@base-ui/react/dialog';\nimport { TimesIcon } from '@acronis-platform/icons-react/stroke-mono';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@/lib/utils';\nimport { usePortalContainer } from '@/lib/portal-container';\n\nimport { Button } from '../button';\nimport { ButtonIcon } from '../button-icon';\nimport { DialogFooterDefault } from '../dialog-footer-default';\nimport { InputText } from '../input-text';\nimport { Loading } from '../loading';\n\n// Initial version ported from `@acronis-platform/shadcn-uikit`'s `dialog`\n// (packages/ui-legacy/src/components/ui/dialog.tsx). A modal overlay built on\n// the Base UI Dialog primitive (keyboard, focus trap, scroll lock, ARIA come\n// from Base UI). A `--ui-dialog-*` / `--ui-button-icon-*` token tier covers the\n// container + close button (reconciled against the Figma \"DialogDefault\" node,\n// 6343:58898); the composable DialogRoot / DialogHeaderRoot / DialogFooterRoot\n// / DialogBodyRoot parts below are internal-only (no public export, no Figma\n// node of their own) and keep the prior semantic-token approach — not to be\n// confused with the recipe-local `DialogHeader`/`DialogBody` further down,\n// which back the public `Dialog` and are reconciled against Figma:\n// • overlay -> var(--ui-background-backdrop-screen) (legacy `bg-black/80`)\n// • popup -> var(--ui-dialog-container-color) / var(--ui-dialog-container-border-radius)\n// • header / footer -> bg-background = --ui-background-surface-primary (white\n// bars over the muted body), divided by border-border\n// • title -> text-foreground / description -> text-muted-foreground\n// • close -> var(--ui-button-icon-global-icon-color-*) (idle/hover/active\n// share one blue in the default brand), bg via\n// var(--ui-button-icon-global-container-color-*), focus ring var(--ui-focus-primary)\n// Enter/exit animations use `tw-animate-css` (imported in styles/index.css),\n// keyed to Base UI's data-[open] / data-[closed] state attributes — overlay\n// fades, popup fades + zooms. `size` has two values: `sm` (512px, the Figma\n// default, backed by `--ui-dialog-container-size-sm`) and `large` (832px) — the\n// latter predates the Figma node and has no token; it's kept as a plain\n// arbitrary value solely for backward compatibility with existing call sites\n// that need a wider popup (see the `Large` story).\n//\n// Dialog's composable primitive parts (this file) are internal-only — not\n// re-exported from the package root — except `DialogClose`, which stays\n// public: it's required by the `wide` variant's documented custom-`footer`\n// escape hatch (see the `footer` prop and dialog.mdx). The public `Dialog`\n// component below is the sole sanctioned entry point; it's built on these\n// parts internally. (In Figma the matching component set is named\n// \"DialogDefault\"; the code-facing name stays `Dialog` — see dialog.figma.tsx.)\n\n// Figma's \"DialogWelcome\" frame (variant=carousel, node 6353:6164) wraps its\n// popup preview in a `p-[48px]` ancestor — the minimum margin the popup must\n// keep from the viewport edge on any screen size. `max-w`/`max-h` (not\n// padding, since the popup itself is centered via `fixed` + transform)\n// enforce it here so every consumer keeps that margin, not just the frame\n// that surfaced it.\nconst dialogContentVariants = cva(\n 'fixed left-1/2 top-1/2 z-50 flex max-h-[calc(100dvh-96px)] w-full min-w-[var(--ui-dialog-container-width-min)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-[var(--ui-dialog-container-border-radius)] bg-[var(--ui-dialog-container-color)] text-foreground shadow-lg duration-200 data-[open]:animate-in data-[open]:fade-in-0 data-[open]:zoom-in-95 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95',\n {\n variants: {\n size: {\n sm: 'max-w-[min(var(--ui-dialog-container-size-sm),calc(100dvw-96px))]',\n large: 'max-w-[min(832px,calc(100dvw-96px))]',\n },\n },\n defaultVariants: {\n size: 'sm',\n },\n }\n);\n\nconst DialogRoot = DialogPrimitive.Root;\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Backdrop>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Backdrop>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Backdrop\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 bg-[var(--ui-background-backdrop-screen)] duration-200 data-[open]:animate-in data-[open]:fade-in-0 data-[closed]:animate-out data-[closed]:fade-out-0',\n className\n )}\n {...props}\n />\n));\nDialogOverlay.displayName = 'DialogOverlay';\n\nexport interface DialogContentProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Popup>,\n VariantProps<typeof dialogContentVariants> {\n /**\n * Popup max-width. `sm` (512px, default) is the Figma-defined size; `large`\n * (832px) is a backward-compatibility size with no design token (see the\n * `Large` story).\n */\n size?: VariantProps<typeof dialogContentVariants>['size'];\n /**\n * Render the content inside a portal (default `true`). Base UI requires the\n * Popup to sit in a Portal for correct stacking; set `false` for inline usage\n * (e.g. when the caller supplies its own `DialogPortal`, or in tests).\n */\n portal?: boolean;\n /**\n * Portal container. Pass a shadow-root mount for isolated-style previews\n * (the docs demos do this via `useShadowMount`).\n */\n portalContainer?: DialogPrimitive.Portal.Props['container'];\n /** Keep the content mounted while closed (Base UI `Portal` prop). */\n keepMounted?: DialogPrimitive.Portal.Props['keepMounted'];\n}\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Popup>,\n DialogContentProps\n>(\n (\n {\n className,\n children,\n size,\n portal = true,\n portalContainer,\n keepMounted,\n ...props\n },\n ref\n ) => {\n const ctxContainer = usePortalContainer();\n const resolvedContainer = portalContainer ?? ctxContainer;\n\n const popup = (\n <>\n <DialogOverlay />\n <DialogPrimitive.Popup\n ref={ref}\n className={cn(dialogContentVariants({ size }), className)}\n {...props}\n >\n {children}\n </DialogPrimitive.Popup>\n </>\n );\n\n return portal ? (\n <DialogPrimitive.Portal container={resolvedContainer} keepMounted={keepMounted}>\n {popup}\n </DialogPrimitive.Portal>\n ) : (\n popup\n );\n }\n);\nDialogContent.displayName = 'DialogContent';\n\nconst DialogHeaderRoot = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n 'flex h-16 items-center gap-4 border-b border-border bg-background px-5 py-4',\n className\n )}\n {...props}\n />\n));\nDialogHeaderRoot.displayName = 'DialogHeaderRoot';\n\nconst DialogFooterRoot = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n 'flex h-16 items-center justify-end gap-4 border-t border-border bg-background px-6 py-4',\n className\n )}\n {...props}\n />\n));\nDialogFooterRoot.displayName = 'DialogFooterRoot';\n\nconst DialogBodyRoot = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn('flex-1 overflow-auto p-6', className)} {...props} />\n));\nDialogBodyRoot.displayName = 'DialogBodyRoot';\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\n 'flex-1 text-2xl font-normal leading-8 text-foreground',\n className\n )}\n {...props}\n />\n));\nDialogTitle.displayName = 'DialogTitle';\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n));\nDialogDescription.displayName = 'DialogDescription';\n\nexport interface DialogCloseButtonProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close> {\n /** Accessible name for screen readers. Defaults to `'Close'`. */\n closeLabel?: string;\n}\n\nconst DialogCloseButton = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Close>,\n DialogCloseButtonProps\n>(({ className, closeLabel = 'Close', ...props }, ref) => (\n <DialogPrimitive.Close\n ref={ref}\n render={<ButtonIcon variant=\"ghost\" />}\n className={className}\n {...props}\n >\n <TimesIcon />\n <span className=\"sr-only\">{closeLabel}</span>\n </DialogPrimitive.Close>\n));\nDialogCloseButton.displayName = 'DialogCloseButton';\n\n// The recipe-specific header: title + close button, reconciled against the\n// Figma \"DialogHeader\" node (4220:3516) via the `--ui-dialog-header-*` tier.\n// Local to this file (not exported) — distinct from the generic, unstyled\n// `DialogHeaderRoot` composable primitive above.\ninterface DialogHeaderProps {\n title: string;\n closeLabel?: string;\n}\n\nfunction DialogHeader({ title, closeLabel }: DialogHeaderProps) {\n return (\n <div className=\"flex h-[var(--ui-dialog-header-height)] shrink-0 items-center gap-[var(--ui-dialog-header-gap)] border-b-[length:var(--ui-dialog-header-border-width)] border-[var(--ui-dialog-header-border-color)] bg-[var(--ui-dialog-header-color)] px-[var(--ui-dialog-header-padding-x)]\">\n <DialogTitle>{title}</DialogTitle>\n <DialogCloseButton closeLabel={closeLabel} />\n </div>\n );\n}\n\n// The recipe-specific body: the variant's canned copy (or the `children`\n// override), reconciled against the Figma DialogDefault node via the\n// `--ui-dialog-body-*` tier. Local to this file — distinct from the generic\n// `DialogBodyRoot` composable primitive above.\ninterface DialogBodyProps {\n children: React.ReactNode;\n /** Makes the body unfocusable/unclickable while the loading overlay is shown. */\n inert?: boolean;\n}\n\nfunction DialogBody({ children, inert }: DialogBodyProps) {\n return (\n <div\n inert={inert}\n className=\"flex min-h-[var(--ui-dialog-body-height-min)] flex-col justify-center-safe gap-[var(--ui-dialog-body-gap)] overflow-y-auto px-4 py-[var(--ui-dialog-body-padding-y)]\"\n >\n {typeof children === 'string' ? (\n <p className=\"text-sm leading-6 text-foreground\">{children}</p>\n ) : (\n children\n )}\n </div>\n );\n}\n\n// The recipe-specific footer actions: a secondary (dismiss) button plus a\n// primary action, the latter either closing the dialog itself (`read-only`'s\n// \"Done\") or firing `onPrimaryAction` and leaving the close to the caller.\n// Local to this file — distinct from the generic `DialogFooterRoot`.\ninterface DialogFooterActionsProps {\n secondaryLabel?: string;\n primaryLabel: string;\n primaryVariant: 'default' | 'destructive';\n primaryCloses?: boolean;\n onPrimaryAction?: () => void;\n}\n\nfunction DialogFooterActions({\n secondaryLabel,\n primaryLabel,\n primaryVariant,\n primaryCloses,\n onPrimaryAction,\n}: DialogFooterActionsProps) {\n return (\n <>\n {secondaryLabel && (\n <DialogClose render={<Button variant=\"secondary\">{secondaryLabel}</Button>} />\n )}\n {primaryCloses ? (\n <DialogClose\n onClick={onPrimaryAction}\n render={<Button variant={primaryVariant}>{primaryLabel}</Button>}\n />\n ) : (\n <Button variant={primaryVariant} onClick={onPrimaryAction}>\n {primaryLabel}\n </Button>\n )}\n </>\n );\n}\n\n// A higher-level \"recipe\" built on top of the Dialog primitive parts above\n// (DialogRoot + DialogContent give the portal, backdrop, focus trap, scroll\n// lock and open state; DialogTitle wires the accessible name; DialogCloseButton\n// / DialogClose give the dismiss controls). It bakes in the seven Figma\n// \"DialogDefault\" use-cases (node 6343:58898) plus one legacy `wide` escape\n// hatch kept for backward compatibility: each `variant` picks a canned title,\n// body copy and footer buttons; `children` overrides only the body slot;\n// `title` overrides only the title; `footer` overrides only the footer's\n// action content (the free-form escape hatch `wide` relies on); `hasLoading`\n// drops a spinner overlay over the body + footer. `hasHeader`/`hasFooter`\n// (both default `true`) hide the header/footer chrome entirely — a\n// ui-react-only extension beyond the Figma DialogDefault contract, which\n// always shows both; the title stays rendered off-screen when the header is\n// hidden so the dialog keeps an accessible name.\n//\n// Colors resolve to shipped semantic tokens via the bridged Tailwind names the\n// Dialog family already uses (text-foreground, the backdrop + focus tokens\n// inside DialogContent / DialogCloseButton) and the Button / InputText token\n// tiers — nothing is hand-authored. The loading scrim renders `Loading`'s\n// `onSurfaceSecondary` variant (`--ui-loading-element-container-color-secondary`),\n// matching the design's translucent surface fill.\n//\n// Header + footer geometry/color resolve to the `--ui-dialog-header-*` /\n// `--ui-footer-*` tiers, reconciled against the DialogDefault Figma node.\n\nexport type DialogVariant =\n | 'default'\n | 'rename'\n | 'save changes'\n | 'reset password'\n | 'discard changes'\n | 'accept'\n | 'read-only'\n | 'wide';\n\ninterface DialogVariantContent {\n /**\n * The variant's canned title. A function receives `objectName` (falls back\n * to its own placeholder default when omitted) for variants whose title\n * embeds the acted-on object's name.\n */\n title: string | ((objectName?: string) => string);\n /**\n * Same `objectName` interpolation as `title`, for body copy/fields that\n * embed it. The `rename` variant's field also receives `objectNameLabel`\n * for its accessible name.\n */\n body:\n | React.ReactNode\n | ((objectName?: string, objectNameLabel?: string) => React.ReactNode);\n /** Secondary (dismiss) button label. Omitted when the variant has none. */\n secondaryLabel?: string;\n primaryLabel: string;\n primaryVariant: 'default' | 'destructive';\n /** Whether the primary button dismisses the dialog (e.g. read-only \"Done\"). */\n primaryCloses?: boolean;\n}\n\nconst DIALOG_VARIANT_CONTENT: Record<DialogVariant, DialogVariantContent> = {\n default: {\n title: 'Dialog title',\n body: 'Drop any content into this slot.',\n secondaryLabel: 'Cancel',\n primaryLabel: 'Label',\n primaryVariant: 'default',\n },\n rename: {\n title: (objectName = 'object name') => `Rename ${objectName}`,\n // `objectName` prefills the field with the real current name; the field's\n // accessible name (`objectNameLabel`) is separate — it's the label, not the value.\n body: (objectName = 'Current name', objectNameLabel = 'Object name') => (\n <InputText aria-label={objectNameLabel} defaultValue={objectName} />\n ),\n secondaryLabel: 'Cancel',\n primaryLabel: 'Rename',\n primaryVariant: 'default',\n },\n 'save changes': {\n title: 'Save changes',\n body: 'You have unsaved changes. Do you want to save them before leaving?',\n secondaryLabel: 'Go back',\n primaryLabel: 'Save',\n primaryVariant: 'default',\n },\n 'reset password': {\n title: 'Reset password',\n body: 'Further instructions will be sent to your email address.',\n secondaryLabel: 'Cancel',\n primaryLabel: 'Reset',\n primaryVariant: 'default',\n },\n 'discard changes': {\n title: 'Discard changes',\n body: (objectName = 'Object name') => (\n <p className=\"text-sm leading-6 text-foreground\">\n Are you sure you want to discard the unsaved changes to{' '}\n <strong className=\"font-semibold\">{objectName}</strong>?\n </p>\n ),\n secondaryLabel: 'Go back',\n primaryLabel: 'Confirm',\n primaryVariant: 'destructive',\n },\n accept: {\n title: (objectName = 'object name') => `Accept ${objectName}`,\n body: 'Click Accept to confirm that you have read, understood, and agree to the terms and conditions below.',\n secondaryLabel: 'Cancel',\n primaryLabel: 'Accept',\n primaryVariant: 'default',\n },\n 'read-only': {\n title: 'License agreement',\n body: 'This is a read-only dialog used to view legal documents such as the License Agreement, EULA updates, Terms of Service, and other legal documents.',\n primaryLabel: 'Done',\n primaryVariant: 'default',\n primaryCloses: true,\n },\n // No Figma preset — a legacy, free-form escape hatch (see the `footer` prop\n // and the `Large` story). This fallback title/body/footer only renders if\n // the caller supplies neither `footer` nor `title`/`children` — every real\n // `wide` call site overrides them.\n wide: {\n title: 'Dialog title',\n body: 'Drop any content into this slot.',\n secondaryLabel: 'Cancel',\n primaryLabel: 'Confirm',\n primaryVariant: 'default',\n },\n};\n\ntype DialogRootProps = React.ComponentPropsWithoutRef<typeof DialogRoot>;\n\nexport interface DialogProps extends Omit<DialogRootProps, 'children'> {\n /**\n * Selects the canned title / body / footer preset. Defaults to `'default'`.\n * `'wide'` is a legacy escape hatch (no canned preset) kept for backward\n * compatibility — pair it with `size=\"large\"` and the `footer` prop.\n */\n variant?: DialogVariant;\n /**\n * Show a spinner overlay across the body + footer, and make both `inert`\n * (unfocusable, unclickable, hidden from assistive tech) so a keyboard user\n * can't activate the visually obscured footer buttons while busy.\n */\n hasLoading?: boolean;\n /**\n * Overrides the loading overlay's accessible label. Defaults to `Loading`'s\n * own default (`'Data is loading…'`). Ignored when `hasLoading` is `false`.\n */\n loadingLabel?: string;\n /**\n * Show the header (title + close button). Defaults to `true`. When `false`,\n * the title is still rendered off-screen so the dialog keeps an accessible\n * name — only the visible bar and close button are omitted. Beyond the\n * strict Figma contract (all seven `DialogDefault` variants always show the\n * header); a ui-react-only extension, like `wide`/`size=\"large\"`.\n */\n hasHeader?: boolean;\n /**\n * Show the footer (action buttons). Defaults to `true`. Beyond the strict\n * Figma contract (all seven `DialogDefault` variants always show the\n * footer); a ui-react-only extension, like `wide`/`size=\"large\"`. When\n * `false`, `footer` (and the canned footer it would otherwise replace) is\n * not rendered either.\n */\n hasFooter?: boolean;\n /** Overrides the variant's default body content. */\n children?: React.ReactNode;\n /** Overrides the variant's default title. */\n title?: string;\n /**\n * The real name of the object being acted on (e.g. a file or resource\n * name). Interpolated into the `rename`/`discard changes`/`accept`\n * variants' canned title/body in place of the generic placeholder text;\n * ignored by variants that don't reference an object name.\n */\n objectName?: string;\n /**\n * Overrides the accessible name of the `rename` variant's text field\n * (default `'Object name'`). Ignored by every other variant.\n */\n objectNameLabel?: string;\n /**\n * Overrides the variant's default secondary (dismiss) button label. Passing\n * this for a variant with no secondary button by default (e.g. `read-only`)\n * also makes the button appear. Ignored when `footer` is provided.\n */\n secondaryLabel?: string;\n /** Overrides the variant's default primary button label. Ignored when `footer` is provided. */\n primaryLabel?: string;\n /**\n * Fires when the primary footer button is clicked. The dialog does not\n * close automatically afterwards — pair this with `open`/`onOpenChange` to\n * close it once the action completes. Ignored when `footer` is provided\n * (wire behavior onto your own buttons there instead).\n */\n onPrimaryAction?: () => void;\n /**\n * Replaces the footer's action content entirely with free-form buttons —\n * the escape hatch the `wide` variant is meant to be paired with, for\n * legacy call sites that don't fit one of the seven canned presets. Ignored\n * (along with the canned footer) when `hasFooter` is `false`.\n */\n footer?: React.ReactNode;\n /** Overrides the close button's accessible name. Defaults to `'Close'`. */\n closeLabel?: string;\n /**\n * Popup max-width (forwarded to `DialogContent`). Defaults to `'sm'`, or to\n * `'large'` when `variant` is `'wide'`.\n */\n size?: DialogContentProps['size'];\n /** Render inside a portal (forwarded to `DialogContent`). Defaults to `true`. */\n portal?: boolean;\n /** Portal container (forwarded to `DialogContent`). */\n portalContainer?: DialogContentProps['portalContainer'];\n /** Keep the content mounted while closed (forwarded to `DialogContent`). */\n keepMounted?: DialogContentProps['keepMounted'];\n /** Extra classes merged onto the popup container. */\n className?: string;\n}\n\nconst Dialog = React.forwardRef<HTMLDivElement, DialogProps>(\n (\n {\n variant = 'default',\n hasLoading = false,\n loadingLabel,\n hasHeader = true,\n hasFooter = true,\n children,\n title,\n objectName,\n objectNameLabel,\n secondaryLabel,\n primaryLabel,\n onPrimaryAction,\n footer,\n closeLabel,\n size,\n portal,\n portalContainer,\n keepMounted,\n className,\n ...rootProps\n },\n ref\n ) => {\n const content = DIALOG_VARIANT_CONTENT[variant];\n const resolvedTitle =\n typeof content.title === 'function' ? content.title(objectName) : content.title;\n const resolvedBody =\n typeof content.body === 'function'\n ? content.body(objectName, objectNameLabel)\n : content.body;\n const bodyContent = children ?? resolvedBody;\n const titleText = title ?? resolvedTitle;\n const secondaryLabelText = secondaryLabel ?? content.secondaryLabel;\n const primaryLabelText = primaryLabel ?? content.primaryLabel;\n const resolvedSize = size ?? (variant === 'wide' ? 'large' : 'sm');\n\n return (\n <DialogRoot {...rootProps}>\n <DialogContent\n ref={ref}\n size={resolvedSize}\n portal={portal}\n portalContainer={portalContainer}\n keepMounted={keepMounted}\n className={className}\n aria-busy={hasLoading || undefined}\n >\n {hasHeader ? (\n <DialogHeader title={titleText} closeLabel={closeLabel} />\n ) : (\n // Header hidden, but the dialog still needs an accessible name.\n <DialogTitle className=\"sr-only\">{titleText}</DialogTitle>\n )}\n\n <DialogBody inert={hasLoading}>{bodyContent}</DialogBody>\n\n {hasFooter && (\n <DialogFooterDefault inert={hasLoading}>\n {footer ?? (\n <DialogFooterActions\n secondaryLabel={secondaryLabelText}\n primaryLabel={primaryLabelText}\n primaryVariant={content.primaryVariant}\n primaryCloses={content.primaryCloses}\n onPrimaryAction={onPrimaryAction}\n />\n )}\n </DialogFooterDefault>\n )}\n\n {hasLoading && (\n <Loading\n variant=\"onSurfaceSecondary\"\n hasLabel={false}\n label={loadingLabel}\n className={cn(\n 'absolute inset-x-0 bottom-0 rounded-none',\n hasHeader ? 'top-[var(--ui-dialog-header-height)]' : 'top-0'\n )}\n />\n )}\n </DialogContent>\n </DialogRoot>\n );\n }\n);\nDialog.displayName = 'Dialog';\n\nexport {\n DialogRoot,\n DialogPortal,\n DialogOverlay,\n DialogClose,\n DialogCloseButton,\n DialogTrigger,\n DialogContent,\n DialogHeaderRoot,\n DialogFooterRoot,\n DialogTitle,\n DialogBodyRoot,\n DialogDescription,\n dialogContentVariants,\n Dialog,\n};\n"],"mappings":";;;;;;;;;;;;;AAsDA,IAAM,IAAwB,EAC5B,8bACA;CACE,UAAU,EACR,MAAM;EACJ,IAAI;EACJ,OAAO;CACT,EACF;CACA,iBAAiB,EACf,MAAM,KACR;AACF,CACF,GAEM,IAAa,EAAgB;AAEb,EAAgB,SAEjB,EAAgB;AAErC,IAAM,IAAc,EAAgB,OAE9B,IAAgB,EAAM,YAGzB,EAAE,cAAW,GAAG,KAAS,MAC1B,kBAAC,EAAgB,UAAjB;CACO;CACL,WAAW,EACT,6KACA,CACF;CACA,GAAI;AACL,CAAA,CACF;AACD,EAAc,cAAc;AA0B5B,IAAM,IAAgB,EAAM,YAKxB,EACE,cACA,aACA,SACA,YAAS,IACT,oBACA,gBACA,GAAG,KAEL,MACG;CACH,IAAM,IAAe,EAAmB,GAClC,IAAoB,KAAmB,GAEvC,IACJ,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD,CAAgB,CAAA,GAChB,kBAAC,EAAgB,OAAjB;EACO;EACL,WAAW,EAAG,EAAsB,EA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IAAuB,CAAA;IAG3D,kBAAC,GAAD;KAAY,OAAO;KAAa,UAAA;IAAwB,CAAA;IAEvD,KACC,kBAAC,GAAD;KAAqB,OAAO;KACzB,UAAA,KACC,kBAAC,GAAD;MACE,gBAAgB;MAChB,cAAc;MACd,gBAAgB,EAAQ;MACxB,eAAe,EAAQ;MACN;KAClB,CAAA;IAEgB,CAAA;IAGtB,KACC,kBAAC,GAAD;KACE,SAAQ;KACR,UAAU;KACV,OAAO;KACP,WAAW,EACT,4CACA,IAAY,yCAAyC,OACvD;IACD,CAAA;GAEU;;CACL,CAAA;AAEhB,CACF;AACA,EAAO,cAAc"}
1
+ {"version":3,"file":"dialog.js","names":[],"sources":["../../../../src/components/ui/dialog/dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Dialog as DialogPrimitive } from '@base-ui/react/dialog';\nimport { TimesIcon } from '@acronis-platform/icons-react/stroke-mono';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@/lib/utils';\nimport { usePortalContainer } from '@/lib/portal-container';\n\nimport { Button } from '../button';\nimport { ButtonIcon } from '../button-icon';\nimport { DialogFooterDefault } from '../dialog-footer-default';\nimport { InputText } from '../input-text';\nimport { Loading } from '../loading';\n\n// Initial version ported from `@acronis-platform/shadcn-uikit`'s `dialog`\n// (packages/ui-legacy/src/components/ui/dialog.tsx). A modal overlay built on\n// the Base UI Dialog primitive (keyboard, focus trap, scroll lock, ARIA come\n// from Base UI). A `--ui-dialog-*` / `--ui-button-icon-*` token tier covers the\n// container + close button (reconciled against the Figma \"DialogDefault\" node,\n// 6343:58898); the composable DialogRoot / DialogHeaderRoot / DialogFooterRoot\n// / DialogBodyRoot parts below are internal-only (no public export, no Figma\n// node of their own) and keep the prior semantic-token approach — not to be\n// confused with the recipe-local `DialogHeader`/`DialogBody` further down,\n// which back the public `Dialog` and are reconciled against Figma:\n// • overlay -> var(--ui-background-backdrop-screen) (legacy `bg-black/80`)\n// • popup -> var(--ui-dialog-container-color) / var(--ui-dialog-container-border-radius)\n// • header / footer -> bg-background = --ui-background-surface-primary (white\n// bars over the muted body), divided by border-border\n// • title -> text-foreground / description -> text-muted-foreground\n// • close -> var(--ui-button-icon-global-icon-color-*) (idle/hover/active\n// share one blue in the default brand), bg via\n// var(--ui-button-icon-global-container-color-*), focus ring var(--ui-focus-primary)\n// Enter/exit animations use `tw-animate-css` (imported in styles/index.css),\n// keyed to Base UI's data-[open] / data-[closed] state attributes — overlay\n// fades, popup fades + zooms. Those keyframes only animate `transform`/\n// `opacity`, so the nested-dialog recede below can safely live on the CSS\n// `scale` property + an `::after` scrim without fighting them.\n//\n// Nested dialogs: Base UI flags a dialog as nested purely by React-tree\n// position (`Boolean(parentDialogRootContext)` in DialogRoot) and then\n// deliberately skips rendering that dialog's own backdrop, so stacked\n// dialogs don't darken progressively. To compensate, Base UI sets\n// `data-nested-dialog-open` (plus a `--nested-dialogs` count) on the PARENT\n// popup while a nested dialog is open, expecting the consuming library to\n// give the parent a \"recede\" treatment for a visible depth cue. That's what\n// the data-[nested-dialog-open] rules below do: the parent popup scales\n// down slightly and gets a token-tinted scrim (a reduced-opacity mix of the\n// same --ui-background-backdrop-screen the overlay uses, not a hardcoded\n// color) while the child — which keeps its own backdrop suppressed — sits\n// on top. Stacked-modal depth reads through relative layer contrast, so the\n// scrim is theme-split in approach, not just strength: in light the parent\n// dims (36% of the backdrop token reads clearly over the white container).\n// In dark the container and the backdrop token are the same near-black, so\n// no scrim percentage can separate the layers — and repainting the nested\n// container with a lighter tier token would flatten its header/footer\n// chrome, whose surfaces share those very values. There the separation\n// comes from the Dialog tier's hairline border on the nested popup (an\n// edge stroke that follows each brand's dialog chrome), while the parent\n// keeps the stronger 80% scrim mainly to fade its content.\n// `size` has two values: `sm` (512px, the Figma\n// default, backed by `--ui-dialog-container-size-sm`) and `large` (832px) — the\n// latter predates the Figma node and has no token; it's kept as a plain\n// arbitrary value solely for backward compatibility with existing call sites\n// that need a wider popup (see the `Large` story).\n//\n// Dialog's composable primitive parts (this file) are internal-only — not\n// re-exported from the package root — except `DialogClose`, which stays\n// public: it's required by the `wide` variant's documented custom-`footer`\n// escape hatch (see the `footer` prop and dialog.mdx). The public `Dialog`\n// component below is the sole sanctioned entry point; it's built on these\n// parts internally. (In Figma the matching component set is named\n// \"DialogDefault\"; the code-facing name stays `Dialog` — see dialog.figma.tsx.)\n\n// Figma's \"DialogWelcome\" frame (variant=carousel, node 6353:6164) wraps its\n// popup preview in a `p-[48px]` ancestor — the minimum margin the popup must\n// keep from the viewport edge on any screen size. `max-w`/`max-h` (not\n// padding, since the popup itself is centered via `fixed` + transform)\n// enforce it here so every consumer keeps that margin, not just the frame\n// that surfaced it.\nconst dialogContentVariants = cva(\n 'fixed left-1/2 top-1/2 z-50 flex max-h-[calc(100dvh-96px)] w-full min-w-[var(--ui-dialog-container-width-min)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-[var(--ui-dialog-container-border-radius)] bg-[var(--ui-dialog-container-color)] text-foreground shadow-lg duration-200 transition-[scale] after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:bg-[color-mix(in_oklab,var(--ui-background-backdrop-screen)_36%,transparent)] dark:after:bg-[color-mix(in_oklab,var(--ui-background-backdrop-screen)_80%,transparent)] after:opacity-0 after:transition-opacity after:duration-200 after:content-[\"\"] data-[open]:animate-in data-[open]:fade-in-0 data-[open]:zoom-in-95 data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:zoom-out-95 data-[nested-dialog-open]:scale-[0.96] data-[nested-dialog-open]:after:opacity-100 dark:data-[nested]:border dark:data-[nested]:border-[var(--ui-dialog-header-border-color)]',\n {\n variants: {\n size: {\n sm: 'max-w-[min(var(--ui-dialog-container-size-sm),calc(100dvw-96px))]',\n large: 'max-w-[min(832px,calc(100dvw-96px))]',\n },\n },\n defaultVariants: {\n size: 'sm',\n },\n }\n);\n\nconst DialogRoot = DialogPrimitive.Root;\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Backdrop>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Backdrop>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Backdrop\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 bg-[var(--ui-background-backdrop-screen)] duration-200 data-[open]:animate-in data-[open]:fade-in-0 data-[closed]:animate-out data-[closed]:fade-out-0',\n className\n )}\n {...props}\n />\n));\nDialogOverlay.displayName = 'DialogOverlay';\n\nexport interface DialogContentProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Popup>,\n VariantProps<typeof dialogContentVariants> {\n /**\n * Popup max-width. `sm` (512px, default) is the Figma-defined size; `large`\n * (832px) is a backward-compatibility size with no design token (see the\n * `Large` story).\n */\n size?: VariantProps<typeof dialogContentVariants>['size'];\n /**\n * Render the content inside a portal (default `true`). Base UI requires the\n * Popup to sit in a Portal for correct stacking; set `false` for inline usage\n * (e.g. when the caller supplies its own `DialogPortal`, or in tests).\n */\n portal?: boolean;\n /**\n * Portal container. Pass a shadow-root mount for isolated-style previews\n * (the docs demos do this via `useShadowMount`).\n */\n portalContainer?: DialogPrimitive.Portal.Props['container'];\n /** Keep the content mounted while closed (Base UI `Portal` prop). */\n keepMounted?: DialogPrimitive.Portal.Props['keepMounted'];\n}\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Popup>,\n DialogContentProps\n>(\n (\n {\n className,\n children,\n size,\n portal = true,\n portalContainer,\n keepMounted,\n ...props\n },\n ref\n ) => {\n const ctxContainer = usePortalContainer();\n const resolvedContainer = portalContainer ?? ctxContainer;\n\n const popup = (\n <>\n <DialogOverlay />\n <DialogPrimitive.Popup\n ref={ref}\n className={cn(dialogContentVariants({ size }), className)}\n {...props}\n >\n {children}\n </DialogPrimitive.Popup>\n </>\n );\n\n return portal ? (\n <DialogPrimitive.Portal container={resolvedContainer} keepMounted={keepMounted}>\n {popup}\n </DialogPrimitive.Portal>\n ) : (\n popup\n );\n }\n);\nDialogContent.displayName = 'DialogContent';\n\nconst DialogHeaderRoot = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n 'flex h-16 items-center gap-4 border-b border-border bg-background px-5 py-4',\n className\n )}\n {...props}\n />\n));\nDialogHeaderRoot.displayName = 'DialogHeaderRoot';\n\nconst DialogFooterRoot = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n 'flex h-16 items-center justify-end gap-4 border-t border-border bg-background px-6 py-4',\n className\n )}\n {...props}\n />\n));\nDialogFooterRoot.displayName = 'DialogFooterRoot';\n\nconst DialogBodyRoot = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div ref={ref} className={cn('flex-1 overflow-auto p-6', className)} {...props} />\n));\nDialogBodyRoot.displayName = 'DialogBodyRoot';\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\n 'flex-1 text-2xl font-normal leading-8 text-foreground',\n className\n )}\n {...props}\n />\n));\nDialogTitle.displayName = 'DialogTitle';\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn('text-sm text-muted-foreground', className)}\n {...props}\n />\n));\nDialogDescription.displayName = 'DialogDescription';\n\nexport interface DialogCloseButtonProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close> {\n /** Accessible name for screen readers. Defaults to `'Close'`. */\n closeLabel?: string;\n}\n\nconst DialogCloseButton = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Close>,\n DialogCloseButtonProps\n>(({ className, closeLabel = 'Close', ...props }, ref) => (\n <DialogPrimitive.Close\n ref={ref}\n render={<ButtonIcon variant=\"ghost\" />}\n className={className}\n {...props}\n >\n <TimesIcon />\n <span className=\"sr-only\">{closeLabel}</span>\n </DialogPrimitive.Close>\n));\nDialogCloseButton.displayName = 'DialogCloseButton';\n\n// The recipe-specific header: title + close button, reconciled against the\n// Figma \"DialogHeader\" node (4220:3516) via the `--ui-dialog-header-*` tier.\n// Local to this file (not exported) — distinct from the generic, unstyled\n// `DialogHeaderRoot` composable primitive above.\ninterface DialogHeaderProps {\n title: string;\n closeLabel?: string;\n}\n\nfunction DialogHeader({ title, closeLabel }: DialogHeaderProps) {\n return (\n <div className=\"flex h-[var(--ui-dialog-header-height)] shrink-0 items-center gap-[var(--ui-dialog-header-gap)] border-b-[length:var(--ui-dialog-header-border-width)] border-[var(--ui-dialog-header-border-color)] bg-[var(--ui-dialog-header-color)] px-[var(--ui-dialog-header-padding-x)]\">\n <DialogTitle>{title}</DialogTitle>\n <DialogCloseButton closeLabel={closeLabel} />\n </div>\n );\n}\n\n// The recipe-specific body: the variant's canned copy (or the `children`\n// override), reconciled against the Figma DialogDefault node via the\n// `--ui-dialog-body-*` tier. Local to this file — distinct from the generic\n// `DialogBodyRoot` composable primitive above.\ninterface DialogBodyProps {\n children: React.ReactNode;\n /** Makes the body unfocusable/unclickable while the loading overlay is shown. */\n inert?: boolean;\n}\n\nfunction DialogBody({ children, inert }: DialogBodyProps) {\n return (\n <div\n inert={inert}\n className=\"flex min-h-[var(--ui-dialog-body-height-min)] flex-col justify-center-safe gap-[var(--ui-dialog-body-gap)] overflow-y-auto px-4 py-[var(--ui-dialog-body-padding-y)]\"\n >\n {typeof children === 'string' ? (\n <p className=\"text-sm leading-6 text-foreground\">{children}</p>\n ) : (\n children\n )}\n </div>\n );\n}\n\n// The recipe-specific footer actions: a secondary (dismiss) button plus a\n// primary action, the latter either closing the dialog itself (`read-only`'s\n// \"Done\") or firing `onPrimaryAction` and leaving the close to the caller.\n// Local to this file — distinct from the generic `DialogFooterRoot`.\ninterface DialogFooterActionsProps {\n secondaryLabel?: string;\n primaryLabel: string;\n primaryVariant: 'default' | 'destructive';\n primaryCloses?: boolean;\n onPrimaryAction?: () => void;\n}\n\nfunction DialogFooterActions({\n secondaryLabel,\n primaryLabel,\n primaryVariant,\n primaryCloses,\n onPrimaryAction,\n}: DialogFooterActionsProps) {\n return (\n <>\n {secondaryLabel && (\n <DialogClose render={<Button variant=\"secondary\">{secondaryLabel}</Button>} />\n )}\n {primaryCloses ? (\n <DialogClose\n onClick={onPrimaryAction}\n render={<Button variant={primaryVariant}>{primaryLabel}</Button>}\n />\n ) : (\n <Button variant={primaryVariant} onClick={onPrimaryAction}>\n {primaryLabel}\n </Button>\n )}\n </>\n );\n}\n\n// A higher-level \"recipe\" built on top of the Dialog primitive parts above\n// (DialogRoot + DialogContent give the portal, backdrop, focus trap, scroll\n// lock and open state; DialogTitle wires the accessible name; DialogCloseButton\n// / DialogClose give the dismiss controls). It bakes in the seven Figma\n// \"DialogDefault\" use-cases (node 6343:58898) plus one legacy `wide` escape\n// hatch kept for backward compatibility: each `variant` picks a canned title,\n// body copy and footer buttons; `children` overrides only the body slot;\n// `title` overrides only the title; `footer` overrides only the footer's\n// action content (the free-form escape hatch `wide` relies on); `hasLoading`\n// drops a spinner overlay over the body + footer. `hasHeader`/`hasFooter`\n// (both default `true`) hide the header/footer chrome entirely — a\n// ui-react-only extension beyond the Figma DialogDefault contract, which\n// always shows both; the title stays rendered off-screen when the header is\n// hidden so the dialog keeps an accessible name.\n//\n// Colors resolve to shipped semantic tokens via the bridged Tailwind names the\n// Dialog family already uses (text-foreground, the backdrop + focus tokens\n// inside DialogContent / DialogCloseButton) and the Button / InputText token\n// tiers — nothing is hand-authored. The loading scrim renders `Loading`'s\n// `onSurfaceSecondary` variant (`--ui-loading-element-container-color-secondary`),\n// matching the design's translucent surface fill.\n//\n// Header + footer geometry/color resolve to the `--ui-dialog-header-*` /\n// `--ui-footer-*` tiers, reconciled against the DialogDefault Figma node.\n\nexport type DialogVariant =\n | 'default'\n | 'rename'\n | 'save changes'\n | 'reset password'\n | 'discard changes'\n | 'accept'\n | 'read-only'\n | 'wide';\n\ninterface DialogVariantContent {\n /**\n * The variant's canned title. A function receives `objectName` (falls back\n * to its own placeholder default when omitted) for variants whose title\n * embeds the acted-on object's name.\n */\n title: string | ((objectName?: string) => string);\n /**\n * Same `objectName` interpolation as `title`, for body copy/fields that\n * embed it. The `rename` variant's field also receives `objectNameLabel`\n * for its accessible name.\n */\n body:\n | React.ReactNode\n | ((objectName?: string, objectNameLabel?: string) => React.ReactNode);\n /** Secondary (dismiss) button label. Omitted when the variant has none. */\n secondaryLabel?: string;\n primaryLabel: string;\n primaryVariant: 'default' | 'destructive';\n /** Whether the primary button dismisses the dialog (e.g. read-only \"Done\"). */\n primaryCloses?: boolean;\n}\n\nconst DIALOG_VARIANT_CONTENT: Record<DialogVariant, DialogVariantContent> = {\n default: {\n title: 'Dialog title',\n body: 'Drop any content into this slot.',\n secondaryLabel: 'Cancel',\n primaryLabel: 'Label',\n primaryVariant: 'default',\n },\n rename: {\n title: (objectName = 'object name') => `Rename ${objectName}`,\n // `objectName` prefills the field with the real current name; the field's\n // accessible name (`objectNameLabel`) is separate — it's the label, not the value.\n body: (objectName = 'Current name', objectNameLabel = 'Object name') => (\n <InputText aria-label={objectNameLabel} defaultValue={objectName} />\n ),\n secondaryLabel: 'Cancel',\n primaryLabel: 'Rename',\n primaryVariant: 'default',\n },\n 'save changes': {\n title: 'Save changes',\n body: 'You have unsaved changes. Do you want to save them before leaving?',\n secondaryLabel: 'Go back',\n primaryLabel: 'Save',\n primaryVariant: 'default',\n },\n 'reset password': {\n title: 'Reset password',\n body: 'Further instructions will be sent to your email address.',\n secondaryLabel: 'Cancel',\n primaryLabel: 'Reset',\n primaryVariant: 'default',\n },\n 'discard changes': {\n title: 'Discard changes',\n body: (objectName = 'Object name') => (\n <p className=\"text-sm leading-6 text-foreground\">\n Are you sure you want to discard the unsaved changes to{' '}\n <strong className=\"font-semibold\">{objectName}</strong>?\n </p>\n ),\n secondaryLabel: 'Go back',\n primaryLabel: 'Confirm',\n primaryVariant: 'destructive',\n },\n accept: {\n title: (objectName = 'object name') => `Accept ${objectName}`,\n body: 'Click Accept to confirm that you have read, understood, and agree to the terms and conditions below.',\n secondaryLabel: 'Cancel',\n primaryLabel: 'Accept',\n primaryVariant: 'default',\n },\n 'read-only': {\n title: 'License agreement',\n body: 'This is a read-only dialog used to view legal documents such as the License Agreement, EULA updates, Terms of Service, and other legal documents.',\n primaryLabel: 'Done',\n primaryVariant: 'default',\n primaryCloses: true,\n },\n // No Figma preset — a legacy, free-form escape hatch (see the `footer` prop\n // and the `Large` story). This fallback title/body/footer only renders if\n // the caller supplies neither `footer` nor `title`/`children` — every real\n // `wide` call site overrides them.\n wide: {\n title: 'Dialog title',\n body: 'Drop any content into this slot.',\n secondaryLabel: 'Cancel',\n primaryLabel: 'Confirm',\n primaryVariant: 'default',\n },\n};\n\ntype DialogRootProps = React.ComponentPropsWithoutRef<typeof DialogRoot>;\n\nexport interface DialogProps extends Omit<DialogRootProps, 'children'> {\n /**\n * Selects the canned title / body / footer preset. Defaults to `'default'`.\n * `'wide'` is a legacy escape hatch (no canned preset) kept for backward\n * compatibility — pair it with `size=\"large\"` and the `footer` prop.\n */\n variant?: DialogVariant;\n /**\n * Show a spinner overlay across the body + footer, and make both `inert`\n * (unfocusable, unclickable, hidden from assistive tech) so a keyboard user\n * can't activate the visually obscured footer buttons while busy.\n */\n hasLoading?: boolean;\n /**\n * Overrides the loading overlay's accessible label. Defaults to `Loading`'s\n * own default (`'Data is loading…'`). Ignored when `hasLoading` is `false`.\n */\n loadingLabel?: string;\n /**\n * Show the header (title + close button). Defaults to `true`. When `false`,\n * the title is still rendered off-screen so the dialog keeps an accessible\n * name — only the visible bar and close button are omitted. Beyond the\n * strict Figma contract (all seven `DialogDefault` variants always show the\n * header); a ui-react-only extension, like `wide`/`size=\"large\"`.\n */\n hasHeader?: boolean;\n /**\n * Show the footer (action buttons). Defaults to `true`. Beyond the strict\n * Figma contract (all seven `DialogDefault` variants always show the\n * footer); a ui-react-only extension, like `wide`/`size=\"large\"`. When\n * `false`, `footer` (and the canned footer it would otherwise replace) is\n * not rendered either.\n */\n hasFooter?: boolean;\n /** Overrides the variant's default body content. */\n children?: React.ReactNode;\n /** Overrides the variant's default title. */\n title?: string;\n /**\n * The real name of the object being acted on (e.g. a file or resource\n * name). Interpolated into the `rename`/`discard changes`/`accept`\n * variants' canned title/body in place of the generic placeholder text;\n * ignored by variants that don't reference an object name.\n */\n objectName?: string;\n /**\n * Overrides the accessible name of the `rename` variant's text field\n * (default `'Object name'`). Ignored by every other variant.\n */\n objectNameLabel?: string;\n /**\n * Overrides the variant's default secondary (dismiss) button label. Passing\n * this for a variant with no secondary button by default (e.g. `read-only`)\n * also makes the button appear. Ignored when `footer` is provided.\n */\n secondaryLabel?: string;\n /** Overrides the variant's default primary button label. Ignored when `footer` is provided. */\n primaryLabel?: string;\n /**\n * Fires when the primary footer button is clicked. The dialog does not\n * close automatically afterwards — pair this with `open`/`onOpenChange` to\n * close it once the action completes. Ignored when `footer` is provided\n * (wire behavior onto your own buttons there instead).\n */\n onPrimaryAction?: () => void;\n /**\n * Replaces the footer's action content entirely with free-form buttons —\n * the escape hatch the `wide` variant is meant to be paired with, for\n * legacy call sites that don't fit one of the seven canned presets. Ignored\n * (along with the canned footer) when `hasFooter` is `false`.\n */\n footer?: React.ReactNode;\n /** Overrides the close button's accessible name. Defaults to `'Close'`. */\n closeLabel?: string;\n /**\n * Popup max-width (forwarded to `DialogContent`). Defaults to `'sm'`, or to\n * `'large'` when `variant` is `'wide'`.\n */\n size?: DialogContentProps['size'];\n /** Render inside a portal (forwarded to `DialogContent`). Defaults to `true`. */\n portal?: boolean;\n /** Portal container (forwarded to `DialogContent`). */\n portalContainer?: DialogContentProps['portalContainer'];\n /** Keep the content mounted while closed (forwarded to `DialogContent`). */\n keepMounted?: DialogContentProps['keepMounted'];\n /** Extra classes merged onto the popup container. */\n className?: string;\n}\n\nconst Dialog = React.forwardRef<HTMLDivElement, DialogProps>(\n (\n {\n variant = 'default',\n hasLoading = false,\n loadingLabel,\n hasHeader = true,\n hasFooter = true,\n children,\n title,\n objectName,\n objectNameLabel,\n secondaryLabel,\n primaryLabel,\n onPrimaryAction,\n footer,\n closeLabel,\n size,\n portal,\n portalContainer,\n keepMounted,\n className,\n ...rootProps\n },\n ref\n ) => {\n const content = DIALOG_VARIANT_CONTENT[variant];\n const resolvedTitle =\n typeof content.title === 'function' ? content.title(objectName) : content.title;\n const resolvedBody =\n typeof content.body === 'function'\n ? content.body(objectName, objectNameLabel)\n : content.body;\n const bodyContent = children ?? resolvedBody;\n const titleText = title ?? resolvedTitle;\n const secondaryLabelText = secondaryLabel ?? content.secondaryLabel;\n const primaryLabelText = primaryLabel ?? content.primaryLabel;\n const resolvedSize = size ?? (variant === 'wide' ? 'large' : 'sm');\n\n return (\n <DialogRoot {...rootProps}>\n <DialogContent\n ref={ref}\n size={resolvedSize}\n portal={portal}\n portalContainer={portalContainer}\n keepMounted={keepMounted}\n className={className}\n aria-busy={hasLoading || undefined}\n >\n {hasHeader ? (\n <DialogHeader title={titleText} closeLabel={closeLabel} />\n ) : (\n // Header hidden, but the dialog still needs an accessible name.\n <DialogTitle className=\"sr-only\">{titleText}</DialogTitle>\n )}\n\n <DialogBody inert={hasLoading}>{bodyContent}</DialogBody>\n\n {hasFooter && (\n <DialogFooterDefault inert={hasLoading}>\n {footer ?? (\n <DialogFooterActions\n secondaryLabel={secondaryLabelText}\n primaryLabel={primaryLabelText}\n primaryVariant={content.primaryVariant}\n primaryCloses={content.primaryCloses}\n onPrimaryAction={onPrimaryAction}\n />\n )}\n </DialogFooterDefault>\n )}\n\n {hasLoading && (\n <Loading\n variant=\"onSurfaceSecondary\"\n hasLabel={false}\n label={loadingLabel}\n className={cn(\n 'absolute inset-x-0 bottom-0 rounded-none',\n hasHeader ? 'top-[var(--ui-dialog-header-height)]' : 'top-0'\n )}\n />\n )}\n </DialogContent>\n </DialogRoot>\n );\n }\n);\nDialog.displayName = 'Dialog';\n\nexport {\n DialogRoot,\n DialogPortal,\n DialogOverlay,\n DialogClose,\n DialogCloseButton,\n DialogTrigger,\n DialogContent,\n DialogHeaderRoot,\n DialogFooterRoot,\n DialogTitle,\n DialogBodyRoot,\n DialogDescription,\n dialogContentVariants,\n Dialog,\n};\n"],"mappings":";;;;;;;;;;;;;AA+EA,IAAM,IAAwB,EAC5B,48BACA;CACE,UAAU,EACR,MAAM;EACJ,IAAI;EACJ,OAAO;CACT,EACF;CACA,iBAAiB,EACf,MAAM,KACR;AACF,CACF,GAEM,IAAa,EAAgB;AAEb,EAAgB,SAEjB,EAAgB;AAErC,IAAM,IAAc,EAAgB,OAE9B,IAAgB,EAAM,YAGzB,EAAE,cAAW,GAAG,KAAS,MAC1B,kBAAC,EAAgB,UAAjB;CACO;CACL,WAAW,EACT,6KACA,CACF;CACA,GAAI;AACL,CAAA,CACF;AACD,EAAc,cAAc;AA0B5B,IAAM,IAAgB,EAAM,YAKxB,EACE,cACA,aACA,SACA,YAAS,IACT,oBACA,gBACA,GAAG,KAEL,MACG;CACH,IAAM,IAAe,EAAmB,GAClC,IAAoB,KAAmB,GAEvC,IACJ,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD,CAAgB,CAAA,GAChB,kBAAC,EAAgB,OAAjB;EACO;EACL,WAAW,EAAG,EAAsB,EAAE,QAAK,CAAC,GAAG,CAAS;EACxD,GAAI;EAEH;CACoB,CAAA,CACvB,EAAA,CAAA;CAGJ,OAAO,IACL,kBAAC,EAAgB,QAAjB;EAAwB,WAAW;EAAgC;EAChE,UAAA;CACqB,CA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B,cAAc;MACd,gBAAgB,EAAQ;MACxB,eAAe,EAAQ;MACN;KAClB,CAAA;IAEgB,CAAA;IAGtB,KACC,kBAAC,GAAD;KACE,SAAQ;KACR,UAAU;KACV,OAAO;KACP,WAAW,EACT,4CACA,IAAY,yCAAyC,OACvD;IACD,CAAA;GAEU;;CACL,CAAA;AAEhB,CACF;AACA,EAAO,cAAc"}
@@ -329,6 +329,32 @@ Scenario: The loading overlay adapts to a hidden header
329
329
  below a (non-existent) header
330
330
  ```
331
331
 
332
+ ### Nested dialogs
333
+
334
+ ```gherkin
335
+ Scenario: A dialog opened from another dialog's content recedes the parent
336
+ Given an open Dialog whose content contains a second Dialog's trigger
337
+ When the user opens the nested dialog
338
+ Then the nested dialog renders without its own backdrop (Base UI
339
+ suppresses it for nested dialogs by design — no double-darkening)
340
+ And the parent popup is marked data-nested-dialog-open and visually
341
+ recedes: it scales down slightly and takes a dim scrim derived from the
342
+ backdrop token (36% in light, 80% in dark), so the two popups read as
343
+ stacked, not merged
344
+ And in dark theme the nested popup (data-nested) gains the Dialog
345
+ tier's hairline border as its edge stroke — the dark container sits at
346
+ the black floor next to the backdrop token, so separation there comes
347
+ from a defined edge, not from dimming or repainting
348
+ ```
349
+
350
+ ```gherkin
351
+ Scenario: The parent recovers when the nested dialog closes
352
+ Given an open Dialog with a nested dialog open on top of it
353
+ When the nested dialog closes
354
+ Then data-nested-dialog-open is cleared from the parent popup
355
+ And the parent returns to its normal scale with no scrim
356
+ ```
357
+
332
358
  ### Opening & closing
333
359
 
334
360
  ```gherkin
package/dist/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # Acronis UI Kit for React — LLM Reference
2
2
 
3
- > `@acronis-platform/ui-react` v5.5.4
3
+ > `@acronis-platform/ui-react` v5.5.6
4
4
 
5
5
  Machine-readable component reference compiled from framework-agnostic specs.
6
6
  Each entry links to a self-contained markdown file with props, behavior,