@fairmint/ui 0.3.6 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/generic/DetailDrawer/DetailDrawer.cjs +1 -13
- package/dist/components/generic/DetailDrawer/DetailDrawer.cjs.map +1 -1
- package/dist/components/generic/DetailDrawer/DetailDrawer.d.ts.map +1 -1
- package/dist/components/generic/DetailDrawer/DetailDrawer.js +1 -13
- package/dist/components/generic/DetailDrawer/DetailDrawer.js.map +1 -1
- package/dist/components/generic/StepCard/StepCard.cjs +17 -8
- package/dist/components/generic/StepCard/StepCard.cjs.map +1 -1
- package/dist/components/generic/StepCard/StepCard.d.ts.map +1 -1
- package/dist/components/generic/StepCard/StepCard.js +18 -9
- package/dist/components/generic/StepCard/StepCard.js.map +1 -1
- package/dist/components/generic/StepFlow/StepFlow.cjs +66 -0
- package/dist/components/generic/StepFlow/StepFlow.cjs.map +1 -0
- package/dist/components/generic/StepFlow/StepFlow.d.ts +35 -0
- package/dist/components/generic/StepFlow/StepFlow.d.ts.map +1 -0
- package/dist/components/generic/StepFlow/StepFlow.js +66 -0
- package/dist/components/generic/StepFlow/StepFlow.js.map +1 -0
- package/dist/components/generic/StepProgress/StepProgress.cjs +100 -0
- package/dist/components/generic/StepProgress/StepProgress.cjs.map +1 -0
- package/dist/components/generic/StepProgress/StepProgress.d.ts +31 -0
- package/dist/components/generic/StepProgress/StepProgress.d.ts.map +1 -0
- package/dist/components/generic/StepProgress/StepProgress.js +100 -0
- package/dist/components/generic/StepProgress/StepProgress.js.map +1 -0
- package/dist/components/primitives/Drawer/Drawer.cjs +10 -1
- package/dist/components/primitives/Drawer/Drawer.cjs.map +1 -1
- package/dist/components/primitives/Drawer/Drawer.d.ts.map +1 -1
- package/dist/components/primitives/Drawer/Drawer.js +10 -1
- package/dist/components/primitives/Drawer/Drawer.js.map +1 -1
- package/dist/fairmint-ui.cjs +8 -0
- package/dist/fairmint-ui.cjs.map +1 -1
- package/dist/fairmint-ui.js +9 -1
- package/dist/fairmint-ui.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/styles.css +157 -0
- package/dist/theme/index.cjs +37 -1
- package/dist/theme/index.cjs.map +1 -1
- package/dist/theme/index.d.ts +21 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +37 -1
- package/dist/theme/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -10,19 +10,7 @@ function DetailDrawer({
|
|
|
10
10
|
size = "md",
|
|
11
11
|
...rest
|
|
12
12
|
}) {
|
|
13
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14
|
-
Drawer.Drawer,
|
|
15
|
-
{
|
|
16
|
-
opened,
|
|
17
|
-
onClose,
|
|
18
|
-
title,
|
|
19
|
-
position: "right",
|
|
20
|
-
size,
|
|
21
|
-
p: "lg",
|
|
22
|
-
...rest,
|
|
23
|
-
children
|
|
24
|
-
}
|
|
25
|
-
);
|
|
13
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Drawer.Drawer, { opened, onClose, title, position: "right", size, ...rest, children });
|
|
26
14
|
}
|
|
27
15
|
exports.DetailDrawer = DetailDrawer;
|
|
28
16
|
//# sourceMappingURL=DetailDrawer.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DetailDrawer.cjs","sources":["../../../../src/components/generic/DetailDrawer/DetailDrawer.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Drawer, type DrawerProps } from \"../../primitives/Drawer/Drawer\";\n\nexport interface DetailDrawerProps extends Omit<DrawerProps, \"title\"> {\n /** Drawer title shown in the header. Accepts ReactNode for flexibility (layout component). */\n title: ReactNode;\n /** Whether the drawer is open. */\n opened: boolean;\n /** Close callback. */\n onClose: () => void;\n /** Drawer content. */\n children: ReactNode;\n /** Drawer width. @default \"md\" */\n size?: DrawerProps[\"size\"];\n}\n\nexport function DetailDrawer({\n title,\n opened,\n onClose,\n children,\n size = \"md\",\n ...rest\n}: DetailDrawerProps) {\n return (\n <Drawer
|
|
1
|
+
{"version":3,"file":"DetailDrawer.cjs","sources":["../../../../src/components/generic/DetailDrawer/DetailDrawer.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Drawer, type DrawerProps } from \"../../primitives/Drawer/Drawer\";\n\nexport interface DetailDrawerProps extends Omit<DrawerProps, \"title\"> {\n /** Drawer title shown in the header. Accepts ReactNode for flexibility (layout component). */\n title: ReactNode;\n /** Whether the drawer is open. */\n opened: boolean;\n /** Close callback. */\n onClose: () => void;\n /** Drawer content. */\n children: ReactNode;\n /** Drawer width. @default \"md\" */\n size?: DrawerProps[\"size\"];\n}\n\nexport function DetailDrawer({\n title,\n opened,\n onClose,\n children,\n size = \"md\",\n ...rest\n}: DetailDrawerProps) {\n return (\n <Drawer opened={opened} onClose={onClose} title={title} position=\"right\" size={size} {...rest}>\n {children}\n </Drawer>\n );\n}\n"],"names":["jsx","Drawer"],"mappings":";;;;AAgBO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,GAAG;AACL,GAAsB;AACpB,SACEA,+BAACC,OAAAA,QAAA,EAAO,QAAgB,SAAkB,OAAc,UAAS,SAAQ,MAAa,GAAG,MACtF,SAAA,CACH;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DetailDrawer.d.ts","sourceRoot":"","sources":["../../../../src/components/generic/DetailDrawer/DetailDrawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE1E,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;IACnE,8FAA8F;IAC9F,KAAK,EAAE,SAAS,CAAC;IACjB,kCAAkC;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,sBAAsB;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,sBAAsB;IACtB,QAAQ,EAAE,SAAS,CAAC;IACpB,kCAAkC;IAClC,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC5B;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,MAAM,EACN,OAAO,EACP,QAAQ,EACR,IAAW,EACX,GAAG,IAAI,EACR,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"DetailDrawer.d.ts","sourceRoot":"","sources":["../../../../src/components/generic/DetailDrawer/DetailDrawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE1E,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;IACnE,8FAA8F;IAC9F,KAAK,EAAE,SAAS,CAAC;IACjB,kCAAkC;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,sBAAsB;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,sBAAsB;IACtB,QAAQ,EAAE,SAAS,CAAC;IACpB,kCAAkC;IAClC,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC5B;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,MAAM,EACN,OAAO,EACP,QAAQ,EACR,IAAW,EACX,GAAG,IAAI,EACR,EAAE,iBAAiB,2CAMnB"}
|
|
@@ -8,19 +8,7 @@ function DetailDrawer({
|
|
|
8
8
|
size = "md",
|
|
9
9
|
...rest
|
|
10
10
|
}) {
|
|
11
|
-
return /* @__PURE__ */ jsx(
|
|
12
|
-
Drawer,
|
|
13
|
-
{
|
|
14
|
-
opened,
|
|
15
|
-
onClose,
|
|
16
|
-
title,
|
|
17
|
-
position: "right",
|
|
18
|
-
size,
|
|
19
|
-
p: "lg",
|
|
20
|
-
...rest,
|
|
21
|
-
children
|
|
22
|
-
}
|
|
23
|
-
);
|
|
11
|
+
return /* @__PURE__ */ jsx(Drawer, { opened, onClose, title, position: "right", size, ...rest, children });
|
|
24
12
|
}
|
|
25
13
|
export {
|
|
26
14
|
DetailDrawer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DetailDrawer.js","sources":["../../../../src/components/generic/DetailDrawer/DetailDrawer.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Drawer, type DrawerProps } from \"../../primitives/Drawer/Drawer\";\n\nexport interface DetailDrawerProps extends Omit<DrawerProps, \"title\"> {\n /** Drawer title shown in the header. Accepts ReactNode for flexibility (layout component). */\n title: ReactNode;\n /** Whether the drawer is open. */\n opened: boolean;\n /** Close callback. */\n onClose: () => void;\n /** Drawer content. */\n children: ReactNode;\n /** Drawer width. @default \"md\" */\n size?: DrawerProps[\"size\"];\n}\n\nexport function DetailDrawer({\n title,\n opened,\n onClose,\n children,\n size = \"md\",\n ...rest\n}: DetailDrawerProps) {\n return (\n <Drawer
|
|
1
|
+
{"version":3,"file":"DetailDrawer.js","sources":["../../../../src/components/generic/DetailDrawer/DetailDrawer.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Drawer, type DrawerProps } from \"../../primitives/Drawer/Drawer\";\n\nexport interface DetailDrawerProps extends Omit<DrawerProps, \"title\"> {\n /** Drawer title shown in the header. Accepts ReactNode for flexibility (layout component). */\n title: ReactNode;\n /** Whether the drawer is open. */\n opened: boolean;\n /** Close callback. */\n onClose: () => void;\n /** Drawer content. */\n children: ReactNode;\n /** Drawer width. @default \"md\" */\n size?: DrawerProps[\"size\"];\n}\n\nexport function DetailDrawer({\n title,\n opened,\n onClose,\n children,\n size = \"md\",\n ...rest\n}: DetailDrawerProps) {\n return (\n <Drawer opened={opened} onClose={onClose} title={title} position=\"right\" size={size} {...rest}>\n {children}\n </Drawer>\n );\n}\n"],"names":[],"mappings":";;AAgBO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,GAAG;AACL,GAAsB;AACpB,SACE,oBAAC,QAAA,EAAO,QAAgB,SAAkB,OAAc,UAAS,SAAQ,MAAa,GAAG,MACtF,SAAA,CACH;AAEJ;"}
|
|
@@ -36,8 +36,8 @@ function StepCard({
|
|
|
36
36
|
radius: "lg",
|
|
37
37
|
p: { base: "md", sm: "xl" },
|
|
38
38
|
style: {
|
|
39
|
-
background:
|
|
40
|
-
border: `1px solid ${index.
|
|
39
|
+
background: index.fairmintVars.colorBgSurface,
|
|
40
|
+
border: `1px solid ${index.fairmintVars.colorBorderDefault}`
|
|
41
41
|
},
|
|
42
42
|
children: /* @__PURE__ */ jsxRuntime.jsxs(layout.Stack, { gap: "md", children: [
|
|
43
43
|
/* @__PURE__ */ jsxRuntime.jsxs(Group.Group, { gap: "md", align: "flex-start", wrap: "nowrap", children: [
|
|
@@ -45,23 +45,32 @@ function StepCard({
|
|
|
45
45
|
ThemeIcon.ThemeIcon,
|
|
46
46
|
{
|
|
47
47
|
size: 32,
|
|
48
|
-
radius: "
|
|
48
|
+
radius: "xl",
|
|
49
49
|
variant: done ? "filled" : "light",
|
|
50
50
|
color: done ? "indigo" : "gray",
|
|
51
51
|
"aria-label": done ? `Step ${index$1} complete` : `Step ${index$1}`,
|
|
52
52
|
style: {
|
|
53
53
|
flexShrink: 0,
|
|
54
54
|
pointerEvents: "none",
|
|
55
|
-
background: done ? index.brandColors.indigo : index.
|
|
56
|
-
color: done ? "white" : index.
|
|
57
|
-
border: done ? void 0 : `1px solid ${index.
|
|
55
|
+
background: done ? index.brandColors.indigo : index.fairmintVars.colorBgSurfaceSecondary,
|
|
56
|
+
color: done ? "white" : index.fairmintVars.colorTextPrimary,
|
|
57
|
+
border: done ? void 0 : `1px solid ${index.fairmintVars.colorBorderDefault}`
|
|
58
58
|
},
|
|
59
59
|
children: done ? doneIcon ?? /* @__PURE__ */ jsxRuntime.jsx(DefaultCheckIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(Text.Text, { fw: 700, fz: 14, children: index$1 })
|
|
60
60
|
}
|
|
61
61
|
),
|
|
62
62
|
/* @__PURE__ */ jsxRuntime.jsxs(layout.Box, { style: { minWidth: 0, flex: 1 }, children: [
|
|
63
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
-
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
+
Text.Text,
|
|
65
|
+
{
|
|
66
|
+
fw: 700,
|
|
67
|
+
fz: responsiveTypography.responsiveTypography.cardTitle,
|
|
68
|
+
c: index.fairmintVars.colorTextPrimary,
|
|
69
|
+
lh: 1.3,
|
|
70
|
+
children: title
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(Text.Text, { size: "sm", c: index.fairmintVars.colorTextSecondary, lh: 1.5, mt: 4, children: description })
|
|
65
74
|
] })
|
|
66
75
|
] }),
|
|
67
76
|
/* @__PURE__ */ jsxRuntime.jsx(layout.Box, { pl: { base: 0, sm: 48 }, children })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepCard.cjs","sources":["../../../../src/components/generic/StepCard/StepCard.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { brandColors,
|
|
1
|
+
{"version":3,"file":"StepCard.cjs","sources":["../../../../src/components/generic/StepCard/StepCard.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { brandColors, fairmintVars, responsiveTypography } from \"../../../theme\";\nimport { Box, Group, Paper, Stack, Text, ThemeIcon } from \"../../primitives/layout\";\n\n/** Default check glyph shown when `done === true`. Inline SVG — check only, no circle outline. */\nconst DefaultCheckIcon = () => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m5 13 4 4 10-10\" />\n </svg>\n);\n\nexport interface StepCardProps {\n /** 1-indexed step number shown in the indicator when not done. */\n index: number;\n /** Step title. */\n title: string;\n /** Optional supporting text below the title. */\n description?: string;\n /** When true, the indicator flips from the number to a check glyph. */\n done?: boolean;\n /**\n * Override the icon shown when `done === true`. Defaults to a check-only\n * glyph. Accept-as-ReactNode so consumers don't need to import an icon library.\n */\n doneIcon?: ReactNode;\n /** Step content rendered below the header. */\n children: ReactNode;\n}\n\n/**\n * Numbered step card used in multi-section wizards and form flows.\n *\n * The numbered indicator on the left flips to a check when the step is\n * marked done — a quiet progress signal that doesn't compete with the\n * right-column summary or page-level progress UI. Each step sits in\n * its own `Paper` for clear visual separation.\n *\n * The header indicator is the focal point; consumers control the body\n * via `children`.\n */\nexport function StepCard({\n index,\n title,\n description,\n done = false,\n doneIcon,\n children,\n}: StepCardProps) {\n return (\n <Paper\n radius=\"lg\"\n p={{ base: \"md\", sm: \"xl\" }}\n style={{\n background: fairmintVars.colorBgSurface,\n border: `1px solid ${fairmintVars.colorBorderDefault}`,\n }}\n >\n <Stack gap=\"md\">\n <Group gap=\"md\" align=\"flex-start\" wrap=\"nowrap\">\n <ThemeIcon\n size={32}\n radius=\"xl\"\n variant={done ? \"filled\" : \"light\"}\n color={done ? \"indigo\" : \"gray\"}\n aria-label={done ? `Step ${index} complete` : `Step ${index}`}\n style={{\n flexShrink: 0,\n pointerEvents: \"none\",\n background: done ? brandColors.indigo : fairmintVars.colorBgSurfaceSecondary,\n color: done ? \"white\" : fairmintVars.colorTextPrimary,\n border: done ? undefined : `1px solid ${fairmintVars.colorBorderDefault}`,\n }}\n >\n {done ? (\n (doneIcon ?? <DefaultCheckIcon />)\n ) : (\n <Text fw={700} fz={14}>\n {index}\n </Text>\n )}\n </ThemeIcon>\n <Box style={{ minWidth: 0, flex: 1 }}>\n <Text\n fw={700}\n fz={responsiveTypography.cardTitle}\n c={fairmintVars.colorTextPrimary}\n lh={1.3}\n >\n {title}\n </Text>\n {description && (\n <Text size=\"sm\" c={fairmintVars.colorTextSecondary} lh={1.5} mt={4}>\n {description}\n </Text>\n )}\n </Box>\n </Group>\n <Box pl={{ base: 0, sm: 48 }}>{children}</Box>\n </Stack>\n </Paper>\n );\n}\n"],"names":["jsx","index","Paper","fairmintVars","jsxs","Stack","Group","ThemeIcon","brandColors","Text","Box","responsiveTypography"],"mappings":";;;;;;;;;AAKA,MAAM,mBAAmB,MACvBA,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,aAAY;AAAA,IACZ,eAAc;AAAA,IACd,gBAAe;AAAA,IACf,eAAY;AAAA,IAEZ,UAAAA,2BAAAA,IAAC,QAAA,EAAK,GAAE,kBAAA,CAAkB;AAAA,EAAA;AAC5B;AAgCK,SAAS,SAAS;AAAA,EAAA,OACvBC;AAAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AACF,GAAkB;AAChB,SACED,2BAAAA;AAAAA,IAACE,OAAAA;AAAAA,IAAA;AAAA,MACC,QAAO;AAAA,MACP,GAAG,EAAE,MAAM,MAAM,IAAI,KAAA;AAAA,MACrB,OAAO;AAAA,QACL,YAAYC,MAAAA,aAAa;AAAA,QACzB,QAAQ,aAAaA,MAAAA,aAAa,kBAAkB;AAAA,MAAA;AAAA,MAGtD,UAAAC,2BAAAA,KAACC,OAAAA,OAAA,EAAM,KAAI,MACT,UAAA;AAAA,QAAAD,gCAACE,MAAAA,SAAM,KAAI,MAAK,OAAM,cAAa,MAAK,UACtC,UAAA;AAAA,UAAAN,2BAAAA;AAAAA,YAACO,UAAAA;AAAAA,YAAA;AAAA,cACC,MAAM;AAAA,cACN,QAAO;AAAA,cACP,SAAS,OAAO,WAAW;AAAA,cAC3B,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SAAS,EAAE,MAAM,OAAO,CAAC;AAqBvC,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uEAAuE;IACvE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,8CAA8C;IAC9C,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,KAAK,EACL,WAAW,EACX,IAAY,EACZ,QAAQ,EACR,QAAQ,GACT,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"StepCard.d.ts","sourceRoot":"","sources":["../../../../src/components/generic/StepCard/StepCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAqBvC,MAAM,WAAW,aAAa;IAC5B,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uEAAuE;IACvE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,8CAA8C;IAC9C,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,KAAK,EACL,WAAW,EACX,IAAY,EACZ,QAAQ,EACR,QAAQ,GACT,EAAE,aAAa,2CAsDf"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { fairmintVars, brandColors } from "../../../theme/index.js";
|
|
3
3
|
import { Paper, Stack, Box } from "../../primitives/layout.js";
|
|
4
4
|
import { Group } from "../../../node_modules/@mantine/core/esm/components/Group/Group.js";
|
|
5
5
|
import { ThemeIcon } from "../../../node_modules/@mantine/core/esm/components/ThemeIcon/ThemeIcon.js";
|
|
@@ -34,8 +34,8 @@ function StepCard({
|
|
|
34
34
|
radius: "lg",
|
|
35
35
|
p: { base: "md", sm: "xl" },
|
|
36
36
|
style: {
|
|
37
|
-
background:
|
|
38
|
-
border: `1px solid ${
|
|
37
|
+
background: fairmintVars.colorBgSurface,
|
|
38
|
+
border: `1px solid ${fairmintVars.colorBorderDefault}`
|
|
39
39
|
},
|
|
40
40
|
children: /* @__PURE__ */ jsxs(Stack, { gap: "md", children: [
|
|
41
41
|
/* @__PURE__ */ jsxs(Group, { gap: "md", align: "flex-start", wrap: "nowrap", children: [
|
|
@@ -43,23 +43,32 @@ function StepCard({
|
|
|
43
43
|
ThemeIcon,
|
|
44
44
|
{
|
|
45
45
|
size: 32,
|
|
46
|
-
radius: "
|
|
46
|
+
radius: "xl",
|
|
47
47
|
variant: done ? "filled" : "light",
|
|
48
48
|
color: done ? "indigo" : "gray",
|
|
49
49
|
"aria-label": done ? `Step ${index} complete` : `Step ${index}`,
|
|
50
50
|
style: {
|
|
51
51
|
flexShrink: 0,
|
|
52
52
|
pointerEvents: "none",
|
|
53
|
-
background: done ? brandColors.indigo :
|
|
54
|
-
color: done ? "white" :
|
|
55
|
-
border: done ? void 0 : `1px solid ${
|
|
53
|
+
background: done ? brandColors.indigo : fairmintVars.colorBgSurfaceSecondary,
|
|
54
|
+
color: done ? "white" : fairmintVars.colorTextPrimary,
|
|
55
|
+
border: done ? void 0 : `1px solid ${fairmintVars.colorBorderDefault}`
|
|
56
56
|
},
|
|
57
57
|
children: done ? doneIcon ?? /* @__PURE__ */ jsx(DefaultCheckIcon, {}) : /* @__PURE__ */ jsx(Text, { fw: 700, fz: 14, children: index })
|
|
58
58
|
}
|
|
59
59
|
),
|
|
60
60
|
/* @__PURE__ */ jsxs(Box, { style: { minWidth: 0, flex: 1 }, children: [
|
|
61
|
-
/* @__PURE__ */ jsx(
|
|
62
|
-
|
|
61
|
+
/* @__PURE__ */ jsx(
|
|
62
|
+
Text,
|
|
63
|
+
{
|
|
64
|
+
fw: 700,
|
|
65
|
+
fz: responsiveTypography.cardTitle,
|
|
66
|
+
c: fairmintVars.colorTextPrimary,
|
|
67
|
+
lh: 1.3,
|
|
68
|
+
children: title
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
description && /* @__PURE__ */ jsx(Text, { size: "sm", c: fairmintVars.colorTextSecondary, lh: 1.5, mt: 4, children: description })
|
|
63
72
|
] })
|
|
64
73
|
] }),
|
|
65
74
|
/* @__PURE__ */ jsx(Box, { pl: { base: 0, sm: 48 }, children })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepCard.js","sources":["../../../../src/components/generic/StepCard/StepCard.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { brandColors,
|
|
1
|
+
{"version":3,"file":"StepCard.js","sources":["../../../../src/components/generic/StepCard/StepCard.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { brandColors, fairmintVars, responsiveTypography } from \"../../../theme\";\nimport { Box, Group, Paper, Stack, Text, ThemeIcon } from \"../../primitives/layout\";\n\n/** Default check glyph shown when `done === true`. Inline SVG — check only, no circle outline. */\nconst DefaultCheckIcon = () => (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m5 13 4 4 10-10\" />\n </svg>\n);\n\nexport interface StepCardProps {\n /** 1-indexed step number shown in the indicator when not done. */\n index: number;\n /** Step title. */\n title: string;\n /** Optional supporting text below the title. */\n description?: string;\n /** When true, the indicator flips from the number to a check glyph. */\n done?: boolean;\n /**\n * Override the icon shown when `done === true`. Defaults to a check-only\n * glyph. Accept-as-ReactNode so consumers don't need to import an icon library.\n */\n doneIcon?: ReactNode;\n /** Step content rendered below the header. */\n children: ReactNode;\n}\n\n/**\n * Numbered step card used in multi-section wizards and form flows.\n *\n * The numbered indicator on the left flips to a check when the step is\n * marked done — a quiet progress signal that doesn't compete with the\n * right-column summary or page-level progress UI. Each step sits in\n * its own `Paper` for clear visual separation.\n *\n * The header indicator is the focal point; consumers control the body\n * via `children`.\n */\nexport function StepCard({\n index,\n title,\n description,\n done = false,\n doneIcon,\n children,\n}: StepCardProps) {\n return (\n <Paper\n radius=\"lg\"\n p={{ base: \"md\", sm: \"xl\" }}\n style={{\n background: fairmintVars.colorBgSurface,\n border: `1px solid ${fairmintVars.colorBorderDefault}`,\n }}\n >\n <Stack gap=\"md\">\n <Group gap=\"md\" align=\"flex-start\" wrap=\"nowrap\">\n <ThemeIcon\n size={32}\n radius=\"xl\"\n variant={done ? \"filled\" : \"light\"}\n color={done ? \"indigo\" : \"gray\"}\n aria-label={done ? `Step ${index} complete` : `Step ${index}`}\n style={{\n flexShrink: 0,\n pointerEvents: \"none\",\n background: done ? brandColors.indigo : fairmintVars.colorBgSurfaceSecondary,\n color: done ? \"white\" : fairmintVars.colorTextPrimary,\n border: done ? undefined : `1px solid ${fairmintVars.colorBorderDefault}`,\n }}\n >\n {done ? (\n (doneIcon ?? <DefaultCheckIcon />)\n ) : (\n <Text fw={700} fz={14}>\n {index}\n </Text>\n )}\n </ThemeIcon>\n <Box style={{ minWidth: 0, flex: 1 }}>\n <Text\n fw={700}\n fz={responsiveTypography.cardTitle}\n c={fairmintVars.colorTextPrimary}\n lh={1.3}\n >\n {title}\n </Text>\n {description && (\n <Text size=\"sm\" c={fairmintVars.colorTextSecondary} lh={1.5} mt={4}>\n {description}\n </Text>\n )}\n </Box>\n </Group>\n <Box pl={{ base: 0, sm: 48 }}>{children}</Box>\n </Stack>\n </Paper>\n );\n}\n"],"names":[],"mappings":";;;;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AA,UAAA;AAAA,UAGJ,qBAAC,OAAI,OAAO,EAAE,UAAU,GAAG,MAAM,KAC/B,UAAA;AAAA,YAAA;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,IAAI;AAAA,gBACJ,IAAI,qBAAqB;AAAA,gBACzB,GAAG,aAAa;AAAA,gBAChB,IAAI;AAAA,gBAEH,UAAA;AAAA,cAAA;AAAA,YAAA;AAAA,YAEF,eACC,oBAAC,MAAA,EAAK,MAAK,MAAK,GAAG,aAAa,oBAAoB,IAAI,KAAK,IAAI,GAC9D,UAAA,YAAA,CACH;AAAA,UAAA,EAAA,CAEJ;AAAA,QAAA,GACF;AAAA,QACA,oBAAC,OAAI,IAAI,EAAE,MAAM,GAAG,IAAI,GAAA,GAAO,SAAA,CAAS;AAAA,MAAA,EAAA,CAC1C;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const layout = require("../../primitives/layout.cjs");
|
|
5
|
+
const StepCard = require("../StepCard/StepCard.cjs");
|
|
6
|
+
const StepProgress = require("../StepProgress/StepProgress.cjs");
|
|
7
|
+
;/* empty css */
|
|
8
|
+
const DEFAULT_MAX_WIDTH = 640;
|
|
9
|
+
const MAX_WIDTH_TOKENS = {
|
|
10
|
+
xs: "444px",
|
|
11
|
+
sm: "600px",
|
|
12
|
+
md: "900px",
|
|
13
|
+
lg: "1200px",
|
|
14
|
+
xl: "1536px"
|
|
15
|
+
};
|
|
16
|
+
const resolveMaxWidth = (maxWidth) => {
|
|
17
|
+
if (typeof maxWidth === "number") return `${maxWidth}px`;
|
|
18
|
+
return MAX_WIDTH_TOKENS[maxWidth] ?? maxWidth;
|
|
19
|
+
};
|
|
20
|
+
const resolveActiveStep = (activeStep, stepCount) => {
|
|
21
|
+
if (!Number.isFinite(activeStep)) return 1;
|
|
22
|
+
return Math.min(Math.max(Math.trunc(activeStep), 1), stepCount);
|
|
23
|
+
};
|
|
24
|
+
const renderStepContent = (step, stepNumber, done) => /* @__PURE__ */ jsxRuntime.jsx(StepCard.StepCard, { index: stepNumber, title: step.title, description: step.description, done, children: step.content });
|
|
25
|
+
function StepFlow({
|
|
26
|
+
steps,
|
|
27
|
+
activeStep,
|
|
28
|
+
orientation = "horizontal",
|
|
29
|
+
onStepChange,
|
|
30
|
+
maxWidth = DEFAULT_MAX_WIDTH,
|
|
31
|
+
ariaLabel = "Progress"
|
|
32
|
+
}) {
|
|
33
|
+
if (steps.length === 0) return null;
|
|
34
|
+
const resolvedActiveStep = resolveActiveStep(activeStep, steps.length);
|
|
35
|
+
const activeIndex = resolvedActiveStep - 1;
|
|
36
|
+
const activeStepData = steps[activeIndex];
|
|
37
|
+
const rootStyle = {
|
|
38
|
+
"--fairmint-step-flow-max-width": resolveMaxWidth(maxWidth)
|
|
39
|
+
};
|
|
40
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
41
|
+
layout.Box,
|
|
42
|
+
{
|
|
43
|
+
className: "fairmint-step-flow",
|
|
44
|
+
"data-orientation": orientation,
|
|
45
|
+
"data-active-step": resolvedActiveStep,
|
|
46
|
+
style: rootStyle,
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
49
|
+
StepProgress.StepProgress,
|
|
50
|
+
{
|
|
51
|
+
steps,
|
|
52
|
+
activeStep: resolvedActiveStep,
|
|
53
|
+
orientation,
|
|
54
|
+
onStepChange,
|
|
55
|
+
ariaLabel
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
activeStepData && /* @__PURE__ */ jsxRuntime.jsx(layout.Box, { className: "fairmint-step-flow__content", children: renderStepContent(activeStepData, resolvedActiveStep, activeStepData.completed ?? false) })
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
const STEP_FLOW_DEFAULT_MAX_WIDTH = DEFAULT_MAX_WIDTH;
|
|
64
|
+
exports.STEP_FLOW_DEFAULT_MAX_WIDTH = STEP_FLOW_DEFAULT_MAX_WIDTH;
|
|
65
|
+
exports.StepFlow = StepFlow;
|
|
66
|
+
//# sourceMappingURL=StepFlow.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepFlow.cjs","sources":["../../../../src/components/generic/StepFlow/StepFlow.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Box } from \"../../primitives/layout\";\nimport { StepCard } from \"../StepCard/StepCard\";\nimport { StepProgress, type StepProgressStep } from \"../StepProgress/StepProgress\";\nimport \"./StepFlow.css\";\n\nconst DEFAULT_MAX_WIDTH = 640;\n\nexport type StepFlowOrientation = \"horizontal\" | \"vertical\";\n\nexport interface StepFlowStep extends StepProgressStep {\n /** Heading shown inside the numbered content container. */\n title: string;\n /** Optional supporting text below the title. */\n description?: string;\n /** Content rendered inside the step container. */\n content: ReactNode;\n}\n\nexport interface StepFlowProps {\n /** Ordered steps. The visible number is derived from this array and is 1-indexed. */\n steps: readonly StepFlowStep[];\n /** Current step number. This is intentionally 1-indexed to match StepCard and the UI. */\n activeStep: number;\n /** Horizontal in-app progress or vertical onboarding rail. @default \"horizontal\" */\n orientation?: StepFlowOrientation;\n /** Called with the 1-indexed step number when a progress pill is activated. */\n onStepChange?: (step: number) => void;\n /** Maximum width of the shared flow shell. @default 640 */\n maxWidth?: number | string;\n /** Accessible label for the progress navigation. @default \"Progress\" */\n ariaLabel?: string;\n}\n\nconst MAX_WIDTH_TOKENS: Record<string, string> = {\n xs: \"444px\",\n sm: \"600px\",\n md: \"900px\",\n lg: \"1200px\",\n xl: \"1536px\",\n};\n\nconst resolveMaxWidth = (maxWidth: number | string) => {\n if (typeof maxWidth === \"number\") return `${maxWidth}px`;\n return MAX_WIDTH_TOKENS[maxWidth] ?? maxWidth;\n};\n\nconst resolveActiveStep = (activeStep: number, stepCount: number) => {\n if (!Number.isFinite(activeStep)) return 1;\n return Math.min(Math.max(Math.trunc(activeStep), 1), stepCount);\n};\n\nconst renderStepContent = (step: StepFlowStep, stepNumber: number, done: boolean) => (\n <StepCard index={stepNumber} title={step.title} description={step.description} done={done}>\n {step.content}\n </StepCard>\n);\n\n/**\n * Canonical Fairmint shell for bounded multi-step flows.\n *\n * Horizontal flows pair step pills with one numbered content container. Vertical\n * flows move the same progress pills into a rail beside the active container.\n * The feature owns persistence, validation, and whether a step is safe to visit.\n */\nexport function StepFlow({\n steps,\n activeStep,\n orientation = \"horizontal\",\n onStepChange,\n maxWidth = DEFAULT_MAX_WIDTH,\n ariaLabel = \"Progress\",\n}: StepFlowProps) {\n if (steps.length === 0) return null;\n\n const resolvedActiveStep = resolveActiveStep(activeStep, steps.length);\n const activeIndex = resolvedActiveStep - 1;\n const activeStepData = steps[activeIndex];\n const rootStyle = {\n \"--fairmint-step-flow-max-width\": resolveMaxWidth(maxWidth),\n };\n\n return (\n <Box\n className=\"fairmint-step-flow\"\n data-orientation={orientation}\n data-active-step={resolvedActiveStep}\n style={rootStyle}\n >\n <StepProgress\n steps={steps}\n activeStep={resolvedActiveStep}\n orientation={orientation}\n onStepChange={onStepChange}\n ariaLabel={ariaLabel}\n />\n\n {activeStepData && (\n <Box className=\"fairmint-step-flow__content\">\n {renderStepContent(activeStepData, resolvedActiveStep, activeStepData.completed ?? false)}\n </Box>\n )}\n </Box>\n );\n}\n\nexport const STEP_FLOW_DEFAULT_MAX_WIDTH = DEFAULT_MAX_WIDTH;\n"],"names":["StepCard","jsxs","Box","jsx","StepProgress"],"mappings":";;;;;;;AAMA,MAAM,oBAAoB;AA4B1B,MAAM,mBAA2C;AAAA,EAC/C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,kBAAkB,CAAC,aAA8B;AACrD,MAAI,OAAO,aAAa,SAAU,QAAO,GAAG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
import { StepProgressStep } from '../StepProgress/StepProgress';
|
|
3
|
+
export type StepFlowOrientation = "horizontal" | "vertical";
|
|
4
|
+
export interface StepFlowStep extends StepProgressStep {
|
|
5
|
+
/** Heading shown inside the numbered content container. */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Optional supporting text below the title. */
|
|
8
|
+
description?: string;
|
|
9
|
+
/** Content rendered inside the step container. */
|
|
10
|
+
content: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export interface StepFlowProps {
|
|
13
|
+
/** Ordered steps. The visible number is derived from this array and is 1-indexed. */
|
|
14
|
+
steps: readonly StepFlowStep[];
|
|
15
|
+
/** Current step number. This is intentionally 1-indexed to match StepCard and the UI. */
|
|
16
|
+
activeStep: number;
|
|
17
|
+
/** Horizontal in-app progress or vertical onboarding rail. @default "horizontal" */
|
|
18
|
+
orientation?: StepFlowOrientation;
|
|
19
|
+
/** Called with the 1-indexed step number when a progress pill is activated. */
|
|
20
|
+
onStepChange?: (step: number) => void;
|
|
21
|
+
/** Maximum width of the shared flow shell. @default 640 */
|
|
22
|
+
maxWidth?: number | string;
|
|
23
|
+
/** Accessible label for the progress navigation. @default "Progress" */
|
|
24
|
+
ariaLabel?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Canonical Fairmint shell for bounded multi-step flows.
|
|
28
|
+
*
|
|
29
|
+
* Horizontal flows pair step pills with one numbered content container. Vertical
|
|
30
|
+
* flows move the same progress pills into a rail beside the active container.
|
|
31
|
+
* The feature owns persistence, validation, and whether a step is safe to visit.
|
|
32
|
+
*/
|
|
33
|
+
export declare function StepFlow({ steps, activeStep, orientation, onStepChange, maxWidth, ariaLabel, }: StepFlowProps): import("react/jsx-runtime").JSX.Element | null;
|
|
34
|
+
export declare const STEP_FLOW_DEFAULT_MAX_WIDTH = 640;
|
|
35
|
+
//# sourceMappingURL=StepFlow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepFlow.d.ts","sourceRoot":"","sources":["../../../../src/components/generic/StepFlow/StepFlow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,gBAAgB,CAAC;AAIxB,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,UAAU,CAAC;AAE5D,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,OAAO,EAAE,SAAS,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,qFAAqF;IACrF,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,yFAAyF;IACzF,UAAU,EAAE,MAAM,CAAC;IACnB,oFAAoF;IACpF,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,+EAA+E;IAC/E,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA0BD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,UAAU,EACV,WAA0B,EAC1B,YAAY,EACZ,QAA4B,EAC5B,SAAsB,GACvB,EAAE,aAAa,kDAgCf;AAED,eAAO,MAAM,2BAA2B,MAAoB,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from "../../primitives/layout.js";
|
|
3
|
+
import { StepCard } from "../StepCard/StepCard.js";
|
|
4
|
+
import { StepProgress } from "../StepProgress/StepProgress.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
const DEFAULT_MAX_WIDTH = 640;
|
|
7
|
+
const MAX_WIDTH_TOKENS = {
|
|
8
|
+
xs: "444px",
|
|
9
|
+
sm: "600px",
|
|
10
|
+
md: "900px",
|
|
11
|
+
lg: "1200px",
|
|
12
|
+
xl: "1536px"
|
|
13
|
+
};
|
|
14
|
+
const resolveMaxWidth = (maxWidth) => {
|
|
15
|
+
if (typeof maxWidth === "number") return `${maxWidth}px`;
|
|
16
|
+
return MAX_WIDTH_TOKENS[maxWidth] ?? maxWidth;
|
|
17
|
+
};
|
|
18
|
+
const resolveActiveStep = (activeStep, stepCount) => {
|
|
19
|
+
if (!Number.isFinite(activeStep)) return 1;
|
|
20
|
+
return Math.min(Math.max(Math.trunc(activeStep), 1), stepCount);
|
|
21
|
+
};
|
|
22
|
+
const renderStepContent = (step, stepNumber, done) => /* @__PURE__ */ jsx(StepCard, { index: stepNumber, title: step.title, description: step.description, done, children: step.content });
|
|
23
|
+
function StepFlow({
|
|
24
|
+
steps,
|
|
25
|
+
activeStep,
|
|
26
|
+
orientation = "horizontal",
|
|
27
|
+
onStepChange,
|
|
28
|
+
maxWidth = DEFAULT_MAX_WIDTH,
|
|
29
|
+
ariaLabel = "Progress"
|
|
30
|
+
}) {
|
|
31
|
+
if (steps.length === 0) return null;
|
|
32
|
+
const resolvedActiveStep = resolveActiveStep(activeStep, steps.length);
|
|
33
|
+
const activeIndex = resolvedActiveStep - 1;
|
|
34
|
+
const activeStepData = steps[activeIndex];
|
|
35
|
+
const rootStyle = {
|
|
36
|
+
"--fairmint-step-flow-max-width": resolveMaxWidth(maxWidth)
|
|
37
|
+
};
|
|
38
|
+
return /* @__PURE__ */ jsxs(
|
|
39
|
+
Box,
|
|
40
|
+
{
|
|
41
|
+
className: "fairmint-step-flow",
|
|
42
|
+
"data-orientation": orientation,
|
|
43
|
+
"data-active-step": resolvedActiveStep,
|
|
44
|
+
style: rootStyle,
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
StepProgress,
|
|
48
|
+
{
|
|
49
|
+
steps,
|
|
50
|
+
activeStep: resolvedActiveStep,
|
|
51
|
+
orientation,
|
|
52
|
+
onStepChange,
|
|
53
|
+
ariaLabel
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
activeStepData && /* @__PURE__ */ jsx(Box, { className: "fairmint-step-flow__content", children: renderStepContent(activeStepData, resolvedActiveStep, activeStepData.completed ?? false) })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
const STEP_FLOW_DEFAULT_MAX_WIDTH = DEFAULT_MAX_WIDTH;
|
|
62
|
+
export {
|
|
63
|
+
STEP_FLOW_DEFAULT_MAX_WIDTH,
|
|
64
|
+
StepFlow
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=StepFlow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepFlow.js","sources":["../../../../src/components/generic/StepFlow/StepFlow.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { Box } from \"../../primitives/layout\";\nimport { StepCard } from \"../StepCard/StepCard\";\nimport { StepProgress, type StepProgressStep } from \"../StepProgress/StepProgress\";\nimport \"./StepFlow.css\";\n\nconst DEFAULT_MAX_WIDTH = 640;\n\nexport type StepFlowOrientation = \"horizontal\" | \"vertical\";\n\nexport interface StepFlowStep extends StepProgressStep {\n /** Heading shown inside the numbered content container. */\n title: string;\n /** Optional supporting text below the title. */\n description?: string;\n /** Content rendered inside the step container. */\n content: ReactNode;\n}\n\nexport interface StepFlowProps {\n /** Ordered steps. The visible number is derived from this array and is 1-indexed. */\n steps: readonly StepFlowStep[];\n /** Current step number. This is intentionally 1-indexed to match StepCard and the UI. */\n activeStep: number;\n /** Horizontal in-app progress or vertical onboarding rail. @default \"horizontal\" */\n orientation?: StepFlowOrientation;\n /** Called with the 1-indexed step number when a progress pill is activated. */\n onStepChange?: (step: number) => void;\n /** Maximum width of the shared flow shell. @default 640 */\n maxWidth?: number | string;\n /** Accessible label for the progress navigation. @default \"Progress\" */\n ariaLabel?: string;\n}\n\nconst MAX_WIDTH_TOKENS: Record<string, string> = {\n xs: \"444px\",\n sm: \"600px\",\n md: \"900px\",\n lg: \"1200px\",\n xl: \"1536px\",\n};\n\nconst resolveMaxWidth = (maxWidth: number | string) => {\n if (typeof maxWidth === \"number\") return `${maxWidth}px`;\n return MAX_WIDTH_TOKENS[maxWidth] ?? maxWidth;\n};\n\nconst resolveActiveStep = (activeStep: number, stepCount: number) => {\n if (!Number.isFinite(activeStep)) return 1;\n return Math.min(Math.max(Math.trunc(activeStep), 1), stepCount);\n};\n\nconst renderStepContent = (step: StepFlowStep, stepNumber: number, done: boolean) => (\n <StepCard index={stepNumber} title={step.title} description={step.description} done={done}>\n {step.content}\n </StepCard>\n);\n\n/**\n * Canonical Fairmint shell for bounded multi-step flows.\n *\n * Horizontal flows pair step pills with one numbered content container. Vertical\n * flows move the same progress pills into a rail beside the active container.\n * The feature owns persistence, validation, and whether a step is safe to visit.\n */\nexport function StepFlow({\n steps,\n activeStep,\n orientation = \"horizontal\",\n onStepChange,\n maxWidth = DEFAULT_MAX_WIDTH,\n ariaLabel = \"Progress\",\n}: StepFlowProps) {\n if (steps.length === 0) return null;\n\n const resolvedActiveStep = resolveActiveStep(activeStep, steps.length);\n const activeIndex = resolvedActiveStep - 1;\n const activeStepData = steps[activeIndex];\n const rootStyle = {\n \"--fairmint-step-flow-max-width\": resolveMaxWidth(maxWidth),\n };\n\n return (\n <Box\n className=\"fairmint-step-flow\"\n data-orientation={orientation}\n data-active-step={resolvedActiveStep}\n style={rootStyle}\n >\n <StepProgress\n steps={steps}\n activeStep={resolvedActiveStep}\n orientation={orientation}\n onStepChange={onStepChange}\n ariaLabel={ariaLabel}\n />\n\n {activeStepData && (\n <Box className=\"fairmint-step-flow__content\">\n {renderStepContent(activeStepData, resolvedActiveStep, activeStepData.completed ?? false)}\n </Box>\n )}\n </Box>\n );\n}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BACC,oBAAC,KAAA,EAAI,WAAU,+BACZ,UAAA,kBAAkB,gBAAgB,oBAAoB,eAAe,aAAa,KAAK,EAAA,CAC1F;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;AAEO,MAAM,8BAA8B;"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const index = require("../../../theme/index.cjs");
|
|
5
|
+
const layout = require("../../primitives/layout.cjs");
|
|
6
|
+
;/* empty css */
|
|
7
|
+
const UnstyledButton = require("../../../node_modules/@mantine/core/esm/components/UnstyledButton/UnstyledButton.cjs");
|
|
8
|
+
const CheckIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
|
|
9
|
+
"svg",
|
|
10
|
+
{
|
|
11
|
+
width: "14",
|
|
12
|
+
height: "14",
|
|
13
|
+
viewBox: "0 0 24 24",
|
|
14
|
+
fill: "none",
|
|
15
|
+
stroke: "currentColor",
|
|
16
|
+
strokeWidth: "2.5",
|
|
17
|
+
strokeLinecap: "round",
|
|
18
|
+
strokeLinejoin: "round",
|
|
19
|
+
"aria-hidden": "true",
|
|
20
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m5 13 4 4 10-10" })
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
const resolveActiveStep = (activeStep, stepCount) => {
|
|
24
|
+
if (!Number.isFinite(activeStep)) return 1;
|
|
25
|
+
return Math.min(Math.max(Math.trunc(activeStep), 1), stepCount);
|
|
26
|
+
};
|
|
27
|
+
const getStepProgressStatus = (step, stepNumber, activeStep) => {
|
|
28
|
+
if (stepNumber === activeStep) return "active";
|
|
29
|
+
if (step.completed ?? stepNumber < activeStep) return "complete";
|
|
30
|
+
return "pending";
|
|
31
|
+
};
|
|
32
|
+
function StepProgress({
|
|
33
|
+
steps,
|
|
34
|
+
activeStep,
|
|
35
|
+
orientation = "horizontal",
|
|
36
|
+
onStepChange,
|
|
37
|
+
ariaLabel = "Progress"
|
|
38
|
+
}) {
|
|
39
|
+
if (steps.length === 0) return null;
|
|
40
|
+
const resolvedActiveStep = resolveActiveStep(activeStep, steps.length);
|
|
41
|
+
const rootStyle = {
|
|
42
|
+
"--fairmint-step-progress-brand": index.brandColors.indigo,
|
|
43
|
+
"--fairmint-step-progress-border": index.fairmintVars.colorBorderDefault,
|
|
44
|
+
"--fairmint-step-progress-text-primary": index.fairmintVars.colorTextPrimary,
|
|
45
|
+
"--fairmint-step-progress-text-secondary": index.fairmintVars.colorTextSecondary,
|
|
46
|
+
"--fairmint-step-progress-surface-selected": index.fairmintVars.colorSurfaceSelected,
|
|
47
|
+
// One shared accent tone for anything bordering/reading on colorSurfaceSelected,
|
|
48
|
+
// instead of two adjacent-but-different indigo shades competing.
|
|
49
|
+
"--fairmint-step-progress-active-border": index.indigoColors[2],
|
|
50
|
+
"--fairmint-step-progress-active-indicator-text": index.commonColors.white,
|
|
51
|
+
"--fairmint-step-progress-complete-border": index.indigoColors[2],
|
|
52
|
+
"--fairmint-step-progress-complete-text": index.fairmintVars.colorIconOnSurfaceSelected
|
|
53
|
+
};
|
|
54
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
55
|
+
layout.Box,
|
|
56
|
+
{
|
|
57
|
+
component: "nav",
|
|
58
|
+
"aria-label": ariaLabel,
|
|
59
|
+
className: "fairmint-step-progress",
|
|
60
|
+
"data-orientation": orientation,
|
|
61
|
+
style: rootStyle,
|
|
62
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "fairmint-step-progress__list", children: steps.map((step, index2) => {
|
|
63
|
+
const stepNumber = index2 + 1;
|
|
64
|
+
const status = getStepProgressStatus(step, stepNumber, resolvedActiveStep);
|
|
65
|
+
const isInteractive = Boolean(onStepChange) && !step.disabled;
|
|
66
|
+
const pillContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
67
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "fairmint-step-progress__indicator", "aria-hidden": "true", children: status === "complete" ? /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, {}) : stepNumber }),
|
|
68
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "fairmint-step-progress__label", children: step.label })
|
|
69
|
+
] });
|
|
70
|
+
return /* @__PURE__ */ jsxRuntime.jsx("li", { className: "fairmint-step-progress__item", children: isInteractive ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
71
|
+
UnstyledButton.UnstyledButton,
|
|
72
|
+
{
|
|
73
|
+
type: "button",
|
|
74
|
+
className: "fairmint-step-progress__pill",
|
|
75
|
+
"data-state": status,
|
|
76
|
+
"data-interactive": "true",
|
|
77
|
+
"aria-current": status === "active" ? "step" : void 0,
|
|
78
|
+
"aria-label": `Step ${stepNumber}: ${step.label}`,
|
|
79
|
+
onClick: () => onStepChange?.(stepNumber),
|
|
80
|
+
children: pillContent
|
|
81
|
+
}
|
|
82
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
83
|
+
"span",
|
|
84
|
+
{
|
|
85
|
+
className: "fairmint-step-progress__pill",
|
|
86
|
+
"data-state": status,
|
|
87
|
+
"aria-current": status === "active" ? "step" : void 0,
|
|
88
|
+
title: `Step ${stepNumber}: ${step.label}`,
|
|
89
|
+
children: pillContent
|
|
90
|
+
}
|
|
91
|
+
) }, `${stepNumber}-${step.label}`);
|
|
92
|
+
}) })
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
const STEP_PROGRESS_MOBILE_BREAKPOINT = "48em";
|
|
97
|
+
exports.STEP_PROGRESS_MOBILE_BREAKPOINT = STEP_PROGRESS_MOBILE_BREAKPOINT;
|
|
98
|
+
exports.StepProgress = StepProgress;
|
|
99
|
+
exports.getStepProgressStatus = getStepProgressStatus;
|
|
100
|
+
//# sourceMappingURL=StepProgress.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepProgress.cjs","sources":["../../../../src/components/generic/StepProgress/StepProgress.tsx"],"sourcesContent":["import { brandColors, commonColors, fairmintVars, indigoColors } from \"../../../theme\";\nimport { Box, UnstyledButton } from \"../../primitives/layout\";\nimport \"./StepProgress.css\";\n\nexport type StepProgressOrientation = \"horizontal\" | \"vertical\";\nexport type StepProgressStepStatus = \"complete\" | \"active\" | \"pending\";\n\nexport interface StepProgressStep {\n /** Visible label in the progress pill. */\n label: string;\n /** Explicitly mark a step complete when completion is not derived from activeStep. */\n completed?: boolean;\n /** Prevent navigation to this step when onStepChange is supplied. */\n disabled?: boolean;\n}\n\nexport interface StepProgressProps {\n /** Ordered steps. The visible number is derived from this array and is 1-indexed. */\n steps: readonly StepProgressStep[];\n /** Current step number. This is intentionally 1-indexed to match StepCard and the UI. */\n activeStep: number;\n /** Row of pills for in-app progress or a rail for onboarding. @default \"horizontal\" */\n orientation?: StepProgressOrientation;\n /** Called with the 1-indexed step number when a pill is activated. */\n onStepChange?: (step: number) => void;\n /** Accessible label for the navigation. @default \"Progress\" */\n ariaLabel?: string;\n}\n\nconst CheckIcon = () => (\n <svg\n width=\"14\"\n height=\"14\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m5 13 4 4 10-10\" />\n </svg>\n);\n\nconst resolveActiveStep = (activeStep: number, stepCount: number) => {\n if (!Number.isFinite(activeStep)) return 1;\n return Math.min(Math.max(Math.trunc(activeStep), 1), stepCount);\n};\n\nexport const getStepProgressStatus = (\n step: StepProgressStep,\n stepNumber: number,\n activeStep: number,\n): StepProgressStepStatus => {\n if (stepNumber === activeStep) return \"active\";\n if (step.completed ?? stepNumber < activeStep) return \"complete\";\n return \"pending\";\n};\n\n/**\n * Numbered progress pills shared by horizontal in-app flows and vertical\n * onboarding rails. Owns navigation only — the numbered content container is\n * `StepCard`, and `StepFlow` pairs the two into the canonical shell.\n */\nexport function StepProgress({\n steps,\n activeStep,\n orientation = \"horizontal\",\n onStepChange,\n ariaLabel = \"Progress\",\n}: StepProgressProps) {\n if (steps.length === 0) return null;\n\n const resolvedActiveStep = resolveActiveStep(activeStep, steps.length);\n const rootStyle = {\n \"--fairmint-step-progress-brand\": brandColors.indigo,\n \"--fairmint-step-progress-border\": fairmintVars.colorBorderDefault,\n \"--fairmint-step-progress-text-primary\": fairmintVars.colorTextPrimary,\n \"--fairmint-step-progress-text-secondary\": fairmintVars.colorTextSecondary,\n \"--fairmint-step-progress-surface-selected\": fairmintVars.colorSurfaceSelected,\n // One shared accent tone for anything bordering/reading on colorSurfaceSelected,\n // instead of two adjacent-but-different indigo shades competing.\n \"--fairmint-step-progress-active-border\": indigoColors[2],\n \"--fairmint-step-progress-active-indicator-text\": commonColors.white,\n \"--fairmint-step-progress-complete-border\": indigoColors[2],\n \"--fairmint-step-progress-complete-text\": fairmintVars.colorIconOnSurfaceSelected,\n };\n\n return (\n <Box\n component=\"nav\"\n aria-label={ariaLabel}\n className=\"fairmint-step-progress\"\n data-orientation={orientation}\n style={rootStyle}\n >\n <ol className=\"fairmint-step-progress__list\">\n {steps.map((step, index) => {\n const stepNumber = index + 1;\n const status = getStepProgressStatus(step, stepNumber, resolvedActiveStep);\n const isInteractive = Boolean(onStepChange) && !step.disabled;\n const pillContent = (\n <>\n <span className=\"fairmint-step-progress__indicator\" aria-hidden=\"true\">\n {status === \"complete\" ? <CheckIcon /> : stepNumber}\n </span>\n <span className=\"fairmint-step-progress__label\">{step.label}</span>\n </>\n );\n\n return (\n <li key={`${stepNumber}-${step.label}`} className=\"fairmint-step-progress__item\">\n {isInteractive ? (\n <UnstyledButton\n type=\"button\"\n className=\"fairmint-step-progress__pill\"\n data-state={status}\n data-interactive=\"true\"\n aria-current={status === \"active\" ? \"step\" : undefined}\n aria-label={`Step ${stepNumber}: ${step.label}`}\n onClick={() => onStepChange?.(stepNumber)}\n >\n {pillContent}\n </UnstyledButton>\n ) : (\n <span\n className=\"fairmint-step-progress__pill\"\n data-state={status}\n aria-current={status === \"active\" ? \"step\" : undefined}\n title={`Step ${stepNumber}: ${step.label}`}\n >\n {pillContent}\n </span>\n )}\n </li>\n );\n })}\n </ol>\n </Box>\n );\n}\n\nexport const STEP_PROGRESS_MOBILE_BREAKPOINT = \"48em\";\n"],"names":["jsx","brandColors","fairmintVars","indigoColors","commonColors","Box","index","jsxs","Fragment","UnstyledButton"],"mappings":";;;;;;;AA6BA,MAAM,YAAY,MAChBA,2BAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,aAAY;AAAA,IACZ,eAAc;AAAA,IACd,gBAAe;AAAA,IACf,eAAY;AAAA,IAEZ,UAAAA,2BAAAA,IAAC,QAAA,EAAK,GAAE,kBAAA,CAAkB;AAAA,EAAA;AAC5B;AAGF,MAAM,oBAAoB,CAAC,YAAoB,cAAsB;AACnE,MAAI,CAAC,OAAO,SAAS,UAAU,EAAG,QAAO;AACzC,SAAO,KAAK,IAAI,KAAK,IAAI,KAAK,MAAM,UAAU,GAAG,CAAC,GAAG,SAAS;AAChE;AAEO,MAAM,wBAAwB,CACnC,MACA,YACA,eAC2B;AAC3B,MAAI,eAAe,WAAY,QAAO;AACtC,MAAI,KAAK,aAAa,aAAa,WAAY,QAAO;AACtD,SAAO;AACT;AAOO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA,YAAY;AACd,GAAsB;AACpB,MAAI,MAAM,WAAW,EAAG,QAAO;AAE/B,QAAM,qBAAqB,kBAAkB,YAAY,MAAM,MAAM;AACrE,QAAM,YAAY;AAAA,IAChB,kCAAkCC,MAAAA,YAAY;AAAA,IAC9C,mCAAmCC,MAAAA,aAAa;AAAA,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C,UAAA;AAAA,UAAA;AAAA,QAAA,IAGHT,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,cAAY;AAAA,YACZ,gBAAc,WAAW,WAAW,SAAS;AAAA,YAC7C,OAAO,QAAQ,UAAU,KAAK,KAAK,KAAK;AAAA,YAEvC,UAAA;AAAA,UAAA;AAAA,QAAA,KApBE,GAAG,UAAU,IAAI,KAAK,KAAK,EAuBpC;AAAA,MAEJ,CAAC,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;AAEO,MAAM,kCAAkC;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type StepProgressOrientation = "horizontal" | "vertical";
|
|
2
|
+
export type StepProgressStepStatus = "complete" | "active" | "pending";
|
|
3
|
+
export interface StepProgressStep {
|
|
4
|
+
/** Visible label in the progress pill. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Explicitly mark a step complete when completion is not derived from activeStep. */
|
|
7
|
+
completed?: boolean;
|
|
8
|
+
/** Prevent navigation to this step when onStepChange is supplied. */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface StepProgressProps {
|
|
12
|
+
/** Ordered steps. The visible number is derived from this array and is 1-indexed. */
|
|
13
|
+
steps: readonly StepProgressStep[];
|
|
14
|
+
/** Current step number. This is intentionally 1-indexed to match StepCard and the UI. */
|
|
15
|
+
activeStep: number;
|
|
16
|
+
/** Row of pills for in-app progress or a rail for onboarding. @default "horizontal" */
|
|
17
|
+
orientation?: StepProgressOrientation;
|
|
18
|
+
/** Called with the 1-indexed step number when a pill is activated. */
|
|
19
|
+
onStepChange?: (step: number) => void;
|
|
20
|
+
/** Accessible label for the navigation. @default "Progress" */
|
|
21
|
+
ariaLabel?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const getStepProgressStatus: (step: StepProgressStep, stepNumber: number, activeStep: number) => StepProgressStepStatus;
|
|
24
|
+
/**
|
|
25
|
+
* Numbered progress pills shared by horizontal in-app flows and vertical
|
|
26
|
+
* onboarding rails. Owns navigation only — the numbered content container is
|
|
27
|
+
* `StepCard`, and `StepFlow` pairs the two into the canonical shell.
|
|
28
|
+
*/
|
|
29
|
+
export declare function StepProgress({ steps, activeStep, orientation, onStepChange, ariaLabel, }: StepProgressProps): import("react/jsx-runtime").JSX.Element | null;
|
|
30
|
+
export declare const STEP_PROGRESS_MOBILE_BREAKPOINT = "48em";
|
|
31
|
+
//# sourceMappingURL=StepProgress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepProgress.d.ts","sourceRoot":"","sources":["../../../../src/components/generic/StepProgress/StepProgress.tsx"],"names":[],"mappings":"AAEA,OAAO,oBAAoB,CAAC;AAE5B,MAAM,MAAM,uBAAuB,GAAG,YAAY,GAAG,UAAU,CAAC;AAChE,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEvE,MAAM,WAAW,gBAAgB;IAC/B,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,sFAAsF;IACtF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,qFAAqF;IACrF,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACnC,yFAAyF;IACzF,UAAU,EAAE,MAAM,CAAC;IACnB,uFAAuF;IACvF,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,sEAAsE;IACtE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAuBD,eAAO,MAAM,qBAAqB,GAChC,MAAM,gBAAgB,EACtB,YAAY,MAAM,EAClB,YAAY,MAAM,KACjB,sBAIF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,UAAU,EACV,WAA0B,EAC1B,YAAY,EACZ,SAAsB,GACvB,EAAE,iBAAiB,kDAsEnB;AAED,eAAO,MAAM,+BAA+B,SAAS,CAAC"}
|