mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 23:52:24 +00:00
style: apply prettier across the tree
One-shot prettier pass so the new format:check gate starts from a clean baseline. Formatting only — no behaviour change. Generator-owned and vendored artifacts stay untouched via .prettierignore.
This commit is contained in:
1 parent
b3fea2ef59
commit
1f4ba5939d
1000 files changed
+12130
-8385
No files matched your search
@@ -43,10 +43,7 @@ import {
|
||||
*/
|
||||
|
||||
function makeStubT() {
|
||||
return (
|
||||
key: string,
|
||||
params?: Record<string, string | number>,
|
||||
): string => {
|
||||
return (key: string, params?: Record<string, string | number>): string => {
|
||||
if (!params) return key;
|
||||
return `${key}(${JSON.stringify(params)})`;
|
||||
};
|
||||
@@ -109,9 +106,9 @@ describe("validateStep", () => {
|
||||
it("step 2: requires a treatment row", () => {
|
||||
const base = emptyWizardPayload();
|
||||
expect(validateStep(base, 2)).toBe(false);
|
||||
expect(
|
||||
validateStep({ ...base, treatmentRow: "bloodPressure" }, 2),
|
||||
).toBe(true);
|
||||
expect(validateStep({ ...base, treatmentRow: "bloodPressure" }, 2)).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
it("step 3: requires populated dose amount", () => {
|
||||
@@ -129,9 +126,9 @@ describe("validateStep", () => {
|
||||
const base = emptyWizardPayload();
|
||||
const start = new Date(Date.UTC(2026, 5, 1));
|
||||
const earlier = new Date(Date.UTC(2026, 4, 1));
|
||||
expect(
|
||||
validateStep({ ...base, startsOn: start, endsOn: earlier }, 4),
|
||||
).toBe(false);
|
||||
expect(validateStep({ ...base, startsOn: start, endsOn: earlier }, 4)).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
it("step 4: accepts null endsOn (chronic)", () => {
|
||||
@@ -152,30 +149,30 @@ describe("validateStep", () => {
|
||||
});
|
||||
|
||||
it("step 6: weekdays requires >= 1 chip", () => {
|
||||
expect(
|
||||
validateStep(withCadence("weekdays", { weekdays: [] }), 6),
|
||||
).toBe(false);
|
||||
expect(
|
||||
validateStep(withCadence("weekdays", { weekdays: ["MO"] }), 6),
|
||||
).toBe(true);
|
||||
expect(validateStep(withCadence("weekdays", { weekdays: [] }), 6)).toBe(
|
||||
false,
|
||||
);
|
||||
expect(validateStep(withCadence("weekdays", { weekdays: ["MO"] }), 6)).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
it("step 6: monthly accepts day-of-month 1..31", () => {
|
||||
expect(
|
||||
validateStep(withCadence("monthly", { dayOfMonth: 1 }), 6),
|
||||
).toBe(true);
|
||||
expect(
|
||||
validateStep(withCadence("monthly", { dayOfMonth: 31 }), 6),
|
||||
).toBe(true);
|
||||
expect(validateStep(withCadence("monthly", { dayOfMonth: 1 }), 6)).toBe(
|
||||
true,
|
||||
);
|
||||
expect(validateStep(withCadence("monthly", { dayOfMonth: 31 }), 6)).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
it("step 6: rolling accepts 1..365 days", () => {
|
||||
expect(
|
||||
validateStep(withCadence("rolling", { rollingDays: 1 }), 6),
|
||||
).toBe(true);
|
||||
expect(
|
||||
validateStep(withCadence("rolling", { rollingDays: 365 }), 6),
|
||||
).toBe(true);
|
||||
expect(validateStep(withCadence("rolling", { rollingDays: 1 }), 6)).toBe(
|
||||
true,
|
||||
);
|
||||
expect(validateStep(withCadence("rolling", { rollingDays: 365 }), 6)).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
it("step 7: requires >= 1 valid HH:mm time", () => {
|
||||
@@ -189,9 +186,9 @@ describe("validateStep", () => {
|
||||
const base = withCadence("daily");
|
||||
expect(validateStep({ ...base, startsOn: null }, 8)).toBe(false);
|
||||
const start = new Date(Date.UTC(2026, 5, 1));
|
||||
expect(
|
||||
validateStep({ ...base, startsOn: start, endsOn: null }, 8),
|
||||
).toBe(true);
|
||||
expect(validateStep({ ...base, startsOn: start, endsOn: null }, 8)).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -397,7 +394,9 @@ describe("buildCreateBody", () => {
|
||||
// The default "1" still ships (an edit back to 1 must reach the server).
|
||||
expect(buildCreateBody({ ...p, unitsPerDose: "1" }).unitsPerDose).toBe(1);
|
||||
// An empty field omits it (server default applies).
|
||||
expect(buildCreateBody({ ...p, unitsPerDose: "" }).unitsPerDose).toBeUndefined();
|
||||
expect(
|
||||
buildCreateBody({ ...p, unitsPerDose: "" }).unitsPerDose,
|
||||
).toBeUndefined();
|
||||
|
||||
const hydrated = hydrateWizardPayload({
|
||||
id: "m1",
|
||||
@@ -634,7 +633,9 @@ describe("summariseScheduleDraft — shared cadence-line helper", () => {
|
||||
});
|
||||
|
||||
it("threads the everyNWeeks interval into the cadence key", () => {
|
||||
const p = commitActiveDraft(withCadence("everyNWeeks", { intervalWeeks: 3 }));
|
||||
const p = commitActiveDraft(
|
||||
withCadence("everyNWeeks", { intervalWeeks: 3 }),
|
||||
);
|
||||
const out = summariseScheduleDraft(p.schedules[p.activeScheduleIndex], t);
|
||||
expect(out).toMatch(/cadence\.everyNWeeks[^|]*"n":3/);
|
||||
});
|
||||
@@ -686,16 +687,12 @@ describe("hydrateWizardPayload", () => {
|
||||
});
|
||||
|
||||
it("hydrates a DIABETES medication as the diabetes row", () => {
|
||||
const out = hydrateWizardPayload(
|
||||
makeInitial({ category: "DIABETES" }),
|
||||
);
|
||||
const out = hydrateWizardPayload(makeInitial({ category: "DIABETES" }));
|
||||
expect(out.treatmentRow).toBe("diabetes");
|
||||
});
|
||||
|
||||
it("hydrates an ANTIBIOTIC medication as the antibiotic row", () => {
|
||||
const out = hydrateWizardPayload(
|
||||
makeInitial({ category: "ANTIBIOTIC" }),
|
||||
);
|
||||
const out = hydrateWizardPayload(makeInitial({ category: "ANTIBIOTIC" }));
|
||||
expect(out.treatmentRow).toBe("antibiotic");
|
||||
});
|
||||
|
||||
|
||||
@@ -25,10 +25,7 @@ import {
|
||||
import type { StepProps } from "./step1-name";
|
||||
|
||||
// Each row's Lucide glyph. maintainer-confirmed assignment in D-1 §3 Step 2.
|
||||
const ROW_ICONS: Record<
|
||||
WizardTreatmentRow,
|
||||
ComponentType<LucideProps>
|
||||
> = {
|
||||
const ROW_ICONS: Record<WizardTreatmentRow, ComponentType<LucideProps>> = {
|
||||
bloodPressure: Stethoscope,
|
||||
diabetes: Droplet,
|
||||
hormone: Activity,
|
||||
|
||||
@@ -21,9 +21,7 @@ export function Step4Window({ payload, applyPartial }: StepProps) {
|
||||
startsOn={payload.startsOn}
|
||||
endsOn={payload.endsOn}
|
||||
lockEndsToStart={isOneShot}
|
||||
onChange={({ startsOn, endsOn }) =>
|
||||
applyPartial({ startsOn, endsOn })
|
||||
}
|
||||
onChange={({ startsOn, endsOn }) => applyPartial({ startsOn, endsOn })}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -173,7 +173,7 @@ function WeekdayChips({ selected, onChange }: WeekdayChipsProps) {
|
||||
data-active={isOn ? "true" : "false"}
|
||||
onClick={() => toggle(tok)}
|
||||
className={[
|
||||
"focus-visible:ring-ring inline-flex h-11 min-w-11 items-center justify-center rounded-md border px-2 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2",
|
||||
"focus-visible:ring-ring inline-flex h-11 min-w-11 items-center justify-center rounded-md border px-2 text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none",
|
||||
isOn
|
||||
? "bg-primary text-primary-foreground border-primary"
|
||||
: "border-border bg-background text-foreground hover:bg-muted",
|
||||
|
||||
@@ -63,9 +63,7 @@ export function Step7Times({ payload, applyPartial }: StepProps) {
|
||||
>
|
||||
{PRESETS.map(({ time, icon: Icon, key }) => {
|
||||
const isOn = payload.timesOfDay.includes(time);
|
||||
const label = t(
|
||||
`medications.wizard.steps.step7.presets.${key}`,
|
||||
);
|
||||
const label = t(`medications.wizard.steps.step7.presets.${key}`);
|
||||
return (
|
||||
<button
|
||||
key={time}
|
||||
@@ -77,7 +75,7 @@ export function Step7Times({ payload, applyPartial }: StepProps) {
|
||||
data-active={isOn ? "true" : "false"}
|
||||
onClick={() => togglePreset(time)}
|
||||
className={[
|
||||
"focus-visible:ring-ring inline-flex h-11 items-center gap-1.5 rounded-md border px-3 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2",
|
||||
"focus-visible:ring-ring inline-flex h-11 items-center gap-1.5 rounded-md border px-3 text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none",
|
||||
isOn
|
||||
? "bg-primary text-primary-foreground border-primary"
|
||||
: "border-border bg-background text-foreground hover:bg-muted",
|
||||
|
||||
@@ -158,7 +158,7 @@ export function Step8Summary({
|
||||
"border-border/70 hover:bg-muted/40 focus-visible:ring-ring",
|
||||
"flex w-full items-center justify-center gap-2 rounded-md border border-dashed",
|
||||
"p-3 text-sm font-medium transition-colors",
|
||||
"focus-visible:outline-none focus-visible:ring-2",
|
||||
"focus-visible:ring-2 focus-visible:outline-none",
|
||||
].join(" ")}
|
||||
>
|
||||
<Plus className="h-4 w-4" aria-hidden="true" />
|
||||
@@ -170,28 +170,25 @@ export function Step8Summary({
|
||||
{/* v1.16.11 — an as-needed medication never reminds (no slots),
|
||||
so the reminders toggle is hidden alongside the schedules. */}
|
||||
{payload.mode !== "asNeeded" && (
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<div className="space-y-1">
|
||||
<Label
|
||||
htmlFor="wizard-reminders"
|
||||
className="text-sm font-medium"
|
||||
>
|
||||
{t("medications.wizard.steps.step8.remindersLabel")}
|
||||
</Label>
|
||||
<p className="text-muted-foreground text-xs">
|
||||
{t("medications.wizard.steps.step8.remindersDescription")}
|
||||
</p>
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<div className="space-y-1">
|
||||
<Label htmlFor="wizard-reminders" className="text-sm font-medium">
|
||||
{t("medications.wizard.steps.step8.remindersLabel")}
|
||||
</Label>
|
||||
<p className="text-muted-foreground text-xs">
|
||||
{t("medications.wizard.steps.step8.remindersDescription")}
|
||||
</p>
|
||||
</div>
|
||||
<Switch
|
||||
id="wizard-reminders"
|
||||
checked={payload.notificationsEnabled}
|
||||
onCheckedChange={(checked) =>
|
||||
applyPartial({ notificationsEnabled: checked })
|
||||
}
|
||||
data-slot="wizard-reminders-toggle"
|
||||
aria-label={t("medications.wizard.steps.step8.remindersLabel")}
|
||||
/>
|
||||
</div>
|
||||
<Switch
|
||||
id="wizard-reminders"
|
||||
checked={payload.notificationsEnabled}
|
||||
onCheckedChange={(checked) =>
|
||||
applyPartial({ notificationsEnabled: checked })
|
||||
}
|
||||
data-slot="wizard-reminders-toggle"
|
||||
aria-label={t("medications.wizard.steps.step8.remindersLabel")}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{payload.mode !== "asNeeded" && showNoChannelHint && (
|
||||
|
||||
@@ -116,7 +116,10 @@ export const WIZARD_TREATMENT_ROWS: readonly WizardTreatmentRow[] = [
|
||||
*/
|
||||
export const WIZARD_TREATMENT_MAPPING: Record<
|
||||
WizardTreatmentRow,
|
||||
{ treatmentClass: MedicationTreatmentClass; category: MedicationCategoryValue }
|
||||
{
|
||||
treatmentClass: MedicationTreatmentClass;
|
||||
category: MedicationCategoryValue;
|
||||
}
|
||||
> = {
|
||||
bloodPressure: { treatmentClass: "GENERIC", category: "BLOOD_PRESSURE" },
|
||||
diabetes: { treatmentClass: "GENERIC", category: "DIABETES" },
|
||||
@@ -696,7 +699,10 @@ export function buildCreateBody(
|
||||
const draftsToEmit = isAsNeeded
|
||||
? []
|
||||
: isOneShot
|
||||
? [committed.schedules[committed.activeScheduleIndex] ?? committed.schedules[0]]
|
||||
? [
|
||||
committed.schedules[committed.activeScheduleIndex] ??
|
||||
committed.schedules[0],
|
||||
]
|
||||
: committed.schedules;
|
||||
|
||||
const parsedDosesPerUnit = Number.parseInt(committed.dosesPerUnit, 10);
|
||||
@@ -738,7 +744,9 @@ export function buildCreateBody(
|
||||
}),
|
||||
oneShot: isOneShot,
|
||||
asNeeded: isAsNeeded,
|
||||
schedules: draftsToEmit.map((draft) => encodeScheduleDraft(draft, isOneShot)),
|
||||
schedules: draftsToEmit.map((draft) =>
|
||||
encodeScheduleDraft(draft, isOneShot),
|
||||
),
|
||||
};
|
||||
if (committed.startsOn) {
|
||||
body.startsOn = dateToIsoString(committed.startsOn);
|
||||
@@ -812,7 +820,8 @@ type CadenceShape = Pick<ScheduleDraft, "mode" | "cadence" | "subControls">;
|
||||
* summaries can't drift apart.
|
||||
*/
|
||||
function cadenceInterpolationN(shape: CadenceShape): number {
|
||||
if (shape.cadence.kind === "everyNWeeks") return shape.subControls.intervalWeeks;
|
||||
if (shape.cadence.kind === "everyNWeeks")
|
||||
return shape.subControls.intervalWeeks;
|
||||
if (shape.cadence.kind === "rolling")
|
||||
return shape.cadence.rollingIntervalDays ?? 0;
|
||||
return 0;
|
||||
@@ -974,7 +983,9 @@ export interface MedicationPayload {
|
||||
}
|
||||
|
||||
/** Coerce a persisted `deliveryForm` string onto the closed enum. */
|
||||
function normaliseDeliveryForm(value: string | undefined): MedicationDeliveryForm {
|
||||
function normaliseDeliveryForm(
|
||||
value: string | undefined,
|
||||
): MedicationDeliveryForm {
|
||||
return value === "INJECTION" || value === "OTHER" ? value : "ORAL";
|
||||
}
|
||||
|
||||
@@ -1037,7 +1048,9 @@ function hydrateScheduleDraft(
|
||||
* the `(daysOfWeek, intervalWeeks)` pair when the v1.5 `rrule` /
|
||||
* `rollingIntervalDays` fields are absent.
|
||||
*/
|
||||
export function hydrateWizardPayload(initial: MedicationPayload): WizardPayload {
|
||||
export function hydrateWizardPayload(
|
||||
initial: MedicationPayload,
|
||||
): WizardPayload {
|
||||
const base = emptyWizardPayload();
|
||||
const parsedDose = parseDoseExpression(initial.dose ?? "");
|
||||
|
||||
@@ -1140,9 +1153,9 @@ function subControlsFromRrule(rrule: string): CadenceSubControls {
|
||||
const sub: CadenceSubControls = { ...DEFAULT_SUB_CONTROLS };
|
||||
const byday = /BYDAY=([A-Z,]+)/.exec(rrule);
|
||||
if (byday) {
|
||||
const tokens = byday[1].split(",").filter((t) =>
|
||||
["MO", "TU", "WE", "TH", "FR", "SA", "SU"].includes(t),
|
||||
);
|
||||
const tokens = byday[1]
|
||||
.split(",")
|
||||
.filter((t) => ["MO", "TU", "WE", "TH", "FR", "SA", "SU"].includes(t));
|
||||
if (tokens.length > 0) {
|
||||
sub.weekdays = tokens as CadenceSubControls["weekdays"];
|
||||
}
|
||||
|
||||
@@ -84,114 +84,114 @@ export function WizardStepper({
|
||||
aria-label={srLabel}
|
||||
>
|
||||
<div className="flex items-center gap-1">
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="relative h-8 w-8 shrink-0 before:absolute before:-inset-1.5 before:content-['']"
|
||||
onClick={onFirst}
|
||||
disabled={!firstEnabled}
|
||||
data-slot="wizard-stepper-first"
|
||||
aria-label={firstLabel}
|
||||
>
|
||||
<SkipBack className="h-4 w-4" aria-hidden="true" />
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="relative h-8 w-8 shrink-0 before:absolute before:-inset-1.5 before:content-['']"
|
||||
onClick={onFirst}
|
||||
disabled={!firstEnabled}
|
||||
data-slot="wizard-stepper-first"
|
||||
aria-label={firstLabel}
|
||||
>
|
||||
<SkipBack className="h-4 w-4" aria-hidden="true" />
|
||||
</Button>
|
||||
|
||||
<ol className="flex min-w-0 flex-1 items-center justify-between">
|
||||
{steps.map((stepNumber, index) => {
|
||||
const isActive = index === activeIndex;
|
||||
const isCompleted = index < activeIndex;
|
||||
const isReachable = index <= reachableUntil;
|
||||
const label = labels[stepNumber] ?? String(stepNumber);
|
||||
// Backward + current are always navigable; forward is gated
|
||||
// on the reachability ceiling.
|
||||
const enabled = index <= activeIndex || isReachable;
|
||||
// A connector segment leads INTO this dot from the previous
|
||||
// one; it reads "completed" (solid) once we've passed it.
|
||||
const connectorSolid = index <= activeIndex;
|
||||
<ol className="flex min-w-0 flex-1 items-center justify-between">
|
||||
{steps.map((stepNumber, index) => {
|
||||
const isActive = index === activeIndex;
|
||||
const isCompleted = index < activeIndex;
|
||||
const isReachable = index <= reachableUntil;
|
||||
const label = labels[stepNumber] ?? String(stepNumber);
|
||||
// Backward + current are always navigable; forward is gated
|
||||
// on the reachability ceiling.
|
||||
const enabled = index <= activeIndex || isReachable;
|
||||
// A connector segment leads INTO this dot from the previous
|
||||
// one; it reads "completed" (solid) once we've passed it.
|
||||
const connectorSolid = index <= activeIndex;
|
||||
|
||||
return (
|
||||
<li
|
||||
key={stepNumber}
|
||||
className={cn(
|
||||
"flex min-w-0 items-center",
|
||||
index === 0 ? "flex-initial" : "flex-1",
|
||||
)}
|
||||
>
|
||||
{index > 0 && (
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={cn(
|
||||
"mx-1 h-0 flex-1 border-t",
|
||||
connectorSolid
|
||||
? "border-primary"
|
||||
: "border-muted-foreground/30 border-dashed",
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => onJump(stepNumber)}
|
||||
disabled={!enabled}
|
||||
data-slot="wizard-stepper-dot"
|
||||
data-step-dot={stepNumber}
|
||||
data-active={isActive || undefined}
|
||||
data-completed={isCompleted || undefined}
|
||||
aria-current={isActive ? "step" : undefined}
|
||||
aria-label={`${index + 1}. ${label}`}
|
||||
return (
|
||||
<li
|
||||
key={stepNumber}
|
||||
className={cn(
|
||||
// 44 px hit target via padding even though the visual
|
||||
// dot is small.
|
||||
"group focus-visible:ring-ring/50 flex shrink-0 flex-col items-center gap-1 rounded-md p-2 transition-colors focus-visible:ring-2 focus-visible:outline-none",
|
||||
enabled
|
||||
? "cursor-pointer"
|
||||
: "cursor-not-allowed opacity-60",
|
||||
"flex min-w-0 items-center",
|
||||
index === 0 ? "flex-initial" : "flex-1",
|
||||
)}
|
||||
>
|
||||
<span
|
||||
{index > 0 && (
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={cn(
|
||||
"mx-1 h-0 flex-1 border-t",
|
||||
connectorSolid
|
||||
? "border-primary"
|
||||
: "border-muted-foreground/30 border-dashed",
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => onJump(stepNumber)}
|
||||
disabled={!enabled}
|
||||
data-slot="wizard-stepper-dot"
|
||||
data-step-dot={stepNumber}
|
||||
data-active={isActive || undefined}
|
||||
data-completed={isCompleted || undefined}
|
||||
aria-current={isActive ? "step" : undefined}
|
||||
aria-label={`${index + 1}. ${label}`}
|
||||
className={cn(
|
||||
"grid h-3 w-3 place-items-center rounded-full border transition-colors",
|
||||
isActive
|
||||
? "border-primary bg-primary ring-primary/30 ring-2 ring-offset-1 ring-offset-transparent"
|
||||
: isCompleted
|
||||
? "border-primary bg-primary"
|
||||
: isReachable
|
||||
? "border-primary bg-transparent"
|
||||
: "border-muted-foreground/30 bg-transparent",
|
||||
)}
|
||||
/>
|
||||
<span
|
||||
className={cn(
|
||||
"max-w-[6rem] truncate text-[0.6875rem] leading-none",
|
||||
isActive
|
||||
? "text-foreground font-medium"
|
||||
: "text-muted-foreground",
|
||||
// Crowding guard: narrow viewports drop the per-dot
|
||||
// labels entirely (the caption below names the active
|
||||
// step instead); from `sm+` every dot is labelled.
|
||||
"hidden sm:inline",
|
||||
// 44 px hit target via padding even though the visual
|
||||
// dot is small.
|
||||
"group focus-visible:ring-ring/50 flex shrink-0 flex-col items-center gap-1 rounded-md p-2 transition-colors focus-visible:ring-2 focus-visible:outline-none",
|
||||
enabled
|
||||
? "cursor-pointer"
|
||||
: "cursor-not-allowed opacity-60",
|
||||
)}
|
||||
>
|
||||
{label}
|
||||
</span>
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ol>
|
||||
<span
|
||||
className={cn(
|
||||
"grid h-3 w-3 place-items-center rounded-full border transition-colors",
|
||||
isActive
|
||||
? "border-primary bg-primary ring-primary/30 ring-2 ring-offset-1 ring-offset-transparent"
|
||||
: isCompleted
|
||||
? "border-primary bg-primary"
|
||||
: isReachable
|
||||
? "border-primary bg-transparent"
|
||||
: "border-muted-foreground/30 bg-transparent",
|
||||
)}
|
||||
/>
|
||||
<span
|
||||
className={cn(
|
||||
"max-w-[6rem] truncate text-[0.6875rem] leading-none",
|
||||
isActive
|
||||
? "text-foreground font-medium"
|
||||
: "text-muted-foreground",
|
||||
// Crowding guard: narrow viewports drop the per-dot
|
||||
// labels entirely (the caption below names the active
|
||||
// step instead); from `sm+` every dot is labelled.
|
||||
"hidden sm:inline",
|
||||
)}
|
||||
>
|
||||
{label}
|
||||
</span>
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ol>
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="relative h-8 w-8 shrink-0 before:absolute before:-inset-1.5 before:content-['']"
|
||||
onClick={onLast}
|
||||
disabled={!lastEnabled}
|
||||
data-slot="wizard-stepper-last"
|
||||
aria-label={lastLabel}
|
||||
>
|
||||
<SkipForward className="h-4 w-4" aria-hidden="true" />
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="relative h-8 w-8 shrink-0 before:absolute before:-inset-1.5 before:content-['']"
|
||||
onClick={onLast}
|
||||
disabled={!lastEnabled}
|
||||
data-slot="wizard-stepper-last"
|
||||
aria-label={lastLabel}
|
||||
>
|
||||
<SkipForward className="h-4 w-4" aria-hidden="true" />
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* Compact caption — on narrow viewports the per-dot labels collapse
|
||||
|
||||
Reference in new issue
Block a user