@egose/shadcn-theme-ng 0.3.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/README.md +20 -19
- package/form-autocomplete/fesm2022/form-autocomplete.mjs +44 -9
- package/form-autocomplete/types/form-autocomplete.d.ts +22 -1
- package/form-checkbox/README.md +20 -19
- package/form-checkbox/fesm2022/form-checkbox.mjs +99 -15
- package/form-checkbox/types/form-checkbox.d.ts +43 -3
- package/form-combobox/README.md +21 -20
- package/form-combobox/fesm2022/form-combobox.mjs +44 -9
- package/form-combobox/types/form-combobox.d.ts +22 -1
- package/form-date-picker/README.md +28 -27
- package/form-date-picker/fesm2022/form-date-picker.mjs +45 -15
- package/form-date-picker/types/form-date-picker.d.ts +22 -1
- package/form-date-picker-multi/README.md +28 -27
- package/form-date-picker-multi/fesm2022/form-date-picker-multi.mjs +45 -15
- package/form-date-picker-multi/types/form-date-picker-multi.d.ts +22 -1
- package/form-date-range-picker/README.md +28 -27
- package/form-date-range-picker/fesm2022/form-date-range-picker.mjs +45 -15
- package/form-date-range-picker/types/form-date-range-picker.d.ts +22 -1
- package/form-field/README.md +9 -0
- package/form-field/fesm2022/form-field.mjs +97 -5
- package/form-field/types/form-field.d.ts +96 -2
- package/form-field-simple/fesm2022/form-field-simple.mjs +15 -1
- package/form-field-simple/types/form-field-simple.d.ts +9 -2
- package/form-input-otp/README.md +17 -16
- package/form-input-otp/fesm2022/form-input-otp.mjs +43 -8
- package/form-input-otp/types/form-input-otp.d.ts +22 -1
- package/form-month-year-picker/README.md +26 -25
- package/form-month-year-picker/fesm2022/form-month-year-picker.mjs +45 -15
- package/form-month-year-picker/types/form-month-year-picker.d.ts +22 -1
- package/form-native-select/README.md +18 -17
- package/form-native-select/fesm2022/form-native-select.mjs +44 -14
- package/form-native-select/types/form-native-select.d.ts +22 -1
- package/form-phone-input/README.md +23 -22
- package/form-phone-input/fesm2022/form-phone-input.mjs +44 -14
- package/form-phone-input/types/form-phone-input.d.ts +22 -1
- package/form-radio-group/README.md +18 -17
- package/form-radio-group/fesm2022/form-radio-group.mjs +44 -14
- package/form-radio-group/types/form-radio-group.d.ts +22 -1
- package/form-searchable-multiselect/README.md +18 -17
- package/form-searchable-multiselect/fesm2022/form-searchable-multiselect.mjs +44 -14
- package/form-searchable-multiselect/types/form-searchable-multiselect.d.ts +22 -1
- package/form-select/README.md +20 -19
- package/form-select/fesm2022/form-select.mjs +44 -14
- package/form-select/types/form-select.d.ts +22 -1
- package/form-slider/README.md +19 -18
- package/form-slider/fesm2022/form-slider.mjs +43 -8
- package/form-slider/types/form-slider.d.ts +22 -1
- package/form-switch/README.md +16 -15
- package/form-switch/fesm2022/form-switch.mjs +44 -14
- package/form-switch/types/form-switch.d.ts +22 -1
- package/form-text-input/README.md +27 -26
- package/form-text-input/fesm2022/form-text-input.mjs +44 -14
- package/form-text-input/types/form-text-input.d.ts +22 -1
- package/form-textarea/README.md +23 -22
- package/form-textarea/fesm2022/form-textarea.mjs +44 -14
- package/form-textarea/types/form-textarea.d.ts +22 -1
- package/form-toggle/README.md +17 -16
- package/form-toggle/fesm2022/form-toggle.mjs +47 -10
- package/form-toggle/types/form-toggle.d.ts +22 -3
- package/form-toggle-group/README.md +20 -19
- package/form-toggle-group/fesm2022/form-toggle-group.mjs +44 -14
- package/form-toggle-group/types/form-toggle-group.d.ts +22 -1
- package/package.json +5 -1
- package/stepper/README.md +353 -0
- package/stepper/fesm2022/stepper.mjs +396 -0
- package/stepper/package.json +24 -0
- package/stepper/types/stepper.d.ts +116 -0
|
@@ -0,0 +1,396 @@
|
|
|
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/button';
|
|
10
|
+
import { classes, hlm } from '@egose/shadcn-theme-ng/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() === 'bottom' && "flex-col 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("flex min-w-0 touch-manipulation flex-col truncate text-sm font-medium", this.state() === 'error' && "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: "group inline-flex shrink-0 outline-none items-center gap-2 touch-manipulation transition-opacity data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50" }, providers: [provideIcons({ lucideCheck, lucideCircleAlert })], usesInheritance: true, ngImport: i0, template: "\n <span aria-hidden=\"true\" [class]=\"_indicatorClass()\">\n @if (_iconName(); as icon) {\n <ng-icon [name]=\"icon\" />\n } @else {\n <span>{{ index() + 1 }}</span>\n }\n </span>\n\n <span [class]=\"_labelClass()\">\n @if (_templateLabel(); as templateLabel) {\n <ng-container [ngTemplateOutlet]=\"templateLabel.template\" />\n } @else if (_stringLabel(); as stringLabel) {\n {{ stringLabel }}\n }\n\n @if (_showOptionalLabel()) {\n <span class=\"text-muted-foreground text-xs\">Optional</span>\n }\n\n @if (_showErrorLabel()) {\n <span class=\"text-destructive text-xs\">{{ errorMessage() }}</span>\n }\n </span>\n ", 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 });
|
|
209
|
+
}
|
|
210
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepHeader, decorators: [{
|
|
211
|
+
type: Component,
|
|
212
|
+
args: [{
|
|
213
|
+
selector: 'hlm-step-header',
|
|
214
|
+
imports: [NgTemplateOutlet, NgIcon],
|
|
215
|
+
providers: [provideIcons({ lucideCheck, lucideCircleAlert })],
|
|
216
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
217
|
+
host: {
|
|
218
|
+
class: "group inline-flex shrink-0 outline-none items-center gap-2 touch-manipulation transition-opacity data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
|
|
219
|
+
'[attr.data-disabled]': 'disabled() ? "true" : null',
|
|
220
|
+
},
|
|
221
|
+
template: "\n <span aria-hidden=\"true\" [class]=\"_indicatorClass()\">\n @if (_iconName(); as icon) {\n <ng-icon [name]=\"icon\" />\n } @else {\n <span>{{ index() + 1 }}</span>\n }\n </span>\n\n <span [class]=\"_labelClass()\">\n @if (_templateLabel(); as templateLabel) {\n <ng-container [ngTemplateOutlet]=\"templateLabel.template\" />\n } @else if (_stringLabel(); as stringLabel) {\n {{ stringLabel }}\n }\n\n @if (_showOptionalLabel()) {\n <span class=\"text-muted-foreground text-xs\">Optional</span>\n }\n\n @if (_showErrorLabel()) {\n <span class=\"text-destructive text-xs\">{{ errorMessage() }}</span>\n }\n </span>\n ",
|
|
222
|
+
}]
|
|
223
|
+
}], 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 }] }] } });
|
|
224
|
+
|
|
225
|
+
const stepTransition = cva('', {
|
|
226
|
+
variants: {
|
|
227
|
+
motion: {
|
|
228
|
+
none: '',
|
|
229
|
+
'enter-forward': "animate-in fade-in slide-in-from-right-8 fill-mode-both",
|
|
230
|
+
'enter-backward': "animate-in fade-in slide-in-from-left-8 fill-mode-both",
|
|
231
|
+
'leave-forward': "animate-out fade-out slide-out-to-left-8 fill-mode-both absolute top-0 right-0 left-0",
|
|
232
|
+
'leave-backward': "animate-out fade-out slide-out-to-right-8 fill-mode-both absolute top-0 right-0 left-0",
|
|
233
|
+
'enter-bottom': "animate-in fade-in slide-in-from-bottom-2 fill-mode-both duration-400 [animation-timing-function:cubic-bezier(0.34,1.56,0.64,1)]",
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
defaultVariants: { motion: 'none' },
|
|
237
|
+
});
|
|
238
|
+
class HlmStepper extends CdkStepper {
|
|
239
|
+
_config = injectHlmStepperConfig();
|
|
240
|
+
labelPosition = input('end', /* @ts-ignore */
|
|
241
|
+
...(ngDevMode ? [{ debugName: "labelPosition" }] : /* istanbul ignore next */ []));
|
|
242
|
+
headerPosition = input('top', /* @ts-ignore */
|
|
243
|
+
...(ngDevMode ? [{ debugName: "headerPosition" }] : /* istanbul ignore next */ []));
|
|
244
|
+
indicatorMode = input(this._config.defaultIndicatorMode, /* @ts-ignore */
|
|
245
|
+
...(ngDevMode ? [{ debugName: "indicatorMode" }] : /* istanbul ignore next */ []));
|
|
246
|
+
stepperAriaLabel = input('Progress', /* @ts-ignore */
|
|
247
|
+
...(ngDevMode ? [{ debugName: "stepperAriaLabel" }] : /* istanbul ignore next */ []));
|
|
248
|
+
stepperAriaLabelledby = input(null, /* @ts-ignore */
|
|
249
|
+
...(ngDevMode ? [{ debugName: "stepperAriaLabelledby" }] : /* istanbul ignore next */ []));
|
|
250
|
+
animationsEnabled = input(this._config.animationEnabled, { ...(ngDevMode ? { debugName: "animationsEnabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
251
|
+
animationDuration = input(this._config.animationDuration, { ...(ngDevMode ? { debugName: "animationDuration" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
252
|
+
_animationDirection = signal('forward', /* @ts-ignore */
|
|
253
|
+
...(ngDevMode ? [{ debugName: "_animationDirection" }] : /* istanbul ignore next */ []));
|
|
254
|
+
_hasSelectionChanged = signal(false, /* @ts-ignore */
|
|
255
|
+
...(ngDevMode ? [{ debugName: "_hasSelectionChanged" }] : /* istanbul ignore next */ []));
|
|
256
|
+
constructor() {
|
|
257
|
+
super();
|
|
258
|
+
this.selectionChange
|
|
259
|
+
.pipe(tap((event) => {
|
|
260
|
+
if (event.previouslySelectedIndex >= 0 && event.selectedIndex !== event.previouslySelectedIndex) {
|
|
261
|
+
this._hasSelectionChanged.set(true);
|
|
262
|
+
}
|
|
263
|
+
this._animationDirection.set(event.selectedIndex < event.previouslySelectedIndex ? 'backward' : 'forward');
|
|
264
|
+
}), takeUntilDestroyed())
|
|
265
|
+
.subscribe();
|
|
266
|
+
}
|
|
267
|
+
next() {
|
|
268
|
+
const stepControl = this.selected?.stepControl;
|
|
269
|
+
if (stepControl && typeof stepControl !== 'function') {
|
|
270
|
+
// Classic reactive-forms control: surface validation errors before a denied linear transition.
|
|
271
|
+
// Signal `Field` controls expose validity through invocation and need no touch pass.
|
|
272
|
+
stepControl.markAllAsTouched();
|
|
273
|
+
stepControl.updateValueAndValidity();
|
|
274
|
+
}
|
|
275
|
+
const invalid = !!stepControl && (typeof stepControl === 'function' ? stepControl().invalid() : stepControl.invalid);
|
|
276
|
+
if (this.linear && invalid) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
super.next();
|
|
280
|
+
}
|
|
281
|
+
stepIcon(step) {
|
|
282
|
+
return step instanceof HlmStep ? step.icon() : null;
|
|
283
|
+
}
|
|
284
|
+
_enterAnimationClass() {
|
|
285
|
+
if (!this._hasSelectionChanged()) {
|
|
286
|
+
return '';
|
|
287
|
+
}
|
|
288
|
+
return stepTransition({ motion: this._animationDirection() === 'forward' ? 'enter-forward' : 'enter-backward' });
|
|
289
|
+
}
|
|
290
|
+
_leaveAnimationClass() {
|
|
291
|
+
if (!this._hasSelectionChanged()) {
|
|
292
|
+
return '';
|
|
293
|
+
}
|
|
294
|
+
return stepTransition({ motion: this._animationDirection() === 'forward' ? 'leave-forward' : 'leave-backward' });
|
|
295
|
+
}
|
|
296
|
+
_gridContainerClass(expanded) {
|
|
297
|
+
return hlm("grid", expanded ? "grid-rows-[1fr]" : "grid-rows-[0fr]", this.animationsEnabled() && "transition-[grid-template-rows]");
|
|
298
|
+
}
|
|
299
|
+
_connectorClass(index) {
|
|
300
|
+
return hlm("block h-full w-px transition-colors duration-200 motion-reduce:transition-none", index < this.selectedIndex ? "bg-primary" : "bg-border");
|
|
301
|
+
}
|
|
302
|
+
_verticalStepClass(showConnector, index) {
|
|
303
|
+
return hlm("ms-4 overflow-hidden ps-6", showConnector && "border-s", this.animationsEnabled() && this.selectedIndex === index && stepTransition({ motion: 'enter-bottom' }));
|
|
304
|
+
}
|
|
305
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepper, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
306
|
+
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: "\n @switch (orientation) {\n @case ('horizontal') {\n <div class=\"flex w-full flex-col gap-6\">\n @if (headerPosition() === 'top') {\n <ng-container [ngTemplateOutlet]=\"horizontalStepsTemplate\" [ngTemplateOutletContext]=\"{ steps: steps }\" />\n <ng-container [ngTemplateOutlet]=\"horizontalPanelTemplate\" />\n } @else {\n <ng-container [ngTemplateOutlet]=\"horizontalPanelTemplate\" />\n <ng-container [ngTemplateOutlet]=\"horizontalStepsTemplate\" [ngTemplateOutletContext]=\"{ steps: steps }\" />\n }\n </div>\n }\n\n @case ('vertical') {\n <div class=\"flex w-full flex-col gap-3\">\n @for (step of steps; track step; let i = $index) {\n <div class=\"flex flex-col gap-2\">\n <ng-container [ngTemplateOutlet]=\"stepHeaderTemplate\" [ngTemplateOutletContext]=\"{ step: step }\" />\n\n <div\n [class]=\"_gridContainerClass(selectedIndex === i)\"\n [style.transition-duration.ms]=\"animationDuration()\"\n >\n <section\n [class]=\"_verticalStepClass(!$last, i)\"\n role=\"region\"\n [id]=\"_getStepContentId(i)\"\n [attr.aria-labelledby]=\"_getStepLabelId(i)\"\n >\n <ng-container [ngTemplateOutlet]=\"step.content\" />\n </section>\n </div>\n\n @if (!$last) {\n <div class=\"ms-4 h-6 w-px\" aria-hidden=\"true\">\n <span [class]=\"_connectorClass(step.index())\"></span>\n </div>\n }\n </div>\n }\n </div>\n }\n }\n\n <ng-template #stepHeaderTemplate let-step=\"step\">\n <hlm-step-header\n cdkStepHeader\n class=\"min-w-0\"\n (click)=\"step.select()\"\n (keydown)=\"_onKeydown($event)\"\n [tabIndex]=\"_getFocusIndex() === step.index() ? 0 : -1\"\n [id]=\"_getStepLabelId(step.index())\"\n [attr.role]=\"orientation === 'horizontal' ? 'tab' : 'button'\"\n [attr.aria-posinset]=\"orientation === 'horizontal' ? step.index() + 1 : null\"\n [attr.aria-setsize]=\"orientation === 'horizontal' ? steps.length : null\"\n [attr.aria-selected]=\"orientation === 'horizontal' ? step.isSelected() : null\"\n [attr.aria-current]=\"orientation === 'vertical' && step.isSelected() ? 'step' : null\"\n [attr.aria-expanded]=\"orientation === 'vertical' ? step.isSelected() : null\"\n [attr.aria-controls]=\"_getStepContentId(step.index())\"\n [attr.aria-label]=\"step.ariaLabel || null\"\n [attr.aria-labelledby]=\"!step.ariaLabel && step.ariaLabelledby ? step.ariaLabelledby : null\"\n [attr.aria-disabled]=\"!step.isNavigable() || (orientation === 'vertical' && step.isSelected()) ? 'true' : null\"\n [index]=\"step.index()\"\n [state]=\"step.indicatorType()\"\n [label]=\"step.stepLabelContent() || step.label\"\n [selected]=\"step.isSelected()\"\n [reached]=\"step.index() < selectedIndex\"\n [active]=\"step.isNavigable()\"\n [optional]=\"step.optional\"\n [errorMessage]=\"step.errorMessage\"\n [disabled]=\"linear && !step.isNavigable()\"\n [labelPosition]=\"orientation === 'horizontal' ? labelPosition() : 'end'\"\n [indicatorMode]=\"indicatorMode()\"\n [icon]=\"stepIcon(step)\"\n />\n </ng-template>\n\n <ng-template #horizontalStepsTemplate let-steps=\"steps\">\n <ol\n class=\"flex w-full items-center\"\n role=\"tablist\"\n aria-orientation=\"horizontal\"\n [attr.aria-label]=\"stepperAriaLabelledby() ? null : (stepperAriaLabel() ?? null)\"\n [attr.aria-labelledby]=\"stepperAriaLabelledby()\"\n >\n @for (step of steps; track step) {\n <li class=\"flex min-w-0 items-center\">\n <ng-container [ngTemplateOutlet]=\"stepHeaderTemplate\" [ngTemplateOutletContext]=\"{ step: step }\" />\n </li>\n\n @if (!$last) {\n <li class=\"mx-3 flex min-w-8 flex-1 items-center\" aria-hidden=\"true\">\n <span class=\"bg-border relative h-px w-full overflow-hidden rounded\">\n <span\n class=\"bg-primary absolute inset-y-0 inset-s-0 transition-[width] duration-200\"\n [style.width.%]=\"step.index() < selectedIndex ? 100 : 0\"\n ></span>\n </span>\n </li>\n }\n }\n </ol>\n </ng-template>\n\n <ng-template #horizontalPanelTemplate>\n <div class=\"relative min-h-0 overflow-hidden\">\n @for (activeIndex of [selectedIndex]; track activeIndex) {\n <section\n role=\"tabpanel\"\n [id]=\"_getStepContentId(activeIndex)\"\n [attr.aria-labelledby]=\"_getStepLabelId(activeIndex)\"\n [style.animation-duration.ms]=\"animationDuration()\"\n [animate.enter]=\"animationsEnabled() ? _enterAnimationClass() : ''\"\n [animate.leave]=\"animationsEnabled() ? _leaveAnimationClass() : ''\"\n >\n <ng-container [ngTemplateOutlet]=\"steps.get(activeIndex)?.content\" />\n </section>\n }\n </div>\n </ng-template>\n ", 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 });
|
|
307
|
+
}
|
|
308
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepper, decorators: [{
|
|
309
|
+
type: Component,
|
|
310
|
+
args: [{
|
|
311
|
+
selector: 'hlm-stepper',
|
|
312
|
+
imports: [CdkStepperModule, NgTemplateOutlet, HlmStepHeader],
|
|
313
|
+
providers: [{ provide: CdkStepper, useExisting: HlmStepper }],
|
|
314
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
315
|
+
template: "\n @switch (orientation) {\n @case ('horizontal') {\n <div class=\"flex w-full flex-col gap-6\">\n @if (headerPosition() === 'top') {\n <ng-container [ngTemplateOutlet]=\"horizontalStepsTemplate\" [ngTemplateOutletContext]=\"{ steps: steps }\" />\n <ng-container [ngTemplateOutlet]=\"horizontalPanelTemplate\" />\n } @else {\n <ng-container [ngTemplateOutlet]=\"horizontalPanelTemplate\" />\n <ng-container [ngTemplateOutlet]=\"horizontalStepsTemplate\" [ngTemplateOutletContext]=\"{ steps: steps }\" />\n }\n </div>\n }\n\n @case ('vertical') {\n <div class=\"flex w-full flex-col gap-3\">\n @for (step of steps; track step; let i = $index) {\n <div class=\"flex flex-col gap-2\">\n <ng-container [ngTemplateOutlet]=\"stepHeaderTemplate\" [ngTemplateOutletContext]=\"{ step: step }\" />\n\n <div\n [class]=\"_gridContainerClass(selectedIndex === i)\"\n [style.transition-duration.ms]=\"animationDuration()\"\n >\n <section\n [class]=\"_verticalStepClass(!$last, i)\"\n role=\"region\"\n [id]=\"_getStepContentId(i)\"\n [attr.aria-labelledby]=\"_getStepLabelId(i)\"\n >\n <ng-container [ngTemplateOutlet]=\"step.content\" />\n </section>\n </div>\n\n @if (!$last) {\n <div class=\"ms-4 h-6 w-px\" aria-hidden=\"true\">\n <span [class]=\"_connectorClass(step.index())\"></span>\n </div>\n }\n </div>\n }\n </div>\n }\n }\n\n <ng-template #stepHeaderTemplate let-step=\"step\">\n <hlm-step-header\n cdkStepHeader\n class=\"min-w-0\"\n (click)=\"step.select()\"\n (keydown)=\"_onKeydown($event)\"\n [tabIndex]=\"_getFocusIndex() === step.index() ? 0 : -1\"\n [id]=\"_getStepLabelId(step.index())\"\n [attr.role]=\"orientation === 'horizontal' ? 'tab' : 'button'\"\n [attr.aria-posinset]=\"orientation === 'horizontal' ? step.index() + 1 : null\"\n [attr.aria-setsize]=\"orientation === 'horizontal' ? steps.length : null\"\n [attr.aria-selected]=\"orientation === 'horizontal' ? step.isSelected() : null\"\n [attr.aria-current]=\"orientation === 'vertical' && step.isSelected() ? 'step' : null\"\n [attr.aria-expanded]=\"orientation === 'vertical' ? step.isSelected() : null\"\n [attr.aria-controls]=\"_getStepContentId(step.index())\"\n [attr.aria-label]=\"step.ariaLabel || null\"\n [attr.aria-labelledby]=\"!step.ariaLabel && step.ariaLabelledby ? step.ariaLabelledby : null\"\n [attr.aria-disabled]=\"!step.isNavigable() || (orientation === 'vertical' && step.isSelected()) ? 'true' : null\"\n [index]=\"step.index()\"\n [state]=\"step.indicatorType()\"\n [label]=\"step.stepLabelContent() || step.label\"\n [selected]=\"step.isSelected()\"\n [reached]=\"step.index() < selectedIndex\"\n [active]=\"step.isNavigable()\"\n [optional]=\"step.optional\"\n [errorMessage]=\"step.errorMessage\"\n [disabled]=\"linear && !step.isNavigable()\"\n [labelPosition]=\"orientation === 'horizontal' ? labelPosition() : 'end'\"\n [indicatorMode]=\"indicatorMode()\"\n [icon]=\"stepIcon(step)\"\n />\n </ng-template>\n\n <ng-template #horizontalStepsTemplate let-steps=\"steps\">\n <ol\n class=\"flex w-full items-center\"\n role=\"tablist\"\n aria-orientation=\"horizontal\"\n [attr.aria-label]=\"stepperAriaLabelledby() ? null : (stepperAriaLabel() ?? null)\"\n [attr.aria-labelledby]=\"stepperAriaLabelledby()\"\n >\n @for (step of steps; track step) {\n <li class=\"flex min-w-0 items-center\">\n <ng-container [ngTemplateOutlet]=\"stepHeaderTemplate\" [ngTemplateOutletContext]=\"{ step: step }\" />\n </li>\n\n @if (!$last) {\n <li class=\"mx-3 flex min-w-8 flex-1 items-center\" aria-hidden=\"true\">\n <span class=\"bg-border relative h-px w-full overflow-hidden rounded\">\n <span\n class=\"bg-primary absolute inset-y-0 inset-s-0 transition-[width] duration-200\"\n [style.width.%]=\"step.index() < selectedIndex ? 100 : 0\"\n ></span>\n </span>\n </li>\n }\n }\n </ol>\n </ng-template>\n\n <ng-template #horizontalPanelTemplate>\n <div class=\"relative min-h-0 overflow-hidden\">\n @for (activeIndex of [selectedIndex]; track activeIndex) {\n <section\n role=\"tabpanel\"\n [id]=\"_getStepContentId(activeIndex)\"\n [attr.aria-labelledby]=\"_getStepLabelId(activeIndex)\"\n [style.animation-duration.ms]=\"animationDuration()\"\n [animate.enter]=\"animationsEnabled() ? _enterAnimationClass() : ''\"\n [animate.leave]=\"animationsEnabled() ? _leaveAnimationClass() : ''\"\n >\n <ng-container [ngTemplateOutlet]=\"steps.get(activeIndex)?.content\" />\n </section>\n }\n </div>\n </ng-template>\n ",
|
|
316
|
+
}]
|
|
317
|
+
}], 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 }] }] } });
|
|
318
|
+
|
|
319
|
+
/** Button that moves to the next step in a stepper workflow. */
|
|
320
|
+
class HlmStepperNext extends CdkStepperNext {
|
|
321
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepperNext, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
322
|
+
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 });
|
|
323
|
+
}
|
|
324
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepperNext, decorators: [{
|
|
325
|
+
type: Directive,
|
|
326
|
+
args: [{
|
|
327
|
+
selector: 'button[hlmStepperNext]',
|
|
328
|
+
host: {
|
|
329
|
+
class: 'hlm-stepper-next',
|
|
330
|
+
'[type]': 'type',
|
|
331
|
+
'[style.touch-action]': '"manipulation"',
|
|
332
|
+
},
|
|
333
|
+
}]
|
|
334
|
+
}] });
|
|
335
|
+
|
|
336
|
+
/** Button that moves to the previous step in a stepper workflow. */
|
|
337
|
+
class HlmStepperPrevious extends CdkStepperPrevious {
|
|
338
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepperPrevious, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
339
|
+
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 });
|
|
340
|
+
}
|
|
341
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepperPrevious, decorators: [{
|
|
342
|
+
type: Directive,
|
|
343
|
+
args: [{
|
|
344
|
+
selector: 'button[hlmStepperPrevious]',
|
|
345
|
+
host: {
|
|
346
|
+
class: 'hlm-stepper-previous',
|
|
347
|
+
'[type]': 'type',
|
|
348
|
+
'[style.touch-action]': '"manipulation"',
|
|
349
|
+
},
|
|
350
|
+
}]
|
|
351
|
+
}] });
|
|
352
|
+
|
|
353
|
+
/*
|
|
354
|
+
* Public API Surface of stepper
|
|
355
|
+
*/
|
|
356
|
+
const HlmStepperImports = [
|
|
357
|
+
HlmStepper,
|
|
358
|
+
HlmStep,
|
|
359
|
+
HlmStepHeader,
|
|
360
|
+
HlmStepperNext,
|
|
361
|
+
HlmStepperPrevious,
|
|
362
|
+
HlmStepContent,
|
|
363
|
+
HlmStepLabel,
|
|
364
|
+
];
|
|
365
|
+
class HlmStepperModule {
|
|
366
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
367
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.3", ngImport: i0, type: HlmStepperModule, imports: [HlmStepper,
|
|
368
|
+
HlmStep,
|
|
369
|
+
HlmStepHeader,
|
|
370
|
+
HlmStepperNext,
|
|
371
|
+
HlmStepperPrevious,
|
|
372
|
+
HlmStepContent,
|
|
373
|
+
HlmStepLabel], exports: [HlmStepper,
|
|
374
|
+
HlmStep,
|
|
375
|
+
HlmStepHeader,
|
|
376
|
+
HlmStepperNext,
|
|
377
|
+
HlmStepperPrevious,
|
|
378
|
+
HlmStepContent,
|
|
379
|
+
HlmStepLabel] });
|
|
380
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepperModule, imports: [HlmStepper,
|
|
381
|
+
HlmStepHeader] });
|
|
382
|
+
}
|
|
383
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: HlmStepperModule, decorators: [{
|
|
384
|
+
type: NgModule,
|
|
385
|
+
args: [{
|
|
386
|
+
imports: [...HlmStepperImports],
|
|
387
|
+
exports: [...HlmStepperImports],
|
|
388
|
+
}]
|
|
389
|
+
}] });
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Generated bundle index. Do not edit.
|
|
393
|
+
*/
|
|
394
|
+
|
|
395
|
+
export { HlmStep, HlmStepContent, HlmStepHeader, HlmStepLabel, HlmStepper, HlmStepperImports, HlmStepperModule, HlmStepperNext, HlmStepperPrevious, injectHlmStepperConfig, provideHlmStepperConfig };
|
|
396
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "stepper",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^22.0.0",
|
|
6
|
+
"@angular/core": "^22.0.0"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"tslib": "^2.3.0"
|
|
10
|
+
},
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"module": "fesm2022/stepper.mjs",
|
|
13
|
+
"typings": "types/stepper.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": {
|
|
16
|
+
"default": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./types/stepper.d.ts",
|
|
20
|
+
"default": "./fesm2022/stepper.mjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"type": "module"
|
|
24
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { TemplateRef, ValueProvider } from '@angular/core';
|
|
3
|
+
import { TemplatePortal } from '@angular/cdk/portal';
|
|
4
|
+
import { CdkStepLabel, CdkStep, CdkStepHeader, CdkStepper, CdkStepperNext, CdkStepperPrevious } from '@angular/cdk/stepper';
|
|
5
|
+
|
|
6
|
+
declare class HlmStepLabel extends CdkStepLabel {
|
|
7
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HlmStepLabel, never>;
|
|
8
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<HlmStepLabel, "[hlmStepLabel]", never, {}, {}, never, never, true, never>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare class HlmStep extends CdkStep {
|
|
12
|
+
private readonly _viewContainerRef;
|
|
13
|
+
private readonly _destroyRef;
|
|
14
|
+
readonly icon: _angular_core.InputSignal<string | null>;
|
|
15
|
+
/** Content for step label given by `<ng-template hlmStepLabel>`. */
|
|
16
|
+
readonly stepLabelContent: _angular_core.Signal<HlmStepLabel | undefined>;
|
|
17
|
+
/** Content that will be rendered lazily. */
|
|
18
|
+
private readonly _lazyContent;
|
|
19
|
+
/** Currently-attached portal containing the lazy content. */
|
|
20
|
+
portal: TemplatePortal<unknown> | null;
|
|
21
|
+
constructor();
|
|
22
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HlmStep, never>;
|
|
23
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<HlmStep, "hlm-step", ["hlmStep"], { "icon": { "alias": "icon"; "required": false; "isSignal": true; }; }, {}, ["stepLabelContent", "_lazyContent"], ["*"], true, never>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Content for an `hlm-step` that will be rendered lazily.
|
|
28
|
+
*/
|
|
29
|
+
declare class HlmStepContent<C> {
|
|
30
|
+
readonly template: TemplateRef<C>;
|
|
31
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HlmStepContent<any>, never>;
|
|
32
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<HlmStepContent<any>, "ng-template[hlmStepContent]", never, {}, {}, never, never, true, never>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type HlmStepperLabelPosition = 'end' | 'bottom';
|
|
36
|
+
type HlmStepperHeaderPosition = 'top' | 'bottom';
|
|
37
|
+
type HlmStepperIndicatorMode = 'number' | 'state' | 'icon';
|
|
38
|
+
interface HlmStepperConfig {
|
|
39
|
+
animationEnabled: boolean;
|
|
40
|
+
animationDuration: number;
|
|
41
|
+
defaultIndicatorMode: HlmStepperIndicatorMode;
|
|
42
|
+
}
|
|
43
|
+
declare function provideHlmStepperConfig(config: Partial<HlmStepperConfig>): ValueProvider;
|
|
44
|
+
declare function injectHlmStepperConfig(): HlmStepperConfig;
|
|
45
|
+
|
|
46
|
+
declare class HlmStepHeader extends CdkStepHeader {
|
|
47
|
+
private readonly _config;
|
|
48
|
+
readonly state: _angular_core.InputSignal<string>;
|
|
49
|
+
readonly label: _angular_core.InputSignal<string | HlmStepLabel | null>;
|
|
50
|
+
readonly errorMessage: _angular_core.InputSignal<string>;
|
|
51
|
+
readonly index: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
52
|
+
readonly selected: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
53
|
+
readonly reached: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
54
|
+
readonly active: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
55
|
+
readonly optional: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
56
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
57
|
+
readonly icon: _angular_core.InputSignal<string | null>;
|
|
58
|
+
readonly indicatorMode: _angular_core.InputSignal<HlmStepperIndicatorMode>;
|
|
59
|
+
readonly labelPosition: _angular_core.InputSignal<HlmStepperLabelPosition>;
|
|
60
|
+
constructor();
|
|
61
|
+
protected readonly _stringLabel: _angular_core.Signal<string | null>;
|
|
62
|
+
protected readonly _templateLabel: _angular_core.Signal<HlmStepLabel | null>;
|
|
63
|
+
protected readonly _showOptionalLabel: _angular_core.Signal<boolean>;
|
|
64
|
+
protected readonly _showErrorLabel: _angular_core.Signal<boolean>;
|
|
65
|
+
protected readonly _buttonVariant: _angular_core.Signal<"default" | "primary" | "secondary" | "success" | "warning" | "danger" | "info" | "light" | "dark" | "accent" | "destructive" | "muted" | "outline" | "link" | "ghost" | null | undefined>;
|
|
66
|
+
protected readonly _indicatorClass: _angular_core.Signal<string>;
|
|
67
|
+
protected readonly _labelClass: _angular_core.Signal<string>;
|
|
68
|
+
protected readonly _iconName: _angular_core.Signal<string | null>;
|
|
69
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HlmStepHeader, never>;
|
|
70
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<HlmStepHeader, "hlm-step-header", never, { "state": { "alias": "state"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "errorMessage": { "alias": "errorMessage"; "required": false; "isSignal": true; }; "index": { "alias": "index"; "required": false; "isSignal": true; }; "selected": { "alias": "selected"; "required": false; "isSignal": true; }; "reached": { "alias": "reached"; "required": false; "isSignal": true; }; "active": { "alias": "active"; "required": false; "isSignal": true; }; "optional": { "alias": "optional"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "indicatorMode": { "alias": "indicatorMode"; "required": false; "isSignal": true; }; "labelPosition": { "alias": "labelPosition"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
declare class HlmStepper extends CdkStepper {
|
|
74
|
+
private readonly _config;
|
|
75
|
+
readonly labelPosition: _angular_core.InputSignal<HlmStepperLabelPosition>;
|
|
76
|
+
readonly headerPosition: _angular_core.InputSignal<HlmStepperHeaderPosition>;
|
|
77
|
+
readonly indicatorMode: _angular_core.InputSignal<HlmStepperIndicatorMode>;
|
|
78
|
+
readonly stepperAriaLabel: _angular_core.InputSignal<string | null>;
|
|
79
|
+
readonly stepperAriaLabelledby: _angular_core.InputSignal<string | null>;
|
|
80
|
+
readonly animationsEnabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
81
|
+
readonly animationDuration: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
82
|
+
protected readonly _animationDirection: _angular_core.WritableSignal<"forward" | "backward">;
|
|
83
|
+
protected readonly _hasSelectionChanged: _angular_core.WritableSignal<boolean>;
|
|
84
|
+
constructor();
|
|
85
|
+
next(): void;
|
|
86
|
+
protected stepIcon(step: CdkStep): string | null;
|
|
87
|
+
protected _enterAnimationClass(): string;
|
|
88
|
+
protected _leaveAnimationClass(): string;
|
|
89
|
+
protected _gridContainerClass(expanded: boolean): string;
|
|
90
|
+
protected _connectorClass(index: number): string;
|
|
91
|
+
protected _verticalStepClass(showConnector: boolean, index: number): string;
|
|
92
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HlmStepper, never>;
|
|
93
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<HlmStepper, "hlm-stepper", never, { "labelPosition": { "alias": "labelPosition"; "required": false; "isSignal": true; }; "headerPosition": { "alias": "headerPosition"; "required": false; "isSignal": true; }; "indicatorMode": { "alias": "indicatorMode"; "required": false; "isSignal": true; }; "stepperAriaLabel": { "alias": "stepperAriaLabel"; "required": false; "isSignal": true; }; "stepperAriaLabelledby": { "alias": "stepperAriaLabelledby"; "required": false; "isSignal": true; }; "animationsEnabled": { "alias": "animationsEnabled"; "required": false; "isSignal": true; }; "animationDuration": { "alias": "animationDuration"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Button that moves to the next step in a stepper workflow. */
|
|
97
|
+
declare class HlmStepperNext extends CdkStepperNext {
|
|
98
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HlmStepperNext, never>;
|
|
99
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<HlmStepperNext, "button[hlmStepperNext]", never, {}, {}, never, never, true, never>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Button that moves to the previous step in a stepper workflow. */
|
|
103
|
+
declare class HlmStepperPrevious extends CdkStepperPrevious {
|
|
104
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HlmStepperPrevious, never>;
|
|
105
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<HlmStepperPrevious, "button[hlmStepperPrevious]", never, {}, {}, never, never, true, never>;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
declare const HlmStepperImports: readonly [typeof HlmStepper, typeof HlmStep, typeof HlmStepHeader, typeof HlmStepperNext, typeof HlmStepperPrevious, typeof HlmStepContent, typeof HlmStepLabel];
|
|
109
|
+
declare class HlmStepperModule {
|
|
110
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HlmStepperModule, never>;
|
|
111
|
+
static ɵmod: _angular_core.ɵɵNgModuleDeclaration<HlmStepperModule, never, [typeof HlmStepper, typeof HlmStep, typeof HlmStepHeader, typeof HlmStepperNext, typeof HlmStepperPrevious, typeof HlmStepContent, typeof HlmStepLabel], [typeof HlmStepper, typeof HlmStep, typeof HlmStepHeader, typeof HlmStepperNext, typeof HlmStepperPrevious, typeof HlmStepContent, typeof HlmStepLabel]>;
|
|
112
|
+
static ɵinj: _angular_core.ɵɵInjectorDeclaration<HlmStepperModule>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export { HlmStep, HlmStepContent, HlmStepHeader, HlmStepLabel, HlmStepper, HlmStepperImports, HlmStepperModule, HlmStepperNext, HlmStepperPrevious, injectHlmStepperConfig, provideHlmStepperConfig };
|
|
116
|
+
export type { HlmStepperConfig, HlmStepperHeaderPosition, HlmStepperIndicatorMode, HlmStepperLabelPosition };
|