@fairmint/ui 0.4.18 → 0.4.19
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/_virtual/index3.cjs +5 -3
- package/dist/_virtual/index3.cjs.map +1 -1
- package/dist/_virtual/index3.js +5 -2
- package/dist/_virtual/index3.js.map +1 -1
- package/dist/_virtual/index4.cjs +3 -5
- package/dist/_virtual/index4.cjs.map +1 -1
- package/dist/_virtual/index4.js +2 -5
- package/dist/_virtual/index4.js.map +1 -1
- package/dist/components/generic/StepProgress/StepProgress.cjs +5 -1
- package/dist/components/generic/StepProgress/StepProgress.cjs.map +1 -1
- package/dist/components/generic/StepProgress/StepProgress.d.ts.map +1 -1
- package/dist/components/generic/StepProgress/StepProgress.js +6 -2
- package/dist/components/generic/StepProgress/StepProgress.js.map +1 -1
- package/dist/node_modules/@mantine/form/esm/hooks/use-form-status/use-form-status.cjs +1 -1
- package/dist/node_modules/@mantine/form/esm/hooks/use-form-status/use-form-status.js +1 -1
- package/dist/node_modules/prop-types/index.cjs +1 -1
- package/dist/node_modules/prop-types/index.js +1 -1
- package/dist/styles.css +8 -3
- package/package.json +1 -1
package/dist/_virtual/index3.cjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const _commonjsHelpers = require("./_commonjsHelpers.cjs");
|
|
3
|
+
const index = require("../node_modules/fast-deep-equal/index.cjs");
|
|
4
|
+
var fastDeepEqualExports = index.__require();
|
|
5
|
+
const isEqual = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(fastDeepEqualExports);
|
|
6
|
+
module.exports = isEqual;
|
|
5
7
|
//# sourceMappingURL=index3.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index3.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index3.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
package/dist/_virtual/index3.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { getDefaultExportFromCjs } from "./_commonjsHelpers.js";
|
|
2
|
+
import { __require as requireFastDeepEqual } from "../node_modules/fast-deep-equal/index.js";
|
|
3
|
+
var fastDeepEqualExports = requireFastDeepEqual();
|
|
4
|
+
const isEqual = /* @__PURE__ */ getDefaultExportFromCjs(fastDeepEqualExports);
|
|
2
5
|
export {
|
|
3
|
-
|
|
6
|
+
isEqual as default
|
|
4
7
|
};
|
|
5
8
|
//# sourceMappingURL=index3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index3.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/dist/_virtual/index4.cjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const isEqual = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(fastDeepEqualExports);
|
|
6
|
-
module.exports = isEqual;
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
var propTypes = { exports: {} };
|
|
4
|
+
exports.__module = propTypes;
|
|
7
5
|
//# sourceMappingURL=index4.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index4.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index4.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/dist/_virtual/index4.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { __require as requireFastDeepEqual } from "../node_modules/fast-deep-equal/index.js";
|
|
3
|
-
var fastDeepEqualExports = requireFastDeepEqual();
|
|
4
|
-
const isEqual = /* @__PURE__ */ getDefaultExportFromCjs(fastDeepEqualExports);
|
|
1
|
+
var propTypes = { exports: {} };
|
|
5
2
|
export {
|
|
6
|
-
|
|
3
|
+
propTypes as __module
|
|
7
4
|
};
|
|
8
5
|
//# sourceMappingURL=index4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index4.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index4.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -94,12 +94,16 @@ function StepProgress({
|
|
|
94
94
|
// indigo[1] — surface-selected (indigo[0]) is too close to the secondary canvas.
|
|
95
95
|
"--fairmint-step-progress-surface-selected": index.fairmintVars.colorBgBrandSubtleHover,
|
|
96
96
|
"--fairmint-step-progress-active-border": index.indigoColors[3],
|
|
97
|
-
|
|
97
|
+
// Not brand indigo: no ink clears AA on it. Both follow the scheme, giving white on
|
|
98
|
+
// indigo[6] (6.29:1) in light and dark ink on indigo[2] (11.8:1) in dark.
|
|
99
|
+
"--fairmint-step-progress-active-indicator": index.fairmintVars.colorIconOnSurfaceSelected,
|
|
100
|
+
"--fairmint-step-progress-active-indicator-text": index.fairmintVars.colorTextInverse,
|
|
98
101
|
"--fairmint-step-progress-complete-border": index.indigoColors[3],
|
|
99
102
|
"--fairmint-step-progress-complete-text": index.fairmintVars.colorIconOnSurfaceSelected,
|
|
100
103
|
// The detail line is the one place that needs muted ink; pending labels above it stay primary.
|
|
101
104
|
"--fairmint-step-progress-detail": index.fairmintVars.colorTextSecondary,
|
|
102
105
|
"--fairmint-step-progress-stopped": index.fairmintVars.colorErrorSolid,
|
|
106
|
+
"--fairmint-step-progress-stopped-indicator-text": index.commonColors.white,
|
|
103
107
|
"--fairmint-step-progress-stopped-text": index.fairmintVars.colorErrorText,
|
|
104
108
|
// Status rows lay out as a grid; the last column never stretches, so it stays flush right.
|
|
105
109
|
"--fairmint-step-progress-columns": steps.length > 1 ? `repeat(${steps.length - 1}, auto) minmax(min-content, max-content)` : "minmax(min-content, max-content)"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepProgress.cjs","sources":["../../../../src/components/generic/StepProgress/StepProgress.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { brandColors, commonColors, fairmintVars, indigoColors } from \"../../../theme\";\nimport { Box, UnstyledButton } from \"../../primitives/layout\";\nimport \"./StepProgress.css\";\n\nexport type StepProgressOrientation = \"horizontal\" | \"vertical\";\nexport type StepProgressVariant = \"navigation\" | \"status\";\nexport type StepProgressStepStatus = \"complete\" | \"active\" | \"pending\" | \"stopped\";\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 /** Second line under the label, such as when the step happened. Shown by the status variant only. */\n detail?: string;\n /** The record stopped at this step (rejected, failed, cancelled). Shown by the status variant only. */\n stopped?: 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 /**\n * `navigation` is where the user is in a flow they are filling in. `status` is where a\n * record is in its lifecycle: read-only, no pill, and each step can carry a `detail`.\n * @default \"navigation\"\n */\n variant?: StepProgressVariant;\n /** Called with the 1-indexed step number when a pill is activated. Ignored by the status variant. */\n onStepChange?: (step: number) => void;\n /** Accessible label for the navigation. @default \"Progress\" */\n ariaLabel?: string;\n}\n\nconst CheckIcon = () => (\n <svg\n width=\"11\"\n height=\"11\"\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 StopIcon = () => (\n <svg\n width=\"11\"\n height=\"11\"\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=\"M7 7l10 10M17 7 7 17\" />\n </svg>\n);\n\nconst STATUS_TEXT: Readonly<Record<StepProgressStepStatus, string | undefined>> = {\n complete: \"(done)\",\n active: undefined,\n pending: undefined,\n stopped: \"(stopped)\",\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 variant: StepProgressVariant = \"navigation\",\n): StepProgressStepStatus => {\n if (variant === \"status\") {\n if (step.stopped) return \"stopped\";\n // A finished record has no current step: its last step is done, not in progress.\n if (step.completed) return \"complete\";\n }\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 *\n * The `status` variant reuses the same anatomy as a read-only lifecycle track,\n * so a record's progress and a flow's progress look like one component.\n */\nexport function StepProgress({\n steps,\n activeStep,\n orientation = \"horizontal\",\n variant = \"navigation\",\n onStepChange,\n ariaLabel = \"Progress\",\n}: StepProgressProps) {\n const listRef = useRef<HTMLOListElement>(null);\n const resolvedActiveStep = resolveActiveStep(activeStep, Math.max(steps.length, 1));\n\n // When the row scrolls, keep the current step in view as it changes. Scrolls the\n // list only — scrollIntoView would also move the page to the progress row.\n useEffect(() => {\n const list = listRef.current;\n const pill = list?.children[resolvedActiveStep - 1]?.querySelector<HTMLElement>(\n \".fairmint-step-progress__pill\",\n );\n if (!list || !pill || list.scrollWidth <= list.clientWidth) return;\n const listBox = list.getBoundingClientRect();\n const pillBox = pill.getBoundingClientRect();\n if (pillBox.left < listBox.left) {\n list.scrollLeft -= listBox.left - pillBox.left;\n } else if (pillBox.right > listBox.right) {\n list.scrollLeft += pillBox.right - listBox.right;\n }\n }, [resolvedActiveStep]);\n\n if (steps.length === 0) return null;\n\n const isStatus = variant === \"status\";\n const rootStyle = {\n \"--fairmint-step-progress-brand\": brandColors.indigo,\n // colorBorderDefault washes out on colorBgSurfaceSecondary; text-secondary clears 3:1.\n \"--fairmint-step-progress-border\": fairmintVars.colorTextSecondary,\n // Kept off the ring token: the ring carries the step number and needs 3:1, the\n // connector is decorative and reads as a hairline between pills.\n \"--fairmint-step-progress-connector\": fairmintVars.colorBorderDefault,\n \"--fairmint-step-progress-text-primary\": fairmintVars.colorTextPrimary,\n // Pending labels use primary ink; active hierarchy is weight + fill, not mute gray.\n \"--fairmint-step-progress-text-secondary\": fairmintVars.colorTextPrimary,\n // indigo[1] — surface-selected (indigo[0]) is too close to the secondary canvas.\n \"--fairmint-step-progress-surface-selected\": fairmintVars.colorBgBrandSubtleHover,\n \"--fairmint-step-progress-active-border\": indigoColors[3],\n \"--fairmint-step-progress-active-indicator-text\": commonColors.white,\n \"--fairmint-step-progress-complete-border\": indigoColors[3],\n \"--fairmint-step-progress-complete-text\": fairmintVars.colorIconOnSurfaceSelected,\n // The detail line is the one place that needs muted ink; pending labels above it stay primary.\n \"--fairmint-step-progress-detail\": fairmintVars.colorTextSecondary,\n \"--fairmint-step-progress-stopped\": fairmintVars.colorErrorSolid,\n \"--fairmint-step-progress-stopped-text\": fairmintVars.colorErrorText,\n // Status rows lay out as a grid; the last column never stretches, so it stays flush right.\n \"--fairmint-step-progress-columns\":\n steps.length > 1\n ? `repeat(${steps.length - 1}, auto) minmax(min-content, max-content)`\n : \"minmax(min-content, max-content)\",\n };\n\n return (\n <Box\n // A status track is not navigation: nothing in it goes anywhere.\n component={isStatus ? \"div\" : \"nav\"}\n role={isStatus ? \"group\" : undefined}\n aria-label={ariaLabel}\n className=\"fairmint-step-progress\"\n data-orientation={orientation}\n data-variant={variant}\n style={rootStyle}\n >\n <ol ref={listRef} className=\"fairmint-step-progress__list\">\n {steps.map((step, index) => {\n const stepNumber = index + 1;\n const status = getStepProgressStatus(step, stepNumber, resolvedActiveStep, variant);\n const isInteractive = !isStatus && Boolean(onStepChange) && !step.disabled;\n const detail = isStatus ? step.detail : undefined;\n // The indicator icons are aria-hidden, so a status track says done and stopped in words.\n const statusText = isStatus ? STATUS_TEXT[status] : undefined;\n const pillContent = (\n <>\n <span className=\"fairmint-step-progress__indicator\" aria-hidden=\"true\">\n {status === \"complete\" ? (\n <CheckIcon />\n ) : status === \"stopped\" ? (\n <StopIcon />\n ) : (\n stepNumber\n )}\n </span>\n {detail ? (\n <span className=\"fairmint-step-progress__text\">\n <span className=\"fairmint-step-progress__label\">{step.label}</span>\n <span className=\"fairmint-step-progress__detail\">{detail}</span>\n </span>\n ) : (\n <span className=\"fairmint-step-progress__label\">{step.label}</span>\n )}\n {statusText ? (\n <span className=\"fairmint-step-progress__status-text\">{statusText}</span>\n ) : null}\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 data-disabled=\"false\"\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 data-disabled={step.disabled ? \"true\" : \"false\"}\n aria-current={status === \"active\" ? \"step\" : undefined}\n aria-disabled={step.disabled || undefined}\n title={`Step ${stepNumber}: ${step.label}`}\n >\n {pillContent}\n </span>\n )}\n {index < steps.length - 1 ? (\n <span\n className=\"fairmint-step-progress__connector\"\n data-state={status}\n aria-hidden=\"true\"\n />\n ) : null}\n </li>\n );\n })}\n </ol>\n </Box>\n );\n}\n\nexport const STEP_PROGRESS_MOBILE_BREAKPOINT = \"48em\";\n"],"names":["jsx","useRef","useEffect","brandColors","fairmintVars","indigoColors","commonColors","Box","index","jsxs","Fragment","UnstyledButton"],"mappings":";;;;;;;;AAyCA,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,WAAW,MACfA,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,uBAAA,CAAuB;AAAA,EAAA;AACjC;AAGF,MAAM,cAA4E;AAAA,EAChF,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AACX;AAEA,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,YACA,UAA+B,iBACJ;AAC3B,MAAI,YAAY,UAAU;AACxB,QAAI,KAAK,QA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],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { brandColors, commonColors, fairmintVars, indigoColors } from \"../../../theme\";\nimport { Box, UnstyledButton } from \"../../primitives/layout\";\nimport \"./StepProgress.css\";\n\nexport type StepProgressOrientation = \"horizontal\" | \"vertical\";\nexport type StepProgressVariant = \"navigation\" | \"status\";\nexport type StepProgressStepStatus = \"complete\" | \"active\" | \"pending\" | \"stopped\";\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 /** Second line under the label, such as when the step happened. Shown by the status variant only. */\n detail?: string;\n /** The record stopped at this step (rejected, failed, cancelled). Shown by the status variant only. */\n stopped?: 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 /**\n * `navigation` is where the user is in a flow they are filling in. `status` is where a\n * record is in its lifecycle: read-only, no pill, and each step can carry a `detail`.\n * @default \"navigation\"\n */\n variant?: StepProgressVariant;\n /** Called with the 1-indexed step number when a pill is activated. Ignored by the status variant. */\n onStepChange?: (step: number) => void;\n /** Accessible label for the navigation. @default \"Progress\" */\n ariaLabel?: string;\n}\n\nconst CheckIcon = () => (\n <svg\n width=\"11\"\n height=\"11\"\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 StopIcon = () => (\n <svg\n width=\"11\"\n height=\"11\"\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=\"M7 7l10 10M17 7 7 17\" />\n </svg>\n);\n\nconst STATUS_TEXT: Readonly<Record<StepProgressStepStatus, string | undefined>> = {\n complete: \"(done)\",\n active: undefined,\n pending: undefined,\n stopped: \"(stopped)\",\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 variant: StepProgressVariant = \"navigation\",\n): StepProgressStepStatus => {\n if (variant === \"status\") {\n if (step.stopped) return \"stopped\";\n // A finished record has no current step: its last step is done, not in progress.\n if (step.completed) return \"complete\";\n }\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 *\n * The `status` variant reuses the same anatomy as a read-only lifecycle track,\n * so a record's progress and a flow's progress look like one component.\n */\nexport function StepProgress({\n steps,\n activeStep,\n orientation = \"horizontal\",\n variant = \"navigation\",\n onStepChange,\n ariaLabel = \"Progress\",\n}: StepProgressProps) {\n const listRef = useRef<HTMLOListElement>(null);\n const resolvedActiveStep = resolveActiveStep(activeStep, Math.max(steps.length, 1));\n\n // When the row scrolls, keep the current step in view as it changes. Scrolls the\n // list only — scrollIntoView would also move the page to the progress row.\n useEffect(() => {\n const list = listRef.current;\n const pill = list?.children[resolvedActiveStep - 1]?.querySelector<HTMLElement>(\n \".fairmint-step-progress__pill\",\n );\n if (!list || !pill || list.scrollWidth <= list.clientWidth) return;\n const listBox = list.getBoundingClientRect();\n const pillBox = pill.getBoundingClientRect();\n if (pillBox.left < listBox.left) {\n list.scrollLeft -= listBox.left - pillBox.left;\n } else if (pillBox.right > listBox.right) {\n list.scrollLeft += pillBox.right - listBox.right;\n }\n }, [resolvedActiveStep]);\n\n if (steps.length === 0) return null;\n\n const isStatus = variant === \"status\";\n const rootStyle = {\n \"--fairmint-step-progress-brand\": brandColors.indigo,\n // colorBorderDefault washes out on colorBgSurfaceSecondary; text-secondary clears 3:1.\n \"--fairmint-step-progress-border\": fairmintVars.colorTextSecondary,\n // Kept off the ring token: the ring carries the step number and needs 3:1, the\n // connector is decorative and reads as a hairline between pills.\n \"--fairmint-step-progress-connector\": fairmintVars.colorBorderDefault,\n \"--fairmint-step-progress-text-primary\": fairmintVars.colorTextPrimary,\n // Pending labels use primary ink; active hierarchy is weight + fill, not mute gray.\n \"--fairmint-step-progress-text-secondary\": fairmintVars.colorTextPrimary,\n // indigo[1] — surface-selected (indigo[0]) is too close to the secondary canvas.\n \"--fairmint-step-progress-surface-selected\": fairmintVars.colorBgBrandSubtleHover,\n \"--fairmint-step-progress-active-border\": indigoColors[3],\n // Not brand indigo: no ink clears AA on it. Both follow the scheme, giving white on\n // indigo[6] (6.29:1) in light and dark ink on indigo[2] (11.8:1) in dark.\n \"--fairmint-step-progress-active-indicator\": fairmintVars.colorIconOnSurfaceSelected,\n \"--fairmint-step-progress-active-indicator-text\": fairmintVars.colorTextInverse,\n \"--fairmint-step-progress-complete-border\": indigoColors[3],\n \"--fairmint-step-progress-complete-text\": fairmintVars.colorIconOnSurfaceSelected,\n // The detail line is the one place that needs muted ink; pending labels above it stay primary.\n \"--fairmint-step-progress-detail\": fairmintVars.colorTextSecondary,\n \"--fairmint-step-progress-stopped\": fairmintVars.colorErrorSolid,\n \"--fairmint-step-progress-stopped-indicator-text\": commonColors.white,\n \"--fairmint-step-progress-stopped-text\": fairmintVars.colorErrorText,\n // Status rows lay out as a grid; the last column never stretches, so it stays flush right.\n \"--fairmint-step-progress-columns\":\n steps.length > 1\n ? `repeat(${steps.length - 1}, auto) minmax(min-content, max-content)`\n : \"minmax(min-content, max-content)\",\n };\n\n return (\n <Box\n // A status track is not navigation: nothing in it goes anywhere.\n component={isStatus ? \"div\" : \"nav\"}\n role={isStatus ? \"group\" : undefined}\n aria-label={ariaLabel}\n className=\"fairmint-step-progress\"\n data-orientation={orientation}\n data-variant={variant}\n style={rootStyle}\n >\n <ol ref={listRef} className=\"fairmint-step-progress__list\">\n {steps.map((step, index) => {\n const stepNumber = index + 1;\n const status = getStepProgressStatus(step, stepNumber, resolvedActiveStep, variant);\n const isInteractive = !isStatus && Boolean(onStepChange) && !step.disabled;\n const detail = isStatus ? step.detail : undefined;\n // The indicator icons are aria-hidden, so a status track says done and stopped in words.\n const statusText = isStatus ? STATUS_TEXT[status] : undefined;\n const pillContent = (\n <>\n <span className=\"fairmint-step-progress__indicator\" aria-hidden=\"true\">\n {status === \"complete\" ? (\n <CheckIcon />\n ) : status === \"stopped\" ? (\n <StopIcon />\n ) : (\n stepNumber\n )}\n </span>\n {detail ? (\n <span className=\"fairmint-step-progress__text\">\n <span className=\"fairmint-step-progress__label\">{step.label}</span>\n <span className=\"fairmint-step-progress__detail\">{detail}</span>\n </span>\n ) : (\n <span className=\"fairmint-step-progress__label\">{step.label}</span>\n )}\n {statusText ? (\n <span className=\"fairmint-step-progress__status-text\">{statusText}</span>\n ) : null}\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 data-disabled=\"false\"\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 data-disabled={step.disabled ? \"true\" : \"false\"}\n aria-current={status === \"active\" ? \"step\" : undefined}\n aria-disabled={step.disabled || undefined}\n title={`Step ${stepNumber}: ${step.label}`}\n >\n {pillContent}\n </span>\n )}\n {index < steps.length - 1 ? (\n <span\n className=\"fairmint-step-progress__connector\"\n data-state={status}\n aria-hidden=\"true\"\n />\n ) : null}\n </li>\n );\n })}\n </ol>\n </Box>\n );\n}\n\nexport const STEP_PROGRESS_MOBILE_BREAKPOINT = \"48em\";\n"],"names":["jsx","useRef","useEffect","brandColors","fairmintVars","indigoColors","commonColors","Box","index","jsxs","Fragment","UnstyledButton"],"mappings":";;;;;;;;AAyCA,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,WAAW,MACfA,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,uBAAA,CAAuB;AAAA,EAAA;AACjC;AAGF,MAAM,cAA4E;AAAA,EAChF,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AACX;AAEA,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,YACA,UAA+B,iBACJ;A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AA,IAAA;AAAA,EAAA;AAGN;AAEO,MAAM,kCAAkC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepProgress.d.ts","sourceRoot":"","sources":["../../../../src/components/generic/StepProgress/StepProgress.tsx"],"names":[],"mappings":"AAGA,OAAO,oBAAoB,CAAC;AAE5B,MAAM,MAAM,uBAAuB,GAAG,YAAY,GAAG,UAAU,CAAC;AAChE,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,QAAQ,CAAC;AAC1D,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAEnF,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;IACnB,qGAAqG;IACrG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uGAAuG;IACvG,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;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;;;;OAIG;IACH,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,qGAAqG;IACrG,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA8CD,eAAO,MAAM,qBAAqB,GAChC,MAAM,gBAAgB,EACtB,YAAY,MAAM,EAClB,YAAY,MAAM,EAClB,UAAS,mBAAkC,KAC1C,sBASF,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,UAAU,EACV,WAA0B,EAC1B,OAAsB,EACtB,YAAY,EACZ,SAAsB,GACvB,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"StepProgress.d.ts","sourceRoot":"","sources":["../../../../src/components/generic/StepProgress/StepProgress.tsx"],"names":[],"mappings":"AAGA,OAAO,oBAAoB,CAAC;AAE5B,MAAM,MAAM,uBAAuB,GAAG,YAAY,GAAG,UAAU,CAAC;AAChE,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,QAAQ,CAAC;AAC1D,MAAM,MAAM,sBAAsB,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAEnF,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;IACnB,qGAAqG;IACrG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uGAAuG;IACvG,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;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;;;;OAIG;IACH,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,qGAAqG;IACrG,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA8CD,eAAO,MAAM,qBAAqB,GAChC,MAAM,gBAAgB,EACtB,YAAY,MAAM,EAClB,YAAY,MAAM,EAClB,UAAS,mBAAkC,KAC1C,sBASF,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,UAAU,EACV,WAA0B,EAC1B,OAAsB,EACtB,YAAY,EACZ,SAAsB,GACvB,EAAE,iBAAiB,sCA2InB;AAED,eAAO,MAAM,+BAA+B,SAAS,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, useEffect } from "react";
|
|
3
|
-
import { fairmintVars,
|
|
3
|
+
import { fairmintVars, commonColors, indigoColors, brandColors } from "../../../theme/index.js";
|
|
4
4
|
import { Box } from "../../primitives/layout.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { UnstyledButton } from "../../../node_modules/@mantine/core/esm/components/UnstyledButton/UnstyledButton.js";
|
|
@@ -92,12 +92,16 @@ function StepProgress({
|
|
|
92
92
|
// indigo[1] — surface-selected (indigo[0]) is too close to the secondary canvas.
|
|
93
93
|
"--fairmint-step-progress-surface-selected": fairmintVars.colorBgBrandSubtleHover,
|
|
94
94
|
"--fairmint-step-progress-active-border": indigoColors[3],
|
|
95
|
-
|
|
95
|
+
// Not brand indigo: no ink clears AA on it. Both follow the scheme, giving white on
|
|
96
|
+
// indigo[6] (6.29:1) in light and dark ink on indigo[2] (11.8:1) in dark.
|
|
97
|
+
"--fairmint-step-progress-active-indicator": fairmintVars.colorIconOnSurfaceSelected,
|
|
98
|
+
"--fairmint-step-progress-active-indicator-text": fairmintVars.colorTextInverse,
|
|
96
99
|
"--fairmint-step-progress-complete-border": indigoColors[3],
|
|
97
100
|
"--fairmint-step-progress-complete-text": fairmintVars.colorIconOnSurfaceSelected,
|
|
98
101
|
// The detail line is the one place that needs muted ink; pending labels above it stay primary.
|
|
99
102
|
"--fairmint-step-progress-detail": fairmintVars.colorTextSecondary,
|
|
100
103
|
"--fairmint-step-progress-stopped": fairmintVars.colorErrorSolid,
|
|
104
|
+
"--fairmint-step-progress-stopped-indicator-text": commonColors.white,
|
|
101
105
|
"--fairmint-step-progress-stopped-text": fairmintVars.colorErrorText,
|
|
102
106
|
// Status rows lay out as a grid; the last column never stretches, so it stays flush right.
|
|
103
107
|
"--fairmint-step-progress-columns": steps.length > 1 ? `repeat(${steps.length - 1}, auto) minmax(min-content, max-content)` : "minmax(min-content, max-content)"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepProgress.js","sources":["../../../../src/components/generic/StepProgress/StepProgress.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { brandColors, commonColors, fairmintVars, indigoColors } from \"../../../theme\";\nimport { Box, UnstyledButton } from \"../../primitives/layout\";\nimport \"./StepProgress.css\";\n\nexport type StepProgressOrientation = \"horizontal\" | \"vertical\";\nexport type StepProgressVariant = \"navigation\" | \"status\";\nexport type StepProgressStepStatus = \"complete\" | \"active\" | \"pending\" | \"stopped\";\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 /** Second line under the label, such as when the step happened. Shown by the status variant only. */\n detail?: string;\n /** The record stopped at this step (rejected, failed, cancelled). Shown by the status variant only. */\n stopped?: 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 /**\n * `navigation` is where the user is in a flow they are filling in. `status` is where a\n * record is in its lifecycle: read-only, no pill, and each step can carry a `detail`.\n * @default \"navigation\"\n */\n variant?: StepProgressVariant;\n /** Called with the 1-indexed step number when a pill is activated. Ignored by the status variant. */\n onStepChange?: (step: number) => void;\n /** Accessible label for the navigation. @default \"Progress\" */\n ariaLabel?: string;\n}\n\nconst CheckIcon = () => (\n <svg\n width=\"11\"\n height=\"11\"\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 StopIcon = () => (\n <svg\n width=\"11\"\n height=\"11\"\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=\"M7 7l10 10M17 7 7 17\" />\n </svg>\n);\n\nconst STATUS_TEXT: Readonly<Record<StepProgressStepStatus, string | undefined>> = {\n complete: \"(done)\",\n active: undefined,\n pending: undefined,\n stopped: \"(stopped)\",\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 variant: StepProgressVariant = \"navigation\",\n): StepProgressStepStatus => {\n if (variant === \"status\") {\n if (step.stopped) return \"stopped\";\n // A finished record has no current step: its last step is done, not in progress.\n if (step.completed) return \"complete\";\n }\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 *\n * The `status` variant reuses the same anatomy as a read-only lifecycle track,\n * so a record's progress and a flow's progress look like one component.\n */\nexport function StepProgress({\n steps,\n activeStep,\n orientation = \"horizontal\",\n variant = \"navigation\",\n onStepChange,\n ariaLabel = \"Progress\",\n}: StepProgressProps) {\n const listRef = useRef<HTMLOListElement>(null);\n const resolvedActiveStep = resolveActiveStep(activeStep, Math.max(steps.length, 1));\n\n // When the row scrolls, keep the current step in view as it changes. Scrolls the\n // list only — scrollIntoView would also move the page to the progress row.\n useEffect(() => {\n const list = listRef.current;\n const pill = list?.children[resolvedActiveStep - 1]?.querySelector<HTMLElement>(\n \".fairmint-step-progress__pill\",\n );\n if (!list || !pill || list.scrollWidth <= list.clientWidth) return;\n const listBox = list.getBoundingClientRect();\n const pillBox = pill.getBoundingClientRect();\n if (pillBox.left < listBox.left) {\n list.scrollLeft -= listBox.left - pillBox.left;\n } else if (pillBox.right > listBox.right) {\n list.scrollLeft += pillBox.right - listBox.right;\n }\n }, [resolvedActiveStep]);\n\n if (steps.length === 0) return null;\n\n const isStatus = variant === \"status\";\n const rootStyle = {\n \"--fairmint-step-progress-brand\": brandColors.indigo,\n // colorBorderDefault washes out on colorBgSurfaceSecondary; text-secondary clears 3:1.\n \"--fairmint-step-progress-border\": fairmintVars.colorTextSecondary,\n // Kept off the ring token: the ring carries the step number and needs 3:1, the\n // connector is decorative and reads as a hairline between pills.\n \"--fairmint-step-progress-connector\": fairmintVars.colorBorderDefault,\n \"--fairmint-step-progress-text-primary\": fairmintVars.colorTextPrimary,\n // Pending labels use primary ink; active hierarchy is weight + fill, not mute gray.\n \"--fairmint-step-progress-text-secondary\": fairmintVars.colorTextPrimary,\n // indigo[1] — surface-selected (indigo[0]) is too close to the secondary canvas.\n \"--fairmint-step-progress-surface-selected\": fairmintVars.colorBgBrandSubtleHover,\n \"--fairmint-step-progress-active-border\": indigoColors[3],\n \"--fairmint-step-progress-active-indicator-text\": commonColors.white,\n \"--fairmint-step-progress-complete-border\": indigoColors[3],\n \"--fairmint-step-progress-complete-text\": fairmintVars.colorIconOnSurfaceSelected,\n // The detail line is the one place that needs muted ink; pending labels above it stay primary.\n \"--fairmint-step-progress-detail\": fairmintVars.colorTextSecondary,\n \"--fairmint-step-progress-stopped\": fairmintVars.colorErrorSolid,\n \"--fairmint-step-progress-stopped-text\": fairmintVars.colorErrorText,\n // Status rows lay out as a grid; the last column never stretches, so it stays flush right.\n \"--fairmint-step-progress-columns\":\n steps.length > 1\n ? `repeat(${steps.length - 1}, auto) minmax(min-content, max-content)`\n : \"minmax(min-content, max-content)\",\n };\n\n return (\n <Box\n // A status track is not navigation: nothing in it goes anywhere.\n component={isStatus ? \"div\" : \"nav\"}\n role={isStatus ? \"group\" : undefined}\n aria-label={ariaLabel}\n className=\"fairmint-step-progress\"\n data-orientation={orientation}\n data-variant={variant}\n style={rootStyle}\n >\n <ol ref={listRef} className=\"fairmint-step-progress__list\">\n {steps.map((step, index) => {\n const stepNumber = index + 1;\n const status = getStepProgressStatus(step, stepNumber, resolvedActiveStep, variant);\n const isInteractive = !isStatus && Boolean(onStepChange) && !step.disabled;\n const detail = isStatus ? step.detail : undefined;\n // The indicator icons are aria-hidden, so a status track says done and stopped in words.\n const statusText = isStatus ? STATUS_TEXT[status] : undefined;\n const pillContent = (\n <>\n <span className=\"fairmint-step-progress__indicator\" aria-hidden=\"true\">\n {status === \"complete\" ? (\n <CheckIcon />\n ) : status === \"stopped\" ? (\n <StopIcon />\n ) : (\n stepNumber\n )}\n </span>\n {detail ? (\n <span className=\"fairmint-step-progress__text\">\n <span className=\"fairmint-step-progress__label\">{step.label}</span>\n <span className=\"fairmint-step-progress__detail\">{detail}</span>\n </span>\n ) : (\n <span className=\"fairmint-step-progress__label\">{step.label}</span>\n )}\n {statusText ? (\n <span className=\"fairmint-step-progress__status-text\">{statusText}</span>\n ) : null}\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 data-disabled=\"false\"\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 data-disabled={step.disabled ? \"true\" : \"false\"}\n aria-current={status === \"active\" ? \"step\" : undefined}\n aria-disabled={step.disabled || undefined}\n title={`Step ${stepNumber}: ${step.label}`}\n >\n {pillContent}\n </span>\n )}\n {index < steps.length - 1 ? (\n <span\n className=\"fairmint-step-progress__connector\"\n data-state={status}\n aria-hidden=\"true\"\n />\n ) : null}\n </li>\n );\n })}\n </ol>\n </Box>\n );\n}\n\nexport const STEP_PROGRESS_MOBILE_BREAKPOINT = \"48em\";\n"],"names":[],"mappings":";;;;;;AAyCA,MAAM,YAAY,MAChB;AAAA,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,UAAA,oBAAC,QAAA,EAAK,GAAE,kBAAA,CAAkB;AAAA,EAAA;AAC5B;AAGF,MAAM,WAAW,MACf;AAAA,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,UAAA,oBAAC,QAAA,EAAK,GAAE,uBAAA,CAAuB;AAAA,EAAA;AACjC;AAGF,MAAM,cAA4E;AAAA,EAChF,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AACX;AAEA,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,YACA,UAA+B,iBACJ;AAC3B,MAAI,YAAY,UAAU;AACxB,QAAI,KAAK,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uC,WAAU,gCAC/C,UAAA;AAAA,UAAA,gBACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,WAAU;AAAA,cACV,cAAY;AAAA,cACZ,oBAAiB;AAAA,cACjB,iBAAc;AAAA,cACd,gBAAc,WAAW,WAAW,SAAS;AAAA,cAC7C,cAAY,QAAQ,UAAU,KAAK,KAAK,KAAK;AAAA,cAC7C,SAAS,MAAM,eAAe,UAAU;AAAA,cAEvC,UAAA;AAAA,YAAA;AAAA,UAAA,IAGH;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,cAAY;AAAA,cACZ,iBAAe,KAAK,WAAW,SAAS;AAAA,cACxC,gBAAc,WAAW,WAAW,SAAS;AAAA,cAC7C,iBAAe,KAAK,YAAY;AAAA,cAChC,OAAO,QAAQ,UAAU,KAAK,KAAK,KAAK;AAAA,cAEvC,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGJ,QAAQ,MAAM,SAAS,IACtB;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,cAAY;AAAA,cACZ,eAAY;AAAA,YAAA;AAAA,UAAA,IAEZ;AAAA,QAAA,EAAA,GAhCG,GAAG,UAAU,IAAI,KAAK,KAAK,EAiCpC;AAAA,MAEJ,CAAC,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;AAEO,MAAM,kCAAkC;"}
|
|
1
|
+
{"version":3,"file":"StepProgress.js","sources":["../../../../src/components/generic/StepProgress/StepProgress.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { brandColors, commonColors, fairmintVars, indigoColors } from \"../../../theme\";\nimport { Box, UnstyledButton } from \"../../primitives/layout\";\nimport \"./StepProgress.css\";\n\nexport type StepProgressOrientation = \"horizontal\" | \"vertical\";\nexport type StepProgressVariant = \"navigation\" | \"status\";\nexport type StepProgressStepStatus = \"complete\" | \"active\" | \"pending\" | \"stopped\";\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 /** Second line under the label, such as when the step happened. Shown by the status variant only. */\n detail?: string;\n /** The record stopped at this step (rejected, failed, cancelled). Shown by the status variant only. */\n stopped?: 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 /**\n * `navigation` is where the user is in a flow they are filling in. `status` is where a\n * record is in its lifecycle: read-only, no pill, and each step can carry a `detail`.\n * @default \"navigation\"\n */\n variant?: StepProgressVariant;\n /** Called with the 1-indexed step number when a pill is activated. Ignored by the status variant. */\n onStepChange?: (step: number) => void;\n /** Accessible label for the navigation. @default \"Progress\" */\n ariaLabel?: string;\n}\n\nconst CheckIcon = () => (\n <svg\n width=\"11\"\n height=\"11\"\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 StopIcon = () => (\n <svg\n width=\"11\"\n height=\"11\"\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=\"M7 7l10 10M17 7 7 17\" />\n </svg>\n);\n\nconst STATUS_TEXT: Readonly<Record<StepProgressStepStatus, string | undefined>> = {\n complete: \"(done)\",\n active: undefined,\n pending: undefined,\n stopped: \"(stopped)\",\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 variant: StepProgressVariant = \"navigation\",\n): StepProgressStepStatus => {\n if (variant === \"status\") {\n if (step.stopped) return \"stopped\";\n // A finished record has no current step: its last step is done, not in progress.\n if (step.completed) return \"complete\";\n }\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 *\n * The `status` variant reuses the same anatomy as a read-only lifecycle track,\n * so a record's progress and a flow's progress look like one component.\n */\nexport function StepProgress({\n steps,\n activeStep,\n orientation = \"horizontal\",\n variant = \"navigation\",\n onStepChange,\n ariaLabel = \"Progress\",\n}: StepProgressProps) {\n const listRef = useRef<HTMLOListElement>(null);\n const resolvedActiveStep = resolveActiveStep(activeStep, Math.max(steps.length, 1));\n\n // When the row scrolls, keep the current step in view as it changes. Scrolls the\n // list only — scrollIntoView would also move the page to the progress row.\n useEffect(() => {\n const list = listRef.current;\n const pill = list?.children[resolvedActiveStep - 1]?.querySelector<HTMLElement>(\n \".fairmint-step-progress__pill\",\n );\n if (!list || !pill || list.scrollWidth <= list.clientWidth) return;\n const listBox = list.getBoundingClientRect();\n const pillBox = pill.getBoundingClientRect();\n if (pillBox.left < listBox.left) {\n list.scrollLeft -= listBox.left - pillBox.left;\n } else if (pillBox.right > listBox.right) {\n list.scrollLeft += pillBox.right - listBox.right;\n }\n }, [resolvedActiveStep]);\n\n if (steps.length === 0) return null;\n\n const isStatus = variant === \"status\";\n const rootStyle = {\n \"--fairmint-step-progress-brand\": brandColors.indigo,\n // colorBorderDefault washes out on colorBgSurfaceSecondary; text-secondary clears 3:1.\n \"--fairmint-step-progress-border\": fairmintVars.colorTextSecondary,\n // Kept off the ring token: the ring carries the step number and needs 3:1, the\n // connector is decorative and reads as a hairline between pills.\n \"--fairmint-step-progress-connector\": fairmintVars.colorBorderDefault,\n \"--fairmint-step-progress-text-primary\": fairmintVars.colorTextPrimary,\n // Pending labels use primary ink; active hierarchy is weight + fill, not mute gray.\n \"--fairmint-step-progress-text-secondary\": fairmintVars.colorTextPrimary,\n // indigo[1] — surface-selected (indigo[0]) is too close to the secondary canvas.\n \"--fairmint-step-progress-surface-selected\": fairmintVars.colorBgBrandSubtleHover,\n \"--fairmint-step-progress-active-border\": indigoColors[3],\n // Not brand indigo: no ink clears AA on it. Both follow the scheme, giving white on\n // indigo[6] (6.29:1) in light and dark ink on indigo[2] (11.8:1) in dark.\n \"--fairmint-step-progress-active-indicator\": fairmintVars.colorIconOnSurfaceSelected,\n \"--fairmint-step-progress-active-indicator-text\": fairmintVars.colorTextInverse,\n \"--fairmint-step-progress-complete-border\": indigoColors[3],\n \"--fairmint-step-progress-complete-text\": fairmintVars.colorIconOnSurfaceSelected,\n // The detail line is the one place that needs muted ink; pending labels above it stay primary.\n \"--fairmint-step-progress-detail\": fairmintVars.colorTextSecondary,\n \"--fairmint-step-progress-stopped\": fairmintVars.colorErrorSolid,\n \"--fairmint-step-progress-stopped-indicator-text\": commonColors.white,\n \"--fairmint-step-progress-stopped-text\": fairmintVars.colorErrorText,\n // Status rows lay out as a grid; the last column never stretches, so it stays flush right.\n \"--fairmint-step-progress-columns\":\n steps.length > 1\n ? `repeat(${steps.length - 1}, auto) minmax(min-content, max-content)`\n : \"minmax(min-content, max-content)\",\n };\n\n return (\n <Box\n // A status track is not navigation: nothing in it goes anywhere.\n component={isStatus ? \"div\" : \"nav\"}\n role={isStatus ? \"group\" : undefined}\n aria-label={ariaLabel}\n className=\"fairmint-step-progress\"\n data-orientation={orientation}\n data-variant={variant}\n style={rootStyle}\n >\n <ol ref={listRef} className=\"fairmint-step-progress__list\">\n {steps.map((step, index) => {\n const stepNumber = index + 1;\n const status = getStepProgressStatus(step, stepNumber, resolvedActiveStep, variant);\n const isInteractive = !isStatus && Boolean(onStepChange) && !step.disabled;\n const detail = isStatus ? step.detail : undefined;\n // The indicator icons are aria-hidden, so a status track says done and stopped in words.\n const statusText = isStatus ? STATUS_TEXT[status] : undefined;\n const pillContent = (\n <>\n <span className=\"fairmint-step-progress__indicator\" aria-hidden=\"true\">\n {status === \"complete\" ? (\n <CheckIcon />\n ) : status === \"stopped\" ? (\n <StopIcon />\n ) : (\n stepNumber\n )}\n </span>\n {detail ? (\n <span className=\"fairmint-step-progress__text\">\n <span className=\"fairmint-step-progress__label\">{step.label}</span>\n <span className=\"fairmint-step-progress__detail\">{detail}</span>\n </span>\n ) : (\n <span className=\"fairmint-step-progress__label\">{step.label}</span>\n )}\n {statusText ? (\n <span className=\"fairmint-step-progress__status-text\">{statusText}</span>\n ) : null}\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 data-disabled=\"false\"\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 data-disabled={step.disabled ? \"true\" : \"false\"}\n aria-current={status === \"active\" ? \"step\" : undefined}\n aria-disabled={step.disabled || undefined}\n title={`Step ${stepNumber}: ${step.label}`}\n >\n {pillContent}\n </span>\n )}\n {index < steps.length - 1 ? (\n <span\n className=\"fairmint-step-progress__connector\"\n data-state={status}\n aria-hidden=\"true\"\n />\n ) : null}\n </li>\n );\n })}\n </ol>\n </Box>\n );\n}\n\nexport const STEP_PROGRESS_MOBILE_BREAKPOINT = \"48em\";\n"],"names":[],"mappings":";;;;;;AAyCA,MAAM,YAAY,MAChB;AAAA,EAAC;AAAA,EA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AA,cAEvC,UAAA;AAAA,YAAA;AAAA,UAAA,IAGH;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,cAAY;AAAA,cACZ,iBAAe,KAAK,WAAW,SAAS;AAAA,cACxC,gBAAc,WAAW,WAAW,SAAS;AAAA,cAC7C,iBAAe,KAAK,YAAY;AAAA,cAChC,OAAO,QAAQ,UAAU,KAAK,KAAK,KAAK;AAAA,cAEvC,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGJ,QAAQ,MAAM,SAAS,IACtB;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,cAAY;AAAA,cACZ,eAAY;AAAA,YAAA;AAAA,UAAA,IAEZ;AAAA,QAAA,EAAA,GAhCG,GAAG,UAAU,IAAI,KAAK,KAAK,EAiCpC;AAAA,MAEJ,CAAC,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;AAEO,MAAM,kCAAkC;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
|
-
const index = require("../../../../../../_virtual/
|
|
4
|
+
const index = require("../../../../../../_virtual/index3.cjs");
|
|
5
5
|
const getStatus = require("../../get-status/get-status.cjs");
|
|
6
6
|
const clearListState = require("../../lists/clear-list-state.cjs");
|
|
7
7
|
const getPath = require("../../paths/get-path.cjs");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useRef, useCallback } from "react";
|
|
2
|
-
import isEqual from "../../../../../../_virtual/
|
|
2
|
+
import isEqual from "../../../../../../_virtual/index3.js";
|
|
3
3
|
import { getStatus } from "../../get-status/get-status.js";
|
|
4
4
|
import { clearListState } from "../../lists/clear-list-state.js";
|
|
5
5
|
import { getPath } from "../../paths/get-path.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index$1 = require("../../_virtual/
|
|
3
|
+
const index$1 = require("../../_virtual/index4.cjs");
|
|
4
4
|
const index = require("./node_modules/react-is/index.cjs");
|
|
5
5
|
const factoryWithTypeCheckers = require("./factoryWithTypeCheckers.cjs");
|
|
6
6
|
const factoryWithThrowingShims = require("./factoryWithThrowingShims.cjs");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __module as propTypes } from "../../_virtual/
|
|
1
|
+
import { __module as propTypes } from "../../_virtual/index4.js";
|
|
2
2
|
import { __require as requireReactIs } from "./node_modules/react-is/index.js";
|
|
3
3
|
import { __require as requireFactoryWithTypeCheckers } from "./factoryWithTypeCheckers.js";
|
|
4
4
|
import { __require as requireFactoryWithThrowingShims } from "./factoryWithThrowingShims.js";
|
package/dist/styles.css
CHANGED
|
@@ -149,9 +149,14 @@
|
|
|
149
149
|
line-height: 1;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
+
/*
|
|
153
|
+
* Filled with the completed check's ink rather than the brand: white on brand is
|
|
154
|
+
* 4.47:1, under AA for a number this small. In dark mode the ink turns light, so
|
|
155
|
+
* the number takes the inverse (dark) text color with it.
|
|
156
|
+
*/
|
|
152
157
|
.fairmint-step-progress__pill[data-state="active"] .fairmint-step-progress__indicator {
|
|
153
|
-
border-color: var(--fairmint-step-progress-
|
|
154
|
-
background: var(--fairmint-step-progress-
|
|
158
|
+
border-color: var(--fairmint-step-progress-active-indicator, #4f46e5);
|
|
159
|
+
background: var(--fairmint-step-progress-active-indicator, #4f46e5);
|
|
155
160
|
color: var(--fairmint-step-progress-active-indicator-text, #ffffff);
|
|
156
161
|
}
|
|
157
162
|
|
|
@@ -395,7 +400,7 @@
|
|
|
395
400
|
.fairmint-step-progress__indicator {
|
|
396
401
|
border-color: var(--fairmint-step-progress-stopped, #e5484d);
|
|
397
402
|
background: var(--fairmint-step-progress-stopped, #e5484d);
|
|
398
|
-
color: var(--fairmint-step-progress-
|
|
403
|
+
color: var(--fairmint-step-progress-stopped-indicator-text, #ffffff);
|
|
399
404
|
}
|
|
400
405
|
|
|
401
406
|
.fairmint-step-progress[data-variant="status"]
|