@su-labs/stepper 20.0.0 → 22.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/README.md +2 -2
- package/fesm2022/su-labs-stepper.mjs +549 -197
- package/fesm2022/su-labs-stepper.mjs.map +1 -1
- package/package.json +7 -6
- package/types/su-labs-stepper.d.ts +142 -0
- package/index.d.ts +0 -88
package/README.md
CHANGED
|
@@ -16,10 +16,10 @@ Content split into steps shown one at a time, for Angular:
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
npm install @su-labs/stepper
|
|
19
|
+
npm install @su-labs/stepper
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
On Angular 19, 20 or 21, install the matching version: `npm install @su-labs/stepper@ng19`, `@ng20` or `@ng21`.
|
|
23
23
|
|
|
24
24
|
## Usage
|
|
25
25
|
|
|
@@ -1,201 +1,553 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
i0.ɵɵ
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, InjectionToken, afterRenderEffect, booleanAttribute, computed, contentChildren, effect, inject, input, model, signal, untracked, viewChildren } from "@angular/core";
|
|
3
|
+
import { SU_STEPPER_LABELS, SuStepperController } from "@su-labs/core/stepper";
|
|
4
|
+
const SU_STEPPER = new InjectionToken("SU_STEPPER");
|
|
5
|
+
var SuStepComponent = class SuStepComponent {
|
|
6
|
+
label = input(...ngDevMode ? [void 0, { debugName: "label" }] : /* istanbul ignore next */ []);
|
|
7
|
+
canNext = input(true, {
|
|
8
|
+
...ngDevMode ? { debugName: "canNext" } : /* istanbul ignore next */ {},
|
|
9
|
+
transform: booleanAttribute
|
|
10
|
+
});
|
|
11
|
+
canBack = input(true, {
|
|
12
|
+
...ngDevMode ? { debugName: "canBack" } : /* istanbul ignore next */ {},
|
|
13
|
+
transform: booleanAttribute
|
|
14
|
+
});
|
|
15
|
+
disabled = input(false, {
|
|
16
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
17
|
+
transform: booleanAttribute
|
|
18
|
+
});
|
|
19
|
+
options = computed(() => ({
|
|
20
|
+
label: this.label(),
|
|
21
|
+
canNext: this.canNext(),
|
|
22
|
+
canBack: this.canBack(),
|
|
23
|
+
disabled: this.disabled()
|
|
24
|
+
}), ...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
|
|
25
|
+
stepper = inject(SU_STEPPER);
|
|
26
|
+
host = inject(ElementRef);
|
|
27
|
+
index = computed(() => this.stepper.steps().indexOf(this), ...ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []);
|
|
28
|
+
isCurrent = computed(() => this.index() === this.stepper.current(), ...ngDevMode ? [{ debugName: "isCurrent" }] : /* istanbul ignore next */ []);
|
|
29
|
+
panelId = computed(() => this.stepper.panelId(this.index()), ...ngDevMode ? [{ debugName: "panelId" }] : /* istanbul ignore next */ []);
|
|
30
|
+
headerId = computed(() => this.stepper.headerId(this.index()), ...ngDevMode ? [{ debugName: "headerId" }] : /* istanbul ignore next */ []);
|
|
31
|
+
focus() {
|
|
32
|
+
this.host.nativeElement.focus();
|
|
33
|
+
}
|
|
34
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
35
|
+
minVersion: "12.0.0",
|
|
36
|
+
version: "22.2.4",
|
|
37
|
+
ngImport: i0,
|
|
38
|
+
type: SuStepComponent,
|
|
39
|
+
deps: [],
|
|
40
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
41
|
+
});
|
|
42
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
43
|
+
minVersion: "17.1.0",
|
|
44
|
+
version: "22.2.4",
|
|
45
|
+
type: SuStepComponent,
|
|
46
|
+
isStandalone: true,
|
|
47
|
+
selector: "su-lib-step",
|
|
48
|
+
inputs: {
|
|
49
|
+
label: {
|
|
50
|
+
classPropertyName: "label",
|
|
51
|
+
publicName: "label",
|
|
52
|
+
isSignal: true,
|
|
53
|
+
isRequired: false,
|
|
54
|
+
transformFunction: null
|
|
55
|
+
},
|
|
56
|
+
canNext: {
|
|
57
|
+
classPropertyName: "canNext",
|
|
58
|
+
publicName: "canNext",
|
|
59
|
+
isSignal: true,
|
|
60
|
+
isRequired: false,
|
|
61
|
+
transformFunction: null
|
|
62
|
+
},
|
|
63
|
+
canBack: {
|
|
64
|
+
classPropertyName: "canBack",
|
|
65
|
+
publicName: "canBack",
|
|
66
|
+
isSignal: true,
|
|
67
|
+
isRequired: false,
|
|
68
|
+
transformFunction: null
|
|
69
|
+
},
|
|
70
|
+
disabled: {
|
|
71
|
+
classPropertyName: "disabled",
|
|
72
|
+
publicName: "disabled",
|
|
73
|
+
isSignal: true,
|
|
74
|
+
isRequired: false,
|
|
75
|
+
transformFunction: null
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
host: {
|
|
79
|
+
attributes: { "tabindex": "-1" },
|
|
80
|
+
properties: {
|
|
81
|
+
"id": "panelId()",
|
|
82
|
+
"attr.role": "stepper.tabs() ? 'tabpanel' : 'group'",
|
|
83
|
+
"attr.aria-labelledby": "headerId()",
|
|
84
|
+
"hidden": "!isCurrent()"
|
|
85
|
+
},
|
|
86
|
+
classAttribute: "su-stepper-panel"
|
|
87
|
+
},
|
|
88
|
+
ngImport: i0,
|
|
89
|
+
template: "<ng-content />\n",
|
|
90
|
+
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"],
|
|
91
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
95
|
+
minVersion: "12.0.0",
|
|
96
|
+
version: "22.2.4",
|
|
97
|
+
ngImport: i0,
|
|
98
|
+
type: SuStepComponent,
|
|
99
|
+
decorators: [{
|
|
100
|
+
type: Component,
|
|
101
|
+
args: [{
|
|
102
|
+
selector: "su-lib-step",
|
|
103
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
104
|
+
host: {
|
|
105
|
+
class: "su-stepper-panel",
|
|
106
|
+
tabindex: "-1",
|
|
107
|
+
"[id]": "panelId()",
|
|
108
|
+
"[attr.role]": "stepper.tabs() ? 'tabpanel' : 'group'",
|
|
109
|
+
"[attr.aria-labelledby]": "headerId()",
|
|
110
|
+
"[hidden]": "!isCurrent()"
|
|
111
|
+
},
|
|
112
|
+
template: "<ng-content />\n",
|
|
113
|
+
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"]
|
|
114
|
+
}]
|
|
115
|
+
}],
|
|
116
|
+
propDecorators: {
|
|
117
|
+
label: [{
|
|
118
|
+
type: i0.Input,
|
|
119
|
+
args: [{
|
|
120
|
+
isSignal: true,
|
|
121
|
+
alias: "label",
|
|
122
|
+
required: false
|
|
123
|
+
}]
|
|
124
|
+
}],
|
|
125
|
+
canNext: [{
|
|
126
|
+
type: i0.Input,
|
|
127
|
+
args: [{
|
|
128
|
+
isSignal: true,
|
|
129
|
+
alias: "canNext",
|
|
130
|
+
required: false
|
|
131
|
+
}]
|
|
132
|
+
}],
|
|
133
|
+
canBack: [{
|
|
134
|
+
type: i0.Input,
|
|
135
|
+
args: [{
|
|
136
|
+
isSignal: true,
|
|
137
|
+
alias: "canBack",
|
|
138
|
+
required: false
|
|
139
|
+
}]
|
|
140
|
+
}],
|
|
141
|
+
disabled: [{
|
|
142
|
+
type: i0.Input,
|
|
143
|
+
args: [{
|
|
144
|
+
isSignal: true,
|
|
145
|
+
alias: "disabled",
|
|
146
|
+
required: false
|
|
147
|
+
}]
|
|
148
|
+
}]
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
var SuStepperHeaderComponent = class SuStepperHeaderComponent {
|
|
152
|
+
step = input.required(...ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []);
|
|
153
|
+
count = input.required(...ngDevMode ? [{ debugName: "count" }] : /* istanbul ignore next */ []);
|
|
154
|
+
labels = input.required(...ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []);
|
|
155
|
+
description = computed(() => {
|
|
156
|
+
const step = this.step();
|
|
157
|
+
const labels = this.labels();
|
|
158
|
+
return [
|
|
159
|
+
labels.step(step.number, this.count()),
|
|
160
|
+
step.label,
|
|
161
|
+
step.completed ? labels.completed : null,
|
|
162
|
+
step.disabled ? labels.unavailable : null
|
|
163
|
+
].filter((part) => part !== null).join(", ");
|
|
164
|
+
}, ...ngDevMode ? [{ debugName: "description" }] : /* istanbul ignore next */ []);
|
|
165
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
166
|
+
minVersion: "12.0.0",
|
|
167
|
+
version: "22.2.4",
|
|
168
|
+
ngImport: i0,
|
|
169
|
+
type: SuStepperHeaderComponent,
|
|
170
|
+
deps: [],
|
|
171
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
172
|
+
});
|
|
173
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
174
|
+
minVersion: "17.0.0",
|
|
175
|
+
version: "22.2.4",
|
|
176
|
+
type: SuStepperHeaderComponent,
|
|
177
|
+
isStandalone: true,
|
|
178
|
+
selector: "su-lib-stepper-header",
|
|
179
|
+
inputs: {
|
|
180
|
+
step: {
|
|
181
|
+
classPropertyName: "step",
|
|
182
|
+
publicName: "step",
|
|
183
|
+
isSignal: true,
|
|
184
|
+
isRequired: true,
|
|
185
|
+
transformFunction: null
|
|
186
|
+
},
|
|
187
|
+
count: {
|
|
188
|
+
classPropertyName: "count",
|
|
189
|
+
publicName: "count",
|
|
190
|
+
isSignal: true,
|
|
191
|
+
isRequired: true,
|
|
192
|
+
transformFunction: null
|
|
193
|
+
},
|
|
194
|
+
labels: {
|
|
195
|
+
classPropertyName: "labels",
|
|
196
|
+
publicName: "labels",
|
|
197
|
+
isSignal: true,
|
|
198
|
+
isRequired: true,
|
|
199
|
+
transformFunction: null
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
host: {
|
|
203
|
+
properties: {
|
|
204
|
+
"class.is-current": "step().current",
|
|
205
|
+
"class.is-completed": "step().completed",
|
|
206
|
+
"class.is-visited": "step().visited",
|
|
207
|
+
"class.is-disabled": "step().disabled"
|
|
208
|
+
},
|
|
209
|
+
classAttribute: "su-stepper-header-content"
|
|
210
|
+
},
|
|
211
|
+
ngImport: i0,
|
|
212
|
+
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",
|
|
213
|
+
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"],
|
|
214
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
218
|
+
minVersion: "12.0.0",
|
|
219
|
+
version: "22.2.4",
|
|
220
|
+
ngImport: i0,
|
|
221
|
+
type: SuStepperHeaderComponent,
|
|
222
|
+
decorators: [{
|
|
223
|
+
type: Component,
|
|
224
|
+
args: [{
|
|
225
|
+
selector: "su-lib-stepper-header",
|
|
226
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
227
|
+
host: {
|
|
228
|
+
class: "su-stepper-header-content",
|
|
229
|
+
"[class.is-current]": "step().current",
|
|
230
|
+
"[class.is-completed]": "step().completed",
|
|
231
|
+
"[class.is-visited]": "step().visited",
|
|
232
|
+
"[class.is-disabled]": "step().disabled"
|
|
233
|
+
},
|
|
234
|
+
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",
|
|
235
|
+
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"]
|
|
236
|
+
}]
|
|
237
|
+
}],
|
|
238
|
+
propDecorators: {
|
|
239
|
+
step: [{
|
|
240
|
+
type: i0.Input,
|
|
241
|
+
args: [{
|
|
242
|
+
isSignal: true,
|
|
243
|
+
alias: "step",
|
|
244
|
+
required: true
|
|
245
|
+
}]
|
|
246
|
+
}],
|
|
247
|
+
count: [{
|
|
248
|
+
type: i0.Input,
|
|
249
|
+
args: [{
|
|
250
|
+
isSignal: true,
|
|
251
|
+
alias: "count",
|
|
252
|
+
required: true
|
|
253
|
+
}]
|
|
254
|
+
}],
|
|
255
|
+
labels: [{
|
|
256
|
+
type: i0.Input,
|
|
257
|
+
args: [{
|
|
258
|
+
isSignal: true,
|
|
259
|
+
alias: "labels",
|
|
260
|
+
required: true
|
|
261
|
+
}]
|
|
262
|
+
}]
|
|
263
|
+
}
|
|
264
|
+
});
|
|
83
265
|
let nextStepperId = 0;
|
|
84
|
-
/** Keys that move focus between the step headers when they act as tabs, and where each one goes */
|
|
85
266
|
const TAB_KEYS = {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
267
|
+
ArrowRight: (index, count) => (index + 1) % count,
|
|
268
|
+
ArrowDown: (index, count) => (index + 1) % count,
|
|
269
|
+
ArrowLeft: (index, count) => (index - 1 + count) % count,
|
|
270
|
+
ArrowUp: (index, count) => (index - 1 + count) % count,
|
|
271
|
+
Home: () => 0,
|
|
272
|
+
End: (_index, count) => count - 1
|
|
92
273
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
274
|
+
var SuStepperComponent = class SuStepperComponent {
|
|
275
|
+
orientation = input("horizontal", ...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
|
|
276
|
+
tabs = input(false, {
|
|
277
|
+
...ngDevMode ? { debugName: "tabs" } : /* istanbul ignore next */ {},
|
|
278
|
+
transform: booleanAttribute
|
|
279
|
+
});
|
|
280
|
+
linear = input(false, {
|
|
281
|
+
...ngDevMode ? { debugName: "linear" } : /* istanbul ignore next */ {},
|
|
282
|
+
transform: booleanAttribute
|
|
283
|
+
});
|
|
284
|
+
controls = input(true, {
|
|
285
|
+
...ngDevMode ? { debugName: "controls" } : /* istanbul ignore next */ {},
|
|
286
|
+
transform: booleanAttribute
|
|
287
|
+
});
|
|
288
|
+
label = input(...ngDevMode ? [void 0, { debugName: "label" }] : /* istanbul ignore next */ []);
|
|
289
|
+
labels = input({}, ...ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []);
|
|
290
|
+
current = model(0, ...ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []);
|
|
291
|
+
steps = contentChildren(SuStepComponent, ...ngDevMode ? [{ debugName: "steps" }] : /* istanbul ignore next */ []);
|
|
292
|
+
controller = new SuStepperController();
|
|
293
|
+
state = signal(this.controller.state.get(), ...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
294
|
+
text = computed(() => ({
|
|
295
|
+
...SU_STEPPER_LABELS,
|
|
296
|
+
...this.labels()
|
|
297
|
+
}), ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
|
|
298
|
+
tabButtons = viewChildren("tab", ...ngDevMode ? [{ debugName: "tabButtons" }] : /* istanbul ignore next */ []);
|
|
299
|
+
focusPending = false;
|
|
300
|
+
id = `su-stepper-${nextStepperId++}`;
|
|
301
|
+
constructor() {
|
|
302
|
+
const unsubscribe = this.controller.state.subscribe((state) => {
|
|
303
|
+
this.state.set(state);
|
|
304
|
+
this.current.set(state.current);
|
|
305
|
+
});
|
|
306
|
+
inject(DestroyRef).onDestroy(unsubscribe);
|
|
307
|
+
effect(() => {
|
|
308
|
+
const steps = this.steps().map((step) => step.options());
|
|
309
|
+
const linear = this.linear();
|
|
310
|
+
const current = this.current();
|
|
311
|
+
untracked(() => {
|
|
312
|
+
this.controller.setSteps(steps);
|
|
313
|
+
this.controller.setLinear(linear);
|
|
314
|
+
this.controller.select(current);
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
afterRenderEffect(() => {
|
|
318
|
+
const current = this.state().current;
|
|
319
|
+
if (this.focusPending) {
|
|
320
|
+
this.focusPending = false;
|
|
321
|
+
untracked(() => this.steps()[current]?.focus());
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
next() {
|
|
326
|
+
return this.controller.next();
|
|
327
|
+
}
|
|
328
|
+
back() {
|
|
329
|
+
return this.controller.back();
|
|
330
|
+
}
|
|
331
|
+
goTo(index) {
|
|
332
|
+
return this.controller.goTo(index);
|
|
333
|
+
}
|
|
334
|
+
reset(start = 0) {
|
|
335
|
+
this.controller.reset(start);
|
|
336
|
+
}
|
|
337
|
+
headerId(index) {
|
|
338
|
+
return `${this.id}-step-${index}`;
|
|
339
|
+
}
|
|
340
|
+
panelId(index) {
|
|
341
|
+
return `${this.id}-panel-${index}`;
|
|
342
|
+
}
|
|
343
|
+
onNext() {
|
|
344
|
+
this.focusPending = this.next();
|
|
345
|
+
}
|
|
346
|
+
onBack() {
|
|
347
|
+
this.focusPending = this.back();
|
|
348
|
+
}
|
|
349
|
+
onTabKeydown(event, index) {
|
|
350
|
+
const target = TAB_KEYS[event.key];
|
|
351
|
+
const buttons = this.tabButtons();
|
|
352
|
+
if (!target || buttons.length === 0) return;
|
|
353
|
+
event.preventDefault();
|
|
354
|
+
buttons[target(index, buttons.length)]?.nativeElement.focus();
|
|
355
|
+
}
|
|
356
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
357
|
+
minVersion: "12.0.0",
|
|
358
|
+
version: "22.2.4",
|
|
359
|
+
ngImport: i0,
|
|
360
|
+
type: SuStepperComponent,
|
|
361
|
+
deps: [],
|
|
362
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
363
|
+
});
|
|
364
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
365
|
+
minVersion: "17.0.0",
|
|
366
|
+
version: "22.2.4",
|
|
367
|
+
type: SuStepperComponent,
|
|
368
|
+
isStandalone: true,
|
|
369
|
+
selector: "su-lib-stepper",
|
|
370
|
+
inputs: {
|
|
371
|
+
orientation: {
|
|
372
|
+
classPropertyName: "orientation",
|
|
373
|
+
publicName: "orientation",
|
|
374
|
+
isSignal: true,
|
|
375
|
+
isRequired: false,
|
|
376
|
+
transformFunction: null
|
|
377
|
+
},
|
|
378
|
+
tabs: {
|
|
379
|
+
classPropertyName: "tabs",
|
|
380
|
+
publicName: "tabs",
|
|
381
|
+
isSignal: true,
|
|
382
|
+
isRequired: false,
|
|
383
|
+
transformFunction: null
|
|
384
|
+
},
|
|
385
|
+
linear: {
|
|
386
|
+
classPropertyName: "linear",
|
|
387
|
+
publicName: "linear",
|
|
388
|
+
isSignal: true,
|
|
389
|
+
isRequired: false,
|
|
390
|
+
transformFunction: null
|
|
391
|
+
},
|
|
392
|
+
controls: {
|
|
393
|
+
classPropertyName: "controls",
|
|
394
|
+
publicName: "controls",
|
|
395
|
+
isSignal: true,
|
|
396
|
+
isRequired: false,
|
|
397
|
+
transformFunction: null
|
|
398
|
+
},
|
|
399
|
+
label: {
|
|
400
|
+
classPropertyName: "label",
|
|
401
|
+
publicName: "label",
|
|
402
|
+
isSignal: true,
|
|
403
|
+
isRequired: false,
|
|
404
|
+
transformFunction: null
|
|
405
|
+
},
|
|
406
|
+
labels: {
|
|
407
|
+
classPropertyName: "labels",
|
|
408
|
+
publicName: "labels",
|
|
409
|
+
isSignal: true,
|
|
410
|
+
isRequired: false,
|
|
411
|
+
transformFunction: null
|
|
412
|
+
},
|
|
413
|
+
current: {
|
|
414
|
+
classPropertyName: "current",
|
|
415
|
+
publicName: "current",
|
|
416
|
+
isSignal: true,
|
|
417
|
+
isRequired: false,
|
|
418
|
+
transformFunction: null
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
outputs: { current: "currentChange" },
|
|
422
|
+
host: {
|
|
423
|
+
properties: { "class.su-stepper-vertical": "orientation() === 'vertical'" },
|
|
424
|
+
classAttribute: "su-stepper"
|
|
425
|
+
},
|
|
426
|
+
providers: [{
|
|
427
|
+
provide: SU_STEPPER,
|
|
428
|
+
useExisting: SuStepperComponent
|
|
429
|
+
}],
|
|
430
|
+
queries: [{
|
|
431
|
+
propertyName: "steps",
|
|
432
|
+
predicate: SuStepComponent,
|
|
433
|
+
isSignal: true
|
|
434
|
+
}],
|
|
435
|
+
viewQueries: [{
|
|
436
|
+
propertyName: "tabButtons",
|
|
437
|
+
predicate: ["tab"],
|
|
438
|
+
descendants: true,
|
|
439
|
+
isSignal: true
|
|
440
|
+
}],
|
|
441
|
+
ngImport: i0,
|
|
442
|
+
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",
|
|
443
|
+
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"],
|
|
444
|
+
dependencies: [{
|
|
445
|
+
kind: "component",
|
|
446
|
+
type: SuStepperHeaderComponent,
|
|
447
|
+
selector: "su-lib-stepper-header",
|
|
448
|
+
inputs: [
|
|
449
|
+
"step",
|
|
450
|
+
"count",
|
|
451
|
+
"labels"
|
|
452
|
+
]
|
|
453
|
+
}],
|
|
454
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
455
|
+
});
|
|
456
|
+
};
|
|
457
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
458
|
+
minVersion: "12.0.0",
|
|
459
|
+
version: "22.2.4",
|
|
460
|
+
ngImport: i0,
|
|
461
|
+
type: SuStepperComponent,
|
|
462
|
+
decorators: [{
|
|
463
|
+
type: Component,
|
|
464
|
+
args: [{
|
|
465
|
+
selector: "su-lib-stepper",
|
|
466
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
467
|
+
imports: [SuStepperHeaderComponent],
|
|
468
|
+
providers: [{
|
|
469
|
+
provide: SU_STEPPER,
|
|
470
|
+
useExisting: SuStepperComponent
|
|
471
|
+
}],
|
|
472
|
+
host: {
|
|
473
|
+
class: "su-stepper",
|
|
474
|
+
"[class.su-stepper-vertical]": "orientation() === 'vertical'"
|
|
475
|
+
},
|
|
476
|
+
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",
|
|
477
|
+
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"]
|
|
478
|
+
}]
|
|
479
|
+
}],
|
|
480
|
+
ctorParameters: () => [],
|
|
481
|
+
propDecorators: {
|
|
482
|
+
orientation: [{
|
|
483
|
+
type: i0.Input,
|
|
484
|
+
args: [{
|
|
485
|
+
isSignal: true,
|
|
486
|
+
alias: "orientation",
|
|
487
|
+
required: false
|
|
488
|
+
}]
|
|
489
|
+
}],
|
|
490
|
+
tabs: [{
|
|
491
|
+
type: i0.Input,
|
|
492
|
+
args: [{
|
|
493
|
+
isSignal: true,
|
|
494
|
+
alias: "tabs",
|
|
495
|
+
required: false
|
|
496
|
+
}]
|
|
497
|
+
}],
|
|
498
|
+
linear: [{
|
|
499
|
+
type: i0.Input,
|
|
500
|
+
args: [{
|
|
501
|
+
isSignal: true,
|
|
502
|
+
alias: "linear",
|
|
503
|
+
required: false
|
|
504
|
+
}]
|
|
505
|
+
}],
|
|
506
|
+
controls: [{
|
|
507
|
+
type: i0.Input,
|
|
508
|
+
args: [{
|
|
509
|
+
isSignal: true,
|
|
510
|
+
alias: "controls",
|
|
511
|
+
required: false
|
|
512
|
+
}]
|
|
513
|
+
}],
|
|
514
|
+
label: [{
|
|
515
|
+
type: i0.Input,
|
|
516
|
+
args: [{
|
|
517
|
+
isSignal: true,
|
|
518
|
+
alias: "label",
|
|
519
|
+
required: false
|
|
520
|
+
}]
|
|
521
|
+
}],
|
|
522
|
+
labels: [{
|
|
523
|
+
type: i0.Input,
|
|
524
|
+
args: [{
|
|
525
|
+
isSignal: true,
|
|
526
|
+
alias: "labels",
|
|
527
|
+
required: false
|
|
528
|
+
}]
|
|
529
|
+
}],
|
|
530
|
+
current: [{
|
|
531
|
+
type: i0.Input,
|
|
532
|
+
args: [{
|
|
533
|
+
isSignal: true,
|
|
534
|
+
alias: "current",
|
|
535
|
+
required: false
|
|
536
|
+
}]
|
|
537
|
+
}, {
|
|
538
|
+
type: i0.Output,
|
|
539
|
+
args: ["currentChange"]
|
|
540
|
+
}],
|
|
541
|
+
steps: [{
|
|
542
|
+
type: i0.ContentChildren,
|
|
543
|
+
args: [i0.forwardRef(() => SuStepComponent), { isSignal: true }]
|
|
544
|
+
}],
|
|
545
|
+
tabButtons: [{
|
|
546
|
+
type: i0.ViewChildren,
|
|
547
|
+
args: ["tab", { isSignal: true }]
|
|
548
|
+
}]
|
|
549
|
+
}
|
|
550
|
+
});
|
|
200
551
|
export { SuStepComponent, SuStepperComponent };
|
|
201
|
-
|
|
552
|
+
|
|
553
|
+
//# sourceMappingURL=su-labs-stepper.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"su-labs-stepper.mjs","sources":["../../../../compat/angular-20/build/stepper/src/lib/stepper.context.ts","../../../../compat/angular-20/build/stepper/src/lib/step/step.component.ts","../../../../compat/angular-20/build/stepper/src/lib/step/step.component.html","../../../../compat/angular-20/build/stepper/src/lib/stepper-header/stepper-header.component.ts","../../../../compat/angular-20/build/stepper/src/lib/stepper-header/stepper-header.component.html","../../../../compat/angular-20/build/stepper/src/lib/stepper/stepper.component.ts","../../../../compat/angular-20/build/stepper/src/lib/stepper/stepper.component.html","../../../../compat/angular-20/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,CAAA,IAAA,SAAA,GAAA,CAAA,SAAA,EAAA,EAAA,SAAA,EAAA,OAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAU;;AAEvB,IAAA,OAAO,GAAG,KAAK,CAAC,IAAI,2CAAI,SAAS,EAAE,gBAAgB,EAAA,CAAA,GAAA,CAA7B,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAC;;AAEtD,IAAA,OAAO,GAAG,KAAK,CAAC,IAAI,2CAAI,SAAS,EAAE,gBAAgB,EAAA,CAAA,GAAA,CAA7B,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAC;;AAEtD,IAAA,QAAQ,GAAG,KAAK,CAAC,KAAK,4CAAI,SAAS,EAAE,gBAAgB,EAAA,CAAA,GAAA,CAA7B,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAC;;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,mDAAC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A,CAAA;;AE9DrD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"su-labs-stepper.mjs","names":[],"sources":["../../../../projects/su-labs/stepper/src/lib/stepper.context.ts","../../../../projects/su-labs/stepper/src/lib/step/step.component.ts","../../../../projects/su-labs/stepper/src/lib/step/step.component.html","../../../../projects/su-labs/stepper/src/lib/stepper-header/stepper-header.component.ts","../../../../projects/su-labs/stepper/src/lib/stepper-header/stepper-header.component.html","../../../../projects/su-labs/stepper/src/lib/stepper/stepper.component.ts","../../../../projects/su-labs/stepper/src/lib/stepper/stepper.component.html"],"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>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AA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,eAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,eAAe,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CASF,OAAK,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@su-labs/stepper",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "22.0.0",
|
|
4
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
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"url": "https://github.com/Greezaaa/settings-utils-lib/issues"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@angular/common": "^
|
|
33
|
-
"@angular/core": "^
|
|
32
|
+
"@angular/common": "^22.0.0",
|
|
33
|
+
"@angular/core": "^22.0.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@su-labs/core": "1.10.0",
|
|
@@ -39,14 +39,15 @@
|
|
|
39
39
|
"sideEffects": false,
|
|
40
40
|
"license": "MIT",
|
|
41
41
|
"module": "fesm2022/su-labs-stepper.mjs",
|
|
42
|
-
"typings": "
|
|
42
|
+
"typings": "types/su-labs-stepper.d.ts",
|
|
43
43
|
"exports": {
|
|
44
44
|
"./package.json": {
|
|
45
45
|
"default": "./package.json"
|
|
46
46
|
},
|
|
47
47
|
".": {
|
|
48
|
-
"types": "./
|
|
48
|
+
"types": "./types/su-labs-stepper.d.ts",
|
|
49
49
|
"default": "./fesm2022/su-labs-stepper.mjs"
|
|
50
50
|
}
|
|
51
|
-
}
|
|
51
|
+
},
|
|
52
|
+
"type": "module"
|
|
52
53
|
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Signal } from "@angular/core";
|
|
3
|
+
import { SuStepOptions, SuStepperLabels, SuStepperOrientation } from "@su-labs/core/stepper";
|
|
4
|
+
/** What a step needs from the stepper around it to show itself as a panel */
|
|
5
|
+
interface SuStepperContext {
|
|
6
|
+
readonly steps: Signal<readonly SuStepComponent[]>;
|
|
7
|
+
readonly current: Signal<number>;
|
|
8
|
+
readonly tabs: Signal<boolean>;
|
|
9
|
+
headerId(index: number): string;
|
|
10
|
+
panelId(index: number): string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* One step of `su-lib-stepper`: its content shows while it's the current step. Its rules say when the user may leave
|
|
14
|
+
* it, e.g. `[canNext]="form.valid"`.
|
|
15
|
+
*/
|
|
16
|
+
export declare class SuStepComponent {
|
|
17
|
+
/** The text beside the step's number; without it, only the number shows */
|
|
18
|
+
readonly label: import("@angular/core").InputSignal<string | undefined>;
|
|
19
|
+
/** The user may go forward from this step, e.g. once its form is valid @default true */
|
|
20
|
+
readonly canNext: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
21
|
+
/** The user may go back from this step @default true */
|
|
22
|
+
readonly canBack: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
23
|
+
/** The step can't be visited; moving forward or back skips it @default false */
|
|
24
|
+
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
25
|
+
/** The step's options for `SuStepperController` */
|
|
26
|
+
readonly options: import("@angular/core").Signal<SuStepOptions>;
|
|
27
|
+
protected readonly stepper: SuStepperContext;
|
|
28
|
+
private readonly host;
|
|
29
|
+
private readonly index;
|
|
30
|
+
protected readonly isCurrent: import("@angular/core").Signal<boolean>;
|
|
31
|
+
protected readonly panelId: import("@angular/core").Signal<string>;
|
|
32
|
+
protected readonly headerId: import("@angular/core").Signal<string>;
|
|
33
|
+
/** Moves keyboard focus to the step's content */
|
|
34
|
+
focus(): void;
|
|
35
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SuStepComponent, never>;
|
|
36
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SuStepComponent, "su-lib-step", never, {
|
|
37
|
+
"label": {
|
|
38
|
+
"alias": "label";
|
|
39
|
+
"required": false;
|
|
40
|
+
"isSignal": true;
|
|
41
|
+
};
|
|
42
|
+
"canNext": {
|
|
43
|
+
"alias": "canNext";
|
|
44
|
+
"required": false;
|
|
45
|
+
"isSignal": true;
|
|
46
|
+
};
|
|
47
|
+
"canBack": {
|
|
48
|
+
"alias": "canBack";
|
|
49
|
+
"required": false;
|
|
50
|
+
"isSignal": true;
|
|
51
|
+
};
|
|
52
|
+
"disabled": {
|
|
53
|
+
"alias": "disabled";
|
|
54
|
+
"required": false;
|
|
55
|
+
"isSignal": true;
|
|
56
|
+
};
|
|
57
|
+
}, {}, never, ["*"], true, never>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Content split into steps (`su-lib-step`) shown one at a time, over `SuStepperController` from
|
|
61
|
+
* `@su-labs/core/stepper`: a numbered circle per step joined by a line, horizontal or vertical, with Back and Next
|
|
62
|
+
* buttons that follow each step's rules. With `tabs`, the step headers act as tabs too, still following the rules.
|
|
63
|
+
*/
|
|
64
|
+
export declare class SuStepperComponent implements SuStepperContext {
|
|
65
|
+
/** @default 'horizontal' */
|
|
66
|
+
readonly orientation: import("@angular/core").InputSignal<SuStepperOrientation>;
|
|
67
|
+
/** The step headers act as tabs: clicking one goes to its step, if the rules allow it @default false */
|
|
68
|
+
readonly tabs: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
69
|
+
/** Going forward by more than one step only reaches steps already visited @default false */
|
|
70
|
+
readonly linear: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
71
|
+
/** Back and Next buttons under the steps; without them, call `next()` and `back()` from your own @default true */
|
|
72
|
+
readonly controls: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
73
|
+
/** The name of the list of steps for screen readers @default labels.steps */
|
|
74
|
+
readonly label: import("@angular/core").InputSignal<string | undefined>;
|
|
75
|
+
/** Texts to replace, e.g. in the page's language */
|
|
76
|
+
readonly labels: import("@angular/core").InputSignal<Partial<SuStepperLabels>>;
|
|
77
|
+
/** The step on screen, from 0; setting it shows that step without checking the rules */
|
|
78
|
+
readonly current: import("@angular/core").ModelSignal<number>;
|
|
79
|
+
readonly steps: import("@angular/core").Signal<readonly SuStepComponent[]>;
|
|
80
|
+
private readonly controller;
|
|
81
|
+
protected readonly state: import("@angular/core").WritableSignal<import("@su-labs/core/stepper").SuStepperState>;
|
|
82
|
+
protected readonly text: import("@angular/core").Signal<SuStepperLabels>;
|
|
83
|
+
private readonly tabButtons;
|
|
84
|
+
/** The step's content takes focus once it renders, after a move the user made with the buttons */
|
|
85
|
+
private focusPending;
|
|
86
|
+
private readonly id;
|
|
87
|
+
constructor();
|
|
88
|
+
/** Goes to the next step that isn't disabled, if the current one allows it; returns whether it moved */
|
|
89
|
+
next(): boolean;
|
|
90
|
+
/** Goes to the previous step that isn't disabled, if the current one allows it; returns whether it moved */
|
|
91
|
+
back(): boolean;
|
|
92
|
+
/** Goes to a step, from 0, if the rules allow it; returns whether it moved */
|
|
93
|
+
goTo(index: number): boolean;
|
|
94
|
+
/** Starts over: back to a step (the first by default) with nothing visited or completed */
|
|
95
|
+
reset(start?: number): void;
|
|
96
|
+
headerId(index: number): string;
|
|
97
|
+
panelId(index: number): string;
|
|
98
|
+
protected onNext(): void;
|
|
99
|
+
protected onBack(): void;
|
|
100
|
+
protected onTabKeydown(event: KeyboardEvent, index: number): void;
|
|
101
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SuStepperComponent, never>;
|
|
102
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SuStepperComponent, "su-lib-stepper", never, {
|
|
103
|
+
"orientation": {
|
|
104
|
+
"alias": "orientation";
|
|
105
|
+
"required": false;
|
|
106
|
+
"isSignal": true;
|
|
107
|
+
};
|
|
108
|
+
"tabs": {
|
|
109
|
+
"alias": "tabs";
|
|
110
|
+
"required": false;
|
|
111
|
+
"isSignal": true;
|
|
112
|
+
};
|
|
113
|
+
"linear": {
|
|
114
|
+
"alias": "linear";
|
|
115
|
+
"required": false;
|
|
116
|
+
"isSignal": true;
|
|
117
|
+
};
|
|
118
|
+
"controls": {
|
|
119
|
+
"alias": "controls";
|
|
120
|
+
"required": false;
|
|
121
|
+
"isSignal": true;
|
|
122
|
+
};
|
|
123
|
+
"label": {
|
|
124
|
+
"alias": "label";
|
|
125
|
+
"required": false;
|
|
126
|
+
"isSignal": true;
|
|
127
|
+
};
|
|
128
|
+
"labels": {
|
|
129
|
+
"alias": "labels";
|
|
130
|
+
"required": false;
|
|
131
|
+
"isSignal": true;
|
|
132
|
+
};
|
|
133
|
+
"current": {
|
|
134
|
+
"alias": "current";
|
|
135
|
+
"required": false;
|
|
136
|
+
"isSignal": true;
|
|
137
|
+
};
|
|
138
|
+
}, {
|
|
139
|
+
"current": "currentChange";
|
|
140
|
+
}, ["steps"], ["*"], true, never>;
|
|
141
|
+
}
|
|
142
|
+
export {};
|
package/index.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { Signal } from '@angular/core';
|
|
3
|
-
import * as _su_labs_core_stepper from '@su-labs/core/stepper';
|
|
4
|
-
import { SuStepOptions, SuStepperOrientation, SuStepperLabels } from '@su-labs/core/stepper';
|
|
5
|
-
|
|
6
|
-
/** What a step needs from the stepper around it to show itself as a panel */
|
|
7
|
-
interface SuStepperContext {
|
|
8
|
-
readonly steps: Signal<readonly SuStepComponent[]>;
|
|
9
|
-
readonly current: Signal<number>;
|
|
10
|
-
readonly tabs: Signal<boolean>;
|
|
11
|
-
headerId(index: number): string;
|
|
12
|
-
panelId(index: number): string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* One step of `su-lib-stepper`: its content shows while it's the current step. Its rules say when the user may leave
|
|
17
|
-
* it, e.g. `[canNext]="form.valid"`.
|
|
18
|
-
*/
|
|
19
|
-
declare class SuStepComponent {
|
|
20
|
-
/** The text beside the step's number; without it, only the number shows */
|
|
21
|
-
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
22
|
-
/** The user may go forward from this step, e.g. once its form is valid @default true */
|
|
23
|
-
readonly canNext: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
24
|
-
/** The user may go back from this step @default true */
|
|
25
|
-
readonly canBack: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
26
|
-
/** The step can't be visited; moving forward or back skips it @default false */
|
|
27
|
-
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
28
|
-
/** The step's options for `SuStepperController` */
|
|
29
|
-
readonly options: _angular_core.Signal<SuStepOptions>;
|
|
30
|
-
protected readonly stepper: SuStepperContext;
|
|
31
|
-
private readonly host;
|
|
32
|
-
private readonly index;
|
|
33
|
-
protected readonly isCurrent: _angular_core.Signal<boolean>;
|
|
34
|
-
protected readonly panelId: _angular_core.Signal<string>;
|
|
35
|
-
protected readonly headerId: _angular_core.Signal<string>;
|
|
36
|
-
/** Moves keyboard focus to the step's content */
|
|
37
|
-
focus(): void;
|
|
38
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SuStepComponent, never>;
|
|
39
|
-
static ɵcmp: _angular_core.ɵɵ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>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Content split into steps (`su-lib-step`) shown one at a time, over `SuStepperController` from
|
|
44
|
-
* `@su-labs/core/stepper`: a numbered circle per step joined by a line, horizontal or vertical, with Back and Next
|
|
45
|
-
* buttons that follow each step's rules. With `tabs`, the step headers act as tabs too, still following the rules.
|
|
46
|
-
*/
|
|
47
|
-
declare class SuStepperComponent implements SuStepperContext {
|
|
48
|
-
/** @default 'horizontal' */
|
|
49
|
-
readonly orientation: _angular_core.InputSignal<SuStepperOrientation>;
|
|
50
|
-
/** The step headers act as tabs: clicking one goes to its step, if the rules allow it @default false */
|
|
51
|
-
readonly tabs: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
52
|
-
/** Going forward by more than one step only reaches steps already visited @default false */
|
|
53
|
-
readonly linear: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
54
|
-
/** Back and Next buttons under the steps; without them, call `next()` and `back()` from your own @default true */
|
|
55
|
-
readonly controls: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
56
|
-
/** The name of the list of steps for screen readers @default labels.steps */
|
|
57
|
-
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
58
|
-
/** Texts to replace, e.g. in the page's language */
|
|
59
|
-
readonly labels: _angular_core.InputSignal<Partial<SuStepperLabels>>;
|
|
60
|
-
/** The step on screen, from 0; setting it shows that step without checking the rules */
|
|
61
|
-
readonly current: _angular_core.ModelSignal<number>;
|
|
62
|
-
readonly steps: _angular_core.Signal<readonly SuStepComponent[]>;
|
|
63
|
-
private readonly controller;
|
|
64
|
-
protected readonly state: _angular_core.WritableSignal<_su_labs_core_stepper.SuStepperState>;
|
|
65
|
-
protected readonly text: _angular_core.Signal<SuStepperLabels>;
|
|
66
|
-
private readonly tabButtons;
|
|
67
|
-
/** The step's content takes focus once it renders, after a move the user made with the buttons */
|
|
68
|
-
private focusPending;
|
|
69
|
-
private readonly id;
|
|
70
|
-
constructor();
|
|
71
|
-
/** Goes to the next step that isn't disabled, if the current one allows it; returns whether it moved */
|
|
72
|
-
next(): boolean;
|
|
73
|
-
/** Goes to the previous step that isn't disabled, if the current one allows it; returns whether it moved */
|
|
74
|
-
back(): boolean;
|
|
75
|
-
/** Goes to a step, from 0, if the rules allow it; returns whether it moved */
|
|
76
|
-
goTo(index: number): boolean;
|
|
77
|
-
/** Starts over: back to a step (the first by default) with nothing visited or completed */
|
|
78
|
-
reset(start?: number): void;
|
|
79
|
-
headerId(index: number): string;
|
|
80
|
-
panelId(index: number): string;
|
|
81
|
-
protected onNext(): void;
|
|
82
|
-
protected onBack(): void;
|
|
83
|
-
protected onTabKeydown(event: KeyboardEvent, index: number): void;
|
|
84
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SuStepperComponent, never>;
|
|
85
|
-
static ɵcmp: _angular_core.ɵɵ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>;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export { SuStepComponent, SuStepperComponent };
|