@stackone/malachite 2.89.1 → 2.91.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,28 +1,28 @@
1
- import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
- import { useId as L, useState as M, useRef as v, useEffect as ae } from "react";
1
+ import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
+ import { useId as B, useState as W, useRef as v, useEffect as ne } from "react";
3
3
  import { createPortal as ie } from "react-dom";
4
- import { ShadowRootWrapper as te } from "../ShadowRootWrapper.js";
5
- import ne from "./CalloutStrip.js";
6
- import oe from "./CustomIcons/ArrowLeftIcon.js";
7
- import se from "./CustomIcons/DismissIcon.js";
4
+ import { ShadowRootWrapper as oe } from "../ShadowRootWrapper.js";
5
+ import se from "./CalloutStrip.js";
6
+ import ce from "./CustomIcons/ArrowLeftIcon.js";
7
+ import de from "./CustomIcons/DismissIcon.js";
8
8
  import N from "./Typography/EllipsisText.js";
9
- import { useOverlayBehaviour as ce, OVERLAY_ICON_BUTTON_CLASSES as W } from "./overlayBehaviour.js";
10
- import { OVERLAY_ELEVATED_ATTR as de, overlayIdentity as j } from "./portalOverlay.js";
11
- const x = 200, me = "360px", F = ({
12
- bodyPadding: a,
13
- callouts: i,
9
+ import { useOverlayBehaviour as me, OVERLAY_ICON_BUTTON_CLASSES as j } from "./overlayBehaviour.js";
10
+ import { OVERLAY_ELEVATED_ATTR as pe, overlayIdentity as F } from "./portalOverlay.js";
11
+ const x = 200, xe = "360px", H = ({
12
+ bodyPadding: r,
13
+ callouts: a,
14
14
  calloutId: n,
15
15
  renderLink: o,
16
16
  children: p
17
17
  }) => {
18
- const c = !!(i != null && i.length);
19
- return /* @__PURE__ */ r(
18
+ const c = !!(a != null && a.length);
19
+ return /* @__PURE__ */ l(
20
20
  "div",
21
21
  {
22
- className: `min-h-0 flex-1 overflow-y-auto ${a && !c ? "px-[28px]" : ""}`,
22
+ className: `min-h-0 flex-1 overflow-y-auto ${r && !c ? "px-[28px]" : ""}`,
23
23
  children: [
24
- i == null ? void 0 : i.map((s, d) => /* @__PURE__ */ e(
25
- ne,
24
+ a == null ? void 0 : a.map((s, d) => /* @__PURE__ */ e(
25
+ se,
26
26
  {
27
27
  id: n ? `${n}-${d}` : void 0,
28
28
  type: s.type,
@@ -31,13 +31,25 @@ const x = 200, me = "360px", F = ({
31
31
  },
32
32
  d
33
33
  )),
34
- a ? /* @__PURE__ */ e("div", { className: c ? "p-[28px]" : "py-[28px]", children: p }) : p
34
+ r ? /* @__PURE__ */ e("div", { className: c ? "p-[28px]" : "py-[28px]", children: p }) : p
35
35
  ]
36
36
  }
37
37
  );
38
- }, g = (a) => typeof a == "number" ? `${a}px` : a, ye = ({
39
- open: a,
40
- onClose: i,
38
+ }, g = (r) => typeof r == "number" ? `${r}px` : r, fe = (r) => {
39
+ r.key === "Enter" && r.target instanceof HTMLInputElement && r.preventDefault();
40
+ }, U = "col-start-2 row-span-3 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid", ue = ({ onSubmit: r, children: a }) => r ? /* @__PURE__ */ e(
41
+ "form",
42
+ {
43
+ noValidate: !0,
44
+ className: U,
45
+ onSubmit: (n) => {
46
+ n.preventDefault(), n.stopPropagation(), r(n);
47
+ },
48
+ children: a
49
+ }
50
+ ) : /* @__PURE__ */ e("div", { className: U, children: a }), Se = ({
51
+ open: r,
52
+ onClose: a,
41
53
  title: n,
42
54
  subtitle: o,
43
55
  subtitlePlacement: p = "inline",
@@ -48,43 +60,44 @@ const x = 200, me = "360px", F = ({
48
60
  icon: w,
49
61
  headerExtra: y,
50
62
  footer: f,
51
- onBack: $,
63
+ onSubmit: $,
64
+ onBack: T,
52
65
  maxWidth: u = 1080,
53
66
  "aria-label": Y,
54
- "aria-labelledby": T,
67
+ "aria-labelledby": I,
55
68
  bodyPadding: q = !0,
56
- stacking: H = "default",
69
+ stacking: K = "default",
57
70
  callouts: h,
58
- renderLink: U,
59
- aside: l,
60
- children: G
71
+ renderLink: G,
72
+ aside: t,
73
+ children: J
61
74
  }) => {
62
- const I = L(), S = L(), [k, C] = M(!1), [J, E] = M(!1), m = v(null), t = v(null), _ = v(null), {
63
- ref: K,
64
- isTopmost: Q,
65
- zIndex: Z,
66
- elevated: ee
67
- } = ce({
68
- open: a,
69
- onClose: i,
70
- elevated: H === "above-app-overlays",
71
- hostRef: _
75
+ const S = B(), E = B(), [C, k] = W(!1), [Q, _] = W(!1), m = v(null), i = v(null), A = v(null), {
76
+ ref: Z,
77
+ isTopmost: ee,
78
+ zIndex: re,
79
+ elevated: le
80
+ } = me({
81
+ open: r,
82
+ onClose: a,
83
+ elevated: K === "above-app-overlays",
84
+ hostRef: A
72
85
  });
73
- if (ae(() => (a ? (E(!0), t.current && (clearTimeout(t.current), t.current = null), m.current = requestAnimationFrame(() => {
74
- m.current = null, C(!0);
75
- })) : (C(!1), t.current = setTimeout(() => {
76
- t.current = null, E(!1);
86
+ if (ne(() => (r ? (_(!0), i.current && (clearTimeout(i.current), i.current = null), m.current = requestAnimationFrame(() => {
87
+ m.current = null, k(!0);
88
+ })) : (k(!1), i.current = setTimeout(() => {
89
+ i.current = null, _(!1);
77
90
  }, x)), () => {
78
- m.current !== null && (cancelAnimationFrame(m.current), m.current = null), t.current && (clearTimeout(t.current), t.current = null);
79
- }), [a]), !J)
91
+ m.current !== null && (cancelAnimationFrame(m.current), m.current = null), i.current && (clearTimeout(i.current), i.current = null);
92
+ }), [r]), !Q)
80
93
  return null;
81
- const A = h == null ? void 0 : h.filter((D) => D.message.trim()), b = `calc(${g(u)} - 2px)`, R = X ? "border-0 border-b border-solid border-[var(--malachite-card-border)]" : "", re = l ? /* @__PURE__ */ r(
94
+ const P = h == null ? void 0 : h.filter((V) => V.message.trim()), b = `calc(${g(u)} - 2px)`, R = X ? "border-0 border-b border-solid border-[var(--malachite-card-border)]" : "", ae = t ? /* @__PURE__ */ l(
82
95
  "aside",
83
96
  {
84
- "aria-label": l.title,
97
+ "aria-label": t.title,
85
98
  className: "col-start-1 row-span-3 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid overflow-hidden border-0 border-r border-solid border-[var(--malachite-card-border)]",
86
99
  children: [
87
- /* @__PURE__ */ r(
100
+ /* @__PURE__ */ l(
88
101
  "div",
89
102
  {
90
103
  className: `flex min-w-0 items-center gap-[8px] px-[20px] py-[18px] ${R}`,
@@ -92,25 +105,25 @@ const x = 200, me = "360px", F = ({
92
105
  /* @__PURE__ */ e("span", { className: "flex min-w-0 shrink-0", children: /* @__PURE__ */ e(
93
106
  N,
94
107
  {
95
- tooltip: l.title,
108
+ tooltip: t.title,
96
109
  tooltipWhenTruncated: !0,
97
110
  tooltipPlacement: "bottom",
98
111
  className: "min-w-0 text-[length:var(--malachite-font-size-15,15px)] font-semibold",
99
- children: l.title
112
+ children: t.title
100
113
  }
101
114
  ) }),
102
- l.headerExtra ? /* @__PURE__ */ e("span", { className: "ml-auto flex shrink-0 items-center", children: l.headerExtra }) : null
115
+ t.headerExtra ? /* @__PURE__ */ e("span", { className: "ml-auto flex shrink-0 items-center", children: t.headerExtra }) : null
103
116
  ]
104
117
  }
105
118
  ),
106
- /* @__PURE__ */ e("div", { className: `flex min-h-0 flex-col ${l.footer ? "" : "row-span-2"}`, children: /* @__PURE__ */ e(F, { bodyPadding: l.bodyPadding ?? !0, children: l.children }) }),
107
- l.footer ? /* @__PURE__ */ e("div", { className: "border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]", children: l.footer }) : null
119
+ /* @__PURE__ */ e("div", { className: `flex min-h-0 flex-col ${t.footer ? "" : "row-span-2"}`, children: /* @__PURE__ */ e(H, { bodyPadding: t.bodyPadding ?? !0, children: t.children }) }),
120
+ t.footer ? /* @__PURE__ */ e("div", { className: "border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]", children: t.footer }) : null
108
121
  ]
109
122
  }
110
- ) : null, P = p === "below" && !!o, z = /* @__PURE__ */ e(
123
+ ) : null, L = p === "below" && !!o, z = /* @__PURE__ */ e(
111
124
  "span",
112
125
  {
113
- className: P ? "flex min-w-0 shrink" : "flex min-w-0 max-w-full shrink-0",
126
+ className: L ? "flex min-w-0 shrink" : "flex min-w-0 max-w-full shrink-0",
114
127
  children: /* @__PURE__ */ e(
115
128
  N,
116
129
  {
@@ -122,7 +135,7 @@ const x = 200, me = "360px", F = ({
122
135
  }
123
136
  )
124
137
  }
125
- ), O = o ? /* @__PURE__ */ e(
138
+ ), D = o ? /* @__PURE__ */ e(
126
139
  N,
127
140
  {
128
141
  tooltip: o,
@@ -132,106 +145,106 @@ const x = 200, me = "360px", F = ({
132
145
  className: "min-w-0 text-[13px]",
133
146
  children: o
134
147
  }
135
- ) : null, B = c ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: c }) : null, V = y ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-baseline", children: y }) : null;
148
+ ) : null, O = c ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: c }) : null, M = y ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-baseline", children: y }) : null;
136
149
  return ie(
137
150
  // Host carries the stacking context — ShadowRootWrapper's `isolation` would
138
151
  // otherwise flatten our z-index and let sticky page elements paint over us.
139
152
  /* @__PURE__ */ e(
140
- te,
153
+ oe,
141
154
  {
142
- hostRef: _,
143
- hostStyle: { position: "relative", zIndex: Z },
144
- hostProps: ee ? { ...j("sidepanel"), [de]: "" } : j("sidepanel"),
145
- children: /* @__PURE__ */ r("div", { className: "fixed inset-0 z-[1000]", children: [
155
+ hostRef: A,
156
+ hostStyle: { position: "relative", zIndex: re },
157
+ hostProps: le ? { ...F("sidepanel"), [pe]: "" } : F("sidepanel"),
158
+ children: /* @__PURE__ */ l("div", { className: "fixed inset-0 z-[1000]", children: [
146
159
  /* @__PURE__ */ e(
147
160
  "div",
148
161
  {
149
162
  "aria-hidden": "true",
150
- onClick: i,
151
- className: `absolute inset-0 bg-[var(--malachite-overlay-scrim)] transition-opacity duration-200 ease-in-out ${k ? "opacity-100" : "opacity-0"}`
163
+ onClick: a,
164
+ className: `absolute inset-0 bg-[var(--malachite-overlay-scrim)] transition-opacity duration-200 ease-in-out ${C ? "opacity-100" : "opacity-0"}`
152
165
  }
153
166
  ),
154
- /* @__PURE__ */ r(
167
+ /* @__PURE__ */ l(
155
168
  "div",
156
169
  {
157
- ref: K,
170
+ ref: Z,
158
171
  role: "dialog",
159
- "aria-modal": Q ? "true" : void 0,
172
+ "aria-modal": ee ? "true" : void 0,
160
173
  "aria-describedby": [
161
- ...(A ?? []).map((D, le) => `${I}-${le}`),
162
- s ? S : null
174
+ ...(P ?? []).map((V, te) => `${S}-${te}`),
175
+ s ? E : null
163
176
  ].filter(Boolean).join(" ") || void 0,
164
177
  tabIndex: -1,
165
- "aria-label": T ? void 0 : Y ?? (typeof n == "string" ? n : void 0),
166
- "aria-labelledby": T,
178
+ "aria-label": I ? void 0 : Y ?? (typeof n == "string" ? n : void 0),
179
+ "aria-labelledby": I,
167
180
  className: "absolute top-[8px] right-[8px] bottom-[8px] grid grid-rows-[auto_minmax(0,1fr)_auto] overflow-x-auto overflow-y-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-lg)]",
168
181
  style: {
169
- width: `min(calc(100% - 16px), ${l ? `calc(2 * ${g(u)})` : g(u)})`,
182
+ width: `min(calc(100% - 16px), ${t ? `calc(2 * ${g(u)})` : g(u)})`,
170
183
  // Inline: Tailwind translate utilities silently break inside
171
184
  // shadow roots (see CLAUDE.md Shadow DOM caveats).
172
- transform: k ? "translateX(0)" : "translateX(calc(100% + 16px))",
185
+ transform: C ? "translateX(0)" : "translateX(calc(100% + 16px))",
173
186
  transition: `transform ${x}ms ease-in-out, width ${x}ms ease-in-out, grid-template-columns ${x}ms ease-in-out`,
174
187
  // The panel's own column is the width it has without an aside: `maxWidth`
175
188
  // less the 1px border either side, so opening the aside never widens it.
176
189
  // With an aside neither column gives way, so a narrow window scrolls the
177
190
  // panel instead. Both templates share one shape so the minimums animate
178
191
  // with the width rather than overflowing mid-transition.
179
- gridTemplateColumns: l ? `minmax(${me}, 1fr) minmax(${b}, ${b})` : `minmax(0px, 1fr) minmax(0px, ${b})`
192
+ gridTemplateColumns: t ? `minmax(${xe}, 1fr) minmax(${b}, ${b})` : `minmax(0px, 1fr) minmax(0px, ${b})`
180
193
  },
181
194
  children: [
182
- re,
183
- /* @__PURE__ */ r("div", { className: "col-start-2 row-span-3 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid", children: [
184
- /* @__PURE__ */ r(
195
+ ae,
196
+ /* @__PURE__ */ l(ue, { onSubmit: $, children: [
197
+ /* @__PURE__ */ l(
185
198
  "div",
186
199
  {
187
200
  className: `flex flex-col gap-[20px] px-[20px] py-[18px] ${R}`,
188
201
  children: [
189
- /* @__PURE__ */ r("div", { className: "flex items-center gap-[12px]", children: [
190
- $ ? /* @__PURE__ */ e(
202
+ /* @__PURE__ */ l("div", { className: "flex items-center gap-[12px]", children: [
203
+ T ? /* @__PURE__ */ e(
191
204
  "button",
192
205
  {
193
206
  type: "button",
194
207
  "aria-label": "Back",
195
- onClick: $,
196
- className: W,
197
- children: /* @__PURE__ */ e(oe, { size: 16 })
208
+ onClick: T,
209
+ className: j,
210
+ children: /* @__PURE__ */ e(ce, { size: 16 })
198
211
  }
199
212
  ) : null,
200
213
  w ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: w }) : null,
201
- P ? /* @__PURE__ */ r("div", { className: "flex min-w-0 flex-1 items-center gap-[12px]", children: [
202
- /* @__PURE__ */ r("div", { className: "flex min-w-0 flex-1 flex-col gap-[2px]", children: [
203
- /* @__PURE__ */ r("div", { className: "flex min-w-0 items-baseline gap-[8px]", children: [
214
+ L ? /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-center gap-[12px]", children: [
215
+ /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 flex-col gap-[2px]", children: [
216
+ /* @__PURE__ */ l("div", { className: "flex min-w-0 items-baseline gap-[8px]", children: [
204
217
  z,
205
- B
218
+ O
206
219
  ] }),
207
- O
220
+ D
208
221
  ] }),
209
- V
210
- ] }) : /* @__PURE__ */ r("div", { className: "flex min-w-0 flex-1 items-baseline gap-[12px]", children: [
211
- /* @__PURE__ */ r("div", { className: "flex min-w-0 flex-1 items-baseline gap-[8px]", children: [
212
- /* @__PURE__ */ r("div", { className: "flex min-w-0 items-baseline gap-[8px]", children: [
222
+ M
223
+ ] }) : /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-baseline gap-[12px]", children: [
224
+ /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-baseline gap-[8px]", children: [
225
+ /* @__PURE__ */ l("div", { className: "flex min-w-0 items-baseline gap-[8px]", children: [
213
226
  z,
214
- O
227
+ D
215
228
  ] }),
216
- B
229
+ O
217
230
  ] }),
218
- V
231
+ M
219
232
  ] }),
220
233
  /* @__PURE__ */ e(
221
234
  "button",
222
235
  {
223
236
  type: "button",
224
237
  "aria-label": "Close",
225
- onClick: i,
226
- className: W,
227
- children: /* @__PURE__ */ e(se, { size: 10 })
238
+ onClick: a,
239
+ className: j,
240
+ children: /* @__PURE__ */ e(de, { size: 10 })
228
241
  }
229
242
  )
230
243
  ] }),
231
244
  s ? /* @__PURE__ */ e(
232
245
  "div",
233
246
  {
234
- id: S,
247
+ id: E,
235
248
  className: "text-[13px] leading-[1.6] text-[var(--malachite-text-secondary)]",
236
249
  children: s
237
250
  }
@@ -239,16 +252,23 @@ const x = 200, me = "360px", F = ({
239
252
  ]
240
253
  }
241
254
  ),
242
- /* @__PURE__ */ r("div", { className: `flex min-h-0 flex-col ${f ? "" : "row-span-2"}`, children: [
243
- d ? /* @__PURE__ */ e("div", { className: "shrink-0 px-[16px] pt-[16px] pb-[8px]", children: d }) : null,
255
+ /* @__PURE__ */ l("div", { className: `flex min-h-0 flex-col ${f ? "" : "row-span-2"}`, children: [
256
+ d ? /* @__PURE__ */ e(
257
+ "div",
258
+ {
259
+ className: "shrink-0 px-[16px] pt-[16px] pb-[8px]",
260
+ onKeyDown: $ ? fe : void 0,
261
+ children: d
262
+ }
263
+ ) : null,
244
264
  /* @__PURE__ */ e(
245
- F,
265
+ H,
246
266
  {
247
267
  bodyPadding: q,
248
- callouts: A,
249
- calloutId: I,
250
- renderLink: U,
251
- children: G
268
+ callouts: P,
269
+ calloutId: S,
270
+ renderLink: G,
271
+ children: J
252
272
  }
253
273
  )
254
274
  ] }),
@@ -264,7 +284,7 @@ const x = 200, me = "360px", F = ({
264
284
  );
265
285
  };
266
286
  export {
267
- ye as SidePanel,
268
- ye as default
287
+ Se as SidePanel,
288
+ Se as default
269
289
  };
270
290
  //# sourceMappingURL=SidePanel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidePanel.js","sources":["../../src/components/SidePanel.tsx"],"sourcesContent":["import React, { useEffect, useId, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { ShadowRootWrapper } from '../ShadowRootWrapper';\nimport type { AlertType } from './Alert';\nimport CalloutStrip from './CalloutStrip';\nimport ArrowLeftIcon from './CustomIcons/ArrowLeftIcon';\nimport DismissIcon from './CustomIcons/DismissIcon';\nimport type { RenderLink } from './PageLayout/types';\nimport EllipsisText from './Typography/EllipsisText';\nimport { OVERLAY_ICON_BUTTON_CLASSES, useOverlayBehaviour } from './overlayBehaviour';\nimport { OVERLAY_ELEVATED_ATTR, overlayIdentity } from './portalOverlay';\n\nexport interface SidePanelProps {\n open: boolean;\n /** Dismiss handler — close button, ESC, or overlay click. */\n onClose: () => void;\n title: React.ReactNode;\n subtitle?: React.ReactNode;\n /** `below` stacks the subtitle under the title, so neither truncates the other. */\n subtitlePlacement?: 'inline' | 'below';\n /** Content at the end of the title row, after the subtitle (e.g. a status tag). */\n titleExtra?: React.ReactNode;\n /** Block paragraph below the title row, spanning the header width. Announced as the panel's description. */\n description?: React.ReactNode;\n /** Pinned between the header and the scrolling body. */\n toolbar?: React.ReactNode;\n /** Divider under the header. Default: false. */\n headerDivider?: boolean;\n /** Leading header slot, typically a logo or icon. */\n icon?: React.ReactNode;\n /** Content pinned right in the header, before the close button. */\n headerExtra?: React.ReactNode;\n footer?: React.ReactNode;\n /** Renders a back button before the header icon. */\n onBack?: () => void;\n /** Maximum panel width. Default: 1080. */\n maxWidth?: number | string;\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 /** Whether the body gets default padding. Default: true. */\n bodyPadding?: boolean;\n /** `above-app-overlays` lifts the overlay stack clear of chrome pinned near max-int. */\n stacking?: 'default' | 'above-app-overlays';\n /** Full-width Alert bands at the top of the body, above `children`, in order. Unaffected by\n * `bodyPadding`, and announced ahead of `description`. The message is markdown. */\n callouts?: { type?: AlertType; message: string }[];\n /** Routes root-relative links in `callouts` through the app's router; see `MarkdownBlock`. */\n renderLink?: RenderLink;\n /** A full-height column opened to the left, as wide again as `maxWidth`. The panel's own\n * header, body and footer keep their width and place; the aside's header and footer line\n * up with them. The aside is never narrower than 360px: a window too narrow for both\n * columns scrolls the panel sideways. */\n aside?: SidePanelAside;\n children: React.ReactNode;\n}\n\nexport interface SidePanelAside {\n /** Shown in the aside's header, and names the column for assistive tech. */\n title: string;\n /** Content pinned right in the aside's header (e.g. a stepper). */\n headerExtra?: React.ReactNode;\n /** Pinned at the bottom, level with the panel's footer. */\n footer?: React.ReactNode;\n /** Whether the aside's body gets default padding, as the panel's `bodyPadding`. Default: true. */\n bodyPadding?: boolean;\n children: React.ReactNode;\n}\n\nconst TRANSITION_MS = 200;\nconst ASIDE_MIN_WIDTH = '360px';\n\ninterface ScrollingBodyProps {\n bodyPadding: boolean;\n callouts?: { type?: AlertType; message: string }[];\n /** Prefix for each callout's id, which the panel names in `aria-describedby`. */\n calloutId?: string;\n renderLink?: RenderLink;\n children: React.ReactNode;\n}\n\nconst ScrollingBody: React.FC<ScrollingBodyProps> = ({\n bodyPadding,\n callouts,\n calloutId,\n renderLink,\n children,\n}) => {\n const hasCallouts = !!callouts?.length;\n\n // Callouts move the horizontal padding inward so their strips run full-bleed.\n return (\n <div\n className={`min-h-0 flex-1 overflow-y-auto ${bodyPadding && !hasCallouts ? 'px-[28px]' : ''}`}\n >\n {callouts?.map((callout, index) => (\n <CalloutStrip\n key={index}\n id={calloutId ? `${calloutId}-${index}` : undefined}\n type={callout.type}\n message={callout.message}\n renderLink={renderLink}\n />\n ))}\n {bodyPadding ? (\n <div className={hasCallouts ? 'p-[28px]' : 'py-[28px]'}>{children}</div>\n ) : (\n children\n )}\n </div>\n );\n};\n\nconst toCssSize = (value: number | string): string =>\n typeof value === 'number' ? `${value}px` : value;\n\n/**\n * A right-hand slide-in overlay panel (drawer) for inspecting or editing an entity\n * without leaving the page. Portals to `document.body`, locks background scroll and\n * traps keyboard focus while open (restoring both on close), dismisses on ESC\n * (topmost open overlay only), overlay click or the close button, and exposes header\n * (back/icon/title/subtitle/extra), scrollable body and optional footer slots.\n */\nconst SidePanel: React.FC<SidePanelProps> = ({\n open,\n onClose,\n title,\n subtitle,\n subtitlePlacement = 'inline',\n titleExtra,\n description,\n toolbar,\n headerDivider = false,\n icon,\n headerExtra,\n footer,\n onBack,\n maxWidth = 1080,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n bodyPadding = true,\n stacking = 'default',\n callouts,\n renderLink,\n aside,\n children,\n}) => {\n const calloutId = useId();\n const descriptionId = useId();\n const [isVisible, setIsVisible] = useState(false);\n const [isMounted, setIsMounted] = useState(false);\n const frameRef = useRef<number | null>(null);\n const unmountTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const hostRef = useRef<HTMLDivElement | null>(null);\n const {\n ref: handlePanelRef,\n isTopmost,\n zIndex,\n elevated,\n } = useOverlayBehaviour({\n open,\n onClose,\n elevated: stacking === 'above-app-overlays',\n hostRef,\n });\n\n useEffect(() => {\n if (open) {\n setIsMounted(true);\n if (unmountTimerRef.current) {\n clearTimeout(unmountTimerRef.current);\n unmountTimerRef.current = null;\n }\n frameRef.current = requestAnimationFrame(() => {\n frameRef.current = null;\n setIsVisible(true);\n });\n } else {\n setIsVisible(false);\n unmountTimerRef.current = setTimeout(() => {\n unmountTimerRef.current = null;\n setIsMounted(false);\n }, TRANSITION_MS);\n }\n return () => {\n if (frameRef.current !== null) {\n cancelAnimationFrame(frameRef.current);\n frameRef.current = null;\n }\n if (unmountTimerRef.current) {\n clearTimeout(unmountTimerRef.current);\n unmountTimerRef.current = null;\n }\n };\n }, [open]);\n\n if (!isMounted) {\n return null;\n }\n\n const shownCallouts = callouts?.filter((callout) => callout.message.trim());\n const panelColumnWidth = `calc(${toCssSize(maxWidth)} - 2px)`;\n const dividerBelow = headerDivider\n ? 'border-0 border-b border-solid border-[var(--malachite-card-border)]'\n : '';\n // Each column is a subgrid of the panel's three rows, so the aside's header and footer\n // stay level with the panel's whatever their content. The panel's own column is always the\n // second, so opening or closing the aside never remounts it or reflows it mid-transition:\n // without an aside the first column is simply empty and narrows to nothing.\n const asideColumn = aside ? (\n <aside\n aria-label={aside.title}\n className=\"col-start-1 row-span-3 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid overflow-hidden border-0 border-r border-solid border-[var(--malachite-card-border)]\"\n >\n <div\n className={`flex min-w-0 items-center gap-[8px] px-[20px] py-[18px] ${dividerBelow}`}\n >\n <span className=\"flex min-w-0 shrink-0\">\n <EllipsisText\n tooltip={aside.title}\n tooltipWhenTruncated\n tooltipPlacement=\"bottom\"\n className=\"min-w-0 text-[length:var(--malachite-font-size-15,15px)] font-semibold\"\n >\n {aside.title}\n </EllipsisText>\n </span>\n {aside.headerExtra ? (\n <span className=\"ml-auto flex shrink-0 items-center\">{aside.headerExtra}</span>\n ) : null}\n </div>\n <div className={`flex min-h-0 flex-col ${aside.footer ? '' : 'row-span-2'}`}>\n <ScrollingBody bodyPadding={aside.bodyPadding ?? true}>\n {aside.children}\n </ScrollingBody>\n </div>\n {aside.footer ? (\n <div className=\"border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]\">\n {aside.footer}\n </div>\n ) : null}\n </aside>\n ) : null;\n\n const subtitleBelow = subtitlePlacement === 'below' && !!subtitle;\n const titleNode = (\n <span\n className={subtitleBelow ? 'flex min-w-0 shrink' : 'flex min-w-0 max-w-full shrink-0'}\n >\n <EllipsisText\n tooltip={title}\n tooltipWhenTruncated\n tooltipPlacement=\"bottom\"\n className=\"min-w-0 text-[length:var(--malachite-font-size-15,15px)] font-semibold\"\n >\n {title}\n </EllipsisText>\n </span>\n );\n const subtitleNode = subtitle ? (\n <EllipsisText\n tooltip={subtitle}\n tooltipWhenTruncated\n tooltipPlacement=\"bottom\"\n color=\"secondary\"\n className=\"min-w-0 text-[13px]\"\n >\n {subtitle}\n </EllipsisText>\n ) : null;\n const titleExtraNode = titleExtra ? (\n <span className=\"flex shrink-0 items-center\">{titleExtra}</span>\n ) : null;\n const headerExtraNode = headerExtra ? (\n <span className=\"flex shrink-0 items-baseline\">{headerExtra}</span>\n ) : null;\n\n return createPortal(\n // Host carries the stacking context — ShadowRootWrapper's `isolation` would\n // otherwise flatten our z-index and let sticky page elements paint over us.\n <ShadowRootWrapper\n hostRef={hostRef}\n hostStyle={{ position: 'relative', zIndex }}\n hostProps={\n elevated\n ? { ...overlayIdentity('sidepanel'), [OVERLAY_ELEVATED_ATTR]: '' }\n : overlayIdentity('sidepanel')\n }\n >\n <div className=\"fixed inset-0 z-[1000]\">\n <div\n aria-hidden=\"true\"\n onClick={onClose}\n className={`absolute inset-0 bg-[var(--malachite-overlay-scrim)] transition-opacity duration-200 ease-in-out ${\n isVisible ? 'opacity-100' : 'opacity-0'\n }`}\n />\n <div\n ref={handlePanelRef}\n role=\"dialog\"\n // Only the topmost overlay may claim it, or a screen reader can still\n // browse the one underneath.\n aria-modal={isTopmost ? 'true' : undefined}\n aria-describedby={\n [\n ...(shownCallouts ?? []).map((_, index) => `${calloutId}-${index}`),\n description ? descriptionId : null,\n ]\n .filter(Boolean)\n .join(' ') || undefined\n }\n tabIndex={-1}\n // Prefer aria-labelledby; only fall back to aria-label when it's absent.\n aria-label={\n ariaLabelledBy\n ? undefined\n : (ariaLabel ?? (typeof title === 'string' ? title : undefined))\n }\n aria-labelledby={ariaLabelledBy}\n className={`absolute top-[8px] right-[8px] bottom-[8px] grid grid-rows-[auto_minmax(0,1fr)_auto] overflow-x-auto overflow-y-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-lg)]`}\n style={{\n width: `min(calc(100% - 16px), ${aside ? `calc(2 * ${toCssSize(maxWidth)})` : toCssSize(maxWidth)})`,\n // Inline: Tailwind translate utilities silently break inside\n // shadow roots (see CLAUDE.md Shadow DOM caveats).\n transform: isVisible ? 'translateX(0)' : 'translateX(calc(100% + 16px))',\n transition: `transform ${TRANSITION_MS}ms ease-in-out, width ${TRANSITION_MS}ms ease-in-out, grid-template-columns ${TRANSITION_MS}ms ease-in-out`,\n // The panel's own column is the width it has without an aside: `maxWidth`\n // less the 1px border either side, so opening the aside never widens it.\n // With an aside neither column gives way, so a narrow window scrolls the\n // panel instead. Both templates share one shape so the minimums animate\n // with the width rather than overflowing mid-transition.\n gridTemplateColumns: aside\n ? `minmax(${ASIDE_MIN_WIDTH}, 1fr) minmax(${panelColumnWidth}, ${panelColumnWidth})`\n : `minmax(0px, 1fr) minmax(0px, ${panelColumnWidth})`,\n }}\n >\n {asideColumn}\n {/* An explicit column: an implicit one is sized to its widest content and overflows the panel. */}\n <div className=\"col-start-2 row-span-3 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid\">\n <div\n className={`flex flex-col gap-[20px] px-[20px] py-[18px] ${dividerBelow}`}\n >\n <div className=\"flex items-center gap-[12px]\">\n {onBack ? (\n <button\n type=\"button\"\n aria-label=\"Back\"\n onClick={onBack}\n className={OVERLAY_ICON_BUTTON_CLASSES}\n >\n <ArrowLeftIcon size={16} />\n </button>\n ) : null}\n {icon ? (\n <span className=\"flex shrink-0 items-center\">{icon}</span>\n ) : null}\n {subtitleBelow ? (\n <div className=\"flex min-w-0 flex-1 items-center gap-[12px]\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-[2px]\">\n <div className=\"flex min-w-0 items-baseline gap-[8px]\">\n {titleNode}\n {titleExtraNode}\n </div>\n {subtitleNode}\n </div>\n {headerExtraNode}\n </div>\n ) : (\n <div className=\"flex min-w-0 flex-1 items-baseline gap-[12px]\">\n <div className=\"flex min-w-0 flex-1 items-baseline gap-[8px]\">\n <div className=\"flex min-w-0 items-baseline gap-[8px]\">\n {titleNode}\n {subtitleNode}\n </div>\n {titleExtraNode}\n </div>\n {headerExtraNode}\n </div>\n )}\n <button\n type=\"button\"\n aria-label=\"Close\"\n onClick={onClose}\n className={OVERLAY_ICON_BUTTON_CLASSES}\n >\n <DismissIcon size={10} />\n </button>\n </div>\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 </div>\n {/* The toolbar shares the body's row, so an aside's header and footer stay level. */}\n <div className={`flex min-h-0 flex-col ${footer ? '' : 'row-span-2'}`}>\n {toolbar ? (\n <div className=\"shrink-0 px-[16px] pt-[16px] pb-[8px]\">\n {toolbar}\n </div>\n ) : null}\n <ScrollingBody\n bodyPadding={bodyPadding}\n callouts={shownCallouts}\n calloutId={calloutId}\n renderLink={renderLink}\n >\n {children}\n </ScrollingBody>\n </div>\n {footer ? (\n <div className=\"border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]\">\n {footer}\n </div>\n ) : null}\n </div>\n </div>\n </div>\n </ShadowRootWrapper>,\n document.body,\n );\n};\n\nexport default SidePanel;\nexport { SidePanel };\n"],"names":["TRANSITION_MS","ASIDE_MIN_WIDTH","ScrollingBody","bodyPadding","callouts","calloutId","renderLink","children","hasCallouts","jsxs","callout","index","jsx","CalloutStrip","toCssSize","value","SidePanel","open","onClose","title","subtitle","subtitlePlacement","titleExtra","description","toolbar","headerDivider","icon","headerExtra","footer","onBack","maxWidth","ariaLabel","ariaLabelledBy","stacking","aside","useId","descriptionId","isVisible","setIsVisible","useState","isMounted","setIsMounted","frameRef","useRef","unmountTimerRef","hostRef","handlePanelRef","isTopmost","zIndex","elevated","useOverlayBehaviour","useEffect","shownCallouts","panelColumnWidth","dividerBelow","asideColumn","EllipsisText","subtitleBelow","titleNode","subtitleNode","titleExtraNode","headerExtraNode","createPortal","ShadowRootWrapper","overlayIdentity","OVERLAY_ELEVATED_ATTR","_","OVERLAY_ICON_BUTTON_CLASSES","ArrowLeftIcon","DismissIcon"],"mappings":";;;;;;;;;;AAsEA,MAAMA,IAAgB,KAChBC,KAAkB,SAWlBC,IAA8C,CAAC;AAAA,EACjD,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AACJ,MAAM;AACF,QAAMC,IAAc,CAAC,EAACJ,KAAA,QAAAA,EAAU;AAGhC,SACI,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAW,kCAAkCN,KAAe,CAACK,IAAc,cAAc,EAAE;AAAA,MAE1F,UAAA;AAAA,QAAAJ,KAAA,gBAAAA,EAAU,IAAI,CAACM,GAASC,MACrB,gBAAAC;AAAA,UAACC;AAAA,UAAA;AAAA,YAEG,IAAIR,IAAY,GAAGA,CAAS,IAAIM,CAAK,KAAK;AAAA,YAC1C,MAAMD,EAAQ;AAAA,YACd,SAASA,EAAQ;AAAA,YACjB,YAAAJ;AAAA,UAAA;AAAA,UAJKK;AAAA,QAAA;AAAA,QAOZR,sBACI,OAAA,EAAI,WAAWK,IAAc,aAAa,aAAc,UAAAD,GAAS,IAElEA;AAAA,MAAA;AAA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AA,oBACJ,gBAAAA;AAAA,sBAACV;AAAA,sBAAA;AAAA,wBACG,aAAAC;AAAA,wBACA,UAAUiD;AAAA,wBACV,WAAA/C;AAAA,wBACA,YAAAC;AAAA,wBAEC,UAAAC;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACL,GACJ;AAAA,kBACCqB,IACG,gBAAAhB,EAAC,OAAA,EAAI,WAAU,4FACV,aACL,IACA;AAAA,gBAAA,EAAA,CACR;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACJ,EAAA,CACJ;AAAA,MAAA;AAAA,IAAA;AAAA,IAEJ,SAAS;AAAA,EAAA;AAEjB;"}
1
+ {"version":3,"file":"SidePanel.js","sources":["../../src/components/SidePanel.tsx"],"sourcesContent":["import React, { useEffect, useId, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport { ShadowRootWrapper } from '../ShadowRootWrapper';\nimport type { AlertType } from './Alert';\nimport CalloutStrip from './CalloutStrip';\nimport ArrowLeftIcon from './CustomIcons/ArrowLeftIcon';\nimport DismissIcon from './CustomIcons/DismissIcon';\nimport type { RenderLink } from './PageLayout/types';\nimport EllipsisText from './Typography/EllipsisText';\nimport { OVERLAY_ICON_BUTTON_CLASSES, useOverlayBehaviour } from './overlayBehaviour';\nimport { OVERLAY_ELEVATED_ATTR, overlayIdentity } from './portalOverlay';\n\nexport interface SidePanelProps {\n open: boolean;\n /** Dismiss handler — close button, ESC, or overlay click. */\n onClose: () => void;\n title: React.ReactNode;\n subtitle?: React.ReactNode;\n /** `below` stacks the subtitle under the title, so neither truncates the other. */\n subtitlePlacement?: 'inline' | 'below';\n /** Content at the end of the title row, after the subtitle (e.g. a status tag). */\n titleExtra?: React.ReactNode;\n /** Block paragraph below the title row, spanning the header width. Announced as the panel's description. */\n description?: React.ReactNode;\n /** Pinned between the header and the scrolling body. */\n toolbar?: React.ReactNode;\n /** Divider under the header. Default: false. */\n headerDivider?: boolean;\n /** Leading header slot, typically a logo or icon. */\n icon?: React.ReactNode;\n /** Content pinned right in the header, before the close button. */\n headerExtra?: React.ReactNode;\n footer?: React.ReactNode;\n /**\n * Makes the panel's header, body and footer one form. Enter in a field then submits through\n * a `type=\"submit\"` button in the footer (see `FormActions`), the way a browser form does:\n * not from a textarea, not mid-composition, and not while that button is disabled. The\n * event's default is prevented and validation is the caller's, so the form is `noValidate`.\n * Enter in the `toolbar` never submits. A field inside its own `MalachiteContext` sits in\n * another shadow root and is outside the form.\n */\n onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void;\n /** Renders a back button before the header icon. */\n onBack?: () => void;\n /** Maximum panel width. Default: 1080. */\n maxWidth?: number | string;\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 /** Whether the body gets default padding. Default: true. */\n bodyPadding?: boolean;\n /** `above-app-overlays` lifts the overlay stack clear of chrome pinned near max-int. */\n stacking?: 'default' | 'above-app-overlays';\n /** Full-width Alert bands at the top of the body, above `children`, in order. Unaffected by\n * `bodyPadding`, and announced ahead of `description`. The message is markdown. */\n callouts?: { type?: AlertType; message: string }[];\n /** Routes root-relative links in `callouts` through the app's router; see `MarkdownBlock`. */\n renderLink?: RenderLink;\n /** A full-height column opened to the left, as wide again as `maxWidth`. The panel's own\n * header, body and footer keep their width and place; the aside's header and footer line\n * up with them. The aside is never narrower than 360px: a window too narrow for both\n * columns scrolls the panel sideways. */\n aside?: SidePanelAside;\n children: React.ReactNode;\n}\n\nexport interface SidePanelAside {\n /** Shown in the aside's header, and names the column for assistive tech. */\n title: string;\n /** Content pinned right in the aside's header (e.g. a stepper). */\n headerExtra?: React.ReactNode;\n /** Pinned at the bottom, level with the panel's footer. */\n footer?: React.ReactNode;\n /** Whether the aside's body gets default padding, as the panel's `bodyPadding`. Default: true. */\n bodyPadding?: boolean;\n children: React.ReactNode;\n}\n\nconst TRANSITION_MS = 200;\nconst ASIDE_MIN_WIDTH = '360px';\n\ninterface ScrollingBodyProps {\n bodyPadding: boolean;\n callouts?: { type?: AlertType; message: string }[];\n /** Prefix for each callout's id, which the panel names in `aria-describedby`. */\n calloutId?: string;\n renderLink?: RenderLink;\n children: React.ReactNode;\n}\n\nconst ScrollingBody: React.FC<ScrollingBodyProps> = ({\n bodyPadding,\n callouts,\n calloutId,\n renderLink,\n children,\n}) => {\n const hasCallouts = !!callouts?.length;\n\n // Callouts move the horizontal padding inward so their strips run full-bleed.\n return (\n <div\n className={`min-h-0 flex-1 overflow-y-auto ${bodyPadding && !hasCallouts ? 'px-[28px]' : ''}`}\n >\n {callouts?.map((callout, index) => (\n <CalloutStrip\n key={index}\n id={calloutId ? `${calloutId}-${index}` : undefined}\n type={callout.type}\n message={callout.message}\n renderLink={renderLink}\n />\n ))}\n {bodyPadding ? (\n <div className={hasCallouts ? 'p-[28px]' : 'py-[28px]'}>{children}</div>\n ) : (\n children\n )}\n </div>\n );\n};\n\nconst toCssSize = (value: number | string): string =>\n typeof value === 'number' ? `${value}px` : value;\n\n// The toolbar holds filters, such as a Search over the list, never a field the form saves.\nconst cancelToolbarSubmit = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Enter' && event.target instanceof HTMLInputElement) {\n event.preventDefault();\n }\n};\n\nconst PANEL_COLUMN_CLASSES =\n 'col-start-2 row-span-3 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid';\n\n// The panel's own column, which is the form when the panel has one, so the header, body and\n// footer stay the subgrid's three rows either way.\nconst PanelColumn: React.FC<{\n onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void;\n children: React.ReactNode;\n}> = ({ onSubmit, children }) =>\n onSubmit ? (\n <form\n noValidate\n className={PANEL_COLUMN_CLASSES}\n onSubmit={(event) => {\n event.preventDefault();\n // React bubbles it through the portal to a consumer's own form around the panel.\n event.stopPropagation();\n onSubmit(event);\n }}\n >\n {children}\n </form>\n ) : (\n <div className={PANEL_COLUMN_CLASSES}>{children}</div>\n );\n\n/**\n * A right-hand slide-in overlay panel (drawer) for inspecting or editing an entity\n * without leaving the page. Portals to `document.body`, locks background scroll and\n * traps keyboard focus while open (restoring both on close), dismisses on ESC\n * (topmost open overlay only), overlay click or the close button, and exposes header\n * (back/icon/title/subtitle/extra), scrollable body and optional footer slots.\n */\nconst SidePanel: React.FC<SidePanelProps> = ({\n open,\n onClose,\n title,\n subtitle,\n subtitlePlacement = 'inline',\n titleExtra,\n description,\n toolbar,\n headerDivider = false,\n icon,\n headerExtra,\n footer,\n onSubmit,\n onBack,\n maxWidth = 1080,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n bodyPadding = true,\n stacking = 'default',\n callouts,\n renderLink,\n aside,\n children,\n}) => {\n const calloutId = useId();\n const descriptionId = useId();\n const [isVisible, setIsVisible] = useState(false);\n const [isMounted, setIsMounted] = useState(false);\n const frameRef = useRef<number | null>(null);\n const unmountTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const hostRef = useRef<HTMLDivElement | null>(null);\n const {\n ref: handlePanelRef,\n isTopmost,\n zIndex,\n elevated,\n } = useOverlayBehaviour({\n open,\n onClose,\n elevated: stacking === 'above-app-overlays',\n hostRef,\n });\n\n useEffect(() => {\n if (open) {\n setIsMounted(true);\n if (unmountTimerRef.current) {\n clearTimeout(unmountTimerRef.current);\n unmountTimerRef.current = null;\n }\n frameRef.current = requestAnimationFrame(() => {\n frameRef.current = null;\n setIsVisible(true);\n });\n } else {\n setIsVisible(false);\n unmountTimerRef.current = setTimeout(() => {\n unmountTimerRef.current = null;\n setIsMounted(false);\n }, TRANSITION_MS);\n }\n return () => {\n if (frameRef.current !== null) {\n cancelAnimationFrame(frameRef.current);\n frameRef.current = null;\n }\n if (unmountTimerRef.current) {\n clearTimeout(unmountTimerRef.current);\n unmountTimerRef.current = null;\n }\n };\n }, [open]);\n\n if (!isMounted) {\n return null;\n }\n\n const shownCallouts = callouts?.filter((callout) => callout.message.trim());\n const panelColumnWidth = `calc(${toCssSize(maxWidth)} - 2px)`;\n const dividerBelow = headerDivider\n ? 'border-0 border-b border-solid border-[var(--malachite-card-border)]'\n : '';\n // Each column is a subgrid of the panel's three rows, so the aside's header and footer\n // stay level with the panel's whatever their content. The panel's own column is always the\n // second, so opening or closing the aside never remounts it or reflows it mid-transition:\n // without an aside the first column is simply empty and narrows to nothing.\n const asideColumn = aside ? (\n <aside\n aria-label={aside.title}\n className=\"col-start-1 row-span-3 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid overflow-hidden border-0 border-r border-solid border-[var(--malachite-card-border)]\"\n >\n <div\n className={`flex min-w-0 items-center gap-[8px] px-[20px] py-[18px] ${dividerBelow}`}\n >\n <span className=\"flex min-w-0 shrink-0\">\n <EllipsisText\n tooltip={aside.title}\n tooltipWhenTruncated\n tooltipPlacement=\"bottom\"\n className=\"min-w-0 text-[length:var(--malachite-font-size-15,15px)] font-semibold\"\n >\n {aside.title}\n </EllipsisText>\n </span>\n {aside.headerExtra ? (\n <span className=\"ml-auto flex shrink-0 items-center\">{aside.headerExtra}</span>\n ) : null}\n </div>\n <div className={`flex min-h-0 flex-col ${aside.footer ? '' : 'row-span-2'}`}>\n <ScrollingBody bodyPadding={aside.bodyPadding ?? true}>\n {aside.children}\n </ScrollingBody>\n </div>\n {aside.footer ? (\n <div className=\"border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]\">\n {aside.footer}\n </div>\n ) : null}\n </aside>\n ) : null;\n\n const subtitleBelow = subtitlePlacement === 'below' && !!subtitle;\n const titleNode = (\n <span\n className={subtitleBelow ? 'flex min-w-0 shrink' : 'flex min-w-0 max-w-full shrink-0'}\n >\n <EllipsisText\n tooltip={title}\n tooltipWhenTruncated\n tooltipPlacement=\"bottom\"\n className=\"min-w-0 text-[length:var(--malachite-font-size-15,15px)] font-semibold\"\n >\n {title}\n </EllipsisText>\n </span>\n );\n const subtitleNode = subtitle ? (\n <EllipsisText\n tooltip={subtitle}\n tooltipWhenTruncated\n tooltipPlacement=\"bottom\"\n color=\"secondary\"\n className=\"min-w-0 text-[13px]\"\n >\n {subtitle}\n </EllipsisText>\n ) : null;\n const titleExtraNode = titleExtra ? (\n <span className=\"flex shrink-0 items-center\">{titleExtra}</span>\n ) : null;\n const headerExtraNode = headerExtra ? (\n <span className=\"flex shrink-0 items-baseline\">{headerExtra}</span>\n ) : null;\n\n return createPortal(\n // Host carries the stacking context — ShadowRootWrapper's `isolation` would\n // otherwise flatten our z-index and let sticky page elements paint over us.\n <ShadowRootWrapper\n hostRef={hostRef}\n hostStyle={{ position: 'relative', zIndex }}\n hostProps={\n elevated\n ? { ...overlayIdentity('sidepanel'), [OVERLAY_ELEVATED_ATTR]: '' }\n : overlayIdentity('sidepanel')\n }\n >\n <div className=\"fixed inset-0 z-[1000]\">\n <div\n aria-hidden=\"true\"\n onClick={onClose}\n className={`absolute inset-0 bg-[var(--malachite-overlay-scrim)] transition-opacity duration-200 ease-in-out ${\n isVisible ? 'opacity-100' : 'opacity-0'\n }`}\n />\n <div\n ref={handlePanelRef}\n role=\"dialog\"\n // Only the topmost overlay may claim it, or a screen reader can still\n // browse the one underneath.\n aria-modal={isTopmost ? 'true' : undefined}\n aria-describedby={\n [\n ...(shownCallouts ?? []).map((_, index) => `${calloutId}-${index}`),\n description ? descriptionId : null,\n ]\n .filter(Boolean)\n .join(' ') || undefined\n }\n tabIndex={-1}\n // Prefer aria-labelledby; only fall back to aria-label when it's absent.\n aria-label={\n ariaLabelledBy\n ? undefined\n : (ariaLabel ?? (typeof title === 'string' ? title : undefined))\n }\n aria-labelledby={ariaLabelledBy}\n className={`absolute top-[8px] right-[8px] bottom-[8px] grid grid-rows-[auto_minmax(0,1fr)_auto] overflow-x-auto overflow-y-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-lg)]`}\n style={{\n width: `min(calc(100% - 16px), ${aside ? `calc(2 * ${toCssSize(maxWidth)})` : toCssSize(maxWidth)})`,\n // Inline: Tailwind translate utilities silently break inside\n // shadow roots (see CLAUDE.md Shadow DOM caveats).\n transform: isVisible ? 'translateX(0)' : 'translateX(calc(100% + 16px))',\n transition: `transform ${TRANSITION_MS}ms ease-in-out, width ${TRANSITION_MS}ms ease-in-out, grid-template-columns ${TRANSITION_MS}ms ease-in-out`,\n // The panel's own column is the width it has without an aside: `maxWidth`\n // less the 1px border either side, so opening the aside never widens it.\n // With an aside neither column gives way, so a narrow window scrolls the\n // panel instead. Both templates share one shape so the minimums animate\n // with the width rather than overflowing mid-transition.\n gridTemplateColumns: aside\n ? `minmax(${ASIDE_MIN_WIDTH}, 1fr) minmax(${panelColumnWidth}, ${panelColumnWidth})`\n : `minmax(0px, 1fr) minmax(0px, ${panelColumnWidth})`,\n }}\n >\n {asideColumn}\n {/* An explicit column: an implicit one is sized to its widest content and overflows the panel. */}\n <PanelColumn onSubmit={onSubmit}>\n <div\n className={`flex flex-col gap-[20px] px-[20px] py-[18px] ${dividerBelow}`}\n >\n <div className=\"flex items-center gap-[12px]\">\n {onBack ? (\n <button\n type=\"button\"\n aria-label=\"Back\"\n onClick={onBack}\n className={OVERLAY_ICON_BUTTON_CLASSES}\n >\n <ArrowLeftIcon size={16} />\n </button>\n ) : null}\n {icon ? (\n <span className=\"flex shrink-0 items-center\">{icon}</span>\n ) : null}\n {subtitleBelow ? (\n <div className=\"flex min-w-0 flex-1 items-center gap-[12px]\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-[2px]\">\n <div className=\"flex min-w-0 items-baseline gap-[8px]\">\n {titleNode}\n {titleExtraNode}\n </div>\n {subtitleNode}\n </div>\n {headerExtraNode}\n </div>\n ) : (\n <div className=\"flex min-w-0 flex-1 items-baseline gap-[12px]\">\n <div className=\"flex min-w-0 flex-1 items-baseline gap-[8px]\">\n <div className=\"flex min-w-0 items-baseline gap-[8px]\">\n {titleNode}\n {subtitleNode}\n </div>\n {titleExtraNode}\n </div>\n {headerExtraNode}\n </div>\n )}\n <button\n type=\"button\"\n aria-label=\"Close\"\n onClick={onClose}\n className={OVERLAY_ICON_BUTTON_CLASSES}\n >\n <DismissIcon size={10} />\n </button>\n </div>\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 </div>\n {/* The toolbar shares the body's row, so an aside's header and footer stay level. */}\n <div className={`flex min-h-0 flex-col ${footer ? '' : 'row-span-2'}`}>\n {toolbar ? (\n <div\n className=\"shrink-0 px-[16px] pt-[16px] pb-[8px]\"\n onKeyDown={onSubmit ? cancelToolbarSubmit : undefined}\n >\n {toolbar}\n </div>\n ) : null}\n <ScrollingBody\n bodyPadding={bodyPadding}\n callouts={shownCallouts}\n calloutId={calloutId}\n renderLink={renderLink}\n >\n {children}\n </ScrollingBody>\n </div>\n {footer ? (\n <div className=\"border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]\">\n {footer}\n </div>\n ) : null}\n </PanelColumn>\n </div>\n </div>\n </ShadowRootWrapper>,\n document.body,\n );\n};\n\nexport default SidePanel;\nexport { SidePanel };\n"],"names":["TRANSITION_MS","ASIDE_MIN_WIDTH","ScrollingBody","bodyPadding","callouts","calloutId","renderLink","children","hasCallouts","jsxs","callout","index","jsx","CalloutStrip","toCssSize","value","cancelToolbarSubmit","event","PANEL_COLUMN_CLASSES","PanelColumn","onSubmit","SidePanel","open","onClose","title","subtitle","subtitlePlacement","titleExtra","description","toolbar","headerDivider","icon","headerExtra","footer","onBack","maxWidth","ariaLabel","ariaLabelledBy","stacking","aside","useId","descriptionId","isVisible","setIsVisible","useState","isMounted","setIsMounted","frameRef","useRef","unmountTimerRef","hostRef","handlePanelRef","isTopmost","zIndex","elevated","useOverlayBehaviour","useEffect","shownCallouts","panelColumnWidth","dividerBelow","asideColumn","EllipsisText","subtitleBelow","titleNode","subtitleNode","titleExtraNode","headerExtraNode","createPortal","ShadowRootWr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