@bmsuisse/ui 0.18.0 → 0.19.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.
- package/dist/index.d.ts +16 -6
- package/dist/index.js +65 -56
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1236,8 +1236,8 @@ interface StepperStep {
|
|
|
1236
1236
|
n: number;
|
|
1237
1237
|
/** Visible label under the chip. */
|
|
1238
1238
|
label: string;
|
|
1239
|
-
/** Small uppercase caption under the label (e.g. a phase/section name). */
|
|
1240
|
-
phase
|
|
1239
|
+
/** Small uppercase caption under the label (e.g. a phase/section name). Omit to render no caption. */
|
|
1240
|
+
phase?: string;
|
|
1241
1241
|
}
|
|
1242
1242
|
interface StepperProps {
|
|
1243
1243
|
/** The current step number (1-based, matches a `StepperStep.n`). */
|
|
@@ -1258,11 +1258,21 @@ interface StepperProps {
|
|
|
1258
1258
|
scrollTestId?: string;
|
|
1259
1259
|
/** `data-testid` for the trailing `onNew` button, when rendered. */
|
|
1260
1260
|
newTestId?: string;
|
|
1261
|
+
/**
|
|
1262
|
+
* Minimum width of the steps track; below it the track scrolls horizontally instead of
|
|
1263
|
+
* shrinking further (a number is px, a string is any CSS length, e.g. `"40rem"`). By default
|
|
1264
|
+
* the track has no fixed minimum: it fills the available width and only scrolls once the
|
|
1265
|
+
* chips themselves no longer fit. Set it to give the chips more room than their own content.
|
|
1266
|
+
*/
|
|
1267
|
+
minWidth?: number | string;
|
|
1268
|
+
/** Extra classes for the root element (e.g. to constrain or centre the stepper). */
|
|
1269
|
+
className?: string;
|
|
1261
1270
|
}
|
|
1262
1271
|
/**
|
|
1263
|
-
* Numbered-chip wizard progress indicator: a
|
|
1264
|
-
*
|
|
1265
|
-
*
|
|
1272
|
+
* Numbered-chip wizard progress indicator: a row of step chips
|
|
1273
|
+
* (done/active/upcoming, connected by a line that fills in as steps complete)
|
|
1274
|
+
* that scrolls horizontally only when the chips don't fit, plus an optional
|
|
1275
|
+
* trailing "start over" button. Replaces
|
|
1266
1276
|
* the same shape hand-rolled independently by more than one multi-step
|
|
1267
1277
|
* wizard.
|
|
1268
1278
|
*
|
|
@@ -1274,7 +1284,7 @@ interface StepperProps {
|
|
|
1274
1284
|
* that needs a one-off extra chip should compose its own around this
|
|
1275
1285
|
* component instead.
|
|
1276
1286
|
*/
|
|
1277
|
-
declare function Stepper({ step, maxStep, onNavigate, onNew, steps, navLabel, newLabel, scrollTestId, newTestId, }: StepperProps): react.JSX.Element;
|
|
1287
|
+
declare function Stepper({ step, maxStep, onNavigate, onNew, steps, navLabel, newLabel, scrollTestId, newTestId, minWidth, className, }: StepperProps): react.JSX.Element;
|
|
1278
1288
|
|
|
1279
1289
|
/** Merges conditional class names, then dedupes conflicting Tailwind utility classes. */
|
|
1280
1290
|
declare function cn(...inputs: ClassValue[]): string;
|
package/dist/index.js
CHANGED
|
@@ -3369,7 +3369,9 @@ function Stepper({
|
|
|
3369
3369
|
navLabel = "Steps",
|
|
3370
3370
|
newLabel = "New",
|
|
3371
3371
|
scrollTestId = "stepper-scroll",
|
|
3372
|
-
newTestId
|
|
3372
|
+
newTestId,
|
|
3373
|
+
minWidth,
|
|
3374
|
+
className
|
|
3373
3375
|
}) {
|
|
3374
3376
|
const stepRefs = useRef8(/* @__PURE__ */ new Map());
|
|
3375
3377
|
useEffect8(() => {
|
|
@@ -3380,69 +3382,76 @@ function Stepper({
|
|
|
3380
3382
|
// onNew is pinned outside the horizontally-scrolling region below (a sibling of
|
|
3381
3383
|
// it, not a child) so its own edge never scrolls off-screen along with the
|
|
3382
3384
|
// later steps once the scroller's min-width doesn't fit the viewport.
|
|
3383
|
-
/* @__PURE__ */ jsxs30("div", { className: "flex w-full shrink-0 items-center gap-2", children: [
|
|
3385
|
+
/* @__PURE__ */ jsxs30("div", { className: cn("flex w-full shrink-0 items-center gap-2", className), children: [
|
|
3384
3386
|
/* @__PURE__ */ jsx48("nav", { "aria-label": navLabel, className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx48(
|
|
3385
3387
|
"div",
|
|
3386
3388
|
{
|
|
3387
3389
|
"data-testid": scrollTestId,
|
|
3388
3390
|
className: "flex w-full items-center gap-0 overflow-x-auto px-2 py-1",
|
|
3389
|
-
children: /* @__PURE__ */ jsx48(
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3391
|
+
children: /* @__PURE__ */ jsx48(
|
|
3392
|
+
"ol",
|
|
3393
|
+
{
|
|
3394
|
+
className: cn("flex flex-1 items-start", minWidth === void 0 && "min-w-fit"),
|
|
3395
|
+
style: minWidth === void 0 ? void 0 : { minWidth },
|
|
3396
|
+
children: steps.map(({ n, label, phase }, i) => {
|
|
3397
|
+
const done = step > n;
|
|
3398
|
+
const active = step === n;
|
|
3399
|
+
const navigable = n <= maxStep && n !== step;
|
|
3400
|
+
const last = i === steps.length - 1;
|
|
3401
|
+
return /* @__PURE__ */ jsxs30("li", { className: cn("flex items-start", !last && "flex-1"), children: [
|
|
3402
|
+
/* @__PURE__ */ jsxs30(
|
|
3403
|
+
"button",
|
|
3404
|
+
{
|
|
3405
|
+
ref: (element) => {
|
|
3406
|
+
if (element) stepRefs.current.set(n, element);
|
|
3407
|
+
else stepRefs.current.delete(n);
|
|
3408
|
+
},
|
|
3409
|
+
"data-testid": `step-${n}`,
|
|
3410
|
+
"aria-disabled": !navigable,
|
|
3411
|
+
"aria-current": active ? "step" : void 0,
|
|
3412
|
+
onClick: () => navigable && onNavigate(n),
|
|
3413
|
+
className: cn(
|
|
3414
|
+
"flex min-w-[68px] flex-col items-center gap-0.5 transition-opacity",
|
|
3415
|
+
navigable ? "cursor-pointer hover:opacity-80" : "cursor-default"
|
|
3416
|
+
),
|
|
3417
|
+
children: [
|
|
3418
|
+
/* @__PURE__ */ jsx48(
|
|
3419
|
+
"div",
|
|
3420
|
+
{
|
|
3421
|
+
className: cn(
|
|
3422
|
+
"flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-[11px] font-bold transition-colors",
|
|
3423
|
+
done ? "bg-primary/15 text-primary" : active ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground"
|
|
3424
|
+
),
|
|
3425
|
+
children: done ? /* @__PURE__ */ jsx48(CheckIcon5, { className: "h-3 w-3" }) : n
|
|
3426
|
+
}
|
|
3417
3427
|
),
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3428
|
+
/* @__PURE__ */ jsx48(
|
|
3429
|
+
"span",
|
|
3430
|
+
{
|
|
3431
|
+
className: cn(
|
|
3432
|
+
"text-center whitespace-nowrap transition-colors",
|
|
3433
|
+
active ? "text-[12px] font-semibold text-foreground" : done ? "text-[12px] font-medium text-primary" : "text-[12px] font-medium text-muted-foreground"
|
|
3434
|
+
),
|
|
3435
|
+
children: label
|
|
3436
|
+
}
|
|
3427
3437
|
),
|
|
3428
|
-
children:
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
done ? "bg-primary" : "bg-border"
|
|
3438
|
+
phase && /* @__PURE__ */ jsx48("span", { className: "text-[9px] tracking-[0.5px] text-muted-foreground/50 uppercase", children: phase })
|
|
3439
|
+
]
|
|
3440
|
+
}
|
|
3441
|
+
),
|
|
3442
|
+
!last && /* @__PURE__ */ jsx48(
|
|
3443
|
+
"div",
|
|
3444
|
+
{
|
|
3445
|
+
className: cn(
|
|
3446
|
+
"mx-1.5 mt-3.5 h-px flex-1 transition-colors",
|
|
3447
|
+
done ? "bg-primary" : "bg-border"
|
|
3448
|
+
)
|
|
3449
|
+
}
|
|
3441
3450
|
)
|
|
3442
|
-
}
|
|
3443
|
-
)
|
|
3444
|
-
|
|
3445
|
-
|
|
3451
|
+
] }, n);
|
|
3452
|
+
})
|
|
3453
|
+
}
|
|
3454
|
+
)
|
|
3446
3455
|
}
|
|
3447
3456
|
) }),
|
|
3448
3457
|
onNew && /* @__PURE__ */ jsxs30(
|