@egose/shadcn-theme-ng-tw 0.4.0 → 0.5.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 +1 -1
- package/form-autocomplete/fesm2022/form-autocomplete.mjs +7 -6
- package/form-autocomplete/types/form-autocomplete.d.ts +1 -0
- package/form-checkbox/README.md +3 -3
- package/form-checkbox/fesm2022/form-checkbox.mjs +65 -10
- package/form-checkbox/types/form-checkbox.d.ts +24 -4
- package/form-combobox/fesm2022/form-combobox.mjs +7 -6
- package/form-combobox/types/form-combobox.d.ts +1 -0
- package/form-date-picker/fesm2022/form-date-picker.mjs +7 -6
- package/form-date-picker/types/form-date-picker.d.ts +1 -0
- package/form-date-picker-multi/fesm2022/form-date-picker-multi.mjs +7 -6
- package/form-date-picker-multi/types/form-date-picker-multi.d.ts +1 -0
- package/form-date-range-picker/fesm2022/form-date-range-picker.mjs +7 -6
- package/form-date-range-picker/types/form-date-range-picker.d.ts +1 -0
- package/form-field/fesm2022/form-field.mjs +18 -1
- package/form-field/types/form-field.d.ts +48 -2
- package/form-input-otp/fesm2022/form-input-otp.mjs +6 -5
- package/form-input-otp/types/form-input-otp.d.ts +1 -0
- package/form-month-year-picker/fesm2022/form-month-year-picker.mjs +7 -6
- package/form-month-year-picker/types/form-month-year-picker.d.ts +1 -0
- package/form-native-select/fesm2022/form-native-select.mjs +6 -5
- package/form-native-select/types/form-native-select.d.ts +1 -0
- package/form-phone-input/fesm2022/form-phone-input.mjs +6 -5
- package/form-phone-input/types/form-phone-input.d.ts +1 -0
- package/form-radio-group/fesm2022/form-radio-group.mjs +6 -5
- package/form-radio-group/types/form-radio-group.d.ts +1 -0
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +6 -5
- package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +1 -0
- package/form-select/fesm2022/form-select.mjs +6 -5
- package/form-select/types/form-select.d.ts +1 -0
- package/form-slider/fesm2022/form-slider.mjs +6 -5
- package/form-slider/types/form-slider.d.ts +1 -0
- package/form-switch/fesm2022/form-switch.mjs +6 -5
- package/form-switch/types/form-switch.d.ts +1 -0
- package/form-text-input/fesm2022/form-text-input.mjs +6 -5
- package/form-text-input/types/form-text-input.d.ts +1 -0
- package/form-textarea/fesm2022/form-textarea.mjs +6 -5
- package/form-textarea/types/form-textarea.d.ts +1 -0
- package/form-toggle/fesm2022/form-toggle.mjs +8 -5
- package/form-toggle/types/form-toggle.d.ts +1 -0
- package/form-toggle-group/fesm2022/form-toggle-group.mjs +6 -5
- package/form-toggle-group/types/form-toggle-group.d.ts +1 -0
- package/package.json +5 -1
- package/stepper/README.md +353 -0
- package/stepper/fesm2022/stepper.mjs +686 -0
- package/stepper/package.json +24 -0
- package/stepper/types/stepper.d.ts +116 -0
|
@@ -0,0 +1,686 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, TemplateRef, Directive, ViewContainerRef, DestroyRef, input, contentChild, effect, untracked, ChangeDetectionStrategy, Component, InjectionToken, numberAttribute, booleanAttribute, computed, signal, NgModule } from '@angular/core';
|
|
3
|
+
import { TemplatePortal, CdkPortalOutlet } from '@angular/cdk/portal';
|
|
4
|
+
import * as i1 from '@angular/cdk/stepper';
|
|
5
|
+
import { CdkStepLabel, CdkStep, CdkStepHeader, CdkStepper, CdkStepperModule, CdkStepperNext, CdkStepperPrevious } from '@angular/cdk/stepper';
|
|
6
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
+
import { NgIcon, provideIcons } from '@ng-icons/core';
|
|
8
|
+
import { lucideCircleAlert, lucideCheck } from '@ng-icons/lucide';
|
|
9
|
+
import { buttonVariants } from '@egose/shadcn-theme-ng-tw/button';
|
|
10
|
+
import { classes, hlm } from '@egose/shadcn-theme-ng-tw/utils';
|
|
11
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
12
|
+
import { cva } from 'class-variance-authority';
|
|
13
|
+
import { tap } from 'rxjs/operators';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Content for an `hlm-step` that will be rendered lazily.
|
|
17
|
+
*/
|
|
18
|
+
class HlmStepContent {
|
|
19
|
+
template = inject(TemplateRef);
|
|
20
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
21
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: HlmStepContent, isStandalone: true, selector: "ng-template[hlmStepContent]", ngImport: i0 });
|
|
22
|
+
}
|
|
23
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepContent, decorators: [{
|
|
24
|
+
type: Directive,
|
|
25
|
+
args: [{
|
|
26
|
+
selector: 'ng-template[hlmStepContent]',
|
|
27
|
+
}]
|
|
28
|
+
}] });
|
|
29
|
+
|
|
30
|
+
class HlmStepLabel extends CdkStepLabel {
|
|
31
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepLabel, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
32
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: HlmStepLabel, isStandalone: true, selector: "[hlmStepLabel]", usesInheritance: true, ngImport: i0 });
|
|
33
|
+
}
|
|
34
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepLabel, decorators: [{
|
|
35
|
+
type: Directive,
|
|
36
|
+
args: [{
|
|
37
|
+
selector: '[hlmStepLabel]',
|
|
38
|
+
}]
|
|
39
|
+
}] });
|
|
40
|
+
|
|
41
|
+
class HlmStep extends CdkStep {
|
|
42
|
+
_viewContainerRef = inject(ViewContainerRef);
|
|
43
|
+
_destroyRef = inject(DestroyRef);
|
|
44
|
+
icon = input(null, /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
46
|
+
/** Content for step label given by `<ng-template hlmStepLabel>`. */
|
|
47
|
+
stepLabelContent = contentChild(HlmStepLabel, /* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [{ debugName: "stepLabelContent" }] : /* istanbul ignore next */ []));
|
|
49
|
+
/** Content that will be rendered lazily. */
|
|
50
|
+
_lazyContent = contentChild(HlmStepContent, /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "_lazyContent" }] : /* istanbul ignore next */ []));
|
|
52
|
+
/** Currently-attached portal containing the lazy content. */
|
|
53
|
+
portal = null;
|
|
54
|
+
constructor() {
|
|
55
|
+
super();
|
|
56
|
+
effect(() => {
|
|
57
|
+
const isSelected = this.isSelected();
|
|
58
|
+
const lazyContent = this._lazyContent();
|
|
59
|
+
untracked(() => {
|
|
60
|
+
if (isSelected && lazyContent && !this.portal) {
|
|
61
|
+
this.portal = new TemplatePortal(lazyContent.template, this._viewContainerRef);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
this._destroyRef.onDestroy(() => {
|
|
66
|
+
if (this.portal?.isAttached) {
|
|
67
|
+
this.portal.detach();
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStep, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
72
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.3", type: HlmStep, isStandalone: true, selector: "hlm-step", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "hidden": "" } }, providers: [
|
|
73
|
+
{
|
|
74
|
+
provide: CdkStep,
|
|
75
|
+
useExisting: HlmStep,
|
|
76
|
+
},
|
|
77
|
+
], queries: [{ propertyName: "stepLabelContent", first: true, predicate: HlmStepLabel, descendants: true, isSignal: true }, { propertyName: "_lazyContent", first: true, predicate: HlmStepContent, descendants: true, isSignal: true }], exportAs: ["hlmStep"], usesInheritance: true, ngImport: i0, template: `
|
|
78
|
+
<ng-template>
|
|
79
|
+
<ng-content></ng-content>
|
|
80
|
+
<ng-template [cdkPortalOutlet]="portal"></ng-template>
|
|
81
|
+
</ng-template>
|
|
82
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
83
|
+
}
|
|
84
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStep, decorators: [{
|
|
85
|
+
type: Component,
|
|
86
|
+
args: [{
|
|
87
|
+
selector: 'hlm-step',
|
|
88
|
+
exportAs: 'hlmStep',
|
|
89
|
+
imports: [CdkPortalOutlet],
|
|
90
|
+
providers: [
|
|
91
|
+
{
|
|
92
|
+
provide: CdkStep,
|
|
93
|
+
useExisting: HlmStep,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
97
|
+
host: {
|
|
98
|
+
hidden: '',
|
|
99
|
+
},
|
|
100
|
+
template: `
|
|
101
|
+
<ng-template>
|
|
102
|
+
<ng-content></ng-content>
|
|
103
|
+
<ng-template [cdkPortalOutlet]="portal"></ng-template>
|
|
104
|
+
</ng-template>
|
|
105
|
+
`,
|
|
106
|
+
}]
|
|
107
|
+
}], ctorParameters: () => [], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], stepLabelContent: [{ type: i0.ContentChild, args: [i0.forwardRef(() => HlmStepLabel), { isSignal: true }] }], _lazyContent: [{ type: i0.ContentChild, args: [i0.forwardRef(() => HlmStepContent), { isSignal: true }] }] } });
|
|
108
|
+
|
|
109
|
+
const defaultConfig = {
|
|
110
|
+
animationEnabled: true,
|
|
111
|
+
animationDuration: 300,
|
|
112
|
+
defaultIndicatorMode: 'state',
|
|
113
|
+
};
|
|
114
|
+
const HlmStepperConfigToken = new InjectionToken('HlmStepperConfig');
|
|
115
|
+
function normalizeDuration(duration) {
|
|
116
|
+
if (!Number.isFinite(duration)) {
|
|
117
|
+
return defaultConfig.animationDuration;
|
|
118
|
+
}
|
|
119
|
+
return Math.max(0, Math.round(duration));
|
|
120
|
+
}
|
|
121
|
+
function provideHlmStepperConfig(config) {
|
|
122
|
+
const mergedConfig = { ...defaultConfig, ...config };
|
|
123
|
+
return {
|
|
124
|
+
provide: HlmStepperConfigToken,
|
|
125
|
+
useValue: { ...mergedConfig, animationDuration: normalizeDuration(mergedConfig.animationDuration) },
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function injectHlmStepperConfig() {
|
|
129
|
+
const config = inject(HlmStepperConfigToken, { optional: true }) ?? defaultConfig;
|
|
130
|
+
return { ...config, animationDuration: normalizeDuration(config.animationDuration) };
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
class HlmStepHeader extends CdkStepHeader {
|
|
134
|
+
_config = injectHlmStepperConfig();
|
|
135
|
+
state = input('number', /* @ts-ignore */
|
|
136
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
137
|
+
label = input(null, /* @ts-ignore */
|
|
138
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
139
|
+
errorMessage = input('', /* @ts-ignore */
|
|
140
|
+
...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
141
|
+
index = input(0, { ...(ngDevMode ? { debugName: "index" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
142
|
+
selected = input(false, { ...(ngDevMode ? { debugName: "selected" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
143
|
+
reached = input(false, { ...(ngDevMode ? { debugName: "reached" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
144
|
+
active = input(false, { ...(ngDevMode ? { debugName: "active" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
145
|
+
optional = input(false, { ...(ngDevMode ? { debugName: "optional" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
146
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
147
|
+
icon = input(null, /* @ts-ignore */
|
|
148
|
+
...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
149
|
+
indicatorMode = input(this._config.defaultIndicatorMode, /* @ts-ignore */
|
|
150
|
+
...(ngDevMode ? [{ debugName: "indicatorMode" }] : /* istanbul ignore next */ []));
|
|
151
|
+
labelPosition = input('end', /* @ts-ignore */
|
|
152
|
+
...(ngDevMode ? [{ debugName: "labelPosition" }] : /* istanbul ignore next */ []));
|
|
153
|
+
constructor() {
|
|
154
|
+
super();
|
|
155
|
+
classes(() => [this.labelPosition() === "tw:bottom" && 'tw:flex-col tw:text-center']);
|
|
156
|
+
}
|
|
157
|
+
_stringLabel = computed(() => {
|
|
158
|
+
const label = this.label();
|
|
159
|
+
return typeof label === 'string' ? label : null;
|
|
160
|
+
}, /* @ts-ignore */
|
|
161
|
+
...(ngDevMode ? [{ debugName: "_stringLabel" }] : /* istanbul ignore next */ []));
|
|
162
|
+
_templateLabel = computed(() => {
|
|
163
|
+
const label = this.label();
|
|
164
|
+
return label instanceof HlmStepLabel ? label : null;
|
|
165
|
+
}, /* @ts-ignore */
|
|
166
|
+
...(ngDevMode ? [{ debugName: "_templateLabel" }] : /* istanbul ignore next */ []));
|
|
167
|
+
_showOptionalLabel = computed(() => this.optional() && this.state() !== 'error', /* @ts-ignore */
|
|
168
|
+
...(ngDevMode ? [{ debugName: "_showOptionalLabel" }] : /* istanbul ignore next */ []));
|
|
169
|
+
_showErrorLabel = computed(() => this.state() === 'error' && !!this.errorMessage(), /* @ts-ignore */
|
|
170
|
+
...(ngDevMode ? [{ debugName: "_showErrorLabel" }] : /* istanbul ignore next */ []));
|
|
171
|
+
_buttonVariant = computed(() => {
|
|
172
|
+
if (this.state() === 'error') {
|
|
173
|
+
return 'destructive';
|
|
174
|
+
}
|
|
175
|
+
if (this.selected() || this.reached()) {
|
|
176
|
+
return 'default';
|
|
177
|
+
}
|
|
178
|
+
return 'outline';
|
|
179
|
+
}, /* @ts-ignore */
|
|
180
|
+
...(ngDevMode ? [{ debugName: "_buttonVariant" }] : /* istanbul ignore next */ []));
|
|
181
|
+
_indicatorClass = computed(() => `${buttonVariants({ size: 'icon-sm', variant: this._buttonVariant() })}`, /* @ts-ignore */
|
|
182
|
+
...(ngDevMode ? [{ debugName: "_indicatorClass" }] : /* istanbul ignore next */ []));
|
|
183
|
+
_labelClass = computed(() => hlm('tw:flex tw:min-w-0 tw:touch-manipulation tw:flex-col tw:truncate tw:text-sm tw:font-medium', this.state() === 'error' && 'tw:text-destructive'), /* @ts-ignore */
|
|
184
|
+
...(ngDevMode ? [{ debugName: "_labelClass" }] : /* istanbul ignore next */ []));
|
|
185
|
+
_iconName = computed(() => {
|
|
186
|
+
const state = this.state();
|
|
187
|
+
const mode = this.indicatorMode();
|
|
188
|
+
const showStateIcon = this.selected() || this.reached();
|
|
189
|
+
if (mode === 'number') {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
if (state === 'error') {
|
|
193
|
+
return 'lucideCircleAlert';
|
|
194
|
+
}
|
|
195
|
+
if (mode === 'state') {
|
|
196
|
+
if (!showStateIcon) {
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
return 'lucideCheck';
|
|
200
|
+
// TODO: to be discussed: should we follow the same ui as material stepper and show a pencil icon for edit state?
|
|
201
|
+
// if (state === 'done') return 'lucideCheck';
|
|
202
|
+
// if (state === 'edit') return 'lucidePencil';
|
|
203
|
+
}
|
|
204
|
+
return this.icon();
|
|
205
|
+
}, /* @ts-ignore */
|
|
206
|
+
...(ngDevMode ? [{ debugName: "_iconName" }] : /* istanbul ignore next */ []));
|
|
207
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepHeader, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
208
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: HlmStepHeader, isStandalone: true, selector: "hlm-step-header", inputs: { state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, reached: { classPropertyName: "reached", publicName: "reached", isSignal: true, isRequired: false, transformFunction: null }, active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, optional: { classPropertyName: "optional", publicName: "optional", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, indicatorMode: { classPropertyName: "indicatorMode", publicName: "indicatorMode", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-disabled": "disabled() ? \"true\" : null" }, classAttribute: "tw:group tw:inline-flex tw:shrink-0 tw:outline-none tw:items-center tw:gap-2 tw:touch-manipulation tw:transition-opacity tw:data-[disabled=true]:pointer-events-none tw:data-[disabled=true]:opacity-50" }, providers: [provideIcons({ lucideCheck, lucideCircleAlert })], usesInheritance: true, ngImport: i0, template: `
|
|
209
|
+
<span aria-hidden="true" [class]="_indicatorClass()">
|
|
210
|
+
@if (_iconName(); as icon) {
|
|
211
|
+
<ng-icon [name]="icon" />
|
|
212
|
+
} @else {
|
|
213
|
+
<span>{{ index() + 1 }}</span>
|
|
214
|
+
}
|
|
215
|
+
</span>
|
|
216
|
+
|
|
217
|
+
<span [class]="_labelClass()">
|
|
218
|
+
@if (_templateLabel(); as templateLabel) {
|
|
219
|
+
<ng-container [ngTemplateOutlet]="templateLabel.template" />
|
|
220
|
+
} @else if (_stringLabel(); as stringLabel) {
|
|
221
|
+
{{ stringLabel }}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@if (_showOptionalLabel()) {
|
|
225
|
+
<span class="tw:text-muted-foreground tw:text-xs">Optional</span>
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
@if (_showErrorLabel()) {
|
|
229
|
+
<span class="tw:text-destructive tw:text-xs">{{ errorMessage() }}</span>
|
|
230
|
+
}
|
|
231
|
+
</span>
|
|
232
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: NgIcon, selector: "ng-icon", inputs: ["name", "svg", "size", "strokeWidth", "color"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
233
|
+
}
|
|
234
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepHeader, decorators: [{
|
|
235
|
+
type: Component,
|
|
236
|
+
args: [{
|
|
237
|
+
selector: 'hlm-step-header',
|
|
238
|
+
imports: [NgTemplateOutlet, NgIcon],
|
|
239
|
+
providers: [provideIcons({ lucideCheck, lucideCircleAlert })],
|
|
240
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
241
|
+
host: {
|
|
242
|
+
class: 'tw:group tw:inline-flex tw:shrink-0 tw:outline-none tw:items-center tw:gap-2 tw:touch-manipulation tw:transition-opacity tw:data-[disabled=true]:pointer-events-none tw:data-[disabled=true]:opacity-50',
|
|
243
|
+
'[attr.data-disabled]': 'disabled() ? "true" : null',
|
|
244
|
+
},
|
|
245
|
+
template: `
|
|
246
|
+
<span aria-hidden="true" [class]="_indicatorClass()">
|
|
247
|
+
@if (_iconName(); as icon) {
|
|
248
|
+
<ng-icon [name]="icon" />
|
|
249
|
+
} @else {
|
|
250
|
+
<span>{{ index() + 1 }}</span>
|
|
251
|
+
}
|
|
252
|
+
</span>
|
|
253
|
+
|
|
254
|
+
<span [class]="_labelClass()">
|
|
255
|
+
@if (_templateLabel(); as templateLabel) {
|
|
256
|
+
<ng-container [ngTemplateOutlet]="templateLabel.template" />
|
|
257
|
+
} @else if (_stringLabel(); as stringLabel) {
|
|
258
|
+
{{ stringLabel }}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
@if (_showOptionalLabel()) {
|
|
262
|
+
<span class="tw:text-muted-foreground tw:text-xs">Optional</span>
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
@if (_showErrorLabel()) {
|
|
266
|
+
<span class="tw:text-destructive tw:text-xs">{{ errorMessage() }}</span>
|
|
267
|
+
}
|
|
268
|
+
</span>
|
|
269
|
+
`,
|
|
270
|
+
}]
|
|
271
|
+
}], ctorParameters: () => [], propDecorators: { state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }], reached: [{ type: i0.Input, args: [{ isSignal: true, alias: "reached", required: false }] }], active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: false }] }], optional: [{ type: i0.Input, args: [{ isSignal: true, alias: "optional", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], indicatorMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "indicatorMode", required: false }] }], labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }] } });
|
|
272
|
+
|
|
273
|
+
const stepTransition = cva('', {
|
|
274
|
+
variants: {
|
|
275
|
+
motion: {
|
|
276
|
+
none: '',
|
|
277
|
+
'enter-forward': 'tw:animate-in fade-in slide-in-from-right-8 tw:fill-mode-both',
|
|
278
|
+
'enter-backward': 'tw:animate-in fade-in slide-in-from-left-8 tw:fill-mode-both',
|
|
279
|
+
'leave-forward': 'tw:animate-out fade-out slide-out-to-left-8 tw:fill-mode-both tw:absolute tw:top-0 tw:right-0 tw:left-0',
|
|
280
|
+
'leave-backward': 'tw:animate-out fade-out slide-out-to-right-8 tw:fill-mode-both tw:absolute tw:top-0 tw:right-0 tw:left-0',
|
|
281
|
+
'enter-bottom': 'tw:animate-in fade-in slide-in-from-bottom-2 tw:fill-mode-both tw:duration-400 tw:[animation-timing-function:cubic-bezier(0.34,1.56,0.64,1)]',
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
defaultVariants: { motion: 'none' },
|
|
285
|
+
});
|
|
286
|
+
class HlmStepper extends CdkStepper {
|
|
287
|
+
_config = injectHlmStepperConfig();
|
|
288
|
+
labelPosition = input('end', /* @ts-ignore */
|
|
289
|
+
...(ngDevMode ? [{ debugName: "labelPosition" }] : /* istanbul ignore next */ []));
|
|
290
|
+
headerPosition = input('top', /* @ts-ignore */
|
|
291
|
+
...(ngDevMode ? [{ debugName: "headerPosition" }] : /* istanbul ignore next */ []));
|
|
292
|
+
indicatorMode = input(this._config.defaultIndicatorMode, /* @ts-ignore */
|
|
293
|
+
...(ngDevMode ? [{ debugName: "indicatorMode" }] : /* istanbul ignore next */ []));
|
|
294
|
+
stepperAriaLabel = input('Progress', /* @ts-ignore */
|
|
295
|
+
...(ngDevMode ? [{ debugName: "stepperAriaLabel" }] : /* istanbul ignore next */ []));
|
|
296
|
+
stepperAriaLabelledby = input(null, /* @ts-ignore */
|
|
297
|
+
...(ngDevMode ? [{ debugName: "stepperAriaLabelledby" }] : /* istanbul ignore next */ []));
|
|
298
|
+
animationsEnabled = input(this._config.animationEnabled, { ...(ngDevMode ? { debugName: "animationsEnabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
299
|
+
animationDuration = input(this._config.animationDuration, { ...(ngDevMode ? { debugName: "animationDuration" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
300
|
+
_animationDirection = signal('forward', /* @ts-ignore */
|
|
301
|
+
...(ngDevMode ? [{ debugName: "_animationDirection" }] : /* istanbul ignore next */ []));
|
|
302
|
+
_hasSelectionChanged = signal(false, /* @ts-ignore */
|
|
303
|
+
...(ngDevMode ? [{ debugName: "_hasSelectionChanged" }] : /* istanbul ignore next */ []));
|
|
304
|
+
constructor() {
|
|
305
|
+
super();
|
|
306
|
+
this.selectionChange
|
|
307
|
+
.pipe(tap((event) => {
|
|
308
|
+
if (event.previouslySelectedIndex >= 0 && event.selectedIndex !== event.previouslySelectedIndex) {
|
|
309
|
+
this._hasSelectionChanged.set(true);
|
|
310
|
+
}
|
|
311
|
+
this._animationDirection.set(event.selectedIndex < event.previouslySelectedIndex ? 'backward' : 'forward');
|
|
312
|
+
}), takeUntilDestroyed())
|
|
313
|
+
.subscribe();
|
|
314
|
+
}
|
|
315
|
+
next() {
|
|
316
|
+
const stepControl = this.selected?.stepControl;
|
|
317
|
+
if (stepControl && typeof stepControl !== 'function') {
|
|
318
|
+
// Classic reactive-forms control: surface validation errors before a denied linear transition.
|
|
319
|
+
// Signal `Field` controls expose validity through invocation and need no touch pass.
|
|
320
|
+
stepControl.markAllAsTouched();
|
|
321
|
+
stepControl.updateValueAndValidity();
|
|
322
|
+
}
|
|
323
|
+
const invalid = !!stepControl && (typeof stepControl === 'function' ? stepControl().invalid() : stepControl.invalid);
|
|
324
|
+
if (this.linear && invalid) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
super.next();
|
|
328
|
+
}
|
|
329
|
+
stepIcon(step) {
|
|
330
|
+
return step instanceof HlmStep ? step.icon() : null;
|
|
331
|
+
}
|
|
332
|
+
_enterAnimationClass() {
|
|
333
|
+
if (!this._hasSelectionChanged()) {
|
|
334
|
+
return '';
|
|
335
|
+
}
|
|
336
|
+
return stepTransition({ motion: this._animationDirection() === 'forward' ? 'enter-forward' : 'enter-backward' });
|
|
337
|
+
}
|
|
338
|
+
_leaveAnimationClass() {
|
|
339
|
+
if (!this._hasSelectionChanged()) {
|
|
340
|
+
return '';
|
|
341
|
+
}
|
|
342
|
+
return stepTransition({ motion: this._animationDirection() === 'forward' ? 'leave-forward' : 'leave-backward' });
|
|
343
|
+
}
|
|
344
|
+
_gridContainerClass(expanded) {
|
|
345
|
+
return hlm('tw:grid', expanded ? 'tw:grid-rows-[1fr]' : 'tw:grid-rows-[0fr]', this.animationsEnabled() && 'tw:transition-[grid-template-rows]');
|
|
346
|
+
}
|
|
347
|
+
_connectorClass(index) {
|
|
348
|
+
return hlm('tw:block tw:h-full tw:w-px tw:transition-colors tw:duration-200 tw:motion-reduce:transition-none', index < this.selectedIndex ? 'tw:bg-primary' : 'tw:bg-border');
|
|
349
|
+
}
|
|
350
|
+
_verticalStepClass(showConnector, index) {
|
|
351
|
+
return hlm('tw:ms-4 tw:overflow-hidden tw:ps-6', showConnector && 'tw:border-s', this.animationsEnabled() && this.selectedIndex === index && stepTransition({ motion: 'enter-bottom' }));
|
|
352
|
+
}
|
|
353
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepper, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
354
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: HlmStepper, isStandalone: true, selector: "hlm-stepper", inputs: { labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, headerPosition: { classPropertyName: "headerPosition", publicName: "headerPosition", isSignal: true, isRequired: false, transformFunction: null }, indicatorMode: { classPropertyName: "indicatorMode", publicName: "indicatorMode", isSignal: true, isRequired: false, transformFunction: null }, stepperAriaLabel: { classPropertyName: "stepperAriaLabel", publicName: "stepperAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, stepperAriaLabelledby: { classPropertyName: "stepperAriaLabelledby", publicName: "stepperAriaLabelledby", isSignal: true, isRequired: false, transformFunction: null }, animationsEnabled: { classPropertyName: "animationsEnabled", publicName: "animationsEnabled", isSignal: true, isRequired: false, transformFunction: null }, animationDuration: { classPropertyName: "animationDuration", publicName: "animationDuration", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CdkStepper, useExisting: HlmStepper }], usesInheritance: true, ngImport: i0, template: `
|
|
355
|
+
@switch (orientation) {
|
|
356
|
+
@case ('horizontal') {
|
|
357
|
+
<div class="tw:flex tw:w-full tw:flex-col tw:gap-6">
|
|
358
|
+
@if (headerPosition() === 'top') {
|
|
359
|
+
<ng-container [ngTemplateOutlet]="horizontalStepsTemplate" [ngTemplateOutletContext]="{ steps: steps }" />
|
|
360
|
+
<ng-container [ngTemplateOutlet]="horizontalPanelTemplate" />
|
|
361
|
+
} @else {
|
|
362
|
+
<ng-container [ngTemplateOutlet]="horizontalPanelTemplate" />
|
|
363
|
+
<ng-container [ngTemplateOutlet]="horizontalStepsTemplate" [ngTemplateOutletContext]="{ steps: steps }" />
|
|
364
|
+
}
|
|
365
|
+
</div>
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
@case ('vertical') {
|
|
369
|
+
<div class="tw:flex tw:w-full tw:flex-col tw:gap-3">
|
|
370
|
+
@for (step of steps; track step; let i = $index) {
|
|
371
|
+
<div class="tw:flex tw:flex-col tw:gap-2">
|
|
372
|
+
<ng-container [ngTemplateOutlet]="stepHeaderTemplate" [ngTemplateOutletContext]="{ step: step }" />
|
|
373
|
+
|
|
374
|
+
<div
|
|
375
|
+
[class]="_gridContainerClass(selectedIndex === i)"
|
|
376
|
+
[style.transition-duration.ms]="animationDuration()"
|
|
377
|
+
>
|
|
378
|
+
<section
|
|
379
|
+
[class]="_verticalStepClass(!$last, i)"
|
|
380
|
+
role="region"
|
|
381
|
+
[id]="_getStepContentId(i)"
|
|
382
|
+
[attr.aria-labelledby]="_getStepLabelId(i)"
|
|
383
|
+
>
|
|
384
|
+
<ng-container [ngTemplateOutlet]="step.content" />
|
|
385
|
+
</section>
|
|
386
|
+
</div>
|
|
387
|
+
|
|
388
|
+
@if (!$last) {
|
|
389
|
+
<div class="tw:ms-4 tw:h-6 tw:w-px" aria-hidden="true">
|
|
390
|
+
<span [class]="_connectorClass(step.index())"></span>
|
|
391
|
+
</div>
|
|
392
|
+
}
|
|
393
|
+
</div>
|
|
394
|
+
}
|
|
395
|
+
</div>
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
<ng-template #stepHeaderTemplate let-step="step">
|
|
400
|
+
<hlm-step-header
|
|
401
|
+
cdkStepHeader
|
|
402
|
+
class="tw:min-w-0"
|
|
403
|
+
(click)="step.select()"
|
|
404
|
+
(keydown)="_onKeydown($event)"
|
|
405
|
+
[tabIndex]="_getFocusIndex() === step.index() ? 0 : -1"
|
|
406
|
+
[id]="_getStepLabelId(step.index())"
|
|
407
|
+
[attr.role]="orientation === 'horizontal' ? 'tab' : 'button'"
|
|
408
|
+
[attr.aria-posinset]="orientation === 'horizontal' ? step.index() + 1 : null"
|
|
409
|
+
[attr.aria-setsize]="orientation === 'horizontal' ? steps.length : null"
|
|
410
|
+
[attr.aria-selected]="orientation === 'horizontal' ? step.isSelected() : null"
|
|
411
|
+
[attr.aria-current]="orientation === 'vertical' && step.isSelected() ? 'step' : null"
|
|
412
|
+
[attr.aria-expanded]="orientation === 'vertical' ? step.isSelected() : null"
|
|
413
|
+
[attr.aria-controls]="_getStepContentId(step.index())"
|
|
414
|
+
[attr.aria-label]="step.ariaLabel || null"
|
|
415
|
+
[attr.aria-labelledby]="!step.ariaLabel && step.ariaLabelledby ? step.ariaLabelledby : null"
|
|
416
|
+
[attr.aria-disabled]="!step.isNavigable() || (orientation === 'vertical' && step.isSelected()) ? 'true' : null"
|
|
417
|
+
[index]="step.index()"
|
|
418
|
+
[state]="step.indicatorType()"
|
|
419
|
+
[label]="step.stepLabelContent() || step.label"
|
|
420
|
+
[selected]="step.isSelected()"
|
|
421
|
+
[reached]="step.index() < selectedIndex"
|
|
422
|
+
[active]="step.isNavigable()"
|
|
423
|
+
[optional]="step.optional"
|
|
424
|
+
[errorMessage]="step.errorMessage"
|
|
425
|
+
[disabled]="linear && !step.isNavigable()"
|
|
426
|
+
[labelPosition]="orientation === 'horizontal' ? labelPosition() : 'end'"
|
|
427
|
+
[indicatorMode]="indicatorMode()"
|
|
428
|
+
[icon]="stepIcon(step)"
|
|
429
|
+
/>
|
|
430
|
+
</ng-template>
|
|
431
|
+
|
|
432
|
+
<ng-template #horizontalStepsTemplate let-steps="steps">
|
|
433
|
+
<ol
|
|
434
|
+
class="tw:flex tw:w-full tw:items-center"
|
|
435
|
+
role="tablist"
|
|
436
|
+
aria-orientation="horizontal"
|
|
437
|
+
[attr.aria-label]="stepperAriaLabelledby() ? null : (stepperAriaLabel() ?? null)"
|
|
438
|
+
[attr.aria-labelledby]="stepperAriaLabelledby()"
|
|
439
|
+
>
|
|
440
|
+
@for (step of steps; track step) {
|
|
441
|
+
<li class="tw:flex tw:min-w-0 tw:items-center">
|
|
442
|
+
<ng-container [ngTemplateOutlet]="stepHeaderTemplate" [ngTemplateOutletContext]="{ step: step }" />
|
|
443
|
+
</li>
|
|
444
|
+
|
|
445
|
+
@if (!$last) {
|
|
446
|
+
<li class="tw:mx-3 tw:flex tw:min-w-8 tw:flex-1 tw:items-center" aria-hidden="true">
|
|
447
|
+
<span class="tw:bg-border tw:relative tw:h-px tw:w-full tw:overflow-hidden tw:rounded">
|
|
448
|
+
<span
|
|
449
|
+
class="tw:bg-primary tw:absolute tw:inset-y-0 tw:inset-s-0 tw:transition-[width] tw:duration-200"
|
|
450
|
+
[style.width.%]="step.index() < selectedIndex ? 100 : 0"
|
|
451
|
+
></span>
|
|
452
|
+
</span>
|
|
453
|
+
</li>
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
</ol>
|
|
457
|
+
</ng-template>
|
|
458
|
+
|
|
459
|
+
<ng-template #horizontalPanelTemplate>
|
|
460
|
+
<div class="tw:relative tw:min-h-0 tw:overflow-hidden">
|
|
461
|
+
@for (activeIndex of [selectedIndex]; track activeIndex) {
|
|
462
|
+
<section
|
|
463
|
+
role="tabpanel"
|
|
464
|
+
[id]="_getStepContentId(activeIndex)"
|
|
465
|
+
[attr.aria-labelledby]="_getStepLabelId(activeIndex)"
|
|
466
|
+
[style.animation-duration.ms]="animationDuration()"
|
|
467
|
+
[animate.enter]="animationsEnabled() ? _enterAnimationClass() : ''"
|
|
468
|
+
[animate.leave]="animationsEnabled() ? _leaveAnimationClass() : ''"
|
|
469
|
+
>
|
|
470
|
+
<ng-container [ngTemplateOutlet]="steps.get(activeIndex)?.content" />
|
|
471
|
+
</section>
|
|
472
|
+
}
|
|
473
|
+
</div>
|
|
474
|
+
</ng-template>
|
|
475
|
+
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CdkStepperModule }, { kind: "directive", type: i1.CdkStepHeader, selector: "[cdkStepHeader]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: HlmStepHeader, selector: "hlm-step-header", inputs: ["state", "label", "errorMessage", "index", "selected", "reached", "active", "optional", "disabled", "icon", "indicatorMode", "labelPosition"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
476
|
+
}
|
|
477
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepper, decorators: [{
|
|
478
|
+
type: Component,
|
|
479
|
+
args: [{
|
|
480
|
+
selector: 'hlm-stepper',
|
|
481
|
+
imports: [CdkStepperModule, NgTemplateOutlet, HlmStepHeader],
|
|
482
|
+
providers: [{ provide: CdkStepper, useExisting: HlmStepper }],
|
|
483
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
484
|
+
template: `
|
|
485
|
+
@switch (orientation) {
|
|
486
|
+
@case ('horizontal') {
|
|
487
|
+
<div class="tw:flex tw:w-full tw:flex-col tw:gap-6">
|
|
488
|
+
@if (headerPosition() === 'top') {
|
|
489
|
+
<ng-container [ngTemplateOutlet]="horizontalStepsTemplate" [ngTemplateOutletContext]="{ steps: steps }" />
|
|
490
|
+
<ng-container [ngTemplateOutlet]="horizontalPanelTemplate" />
|
|
491
|
+
} @else {
|
|
492
|
+
<ng-container [ngTemplateOutlet]="horizontalPanelTemplate" />
|
|
493
|
+
<ng-container [ngTemplateOutlet]="horizontalStepsTemplate" [ngTemplateOutletContext]="{ steps: steps }" />
|
|
494
|
+
}
|
|
495
|
+
</div>
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
@case ('vertical') {
|
|
499
|
+
<div class="tw:flex tw:w-full tw:flex-col tw:gap-3">
|
|
500
|
+
@for (step of steps; track step; let i = $index) {
|
|
501
|
+
<div class="tw:flex tw:flex-col tw:gap-2">
|
|
502
|
+
<ng-container [ngTemplateOutlet]="stepHeaderTemplate" [ngTemplateOutletContext]="{ step: step }" />
|
|
503
|
+
|
|
504
|
+
<div
|
|
505
|
+
[class]="_gridContainerClass(selectedIndex === i)"
|
|
506
|
+
[style.transition-duration.ms]="animationDuration()"
|
|
507
|
+
>
|
|
508
|
+
<section
|
|
509
|
+
[class]="_verticalStepClass(!$last, i)"
|
|
510
|
+
role="region"
|
|
511
|
+
[id]="_getStepContentId(i)"
|
|
512
|
+
[attr.aria-labelledby]="_getStepLabelId(i)"
|
|
513
|
+
>
|
|
514
|
+
<ng-container [ngTemplateOutlet]="step.content" />
|
|
515
|
+
</section>
|
|
516
|
+
</div>
|
|
517
|
+
|
|
518
|
+
@if (!$last) {
|
|
519
|
+
<div class="tw:ms-4 tw:h-6 tw:w-px" aria-hidden="true">
|
|
520
|
+
<span [class]="_connectorClass(step.index())"></span>
|
|
521
|
+
</div>
|
|
522
|
+
}
|
|
523
|
+
</div>
|
|
524
|
+
}
|
|
525
|
+
</div>
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
<ng-template #stepHeaderTemplate let-step="step">
|
|
530
|
+
<hlm-step-header
|
|
531
|
+
cdkStepHeader
|
|
532
|
+
class="tw:min-w-0"
|
|
533
|
+
(click)="step.select()"
|
|
534
|
+
(keydown)="_onKeydown($event)"
|
|
535
|
+
[tabIndex]="_getFocusIndex() === step.index() ? 0 : -1"
|
|
536
|
+
[id]="_getStepLabelId(step.index())"
|
|
537
|
+
[attr.role]="orientation === 'horizontal' ? 'tab' : 'button'"
|
|
538
|
+
[attr.aria-posinset]="orientation === 'horizontal' ? step.index() + 1 : null"
|
|
539
|
+
[attr.aria-setsize]="orientation === 'horizontal' ? steps.length : null"
|
|
540
|
+
[attr.aria-selected]="orientation === 'horizontal' ? step.isSelected() : null"
|
|
541
|
+
[attr.aria-current]="orientation === 'vertical' && step.isSelected() ? 'step' : null"
|
|
542
|
+
[attr.aria-expanded]="orientation === 'vertical' ? step.isSelected() : null"
|
|
543
|
+
[attr.aria-controls]="_getStepContentId(step.index())"
|
|
544
|
+
[attr.aria-label]="step.ariaLabel || null"
|
|
545
|
+
[attr.aria-labelledby]="!step.ariaLabel && step.ariaLabelledby ? step.ariaLabelledby : null"
|
|
546
|
+
[attr.aria-disabled]="!step.isNavigable() || (orientation === 'vertical' && step.isSelected()) ? 'true' : null"
|
|
547
|
+
[index]="step.index()"
|
|
548
|
+
[state]="step.indicatorType()"
|
|
549
|
+
[label]="step.stepLabelContent() || step.label"
|
|
550
|
+
[selected]="step.isSelected()"
|
|
551
|
+
[reached]="step.index() < selectedIndex"
|
|
552
|
+
[active]="step.isNavigable()"
|
|
553
|
+
[optional]="step.optional"
|
|
554
|
+
[errorMessage]="step.errorMessage"
|
|
555
|
+
[disabled]="linear && !step.isNavigable()"
|
|
556
|
+
[labelPosition]="orientation === 'horizontal' ? labelPosition() : 'end'"
|
|
557
|
+
[indicatorMode]="indicatorMode()"
|
|
558
|
+
[icon]="stepIcon(step)"
|
|
559
|
+
/>
|
|
560
|
+
</ng-template>
|
|
561
|
+
|
|
562
|
+
<ng-template #horizontalStepsTemplate let-steps="steps">
|
|
563
|
+
<ol
|
|
564
|
+
class="tw:flex tw:w-full tw:items-center"
|
|
565
|
+
role="tablist"
|
|
566
|
+
aria-orientation="horizontal"
|
|
567
|
+
[attr.aria-label]="stepperAriaLabelledby() ? null : (stepperAriaLabel() ?? null)"
|
|
568
|
+
[attr.aria-labelledby]="stepperAriaLabelledby()"
|
|
569
|
+
>
|
|
570
|
+
@for (step of steps; track step) {
|
|
571
|
+
<li class="tw:flex tw:min-w-0 tw:items-center">
|
|
572
|
+
<ng-container [ngTemplateOutlet]="stepHeaderTemplate" [ngTemplateOutletContext]="{ step: step }" />
|
|
573
|
+
</li>
|
|
574
|
+
|
|
575
|
+
@if (!$last) {
|
|
576
|
+
<li class="tw:mx-3 tw:flex tw:min-w-8 tw:flex-1 tw:items-center" aria-hidden="true">
|
|
577
|
+
<span class="tw:bg-border tw:relative tw:h-px tw:w-full tw:overflow-hidden tw:rounded">
|
|
578
|
+
<span
|
|
579
|
+
class="tw:bg-primary tw:absolute tw:inset-y-0 tw:inset-s-0 tw:transition-[width] tw:duration-200"
|
|
580
|
+
[style.width.%]="step.index() < selectedIndex ? 100 : 0"
|
|
581
|
+
></span>
|
|
582
|
+
</span>
|
|
583
|
+
</li>
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
</ol>
|
|
587
|
+
</ng-template>
|
|
588
|
+
|
|
589
|
+
<ng-template #horizontalPanelTemplate>
|
|
590
|
+
<div class="tw:relative tw:min-h-0 tw:overflow-hidden">
|
|
591
|
+
@for (activeIndex of [selectedIndex]; track activeIndex) {
|
|
592
|
+
<section
|
|
593
|
+
role="tabpanel"
|
|
594
|
+
[id]="_getStepContentId(activeIndex)"
|
|
595
|
+
[attr.aria-labelledby]="_getStepLabelId(activeIndex)"
|
|
596
|
+
[style.animation-duration.ms]="animationDuration()"
|
|
597
|
+
[animate.enter]="animationsEnabled() ? _enterAnimationClass() : ''"
|
|
598
|
+
[animate.leave]="animationsEnabled() ? _leaveAnimationClass() : ''"
|
|
599
|
+
>
|
|
600
|
+
<ng-container [ngTemplateOutlet]="steps.get(activeIndex)?.content" />
|
|
601
|
+
</section>
|
|
602
|
+
}
|
|
603
|
+
</div>
|
|
604
|
+
</ng-template>
|
|
605
|
+
`,
|
|
606
|
+
}]
|
|
607
|
+
}], ctorParameters: () => [], propDecorators: { labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }], headerPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "headerPosition", required: false }] }], indicatorMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "indicatorMode", required: false }] }], stepperAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "stepperAriaLabel", required: false }] }], stepperAriaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "stepperAriaLabelledby", required: false }] }], animationsEnabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "animationsEnabled", required: false }] }], animationDuration: [{ type: i0.Input, args: [{ isSignal: true, alias: "animationDuration", required: false }] }] } });
|
|
608
|
+
|
|
609
|
+
/** Button that moves to the next step in a stepper workflow. */
|
|
610
|
+
class HlmStepperNext extends CdkStepperNext {
|
|
611
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepperNext, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
612
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: HlmStepperNext, isStandalone: true, selector: "button[hlmStepperNext]", host: { properties: { "type": "type", "style.touch-action": "\"manipulation\"" }, classAttribute: "hlm-stepper-next" }, usesInheritance: true, ngImport: i0 });
|
|
613
|
+
}
|
|
614
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepperNext, decorators: [{
|
|
615
|
+
type: Directive,
|
|
616
|
+
args: [{
|
|
617
|
+
selector: 'button[hlmStepperNext]',
|
|
618
|
+
host: {
|
|
619
|
+
class: 'hlm-stepper-next',
|
|
620
|
+
'[type]': 'type',
|
|
621
|
+
'[style.touch-action]': '"manipulation"',
|
|
622
|
+
},
|
|
623
|
+
}]
|
|
624
|
+
}] });
|
|
625
|
+
|
|
626
|
+
/** Button that moves to the previous step in a stepper workflow. */
|
|
627
|
+
class HlmStepperPrevious extends CdkStepperPrevious {
|
|
628
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepperPrevious, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
629
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.3", type: HlmStepperPrevious, isStandalone: true, selector: "button[hlmStepperPrevious]", host: { properties: { "type": "type", "style.touch-action": "\"manipulation\"" }, classAttribute: "hlm-stepper-previous" }, usesInheritance: true, ngImport: i0 });
|
|
630
|
+
}
|
|
631
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepperPrevious, decorators: [{
|
|
632
|
+
type: Directive,
|
|
633
|
+
args: [{
|
|
634
|
+
selector: 'button[hlmStepperPrevious]',
|
|
635
|
+
host: {
|
|
636
|
+
class: 'hlm-stepper-previous',
|
|
637
|
+
'[type]': 'type',
|
|
638
|
+
'[style.touch-action]': '"manipulation"',
|
|
639
|
+
},
|
|
640
|
+
}]
|
|
641
|
+
}] });
|
|
642
|
+
|
|
643
|
+
/*
|
|
644
|
+
* Public API Surface of stepper
|
|
645
|
+
*/
|
|
646
|
+
const HlmStepperImports = [
|
|
647
|
+
HlmStepper,
|
|
648
|
+
HlmStep,
|
|
649
|
+
HlmStepHeader,
|
|
650
|
+
HlmStepperNext,
|
|
651
|
+
HlmStepperPrevious,
|
|
652
|
+
HlmStepContent,
|
|
653
|
+
HlmStepLabel,
|
|
654
|
+
];
|
|
655
|
+
class HlmStepperModule {
|
|
656
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
657
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.3", ngImport: i0, type: HlmStepperModule, imports: [HlmStepper,
|
|
658
|
+
HlmStep,
|
|
659
|
+
HlmStepHeader,
|
|
660
|
+
HlmStepperNext,
|
|
661
|
+
HlmStepperPrevious,
|
|
662
|
+
HlmStepContent,
|
|
663
|
+
HlmStepLabel], exports: [HlmStepper,
|
|
664
|
+
HlmStep,
|
|
665
|
+
HlmStepHeader,
|
|
666
|
+
HlmStepperNext,
|
|
667
|
+
HlmStepperPrevious,
|
|
668
|
+
HlmStepContent,
|
|
669
|
+
HlmStepLabel] });
|
|
670
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepperModule, imports: [HlmStepper,
|
|
671
|
+
HlmStepHeader] });
|
|
672
|
+
}
|
|
673
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepperModule, decorators: [{
|
|
674
|
+
type: NgModule,
|
|
675
|
+
args: [{
|
|
676
|
+
imports: [...HlmStepperImports],
|
|
677
|
+
exports: [...HlmStepperImports],
|
|
678
|
+
}]
|
|
679
|
+
}] });
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Generated bundle index. Do not edit.
|
|
683
|
+
*/
|
|
684
|
+
|
|
685
|
+
export { HlmStep, HlmStepContent, HlmStepHeader, HlmStepLabel, HlmStepper, HlmStepperImports, HlmStepperModule, HlmStepperNext, HlmStepperPrevious, injectHlmStepperConfig, provideHlmStepperConfig };
|
|
686
|
+
|