mn-angular-lib 2.0.50 → 2.0.52
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/fesm2022/mn-angular-lib-calendar.mjs +6 -6
- package/fesm2022/mn-angular-lib-calendar.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-keyboard.mjs +55 -3
- package/fesm2022/mn-angular-lib-keyboard.mjs.map +1 -1
- package/fesm2022/mn-angular-lib-modal-ui.mjs +8 -6
- package/fesm2022/mn-angular-lib-modal-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/mn-angular-lib-keyboard.d.ts +19 -0
|
@@ -48,6 +48,36 @@ const DIGIT_ROW = [
|
|
|
48
48
|
"9",
|
|
49
49
|
"0"
|
|
50
50
|
];
|
|
51
|
+
const ACCENT_ROWS = [
|
|
52
|
+
[
|
|
53
|
+
"é",
|
|
54
|
+
"è",
|
|
55
|
+
"ë",
|
|
56
|
+
"ê",
|
|
57
|
+
"á",
|
|
58
|
+
"à",
|
|
59
|
+
"ä"
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
"â",
|
|
63
|
+
"ó",
|
|
64
|
+
"ò",
|
|
65
|
+
"ö",
|
|
66
|
+
"ô",
|
|
67
|
+
"ú",
|
|
68
|
+
"ù"
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
"ü",
|
|
72
|
+
"û",
|
|
73
|
+
"í",
|
|
74
|
+
"ì",
|
|
75
|
+
"ï",
|
|
76
|
+
"î",
|
|
77
|
+
"ç"
|
|
78
|
+
]
|
|
79
|
+
];
|
|
80
|
+
const SYMBOL_KEYS = ["'", "-"];
|
|
51
81
|
const NUMERIC_ROWS = [
|
|
52
82
|
[
|
|
53
83
|
"1",
|
|
@@ -75,9 +105,12 @@ var MnKeyboard = class MnKeyboard {
|
|
|
75
105
|
clear: "⨯",
|
|
76
106
|
space: "␣",
|
|
77
107
|
submit: "⏎",
|
|
78
|
-
keyboard: ""
|
|
108
|
+
keyboard: "",
|
|
109
|
+
shift: "⇧",
|
|
110
|
+
accents: "é"
|
|
79
111
|
};
|
|
80
112
|
uppercase = false;
|
|
113
|
+
uppercaseChange = new EventEmitter();
|
|
81
114
|
allowSpace = true;
|
|
82
115
|
showSubmit = true;
|
|
83
116
|
submitDisabled = false;
|
|
@@ -94,12 +127,29 @@ var MnKeyboard = class MnKeyboard {
|
|
|
94
127
|
const letters = this.uppercase ? ALPHA_ROWS.map((row) => row.map((key) => key.toUpperCase())) : ALPHA_ROWS;
|
|
95
128
|
return this.layout === "alpha" ? letters : [[...DIGIT_ROW], ...letters];
|
|
96
129
|
}
|
|
130
|
+
accentsOpen = false;
|
|
131
|
+
get textual() {
|
|
132
|
+
return this.layout !== "numeric";
|
|
133
|
+
}
|
|
134
|
+
get accentRows() {
|
|
135
|
+
return this.uppercase ? ACCENT_ROWS.map((row) => row.map((key) => key.toUpperCase())) : ACCENT_ROWS;
|
|
136
|
+
}
|
|
137
|
+
get symbolKeys() {
|
|
138
|
+
return SYMBOL_KEYS;
|
|
139
|
+
}
|
|
97
140
|
get spaceVisible() {
|
|
98
141
|
return this.allowSpace && this.layout !== "numeric";
|
|
99
142
|
}
|
|
100
143
|
press(key) {
|
|
101
144
|
this.emit(this.value + key);
|
|
102
145
|
}
|
|
146
|
+
toggleShift() {
|
|
147
|
+
this.uppercase = !this.uppercase;
|
|
148
|
+
this.uppercaseChange.emit(this.uppercase);
|
|
149
|
+
}
|
|
150
|
+
toggleAccents() {
|
|
151
|
+
this.accentsOpen = !this.accentsOpen;
|
|
152
|
+
}
|
|
103
153
|
pressSpace() {
|
|
104
154
|
this.emit(this.value + " ");
|
|
105
155
|
}
|
|
@@ -149,13 +199,14 @@ var MnKeyboard = class MnKeyboard {
|
|
|
149
199
|
sheetMaxHeightVh: "sheetMaxHeightVh"
|
|
150
200
|
},
|
|
151
201
|
outputs: {
|
|
202
|
+
uppercaseChange: "uppercaseChange",
|
|
152
203
|
valueChange: "valueChange",
|
|
153
204
|
submitted: "submitted",
|
|
154
205
|
dismissed: "dismissed"
|
|
155
206
|
},
|
|
156
207
|
host: { properties: { "class": "this.hostClasses" } },
|
|
157
208
|
ngImport: i0,
|
|
158
|
-
template: "<!-- The key block. Rendered directly for `inline`, or projected into the sheet below. -->\n<ng-template #keys>\n <div [attr.aria-label]=\"labels.keyboard || null\" class=\"mn-keyboard-keys flex flex-col gap-2 p-3\" role=\"group\">\n @for (row of rows; track $index) {\n <div class=\"flex justify-center gap-2\">\n @for (key of row; track key) {\n <button\n (click)=\"press(key)\"\n class=\"mn-keyboard-key flex-1 rounded-lg border border-base-300 bg-base-100 py-4 text-xl font-semibold text-base-content shadow-sm transition-colors hover:bg-base-200 active:bg-base-300\"\n type=\"button\"\n >\n {{ key }}\n </button>\n }\n </div>\n }\n\n <div class=\"flex justify-center gap-2\">\n <button\n (click)=\"backspace()\"\n [attr.aria-label]=\"labels.backspace\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.backspace }}\n </button>\n\n @if (spaceVisible) {\n <button\n (click)=\"pressSpace()\"\n [attr.aria-label]=\"labels.space\"\n class=\"mn-keyboard-key mn-keyboard-key-space flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n style=\"flex-grow: 3\"\n type=\"button\"\n >\n {{ labels.space }}\n </button>\n }\n\n <button\n (click)=\"clear()\"\n [attr.aria-label]=\"labels.clear\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.clear }}\n </button>\n\n @if (showSubmit) {\n <button\n (click)=\"submit()\"\n [attr.aria-label]=\"labels.submit\"\n [disabled]=\"submitDisabled\"\n class=\"mn-keyboard-key mn-keyboard-key-submit flex-1 rounded-lg bg-primary py-4 text-base font-semibold text-primary-content shadow-sm transition-colors hover:opacity-90 disabled:opacity-50\"\n style=\"flex-grow: 2\"\n type=\"button\"\n >\n {{ labels.submit }}\n </button>\n }\n </div>\n </div>\n</ng-template>\n\n@if (presentation === 'sheet') {\n <mn-bottom-sheet\n (dismiss)=\"onDismiss()\"\n [ariaLabel]=\"labels.keyboard || undefined\"\n [maxHeightVh]=\"sheetMaxHeightVh\"\n >\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n </mn-bottom-sheet>\n} @else {\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n}\n",
|
|
209
|
+
template: "<!-- The key block. Rendered directly for `inline`, or projected into the sheet below. -->\n<ng-template #keys>\n <div [attr.aria-label]=\"labels.keyboard || null\" class=\"mn-keyboard-keys flex flex-col gap-2 p-3\" role=\"group\">\n @for (row of rows; track $index) {\n <div class=\"flex justify-center gap-2\">\n @if ($last && textual) {\n <button\n (click)=\"toggleShift()\"\n [attr.aria-label]=\"labels.shift || '⇧'\"\n [attr.aria-pressed]=\"uppercase\"\n class=\"mn-keyboard-key mn-keyboard-key-shift flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n [class.bg-primary]=\"uppercase\"\n [class.text-primary-content]=\"uppercase\"\n style=\"flex-grow: 1.5\"\n type=\"button\"\n >\n {{ labels.shift || '⇧' }}\n </button>\n }\n @for (key of row; track key) {\n <button\n (click)=\"press(key)\"\n class=\"mn-keyboard-key flex-1 rounded-lg border border-base-300 bg-base-100 py-4 text-xl font-semibold text-base-content shadow-sm transition-colors hover:bg-base-200 active:bg-base-300\"\n type=\"button\"\n >\n {{ key }}\n </button>\n }\n </div>\n }\n\n @if (textual && accentsOpen) {\n @for (row of accentRows; track $index) {\n <div class=\"mn-keyboard-accents flex justify-center gap-2\">\n @for (key of row; track key) {\n <button\n (click)=\"press(key)\"\n class=\"mn-keyboard-key mn-keyboard-key-accent flex-1 rounded-lg border border-base-300 bg-base-100 py-3 text-xl font-semibold text-base-content shadow-sm transition-colors hover:bg-base-200 active:bg-base-300\"\n type=\"button\"\n >\n {{ key }}\n </button>\n }\n </div>\n }\n }\n\n <div class=\"flex justify-center gap-2\">\n @if (textual) {\n <button\n (click)=\"toggleAccents()\"\n [attr.aria-label]=\"labels.accents || 'é'\"\n [attr.aria-pressed]=\"accentsOpen\"\n class=\"mn-keyboard-key mn-keyboard-key-accents flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.accents || 'é' }}\n </button>\n @for (key of symbolKeys; track key) {\n <button\n (click)=\"press(key)\"\n class=\"mn-keyboard-key mn-keyboard-key-symbol flex-1 rounded-lg border border-base-300 bg-base-100 py-4 text-xl font-semibold text-base-content shadow-sm transition-colors hover:bg-base-200 active:bg-base-300\"\n type=\"button\"\n >\n {{ key }}\n </button>\n }\n }\n <button\n (click)=\"backspace()\"\n [attr.aria-label]=\"labels.backspace\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.backspace }}\n </button>\n\n @if (spaceVisible) {\n <button\n (click)=\"pressSpace()\"\n [attr.aria-label]=\"labels.space\"\n class=\"mn-keyboard-key mn-keyboard-key-space flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n style=\"flex-grow: 3\"\n type=\"button\"\n >\n {{ labels.space }}\n </button>\n }\n\n <button\n (click)=\"clear()\"\n [attr.aria-label]=\"labels.clear\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.clear }}\n </button>\n\n @if (showSubmit) {\n <button\n (click)=\"submit()\"\n [attr.aria-label]=\"labels.submit\"\n [disabled]=\"submitDisabled\"\n class=\"mn-keyboard-key mn-keyboard-key-submit flex-1 rounded-lg bg-primary py-4 text-base font-semibold text-primary-content shadow-sm transition-colors hover:opacity-90 disabled:opacity-50\"\n style=\"flex-grow: 2\"\n type=\"button\"\n >\n {{ labels.submit }}\n </button>\n }\n </div>\n </div>\n</ng-template>\n\n@if (presentation === 'sheet') {\n <mn-bottom-sheet\n (dismiss)=\"onDismiss()\"\n [ariaLabel]=\"labels.keyboard || undefined\"\n [maxHeightVh]=\"sheetMaxHeightVh\"\n >\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n </mn-bottom-sheet>\n} @else {\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n}\n",
|
|
159
210
|
styles: [":host{display:block}.mn-keyboard-key{-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none;touch-action:manipulation}\n"],
|
|
160
211
|
dependencies: [{
|
|
161
212
|
kind: "component",
|
|
@@ -197,7 +248,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
197
248
|
selector: "mn-keyboard",
|
|
198
249
|
standalone: true,
|
|
199
250
|
imports: [MnBottomSheet, NgTemplateOutlet],
|
|
200
|
-
template: "<!-- The key block. Rendered directly for `inline`, or projected into the sheet below. -->\n<ng-template #keys>\n <div [attr.aria-label]=\"labels.keyboard || null\" class=\"mn-keyboard-keys flex flex-col gap-2 p-3\" role=\"group\">\n @for (row of rows; track $index) {\n <div class=\"flex justify-center gap-2\">\n @for (key of row; track key) {\n <button\n (click)=\"press(key)\"\n class=\"mn-keyboard-key flex-1 rounded-lg border border-base-300 bg-base-100 py-4 text-xl font-semibold text-base-content shadow-sm transition-colors hover:bg-base-200 active:bg-base-300\"\n type=\"button\"\n >\n {{ key }}\n </button>\n }\n </div>\n }\n\n <div class=\"flex justify-center gap-2\">\n <button\n (click)=\"backspace()\"\n [attr.aria-label]=\"labels.backspace\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.backspace }}\n </button>\n\n @if (spaceVisible) {\n <button\n (click)=\"pressSpace()\"\n [attr.aria-label]=\"labels.space\"\n class=\"mn-keyboard-key mn-keyboard-key-space flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n style=\"flex-grow: 3\"\n type=\"button\"\n >\n {{ labels.space }}\n </button>\n }\n\n <button\n (click)=\"clear()\"\n [attr.aria-label]=\"labels.clear\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.clear }}\n </button>\n\n @if (showSubmit) {\n <button\n (click)=\"submit()\"\n [attr.aria-label]=\"labels.submit\"\n [disabled]=\"submitDisabled\"\n class=\"mn-keyboard-key mn-keyboard-key-submit flex-1 rounded-lg bg-primary py-4 text-base font-semibold text-primary-content shadow-sm transition-colors hover:opacity-90 disabled:opacity-50\"\n style=\"flex-grow: 2\"\n type=\"button\"\n >\n {{ labels.submit }}\n </button>\n }\n </div>\n </div>\n</ng-template>\n\n@if (presentation === 'sheet') {\n <mn-bottom-sheet\n (dismiss)=\"onDismiss()\"\n [ariaLabel]=\"labels.keyboard || undefined\"\n [maxHeightVh]=\"sheetMaxHeightVh\"\n >\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n </mn-bottom-sheet>\n} @else {\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n}\n",
|
|
251
|
+
template: "<!-- The key block. Rendered directly for `inline`, or projected into the sheet below. -->\n<ng-template #keys>\n <div [attr.aria-label]=\"labels.keyboard || null\" class=\"mn-keyboard-keys flex flex-col gap-2 p-3\" role=\"group\">\n @for (row of rows; track $index) {\n <div class=\"flex justify-center gap-2\">\n @if ($last && textual) {\n <button\n (click)=\"toggleShift()\"\n [attr.aria-label]=\"labels.shift || '⇧'\"\n [attr.aria-pressed]=\"uppercase\"\n class=\"mn-keyboard-key mn-keyboard-key-shift flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n [class.bg-primary]=\"uppercase\"\n [class.text-primary-content]=\"uppercase\"\n style=\"flex-grow: 1.5\"\n type=\"button\"\n >\n {{ labels.shift || '⇧' }}\n </button>\n }\n @for (key of row; track key) {\n <button\n (click)=\"press(key)\"\n class=\"mn-keyboard-key flex-1 rounded-lg border border-base-300 bg-base-100 py-4 text-xl font-semibold text-base-content shadow-sm transition-colors hover:bg-base-200 active:bg-base-300\"\n type=\"button\"\n >\n {{ key }}\n </button>\n }\n </div>\n }\n\n @if (textual && accentsOpen) {\n @for (row of accentRows; track $index) {\n <div class=\"mn-keyboard-accents flex justify-center gap-2\">\n @for (key of row; track key) {\n <button\n (click)=\"press(key)\"\n class=\"mn-keyboard-key mn-keyboard-key-accent flex-1 rounded-lg border border-base-300 bg-base-100 py-3 text-xl font-semibold text-base-content shadow-sm transition-colors hover:bg-base-200 active:bg-base-300\"\n type=\"button\"\n >\n {{ key }}\n </button>\n }\n </div>\n }\n }\n\n <div class=\"flex justify-center gap-2\">\n @if (textual) {\n <button\n (click)=\"toggleAccents()\"\n [attr.aria-label]=\"labels.accents || 'é'\"\n [attr.aria-pressed]=\"accentsOpen\"\n class=\"mn-keyboard-key mn-keyboard-key-accents flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.accents || 'é' }}\n </button>\n @for (key of symbolKeys; track key) {\n <button\n (click)=\"press(key)\"\n class=\"mn-keyboard-key mn-keyboard-key-symbol flex-1 rounded-lg border border-base-300 bg-base-100 py-4 text-xl font-semibold text-base-content shadow-sm transition-colors hover:bg-base-200 active:bg-base-300\"\n type=\"button\"\n >\n {{ key }}\n </button>\n }\n }\n <button\n (click)=\"backspace()\"\n [attr.aria-label]=\"labels.backspace\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.backspace }}\n </button>\n\n @if (spaceVisible) {\n <button\n (click)=\"pressSpace()\"\n [attr.aria-label]=\"labels.space\"\n class=\"mn-keyboard-key mn-keyboard-key-space flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n style=\"flex-grow: 3\"\n type=\"button\"\n >\n {{ labels.space }}\n </button>\n }\n\n <button\n (click)=\"clear()\"\n [attr.aria-label]=\"labels.clear\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.clear }}\n </button>\n\n @if (showSubmit) {\n <button\n (click)=\"submit()\"\n [attr.aria-label]=\"labels.submit\"\n [disabled]=\"submitDisabled\"\n class=\"mn-keyboard-key mn-keyboard-key-submit flex-1 rounded-lg bg-primary py-4 text-base font-semibold text-primary-content shadow-sm transition-colors hover:opacity-90 disabled:opacity-50\"\n style=\"flex-grow: 2\"\n type=\"button\"\n >\n {{ labels.submit }}\n </button>\n }\n </div>\n </div>\n</ng-template>\n\n@if (presentation === 'sheet') {\n <mn-bottom-sheet\n (dismiss)=\"onDismiss()\"\n [ariaLabel]=\"labels.keyboard || undefined\"\n [maxHeightVh]=\"sheetMaxHeightVh\"\n >\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n </mn-bottom-sheet>\n} @else {\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n}\n",
|
|
201
252
|
styles: [":host{display:block}.mn-keyboard-key{-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none;touch-action:manipulation}\n"]
|
|
202
253
|
}]
|
|
203
254
|
}],
|
|
@@ -207,6 +258,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
207
258
|
presentation: [{ type: Input }],
|
|
208
259
|
labels: [{ type: Input }],
|
|
209
260
|
uppercase: [{ type: Input }],
|
|
261
|
+
uppercaseChange: [{ type: Output }],
|
|
210
262
|
allowSpace: [{ type: Input }],
|
|
211
263
|
showSubmit: [{ type: Input }],
|
|
212
264
|
submitDisabled: [{ type: Input }],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mn-angular-lib-keyboard.mjs","names":[],"sources":["../../../projects/mn-angular-lib/keyboard/src/mn-keyboard/mn-keyboard.component.ts","../../../projects/mn-angular-lib/keyboard/src/mn-keyboard/mn-keyboard.component.html"],"sourcesContent":["import {\n Component,\n EventEmitter,\n HostBinding,\n Input,\n Output,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { MnBottomSheet } from 'mn-angular-lib/bottom-sheet';\nimport { MnKeyboardLabels, MnKeyboardLayout, MnKeyboardPresentation } from './mn-keyboard.types';\n\n/** QWERTY letter rows, lower-case. Rendered upper-case when {@link MnKeyboard.uppercase} is set. */\nconst ALPHA_ROWS: readonly string[][] = [\n ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'],\n ['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l'],\n ['z', 'x', 'c', 'v', 'b', 'n', 'm'],\n];\n\n/** The digit row that sits above the letters on an alphanumeric keyboard. */\nconst DIGIT_ROW: readonly string[] = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];\n\n/** Phone-style pad rows for the numeric layout. */\nconst NUMERIC_ROWS: readonly string[][] = [\n ['1', '2', '3'],\n ['4', '5', '6'],\n ['7', '8', '9'],\n ['0'],\n];\n\n/**\n * An on-screen keyboard for touch devices that have no keyboard of their own.\n *\n * It exists for unattended screens — a tablet on a wall, a kiosk by a door — where\n * the OS keyboard is either unavailable or unwanted, and where the same field may\n * need to take a membership number *or* a name. Hence one component with a\n * {@link layout} switch rather than a separate number pad and text pad.\n *\n * It is a controlled component: it never owns the text. The host passes {@link value}\n * and reacts to {@link valueChange}, exactly like a form control, so the same value\n * can also be filled by a barcode scanner or a real keyboard without this component\n * fighting it.\n *\n * With {@link presentation} set to `sheet` it mounts inside an {@link MnBottomSheet},\n * rising from the bottom of the screen and swipeable away — the shape a kiosk wants\n * so the keys do not permanently occupy half the display.\n *\n * The library ships no user-facing English, so every named key takes its caption\n * from {@link labels}.\n */\n@Component({\n selector: 'mn-keyboard',\n standalone: true,\n imports: [MnBottomSheet, NgTemplateOutlet],\n templateUrl: './mn-keyboard.component.html',\n styleUrl: './mn-keyboard.component.css',\n})\nexport class MnKeyboard {\n /** The current text. This component never mutates it — see {@link valueChange}. */\n @Input() value = '';\n /** Which keys to render. */\n @Input() layout: MnKeyboardLayout = 'alphanumeric';\n /** Whether the keys sit in the page or rise from the bottom as a sheet. */\n @Input() presentation: MnKeyboardPresentation = 'inline';\n /**\n * Captions and accessible names for the named keys.\n *\n * The defaults are language-neutral glyphs rather than words, so a consumer that\n * forgets to translate still ships no English (or Dutch) from the library. The\n * accessible name for the keyboard as a whole has no neutral glyph, so it\n * defaults to empty and the attribute is simply omitted until a host supplies one.\n */\n @Input() labels: MnKeyboardLabels = {\n backspace: '⌫',\n clear: '⨯',\n space: '␣',\n submit: '⏎',\n keyboard: '',\n };\n /** Whether letters are rendered (and typed) upper-case. */\n @Input() uppercase = false;\n /** Whether to offer a space key. Off for a field that can never contain one. */\n @Input() allowSpace = true;\n /** Whether to offer a submit key. */\n @Input() showSubmit = true;\n /** Whether the submit key is currently actionable. */\n @Input() submitDisabled = false;\n /** Hard cap on the text length, or null for none. */\n @Input() maxLength: number | null = null;\n /** Cap on the sheet height as a fraction of the viewport, in vh (sheet presentation only). */\n @Input() sheetMaxHeightVh = 60;\n\n /** Emits the full text after every key press, so the host can drive its own field. */\n @Output() valueChange = new EventEmitter<string>();\n /** Emits when the submit key is pressed. */\n @Output() submitted = new EventEmitter<string>();\n /** Emits when a sheet-presented keyboard is swiped or tapped away. */\n @Output() dismissed = new EventEmitter<void>();\n\n @HostBinding('class') get hostClasses(): string {\n return `mn-keyboard mn-keyboard-${this.layout}`;\n }\n\n /** The character rows to render, driven by {@link layout}. */\n get rows(): readonly string[][] {\n if (this.layout === 'numeric') {\n return NUMERIC_ROWS;\n }\n const letters = this.uppercase\n ? ALPHA_ROWS.map((row) => row.map((key) => key.toUpperCase()))\n : ALPHA_ROWS;\n return this.layout === 'alpha' ? letters : [[...DIGIT_ROW], ...letters];\n }\n\n /** Whether the space key should be offered (never on a digits-only pad). */\n get spaceVisible(): boolean {\n return this.allowSpace && this.layout !== 'numeric';\n }\n\n /**\n * Appends a character, respecting {@link maxLength}.\n * @param key The character pressed.\n */\n press(key: string): void {\n this.emit(this.value + key);\n }\n\n /** Appends a space. */\n pressSpace(): void {\n this.emit(this.value + ' ');\n }\n\n /** Removes the last character. */\n backspace(): void {\n this.emit(this.value.slice(0, -1));\n }\n\n /** Empties the field. */\n clear(): void {\n this.emit('');\n }\n\n /** Reports a submit press. The host decides what submitting means. */\n submit(): void {\n if (this.submitDisabled) {\n return;\n }\n this.submitted.emit(this.value);\n }\n\n /** Reports that a sheet-presented keyboard was dismissed. */\n onDismiss(): void {\n this.dismissed.emit();\n }\n\n /**\n * Emits a new value, clamped to {@link maxLength}.\n *\n * Clamping happens here rather than in each key handler so a paste-like burst\n * from a scanner and a tapped key are bounded the same way.\n * @param next The candidate text.\n */\n private emit(next: string): void {\n const clamped =\n this.maxLength !== null && next.length > this.maxLength\n ? next.slice(0, this.maxLength)\n : next;\n if (clamped === this.value) {\n return;\n }\n this.value = clamped;\n this.valueChange.emit(clamped);\n }\n}\n","<!-- The key block. Rendered directly for `inline`, or projected into the sheet below. -->\n<ng-template #keys>\n <div [attr.aria-label]=\"labels.keyboard || null\" class=\"mn-keyboard-keys flex flex-col gap-2 p-3\" role=\"group\">\n @for (row of rows; track $index) {\n <div class=\"flex justify-center gap-2\">\n @for (key of row; track key) {\n <button\n (click)=\"press(key)\"\n class=\"mn-keyboard-key flex-1 rounded-lg border border-base-300 bg-base-100 py-4 text-xl font-semibold text-base-content shadow-sm transition-colors hover:bg-base-200 active:bg-base-300\"\n type=\"button\"\n >\n {{ key }}\n </button>\n }\n </div>\n }\n\n <div class=\"flex justify-center gap-2\">\n <button\n (click)=\"backspace()\"\n [attr.aria-label]=\"labels.backspace\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.backspace }}\n </button>\n\n @if (spaceVisible) {\n <button\n (click)=\"pressSpace()\"\n [attr.aria-label]=\"labels.space\"\n class=\"mn-keyboard-key mn-keyboard-key-space flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n style=\"flex-grow: 3\"\n type=\"button\"\n >\n {{ labels.space }}\n </button>\n }\n\n <button\n (click)=\"clear()\"\n [attr.aria-label]=\"labels.clear\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.clear }}\n </button>\n\n @if (showSubmit) {\n <button\n (click)=\"submit()\"\n [attr.aria-label]=\"labels.submit\"\n [disabled]=\"submitDisabled\"\n class=\"mn-keyboard-key mn-keyboard-key-submit flex-1 rounded-lg bg-primary py-4 text-base font-semibold text-primary-content shadow-sm transition-colors hover:opacity-90 disabled:opacity-50\"\n style=\"flex-grow: 2\"\n type=\"button\"\n >\n {{ labels.submit }}\n </button>\n }\n </div>\n </div>\n</ng-template>\n\n@if (presentation === 'sheet') {\n <mn-bottom-sheet\n (dismiss)=\"onDismiss()\"\n [ariaLabel]=\"labels.keyboard || undefined\"\n [maxHeightVh]=\"sheetMaxHeightVh\"\n >\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n </mn-bottom-sheet>\n} @else {\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n}\n"],"mappings":";;;;AAYA,MAAM,aAAkC;CACtC;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;CAAG;CACjD;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;CAAG;CAC5C;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;CAAG;AACnC;AAGD,MAAM,YAA+B;CAAC;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;AAAG;AAGtF,MAAM,eAAoC;CACxC;EAAC;EAAK;EAAK;CAAG;CACd;EAAC;EAAK;EAAK;CAAG;CACd;EAAC;EAAK;EAAK;CAAG;CACd,CAAC,GAAG;AACL;AA6BD,IAAa,aAAb,MAAa,WAAU;CAEZ,QAAQ;CAER,SAA2B;CAE3B,eAAuC;CASvC,SAA2B;EAClC,WAAW;EACX,OAAO;EACP,OAAO;EACP,QAAQ;EACR,UAAU;CACX;CAEQ,YAAY;CAEZ,aAAa;CAEb,aAAa;CAEb,iBAAiB;CAEjB,YAA2B;CAE3B,mBAAmB;CAGlB,cAAc,IAAI,aAAY;CAE9B,YAAY,IAAI,aAAY;CAE5B,YAAY,IAAI,aAAY;CAEtC,IAA0B,cAAW;EACnC,OAAO,2BAA2B,KAAK;CACzC;CAGA,IAAI,OAAI;EACN,IAAI,KAAK,WAAW,WAClB,OAAO;EAET,MAAM,UAAU,KAAK,YACjB,WAAW,KAAK,QAAQ,IAAI,KAAK,QAAQ,IAAI,YAAW,CAAE,CAAC,IAC3D;EACJ,OAAO,KAAK,WAAW,UAAU,UAAU,CAAC,CAAC,GAAG,SA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A;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;GAAA;GAAA,SAAA,CAAA,SAAA;EAAA,GAAA;GAAA,MAAA;GAAA,MAAE;GAAgB,UAAA;GAAA,QAAA;IAAA;IAAA;IAAA;GAAA;EAAA,CAAA;CAAA,CAAA;;AAI9B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAU,YAAA,CAAA;EAPtB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAa,YACX;GAAI,SACP,CAAC,eAAe,gBAAgB;GAAC,UAAA;GAAA,QAAA,CAAA,qJAAA;EAAA,CAAA;;;EAMzC,OAAA,CAAA,EAAA,MAAA,MAAA,CAAA;EAEA,QAAA,CAAA,EAAA,MAAA,MAAA,CAAA;EAEA,cAAA,CAAA,EAAA,MAAA,MAAA,CAAA;EASA,QAAA,CAAA,EAAA,MAAA,MAAA,CAAA;EAQA,WAAA,CAAA,EAAA,MAAA,MAAA,CAAA;EAEA,YAAA,CAAA,EAAA,MAAA,MAAA,CAAA;EAEA,YAAA,CAAA,EAAA,MAAA,MAAA,CAAA;EAEA,gBAAA,CAAA,EAAA,MAAA,MAAA,CAAA;EAEA,WAAA,CAAA,EAAA,MAAA,MAAA,CAAA;EAEA,kBAAA,CAAA,EAAA,MAAA,MAAA,CAAA;EAGA,aAAA,CAAA,EAAA,MAAA,OAAA,CAAA;EAEA,WAAA,CAAA,EAAA,MAAA,OAAA,CAAA;EAEA,WAAA,CAAA,EAAA,MAAA,OAAA,CAAA;;GAEA,MAAA;GAAY,MAAA,CAAA,OAAO"}
|
|
1
|
+
{"version":3,"file":"mn-angular-lib-keyboard.mjs","names":[],"sources":["../../../projects/mn-angular-lib/keyboard/src/mn-keyboard/mn-keyboard.component.ts","../../../projects/mn-angular-lib/keyboard/src/mn-keyboard/mn-keyboard.component.html"],"sourcesContent":["import {\n Component,\n EventEmitter,\n HostBinding,\n Input,\n Output,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { MnBottomSheet } from 'mn-angular-lib/bottom-sheet';\nimport { MnKeyboardLabels, MnKeyboardLayout, MnKeyboardPresentation } from './mn-keyboard.types';\n\n/** QWERTY letter rows, lower-case. Rendered upper-case when {@link MnKeyboard.uppercase} is set. */\nconst ALPHA_ROWS: readonly string[][] = [\n ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p'],\n ['a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l'],\n ['z', 'x', 'c', 'v', 'b', 'n', 'm'],\n];\n\n/** The digit row that sits above the letters on an alphanumeric keyboard. */\nconst DIGIT_ROW: readonly string[] = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];\n\n/** Accented letters for Dutch names, lower-case, in three rows of seven. */\nconst ACCENT_ROWS: readonly string[][] = [\n ['é', 'è', 'ë', 'ê', 'á', 'à', 'ä'],\n ['â', 'ó', 'ò', 'ö', 'ô', 'ú', 'ù'],\n ['ü', 'û', 'í', 'ì', 'ï', 'î', 'ç'],\n];\n\n/** Punctuation allowed in names: apostrophe and hyphen. */\nconst SYMBOL_KEYS: readonly string[] = [\"'\", '-'];\n\n/** Phone-style pad rows for the numeric layout. */\nconst NUMERIC_ROWS: readonly string[][] = [\n ['1', '2', '3'],\n ['4', '5', '6'],\n ['7', '8', '9'],\n ['0'],\n];\n\n/**\n * An on-screen keyboard for touch devices that have no keyboard of their own.\n *\n * It exists for unattended screens — a tablet on a wall, a kiosk by a door — where\n * the OS keyboard is either unavailable or unwanted, and where the same field may\n * need to take a membership number *or* a name. Hence one component with a\n * {@link layout} switch rather than a separate number pad and text pad.\n *\n * It is a controlled component: it never owns the text. The host passes {@link value}\n * and reacts to {@link valueChange}, exactly like a form control, so the same value\n * can also be filled by a barcode scanner or a real keyboard without this component\n * fighting it.\n *\n * With {@link presentation} set to `sheet` it mounts inside an {@link MnBottomSheet},\n * rising from the bottom of the screen and swipeable away — the shape a kiosk wants\n * so the keys do not permanently occupy half the display.\n *\n * The library ships no user-facing English, so every named key takes its caption\n * from {@link labels}.\n */\n@Component({\n selector: 'mn-keyboard',\n standalone: true,\n imports: [MnBottomSheet, NgTemplateOutlet],\n templateUrl: './mn-keyboard.component.html',\n styleUrl: './mn-keyboard.component.css',\n})\nexport class MnKeyboard {\n /** The current text. This component never mutates it — see {@link valueChange}. */\n @Input() value = '';\n /** Which keys to render. */\n @Input() layout: MnKeyboardLayout = 'alphanumeric';\n /** Whether the keys sit in the page or rise from the bottom as a sheet. */\n @Input() presentation: MnKeyboardPresentation = 'inline';\n /**\n * Captions and accessible names for the named keys.\n *\n * The defaults are language-neutral glyphs rather than words, so a consumer that\n * forgets to translate still ships no English (or Dutch) from the library. The\n * accessible name for the keyboard as a whole has no neutral glyph, so it\n * defaults to empty and the attribute is simply omitted until a host supplies one.\n */\n @Input() labels: MnKeyboardLabels = {\n backspace: '⌫',\n clear: '⨯',\n space: '␣',\n submit: '⏎',\n keyboard: '',\n shift: '⇧',\n accents: 'é',\n };\n /** Whether letters are rendered (and typed) upper-case. */\n @Input() uppercase = false;\n /** Emits the new case when the shift key flips {@link uppercase}. */\n @Output() uppercaseChange = new EventEmitter<boolean>();\n /** Whether to offer a space key. Off for a field that can never contain one. */\n @Input() allowSpace = true;\n /** Whether to offer a submit key. */\n @Input() showSubmit = true;\n /** Whether the submit key is currently actionable. */\n @Input() submitDisabled = false;\n /** Hard cap on the text length, or null for none. */\n @Input() maxLength: number | null = null;\n /** Cap on the sheet height as a fraction of the viewport, in vh (sheet presentation only). */\n @Input() sheetMaxHeightVh = 60;\n\n /** Emits the full text after every key press, so the host can drive its own field. */\n @Output() valueChange = new EventEmitter<string>();\n /** Emits when the submit key is pressed. */\n @Output() submitted = new EventEmitter<string>();\n /** Emits when a sheet-presented keyboard is swiped or tapped away. */\n @Output() dismissed = new EventEmitter<void>();\n\n @HostBinding('class') get hostClasses(): string {\n return `mn-keyboard mn-keyboard-${this.layout}`;\n }\n\n /** The character rows to render, driven by {@link layout}. */\n get rows(): readonly string[][] {\n if (this.layout === 'numeric') {\n return NUMERIC_ROWS;\n }\n const letters = this.uppercase\n ? ALPHA_ROWS.map((row) => row.map((key) => key.toUpperCase()))\n : ALPHA_ROWS;\n return this.layout === 'alpha' ? letters : [[...DIGIT_ROW], ...letters];\n }\n\n /** Whether the accent page is open. */\n accentsOpen = false;\n\n /** Whether the layout takes text (letters, accents, apostrophe, hyphen). */\n get textual(): boolean {\n return this.layout !== 'numeric';\n }\n\n /** The accent rows, cased like the letters. */\n get accentRows(): readonly string[][] {\n return this.uppercase\n ? ACCENT_ROWS.map((row) => row.map((key) => key.toUpperCase()))\n : ACCENT_ROWS;\n }\n\n /** The apostrophe and hyphen keys. */\n get symbolKeys(): readonly string[] {\n return SYMBOL_KEYS;\n }\n\n /** Whether the space key should be offered (never on a digits-only pad). */\n get spaceVisible(): boolean {\n return this.allowSpace && this.layout !== 'numeric';\n }\n\n /**\n * Appends a character, respecting {@link maxLength}.\n * @param key The character pressed.\n */\n press(key: string): void {\n this.emit(this.value + key);\n }\n\n /** Flips between lower and upper case, as the shift key does. */\n toggleShift(): void {\n this.uppercase = !this.uppercase;\n this.uppercaseChange.emit(this.uppercase);\n }\n\n /** Opens or closes the accent page. */\n toggleAccents(): void {\n this.accentsOpen = !this.accentsOpen;\n }\n\n /** Appends a space. */\n pressSpace(): void {\n this.emit(this.value + ' ');\n }\n\n /** Removes the last character. */\n backspace(): void {\n this.emit(this.value.slice(0, -1));\n }\n\n /** Empties the field. */\n clear(): void {\n this.emit('');\n }\n\n /** Reports a submit press. The host decides what submitting means. */\n submit(): void {\n if (this.submitDisabled) {\n return;\n }\n this.submitted.emit(this.value);\n }\n\n /** Reports that a sheet-presented keyboard was dismissed. */\n onDismiss(): void {\n this.dismissed.emit();\n }\n\n /**\n * Emits a new value, clamped to {@link maxLength}.\n *\n * Clamping happens here rather than in each key handler so a paste-like burst\n * from a scanner and a tapped key are bounded the same way.\n * @param next The candidate text.\n */\n private emit(next: string): void {\n const clamped =\n this.maxLength !== null && next.length > this.maxLength\n ? next.slice(0, this.maxLength)\n : next;\n if (clamped === this.value) {\n return;\n }\n this.value = clamped;\n this.valueChange.emit(clamped);\n }\n}\n","<!-- The key block. Rendered directly for `inline`, or projected into the sheet below. -->\n<ng-template #keys>\n <div [attr.aria-label]=\"labels.keyboard || null\" class=\"mn-keyboard-keys flex flex-col gap-2 p-3\" role=\"group\">\n @for (row of rows; track $index) {\n <div class=\"flex justify-center gap-2\">\n @if ($last && textual) {\n <button\n (click)=\"toggleShift()\"\n [attr.aria-label]=\"labels.shift || '⇧'\"\n [attr.aria-pressed]=\"uppercase\"\n class=\"mn-keyboard-key mn-keyboard-key-shift flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n [class.bg-primary]=\"uppercase\"\n [class.text-primary-content]=\"uppercase\"\n style=\"flex-grow: 1.5\"\n type=\"button\"\n >\n {{ labels.shift || '⇧' }}\n </button>\n }\n @for (key of row; track key) {\n <button\n (click)=\"press(key)\"\n class=\"mn-keyboard-key flex-1 rounded-lg border border-base-300 bg-base-100 py-4 text-xl font-semibold text-base-content shadow-sm transition-colors hover:bg-base-200 active:bg-base-300\"\n type=\"button\"\n >\n {{ key }}\n </button>\n }\n </div>\n }\n\n @if (textual && accentsOpen) {\n @for (row of accentRows; track $index) {\n <div class=\"mn-keyboard-accents flex justify-center gap-2\">\n @for (key of row; track key) {\n <button\n (click)=\"press(key)\"\n class=\"mn-keyboard-key mn-keyboard-key-accent flex-1 rounded-lg border border-base-300 bg-base-100 py-3 text-xl font-semibold text-base-content shadow-sm transition-colors hover:bg-base-200 active:bg-base-300\"\n type=\"button\"\n >\n {{ key }}\n </button>\n }\n </div>\n }\n }\n\n <div class=\"flex justify-center gap-2\">\n @if (textual) {\n <button\n (click)=\"toggleAccents()\"\n [attr.aria-label]=\"labels.accents || 'é'\"\n [attr.aria-pressed]=\"accentsOpen\"\n class=\"mn-keyboard-key mn-keyboard-key-accents flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.accents || 'é' }}\n </button>\n @for (key of symbolKeys; track key) {\n <button\n (click)=\"press(key)\"\n class=\"mn-keyboard-key mn-keyboard-key-symbol flex-1 rounded-lg border border-base-300 bg-base-100 py-4 text-xl font-semibold text-base-content shadow-sm transition-colors hover:bg-base-200 active:bg-base-300\"\n type=\"button\"\n >\n {{ key }}\n </button>\n }\n }\n <button\n (click)=\"backspace()\"\n [attr.aria-label]=\"labels.backspace\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.backspace }}\n </button>\n\n @if (spaceVisible) {\n <button\n (click)=\"pressSpace()\"\n [attr.aria-label]=\"labels.space\"\n class=\"mn-keyboard-key mn-keyboard-key-space flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n style=\"flex-grow: 3\"\n type=\"button\"\n >\n {{ labels.space }}\n </button>\n }\n\n <button\n (click)=\"clear()\"\n [attr.aria-label]=\"labels.clear\"\n class=\"mn-keyboard-key mn-keyboard-key-action flex-1 rounded-lg border border-base-300 bg-base-200 py-4 text-base font-medium text-base-content shadow-sm transition-colors hover:bg-base-300\"\n type=\"button\"\n >\n {{ labels.clear }}\n </button>\n\n @if (showSubmit) {\n <button\n (click)=\"submit()\"\n [attr.aria-label]=\"labels.submit\"\n [disabled]=\"submitDisabled\"\n class=\"mn-keyboard-key mn-keyboard-key-submit flex-1 rounded-lg bg-primary py-4 text-base font-semibold text-primary-content shadow-sm transition-colors hover:opacity-90 disabled:opacity-50\"\n style=\"flex-grow: 2\"\n type=\"button\"\n >\n {{ labels.submit }}\n </button>\n }\n </div>\n </div>\n</ng-template>\n\n@if (presentation === 'sheet') {\n <mn-bottom-sheet\n (dismiss)=\"onDismiss()\"\n [ariaLabel]=\"labels.keyboard || undefined\"\n [maxHeightVh]=\"sheetMaxHeightVh\"\n >\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n </mn-bottom-sheet>\n} @else {\n <ng-container [ngTemplateOutlet]=\"keys\"></ng-container>\n}\n"],"mappings":";;;;AAYA,MAAM,aAAkC;CACtC;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;CAAG;CACjD;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;CAAG;CAC5C;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;CAAG;AACnC;AAGD,MAAM,YAA+B;CAAC;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;AAAG;AAGtF,MAAM,cAAmC;CACvC;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;CAAG;CAClC;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;CAAG;CAClC;EAAC;EAAK;EAAK;EAAK;EAAK;EAAK;EAAK;CAAG;AACnC;AAGD,MAAM,cAAiC,CAAC,KAAK,GAAG;AAGhD,MAAM,eAAoC;CACxC;EAAC;EAAK;EAAK;CAAG;CACd;EAAC;EAAK;EAAK;CAAG;CACd;EAAC;EAAK;EAAK;CAAG;CACd,CAAC,GAAG;AACL;AA6BD,IAAa,aAAb,MAAa,WAAU;CAEZ,QAAQ;CAER,SAA2B;CAE3B,eAAuC;CASvC,SAA2B;EAClC,WAAW;EACX,OAAO;EACP,OAAO;EACP,QAAQ;EACR,UAAU;EACV,OAAO;EACP,SAAS;CACV;CAEQ,YAAY;CAEX,kBAAkB,IAAI,aAAY;CAEnC,aAAa;CAEb,aAAa;CAEb,iBAAiB;CAEjB,YAA2B;CAE3B,mBAAmB;CAGlB,cAAc,IAAI,aAAY;CAE9B,YAAY,IAAI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,CAAA;EAUA,WAAA,CAAA,EAAA,MAAA,MAAA,CAAA;EAEA,iBAAA,CAAA,EAAA,MAAA,OAAA,CAAA;EAEA,YAAA,CAAA,EAAA,MAAA,MAAA,CAAA;EAEA,YAAA,CAAA,EAAA,MAAA,MAAA,CAAA;EAEA,gBAAA,CAAA,EAAA,MAAA,MAAA,CAAA;EAEA,WAAA,CAAA,EAAA,MAAA,MAAA,CAAA;EAEA,kBAAA,CAAA,EAAA,MAAA,MAAA,CAAA;EAGA,aAAA,CAAA,EAAA,MAAA,OAAA,CAAA;EAEA,WAAA,CAAA,EAAA,MAAA,OAAA,CAAA;EAEA,WAAA,CAAA,EAAA,MAAA,OAAA,CAAA;;GAEA,MAAA;GAAY,MAAA,CAAA,OAAO"}
|
|
@@ -5,6 +5,7 @@ import { CommonModule } from "@angular/common";
|
|
|
5
5
|
import { ActionStyle, BackdropMode, CloseMode, ConfirmationTone, FieldKind, KeyboardMode, MN_HAPTICS, MN_MODAL_ACTION_ICONS, MODAL_ACTION_ICON_SIZE, ModalCloseReason, ModalKind, ModalSize, NavigationDirection, SubmitMode, WizardFlowMode, defaultIconForStyle } from "mn-angular-lib/modal-core";
|
|
6
6
|
import * as i2 from "@angular/forms";
|
|
7
7
|
import { FormBuilder, NG_VALUE_ACCESSOR, ReactiveFormsModule, Validators } from "@angular/forms";
|
|
8
|
+
import { merge } from "rxjs";
|
|
8
9
|
import { MnButton } from "mn-angular-lib/button";
|
|
9
10
|
import { MnCheckbox, MnDatetime, MnFileInput, MnInputField, MnMultiSelect, MnSelect, MnTextarea } from "mn-angular-lib/forms";
|
|
10
11
|
import { MN_IN_MODAL, MnLanguageService, lucideIcons } from "mn-angular-lib/core";
|
|
@@ -1161,7 +1162,7 @@ var MnWizardBodyComponent = class MnWizardBodyComponent {
|
|
|
1161
1162
|
if (!this.canNavigateToStep(step)) return;
|
|
1162
1163
|
if (step.id === this.currentStepId) return;
|
|
1163
1164
|
const formBody = this.getCurrentFormBody();
|
|
1164
|
-
if (formBody && formBody.form.invalid) {
|
|
1165
|
+
if (formBody && (formBody.form.invalid || formBody.hasFormErrors)) {
|
|
1165
1166
|
formBody.form.markAllAsTouched();
|
|
1166
1167
|
return;
|
|
1167
1168
|
}
|
|
@@ -1244,7 +1245,7 @@ var MnWizardBodyComponent = class MnWizardBodyComponent {
|
|
|
1244
1245
|
if (!this.canGoNext) return;
|
|
1245
1246
|
const currentStep = this.currentStep;
|
|
1246
1247
|
const formBody = this.getCurrentFormBody();
|
|
1247
|
-
if (formBody && formBody.form.invalid) {
|
|
1248
|
+
if (formBody && (formBody.form.invalid || formBody.hasFormErrors)) {
|
|
1248
1249
|
formBody.form.markAllAsTouched();
|
|
1249
1250
|
return;
|
|
1250
1251
|
}
|
|
@@ -1276,9 +1277,10 @@ var MnWizardBodyComponent = class MnWizardBodyComponent {
|
|
|
1276
1277
|
this.statusSubscription = void 0;
|
|
1277
1278
|
const formBody = this.getCurrentFormBody();
|
|
1278
1279
|
if (formBody && formBody.form) {
|
|
1279
|
-
|
|
1280
|
-
this.
|
|
1281
|
-
|
|
1280
|
+
const isValid = () => formBody.form.valid && !formBody.hasFormErrors;
|
|
1281
|
+
this.isCurrentStepValid = isValid();
|
|
1282
|
+
this.statusSubscription = merge(formBody.form.statusChanges, formBody.form.valueChanges).subscribe(() => {
|
|
1283
|
+
this.isCurrentStepValid = isValid();
|
|
1282
1284
|
this.cdr.detectChanges();
|
|
1283
1285
|
});
|
|
1284
1286
|
} else this.isCurrentStepValid = true;
|
|
@@ -1306,7 +1308,7 @@ var MnWizardBodyComponent = class MnWizardBodyComponent {
|
|
|
1306
1308
|
if (this.isCompleting) return;
|
|
1307
1309
|
const currentStep = this.currentStep;
|
|
1308
1310
|
const formBody = this.getCurrentFormBody();
|
|
1309
|
-
if (formBody && formBody.form.invalid) {
|
|
1311
|
+
if (formBody && (formBody.form.invalid || formBody.hasFormErrors)) {
|
|
1310
1312
|
formBody.form.markAllAsTouched();
|
|
1311
1313
|
return;
|
|
1312
1314
|
}
|