@cngx/common 0.1.0-rc.6 → 0.1.0-rc.8

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 (72) hide show
  1. package/card/README.md +2 -1
  2. package/chart/README.md +85 -0
  3. package/command/README.md +157 -0
  4. package/data/README.md +33 -1
  5. package/dialog/README.md +23 -1
  6. package/fesm2022/cngx-common-a11y.mjs +356 -180
  7. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  8. package/fesm2022/cngx-common-audio.mjs +84 -42
  9. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  10. package/fesm2022/cngx-common-card.mjs +311 -53
  11. package/fesm2022/cngx-common-card.mjs.map +1 -1
  12. package/fesm2022/cngx-common-chart.mjs +4360 -1625
  13. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  14. package/fesm2022/cngx-common-command.mjs +171 -0
  15. package/fesm2022/cngx-common-command.mjs.map +1 -0
  16. package/fesm2022/cngx-common-data.mjs +1556 -616
  17. package/fesm2022/cngx-common-data.mjs.map +1 -1
  18. package/fesm2022/cngx-common-dialog.mjs +518 -112
  19. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  20. package/fesm2022/cngx-common-display.mjs +468 -87
  21. package/fesm2022/cngx-common-display.mjs.map +1 -1
  22. package/fesm2022/cngx-common-interactive.mjs +2725 -1303
  23. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  24. package/fesm2022/cngx-common-layout.mjs +943 -164
  25. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  26. package/fesm2022/cngx-common-popover.mjs +769 -103
  27. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  28. package/fesm2022/cngx-common-stepper.mjs +816 -348
  29. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  30. package/fesm2022/cngx-common-tabs.mjs +2330 -1554
  31. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  32. package/fesm2022/cngx-common-timeline.mjs +1170 -0
  33. package/fesm2022/cngx-common-timeline.mjs.map +1 -0
  34. package/fesm2022/cngx-common.mjs +2 -2
  35. package/fesm2022/cngx-common.mjs.map +1 -1
  36. package/interactive/README.md +15 -4
  37. package/layout/README.md +21 -1
  38. package/package.json +11 -1
  39. package/popover/README.md +18 -2
  40. package/stepper/README.md +7 -5
  41. package/theming/components/cngx-accordion.css +4 -1
  42. package/theming/components/cngx-backdrop.css +12 -0
  43. package/theming/components/cngx-badge.css +22 -0
  44. package/theming/components/cngx-bottom-sheet.css +14 -2
  45. package/theming/components/cngx-breadcrumb.css +8 -0
  46. package/theming/components/cngx-button-toggle.css +73 -5
  47. package/theming/components/cngx-data-grid.css +234 -1
  48. package/theming/components/cngx-dialog.css +25 -0
  49. package/theming/components/cngx-divider.css +12 -0
  50. package/theming/components/cngx-listbox.css +48 -12
  51. package/theming/components/cngx-menu.css +91 -15
  52. package/theming/components/cngx-popover.css +24 -0
  53. package/theming/components/cngx-recycler-placeholder.css +196 -0
  54. package/theming/components/cngx-ripple.css +2 -2
  55. package/theming/components/cngx-slider.css +32 -1
  56. package/theming/components/cngx-tooltip.css +23 -0
  57. package/timeline/README.md +155 -0
  58. package/types/cngx-common-a11y.d.ts +101 -31
  59. package/types/cngx-common-audio.d.ts +32 -32
  60. package/types/cngx-common-card.d.ts +211 -20
  61. package/types/cngx-common-chart.d.ts +1605 -169
  62. package/types/cngx-common-command.d.ts +190 -0
  63. package/types/cngx-common-data.d.ts +842 -163
  64. package/types/cngx-common-dialog.d.ts +372 -28
  65. package/types/cngx-common-display.d.ts +432 -148
  66. package/types/cngx-common-interactive.d.ts +1553 -370
  67. package/types/cngx-common-layout.d.ts +613 -27
  68. package/types/cngx-common-popover.d.ts +376 -36
  69. package/types/cngx-common-stepper.d.ts +414 -114
  70. package/types/cngx-common-tabs.d.ts +597 -72
  71. package/types/cngx-common-timeline.d.ts +1125 -0
  72. package/types/cngx-common.d.ts +1 -1
@@ -1,5 +1,6 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { Signal, InjectionToken, Provider, ViewContainerRef, Type, ComponentRef, Injector, TemplateRef } from '@angular/core';
3
+ import * as _cngx_core_utils from '@cngx/core/utils';
3
4
  import { CngxAsyncState } from '@cngx/core/utils';
4
5
  import { Observable } from 'rxjs';
5
6
  import * as _cngx_common_dialog from '@cngx/common/dialog';
@@ -55,6 +56,54 @@ interface DialogRef<T = unknown> {
55
56
  */
56
57
  declare const DIALOG_REF: InjectionToken<DialogRef<unknown>>;
57
58
 
59
+ /**
60
+ * Labelling handle a title or description source registers with the
61
+ * dialog's ARIA registry.
62
+ *
63
+ * `id` feeds the dialog's `aria-labelledby` / `aria-describedby`
64
+ * derivation; `textContent` (title only) is read at announce time so the
65
+ * live region speaks the current DOM text, not a cached first read.
66
+ */
67
+ interface DialogLabelHandle {
68
+ /** Element id referenced from the dialog host's ARIA attributes. */
69
+ readonly id: Signal<string>;
70
+ /** Fresh text read for the open announce. Optional - descriptions are never announced. */
71
+ readonly textContent?: () => string;
72
+ }
73
+ /**
74
+ * Registration contract between `CngxDialog` and its labelling sources.
75
+ *
76
+ * Content queries only see nodes declared in the projection template, so a
77
+ * programmatically opened dialog (content created into the outlet's
78
+ * `ViewContainerRef`) is invisible to `contentChild()`. Sources therefore
79
+ * push their handles through this token instead of being pulled by query -
80
+ * the same inversion as `CNGX_POPOVER_ARROW_BOUNDS`.
81
+ *
82
+ * `CngxDialog` provides the token via `useExisting` and stays the single
83
+ * owner of the `aria-describedby` derivation: directives sharing the dialog
84
+ * host must never bind `attr.aria-describedby` themselves (two host
85
+ * bindings on one attribute clobber each other) - they register an id here
86
+ * and the dialog merges it.
87
+ *
88
+ * Each `register*` call returns a release function (single-slot per kind:
89
+ * one title, one description, N anonymous describedby ids) - tie it to
90
+ * `DestroyRef.onDestroy`.
91
+ *
92
+ * Internal contract - intentionally not exported from `public-api.ts`.
93
+ */
94
+ interface CngxDialogAriaRegistry {
95
+ /** Register the labelling source for `aria-labelledby` and the open announce. */
96
+ registerTitle(handle: DialogLabelHandle): () => void;
97
+ /** Register the primary description source for `aria-describedby`. */
98
+ registerDescription(handle: DialogLabelHandle): () => void;
99
+ /**
100
+ * Register a supplemental `aria-describedby` id (e.g. an interaction
101
+ * instruction). Accepts a plain string for ids that are fixed for the
102
+ * registration's lifetime; pass a signal only when the id itself changes.
103
+ */
104
+ registerDescribedBy(id: string | Signal<string>): () => void;
105
+ }
106
+
58
107
  /**
59
108
  * Signal-driven state machine for native `<dialog>`.
60
109
  *
@@ -128,14 +177,19 @@ declare const DIALOG_REF: InjectionToken<DialogRef<unknown>>;
128
177
  * <example-url>http://localhost:4200/#/common/dialog/programmatic-control</example-url>
129
178
  * <example-url>http://localhost:4200/#/common/dialog/template-directives</example-url>
130
179
  */
131
- declare class CngxDialog<T = unknown> implements DialogRef<T> {
180
+ declare class CngxDialog<T = unknown> implements DialogRef<T>, CngxDialogAriaRegistry {
132
181
  private readonly elRef;
133
182
  private readonly doc;
134
183
  private readonly renderer;
135
184
  private readonly destroyRef;
136
185
  private readonly dialogStack;
186
+ private readonly labels;
187
+ private pendingClose;
137
188
  private readonly titleDirective;
138
189
  private readonly descriptionDirective;
190
+ private readonly registeredTitle;
191
+ private readonly registeredDescription;
192
+ private readonly supplementalDescribedByIds;
139
193
  /**
140
194
  * Whether the dialog opens as modal (`showModal()`) or non-modal (`show()`).
141
195
  *
@@ -231,7 +285,7 @@ declare class CngxDialog<T = unknown> implements DialogRef<T> {
231
285
  *
232
286
  * Possible values: `'closed'`, `'opening'`, `'open'`, `'closing'`.
233
287
  */
234
- readonly lifecycle: _angular_core.Signal<DialogState>;
288
+ readonly lifecycle: Signal<DialogState>;
235
289
  /**
236
290
  * The typed result of the dialog.
237
291
  *
@@ -239,9 +293,9 @@ declare class CngxDialog<T = unknown> implements DialogRef<T> {
239
293
  * - `'dismissed'` when dismissed via Escape or backdrop click
240
294
  * - `T` when closed with an explicit value via `close(value)`
241
295
  */
242
- readonly result: _angular_core.Signal<"dismissed" | T | undefined>;
296
+ readonly result: Signal<"dismissed" | T | undefined>;
243
297
  /** Unique auto-generated ID for this dialog instance. Used for ARIA and stack tracking. */
244
- readonly id: _angular_core.Signal<string>;
298
+ readonly id: Signal<string>;
245
299
  private readonly submitStatusState;
246
300
  private readonly submitErrorState;
247
301
  /**
@@ -259,21 +313,51 @@ declare class CngxDialog<T = unknown> implements DialogRef<T> {
259
313
  * External `[state]` short-circuits - when set, `submitAction` is ignored by the
260
314
  * `close()` guard (`action && !this.state()`), so `submitStatusState` stays `'idle'`.
261
315
  */
262
- readonly isPending: _angular_core.Signal<boolean>;
316
+ readonly isPending: Signal<boolean>;
263
317
  /**
264
318
  * Resolved error - external `[state]` takes precedence over submit state,
265
319
  * which takes precedence over the boolean `[error]` input.
266
320
  */
267
- protected readonly effectiveError: _angular_core.Signal<boolean>;
268
- protected readonly isOpening: _angular_core.Signal<boolean>;
269
- protected readonly isOpen: _angular_core.Signal<boolean>;
270
- protected readonly isClosing: _angular_core.Signal<boolean>;
271
- protected readonly ariaModal: _angular_core.Signal<"true" | null>;
272
- protected readonly ariaLabelledBy: _angular_core.Signal<string | null>;
273
- protected readonly ariaDescribedBy: _angular_core.Signal<string | null>;
274
- protected readonly backdropOpacity: _angular_core.Signal<"1" | "0">;
321
+ protected readonly effectiveError: Signal<boolean>;
322
+ protected readonly isOpening: Signal<boolean>;
323
+ protected readonly isOpen: Signal<boolean>;
324
+ protected readonly isClosing: Signal<boolean>;
325
+ protected readonly ariaModal: Signal<"true" | null>;
326
+ protected readonly ariaLabelledBy: Signal<string | null>;
327
+ protected readonly ariaDescribedBy: Signal<string | null>;
328
+ protected readonly backdropOpacity: Signal<"0" | "1">;
275
329
  private liveRegion;
330
+ /**
331
+ * The modal mode latched at `open()`. Everything that depends on how the
332
+ * dialog actually opened derives from this - scroll-lock release, stack
333
+ * pop, Escape/backdrop dismissal, focus strategy, and `aria-modal` -
334
+ * so toggling `[modal]` while open can neither unbalance the ref count
335
+ * nor strand a rendered backdrop without its dismissal surface.
336
+ */
337
+ private readonly openedAsModal;
276
338
  constructor();
339
+ /**
340
+ * Register the labelling source for `aria-labelledby` and the open announce.
341
+ *
342
+ * A present content-queried title wins over the registered handle (same
343
+ * directive in the declarative case - identical id either way).
344
+ *
345
+ * @internal CNGX_DIALOG_ARIA_REGISTRY implementation - not public API.
346
+ */
347
+ registerTitle(handle: DialogLabelHandle): () => void;
348
+ /**
349
+ * Register the primary description source for `aria-describedby`.
350
+ *
351
+ * @internal CNGX_DIALOG_ARIA_REGISTRY implementation - not public API.
352
+ */
353
+ registerDescription(handle: DialogLabelHandle): () => void;
354
+ /**
355
+ * Register a supplemental `aria-describedby` id, merged after the
356
+ * description id in registration order.
357
+ *
358
+ * @internal CNGX_DIALOG_ARIA_REGISTRY implementation - not public API.
359
+ */
360
+ registerDescribedBy(id: string | Signal<string>): () => void;
277
361
  /**
278
362
  * Open the dialog.
279
363
  *
@@ -309,15 +393,40 @@ declare class CngxDialog<T = unknown> implements DialogRef<T> {
309
393
  dismiss(): void;
310
394
  private executeSubmit;
311
395
  protected handleCancel(event: Event): void;
396
+ /**
397
+ * `true` when the last pointerdown landed on the backdrop (the dialog
398
+ * element itself, outside the content rect). Backdrop dismissal requires
399
+ * the interaction to START there: a text-selection drag that begins inside
400
+ * the content and releases over the backdrop synthesises a click with
401
+ * outside coordinates and must not dismiss.
402
+ */
403
+ private pointerDownOnBackdrop;
404
+ protected handlePointerDown(event: PointerEvent): void;
312
405
  protected handleClick(event: MouseEvent): void;
406
+ /** Backdrop test: coordinates outside the dialog's content rect. */
407
+ private isOutsideContentRect;
313
408
  private get dialogElement();
314
409
  private startClosing;
315
410
  private finalize;
316
411
  private moveFocus;
317
412
  private returnFocus;
318
413
  private createLiveRegion;
414
+ /**
415
+ * Release function of the currently held scroll lock, `null` while not
416
+ * locked. The shared `createScrollLock` core (single WeakMap owner in
417
+ * `@cngx/common/layout`) keeps this instance's count in the same registry
418
+ * as `CngxScrollLock`, so interleaved dialog + directive locks restore the
419
+ * saved overflow values correctly.
420
+ */
421
+ private scrollLockRelease;
319
422
  private acquireScrollLock;
320
423
  private releaseScrollLock;
424
+ /**
425
+ * The registry is single-slot per kind, so a second live registration
426
+ * silently wins - surface the authoring error instead of letting the
427
+ * two open paths resolve different labelling.
428
+ */
429
+ private warnDoubleRegistration;
321
430
  private warnNonModalA11y;
322
431
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxDialog<any>, never>;
323
432
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxDialog<any>, "dialog[cngxDialog]", ["cngxDialog"], { "modal": { "alias": "modal"; "required": false; "isSignal": true; }; "closeOnBackdropClick": { "alias": "closeOnBackdropClick"; "required": false; "isSignal": true; }; "closeOnEscape": { "alias": "closeOnEscape"; "required": false; "isSignal": true; }; "autoFocus": { "alias": "autoFocus"; "required": false; "isSignal": true; }; "focusFallback": { "alias": "focusFallback"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "submitAction": { "alias": "submitAction"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; }, {}, ["titleDirective", "descriptionDirective"], never, true, never>;
@@ -357,20 +466,26 @@ declare class CngxDialog<T = unknown> implements DialogRef<T> {
357
466
  declare class CngxDialogTitle {
358
467
  private readonly elRef;
359
468
  private readonly dialogRef;
469
+ private readonly ariaRegistry;
470
+ private readonly destroyRef;
471
+ private readonly idState;
360
472
  /**
361
473
  * Auto-generated unique ID bound to the host `[id]` attribute.
362
474
  *
363
475
  * Used by `CngxDialog` for `aria-labelledby`. When a parent `CngxDialog`
364
476
  * is present, the ID is derived from the dialog's ID (e.g. `cngx-dialog-0-title`).
477
+ * Read-only: an externally mutated id would silently break the ARIA wiring.
365
478
  */
366
- readonly id: _angular_core.WritableSignal<string>;
479
+ readonly id: _angular_core.Signal<string>;
367
480
  /**
368
- * Text content of the title element.
481
+ * Text content of the title element, read fresh on every call.
369
482
  *
370
- * Read by `CngxDialog` on open to announce the dialog title via
371
- * an `aria-live` region for screen readers.
483
+ * Read by `CngxDialog` at announce time (each `'open'` transition) so a
484
+ * changed title - translation swap, interpolated data - is what screen
485
+ * readers hear. A `computed` would cache the first non-reactive DOM read
486
+ * forever.
372
487
  */
373
- readonly textContent: _angular_core.Signal<string>;
488
+ readonly textContent: () => string;
374
489
  constructor();
375
490
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxDialogTitle, never>;
376
491
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxDialogTitle, "[cngxDialogTitle]", ["cngxDialogTitle"], {}, {}, never, never, true, never>;
@@ -409,13 +524,17 @@ declare class CngxDialogTitle {
409
524
  */
410
525
  declare class CngxDialogDescription {
411
526
  private readonly dialogRef;
527
+ private readonly ariaRegistry;
528
+ private readonly destroyRef;
529
+ private readonly idState;
412
530
  /**
413
531
  * Auto-generated unique ID bound to the host `[id]` attribute.
414
532
  *
415
533
  * Used by `CngxDialog` for `aria-describedby`. When a parent `CngxDialog`
416
534
  * is present, the ID is derived from the dialog's ID (e.g. `cngx-dialog-0-desc`).
535
+ * Read-only: an externally mutated id would silently break the ARIA wiring.
417
536
  */
418
- readonly id: _angular_core.WritableSignal<string>;
537
+ readonly id: _angular_core.Signal<string>;
419
538
  constructor();
420
539
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxDialogDescription, never>;
421
540
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxDialogDescription, "[cngxDialogDescription]", ["cngxDialogDescription"], {}, {}, never, never, true, never>;
@@ -458,10 +577,14 @@ declare class CngxDialogDescription {
458
577
  declare class CngxDialogClose {
459
578
  private readonly dialogRef;
460
579
  private readonly elRef;
580
+ private readonly labels;
461
581
  /** Value to pass to `close()`. When `undefined`, calls `dismiss()` instead. */
462
582
  readonly value: _angular_core.InputSignal<unknown>;
463
583
  /**
464
- * Explicit `aria-label` override.
584
+ * Explicit `aria-label` override. Bind a dynamic accessible name here,
585
+ * not through `[attr.aria-label]`: the directive owns the host's
586
+ * `aria-label` binding, so a second binding on the same attribute races it.
587
+ * A static `aria-label="..."` attribute on the host is kept as is.
465
588
  *
466
589
  * When not set, the directive auto-detects whether the host element
467
590
  * has descriptive text content. If it does (e.g. "Cancel", "Confirm"),
@@ -469,11 +592,13 @@ declare class CngxDialogClose {
469
592
  * empty, or visually an icon, `aria-label` defaults to `"Close dialog"`.
470
593
  */
471
594
  readonly label: _angular_core.InputSignal<string | undefined>;
595
+ private readonly consumerAriaLabel;
472
596
  /** Set type="button" on <button> hosts to prevent form submit. */
473
597
  protected readonly hostType: string | null;
474
598
  /**
475
599
  * Computed `aria-label`. Returns:
476
600
  * - explicit `label()` input if set
601
+ * - the consumer's static `aria-label` attribute, kept as is
477
602
  * - `null` if host text is descriptive (> 1 char, not whitespace-only)
478
603
  * - `'Close dialog'` for icon-only / single-char content
479
604
  */
@@ -548,9 +673,13 @@ declare const CNGX_DIALOG_DATA: InjectionToken<unknown>;
548
673
  /**
549
674
  * Configuration for programmatically opened dialogs.
550
675
  *
676
+ * Mirrors the declarative `CngxDialog` input surface - everything a
677
+ * template-driven dialog can bind is also reachable through
678
+ * `CngxDialogOpener.open()`.
679
+ *
551
680
  * @category common/dialog
552
681
  */
553
- interface CngxDialogConfig<D = unknown> {
682
+ interface CngxDialogConfig<D = unknown, T = unknown> {
554
683
  /** Data to inject via `CNGX_DIALOG_DATA` inside the dialog component. */
555
684
  data?: D;
556
685
  /** Whether the dialog opens as modal (`showModal()`) or non-modal (`show()`). Default: `true`. */
@@ -561,12 +690,175 @@ interface CngxDialogConfig<D = unknown> {
561
690
  closeOnEscape?: boolean;
562
691
  /** Focus strategy on open. Default: `'first-focusable'`. */
563
692
  autoFocus?: 'first-focusable' | 'none' | (string & {});
693
+ /**
694
+ * Async action executed when the dialog closes with a value. Same contract
695
+ * as the declarative `[submitAction]` input: on success the dialog
696
+ * auto-closes, on error it stays open with the error announced. The submit
697
+ * lifecycle is exposed on `CngxDialogRef.submitState`.
698
+ */
699
+ submitAction?: (value: T) => Promise<unknown> | Observable<unknown>;
700
+ /**
701
+ * External async state driving pending/error, same contract as the
702
+ * declarative `[state]` input. Takes precedence over `submitAction`.
703
+ */
704
+ state?: CngxAsyncState<unknown>;
705
+ /** Initial error flag, same contract as the declarative `[error]` input. */
706
+ error?: boolean;
707
+ /**
708
+ * Fallback element to focus when the trigger element is gone by the time
709
+ * the dialog closes, same contract as the declarative `[focusFallback]`.
710
+ */
711
+ focusFallback?: HTMLElement;
712
+ }
713
+
714
+ /**
715
+ * The dialog section of a {@link CngxLanguagePack}: the interaction strings
716
+ * the dialog family renders on its own behalf. {@link CngxDialogLabels} is
717
+ * this shape; it feeds the `labels` of `CNGX_DIALOG_DEFAULTS`.
718
+ *
719
+ * @category common/dialog/i18n
720
+ * @since 0.1.0
721
+ * @relatedTo CNGX_DIALOG_DEFAULTS
722
+ */
723
+ interface CngxDialogLanguageSection {
724
+ /** Implicit accessible name of `CngxDialogClose` when the trigger carries no text. */
725
+ readonly close: string;
726
+ /** Live-region text when a dialog error carries no message of its own. */
727
+ readonly errorFallback: string;
728
+ /** `aria-label` set on a promoted drag handle. */
729
+ readonly dragHandle: string;
730
+ /** `aria-roledescription` set on a promoted drag handle. */
731
+ readonly dragHandleRoleDescription: string;
732
+ /** Visually hidden keyboard-drag instruction the handle is described by. */
733
+ readonly dragInstructions: string;
734
+ }
735
+ /**
736
+ * The English dialog section: the single source of the dialog family's
737
+ * English copy. The `CNGX_DIALOG_DEFAULTS` labels default to it.
738
+ *
739
+ * @category common/dialog/i18n
740
+ * @since 0.1.0
741
+ * @relatedTo CNGX_DIALOG_DEFAULTS
742
+ */
743
+ declare const CNGX_DIALOG_LANGUAGE_EN: CngxDialogLanguageSection;
744
+ declare module '@cngx/core/i18n' {
745
+ interface CngxLanguagePack {
746
+ readonly dialog: CngxDialogLanguageSection;
747
+ }
564
748
  }
565
749
 
750
+ /**
751
+ * The five interaction strings the dialog family renders on its own behalf.
752
+ * Every one is a fallback the consumer cannot reach declaratively: the close
753
+ * affordance only names itself when the trigger has no text of its own, the
754
+ * error fallback only fires when the thrown value is not a string, and the
755
+ * drag handle is labelled imperatively because the directive may promote any
756
+ * element to a handle. The same shape as the dialog section of a language
757
+ * pack, declared once as {@link CngxDialogLanguageSection}.
758
+ *
759
+ * @category common/dialog/config
760
+ */
761
+ type CngxDialogLabels = CngxDialogLanguageSection;
762
+ /**
763
+ * App-wide dialog defaults, populated via {@link provideDialogConfig} in the
764
+ * root providers (or {@link provideDialogConfigAt} in a component's
765
+ * `viewProviders` for a sub-tree scope).
766
+ *
767
+ * Distinct from `CngxDialogConfig`, which is the per-open option bag passed to
768
+ * `CngxDialogOpener.open()`. This one carries defaults for every dialog in the
769
+ * scope; that one configures a single dialog instance.
770
+ *
771
+ * `labels` is a plain bundle or a `Signal` of one; once
772
+ * {@link provideDialogConfig} ran it holds a `Signal`, so the strings follow
773
+ * a runtime language switch. Read it through `coerceSignal` from
774
+ * `@cngx/core/utils`.
775
+ *
776
+ * Only `labels` today. Size / backdrop / close-on-escape / focus-fallback
777
+ * defaults are deliberately absent - no consumer has asked for them, and a key
778
+ * with no caller is configuration for its own sake.
779
+ *
780
+ * @category common/dialog/config
781
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/config/dialog-config.ts
782
+ * @since 0.1.0
783
+ */
784
+ interface CngxDialogDefaults {
785
+ readonly labels: CngxDialogLabels | Signal<CngxDialogLabels>;
786
+ }
787
+ /**
788
+ * DI token carrying the merged {@link CngxDialogDefaults}. `providedIn: 'root'`:
789
+ * `labels` is the dialog section of the active language pack over the English
790
+ * defaults, so a consumer who provides nothing keeps today's behaviour
791
+ * exactly.
792
+ *
793
+ * @category common/dialog/config
794
+ * @wcag AA
795
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/config/dialog-config.ts
796
+ * @since 0.1.0
797
+ * @relatedTo CngxDialog, CngxDialogClose, CngxDialogDraggable
798
+ */
799
+ declare const CNGX_DIALOG_DEFAULTS: InjectionToken<CngxDialogDefaults>;
800
+ /**
801
+ * Feature returned by a `with*` function - merged by
802
+ * {@link provideDialogConfig}.
803
+ *
804
+ * @category common/dialog/config
805
+ */
806
+ interface CngxDialogConfigFeature {
807
+ /** @internal */
808
+ readonly labels?: Partial<CngxDialogLabels> | Signal<Partial<CngxDialogLabels>>;
809
+ }
810
+ /**
811
+ * Override dialog interaction strings. Unset keys keep the language pack's
812
+ * text, or the English default, and two calls merge rather than replace.
813
+ * Pass a `Signal` to switch the language at runtime.
814
+ *
815
+ * ```ts
816
+ * bootstrapApplication(AppComponent, {
817
+ * providers: [
818
+ * provideDialogConfig(
819
+ * withDialogLabels({ close: 'Dialog schließen', dragHandle: 'Dialog verschieben' }),
820
+ * ),
821
+ * ],
822
+ * });
823
+ * ```
824
+ *
825
+ * @category common/dialog/config
826
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/config/dialog-config.ts
827
+ * @since 0.1.0
828
+ */
829
+ declare function withDialogLabels(overrides: Partial<CngxDialogLabels> | Signal<Partial<CngxDialogLabels>>): CngxDialogConfigFeature;
830
+ /**
831
+ * Register app-wide dialog defaults composed from `with*` features, applied
832
+ * on top of the active language pack.
833
+ *
834
+ * @category common/dialog/config
835
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/config/dialog-config.ts
836
+ * @since 0.1.0
837
+ */
838
+ declare function provideDialogConfig(...features: CngxDialogConfigFeature[]): Provider[];
839
+ /**
840
+ * Sub-tree variant - use in `viewProviders` so the defaults only apply to
841
+ * dialogs opened from descendants of this component.
842
+ *
843
+ * @category common/dialog/config
844
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/config/dialog-config.ts
845
+ * @since 0.1.0
846
+ */
847
+ declare function provideDialogConfigAt(...features: CngxDialogConfigFeature[]): Provider[];
848
+ /**
849
+ * Inject the currently-resolved dialog defaults. Safe in any injection
850
+ * context; falls back to the English bundle when nothing is provided.
851
+ *
852
+ * @category common/dialog/config
853
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/config/dialog-config.ts
854
+ * @since 0.1.0
855
+ */
856
+ declare function injectDialogConfig(): CngxDialogDefaults;
857
+
566
858
  /**
567
859
  * Internal container component for programmatically opened dialogs.
568
860
  *
569
- * Not part of the public API — instantiated exclusively by `CngxDialogOpener`.
861
+ * Not part of the public API - instantiated exclusively by `CngxDialogOpener`.
570
862
  * Renders the native `<dialog>` shell and exposes a `<ng-container>` outlet
571
863
  * where the content component or template is inserted.
572
864
  *
@@ -577,10 +869,14 @@ declare class CngxDialogOutlet {
577
869
  readonly closeOnBackdropClick: _angular_core.InputSignal<boolean>;
578
870
  readonly closeOnEscape: _angular_core.InputSignal<boolean>;
579
871
  readonly autoFocus: _angular_core.InputSignal<string>;
872
+ readonly submitAction: _angular_core.InputSignal<((value: unknown) => Promise<unknown> | Observable<unknown>) | undefined>;
873
+ readonly state: _angular_core.InputSignal<CngxAsyncState<unknown> | undefined>;
874
+ readonly error: _angular_core.InputSignal<boolean>;
875
+ readonly focusFallback: _angular_core.InputSignal<HTMLElement | undefined>;
580
876
  readonly dialog: _angular_core.Signal<CngxDialog<any>>;
581
877
  readonly contentOutlet: _angular_core.Signal<ViewContainerRef | undefined>;
582
878
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxDialogOutlet, never>;
583
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxDialogOutlet, "cngx-dialog-outlet", never, { "modal": { "alias": "modal"; "required": false; "isSignal": true; }; "closeOnBackdropClick": { "alias": "closeOnBackdropClick"; "required": false; "isSignal": true; }; "closeOnEscape": { "alias": "closeOnEscape"; "required": false; "isSignal": true; }; "autoFocus": { "alias": "autoFocus"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
879
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxDialogOutlet, "cngx-dialog-outlet", never, { "modal": { "alias": "modal"; "required": false; "isSignal": true; }; "closeOnBackdropClick": { "alias": "closeOnBackdropClick"; "required": false; "isSignal": true; }; "closeOnEscape": { "alias": "closeOnEscape"; "required": false; "isSignal": true; }; "autoFocus": { "alias": "autoFocus"; "required": false; "isSignal": true; }; "submitAction": { "alias": "submitAction"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; "isSignal": true; }; "focusFallback": { "alias": "focusFallback"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
584
880
  }
585
881
 
586
882
  /**
@@ -634,6 +930,14 @@ declare class CngxDialogRef<T = unknown> {
634
930
  get result(): _angular_core.Signal<"dismissed" | T | undefined>;
635
931
  /** Unique auto-generated ID for this dialog instance. */
636
932
  get id(): _angular_core.Signal<string>;
933
+ /**
934
+ * Async state of the submit channel - same surface a declarative dialog
935
+ * exposes. Populated when the open config carries a `submitAction`;
936
+ * remains at `'idle'` otherwise.
937
+ *
938
+ * Bind to any state consumer: `<cngx-alert [state]="ref.submitState" />`.
939
+ */
940
+ get submitState(): _cngx_core_utils.CngxAsyncState<unknown>;
637
941
  /**
638
942
  * Close the dialog with a typed result value.
639
943
  *
@@ -710,6 +1014,13 @@ declare class CngxDialogOpener {
710
1014
  private readonly injector;
711
1015
  private readonly doc;
712
1016
  private readonly openDialogs;
1017
+ /**
1018
+ * Per-open close-watcher effects, keyed by ref. Owned here (not on the
1019
+ * public `CngxDialogRef`) - the effect's injector outlives the dialog, so
1020
+ * without the explicit destroy in `cleanup()` every `open()` would leak
1021
+ * one live effect.
1022
+ */
1023
+ private readonly cleanupEffects;
713
1024
  /**
714
1025
  * Open a dialog with the given component.
715
1026
  *
@@ -717,7 +1028,7 @@ declare class CngxDialogOpener {
717
1028
  * @param config - Optional dialog configuration.
718
1029
  * @returns A typed `CngxDialogRef<T>` for reading the result and controlling the dialog.
719
1030
  */
720
- open<T = unknown, D = unknown>(component: Type<unknown>, config?: CngxDialogConfig<D>): CngxDialogRef<T>;
1031
+ open<T = unknown, D = unknown>(component: Type<unknown>, config?: CngxDialogConfig<D, T>): CngxDialogRef<T>;
721
1032
  /**
722
1033
  * Open a dialog with the given template.
723
1034
  *
@@ -725,7 +1036,7 @@ declare class CngxDialogOpener {
725
1036
  * @param config - Optional dialog configuration.
726
1037
  * @returns A typed `CngxDialogRef<T>`.
727
1038
  */
728
- open<T = unknown, D = unknown>(templateRef: TemplateRef<unknown>, config?: CngxDialogConfig<D>): CngxDialogRef<T>;
1039
+ open<T = unknown, D = unknown>(templateRef: TemplateRef<unknown>, config?: CngxDialogConfig<D, T>): CngxDialogRef<T>;
729
1040
  /**
730
1041
  * Dismiss all programmatically opened dialogs.
731
1042
  *
@@ -794,7 +1105,8 @@ declare class CngxBottomSheet {
794
1105
  /**
795
1106
  * Whether the drag handle bar is visible.
796
1107
  *
797
- * The handle itself is rendered via CSS (`::before` pseudo-element on the host).
1108
+ * The handle itself is rendered via CSS (`::before` pseudo-element, gated
1109
+ * on the `cngx-bottom-sheet--handle` modifier class this input binds).
798
1110
  * Set to `false` to hide it.
799
1111
  *
800
1112
  * @defaultValue `true`
@@ -817,6 +1129,11 @@ declare class CngxBottomSheet {
817
1129
  * - Shift + Arrow moves 50px
818
1130
  * - Home resets to origin
819
1131
  *
1132
+ * Keys move the dialog only while the handle element itself has focus -
1133
+ * arrows inside form fields keep moving the caret. Without an explicit
1134
+ * `[handle]` the dialog element becomes focusable (`tabindex="0"`) and is
1135
+ * the keyboard drag surface.
1136
+ *
820
1137
  * ```html
821
1138
  * <dialog cngxDialog cngxDialogDraggable>
822
1139
  * <div class="dialog-header" #handle>Title</div>
@@ -850,7 +1167,9 @@ declare class CngxBottomSheet {
850
1167
  declare class CngxDialogDraggable {
851
1168
  private readonly elRef;
852
1169
  private readonly doc;
1170
+ private readonly labels;
853
1171
  private readonly destroyRef;
1172
+ private readonly ariaRegistry;
854
1173
  /** Handle element for initiating drag. If not set, entire dialog is the handle. */
855
1174
  readonly handle: _angular_core.InputSignal<HTMLElement | undefined>;
856
1175
  /** Clamp position to viewport bounds. */
@@ -895,6 +1214,8 @@ declare class CngxDialogDraggable {
895
1214
  private currentHandle;
896
1215
  private boundPointerDown;
897
1216
  private boundKeyDown;
1217
+ private handleAddedTabindex;
1218
+ private handleAddedAria;
898
1219
  /** Attach pointer and keyboard listeners to `el`, cleaning up the previous handle first. */
899
1220
  private setupHandle;
900
1221
  private handlePointerDown;
@@ -903,10 +1224,33 @@ declare class CngxDialogDraggable {
903
1224
  private handleKeyDown;
904
1225
  /** Snap `x`/`y` to the nearest `gridSize` increment. Pass-through when grid is disabled. */
905
1226
  private snap;
1227
+ /** Re-apply the handle labels and the instruction text this directive owns. */
1228
+ private applyLabels;
1229
+ private instructionNode;
1230
+ private releaseInstruction;
1231
+ private handleAddedDescribedBy;
1232
+ /**
1233
+ * Visually hidden keyboard-drag instruction, appended to the host so it
1234
+ * lives inside the dialog for both handle modes. Same hidden technique as
1235
+ * the dialog's live region - a referenced node must stay perceivable to
1236
+ * AT, not `display: none`.
1237
+ */
1238
+ private createInstructionNode;
1239
+ /**
1240
+ * Detach listeners from the current handle and restore every attribute and
1241
+ * style this directive added. A demoted handle must not stay focusable or
1242
+ * keep announcing "Move dialog" with a dead keyboard path behind it.
1243
+ *
1244
+ * The instruction node and its describedby registration leave atomically
1245
+ * with the capability they describe: a handle swap away from host-as-handle
1246
+ * removes the arrow-keys-on-the-dialog path itself, so keeping an orphan
1247
+ * description would misinform AT, not inform it.
1248
+ */
1249
+ private teardownHandle;
906
1250
  private cleanup;
907
1251
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxDialogDraggable, never>;
908
1252
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxDialogDraggable, "[cngxDialogDraggable]", ["cngxDialogDraggable"], { "handle": { "alias": "handle"; "required": false; "isSignal": true; }; "constrainToViewport": { "alias": "constrainToViewport"; "required": false; "isSignal": true; }; "gridSize": { "alias": "gridSize"; "required": false; "isSignal": true; }; "snapMode": { "alias": "snapMode"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
909
1253
  }
910
1254
 
911
- export { CNGX_DIALOG_DATA, CngxBottomSheet, CngxDialog, CngxDialogClose, CngxDialogDescription, CngxDialogDraggable, CngxDialogOpener, CngxDialogRef, CngxDialogStack, CngxDialogTitle, DIALOG_REF, provideDialog, provideDialogStack };
912
- export type { CngxDialogConfig, DialogRef, DialogState };
1255
+ export { CNGX_DIALOG_DATA, CNGX_DIALOG_DEFAULTS, CNGX_DIALOG_LANGUAGE_EN, CngxBottomSheet, CngxDialog, CngxDialogClose, CngxDialogDescription, CngxDialogDraggable, CngxDialogOpener, CngxDialogRef, CngxDialogStack, CngxDialogTitle, DIALOG_REF, injectDialogConfig, provideDialog, provideDialogConfig, provideDialogConfigAt, provideDialogStack, withDialogLabels };
1256
+ export type { CngxDialogConfig, CngxDialogConfigFeature, CngxDialogDefaults, CngxDialogLabels, CngxDialogLanguageSection, DialogRef, DialogState };