import { NgTemplateOutlet } from '@angular/common';
import {
afterRenderEffect,
booleanAttribute,
ChangeDetectionStrategy,
Component,
computed,
contentChildren,
ElementRef,
inject,
input,
output,
signal,
TemplateRef,
viewChild,
} from '@angular/core';
import { ModeColorService } from '@africanies/africanies-theme';
import { AfricaniesUiI18n } from '../i18n/africanies-ui-i18n';
import { StepDefDirective } from './step-def.directive';
import { StepDefinition } from './step-definition';
function prefersReducedMotion(): boolean {
return (
typeof matchMedia === 'function' &&
matchMedia('(prefers-reduced-motion: reduce)').matches
);
}
/**
* Multi-step wizard for form flows (e.g. shipment creation).
*
* Distinct from a status *timeline*: this component navigates wizard steps,
* it does not display shipment delivery progress.
*
* Inputs: `steps`, `activeIndex`, and `linear` (default `true`). In linear
* mode, header clicks only activate the current or a previous step; advance
* with Next. Non-linear mode allows jumping to any step via its header.
*
* When `animateSteps` is true (default), the step body fades/slides via the
* Web Animations API (skipped when the user prefers reduced motion).
*/
@Component({
selector: 'africanies-stepper',
standalone: true,
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [NgTemplateOutlet],
host: { class: 'block min-w-0' },
styles: `
.africanies-step-rail {
scrollbar-width: thin;
}
.africanies-step-body {
min-width: 0;
overflow-x: clip;
/* 4 px breathing room so any remaining external focus rings are not clipped */
padding-inline: 4px;
margin-inline: -4px;
}
.africanies-step-pane {
min-width: 0;
will-change: opacity, transform;
}
`,
template: `