@mk-kit/ui 0.34.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/LICENSE +21 -0
- package/README.md +115 -0
- package/block-editor/README.md +254 -0
- package/fesm2022/mk-kit-ui-block-editor.mjs +2158 -0
- package/fesm2022/mk-kit-ui-block-editor.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-button.mjs +81 -0
- package/fesm2022/mk-kit-ui-button.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-checkbox.mjs +136 -0
- package/fesm2022/mk-kit-ui-checkbox.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-chip.mjs +122 -0
- package/fesm2022/mk-kit-ui-chip.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-context-menu.mjs +144 -0
- package/fesm2022/mk-kit-ui-context-menu.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-core.mjs +1576 -0
- package/fesm2022/mk-kit-ui-core.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-data.mjs +6055 -0
- package/fesm2022/mk-kit-ui-data.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-datetime.mjs +3409 -0
- package/fesm2022/mk-kit-ui-datetime.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-directives.mjs +1779 -0
- package/fesm2022/mk-kit-ui-directives.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-dnd.mjs +1073 -0
- package/fesm2022/mk-kit-ui-dnd.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-feedback.mjs +2426 -0
- package/fesm2022/mk-kit-ui-feedback.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-forms.mjs +9208 -0
- package/fesm2022/mk-kit-ui-forms.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-icon.mjs +470 -0
- package/fesm2022/mk-kit-ui-icon.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-media.mjs +896 -0
- package/fesm2022/mk-kit-ui-media.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-navigation.mjs +2542 -0
- package/fesm2022/mk-kit-ui-navigation.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-rich-text.mjs +565 -0
- package/fesm2022/mk-kit-ui-rich-text.mjs.map +1 -0
- package/fesm2022/mk-kit-ui-table.mjs +1378 -0
- package/fesm2022/mk-kit-ui-table.mjs.map +1 -0
- package/fesm2022/mk-kit-ui.mjs +32 -0
- package/fesm2022/mk-kit-ui.mjs.map +1 -0
- package/package.json +130 -0
- package/schematics/collection.json +10 -0
- package/schematics/ng-add/index.js +113 -0
- package/schematics/ng-add/schema.json +22 -0
- package/schematics/package.json +3 -0
- package/styles/mk-kit.css +750 -0
- package/types/mk-kit-ui-block-editor.d.ts +292 -0
- package/types/mk-kit-ui-button.d.ts +40 -0
- package/types/mk-kit-ui-checkbox.d.ts +62 -0
- package/types/mk-kit-ui-chip.d.ts +59 -0
- package/types/mk-kit-ui-context-menu.d.ts +57 -0
- package/types/mk-kit-ui-core.d.ts +1105 -0
- package/types/mk-kit-ui-data.d.ts +2580 -0
- package/types/mk-kit-ui-datetime.d.ts +1171 -0
- package/types/mk-kit-ui-directives.d.ts +807 -0
- package/types/mk-kit-ui-dnd.d.ts +423 -0
- package/types/mk-kit-ui-feedback.d.ts +1270 -0
- package/types/mk-kit-ui-forms.d.ts +3586 -0
- package/types/mk-kit-ui-icon.d.ts +108 -0
- package/types/mk-kit-ui-media.d.ts +549 -0
- package/types/mk-kit-ui-navigation.d.ts +1169 -0
- package/types/mk-kit-ui-rich-text.d.ts +187 -0
- package/types/mk-kit-ui-table.d.ts +739 -0
- package/types/mk-kit-ui.d.ts +17 -0
|
@@ -0,0 +1,3586 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { OnDestroy, Signal, ElementRef, TemplateRef, OnInit } from '@angular/core';
|
|
3
|
+
import * as _mk_kit_ui_core from '@mk-kit/ui/core';
|
|
4
|
+
import { MkFieldContext, MkSize, MkVariant, MkTone, MkCodeLanguage, MkPlacement } from '@mk-kit/ui/core';
|
|
5
|
+
export { MkCodeLanguage, mkHighlight } from '@mk-kit/ui/core';
|
|
6
|
+
import { AbstractControl, ControlValueAccessor, Validator, ValidationErrors, ValidatorFn } from '@angular/forms';
|
|
7
|
+
import { MkDropEvent } from '@mk-kit/ui/dnd';
|
|
8
|
+
import { MkTreeNode } from '@mk-kit/ui/navigation';
|
|
9
|
+
export { MkTreeNode } from '@mk-kit/ui/navigation';
|
|
10
|
+
export * from '@mk-kit/ui/checkbox';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* FormField — an accessible wrapper that provides a real `<label>`, optional
|
|
14
|
+
* hint text, error text and a required indicator for any nested control
|
|
15
|
+
* (`input[mkInput]`, `mk-select`, `mk-checkbox`, …).
|
|
16
|
+
*
|
|
17
|
+
* It generates stable ids (via `mkUniqueId`) and exposes them so nested
|
|
18
|
+
* controls can wire `aria-labelledby` / `aria-describedby` / `aria-invalid`
|
|
19
|
+
* automatically by injecting this component. While an error shows, the hint is
|
|
20
|
+
* hidden and the error is announced through a `role="alert"` region.
|
|
21
|
+
*
|
|
22
|
+
* ## Automatic errors
|
|
23
|
+
*
|
|
24
|
+
* When the projected control is bound to a form (`formControlName`,
|
|
25
|
+
* `[formControl]` or `[(ngModel)]`) the field adopts its `NgControl` and shows
|
|
26
|
+
* the first validation error by itself — no `[error]` binding needed. Messages
|
|
27
|
+
* come from the `validation` i18n table and can be reworded per field with
|
|
28
|
+
* `errorMessages`. As with `mat-error`, an error only appears once the control
|
|
29
|
+
* is touched or dirty, or its form has been submitted; `errorOn` changes that.
|
|
30
|
+
* `required` and the disabled styling are derived from the control too.
|
|
31
|
+
*
|
|
32
|
+
* ```html
|
|
33
|
+
* <!-- automatic: message + required marker come from the validators -->
|
|
34
|
+
* <mk-form-field label="Email">
|
|
35
|
+
* <input mkInput type="email" formControlName="email" />
|
|
36
|
+
* </mk-form-field>
|
|
37
|
+
*
|
|
38
|
+
* <!-- per-field wording -->
|
|
39
|
+
* <mk-form-field label="Age" [errorMessages]="{ min: 'You must be 18 or over' }">
|
|
40
|
+
* <mk-number-input formControlName="age" [min]="18" />
|
|
41
|
+
* </mk-form-field>
|
|
42
|
+
*
|
|
43
|
+
* <!-- fully manual: an explicit [error] always wins -->
|
|
44
|
+
* <mk-form-field label="Email" hint="We never share it." required
|
|
45
|
+
* [error]="emailError()">
|
|
46
|
+
* <input mkInput type="email" [(ngModel)]="email" />
|
|
47
|
+
* </mk-form-field>
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
declare class MkFormField implements MkFieldContext {
|
|
51
|
+
private readonly i18n;
|
|
52
|
+
private readonly parentForm;
|
|
53
|
+
private readonly parentFormGroup;
|
|
54
|
+
/** Visible field label. Rendered as a real `<label for>`. */
|
|
55
|
+
readonly label: _angular_core.InputSignal<string>;
|
|
56
|
+
/** Optional helper text shown below the control (hidden while an error shows). */
|
|
57
|
+
readonly hint: _angular_core.InputSignal<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Explicit error message. When non-null it overrides the automatic message
|
|
60
|
+
* derived from the projected control; `''` suppresses errors entirely.
|
|
61
|
+
*/
|
|
62
|
+
readonly error: _angular_core.InputSignal<string | null>;
|
|
63
|
+
/**
|
|
64
|
+
* Per-field wording for automatic errors, keyed by `ValidationErrors` key.
|
|
65
|
+
* Each value is either a fixed string or a function of the error payload.
|
|
66
|
+
*/
|
|
67
|
+
readonly errorMessages: _angular_core.InputSignal<Readonly<Record<string, string | ((err: any) => string)>> | null>;
|
|
68
|
+
/**
|
|
69
|
+
* When automatic errors become visible. `touched` (the default) matches
|
|
70
|
+
* Material: after the control is touched or dirty, or the form is submitted.
|
|
71
|
+
* `dirty` waits for an actual edit; `always` shows as soon as it is invalid.
|
|
72
|
+
*/
|
|
73
|
+
readonly errorOn: _angular_core.InputSignal<"always" | "touched" | "dirty">;
|
|
74
|
+
/**
|
|
75
|
+
* Marks the field required (adds an indicator + `aria-required`). Derived
|
|
76
|
+
* from the projected control's validators when it is bound to a form.
|
|
77
|
+
*/
|
|
78
|
+
readonly required: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
79
|
+
/**
|
|
80
|
+
* Visually reflect a disabled control. Derived from the projected control
|
|
81
|
+
* when it is bound to a form.
|
|
82
|
+
*/
|
|
83
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
84
|
+
/** Control size; nested controls inherit it. */
|
|
85
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
86
|
+
/** The projected control's form binding, when it has one. */
|
|
87
|
+
private readonly ngControl;
|
|
88
|
+
/**
|
|
89
|
+
* Bumped on every change of the bound control so the computed state below
|
|
90
|
+
* re-reads it. `AbstractControl` is not signal-based, so this bridges its
|
|
91
|
+
* event stream into the reactive graph.
|
|
92
|
+
*/
|
|
93
|
+
private readonly controlTick;
|
|
94
|
+
/** Id for the nested interactive control — adopt on your control element. */
|
|
95
|
+
readonly controlId: string;
|
|
96
|
+
/** Id of the `<label>` element (for `aria-labelledby`). */
|
|
97
|
+
readonly labelId: string;
|
|
98
|
+
/** Id of the hint element. */
|
|
99
|
+
readonly hintId: string;
|
|
100
|
+
/** Id of the error element. */
|
|
101
|
+
readonly errorId: string;
|
|
102
|
+
constructor();
|
|
103
|
+
/** Whether the surrounding form (if any) has been submitted. */
|
|
104
|
+
private readonly submitted;
|
|
105
|
+
/** The automatic message for the bound control, when one should show. */
|
|
106
|
+
private readonly autoError;
|
|
107
|
+
/** The message actually rendered — an explicit `error` always wins. */
|
|
108
|
+
readonly errorText: _angular_core.Signal<string | null>;
|
|
109
|
+
/** Whether the field currently has an error. */
|
|
110
|
+
readonly hasError: _angular_core.Signal<boolean>;
|
|
111
|
+
/** Required either explicitly or through the bound control's validators. */
|
|
112
|
+
readonly isRequired: _angular_core.Signal<boolean>;
|
|
113
|
+
/** Disabled either explicitly or through the bound control. */
|
|
114
|
+
readonly isDisabled: _angular_core.Signal<boolean>;
|
|
115
|
+
/** Whether the hint should be shown (hidden while an error is present). */
|
|
116
|
+
readonly hintVisible: _angular_core.Signal<boolean>;
|
|
117
|
+
/**
|
|
118
|
+
* Space-separated id list for a nested control's `aria-describedby`,
|
|
119
|
+
* or `null` when there is nothing to describe.
|
|
120
|
+
*/
|
|
121
|
+
readonly describedBy: _angular_core.Signal<string | null>;
|
|
122
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkFormField, never>;
|
|
123
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkFormField, "mk-form-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "errorMessages": { "alias": "errorMessages"; "required": false; "isSignal": true; }; "errorOn": { "alias": "errorOn"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, {}, ["ngControl"], ["*"], true, never>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** One field-level error to surface in {@link MkFormErrorSummary}. */
|
|
127
|
+
interface MkFormError {
|
|
128
|
+
/**
|
|
129
|
+
* The `id` of the control (or `mk-form-field`'s `controlId`) the message
|
|
130
|
+
* refers to. Clicking the summary entry focuses this element.
|
|
131
|
+
*/
|
|
132
|
+
fieldId: string;
|
|
133
|
+
/** The human-readable error message. */
|
|
134
|
+
message: string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* FormErrorSummary — an accessible summary of a form's validation errors,
|
|
138
|
+
* shown at the top of the form on a failed submit. Each entry links to its
|
|
139
|
+
* field and focuses it on click. Following the WAI/GOV.UK pattern it is an
|
|
140
|
+
* `alert` region and, when the surrounding form is submitted with errors,
|
|
141
|
+
* focus moves here automatically (opt out with `[autoFocus]="false"`) so
|
|
142
|
+
* screen-reader and keyboard users are taken straight to the problems. The
|
|
143
|
+
* public `focus()` remains for manual flows (e.g. server-side errors).
|
|
144
|
+
*
|
|
145
|
+
* ## Automatic collection
|
|
146
|
+
*
|
|
147
|
+
* Point `form` at a `FormGroup` and the summary walks it itself: one entry per
|
|
148
|
+
* invalid control, worded from the `validation` i18n table (override per key
|
|
149
|
+
* with `errorMessages`). Pass `labels` to name the fields — without an entry
|
|
150
|
+
* the control's path is used. Entries appear once the form is submitted;
|
|
151
|
+
* `showOn="always"` lists them as soon as they exist.
|
|
152
|
+
*
|
|
153
|
+
* Each entry is linked to its field by locating the control in the DOM, so
|
|
154
|
+
* `formControlName` must be a static attribute (`formControlName="email"`,
|
|
155
|
+
* the usual form) rather than a binding.
|
|
156
|
+
*
|
|
157
|
+
* ```html
|
|
158
|
+
* <!-- automatic -->
|
|
159
|
+
* <form [formGroup]="form" (ngSubmit)="submit()">
|
|
160
|
+
* <mk-form-error-summary #summary [form]="form"
|
|
161
|
+
* [labels]="{ email: 'Email address', age: 'Age' }" />
|
|
162
|
+
* …
|
|
163
|
+
* </form>
|
|
164
|
+
*
|
|
165
|
+
* <!-- manual -->
|
|
166
|
+
* <mk-form-error-summary #summary [errors]="errors()" />
|
|
167
|
+
* …
|
|
168
|
+
* onSubmit() { if (invalid) { this.errors.set(collect()); this.summary.focus(); } }
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
declare class MkFormErrorSummary {
|
|
172
|
+
private readonly document;
|
|
173
|
+
private readonly host;
|
|
174
|
+
private readonly i18n;
|
|
175
|
+
private readonly parentForm;
|
|
176
|
+
private readonly parentFormGroup;
|
|
177
|
+
/**
|
|
178
|
+
* Errors to list explicitly. When non-empty this wins over `form`, so a form
|
|
179
|
+
* can mix automatic collection with server-side errors by not setting it.
|
|
180
|
+
*/
|
|
181
|
+
readonly errors: _angular_core.InputSignal<readonly MkFormError[]>;
|
|
182
|
+
/** Collect errors from this control tree instead of passing them in. */
|
|
183
|
+
readonly form: _angular_core.InputSignal<AbstractControl<any, any, any> | null>;
|
|
184
|
+
/** Field names for automatic entries, keyed by control path. */
|
|
185
|
+
readonly labels: _angular_core.InputSignal<Readonly<Record<string, string>>>;
|
|
186
|
+
/** Per-key wording for automatic entries, as on `mk-form-field`. */
|
|
187
|
+
readonly errorMessages: _angular_core.InputSignal<Readonly<Record<string, string | ((err: any) => string)>> | null>;
|
|
188
|
+
/** When automatic entries appear. Defaults to after the form is submitted. */
|
|
189
|
+
readonly showOn: _angular_core.InputSignal<"always" | "submit">;
|
|
190
|
+
/** Heading shown above the list. */
|
|
191
|
+
readonly summaryTitle: _angular_core.InputSignal<string>;
|
|
192
|
+
/**
|
|
193
|
+
* Move focus to the summary automatically when the surrounding form is
|
|
194
|
+
* submitted with errors (the WAI/GOV.UK pattern). Disable to drive focus
|
|
195
|
+
* yourself via the public `focus()`.
|
|
196
|
+
*/
|
|
197
|
+
readonly autoFocus: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
198
|
+
readonly titleId: string;
|
|
199
|
+
/** Bumped on every change in the watched control tree. */
|
|
200
|
+
private readonly formTick;
|
|
201
|
+
constructor();
|
|
202
|
+
/** Whether the surrounding form (if any) has been submitted. */
|
|
203
|
+
private readonly submitted;
|
|
204
|
+
/** Entries collected from `form`, when one is set and they should show. */
|
|
205
|
+
private readonly autoErrors;
|
|
206
|
+
/** The entries actually rendered — an explicit `errors` list wins. */
|
|
207
|
+
protected readonly shownErrors: _angular_core.Signal<readonly MkFormError[]>;
|
|
208
|
+
/** Whether there is anything to show. */
|
|
209
|
+
protected readonly hasErrors: _angular_core.Signal<boolean>;
|
|
210
|
+
/** Move keyboard focus to the summary (call after a failed submit). */
|
|
211
|
+
focus(): void;
|
|
212
|
+
/** Focus the field an entry points at (native anchor jump is unreliable). */
|
|
213
|
+
protected focusField(event: Event, fieldId: string): void;
|
|
214
|
+
/**
|
|
215
|
+
* Resolves a control path to the id of the element to focus. Reactive forms
|
|
216
|
+
* put `formControlName` in the DOM as a plain attribute, so the control can
|
|
217
|
+
* be located from its path; the element's own `id` (which `mk-form-field`
|
|
218
|
+
* assigns) is preferred so the link's `href` anchor also resolves.
|
|
219
|
+
*/
|
|
220
|
+
private fieldIdFor;
|
|
221
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkFormErrorSummary, never>;
|
|
222
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkFormErrorSummary, "mk-form-error-summary", ["mkFormErrorSummary"], { "errors": { "alias": "errors"; "required": false; "isSignal": true; }; "form": { "alias": "form"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; "errorMessages": { "alias": "errorMessages"; "required": false; "isSignal": true; }; "showOn": { "alias": "showOn"; "required": false; "isSignal": true; }; "summaryTitle": { "alias": "summaryTitle"; "required": false; "isSignal": true; }; "autoFocus": { "alias": "autoFocus"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Input — enhances a native `<input>` or `<textarea>` with mk-kit theming and
|
|
227
|
+
* a11y wiring. It is an attribute-selector component so all native semantics
|
|
228
|
+
* and keyboard behaviour come for free; this layers on tokenised styling, aria
|
|
229
|
+
* state and form integration.
|
|
230
|
+
*
|
|
231
|
+
* It provides its own `ControlValueAccessor` (over the native `value`) so
|
|
232
|
+
* `[(ngModel)]` and reactive forms write back to the DOM reliably — including
|
|
233
|
+
* when the bound model is reset programmatically. IME composition is buffered
|
|
234
|
+
* so `onChange` fires once per completed character, matching Angular's built-in
|
|
235
|
+
* `DefaultValueAccessor`.
|
|
236
|
+
*
|
|
237
|
+
* When placed inside an `mk-form-field` it automatically adopts the field's
|
|
238
|
+
* control id (so the `<label for>` associates), `aria-describedby`,
|
|
239
|
+
* `aria-invalid` and `aria-required`.
|
|
240
|
+
*
|
|
241
|
+
* ```html
|
|
242
|
+
* <input mkInput type="email" placeholder="you@example.com" />
|
|
243
|
+
* <textarea mkInput rows="4" [invalid]="true"></textarea>
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
declare class MkInput implements ControlValueAccessor {
|
|
247
|
+
private readonly field;
|
|
248
|
+
private readonly group;
|
|
249
|
+
private readonly host;
|
|
250
|
+
private readonly initialId;
|
|
251
|
+
/** Whether this input sits inside an `mk-input-group` (the group then owns the frame). */
|
|
252
|
+
protected readonly inGroup: boolean;
|
|
253
|
+
/** Control size. Ignored when nested in an `mk-form-field` (inherits it). */
|
|
254
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
255
|
+
/** Force the invalid visual + `aria-invalid` when used standalone. */
|
|
256
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
257
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
258
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
259
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
260
|
+
protected readonly resolvedId: _angular_core.Signal<string | null>;
|
|
261
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
262
|
+
private onChange;
|
|
263
|
+
protected onTouched: () => void;
|
|
264
|
+
/** True while an IME composition is in flight (buffers `onChange`). */
|
|
265
|
+
private composing;
|
|
266
|
+
protected onInput(event: Event): void;
|
|
267
|
+
protected onCompositionStart(): void;
|
|
268
|
+
protected onCompositionEnd(event: Event): void;
|
|
269
|
+
writeValue(value: unknown): void;
|
|
270
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
271
|
+
registerOnTouched(fn: () => void): void;
|
|
272
|
+
setDisabledState(isDisabled: boolean): void;
|
|
273
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkInput, never>;
|
|
274
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkInput, "input[mkInput], textarea[mkInput]", never, { "size": { "alias": "size"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* InputGroup — wraps a native `input[mkInput]` with leading / trailing affixes
|
|
279
|
+
* (icons, static text, compact buttons) inside one shared control frame. The
|
|
280
|
+
* group carries the border, background and focus ring; the nested input
|
|
281
|
+
* detects the group and drops its own chrome, so the whole assembly reads as
|
|
282
|
+
* a single field.
|
|
283
|
+
*
|
|
284
|
+
* Project affixes with the `mkInputPrefix` / `mkInputSuffix` attributes. Both
|
|
285
|
+
* are optional; interactive suffixes (a clear or scan button) keep their own
|
|
286
|
+
* focus behaviour.
|
|
287
|
+
*
|
|
288
|
+
* Inside an `mk-form-field` the group inherits the field's size and invalid
|
|
289
|
+
* state, and the field's label association still targets the inner input.
|
|
290
|
+
*
|
|
291
|
+
* ```html
|
|
292
|
+
* <mk-input-group>
|
|
293
|
+
* <mk-icon mkInputPrefix name="search" />
|
|
294
|
+
* <input mkInput type="search" placeholder="Search…" />
|
|
295
|
+
* </mk-input-group>
|
|
296
|
+
*
|
|
297
|
+
* <mk-form-field label="Price">
|
|
298
|
+
* <mk-input-group>
|
|
299
|
+
* <input mkInput type="number" formControlName="price" />
|
|
300
|
+
* <span mkInputSuffix>zł</span>
|
|
301
|
+
* </mk-input-group>
|
|
302
|
+
* </mk-form-field>
|
|
303
|
+
* ```
|
|
304
|
+
*/
|
|
305
|
+
declare class MkInputGroup {
|
|
306
|
+
private readonly field;
|
|
307
|
+
/** Control size. Ignored when nested in an `mk-form-field` (inherits it). */
|
|
308
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
309
|
+
/** Force the invalid visual when used standalone. */
|
|
310
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
311
|
+
/** Visually reflect a disabled inner control. */
|
|
312
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
313
|
+
/** The size the group (and its nested input) renders at. */
|
|
314
|
+
readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
315
|
+
/** Whether the group renders the invalid frame. */
|
|
316
|
+
readonly isInvalid: _angular_core.Signal<boolean>;
|
|
317
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
318
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkInputGroup, never>;
|
|
319
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkInputGroup, "mk-input-group", never, { "size": { "alias": "size"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, ["[mkInputPrefix]", "*", "[mkInputSuffix]"], true, never>;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* SubmitInput — a short text entry and its action button rendered as one
|
|
324
|
+
* connected control: the "type a code and apply it" pattern (discount codes,
|
|
325
|
+
* gift cards, invite codes, newsletter sign-up, quick search).
|
|
326
|
+
*
|
|
327
|
+
* The button is disabled while the value is empty or blank, shows a spinner
|
|
328
|
+
* while `loading` and emits {@link submitted} with the **trimmed** value on
|
|
329
|
+
* click or on Enter.
|
|
330
|
+
*
|
|
331
|
+
* ## Enter never submits the surrounding form
|
|
332
|
+
*
|
|
333
|
+
* This control is normally dropped inside a bigger form (a checkout, a
|
|
334
|
+
* settings page), where triggering that form's submit would be a bug. So the
|
|
335
|
+
* action button is a `type="button"` and, while `submitOnEnter` is on, the
|
|
336
|
+
* Enter keydown is `preventDefault()`-ed — implicit form submission never
|
|
337
|
+
* fires. Set `submitOnEnter="false"` to restore the native behaviour and let
|
|
338
|
+
* Enter reach the enclosing form.
|
|
339
|
+
*
|
|
340
|
+
* ## Button content
|
|
341
|
+
*
|
|
342
|
+
* The button is configured, not projected: `buttonLabel` sets its text.
|
|
343
|
+
* Passing `buttonIcon` (a registered {@link MkIcon} name) switches it to the
|
|
344
|
+
* square icon-only variant, where `buttonLabel` becomes its `aria-label` — so
|
|
345
|
+
* the action always has an accessible name.
|
|
346
|
+
*
|
|
347
|
+
* Implements `ControlValueAccessor` and exposes a two-way `value` model, so
|
|
348
|
+
* `[(ngModel)]`, reactive forms and `[(value)]` all work.
|
|
349
|
+
*
|
|
350
|
+
* ```html
|
|
351
|
+
* <mk-submit-input
|
|
352
|
+
* [(value)]="code"
|
|
353
|
+
* buttonLabel="Apply"
|
|
354
|
+
* [loading]="applying()"
|
|
355
|
+
* placeholder="SUMMER10"
|
|
356
|
+
* clearable
|
|
357
|
+
* (submitted)="apply($event)"
|
|
358
|
+
* />
|
|
359
|
+
*
|
|
360
|
+
* <!-- icon-only, inside a field -->
|
|
361
|
+
* <mk-form-field label="Search">
|
|
362
|
+
* <mk-submit-input buttonIcon="search" buttonLabel="Search" [(ngModel)]="q" />
|
|
363
|
+
* </mk-form-field>
|
|
364
|
+
* ```
|
|
365
|
+
*/
|
|
366
|
+
declare class MkSubmitInput implements ControlValueAccessor {
|
|
367
|
+
private readonly field;
|
|
368
|
+
/** Localised strings (override globally via `provideMkI18n`). */
|
|
369
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
370
|
+
private readonly inputRef;
|
|
371
|
+
/** Control size. Ignored when nested in an `mk-form-field`. */
|
|
372
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
373
|
+
/** Force invalid styling + `aria-invalid` when used standalone. */
|
|
374
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
375
|
+
/** Disable the whole control (input + button). */
|
|
376
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
377
|
+
/** Placeholder shown when empty. */
|
|
378
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
379
|
+
/**
|
|
380
|
+
* Accessible name for the inner input when the control is used outside an
|
|
381
|
+
* `mk-form-field` (inside one, the field's `<label>` wins). Defaults to the
|
|
382
|
+
* button's caption.
|
|
383
|
+
*/
|
|
384
|
+
readonly label: _angular_core.InputSignal<string>;
|
|
385
|
+
/** Native `type` of the inner input (`text`, `search`, `email`, …). */
|
|
386
|
+
readonly type: _angular_core.InputSignal<string>;
|
|
387
|
+
/** Native `autocomplete` hint for the inner input. */
|
|
388
|
+
readonly autocomplete: _angular_core.InputSignal<string>;
|
|
389
|
+
/** Two-way value. `submitted` emits it trimmed; the model keeps what was typed. */
|
|
390
|
+
readonly value: _angular_core.ModelSignal<string>;
|
|
391
|
+
/** Button text — or, with `buttonIcon`, the icon button's `aria-label`. */
|
|
392
|
+
readonly buttonLabel: _angular_core.InputSignal<string>;
|
|
393
|
+
/** Registered icon name; switches the button to the icon-only variant. */
|
|
394
|
+
readonly buttonIcon: _angular_core.InputSignal<string>;
|
|
395
|
+
/** Button visual treatment. */
|
|
396
|
+
readonly buttonVariant: _angular_core.InputSignal<MkVariant>;
|
|
397
|
+
/** Button colour tone. */
|
|
398
|
+
readonly buttonTone: _angular_core.InputSignal<MkTone>;
|
|
399
|
+
/** Shows a spinner in the button and blocks submitting while an action runs. */
|
|
400
|
+
readonly loading: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
401
|
+
/** Show a clear affix while the value is non-empty. */
|
|
402
|
+
readonly clearable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
403
|
+
/**
|
|
404
|
+
* Submit on Enter, without submitting an enclosing `<form>`. Turn it off to
|
|
405
|
+
* let Enter bubble to the form as the browser normally would.
|
|
406
|
+
*/
|
|
407
|
+
readonly submitOnEnter: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
408
|
+
/** Emits the current value, trimmed, when the action is triggered. */
|
|
409
|
+
readonly submitted: _angular_core.OutputEmitterRef<string>;
|
|
410
|
+
private readonly cvaDisabled;
|
|
411
|
+
private onChange;
|
|
412
|
+
private onTouched;
|
|
413
|
+
/** Id of the inner input — the `<label for>` target inside an `mk-form-field`. */
|
|
414
|
+
readonly inputId: string;
|
|
415
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
416
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
417
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
418
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
419
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
420
|
+
/** Fallback accessible name for the input when no field label describes it. */
|
|
421
|
+
protected readonly inputLabel: _angular_core.Signal<string | null>;
|
|
422
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
423
|
+
/** The accessible name of the action button in either variant. */
|
|
424
|
+
protected readonly actionLabel: _angular_core.Signal<string>;
|
|
425
|
+
/** Whether the clear affix is currently rendered. */
|
|
426
|
+
protected readonly showClear: _angular_core.Signal<boolean>;
|
|
427
|
+
/** Blank values, a disabled control and an in-flight action all block submitting. */
|
|
428
|
+
protected readonly canSubmit: _angular_core.Signal<boolean>;
|
|
429
|
+
protected onInput(event: Event): void;
|
|
430
|
+
protected onBlur(): void;
|
|
431
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
432
|
+
/** Emit `submitted` with the trimmed value, when the control allows it. */
|
|
433
|
+
submit(): void;
|
|
434
|
+
/** Clear the value and return focus to the input. */
|
|
435
|
+
clear(): void;
|
|
436
|
+
writeValue(value: string | null): void;
|
|
437
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
438
|
+
registerOnTouched(fn: () => void): void;
|
|
439
|
+
setDisabledState(isDisabled: boolean): void;
|
|
440
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkSubmitInput, never>;
|
|
441
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkSubmitInput, "mk-submit-input", ["mkSubmitInput"], { "size": { "alias": "size"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "autocomplete": { "alias": "autocomplete"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "buttonLabel": { "alias": "buttonLabel"; "required": false; "isSignal": true; }; "buttonIcon": { "alias": "buttonIcon"; "required": false; "isSignal": true; }; "buttonVariant": { "alias": "buttonVariant"; "required": false; "isSignal": true; }; "buttonTone": { "alias": "buttonTone"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; "submitOnEnter": { "alias": "submitOnEnter"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "submitted": "submitted"; }, never, never, true, never>;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
/** One translatable locale offered by {@link MkI18nInput}. */
|
|
445
|
+
interface MkI18nLocale {
|
|
446
|
+
/** Value key in the bound record, e.g. `pl`. */
|
|
447
|
+
code: string;
|
|
448
|
+
/** Short switcher label, e.g. `PL`. */
|
|
449
|
+
label: string;
|
|
450
|
+
/** Longer name for the accessible label, e.g. `Polish`. */
|
|
451
|
+
name?: string;
|
|
452
|
+
}
|
|
453
|
+
/** The bound value: one string per locale code. */
|
|
454
|
+
type MkI18nValue = Record<string, string>;
|
|
455
|
+
/**
|
|
456
|
+
* I18nInput — one field that edits the same text in several languages.
|
|
457
|
+
*
|
|
458
|
+
* The common alternative is stacking one input per language, which grows the
|
|
459
|
+
* form linearly with locale count and buries the field the author actually
|
|
460
|
+
* cares about. This shows a single input and a compact switcher, and marks
|
|
461
|
+
* which locales already have content so nothing is silently left untranslated.
|
|
462
|
+
*
|
|
463
|
+
* Binds a `Record<code, string>`, so it drops into reactive forms as one
|
|
464
|
+
* control instead of a nested group:
|
|
465
|
+
*
|
|
466
|
+
* ```html
|
|
467
|
+
* <mk-form-field label="Name">
|
|
468
|
+
* <mk-i18n-input formControlName="name" [locales]="locales" />
|
|
469
|
+
* </mk-form-field>
|
|
470
|
+
* ```
|
|
471
|
+
*
|
|
472
|
+
* ```ts
|
|
473
|
+
* locales = [
|
|
474
|
+
* { code: 'en', label: 'EN', name: 'English' },
|
|
475
|
+
* { code: 'pl', label: 'PL', name: 'Polish' },
|
|
476
|
+
* ];
|
|
477
|
+
* ```
|
|
478
|
+
*/
|
|
479
|
+
declare class MkI18nInput implements ControlValueAccessor {
|
|
480
|
+
/** Locales offered, in switcher order. The first is the initial tab. */
|
|
481
|
+
readonly locales: _angular_core.InputSignal<readonly MkI18nLocale[]>;
|
|
482
|
+
/** Render a textarea instead of a single-line input. */
|
|
483
|
+
readonly multiline: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
484
|
+
/** Textarea rows (ignored unless `multiline`). */
|
|
485
|
+
readonly rows: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
486
|
+
/** Placeholder for the active locale's input. */
|
|
487
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
488
|
+
/** Control size, forwarded to the input and the switcher. */
|
|
489
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
490
|
+
/**
|
|
491
|
+
* Locale codes that must be filled. They get a marker in the switcher while
|
|
492
|
+
* empty, so a missing translation is visible without switching to it.
|
|
493
|
+
*/
|
|
494
|
+
readonly requiredLocales: _angular_core.InputSignal<readonly string[]>;
|
|
495
|
+
/** Disable the whole control. */
|
|
496
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
497
|
+
private readonly value;
|
|
498
|
+
private readonly cvaDisabled;
|
|
499
|
+
protected readonly activeCode: _angular_core.WritableSignal<string | null>;
|
|
500
|
+
/** The locale currently being edited — the first one until switched. */
|
|
501
|
+
protected readonly active: _angular_core.Signal<MkI18nLocale>;
|
|
502
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
503
|
+
/** Text for the active locale. */
|
|
504
|
+
protected readonly activeText: _angular_core.Signal<string>;
|
|
505
|
+
/** Locale codes that currently hold text — drives the switcher markers. */
|
|
506
|
+
protected readonly filled: _angular_core.Signal<Set<string>>;
|
|
507
|
+
/** True when a required locale is still empty. */
|
|
508
|
+
protected missing(code: string): boolean;
|
|
509
|
+
protected onSwitch(code: string): void;
|
|
510
|
+
protected onInput(text: string): void;
|
|
511
|
+
protected onBlur(): void;
|
|
512
|
+
/** Accessible label for a switcher item, e.g. "Polish — missing". */
|
|
513
|
+
protected switcherAria(locale: MkI18nLocale): string;
|
|
514
|
+
private onChange;
|
|
515
|
+
private onTouched;
|
|
516
|
+
writeValue(value: MkI18nValue | null): void;
|
|
517
|
+
registerOnChange(fn: (value: MkI18nValue) => void): void;
|
|
518
|
+
registerOnTouched(fn: () => void): void;
|
|
519
|
+
setDisabledState(isDisabled: boolean): void;
|
|
520
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkI18nInput, never>;
|
|
521
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkI18nInput, "mk-i18n-input", never, { "locales": { "alias": "locales"; "required": false; "isSignal": true; }; "multiline": { "alias": "multiline"; "required": false; "isSignal": true; }; "rows": { "alias": "rows"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "requiredLocales": { "alias": "requiredLocales"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/** A single selectable option for {@link MkSelect}. */
|
|
525
|
+
interface MkSelectOption {
|
|
526
|
+
/** Text shown to the user (and used for typeahead). */
|
|
527
|
+
label: string;
|
|
528
|
+
/** The value bound to the form control when chosen. */
|
|
529
|
+
value: unknown;
|
|
530
|
+
/** Disable the option (skipped by keyboard + not selectable). */
|
|
531
|
+
disabled?: boolean;
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Select — a fully custom, accessible single-select implementing the ARIA
|
|
535
|
+
* listbox/combobox pattern. Options are supplied via the `options` input.
|
|
536
|
+
*
|
|
537
|
+
* Keyboard: Up/Down to move, Home/End to jump, Enter/Space to select, Esc to
|
|
538
|
+
* close, and typeahead by typing option text. Focus stays on the trigger
|
|
539
|
+
* (`aria-activedescendant` pattern) for robust screen-reader behaviour.
|
|
540
|
+
*
|
|
541
|
+
* Implements `ControlValueAccessor` and exposes a two-way `value` model, so it
|
|
542
|
+
* works with `[(ngModel)]`, reactive forms and `[(value)]`.
|
|
543
|
+
*
|
|
544
|
+
* ```html
|
|
545
|
+
* <mk-select placeholder="Pick a role"
|
|
546
|
+
* [options]="[{label:'Admin', value:'admin'}, {label:'Editor', value:'editor'}]"
|
|
547
|
+
* [(ngModel)]="role" />
|
|
548
|
+
* ```
|
|
549
|
+
*/
|
|
550
|
+
declare class MkSelect implements ControlValueAccessor, OnDestroy {
|
|
551
|
+
private readonly field;
|
|
552
|
+
/** Localised strings (override globally via `provideMkI18n`). */
|
|
553
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
554
|
+
private readonly triggerRef;
|
|
555
|
+
/** The list of options to choose from. */
|
|
556
|
+
readonly options: _angular_core.InputSignal<readonly MkSelectOption[]>;
|
|
557
|
+
/** Placeholder shown when nothing is selected. */
|
|
558
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
559
|
+
/** Control size. Ignored when nested in an `mk-form-field`. */
|
|
560
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
561
|
+
/** Force invalid styling + `aria-invalid` when used standalone. */
|
|
562
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
563
|
+
/** Disable the control. */
|
|
564
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
565
|
+
/** Two-way selected value. */
|
|
566
|
+
readonly value: _angular_core.ModelSignal<unknown>;
|
|
567
|
+
protected readonly open: _angular_core.WritableSignal<boolean>;
|
|
568
|
+
protected readonly activeIndex: _angular_core.WritableSignal<number>;
|
|
569
|
+
private readonly cvaDisabled;
|
|
570
|
+
private onChange;
|
|
571
|
+
private onTouched;
|
|
572
|
+
private typeahead;
|
|
573
|
+
private typeaheadTimer?;
|
|
574
|
+
readonly listId: string;
|
|
575
|
+
readonly triggerId: string;
|
|
576
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
577
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
578
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
579
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
580
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
581
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
582
|
+
protected readonly selectedIndex: _angular_core.Signal<number>;
|
|
583
|
+
protected readonly displayLabel: _angular_core.Signal<string>;
|
|
584
|
+
protected optionId(index: number): string;
|
|
585
|
+
protected toggle(): void;
|
|
586
|
+
private openList;
|
|
587
|
+
protected close(): void;
|
|
588
|
+
protected selectOption(index: number): void;
|
|
589
|
+
protected onKeydown(event: Event): void;
|
|
590
|
+
protected onBlur(): void;
|
|
591
|
+
private move;
|
|
592
|
+
private firstEnabled;
|
|
593
|
+
private lastEnabled;
|
|
594
|
+
private typeaheadSearch;
|
|
595
|
+
private focusTrigger;
|
|
596
|
+
ngOnDestroy(): void;
|
|
597
|
+
writeValue(value: unknown): void;
|
|
598
|
+
registerOnChange(fn: (value: unknown) => void): void;
|
|
599
|
+
registerOnTouched(fn: () => void): void;
|
|
600
|
+
setDisabledState(isDisabled: boolean): void;
|
|
601
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkSelect, never>;
|
|
602
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkSelect, "mk-select", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/** A single suggestion for {@link MkAutocomplete}. */
|
|
606
|
+
interface MkAutocompleteOption {
|
|
607
|
+
/** Text shown to the user and used as the input display value when chosen. */
|
|
608
|
+
label: string;
|
|
609
|
+
/** The value bound to the form control when this option is selected. */
|
|
610
|
+
value: unknown;
|
|
611
|
+
/** Disable the option (skipped by keyboard + not selectable). */
|
|
612
|
+
disabled?: boolean;
|
|
613
|
+
/**
|
|
614
|
+
* Muted second line under the label — the disambiguator when labels can
|
|
615
|
+
* collide (two customers named Jan Kowalski, telling accounts apart by
|
|
616
|
+
* email, an id under a product name).
|
|
617
|
+
*/
|
|
618
|
+
description?: string;
|
|
619
|
+
}
|
|
620
|
+
/** How the option list is narrowed against the typed text. */
|
|
621
|
+
type MkAutocompleteFilterMode = 'contains' | 'startsWith' | 'none';
|
|
622
|
+
/**
|
|
623
|
+
* Autocomplete — an accessible text input that suggests options as the user
|
|
624
|
+
* types, implementing the ARIA combobox (`aria-autocomplete="list"`) pattern
|
|
625
|
+
* with a popup listbox.
|
|
626
|
+
*
|
|
627
|
+
* Filtering is built in (`contains` / `startsWith`); set `filterMode="none"`
|
|
628
|
+
* and drive `options` yourself from the `search` output for async/server-side
|
|
629
|
+
* suggestions. Typing arbitrary text is allowed unless `requireSelection` is
|
|
630
|
+
* set, in which case the field clears on blur if it doesn't match an option.
|
|
631
|
+
*
|
|
632
|
+
* Implements `ControlValueAccessor` and exposes a two-way `value` model, so it
|
|
633
|
+
* works with `[(ngModel)]`, reactive forms and `[(value)]`. When nested in an
|
|
634
|
+
* `mk-form-field` it inherits size, label, hint/error and required wiring.
|
|
635
|
+
*
|
|
636
|
+
* ```html
|
|
637
|
+
* <mk-autocomplete placeholder="Search users"
|
|
638
|
+
* [options]="filtered()"
|
|
639
|
+
* filterMode="none"
|
|
640
|
+
* (search)="query.set($event)"
|
|
641
|
+
* [(value)]="userId" />
|
|
642
|
+
* ```
|
|
643
|
+
*/
|
|
644
|
+
declare class MkAutocomplete implements ControlValueAccessor {
|
|
645
|
+
private readonly field;
|
|
646
|
+
/** Localised strings (override globally via `provideMkI18n`). */
|
|
647
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
648
|
+
private readonly announcer;
|
|
649
|
+
private readonly inputRef;
|
|
650
|
+
/** Last announced result count (guards repeat announcements). */
|
|
651
|
+
private lastAnnouncedCount;
|
|
652
|
+
constructor();
|
|
653
|
+
/** The list of suggestions. Update it from `search` for async sources. */
|
|
654
|
+
readonly options: _angular_core.InputSignal<readonly MkAutocompleteOption[]>;
|
|
655
|
+
/** Placeholder shown when the input is empty. */
|
|
656
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
657
|
+
/** Control size. Ignored when nested in an `mk-form-field`. */
|
|
658
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
659
|
+
/** Force invalid styling + `aria-invalid` when used standalone. */
|
|
660
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
661
|
+
/** Disable the control. */
|
|
662
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
663
|
+
/** How the option list is filtered against the typed text. */
|
|
664
|
+
readonly filterMode: _angular_core.InputSignal<MkAutocompleteFilterMode>;
|
|
665
|
+
/** Only open the list once this many characters have been typed. */
|
|
666
|
+
readonly minChars: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
667
|
+
/** Show a loading row instead of "no results" (for async fetches). */
|
|
668
|
+
readonly loading: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
669
|
+
/** Clear the input on blur unless the text matches a selectable option. */
|
|
670
|
+
readonly requireSelection: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
671
|
+
/** Message shown when there are no matching options. */
|
|
672
|
+
readonly emptyMessage: _angular_core.InputSignal<string>;
|
|
673
|
+
/** Two-way selected value (the `value` of the chosen option, or `null`). */
|
|
674
|
+
readonly value: _angular_core.ModelSignal<unknown>;
|
|
675
|
+
/** Emits the current input text on every keystroke — drive async loading. */
|
|
676
|
+
readonly search: _angular_core.OutputEmitterRef<string>;
|
|
677
|
+
/** Emits the option whenever one is committed by click or Enter. */
|
|
678
|
+
readonly optionSelected: _angular_core.OutputEmitterRef<MkAutocompleteOption>;
|
|
679
|
+
protected readonly open: _angular_core.WritableSignal<boolean>;
|
|
680
|
+
protected readonly activeIndex: _angular_core.WritableSignal<number>;
|
|
681
|
+
protected readonly query: _angular_core.WritableSignal<string>;
|
|
682
|
+
private readonly cvaDisabled;
|
|
683
|
+
private onChange;
|
|
684
|
+
private onTouched;
|
|
685
|
+
readonly listId: string;
|
|
686
|
+
readonly inputId: string;
|
|
687
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
688
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
689
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
690
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
691
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
692
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
693
|
+
/** Options after applying the built-in filter (or all, when `none`). */
|
|
694
|
+
protected readonly filtered: _angular_core.Signal<readonly MkAutocompleteOption[]>;
|
|
695
|
+
protected readonly hasResults: _angular_core.Signal<boolean>;
|
|
696
|
+
protected optionId(index: number): string;
|
|
697
|
+
/** The option matching the current value, if any. */
|
|
698
|
+
private optionForValue;
|
|
699
|
+
protected onInput(event: Event): void;
|
|
700
|
+
protected onFocus(): void;
|
|
701
|
+
private openIfEligible;
|
|
702
|
+
protected close(): void;
|
|
703
|
+
protected selectOption(index: number): void;
|
|
704
|
+
protected onKeydown(event: Event): void;
|
|
705
|
+
protected onBlur(): void;
|
|
706
|
+
/**
|
|
707
|
+
* When `requireSelection` is set, drop free text that doesn't map to an
|
|
708
|
+
* option; otherwise restore the committed option's label if one exists.
|
|
709
|
+
*/
|
|
710
|
+
private reconcileOnBlur;
|
|
711
|
+
protected onOutsideDismiss(): void;
|
|
712
|
+
protected clear(): void;
|
|
713
|
+
private move;
|
|
714
|
+
private firstEnabled;
|
|
715
|
+
private lastEnabled;
|
|
716
|
+
private focusInput;
|
|
717
|
+
writeValue(value: unknown): void;
|
|
718
|
+
registerOnChange(fn: (value: unknown) => void): void;
|
|
719
|
+
registerOnTouched(fn: () => void): void;
|
|
720
|
+
setDisabledState(isDisabled: boolean): void;
|
|
721
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkAutocomplete, never>;
|
|
722
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkAutocomplete, "mk-autocomplete", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "filterMode": { "alias": "filterMode"; "required": false; "isSignal": true; }; "minChars": { "alias": "minChars"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "requireSelection": { "alias": "requireSelection"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "search": "search"; "optionSelected": "optionSelected"; }, never, never, true, never>;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
/** How mention suggestions are narrowed against the typed query. */
|
|
726
|
+
type MkMentionFilterMode = 'contains' | 'startsWith' | 'none';
|
|
727
|
+
/** A single suggestion offered by {@link MkMention}. */
|
|
728
|
+
interface MkMentionOption {
|
|
729
|
+
/** Machine identifier (username, tag slug) — also matched when filtering. */
|
|
730
|
+
value: string;
|
|
731
|
+
/** Text shown in the panel; the default insertion writes `trigger + label`. */
|
|
732
|
+
label: string;
|
|
733
|
+
/** Muted, single-line disambiguator shown after the label (e-mail, count…). */
|
|
734
|
+
hint?: string;
|
|
735
|
+
/**
|
|
736
|
+
* Offer this option for one trigger character only (e.g. `'#'` for tags).
|
|
737
|
+
* Options without a `trigger` are offered for every trigger.
|
|
738
|
+
*/
|
|
739
|
+
trigger?: string;
|
|
740
|
+
}
|
|
741
|
+
/** Payload of {@link MkMention.mentionSearch}. */
|
|
742
|
+
interface MkMentionSearchEvent {
|
|
743
|
+
/** The trigger character that opened the session (`'@'`, `'#'`, …). */
|
|
744
|
+
trigger: string;
|
|
745
|
+
/** Text typed between the trigger and the caret. */
|
|
746
|
+
query: string;
|
|
747
|
+
}
|
|
748
|
+
/** Payload of {@link MkMention.mentionSelect}. */
|
|
749
|
+
interface MkMentionSelectEvent {
|
|
750
|
+
option: MkMentionOption;
|
|
751
|
+
trigger: string;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Mention / hashtag autocomplete for a **native** `<textarea>` or text
|
|
755
|
+
* `<input>`. Typing a trigger character (`@`, `#`, …) at the start of a word
|
|
756
|
+
* opens a top-layer suggestion panel anchored at the caret; picking an option
|
|
757
|
+
* replaces the trigger-plus-query with the completed mention and dispatches an
|
|
758
|
+
* `input` event so `ngModel`/reactive-forms bindings stay in sync.
|
|
759
|
+
*
|
|
760
|
+
* The element keeps its native textbox semantics — no `role="combobox"` — and
|
|
761
|
+
* follows the ARIA activedescendant pattern while the panel is open
|
|
762
|
+
* (`aria-autocomplete="list"`, `aria-controls`, `aria-expanded`,
|
|
763
|
+
* `aria-activedescendant`).
|
|
764
|
+
*
|
|
765
|
+
* Filtering is built in (`contains` / `startsWith` over label + value); set
|
|
766
|
+
* `mentionFilter="none"` and drive `mentionOptions` from the `mentionSearch`
|
|
767
|
+
* output for async/server-side suggestions (`mentionLoading` keeps the panel
|
|
768
|
+
* open with a spinner while results are in flight).
|
|
769
|
+
*
|
|
770
|
+
* ```html
|
|
771
|
+
* <textarea mkMention
|
|
772
|
+
* [mentionTriggers]="['@', '#']"
|
|
773
|
+
* [mentionOptions]="users"
|
|
774
|
+
* (mentionSelect)="onPick($event)"
|
|
775
|
+
* ></textarea>
|
|
776
|
+
* ```
|
|
777
|
+
*/
|
|
778
|
+
declare class MkMention implements OnDestroy {
|
|
779
|
+
private readonly host;
|
|
780
|
+
private readonly document;
|
|
781
|
+
private readonly vcr;
|
|
782
|
+
/** Single characters that start a mention session. */
|
|
783
|
+
readonly mentionTriggers: _angular_core.InputSignal<readonly string[]>;
|
|
784
|
+
/** The suggestion pool. Update it from `mentionSearch` for async sources. */
|
|
785
|
+
readonly mentionOptions: _angular_core.InputSignal<readonly MkMentionOption[]>;
|
|
786
|
+
/** How suggestions are filtered against the typed query. */
|
|
787
|
+
readonly mentionFilter: _angular_core.InputSignal<MkMentionFilterMode>;
|
|
788
|
+
/** Keep the panel open with a loading row while async results are pending. */
|
|
789
|
+
readonly mentionLoading: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
790
|
+
/**
|
|
791
|
+
* Builds the text inserted for a picked option. Defaults to
|
|
792
|
+
* `` `${trigger}${option.label} ` `` (note the trailing space).
|
|
793
|
+
*/
|
|
794
|
+
readonly mentionInsert: _angular_core.InputSignal<((option: MkMentionOption, trigger: string) => string) | null>;
|
|
795
|
+
/** Emits `{trigger, query}` whenever the active query changes — drive async loading. */
|
|
796
|
+
readonly mentionSearch: _angular_core.OutputEmitterRef<MkMentionSearchEvent>;
|
|
797
|
+
/** Emits after an option has been inserted into the control. */
|
|
798
|
+
readonly mentionSelect: _angular_core.OutputEmitterRef<MkMentionSelectEvent>;
|
|
799
|
+
/** Id of the listbox panel, wired to `aria-controls` while open. */
|
|
800
|
+
readonly listId: string;
|
|
801
|
+
private readonly session;
|
|
802
|
+
private readonly activeIndex;
|
|
803
|
+
/** Caret anchor point (viewport px) the panel is positioned against. */
|
|
804
|
+
private readonly caretAnchor;
|
|
805
|
+
/**
|
|
806
|
+
* Trigger index dismissed via Escape. The session stays closed while the
|
|
807
|
+
* caret remains in a mention context at this index — i.e. until a new
|
|
808
|
+
* trigger is typed elsewhere (or this one is deleted).
|
|
809
|
+
*/
|
|
810
|
+
private dismissedStart;
|
|
811
|
+
private panelRef;
|
|
812
|
+
/** Options for the active session, after trigger scoping + filtering. */
|
|
813
|
+
private readonly filtered;
|
|
814
|
+
/**
|
|
815
|
+
* The panel shows while a session is active and there is something to show:
|
|
816
|
+
* matching options, or a pending async fetch (`mentionLoading`). Zero
|
|
817
|
+
* options with nothing pending closes the panel (the session itself stays
|
|
818
|
+
* active, so async results arriving later reopen it).
|
|
819
|
+
*/
|
|
820
|
+
protected readonly panelOpen: _angular_core.Signal<boolean>;
|
|
821
|
+
protected readonly activeOptionId: _angular_core.Signal<string | null>;
|
|
822
|
+
constructor();
|
|
823
|
+
/**
|
|
824
|
+
* Looks backwards from the caret for a trigger character that starts a
|
|
825
|
+
* mention context: the trigger must sit at the start of the text or be
|
|
826
|
+
* preceded by whitespace, and the text between it and the caret (the query)
|
|
827
|
+
* must contain no whitespace and stay under {@link MAX_QUERY} characters.
|
|
828
|
+
*/
|
|
829
|
+
private detect;
|
|
830
|
+
/** Re-evaluates the mention context after typing or caret movement. */
|
|
831
|
+
protected update(): void;
|
|
832
|
+
private closeSession;
|
|
833
|
+
protected onKeydown(event: Event): void;
|
|
834
|
+
/** Caret-only movements never fire `input`; re-detect on their keyup. */
|
|
835
|
+
protected onKeyup(event: Event): void;
|
|
836
|
+
private move;
|
|
837
|
+
protected onBlur(event: Event): void;
|
|
838
|
+
private commit;
|
|
839
|
+
private createPanel;
|
|
840
|
+
private destroyPanel;
|
|
841
|
+
ngOnDestroy(): void;
|
|
842
|
+
/**
|
|
843
|
+
* Caret pixel position via the mirror-div technique: an offscreen `<div>`
|
|
844
|
+
* cloning the control's text layout gets the value up to the caret plus a
|
|
845
|
+
* marker span; the marker's rect, offset by the control's own rect and
|
|
846
|
+
* scroll position, is the caret's viewport coordinate. Returns the point
|
|
847
|
+
* just **below** the caret's line so the panel opens under it.
|
|
848
|
+
*
|
|
849
|
+
* Environments without layout (SSR, jsdom) safely yield `{0, 0}`.
|
|
850
|
+
*/
|
|
851
|
+
private caretPoint;
|
|
852
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkMention, never>;
|
|
853
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MkMention, "textarea[mkMention], input[mkMention]", ["mkMention"], { "mentionTriggers": { "alias": "mentionTriggers"; "required": false; "isSignal": true; }; "mentionOptions": { "alias": "mentionOptions"; "required": false; "isSignal": true; }; "mentionFilter": { "alias": "mentionFilter"; "required": false; "isSignal": true; }; "mentionLoading": { "alias": "mentionLoading"; "required": false; "isSignal": true; }; "mentionInsert": { "alias": "mentionInsert"; "required": false; "isSignal": true; }; }, { "mentionSearch": "mentionSearch"; "mentionSelect": "mentionSelect"; }, never, never, true, never>;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Suggestion listbox for {@link MkMention}. Created dynamically by the
|
|
858
|
+
* directive and wired imperatively right after creation: the directive hands
|
|
859
|
+
* it read-only signals (options, active index, caret anchor point) plus plain
|
|
860
|
+
* callbacks, so the panel re-renders reactively without `setInput` churn.
|
|
861
|
+
*
|
|
862
|
+
* The `<ul>` is promoted to the top layer by `mkAnchoredPanel` and positioned
|
|
863
|
+
* at the caret point; this host element stays empty in place.
|
|
864
|
+
*
|
|
865
|
+
* Not intended for direct use — the public API is the `[mkMention]` directive.
|
|
866
|
+
*/
|
|
867
|
+
declare class MkMentionPanel {
|
|
868
|
+
/** Localised strings (override globally via `provideMkI18n`). */
|
|
869
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
870
|
+
options: Signal<readonly MkMentionOption[]>;
|
|
871
|
+
activeIndex: Signal<number>;
|
|
872
|
+
/** Caret point (viewport px) the panel is anchored to. */
|
|
873
|
+
anchorPoint: Signal<{
|
|
874
|
+
x: number;
|
|
875
|
+
y: number;
|
|
876
|
+
}>;
|
|
877
|
+
loading: Signal<boolean>;
|
|
878
|
+
listId: string;
|
|
879
|
+
/**
|
|
880
|
+
* The mention control itself — passed as the anchored panel's element
|
|
881
|
+
* anchor so pointerdowns inside the control don't count as "outside"
|
|
882
|
+
* dismissals (the point anchor still wins for positioning).
|
|
883
|
+
*/
|
|
884
|
+
anchorEl: HTMLElement | undefined;
|
|
885
|
+
onPick: (index: number) => void;
|
|
886
|
+
onHover: (index: number) => void;
|
|
887
|
+
onDismiss: () => void;
|
|
888
|
+
private readonly panel;
|
|
889
|
+
/** The teleported listbox element (used for the blur containment guard). */
|
|
890
|
+
readonly list: Signal<ElementRef<HTMLUListElement> | undefined>;
|
|
891
|
+
constructor();
|
|
892
|
+
optionId(index: number): string;
|
|
893
|
+
protected pick(event: Event, index: number): void;
|
|
894
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkMentionPanel, never>;
|
|
895
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkMentionPanel, "mk-mention-panel", never, {}, {}, never, never, true, never>;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/** A single selectable option for {@link MkMultiSelect}. */
|
|
899
|
+
interface MkMultiSelectOption {
|
|
900
|
+
/** Text shown to the user (and used for the chip + typeahead). */
|
|
901
|
+
label: string;
|
|
902
|
+
/** The value committed to the form control when chosen. */
|
|
903
|
+
value: unknown;
|
|
904
|
+
/** Disable the option (skipped by keyboard + not selectable). */
|
|
905
|
+
disabled?: boolean;
|
|
906
|
+
}
|
|
907
|
+
/** How the option list is narrowed against the typed text. */
|
|
908
|
+
type MkMultiSelectFilterMode = 'contains' | 'startsWith' | 'none';
|
|
909
|
+
/**
|
|
910
|
+
* MultiSelect — an accessible combobox that commits **multiple** values,
|
|
911
|
+
* rendering each selection as a removable chip inside the control. Implements
|
|
912
|
+
* the ARIA combobox + multiselectable listbox pattern.
|
|
913
|
+
*
|
|
914
|
+
* Filtering is built in (`contains` / `startsWith`); set `filterMode="none"`
|
|
915
|
+
* and drive `options` from the `search` output for async / server-side sources.
|
|
916
|
+
* Selected options are remembered even after they leave the `options` list, so
|
|
917
|
+
* chips keep their labels across async pages.
|
|
918
|
+
*
|
|
919
|
+
* Implements `ControlValueAccessor` over an **array** value and exposes a
|
|
920
|
+
* two-way `value` model, so it works with `[(ngModel)]`, reactive forms and
|
|
921
|
+
* `[(value)]`. When nested in an `mk-form-field` it inherits size, label,
|
|
922
|
+
* hint/error and required wiring.
|
|
923
|
+
*
|
|
924
|
+
* Keyboard: type to filter, Up/Down to move, Home/End to jump, Enter/Space to
|
|
925
|
+
* toggle the active option, Backspace on an empty query removes the last chip,
|
|
926
|
+
* Escape closes. The dropdown renders in the top layer via
|
|
927
|
+
* {@link MkAnchoredPanel} so it is never clipped by a container.
|
|
928
|
+
*
|
|
929
|
+
* ```html
|
|
930
|
+
* <mk-multi-select placeholder="Add tags"
|
|
931
|
+
* [options]="tagOptions()"
|
|
932
|
+
* [(value)]="tags" />
|
|
933
|
+
* ```
|
|
934
|
+
*/
|
|
935
|
+
declare class MkMultiSelect implements ControlValueAccessor, Validator {
|
|
936
|
+
private readonly field;
|
|
937
|
+
private readonly host;
|
|
938
|
+
/** Localised strings (override globally via `provideMkI18n`). */
|
|
939
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
940
|
+
private readonly announcer;
|
|
941
|
+
private readonly inputRef;
|
|
942
|
+
/** The list of options to choose from. Update from `search` for async. */
|
|
943
|
+
readonly options: _angular_core.InputSignal<readonly MkMultiSelectOption[]>;
|
|
944
|
+
/** Placeholder shown when no value is selected. */
|
|
945
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
946
|
+
/** Control size. Ignored when nested in an `mk-form-field`. */
|
|
947
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
948
|
+
/** Force invalid styling + `aria-invalid` when used standalone. */
|
|
949
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
950
|
+
/** Disable the control. */
|
|
951
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
952
|
+
/** How the option list is filtered against the typed text. */
|
|
953
|
+
readonly filterMode: _angular_core.InputSignal<MkMultiSelectFilterMode>;
|
|
954
|
+
/** Only open the list once this many characters have been typed. */
|
|
955
|
+
readonly minChars: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
956
|
+
/** Show a loading row instead of "no results" (for async fetches). */
|
|
957
|
+
readonly loading: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
958
|
+
/** Maximum number of selections (0 = unlimited). */
|
|
959
|
+
readonly max: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
960
|
+
/** Close the dropdown after each selection. Default keeps it open. */
|
|
961
|
+
readonly closeOnSelect: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
962
|
+
/** Message shown when there are no matching options. */
|
|
963
|
+
readonly emptyMessage: _angular_core.InputSignal<string>;
|
|
964
|
+
/** Two-way selected values. */
|
|
965
|
+
readonly value: _angular_core.ModelSignal<unknown[]>;
|
|
966
|
+
/** Emits the current query text on every keystroke — drive async loading. */
|
|
967
|
+
readonly search: _angular_core.OutputEmitterRef<string>;
|
|
968
|
+
/** Emits the option whenever one is added. */
|
|
969
|
+
readonly optionAdded: _angular_core.OutputEmitterRef<MkMultiSelectOption>;
|
|
970
|
+
/** Emits the value whenever a selection is removed. */
|
|
971
|
+
readonly optionRemoved: _angular_core.OutputEmitterRef<unknown>;
|
|
972
|
+
protected readonly open: _angular_core.WritableSignal<boolean>;
|
|
973
|
+
protected readonly activeIndex: _angular_core.WritableSignal<number>;
|
|
974
|
+
protected readonly query: _angular_core.WritableSignal<string>;
|
|
975
|
+
private readonly cvaDisabled;
|
|
976
|
+
private onChange;
|
|
977
|
+
private onTouched;
|
|
978
|
+
readonly listId: string;
|
|
979
|
+
readonly inputId: string;
|
|
980
|
+
/**
|
|
981
|
+
* Every option ever seen, keyed by value — so chips keep their labels even
|
|
982
|
+
* after the option leaves the (async, filtered) `options` list.
|
|
983
|
+
*/
|
|
984
|
+
private readonly seen;
|
|
985
|
+
/** Last announced result count (guards repeat announcements). */
|
|
986
|
+
private lastAnnouncedCount;
|
|
987
|
+
/**
|
|
988
|
+
* Skips the next results-count announcement — set when a selection resets
|
|
989
|
+
* the query, so "x added" is not immediately clobbered by "n results".
|
|
990
|
+
*/
|
|
991
|
+
private suppressCountAnnouncement;
|
|
992
|
+
constructor();
|
|
993
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
994
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
995
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
996
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
997
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
998
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
999
|
+
/** Whether the selection cap has been reached. */
|
|
1000
|
+
protected readonly atMax: _angular_core.Signal<boolean>;
|
|
1001
|
+
/** Why unselected options are unavailable once the cap is reached. */
|
|
1002
|
+
protected readonly atMaxHint: _angular_core.Signal<string>;
|
|
1003
|
+
/** The selected values resolved to option objects (for the chips). */
|
|
1004
|
+
protected readonly chips: _angular_core.Signal<MkMultiSelectOption[]>;
|
|
1005
|
+
/** Options after the built-in filter (or all, when `none`). */
|
|
1006
|
+
protected readonly filtered: _angular_core.Signal<readonly MkMultiSelectOption[]>;
|
|
1007
|
+
protected readonly hasResults: _angular_core.Signal<boolean>;
|
|
1008
|
+
protected optionId(index: number): string;
|
|
1009
|
+
protected isSelected(value: unknown): boolean;
|
|
1010
|
+
protected onInput(event: Event): void;
|
|
1011
|
+
protected onFocus(): void;
|
|
1012
|
+
private openIfEligible;
|
|
1013
|
+
protected close(): void;
|
|
1014
|
+
/** Add or remove the option at `index` in the filtered list. */
|
|
1015
|
+
protected toggleOption(index: number): void;
|
|
1016
|
+
private add;
|
|
1017
|
+
private remove;
|
|
1018
|
+
/** Remove a chip from its remove button. */
|
|
1019
|
+
protected removeChip(value: unknown): void;
|
|
1020
|
+
protected onKeydown(event: Event): void;
|
|
1021
|
+
protected onBlur(event: Event): void;
|
|
1022
|
+
protected onOutsideDismiss(): void;
|
|
1023
|
+
/** Clicking anywhere in the control focuses the input. */
|
|
1024
|
+
protected onControlPointerdown(event: Event): void;
|
|
1025
|
+
private move;
|
|
1026
|
+
private firstEnabled;
|
|
1027
|
+
private lastEnabled;
|
|
1028
|
+
private focusInput;
|
|
1029
|
+
private setValue;
|
|
1030
|
+
writeValue(value: unknown[] | null): void;
|
|
1031
|
+
registerOnChange(fn: (value: unknown[]) => void): void;
|
|
1032
|
+
registerOnTouched(fn: () => void): void;
|
|
1033
|
+
setDisabledState(isDisabled: boolean): void;
|
|
1034
|
+
private readonly validatorChange;
|
|
1035
|
+
/**
|
|
1036
|
+
* Reports `mkMaxItems` when more options are selected than `[max]` allows.
|
|
1037
|
+
*/
|
|
1038
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
1039
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
1040
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkMultiSelect, never>;
|
|
1041
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkMultiSelect, "mk-multi-select", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "filterMode": { "alias": "filterMode"; "required": false; "isSignal": true; }; "minChars": { "alias": "minChars"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "closeOnSelect": { "alias": "closeOnSelect"; "required": false; "isSignal": true; }; "emptyMessage": { "alias": "emptyMessage"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "search": "search"; "optionAdded": "optionAdded"; "optionRemoved": "optionRemoved"; }, never, never, true, never>;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* TagInput — a freeform token input: type a value and press Enter (or a
|
|
1046
|
+
* separator) to add it as a removable chip. Backspace on an empty field removes
|
|
1047
|
+
* the last tag, and pasting a delimited string adds several at once. Unlike
|
|
1048
|
+
* `mk-multi-select` the tags are not drawn from a fixed option list. Implements
|
|
1049
|
+
* `ControlValueAccessor` + a two-way `value` model of `string[]`.
|
|
1050
|
+
*
|
|
1051
|
+
* ```html
|
|
1052
|
+
* <mk-tag-input placeholder="Add tags…" [(value)]="tags" />
|
|
1053
|
+
* ```
|
|
1054
|
+
*/
|
|
1055
|
+
declare class MkTagInput implements ControlValueAccessor, Validator {
|
|
1056
|
+
private readonly field;
|
|
1057
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
1058
|
+
private readonly announcer;
|
|
1059
|
+
private readonly host;
|
|
1060
|
+
private readonly injector;
|
|
1061
|
+
private readonly inputRef;
|
|
1062
|
+
/** Two-way list of tags. */
|
|
1063
|
+
readonly value: _angular_core.ModelSignal<string[]>;
|
|
1064
|
+
/** Placeholder shown in the text field. */
|
|
1065
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
1066
|
+
/** Maximum number of tags (0 = unlimited). */
|
|
1067
|
+
readonly max: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
1068
|
+
/** Allow the same tag more than once. */
|
|
1069
|
+
readonly allowDuplicates: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1070
|
+
/** Commit the pending text as a tag when the field loses focus. */
|
|
1071
|
+
readonly addOnBlur: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1072
|
+
/**
|
|
1073
|
+
* Extra characters that commit the pending text (Enter always does). A
|
|
1074
|
+
* pasted string is split on these too. Default: comma.
|
|
1075
|
+
*/
|
|
1076
|
+
readonly separators: _angular_core.InputSignal<readonly string[]>;
|
|
1077
|
+
/** Force invalid styling + `aria-invalid` when used standalone. */
|
|
1078
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1079
|
+
/** Disable the control. */
|
|
1080
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1081
|
+
/** Control size. Ignored when nested in an `mk-form-field`. */
|
|
1082
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
1083
|
+
/** Emitted when a tag is added. */
|
|
1084
|
+
readonly added: _angular_core.OutputEmitterRef<string>;
|
|
1085
|
+
/** Emitted when a tag is removed. */
|
|
1086
|
+
readonly removed: _angular_core.OutputEmitterRef<string>;
|
|
1087
|
+
protected readonly query: _angular_core.WritableSignal<string>;
|
|
1088
|
+
private readonly cvaDisabled;
|
|
1089
|
+
private onChange;
|
|
1090
|
+
private onTouched;
|
|
1091
|
+
readonly inputId: string;
|
|
1092
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
1093
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
1094
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
1095
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
1096
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
1097
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
1098
|
+
protected readonly atMax: _angular_core.Signal<boolean>;
|
|
1099
|
+
protected focusInput(): void;
|
|
1100
|
+
protected onQueryInput(event: Event): void;
|
|
1101
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
1102
|
+
protected onPaste(event: ClipboardEvent): void;
|
|
1103
|
+
protected onBlur(): void;
|
|
1104
|
+
private splitPattern;
|
|
1105
|
+
private commit;
|
|
1106
|
+
/**
|
|
1107
|
+
* Reset the pending text. A one-way `[value]="query()"` binding does not
|
|
1108
|
+
* reliably push an empty value back onto an input the user has just edited,
|
|
1109
|
+
* so clear the native element directly as well as the signal.
|
|
1110
|
+
*/
|
|
1111
|
+
private clearQuery;
|
|
1112
|
+
protected removeAt(index: number): boolean;
|
|
1113
|
+
/**
|
|
1114
|
+
* Remove a chip via its remove button. The button disappears with the chip,
|
|
1115
|
+
* so keep focus useful: the next chip's remove button, else the previous
|
|
1116
|
+
* one's, else the text input.
|
|
1117
|
+
*/
|
|
1118
|
+
protected removeChipAt(index: number): void;
|
|
1119
|
+
private setValue;
|
|
1120
|
+
writeValue(value: string[] | null): void;
|
|
1121
|
+
registerOnChange(fn: (value: string[]) => void): void;
|
|
1122
|
+
registerOnTouched(fn: () => void): void;
|
|
1123
|
+
setDisabledState(isDisabled: boolean): void;
|
|
1124
|
+
private readonly validatorChange;
|
|
1125
|
+
/**
|
|
1126
|
+
* Reports `mkMaxItems` when more tags are present than `[max]` allows.
|
|
1127
|
+
*/
|
|
1128
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
1129
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
1130
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkTagInput, never>;
|
|
1131
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkTagInput, "mk-tag-input", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "allowDuplicates": { "alias": "allowDuplicates"; "required": false; "isSignal": true; }; "addOnBlur": { "alias": "addOnBlur"; "required": false; "isSignal": true; }; "separators": { "alias": "separators"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "added": "added"; "removed": "removed"; }, never, never, true, never>;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/** A single password rule with its current pass/fail state. */
|
|
1135
|
+
interface MkPasswordRule {
|
|
1136
|
+
readonly key: 'length' | 'uppercase' | 'number' | 'symbol';
|
|
1137
|
+
readonly label: string;
|
|
1138
|
+
readonly met: boolean;
|
|
1139
|
+
}
|
|
1140
|
+
/**
|
|
1141
|
+
* PasswordInput — a password field with a reveal toggle, an optional strength
|
|
1142
|
+
* meter and an optional rules checklist. Implements `ControlValueAccessor` over
|
|
1143
|
+
* `string` with a two-way `value` model, and wires label / description /
|
|
1144
|
+
* validity a11y automatically when nested in an `mk-form-field`.
|
|
1145
|
+
*
|
|
1146
|
+
* ```html
|
|
1147
|
+
* <mk-password-input [(value)]="pw" showStrength showRules [minLength]="10" />
|
|
1148
|
+
* ```
|
|
1149
|
+
*/
|
|
1150
|
+
declare class MkPasswordInput implements ControlValueAccessor, Validator {
|
|
1151
|
+
private readonly field;
|
|
1152
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
1153
|
+
private readonly inputRef;
|
|
1154
|
+
/** Two-way value. */
|
|
1155
|
+
readonly value: _angular_core.ModelSignal<string>;
|
|
1156
|
+
/** Placeholder when empty. */
|
|
1157
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
1158
|
+
/** Disable the control. */
|
|
1159
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1160
|
+
/** Control size. Ignored inside an `mk-form-field`. */
|
|
1161
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
1162
|
+
/** Force invalid styling when standalone. */
|
|
1163
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1164
|
+
/** Show the 0–4 strength meter below the field. */
|
|
1165
|
+
readonly showStrength: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1166
|
+
/** Show the rules checklist below the field. */
|
|
1167
|
+
readonly showRules: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1168
|
+
/** Minimum length used by the strength score and rules. */
|
|
1169
|
+
readonly minLength: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
1170
|
+
/**
|
|
1171
|
+
* `autocomplete` for the native input. Use `'new-password'` on signup /
|
|
1172
|
+
* change-password forms (where the strength meter and rules belong) so the
|
|
1173
|
+
* browser offers a generated password instead of the saved one.
|
|
1174
|
+
*/
|
|
1175
|
+
readonly autocomplete: _angular_core.InputSignal<(string & {}) | "current-password" | "new-password">;
|
|
1176
|
+
protected readonly inputId: string;
|
|
1177
|
+
protected readonly strengthId: string;
|
|
1178
|
+
protected readonly rulesId: string;
|
|
1179
|
+
/** Whether the password characters are currently visible. */
|
|
1180
|
+
protected readonly revealed: _angular_core.WritableSignal<boolean>;
|
|
1181
|
+
private readonly cvaDisabled;
|
|
1182
|
+
private onChange;
|
|
1183
|
+
private onTouched;
|
|
1184
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
1185
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
1186
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
1187
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
1188
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
1189
|
+
/** The four rules and whether the current value satisfies each. */
|
|
1190
|
+
protected readonly rules: _angular_core.Signal<MkPasswordRule[]>;
|
|
1191
|
+
/**
|
|
1192
|
+
* Password strength as a 0–4 score, counting distinct character classes
|
|
1193
|
+
* (lowercase, uppercase, digit, symbol) plus a length ≥ minLength bonus,
|
|
1194
|
+
* capped at 4.
|
|
1195
|
+
*/
|
|
1196
|
+
protected readonly strength: _angular_core.Signal<number>;
|
|
1197
|
+
protected readonly strengthLabel: _angular_core.Signal<string>;
|
|
1198
|
+
/** The 4 meter segments, marked filled up to the current score. */
|
|
1199
|
+
protected readonly segments: _angular_core.Signal<boolean[]>;
|
|
1200
|
+
/** Combined `aria-describedby` for the input, or `null`. */
|
|
1201
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
1202
|
+
protected toggleReveal(): void;
|
|
1203
|
+
protected onInput(event: Event): void;
|
|
1204
|
+
protected onBlur(): void;
|
|
1205
|
+
writeValue(value: string | null): void;
|
|
1206
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
1207
|
+
registerOnTouched(fn: () => void): void;
|
|
1208
|
+
setDisabledState(isDisabled: boolean): void;
|
|
1209
|
+
private readonly validatorChange;
|
|
1210
|
+
/**
|
|
1211
|
+
* Reports `minlength` for a password shorter than `[minLength]` — the same
|
|
1212
|
+
* requirement the rules list shows. An empty value passes; compose with
|
|
1213
|
+
* `Validators.required` to reject it.
|
|
1214
|
+
*/
|
|
1215
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
1216
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
1217
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkPasswordInput, never>;
|
|
1218
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkPasswordInput, "mk-password-input", ["mkPasswordInput"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "showStrength": { "alias": "showStrength"; "required": false; "isSignal": true; }; "showRules": { "alias": "showRules"; "required": false; "isSignal": true; }; "minLength": { "alias": "minLength"; "required": false; "isSignal": true; }; "autocomplete": { "alias": "autocomplete"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
/** A single transferable item for {@link MkTransferList}. */
|
|
1222
|
+
interface MkTransferItem {
|
|
1223
|
+
/** The value committed to the form control when the item is in the selected list. */
|
|
1224
|
+
value: unknown;
|
|
1225
|
+
/** Text shown to the user. */
|
|
1226
|
+
label: string;
|
|
1227
|
+
/** Disable the item (cannot be checked or moved). */
|
|
1228
|
+
disabled?: boolean;
|
|
1229
|
+
}
|
|
1230
|
+
/** Which of the two lists a row belongs to. */
|
|
1231
|
+
type MkTransferSide = 'available' | 'selected';
|
|
1232
|
+
/**
|
|
1233
|
+
* TransferList — a dual list box (a.k.a. pick list) for moving items between an
|
|
1234
|
+
* **available** list and a **selected** list, e.g. assigning roles or
|
|
1235
|
+
* permissions. The user checks rows in one list then clicks the middle move
|
|
1236
|
+
* buttons (or presses Enter on a row) to shuttle them across.
|
|
1237
|
+
*
|
|
1238
|
+
* Implements `ControlValueAccessor` over an **array** value (the values in the
|
|
1239
|
+
* selected list) and exposes a two-way `value` model, so it works with
|
|
1240
|
+
* `[(ngModel)]`, reactive forms and `[(value)]`. When nested in an
|
|
1241
|
+
* `mk-form-field` it inherits size and label wiring.
|
|
1242
|
+
*
|
|
1243
|
+
* Keyboard: each listbox is a single tab stop (roving tabindex). Arrow Up/Down
|
|
1244
|
+
* and Home/End move between rows, Space toggles a row's check and Enter moves
|
|
1245
|
+
* it to the opposite list.
|
|
1246
|
+
*
|
|
1247
|
+
* ```html
|
|
1248
|
+
* <mk-transfer-list filterable
|
|
1249
|
+
* [items]="allRoles()"
|
|
1250
|
+
* [(value)]="assignedRoles"
|
|
1251
|
+
* availableLabel="All roles"
|
|
1252
|
+
* selectedLabel="Assigned" />
|
|
1253
|
+
* ```
|
|
1254
|
+
*/
|
|
1255
|
+
declare class MkTransferList implements ControlValueAccessor {
|
|
1256
|
+
private readonly host;
|
|
1257
|
+
private readonly field;
|
|
1258
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
1259
|
+
private readonly announcer;
|
|
1260
|
+
private readonly injector;
|
|
1261
|
+
private readonly availableOptEls;
|
|
1262
|
+
private readonly selectedOptEls;
|
|
1263
|
+
private readonly availableListEl;
|
|
1264
|
+
private readonly selectedListEl;
|
|
1265
|
+
/** The full set of items to shuttle between the two lists. */
|
|
1266
|
+
readonly items: _angular_core.InputSignal<readonly MkTransferItem[]>;
|
|
1267
|
+
/** Heading for the left (available) list. */
|
|
1268
|
+
readonly availableLabel: _angular_core.InputSignal<string>;
|
|
1269
|
+
/** Heading for the right (selected) list. */
|
|
1270
|
+
readonly selectedLabel: _angular_core.InputSignal<string>;
|
|
1271
|
+
/** Show a search box over each list. */
|
|
1272
|
+
readonly filterable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1273
|
+
/** Disable the whole control. */
|
|
1274
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1275
|
+
/** Force invalid styling + `aria-invalid` when used standalone. */
|
|
1276
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1277
|
+
/** Control size. Ignored when nested in an `mk-form-field`. */
|
|
1278
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
1279
|
+
/** Two-way values currently in the selected (right) list. */
|
|
1280
|
+
readonly value: _angular_core.ModelSignal<unknown[]>;
|
|
1281
|
+
/** Emits the new selected values whenever items are moved. */
|
|
1282
|
+
readonly change: _angular_core.OutputEmitterRef<unknown[]>;
|
|
1283
|
+
private readonly cvaDisabled;
|
|
1284
|
+
/** Values checked in each list, awaiting a move. */
|
|
1285
|
+
private readonly checkedAvailable;
|
|
1286
|
+
private readonly checkedSelected;
|
|
1287
|
+
/** Per-list search queries (only used when `filterable`). */
|
|
1288
|
+
protected readonly availableQuery: _angular_core.WritableSignal<string>;
|
|
1289
|
+
protected readonly selectedQuery: _angular_core.WritableSignal<string>;
|
|
1290
|
+
/** Roving-tabindex active option index per list. */
|
|
1291
|
+
private readonly activeAvailable;
|
|
1292
|
+
private readonly activeSelected;
|
|
1293
|
+
private onChange;
|
|
1294
|
+
private onTouched;
|
|
1295
|
+
readonly baseId: string;
|
|
1296
|
+
readonly availableListId: string;
|
|
1297
|
+
readonly selectedListId: string;
|
|
1298
|
+
readonly availableLabelId: string;
|
|
1299
|
+
readonly selectedLabelId: string;
|
|
1300
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
1301
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
1302
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
1303
|
+
/** Items keyed by value, for resolving the selected order. */
|
|
1304
|
+
private readonly byValue;
|
|
1305
|
+
/** Items not currently in the value (in `items` order). */
|
|
1306
|
+
protected readonly available: _angular_core.Signal<readonly MkTransferItem[]>;
|
|
1307
|
+
/** Items currently in the value, preserving the value array order. */
|
|
1308
|
+
protected readonly selected: _angular_core.Signal<readonly MkTransferItem[]>;
|
|
1309
|
+
protected readonly filteredAvailable: _angular_core.Signal<readonly MkTransferItem[]>;
|
|
1310
|
+
protected readonly filteredSelected: _angular_core.Signal<readonly MkTransferItem[]>;
|
|
1311
|
+
private applyFilter;
|
|
1312
|
+
/** Whether the "move right" controls are actionable. */
|
|
1313
|
+
protected readonly canMoveRight: _angular_core.Signal<boolean>;
|
|
1314
|
+
/** Whether the "move left" controls are actionable. */
|
|
1315
|
+
protected readonly canMoveLeft: _angular_core.Signal<boolean>;
|
|
1316
|
+
protected readonly canMoveAllRight: _angular_core.Signal<boolean>;
|
|
1317
|
+
protected readonly canMoveAllLeft: _angular_core.Signal<boolean>;
|
|
1318
|
+
protected isChecked(side: MkTransferSide, value: unknown): boolean;
|
|
1319
|
+
private checkedFor;
|
|
1320
|
+
/** Toggle a row's checked state (Space / click on the row). */
|
|
1321
|
+
protected toggleCheck(side: MkTransferSide, item: MkTransferItem): void;
|
|
1322
|
+
protected onQueryInput(side: MkTransferSide, event: Event): void;
|
|
1323
|
+
private filteredFor;
|
|
1324
|
+
private activeSignalFor;
|
|
1325
|
+
/** The active (tabbable) option index for a list, clamped to its length. */
|
|
1326
|
+
protected activeIdx(side: MkTransferSide): number;
|
|
1327
|
+
/** Keep the roving index in sync when an option is focused (e.g. by click). */
|
|
1328
|
+
protected setActive(side: MkTransferSide, index: number): void;
|
|
1329
|
+
/** Move the active index and focus that option. */
|
|
1330
|
+
private moveActive;
|
|
1331
|
+
private focusOption;
|
|
1332
|
+
/**
|
|
1333
|
+
* After a move, keep focus useful: focus the source list's next remaining
|
|
1334
|
+
* option, or the (empty) list element itself.
|
|
1335
|
+
*/
|
|
1336
|
+
private focusAfterMove;
|
|
1337
|
+
private announceMove;
|
|
1338
|
+
protected onRowKeydown(side: MkTransferSide, item: MkTransferItem, event: Event): void;
|
|
1339
|
+
/** Move a single item to the opposite list (Enter on a row). */
|
|
1340
|
+
private moveOne;
|
|
1341
|
+
/** Move all checked available items into the selected list. */
|
|
1342
|
+
protected moveRight(): void;
|
|
1343
|
+
/** Move all checked selected items back to the available list. */
|
|
1344
|
+
protected moveLeft(): void;
|
|
1345
|
+
/** Move every movable available item into the selected list. */
|
|
1346
|
+
protected moveAllRight(): void;
|
|
1347
|
+
/** Move every movable selected item back to the available list. */
|
|
1348
|
+
protected moveAllLeft(): void;
|
|
1349
|
+
private uncheck;
|
|
1350
|
+
private commit;
|
|
1351
|
+
/**
|
|
1352
|
+
* Marks the control touched once focus leaves it entirely, so a form that
|
|
1353
|
+
* gates its errors on `touched` behaves the same here as on a native input.
|
|
1354
|
+
*/
|
|
1355
|
+
protected onFocusOut(event: FocusEvent): void;
|
|
1356
|
+
writeValue(value: unknown[] | null): void;
|
|
1357
|
+
registerOnChange(fn: (value: unknown[]) => void): void;
|
|
1358
|
+
registerOnTouched(fn: () => void): void;
|
|
1359
|
+
setDisabledState(isDisabled: boolean): void;
|
|
1360
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkTransferList, never>;
|
|
1361
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkTransferList, "mk-transfer-list", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "availableLabel": { "alias": "availableLabel"; "required": false; "isSignal": true; }; "selectedLabel": { "alias": "selectedLabel"; "required": false; "isSignal": true; }; "filterable": { "alias": "filterable"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "change": "change"; }, never, never, true, never>;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
/** Template context for a {@link MkRepeaterRow} row template. */
|
|
1365
|
+
interface MkRepeaterRowContext<T> {
|
|
1366
|
+
/** The row's item — destructure with `let-item`. */
|
|
1367
|
+
$implicit: T;
|
|
1368
|
+
/** The row's current index — destructure with `let-i="index"`. */
|
|
1369
|
+
index: number;
|
|
1370
|
+
}
|
|
1371
|
+
/**
|
|
1372
|
+
* Marks an `<ng-template>` as the row template for {@link MkRepeater}. The
|
|
1373
|
+
* template receives the item as its implicit context plus its `index`:
|
|
1374
|
+
*
|
|
1375
|
+
* ```html
|
|
1376
|
+
* <ng-template mkRepeaterRow let-item let-i="index">
|
|
1377
|
+
* <input mkInput [(ngModel)]="item.name" />
|
|
1378
|
+
* </ng-template>
|
|
1379
|
+
* ```
|
|
1380
|
+
*/
|
|
1381
|
+
declare class MkRepeaterRow<T = unknown> {
|
|
1382
|
+
/** The projected row template, rendered once per item. */
|
|
1383
|
+
readonly template: TemplateRef<MkRepeaterRowContext<T>>;
|
|
1384
|
+
static ngTemplateContextGuard<T>(_dir: MkRepeaterRow<T>, _ctx: unknown): _ctx is MkRepeaterRowContext<T>;
|
|
1385
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkRepeaterRow<any>, never>;
|
|
1386
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MkRepeaterRow<any>, "[mkRepeaterRow]", never, {}, {}, never, never, true, never>;
|
|
1387
|
+
}
|
|
1388
|
+
/**
|
|
1389
|
+
* Marks an `<ng-template>` as {@link MkRepeater}'s custom empty state, shown
|
|
1390
|
+
* instead of the row list while there are no items.
|
|
1391
|
+
*/
|
|
1392
|
+
declare class MkRepeaterEmpty {
|
|
1393
|
+
/** The projected empty-state template. */
|
|
1394
|
+
readonly template: TemplateRef<any>;
|
|
1395
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkRepeaterEmpty, never>;
|
|
1396
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MkRepeaterEmpty, "[mkRepeaterEmpty]", never, {}, {}, never, never, true, never>;
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* Repeater — the schema-friendly editable list: renders one instance of a
|
|
1400
|
+
* consumer-projected row template per item, with add / remove / (optional)
|
|
1401
|
+
* drag-and-drop + keyboard reorder built in.
|
|
1402
|
+
*
|
|
1403
|
+
* `items` is a two-way model and the component also implements
|
|
1404
|
+
* `ControlValueAccessor` over `T[]`, so it drops into template-driven and
|
|
1405
|
+
* reactive forms alike. **Every mutation produces a new array** — the
|
|
1406
|
+
* consumer's array is never mutated in place.
|
|
1407
|
+
*
|
|
1408
|
+
* Rows are tracked by **item object identity** (stable across the repeater's
|
|
1409
|
+
* immutable array copies), so removing a middle row keeps the following rows'
|
|
1410
|
+
* DOM — and any in-progress input state — intact. Consequently, arrays of
|
|
1411
|
+
* primitives with duplicate values (e.g. `['a', 'a']`) are not supported
|
|
1412
|
+
* directly: wrap each value in an object (`{ value: 'a' }`) so every row has
|
|
1413
|
+
* a distinct identity.
|
|
1414
|
+
*
|
|
1415
|
+
* With `reorderable`, each row gets a drag handle wired through the dnd
|
|
1416
|
+
* module's touch-safe handle-based configuration (a swipe on the row body
|
|
1417
|
+
* still scrolls the page). Reordering also works by keyboard: focus the
|
|
1418
|
+
* handle (or the row) and press Space/Enter to pick up, arrows to move,
|
|
1419
|
+
* Space/Enter to drop, Escape to cancel. Each completed reorder is announced
|
|
1420
|
+
* via {@link MkLiveAnnouncer}.
|
|
1421
|
+
*
|
|
1422
|
+
* ```html
|
|
1423
|
+
* <mk-repeater [(items)]="rows" [min]="1" [max]="10" reorderable
|
|
1424
|
+
* [factory]="newRow" addLabel="Add row">
|
|
1425
|
+
* <ng-template mkRepeaterRow let-item let-i="index">
|
|
1426
|
+
* <input mkInput [(ngModel)]="item.name" />
|
|
1427
|
+
* </ng-template>
|
|
1428
|
+
* <ng-template mkRepeaterEmpty>No rows yet.</ng-template>
|
|
1429
|
+
* </mk-repeater>
|
|
1430
|
+
* ```
|
|
1431
|
+
*
|
|
1432
|
+
* @typeParam T item data type.
|
|
1433
|
+
*/
|
|
1434
|
+
declare class MkRepeater<T = unknown> implements ControlValueAccessor {
|
|
1435
|
+
/** Localised strings (override globally via `provideMkI18n`). */
|
|
1436
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
1437
|
+
private readonly announcer;
|
|
1438
|
+
/** The rows (two-way). Every mutation sets a **new** array. */
|
|
1439
|
+
readonly items: _angular_core.ModelSignal<T[]>;
|
|
1440
|
+
/** Creates the item appended by the add button. Default: `{}` cast to `T`. */
|
|
1441
|
+
readonly factory: _angular_core.InputSignal<() => T>;
|
|
1442
|
+
/** Minimum number of rows — remove buttons disable at (or below) it. */
|
|
1443
|
+
readonly min: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
1444
|
+
/** Maximum number of rows (0 = unlimited) — the add button disables at it. */
|
|
1445
|
+
readonly max: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
1446
|
+
/** Enable per-row drag handles (pointer + keyboard reorder). */
|
|
1447
|
+
readonly reorderable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1448
|
+
/** Disable the whole control (add, remove and reorder). */
|
|
1449
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1450
|
+
/** Add-button caption. Defaults to the i18n `repeaterAddRow` string. */
|
|
1451
|
+
readonly addLabel: _angular_core.InputSignal<string>;
|
|
1452
|
+
/** Emitted after the add button appended a factory-made item. */
|
|
1453
|
+
readonly added: _angular_core.OutputEmitterRef<{
|
|
1454
|
+
item: T;
|
|
1455
|
+
index: number;
|
|
1456
|
+
}>;
|
|
1457
|
+
/** Emitted after a row was removed. */
|
|
1458
|
+
readonly removed: _angular_core.OutputEmitterRef<{
|
|
1459
|
+
item: T;
|
|
1460
|
+
index: number;
|
|
1461
|
+
}>;
|
|
1462
|
+
/** Emitted after a row was reordered (drag or keyboard). */
|
|
1463
|
+
readonly moved: _angular_core.OutputEmitterRef<{
|
|
1464
|
+
from: number;
|
|
1465
|
+
to: number;
|
|
1466
|
+
}>;
|
|
1467
|
+
/** The projected `[mkRepeaterRow]` row template (required). */
|
|
1468
|
+
protected readonly rowTemplate: _angular_core.Signal<MkRepeaterRow<T>>;
|
|
1469
|
+
/** The optional `[mkRepeaterEmpty]` empty-state template. */
|
|
1470
|
+
protected readonly emptyTemplate: _angular_core.Signal<MkRepeaterEmpty | undefined>;
|
|
1471
|
+
private readonly cvaDisabled;
|
|
1472
|
+
private onChange;
|
|
1473
|
+
private onTouched;
|
|
1474
|
+
/** Effective disabled state (input- or form-driven). */
|
|
1475
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
1476
|
+
/** Whether the row cap has been reached (add disables). */
|
|
1477
|
+
protected readonly atMax: _angular_core.Signal<boolean>;
|
|
1478
|
+
/** Whether the row floor has been reached (remove disables). */
|
|
1479
|
+
protected readonly atMin: _angular_core.Signal<boolean>;
|
|
1480
|
+
/** The add button's caption (input, falling back to i18n). */
|
|
1481
|
+
protected readonly effectiveAddLabel: _angular_core.Signal<string>;
|
|
1482
|
+
/** Append a new `factory()` item (no-op when disabled or at `max`). */
|
|
1483
|
+
protected add(): void;
|
|
1484
|
+
/** Remove the row at `index` (no-op when disabled or at `min`). */
|
|
1485
|
+
protected removeAt(index: number): void;
|
|
1486
|
+
/** Apply a dnd drop (pointer or keyboard) to a **copy** of the array. */
|
|
1487
|
+
protected onDrop(event: MkDropEvent<T>): void;
|
|
1488
|
+
/**
|
|
1489
|
+
* Keep keys typed into the projected row content (and pressed on the remove
|
|
1490
|
+
* button) from bubbling to the row's `[mkDrag]` host, where Space/Enter
|
|
1491
|
+
* would pick the row up for keyboard dragging. Reordering by keyboard stays
|
|
1492
|
+
* available from the drag handle and the row element itself.
|
|
1493
|
+
*/
|
|
1494
|
+
protected onContentKeydown(event: Event): void;
|
|
1495
|
+
private setItems;
|
|
1496
|
+
writeValue(value: T[] | null): void;
|
|
1497
|
+
registerOnChange(fn: (value: T[]) => void): void;
|
|
1498
|
+
registerOnTouched(fn: () => void): void;
|
|
1499
|
+
setDisabledState(isDisabled: boolean): void;
|
|
1500
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkRepeater<any>, never>;
|
|
1501
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkRepeater<any>, "mk-repeater", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "factory": { "alias": "factory"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "reorderable": { "alias": "reorderable"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "addLabel": { "alias": "addLabel"; "required": false; "isSignal": true; }; }, { "items": "itemsChange"; "added": "added"; "removed": "removed"; "moved": "moved"; }, ["rowTemplate", "emptyTemplate"], never, true, never>;
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
/**
|
|
1505
|
+
* TreeSelect — a form field whose popover contains a hierarchical
|
|
1506
|
+
* {@link MkTree}. The trigger shows the selected node's label (or a
|
|
1507
|
+
* placeholder); opening it reveals a selectable tree rendered in the top layer
|
|
1508
|
+
* via {@link MkAnchoredPanel}, so it is never clipped. Choosing a node sets the
|
|
1509
|
+
* value to that node's `value` (or the node itself when `value` is unset),
|
|
1510
|
+
* closes the panel and restores focus to the trigger. Implements
|
|
1511
|
+
* `ControlValueAccessor` and a two-way `value` model.
|
|
1512
|
+
*
|
|
1513
|
+
* ```html
|
|
1514
|
+
* <mk-tree-select [nodes]="tree" [(value)]="picked" clearable />
|
|
1515
|
+
* ```
|
|
1516
|
+
*/
|
|
1517
|
+
declare class MkTreeSelect implements ControlValueAccessor {
|
|
1518
|
+
private readonly field;
|
|
1519
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
1520
|
+
private readonly host;
|
|
1521
|
+
private readonly injector;
|
|
1522
|
+
private readonly triggerRef;
|
|
1523
|
+
private readonly panelRef;
|
|
1524
|
+
/** The hierarchical data to render in the panel. */
|
|
1525
|
+
readonly nodes: _angular_core.InputSignal<readonly MkTreeNode[]>;
|
|
1526
|
+
/** Two-way selected value (a node's `value`, or the node itself if unset). */
|
|
1527
|
+
readonly value: _angular_core.ModelSignal<unknown>;
|
|
1528
|
+
/** Placeholder shown when nothing is selected. */
|
|
1529
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
1530
|
+
/** Disable the control. */
|
|
1531
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1532
|
+
/** Show a clear button when a value is selected. */
|
|
1533
|
+
readonly clearable: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1534
|
+
/** Force invalid styling. */
|
|
1535
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1536
|
+
/** Control size. Ignored when nested in an `mk-form-field`. */
|
|
1537
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
1538
|
+
protected readonly open: _angular_core.WritableSignal<boolean>;
|
|
1539
|
+
private readonly cvaDisabled;
|
|
1540
|
+
private onChange;
|
|
1541
|
+
private onTouched;
|
|
1542
|
+
readonly triggerId: string;
|
|
1543
|
+
readonly panelId: string;
|
|
1544
|
+
/** Id of the rendered value/placeholder span, appended to `aria-labelledby`. */
|
|
1545
|
+
readonly valueId: string;
|
|
1546
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
1547
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
1548
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
1549
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
1550
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
1551
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
1552
|
+
/** Label of the selected node (found by walking `nodes` recursively). */
|
|
1553
|
+
protected readonly selectedLabel: _angular_core.Signal<string>;
|
|
1554
|
+
protected toggle(): void;
|
|
1555
|
+
protected openPanel(): void;
|
|
1556
|
+
protected close(restoreFocus?: boolean): void;
|
|
1557
|
+
protected onTriggerKeydown(event: KeyboardEvent): void;
|
|
1558
|
+
protected onPanelKeydown(event: KeyboardEvent): void;
|
|
1559
|
+
/**
|
|
1560
|
+
* Focus left the teleported panel. The host `(focusout)` never sees this —
|
|
1561
|
+
* the panel lives under `document.body` — so Tab-out of the tree is handled
|
|
1562
|
+
* here: close unless focus moved back into the field or the panel.
|
|
1563
|
+
*/
|
|
1564
|
+
protected onPanelFocusout(event: FocusEvent): void;
|
|
1565
|
+
/** Handle a selection emitted by the tree (a value) or a node passed directly. */
|
|
1566
|
+
protected onPick(selected: unknown): void;
|
|
1567
|
+
protected clear(event: Event): void;
|
|
1568
|
+
protected onFocusOut(event: FocusEvent): void;
|
|
1569
|
+
/** Resolve the bound value for a node (or pass a primitive value through). */
|
|
1570
|
+
private valueOf;
|
|
1571
|
+
private findNode;
|
|
1572
|
+
private focusTree;
|
|
1573
|
+
writeValue(value: unknown | null): void;
|
|
1574
|
+
registerOnChange(fn: (value: unknown | null) => void): void;
|
|
1575
|
+
registerOnTouched(fn: () => void): void;
|
|
1576
|
+
setDisabledState(isDisabled: boolean): void;
|
|
1577
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkTreeSelect, never>;
|
|
1578
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkTreeSelect, "mk-tree-select", never, { "nodes": { "alias": "nodes"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "clearable": { "alias": "clearable"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
/** Upload lifecycle state for a single file. */
|
|
1582
|
+
type MkUploadStatus = 'pending' | 'uploading' | 'success' | 'error';
|
|
1583
|
+
/** A file tracked by {@link MkFileUpload}. */
|
|
1584
|
+
interface MkUploadFile {
|
|
1585
|
+
/** Stable id for tracking + removal. */
|
|
1586
|
+
id: string;
|
|
1587
|
+
/** The underlying browser `File`. */
|
|
1588
|
+
file: File;
|
|
1589
|
+
/** File name. */
|
|
1590
|
+
name: string;
|
|
1591
|
+
/** Size in bytes. */
|
|
1592
|
+
size: number;
|
|
1593
|
+
/** Upload lifecycle state. */
|
|
1594
|
+
status: MkUploadStatus;
|
|
1595
|
+
/** Upload progress, 0–100. */
|
|
1596
|
+
progress: number;
|
|
1597
|
+
/** Failure reason (validation or upload error). */
|
|
1598
|
+
error?: string;
|
|
1599
|
+
/** Object URL for an image preview, when the file is an image. */
|
|
1600
|
+
previewUrl?: string;
|
|
1601
|
+
}
|
|
1602
|
+
/** Why a dropped/selected file was rejected. */
|
|
1603
|
+
interface MkUploadRejection {
|
|
1604
|
+
file: File;
|
|
1605
|
+
reason: 'type' | 'size' | 'maxFiles';
|
|
1606
|
+
message: string;
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Uploads the given file, reporting progress via `onProgress` (0–100) and
|
|
1610
|
+
* resolving on success / rejecting (optionally with an `Error`) on failure.
|
|
1611
|
+
*/
|
|
1612
|
+
type MkUploadFn = (file: File, onProgress: (percent: number) => void) => Promise<void>;
|
|
1613
|
+
/**
|
|
1614
|
+
* What {@link MkFileUpload} publishes as its form value: the raw browser
|
|
1615
|
+
* `File`s (the default, and what you would send in a `FormData`), or the full
|
|
1616
|
+
* tracked items including upload status and progress.
|
|
1617
|
+
*/
|
|
1618
|
+
type MkUploadValueFormat = 'file' | 'item';
|
|
1619
|
+
/**
|
|
1620
|
+
* FileUpload — an accessible click-or-drag dropzone with multi-file support,
|
|
1621
|
+
* type/size/count validation, image thumbnails and per-file progress.
|
|
1622
|
+
*
|
|
1623
|
+
* Provide an `uploadFn` to stream each accepted file to your backend (it
|
|
1624
|
+
* reports progress and resolves/rejects); with `autoUpload` (on by default when
|
|
1625
|
+
* an `uploadFn` is set) files upload as soon as they are accepted. Without one,
|
|
1626
|
+
* the component just validates + tracks files and emits `filesSelected` for you
|
|
1627
|
+
* to handle. The tracked list is a two-way `files` model so you can reset it.
|
|
1628
|
+
*
|
|
1629
|
+
* Keyboard: the dropzone is a button — Enter/Space opens the native picker.
|
|
1630
|
+
* Rejections are announced through a polite live region.
|
|
1631
|
+
*
|
|
1632
|
+
* Implements `ControlValueAccessor` and `Validator`, so it drops into a
|
|
1633
|
+
* reactive form like any other control. The form value is `File[]` by default
|
|
1634
|
+
* (`[valueFormat]="'item'"` publishes the tracked `MkUploadFile[]` instead),
|
|
1635
|
+
* and `accept` / `maxSize` / `maxFiles` are enforced as validation errors as
|
|
1636
|
+
* well as at pick time — a list written in from the model side is checked too.
|
|
1637
|
+
*
|
|
1638
|
+
* ```html
|
|
1639
|
+
* <mk-file-upload accept="image/*" multiple [maxSize]="5_000_000"
|
|
1640
|
+
* [uploadFn]="upload" (filesSelected)="onFiles($event)" [(files)]="files" />
|
|
1641
|
+
*
|
|
1642
|
+
* <mk-file-upload formControlName="attachments" accept=".pdf" [maxFiles]="3" />
|
|
1643
|
+
* ```
|
|
1644
|
+
*/
|
|
1645
|
+
declare class MkFileUpload implements ControlValueAccessor, Validator {
|
|
1646
|
+
private readonly host;
|
|
1647
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
1648
|
+
private readonly document;
|
|
1649
|
+
private readonly isBrowser;
|
|
1650
|
+
private readonly inputRef;
|
|
1651
|
+
/** Native `accept` filter, e.g. `image/*` or `.pdf,.doc`. */
|
|
1652
|
+
readonly accept: _angular_core.InputSignal<string>;
|
|
1653
|
+
/** Allow selecting more than one file. */
|
|
1654
|
+
readonly multiple: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1655
|
+
/** Maximum size per file in bytes (0 = unlimited). */
|
|
1656
|
+
readonly maxSize: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
1657
|
+
/** Maximum number of files kept (0 = unlimited). */
|
|
1658
|
+
readonly maxFiles: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
1659
|
+
/** Disable the control. */
|
|
1660
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1661
|
+
/** Force invalid styling when used standalone. */
|
|
1662
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1663
|
+
/** Primary dropzone prompt. */
|
|
1664
|
+
readonly label: _angular_core.InputSignal<string>;
|
|
1665
|
+
/** Secondary hint under the prompt (e.g. accepted types / size). */
|
|
1666
|
+
readonly hint: _angular_core.InputSignal<string>;
|
|
1667
|
+
/** Hide the built-in file list (render your own from `files`). */
|
|
1668
|
+
readonly hideList: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1669
|
+
/** Async upload handler. When set, files upload automatically. */
|
|
1670
|
+
readonly uploadFn: _angular_core.InputSignal<MkUploadFn | null>;
|
|
1671
|
+
/** Upload accepted files immediately. Defaults to true when `uploadFn` set. */
|
|
1672
|
+
readonly autoUpload: _angular_core.InputSignal<boolean | undefined>;
|
|
1673
|
+
/** Shape of the value published to a bound form control. */
|
|
1674
|
+
readonly valueFormat: _angular_core.InputSignal<MkUploadValueFormat>;
|
|
1675
|
+
/** The tracked files (two-way, so consumers can reset the list). */
|
|
1676
|
+
readonly files: _angular_core.ModelSignal<MkUploadFile[]>;
|
|
1677
|
+
/** Emits the accepted `File`s each time files are added. */
|
|
1678
|
+
readonly filesSelected: _angular_core.OutputEmitterRef<File[]>;
|
|
1679
|
+
/** Emits rejected files with a reason. */
|
|
1680
|
+
readonly rejected: _angular_core.OutputEmitterRef<MkUploadRejection[]>;
|
|
1681
|
+
/** Emits a file once its upload succeeds. */
|
|
1682
|
+
readonly uploaded: _angular_core.OutputEmitterRef<MkUploadFile>;
|
|
1683
|
+
/** Emits a file when it is removed from the list. */
|
|
1684
|
+
readonly removed: _angular_core.OutputEmitterRef<MkUploadFile>;
|
|
1685
|
+
protected readonly dragging: _angular_core.WritableSignal<boolean>;
|
|
1686
|
+
/** Latest rejection messages, surfaced in a polite live region. */
|
|
1687
|
+
protected readonly announcement: _angular_core.WritableSignal<string>;
|
|
1688
|
+
readonly inputId: string;
|
|
1689
|
+
/** Set by reactive forms through `setDisabledState`. */
|
|
1690
|
+
private readonly cvaDisabled;
|
|
1691
|
+
/** Disabled either by the `disabled` input or by the bound form control. */
|
|
1692
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
1693
|
+
private onChange;
|
|
1694
|
+
private onTouched;
|
|
1695
|
+
/** Guards `writeValue` from echoing back through `onChange`. */
|
|
1696
|
+
private writing;
|
|
1697
|
+
protected readonly shouldAutoUpload: _angular_core.Signal<boolean>;
|
|
1698
|
+
protected openPicker(): void;
|
|
1699
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
1700
|
+
protected onInputChange(event: Event): void;
|
|
1701
|
+
protected onDragOver(event: DragEvent): void;
|
|
1702
|
+
protected onDragLeave(event: DragEvent): void;
|
|
1703
|
+
protected onDrop(event: DragEvent): void;
|
|
1704
|
+
/** Validate + track a batch of files, uploading them when configured. */
|
|
1705
|
+
private addFiles;
|
|
1706
|
+
/** Remove a tracked file. */
|
|
1707
|
+
protected remove(item: MkUploadFile): void;
|
|
1708
|
+
/** Retry a failed upload. */
|
|
1709
|
+
protected retry(item: MkUploadFile): void;
|
|
1710
|
+
private upload;
|
|
1711
|
+
/** Immutably update one tracked file by id. */
|
|
1712
|
+
private patch;
|
|
1713
|
+
private toItem;
|
|
1714
|
+
private revoke;
|
|
1715
|
+
private matchesAccept;
|
|
1716
|
+
protected formatBytes(bytes: number): string;
|
|
1717
|
+
/**
|
|
1718
|
+
* Revoke preview object-URLs for items that leave the two-way `files` model
|
|
1719
|
+
* externally (e.g. a consumer resetting the list), not just via `remove()`.
|
|
1720
|
+
*/
|
|
1721
|
+
private readonly trackedPreviews;
|
|
1722
|
+
private readonly trackPreviews;
|
|
1723
|
+
ngOnDestroy(): void;
|
|
1724
|
+
/** Marks the control touched once focus leaves the dropzone and its list. */
|
|
1725
|
+
protected onFocusOut(event: FocusEvent): void;
|
|
1726
|
+
/** The value published to a bound form control, in the requested shape. */
|
|
1727
|
+
private readonly formValue;
|
|
1728
|
+
/**
|
|
1729
|
+
* Last value handed to `onChange`, for change detection against `formValue`.
|
|
1730
|
+
* `null` suppresses the next emission — used for the initial render and for
|
|
1731
|
+
* every `writeValue`, so writing from the model side never dirties the
|
|
1732
|
+
* control or loops back.
|
|
1733
|
+
*/
|
|
1734
|
+
private lastEmitted;
|
|
1735
|
+
private readonly emitOnChange;
|
|
1736
|
+
writeValue(value: unknown): void;
|
|
1737
|
+
registerOnChange(fn: (value: File[] | MkUploadFile[]) => void): void;
|
|
1738
|
+
registerOnTouched(fn: () => void): void;
|
|
1739
|
+
setDisabledState(isDisabled: boolean): void;
|
|
1740
|
+
/** Accepts either shape of written value; drops anything unrecognisable. */
|
|
1741
|
+
private adopt;
|
|
1742
|
+
private readonly validatorChange;
|
|
1743
|
+
/**
|
|
1744
|
+
* Applies the same `accept` / `maxSize` / `maxFiles` rules the dropzone
|
|
1745
|
+
* enforces at pick time, so a list written in from the model side — which
|
|
1746
|
+
* never goes through that path — is checked too. An empty list passes;
|
|
1747
|
+
* compose with `Validators.required` to reject it.
|
|
1748
|
+
*/
|
|
1749
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
1750
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
1751
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkFileUpload, never>;
|
|
1752
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkFileUpload, "mk-file-upload", never, { "accept": { "alias": "accept"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "maxSize": { "alias": "maxSize"; "required": false; "isSignal": true; }; "maxFiles": { "alias": "maxFiles"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "hideList": { "alias": "hideList"; "required": false; "isSignal": true; }; "uploadFn": { "alias": "uploadFn"; "required": false; "isSignal": true; }; "autoUpload": { "alias": "autoUpload"; "required": false; "isSignal": true; }; "valueFormat": { "alias": "valueFormat"; "required": false; "isSignal": true; }; "files": { "alias": "files"; "required": false; "isSignal": true; }; }, { "files": "filesChange"; "filesSelected": "filesSelected"; "rejected": "rejected"; "uploaded": "uploaded"; "removed": "removed"; }, never, never, true, never>;
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
/** The validity of the editor's current content. */
|
|
1756
|
+
interface MkCodeValidity {
|
|
1757
|
+
valid: boolean;
|
|
1758
|
+
/** Parser error message, or `null` when valid / not validated. */
|
|
1759
|
+
error: string | null;
|
|
1760
|
+
}
|
|
1761
|
+
/**
|
|
1762
|
+
* CodeEditor — a lightweight, dependency-free code field with syntax
|
|
1763
|
+
* highlighting, JSON validation and pretty-printing. A `<textarea>` provides
|
|
1764
|
+
* editing and a synced highlight layer sits behind it, so it stays fully
|
|
1765
|
+
* accessible (real textarea semantics, `aria-invalid`, form-field wiring)
|
|
1766
|
+
* without pulling in a heavyweight editor.
|
|
1767
|
+
*
|
|
1768
|
+
* With `language="json"` it validates on every change (exposing an inline error
|
|
1769
|
+
* + `(validate)` output) and offers `format()` to pretty-print. Ideal for a CMS
|
|
1770
|
+
* `json` field or plugin/settings JSONB editing.
|
|
1771
|
+
*
|
|
1772
|
+
* Keyboard: Tab inserts `tabSize` spaces; press Escape then Tab to move focus
|
|
1773
|
+
* out (so it is never a keyboard trap). Implements `ControlValueAccessor` over a
|
|
1774
|
+
* string value with a two-way `value` model.
|
|
1775
|
+
*
|
|
1776
|
+
* ```html
|
|
1777
|
+
* <mk-code-editor #editor language="json" [(value)]="config" [rows]="10" />
|
|
1778
|
+
* <button mkButton (click)="editor.format()">Format</button>
|
|
1779
|
+
* ```
|
|
1780
|
+
*/
|
|
1781
|
+
declare class MkCodeEditor implements ControlValueAccessor, OnDestroy {
|
|
1782
|
+
private readonly field;
|
|
1783
|
+
private readonly textareaRef;
|
|
1784
|
+
private readonly highlightRef;
|
|
1785
|
+
private readonly gutterRef;
|
|
1786
|
+
/** Language for highlighting + validation. */
|
|
1787
|
+
readonly language: _angular_core.InputSignal<MkCodeLanguage>;
|
|
1788
|
+
/** Placeholder shown when empty. */
|
|
1789
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
1790
|
+
/** Render read-only (still focusable/selectable). */
|
|
1791
|
+
readonly readOnly: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1792
|
+
/** Disable the control. */
|
|
1793
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1794
|
+
/** Force invalid styling when used standalone. */
|
|
1795
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1796
|
+
/** Visible rows (minimum height). */
|
|
1797
|
+
readonly rows: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
1798
|
+
/** Show a line-number gutter. */
|
|
1799
|
+
readonly lineNumbers: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1800
|
+
/** Number of spaces inserted by Tab. */
|
|
1801
|
+
readonly tabSize: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
1802
|
+
/** Soft-wrap long lines instead of scrolling horizontally. */
|
|
1803
|
+
readonly wrap: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1804
|
+
/** Control size. Ignored when nested in an `mk-form-field`. */
|
|
1805
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
1806
|
+
/** Accessible label when used standalone (no form field). */
|
|
1807
|
+
readonly ariaLabel: _angular_core.InputSignal<string>;
|
|
1808
|
+
/** Two-way editor content. */
|
|
1809
|
+
readonly value: _angular_core.ModelSignal<string>;
|
|
1810
|
+
/** Emits the content validity whenever it changes (JSON only). */
|
|
1811
|
+
readonly validate: _angular_core.OutputEmitterRef<MkCodeValidity>;
|
|
1812
|
+
private readonly cvaDisabled;
|
|
1813
|
+
/**
|
|
1814
|
+
* Debounced mirror of `value` that the expensive derivations (highlight,
|
|
1815
|
+
* JSON validation) read. Typing schedules a trailing update; programmatic
|
|
1816
|
+
* writes (`writeValue`, `format()`, `[(value)]` at rest) flush synchronously
|
|
1817
|
+
* so the overlay never lags when the user is not typing.
|
|
1818
|
+
*/
|
|
1819
|
+
private readonly debouncedValue;
|
|
1820
|
+
private debounceTimer;
|
|
1821
|
+
/** Set true by Escape so the next Tab moves focus instead of indenting. */
|
|
1822
|
+
private escapeArmed;
|
|
1823
|
+
private onChange;
|
|
1824
|
+
private onTouched;
|
|
1825
|
+
readonly editorId: string;
|
|
1826
|
+
readonly errorId: string;
|
|
1827
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
1828
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
1829
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
1830
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
1831
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
1832
|
+
/** Parse error for JSON content, or `null` when valid / empty / plaintext. */
|
|
1833
|
+
protected readonly jsonError: _angular_core.Signal<string | null>;
|
|
1834
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
1835
|
+
/** `aria-describedby` merging the field's ids with the JSON error id. */
|
|
1836
|
+
protected readonly ariaDescribedBy: _angular_core.Signal<string | null>;
|
|
1837
|
+
/**
|
|
1838
|
+
* Highlighted HTML for the layer behind the textarea. Reads the debounced
|
|
1839
|
+
* value: while typing the (transparent-text) textarea sits above the overlay,
|
|
1840
|
+
* so a briefly stale highlight is invisible; at rest both are identical.
|
|
1841
|
+
*/
|
|
1842
|
+
protected readonly highlightedHtml: _angular_core.Signal<string>;
|
|
1843
|
+
/** Cache so `lines()` returns the same array while the count is unchanged. */
|
|
1844
|
+
private cachedLines;
|
|
1845
|
+
/**
|
|
1846
|
+
* Line numbers to render in the gutter. Counts newlines in the LIVE value
|
|
1847
|
+
* (cheap single scan, no `split()` allocation) so the gutter never lags the
|
|
1848
|
+
* textarea, and returns a cached array while the count is unchanged so the
|
|
1849
|
+
* `@for` never re-diffs on same-line edits.
|
|
1850
|
+
*/
|
|
1851
|
+
protected readonly lines: _angular_core.Signal<number[]>;
|
|
1852
|
+
constructor();
|
|
1853
|
+
ngOnDestroy(): void;
|
|
1854
|
+
/** Trailing-edge debounce for the expensive derivations while typing. */
|
|
1855
|
+
private scheduleDerivations;
|
|
1856
|
+
/** Cancels any pending debounce and syncs the derivations immediately. */
|
|
1857
|
+
private flushDerivations;
|
|
1858
|
+
protected onInput(event: Event): void;
|
|
1859
|
+
protected onBlur(): void;
|
|
1860
|
+
/** Keep the highlight layer + gutter aligned with the textarea scroll. */
|
|
1861
|
+
protected onScroll(event: Event): void;
|
|
1862
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
1863
|
+
/** Insert text at the caret, preserving undo history where supported. */
|
|
1864
|
+
private insertText;
|
|
1865
|
+
/** The parsed JSON value, or `undefined` when empty / invalid / plaintext. */
|
|
1866
|
+
parsed(): unknown;
|
|
1867
|
+
/** Pretty-print valid JSON with `tabSize` indentation. No-op otherwise. */
|
|
1868
|
+
format(): void;
|
|
1869
|
+
writeValue(value: string | null): void;
|
|
1870
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
1871
|
+
registerOnTouched(fn: () => void): void;
|
|
1872
|
+
setDisabledState(isDisabled: boolean): void;
|
|
1873
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkCodeEditor, never>;
|
|
1874
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkCodeEditor, "mk-code-editor", ["mkCodeEditor"], { "language": { "alias": "language"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readOnly": { "alias": "readOnly"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "rows": { "alias": "rows"; "required": false; "isSignal": true; }; "lineNumbers": { "alias": "lineNumbers"; "required": false; "isSignal": true; }; "tabSize": { "alias": "tabSize"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "validate": "validate"; }, never, never, true, never>;
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
/**
|
|
1878
|
+
* Rating — a star rating input (and read-only display). Implements the ARIA
|
|
1879
|
+
* slider pattern: one focusable control, Arrow keys adjust, Home/End jump.
|
|
1880
|
+
* Click or hover a star to set the value. `ControlValueAccessor` + two-way
|
|
1881
|
+
* `value` model over a number.
|
|
1882
|
+
*
|
|
1883
|
+
* ```html
|
|
1884
|
+
* <mk-rating [(value)]="score" [max]="5" />
|
|
1885
|
+
* <mk-rating [value]="4" readonly />
|
|
1886
|
+
* ```
|
|
1887
|
+
*/
|
|
1888
|
+
declare class MkRating implements ControlValueAccessor, Validator {
|
|
1889
|
+
private readonly field;
|
|
1890
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
1891
|
+
/** Number of stars. */
|
|
1892
|
+
readonly max: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
1893
|
+
/** Two-way rating value (0–max). */
|
|
1894
|
+
readonly value: _angular_core.ModelSignal<number>;
|
|
1895
|
+
/** Read-only display (no interaction). */
|
|
1896
|
+
readonly readonly: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1897
|
+
/** Disable the control. */
|
|
1898
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1899
|
+
/** Force the invalid visual + `aria-invalid` when used standalone. */
|
|
1900
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1901
|
+
/** Size scale. */
|
|
1902
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
1903
|
+
/** Accessible label. */
|
|
1904
|
+
readonly ariaLabel: _angular_core.InputSignal<string>;
|
|
1905
|
+
protected readonly hover: _angular_core.WritableSignal<number>;
|
|
1906
|
+
private readonly cvaDisabled;
|
|
1907
|
+
private onChange;
|
|
1908
|
+
private onTouched;
|
|
1909
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
1910
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
1911
|
+
/** The surrounding field's label labels this control (`aria-labelledby`). */
|
|
1912
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
1913
|
+
/** Hint/error ids from the surrounding field (`aria-describedby`). */
|
|
1914
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
1915
|
+
/**
|
|
1916
|
+
* The `aria-label` actually rendered. When an `mk-form-field` provides a
|
|
1917
|
+
* label, `aria-labelledby` wins and the default label is dropped so it
|
|
1918
|
+
* cannot override the field's visible label.
|
|
1919
|
+
*/
|
|
1920
|
+
protected readonly effectiveAriaLabel: _angular_core.Signal<string | null>;
|
|
1921
|
+
/** The stars to render (1-based indices). */
|
|
1922
|
+
protected readonly stars: _angular_core.Signal<number[]>;
|
|
1923
|
+
/** The value shown right now (hover preview wins). */
|
|
1924
|
+
protected readonly displayValue: _angular_core.Signal<number>;
|
|
1925
|
+
protected readonly valueText: _angular_core.Signal<string>;
|
|
1926
|
+
protected setValue(v: number): void;
|
|
1927
|
+
protected onStarEnter(v: number): void;
|
|
1928
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
1929
|
+
protected onBlur(): void;
|
|
1930
|
+
writeValue(value: number | null): void;
|
|
1931
|
+
registerOnChange(fn: (value: number) => void): void;
|
|
1932
|
+
registerOnTouched(fn: () => void): void;
|
|
1933
|
+
setDisabledState(isDisabled: boolean): void;
|
|
1934
|
+
private readonly validatorChange;
|
|
1935
|
+
/**
|
|
1936
|
+
* Reports `max` for a rating above `[max]`. Zero means "unrated" and is
|
|
1937
|
+
* left to `Validators.required` to reject.
|
|
1938
|
+
*/
|
|
1939
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
1940
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
1941
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkRating, never>;
|
|
1942
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkRating, "mk-rating", never, { "max": { "alias": "max"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
/**
|
|
1946
|
+
* NumberInput — a numeric field with −/+ stepper buttons, clamping and keyboard
|
|
1947
|
+
* stepping (Arrow keys / Page keys). Implements the ARIA `spinbutton` pattern
|
|
1948
|
+
* and `ControlValueAccessor` over `number | null`, with a two-way `value` model.
|
|
1949
|
+
*
|
|
1950
|
+
* ```html
|
|
1951
|
+
* <mk-number-input [(value)]="qty" [min]="0" [max]="99" [step]="1" />
|
|
1952
|
+
* ```
|
|
1953
|
+
*/
|
|
1954
|
+
declare class MkNumberInput implements ControlValueAccessor, Validator {
|
|
1955
|
+
private readonly field;
|
|
1956
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
1957
|
+
private readonly inputRef;
|
|
1958
|
+
/** Minimum value. */
|
|
1959
|
+
readonly min: _angular_core.InputSignal<number | null>;
|
|
1960
|
+
/** Maximum value. */
|
|
1961
|
+
readonly max: _angular_core.InputSignal<number | null>;
|
|
1962
|
+
/** Step increment for buttons + Arrow keys. */
|
|
1963
|
+
readonly step: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
1964
|
+
/** Two-way value. */
|
|
1965
|
+
readonly value: _angular_core.ModelSignal<number | null>;
|
|
1966
|
+
/** Placeholder when empty. */
|
|
1967
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
1968
|
+
/** Disable the control. */
|
|
1969
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1970
|
+
/** Force invalid styling when standalone. */
|
|
1971
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1972
|
+
/** Control size. Ignored inside an `mk-form-field`. */
|
|
1973
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
1974
|
+
protected readonly inputId: string;
|
|
1975
|
+
private readonly cvaDisabled;
|
|
1976
|
+
private onChange;
|
|
1977
|
+
private onTouched;
|
|
1978
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
1979
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
1980
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
1981
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
1982
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
1983
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
1984
|
+
/** Text mirror of the value for the input. */
|
|
1985
|
+
protected readonly display: _angular_core.Signal<string>;
|
|
1986
|
+
protected readonly canDecrement: _angular_core.Signal<boolean>;
|
|
1987
|
+
protected readonly canIncrement: _angular_core.Signal<boolean>;
|
|
1988
|
+
protected onInput(event: Event): void;
|
|
1989
|
+
protected onBlur(): void;
|
|
1990
|
+
protected step_(delta: number): void;
|
|
1991
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
1992
|
+
private clamp;
|
|
1993
|
+
private commit;
|
|
1994
|
+
writeValue(value: number | null): void;
|
|
1995
|
+
registerOnChange(fn: (value: number | null) => void): void;
|
|
1996
|
+
registerOnTouched(fn: () => void): void;
|
|
1997
|
+
setDisabledState(isDisabled: boolean): void;
|
|
1998
|
+
private readonly validatorChange;
|
|
1999
|
+
/**
|
|
2000
|
+
* Reports `min` / `max` against the `[min]` and `[max]` inputs, using the
|
|
2001
|
+
* same error shapes as `Validators.min` / `Validators.max`.
|
|
2002
|
+
*/
|
|
2003
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
2004
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
2005
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkNumberInput, never>;
|
|
2006
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkNumberInput, "mk-number-input", never, { "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "step": { "alias": "step"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
type MkNumericKeypadMode = 'pin' | 'quantity' | 'amount';
|
|
2010
|
+
/** A key on the pad: a digit, or one of the three action keys. */
|
|
2011
|
+
type PadKey = {
|
|
2012
|
+
id: string;
|
|
2013
|
+
label: string;
|
|
2014
|
+
action: 'digit' | 'clear' | 'decimal' | 'backspace';
|
|
2015
|
+
};
|
|
2016
|
+
/**
|
|
2017
|
+
* Numeric keypad — a touch-first 3×4 digit pad for PIN entry, quantity entry
|
|
2018
|
+
* and money amounts (POS-style). `ControlValueAccessor` + two-way `value`
|
|
2019
|
+
* model; the value is a **string** in `pin` mode (leading zeros preserved)
|
|
2020
|
+
* and a **number | null** in `quantity`/`amount` mode.
|
|
2021
|
+
*
|
|
2022
|
+
* - `pin`: masked echo row by default; `(submit)` fires automatically when
|
|
2023
|
+
* `length` digits are entered.
|
|
2024
|
+
* - `quantity`: integer entry; the bottom-left key clears.
|
|
2025
|
+
* - `amount`: decimal entry (value uses `.`; the echo shows
|
|
2026
|
+
* `decimalSeparator`); capped at `fractionDigits` fraction digits.
|
|
2027
|
+
*
|
|
2028
|
+
* A physical keyboard works anywhere inside the pad: digits, Backspace,
|
|
2029
|
+
* Delete (clear), Enter (submit) and the decimal separator. Arrow keys move
|
|
2030
|
+
* between the on-screen keys (roving tabindex).
|
|
2031
|
+
*
|
|
2032
|
+
* ```html
|
|
2033
|
+
* <mk-numeric-keypad mode="pin" [length]="4" (submit)="unlock($event)" />
|
|
2034
|
+
* <mk-numeric-keypad mode="quantity" [min]="1" [(value)]="qty" />
|
|
2035
|
+
* ```
|
|
2036
|
+
*/
|
|
2037
|
+
declare class MkNumericKeypad implements ControlValueAccessor, Validator {
|
|
2038
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
2039
|
+
private readonly announcer;
|
|
2040
|
+
private readonly keyEls;
|
|
2041
|
+
/** Entry mode. Decides the value type and the bottom-left key. */
|
|
2042
|
+
readonly mode: _angular_core.InputSignal<MkNumericKeypadMode>;
|
|
2043
|
+
/** PIN length (`pin` mode only). Reaching it emits `submit`. */
|
|
2044
|
+
readonly length: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
2045
|
+
/** Lower bound reported through the validator (`quantity`/`amount`). */
|
|
2046
|
+
readonly min: _angular_core.InputSignal<number | null>;
|
|
2047
|
+
/** Upper bound reported through the validator (`quantity`/`amount`). */
|
|
2048
|
+
readonly max: _angular_core.InputSignal<number | null>;
|
|
2049
|
+
/** Mask the echo row in `pin` mode. Default `true`. */
|
|
2050
|
+
readonly mask: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2051
|
+
/** Show the echo row above the keys. Default `true`. */
|
|
2052
|
+
readonly showValue: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2053
|
+
/** Echo-row separator for `amount` mode. The VALUE always uses `.`. */
|
|
2054
|
+
readonly decimalSeparator: _angular_core.InputSignal<string>;
|
|
2055
|
+
/** Max fraction digits accepted in `amount` mode. */
|
|
2056
|
+
readonly fractionDigits: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
2057
|
+
/** Disable the pad. */
|
|
2058
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2059
|
+
/** Force invalid styling. */
|
|
2060
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2061
|
+
/** Accessible label for the pad. */
|
|
2062
|
+
readonly ariaLabel: _angular_core.InputSignal<string>;
|
|
2063
|
+
/** Two-way value: `string` in `pin` mode, `number | null` otherwise. */
|
|
2064
|
+
readonly value: _angular_core.ModelSignal<string | number | null>;
|
|
2065
|
+
/** Enter key / full PIN. Emits the current value. */
|
|
2066
|
+
readonly submit: _angular_core.OutputEmitterRef<string | number | null>;
|
|
2067
|
+
readonly padId: string;
|
|
2068
|
+
/** Raw entry buffer ('' = empty; amount keeps a '.' while typing). */
|
|
2069
|
+
private readonly buffer;
|
|
2070
|
+
private readonly cvaDisabled;
|
|
2071
|
+
/** Roving-tabindex position inside the flattened key list. */
|
|
2072
|
+
protected readonly focusIndex: _angular_core.WritableSignal<number>;
|
|
2073
|
+
private onChange;
|
|
2074
|
+
private onTouched;
|
|
2075
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
2076
|
+
protected readonly keys: _angular_core.Signal<PadKey[]>;
|
|
2077
|
+
/** Echo text: masked dots are rendered separately in `pin` mode. */
|
|
2078
|
+
protected readonly echoText: _angular_core.Signal<string>;
|
|
2079
|
+
protected readonly isPinMasked: _angular_core.Signal<boolean>;
|
|
2080
|
+
protected readonly pinDots: _angular_core.Signal<boolean[]>;
|
|
2081
|
+
protected keyAriaLabel(key: PadKey): string | null;
|
|
2082
|
+
protected onKeyClick(key: PadKey): void;
|
|
2083
|
+
/** Physical-keyboard entry + arrow-key roving over the on-screen keys. */
|
|
2084
|
+
protected onGridKeydown(event: KeyboardEvent): void;
|
|
2085
|
+
protected onKeyFocus(index: number): void;
|
|
2086
|
+
protected onBlur(): void;
|
|
2087
|
+
private focusKey;
|
|
2088
|
+
private pushDigit;
|
|
2089
|
+
private pushDecimal;
|
|
2090
|
+
private commit;
|
|
2091
|
+
writeValue(value: string | number | null): void;
|
|
2092
|
+
registerOnChange(fn: (value: string | number | null) => void): void;
|
|
2093
|
+
registerOnTouched(fn: () => void): void;
|
|
2094
|
+
setDisabledState(isDisabled: boolean): void;
|
|
2095
|
+
private readonly validatorChange;
|
|
2096
|
+
/**
|
|
2097
|
+
* `pin`: reports `minlength` while the code is incomplete (empty passes —
|
|
2098
|
+
* compose with `Validators.required`). `quantity`/`amount`: reports
|
|
2099
|
+
* `min`/`max` against the bounds.
|
|
2100
|
+
*/
|
|
2101
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
2102
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
2103
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkNumericKeypad, never>;
|
|
2104
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkNumericKeypad, "mk-numeric-keypad", never, { "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "length": { "alias": "length"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "mask": { "alias": "mask"; "required": false; "isSignal": true; }; "showValue": { "alias": "showValue"; "required": false; "isSignal": true; }; "decimalSeparator": { "alias": "decimalSeparator"; "required": false; "isSignal": true; }; "fractionDigits": { "alias": "fractionDigits"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "submit": "submit"; }, never, never, true, never>;
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
/**
|
|
2108
|
+
* Layout data for {@link MkOnScreenKeyboard}.
|
|
2109
|
+
*
|
|
2110
|
+
* A layout is a set of rows per layer. String entries are literal character
|
|
2111
|
+
* keys (lowercase base form); object entries are action keys. Shifted
|
|
2112
|
+
* characters come from `shiftMap` when present, else `toUpperCase()` — which
|
|
2113
|
+
* handles Polish diacritics for free (`ą` → `Ą`).
|
|
2114
|
+
*/
|
|
2115
|
+
/** Non-character keys. `span` stretches the key across extra grid columns. */
|
|
2116
|
+
interface MkKeyboardActionKey {
|
|
2117
|
+
readonly action: 'shift' | 'backspace' | 'space' | 'enter' | 'layer';
|
|
2118
|
+
readonly span?: number;
|
|
2119
|
+
}
|
|
2120
|
+
type MkKeyboardKey = string | MkKeyboardActionKey;
|
|
2121
|
+
interface MkKeyboardLayout {
|
|
2122
|
+
/** Letter layer. */
|
|
2123
|
+
readonly base: ReadonlyArray<ReadonlyArray<MkKeyboardKey>>;
|
|
2124
|
+
/** Alternate layer (digits live in the base top row; this holds diacritics + symbols). */
|
|
2125
|
+
readonly alt: ReadonlyArray<ReadonlyArray<MkKeyboardKey>>;
|
|
2126
|
+
/** Overrides for shifted characters; missing keys fall back to `toUpperCase()`. */
|
|
2127
|
+
readonly shiftMap?: Readonly<Record<string, string>>;
|
|
2128
|
+
}
|
|
2129
|
+
/**
|
|
2130
|
+
* QWERTY with a Polish alternate layer (programmer-Polish convention: base
|
|
2131
|
+
* letters are plain QWERTY, diacritics sit on the `?ąę` layer along with the
|
|
2132
|
+
* common symbols).
|
|
2133
|
+
*/
|
|
2134
|
+
declare const MK_KEYBOARD_LAYOUT_QWERTY_PL: MkKeyboardLayout;
|
|
2135
|
+
|
|
2136
|
+
/** A resolved key ready for the template. */
|
|
2137
|
+
interface RenderKey {
|
|
2138
|
+
readonly char?: string;
|
|
2139
|
+
readonly action?: MkKeyboardActionKey['action'];
|
|
2140
|
+
readonly span: number;
|
|
2141
|
+
}
|
|
2142
|
+
type MkOnScreenKeyboardTarget = HTMLInputElement | HTMLTextAreaElement;
|
|
2143
|
+
/**
|
|
2144
|
+
* On-screen keyboard — a touch QWERTY panel for kiosk/till screens where no
|
|
2145
|
+
* physical keyboard exists. Anchored below its input in the browser top layer
|
|
2146
|
+
* (via {@link MkAnchoredPanel}), it writes caret-aware into the target's
|
|
2147
|
+
* native value and dispatches `input` events, so `ngModel`/reactive forms
|
|
2148
|
+
* stay in sync with no extra wiring.
|
|
2149
|
+
*
|
|
2150
|
+
* Pair it with the `mkOnScreenKeyboardFor` directive, which opens the panel
|
|
2151
|
+
* on focus and suppresses the OS keyboard (`inputmode="none"`):
|
|
2152
|
+
*
|
|
2153
|
+
* ```html
|
|
2154
|
+
* <input mkInput [mkOnScreenKeyboardFor]="kbd" />
|
|
2155
|
+
* <mk-on-screen-keyboard #kbd />
|
|
2156
|
+
* ```
|
|
2157
|
+
*
|
|
2158
|
+
* Layers: base (letters + digit row), shift (auto-resets after one
|
|
2159
|
+
* character) and an alternate layer (Polish diacritics + symbols in the
|
|
2160
|
+
* default {@link MK_KEYBOARD_LAYOUT_QWERTY_PL}); pass `layout` for other
|
|
2161
|
+
* languages. Enter inserts a newline in a `<textarea>` and emits `enter`
|
|
2162
|
+
* for single-line inputs. Keys are excluded from the tab order — physical
|
|
2163
|
+
* keyboards type into the input directly, the panel is a pointer surface.
|
|
2164
|
+
*/
|
|
2165
|
+
declare class MkOnScreenKeyboard {
|
|
2166
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
2167
|
+
private readonly isBrowser;
|
|
2168
|
+
/** Stable id for `aria-controls` on the trigger. */
|
|
2169
|
+
readonly panelId: string;
|
|
2170
|
+
/** Key layout. Defaults to QWERTY with a Polish alternate layer. */
|
|
2171
|
+
readonly layout: _angular_core.InputSignal<MkKeyboardLayout>;
|
|
2172
|
+
/** Preferred placement relative to the input. */
|
|
2173
|
+
readonly placement: _angular_core.InputSignal<MkPlacement>;
|
|
2174
|
+
/** Enter pressed on a single-line input (textareas insert a newline instead). */
|
|
2175
|
+
readonly enter: _angular_core.OutputEmitterRef<void>;
|
|
2176
|
+
/** Emitted whenever the keyboard closes (any reason). */
|
|
2177
|
+
readonly closed: _angular_core.OutputEmitterRef<void>;
|
|
2178
|
+
private readonly _open;
|
|
2179
|
+
/** Whether the panel is open. */
|
|
2180
|
+
readonly opened: _angular_core.Signal<boolean>;
|
|
2181
|
+
protected readonly anchorEl: _angular_core.WritableSignal<HTMLElement | undefined>;
|
|
2182
|
+
protected readonly shift: _angular_core.WritableSignal<boolean>;
|
|
2183
|
+
protected readonly layer: _angular_core.WritableSignal<"base" | "alt">;
|
|
2184
|
+
private target;
|
|
2185
|
+
protected readonly rows: _angular_core.Signal<RenderKey[][]>;
|
|
2186
|
+
private resolve;
|
|
2187
|
+
/** Open anchored to `anchor`, typing into `target`. */
|
|
2188
|
+
open(anchor: HTMLElement, target: MkOnScreenKeyboardTarget): void;
|
|
2189
|
+
/** Close the panel. */
|
|
2190
|
+
close(): void;
|
|
2191
|
+
/** Keys must never steal focus from the input. */
|
|
2192
|
+
protected onPanelPointerdown(event: Event): void;
|
|
2193
|
+
protected onKeyClick(key: RenderKey): void;
|
|
2194
|
+
protected keyLabel(key: RenderKey): string;
|
|
2195
|
+
/** The visible face of the layer key: `?ąę` on base, `abc` on alt. */
|
|
2196
|
+
protected layerFace(): string;
|
|
2197
|
+
private insert;
|
|
2198
|
+
private deleteBack;
|
|
2199
|
+
private notify;
|
|
2200
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkOnScreenKeyboard, never>;
|
|
2201
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkOnScreenKeyboard, "mk-on-screen-keyboard", ["mkOnScreenKeyboard"], { "layout": { "alias": "layout"; "required": false; "isSignal": true; }; "placement": { "alias": "placement"; "required": false; "isSignal": true; }; }, { "enter": "enter"; "closed": "closed"; }, never, never, true, never>;
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
/**
|
|
2205
|
+
* Binds an `<input>`/`<textarea>` to an {@link MkOnScreenKeyboard}: opens the
|
|
2206
|
+
* panel on focus/click, closes it when focus leaves, and sets
|
|
2207
|
+
* `inputmode="none"` so touch devices don't raise the OS keyboard on top of
|
|
2208
|
+
* it. Disabled/readonly fields never open the panel.
|
|
2209
|
+
*
|
|
2210
|
+
* ```html
|
|
2211
|
+
* <input mkInput [mkOnScreenKeyboardFor]="kbd" />
|
|
2212
|
+
* <mk-on-screen-keyboard #kbd />
|
|
2213
|
+
* ```
|
|
2214
|
+
*/
|
|
2215
|
+
declare class MkOnScreenKeyboardTrigger {
|
|
2216
|
+
private readonly host;
|
|
2217
|
+
/** The keyboard instance to open for this field. */
|
|
2218
|
+
readonly keyboard: _angular_core.InputSignal<MkOnScreenKeyboard>;
|
|
2219
|
+
protected open(): void;
|
|
2220
|
+
/**
|
|
2221
|
+
* Panel keys `preventDefault()` their pointerdown, so the input only blurs
|
|
2222
|
+
* when focus genuinely moves elsewhere — close then.
|
|
2223
|
+
*/
|
|
2224
|
+
protected onBlur(): void;
|
|
2225
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkOnScreenKeyboardTrigger, never>;
|
|
2226
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MkOnScreenKeyboardTrigger, "input[mkOnScreenKeyboardFor], textarea[mkOnScreenKeyboardFor]", ["mkOnScreenKeyboardTrigger"], { "keyboard": { "alias": "mkOnScreenKeyboardFor"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
/**
|
|
2230
|
+
* OTP — a segmented one-time-code input: N single-character boxes with automatic
|
|
2231
|
+
* focus advance, Backspace-to-previous, Arrow navigation and full-code paste.
|
|
2232
|
+
* `ControlValueAccessor` + two-way `value` model over the concatenated string.
|
|
2233
|
+
*
|
|
2234
|
+
* ```html
|
|
2235
|
+
* <mk-otp [(value)]="code" [length]="6" />
|
|
2236
|
+
* ```
|
|
2237
|
+
*/
|
|
2238
|
+
declare class MkOtp implements ControlValueAccessor, Validator {
|
|
2239
|
+
private readonly field;
|
|
2240
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
2241
|
+
private readonly cells;
|
|
2242
|
+
/** Number of character boxes. */
|
|
2243
|
+
readonly length: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
2244
|
+
/** Restrict input to digits (`number`) or allow any char (`text`). */
|
|
2245
|
+
readonly type: _angular_core.InputSignal<"number" | "text">;
|
|
2246
|
+
/** Mask entered characters (password style). */
|
|
2247
|
+
readonly mask: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2248
|
+
/** Two-way concatenated value. */
|
|
2249
|
+
readonly value: _angular_core.ModelSignal<string>;
|
|
2250
|
+
/** Disable the control. */
|
|
2251
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2252
|
+
/** Force invalid styling when standalone. */
|
|
2253
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2254
|
+
/** Control size. Ignored inside an `mk-form-field`. */
|
|
2255
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
2256
|
+
/** Accessible label for the group. */
|
|
2257
|
+
readonly ariaLabel: _angular_core.InputSignal<string>;
|
|
2258
|
+
readonly cellId: string;
|
|
2259
|
+
private readonly chars;
|
|
2260
|
+
private readonly cvaDisabled;
|
|
2261
|
+
private onChange;
|
|
2262
|
+
private onTouched;
|
|
2263
|
+
protected readonly indexes: _angular_core.Signal<number[]>;
|
|
2264
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
2265
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
2266
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
2267
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
2268
|
+
/** Required state from the surrounding field (`aria-required` on the cells). */
|
|
2269
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
2270
|
+
/** Hint/error ids from the surrounding field (`aria-describedby` on the cells). */
|
|
2271
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
2272
|
+
protected readonly inputMode: _angular_core.Signal<"text" | "numeric">;
|
|
2273
|
+
/**
|
|
2274
|
+
* Cell ids. The first cell adopts the surrounding field's `controlId` so the
|
|
2275
|
+
* field's `<label for>` resolves to a real element.
|
|
2276
|
+
*/
|
|
2277
|
+
protected cellIdFor(i: number): string;
|
|
2278
|
+
constructor();
|
|
2279
|
+
protected charAt(i: number): string;
|
|
2280
|
+
protected onCellInput(i: number, event: Event): void;
|
|
2281
|
+
protected onCellKeydown(i: number, event: KeyboardEvent): void;
|
|
2282
|
+
protected onPaste(i: number, event: ClipboardEvent): void;
|
|
2283
|
+
protected onBlur(): void;
|
|
2284
|
+
private fillFrom;
|
|
2285
|
+
private commit;
|
|
2286
|
+
private focusCell;
|
|
2287
|
+
private sanitize;
|
|
2288
|
+
private split;
|
|
2289
|
+
writeValue(value: string | null): void;
|
|
2290
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
2291
|
+
registerOnTouched(fn: () => void): void;
|
|
2292
|
+
setDisabledState(isDisabled: boolean): void;
|
|
2293
|
+
private readonly validatorChange;
|
|
2294
|
+
/**
|
|
2295
|
+
* Reports `minlength` for a partially entered code. An empty value passes;
|
|
2296
|
+
* compose with `Validators.required` to reject it.
|
|
2297
|
+
*/
|
|
2298
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
2299
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
2300
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkOtp, never>;
|
|
2301
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkOtp, "mk-otp", never, { "length": { "alias": "length"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "mask": { "alias": "mask"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2304
|
+
/**
|
|
2305
|
+
* Per-country dialing metadata for {@link MkPhoneInput}.
|
|
2306
|
+
*
|
|
2307
|
+
* `mask` is an `mkApplyMask`-style pattern for the **national** number
|
|
2308
|
+
* (`0` = digit, everything else is a literal). Masks follow the most common
|
|
2309
|
+
* national formatting; countries with several plan lengths use their longest
|
|
2310
|
+
* common mobile format. The set covers the countries an admin product is
|
|
2311
|
+
* likely to meet — extend or replace it via the `countries` input.
|
|
2312
|
+
*/
|
|
2313
|
+
interface MkPhoneCountry {
|
|
2314
|
+
/** ISO 3166-1 alpha-2 code, uppercase (drives the flag + display name). */
|
|
2315
|
+
code: string;
|
|
2316
|
+
/** International dialing code, digits only (no `+`). */
|
|
2317
|
+
dialCode: string;
|
|
2318
|
+
/** Mask for the national number, `0` = digit. */
|
|
2319
|
+
mask: string;
|
|
2320
|
+
}
|
|
2321
|
+
/** The built-in country set (alphabetical by ISO code). */
|
|
2322
|
+
declare const MK_PHONE_COUNTRIES: readonly MkPhoneCountry[];
|
|
2323
|
+
/** Regional-indicator flag emoji for an ISO 3166-1 alpha-2 code. */
|
|
2324
|
+
declare function mkCountryFlag(code: string): string;
|
|
2325
|
+
|
|
2326
|
+
/** Structured value emitted by {@link MkPhoneInput} in `parts` mode. */
|
|
2327
|
+
interface MkPhoneValue {
|
|
2328
|
+
/** ISO 3166-1 alpha-2 country code, e.g. `PL`. */
|
|
2329
|
+
country: string;
|
|
2330
|
+
/** Dialing prefix with the leading `+`, e.g. `+48`. */
|
|
2331
|
+
dialCode: string;
|
|
2332
|
+
/** National number, digits only. */
|
|
2333
|
+
national: string;
|
|
2334
|
+
/** The full E.164 number, e.g. `+48601234567`. */
|
|
2335
|
+
e164: string;
|
|
2336
|
+
}
|
|
2337
|
+
/** A country row prepared for the dropdown list. */
|
|
2338
|
+
interface CountryOption {
|
|
2339
|
+
country: MkPhoneCountry;
|
|
2340
|
+
name: string;
|
|
2341
|
+
flag: string;
|
|
2342
|
+
}
|
|
2343
|
+
/**
|
|
2344
|
+
* PhoneInput — an international telephone field: a searchable country-prefix
|
|
2345
|
+
* dropdown (flag + dial code) next to a national-number input that formats
|
|
2346
|
+
* itself with the selected country's mask as the user types.
|
|
2347
|
+
*
|
|
2348
|
+
* The form value is either a single E.164 string (`"+48601234567"`, default)
|
|
2349
|
+
* or a structured object (`valueFormat="parts"`) carrying the country, dial
|
|
2350
|
+
* code and national number separately; both modes read back either shape and
|
|
2351
|
+
* `null` when empty. Pasting a full international number (`+44…`) into the
|
|
2352
|
+
* number field switches the country automatically.
|
|
2353
|
+
*
|
|
2354
|
+
* Implements `ControlValueAccessor` and exposes two-way `value` and `country`
|
|
2355
|
+
* models, so `[(ngModel)]`, reactive forms, `[(value)]` and `[(country)]` all
|
|
2356
|
+
* work.
|
|
2357
|
+
*
|
|
2358
|
+
* ```html
|
|
2359
|
+
* <mk-phone-input [(ngModel)]="phone" country="PL" />
|
|
2360
|
+
* <mk-phone-input valueFormat="parts" [preferredCountries]="['PL','DE','CZ']"
|
|
2361
|
+
* [(value)]="phoneParts" />
|
|
2362
|
+
* ```
|
|
2363
|
+
*/
|
|
2364
|
+
declare class MkPhoneInput implements ControlValueAccessor {
|
|
2365
|
+
private readonly field;
|
|
2366
|
+
/** Localised strings (override globally via `provideMkI18n`). */
|
|
2367
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
2368
|
+
private readonly triggerRef;
|
|
2369
|
+
private readonly searchRef;
|
|
2370
|
+
private readonly nationalRef;
|
|
2371
|
+
/** The selectable country set (defaults to the built-in list). */
|
|
2372
|
+
readonly countries: _angular_core.InputSignal<readonly MkPhoneCountry[]>;
|
|
2373
|
+
/** ISO codes pinned, in order, to the top of the dropdown. */
|
|
2374
|
+
readonly preferredCountries: _angular_core.InputSignal<readonly string[]>;
|
|
2375
|
+
/** Shape of the form value: an E.164 string or a structured object. */
|
|
2376
|
+
readonly valueFormat: _angular_core.InputSignal<"e164" | "parts">;
|
|
2377
|
+
/** Control size. Ignored when nested in an `mk-form-field`. */
|
|
2378
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
2379
|
+
/** Force invalid styling + `aria-invalid` when used standalone. */
|
|
2380
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2381
|
+
/** Disable the control. */
|
|
2382
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2383
|
+
/** Placeholder for the national-number field. */
|
|
2384
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
2385
|
+
/** Two-way selected ISO country code. */
|
|
2386
|
+
readonly country: _angular_core.ModelSignal<string>;
|
|
2387
|
+
/** Two-way form value (`string` in `e164` mode, {@link MkPhoneValue} in `parts`). */
|
|
2388
|
+
readonly value: _angular_core.ModelSignal<string | MkPhoneValue | null>;
|
|
2389
|
+
protected readonly open: _angular_core.WritableSignal<boolean>;
|
|
2390
|
+
protected readonly query: _angular_core.WritableSignal<string>;
|
|
2391
|
+
protected readonly activeIndex: _angular_core.WritableSignal<number>;
|
|
2392
|
+
private readonly nationalDigits;
|
|
2393
|
+
private readonly cvaDisabled;
|
|
2394
|
+
private onChange;
|
|
2395
|
+
private onTouched;
|
|
2396
|
+
/** The last value this component itself wrote into the `value` model. */
|
|
2397
|
+
private lastDerived;
|
|
2398
|
+
private lastCountry;
|
|
2399
|
+
readonly listId: string;
|
|
2400
|
+
readonly inputId: string;
|
|
2401
|
+
readonly searchId: string;
|
|
2402
|
+
private readonly displayNames;
|
|
2403
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
2404
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
2405
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
2406
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
2407
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
2408
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
2409
|
+
/** The currently selected country (falls back to the first in the set). */
|
|
2410
|
+
protected readonly selectedCountry: _angular_core.Signal<MkPhoneCountry>;
|
|
2411
|
+
protected readonly selectedFlag: _angular_core.Signal<string>;
|
|
2412
|
+
protected readonly selectedName: _angular_core.Signal<string>;
|
|
2413
|
+
/** Masked national number shown in the field. */
|
|
2414
|
+
protected readonly nationalMasked: _angular_core.Signal<string>;
|
|
2415
|
+
/** Countries sorted preferred-first, then A→Z by localised name. */
|
|
2416
|
+
private readonly sortedCountries;
|
|
2417
|
+
/** Dropdown rows matching the search query. */
|
|
2418
|
+
protected readonly filtered: _angular_core.Signal<CountryOption[]>;
|
|
2419
|
+
constructor();
|
|
2420
|
+
/** Localised display name for an ISO country code. */
|
|
2421
|
+
protected countryName(code: string): string;
|
|
2422
|
+
protected optionId(index: number): string;
|
|
2423
|
+
protected onNationalChange(unmasked: string): void;
|
|
2424
|
+
/** Pasting a full `+…` number switches country + fills the national part. */
|
|
2425
|
+
protected onNationalPaste(event: ClipboardEvent): void;
|
|
2426
|
+
protected onBlur(): void;
|
|
2427
|
+
/** Pending focus-the-search-box timeout; cleared on re-open and destroy. */
|
|
2428
|
+
private searchFocusTimer?;
|
|
2429
|
+
protected toggle(): void;
|
|
2430
|
+
private openList;
|
|
2431
|
+
protected close(refocusTrigger?: boolean): void;
|
|
2432
|
+
protected onTriggerKeydown(event: Event): void;
|
|
2433
|
+
protected onSearch(event: Event): void;
|
|
2434
|
+
protected onSearchKeydown(event: Event): void;
|
|
2435
|
+
protected selectCountry(index: number): void;
|
|
2436
|
+
/** Compute the outward value and push it to the model (+ form when `emit`). */
|
|
2437
|
+
private deriveValue;
|
|
2438
|
+
private sameValue;
|
|
2439
|
+
/** Interpret an externally-assigned value (writeValue or `[value]`). */
|
|
2440
|
+
private applyExternalValue;
|
|
2441
|
+
/** Split an E.164-ish string into a country + national digits. */
|
|
2442
|
+
private applyE164;
|
|
2443
|
+
writeValue(value: string | MkPhoneValue | null): void;
|
|
2444
|
+
registerOnChange(fn: (value: string | MkPhoneValue | null) => void): void;
|
|
2445
|
+
registerOnTouched(fn: () => void): void;
|
|
2446
|
+
setDisabledState(isDisabled: boolean): void;
|
|
2447
|
+
ngOnDestroy(): void;
|
|
2448
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkPhoneInput, never>;
|
|
2449
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkPhoneInput, "mk-phone-input", ["mkPhoneInput"], { "countries": { "alias": "countries"; "required": false; "isSignal": true; }; "preferredCountries": { "alias": "preferredCountries"; "required": false; "isSignal": true; }; "valueFormat": { "alias": "valueFormat"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "country": { "alias": "country"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "country": "countryChange"; "value": "valueChange"; }, never, never, true, never>;
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2452
|
+
/**
|
|
2453
|
+
* Per-country postal-code formats for {@link MkPostalCodeInput}.
|
|
2454
|
+
*
|
|
2455
|
+
* `mask` is an `mkApplyMask`-style pattern (`0` = digit, `A` = letter,
|
|
2456
|
+
* `*` = alphanumeric, everything else a literal). `pattern` validates the
|
|
2457
|
+
* complete formatted value. Countries whose codes vary too much for a fixed
|
|
2458
|
+
* mask (e.g. GB) omit `mask` and rely on `pattern` + uppercasing alone.
|
|
2459
|
+
*/
|
|
2460
|
+
interface MkPostalFormat {
|
|
2461
|
+
/** ISO 3166-1 alpha-2 code, uppercase. */
|
|
2462
|
+
code: string;
|
|
2463
|
+
/** Input mask; omitted for free-form (variable-length) codes. */
|
|
2464
|
+
mask?: string;
|
|
2465
|
+
/** Regex the complete formatted value must match to be valid. */
|
|
2466
|
+
pattern: RegExp;
|
|
2467
|
+
/** Example of a valid code, used as the default placeholder. */
|
|
2468
|
+
example: string;
|
|
2469
|
+
}
|
|
2470
|
+
/** The built-in postal formats (alphabetical by ISO code). */
|
|
2471
|
+
declare const MK_POSTAL_FORMATS: readonly MkPostalFormat[];
|
|
2472
|
+
/** Look up the built-in format for an ISO country code (case-insensitive). */
|
|
2473
|
+
declare function mkPostalFormat(code: string): MkPostalFormat | undefined;
|
|
2474
|
+
|
|
2475
|
+
/**
|
|
2476
|
+
* Reactive-forms validator for a postal code in a given country. Empty values
|
|
2477
|
+
* pass (compose with `Validators.required`); countries without a built-in
|
|
2478
|
+
* format pass everything.
|
|
2479
|
+
*
|
|
2480
|
+
* ```ts
|
|
2481
|
+
* zip: ['', [Validators.required, mkPostalCodeValidator('PL')]]
|
|
2482
|
+
* ```
|
|
2483
|
+
*/
|
|
2484
|
+
declare function mkPostalCodeValidator(country: string, formats?: readonly MkPostalFormat[]): ValidatorFn;
|
|
2485
|
+
/**
|
|
2486
|
+
* PostalCodeInput — a postal/ZIP code field that masks, uppercases and
|
|
2487
|
+
* validates itself for the given `country` (35+ built-in formats: `PL`
|
|
2488
|
+
* `00-000`, `US` `00000[-0000]`, `CA` `A0A 0A0`, `NL` `0000 AA`, …).
|
|
2489
|
+
* Free-format countries (e.g. `GB`) skip the mask and validate against the
|
|
2490
|
+
* national pattern instead, normalising the inward-code space on blur.
|
|
2491
|
+
*
|
|
2492
|
+
* The placeholder defaults to a valid example for the country. `valid()`
|
|
2493
|
+
* (via `exportAs`) reports `true`/`false` for a complete/incomplete code and
|
|
2494
|
+
* `null` when empty or the country is unknown; invalid styling engages after
|
|
2495
|
+
* the field is touched.
|
|
2496
|
+
*
|
|
2497
|
+
* Implements `ControlValueAccessor` and exposes a two-way `value` model, so
|
|
2498
|
+
* `[(ngModel)]`, reactive forms and `[(value)]` all work.
|
|
2499
|
+
*
|
|
2500
|
+
* ```html
|
|
2501
|
+
* <mk-postal-code-input country="PL" [(ngModel)]="zip" />
|
|
2502
|
+
* <mk-postal-code-input [country]="form.value.country" [(value)]="zip" />
|
|
2503
|
+
* ```
|
|
2504
|
+
*/
|
|
2505
|
+
declare class MkPostalCodeInput implements ControlValueAccessor, Validator {
|
|
2506
|
+
private readonly field;
|
|
2507
|
+
/** Localised strings (override globally via `provideMkI18n`). */
|
|
2508
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
2509
|
+
/** ISO 3166-1 alpha-2 country whose format applies. */
|
|
2510
|
+
readonly country: _angular_core.InputSignal<string>;
|
|
2511
|
+
/** The format table (defaults to the built-in set) — extend to add countries. */
|
|
2512
|
+
readonly formats: _angular_core.InputSignal<readonly MkPostalFormat[]>;
|
|
2513
|
+
/** Control size. Ignored when nested in an `mk-form-field`. */
|
|
2514
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
2515
|
+
/** Force invalid styling + `aria-invalid` when used standalone. */
|
|
2516
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2517
|
+
/** Disable the control. */
|
|
2518
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2519
|
+
/** Placeholder; defaults to a valid example for the country. */
|
|
2520
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
2521
|
+
/** Two-way formatted value (e.g. `00-950`, `K1A 0B1`). */
|
|
2522
|
+
readonly value: _angular_core.ModelSignal<string>;
|
|
2523
|
+
private readonly touched;
|
|
2524
|
+
private readonly cvaDisabled;
|
|
2525
|
+
private onChange;
|
|
2526
|
+
private onTouched;
|
|
2527
|
+
readonly inputId: string;
|
|
2528
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
2529
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
2530
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
2531
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
2532
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
2533
|
+
/** The active format, or `undefined` for unknown countries (free text). */
|
|
2534
|
+
protected readonly format: _angular_core.Signal<MkPostalFormat | undefined>;
|
|
2535
|
+
/**
|
|
2536
|
+
* `true`/`false` for a complete/incomplete code, `null` when empty or the
|
|
2537
|
+
* country has no known format.
|
|
2538
|
+
*/
|
|
2539
|
+
readonly valid: _angular_core.Signal<boolean | null>;
|
|
2540
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
2541
|
+
protected readonly effectivePlaceholder: _angular_core.Signal<string>;
|
|
2542
|
+
/** Numeric keyboard for digit-only masks. */
|
|
2543
|
+
protected readonly inputMode: _angular_core.Signal<"text" | "numeric">;
|
|
2544
|
+
protected readonly maxLength: _angular_core.Signal<number>;
|
|
2545
|
+
protected onInput(event: Event): void;
|
|
2546
|
+
protected onBlur(): void;
|
|
2547
|
+
private commit;
|
|
2548
|
+
writeValue(value: string | null): void;
|
|
2549
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
2550
|
+
registerOnTouched(fn: () => void): void;
|
|
2551
|
+
setDisabledState(isDisabled: boolean): void;
|
|
2552
|
+
private readonly validatorChange;
|
|
2553
|
+
/**
|
|
2554
|
+
* Reports `postalCode` for a code not matching `[country]`'s format — the
|
|
2555
|
+
* same error `mkPostalCodeValidator()` produces. Empty values and countries
|
|
2556
|
+
* without a built-in format pass.
|
|
2557
|
+
*/
|
|
2558
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
2559
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
2560
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkPostalCodeInput, never>;
|
|
2561
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkPostalCodeInput, "mk-postal-code-input", ["mkPostalCodeInput"], { "country": { "alias": "country"; "required": false; "isSignal": true; }; "formats": { "alias": "formats"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2564
|
+
/** Locale-derived formatting facts used while editing. */
|
|
2565
|
+
interface LocaleInfo {
|
|
2566
|
+
/** Grouping separator, e.g. `,` / ` ` / `.`. */
|
|
2567
|
+
group: string;
|
|
2568
|
+
/** Decimal separator, e.g. `.` / `,`. */
|
|
2569
|
+
decimal: string;
|
|
2570
|
+
/** Currency symbol text (empty in plain-decimal mode). */
|
|
2571
|
+
symbol: string;
|
|
2572
|
+
/** Whether the symbol renders before the number. */
|
|
2573
|
+
symbolPrefix: boolean;
|
|
2574
|
+
/** The currency's default fraction digits (2 for USD, 0 for JPY, …). */
|
|
2575
|
+
fractionDigits: number;
|
|
2576
|
+
}
|
|
2577
|
+
/**
|
|
2578
|
+
* CurrencyInput — a money/amount field that formats itself with
|
|
2579
|
+
* `Intl.NumberFormat`: thousands grouping live as the user types, the
|
|
2580
|
+
* currency symbol as a fixed prefix/suffix (per locale), fraction digits
|
|
2581
|
+
* padded to the currency's convention on blur (`1234,5` → `1 234,50 zł`).
|
|
2582
|
+
* The form value is always a plain `number` (or `null` when empty) — the
|
|
2583
|
+
* locale formatting never leaks into the data.
|
|
2584
|
+
*
|
|
2585
|
+
* `currency` takes an ISO 4217 code; omit it for a plain grouped decimal.
|
|
2586
|
+
* `locale` defaults to the runtime locale. `decimals` overrides the
|
|
2587
|
+
* currency's fraction digits; `min`/`max` clamp on blur.
|
|
2588
|
+
*
|
|
2589
|
+
* Implements `ControlValueAccessor` and exposes a two-way `value` model, so
|
|
2590
|
+
* `[(ngModel)]`, reactive forms and `[(value)]` all work.
|
|
2591
|
+
*
|
|
2592
|
+
* ```html
|
|
2593
|
+
* <mk-currency-input currency="PLN" [(ngModel)]="price" />
|
|
2594
|
+
* <mk-currency-input currency="USD" [min]="0" [(value)]="budget" />
|
|
2595
|
+
* ```
|
|
2596
|
+
*/
|
|
2597
|
+
declare class MkCurrencyInput implements ControlValueAccessor, Validator {
|
|
2598
|
+
private readonly field;
|
|
2599
|
+
/** Localised strings (override globally via `provideMkI18n`). */
|
|
2600
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
2601
|
+
/** ISO 4217 currency code (`PLN`, `USD`, …). Empty = plain decimal. */
|
|
2602
|
+
readonly currency: _angular_core.InputSignal<string>;
|
|
2603
|
+
/** BCP 47 locale for separators/symbol; defaults to the runtime locale. */
|
|
2604
|
+
readonly locale: _angular_core.InputSignal<string | undefined>;
|
|
2605
|
+
/** Max fraction digits; defaults to the currency's convention (else 2). */
|
|
2606
|
+
readonly decimals: _angular_core.InputSignal<number | null>;
|
|
2607
|
+
/** Clamp the value to at least this on blur. */
|
|
2608
|
+
readonly min: _angular_core.InputSignal<number | null>;
|
|
2609
|
+
/** Clamp the value to at most this on blur. */
|
|
2610
|
+
readonly max: _angular_core.InputSignal<number | null>;
|
|
2611
|
+
/** Allow a leading minus sign. */
|
|
2612
|
+
readonly allowNegative: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2613
|
+
/** Control size. Ignored when nested in an `mk-form-field`. */
|
|
2614
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
2615
|
+
/** Force invalid styling + `aria-invalid` when used standalone. */
|
|
2616
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2617
|
+
/** Disable the control. */
|
|
2618
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2619
|
+
/** Placeholder shown when empty. */
|
|
2620
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
2621
|
+
/** Two-way numeric value (`null` when empty). */
|
|
2622
|
+
readonly value: _angular_core.ModelSignal<number | null>;
|
|
2623
|
+
/** The text currently shown in the field. */
|
|
2624
|
+
protected readonly display: _angular_core.WritableSignal<string>;
|
|
2625
|
+
private readonly cvaDisabled;
|
|
2626
|
+
private onChange;
|
|
2627
|
+
private onTouched;
|
|
2628
|
+
/** The last value this component itself pushed into the `value` model. */
|
|
2629
|
+
private lastEmitted;
|
|
2630
|
+
readonly inputId: string;
|
|
2631
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
2632
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
2633
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
2634
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
2635
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
2636
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
2637
|
+
/** Separators, symbol and fraction convention for the current setup. */
|
|
2638
|
+
protected readonly localeInfo: _angular_core.Signal<LocaleInfo>;
|
|
2639
|
+
/** Effective max fraction digits. */
|
|
2640
|
+
private readonly maxDecimals;
|
|
2641
|
+
constructor();
|
|
2642
|
+
protected onInput(event: Event): void;
|
|
2643
|
+
protected onBlur(): void;
|
|
2644
|
+
/**
|
|
2645
|
+
* Reduce whatever is in the field to a canonical `-?digits(.digits)?`
|
|
2646
|
+
* string. Accepts the locale decimal separator plus `.`/`,` when they are
|
|
2647
|
+
* not the grouping separator; drops everything else.
|
|
2648
|
+
*/
|
|
2649
|
+
private parseCanonical;
|
|
2650
|
+
/** Canonical string → number (`null` for empty / lone `-`). */
|
|
2651
|
+
private toNumber;
|
|
2652
|
+
/** Grouped editing text preserving a partially-typed fraction (`1 234,5`). */
|
|
2653
|
+
private formatEditing;
|
|
2654
|
+
/** Settled (blur / programmatic) text with padded fraction digits. */
|
|
2655
|
+
private formatSettled;
|
|
2656
|
+
writeValue(value: number | null): void;
|
|
2657
|
+
registerOnChange(fn: (value: number | null) => void): void;
|
|
2658
|
+
registerOnTouched(fn: () => void): void;
|
|
2659
|
+
setDisabledState(isDisabled: boolean): void;
|
|
2660
|
+
private readonly validatorChange;
|
|
2661
|
+
/**
|
|
2662
|
+
* Reports `min` / `max` against the `[min]` and `[max]` inputs, using the
|
|
2663
|
+
* same error shapes as `Validators.min` / `Validators.max`.
|
|
2664
|
+
*/
|
|
2665
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
2666
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
2667
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkCurrencyInput, never>;
|
|
2668
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkCurrencyInput, "mk-currency-input", ["mkCurrencyInput"], { "currency": { "alias": "currency"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "decimals": { "alias": "decimals"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "allowNegative": { "alias": "allowNegative"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2671
|
+
/** Card networks {@link MkCardNumberInput} recognises. */
|
|
2672
|
+
type MkCardBrand = 'visa' | 'mastercard' | 'amex' | 'discover' | 'diners' | 'jcb';
|
|
2673
|
+
/** Human-readable names for the recognised brands. */
|
|
2674
|
+
declare const MK_CARD_BRAND_NAMES: Record<MkCardBrand, string>;
|
|
2675
|
+
/** Detect the card network from the leading digits (IIN ranges). */
|
|
2676
|
+
declare function mkDetectCardBrand(digits: string): MkCardBrand | null;
|
|
2677
|
+
/** Luhn (mod 10) checksum over a digit string. */
|
|
2678
|
+
declare function mkLuhnCheck(digits: string): boolean;
|
|
2679
|
+
/**
|
|
2680
|
+
* CardNumberInput — a payment-card number field that groups digits with the
|
|
2681
|
+
* detected network's layout (16-digit `0000 0000 0000 0000`, Amex
|
|
2682
|
+
* `0000 000000 00000`, Diners `0000 000000 0000`), shows the brand as a
|
|
2683
|
+
* badge, and validates the complete number with the Luhn checksum.
|
|
2684
|
+
*
|
|
2685
|
+
* The form value is the raw digit string (no spaces). `brand()` exposes the
|
|
2686
|
+
* detected network (also via `(brandChange)`), and `valid()` reports
|
|
2687
|
+
* `true`/`false` for a complete number passing/failing Luhn and `null` while
|
|
2688
|
+
* empty or incomplete; invalid styling engages after the field was touched.
|
|
2689
|
+
*
|
|
2690
|
+
* Implements `ControlValueAccessor` and exposes a two-way `value` model, so
|
|
2691
|
+
* `[(ngModel)]`, reactive forms and `[(value)]` all work.
|
|
2692
|
+
*
|
|
2693
|
+
* ```html
|
|
2694
|
+
* <mk-card-number-input [(ngModel)]="cardNumber" />
|
|
2695
|
+
* ```
|
|
2696
|
+
*/
|
|
2697
|
+
declare class MkCardNumberInput implements ControlValueAccessor, Validator {
|
|
2698
|
+
private readonly field;
|
|
2699
|
+
/** Localised strings (override globally via `provideMkI18n`). */
|
|
2700
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
2701
|
+
/** Show the detected brand as a badge inside the field. */
|
|
2702
|
+
readonly showBrand: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2703
|
+
/** Control size. Ignored when nested in an `mk-form-field`. */
|
|
2704
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
2705
|
+
/** Force invalid styling + `aria-invalid` when used standalone. */
|
|
2706
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2707
|
+
/** Disable the control. */
|
|
2708
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2709
|
+
/** Placeholder shown when empty. */
|
|
2710
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
2711
|
+
/** Two-way card number, digits only (no spaces). */
|
|
2712
|
+
readonly value: _angular_core.ModelSignal<string>;
|
|
2713
|
+
/** Emits whenever the detected brand changes. */
|
|
2714
|
+
readonly brandChange: _angular_core.OutputEmitterRef<MkCardBrand | null>;
|
|
2715
|
+
private readonly touched;
|
|
2716
|
+
private readonly cvaDisabled;
|
|
2717
|
+
private onChange;
|
|
2718
|
+
private onTouched;
|
|
2719
|
+
private lastBrand;
|
|
2720
|
+
readonly inputId: string;
|
|
2721
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
2722
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
2723
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
2724
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
2725
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
2726
|
+
/** The detected card network, `null` while unrecognised. */
|
|
2727
|
+
readonly brand: _angular_core.Signal<MkCardBrand | null>;
|
|
2728
|
+
/** Human-readable brand name (empty while unrecognised). */
|
|
2729
|
+
protected readonly brandName: _angular_core.Signal<string>;
|
|
2730
|
+
/** The grouping mask for the current brand. */
|
|
2731
|
+
protected readonly mask: _angular_core.Signal<string>;
|
|
2732
|
+
/** Digits the current brand's complete number has. */
|
|
2733
|
+
private readonly expectedLength;
|
|
2734
|
+
/** Formatted (grouped) number shown in the field. */
|
|
2735
|
+
protected readonly masked: _angular_core.Signal<string>;
|
|
2736
|
+
/**
|
|
2737
|
+
* `true` for a complete number passing Luhn, `false` for a complete number
|
|
2738
|
+
* failing it, `null` while empty or incomplete.
|
|
2739
|
+
*/
|
|
2740
|
+
readonly valid: _angular_core.Signal<boolean | null>;
|
|
2741
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
2742
|
+
protected onDigitsChange(unmasked: string): void;
|
|
2743
|
+
protected onBlur(): void;
|
|
2744
|
+
writeValue(value: string | null): void;
|
|
2745
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
2746
|
+
registerOnTouched(fn: () => void): void;
|
|
2747
|
+
setDisabledState(isDisabled: boolean): void;
|
|
2748
|
+
/**
|
|
2749
|
+
* Reports `cardNumber` for a number failing the Luhn checksum (which
|
|
2750
|
+
* includes a half-typed one). An empty value passes; compose with
|
|
2751
|
+
* `Validators.required` to reject it.
|
|
2752
|
+
*/
|
|
2753
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
2754
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkCardNumberInput, never>;
|
|
2755
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkCardNumberInput, "mk-card-number-input", ["mkCardNumberInput"], { "showBrand": { "alias": "showBrand"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "brandChange": "brandChange"; }, never, never, true, never>;
|
|
2756
|
+
}
|
|
2757
|
+
|
|
2758
|
+
/** IBAN length per ISO 13616 country code (SEPA + common others). */
|
|
2759
|
+
declare const MK_IBAN_LENGTHS: Readonly<Record<string, number>>;
|
|
2760
|
+
/**
|
|
2761
|
+
* ISO 13616 mod-97 check over a compact (no spaces, uppercase) IBAN.
|
|
2762
|
+
* Assumes the shape `CC00…` has already been length-checked by the caller.
|
|
2763
|
+
*/
|
|
2764
|
+
declare function mkIbanChecksum(compact: string): boolean;
|
|
2765
|
+
/** Full IBAN validity: known country, exact length, mod-97 check. */
|
|
2766
|
+
declare function mkIbanIsValid(compact: string): boolean;
|
|
2767
|
+
/**
|
|
2768
|
+
* Reactive-forms validator for an IBAN (any supported country). Empty values
|
|
2769
|
+
* pass (compose with `Validators.required`); the error carries the country
|
|
2770
|
+
* and its expected length when known.
|
|
2771
|
+
*
|
|
2772
|
+
* ```ts
|
|
2773
|
+
* account: ['', [Validators.required, mkIbanValidator()]]
|
|
2774
|
+
* ```
|
|
2775
|
+
*/
|
|
2776
|
+
declare function mkIbanValidator(): ValidatorFn;
|
|
2777
|
+
/**
|
|
2778
|
+
* IbanInput — an international bank account number field: uppercases and
|
|
2779
|
+
* groups the number in blocks of four as the user types (`PL61 1090 1014 …`),
|
|
2780
|
+
* caps input at the country's exact length (65 countries built in) and
|
|
2781
|
+
* validates with the ISO 13616 mod-97 checksum.
|
|
2782
|
+
*
|
|
2783
|
+
* The form value is the compact electronic format (uppercase, no spaces).
|
|
2784
|
+
* `valid()` (via `exportAs`) reports `true`/`false` for a complete number
|
|
2785
|
+
* passing/failing validation and `null` while empty or incomplete; invalid
|
|
2786
|
+
* styling engages after the field was touched.
|
|
2787
|
+
* `mkIbanValidator()` covers reactive forms.
|
|
2788
|
+
*
|
|
2789
|
+
* Implements `ControlValueAccessor` and exposes a two-way `value` model, so
|
|
2790
|
+
* `[(ngModel)]`, reactive forms and `[(value)]` all work.
|
|
2791
|
+
*
|
|
2792
|
+
* ```html
|
|
2793
|
+
* <mk-iban-input [(ngModel)]="account" />
|
|
2794
|
+
* ```
|
|
2795
|
+
*/
|
|
2796
|
+
declare class MkIbanInput implements ControlValueAccessor, Validator {
|
|
2797
|
+
private readonly field;
|
|
2798
|
+
/** Localised strings (override globally via `provideMkI18n`). */
|
|
2799
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
2800
|
+
/** Control size. Ignored when nested in an `mk-form-field`. */
|
|
2801
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
2802
|
+
/** Force invalid styling + `aria-invalid` when used standalone. */
|
|
2803
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2804
|
+
/** Disable the control. */
|
|
2805
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2806
|
+
/** Placeholder shown when empty. */
|
|
2807
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
2808
|
+
/** Two-way IBAN in compact electronic format (uppercase, no spaces). */
|
|
2809
|
+
readonly value: _angular_core.ModelSignal<string>;
|
|
2810
|
+
private readonly touched;
|
|
2811
|
+
private readonly cvaDisabled;
|
|
2812
|
+
private onChange;
|
|
2813
|
+
private onTouched;
|
|
2814
|
+
readonly inputId: string;
|
|
2815
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
2816
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
2817
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
2818
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
2819
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
2820
|
+
/** The value grouped in blocks of four for display. */
|
|
2821
|
+
protected readonly grouped: _angular_core.Signal<string>;
|
|
2822
|
+
/** The expected length for the typed country, when known. */
|
|
2823
|
+
private readonly expectedLength;
|
|
2824
|
+
/**
|
|
2825
|
+
* `true` for a complete IBAN passing the mod-97 check, `false` for a
|
|
2826
|
+
* complete-but-wrong one (or an unknown country once 2+ chars are typed and
|
|
2827
|
+
* the field was left), `null` while empty or still incomplete.
|
|
2828
|
+
*/
|
|
2829
|
+
readonly valid: _angular_core.Signal<boolean | null>;
|
|
2830
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
2831
|
+
protected onInput(event: Event): void;
|
|
2832
|
+
private expectedLengthFor;
|
|
2833
|
+
protected onBlur(): void;
|
|
2834
|
+
writeValue(value: string | null): void;
|
|
2835
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
2836
|
+
registerOnTouched(fn: () => void): void;
|
|
2837
|
+
setDisabledState(isDisabled: boolean): void;
|
|
2838
|
+
/**
|
|
2839
|
+
* Reports `iban` for a number failing the mod-97 checksum — the same error
|
|
2840
|
+
* `mkIbanValidator()` produces, so the two are interchangeable. An empty
|
|
2841
|
+
* value passes; compose with `Validators.required` to reject it.
|
|
2842
|
+
*/
|
|
2843
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
2844
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkIbanInput, never>;
|
|
2845
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkIbanInput, "mk-iban-input", ["mkIbanInput"], { "size": { "alias": "size"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2848
|
+
/**
|
|
2849
|
+
* Per-country business tax-identifier format for {@link MkTaxIdInput}.
|
|
2850
|
+
*
|
|
2851
|
+
* `mask` is an `mkApplyMask` pattern (`0` = digit; every built-in format is
|
|
2852
|
+
* digits only). `compact` validates the unmasked value — the form value —
|
|
2853
|
+
* and `validate` adds the national checksum where one exists and is
|
|
2854
|
+
* unambiguous. Formats without a `validate` are pattern-checked only.
|
|
2855
|
+
*/
|
|
2856
|
+
interface MkTaxIdFormat {
|
|
2857
|
+
/** ISO 3166-1 alpha-2 code, uppercase. */
|
|
2858
|
+
country: string;
|
|
2859
|
+
/** Local name of the identifier, e.g. `NIP`. */
|
|
2860
|
+
label: string;
|
|
2861
|
+
/** Input mask; `0` = digit. */
|
|
2862
|
+
mask: string;
|
|
2863
|
+
/** Regex the complete unmasked (compact) value must match. */
|
|
2864
|
+
compact: RegExp;
|
|
2865
|
+
/** Example of a valid identifier, used as the default placeholder. */
|
|
2866
|
+
example: string;
|
|
2867
|
+
/** National checksum over the compact value; omitted when there is none. */
|
|
2868
|
+
validate?: (compact: string) => boolean;
|
|
2869
|
+
}
|
|
2870
|
+
/**
|
|
2871
|
+
* Polish NIP checksum: the weighted sum of the first nine digits modulo 11 is
|
|
2872
|
+
* the tenth (check) digit. A remainder of 10 can never be a digit, so such a
|
|
2873
|
+
* number is invalid whatever its last digit.
|
|
2874
|
+
*/
|
|
2875
|
+
declare function mkNipChecksum(compact: string): boolean;
|
|
2876
|
+
/**
|
|
2877
|
+
* The built-in tax-identifier formats (alphabetical by ISO code). Only Poland
|
|
2878
|
+
* carries a checksum; the rest are length/shape checks, which is what the
|
|
2879
|
+
* national registries publish without ambiguity.
|
|
2880
|
+
*/
|
|
2881
|
+
declare const MK_TAX_ID_FORMATS: readonly MkTaxIdFormat[];
|
|
2882
|
+
/** Look up the built-in format for an ISO country code (case-insensitive). */
|
|
2883
|
+
declare function mkTaxIdFormat(country: string): MkTaxIdFormat | undefined;
|
|
2884
|
+
/**
|
|
2885
|
+
* Full validity for a country: shape plus the national checksum when the
|
|
2886
|
+
* format defines one. Masked and compact input are both accepted; unknown
|
|
2887
|
+
* countries have no rule to fail, so they pass.
|
|
2888
|
+
*/
|
|
2889
|
+
declare function mkTaxIdIsValid(value: string, country: string): boolean;
|
|
2890
|
+
/**
|
|
2891
|
+
* Reactive-forms validator for a business tax identifier in a given country.
|
|
2892
|
+
* Empty values pass (compose with `Validators.required`); countries without a
|
|
2893
|
+
* built-in format pass everything.
|
|
2894
|
+
*
|
|
2895
|
+
* ```ts
|
|
2896
|
+
* nip: ['', [Validators.required, mkTaxIdValidator('PL')]]
|
|
2897
|
+
* ```
|
|
2898
|
+
*/
|
|
2899
|
+
declare function mkTaxIdValidator(country: string): ValidatorFn;
|
|
2900
|
+
/**
|
|
2901
|
+
* TaxIdInput — a business tax-identifier field that masks and validates itself
|
|
2902
|
+
* for the given `country` (`PL` NIP `000-000-00-00`, `DE` USt-IdNr., `CZ` DIČ,
|
|
2903
|
+
* `IT` Partita IVA, `SK` IČ DPH). Poland's NIP is checksum-verified; the other
|
|
2904
|
+
* built-ins are shape-verified.
|
|
2905
|
+
*
|
|
2906
|
+
* Like `MkIbanInput`, the form value is the **compact** identifier (digits
|
|
2907
|
+
* only, e.g. `1234563218`) while the field *displays* it masked
|
|
2908
|
+
* (`123-456-32-18`) — so what is stored is what an API or invoice expects, and
|
|
2909
|
+
* `writeValue()` accepts either form. The placeholder defaults to a valid
|
|
2910
|
+
* example for the country. `valid()` (via `exportAs`) reports `true`/`false`
|
|
2911
|
+
* for a complete identifier passing/failing validation and `null` while empty,
|
|
2912
|
+
* still incomplete or the country is unknown; invalid styling engages after
|
|
2913
|
+
* the field was touched. `mkTaxIdValidator()` covers reactive forms.
|
|
2914
|
+
*
|
|
2915
|
+
* Implements `ControlValueAccessor` and exposes a two-way `value` model, so
|
|
2916
|
+
* `[(ngModel)]`, reactive forms and `[(value)]` all work.
|
|
2917
|
+
*
|
|
2918
|
+
* ```html
|
|
2919
|
+
* <mk-tax-id-input [(ngModel)]="nip" />
|
|
2920
|
+
* <mk-tax-id-input [country]="form.value.country" [(value)]="taxId" />
|
|
2921
|
+
* ```
|
|
2922
|
+
*/
|
|
2923
|
+
declare class MkTaxIdInput implements ControlValueAccessor, Validator {
|
|
2924
|
+
private readonly field;
|
|
2925
|
+
/** Localised strings (override globally via `provideMkI18n`). */
|
|
2926
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
2927
|
+
/** ISO 3166-1 alpha-2 country whose format applies. */
|
|
2928
|
+
readonly country: _angular_core.InputSignal<string>;
|
|
2929
|
+
/** Control size. Ignored when nested in an `mk-form-field`. */
|
|
2930
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
2931
|
+
/** Force invalid styling + `aria-invalid` when used standalone. */
|
|
2932
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2933
|
+
/** Disable the control. */
|
|
2934
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
2935
|
+
/** Placeholder; defaults to a valid example for the country. */
|
|
2936
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
2937
|
+
/** Two-way identifier in compact form (digits only, e.g. `1234563218`). */
|
|
2938
|
+
readonly value: _angular_core.ModelSignal<string>;
|
|
2939
|
+
private readonly touched;
|
|
2940
|
+
private readonly cvaDisabled;
|
|
2941
|
+
private onChange;
|
|
2942
|
+
private onTouched;
|
|
2943
|
+
readonly inputId: string;
|
|
2944
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
2945
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
2946
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
2947
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
2948
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
2949
|
+
/** The active format, or `undefined` for unknown countries (free digits). */
|
|
2950
|
+
protected readonly format: _angular_core.Signal<MkTaxIdFormat | undefined>;
|
|
2951
|
+
/** The compact value rendered through the country's mask. */
|
|
2952
|
+
protected readonly masked: _angular_core.Signal<string>;
|
|
2953
|
+
protected readonly effectivePlaceholder: _angular_core.Signal<string>;
|
|
2954
|
+
protected readonly maxLength: _angular_core.Signal<number>;
|
|
2955
|
+
/**
|
|
2956
|
+
* `true` for a complete identifier passing its format (and checksum),
|
|
2957
|
+
* `false` for a complete-but-wrong one, `null` while empty, still shorter
|
|
2958
|
+
* than the mask allows, or the country has no known format.
|
|
2959
|
+
*/
|
|
2960
|
+
readonly valid: _angular_core.Signal<boolean | null>;
|
|
2961
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
2962
|
+
protected onInput(event: Event): void;
|
|
2963
|
+
protected onBlur(): void;
|
|
2964
|
+
/** Accepts both the masked (`123-456-32-18`) and compact (`1234563218`) form. */
|
|
2965
|
+
writeValue(value: string | null): void;
|
|
2966
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
2967
|
+
registerOnTouched(fn: () => void): void;
|
|
2968
|
+
setDisabledState(isDisabled: boolean): void;
|
|
2969
|
+
private readonly validatorChange;
|
|
2970
|
+
/**
|
|
2971
|
+
* Reports `taxId` for an identifier not matching `[country]`'s format or
|
|
2972
|
+
* failing its checksum — the same error `mkTaxIdValidator()` produces, so
|
|
2973
|
+
* the two are interchangeable. Empty values and unknown countries pass;
|
|
2974
|
+
* compose with `Validators.required` to reject an empty one.
|
|
2975
|
+
*/
|
|
2976
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
2977
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
2978
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkTaxIdInput, never>;
|
|
2979
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkTaxIdInput, "mk-tax-id-input", ["mkTaxIdInput"], { "country": { "alias": "country"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
2980
|
+
}
|
|
2981
|
+
|
|
2982
|
+
/**
|
|
2983
|
+
* SignaturePad — a canvas the user draws a signature on (pointer, touch or
|
|
2984
|
+
* pen). Strokes are captured as smoothed polylines, rendered crisp on hi-DPI
|
|
2985
|
+
* screens and re-drawn losslessly when the pad resizes. The form value is a
|
|
2986
|
+
* PNG data-URL of the drawing (`null` while empty), so it drops straight into
|
|
2987
|
+
* an `<img>`, a form post or an upload.
|
|
2988
|
+
*
|
|
2989
|
+
* A Clear control resets the pad (also available as `clear()`); `isEmpty()`
|
|
2990
|
+
* reports whether anything is drawn. Programmatic values (`writeValue`,
|
|
2991
|
+
* `[value]`) are painted onto the canvas as an image.
|
|
2992
|
+
*
|
|
2993
|
+
* Drawing is inherently pointer-based; pair the pad with an alternative flow
|
|
2994
|
+
* (e.g. a typed-name checkbox) where WCAG requires a keyboard equivalent.
|
|
2995
|
+
*
|
|
2996
|
+
* Implements `ControlValueAccessor` and exposes a two-way `value` model, so
|
|
2997
|
+
* `[(ngModel)]`, reactive forms and `[(value)]` all work.
|
|
2998
|
+
*
|
|
2999
|
+
* ```html
|
|
3000
|
+
* <mk-signature-pad [(ngModel)]="signature" />
|
|
3001
|
+
* <img [src]="signature" alt="Captured signature" />
|
|
3002
|
+
* ```
|
|
3003
|
+
*/
|
|
3004
|
+
declare class MkSignaturePad implements ControlValueAccessor, OnDestroy {
|
|
3005
|
+
private readonly host;
|
|
3006
|
+
private readonly field;
|
|
3007
|
+
private readonly isBrowser;
|
|
3008
|
+
/** Localised strings (override globally via `provideMkI18n`). */
|
|
3009
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
3010
|
+
private readonly canvasRef;
|
|
3011
|
+
/** Stroke width in CSS pixels. */
|
|
3012
|
+
readonly strokeWidth: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
3013
|
+
/** Pad height in CSS pixels (width follows the container). */
|
|
3014
|
+
readonly height: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
3015
|
+
/** Force invalid styling + `aria-invalid` when used standalone. */
|
|
3016
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3017
|
+
/** Disable the control. */
|
|
3018
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3019
|
+
/** Two-way PNG data-URL of the signature (`null` while empty). */
|
|
3020
|
+
readonly value: _angular_core.ModelSignal<string | null>;
|
|
3021
|
+
/** Emits when the pad is cleared (via the button or `clear()`). */
|
|
3022
|
+
readonly cleared: _angular_core.OutputEmitterRef<void>;
|
|
3023
|
+
private readonly strokes;
|
|
3024
|
+
private current;
|
|
3025
|
+
/**
|
|
3026
|
+
* Per-gesture cache: canvas rect, devicePixelRatio and stroke color are
|
|
3027
|
+
* read once at pointerdown so pointermove does no layout/style reads.
|
|
3028
|
+
* Refreshed on a mid-stroke resize, dropped at pointerup/cancel.
|
|
3029
|
+
*/
|
|
3030
|
+
private gesture;
|
|
3031
|
+
/**
|
|
3032
|
+
* Highest smoothing segment of `current` already painted incrementally.
|
|
3033
|
+
* Segment `i` (1-based) is `quadraticCurveTo(p[i], mid(p[i], p[i+1]))` —
|
|
3034
|
+
* exactly the curve `redraw()` produces, so the final full redraw matches.
|
|
3035
|
+
*/
|
|
3036
|
+
private lastSeg;
|
|
3037
|
+
/** Pending animation-frame handle for the incremental draw. */
|
|
3038
|
+
private rafId;
|
|
3039
|
+
private readonly empty;
|
|
3040
|
+
private readonly cvaDisabled;
|
|
3041
|
+
private onChange;
|
|
3042
|
+
private onTouched;
|
|
3043
|
+
private resizeObserver?;
|
|
3044
|
+
/** Set while `value` holds an external image we can't re-derive strokes from. */
|
|
3045
|
+
private externalImage;
|
|
3046
|
+
readonly padId: string;
|
|
3047
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
3048
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
3049
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
3050
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
3051
|
+
/** Whether nothing is drawn yet. */
|
|
3052
|
+
readonly isEmpty: _angular_core.Signal<boolean>;
|
|
3053
|
+
constructor();
|
|
3054
|
+
ngOnDestroy(): void;
|
|
3055
|
+
protected onPointerDown(event: PointerEvent): void;
|
|
3056
|
+
protected onPointerMove(event: PointerEvent): void;
|
|
3057
|
+
protected onPointerUp(): void;
|
|
3058
|
+
/** Clear the drawing (and the form value). */
|
|
3059
|
+
clear(): void;
|
|
3060
|
+
protected onClearClick(): void;
|
|
3061
|
+
private toLocal;
|
|
3062
|
+
/** Snapshot the per-gesture environment (rect, dpr, stroke color). */
|
|
3063
|
+
private cacheGesture;
|
|
3064
|
+
private scheduleFlush;
|
|
3065
|
+
private cancelFlush;
|
|
3066
|
+
/**
|
|
3067
|
+
* Paint only the not-yet-drawn part of the in-flight stroke. Produces the
|
|
3068
|
+
* same midpoint-smoothed curve as `redraw()` minus the trailing straight
|
|
3069
|
+
* cap to the last point, which the final redraw on pointerup adds.
|
|
3070
|
+
*/
|
|
3071
|
+
private drawPending;
|
|
3072
|
+
/** Match the bitmap to the CSS size × devicePixelRatio, then re-render. */
|
|
3073
|
+
private resizeCanvas;
|
|
3074
|
+
private context;
|
|
3075
|
+
private redraw;
|
|
3076
|
+
private emitValue;
|
|
3077
|
+
/** Paint an externally-provided data-URL/image URL onto the pad. */
|
|
3078
|
+
private paintExternal;
|
|
3079
|
+
/**
|
|
3080
|
+
* Marks the control touched once focus leaves it entirely, so a form that
|
|
3081
|
+
* gates its errors on `touched` behaves the same here as on a native input.
|
|
3082
|
+
*/
|
|
3083
|
+
protected onFocusOut(event: FocusEvent): void;
|
|
3084
|
+
writeValue(value: string | null): void;
|
|
3085
|
+
registerOnChange(fn: (value: string | null) => void): void;
|
|
3086
|
+
registerOnTouched(fn: () => void): void;
|
|
3087
|
+
setDisabledState(isDisabled: boolean): void;
|
|
3088
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkSignaturePad, never>;
|
|
3089
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkSignaturePad, "mk-signature-pad", ["mkSignaturePad"], { "strokeWidth": { "alias": "strokeWidth"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "cleared": "cleared"; }, never, never, true, never>;
|
|
3090
|
+
}
|
|
3091
|
+
|
|
3092
|
+
/**
|
|
3093
|
+
* A single segment inside an `mk-button-toggle-group`. Projected content is the
|
|
3094
|
+
* label (text, an icon, or both). Its selected state and keyboard behaviour are
|
|
3095
|
+
* driven by the parent group.
|
|
3096
|
+
*
|
|
3097
|
+
* ```html
|
|
3098
|
+
* <mk-button-toggle value="bold" aria-label="Bold"><b>B</b></mk-button-toggle>
|
|
3099
|
+
* ```
|
|
3100
|
+
*/
|
|
3101
|
+
declare class MkButtonToggle {
|
|
3102
|
+
private readonly group;
|
|
3103
|
+
private readonly btnRef;
|
|
3104
|
+
/** The value contributed to the group's selection when this item is on. */
|
|
3105
|
+
readonly value: _angular_core.InputSignal<unknown>;
|
|
3106
|
+
/** Disable just this item. */
|
|
3107
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3108
|
+
/** Whether this item is currently selected (owned by the parent group). */
|
|
3109
|
+
readonly selected: _angular_core.Signal<boolean>;
|
|
3110
|
+
/** Disabled if the item or the whole group is disabled. */
|
|
3111
|
+
readonly isDisabled: _angular_core.Signal<boolean>;
|
|
3112
|
+
/** `radio` in single-select groups; a plain toggle button in multiple mode. */
|
|
3113
|
+
protected readonly role: _angular_core.Signal<"radio" | null>;
|
|
3114
|
+
/** `aria-checked` for the radio role; `null` otherwise. */
|
|
3115
|
+
protected readonly ariaChecked: _angular_core.Signal<boolean | null>;
|
|
3116
|
+
/** `aria-pressed` for multiple-select toggle buttons; `null` otherwise. */
|
|
3117
|
+
protected readonly ariaPressed: _angular_core.Signal<boolean | null>;
|
|
3118
|
+
/** Roving tabindex position within the group. */
|
|
3119
|
+
protected readonly tabIndex: _angular_core.Signal<number>;
|
|
3120
|
+
protected onClick(): void;
|
|
3121
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
3122
|
+
/** Move focus to this item's button. Called by the parent group. */
|
|
3123
|
+
focus(): void;
|
|
3124
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkButtonToggle, never>;
|
|
3125
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkButtonToggle, "mk-button-toggle", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
3126
|
+
}
|
|
3127
|
+
|
|
3128
|
+
/**
|
|
3129
|
+
* ButtonToggleGroup — a segmented control grouping one or more
|
|
3130
|
+
* `mk-button-toggle` items into a single, keyboard-operable selection.
|
|
3131
|
+
*
|
|
3132
|
+
* In single-select mode (default) the group is an ARIA `radiogroup`: exactly
|
|
3133
|
+
* one item is selected, Arrow keys move and select, and the selected item is
|
|
3134
|
+
* the tab stop. Set `multiple` to allow any number of items — the group
|
|
3135
|
+
* becomes a toolbar of independent `aria-pressed` buttons.
|
|
3136
|
+
*
|
|
3137
|
+
* Implements `ControlValueAccessor` and exposes a two-way `value` model. In
|
|
3138
|
+
* single mode `value` is the chosen item's `value`; in multiple mode it is an
|
|
3139
|
+
* array of the selected values.
|
|
3140
|
+
*
|
|
3141
|
+
* ```html
|
|
3142
|
+
* <mk-button-toggle-group [(value)]="view" aria-label="View">
|
|
3143
|
+
* <mk-button-toggle value="grid">Grid</mk-button-toggle>
|
|
3144
|
+
* <mk-button-toggle value="list">List</mk-button-toggle>
|
|
3145
|
+
* </mk-button-toggle-group>
|
|
3146
|
+
* ```
|
|
3147
|
+
*/
|
|
3148
|
+
declare class MkButtonToggleGroup implements ControlValueAccessor {
|
|
3149
|
+
private readonly host;
|
|
3150
|
+
/** Optional surrounding form field — supplies label/hint/error wiring. */
|
|
3151
|
+
private readonly field;
|
|
3152
|
+
/** Live list of projected toggle items, in DOM order. */
|
|
3153
|
+
readonly toggles: _angular_core.Signal<readonly MkButtonToggle[]>;
|
|
3154
|
+
/** Allow selecting any number of items (toolbar of `aria-pressed` buttons). */
|
|
3155
|
+
readonly multiple: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3156
|
+
/** Control size, applied to every item. Ignored inside an `mk-form-field`. */
|
|
3157
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
3158
|
+
/** The size actually applied (the form field's when nested). */
|
|
3159
|
+
readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
3160
|
+
/** Label / description ids inherited from a surrounding form field. */
|
|
3161
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
3162
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
3163
|
+
/** Semantic color tone used for the selected fill. */
|
|
3164
|
+
readonly tone: _angular_core.InputSignal<MkTone>;
|
|
3165
|
+
/** Disable the whole group. */
|
|
3166
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3167
|
+
/** Force the invalid visual + `aria-invalid` when used standalone. */
|
|
3168
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3169
|
+
/** Accessible name for the group (recommended). */
|
|
3170
|
+
readonly ariaLabel: _angular_core.InputSignal<string>;
|
|
3171
|
+
/**
|
|
3172
|
+
* Two-way selected value. Single mode: the chosen item's `value` (or `null`).
|
|
3173
|
+
* Multiple mode: an array of selected values.
|
|
3174
|
+
*/
|
|
3175
|
+
readonly value: _angular_core.ModelSignal<unknown>;
|
|
3176
|
+
private readonly cvaDisabled;
|
|
3177
|
+
private readonly roving;
|
|
3178
|
+
private onChange;
|
|
3179
|
+
private onTouched;
|
|
3180
|
+
readonly isDisabled: _angular_core.Signal<boolean>;
|
|
3181
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
3182
|
+
/** The single item that currently owns the tab stop (roving tabindex). */
|
|
3183
|
+
private readonly rovingTarget;
|
|
3184
|
+
/** Whether a given item is part of the current selection. */
|
|
3185
|
+
isSelected(toggle: MkButtonToggle): boolean;
|
|
3186
|
+
/** `0` for the item that owns the tab stop, `-1` for the rest. */
|
|
3187
|
+
tabIndexFor(toggle: MkButtonToggle): number;
|
|
3188
|
+
/** Toggle (multiple) or set (single) the selection for an item. */
|
|
3189
|
+
select(toggle: MkButtonToggle): void;
|
|
3190
|
+
onKeydown(event: KeyboardEvent, toggle: MkButtonToggle): void;
|
|
3191
|
+
private nextEnabled;
|
|
3192
|
+
private commit;
|
|
3193
|
+
/**
|
|
3194
|
+
* Marks the control touched once focus leaves it entirely, so a form that
|
|
3195
|
+
* gates its errors on `touched` behaves the same here as on a native input.
|
|
3196
|
+
*/
|
|
3197
|
+
protected onFocusOut(event: FocusEvent): void;
|
|
3198
|
+
writeValue(value: unknown): void;
|
|
3199
|
+
registerOnChange(fn: (value: unknown) => void): void;
|
|
3200
|
+
registerOnTouched(fn: () => void): void;
|
|
3201
|
+
setDisabledState(isDisabled: boolean): void;
|
|
3202
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkButtonToggleGroup, never>;
|
|
3203
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkButtonToggleGroup, "mk-button-toggle-group", never, { "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "tone": { "alias": "tone"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, ["toggles"], ["*"], true, never>;
|
|
3204
|
+
}
|
|
3205
|
+
|
|
3206
|
+
/**
|
|
3207
|
+
* Radio — a single option within an `mk-radio-group`. Rendered as
|
|
3208
|
+
* `role="radio"` with a roving tabindex managed by the parent group, so the
|
|
3209
|
+
* whole group is a single Tab stop and Arrow keys move between options.
|
|
3210
|
+
*
|
|
3211
|
+
* Must be used as a child of `mk-radio-group`.
|
|
3212
|
+
*
|
|
3213
|
+
* ```html
|
|
3214
|
+
* <mk-radio [value]="'pro'">Pro plan</mk-radio>
|
|
3215
|
+
* ```
|
|
3216
|
+
*/
|
|
3217
|
+
declare class MkRadio implements OnInit, OnDestroy {
|
|
3218
|
+
protected readonly group: MkRadioGroup;
|
|
3219
|
+
private readonly host;
|
|
3220
|
+
/** The value contributed to the group when this radio is selected. */
|
|
3221
|
+
readonly value: _angular_core.InputSignal<unknown>;
|
|
3222
|
+
/** Disable just this radio. */
|
|
3223
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3224
|
+
protected readonly size: Signal<MkSize>;
|
|
3225
|
+
readonly checked: Signal<boolean>;
|
|
3226
|
+
readonly isDisabled: Signal<boolean>;
|
|
3227
|
+
/** Roving tabindex: the checked radio (or the first enabled one) is tabbable. */
|
|
3228
|
+
protected readonly tabindex: Signal<number>;
|
|
3229
|
+
ngOnInit(): void;
|
|
3230
|
+
ngOnDestroy(): void;
|
|
3231
|
+
/** Focus this radio's host element (used by the group's keyboard nav). */
|
|
3232
|
+
focus(): void;
|
|
3233
|
+
protected onClick(): void;
|
|
3234
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkRadio, never>;
|
|
3235
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkRadio, "mk-radio", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
3236
|
+
}
|
|
3237
|
+
|
|
3238
|
+
/**
|
|
3239
|
+
* RadioGroup — an ARIA `radiogroup` that coordinates projected `mk-radio`
|
|
3240
|
+
* children. It manages a single selected value with roving tabindex and
|
|
3241
|
+
* Arrow-key navigation (Up/Left = previous, Down/Right = next, wrapping and
|
|
3242
|
+
* skipping disabled radios).
|
|
3243
|
+
*
|
|
3244
|
+
* Implements `ControlValueAccessor` with a two-way `value` model.
|
|
3245
|
+
*
|
|
3246
|
+
* ```html
|
|
3247
|
+
* <mk-radio-group [(ngModel)]="plan" aria-label="Plan">
|
|
3248
|
+
* <mk-radio [value]="'free'">Free</mk-radio>
|
|
3249
|
+
* <mk-radio [value]="'pro'">Pro</mk-radio>
|
|
3250
|
+
* </mk-radio-group>
|
|
3251
|
+
* ```
|
|
3252
|
+
*/
|
|
3253
|
+
declare class MkRadioGroup implements ControlValueAccessor, Validator {
|
|
3254
|
+
private readonly host;
|
|
3255
|
+
private readonly field;
|
|
3256
|
+
/** Two-way selected value. */
|
|
3257
|
+
readonly value: _angular_core.ModelSignal<unknown>;
|
|
3258
|
+
/** Disable the whole group. */
|
|
3259
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3260
|
+
/** Force the invalid visual + `aria-invalid` when used standalone. */
|
|
3261
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3262
|
+
/** Mark required (adds `aria-required`). */
|
|
3263
|
+
readonly required: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3264
|
+
/** Size applied to all child radios. */
|
|
3265
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
3266
|
+
/** Semantic color tone applied to all child radios. */
|
|
3267
|
+
readonly tone: _angular_core.InputSignal<MkTone>;
|
|
3268
|
+
/** Shared `name` grouping (defaults to a generated unique name). */
|
|
3269
|
+
readonly name: _angular_core.InputSignal<string>;
|
|
3270
|
+
/** Layout direction; also sets arrow-key mapping expectations. */
|
|
3271
|
+
readonly orientation: _angular_core.InputSignal<"horizontal" | "vertical">;
|
|
3272
|
+
private readonly radios;
|
|
3273
|
+
private readonly cvaDisabled;
|
|
3274
|
+
private onChange;
|
|
3275
|
+
private onTouched;
|
|
3276
|
+
readonly isDisabled: Signal<boolean>;
|
|
3277
|
+
protected readonly isRequired: Signal<boolean>;
|
|
3278
|
+
protected readonly isInvalid: Signal<boolean>;
|
|
3279
|
+
protected readonly labelledBy: Signal<string | null>;
|
|
3280
|
+
protected readonly describedBy: Signal<string | null>;
|
|
3281
|
+
/** Whether a radio currently matches the selected value. */
|
|
3282
|
+
readonly hasChecked: Signal<boolean>;
|
|
3283
|
+
/** Register a child radio (called from `mk-radio` on init). */
|
|
3284
|
+
register(radio: MkRadio): void;
|
|
3285
|
+
/** Unregister a child radio (called on destroy). */
|
|
3286
|
+
unregister(radio: MkRadio): void;
|
|
3287
|
+
/** True when `radio` matches the group's current value. */
|
|
3288
|
+
isChecked(radio: MkRadio): boolean;
|
|
3289
|
+
/** The radio that should be tabbable when nothing is selected. */
|
|
3290
|
+
readonly firstEnabled: Signal<MkRadio | null>;
|
|
3291
|
+
/** Select a radio's value (guarded by disabled state). */
|
|
3292
|
+
select(radio: MkRadio): void;
|
|
3293
|
+
protected onKeydown(event: Event): void;
|
|
3294
|
+
/**
|
|
3295
|
+
* Marks the control touched once focus leaves it entirely, so a form that
|
|
3296
|
+
* gates its errors on `touched` behaves the same here as on a native input.
|
|
3297
|
+
*/
|
|
3298
|
+
protected onFocusOut(event: FocusEvent): void;
|
|
3299
|
+
writeValue(value: unknown): void;
|
|
3300
|
+
registerOnChange(fn: (value: unknown) => void): void;
|
|
3301
|
+
registerOnTouched(fn: () => void): void;
|
|
3302
|
+
setDisabledState(isDisabled: boolean): void;
|
|
3303
|
+
private readonly validatorChange;
|
|
3304
|
+
/**
|
|
3305
|
+
* Reports `required` when `[required]` is set and no radio is selected.
|
|
3306
|
+
*/
|
|
3307
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
3308
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
3309
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkRadioGroup, never>;
|
|
3310
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkRadioGroup, "mk-radio-group", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "tone": { "alias": "tone"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, ["*"], true, never>;
|
|
3311
|
+
}
|
|
3312
|
+
|
|
3313
|
+
/**
|
|
3314
|
+
* Switch — a toggle with `role="switch"` and an animated knob. Operable with
|
|
3315
|
+
* Space/Enter, projects its label, and supports size + tone.
|
|
3316
|
+
*
|
|
3317
|
+
* Implements `ControlValueAccessor` with a two-way `checked` model, so it works
|
|
3318
|
+
* with `[(ngModel)]`, reactive forms and `[(checked)]`.
|
|
3319
|
+
*
|
|
3320
|
+
* ```html
|
|
3321
|
+
* <mk-switch [(ngModel)]="notify">Email notifications</mk-switch>
|
|
3322
|
+
* <mk-switch [(checked)]="dark" tone="success" size="lg">Dark mode</mk-switch>
|
|
3323
|
+
* ```
|
|
3324
|
+
*/
|
|
3325
|
+
declare class MkSwitch implements ControlValueAccessor {
|
|
3326
|
+
private readonly field;
|
|
3327
|
+
/** Two-way checked (on/off) state. */
|
|
3328
|
+
readonly checked: _angular_core.ModelSignal<boolean>;
|
|
3329
|
+
/** Disable the control. */
|
|
3330
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3331
|
+
/** Force the invalid visual + `aria-invalid` when used standalone. */
|
|
3332
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3333
|
+
/** Control size. */
|
|
3334
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
3335
|
+
/** Semantic color tone for the "on" track. */
|
|
3336
|
+
readonly tone: _angular_core.InputSignal<MkTone>;
|
|
3337
|
+
/** Accessible label when no text content is projected. */
|
|
3338
|
+
readonly ariaLabel: _angular_core.InputSignal<string>;
|
|
3339
|
+
private readonly cvaDisabled;
|
|
3340
|
+
private onChange;
|
|
3341
|
+
protected onTouched: () => void;
|
|
3342
|
+
readonly labelId: string;
|
|
3343
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
3344
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
3345
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
3346
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
3347
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
3348
|
+
protected toggle(): void;
|
|
3349
|
+
protected onKeydown(event: Event): void;
|
|
3350
|
+
writeValue(value: unknown): void;
|
|
3351
|
+
registerOnChange(fn: (value: boolean) => void): void;
|
|
3352
|
+
registerOnTouched(fn: () => void): void;
|
|
3353
|
+
setDisabledState(isDisabled: boolean): void;
|
|
3354
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkSwitch, never>;
|
|
3355
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkSwitch, "mk-switch", never, { "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "tone": { "alias": "tone"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; }, { "checked": "checkedChange"; }, never, ["*"], true, never>;
|
|
3356
|
+
}
|
|
3357
|
+
|
|
3358
|
+
/**
|
|
3359
|
+
* Slider — a single-value range slider with `role="slider"`, a filled track and
|
|
3360
|
+
* a draggable thumb (pointer events). Fully keyboard operable: Arrow keys step,
|
|
3361
|
+
* Page Up/Down take larger steps, Home/End jump to the bounds.
|
|
3362
|
+
*
|
|
3363
|
+
* Implements `ControlValueAccessor` with a two-way `value` model, so it works
|
|
3364
|
+
* with `[(ngModel)]`, reactive forms and `[(value)]`.
|
|
3365
|
+
*
|
|
3366
|
+
* ```html
|
|
3367
|
+
* <mk-slider [min]="0" [max]="100" [step]="5" [(ngModel)]="volume" />
|
|
3368
|
+
* ```
|
|
3369
|
+
*/
|
|
3370
|
+
declare class MkSlider implements ControlValueAccessor, Validator, OnDestroy {
|
|
3371
|
+
private readonly field;
|
|
3372
|
+
private readonly trackRef;
|
|
3373
|
+
private readonly thumbRef;
|
|
3374
|
+
/** Minimum value. */
|
|
3375
|
+
readonly min: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
3376
|
+
/** Maximum value. */
|
|
3377
|
+
readonly max: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
3378
|
+
/** Step increment (must be > 0). */
|
|
3379
|
+
readonly step: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
3380
|
+
/** Disable the control. */
|
|
3381
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3382
|
+
/** Force the invalid visual + `aria-invalid` when used standalone. */
|
|
3383
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3384
|
+
/** Control size (track/thumb thickness). */
|
|
3385
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
3386
|
+
/** Semantic color tone for the filled track + thumb. */
|
|
3387
|
+
readonly tone: _angular_core.InputSignal<MkTone>;
|
|
3388
|
+
/** Accessible label for the thumb. */
|
|
3389
|
+
readonly ariaLabel: _angular_core.InputSignal<string>;
|
|
3390
|
+
/** Two-way current value. */
|
|
3391
|
+
readonly value: _angular_core.ModelSignal<number>;
|
|
3392
|
+
private dragging;
|
|
3393
|
+
/** Element the drag listeners are attached to (only while dragging). */
|
|
3394
|
+
private dragTarget;
|
|
3395
|
+
/** Track geometry cached at pointerdown — no layout reads per move. */
|
|
3396
|
+
private dragRect;
|
|
3397
|
+
/** Text direction cached at pointerdown (keyboard keeps live reads). */
|
|
3398
|
+
private dragRtl;
|
|
3399
|
+
private readonly cvaDisabled;
|
|
3400
|
+
private onChange;
|
|
3401
|
+
private onTouched;
|
|
3402
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
3403
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
3404
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
3405
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
3406
|
+
protected readonly describedBy: _angular_core.Signal<string | null>;
|
|
3407
|
+
/** Fill percentage (0–100) for the track + thumb position. */
|
|
3408
|
+
protected readonly percent: _angular_core.Signal<number>;
|
|
3409
|
+
private get bigStep();
|
|
3410
|
+
protected onKeydown(event: Event): void;
|
|
3411
|
+
protected onPointerDown(event: Event): void;
|
|
3412
|
+
private readonly onDragMove;
|
|
3413
|
+
private readonly onDragEnd;
|
|
3414
|
+
/** Blur while dragging releases the drag (template binding). */
|
|
3415
|
+
protected onPointerUp(): void;
|
|
3416
|
+
private endDrag;
|
|
3417
|
+
ngOnDestroy(): void;
|
|
3418
|
+
/** Whether the rendered track is right-to-left. */
|
|
3419
|
+
private isRtl;
|
|
3420
|
+
/** Pointer-drag path only — uses the geometry cached at pointerdown. */
|
|
3421
|
+
private updateFromClientX;
|
|
3422
|
+
private setValue;
|
|
3423
|
+
private clampSnap;
|
|
3424
|
+
writeValue(value: unknown): void;
|
|
3425
|
+
registerOnChange(fn: (value: number) => void): void;
|
|
3426
|
+
registerOnTouched(fn: () => void): void;
|
|
3427
|
+
setDisabledState(isDisabled: boolean): void;
|
|
3428
|
+
private readonly validatorChange;
|
|
3429
|
+
/**
|
|
3430
|
+
* Reports `min` / `max` for a value outside the track. The slider clamps
|
|
3431
|
+
* what the user can produce, so this only fires for a value written in
|
|
3432
|
+
* from the model side.
|
|
3433
|
+
*/
|
|
3434
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
3435
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
3436
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkSlider, never>;
|
|
3437
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkSlider, "mk-slider", never, { "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "step": { "alias": "step"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "tone": { "alias": "tone"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
3438
|
+
}
|
|
3439
|
+
|
|
3440
|
+
/**
|
|
3441
|
+
* ColorPicker — a compact color control: a live swatch that opens the native OS
|
|
3442
|
+
* picker, an editable hex field and an optional row of preset swatches.
|
|
3443
|
+
* `ControlValueAccessor` + two-way `value` model over a hex string.
|
|
3444
|
+
*
|
|
3445
|
+
* ```html
|
|
3446
|
+
* <mk-color-picker [(value)]="brand" [swatches]="palette" />
|
|
3447
|
+
* ```
|
|
3448
|
+
*/
|
|
3449
|
+
declare class MkColorPicker implements ControlValueAccessor {
|
|
3450
|
+
private readonly field;
|
|
3451
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
3452
|
+
private readonly nativeRef;
|
|
3453
|
+
/** Two-way hex color value. */
|
|
3454
|
+
readonly value: _angular_core.ModelSignal<string>;
|
|
3455
|
+
/** Preset swatches (hex strings). */
|
|
3456
|
+
readonly swatches: _angular_core.InputSignal<readonly string[]>;
|
|
3457
|
+
/** Show the editable hex text field. */
|
|
3458
|
+
readonly hexInput: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3459
|
+
/** Disable the control. */
|
|
3460
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3461
|
+
/** Force invalid styling when standalone. */
|
|
3462
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3463
|
+
/** Control size. Ignored inside an `mk-form-field`. */
|
|
3464
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
3465
|
+
/** Accessible label for the swatch trigger. */
|
|
3466
|
+
readonly ariaLabel: _angular_core.InputSignal<string>;
|
|
3467
|
+
readonly inputId: string;
|
|
3468
|
+
/** Uncommitted text in the hex field (may be partial while typing). */
|
|
3469
|
+
protected readonly hexText: _angular_core.WritableSignal<string>;
|
|
3470
|
+
private readonly cvaDisabled;
|
|
3471
|
+
private onChange;
|
|
3472
|
+
private onTouched;
|
|
3473
|
+
constructor();
|
|
3474
|
+
protected readonly effectiveSize: _angular_core.Signal<MkSize>;
|
|
3475
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
3476
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
3477
|
+
protected readonly isRequired: _angular_core.Signal<boolean>;
|
|
3478
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
3479
|
+
protected readonly nativeValue: _angular_core.Signal<string>;
|
|
3480
|
+
/** Open the OS color picker (via the hidden native input). */
|
|
3481
|
+
protected openNative(): void;
|
|
3482
|
+
protected onNativeInput(event: Event): void;
|
|
3483
|
+
protected onHexInput(event: Event): void;
|
|
3484
|
+
protected commitHex(): void;
|
|
3485
|
+
protected pickSwatch(hex: string): void;
|
|
3486
|
+
private setValue;
|
|
3487
|
+
writeValue(value: string | null): void;
|
|
3488
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
3489
|
+
registerOnTouched(fn: () => void): void;
|
|
3490
|
+
setDisabledState(isDisabled: boolean): void;
|
|
3491
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkColorPicker, never>;
|
|
3492
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkColorPicker, "mk-color-picker", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "swatches": { "alias": "swatches"; "required": false; "isSignal": true; }; "hexInput": { "alias": "hexInput"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
3493
|
+
}
|
|
3494
|
+
|
|
3495
|
+
/** A `[low, high]` value pair. */
|
|
3496
|
+
type MkRange = [number, number];
|
|
3497
|
+
/**
|
|
3498
|
+
* RangeSlider — a two-thumb slider selecting a `[low, high]` range. Each thumb is
|
|
3499
|
+
* a `role="slider"` (Arrow / Page / Home / End keys); the thumbs can't cross.
|
|
3500
|
+
* Implements `ControlValueAccessor` over a `[number, number]` tuple with a
|
|
3501
|
+
* two-way `value` model.
|
|
3502
|
+
*
|
|
3503
|
+
* ```html
|
|
3504
|
+
* <mk-range-slider [min]="0" [max]="1000" [step]="10" [(value)]="priceRange" />
|
|
3505
|
+
* ```
|
|
3506
|
+
*/
|
|
3507
|
+
declare class MkRangeSlider implements ControlValueAccessor, Validator, OnDestroy {
|
|
3508
|
+
private readonly host;
|
|
3509
|
+
private readonly field;
|
|
3510
|
+
protected readonly i18n: _mk_kit_ui_core.MkI18nStrings;
|
|
3511
|
+
private readonly trackRef;
|
|
3512
|
+
private readonly thumbRefs;
|
|
3513
|
+
/** Minimum value. */
|
|
3514
|
+
readonly min: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
3515
|
+
/** Maximum value. */
|
|
3516
|
+
readonly max: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
3517
|
+
/** Step increment (must be > 0). */
|
|
3518
|
+
readonly step: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
3519
|
+
/** Disable the control. */
|
|
3520
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3521
|
+
/** Force the invalid visual + `aria-invalid` when used standalone. */
|
|
3522
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
3523
|
+
/** Control size. */
|
|
3524
|
+
readonly size: _angular_core.InputSignal<MkSize>;
|
|
3525
|
+
/** Semantic tone for the filled range + thumbs. */
|
|
3526
|
+
readonly tone: _angular_core.InputSignal<MkTone>;
|
|
3527
|
+
/** Accessible label for the low thumb. */
|
|
3528
|
+
readonly minLabel: _angular_core.InputSignal<string>;
|
|
3529
|
+
/** Accessible label for the high thumb. */
|
|
3530
|
+
readonly maxLabel: _angular_core.InputSignal<string>;
|
|
3531
|
+
/** Two-way `[low, high]` value. */
|
|
3532
|
+
readonly value: _angular_core.ModelSignal<MkRange>;
|
|
3533
|
+
private activeThumb;
|
|
3534
|
+
/** Element the drag listeners are attached to (only while dragging). */
|
|
3535
|
+
private dragTarget;
|
|
3536
|
+
/** Track geometry cached at pointerdown — no layout reads per move. */
|
|
3537
|
+
private dragRect;
|
|
3538
|
+
/** Text direction cached at pointerdown (keyboard keeps live reads). */
|
|
3539
|
+
private dragRtl;
|
|
3540
|
+
private readonly cvaDisabled;
|
|
3541
|
+
private onChange;
|
|
3542
|
+
private onTouched;
|
|
3543
|
+
protected readonly low: _angular_core.Signal<number>;
|
|
3544
|
+
protected readonly high: _angular_core.Signal<number>;
|
|
3545
|
+
protected readonly isDisabled: _angular_core.Signal<boolean>;
|
|
3546
|
+
protected readonly isInvalid: _angular_core.Signal<boolean>;
|
|
3547
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
3548
|
+
private pct;
|
|
3549
|
+
protected readonly lowPercent: _angular_core.Signal<number>;
|
|
3550
|
+
protected readonly highPercent: _angular_core.Signal<number>;
|
|
3551
|
+
private get bigStep();
|
|
3552
|
+
protected onKeydown(thumb: 0 | 1, event: Event): void;
|
|
3553
|
+
protected onPointerDown(event: Event): void;
|
|
3554
|
+
private readonly onDragMove;
|
|
3555
|
+
private readonly onDragEnd;
|
|
3556
|
+
private endDrag;
|
|
3557
|
+
ngOnDestroy(): void;
|
|
3558
|
+
/** Whether the rendered track is right-to-left. */
|
|
3559
|
+
private isRtl;
|
|
3560
|
+
/** Pointer-drag path only — uses the geometry cached at pointerdown. */
|
|
3561
|
+
private rawFromClientX;
|
|
3562
|
+
private setThumb;
|
|
3563
|
+
private clampSnap;
|
|
3564
|
+
/**
|
|
3565
|
+
* Marks the control touched once focus leaves it entirely, so a form that
|
|
3566
|
+
* gates its errors on `touched` behaves the same here as on a native input.
|
|
3567
|
+
*/
|
|
3568
|
+
protected onFocusOut(event: FocusEvent): void;
|
|
3569
|
+
writeValue(value: MkRange | null): void;
|
|
3570
|
+
registerOnChange(fn: (value: MkRange) => void): void;
|
|
3571
|
+
registerOnTouched(fn: () => void): void;
|
|
3572
|
+
setDisabledState(isDisabled: boolean): void;
|
|
3573
|
+
private readonly validatorChange;
|
|
3574
|
+
/**
|
|
3575
|
+
* Reports `min` / `max` for either endpoint falling outside the track. The
|
|
3576
|
+
* slider clamps what the user can produce, so this only fires for a range
|
|
3577
|
+
* written in from the model side.
|
|
3578
|
+
*/
|
|
3579
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
3580
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
3581
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkRangeSlider, never>;
|
|
3582
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkRangeSlider, "mk-range-slider", never, { "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "step": { "alias": "step"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "tone": { "alias": "tone"; "required": false; "isSignal": true; }; "minLabel": { "alias": "minLabel"; "required": false; "isSignal": true; }; "maxLabel": { "alias": "maxLabel"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
|
|
3583
|
+
}
|
|
3584
|
+
|
|
3585
|
+
export { MK_CARD_BRAND_NAMES, MK_IBAN_LENGTHS, MK_KEYBOARD_LAYOUT_QWERTY_PL, MK_PHONE_COUNTRIES, MK_POSTAL_FORMATS, MK_TAX_ID_FORMATS, MkAutocomplete, MkButtonToggle, MkButtonToggleGroup, MkCardNumberInput, MkCodeEditor, MkColorPicker, MkCurrencyInput, MkFileUpload, MkFormErrorSummary, MkFormField, MkI18nInput, MkIbanInput, MkInput, MkInputGroup, MkMention, MkMentionPanel, MkMultiSelect, MkNumberInput, MkNumericKeypad, MkOnScreenKeyboard, MkOnScreenKeyboardTrigger, MkOtp, MkPasswordInput, MkPhoneInput, MkPostalCodeInput, MkRadio, MkRadioGroup, MkRangeSlider, MkRating, MkRepeater, MkRepeaterEmpty, MkRepeaterRow, MkSelect, MkSignaturePad, MkSlider, MkSubmitInput, MkSwitch, MkTagInput, MkTaxIdInput, MkTransferList, MkTreeSelect, mkCountryFlag, mkDetectCardBrand, mkIbanChecksum, mkIbanIsValid, mkIbanValidator, mkLuhnCheck, mkNipChecksum, mkPostalCodeValidator, mkPostalFormat, mkTaxIdFormat, mkTaxIdIsValid, mkTaxIdValidator };
|
|
3586
|
+
export type { MkAutocompleteFilterMode, MkAutocompleteOption, MkCardBrand, MkCodeValidity, MkFormError, MkI18nLocale, MkI18nValue, MkKeyboardActionKey, MkKeyboardKey, MkKeyboardLayout, MkMentionFilterMode, MkMentionOption, MkMentionSearchEvent, MkMentionSelectEvent, MkMultiSelectFilterMode, MkMultiSelectOption, MkNumericKeypadMode, MkOnScreenKeyboardTarget, MkPasswordRule, MkPhoneCountry, MkPhoneValue, MkPostalFormat, MkRange, MkRepeaterRowContext, MkSelectOption, MkTaxIdFormat, MkTransferItem, MkUploadFile, MkUploadFn, MkUploadRejection, MkUploadStatus, MkUploadValueFormat };
|