@nanahoshi/mona-ui 0.24.10 → 0.25.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 +9 -0
- package/chart/README.md +223 -77
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +11 -10
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +37 -20
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +239 -47
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +184 -31
- package/fesm2022/nanahoshi-mona-ui-button.mjs +47 -11
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +17 -13
- package/fesm2022/nanahoshi-mona-ui-card.mjs +54 -30
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +1909 -666
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +112 -31
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +131 -89
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +59 -19
- package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +118 -41
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +243 -212
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +155 -86
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +161 -131
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +12 -11
- package/fesm2022/nanahoshi-mona-ui-common.mjs +18 -1
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +25 -24
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +202 -33
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +31 -10
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +1 -1
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-DhKLnW06.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-voGbKOiB.mjs → nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs} +4 -4
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-HQ1Kv6R9.mjs → nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs} +7 -7
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-PNLJFcuH.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs} +4 -4
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BO19AVwC.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs} +27 -29
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +146 -5
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +5 -5
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +7 -7
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +183 -47
- package/fesm2022/nanahoshi-mona-ui-label.mjs +111 -15
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +111 -5
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +103 -5
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +103 -5
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +100 -6
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +90 -5
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +103 -5
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +90 -5
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +90 -5
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +103 -5
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +105 -5
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +103 -5
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +90 -5
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +90 -5
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +14 -13
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +13 -12
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +192 -56
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +3 -1
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +60 -29
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +334 -37
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +84 -30
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +274 -108
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +127 -37
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +595 -170
- package/fesm2022/nanahoshi-mona-ui-skeleton.mjs +3 -2
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +323 -166
- package/fesm2022/nanahoshi-mona-ui-spinner.mjs +167 -82
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +3 -3
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +273 -165
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +219 -132
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +84 -32
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +337 -116
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +10 -12
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +21 -8
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +444 -88
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +10 -9
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +15 -14
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +17 -3
- package/fesm2022/nanahoshi-mona-ui-window.mjs +1 -1
- package/i18n/catalogs/en-US.messages.json +90 -5
- package/locales/ar-sa/ar-sa.messages.json +90 -5
- package/locales/de-de/de-de.messages.json +90 -5
- package/locales/es-es/es-es.messages.json +90 -5
- package/locales/fr-fr/fr-fr.messages.json +91 -6
- package/locales/id-id/id-id.messages.json +90 -5
- package/locales/it-it/it-it.messages.json +90 -5
- package/locales/ja-jp/ja-jp.messages.json +90 -5
- package/locales/ko-kr/ko-kr.messages.json +90 -5
- package/locales/pt-br/pt-br.messages.json +90 -5
- package/locales/ru-ru/ru-ru.messages.json +90 -5
- package/locales/tr-tr/tr-tr.messages.json +90 -5
- package/locales/zh-cn/zh-cn.messages.json +90 -5
- package/locales/zh-tw/zh-tw.messages.json +90 -5
- package/package.json +2 -1
- package/styles.css +156 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -0
- package/types/nanahoshi-mona-ui-avatar.d.ts +18 -11
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +62 -14
- package/types/nanahoshi-mona-ui-button-group.d.ts +86 -16
- package/types/nanahoshi-mona-ui-button.d.ts +26 -3
- package/types/nanahoshi-mona-ui-calendar.d.ts +1 -0
- package/types/nanahoshi-mona-ui-card.d.ts +22 -6
- package/types/nanahoshi-mona-ui-chart.d.ts +519 -527
- package/types/nanahoshi-mona-ui-check-box.d.ts +54 -13
- package/types/nanahoshi-mona-ui-chip.d.ts +31 -18
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +21 -5
- package/types/nanahoshi-mona-ui-collapsible.d.ts +20 -11
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +62 -36
- package/types/nanahoshi-mona-ui-color-palette.d.ts +65 -27
- package/types/nanahoshi-mona-ui-color-picker.d.ts +64 -23
- package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -0
- package/types/nanahoshi-mona-ui-common.d.ts +28 -2
- package/types/nanahoshi-mona-ui-date-picker.d.ts +1 -0
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +1 -0
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +1 -0
- package/types/nanahoshi-mona-ui-editor.d.ts +1 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +51 -7
- package/types/nanahoshi-mona-ui-fieldset.d.ts +18 -4
- package/types/nanahoshi-mona-ui-grid.d.ts +0 -1
- package/types/nanahoshi-mona-ui-i18n.d.ts +130 -3
- package/types/nanahoshi-mona-ui-internal.d.ts +95 -14
- package/types/nanahoshi-mona-ui-label.d.ts +17 -2
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +85 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +85 -0
- package/types/nanahoshi-mona-ui-multi-select.d.ts +1 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -0
- package/types/nanahoshi-mona-ui-otp-input.d.ts +49 -12
- package/types/nanahoshi-mona-ui-placeholder.d.ts +2 -1
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +21 -9
- package/types/nanahoshi-mona-ui-radio-button.d.ts +165 -20
- package/types/nanahoshi-mona-ui-rating.d.ts +21 -6
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +59 -27
- package/types/nanahoshi-mona-ui-segmented.d.ts +52 -24
- package/types/nanahoshi-mona-ui-sidebar.d.ts +104 -41
- package/types/nanahoshi-mona-ui-skeleton.d.ts +1 -1
- package/types/nanahoshi-mona-ui-slider.d.ts +99 -35
- package/types/nanahoshi-mona-ui-spinner.d.ts +9 -5
- package/types/nanahoshi-mona-ui-splitter.d.ts +31 -10
- package/types/nanahoshi-mona-ui-stepper.d.ts +58 -12
- package/types/nanahoshi-mona-ui-switch.d.ts +32 -10
- package/types/nanahoshi-mona-ui-tabs.d.ts +75 -20
- package/types/nanahoshi-mona-ui-text-area.d.ts +7 -7
- package/types/nanahoshi-mona-ui-text-box.d.ts +2 -0
- package/types/nanahoshi-mona-ui-theme.d.ts +392 -15
- package/types/nanahoshi-mona-ui-time-picker.d.ts +1 -0
- package/types/nanahoshi-mona-ui-time-selector.d.ts +1 -0
- package/types/nanahoshi-mona-ui-tooltip.d.ts +7 -1
|
@@ -1,12 +1,40 @@
|
|
|
1
|
+
import { PreventableEvent } from '@nanahoshi/mona-ui/common';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive,
|
|
3
|
+
import { Directive, computed, input, inject, signal, contentChild, TemplateRef, viewChildren, booleanAttribute, model, output, effect, Component } from '@angular/core';
|
|
3
4
|
import { NgTemplateOutlet } from '@angular/common';
|
|
4
|
-
import {
|
|
5
|
+
import { LucideCheck, LucideCircleAlert } from '@lucide/angular';
|
|
5
6
|
import { select } from '@mirei/ts-collections';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
7
|
+
import { formatNumber, injectComponentDirection, MonaI18nService } from '@nanahoshi/mona-ui/i18n';
|
|
8
|
+
import { createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
8
9
|
import { cva } from 'class-variance-authority';
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* What `mona-stepper` reports before a click or key changes the step. Call `preventDefault()` to stay on the current step.
|
|
13
|
+
*/
|
|
14
|
+
class StepSelectEvent extends PreventableEvent {
|
|
15
|
+
#index;
|
|
16
|
+
#previousIndex;
|
|
17
|
+
#step;
|
|
18
|
+
constructor(index, previousIndex, step, originalEvent) {
|
|
19
|
+
super("stepSelect", originalEvent);
|
|
20
|
+
this.#index = index;
|
|
21
|
+
this.#previousIndex = previousIndex;
|
|
22
|
+
this.#step = step;
|
|
23
|
+
}
|
|
24
|
+
/** Zero-based index of the step being selected. */
|
|
25
|
+
get index() {
|
|
26
|
+
return this.#index;
|
|
27
|
+
}
|
|
28
|
+
/** Zero-based index of the step that is current now. */
|
|
29
|
+
get previousIndex() {
|
|
30
|
+
return this.#previousIndex;
|
|
31
|
+
}
|
|
32
|
+
/** The options of the step being selected. */
|
|
33
|
+
get step() {
|
|
34
|
+
return this.#step;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
10
38
|
/**
|
|
11
39
|
* Marks an ng-template as the custom indicator template for mona-stepper.
|
|
12
40
|
* The template context provides the step options, index, active state, and current step index.
|
|
@@ -54,7 +82,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
54
82
|
}] });
|
|
55
83
|
|
|
56
84
|
const stepperBaseThemeVariants = cva(`
|
|
57
|
-
relative grid
|
|
85
|
+
relative grid
|
|
58
86
|
`, {
|
|
59
87
|
variants: {
|
|
60
88
|
orientation: {
|
|
@@ -101,18 +129,30 @@ const stepperStepListItemThemeVariants = cva(`
|
|
|
101
129
|
});
|
|
102
130
|
const stepperStepIndicatorThemeVariants = cva(`
|
|
103
131
|
flex h-8 w-8 items-center justify-center
|
|
104
|
-
border border-border
|
|
105
|
-
transition-colors duration-
|
|
132
|
+
border border-border cursor-[inherit]
|
|
133
|
+
transition-colors duration-(--mona-motion-standard) ease-in-out
|
|
134
|
+
focus-visible:outline-2 focus-visible:outline-offset-4 focus-visible:outline-focus-indicator
|
|
106
135
|
`, {
|
|
107
136
|
variants: {
|
|
108
|
-
|
|
109
|
-
true: "
|
|
110
|
-
false: "bg-surface-raised text-foreground"
|
|
111
|
-
},
|
|
112
|
-
focused: {
|
|
113
|
-
true: "border-focus-indicator ring-2 ring-focus-indicator/35",
|
|
137
|
+
invalid: {
|
|
138
|
+
true: "border-2 border-error",
|
|
114
139
|
false: ""
|
|
115
140
|
},
|
|
141
|
+
state: {
|
|
142
|
+
completed: `
|
|
143
|
+
bg-[var(--mona-indicator-color,var(--color-primary))]
|
|
144
|
+
text-[var(--mona-indicator-foreground,var(--color-primary-foreground))]
|
|
145
|
+
forced-colors:border-[Highlight]
|
|
146
|
+
`,
|
|
147
|
+
current: `
|
|
148
|
+
bg-[var(--mona-indicator-color,var(--color-primary))]
|
|
149
|
+
text-[var(--mona-indicator-foreground,var(--color-primary-foreground))]
|
|
150
|
+
ring-2 ring-primary ring-offset-2 ring-offset-surface
|
|
151
|
+
forced-colors:border-2 forced-colors:border-[Highlight]
|
|
152
|
+
`,
|
|
153
|
+
disabled: "border-dashed bg-surface-muted text-disabled-foreground",
|
|
154
|
+
upcoming: "bg-surface-raised text-foreground"
|
|
155
|
+
},
|
|
116
156
|
rounded: {
|
|
117
157
|
small: "rounded-sm",
|
|
118
158
|
medium: "rounded-md",
|
|
@@ -122,6 +162,21 @@ const stepperStepIndicatorThemeVariants = cva(`
|
|
|
122
162
|
}
|
|
123
163
|
}
|
|
124
164
|
});
|
|
165
|
+
/** The button around a `monaStepperStepTemplate`, whose looks are the template's. */
|
|
166
|
+
const stepperStepButtonThemeVariants = cva(`
|
|
167
|
+
cursor-[inherit] rounded-sm
|
|
168
|
+
focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-indicator
|
|
169
|
+
`);
|
|
170
|
+
const stepperStepLabelThemeVariants = cva("", {
|
|
171
|
+
variants: {
|
|
172
|
+
state: {
|
|
173
|
+
completed: "",
|
|
174
|
+
current: "font-semibold",
|
|
175
|
+
disabled: "text-disabled-foreground",
|
|
176
|
+
upcoming: ""
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
});
|
|
125
180
|
const stepperTrackThemeVariants = cva(`
|
|
126
181
|
relative grid
|
|
127
182
|
bg-surface-muted text-foreground
|
|
@@ -138,7 +193,7 @@ const stepperTrackThemeVariants = cva(`
|
|
|
138
193
|
}
|
|
139
194
|
});
|
|
140
195
|
const stepperTrackLineThemeVariants = cva(`
|
|
141
|
-
absolute start-0 top-0 bg-primary
|
|
196
|
+
absolute start-0 top-0 bg-[var(--mona-indicator-color,var(--color-primary))]
|
|
142
197
|
`, {
|
|
143
198
|
variants: {
|
|
144
199
|
orientation: {
|
|
@@ -152,66 +207,76 @@ const stepperTrackLineThemeVariants = cva(`
|
|
|
152
207
|
});
|
|
153
208
|
|
|
154
209
|
class StepperIndicatorDirective {
|
|
155
|
-
#host;
|
|
156
|
-
#wasFocused;
|
|
157
210
|
constructor() {
|
|
158
|
-
this.#host = inject(ElementRef);
|
|
159
|
-
this.#wasFocused = false;
|
|
160
211
|
this.stepIndicatorClass = computed(() => {
|
|
161
|
-
const
|
|
162
|
-
const focused = this.focused();
|
|
212
|
+
const invalid = this.invalid();
|
|
163
213
|
const rounded = this.rounded();
|
|
164
|
-
|
|
214
|
+
const state = this.state();
|
|
215
|
+
return stepperStepIndicatorThemeVariants({ invalid, rounded, state });
|
|
165
216
|
}, /* @ts-ignore */
|
|
166
217
|
...(ngDevMode ? [{ debugName: "stepIndicatorClass" }] : /* istanbul ignore next */ []));
|
|
167
|
-
this.
|
|
168
|
-
...(ngDevMode ? [{ debugName: "
|
|
169
|
-
this.focused = input.required(/* @ts-ignore */
|
|
170
|
-
...(ngDevMode ? [{ debugName: "focused" }] : /* istanbul ignore next */ []));
|
|
218
|
+
this.invalid = input.required(/* @ts-ignore */
|
|
219
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
171
220
|
this.rounded = input.required(/* @ts-ignore */
|
|
172
221
|
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const focused = this.focused();
|
|
176
|
-
if (focused && !this.#wasFocused) {
|
|
177
|
-
this.#host.nativeElement.focus();
|
|
178
|
-
}
|
|
179
|
-
this.#wasFocused = focused;
|
|
180
|
-
}
|
|
181
|
-
});
|
|
222
|
+
this.state = input.required(/* @ts-ignore */
|
|
223
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
182
224
|
}
|
|
183
225
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: StepperIndicatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
184
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: StepperIndicatorDirective, isStandalone: true, selector: "
|
|
226
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: StepperIndicatorDirective, isStandalone: true, selector: "button[monaStepperIndicator]", inputs: { invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: true, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: true, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class": "stepIndicatorClass()" } }, ngImport: i0 }); }
|
|
185
227
|
}
|
|
186
228
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: StepperIndicatorDirective, decorators: [{
|
|
187
229
|
type: Directive,
|
|
188
230
|
args: [{
|
|
189
|
-
selector: "
|
|
231
|
+
selector: "button[monaStepperIndicator]",
|
|
190
232
|
host: {
|
|
191
233
|
"[class]": "stepIndicatorClass()"
|
|
192
234
|
}
|
|
193
235
|
}]
|
|
194
|
-
}],
|
|
236
|
+
}], propDecorators: { invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: true }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: true }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: true }] }] } });
|
|
195
237
|
|
|
196
238
|
// Generated from i18n/catalogs/en-US.messages.json by scripts/generate-locale-catalogs.ts. Do not edit.
|
|
197
239
|
// Edit the JSON file and run `npm run generate:locale-catalogs`.
|
|
240
|
+
function localizeNumber(value, options) {
|
|
241
|
+
return formatNumber(value, "en-US", options);
|
|
242
|
+
}
|
|
198
243
|
const STEPPER_DEFAULT_MESSAGES = {
|
|
244
|
+
stepCompleted: "Completed",
|
|
245
|
+
stepInvalid: "Has errors",
|
|
246
|
+
stepPosition: (current, total) => `Step ${localizeNumber(current)} of ${localizeNumber(total)}`,
|
|
199
247
|
stepProgress: "Step progress",
|
|
200
248
|
stepper: "Progress"
|
|
201
249
|
};
|
|
202
250
|
|
|
251
|
+
/** What in a label or step template keeps its own clicks. */
|
|
252
|
+
const PROJECTED_CONTROL_SELECTOR = "a[href], button, input, select, summary, textarea, [contenteditable], [tabindex]";
|
|
203
253
|
class StepperComponent {
|
|
204
|
-
|
|
254
|
+
/** The nearest steps on either side of the current one that aren't disabled: all that a linear stepper can reach. */
|
|
255
|
+
#adjacentEnabledSteps;
|
|
205
256
|
#direction;
|
|
206
|
-
#hostElementRef;
|
|
207
257
|
#i18n;
|
|
258
|
+
#id;
|
|
208
259
|
#trackItemSize;
|
|
209
260
|
#trackLength;
|
|
210
261
|
constructor() {
|
|
211
|
-
|
|
262
|
+
/** The nearest steps on either side of the current one that aren't disabled: all that a linear stepper can reach. */
|
|
263
|
+
this.#adjacentEnabledSteps = computed(() => {
|
|
264
|
+
const active = this.activeStep();
|
|
265
|
+
const enabled = this.viewSteps()
|
|
266
|
+
.toArray()
|
|
267
|
+
.filter(step => !step.options.disabled);
|
|
268
|
+
if (!active) {
|
|
269
|
+
return { next: undefined, previous: undefined };
|
|
270
|
+
}
|
|
271
|
+
return {
|
|
272
|
+
next: enabled.find(step => step.index > active.index),
|
|
273
|
+
previous: enabled.filter(step => step.index < active.index).pop()
|
|
274
|
+
};
|
|
275
|
+
}, /* @ts-ignore */
|
|
276
|
+
...(ngDevMode ? [{ debugName: "#adjacentEnabledSteps" }] : /* istanbul ignore next */ []));
|
|
212
277
|
this.#direction = injectComponentDirection();
|
|
213
|
-
this.#hostElementRef = inject(ElementRef);
|
|
214
278
|
this.#i18n = inject(MonaI18nService);
|
|
279
|
+
this.#id = createElementControlId();
|
|
215
280
|
this.#trackItemSize = computed(() => {
|
|
216
281
|
const stepCount = this.viewSteps().length;
|
|
217
282
|
return stepCount !== 0 ? 100 / stepCount : 0;
|
|
@@ -228,9 +293,7 @@ class StepperComponent {
|
|
|
228
293
|
if (steps.length === 0) {
|
|
229
294
|
return undefined;
|
|
230
295
|
}
|
|
231
|
-
|
|
232
|
-
const clampedIndex = Math.min(Math.max(step, 0), steps.length - 1);
|
|
233
|
-
return steps.elementAt(clampedIndex);
|
|
296
|
+
return steps.elementAt(this.normalizeIndex(this.step(), steps.length));
|
|
234
297
|
}, /* @ts-ignore */
|
|
235
298
|
...(ngDevMode ? [{ debugName: "activeStep" }] : /* istanbul ignore next */ []));
|
|
236
299
|
this.baseClass = computed(() => {
|
|
@@ -268,6 +331,17 @@ class StepperComponent {
|
|
|
268
331
|
this.messages = this.#i18n.componentMessages("stepper", STEPPER_DEFAULT_MESSAGES);
|
|
269
332
|
this.progressMax = computed(() => Math.max(this.viewSteps().length - 1, 0), /* @ts-ignore */
|
|
270
333
|
...(ngDevMode ? [{ debugName: "progressMax" }] : /* istanbul ignore next */ []));
|
|
334
|
+
this.progressText = computed(() => {
|
|
335
|
+
const active = this.activeStep();
|
|
336
|
+
return active ? this.positionText(active.index + 1) : null;
|
|
337
|
+
}, /* @ts-ignore */
|
|
338
|
+
...(ngDevMode ? [{ debugName: "progressText" }] : /* istanbul ignore next */ []));
|
|
339
|
+
this.stepButtonClass = computed(() => {
|
|
340
|
+
return stepperStepButtonThemeVariants();
|
|
341
|
+
}, /* @ts-ignore */
|
|
342
|
+
...(ngDevMode ? [{ debugName: "stepButtonClass" }] : /* istanbul ignore next */ []));
|
|
343
|
+
this.stepButtons = viewChildren("stepButton", /* @ts-ignore */
|
|
344
|
+
...(ngDevMode ? [{ debugName: "stepButtons" }] : /* istanbul ignore next */ []));
|
|
271
345
|
this.stepTemplate = contentChild(StepperStepTemplateDirective, {
|
|
272
346
|
read: TemplateRef
|
|
273
347
|
});
|
|
@@ -324,8 +398,7 @@ class StepperComponent {
|
|
|
324
398
|
* If set to true, the user will only be able to navigate to the previous or the next step.
|
|
325
399
|
* @default true
|
|
326
400
|
*/
|
|
327
|
-
this.linear = input(true, /*
|
|
328
|
-
...(ngDevMode ? [{ debugName: "linear" }] : /* istanbul ignore next */ []));
|
|
401
|
+
this.linear = input(true, { ...(ngDevMode ? { debugName: "linear" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
329
402
|
/**
|
|
330
403
|
* @description Sets the orientation of the stepper.
|
|
331
404
|
*/
|
|
@@ -347,24 +420,32 @@ class StepperComponent {
|
|
|
347
420
|
*/
|
|
348
421
|
this.step = model(0, /* @ts-ignore */
|
|
349
422
|
...(ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []));
|
|
423
|
+
/**
|
|
424
|
+
* @description Emitted before a click or key changes the step. Call `preventDefault()` to stay on the current step,
|
|
425
|
+
* for example while its form is invalid. It doesn't fire when `step` is written from outside.
|
|
426
|
+
*/
|
|
427
|
+
this.stepSelect = output();
|
|
350
428
|
/**
|
|
351
429
|
* @description Sets the steps of the stepper.
|
|
352
430
|
*/
|
|
353
431
|
this.steps = input([], /* @ts-ignore */
|
|
354
432
|
...(ngDevMode ? [{ debugName: "steps" }] : /* istanbul ignore next */ []));
|
|
355
433
|
effect(() => {
|
|
356
|
-
const
|
|
434
|
+
const requested = this.step();
|
|
357
435
|
const stepCount = this.viewSteps().length;
|
|
358
436
|
if (stepCount === 0) {
|
|
359
|
-
return;
|
|
437
|
+
return; // Steps may still be on their way, so the value can't be judged yet.
|
|
360
438
|
}
|
|
361
|
-
const
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
439
|
+
const index = this.normalizeIndex(requested, stepCount);
|
|
440
|
+
if (index !== requested) {
|
|
441
|
+
this.step.set(index);
|
|
442
|
+
}
|
|
443
|
+
this.highlightedStep.set(index);
|
|
366
444
|
});
|
|
367
445
|
}
|
|
446
|
+
descriptionId(step) {
|
|
447
|
+
return `${this.#id}-${step.index}-description`;
|
|
448
|
+
}
|
|
368
449
|
formatStepNumber(value) {
|
|
369
450
|
if (value == null) {
|
|
370
451
|
return "";
|
|
@@ -386,110 +467,116 @@ class StepperComponent {
|
|
|
386
467
|
return false;
|
|
387
468
|
}
|
|
388
469
|
const active = this.activeStep();
|
|
389
|
-
if (!active) {
|
|
470
|
+
if (!active || step.index === active.index) {
|
|
390
471
|
return false;
|
|
391
472
|
}
|
|
392
|
-
|
|
473
|
+
const { next, previous } = this.#adjacentEnabledSteps();
|
|
474
|
+
return step.index !== next?.index && step.index !== previous?.index;
|
|
393
475
|
}
|
|
394
|
-
|
|
395
|
-
|
|
476
|
+
labelClass(state) {
|
|
477
|
+
return stepperStepLabelThemeVariants({ state });
|
|
396
478
|
}
|
|
397
|
-
|
|
398
|
-
this.
|
|
479
|
+
onIndicatorFocus(step) {
|
|
480
|
+
this.highlightedStep.set(step.index);
|
|
399
481
|
}
|
|
400
|
-
|
|
401
|
-
|
|
482
|
+
/**
|
|
483
|
+
* Enter and Space aren't here: they reach the step as the click a native button makes of them. Only the step buttons'
|
|
484
|
+
* own keys count, so a control in a template keeps its arrows, and a modified key stays the browser's.
|
|
485
|
+
*/
|
|
486
|
+
onKeydown(event) {
|
|
487
|
+
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
if (!this.stepButtons().some(button => button.nativeElement === event.target)) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
const orientation = this.orientation();
|
|
494
|
+
const isRtl = this.isRtl();
|
|
495
|
+
let previousKey = orientation === "vertical" ? "ArrowUp" : "ArrowLeft";
|
|
496
|
+
let nextKey = orientation === "vertical" ? "ArrowDown" : "ArrowRight";
|
|
497
|
+
if (orientation === "horizontal" && isRtl) {
|
|
498
|
+
previousKey = "ArrowRight";
|
|
499
|
+
nextKey = "ArrowLeft";
|
|
500
|
+
}
|
|
501
|
+
const reachable = this.viewSteps()
|
|
502
|
+
.toArray()
|
|
503
|
+
.filter(step => !this.isStepLocked(step));
|
|
402
504
|
const current = this.highlightedStep();
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
let target = current + offset;
|
|
407
|
-
const minIndex = linear && activeStep ? Math.max(activeStep.index - 1, 0) : 0;
|
|
408
|
-
const maxIndex = linear && activeStep ? Math.min(activeStep.index + 1, stepCount - 1) : stepCount - 1;
|
|
409
|
-
target = Math.min(Math.max(target, minIndex), maxIndex);
|
|
410
|
-
// Skip over disabled steps in the direction of travel.
|
|
411
|
-
while (target >= 0 && target < stepCount && steps.elementAt(target)?.options.disabled) {
|
|
412
|
-
target += offset;
|
|
505
|
+
let target;
|
|
506
|
+
if (event.key === previousKey) {
|
|
507
|
+
target = reachable.filter(step => step.index < current).pop();
|
|
413
508
|
}
|
|
414
|
-
if (
|
|
415
|
-
|
|
509
|
+
else if (event.key === nextKey) {
|
|
510
|
+
target = reachable.find(step => step.index > current);
|
|
416
511
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
512
|
+
else if (event.key === "Home") {
|
|
513
|
+
target = reachable[0];
|
|
514
|
+
}
|
|
515
|
+
else if (event.key === "End") {
|
|
516
|
+
target = reachable[reachable.length - 1];
|
|
517
|
+
}
|
|
518
|
+
else {
|
|
420
519
|
return;
|
|
421
520
|
}
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
if (!linear || (activeStep && (isPreviousStep || isNextStep))) {
|
|
427
|
-
this.step.set(step.index);
|
|
428
|
-
this.highlightedStep.set(step.index);
|
|
521
|
+
event.preventDefault();
|
|
522
|
+
if (target) {
|
|
523
|
+
this.highlightedStep.set(target.index);
|
|
524
|
+
this.stepButtons()[target.index]?.nativeElement.focus();
|
|
429
525
|
}
|
|
430
526
|
}
|
|
431
|
-
|
|
432
|
-
const
|
|
433
|
-
if (
|
|
527
|
+
onStepClick(step, event) {
|
|
528
|
+
const control = event.target.closest(PROJECTED_CONTROL_SELECTOR);
|
|
529
|
+
if (control && !this.stepButtons().some(button => button.nativeElement === control)) {
|
|
434
530
|
return;
|
|
435
531
|
}
|
|
436
|
-
|
|
437
|
-
this.highlightedStep.set(clampedIndex);
|
|
532
|
+
this.setActiveStep(step, event);
|
|
438
533
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
else if (event.key === "Enter" || event.key === " ") {
|
|
468
|
-
event.preventDefault();
|
|
469
|
-
const highlightedStep = this.highlightedStep();
|
|
470
|
-
const step = this.viewSteps().elementAt(highlightedStep);
|
|
471
|
-
if (step) {
|
|
472
|
-
this.setActiveStep(step);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
});
|
|
534
|
+
positionText(position) {
|
|
535
|
+
return this.messages().stepPosition(position, this.viewSteps().length);
|
|
536
|
+
}
|
|
537
|
+
stepState(step) {
|
|
538
|
+
const active = this.activeStep();
|
|
539
|
+
if (step.index === active?.index) {
|
|
540
|
+
return "current";
|
|
541
|
+
}
|
|
542
|
+
if (step.options.disabled) {
|
|
543
|
+
return "disabled";
|
|
544
|
+
}
|
|
545
|
+
return (step.options.completed ?? (active != null && step.index < active.index)) ? "completed" : "upcoming";
|
|
546
|
+
}
|
|
547
|
+
normalizeIndex(value, stepCount) {
|
|
548
|
+
return Number.isFinite(value) ? Math.min(Math.max(Math.trunc(value), 0), stepCount - 1) : 0;
|
|
549
|
+
}
|
|
550
|
+
setActiveStep(step, event) {
|
|
551
|
+
const active = this.activeStep();
|
|
552
|
+
if (this.isStepLocked(step) || step.index === active?.index) {
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
const selectEvent = new StepSelectEvent(step.index, active?.index ?? 0, step.options, event);
|
|
556
|
+
this.stepSelect.emit(selectEvent);
|
|
557
|
+
if (selectEvent.isDefaultPrevented()) {
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
this.step.set(step.index);
|
|
561
|
+
this.highlightedStep.set(step.index);
|
|
476
562
|
}
|
|
477
563
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: StepperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
478
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: StepperComponent, isStandalone: true, selector: "mona-stepper", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, linear: { classPropertyName: "linear", publicName: "linear", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, progressAriaLabel: { classPropertyName: "progressAriaLabel", publicName: "progressAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, steps: { classPropertyName: "steps", publicName: "steps", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { step: "stepChange" }, host: { attributes: { "role": "group" }, properties: { "attr.aria-label": "ariaLabel() || messages().stepper", "class": "baseClass()", "style": "hostStyles()" } }, queries: [{ propertyName: "indicatorTemplate", first: true, predicate: StepperIndicatorTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "labelTemplate", first: true, predicate: StepperLabelTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "stepTemplate", first: true, predicate: StepperStepTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], ngImport: i0, template: "<ol [class]=\"listClass()\">\n @for (step of viewSteps(); track step.index) {\n @let active = isStepActive(step);\n @let locked = isStepLocked(step);\n @let
|
|
564
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: StepperComponent, isStandalone: true, selector: "mona-stepper", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, linear: { classPropertyName: "linear", publicName: "linear", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, progressAriaLabel: { classPropertyName: "progressAriaLabel", publicName: "progressAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, steps: { classPropertyName: "steps", publicName: "steps", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { step: "stepChange", stepSelect: "stepSelect" }, host: { attributes: { "role": "group" }, listeners: { "keydown": "onKeydown($event)" }, properties: { "attr.aria-label": "ariaLabel() || messages().stepper", "class": "baseClass()", "style": "hostStyles()" } }, queries: [{ propertyName: "indicatorTemplate", first: true, predicate: StepperIndicatorTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "labelTemplate", first: true, predicate: StepperLabelTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "stepTemplate", first: true, predicate: StepperStepTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "stepButtons", predicate: ["stepButton"], descendants: true, isSignal: true }], ngImport: i0, template: "<ol role=\"list\" [class]=\"listClass()\">\n @for (step of viewSteps(); track step.index) {\n @let active = isStepActive(step);\n @let locked = isStepLocked(step);\n @let state = stepState(step);\n @let invalid = !!step.options.invalid;\n @let options = step.options;\n @let index = step.index;\n @let currentIndex = activeStep()?.index ?? -1;\n @let disabled = !!options.disabled;\n @let focusable = step.index === highlightedStep();\n <li\n [class]=\"listItemClass()\"\n [class.cursor-pointer]=\"!locked\"\n [class.cursor-not-allowed]=\"locked\"\n [style]=\"trackItemStyles()\"\n (click)=\"onStepClick(step, $event)\">\n @if (stepTemplate()) {\n <button\n #stepButton\n type=\"button\"\n [class]=\"stepButtonClass()\"\n [attr.aria-current]=\"state === 'current' ? 'step' : undefined\"\n [attr.aria-describedby]=\"descriptionId(step)\"\n [attr.aria-disabled]=\"locked ? true : undefined\"\n [attr.aria-label]=\"options.label\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (focus)=\"onIndicatorFocus(step)\">\n <ng-container\n [ngTemplateOutlet]=\"stepTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n </button>\n } @else {\n <button\n #stepButton\n monaStepperIndicator\n type=\"button\"\n [invalid]=\"invalid\"\n [rounded]=\"rounded()\"\n [state]=\"state\"\n [attr.aria-current]=\"state === 'current' ? 'step' : undefined\"\n [attr.aria-describedby]=\"descriptionId(step)\"\n [attr.aria-disabled]=\"locked ? true : undefined\"\n [attr.aria-label]=\"options.label\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (focus)=\"onIndicatorFocus(step)\">\n @if (indicatorTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"indicatorTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n } @else if (invalid) {\n <svg lucideCircleAlert [size]=\"16\" aria-hidden=\"true\"></svg>\n } @else if (state === \"completed\") {\n <svg lucideCheck [size]=\"16\" aria-hidden=\"true\"></svg>\n } @else {\n {{ formatStepNumber(step.index + 1) }}\n }\n </button>\n }\n @if (labelTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"labelTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n } @else {\n <span [class]=\"labelClass(state)\" aria-hidden=\"true\">{{ options.label }}</span>\n }\n </li>\n }\n</ol>\n<!-- Read through aria-describedby, which also works on hidden text. Nothing here is shown or read twice. -->\n<div hidden>\n @for (step of viewSteps(); track step.index) {\n <span [id]=\"descriptionId(step)\">\n <span>{{ positionText(step.index + 1) }}</span>\n @if (stepState(step) === \"completed\") {\n <span> {{ messages().stepCompleted }}</span>\n }\n @if (step.options.invalid) {\n <span> {{ messages().stepInvalid }}</span>\n }\n </span>\n }\n</div>\n<div\n [class]=\"trackClass()\"\n [style]=\"trackStyles()\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"activeStep()?.index ?? 0\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"progressMax()\"\n [attr.aria-valuetext]=\"progressText()\"\n [attr.aria-label]=\"progressAriaLabel() || messages().stepProgress\">\n <div [class]=\"trackLineClass()\" [style]=\"trackInnerStyles()\"></div>\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: StepperIndicatorDirective, selector: "button[monaStepperIndicator]", inputs: ["invalid", "rounded", "state"] }, { kind: "component", type: LucideCheck, selector: "svg[lucideCheck]" }, { kind: "component", type: LucideCircleAlert, selector: "svg[lucideCircleAlert], svg[lucideAlertCircle]" }] }); }
|
|
479
565
|
}
|
|
480
566
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: StepperComponent, decorators: [{
|
|
481
567
|
type: Component,
|
|
482
|
-
args: [{ selector: "mona-stepper", imports: [NgTemplateOutlet, StepperIndicatorDirective], host: {
|
|
568
|
+
args: [{ selector: "mona-stepper", imports: [NgTemplateOutlet, StepperIndicatorDirective, LucideCheck, LucideCircleAlert], host: {
|
|
483
569
|
role: "group",
|
|
484
570
|
"[attr.aria-label]": "ariaLabel() || messages().stepper",
|
|
485
571
|
"[class]": "baseClass()",
|
|
486
|
-
"[style]": "hostStyles()"
|
|
487
|
-
|
|
572
|
+
"[style]": "hostStyles()",
|
|
573
|
+
"(keydown)": "onKeydown($event)"
|
|
574
|
+
}, template: "<ol role=\"list\" [class]=\"listClass()\">\n @for (step of viewSteps(); track step.index) {\n @let active = isStepActive(step);\n @let locked = isStepLocked(step);\n @let state = stepState(step);\n @let invalid = !!step.options.invalid;\n @let options = step.options;\n @let index = step.index;\n @let currentIndex = activeStep()?.index ?? -1;\n @let disabled = !!options.disabled;\n @let focusable = step.index === highlightedStep();\n <li\n [class]=\"listItemClass()\"\n [class.cursor-pointer]=\"!locked\"\n [class.cursor-not-allowed]=\"locked\"\n [style]=\"trackItemStyles()\"\n (click)=\"onStepClick(step, $event)\">\n @if (stepTemplate()) {\n <button\n #stepButton\n type=\"button\"\n [class]=\"stepButtonClass()\"\n [attr.aria-current]=\"state === 'current' ? 'step' : undefined\"\n [attr.aria-describedby]=\"descriptionId(step)\"\n [attr.aria-disabled]=\"locked ? true : undefined\"\n [attr.aria-label]=\"options.label\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (focus)=\"onIndicatorFocus(step)\">\n <ng-container\n [ngTemplateOutlet]=\"stepTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n </button>\n } @else {\n <button\n #stepButton\n monaStepperIndicator\n type=\"button\"\n [invalid]=\"invalid\"\n [rounded]=\"rounded()\"\n [state]=\"state\"\n [attr.aria-current]=\"state === 'current' ? 'step' : undefined\"\n [attr.aria-describedby]=\"descriptionId(step)\"\n [attr.aria-disabled]=\"locked ? true : undefined\"\n [attr.aria-label]=\"options.label\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (focus)=\"onIndicatorFocus(step)\">\n @if (indicatorTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"indicatorTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n } @else if (invalid) {\n <svg lucideCircleAlert [size]=\"16\" aria-hidden=\"true\"></svg>\n } @else if (state === \"completed\") {\n <svg lucideCheck [size]=\"16\" aria-hidden=\"true\"></svg>\n } @else {\n {{ formatStepNumber(step.index + 1) }}\n }\n </button>\n }\n @if (labelTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"labelTemplate()\"\n [ngTemplateOutletContext]=\"{\n $implicit: options,\n index,\n active,\n currentIndex,\n disabled,\n invalid,\n state\n }\"></ng-container>\n } @else {\n <span [class]=\"labelClass(state)\" aria-hidden=\"true\">{{ options.label }}</span>\n }\n </li>\n }\n</ol>\n<!-- Read through aria-describedby, which also works on hidden text. Nothing here is shown or read twice. -->\n<div hidden>\n @for (step of viewSteps(); track step.index) {\n <span [id]=\"descriptionId(step)\">\n <span>{{ positionText(step.index + 1) }}</span>\n @if (stepState(step) === \"completed\") {\n <span> {{ messages().stepCompleted }}</span>\n }\n @if (step.options.invalid) {\n <span> {{ messages().stepInvalid }}</span>\n }\n </span>\n }\n</div>\n<div\n [class]=\"trackClass()\"\n [style]=\"trackStyles()\"\n role=\"progressbar\"\n [attr.aria-valuenow]=\"activeStep()?.index ?? 0\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"progressMax()\"\n [attr.aria-valuetext]=\"progressText()\"\n [attr.aria-label]=\"progressAriaLabel() || messages().stepProgress\">\n <div [class]=\"trackLineClass()\" [style]=\"trackInnerStyles()\"></div>\n</div>\n" }]
|
|
488
575
|
}], ctorParameters: () => [], propDecorators: { indicatorTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => StepperIndicatorTemplateDirective), { ...{
|
|
489
576
|
read: TemplateRef
|
|
490
|
-
}, isSignal: true }] }], labelTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => StepperLabelTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], stepTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => StepperStepTemplateDirective), { ...{
|
|
577
|
+
}, isSignal: true }] }], labelTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => StepperLabelTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], stepButtons: [{ type: i0.ViewChildren, args: ["stepButton", { isSignal: true }] }], stepTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => StepperStepTemplateDirective), { ...{
|
|
491
578
|
read: TemplateRef
|
|
492
|
-
}, isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], linear: [{ type: i0.Input, args: [{ isSignal: true, alias: "linear", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], progressAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "progressAriaLabel", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }, { type: i0.Output, args: ["stepChange"] }], steps: [{ type: i0.Input, args: [{ isSignal: true, alias: "steps", required: false }] }] } });
|
|
579
|
+
}, isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], linear: [{ type: i0.Input, args: [{ isSignal: true, alias: "linear", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], progressAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "progressAriaLabel", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }, { type: i0.Output, args: ["stepChange"] }], stepSelect: [{ type: i0.Output, args: ["stepSelect"] }], steps: [{ type: i0.Input, args: [{ isSignal: true, alias: "steps", required: false }] }] } });
|
|
493
580
|
|
|
494
581
|
/*
|
|
495
582
|
* Public API Surface of @nanahoshi/mona-ui/stepper
|
|
@@ -499,5 +586,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
499
586
|
* Generated bundle index. Do not edit.
|
|
500
587
|
*/
|
|
501
588
|
|
|
502
|
-
export { STEPPER_DEFAULT_MESSAGES, StepperComponent, StepperIndicatorTemplateDirective, StepperLabelTemplateDirective, StepperStepTemplateDirective };
|
|
589
|
+
export { STEPPER_DEFAULT_MESSAGES, StepSelectEvent, StepperComponent, StepperIndicatorTemplateDirective, StepperLabelTemplateDirective, StepperStepTemplateDirective };
|
|
503
590
|
//# sourceMappingURL=nanahoshi-mona-ui-stepper.mjs.map
|