@mk-kit/ui 0.42.0 → 0.44.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.
Files changed (57) hide show
  1. package/README.md +5 -3
  2. package/THIRD_PARTY_NOTICES.md +4 -2
  3. package/fesm2022/mk-kit-ui-block-editor.mjs +4 -2
  4. package/fesm2022/mk-kit-ui-block-editor.mjs.map +1 -1
  5. package/fesm2022/mk-kit-ui-checkbox.mjs +4 -2
  6. package/fesm2022/mk-kit-ui-checkbox.mjs.map +1 -1
  7. package/fesm2022/mk-kit-ui-core.mjs +136 -1
  8. package/fesm2022/mk-kit-ui-core.mjs.map +1 -1
  9. package/fesm2022/mk-kit-ui-data.mjs +438 -8
  10. package/fesm2022/mk-kit-ui-data.mjs.map +1 -1
  11. package/fesm2022/mk-kit-ui-datetime.mjs +88 -50
  12. package/fesm2022/mk-kit-ui-datetime.mjs.map +1 -1
  13. package/fesm2022/mk-kit-ui-directives.mjs +27 -8
  14. package/fesm2022/mk-kit-ui-directives.mjs.map +1 -1
  15. package/fesm2022/mk-kit-ui-dnd.mjs +43 -8
  16. package/fesm2022/mk-kit-ui-dnd.mjs.map +1 -1
  17. package/fesm2022/mk-kit-ui-dynamic-form.mjs +149 -2
  18. package/fesm2022/mk-kit-ui-dynamic-form.mjs.map +1 -1
  19. package/fesm2022/mk-kit-ui-feedback.mjs +1 -1
  20. package/fesm2022/mk-kit-ui-feedback.mjs.map +1 -1
  21. package/fesm2022/mk-kit-ui-forms.mjs +326 -78
  22. package/fesm2022/mk-kit-ui-forms.mjs.map +1 -1
  23. package/fesm2022/mk-kit-ui-icon-extended.mjs +425 -0
  24. package/fesm2022/mk-kit-ui-icon-extended.mjs.map +1 -0
  25. package/fesm2022/mk-kit-ui-icon.mjs +296 -459
  26. package/fesm2022/mk-kit-ui-icon.mjs.map +1 -1
  27. package/fesm2022/mk-kit-ui-media.mjs +1 -1
  28. package/fesm2022/mk-kit-ui-media.mjs.map +1 -1
  29. package/fesm2022/mk-kit-ui-query-builder.mjs +1 -1
  30. package/fesm2022/mk-kit-ui-query-builder.mjs.map +1 -1
  31. package/fesm2022/mk-kit-ui-rich-text.mjs +4 -2
  32. package/fesm2022/mk-kit-ui-rich-text.mjs.map +1 -1
  33. package/fesm2022/mk-kit-ui-table.mjs +668 -24
  34. package/fesm2022/mk-kit-ui-table.mjs.map +1 -1
  35. package/fesm2022/mk-kit-ui-testing.mjs +54 -0
  36. package/fesm2022/mk-kit-ui-testing.mjs.map +1 -1
  37. package/fesm2022/mk-kit-ui.mjs +1 -0
  38. package/fesm2022/mk-kit-ui.mjs.map +1 -1
  39. package/package.json +5 -1
  40. package/schematics/migrate-primeng/transform.js +4 -1
  41. package/schematics/ng-add/index.js +30 -2
  42. package/schematics/ng-add/schema.json +6 -0
  43. package/types/mk-kit-ui-block-editor.d.ts +2 -0
  44. package/types/mk-kit-ui-checkbox.d.ts +2 -0
  45. package/types/mk-kit-ui-core.d.ts +82 -2
  46. package/types/mk-kit-ui-data.d.ts +203 -2
  47. package/types/mk-kit-ui-datetime.d.ts +41 -19
  48. package/types/mk-kit-ui-directives.d.ts +12 -6
  49. package/types/mk-kit-ui-dnd.d.ts +32 -4
  50. package/types/mk-kit-ui-dynamic-form.d.ts +44 -1
  51. package/types/mk-kit-ui-forms.d.ts +154 -16
  52. package/types/mk-kit-ui-icon-extended.d.ts +83 -0
  53. package/types/mk-kit-ui-icon.d.ts +100 -17
  54. package/types/mk-kit-ui-rich-text.d.ts +2 -0
  55. package/types/mk-kit-ui-table.d.ts +234 -25
  56. package/types/mk-kit-ui-testing.d.ts +16 -0
  57. package/types/mk-kit-ui.d.ts +1 -0
@@ -323,6 +323,12 @@ declare class MkDropList<T = unknown> {
323
323
  * move items across lists by keyboard.
324
324
  */
325
325
  readonly mkDropListLabel: _angular_core.InputSignal<string>;
326
+ /**
327
+ * Id of the element that names the list (`aria-labelledby`), e.g. a
328
+ * visible heading. Takes precedence over `mkDropListLabel` as the
329
+ * accessible name; the label is still used in announcements.
330
+ */
331
+ readonly mkDropListLabelledBy: _angular_core.InputSignal<string>;
326
332
  /** Layout axis; controls pointer hit-testing and arrow-key direction. */
327
333
  readonly mkDropListOrientation: _angular_core.InputSignal<MkDropListOrientation>;
328
334
  /** Disable dropping into (and dragging out of) this list. */
@@ -348,7 +354,11 @@ declare class MkDropList<T = unknown> {
348
354
  protected readonly orientationAllowed: _angular_core.Signal<boolean>;
349
355
  /** A static `aria-label` written in the template, kept when no label input is set. */
350
356
  private readonly staticAriaLabel;
351
- /** Accessible name of the list: `mkDropListLabel`, else the template's own. */
357
+ /**
358
+ * Accessible name of the list: `mkDropListLabel`, else the template's own.
359
+ * Omitted while `mkDropListLabelledBy` names the list, so the referenced
360
+ * element is the single source of the name.
361
+ */
352
362
  protected readonly ariaLabel: _angular_core.Signal<string | null>;
353
363
  /** Connected-list ids, normalised to a plain array. */
354
364
  readonly connectedTo: _angular_core.Signal<readonly string[]>;
@@ -368,7 +378,7 @@ declare class MkDropList<T = unknown> {
368
378
  /** Emit a drop into this list. Called by the active `MkDrag`. */
369
379
  emitDrop(event: MkDropEvent<any>): void;
370
380
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkDropList<any>, never>;
371
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkDropList<any>, "[mkDropList]", ["mkDropList"], { "mkDropListData": { "alias": "mkDropListData"; "required": false; "isSignal": true; }; "mkDropListId": { "alias": "mkDropListId"; "required": false; "isSignal": true; }; "mkDropListConnectedTo": { "alias": "mkDropListConnectedTo"; "required": false; "isSignal": true; }; "mkDropListLabel": { "alias": "mkDropListLabel"; "required": false; "isSignal": true; }; "mkDropListOrientation": { "alias": "mkDropListOrientation"; "required": false; "isSignal": true; }; "mkDropListDisabled": { "alias": "mkDropListDisabled"; "required": false; "isSignal": true; }; }, { "mkDropListDropped": "mkDropListDropped"; }, ["drags"], ["*"], true, never>;
381
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkDropList<any>, "[mkDropList]", ["mkDropList"], { "mkDropListData": { "alias": "mkDropListData"; "required": false; "isSignal": true; }; "mkDropListId": { "alias": "mkDropListId"; "required": false; "isSignal": true; }; "mkDropListConnectedTo": { "alias": "mkDropListConnectedTo"; "required": false; "isSignal": true; }; "mkDropListLabel": { "alias": "mkDropListLabel"; "required": false; "isSignal": true; }; "mkDropListLabelledBy": { "alias": "mkDropListLabelledBy"; "required": false; "isSignal": true; }; "mkDropListOrientation": { "alias": "mkDropListOrientation"; "required": false; "isSignal": true; }; "mkDropListDisabled": { "alias": "mkDropListDisabled"; "required": false; "isSignal": true; }; }, { "mkDropListDropped": "mkDropListDropped"; }, ["drags"], ["*"], true, never>;
372
382
  }
373
383
 
374
384
  /** Layout axis a drop list lays its items along. */
@@ -475,8 +485,13 @@ declare class MkDragDropRegistry {
475
485
  *
476
486
  * For connected buckets / kanban, use `[mkDropList]` + `[mkDrag]` directly.
477
487
  *
488
+ * The list renders as a named `group` of `button` items: pass `label` (or
489
+ * `labelledBy` pointing at a visible heading) so screen readers say what is
490
+ * being reordered — the i18n `sortableListLabel` ("Sortable list") is the
491
+ * fallback.
492
+ *
478
493
  * ```html
479
- * <mk-sortable-list [(items)]="rows">
494
+ * <mk-sortable-list [(items)]="rows" label="Steps">
480
495
  * <ng-template let-row let-i="index">
481
496
  * <span mkDragHandle aria-hidden="true">⠿</span> {{ i + 1 }}. {{ row.name }}
482
497
  * </ng-template>
@@ -486,8 +501,19 @@ declare class MkDragDropRegistry {
486
501
  * @typeParam T item data type.
487
502
  */
488
503
  declare class MkSortableList<T = unknown> {
504
+ private readonly i18n;
489
505
  /** The ordered items (two-way). Reordered in place on drop. */
490
506
  readonly items: _angular_core.ModelSignal<T[]>;
507
+ /**
508
+ * Accessible name of the list (`aria-label`), also used in the
509
+ * "moved into …" announcements. Defaults to the i18n `sortableListLabel`.
510
+ */
511
+ readonly label: _angular_core.InputSignal<string | undefined>;
512
+ /**
513
+ * Id of an element that names the list (`aria-labelledby`), e.g. a visible
514
+ * heading. Wins over `label` as the accessible name.
515
+ */
516
+ readonly labelledBy: _angular_core.InputSignal<string | undefined>;
491
517
  /** Layout axis of the list. */
492
518
  readonly orientation: _angular_core.InputSignal<MkDropListOrientation>;
493
519
  /** Disable reordering. */
@@ -498,9 +524,11 @@ declare class MkSortableList<T = unknown> {
498
524
  readonly sorted: _angular_core.OutputEmitterRef<MkDropEvent<T>>;
499
525
  /** The row template projected as `<ng-template>`. */
500
526
  protected readonly itemTemplate: _angular_core.Signal<TemplateRef<any>>;
527
+ /** `label`, else the i18n default. */
528
+ protected readonly resolvedLabel: _angular_core.Signal<string>;
501
529
  protected onDrop(event: MkDropEvent<T>): void;
502
530
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<MkSortableList<any>, never>;
503
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkSortableList<any>, "mk-sortable-list", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "trackBy": { "alias": "trackBy"; "required": false; "isSignal": true; }; }, { "items": "itemsChange"; "sorted": "sorted"; }, ["itemTemplate"], never, true, never>;
531
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkSortableList<any>, "mk-sortable-list", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "labelledBy": { "alias": "labelledBy"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "trackBy": { "alias": "trackBy"; "required": false; "isSignal": true; }; }, { "items": "itemsChange"; "sorted": "sorted"; }, ["itemTemplate"], never, true, never>;
504
532
  }
505
533
 
506
534
  export { MkDrag, MkDragDropRegistry, MkDragHandle, MkDropList, MkSortableList, mkMoveItemInArray, mkTransferArrayItem };
@@ -1,4 +1,5 @@
1
1
  import { ValidatorFn, AbstractControl, FormGroup, FormControl, FormArray } from '@angular/forms';
2
+ import { Schema } from '@angular/forms/signals';
2
3
  import * as _mk_kit_ui_core from '@mk-kit/ui/core';
3
4
  import * as _angular_core from '@angular/core';
4
5
  import { TemplateRef } from '@angular/core';
@@ -154,6 +155,48 @@ declare function mkDynamicFlatten(fields: readonly MkDynamicField[], prefix?: st
154
155
  /** Column span a field takes in a grid of `columns`. */
155
156
  declare function mkDynamicSpan(field: MkDynamicField, columns: number): number;
156
157
 
158
+ /**
159
+ * Converts an `mk-dynamic-form` schema into a Signal Forms `Schema`, so the
160
+ * same JSON definition can drive `form()` from `@angular/forms/signals`:
161
+ *
162
+ * ```ts
163
+ * const definition: MkDynamicSchema = { fields: [ … ] };
164
+ * const model = signal(mkDynamicDefaults(definition.fields));
165
+ * const f = form(model, mkDynamicFormToSignalSchema(definition));
166
+ * ```
167
+ *
168
+ * What maps:
169
+ * - `required` → `required()` (for `checkbox` / `switch` this means "must be
170
+ * on", as Signal Forms treats `false` as empty — the `requiredTrue`
171
+ * behaviour of the renderer);
172
+ * - `validators.min` / `max` / `minLength` / `maxLength` / `pattern` / `email`
173
+ * (and `type: 'email'`) → the matching built-in rules, so the field's
174
+ * `min()` / `maxLength()` / `pattern()` state is set as well;
175
+ * - `validators.custom` → `validate()` running each `ValidatorFn` against a
176
+ * throw-away `FormControl` holding the field's value; the reactive error
177
+ * keys become error `kind`s with their payload attached, so
178
+ * `mk-form-field` renders them through the same i18n table;
179
+ * - `disabled: true` and `disabledWhen` → `disabled()`, `showWhen` →
180
+ * `hidden()` — the condition is evaluated against the form value exactly as
181
+ * the renderer does it (dotted paths, `and` / `or` / `not`, and inside an
182
+ * array item the item's own value with the root under `$root` and the
183
+ * position under `$index`);
184
+ * - `group` → the nested fields under the group's key, `array` → `applyEach`
185
+ * over the items plus `minItems` / `maxItems` errors from `min` / `max`.
186
+ *
187
+ * What differs from the renderer: a hidden Signal Forms field is skipped for
188
+ * validation and touched / dirty state but **keeps its value in the model**
189
+ * (the model is your data — nothing is stripped), so remove hidden controls
190
+ * from the template with `@if (!f.company().hidden())` and drop the value
191
+ * yourself before saving if it must not be sent. Layout properties (`span`,
192
+ * `columns`), `options`, `props` and `section` entries have no schema
193
+ * equivalent and are ignored.
194
+ *
195
+ * @param definition The dynamic-form schema, or just its `fields`.
196
+ * @template TModel The model type the schema binds to (defaults to a loose record).
197
+ */
198
+ declare function mkDynamicFormToSignalSchema<TModel extends object = Record<string, unknown>>(definition: MkDynamicSchema | readonly MkDynamicField[]): Schema<TModel>;
199
+
157
200
  /** Context handed to a custom field template. */
158
201
  interface MkDynamicFieldContext {
159
202
  $implicit: MkDynamicFieldBase;
@@ -301,5 +344,5 @@ declare class MkDynamicForm {
301
344
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<MkDynamicForm, "mk-dynamic-form", never, { "schema": { "alias": "schema"; "required": true; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "labelPosition": { "alias": "labelPosition"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "formSubmit": "formSubmit"; "invalidSubmit": "invalidSubmit"; }, ["defs"], ["*"], true, never>;
302
345
  }
303
346
 
304
- export { MkDynamicFieldDef, MkDynamicFields, MkDynamicForm, mkDynamicCondition, mkDynamicControl, mkDynamicDefaults, mkDynamicEmptyValue, mkDynamicFlatten, mkDynamicForm, mkDynamicGroup, mkDynamicSpan, mkDynamicValidators, mkIsArray, mkIsGroup, mkIsSection, mkIsValueField };
347
+ export { MkDynamicFieldDef, MkDynamicFields, MkDynamicForm, mkDynamicCondition, mkDynamicControl, mkDynamicDefaults, mkDynamicEmptyValue, mkDynamicFlatten, mkDynamicForm, mkDynamicFormToSignalSchema, mkDynamicGroup, mkDynamicSpan, mkDynamicValidators, mkIsArray, mkIsGroup, mkIsSection, mkIsValueField };
305
348
  export type { MkDynamicArray, MkDynamicCondition, MkDynamicField, MkDynamicFieldBase, MkDynamicFieldContext, MkDynamicFieldType, MkDynamicGroup, MkDynamicGroup as MkDynamicGroupField, MkDynamicOption, MkDynamicSchema, MkDynamicSection, MkDynamicValidators };