@stackone/malachite 2.116.0 → 2.118.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.
Files changed (50) hide show
  1. package/COMPONENTS.md +19 -9
  2. package/dist/assets/icons/caret_down.svg.js +2 -2
  3. package/dist/assets/icons/caret_down.svg.js.map +1 -1
  4. package/dist/assets/icons/caret_up.svg.js +2 -2
  5. package/dist/assets/icons/caret_up.svg.js.map +1 -1
  6. package/dist/assets/icons/minus.svg.js +6 -0
  7. package/dist/assets/icons/minus.svg.js.map +1 -0
  8. package/dist/assets/icons/warning_circle_filled.svg.js +3 -3
  9. package/dist/assets/icons/warning_circle_filled.svg.js.map +1 -1
  10. package/dist/components/Alert.js +3 -3
  11. package/dist/components/Alert.js.map +1 -1
  12. package/dist/components/BaseFormComponent.js +84 -64
  13. package/dist/components/BaseFormComponent.js.map +1 -1
  14. package/dist/components/ClampText.js +89 -15
  15. package/dist/components/ClampText.js.map +1 -1
  16. package/dist/components/CustomIcons/MinusIcon.js +16 -0
  17. package/dist/components/CustomIcons/MinusIcon.js.map +1 -0
  18. package/dist/components/CustomIcons/index.js +150 -147
  19. package/dist/components/CustomIcons/index.js.map +1 -1
  20. package/dist/components/Dropdown.js +449 -439
  21. package/dist/components/Dropdown.js.map +1 -1
  22. package/dist/components/FieldBlock.js +32 -21
  23. package/dist/components/FieldBlock.js.map +1 -1
  24. package/dist/components/GuideTimeline/GuideJumpMenu.js +74 -0
  25. package/dist/components/GuideTimeline/GuideJumpMenu.js.map +1 -0
  26. package/dist/components/GuideTimeline/GuideProgress.js +81 -0
  27. package/dist/components/GuideTimeline/GuideProgress.js.map +1 -0
  28. package/dist/components/GuideTimeline/GuideTimeline.js +313 -0
  29. package/dist/components/GuideTimeline/GuideTimeline.js.map +1 -0
  30. package/dist/components/GuideTimeline/guideTimelinePositions.js +23 -0
  31. package/dist/components/GuideTimeline/guideTimelinePositions.js.map +1 -0
  32. package/dist/components/Link.js +11 -10
  33. package/dist/components/Link.js.map +1 -1
  34. package/dist/components/MultiSelect.js +1 -1
  35. package/dist/components/MultiSelect.js.map +1 -1
  36. package/dist/components/SidePanel.js +382 -227
  37. package/dist/components/SidePanel.js.map +1 -1
  38. package/dist/components/Tooltip.js +1 -1
  39. package/dist/components/Tooltip.js.map +1 -1
  40. package/dist/components/TruncatedTooltip.js +1 -1
  41. package/dist/components/TruncatedTooltip.js.map +1 -1
  42. package/dist/components/ZoomableImage.js +144 -32
  43. package/dist/components/ZoomableImage.js.map +1 -1
  44. package/dist/components/sidePanelOverlay.js +7 -0
  45. package/dist/components/sidePanelOverlay.js.map +1 -0
  46. package/dist/index.d.ts +149 -11
  47. package/dist/index.js +265 -255
  48. package/dist/index.js.map +1 -1
  49. package/dist/tailwind.css.js +1 -1
  50. package/package.json +1 -1
@@ -1,141 +1,160 @@
1
- import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
- import { useId as J, useState as f, useCallback as ge, useMemo as we, useRef as v, useLayoutEffect as ye, useEffect as Se } from "react";
3
- import { createPortal as Te } from "react-dom";
4
- import { ShadowRootWrapper as $e } from "../ShadowRootWrapper.js";
5
- import Ce from "./CalloutStrip.js";
6
- import Pe from "./CustomIcons/ArrowLeftIcon.js";
7
- import Ee from "./CustomIcons/DismissIcon.js";
8
- import Ie from "./SidePanelSheet.js";
9
- import ke from "./SidePanelTabs.js";
10
- import Q from "./SidePanelTitle.js";
11
- import _e from "./Typography/EllipsisText.js";
12
- import { afterNextPaint as Ae } from "./afterNextPaint.js";
13
- import { inertWhen as N } from "./inert.js";
14
- import { useOverlayBehaviour as Re, OVERLAY_ICON_BUTTON_CLASSES as Z } from "./overlayBehaviour.js";
15
- import { OVERLAY_ELEVATED_ATTR as Le, overlayIdentity as ee } from "./portalOverlay.js";
16
- import { SidePanelTabsContext as re } from "./sidePanelTabsContext.js";
17
- const g = 200, De = "360px", le = ({
18
- bodyPadding: r,
19
- callouts: a,
20
- calloutId: n,
21
- renderLink: s,
22
- stableGutter: w = !1,
23
- scrollerRef: x,
24
- children: c
1
+ import { jsxs as l, jsx as e, Fragment as O } from "react/jsx-runtime";
2
+ import { useId as pe, useState as d, useCallback as Je, useMemo as Qe, useRef as T, useLayoutEffect as Ze, useEffect as Ne } from "react";
3
+ import { createPortal as er } from "react-dom";
4
+ import { ShadowRootWrapper as rr } from "../ShadowRootWrapper.js";
5
+ import tr from "./CalloutStrip.js";
6
+ import lr from "./CustomIcons/ArrowLeftIcon.js";
7
+ import nr from "./CustomIcons/ArrowLineLeftIcon.js";
8
+ import or from "./CustomIcons/ArrowLineRightIcon.js";
9
+ import ar from "./CustomIcons/DismissIcon.js";
10
+ import xe from "./SidePanelSheet.js";
11
+ import ir from "./SidePanelTabs.js";
12
+ import A from "./SidePanelTitle.js";
13
+ import sr from "./Typography/EllipsisText.js";
14
+ import { afterNextPaint as cr } from "./afterNextPaint.js";
15
+ import { FOCUS_RING as dr } from "./focusRing.js";
16
+ import { inertWhen as y } from "./inert.js";
17
+ import { useOverlayBehaviour as mr, OVERLAY_ICON_BUTTON_CLASSES as M } from "./overlayBehaviour.js";
18
+ import { OVERLAY_ELEVATED_ATTR as pr, overlayIdentity as he } from "./portalOverlay.js";
19
+ import { SidePanelOverlayContext as xr } from "./sidePanelOverlay.js";
20
+ import { SidePanelTabsContext as ue } from "./sidePanelTabsContext.js";
21
+ const N = 200, fe = "360px", k = 16, be = 320, hr = "cubic-bezier(0.2, 0.8, 0.2, 1)", ve = "var(--malachite-card-warm-background, rgb(244, 242, 240))", ge = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, ur = 1, we = (t) => t === void 0 ? void 0 : t + ur, fr = (t, o, n) => {
22
+ const [s, b] = d({});
23
+ return Ne(() => {
24
+ if (!t || typeof ResizeObserver > "u")
25
+ return;
26
+ const h = () => b({
27
+ header: o == null ? void 0 : o.getBoundingClientRect().height,
28
+ footer: n == null ? void 0 : n.getBoundingClientRect().height
29
+ }), m = new ResizeObserver(h);
30
+ return o && m.observe(o), n && m.observe(n), h(), () => m.disconnect();
31
+ }, [t, o, n]), s;
32
+ }, z = ({
33
+ bodyPadding: t,
34
+ className: o = "",
35
+ callouts: n,
36
+ calloutId: s,
37
+ renderLink: b,
38
+ stableGutter: h = !1,
39
+ scrollerRef: m,
40
+ children: f
25
41
  }) => {
26
- const p = !!(a != null && a.length);
42
+ const v = !!(n != null && n.length);
27
43
  return /* @__PURE__ */ l(
28
44
  "div",
29
45
  {
30
- ref: x,
31
- className: `min-h-0 flex-1 overflow-y-auto ${w ? "[scrollbar-gutter:stable]" : ""} ${r && !p ? "px-[28px]" : ""}`,
46
+ ref: m,
47
+ className: `min-h-0 flex-1 overflow-y-auto [scrollbar-color:var(--malachite-text-dimmed)_transparent] ${h ? "[scrollbar-gutter:stable]" : ""} ${t && !v ? "px-[28px]" : ""} ${o}`,
32
48
  children: [
33
- a == null ? void 0 : a.map((u, b) => /* @__PURE__ */ e(
34
- Ce,
49
+ n == null ? void 0 : n.map((C, g) => /* @__PURE__ */ e(
50
+ tr,
35
51
  {
36
- id: n ? `${n}-${b}` : void 0,
37
- type: u.type,
38
- message: u.message,
39
- renderLink: s
52
+ id: s ? `${s}-${g}` : void 0,
53
+ type: C.type,
54
+ message: C.message,
55
+ renderLink: b
40
56
  },
41
- b
57
+ g
42
58
  )),
43
- r ? /* @__PURE__ */ e("div", { className: p ? "p-[28px]" : "py-[28px]", children: c }) : c
59
+ t ? /* @__PURE__ */ e("div", { className: v ? "p-[28px]" : "py-[28px]", children: f }) : f
44
60
  ]
45
61
  }
46
62
  );
47
- }, C = (r) => typeof r == "number" ? `${r}px` : r, Me = (r) => {
48
- r.key === "Enter" && r.target instanceof HTMLInputElement && r.preventDefault();
49
- }, ae = "isolate col-start-2 row-span-3 row-start-1 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid", Oe = ({ onSubmit: r, children: a }) => r ? /* @__PURE__ */ e(
63
+ }, $ = (t) => typeof t == "number" ? `${t}px` : t, br = (t) => {
64
+ t.key === "Enter" && t.target instanceof HTMLInputElement && t.preventDefault();
65
+ }, ye = "isolate col-start-2 row-span-3 row-start-1 grid min-w-0 grid-cols-[minmax(0,1fr)] grid-rows-subgrid", vr = ({ onSubmit: t, children: o }) => t ? /* @__PURE__ */ e(
50
66
  "form",
51
67
  {
52
68
  noValidate: !0,
53
- className: ae,
69
+ className: ye,
54
70
  onSubmit: (n) => {
55
- n.preventDefault(), n.stopPropagation(), r(n);
71
+ n.preventDefault(), n.stopPropagation(), t(n);
56
72
  },
57
- children: a
73
+ children: o
58
74
  }
59
- ) : /* @__PURE__ */ e("div", { className: ae, children: a }), Ve = ({
60
- open: r,
61
- onClose: a,
75
+ ) : /* @__PURE__ */ e("div", { className: ye, children: o }), gr = ({
76
+ open: t,
77
+ onClose: o,
62
78
  title: n,
63
79
  subtitle: s,
64
- subtitlePlacement: w = "inline",
65
- titleExtra: x,
66
- description: c,
67
- toolbar: p,
68
- toolbarPadding: u = "default",
69
- headerDivider: b = !1,
70
- icon: P,
71
- headerExtra: E,
72
- footer: y,
73
- onSubmit: I,
74
- onBack: k,
75
- maxWidth: S = 1080,
76
- "aria-label": te,
77
- "aria-labelledby": _,
78
- bodyPadding: ne = !0,
79
- stacking: ie = "default",
80
- callouts: T,
81
- renderLink: oe,
82
- aside: t,
83
- sheet: i,
84
- children: se
80
+ subtitlePlacement: b = "inline",
81
+ subtitleExtra: h,
82
+ titleExtra: m,
83
+ description: f,
84
+ toolbar: v,
85
+ toolbarPadding: C = "default",
86
+ headerDivider: g = !1,
87
+ icon: D,
88
+ headerExtra: B,
89
+ footer: I,
90
+ onSubmit: H,
91
+ onBack: j,
92
+ maxWidth: w = 1080,
93
+ "aria-label": $e,
94
+ "aria-labelledby": V,
95
+ bodyPadding: Ce = !0,
96
+ stacking: Se = "default",
97
+ callouts: P,
98
+ renderLink: _e,
99
+ aside: r,
100
+ sheet: p,
101
+ progress: X,
102
+ subheader: S,
103
+ children: Te
85
104
  }) => {
86
- const A = J(), [R, ce] = f(null), [de, L] = f(0), D = ge(() => (L((m) => m + 1), () => L((m) => m - 1)), []), [M, me] = f(null), pe = we(
87
- () => ({ stripSlot: R, scroller: M, registerTabs: D }),
88
- [R, M, D]
89
- ), O = J(), [V, z] = f(!1), [fe, B] = f(!1), h = v(null), o = v(null), j = v(null), {
90
- ref: xe,
91
- isTopmost: ue,
92
- zIndex: be,
93
- elevated: he
94
- } = Re({
95
- open: r,
96
- onClose: i ? i.onClose : a,
97
- elevated: ie === "above-app-overlays",
98
- hostRef: j
99
- }), W = v(i);
100
- if (ye(() => {
101
- r && (W.current = i);
102
- }), Se(() => (r ? (B(!0), o.current && (clearTimeout(o.current), o.current = null), Ae(h, () => z(!0))) : (z(!1), o.current = setTimeout(() => {
103
- o.current = null, B(!1);
104
- }, g)), () => {
105
- h.current !== null && (cancelAnimationFrame(h.current), h.current = null), o.current && (clearTimeout(o.current), o.current = null);
106
- }), [r]), !fe)
105
+ const F = pe(), [U, ke] = d(null), [Ie, G] = d(0), K = Je(() => (G((a) => a + 1), () => G((a) => a - 1)), []), [W, Pe] = d(null), Re = Qe(
106
+ () => ({ stripSlot: U, scroller: W, registerTabs: K }),
107
+ [U, W, K]
108
+ ), [Ee, Le] = d(null), [Oe, Ae] = d(null), [Me, ze] = d(null), i = (r == null ? void 0 : r.layout) === "detached", u = i ? (r == null ? void 0 : r.open) ?? !0 : !!r, Y = fr(i, Oe, Me), q = pe(), [J, Q] = d(!1), [De, Z] = d(!1), _ = T(null), x = T(null), ee = T(null), {
109
+ ref: Be,
110
+ isTopmost: He,
111
+ zIndex: je,
112
+ elevated: Ve
113
+ } = mr({
114
+ open: t,
115
+ onClose: p ? p.onClose : o,
116
+ elevated: Se === "above-app-overlays",
117
+ hostRef: ee
118
+ }), re = T(p);
119
+ if (Ze(() => {
120
+ t && (re.current = p);
121
+ }), Ne(() => (t ? (Z(!0), x.current && (clearTimeout(x.current), x.current = null), cr(_, () => Q(!0))) : (Q(!1), x.current = setTimeout(() => {
122
+ x.current = null, Z(!1);
123
+ }, N)), () => {
124
+ _.current !== null && (cancelAnimationFrame(_.current), _.current = null), x.current && (clearTimeout(x.current), x.current = null);
125
+ }), [t]), !De)
107
126
  return null;
108
- const H = () => {
109
- i == null || i.onClose(), a();
110
- }, d = r ? i : W.current, U = T == null ? void 0 : T.filter((m) => m.message.trim()), $ = `calc(${C(S)} - 2px)`, X = b ? "border-0 border-b border-solid border-[var(--malachite-card-border)]" : "", ve = t ? /* @__PURE__ */ l(
127
+ const te = () => {
128
+ p == null || p.onClose(), o();
129
+ }, c = t ? p : re.current, le = P == null ? void 0 : P.filter((a) => a.message.trim()), R = `calc(${$(w)} - 2px)`, Xe = g ? "border-0 border-b border-solid border-[var(--malachite-card-border)]" : "", Fe = g ? "[box-shadow:inset_0_-1px_0_var(--malachite-card-border)]" : "", Ue = r && !i ? /* @__PURE__ */ l(
111
130
  "aside",
112
131
  {
113
- "aria-label": t.title,
114
- ...N(!!d),
132
+ "aria-label": r.title,
133
+ ...y(!!c),
115
134
  className: "col-start-1 row-span-3 row-start-1 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)]",
116
135
  children: [
117
136
  /* @__PURE__ */ l(
118
137
  "div",
119
138
  {
120
- className: `flex min-w-0 items-center gap-[8px] px-[20px] py-[18px] ${X}`,
139
+ className: `box-border flex min-h-[56px] min-w-0 items-center gap-[8px] px-[20px] py-[8px] ${Xe}`,
121
140
  children: [
122
- /* @__PURE__ */ e("span", { className: "flex min-w-0 shrink-0", children: /* @__PURE__ */ e(Q, { children: t.title }) }),
123
- t.headerExtra ? /* @__PURE__ */ e("span", { className: "ml-auto flex shrink-0 items-center", children: t.headerExtra }) : null
141
+ /* @__PURE__ */ e("span", { className: "flex min-w-0 shrink-0", children: /* @__PURE__ */ e(A, { children: r.title }) }),
142
+ r.headerExtra ? /* @__PURE__ */ e("span", { className: "ml-auto flex shrink-0 items-center", children: r.headerExtra }) : null
124
143
  ]
125
144
  }
126
145
  ),
127
- /* @__PURE__ */ e("div", { className: `flex min-h-0 flex-col ${t.footer ? "" : "row-span-2"}`, children: /* @__PURE__ */ e(le, { bodyPadding: t.bodyPadding ?? !0, children: t.children }) }),
128
- 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
146
+ /* @__PURE__ */ e("div", { className: `flex min-h-0 flex-col ${r.footer ? "" : "row-span-2"}`, children: /* @__PURE__ */ e(z, { bodyPadding: r.bodyPadding ?? !0, children: r.children }) }),
147
+ r.footer ? /* @__PURE__ */ e("div", { className: "border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]", children: r.footer }) : null
129
148
  ]
130
149
  }
131
- ) : null, Y = w === "below" && !!s, F = /* @__PURE__ */ e(
150
+ ) : null, ne = b === "below" && !!s, oe = /* @__PURE__ */ e(
132
151
  "span",
133
152
  {
134
- className: Y ? "flex min-w-0 shrink" : "flex min-w-0 max-w-full shrink-0",
135
- children: /* @__PURE__ */ e(Q, { children: n })
153
+ className: ne ? "flex min-w-0 shrink" : "flex min-w-0 max-w-full shrink-0",
154
+ children: /* @__PURE__ */ e(A, { children: n })
136
155
  }
137
- ), G = s ? /* @__PURE__ */ e(
138
- _e,
156
+ ), E = s ? /* @__PURE__ */ e(
157
+ sr,
139
158
  {
140
159
  tooltip: s,
141
160
  tooltipWhenTruncated: !0,
@@ -144,161 +163,297 @@ const g = 200, De = "360px", le = ({
144
163
  className: "min-w-0 text-[13px]",
145
164
  children: s
146
165
  }
147
- ) : null, K = x ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: x }) : null, q = E ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-baseline", children: E }) : null;
148
- return Te(
166
+ ) : null, ae = m ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: m }) : null, ie = B ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-baseline", children: B }) : null, se = X === void 0 ? null : /* @__PURE__ */ e(
167
+ "span",
168
+ {
169
+ "aria-hidden": "true",
170
+ className: `absolute ${S ? "bottom-[-1px]" : "bottom-0"} left-0 h-[3px] bg-[var(--malachite-accent-foreground)]`,
171
+ style: {
172
+ width: `${Math.round(Math.min(1, Math.max(0, X)) * 100)}%`,
173
+ transition: ge() ? void 0 : "width 280ms ease-out"
174
+ }
175
+ }
176
+ ), ce = /* @__PURE__ */ e(O, { children: /* @__PURE__ */ l(vr, { onSubmit: H, children: [
177
+ /* @__PURE__ */ l(
178
+ "div",
179
+ {
180
+ ref: Ae,
181
+ className: `relative box-border flex min-h-[56px] flex-col justify-center px-[20px] ${Fe}`,
182
+ ...y(!!c),
183
+ children: [
184
+ S ? null : se,
185
+ /* @__PURE__ */ l("div", { className: "flex min-h-[56px] items-center gap-[12px] py-[8px]", children: [
186
+ j ? /* @__PURE__ */ e(
187
+ "button",
188
+ {
189
+ type: "button",
190
+ "aria-label": "Back",
191
+ onClick: j,
192
+ className: M,
193
+ children: /* @__PURE__ */ e(lr, { size: 16 })
194
+ }
195
+ ) : null,
196
+ D ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: D }) : null,
197
+ ne ? /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-center gap-[12px]", children: [
198
+ /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 flex-col gap-[2px]", children: [
199
+ /* @__PURE__ */ l("div", { className: "flex min-w-0 items-baseline gap-[8px]", children: [
200
+ oe,
201
+ ae
202
+ ] }),
203
+ h ? /* @__PURE__ */ l("div", { className: "flex min-w-0 items-baseline gap-[12px]", children: [
204
+ E,
205
+ /* @__PURE__ */ e("span", { className: "ml-auto flex shrink-0 items-baseline text-[13px]", children: h })
206
+ ] }) : E
207
+ ] }),
208
+ ie
209
+ ] }) : /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-baseline gap-[12px]", children: [
210
+ /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 items-baseline gap-[8px]", children: [
211
+ /* @__PURE__ */ l("div", { className: "flex min-w-0 items-baseline gap-[8px]", children: [
212
+ oe,
213
+ E
214
+ ] }),
215
+ ae
216
+ ] }),
217
+ ie
218
+ ] }),
219
+ /* @__PURE__ */ e(
220
+ "button",
221
+ {
222
+ type: "button",
223
+ "aria-label": "Close",
224
+ onClick: te,
225
+ className: M,
226
+ children: /* @__PURE__ */ e(ar, { size: 10 })
227
+ }
228
+ )
229
+ ] }),
230
+ f ? /* @__PURE__ */ e(
231
+ "div",
232
+ {
233
+ id: q,
234
+ className: "-mt-[8px] pb-[16px] text-[13px] leading-[1.6] text-[var(--malachite-text-secondary)]",
235
+ children: f
236
+ }
237
+ ) : null
238
+ ]
239
+ }
240
+ ),
241
+ /* @__PURE__ */ l(
242
+ "div",
243
+ {
244
+ className: `flex min-h-0 flex-col ${I ? "" : "row-span-2"}`,
245
+ ...y(!!c),
246
+ children: [
247
+ S ? /* @__PURE__ */ l("div", { className: "relative box-border flex min-h-[56px] shrink-0 items-center border-0 border-b border-solid border-[var(--malachite-card-border)] px-[20px]", children: [
248
+ /* @__PURE__ */ e("div", { className: "min-w-0 flex-1", children: S }),
249
+ se
250
+ ] }) : null,
251
+ v ? /* @__PURE__ */ e(
252
+ "div",
253
+ {
254
+ className: `shrink-0 pt-[16px] pb-[8px] ${C === "body" ? "px-[28px]" : "px-[16px]"}`,
255
+ onKeyDown: H ? br : void 0,
256
+ children: v
257
+ }
258
+ ) : null,
259
+ /* @__PURE__ */ e("div", { ref: ke, className: "shrink-0 px-[28px] empty:hidden" }),
260
+ /* @__PURE__ */ e(
261
+ z,
262
+ {
263
+ bodyPadding: Ce,
264
+ callouts: le,
265
+ calloutId: F,
266
+ renderLink: _e,
267
+ stableGutter: Ie > 0,
268
+ scrollerRef: Pe,
269
+ children: /* @__PURE__ */ e(ue.Provider, { value: Re, children: Te })
270
+ }
271
+ )
272
+ ]
273
+ }
274
+ ),
275
+ I ? /* @__PURE__ */ e(
276
+ "div",
277
+ {
278
+ ref: ze,
279
+ className: "border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]",
280
+ ...y(!!c),
281
+ children: I
282
+ }
283
+ ) : null
284
+ ] }) }), de = `max(${fe}, min(${$(w)}, calc(100vw - ${$(w)} - 40px)))`, Ge = (a) => ge() ? {} : {
285
+ transition: `transform ${be}ms ${hr}, opacity ${N}ms, visibility 0s linear ${a ? 0 : be}ms`
286
+ }, Ke = r && i ? /* @__PURE__ */ l(
287
+ "aside",
288
+ {
289
+ "aria-label": r.title,
290
+ "aria-hidden": u ? void 0 : !0,
291
+ ...y(!!c),
292
+ className: "absolute top-0 bottom-0 grid grid-cols-[minmax(0,1fr)] grid-rows-[auto_minmax(0,1fr)_auto] overflow-hidden rounded-l-[16px] text-[var(--malachite-card-foreground)] [box-shadow:var(--malachite-shadow-lg)]",
293
+ style: {
294
+ right: `calc(100% - ${k}px)`,
295
+ width: `calc(${de} + ${k}px)`,
296
+ paddingRight: k,
297
+ boxSizing: "border-box",
298
+ background: ve,
299
+ transform: u ? "translateX(0)" : `translateX(calc(100% - ${k}px))`,
300
+ opacity: u ? 1 : 0,
301
+ visibility: u ? "visible" : "hidden",
302
+ ...Ge(u)
303
+ },
304
+ children: [
305
+ /* @__PURE__ */ l(
306
+ "div",
307
+ {
308
+ className: "box-border flex min-w-0 items-center gap-[10px] px-[20px] py-[8px] [box-shadow:inset_0_-1px_0_var(--malachite-card-border)]",
309
+ style: { minHeight: we(Y.header) },
310
+ children: [
311
+ /* @__PURE__ */ e("span", { className: "mr-[10px] flex shrink-0", children: /* @__PURE__ */ e(A, { children: r.title }) }),
312
+ r.headerExtra ? /* @__PURE__ */ e("span", { className: "ml-auto flex min-w-0 shrink items-center justify-end", children: r.headerExtra }) : null,
313
+ r.onOpenChange ? /* @__PURE__ */ e(
314
+ "button",
315
+ {
316
+ type: "button",
317
+ "aria-label": `Collapse ${r.title}`,
318
+ title: `Collapse ${r.title}`,
319
+ onClick: () => {
320
+ var a;
321
+ return (a = r.onOpenChange) == null ? void 0 : a.call(r, !1);
322
+ },
323
+ className: M,
324
+ children: /* @__PURE__ */ e(or, { size: 16 })
325
+ }
326
+ ) : null
327
+ ]
328
+ }
329
+ ),
330
+ /* @__PURE__ */ e("div", { className: `flex min-h-0 flex-col ${r.footer ? "" : "row-span-2"}`, children: /* @__PURE__ */ e(
331
+ z,
332
+ {
333
+ bodyPadding: r.bodyPadding ?? !0,
334
+ className: "[scrollbar-color:var(--malachite-text-dimmed)_transparent]",
335
+ children: r.children
336
+ }
337
+ ) }),
338
+ r.footer ? /* @__PURE__ */ e(
339
+ "div",
340
+ {
341
+ className: "box-border flex flex-col justify-center border-0 border-t border-solid border-[var(--malachite-card-border)] px-[20px] py-[12px]",
342
+ style: { minHeight: we(Y.footer) },
343
+ children: r.footer
344
+ }
345
+ ) : null
346
+ ]
347
+ }
348
+ ) : null, L = (r == null ? void 0 : r.tabLabel) ?? `Open ${(r == null ? void 0 : r.title) ?? ""}`, We = r && i && !u && r.onOpenChange ? /* @__PURE__ */ l(
349
+ "button",
350
+ {
351
+ type: "button",
352
+ "aria-label": L,
353
+ title: L,
354
+ onClick: () => {
355
+ var a;
356
+ return (a = r.onOpenChange) == null ? void 0 : a.call(r, !0);
357
+ },
358
+ className: `absolute flex cursor-pointer flex-col items-center rounded-l-[14px] border-0 py-[12px] pr-0 pl-[2px] text-[13px] font-medium text-[var(--malachite-text-primary)] [box-shadow:var(--malachite-shadow-lg)] ${dr}`,
359
+ style: { right: "100%", top: 20, width: 42, background: ve },
360
+ children: [
361
+ /* @__PURE__ */ e(nr, { size: 16 }),
362
+ /* @__PURE__ */ e("span", { "aria-hidden": "true", style: { height: 12, flexShrink: 0 } }),
363
+ /* @__PURE__ */ e(
364
+ "span",
365
+ {
366
+ "aria-hidden": "true",
367
+ style: {
368
+ writingMode: "vertical-rl",
369
+ transform: "rotate(180deg)",
370
+ whiteSpace: "nowrap"
371
+ },
372
+ children: L
373
+ }
374
+ ),
375
+ r.tabIcon ? /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "mt-[8px] flex", children: r.tabIcon }) : null
376
+ ]
377
+ }
378
+ ) : null, Ye = /* @__PURE__ */ e(
379
+ "div",
380
+ {
381
+ ref: Le,
382
+ className: "pointer-events-none absolute top-0 right-0 bottom-0 z-[20]",
383
+ style: {
384
+ left: i && u ? `calc(-1 * ${de})` : 0
385
+ }
386
+ }
387
+ ), me = "grid grid-rows-[auto_minmax(0,1fr)_auto] rounded-[20px] border border-solid border-[var(--malachite-card-border)] bg-[var(--malachite-card-background)] text-[var(--malachite-card-foreground)] [box-shadow:var(--malachite-shadow-lg)]";
388
+ return er(
149
389
  // Host carries the stacking context — ShadowRootWrapper's `isolation` would
150
390
  // otherwise flatten our z-index and let sticky page elements paint over us.
151
391
  /* @__PURE__ */ e(
152
- $e,
392
+ rr,
153
393
  {
154
- hostRef: j,
155
- hostStyle: { position: "relative", zIndex: be },
156
- hostProps: he ? { ...ee("sidepanel"), [Le]: "" } : ee("sidepanel"),
157
- children: /* @__PURE__ */ e(re.Provider, { value: null, children: /* @__PURE__ */ l("div", { className: "fixed inset-0 z-[1000]", children: [
394
+ hostRef: ee,
395
+ hostStyle: { position: "relative", zIndex: je },
396
+ hostProps: Ve ? { ...he("sidepanel"), [pr]: "" } : he("sidepanel"),
397
+ children: /* @__PURE__ */ e(ue.Provider, { value: null, children: /* @__PURE__ */ l("div", { className: "fixed inset-0 z-[1000]", children: [
158
398
  /* @__PURE__ */ e(
159
399
  "div",
160
400
  {
161
401
  "aria-hidden": "true",
162
- onClick: H,
163
- className: `absolute inset-0 bg-[var(--malachite-overlay-scrim)] transition-opacity duration-200 ease-in-out ${V ? "opacity-100" : "opacity-0"}`
402
+ onClick: te,
403
+ className: `absolute inset-0 bg-[var(--malachite-overlay-scrim)] transition-opacity duration-200 ease-in-out ${J ? "opacity-100" : "opacity-0"}`
164
404
  }
165
405
  ),
166
- /* @__PURE__ */ l(
406
+ /* @__PURE__ */ e(
167
407
  "div",
168
408
  {
169
- ref: xe,
409
+ ref: Be,
170
410
  role: "dialog",
171
- "aria-modal": ue ? "true" : void 0,
411
+ "aria-modal": He ? "true" : void 0,
172
412
  "aria-describedby": [
173
- ...(U ?? []).map((m, Ne) => `${A}-${Ne}`),
174
- c ? O : null
413
+ ...(le ?? []).map((a, qe) => `${F}-${qe}`),
414
+ f ? q : null
175
415
  ].filter(Boolean).join(" ") || void 0,
176
416
  tabIndex: -1,
177
- "aria-label": _ ? void 0 : te ?? (typeof n == "string" ? n : void 0),
178
- "aria-labelledby": _,
179
- 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)]",
417
+ "aria-label": V ? void 0 : $e ?? (typeof n == "string" ? n : void 0),
418
+ "aria-labelledby": V,
419
+ className: i ? "absolute top-[8px] right-[8px] bottom-[8px] outline-none" : `absolute top-[8px] right-[8px] bottom-[8px] overflow-x-auto overflow-y-hidden outline-none ${me}`,
180
420
  style: {
181
- width: `min(calc(100% - 16px), ${t ? `calc(2 * ${C(S)})` : C(S)})`,
421
+ width: `min(calc(100% - 16px), ${r && !i ? `calc(2 * ${$(w)})` : $(w)})`,
182
422
  // Inline: Tailwind translate utilities silently break inside
183
423
  // shadow roots (see CLAUDE.md Shadow DOM caveats).
184
- transform: V ? "translateX(0)" : "translateX(calc(100% + 16px))",
185
- transition: `transform ${g}ms ease-in-out, width ${g}ms ease-in-out, grid-template-columns ${g}ms ease-in-out`,
424
+ transform: J ? "translateX(0)" : "translateX(calc(100% + 16px))",
425
+ transition: `transform ${N}ms ease-in-out, width ${N}ms ease-in-out, grid-template-columns ${N}ms ease-in-out`,
186
426
  // The panel's own column is the width it has without an aside: `maxWidth`
187
427
  // less the 1px border either side, so opening the aside never widens it.
188
428
  // With an aside neither column gives way, so a narrow window scrolls the
189
429
  // panel instead. Both templates share one shape so the minimums animate
190
430
  // with the width rather than overflowing mid-transition.
191
- gridTemplateColumns: t ? `minmax(${De}, 1fr) minmax(${$}, ${$})` : `minmax(0px, 1fr) minmax(0px, ${$})`
431
+ gridTemplateColumns: i ? void 0 : r ? `minmax(${fe}, 1fr) minmax(${R}, ${R})` : `minmax(0px, 1fr) minmax(0px, ${R})`
192
432
  },
193
- children: [
194
- ve,
195
- /* @__PURE__ */ l(Oe, { onSubmit: I, children: [
433
+ children: /* @__PURE__ */ l(xr.Provider, { value: Ee, children: [
434
+ i ? /* @__PURE__ */ l(O, { children: [
435
+ Ke,
436
+ We,
196
437
  /* @__PURE__ */ l(
197
438
  "div",
198
439
  {
199
- className: `flex flex-col gap-[20px] px-[20px] py-[18px] ${X}`,
200
- ...N(!!d),
440
+ className: `absolute inset-0 overflow-hidden ${me}`,
441
+ style: {
442
+ gridTemplateColumns: "0px minmax(0px, 1fr)"
443
+ },
201
444
  children: [
202
- /* @__PURE__ */ l("div", { className: "flex items-center gap-[12px]", children: [
203
- k ? /* @__PURE__ */ e(
204
- "button",
205
- {
206
- type: "button",
207
- "aria-label": "Back",
208
- onClick: k,
209
- className: Z,
210
- children: /* @__PURE__ */ e(Pe, { size: 16 })
211
- }
212
- ) : null,
213
- P ? /* @__PURE__ */ e("span", { className: "flex shrink-0 items-center", children: P }) : null,
214
- Y ? /* @__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: [
217
- F,
218
- K
219
- ] }),
220
- G
221
- ] }),
222
- q
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: [
226
- F,
227
- G
228
- ] }),
229
- K
230
- ] }),
231
- q
232
- ] }),
233
- /* @__PURE__ */ e(
234
- "button",
235
- {
236
- type: "button",
237
- "aria-label": "Close",
238
- onClick: H,
239
- className: Z,
240
- children: /* @__PURE__ */ e(Ee, { size: 10 })
241
- }
242
- )
243
- ] }),
244
- c ? /* @__PURE__ */ e(
245
- "div",
246
- {
247
- id: O,
248
- className: "text-[13px] leading-[1.6] text-[var(--malachite-text-secondary)]",
249
- children: c
250
- }
251
- ) : null
445
+ ce,
446
+ c ? /* @__PURE__ */ e(xe, { sheet: c }) : null
252
447
  ]
253
448
  }
254
- ),
255
- /* @__PURE__ */ l(
256
- "div",
257
- {
258
- className: `flex min-h-0 flex-col ${y ? "" : "row-span-2"}`,
259
- ...N(!!d),
260
- children: [
261
- p ? /* @__PURE__ */ e(
262
- "div",
263
- {
264
- className: `shrink-0 pt-[16px] pb-[8px] ${u === "body" ? "px-[28px]" : "px-[16px]"}`,
265
- onKeyDown: I ? Me : void 0,
266
- children: p
267
- }
268
- ) : null,
269
- /* @__PURE__ */ e(
270
- "div",
271
- {
272
- ref: ce,
273
- className: "shrink-0 px-[28px] empty:hidden"
274
- }
275
- ),
276
- /* @__PURE__ */ e(
277
- le,
278
- {
279
- bodyPadding: ne,
280
- callouts: U,
281
- calloutId: A,
282
- renderLink: oe,
283
- stableGutter: de > 0,
284
- scrollerRef: me,
285
- children: /* @__PURE__ */ e(re.Provider, { value: pe, children: se })
286
- }
287
- )
288
- ]
289
- }
290
- ),
291
- y ? /* @__PURE__ */ e(
292
- "div",
293
- {
294
- className: "border-0 border-t border-solid border-[var(--malachite-card-border)] px-[24px] py-[16px]",
295
- ...N(!!d),
296
- children: y
297
- }
298
- ) : null
449
+ )
450
+ ] }) : /* @__PURE__ */ l(O, { children: [
451
+ Ue,
452
+ ce,
453
+ c ? /* @__PURE__ */ e(xe, { sheet: c }) : null
299
454
  ] }),
300
- d ? /* @__PURE__ */ e(Ie, { sheet: d }) : null
301
- ]
455
+ Ye
456
+ ] })
302
457
  }
303
458
  )
304
459
  ] }) })
@@ -307,9 +462,9 @@ const g = 200, De = "360px", le = ({
307
462
  document.body
308
463
  );
309
464
  };
310
- Ve.Tabs = ke;
465
+ gr.Tabs = ir;
311
466
  export {
312
- Ve as SidePanel,
313
- Ve as default
467
+ gr as SidePanel,
468
+ gr as default
314
469
  };
315
470
  //# sourceMappingURL=SidePanel.js.map