@homebound/beam 2.144.0 → 2.145.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,10 +12,16 @@ function Stepper({ steps, currentStep, onChange }) {
|
|
|
12
12
|
}
|
|
13
13
|
// calc progress based on last completed step - return -1 when no steps completed
|
|
14
14
|
const lastCompletedStep = steps.map((step) => step.state).lastIndexOf("complete");
|
|
15
|
-
|
|
15
|
+
const maxStepWidth = 200;
|
|
16
|
+
const minStepWidth = 100;
|
|
17
|
+
const gap = 8;
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)("nav", Object.assign({ "aria-label": "steps", css: Css_1.Css.df.fdc.w100.$ }, { children: [(0, jsx_runtime_1.jsx)("ol", Object.assign({ css: Css_1.Css.listReset.df.gapPx(gap).$ }, { children: steps.map((step) => {
|
|
16
19
|
const isCurrent = currentStep === step.value;
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)("li", Object.assign({ css: Css_1.Css.df.fdc.
|
|
18
|
-
}) }), void 0), (0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.mt1.bgGray300
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)("li", Object.assign({ css: Css_1.Css.df.fg1.fdc.maxwPx(maxStepWidth).mwPx(minStepWidth).$, "aria-current": isCurrent }, { children: (0, jsx_runtime_1.jsx)(StepButton, Object.assign({}, step, { onClick: () => onChange(step.value), isCurrent: isCurrent }), void 0) }), step.label));
|
|
21
|
+
}) }), void 0), (0, jsx_runtime_1.jsx)("div", Object.assign({ css: Css_1.Css.mt1.bgGray300
|
|
22
|
+
.hPx(4)
|
|
23
|
+
.maxwPx(steps.length * maxStepWidth + (steps.length - 1) * gap)
|
|
24
|
+
.mwPx(steps.length * minStepWidth + (steps.length - 1) * gap).w100.$ }, { children: (0, jsx_runtime_1.jsx)("div", { css: Css_1.Css.bgLightBlue600
|
|
19
25
|
.add("transition", "width 200ms")
|
|
20
26
|
.h100.w(`${((lastCompletedStep + 1) / steps.length) * 100}%`).$ }, void 0) }), void 0)] }), void 0));
|
|
21
27
|
}
|