@su-labs/stepper 0.0.0-stage → 19.0.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/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [22.0.0] - 2026-11-17
9
+
10
+ ### Added
11
+ - `su-lib-stepper` with `su-lib-step` pages shown one at a time: a numbered circle per step joined by a line, as many steps as you need, each with an optional `label`
12
+ - Rules per step: `canNext`, `canBack` and `disabled`; jumps check every step they pass, and the `linear` option keeps forward jumps to visited steps
13
+ - `orientation`: `'horizontal'` or `'vertical'`
14
+ - `tabs`: the step headers act as tabs (`tablist`, `tab`, `tabpanel`), still following the rules, with the arrow keys, Home and End; steps out of reach are announced as unavailable
15
+ - Back and Next buttons (`controls`), `[(current)]`, and `next()`, `back()`, `goTo()` and `reset()` for your own buttons; focus moves to the new step's content after Back or Next
16
+ - Without tabs, a list of steps with `aria-current="step"`; each step reads out its place, label and whether it's completed
17
+ - `labels` to replace the texts, and `--su-stepper-*` CSS variables
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Yevheniy Alekseyev <yev.alekseyev@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,122 @@
1
- # Temporary Holding Version
1
+ # Stepper
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `@su-labs/stepper`
4
+
5
+ ![Angular Version](https://img.shields.io/badge/Angular-v22-DD0031?style=for-the-badge&logo=angular&logoColor=white)
6
+ ![License](https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge)
7
+
8
+ Content split into steps shown one at a time, for Angular:
9
+
10
+ - **Numbered steps**: a circle with its number per step, joined by a line, as many steps as you need. Each step can have its own title, or just the number.
11
+ - **Rules**: each step says whether the user may go forward (e.g. once its form is valid) and whether they may go back.
12
+ - **Horizontal or vertical**: the steps in a row above the content, or in a column beside it.
13
+ - **Tabs**: the step headers can act as tabs, so a click goes straight to a step, still following the rules.
14
+ - **Accessible**: a list of steps with `aria-current="step"`, or tabs with the arrow keys, Home and End; steps out of reach are announced, and focus moves to the new step's content.
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install @su-labs/stepper@ng19
20
+ ```
21
+
22
+ This is the Angular 19 version. For the newest Angular, install `@su-labs/stepper` without a tag.
23
+
24
+ ## Usage
25
+
26
+ ```ts
27
+ import { SuStepComponent, SuStepperComponent } from '@su-labs/stepper';
28
+
29
+ @Component({
30
+ imports: [SuStepComponent, SuStepperComponent],
31
+ })
32
+ ```
33
+
34
+ ```html
35
+ <su-lib-stepper label="Sign up" [(current)]="step">
36
+ <su-lib-step label="Account" [canNext]="name().length > 0">
37
+ <label>Name <input #nameInput [value]="name()" (input)="name.set(nameInput.value)" /></label>
38
+ </su-lib-step>
39
+ <su-lib-step label="Address">…</su-lib-step>
40
+ <su-lib-step label="Confirm" [canBack]="false">…</su-lib-step>
41
+ </su-lib-stepper>
42
+ ```
43
+
44
+ Leave `label` out to show only the step's number. A step is completed once the user leaves it forward, as long as it still allows going forward.
45
+
46
+ ### Stepper
47
+
48
+ | Input | Default | |
49
+ |---|---|---|
50
+ | `orientation` | `'horizontal'` | `'horizontal'` or `'vertical'` |
51
+ | `tabs` | `false` | The step headers act as tabs: a click (or Enter) goes to its step if the rules allow it |
52
+ | `linear` | `false` | Going forward by more than one step only reaches steps already visited |
53
+ | `controls` | `true` | Back and Next buttons under the steps |
54
+ | `[(current)]` | `0` | The step on screen, from 0; setting it shows that step without checking the rules |
55
+ | `label` | `'Steps'` | The name of the list of steps for screen readers |
56
+ | `labels` | English | Texts to replace: `steps`, `step(number, count)`, `completed`, `unavailable`, `back`, `next` |
57
+
58
+ | Method | |
59
+ |---|---|
60
+ | `next()` / `back()` | Goes to the next or previous step that isn't disabled, if the rules allow it; returns whether it moved |
61
+ | `goTo(index)` | Goes to a step, from 0, if the rules allow it |
62
+ | `reset(start?)` | Back to a step (the first by default) with nothing visited or completed |
63
+
64
+ To use your own buttons, set `[controls]="false"` and call the methods through a reference: `<su-lib-stepper #stepper>` and `(click)="stepper.next()"`.
65
+
66
+ ### Step
67
+
68
+ | Input | Default | |
69
+ |---|---|---|
70
+ | `label` | — | The text beside the step's number |
71
+ | `canNext` | `true` | The user may go forward from this step |
72
+ | `canBack` | `true` | The user may go back from this step |
73
+ | `disabled` | `false` | The step can't be visited; Back and Next skip it |
74
+
75
+ A jump from a step header checks every step it passes: forward, each one's `canNext`; back, each one's `canBack`.
76
+
77
+ ## Accessibility
78
+
79
+ - Without `tabs`, the steps are an ordered list and the current one has `aria-current="step"`; each step's content is a group named by its header.
80
+ - With `tabs`, the headers are a `tablist` of `tab`s, each controlling its `tabpanel`. The arrow keys, Home and End move between them and Enter or Space goes to the step. Steps out of reach have `aria-disabled` and stay focusable, so they're announced.
81
+ - Each header reads out its place, label and state, e.g. "Step 2 of 3, Address, Completed".
82
+ - After Back or Next, focus moves to the new step's content. The Next button stays focusable while its step blocks it, with `aria-disabled`.
83
+
84
+ ## Theming
85
+
86
+ | Variable | Default | |
87
+ |---|---|---|
88
+ | `--su-stepper-accent` | `#2563eb` | The current step's ring, completed steps and the Next button |
89
+ | `--su-stepper-accent-text` | `#ffffff` | Text on the accent |
90
+ | `--su-stepper-marker-size` | `2rem` | The circles |
91
+ | `--su-stepper-marker-background` | `transparent` | Circles of steps not completed |
92
+ | `--su-stepper-marker-border` | `2px solid rgb(0 0 0 / 0.2)` | |
93
+ | `--su-stepper-marker-color` | `inherit` | The number |
94
+ | `--su-stepper-marker-font-size` | `0.875rem` | |
95
+ | `--su-stepper-current-background` | `transparent` | The current step's circle |
96
+ | `--su-stepper-current-color` | the accent | The current step's number |
97
+ | `--su-stepper-current-label-weight` | `600` | |
98
+ | `--su-stepper-label-color` | `inherit` | |
99
+ | `--su-stepper-label-font-size` | `0.95rem` | |
100
+ | `--su-stepper-line-color` | `rgb(0 0 0 / 0.15)` | The line between steps |
101
+ | `--su-stepper-line-done-color` | the accent | The line after a completed step |
102
+ | `--su-stepper-line-width` | `2px` | |
103
+ | `--su-stepper-step-gap` | `1.5rem` | Room between steps when vertical |
104
+ | `--su-stepper-vertical-gap` | `1.5rem` | Room between the steps and the content when vertical |
105
+ | `--su-stepper-tab-hover-background` | `rgb(0 0 0 / 0.05)` | Headers acting as tabs |
106
+ | `--su-stepper-panel-padding` | `1rem 0` | Each step's content |
107
+ | `--su-stepper-button-background` | `transparent` | The Back button |
108
+ | `--su-stepper-button-border` | `1px solid rgb(0 0 0 / 0.2)` | |
109
+ | `--su-stepper-button-color` | `inherit` | |
110
+ | `--su-stepper-button-radius` | `0.5rem` | |
111
+ | `--su-stepper-primary-background` | the accent | The Next button |
112
+ | `--su-stepper-primary-color` | the accent text | |
113
+ | `--su-stepper-disabled-opacity` | `0.45` | Disabled steps and blocked buttons |
114
+ | `--su-stepper-focus-ring` | `2px solid currentColor` | |
115
+
116
+ ## Without Angular
117
+
118
+ The same logic is in [`@su-labs/core`](https://www.npmjs.com/package/@su-labs/core): `SuStepperController` from `@su-labs/core/stepper` keeps the current step, the visited and completed ones and checks each move, and you render the steps.
119
+
120
+ ## License
121
+
122
+ MIT
@@ -0,0 +1,201 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, input, booleanAttribute, computed, inject, ElementRef, ChangeDetectionStrategy, Component, model, contentChildren, signal, viewChildren, DestroyRef, effect, untracked, afterRenderEffect } from '@angular/core';
3
+ import { SuStepperController, SU_STEPPER_LABELS } from '@su-labs/core/stepper';
4
+
5
+ const SU_STEPPER = new InjectionToken('SU_STEPPER');
6
+
7
+ /**
8
+ * One step of `su-lib-stepper`: its content shows while it's the current step. Its rules say when the user may leave
9
+ * it, e.g. `[canNext]="form.valid"`.
10
+ */
11
+ class SuStepComponent {
12
+ /** The text beside the step's number; without it, only the number shows */
13
+ label = input();
14
+ /** The user may go forward from this step, e.g. once its form is valid @default true */
15
+ canNext = input(true, { transform: booleanAttribute });
16
+ /** The user may go back from this step @default true */
17
+ canBack = input(true, { transform: booleanAttribute });
18
+ /** The step can't be visited; moving forward or back skips it @default false */
19
+ disabled = input(false, { transform: booleanAttribute });
20
+ /** The step's options for `SuStepperController` */
21
+ options = computed(() => ({
22
+ label: this.label(),
23
+ canNext: this.canNext(),
24
+ canBack: this.canBack(),
25
+ disabled: this.disabled(),
26
+ }));
27
+ stepper = inject(SU_STEPPER);
28
+ host = inject(ElementRef);
29
+ index = computed(() => this.stepper.steps().indexOf(this));
30
+ isCurrent = computed(() => this.index() === this.stepper.current());
31
+ panelId = computed(() => this.stepper.panelId(this.index()));
32
+ headerId = computed(() => this.stepper.headerId(this.index()));
33
+ /** Moves keyboard focus to the step's content */
34
+ focus() {
35
+ this.host.nativeElement.focus();
36
+ }
37
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: SuStepComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
38
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.25", type: SuStepComponent, isStandalone: true, selector: "su-lib-step", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, canNext: { classPropertyName: "canNext", publicName: "canNext", isSignal: true, isRequired: false, transformFunction: null }, canBack: { classPropertyName: "canBack", publicName: "canBack", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "tabindex": "-1" }, properties: { "id": "panelId()", "attr.role": "stepper.tabs() ? 'tabpanel' : 'group'", "attr.aria-labelledby": "headerId()", "hidden": "!isCurrent()" }, classAttribute: "su-stepper-panel" }, ngImport: i0, template: "<ng-content />\n", styles: [":host{border-radius:var(--su-stepper-panel-radius, .5rem);display:block;outline:none;padding:var(--su-stepper-panel-padding, 1rem 0)}:host:focus-visible{outline:var(--su-stepper-focus-ring, 2px solid currentColor);outline-offset:2px}:host([hidden]){display:none}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
39
+ }
40
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: SuStepComponent, decorators: [{
41
+ type: Component,
42
+ args: [{ selector: 'su-lib-step', changeDetection: ChangeDetectionStrategy.OnPush, host: {
43
+ class: 'su-stepper-panel',
44
+ tabindex: '-1',
45
+ '[id]': 'panelId()',
46
+ '[attr.role]': "stepper.tabs() ? 'tabpanel' : 'group'",
47
+ '[attr.aria-labelledby]': 'headerId()',
48
+ '[hidden]': '!isCurrent()',
49
+ }, template: "<ng-content />\n", styles: [":host{border-radius:var(--su-stepper-panel-radius, .5rem);display:block;outline:none;padding:var(--su-stepper-panel-padding, 1rem 0)}:host:focus-visible{outline:var(--su-stepper-focus-ring, 2px solid currentColor);outline-offset:2px}:host([hidden]){display:none}\n"] }]
50
+ }] });
51
+
52
+ /** A step's circle with its number and its label, with the step's place and state for screen readers */
53
+ class SuStepperHeaderComponent {
54
+ step = input.required();
55
+ count = input.required();
56
+ labels = input.required();
57
+ description = computed(() => {
58
+ const step = this.step();
59
+ const labels = this.labels();
60
+ return [
61
+ labels.step(step.number, this.count()),
62
+ step.label,
63
+ step.completed ? labels.completed : null,
64
+ step.disabled ? labels.unavailable : null,
65
+ ]
66
+ .filter(part => part !== null)
67
+ .join(', ');
68
+ });
69
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: SuStepperHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
70
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: SuStepperHeaderComponent, isStandalone: true, selector: "su-lib-stepper-header", inputs: { step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: true, transformFunction: null }, count: { classPropertyName: "count", publicName: "count", isSignal: true, isRequired: true, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class.is-current": "step().current", "class.is-completed": "step().completed", "class.is-visited": "step().visited", "class.is-disabled": "step().disabled" }, classAttribute: "su-stepper-header-content" }, ngImport: i0, template: "<span class=\"su-stepper-marker\" aria-hidden=\"true\">{{ step().number }}</span>\n@if (step().label; as label) {\n <span class=\"su-stepper-label\" aria-hidden=\"true\">{{ label }}</span>\n}\n<span class=\"su-stepper-visually-hidden\">{{ description() }}</span>\n", styles: [":host{align-items:center;display:inline-flex;gap:var(--su-stepper-label-gap, .5rem);min-width:0}.su-stepper-marker{align-items:center;background:var(--su-stepper-marker-background, transparent);border:var(--su-stepper-marker-border, 2px solid rgba(0, 0, 0, .2));border-radius:50%;box-sizing:border-box;color:var(--su-stepper-marker-color, inherit);display:inline-flex;flex:none;font-size:var(--su-stepper-marker-font-size, .875rem);font-variant-numeric:tabular-nums;font-weight:600;height:var(--su-stepper-marker-size, 2rem);justify-content:center;transition:background-color .2s ease,border-color .2s ease,color .2s ease;width:var(--su-stepper-marker-size, 2rem)}.su-stepper-label{color:var(--su-stepper-label-color, inherit);font-size:var(--su-stepper-label-font-size, .95rem);overflow-wrap:anywhere}:host(.is-current) .su-stepper-marker{background:var(--su-stepper-current-background, transparent);border-color:var(--su-stepper-accent, #2563eb);color:var(--su-stepper-current-color, var(--su-stepper-accent, #2563eb))}:host(.is-current) .su-stepper-label{color:var(--su-stepper-current-label-color, inherit);font-weight:var(--su-stepper-current-label-weight, 600)}:host(.is-completed) .su-stepper-marker{background:var(--su-stepper-accent, #2563eb);border-color:var(--su-stepper-accent, #2563eb);color:var(--su-stepper-accent-text, #ffffff)}:host(.is-disabled){opacity:var(--su-stepper-disabled-opacity, .45)}.su-stepper-visually-hidden{clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}@media(prefers-reduced-motion:reduce){.su-stepper-marker{transition:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
71
+ }
72
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: SuStepperHeaderComponent, decorators: [{
73
+ type: Component,
74
+ args: [{ selector: 'su-lib-stepper-header', changeDetection: ChangeDetectionStrategy.OnPush, host: {
75
+ class: 'su-stepper-header-content',
76
+ '[class.is-current]': 'step().current',
77
+ '[class.is-completed]': 'step().completed',
78
+ '[class.is-visited]': 'step().visited',
79
+ '[class.is-disabled]': 'step().disabled',
80
+ }, template: "<span class=\"su-stepper-marker\" aria-hidden=\"true\">{{ step().number }}</span>\n@if (step().label; as label) {\n <span class=\"su-stepper-label\" aria-hidden=\"true\">{{ label }}</span>\n}\n<span class=\"su-stepper-visually-hidden\">{{ description() }}</span>\n", styles: [":host{align-items:center;display:inline-flex;gap:var(--su-stepper-label-gap, .5rem);min-width:0}.su-stepper-marker{align-items:center;background:var(--su-stepper-marker-background, transparent);border:var(--su-stepper-marker-border, 2px solid rgba(0, 0, 0, .2));border-radius:50%;box-sizing:border-box;color:var(--su-stepper-marker-color, inherit);display:inline-flex;flex:none;font-size:var(--su-stepper-marker-font-size, .875rem);font-variant-numeric:tabular-nums;font-weight:600;height:var(--su-stepper-marker-size, 2rem);justify-content:center;transition:background-color .2s ease,border-color .2s ease,color .2s ease;width:var(--su-stepper-marker-size, 2rem)}.su-stepper-label{color:var(--su-stepper-label-color, inherit);font-size:var(--su-stepper-label-font-size, .95rem);overflow-wrap:anywhere}:host(.is-current) .su-stepper-marker{background:var(--su-stepper-current-background, transparent);border-color:var(--su-stepper-accent, #2563eb);color:var(--su-stepper-current-color, var(--su-stepper-accent, #2563eb))}:host(.is-current) .su-stepper-label{color:var(--su-stepper-current-label-color, inherit);font-weight:var(--su-stepper-current-label-weight, 600)}:host(.is-completed) .su-stepper-marker{background:var(--su-stepper-accent, #2563eb);border-color:var(--su-stepper-accent, #2563eb);color:var(--su-stepper-accent-text, #ffffff)}:host(.is-disabled){opacity:var(--su-stepper-disabled-opacity, .45)}.su-stepper-visually-hidden{clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}@media(prefers-reduced-motion:reduce){.su-stepper-marker{transition:none}}\n"] }]
81
+ }] });
82
+
83
+ let nextStepperId = 0;
84
+ /** Keys that move focus between the step headers when they act as tabs, and where each one goes */
85
+ const TAB_KEYS = {
86
+ ArrowRight: (index, count) => (index + 1) % count,
87
+ ArrowDown: (index, count) => (index + 1) % count,
88
+ ArrowLeft: (index, count) => (index - 1 + count) % count,
89
+ ArrowUp: (index, count) => (index - 1 + count) % count,
90
+ Home: () => 0,
91
+ End: (_index, count) => count - 1,
92
+ };
93
+ /**
94
+ * Content split into steps (`su-lib-step`) shown one at a time, over `SuStepperController` from
95
+ * `@su-labs/core/stepper`: a numbered circle per step joined by a line, horizontal or vertical, with Back and Next
96
+ * buttons that follow each step's rules. With `tabs`, the step headers act as tabs too, still following the rules.
97
+ */
98
+ class SuStepperComponent {
99
+ /** @default 'horizontal' */
100
+ orientation = input('horizontal');
101
+ /** The step headers act as tabs: clicking one goes to its step, if the rules allow it @default false */
102
+ tabs = input(false, { transform: booleanAttribute });
103
+ /** Going forward by more than one step only reaches steps already visited @default false */
104
+ linear = input(false, { transform: booleanAttribute });
105
+ /** Back and Next buttons under the steps; without them, call `next()` and `back()` from your own @default true */
106
+ controls = input(true, { transform: booleanAttribute });
107
+ /** The name of the list of steps for screen readers @default labels.steps */
108
+ label = input();
109
+ /** Texts to replace, e.g. in the page's language */
110
+ labels = input({});
111
+ /** The step on screen, from 0; setting it shows that step without checking the rules */
112
+ current = model(0);
113
+ steps = contentChildren(SuStepComponent);
114
+ controller = new SuStepperController();
115
+ state = signal(this.controller.state.get());
116
+ text = computed(() => ({
117
+ ...SU_STEPPER_LABELS,
118
+ ...this.labels(),
119
+ }));
120
+ tabButtons = viewChildren('tab');
121
+ /** The step's content takes focus once it renders, after a move the user made with the buttons */
122
+ focusPending = false;
123
+ id = `su-stepper-${nextStepperId++}`;
124
+ constructor() {
125
+ const unsubscribe = this.controller.state.subscribe(state => {
126
+ this.state.set(state);
127
+ this.current.set(state.current);
128
+ });
129
+ inject(DestroyRef).onDestroy(unsubscribe);
130
+ effect(() => {
131
+ const steps = this.steps().map(step => step.options());
132
+ const linear = this.linear();
133
+ const current = this.current();
134
+ untracked(() => {
135
+ this.controller.setSteps(steps);
136
+ this.controller.setLinear(linear);
137
+ this.controller.select(current);
138
+ });
139
+ });
140
+ afterRenderEffect(() => {
141
+ const current = this.state().current;
142
+ if (this.focusPending) {
143
+ this.focusPending = false;
144
+ untracked(() => this.steps()[current]?.focus());
145
+ }
146
+ });
147
+ }
148
+ /** Goes to the next step that isn't disabled, if the current one allows it; returns whether it moved */
149
+ next() {
150
+ return this.controller.next();
151
+ }
152
+ /** Goes to the previous step that isn't disabled, if the current one allows it; returns whether it moved */
153
+ back() {
154
+ return this.controller.back();
155
+ }
156
+ /** Goes to a step, from 0, if the rules allow it; returns whether it moved */
157
+ goTo(index) {
158
+ return this.controller.goTo(index);
159
+ }
160
+ /** Starts over: back to a step (the first by default) with nothing visited or completed */
161
+ reset(start = 0) {
162
+ this.controller.reset(start);
163
+ }
164
+ headerId(index) {
165
+ return `${this.id}-step-${index}`;
166
+ }
167
+ panelId(index) {
168
+ return `${this.id}-panel-${index}`;
169
+ }
170
+ onNext() {
171
+ this.focusPending = this.next();
172
+ }
173
+ onBack() {
174
+ this.focusPending = this.back();
175
+ }
176
+ onTabKeydown(event, index) {
177
+ const target = TAB_KEYS[event.key];
178
+ const buttons = this.tabButtons();
179
+ if (!target || buttons.length === 0) {
180
+ return;
181
+ }
182
+ event.preventDefault();
183
+ buttons[target(index, buttons.length)]?.nativeElement.focus();
184
+ }
185
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: SuStepperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
186
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: SuStepperComponent, isStandalone: true, selector: "su-lib-stepper", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, tabs: { classPropertyName: "tabs", publicName: "tabs", isSignal: true, isRequired: false, transformFunction: null }, linear: { classPropertyName: "linear", publicName: "linear", isSignal: true, isRequired: false, transformFunction: null }, controls: { classPropertyName: "controls", publicName: "controls", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null }, current: { classPropertyName: "current", publicName: "current", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { current: "currentChange" }, host: { properties: { "class.su-stepper-vertical": "orientation() === 'vertical'" }, classAttribute: "su-stepper" }, providers: [{ provide: SU_STEPPER, useExisting: SuStepperComponent }], queries: [{ propertyName: "steps", predicate: SuStepComponent, isSignal: true }], viewQueries: [{ propertyName: "tabButtons", predicate: ["tab"], descendants: true, isSignal: true }], ngImport: i0, template: "<ol\n class=\"su-stepper-steps\"\n [attr.role]=\"tabs() ? 'tablist' : null\"\n [attr.aria-orientation]=\"tabs() ? orientation() : null\"\n [attr.aria-label]=\"label() ?? text().steps\">\n @for (step of state().steps; track step.index) {\n <li\n class=\"su-stepper-step\"\n [class.is-current]=\"step.current\"\n [class.is-completed]=\"step.completed\"\n [attr.role]=\"tabs() ? 'presentation' : null\"\n [attr.aria-current]=\"!tabs() && step.current ? 'step' : null\">\n @if (tabs()) {\n <button\n #tab\n type=\"button\"\n role=\"tab\"\n class=\"su-stepper-header su-stepper-tab\"\n [id]=\"headerId(step.index)\"\n [attr.aria-controls]=\"panelId(step.index)\"\n [attr.aria-selected]=\"step.current\"\n [attr.aria-disabled]=\"step.current || step.reachable ? null : 'true'\"\n [tabIndex]=\"step.current ? 0 : -1\"\n (click)=\"goTo(step.index)\"\n (keydown)=\"onTabKeydown($event, step.index)\">\n <su-lib-stepper-header [step]=\"step\" [count]=\"state().count\" [labels]=\"text()\" />\n </button>\n } @else {\n <div class=\"su-stepper-header\" [id]=\"headerId(step.index)\">\n <su-lib-stepper-header [step]=\"step\" [count]=\"state().count\" [labels]=\"text()\" />\n </div>\n }\n </li>\n }\n</ol>\n\n<div class=\"su-stepper-body\">\n <ng-content />\n\n @if (controls() && state().count > 1) {\n <div class=\"su-stepper-controls\">\n @if (!state().isFirst) {\n <button\n type=\"button\"\n class=\"su-stepper-button su-stepper-back\"\n [attr.aria-disabled]=\"state().canBack ? null : 'true'\"\n (click)=\"onBack()\">\n {{ text().back }}\n </button>\n }\n @if (!state().isLast) {\n <button\n type=\"button\"\n class=\"su-stepper-button su-stepper-next\"\n [attr.aria-disabled]=\"state().canNext ? null : 'true'\"\n (click)=\"onNext()\">\n {{ text().next }}\n </button>\n }\n </div>\n }\n</div>\n", styles: [":host{color:var(--su-stepper-text-color, inherit);display:block;font-family:var(--su-stepper-font-family, inherit);min-width:0}.su-stepper-steps{display:flex;list-style:none;margin:0;padding:0}.su-stepper-step{align-items:center;display:flex;flex:1 1 0;min-width:0}.su-stepper-step:last-child{flex:0 1 auto}.su-stepper-step:not(:last-child):after{background:var(--su-stepper-line-color, rgba(0, 0, 0, .15));content:\"\";flex:1 1 1rem;height:var(--su-stepper-line-width, 2px);margin-inline:var(--su-stepper-line-gap, .5rem);min-width:1rem}.su-stepper-step.is-completed:after{background:var(--su-stepper-line-done-color, var(--su-stepper-accent, #2563eb))}.su-stepper-header{border-radius:var(--su-stepper-header-radius, .5rem);display:flex;min-width:0;padding:var(--su-stepper-header-padding, .25rem)}.su-stepper-tab{background:none;border:none;color:inherit;cursor:pointer;font:inherit;text-align:start}.su-stepper-tab:hover:not([aria-disabled=true]){background:var(--su-stepper-tab-hover-background, rgba(0, 0, 0, .05))}.su-stepper-tab[aria-disabled=true]{cursor:not-allowed}.su-stepper-tab:focus-visible,.su-stepper-button:focus-visible{outline:var(--su-stepper-focus-ring, 2px solid currentColor);outline-offset:2px}.su-stepper-body{min-width:0}.su-stepper-controls{display:flex;gap:var(--su-stepper-controls-gap, .5rem);margin-top:var(--su-stepper-controls-margin, .5rem)}.su-stepper-button{background:var(--su-stepper-button-background, transparent);border:var(--su-stepper-button-border, 1px solid rgba(0, 0, 0, .2));border-radius:var(--su-stepper-button-radius, .5rem);color:var(--su-stepper-button-color, inherit);cursor:pointer;font:inherit;font-weight:600;padding:var(--su-stepper-button-padding, .5rem 1rem)}.su-stepper-button[aria-disabled=true]{cursor:not-allowed;opacity:var(--su-stepper-disabled-opacity, .45)}.su-stepper-next{background:var(--su-stepper-primary-background, var(--su-stepper-accent, #2563eb));border-color:transparent;color:var(--su-stepper-primary-color, var(--su-stepper-accent-text, #ffffff));margin-inline-start:auto}:host(.su-stepper-vertical){align-items:flex-start;display:flex;flex-wrap:wrap;gap:var(--su-stepper-vertical-gap, 1.5rem)}:host(.su-stepper-vertical) .su-stepper-steps{flex:0 0 auto;flex-direction:column;max-width:100%}:host(.su-stepper-vertical) .su-stepper-step{flex:none;padding-bottom:var(--su-stepper-step-gap, 1.5rem);position:relative}:host(.su-stepper-vertical) .su-stepper-step:last-child{padding-bottom:0}:host(.su-stepper-vertical) .su-stepper-step:not(:last-child):after{bottom:.25rem;height:auto;inset-inline-start:calc(var(--su-stepper-header-padding, .25rem) + var(--su-stepper-marker-size, 2rem) / 2 - var(--su-stepper-line-width, 2px) / 2);margin:0;min-width:0;position:absolute;top:calc(var(--su-stepper-marker-size, 2rem) + var(--su-stepper-header-padding, .25rem) * 2 + .25rem);width:var(--su-stepper-line-width, 2px)}:host(.su-stepper-vertical) .su-stepper-body{flex:1 1 16rem}\n"], dependencies: [{ kind: "component", type: SuStepperHeaderComponent, selector: "su-lib-stepper-header", inputs: ["step", "count", "labels"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
187
+ }
188
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: SuStepperComponent, decorators: [{
189
+ type: Component,
190
+ args: [{ selector: 'su-lib-stepper', changeDetection: ChangeDetectionStrategy.OnPush, imports: [SuStepperHeaderComponent], providers: [{ provide: SU_STEPPER, useExisting: SuStepperComponent }], host: {
191
+ class: 'su-stepper',
192
+ '[class.su-stepper-vertical]': "orientation() === 'vertical'",
193
+ }, template: "<ol\n class=\"su-stepper-steps\"\n [attr.role]=\"tabs() ? 'tablist' : null\"\n [attr.aria-orientation]=\"tabs() ? orientation() : null\"\n [attr.aria-label]=\"label() ?? text().steps\">\n @for (step of state().steps; track step.index) {\n <li\n class=\"su-stepper-step\"\n [class.is-current]=\"step.current\"\n [class.is-completed]=\"step.completed\"\n [attr.role]=\"tabs() ? 'presentation' : null\"\n [attr.aria-current]=\"!tabs() && step.current ? 'step' : null\">\n @if (tabs()) {\n <button\n #tab\n type=\"button\"\n role=\"tab\"\n class=\"su-stepper-header su-stepper-tab\"\n [id]=\"headerId(step.index)\"\n [attr.aria-controls]=\"panelId(step.index)\"\n [attr.aria-selected]=\"step.current\"\n [attr.aria-disabled]=\"step.current || step.reachable ? null : 'true'\"\n [tabIndex]=\"step.current ? 0 : -1\"\n (click)=\"goTo(step.index)\"\n (keydown)=\"onTabKeydown($event, step.index)\">\n <su-lib-stepper-header [step]=\"step\" [count]=\"state().count\" [labels]=\"text()\" />\n </button>\n } @else {\n <div class=\"su-stepper-header\" [id]=\"headerId(step.index)\">\n <su-lib-stepper-header [step]=\"step\" [count]=\"state().count\" [labels]=\"text()\" />\n </div>\n }\n </li>\n }\n</ol>\n\n<div class=\"su-stepper-body\">\n <ng-content />\n\n @if (controls() && state().count > 1) {\n <div class=\"su-stepper-controls\">\n @if (!state().isFirst) {\n <button\n type=\"button\"\n class=\"su-stepper-button su-stepper-back\"\n [attr.aria-disabled]=\"state().canBack ? null : 'true'\"\n (click)=\"onBack()\">\n {{ text().back }}\n </button>\n }\n @if (!state().isLast) {\n <button\n type=\"button\"\n class=\"su-stepper-button su-stepper-next\"\n [attr.aria-disabled]=\"state().canNext ? null : 'true'\"\n (click)=\"onNext()\">\n {{ text().next }}\n </button>\n }\n </div>\n }\n</div>\n", styles: [":host{color:var(--su-stepper-text-color, inherit);display:block;font-family:var(--su-stepper-font-family, inherit);min-width:0}.su-stepper-steps{display:flex;list-style:none;margin:0;padding:0}.su-stepper-step{align-items:center;display:flex;flex:1 1 0;min-width:0}.su-stepper-step:last-child{flex:0 1 auto}.su-stepper-step:not(:last-child):after{background:var(--su-stepper-line-color, rgba(0, 0, 0, .15));content:\"\";flex:1 1 1rem;height:var(--su-stepper-line-width, 2px);margin-inline:var(--su-stepper-line-gap, .5rem);min-width:1rem}.su-stepper-step.is-completed:after{background:var(--su-stepper-line-done-color, var(--su-stepper-accent, #2563eb))}.su-stepper-header{border-radius:var(--su-stepper-header-radius, .5rem);display:flex;min-width:0;padding:var(--su-stepper-header-padding, .25rem)}.su-stepper-tab{background:none;border:none;color:inherit;cursor:pointer;font:inherit;text-align:start}.su-stepper-tab:hover:not([aria-disabled=true]){background:var(--su-stepper-tab-hover-background, rgba(0, 0, 0, .05))}.su-stepper-tab[aria-disabled=true]{cursor:not-allowed}.su-stepper-tab:focus-visible,.su-stepper-button:focus-visible{outline:var(--su-stepper-focus-ring, 2px solid currentColor);outline-offset:2px}.su-stepper-body{min-width:0}.su-stepper-controls{display:flex;gap:var(--su-stepper-controls-gap, .5rem);margin-top:var(--su-stepper-controls-margin, .5rem)}.su-stepper-button{background:var(--su-stepper-button-background, transparent);border:var(--su-stepper-button-border, 1px solid rgba(0, 0, 0, .2));border-radius:var(--su-stepper-button-radius, .5rem);color:var(--su-stepper-button-color, inherit);cursor:pointer;font:inherit;font-weight:600;padding:var(--su-stepper-button-padding, .5rem 1rem)}.su-stepper-button[aria-disabled=true]{cursor:not-allowed;opacity:var(--su-stepper-disabled-opacity, .45)}.su-stepper-next{background:var(--su-stepper-primary-background, var(--su-stepper-accent, #2563eb));border-color:transparent;color:var(--su-stepper-primary-color, var(--su-stepper-accent-text, #ffffff));margin-inline-start:auto}:host(.su-stepper-vertical){align-items:flex-start;display:flex;flex-wrap:wrap;gap:var(--su-stepper-vertical-gap, 1.5rem)}:host(.su-stepper-vertical) .su-stepper-steps{flex:0 0 auto;flex-direction:column;max-width:100%}:host(.su-stepper-vertical) .su-stepper-step{flex:none;padding-bottom:var(--su-stepper-step-gap, 1.5rem);position:relative}:host(.su-stepper-vertical) .su-stepper-step:last-child{padding-bottom:0}:host(.su-stepper-vertical) .su-stepper-step:not(:last-child):after{bottom:.25rem;height:auto;inset-inline-start:calc(var(--su-stepper-header-padding, .25rem) + var(--su-stepper-marker-size, 2rem) / 2 - var(--su-stepper-line-width, 2px) / 2);margin:0;min-width:0;position:absolute;top:calc(var(--su-stepper-marker-size, 2rem) + var(--su-stepper-header-padding, .25rem) * 2 + .25rem);width:var(--su-stepper-line-width, 2px)}:host(.su-stepper-vertical) .su-stepper-body{flex:1 1 16rem}\n"] }]
194
+ }], ctorParameters: () => [] });
195
+
196
+ /**
197
+ * Generated bundle index. Do not edit.
198
+ */
199
+
200
+ export { SuStepComponent, SuStepperComponent };
201
+ //# sourceMappingURL=su-labs-stepper.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"su-labs-stepper.mjs","sources":["../../../../compat/angular-19/build/stepper/src/lib/stepper.context.ts","../../../../compat/angular-19/build/stepper/src/lib/step/step.component.ts","../../../../compat/angular-19/build/stepper/src/lib/step/step.component.html","../../../../compat/angular-19/build/stepper/src/lib/stepper-header/stepper-header.component.ts","../../../../compat/angular-19/build/stepper/src/lib/stepper-header/stepper-header.component.html","../../../../compat/angular-19/build/stepper/src/lib/stepper/stepper.component.ts","../../../../compat/angular-19/build/stepper/src/lib/stepper/stepper.component.html","../../../../compat/angular-19/build/stepper/src/su-labs-stepper.ts"],"sourcesContent":["import { InjectionToken, Signal } from '@angular/core';\nimport type { SuStepComponent } from './step/step.component';\n\n/** What a step needs from the stepper around it to show itself as a panel */\nexport interface SuStepperContext {\n readonly steps: Signal<readonly SuStepComponent[]>;\n readonly current: Signal<number>;\n readonly tabs: Signal<boolean>;\n headerId(index: number): string;\n panelId(index: number): string;\n}\n\nexport const SU_STEPPER = new InjectionToken<SuStepperContext>('SU_STEPPER');\n","import { booleanAttribute, ChangeDetectionStrategy, Component, computed, ElementRef, inject, input } from '@angular/core';\nimport { SuStepOptions } from '@su-labs/core/stepper';\nimport { SU_STEPPER } from '../stepper.context';\n\n/**\n * One step of `su-lib-stepper`: its content shows while it's the current step. Its rules say when the user may leave\n * it, e.g. `[canNext]=\"form.valid\"`.\n */\n@Component({\n selector: 'su-lib-step',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './step.component.html',\n styleUrl: './step.component.scss',\n host: {\n class: 'su-stepper-panel',\n tabindex: '-1',\n '[id]': 'panelId()',\n '[attr.role]': \"stepper.tabs() ? 'tabpanel' : 'group'\",\n '[attr.aria-labelledby]': 'headerId()',\n '[hidden]': '!isCurrent()',\n },\n})\nexport class SuStepComponent {\n /** The text beside the step's number; without it, only the number shows */\n readonly label = input<string>();\n /** The user may go forward from this step, e.g. once its form is valid @default true */\n readonly canNext = input(true, { transform: booleanAttribute });\n /** The user may go back from this step @default true */\n readonly canBack = input(true, { transform: booleanAttribute });\n /** The step can't be visited; moving forward or back skips it @default false */\n readonly disabled = input(false, { transform: booleanAttribute });\n\n /** The step's options for `SuStepperController` */\n readonly options = computed<SuStepOptions>(() => ({\n label: this.label(),\n canNext: this.canNext(),\n canBack: this.canBack(),\n disabled: this.disabled(),\n }));\n\n protected readonly stepper = inject(SU_STEPPER);\n private readonly host: ElementRef<HTMLElement> = inject(ElementRef);\n private readonly index = computed(() => this.stepper.steps().indexOf(this));\n protected readonly isCurrent = computed(\n () => this.index() === this.stepper.current()\n );\n protected readonly panelId = computed(() =>\n this.stepper.panelId(this.index())\n );\n protected readonly headerId = computed(() =>\n this.stepper.headerId(this.index())\n );\n\n /** Moves keyboard focus to the step's content */\n focus(): void {\n this.host.nativeElement.focus();\n }\n}\n","<ng-content />\n","import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { SuStepperLabels, SuStepView } from '@su-labs/core/stepper';\n\n/** A step's circle with its number and its label, with the step's place and state for screen readers */\n@Component({\n selector: 'su-lib-stepper-header',\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './stepper-header.component.html',\n styleUrl: './stepper-header.component.scss',\n host: {\n class: 'su-stepper-header-content',\n '[class.is-current]': 'step().current',\n '[class.is-completed]': 'step().completed',\n '[class.is-visited]': 'step().visited',\n '[class.is-disabled]': 'step().disabled',\n },\n})\nexport class SuStepperHeaderComponent {\n readonly step = input.required<SuStepView>();\n readonly count = input.required<number>();\n readonly labels = input.required<SuStepperLabels>();\n\n protected readonly description = computed(() => {\n const step = this.step();\n const labels = this.labels();\n return [\n labels.step(step.number, this.count()),\n step.label,\n step.completed ? labels.completed : null,\n step.disabled ? labels.unavailable : null,\n ]\n .filter(part => part !== null)\n .join(', ');\n });\n}\n","<span class=\"su-stepper-marker\" aria-hidden=\"true\">{{ step().number }}</span>\n@if (step().label; as label) {\n <span class=\"su-stepper-label\" aria-hidden=\"true\">{{ label }}</span>\n}\n<span class=\"su-stepper-visually-hidden\">{{ description() }}</span>\n","import { afterRenderEffect, booleanAttribute, ChangeDetectionStrategy, Component, computed, contentChildren, DestroyRef, effect, ElementRef, inject, input, model, signal, untracked, viewChildren } from '@angular/core';\nimport { SU_STEPPER_LABELS, SuStepperController, SuStepperLabels, SuStepperOrientation } from '@su-labs/core/stepper';\nimport { SuStepComponent } from '../step/step.component';\nimport { SU_STEPPER, SuStepperContext } from '../stepper.context';\nimport { SuStepperHeaderComponent } from '../stepper-header/stepper-header.component';\n\nlet nextStepperId = 0;\n\n/** Keys that move focus between the step headers when they act as tabs, and where each one goes */\nconst TAB_KEYS: Readonly<\n Record<string, (index: number, count: number) => number>\n> = {\n ArrowRight: (index, count) => (index + 1) % count,\n ArrowDown: (index, count) => (index + 1) % count,\n ArrowLeft: (index, count) => (index - 1 + count) % count,\n ArrowUp: (index, count) => (index - 1 + count) % count,\n Home: () => 0,\n End: (_index, count) => count - 1,\n};\n\n/**\n * Content split into steps (`su-lib-step`) shown one at a time, over `SuStepperController` from\n * `@su-labs/core/stepper`: a numbered circle per step joined by a line, horizontal or vertical, with Back and Next\n * buttons that follow each step's rules. With `tabs`, the step headers act as tabs too, still following the rules.\n */\n@Component({\n selector: 'su-lib-stepper',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [SuStepperHeaderComponent],\n templateUrl: './stepper.component.html',\n styleUrl: './stepper.component.scss',\n providers: [{ provide: SU_STEPPER, useExisting: SuStepperComponent }],\n host: {\n class: 'su-stepper',\n '[class.su-stepper-vertical]': \"orientation() === 'vertical'\",\n },\n})\nexport class SuStepperComponent implements SuStepperContext {\n /** @default 'horizontal' */\n readonly orientation = input<SuStepperOrientation>('horizontal');\n /** The step headers act as tabs: clicking one goes to its step, if the rules allow it @default false */\n readonly tabs = input(false, { transform: booleanAttribute });\n /** Going forward by more than one step only reaches steps already visited @default false */\n readonly linear = input(false, { transform: booleanAttribute });\n /** Back and Next buttons under the steps; without them, call `next()` and `back()` from your own @default true */\n readonly controls = input(true, { transform: booleanAttribute });\n /** The name of the list of steps for screen readers @default labels.steps */\n readonly label = input<string>();\n /** Texts to replace, e.g. in the page's language */\n readonly labels = input<Partial<SuStepperLabels>>({});\n /** The step on screen, from 0; setting it shows that step without checking the rules */\n readonly current = model(0);\n\n readonly steps = contentChildren(SuStepComponent);\n\n private readonly controller = new SuStepperController();\n protected readonly state = signal(this.controller.state.get());\n protected readonly text = computed<SuStepperLabels>(() => ({\n ...SU_STEPPER_LABELS,\n ...this.labels(),\n }));\n private readonly tabButtons =\n viewChildren<ElementRef<HTMLButtonElement>>('tab');\n /** The step's content takes focus once it renders, after a move the user made with the buttons */\n private focusPending = false;\n private readonly id = `su-stepper-${nextStepperId++}`;\n\n constructor() {\n const unsubscribe = this.controller.state.subscribe(state => {\n this.state.set(state);\n this.current.set(state.current);\n });\n inject(DestroyRef).onDestroy(unsubscribe);\n\n effect(() => {\n const steps = this.steps().map(step => step.options());\n const linear = this.linear();\n const current = this.current();\n untracked(() => {\n this.controller.setSteps(steps);\n this.controller.setLinear(linear);\n this.controller.select(current);\n });\n });\n\n afterRenderEffect(() => {\n const current = this.state().current;\n if (this.focusPending) {\n this.focusPending = false;\n untracked(() => this.steps()[current]?.focus());\n }\n });\n }\n\n /** Goes to the next step that isn't disabled, if the current one allows it; returns whether it moved */\n next(): boolean {\n return this.controller.next();\n }\n\n /** Goes to the previous step that isn't disabled, if the current one allows it; returns whether it moved */\n back(): boolean {\n return this.controller.back();\n }\n\n /** Goes to a step, from 0, if the rules allow it; returns whether it moved */\n goTo(index: number): boolean {\n return this.controller.goTo(index);\n }\n\n /** Starts over: back to a step (the first by default) with nothing visited or completed */\n reset(start = 0): void {\n this.controller.reset(start);\n }\n\n headerId(index: number): string {\n return `${this.id}-step-${index}`;\n }\n\n panelId(index: number): string {\n return `${this.id}-panel-${index}`;\n }\n\n protected onNext(): void {\n this.focusPending = this.next();\n }\n\n protected onBack(): void {\n this.focusPending = this.back();\n }\n\n protected onTabKeydown(event: KeyboardEvent, index: number): void {\n const target = TAB_KEYS[event.key];\n const buttons = this.tabButtons();\n if (!target || buttons.length === 0) {\n return;\n }\n event.preventDefault();\n buttons[target(index, buttons.length)]?.nativeElement.focus();\n }\n}\n","<ol\n class=\"su-stepper-steps\"\n [attr.role]=\"tabs() ? 'tablist' : null\"\n [attr.aria-orientation]=\"tabs() ? orientation() : null\"\n [attr.aria-label]=\"label() ?? text().steps\">\n @for (step of state().steps; track step.index) {\n <li\n class=\"su-stepper-step\"\n [class.is-current]=\"step.current\"\n [class.is-completed]=\"step.completed\"\n [attr.role]=\"tabs() ? 'presentation' : null\"\n [attr.aria-current]=\"!tabs() && step.current ? 'step' : null\">\n @if (tabs()) {\n <button\n #tab\n type=\"button\"\n role=\"tab\"\n class=\"su-stepper-header su-stepper-tab\"\n [id]=\"headerId(step.index)\"\n [attr.aria-controls]=\"panelId(step.index)\"\n [attr.aria-selected]=\"step.current\"\n [attr.aria-disabled]=\"step.current || step.reachable ? null : 'true'\"\n [tabIndex]=\"step.current ? 0 : -1\"\n (click)=\"goTo(step.index)\"\n (keydown)=\"onTabKeydown($event, step.index)\">\n <su-lib-stepper-header [step]=\"step\" [count]=\"state().count\" [labels]=\"text()\" />\n </button>\n } @else {\n <div class=\"su-stepper-header\" [id]=\"headerId(step.index)\">\n <su-lib-stepper-header [step]=\"step\" [count]=\"state().count\" [labels]=\"text()\" />\n </div>\n }\n </li>\n }\n</ol>\n\n<div class=\"su-stepper-body\">\n <ng-content />\n\n @if (controls() && state().count > 1) {\n <div class=\"su-stepper-controls\">\n @if (!state().isFirst) {\n <button\n type=\"button\"\n class=\"su-stepper-button su-stepper-back\"\n [attr.aria-disabled]=\"state().canBack ? null : 'true'\"\n (click)=\"onBack()\">\n {{ text().back }}\n </button>\n }\n @if (!state().isLast) {\n <button\n type=\"button\"\n class=\"su-stepper-button su-stepper-next\"\n [attr.aria-disabled]=\"state().canNext ? null : 'true'\"\n (click)=\"onNext()\">\n {{ text().next }}\n </button>\n }\n </div>\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAYO,MAAM,UAAU,GAAG,IAAI,cAAc,CAAmB,YAAY,CAAC;;ACR5E;;;AAGG;MAeU,eAAe,CAAA;;IAEjB,KAAK,GAAG,KAAK,EAAU;;IAEvB,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;;IAEtD,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;;IAEtD,QAAQ,GAAG,KAAK,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;;AAGxD,IAAA,OAAO,GAAG,QAAQ,CAAgB,OAAO;AAChD,QAAA,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;AACnB,QAAA,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;AACvB,QAAA,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;AACvB,QAAA,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE;AAC1B,KAAA,CAAC,CAAC;AAEgB,IAAA,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC;AAC9B,IAAA,IAAI,GAA4B,MAAM,CAAC,UAAU,CAAC;AAClD,IAAA,KAAK,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACxD,IAAA,SAAS,GA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EAAA,SAAA,EAGxB,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAA,kBAAoB,EAAE,CAAC,EAAA,IAAA,EAC/D;AACJ,wBAAA,KAAK,EAAE,YAAY;AACnB,wBAAA,6BAA6B,EAAE,8BAA8B;AAC9D,qBAAA,EAAA,QAAA,EAAA,ulEAAA,EAAA,MAAA,EAAA,CAAA,24FAAA,CAAA,EAAA;;;AEnCH;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@su-labs/stepper" />
5
+ export * from './public-api';
@@ -0,0 +1,28 @@
1
+ import { SuStepOptions } from '@su-labs/core/stepper';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * One step of `su-lib-stepper`: its content shows while it's the current step. Its rules say when the user may leave
5
+ * it, e.g. `[canNext]="form.valid"`.
6
+ */
7
+ export declare class SuStepComponent {
8
+ /** The text beside the step's number; without it, only the number shows */
9
+ readonly label: import("@angular/core").InputSignal<string | undefined>;
10
+ /** The user may go forward from this step, e.g. once its form is valid @default true */
11
+ readonly canNext: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
12
+ /** The user may go back from this step @default true */
13
+ readonly canBack: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
14
+ /** The step can't be visited; moving forward or back skips it @default false */
15
+ readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
16
+ /** The step's options for `SuStepperController` */
17
+ readonly options: import("@angular/core").Signal<SuStepOptions>;
18
+ protected readonly stepper: import("../stepper.context").SuStepperContext;
19
+ private readonly host;
20
+ private readonly index;
21
+ protected readonly isCurrent: import("@angular/core").Signal<boolean>;
22
+ protected readonly panelId: import("@angular/core").Signal<string>;
23
+ protected readonly headerId: import("@angular/core").Signal<string>;
24
+ /** Moves keyboard focus to the step's content */
25
+ focus(): void;
26
+ static ɵfac: i0.ɵɵFactoryDeclaration<SuStepComponent, never>;
27
+ static ɵcmp: i0.ɵɵComponentDeclaration<SuStepComponent, "su-lib-step", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "canNext": { "alias": "canNext"; "required": false; "isSignal": true; }; "canBack": { "alias": "canBack"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
28
+ }
@@ -0,0 +1,49 @@
1
+ import { SuStepperLabels, SuStepperOrientation } from '@su-labs/core/stepper';
2
+ import { SuStepComponent } from '../step/step.component';
3
+ import { SuStepperContext } from '../stepper.context';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Content split into steps (`su-lib-step`) shown one at a time, over `SuStepperController` from
7
+ * `@su-labs/core/stepper`: a numbered circle per step joined by a line, horizontal or vertical, with Back and Next
8
+ * buttons that follow each step's rules. With `tabs`, the step headers act as tabs too, still following the rules.
9
+ */
10
+ export declare class SuStepperComponent implements SuStepperContext {
11
+ /** @default 'horizontal' */
12
+ readonly orientation: import("@angular/core").InputSignal<SuStepperOrientation>;
13
+ /** The step headers act as tabs: clicking one goes to its step, if the rules allow it @default false */
14
+ readonly tabs: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
15
+ /** Going forward by more than one step only reaches steps already visited @default false */
16
+ readonly linear: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
17
+ /** Back and Next buttons under the steps; without them, call `next()` and `back()` from your own @default true */
18
+ readonly controls: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
19
+ /** The name of the list of steps for screen readers @default labels.steps */
20
+ readonly label: import("@angular/core").InputSignal<string | undefined>;
21
+ /** Texts to replace, e.g. in the page's language */
22
+ readonly labels: import("@angular/core").InputSignal<Partial<SuStepperLabels>>;
23
+ /** The step on screen, from 0; setting it shows that step without checking the rules */
24
+ readonly current: import("@angular/core").ModelSignal<number>;
25
+ readonly steps: import("@angular/core").Signal<readonly SuStepComponent[]>;
26
+ private readonly controller;
27
+ protected readonly state: import("@angular/core").WritableSignal<import("@su-labs/core/stepper").SuStepperState>;
28
+ protected readonly text: import("@angular/core").Signal<SuStepperLabels>;
29
+ private readonly tabButtons;
30
+ /** The step's content takes focus once it renders, after a move the user made with the buttons */
31
+ private focusPending;
32
+ private readonly id;
33
+ constructor();
34
+ /** Goes to the next step that isn't disabled, if the current one allows it; returns whether it moved */
35
+ next(): boolean;
36
+ /** Goes to the previous step that isn't disabled, if the current one allows it; returns whether it moved */
37
+ back(): boolean;
38
+ /** Goes to a step, from 0, if the rules allow it; returns whether it moved */
39
+ goTo(index: number): boolean;
40
+ /** Starts over: back to a step (the first by default) with nothing visited or completed */
41
+ reset(start?: number): void;
42
+ headerId(index: number): string;
43
+ panelId(index: number): string;
44
+ protected onNext(): void;
45
+ protected onBack(): void;
46
+ protected onTabKeydown(event: KeyboardEvent, index: number): void;
47
+ static ɵfac: i0.ɵɵFactoryDeclaration<SuStepperComponent, never>;
48
+ static ɵcmp: i0.ɵɵComponentDeclaration<SuStepperComponent, "su-lib-stepper", never, { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "tabs": { "alias": "tabs"; "required": false; "isSignal": true; }; "linear": { "alias": "linear"; "required": false; "isSignal": true; }; "controls": { "alias": "controls"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; "current": { "alias": "current"; "required": false; "isSignal": true; }; }, { "current": "currentChange"; }, ["steps"], ["*"], true, never>;
49
+ }
@@ -0,0 +1,11 @@
1
+ import { SuStepperLabels, SuStepView } from '@su-labs/core/stepper';
2
+ import * as i0 from "@angular/core";
3
+ /** A step's circle with its number and its label, with the step's place and state for screen readers */
4
+ export declare class SuStepperHeaderComponent {
5
+ readonly step: import("@angular/core").InputSignal<SuStepView>;
6
+ readonly count: import("@angular/core").InputSignal<number>;
7
+ readonly labels: import("@angular/core").InputSignal<SuStepperLabels>;
8
+ protected readonly description: import("@angular/core").Signal<string>;
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<SuStepperHeaderComponent, never>;
10
+ static ɵcmp: i0.ɵɵComponentDeclaration<SuStepperHeaderComponent, "su-lib-stepper-header", never, { "step": { "alias": "step"; "required": true; "isSignal": true; }; "count": { "alias": "count"; "required": true; "isSignal": true; }; "labels": { "alias": "labels"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
11
+ }
@@ -0,0 +1,11 @@
1
+ import { InjectionToken, Signal } from '@angular/core';
2
+ import type { SuStepComponent } from './step/step.component';
3
+ /** What a step needs from the stepper around it to show itself as a panel */
4
+ export interface SuStepperContext {
5
+ readonly steps: Signal<readonly SuStepComponent[]>;
6
+ readonly current: Signal<number>;
7
+ readonly tabs: Signal<boolean>;
8
+ headerId(index: number): string;
9
+ panelId(index: number): string;
10
+ }
11
+ export declare const SU_STEPPER: InjectionToken<SuStepperContext>;
package/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "@su-labs/stepper",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "19.0.0",
4
+ "description": "Accessible Angular steppers: content split into steps shown one at a time, with numbered circles joined by a line, optional titles, rules for going forward and back, horizontal or vertical, and headers that can act as tabs, themeable with CSS variables.",
5
+ "keywords": [
6
+ "angular",
7
+ "stepper",
8
+ "wizard",
9
+ "steps",
10
+ "multi-step-form",
11
+ "tabs",
12
+ "accessible",
13
+ "signals",
14
+ "themeable",
15
+ "css-variables"
16
+ ],
17
+ "author": {
18
+ "name": "Yevheniy Alekseyev",
19
+ "email": "yev.alekseyev@gmail.com",
20
+ "url": "https://github.com/Greezaaa"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/Greezaaa/settings-utils-lib.git",
25
+ "directory": "projects/su-labs/stepper"
26
+ },
27
+ "homepage": "https://su-labs.dev/stepper/",
28
+ "bugs": {
29
+ "url": "https://github.com/Greezaaa/settings-utils-lib/issues"
30
+ },
31
+ "peerDependencies": {
32
+ "@angular/common": "^19.0.0",
33
+ "@angular/core": "^19.0.0"
34
+ },
35
+ "dependencies": {
36
+ "@su-labs/core": "1.10.0",
37
+ "tslib": "^2.3.0"
38
+ },
39
+ "sideEffects": false,
40
+ "license": "MIT",
41
+ "module": "fesm2022/su-labs-stepper.mjs",
42
+ "typings": "index.d.ts",
43
+ "exports": {
44
+ "./package.json": {
45
+ "default": "./package.json"
46
+ },
47
+ ".": {
48
+ "types": "./index.d.ts",
49
+ "default": "./fesm2022/su-labs-stepper.mjs"
50
+ }
51
+ }
6
52
  }
@@ -0,0 +1,2 @@
1
+ export * from './lib/step/step.component';
2
+ export * from './lib/stepper/stepper.component';