@stackone/malachite 2.88.0 → 2.88.1
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,77 +1,80 @@
|
|
|
1
1
|
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as j, useState as
|
|
3
|
-
import { Button as
|
|
4
|
-
import
|
|
5
|
-
import { GLASS_SURFACE_STYLE as
|
|
6
|
-
const
|
|
7
|
-
default: "px-6
|
|
8
|
-
large: "
|
|
9
|
-
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
import { useRef as j, useState as A, useLayoutEffect as L } from "react";
|
|
3
|
+
import { Button as R } from "./Button.js";
|
|
4
|
+
import E from "./CustomIcons/ArrowLeftIcon.js";
|
|
5
|
+
import { GLASS_SURFACE_STYLE as T } from "./glassSurface.js";
|
|
6
|
+
const r = {
|
|
7
|
+
default: "px-6",
|
|
8
|
+
large: "px-[28px] max-sm:px-[16px]"
|
|
9
|
+
}, z = {
|
|
10
|
+
default: `${r.default} pt-4 min-h-[var(--malachite-control-height-small,28px)]`,
|
|
11
|
+
large: `h-[60px] ${r.large} max-sm:h-[52px]`
|
|
12
|
+
}, I = ({
|
|
13
|
+
showBack: d = !1,
|
|
14
|
+
onBack: h,
|
|
15
|
+
backDisabled: u = !1,
|
|
16
|
+
reserveBack: v = !0,
|
|
17
|
+
topBarSize: c = "default",
|
|
18
|
+
leading: g,
|
|
19
|
+
stepper: N,
|
|
17
20
|
trailing: w,
|
|
18
|
-
banner:
|
|
21
|
+
banner: n,
|
|
19
22
|
header: s,
|
|
20
23
|
footer: l,
|
|
21
|
-
footerGlass:
|
|
22
|
-
footerAlign:
|
|
23
|
-
center:
|
|
24
|
+
footerGlass: b = !1,
|
|
25
|
+
footerAlign: y = "full",
|
|
26
|
+
center: $ = !1,
|
|
24
27
|
contentWidth: a = 480,
|
|
25
|
-
minWidth:
|
|
28
|
+
minWidth: o,
|
|
26
29
|
children: k,
|
|
27
30
|
className: S = ""
|
|
28
31
|
}) => {
|
|
29
|
-
const
|
|
30
|
-
return
|
|
31
|
-
const i =
|
|
32
|
+
const m = j(null), [_, x] = A(0);
|
|
33
|
+
return L(() => {
|
|
34
|
+
const i = m.current;
|
|
32
35
|
if (!i) {
|
|
33
|
-
|
|
36
|
+
x(0);
|
|
34
37
|
return;
|
|
35
38
|
}
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
return
|
|
39
|
+
const f = () => x(i.offsetHeight);
|
|
40
|
+
f();
|
|
41
|
+
const p = new ResizeObserver(f);
|
|
42
|
+
return p.observe(i), () => p.disconnect();
|
|
40
43
|
}, [l]), /* @__PURE__ */ t(
|
|
41
44
|
"div",
|
|
42
45
|
{
|
|
43
46
|
className: `w-full h-screen flex flex-col overflow-hidden bg-[var(--malachite-card-sunken-background)] ${S}`,
|
|
44
|
-
style:
|
|
47
|
+
style: o ? { minWidth: `${o}px` } : void 0,
|
|
45
48
|
children: [
|
|
46
49
|
/* @__PURE__ */ t(
|
|
47
50
|
"div",
|
|
48
51
|
{
|
|
49
|
-
className: `w-full shrink-0 flex items-center justify-between ${
|
|
52
|
+
className: `w-full shrink-0 flex items-center justify-between ${z[c]}`,
|
|
50
53
|
children: [
|
|
51
54
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-[16px] min-w-0", children: [
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
d ? /* @__PURE__ */ e(
|
|
56
|
+
R,
|
|
54
57
|
{
|
|
55
58
|
variant: "outline",
|
|
56
59
|
size: "small",
|
|
57
60
|
iconOnly: !0,
|
|
58
|
-
icon: /* @__PURE__ */ e(
|
|
59
|
-
disabled:
|
|
60
|
-
onClick:
|
|
61
|
+
icon: /* @__PURE__ */ e(E, { size: 14 }),
|
|
62
|
+
disabled: u,
|
|
63
|
+
onClick: h,
|
|
61
64
|
"aria-label": "Back",
|
|
62
65
|
className: "w-[var(--malachite-control-height-small,28px)] h-[var(--malachite-control-height-small,28px)] shrink-0"
|
|
63
66
|
}
|
|
64
|
-
) :
|
|
65
|
-
|
|
67
|
+
) : v ? /* @__PURE__ */ e("span", { className: "w-[var(--malachite-control-height-small,28px)] h-[var(--malachite-control-height-small,28px)] shrink-0" }) : null,
|
|
68
|
+
g
|
|
66
69
|
] }),
|
|
67
70
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-[16px]", children: [
|
|
68
71
|
w ?? null,
|
|
69
|
-
|
|
72
|
+
N ?? null
|
|
70
73
|
] })
|
|
71
74
|
]
|
|
72
75
|
}
|
|
73
76
|
),
|
|
74
|
-
|
|
77
|
+
n ? /* @__PURE__ */ e("div", { className: `w-full shrink-0 pt-[12px] ${r[c]}`, children: n }) : null,
|
|
75
78
|
s ? /* @__PURE__ */ e("div", { className: "w-full shrink-0 flex flex-col items-center px-6 pt-8", children: /* @__PURE__ */ e(
|
|
76
79
|
"div",
|
|
77
80
|
{
|
|
@@ -84,12 +87,12 @@ const B = {
|
|
|
84
87
|
/* @__PURE__ */ e(
|
|
85
88
|
"div",
|
|
86
89
|
{
|
|
87
|
-
className: `absolute inset-0 overflow-y-auto [scrollbar-gutter:stable_both-edges] flex flex-col items-center px-6 ${
|
|
90
|
+
className: `absolute inset-0 overflow-y-auto [scrollbar-gutter:stable_both-edges] flex flex-col items-center px-6 ${$ ? "justify-center" : "justify-start"}`,
|
|
88
91
|
style: {
|
|
89
92
|
// Reserve the overlaid footer's height plus a gap, so the last item
|
|
90
93
|
// clears the footer with breathing room (not flush against it, which
|
|
91
94
|
// reads as hidden content continuing underneath).
|
|
92
|
-
paddingBottom: l ? `${
|
|
95
|
+
paddingBottom: l ? `${_ + 24}px` : "48px"
|
|
93
96
|
},
|
|
94
97
|
children: /* @__PURE__ */ e(
|
|
95
98
|
"div",
|
|
@@ -109,10 +112,10 @@ const B = {
|
|
|
109
112
|
l ? /* @__PURE__ */ e(
|
|
110
113
|
"div",
|
|
111
114
|
{
|
|
112
|
-
ref:
|
|
115
|
+
ref: m,
|
|
113
116
|
className: "absolute inset-x-0 bottom-0 z-20",
|
|
114
|
-
style:
|
|
115
|
-
children:
|
|
117
|
+
style: b ? T : void 0,
|
|
118
|
+
children: y === "content" ? /* @__PURE__ */ e("div", { className: "flex justify-center px-6 pt-4 pb-3", children: /* @__PURE__ */ e("div", { className: "w-full", style: { maxWidth: `${a}px` }, children: l }) }) : l
|
|
116
119
|
}
|
|
117
120
|
) : null
|
|
118
121
|
] })
|
|
@@ -121,7 +124,7 @@ const B = {
|
|
|
121
124
|
);
|
|
122
125
|
};
|
|
123
126
|
export {
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
I as WizardLayout,
|
|
128
|
+
I as default
|
|
126
129
|
};
|
|
127
130
|
//# sourceMappingURL=WizardLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardLayout.js","sources":["../../src/components/WizardLayout.tsx"],"sourcesContent":["import React, { useLayoutEffect, useRef, useState } from 'react';\nimport Button from './Button';\nimport ArrowLeftIcon from './CustomIcons/ArrowLeftIcon';\nimport { GLASS_SURFACE_STYLE } from './glassSurface';\n\nexport interface WizardLayoutProps {\n /** Renders the outline back button in the top-left slot. */\n showBack?: boolean;\n onBack?: () => void;\n backDisabled?: boolean;\n /** `false` drops the hidden back button's square, so `leading` sits at the same inset as `trailing`. */\n reserveBack?: boolean;\n /** `large`: a 60px bar with 28px insets (52px and 16px below 640px), items centred. */\n topBarSize?: 'default' | 'large';\n /** Top-left slot beside the back button — e.g. a user avatar menu. */\n leading?: React.ReactNode;\n /** Right top-bar slot (sits just before `stepper`) — e.g. a theme toggle. */\n stepper?: React.ReactNode;\n /** Far-right top-bar slot — e.g. a theme toggle. */\n trailing?: React.ReactNode;\n /** A page-wide notice under the top bar, above `header`. */\n banner?: React.ReactNode;\n /**\n * Pinned below the top bar and always visible while the content scrolls —\n * e.g. connection logos + a step title. Rendered in the same centred column\n * as the content (`contentWidth`).\n */\n header?: React.ReactNode;\n /** Pinned to the bottom of the screen — typically a <FooterNav /> or a primary CTA. */\n footer?: React.ReactNode;\n /**\n * Give the pinned footer a frosted-glass treatment (translucent background +\n * backdrop blur) so scrolling content shows through it. The footer already sits\n * above sticky body content, so it reads as glass over the scrolling list.\n */\n footerGlass?: boolean;\n /** `content` holds the footer to the content column, so a full-width action lines up with the list. */\n footerAlign?: 'full' | 'content';\n /** Vertically centre the content (used for terminal/success screens). */\n center?: boolean;\n /** Max width of the centered content column. */\n contentWidth?: number;\n /** Minimum width of the whole layout, below which it scrolls horizontally. */\n minWidth?: number;\n children?: React.ReactNode;\n className?: string;\n}\n\nconst TOP_BAR_CLASSES: Record<NonNullable<WizardLayoutProps['topBarSize']>, string> = {\n default: 'px-6 pt-4 min-h-[var(--malachite-control-height-small,28px)]',\n large: 'h-[60px] px-[28px] max-sm:h-[52px] max-sm:px-[16px]',\n};\n\nconst WizardLayout: React.FC<WizardLayoutProps> = ({\n showBack = false,\n onBack,\n backDisabled = false,\n reserveBack = true,\n topBarSize = 'default',\n leading,\n stepper,\n trailing,\n banner,\n header,\n footer,\n footerGlass = false,\n footerAlign = 'full',\n center = false,\n contentWidth = 480,\n minWidth,\n children,\n className = '',\n}) => {\n // The footer overlays the bottom of the scroll area (so content can glass under\n // it). Measure it so the scroll content reserves matching bottom space and the\n // last item is never hidden behind it.\n const footerRef = useRef<HTMLDivElement>(null);\n const [footerHeight, setFooterHeight] = useState(0);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: re-run when the footer node mounts/unmounts so the observer attaches to the current element.\n useLayoutEffect(() => {\n const el = footerRef.current;\n if (!el) {\n setFooterHeight(0);\n return;\n }\n const update = () => setFooterHeight(el.offsetHeight);\n update();\n const observer = new ResizeObserver(update);\n observer.observe(el);\n return () => observer.disconnect();\n }, [footer]);\n\n return (\n <div\n className={`w-full h-screen flex flex-col overflow-hidden bg-[var(--malachite-card-sunken-background)] ${className}`}\n style={minWidth ? { minWidth: `${minWidth}px` } : undefined}\n >\n <div\n className={`w-full shrink-0 flex items-center justify-between ${TOP_BAR_CLASSES[topBarSize]}`}\n >\n <div className=\"flex items-center gap-[16px] min-w-0\">\n {showBack ? (\n <Button\n variant=\"outline\"\n size=\"small\"\n iconOnly\n icon={<ArrowLeftIcon size={14} />}\n disabled={backDisabled}\n onClick={onBack}\n aria-label=\"Back\"\n className=\"w-[var(--malachite-control-height-small,28px)] h-[var(--malachite-control-height-small,28px)] shrink-0\"\n />\n ) : reserveBack ? (\n <span className=\"w-[var(--malachite-control-height-small,28px)] h-[var(--malachite-control-height-small,28px)] shrink-0\" />\n ) : null}\n {leading}\n </div>\n <div className=\"flex items-center gap-[16px]\">\n {trailing ?? null}\n {stepper ?? null}\n </div>\n </div>\n\n {banner ? <div className=\"w-full shrink-0 px-[12px] pt-[12px]\">{banner}</div> : null}\n\n {header ? (\n <div className=\"w-full shrink-0 flex flex-col items-center px-6 pt-8\">\n <div\n className=\"w-full flex flex-col items-center gap-[24px]\"\n style={{ maxWidth: `${contentWidth}px` }}\n >\n {header}\n </div>\n </div>\n ) : null}\n\n <div className=\"relative flex-1 min-h-0\">\n {/* The gutter is held on both edges so a classic scrollbar keeps the content\n centred on the page, in line with the pinned header and the overlaid footer. */}\n <div\n className={`absolute inset-0 overflow-y-auto [scrollbar-gutter:stable_both-edges] flex flex-col items-center px-6 ${\n center ? 'justify-center' : 'justify-start'\n }`}\n style={{\n // Reserve the overlaid footer's height plus a gap, so the last item\n // clears the footer with breathing room (not flush against it, which\n // reads as hidden content continuing underneath).\n paddingBottom: footer ? `${footerHeight + 24}px` : '48px',\n }}\n >\n <div\n className=\"w-full flex flex-col items-center gap-[40px]\"\n style={{\n maxWidth: `${contentWidth}px`,\n // Top padding lives on the scrolling content — NOT the scrollport —\n // so a `position: sticky` child pins flush to the top with no gap.\n paddingTop: header ? '32px' : '48px',\n }}\n >\n {children}\n </div>\n </div>\n\n {footer ? (\n <div\n ref={footerRef}\n // z-20 keeps the pinned footer above sticky body content (e.g. a\n // sticky Accordion header at z-10) so it can't paint over the footer.\n className=\"absolute inset-x-0 bottom-0 z-20\"\n style={footerGlass ? GLASS_SURFACE_STYLE : undefined}\n >\n {footerAlign === 'content' ? (\n <div className=\"flex justify-center px-6 pt-4 pb-3\">\n <div className=\"w-full\" style={{ maxWidth: `${contentWidth}px` }}>\n {footer}\n </div>\n </div>\n ) : (\n footer\n )}\n </div>\n ) : null}\n </div>\n </div>\n );\n};\n\nexport default WizardLayout;\nexport { WizardLayout };\n"],"names":["TOP_BAR_CLASSES","WizardLayout","showBack","onBack","backDisabled","reserveBack","topBarSize","leading","stepper","trailing","banner","header","footer","footerGlass","footerAlign","center","contentWidth","minWidth","children","className","footerRef","useRef","footerHeight","setFooterHeight","useState","useLayoutEffect","el","update","observer","jsxs","jsx","Button","ArrowLeftIcon","GLASS_SURFACE_STYLE"],"mappings":";;;;;AAgDA,MAAMA,IAAgF;AAAA,EAClF,SAAS;AAAA,EACT,OAAO;AACX,GAEMC,IAA4C,CAAC;AAAA,EAC/C,UAAAC,IAAW;AAAA,EACX,QAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,aAAAC,IAAc;AAAA,EACd,YAAAC,IAAa;AAAA,EACb,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,aAAAC,IAAc;AAAA,EACd,QAAAC,IAAS;AAAA,EACT,cAAAC,IAAe;AAAA,EACf,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAChB,MAAM;AAIF,QAAMC,IAAYC,EAAuB,IAAI,GACvC,CAACC,GAAcC,CAAe,IAAIC,EAAS,CAAC;AAGlD,SAAAC,EAAgB,MAAM;AAClB,UAAMC,IAAKN,EAAU;AACrB,QAAI,CAACM,GAAI;AACL,MAAAH,EAAg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AAA,UAAA;AAAA,YACG,WAAU;AAAA,YACV,OAAO,EAAE,UAAU,GAAGd,CAAY,KAAA;AAAA,YAEjC,UAAAL;AAAA,UAAA;AAAA,QAAA,GAET,IACA;AAAA,QAEJ,gBAAAkB,EAAC,OAAA,EAAI,WAAU,2BAGX,UAAA;AAAA,UAAA,gBAAAC;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,WAAW,yGACPf,IAAS,mBAAmB,eAChC;AAAA,cACA,OAAO;AAAA;AAAA;AAAA;AAAA,gBAIH,eAAeH,IAAS,GAAGU,IAAe,EAAE,OAAO;AAAA,cAAA;AAAA,cAGvD,UAAA,gBAAAQ;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACG,WAAU;AAAA,kBACV,OAAO;AAAA,oBACH,UAAU,GAAGd,CAAY;AAAA;AAAA;AAAA,oBAGzB,YAAYL,IAAS,SAAS;AAAA,kBAAA;AAAA,kBAGjC,UAAAO;AAAA,gBAAA;AAAA,cAAA;AAAA,YACL;AAAA,UAAA;AAAA,UAGHN,IACG,gBAAAkB;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,KAAKV;AAAA,cAGL,WAAU;AAAA,cACV,OAAOP,IAAcoB,IAAsB;AAAA,cAE1C,gBAAgB,YACb,gBAAAH,EAAC,SAAI,WAAU,sCACX,4BAAC,OAAA,EAAI,WAAU,UAAS,OAAO,EAAE,UAAU,GAAGd,CAAY,QACrD,UAAAJ,EAAA,CACL,GACJ,IAEAA;AAAA,YAAA;AAAA,UAAA,IAGR;AAAA,QAAA,EAAA,CACR;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
|
|
1
|
+
{"version":3,"file":"WizardLayout.js","sources":["../../src/components/WizardLayout.tsx"],"sourcesContent":["import React, { useLayoutEffect, useRef, useState } from 'react';\nimport Button from './Button';\nimport ArrowLeftIcon from './CustomIcons/ArrowLeftIcon';\nimport { GLASS_SURFACE_STYLE } from './glassSurface';\n\nexport interface WizardLayoutProps {\n /** Renders the outline back button in the top-left slot. */\n showBack?: boolean;\n onBack?: () => void;\n backDisabled?: boolean;\n /** `false` drops the hidden back button's square, so `leading` sits at the same inset as `trailing`. */\n reserveBack?: boolean;\n /** `large`: a 60px bar with 28px insets (52px and 16px below 640px), items centred. */\n topBarSize?: 'default' | 'large';\n /** Top-left slot beside the back button — e.g. a user avatar menu. */\n leading?: React.ReactNode;\n /** Right top-bar slot (sits just before `stepper`) — e.g. a theme toggle. */\n stepper?: React.ReactNode;\n /** Far-right top-bar slot — e.g. a theme toggle. */\n trailing?: React.ReactNode;\n /** A page-wide notice under the top bar, above `header`. */\n banner?: React.ReactNode;\n /**\n * Pinned below the top bar and always visible while the content scrolls —\n * e.g. connection logos + a step title. Rendered in the same centred column\n * as the content (`contentWidth`).\n */\n header?: React.ReactNode;\n /** Pinned to the bottom of the screen — typically a <FooterNav /> or a primary CTA. */\n footer?: React.ReactNode;\n /**\n * Give the pinned footer a frosted-glass treatment (translucent background +\n * backdrop blur) so scrolling content shows through it. The footer already sits\n * above sticky body content, so it reads as glass over the scrolling list.\n */\n footerGlass?: boolean;\n /** `content` holds the footer to the content column, so a full-width action lines up with the list. */\n footerAlign?: 'full' | 'content';\n /** Vertically centre the content (used for terminal/success screens). */\n center?: boolean;\n /** Max width of the centered content column. */\n contentWidth?: number;\n /** Minimum width of the whole layout, below which it scrolls horizontally. */\n minWidth?: number;\n children?: React.ReactNode;\n className?: string;\n}\n\ntype TopBarSize = NonNullable<WizardLayoutProps['topBarSize']>;\n\n// Shared by the top bar and the banner under it, so the banner's edges line up with the bar's items.\nconst TOP_BAR_INSETS: Record<TopBarSize, string> = {\n default: 'px-6',\n large: 'px-[28px] max-sm:px-[16px]',\n};\n\nconst TOP_BAR_CLASSES: Record<TopBarSize, string> = {\n default: `${TOP_BAR_INSETS.default} pt-4 min-h-[var(--malachite-control-height-small,28px)]`,\n large: `h-[60px] ${TOP_BAR_INSETS.large} max-sm:h-[52px]`,\n};\n\nconst WizardLayout: React.FC<WizardLayoutProps> = ({\n showBack = false,\n onBack,\n backDisabled = false,\n reserveBack = true,\n topBarSize = 'default',\n leading,\n stepper,\n trailing,\n banner,\n header,\n footer,\n footerGlass = false,\n footerAlign = 'full',\n center = false,\n contentWidth = 480,\n minWidth,\n children,\n className = '',\n}) => {\n // The footer overlays the bottom of the scroll area (so content can glass under\n // it). Measure it so the scroll content reserves matching bottom space and the\n // last item is never hidden behind it.\n const footerRef = useRef<HTMLDivElement>(null);\n const [footerHeight, setFooterHeight] = useState(0);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: re-run when the footer node mounts/unmounts so the observer attaches to the current element.\n useLayoutEffect(() => {\n const el = footerRef.current;\n if (!el) {\n setFooterHeight(0);\n return;\n }\n const update = () => setFooterHeight(el.offsetHeight);\n update();\n const observer = new ResizeObserver(update);\n observer.observe(el);\n return () => observer.disconnect();\n }, [footer]);\n\n return (\n <div\n className={`w-full h-screen flex flex-col overflow-hidden bg-[var(--malachite-card-sunken-background)] ${className}`}\n style={minWidth ? { minWidth: `${minWidth}px` } : undefined}\n >\n <div\n className={`w-full shrink-0 flex items-center justify-between ${TOP_BAR_CLASSES[topBarSize]}`}\n >\n <div className=\"flex items-center gap-[16px] min-w-0\">\n {showBack ? (\n <Button\n variant=\"outline\"\n size=\"small\"\n iconOnly\n icon={<ArrowLeftIcon size={14} />}\n disabled={backDisabled}\n onClick={onBack}\n aria-label=\"Back\"\n className=\"w-[var(--malachite-control-height-small,28px)] h-[var(--malachite-control-height-small,28px)] shrink-0\"\n />\n ) : reserveBack ? (\n <span className=\"w-[var(--malachite-control-height-small,28px)] h-[var(--malachite-control-height-small,28px)] shrink-0\" />\n ) : null}\n {leading}\n </div>\n <div className=\"flex items-center gap-[16px]\">\n {trailing ?? null}\n {stepper ?? null}\n </div>\n </div>\n\n {banner ? (\n <div className={`w-full shrink-0 pt-[12px] ${TOP_BAR_INSETS[topBarSize]}`}>\n {banner}\n </div>\n ) : null}\n\n {header ? (\n <div className=\"w-full shrink-0 flex flex-col items-center px-6 pt-8\">\n <div\n className=\"w-full flex flex-col items-center gap-[24px]\"\n style={{ maxWidth: `${contentWidth}px` }}\n >\n {header}\n </div>\n </div>\n ) : null}\n\n <div className=\"relative flex-1 min-h-0\">\n {/* The gutter is held on both edges so a classic scrollbar keeps the content\n centred on the page, in line with the pinned header and the overlaid footer. */}\n <div\n className={`absolute inset-0 overflow-y-auto [scrollbar-gutter:stable_both-edges] flex flex-col items-center px-6 ${\n center ? 'justify-center' : 'justify-start'\n }`}\n style={{\n // Reserve the overlaid footer's height plus a gap, so the last item\n // clears the footer with breathing room (not flush against it, which\n // reads as hidden content continuing underneath).\n paddingBottom: footer ? `${footerHeight + 24}px` : '48px',\n }}\n >\n <div\n className=\"w-full flex flex-col items-center gap-[40px]\"\n style={{\n maxWidth: `${contentWidth}px`,\n // Top padding lives on the scrolling content — NOT the scrollport —\n // so a `position: sticky` child pins flush to the top with no gap.\n paddingTop: header ? '32px' : '48px',\n }}\n >\n {children}\n </div>\n </div>\n\n {footer ? (\n <div\n ref={footerRef}\n // z-20 keeps the pinned footer above sticky body content (e.g. a\n // sticky Accordion header at z-10) so it can't paint over the footer.\n className=\"absolute inset-x-0 bottom-0 z-20\"\n style={footerGlass ? GLASS_SURFACE_STYLE : undefined}\n >\n {footerAlign === 'content' ? (\n <div className=\"flex justify-center px-6 pt-4 pb-3\">\n <div className=\"w-full\" style={{ maxWidth: `${contentWidth}px` }}>\n {footer}\n </div>\n </div>\n ) : (\n footer\n )}\n </div>\n ) : null}\n </div>\n </div>\n );\n};\n\nexport default WizardLayout;\nexport { WizardLayout };\n"],"names":["TOP_BAR_INSETS","TOP_BAR_CLASSES","WizardLayout","showBack","onBack","backDisabled","reserveBack","topBarSize","leading","stepper","trailing","banner","header","footer","footerGlass","footerAlign","center","contentWidth","minWidth","children","className","footerRef","useRef","footerHeight","setFooterHeight","useState","useLayoutEffect","el","update","observer","jsxs","jsx","Button","ArrowLeftIcon","GLASS_SURFACE_STYLE"],"m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