@stackone/malachite 2.109.0 → 2.111.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/COMPONENTS.md CHANGED
@@ -122,7 +122,7 @@ The catalog of components exported from `@stackone/malachite`. **Reach for one o
122
122
  - **`TimeBarChart`** — Counts per time bucket as stacked bars on a UTC axis, the request-volume chart above a log list. Every bucket in `range` takes a slot whether or not it has data, so gaps read as gaps; a zone-less time string is read as UTC. Hover or arrow-key through buckets for a tooltip listing every series and the total; `highlightTime` shades the bucket holding a time from elsewhere on the page, such as the hovered log row. With `onRangeSelect`, dragging across bars reports the whole buckets covered, `end` exclusive so it goes straight back in as `range`, and whether the selection takes in the last bucket. `loading` dims bars already drawn rather than replacing them, and shows a spinner only when there is nothing to dim. Series colours follow the theme’s status tokens by `tone`, and failures always stack above successes whatever order `series` comes in, so position separates them where colour alone might not; a legend names them unless `legend={false}`. A visually hidden table carries the same numbers for screen readers. _Key props:_ `series` (`{ key, label, tone }[]`, stacked by tone with `error` on top; `TimeBarChartTone`: `success` | `error` | `neutral`), `buckets` (`{ start, values }[]`), `interval` (`{ unit, step }`; `TimeBarChartUnit`: `minute` | `hour` | `day` | `week` | `month`), `range` (`end` exclusive, as a selection reports it; at most 2,000 buckets, the newest kept), `TimeBarChartSize` (`small` | `medium` | `large`), `loading`, `error`, `errorTitle`, `errorSubTitle`, `valueLabel`, `legend`, `highlightTime`, `onRangeSelect`, `aria-label`, `aria-labelledby`, `className`, `style`.
123
123
  - **`TimeBarChartSwatch`** — The mark a `TimeBarChart` draws a series in, by its `tone`, for naming the series somewhere other than the chart's legend, such as a count beside the chart standing in for it. It matches the legend and the tooltip, and the bars draw the same colour at 40%; it follows the theme with them. Decorative: the label beside it does the naming. _Key props:_ `tone` (`TimeBarChartTone`).
124
124
  - **`Timeline`** — A vertical sequence of steps as an ordered list (`Timeline.Item`): a dot on a connecting line, a title, its timing at the right and a free-form body below, such as what happened to one API call. `titleCode` sets code after the title in the mono face as one phrase with it, such as `n8n called` then `Salesforce | Delete contact`. The dot is painted by `tone` from the theme’s text tokens (`neutral` is secondary text, the rest their status colours), or replaced by a decorative `marker` such as the caller’s logo. `icon` keeps the ring and draws a 12-14px glyph inside it in place of the dot, painted by `tone`, such as the call’s source type (MCP, API key, webhook); `skipped` beats `marker`, which beats `icon`. `stopped` puts an error badge (`stoppedLabel`, default "Stopped here") after the title of the step a flow ended on and paints its dot `error` unless a `tone` is set; the line ends at the last item. `meta` puts facts about a step in one wrapping row under its title, such as `calls` 2 and `status` 200, each label secondary and its value in the mono face, 18px apart, as a `dl`. `skipped` marks a step that never ran with a grey chevron in place of the dot; the title has to say so. For steps a person works through (complete, open, locked) use `StepList`. _Key props:_ `aria-label`, `aria-labelledby`; on `Timeline.Item`: `title`, `titleCode`, `time`, `tone` (`TimelineTone`: `neutral` | `info` | `success` | `warning` | `error`), `marker` (fills the 24px circle in place of the ringed dot), `icon` (a glyph inside the ring, painted by `tone`), `skipped`, `stopped`, `stoppedLabel`, `meta` (`TimelineMetaEntry[]`: `label`, `value`).
125
- - **`Table`** — Data table with columns, sizing, pagination and row selection. `column.align` places a column's header as well as its cells. What lands on the aligned edge is the last thing in the header row rather than the title: the sort caret on a sortable column, the info icon on one carrying `info` without a sorter. `headerVariant` picks the header layout, and only `inline` lines header and body up exactly, because both are cells of one `<table>`. `detached` builds them from flex rows, where a sortable header cell is 32px narrower than a non-sortable one — its padding sits on the inner button rather than on the flex item — so its header cells sit 15–17px off their column at any alignment; reach for `inline` where exact alignment matters. Sorting is internal, so the array passed as `data` is not the order rendered once a column is sorted: `onVisibleOrderChange` reports the rows in render order — the whole of `data`, compared by `rowKey` so an equal order never re-fires — for a consumer stepping a master-detail view the way the user sees it. On the detached header, `title`, `subtitle` and `extra` add a title row on the frame above the column headers, the row a `framed` `Card` draws, and it docks with them under `stickyHeaderTop` (with `showHeader={false}` nothing docks and it scrolls with the rows). The inline header has no frame, so it draws none of the three and warns in development. _Key props:_ `TableColumns` (incl. `align`), `TableSize`, `TableType`, `TableRowSelection`, `TablePaginationPosition` (`pagination.position`, in antd naming: a pager on each edge named, aligned as named, 16px from the rows; bottom right by default), `headerVariant`, `title`, `subtitle`, `extra`, `onVisibleOrderChange`, `scrollHeight` (a height, or `"fill"` for the room left in its scroller once the content above and below it fits, so the page itself never scrolls).
125
+ - **`Table`** — Data table with columns, sizing, pagination and row selection. `column.align` places a column's header as well as its cells. What lands on the aligned edge is the last thing in the header row rather than the title: the sort caret on a sortable column, the info icon on one carrying `info` without a sorter. `headerVariant` picks the header layout, and only `inline` lines header and body up exactly, because both are cells of one `<table>`. `detached` builds them from flex rows, where a sortable header cell is 32px narrower than a non-sortable one — its padding sits on the inner button rather than on the flex item — so its header cells sit 15–17px off their column at any alignment; reach for `inline` where exact alignment matters. Sorting is internal, so the array passed as `data` is not the order rendered once a column is sorted: `onVisibleOrderChange` reports the rows in render order — the whole of `data`, compared by `rowKey` so an equal order never re-fires — for a consumer stepping a master-detail view the way the user sees it. On the detached header, `title`, `subtitle` and `extra` add a title row on the frame above the column headers, the row a `framed` `Card` draws, and it docks with them under `stickyHeaderTop` (with `showHeader={false}` nothing docks and it scrolls with the rows). The inline header has no frame, so it draws none of the three and warns in development. _Key props:_ `TableColumns` (incl. `align`), `TableSize`, `TableType`, `TableRowSelection`, `TablePaginationPosition` (`pagination.position`, in antd naming: a pager on each edge named, aligned as named, 16px from the rows; bottom right by default), `rowDensity` (`default`; `compact`, about 30px rows; `snug`, 38px rows with 12px side padding and a tighter header), `headerVariant`, `title`, `subtitle`, `extra`, `onVisibleOrderChange`, `scrollHeight` (a height, or `"fill"` for the room left in its scroller once the content above and below it fits, so the page itself never scrolls).
126
126
  - **`Statistic`** — Displays a statistic value with a label; primary/secondary sizes. _Key props:_ `StatisticValueSize`.
127
127
  - **`Avatar`** — Logo/initial avatar. Renders the image when available, otherwise a coloured tile with the first letter of `name`, or with `fallback="placeholder"` the generic "no logo available" tile. Encapsulates the fallback colour. _Key props:_ `src`, `name`, `size`, `shape="square" | "circle"`, `fallback="initial" | "placeholder"`.
128
128
  - **`ZoomableImage`** — An image shown inline as a button that enlarges it, for a screenshot too detailed to read at its inline size. The thumbnail is shown at its own width up to the width of its container, never stretched, and stops at 240px tall, cropping a tall image to its top. The enlarged image sits on the scrim with no card, as large as the window allows at its own aspect ratio, up to its natural size, and a click anywhere or ESC closes it. The thumbnail is named `Enlarge image: <alt>` and the dialog is named by `title`, or by `alt` when `title` is missing or empty, so `alt` must be non-empty. `onError` reports a thumbnail that failed to load, so the caller can leave it out rather than show a broken image. The thumbnail loads lazily, so for one below the fold that report comes once it nears the viewport, not on render. _Key props:_ `src`, `alt`, `title`, `onError`.
@@ -1,32 +1,32 @@
1
1
  import { jsxs as p, jsx as o } from "react/jsx-runtime";
2
- import { useState as $, useId as d, Children as ee } from "react";
2
+ import { useState as $, useId as d, Children as oe } from "react";
3
3
  import { Button as z } from "./Button.js";
4
- import oe from "./CalloutStrip.js";
5
- import te from "./CustomIcons/CheckCircleFilled.js";
6
- import ie from "./CustomIcons/CheckmarkIcon.js";
7
- import le from "./CustomIcons/CopyIcon.js";
8
- import re from "./CustomIcons/ErrorCircleFilled.js";
9
- import se from "./CustomIcons/InfoCircleFilled.js";
10
- import ae from "./CustomIcons/WarningCircleFilled.js";
11
- import { FieldMessage as ne } from "./FieldMessage.js";
12
- import { IconBadge as ce } from "./IconBadge.js";
13
- import { Modal as de } from "./Modal.js";
4
+ import te from "./CalloutStrip.js";
5
+ import ie from "./CustomIcons/CheckCircleFilled.js";
6
+ import le from "./CustomIcons/CheckmarkIcon.js";
7
+ import re from "./CustomIcons/CopyIcon.js";
8
+ import se from "./CustomIcons/ErrorCircleFilled.js";
9
+ import ae from "./CustomIcons/InfoCircleFilled.js";
10
+ import ne from "./CustomIcons/WarningCircleFilled.js";
11
+ import { FieldMessage as ce } from "./FieldMessage.js";
12
+ import { IconBadge as de } from "./IconBadge.js";
13
+ import { Modal as pe } from "./Modal.js";
14
14
  import { Typography as G } from "./Typography/index.js";
15
- import { useClipboardCopy as pe } from "./useClipboardCopy.js";
16
- import { CONFIRMATION_DIALOG_VARIANTS as me } from "./confirmationDialogVariants.js";
17
- import fe from "./Input/Input.js";
18
- const h = 12, I = (e) => e.replace(/\s+/g, " "), ue = (e, t) => {
15
+ import { useClipboardCopy as me } from "./useClipboardCopy.js";
16
+ import { CONFIRMATION_DIALOG_VARIANTS as fe } from "./confirmationDialogVariants.js";
17
+ import ue from "./Input/Input.js";
18
+ const h = 12, I = (e) => e.replace(/\s+/g, " "), ye = (e, t) => {
19
19
  if (!(t === "" || e === "" || e === t) && I(e).toLowerCase() === I(t).toLowerCase())
20
20
  return I(e) === I(t) ? "The spacing has to match exactly." : "This is case-sensitive.";
21
- }, ye = "Could not copy. Enter the phrase manually.", xe = (e, t) => {
21
+ }, xe = "Could not copy. Enter the phrase manually.", Ce = (e, t) => {
22
22
  const l = typeof e == "object" && e !== null ? e : void 0;
23
23
  return l ? { parts: l, text: [l.prefix, t, l.suffix].filter(Boolean).join(" ") } : { text: typeof e == "string" ? e : `Type ${t} to confirm` };
24
- }, Ce = (e, t) => e === "copied" ? `${t} copied to clipboard` : "", be = (e, t, l, c) => {
25
- const { outcome: m, canCopy: f, copy: a } = pe(`${t}|${e}`), s = async () => {
24
+ }, be = (e, t) => e === "copied" ? `${t} copied to clipboard` : "", ve = (e, t, l, c) => {
25
+ const { outcome: m, canCopy: f, copy: a } = me(`${t}|${e}`), s = async () => {
26
26
  e && await a(e) && queueMicrotask(() => c == null ? void 0 : c(e));
27
27
  };
28
28
  return { outcome: m, canCopy: f && !l, copy: () => void s() };
29
- }, T = ({ children: e }) => /* @__PURE__ */ o(G.Text, { size: "small", color: "primary", children: e }), ve = ({
29
+ }, T = ({ children: e }) => /* @__PURE__ */ o(G.Text, { size: "small", color: "primary", children: e }), he = ({
30
30
  phrase: e,
31
31
  parts: t,
32
32
  plainLabel: l,
@@ -40,7 +40,7 @@ const h = 12, I = (e) => e.replace(/\s+/g, " "), ue = (e, t) => {
40
40
  onCopy: g,
41
41
  nearMissMessage: x
42
42
  }) => {
43
- const u = d(), C = d(), b = d(), v = d(), r = [x, n === "failed" ? ye : void 0].filter(Boolean).join(" ") || void 0, B = t ? [u, t.suffix ? C : void 0].filter(Boolean).join(" ") : void 0;
43
+ const u = d(), C = d(), b = d(), v = d(), r = [x, n === "failed" ? xe : void 0].filter(Boolean).join(" ") || void 0, B = t ? [u, t.suffix ? C : void 0].filter(Boolean).join(" ") : void 0;
44
44
  return /* @__PURE__ */ p("div", { className: "flex flex-col gap-[6px]", children: [
45
45
  t ? /* @__PURE__ */ p("div", { className: "flex flex-wrap items-center gap-[6px] px-2 text-[13px]", children: [
46
46
  /* @__PURE__ */ p("span", { id: u, children: [
@@ -55,7 +55,7 @@ const h = 12, I = (e) => e.replace(/\s+/g, " "), ue = (e, t) => {
55
55
  size: "small",
56
56
  iconOnly: !0,
57
57
  "aria-label": `${s} ${e}`,
58
- icon: n === "copied" ? /* @__PURE__ */ o(ie, { size: 13 }) : /* @__PURE__ */ o(le, { size: 13 }),
58
+ icon: n === "copied" ? /* @__PURE__ */ o(le, { size: 13 }) : /* @__PURE__ */ o(re, { size: 13 }),
59
59
  onClick: g,
60
60
  disabled: !i
61
61
  }
@@ -63,7 +63,7 @@ const h = 12, I = (e) => e.replace(/\s+/g, " "), ue = (e, t) => {
63
63
  t.suffix ? /* @__PURE__ */ o("span", { id: C, children: /* @__PURE__ */ o(T, { children: t.suffix }) }) : null
64
64
  ] }) : /* @__PURE__ */ o("label", { id: u, htmlFor: v, className: "px-2 text-[13px]", children: /* @__PURE__ */ o(T, { children: l }) }),
65
65
  /* @__PURE__ */ o(
66
- fe,
66
+ ue,
67
67
  {
68
68
  id: v,
69
69
  name: "confirmation-phrase",
@@ -78,15 +78,15 @@ const h = 12, I = (e) => e.replace(/\s+/g, " "), ue = (e, t) => {
78
78
  disabled: a
79
79
  }
80
80
  ),
81
- /* @__PURE__ */ o(ne, { id: b, message: r }),
82
- t ? /* @__PURE__ */ o("span", { role: "status", className: "sr-only", children: Ce(n, e) }) : null
81
+ /* @__PURE__ */ o(ce, { id: b, message: r }),
82
+ t ? /* @__PURE__ */ o("span", { role: "status", className: "sr-only", children: be(n, e) }) : null
83
83
  ] });
84
- }, he = {
85
- default: /* @__PURE__ */ o(se, { size: h }),
86
- warning: /* @__PURE__ */ o(ae, { size: h }),
87
- destructive: /* @__PURE__ */ o(re, { size: h }),
88
- success: /* @__PURE__ */ o(te, { size: h })
89
- }, Me = ({
84
+ }, Ie = {
85
+ default: /* @__PURE__ */ o(ae, { size: h }),
86
+ warning: /* @__PURE__ */ o(ne, { size: h }),
87
+ destructive: /* @__PURE__ */ o(se, { size: h }),
88
+ success: /* @__PURE__ */ o(ie, { size: h })
89
+ }, $e = ({
90
90
  open: e,
91
91
  onClose: t,
92
92
  onConfirm: l,
@@ -107,22 +107,23 @@ const h = 12, I = (e) => e.replace(/\s+/g, " "), ue = (e, t) => {
107
107
  confirmDisabled: B = !1,
108
108
  tip: R,
109
109
  size: V = "medium",
110
- "aria-label": q,
111
- "aria-labelledby": Y,
110
+ stacking: q,
111
+ "aria-label": Y,
112
+ "aria-labelledby": H,
112
113
  children: L
113
114
  }) => {
114
- const [A, S] = $(""), k = d(), w = d(), F = me[s], [j, H] = $({ open: e, confirmPhrase: i });
115
- (j.open !== e || j.confirmPhrase !== i) && (H({ open: e, confirmPhrase: i }), e && S(""));
116
- const { parts: W, text: E } = xe(
115
+ const [A, S] = $(""), k = d(), w = d(), F = fe[s], [j, W] = $({ open: e, confirmPhrase: i });
116
+ (j.open !== e || j.confirmPhrase !== i) && (W({ open: e, confirmPhrase: i }), e && S(""));
117
+ const { parts: Z, text: E } = Ce(
117
118
  g,
118
119
  i
119
120
  ), {
120
- outcome: Z,
121
- canCopy: J,
122
- copy: K
123
- } = be(i, e, r, u), O = A.trim(), N = (i == null ? void 0 : i.trim()) ?? "", _ = !i || (N === "" ? A === i : O === N), Q = ue(O, N), D = r || B || !_, U = ee.toArray(L).some(
121
+ outcome: J,
122
+ canCopy: K,
123
+ copy: Q
124
+ } = ve(i, e, r, u), O = A.trim(), N = (i == null ? void 0 : i.trim()) ?? "", _ = !i || (N === "" ? A === i : O === N), U = ye(O, N), D = r || B || !_, X = oe.toArray(L).some(
124
125
  (y) => typeof y != "string" || y.trim() !== ""
125
- ), M = !!a || U || !!i, X = [n ? w : null, a ? k : null].filter(Boolean).join(" ") || void 0, P = /* @__PURE__ */ p("div", { className: "flex w-full flex-wrap items-center justify-end gap-[8px]", children: [
126
+ ), M = !!a || X || !!i, P = [n ? w : null, a ? k : null].filter(Boolean).join(" ") || void 0, ee = /* @__PURE__ */ p("div", { className: "flex w-full flex-wrap items-center justify-end gap-[8px]", children: [
126
127
  /* @__PURE__ */ o(z, { variant: "outline", size: "small", onClick: t, disabled: r, children: v }),
127
128
  /* @__PURE__ */ o(
128
129
  z,
@@ -138,33 +139,34 @@ const h = 12, I = (e) => e.replace(/\s+/g, " "), ue = (e, t) => {
138
139
  )
139
140
  ] });
140
141
  return /* @__PURE__ */ p(
141
- de,
142
+ pe,
142
143
  {
143
144
  open: e,
144
145
  onClose: t,
145
146
  title: c,
146
147
  size: V,
147
- footer: P,
148
+ stacking: q,
149
+ footer: ee,
148
150
  busy: r,
149
151
  role: s === "destructive" ? "alertdialog" : "dialog",
150
- "aria-label": q,
151
- "aria-labelledby": Y,
152
- "aria-describedby": X,
152
+ "aria-label": Y,
153
+ "aria-labelledby": H,
154
+ "aria-describedby": P,
153
155
  closeOnOverlayClick: s !== "destructive" && !i,
154
156
  headerDivider: !0,
155
157
  titleAdornment: m,
156
158
  bodyPadding: !1,
157
159
  tray: { tone: F.tray, caption: R },
158
160
  icon: /* @__PURE__ */ o(
159
- ce,
161
+ de,
160
162
  {
161
163
  variant: s,
162
- icon: f ?? he[s]
164
+ icon: f ?? Ie[s]
163
165
  }
164
166
  ),
165
167
  children: [
166
168
  n ? /* @__PURE__ */ o(
167
- oe,
169
+ te,
168
170
  {
169
171
  id: w,
170
172
  type: n.type ?? F.calloutType,
@@ -192,20 +194,20 @@ const h = 12, I = (e) => e.replace(/\s+/g, " "), ue = (e, t) => {
192
194
  y.preventDefault(), y.stopPropagation(), D || l();
193
195
  },
194
196
  children: /* @__PURE__ */ o(
195
- ve,
197
+ he,
196
198
  {
197
199
  phrase: i,
198
- parts: W,
200
+ parts: Z,
199
201
  plainLabel: E,
200
202
  placeholder: C,
201
203
  value: A,
202
204
  onChange: S,
203
205
  disabled: r,
204
206
  copyLabel: x,
205
- copyOutcome: Z,
206
- canCopy: J,
207
- onCopy: K,
208
- nearMissMessage: Q
207
+ copyOutcome: J,
208
+ canCopy: K,
209
+ onCopy: Q,
210
+ nearMissMessage: U
209
211
  }
210
212
  )
211
213
  }
@@ -217,7 +219,7 @@ const h = 12, I = (e) => e.replace(/\s+/g, " "), ue = (e, t) => {
217
219
  );
218
220
  };
219
221
  export {
220
- Me as ConfirmationDialog,
221
- Me as default
222
+ $e as ConfirmationDialog,
223
+ $e as default
222
224
  };
223
225
  //# sourceMappingURL=ConfirmationDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmationDialog.js","sources":["../../src/components/ConfirmationDialog.tsx"],"sourcesContent":["import type React from 'react';\nimport { Children, useId, useState } from 'react';\nimport type { AlertType } from './Alert';\nimport Button from './Button';\nimport CalloutStrip from './CalloutStrip';\nimport CheckCircleFilled from './CustomIcons/CheckCircleFilled';\nimport CheckmarkIcon from './CustomIcons/CheckmarkIcon';\nimport CopyIcon from './CustomIcons/CopyIcon';\nimport ErrorCircleFilled from './CustomIcons/ErrorCircleFilled';\nimport InfoCircleFilled from './CustomIcons/InfoCircleFilled';\nimport WarningCircleFilled from './CustomIcons/WarningCircleFilled';\nimport FieldMessage from './FieldMessage';\nimport IconBadge from './IconBadge';\nimport { Input } from './Input';\nimport Modal, { type ModalSize } from './Modal';\nimport Typography from './Typography';\nimport { type CopyOutcome, useClipboardCopy } from './useClipboardCopy';\nimport {\n CONFIRMATION_DIALOG_VARIANTS,\n type ConfirmationDialogVariant,\n} from './confirmationDialogVariants';\n\n/** Kept beside the component: an icon is a node, not a value the variant table can hold. */\nconst BADGE_GLYPH_SIZE = 12;\n\nconst collapseSpaces = (value: string) => value.replace(/\\s+/g, ' ');\n\nconst nearMissAgainst = (typed: string, phrase: string): string | undefined => {\n if (phrase === '' || typed === '' || typed === phrase) {\n return undefined;\n }\n if (collapseSpaces(typed).toLowerCase() !== collapseSpaces(phrase).toLowerCase()) {\n return undefined;\n }\n return collapseSpaces(typed) === collapseSpaces(phrase)\n ? 'The spacing has to match exactly.'\n : 'This is case-sensitive.';\n};\n\ntype PhraseLabel = string | { prefix: string; suffix?: string };\n\nconst COPY_FAILED_MESSAGE = 'Could not copy. Enter the phrase manually.';\n\nconst resolvePhraseLabel = (\n label: PhraseLabel | undefined,\n phrase?: string,\n): { parts?: { prefix: string; suffix?: string }; text: string } => {\n const parts = typeof label === 'object' && label !== null ? label : undefined;\n if (parts) {\n return { parts, text: [parts.prefix, phrase, parts.suffix].filter(Boolean).join(' ') };\n }\n return { text: typeof label === 'string' ? label : `Type ${phrase} to confirm` };\n};\n\nconst copyStatusFor = (outcome: CopyOutcome, phrase: string): string =>\n outcome === 'copied' ? `${phrase} copied to clipboard` : '';\n\nconst usePhraseCopy = (\n phrase: string | undefined,\n open: boolean,\n disabled: boolean,\n onCopied?: (phrase: string) => void,\n): { outcome: CopyOutcome; canCopy: boolean; copy: () => void } => {\n const { outcome, canCopy, copy } = useClipboardCopy(`${open}|${phrase}`);\n\n const run = async () => {\n if (phrase && (await copy(phrase))) {\n queueMicrotask(() => onCopied?.(phrase));\n }\n };\n\n return { outcome, canCopy: canCopy && !disabled, copy: () => void run() };\n};\n\nconst LabelText: React.FC<{ children: React.ReactNode }> = ({ children }) => (\n <Typography.Text size=\"small\" color=\"primary\">\n {children}\n </Typography.Text>\n);\n\ninterface PhraseFieldProps {\n phrase: string;\n parts?: { prefix: string; suffix?: string };\n plainLabel: string;\n placeholder?: string;\n value: string;\n onChange: (value: string) => void;\n disabled: boolean;\n copyLabel: string;\n copyOutcome: CopyOutcome;\n canCopy: boolean;\n onCopy: () => void;\n nearMissMessage?: string;\n}\n\nconst PhraseField: React.FC<PhraseFieldProps> = ({\n phrase,\n parts,\n plainLabel,\n placeholder,\n value,\n onChange,\n disabled,\n copyLabel,\n copyOutcome,\n canCopy,\n onCopy,\n nearMissMessage,\n}) => {\n const beforeId = useId();\n const afterId = useId();\n const messageId = useId();\n const inputId = useId();\n const message =\n [nearMissMessage, copyOutcome === 'failed' ? COPY_FAILED_MESSAGE : undefined]\n .filter(Boolean)\n .join(' ') || undefined;\n const labelledBy = parts\n ? [beforeId, parts.suffix ? afterId : undefined].filter(Boolean).join(' ')\n : undefined;\n\n return (\n <div className=\"flex flex-col gap-[6px]\">\n {parts ? (\n <div className=\"flex flex-wrap items-center gap-[6px] px-2 text-[13px]\">\n <span id={beforeId}>\n <LabelText>{parts.prefix}</LabelText>{' '}\n <Typography.CodeText variant=\"inline\">\n {phrase}\n </Typography.CodeText>\n </span>\n <Button\n variant=\"ghost\"\n size=\"small\"\n iconOnly\n aria-label={`${copyLabel} ${phrase}`}\n icon={\n copyOutcome === 'copied' ? (\n <CheckmarkIcon size={13} />\n ) : (\n <CopyIcon size={13} />\n )\n }\n onClick={onCopy}\n disabled={!canCopy}\n />\n {parts.suffix ? (\n <span id={afterId}>\n <LabelText>{parts.suffix}</LabelText>\n </span>\n ) : null}\n </div>\n ) : (\n <label id={beforeId} htmlFor={inputId} className=\"px-2 text-[13px]\">\n <LabelText>{plainLabel}</LabelText>\n </label>\n )}\n <Input\n id={inputId}\n name=\"confirmation-phrase\"\n size=\"medium\"\n value={value}\n onChange={onChange}\n aria-labelledby={labelledBy}\n placeholder={placeholder}\n requiredIndicator=\"none\"\n error={!!nearMissMessage}\n aria-describedby={message ? messageId : undefined}\n disabled={disabled}\n />\n <FieldMessage id={messageId} message={message} />\n {parts ? (\n <span role=\"status\" className=\"sr-only\">\n {copyStatusFor(copyOutcome, phrase)}\n </span>\n ) : null}\n </div>\n );\n};\n\nconst VARIANT_ICON: Record<ConfirmationDialogVariant, React.ReactNode> = {\n default: <InfoCircleFilled size={BADGE_GLYPH_SIZE} />,\n warning: <WarningCircleFilled size={BADGE_GLYPH_SIZE} />,\n destructive: <ErrorCircleFilled size={BADGE_GLYPH_SIZE} />,\n success: <CheckCircleFilled size={BADGE_GLYPH_SIZE} />,\n};\n\nexport interface ConfirmationDialogProps {\n open: boolean;\n /** Dismiss handler — cancel, close button, ESC or scrim. `loading` suppresses every\n * route except ESC, which always reaches this so a keyboard user is never stranded. */\n onClose: () => void;\n /** Runs when the confirm action is taken. Closing is left to the consumer. */\n onConfirm: () => void;\n title: React.ReactNode;\n titleAdornment?: React.ReactNode;\n badgeIcon?: React.ReactNode;\n /** The sentence saying what is about to happen. */\n description?: React.ReactNode;\n variant?: ConfirmationDialogVariant;\n /** Coloured callout below the body. Defaults to the variant's own type. */\n callout?: { type?: AlertType; message: string };\n /**\n * Requires this phrase, ends trimmed, to be typed before the confirm action enables — for a\n * consequence severe enough that a single click should not be able to cause it.\n */\n confirmPhrase?: string;\n /** Label above the type-to-confirm field. `{ prefix, suffix }` makes the phrase copyable. */\n confirmPhraseLabel?: PhraseLabel;\n /** Names the copy control, e.g. `Copy profile name`. Default: `Copy`. */\n confirmPhraseCopyLabel?: string;\n /** Runs after the phrase reaches the clipboard, with what was copied. */\n onPhraseCopied?: (phrase: string) => void;\n confirmPhrasePlaceholder?: string;\n confirmLabel?: string;\n cancelLabel?: string;\n /**\n * Disables the actions, spins the confirm button and suppresses the pointer dismissal\n * routes — but never ESC, which always reaches `onClose`.\n */\n loading?: boolean;\n /**\n * Holds the confirm action back while the consequence is not yet known, say while a check\n * the callout reports on is still running. Cancel and every dismissal route stay live. The\n * held button has no tooltip, so pair it with a callout that says why.\n */\n confirmDisabled?: boolean;\n tip?: { label?: string; message: string };\n size?: ModalSize;\n /** Accessible dialog name; required when `title` isn't a plain string. */\n 'aria-label'?: string;\n /** ID of a visible element naming the dialog (alternative to `aria-label`). */\n 'aria-labelledby'?: string;\n /** Extra body content between the description and the callout, e.g. an entity chip. */\n children?: React.ReactNode;\n}\n\nconst ConfirmationDialog: React.FC<ConfirmationDialogProps> = ({\n open,\n onClose,\n onConfirm,\n title,\n titleAdornment,\n badgeIcon,\n description,\n variant = 'default',\n callout,\n confirmPhrase,\n confirmPhraseLabel,\n confirmPhraseCopyLabel = 'Copy',\n onPhraseCopied,\n confirmPhrasePlaceholder,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n loading = false,\n confirmDisabled = false,\n tip,\n size = 'medium',\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n children,\n}) => {\n const [typedPhrase, setTypedPhrase] = useState('');\n const descriptionId = useId();\n const calloutId = useId();\n const base = CONFIRMATION_DIALOG_VARIANTS[variant];\n\n // On open, not close: the dialog outlives `open` by its exit transition, so resetting on\n // close empties the field in front of the user. Adjusted during render rather than from an\n // effect, or a reopen paints the previous answer once with confirm already enabled.\n const [answeredFor, setAnsweredFor] = useState({ open, confirmPhrase });\n if (answeredFor.open !== open || answeredFor.confirmPhrase !== confirmPhrase) {\n setAnsweredFor({ open, confirmPhrase });\n if (open) {\n setTypedPhrase('');\n }\n }\n\n const { parts: phraseParts, text: phraseLabel } = resolvePhraseLabel(\n confirmPhraseLabel,\n confirmPhrase,\n );\n const {\n outcome: copyOutcome,\n canCopy: canCopyPhrase,\n copy: handleCopyPhrase,\n } = usePhraseCopy(confirmPhrase, open, loading, onPhraseCopied);\n // Both sides trimmed, as copied and saved names pick up padding that never renders. A\n // whitespace-only phrase is matched as given, so an empty field cannot confirm it.\n const typed = typedPhrase.trim();\n const phrase = confirmPhrase?.trim() ?? '';\n const phraseSatisfied =\n !confirmPhrase || (phrase === '' ? typedPhrase === confirmPhrase : typed === phrase);\n const nearMissMessage = nearMissAgainst(typed, phrase);\n const confirmBlocked = loading || confirmDisabled || !phraseSatisfied;\n const hasChildren = Children.toArray(children).some(\n (child) => typeof child !== 'string' || child.trim() !== '',\n );\n const hasBody = Boolean(description) || hasChildren || Boolean(confirmPhrase);\n // The callout is often the whole consequence, so it is announced along with the description.\n const describedBy =\n [callout ? calloutId : null, description ? descriptionId : null]\n .filter(Boolean)\n .join(' ') || undefined;\n\n const footer = (\n <div className=\"flex w-full flex-wrap items-center justify-end gap-[8px]\">\n <Button variant=\"outline\" size=\"small\" onClick={onClose} disabled={loading}>\n {cancelLabel}\n </Button>\n <Button\n variant={base.confirmVariant}\n size=\"small\"\n onClick={onConfirm}\n disabled={confirmBlocked}\n loading={loading}\n // A disabled control emits no hover, so the tooltip explains the gate from the\n // wrapper Button renders for exactly this case.\n tooltip={!loading && !phraseSatisfied ? phraseLabel : undefined}\n >\n {confirmLabel}\n </Button>\n </div>\n );\n\n return (\n <Modal\n open={open}\n onClose={onClose}\n title={title}\n size={size}\n footer={footer}\n busy={loading}\n // A consequential choice is an alertdialog: it asks assistive tech to announce the\n // body, which is where the consequence is written.\n role={variant === 'destructive' ? 'alertdialog' : 'dialog'}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={describedBy}\n // A choice this deliberate should not be undone by a stray click, and a scrim\n // click must not discard a phrase the customer has already typed.\n closeOnOverlayClick={variant !== 'destructive' && !confirmPhrase}\n headerDivider\n titleAdornment={titleAdornment}\n bodyPadding={false}\n tray={{ tone: base.tray, caption: tip }}\n icon={\n <IconBadge\n variant={variant}\n icon={badgeIcon ?? VARIANT_ICON[variant]}\n />\n }\n >\n {callout ? (\n <CalloutStrip\n id={calloutId}\n type={callout.type ?? base.calloutType}\n message={callout.message}\n divider={hasBody}\n />\n ) : null}\n {hasBody ? (\n <div className=\"flex flex-col gap-[12px] p-[28px]\">\n {description ? (\n <div\n id={descriptionId}\n className=\"text-[13px] leading-[1.6] text-[var(--malachite-text-secondary)]\"\n >\n {description}\n </div>\n ) : null}\n {children}\n {confirmPhrase ? (\n // Enter in a lone field submits its form; gated like the confirm button,\n // and kept from a consumer's own form, which the portal would reach.\n <form\n onSubmit={(event) => {\n event.preventDefault();\n event.stopPropagation();\n if (!confirmBlocked) {\n onConfirm();\n }\n }}\n >\n <PhraseField\n phrase={confirmPhrase}\n parts={phraseParts}\n plainLabel={phraseLabel}\n placeholder={confirmPhrasePlaceholder}\n value={typedPhrase}\n onChange={setTypedPhrase}\n disabled={loading}\n copyLabel={confirmPhraseCopyLabel}\n copyOutcome={copyOutcome}\n canCopy={canCopyPhrase}\n onCopy={handleCopyPhrase}\n nearMissMessage={nearMissMessage}\n />\n </form>\n ) : null}\n </div>\n ) : null}\n </Modal>\n );\n};\n\nexport default ConfirmationDialog;\nexport { ConfirmationDialog };\nexport type { ConfirmationDialogVariant };\n"],"names":["BADGE_GLYPH_SIZE","collapseSpaces","value","nearMissAgainst","typed","phrase","COPY_FAILED_MESSAGE","resolvePhraseLabel","label","parts","copyStatusFor","outcome","usePhraseCopy","open","disabled","onCopied","canCopy","copy","useClipboardCopy","run","LabelText","children","jsx","Typography","PhraseField","plainLabel","placeholder","onChange","copyLabel","copyOutcome","onCopy","nearMissMessage","beforeId","useId","afterId","messageId","inputId","message","labelledBy","jsxs","Button","CheckmarkIcon","CopyIcon","Input","FieldMessage","VARIANT_ICON","InfoCircleFilled","WarningCircleFilled","ErrorCircleFilled","CheckCircleFilled","ConfirmationDialog","onClose","onConfirm","title","titleAdornment","badgeIcon","description","variant","callout","confirmPhrase","confirmPhraseLabel","confirmPhraseCopyLabel","onPhraseCopied","confirmPhrasePlaceholder","confirmLabel","cancelLabel","loading","confirmDisabled","tip","size","ariaLabel","ariaLabelledBy","typedPhrase","setTypedPhrase","useState","descriptionId","calloutId","base","CONFIRMATION_DIALOG_VARIANTS","answeredFor","setAnsweredFor","phraseParts","phraseLabel","canCopyPhrase","handleCopyPhrase","phraseSatisfied","confirmBlocked","hasChildren","Children","child","hasBody","describedBy","footer","Modal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A,YACJ,MAAMlB,EAAQ,QAAQmB,EAAK;AAAA,YAC3B,SAASnB,EAAQ;AAAA,YACjB,SAASgC;AAAA,UAAA;AAAA,QAAA,IAEb;AAAA,QACHA,IACG,gBAAAnD,EAAC,OAAA,EAAI,WAAU,qCACV,UAAA;AAAA,UAAAiB,IACG,gBAAAlC;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,IAAIqD;AAAA,cACJ,WAAU;AAAA,cAET,UAAAnB;AAAA,YAAA;AAAA,UAAA,IAEL;AAAA,UACHnC;AAAA,UACAsC;AAAA;AAAA;AAAA,YAGG,gBAAArC;AAAA,cAAC;AAAA,cAAA;AAAA,gBACG,UAAU,CAAC0E,MAAU;AACjB,kBAAAA,EAAM,eAAA,GACNA,EAAM,gBAAA,GACDV,KACDlC,EAAA;AAAA,gBAER;AAAA,gBAEA,UAAA,gBAAA9B;AAAA,kBAACE;AAAA,kBAAA;AAAA,oBACG,QAAQmC;AAAA,oBACR,OAAOsB;AAAA,oBACP,YAAYC;AAAA,oBACZ,aAAanB;AAAA,oBACb,OAAOS;AAAA,oBACP,UAAUC;AAAA,oBACV,UAAUP;AAAA,oBACV,WAAWL;AAAA,oBACX,aAAAhC;AAAA,oBACA,SAASsD;AAAA,oBACT,QAAQC;AAAA,oBACR,iBAAArD;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACJ;AAAA,YAAA;AAAA,cAEJ;AAAA,QAAA,EAAA,CACR,IACA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGhB;"}
1
+ {"version":3,"file":"ConfirmationDialog.js","sources":["../../src/components/ConfirmationDialog.tsx"],"sourcesContent":["import type React from 'react';\nimport { Children, useId, useState } from 'react';\nimport type { AlertType } from './Alert';\nimport Button from './Button';\nimport CalloutStrip from './CalloutStrip';\nimport CheckCircleFilled from './CustomIcons/CheckCircleFilled';\nimport CheckmarkIcon from './CustomIcons/CheckmarkIcon';\nimport CopyIcon from './CustomIcons/CopyIcon';\nimport ErrorCircleFilled from './CustomIcons/ErrorCircleFilled';\nimport InfoCircleFilled from './CustomIcons/InfoCircleFilled';\nimport WarningCircleFilled from './CustomIcons/WarningCircleFilled';\nimport FieldMessage from './FieldMessage';\nimport IconBadge from './IconBadge';\nimport { Input } from './Input';\nimport Modal, { type ModalSize } from './Modal';\nimport type { OverlayStacking } from './portalOverlay';\nimport Typography from './Typography';\nimport { type CopyOutcome, useClipboardCopy } from './useClipboardCopy';\nimport {\n CONFIRMATION_DIALOG_VARIANTS,\n type ConfirmationDialogVariant,\n} from './confirmationDialogVariants';\n\n/** Kept beside the component: an icon is a node, not a value the variant table can hold. */\nconst BADGE_GLYPH_SIZE = 12;\n\nconst collapseSpaces = (value: string) => value.replace(/\\s+/g, ' ');\n\nconst nearMissAgainst = (typed: string, phrase: string): string | undefined => {\n if (phrase === '' || typed === '' || typed === phrase) {\n return undefined;\n }\n if (collapseSpaces(typed).toLowerCase() !== collapseSpaces(phrase).toLowerCase()) {\n return undefined;\n }\n return collapseSpaces(typed) === collapseSpaces(phrase)\n ? 'The spacing has to match exactly.'\n : 'This is case-sensitive.';\n};\n\ntype PhraseLabel = string | { prefix: string; suffix?: string };\n\nconst COPY_FAILED_MESSAGE = 'Could not copy. Enter the phrase manually.';\n\nconst resolvePhraseLabel = (\n label: PhraseLabel | undefined,\n phrase?: string,\n): { parts?: { prefix: string; suffix?: string }; text: string } => {\n const parts = typeof label === 'object' && label !== null ? label : undefined;\n if (parts) {\n return { parts, text: [parts.prefix, phrase, parts.suffix].filter(Boolean).join(' ') };\n }\n return { text: typeof label === 'string' ? label : `Type ${phrase} to confirm` };\n};\n\nconst copyStatusFor = (outcome: CopyOutcome, phrase: string): string =>\n outcome === 'copied' ? `${phrase} copied to clipboard` : '';\n\nconst usePhraseCopy = (\n phrase: string | undefined,\n open: boolean,\n disabled: boolean,\n onCopied?: (phrase: string) => void,\n): { outcome: CopyOutcome; canCopy: boolean; copy: () => void } => {\n const { outcome, canCopy, copy } = useClipboardCopy(`${open}|${phrase}`);\n\n const run = async () => {\n if (phrase && (await copy(phrase))) {\n queueMicrotask(() => onCopied?.(phrase));\n }\n };\n\n return { outcome, canCopy: canCopy && !disabled, copy: () => void run() };\n};\n\nconst LabelText: React.FC<{ children: React.ReactNode }> = ({ children }) => (\n <Typography.Text size=\"small\" color=\"primary\">\n {children}\n </Typography.Text>\n);\n\ninterface PhraseFieldProps {\n phrase: string;\n parts?: { prefix: string; suffix?: string };\n plainLabel: string;\n placeholder?: string;\n value: string;\n onChange: (value: string) => void;\n disabled: boolean;\n copyLabel: string;\n copyOutcome: CopyOutcome;\n canCopy: boolean;\n onCopy: () => void;\n nearMissMessage?: string;\n}\n\nconst PhraseField: React.FC<PhraseFieldProps> = ({\n phrase,\n parts,\n plainLabel,\n placeholder,\n value,\n onChange,\n disabled,\n copyLabel,\n copyOutcome,\n canCopy,\n onCopy,\n nearMissMessage,\n}) => {\n const beforeId = useId();\n const afterId = useId();\n const messageId = useId();\n const inputId = useId();\n const message =\n [nearMissMessage, copyOutcome === 'failed' ? COPY_FAILED_MESSAGE : undefined]\n .filter(Boolean)\n .join(' ') || undefined;\n const labelledBy = parts\n ? [beforeId, parts.suffix ? afterId : undefined].filter(Boolean).join(' ')\n : undefined;\n\n return (\n <div className=\"flex flex-col gap-[6px]\">\n {parts ? (\n <div className=\"flex flex-wrap items-center gap-[6px] px-2 text-[13px]\">\n <span id={beforeId}>\n <LabelText>{parts.prefix}</LabelText>{' '}\n <Typography.CodeText variant=\"inline\">\n {phrase}\n </Typography.CodeText>\n </span>\n <Button\n variant=\"ghost\"\n size=\"small\"\n iconOnly\n aria-label={`${copyLabel} ${phrase}`}\n icon={\n copyOutcome === 'copied' ? (\n <CheckmarkIcon size={13} />\n ) : (\n <CopyIcon size={13} />\n )\n }\n onClick={onCopy}\n disabled={!canCopy}\n />\n {parts.suffix ? (\n <span id={afterId}>\n <LabelText>{parts.suffix}</LabelText>\n </span>\n ) : null}\n </div>\n ) : (\n <label id={beforeId} htmlFor={inputId} className=\"px-2 text-[13px]\">\n <LabelText>{plainLabel}</LabelText>\n </label>\n )}\n <Input\n id={inputId}\n name=\"confirmation-phrase\"\n size=\"medium\"\n value={value}\n onChange={onChange}\n aria-labelledby={labelledBy}\n placeholder={placeholder}\n requiredIndicator=\"none\"\n error={!!nearMissMessage}\n aria-describedby={message ? messageId : undefined}\n disabled={disabled}\n />\n <FieldMessage id={messageId} message={message} />\n {parts ? (\n <span role=\"status\" className=\"sr-only\">\n {copyStatusFor(copyOutcome, phrase)}\n </span>\n ) : null}\n </div>\n );\n};\n\nconst VARIANT_ICON: Record<ConfirmationDialogVariant, React.ReactNode> = {\n default: <InfoCircleFilled size={BADGE_GLYPH_SIZE} />,\n warning: <WarningCircleFilled size={BADGE_GLYPH_SIZE} />,\n destructive: <ErrorCircleFilled size={BADGE_GLYPH_SIZE} />,\n success: <CheckCircleFilled size={BADGE_GLYPH_SIZE} />,\n};\n\nexport interface ConfirmationDialogProps {\n open: boolean;\n /** Dismiss handler — cancel, close button, ESC or scrim. `loading` suppresses every\n * route except ESC, which always reaches this so a keyboard user is never stranded. */\n onClose: () => void;\n /** Runs when the confirm action is taken. Closing is left to the consumer. */\n onConfirm: () => void;\n title: React.ReactNode;\n titleAdornment?: React.ReactNode;\n badgeIcon?: React.ReactNode;\n /** The sentence saying what is about to happen. */\n description?: React.ReactNode;\n variant?: ConfirmationDialogVariant;\n /** Coloured callout below the body. Defaults to the variant's own type. */\n callout?: { type?: AlertType; message: string };\n /**\n * Requires this phrase, ends trimmed, to be typed before the confirm action enables — for a\n * consequence severe enough that a single click should not be able to cause it.\n */\n confirmPhrase?: string;\n /** Label above the type-to-confirm field. `{ prefix, suffix }` makes the phrase copyable. */\n confirmPhraseLabel?: PhraseLabel;\n /** Names the copy control, e.g. `Copy profile name`. Default: `Copy`. */\n confirmPhraseCopyLabel?: string;\n /** Runs after the phrase reaches the clipboard, with what was copied. */\n onPhraseCopied?: (phrase: string) => void;\n confirmPhrasePlaceholder?: string;\n confirmLabel?: string;\n cancelLabel?: string;\n /**\n * Disables the actions, spins the confirm button and suppresses the pointer dismissal\n * routes — but never ESC, which always reaches `onClose`.\n */\n loading?: boolean;\n /**\n * Holds the confirm action back while the consequence is not yet known, say while a check\n * the callout reports on is still running. Cancel and every dismissal route stay live. The\n * held button has no tooltip, so pair it with a callout that says why.\n */\n confirmDisabled?: boolean;\n tip?: { label?: string; message: string };\n size?: ModalSize;\n /** See `Modal`'s `stacking`. */\n stacking?: OverlayStacking;\n /** Accessible dialog name; required when `title` isn't a plain string. */\n 'aria-label'?: string;\n /** ID of a visible element naming the dialog (alternative to `aria-label`). */\n 'aria-labelledby'?: string;\n /** Extra body content between the description and the callout, e.g. an entity chip. */\n children?: React.ReactNode;\n}\n\nconst ConfirmationDialog: React.FC<ConfirmationDialogProps> = ({\n open,\n onClose,\n onConfirm,\n title,\n titleAdornment,\n badgeIcon,\n description,\n variant = 'default',\n callout,\n confirmPhrase,\n confirmPhraseLabel,\n confirmPhraseCopyLabel = 'Copy',\n onPhraseCopied,\n confirmPhrasePlaceholder,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n loading = false,\n confirmDisabled = false,\n tip,\n size = 'medium',\n stacking,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n children,\n}) => {\n const [typedPhrase, setTypedPhrase] = useState('');\n const descriptionId = useId();\n const calloutId = useId();\n const base = CONFIRMATION_DIALOG_VARIANTS[variant];\n\n // On open, not close: the dialog outlives `open` by its exit transition, so resetting on\n // close empties the field in front of the user. Adjusted during render rather than from an\n // effect, or a reopen paints the previous answer once with confirm already enabled.\n const [answeredFor, setAnsweredFor] = useState({ open, confirmPhrase });\n if (answeredFor.open !== open || answeredFor.confirmPhrase !== confirmPhrase) {\n setAnsweredFor({ open, confirmPhrase });\n if (open) {\n setTypedPhrase('');\n }\n }\n\n const { parts: phraseParts, text: phraseLabel } = resolvePhraseLabel(\n confirmPhraseLabel,\n confirmPhrase,\n );\n const {\n outcome: copyOutcome,\n canCopy: canCopyPhrase,\n copy: handleCopyPhrase,\n } = usePhraseCopy(confirmPhrase, open, loading, onPhraseCopied);\n // Both sides trimmed, as copied and saved names pick up padding that never renders. A\n // whitespace-only phrase is matched as given, so an empty field cannot confirm it.\n const typed = typedPhrase.trim();\n const phrase = confirmPhrase?.trim() ?? '';\n const phraseSatisfied =\n !confirmPhrase || (phrase === '' ? typedPhrase === confirmPhrase : typed === phrase);\n const nearMissMessage = nearMissAgainst(typed, phrase);\n const confirmBlocked = loading || confirmDisabled || !phraseSatisfied;\n const hasChildren = Children.toArray(children).some(\n (child) => typeof child !== 'string' || child.trim() !== '',\n );\n const hasBody = Boolean(description) || hasChildren || Boolean(confirmPhrase);\n // The callout is often the whole consequence, so it is announced along with the description.\n const describedBy =\n [callout ? calloutId : null, description ? descriptionId : null]\n .filter(Boolean)\n .join(' ') || undefined;\n\n const footer = (\n <div className=\"flex w-full flex-wrap items-center justify-end gap-[8px]\">\n <Button variant=\"outline\" size=\"small\" onClick={onClose} disabled={loading}>\n {cancelLabel}\n </Button>\n <Button\n variant={base.confirmVariant}\n size=\"small\"\n onClick={onConfirm}\n disabled={confirmBlocked}\n loading={loading}\n // A disabled control emits no hover, so the tooltip explains the gate from the\n // wrapper Button renders for exactly this case.\n tooltip={!loading && !phraseSatisfied ? phraseLabel : undefined}\n >\n {confirmLabel}\n </Button>\n </div>\n );\n\n return (\n <Modal\n open={open}\n onClose={onClose}\n title={title}\n size={size}\n stacking={stacking}\n footer={footer}\n busy={loading}\n // A consequential choice is an alertdialog: it asks assistive tech to announce the\n // body, which is where the consequence is written.\n role={variant === 'destructive' ? 'alertdialog' : 'dialog'}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={describedBy}\n // A choice this deliberate should not be undone by a stray click, and a scrim\n // click must not discard a phrase the customer has already typed.\n closeOnOverlayClick={variant !== 'destructive' && !confirmPhrase}\n headerDivider\n titleAdornment={titleAdornment}\n bodyPadding={false}\n tray={{ tone: base.tray, caption: tip }}\n icon={\n <IconBadge\n variant={variant}\n icon={badgeIcon ?? VARIANT_ICON[variant]}\n />\n }\n >\n {callout ? (\n <CalloutStrip\n id={calloutId}\n type={callout.type ?? base.calloutType}\n message={callout.message}\n divider={hasBody}\n />\n ) : null}\n {hasBody ? (\n <div className=\"flex flex-col gap-[12px] p-[28px]\">\n {description ? (\n <div\n id={descriptionId}\n className=\"text-[13px] leading-[1.6] text-[var(--malachite-text-secondary)]\"\n >\n {description}\n </div>\n ) : null}\n {children}\n {confirmPhrase ? (\n // Enter in a lone field submits its form; gated like the confirm button,\n // and kept from a consumer's own form, which the portal would reach.\n <form\n onSubmit={(event) => {\n event.preventDefault();\n event.stopPropagation();\n if (!confirmBlocked) {\n onConfirm();\n }\n }}\n >\n <PhraseField\n phrase={confirmPhrase}\n parts={phraseParts}\n plainLabel={phraseLabel}\n placeholder={confirmPhrasePlaceholder}\n value={typedPhrase}\n onChange={setTypedPhrase}\n disabled={loading}\n copyLabel={confirmPhraseCopyLabel}\n copyOutcome={copyOutcome}\n canCopy={canCopyPhrase}\n onCopy={handleCopyPhrase}\n nearMissMessage={nearMissMessage}\n />\n </form>\n ) : null}\n </div>\n ) : null}\n </Modal>\n );\n};\n\nexport default ConfirmationDialog;\nexport { ConfirmationDialog };\nexport type { ConfirmationDialogVariant };\n"],"names":["BADGE_GLYPH_SIZE","collapseSpaces","value","nearMissAgainst","typed","phrase","COPY_FAILED_MESSAGE","resolvePhraseLabel","label","parts","copyStatusFor","outcome","usePhraseCopy","open","disabled","onCopied","canCopy","copy","useClipboardCopy","run","LabelText","children","jsx","Typography","PhraseField","plainLabel","placeholder","onChange","copyLabel","copyOutcome","onCopy","nearMissMessage","beforeId","useId","afterId","messageId","inputId","message","labelledBy","jsxs","Button","CheckmarkIcon","CopyIcon","Input","FieldMessage","VARIANT_ICON","InfoCircleFilled","WarningCircleFilled","ErrorCircleFilled","CheckCircleFilled","ConfirmationDialog","onClose","onConfirm","title","titleAdornment","badgeIcon","description","variant","callout","confirmPhrase","confirmPhraseLabel","confirmPhraseCopyLabel","onPhraseCopied","confirmPhrasePlaceholder","confirmLabel","cancelLabel","loading","confirmDisabled","tip","size","stacking","ariaLabel","ariaLabelledBy","typedPhrase","setTypedPhrase","useState","descriptionId","calloutId","base","CONFIRMATION_DIALOG_VARIANTS","answeredFor","setAnsweredFor","phraseParts","phraseLabel","canCopyPhrase","handleCopyPhrase","phraseSatisfied","confirmBlocked","hasChildren","Children","child","hasBody","describedBy","footer","Modal","IconBadge","CalloutStrip","event"],"mappings":";;;;;;;;;;;;;;;;;AAwBA,MAAMA,IAAmB,IAEnBC,IAAiB,CAACC,MAAkBA,EAAM,QAAQ,QAAQ,GAAG,GAE7DC,KAAkB,CAACC,GAAeC,MAAuC;AAC3E,MAAI,EAAAA,MAAW,MAAMD,MAAU,MAAMA,MAAUC,MAG3CJ,EAAeG,CAAK,EAAE,YAAA,MAAkBH,EAAeI,CAAM,EAAE;AAGnE,WAAOJ,EAAeG,CAAK,MAAMH,EAAeI,CAAM,IAChD,sCACA;AACV,GAIMC,KAAsB,8CAEtBC,KAAqB,CACvBC,GACAH,MACgE;AAChE,QAAMI,IAAQ,OAAOD,KAAU,YAAYA,MAAU,OAAOA,IAAQ;AACpE,SAAIC,IACO,EAAE,OAAAA,GAAO,MAAM,CAACA,EAAM,QAAQJ,GAAQI,EAAM,MAAM,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,EAAA,IAEhF,EAAE,MAAM,OAAOD,KAAU,WAAWA,IAAQ,QAAQH,CAAM,cAAA;AACrE,GAEMK,KAAgB,CAACC,GAAsBN,MACzCM,MAAY,WAAW,GAAGN,CAAM,yBAAyB,IAEvDO,KAAgB,CAClBP,GACAQ,GACAC,GACAC,MAC+D;AAC/D,QAAM,EAAE,SAAAJ,GAAS,SAAAK,GAAS,MAAAC,MAASC,GAAiB,GAAGL,CAAI,IAAIR,CAAM,EAAE,GAEjEc,IAAM,YAAY;AACpB,IAAId,KA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A,QAAA,EAAA,CACR,IACA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGhB;"}
@@ -1,15 +1,15 @@
1
1
  import { jsx as e, jsxs as l, Fragment as V } from "react/jsx-runtime";
2
2
  import { useId as F, useState as g, useRef as n, useEffect as U, useCallback as W } from "react";
3
- import { createPortal as ce } from "react-dom";
4
- import { ShadowRootWrapper as de } from "../ShadowRootWrapper.js";
5
- import me from "./CalloutStrip.js";
6
- import ue from "./CustomIcons/DismissIcon.js";
7
- import { getDeepActiveElement as pe } from "./activeElement.js";
8
- import { afterNextPaint as fe } from "./afterNextPaint.js";
9
- import { GLASS_SURFACE_STYLE as xe } from "./glassSurface.js";
10
- import { MODAL_TRAY_BACKGROUND as he, MODAL_TRAY_CAPTION_COLOR as ve } from "./modalTray.js";
11
- import { useOverlayBehaviour as be, OVERLAY_ICON_BUTTON_CLASSES as ge } from "./overlayBehaviour.js";
12
- import { OVERLAY_ELEVATED_ATTR as Ne, overlayIdentity as G } from "./portalOverlay.js";
3
+ import { createPortal as de } from "react-dom";
4
+ import { ShadowRootWrapper as me } from "../ShadowRootWrapper.js";
5
+ import ue from "./CalloutStrip.js";
6
+ import pe from "./CustomIcons/DismissIcon.js";
7
+ import { getDeepActiveElement as fe } from "./activeElement.js";
8
+ import { afterNextPaint as xe } from "./afterNextPaint.js";
9
+ import { GLASS_SURFACE_STYLE as he } from "./glassSurface.js";
10
+ import { MODAL_TRAY_BACKGROUND as ve, MODAL_TRAY_CAPTION_COLOR as be } from "./modalTray.js";
11
+ import { useOverlayBehaviour as ge, OVERLAY_ICON_BUTTON_CLASSES as Ne } from "./overlayBehaviour.js";
12
+ import { OVERLAY_ELEVATED_ATTR as we, overlayIdentity as G } from "./portalOverlay.js";
13
13
  const z = {
14
14
  small: "420px",
15
15
  medium: "612px",
@@ -17,7 +17,7 @@ const z = {
17
17
  // A wizard width: 864 of content, 872 with a tray ring. The widest fixed size.
18
18
  xlarge: "864px",
19
19
  fullscreen: "100%"
20
- }, N = 200, K = "flex-[0_1_auto] h-[min(600px,calc(100dvh-160px))]", Ee = ({
20
+ }, N = 200, K = "flex-[0_1_auto] h-[min(600px,calc(100dvh-160px))]", Le = ({
21
21
  open: s,
22
22
  onClose: c,
23
23
  title: u,
@@ -41,10 +41,11 @@ const z = {
41
41
  "aria-labelledby": $,
42
42
  "aria-describedby": re,
43
43
  busy: o = !1,
44
+ stacking: le = "default",
44
45
  children: x
45
46
  }) => {
46
47
  var j;
47
- const k = F(), S = F(), h = Z === "none", a = X, d = ((j = h ? void 0 : J) == null ? void 0 : j.filter((r) => r.message.trim())) ?? [], [v, O] = g(!1), [le, C] = g(!1), [te, E] = g(!1), L = n(null), m = n(null), t = n(null), D = n(o), M = n(c);
48
+ const k = F(), S = F(), h = Z === "none", a = X, d = ((j = h ? void 0 : J) == null ? void 0 : j.filter((r) => r.message.trim())) ?? [], [v, O] = g(!1), [te, C] = g(!1), [ie, E] = g(!1), L = n(null), m = n(null), t = n(null), D = n(o), M = n(c);
48
49
  U(() => {
49
50
  D.current = o, M.current = c;
50
51
  }, [o, c]);
@@ -52,14 +53,15 @@ const z = {
52
53
  D.current || M.current();
53
54
  }, []), P = n(null), {
54
55
  ref: Y,
55
- isTopmost: ie,
56
- zIndex: ne,
57
- elevated: oe
58
- } = be({
56
+ isTopmost: ne,
57
+ zIndex: oe,
58
+ elevated: se
59
+ } = ge({
59
60
  open: s,
60
61
  onClose: c,
62
+ elevated: le === "above-app-overlays",
61
63
  hostRef: P
62
- }), se = W(
64
+ }), ce = W(
63
65
  (r) => {
64
66
  L.current = r, Y(r);
65
67
  },
@@ -68,9 +70,9 @@ const z = {
68
70
  if (U(() => {
69
71
  var r;
70
72
  if (s)
71
- C(!0), E(!1), t.current && (clearTimeout(t.current), t.current = null), fe(m, () => O(!0));
73
+ C(!0), E(!1), t.current && (clearTimeout(t.current), t.current = null), xe(m, () => O(!0));
72
74
  else {
73
- const i = pe();
75
+ const i = fe();
74
76
  i && ((r = L.current) != null && r.contains(i)) && i.blur(), E(!0), O(!1), t.current = setTimeout(() => {
75
77
  t.current = null, C(!1);
76
78
  }, N);
@@ -78,18 +80,19 @@ const z = {
78
80
  return () => {
79
81
  m.current !== null && (cancelAnimationFrame(m.current), m.current = null), t.current && (clearTimeout(t.current), t.current = null);
80
82
  };
81
- }, [s]), !le)
83
+ }, [s]), !te)
82
84
  return null;
83
85
  let b = "relative flex max-h-full w-full flex-col overflow-hidden rounded-[20px] border border-solid border-[var(--malachite-card-border)] bg-[var(--malachite-card-background)] text-[var(--malachite-card-foreground)] outline-none [box-shadow:var(--malachite-shadow-glow,var(--malachite-shadow-lg))]";
84
- return a ? b = "relative flex max-h-full w-full flex-col gap-[4px] rounded-[20px] p-[4px] text-[var(--malachite-card-foreground)] outline-none [box-shadow:var(--malachite-shadow-glow,var(--malachite-shadow-lg))]" : h && (b = "relative flex max-h-full w-full flex-col outline-none"), ce(
86
+ return a ? b = "relative flex max-h-full w-full flex-col gap-[4px] rounded-[20px] p-[4px] text-[var(--malachite-card-foreground)] outline-none [box-shadow:var(--malachite-shadow-glow,var(--malachite-shadow-lg))]" : h && (b = "relative flex max-h-full w-full flex-col outline-none"), de(
85
87
  // Host carries the stacking context — ShadowRootWrapper's `isolation` would otherwise
86
- // flatten our z-index. Not promoted to the top layer, so host dialogs can cover us.
88
+ // flatten our z-index. Only an elevated stack is promoted to the top layer; otherwise
89
+ // host dialogs can cover us.
87
90
  /* @__PURE__ */ e(
88
- de,
91
+ me,
89
92
  {
90
93
  hostRef: P,
91
- hostStyle: { position: "relative", zIndex: ne },
92
- hostProps: oe ? { ...G("modal"), [Ne]: "" } : G("modal"),
94
+ hostStyle: { position: "relative", zIndex: oe },
95
+ hostProps: se ? { ...G("modal"), [we]: "" } : G("modal"),
93
96
  children: /* @__PURE__ */ l(
94
97
  "div",
95
98
  {
@@ -106,10 +109,10 @@ const z = {
106
109
  /* @__PURE__ */ l(
107
110
  "div",
108
111
  {
109
- ref: se,
112
+ ref: ce,
110
113
  role: ee,
111
- "aria-hidden": te ? "true" : void 0,
112
- "aria-modal": ie ? "true" : void 0,
114
+ "aria-hidden": ie ? "true" : void 0,
115
+ "aria-modal": ne ? "true" : void 0,
113
116
  "aria-describedby": [
114
117
  ...d.map((r, i) => `${S}-${i}`),
115
118
  re,
@@ -124,7 +127,7 @@ const z = {
124
127
  maxWidth: a ? `calc(${z[f]} + 8px)` : z[f],
125
128
  ...f === "fullscreen" ? { height: "100%" } : {},
126
129
  ...a ? {
127
- backgroundColor: he[a.tone ?? "neutral"]
130
+ backgroundColor: ve[a.tone ?? "neutral"]
128
131
  } : {},
129
132
  // Inline: Tailwind scale/translate utilities silently break inside
130
133
  // shadow roots (see CLAUDE.md Shadow DOM caveats).
@@ -180,8 +183,8 @@ const z = {
180
183
  "aria-label": "Close",
181
184
  onClick: B,
182
185
  disabled: o,
183
- className: ge,
184
- children: /* @__PURE__ */ e(ue, { size: 10 })
186
+ className: Ne,
187
+ children: /* @__PURE__ */ e(pe, { size: 10 })
185
188
  }
186
189
  ) : null
187
190
  ]
@@ -193,7 +196,7 @@ const z = {
193
196
  className: `min-h-0 ${I === "tall" ? K : "flex-1"} overflow-y-auto ${A && d.length === 0 ? "px-[20px]" : ""}`,
194
197
  children: [
195
198
  d.map((r, i) => /* @__PURE__ */ e(
196
- me,
199
+ ue,
197
200
  {
198
201
  id: `${S}-${i}`,
199
202
  type: r.type,
@@ -216,7 +219,7 @@ const z = {
216
219
  "div",
217
220
  {
218
221
  className: "flex min-h-[56px] shrink-0 items-center border-0 border-t border-solid border-[var(--malachite-card-border)] px-[12px]",
219
- style: xe,
222
+ style: he,
220
223
  children: T
221
224
  }
222
225
  ) : null
@@ -228,7 +231,7 @@ const z = {
228
231
  {
229
232
  id: k,
230
233
  className: "flex h-[48px] shrink-0 items-center justify-center px-[16px] text-[13px] tracking-[0.13px]",
231
- style: { color: ve[a.tone ?? "neutral"] },
234
+ style: { color: be[a.tone ?? "neutral"] },
232
235
  children: /* @__PURE__ */ l("span", { children: [
233
236
  a.caption.label ? /* @__PURE__ */ l(V, { children: [
234
237
  /* @__PURE__ */ e("span", { className: "font-medium", children: a.caption.label }),
@@ -250,7 +253,7 @@ const z = {
250
253
  );
251
254
  };
252
255
  export {
253
- Ee as Modal,
254
- Ee as default
256
+ Le as Modal,
257
+ Le as default
255
258
  };
256
259
  //# sourceMappingURL=Modal.js.map