@cngx/common 0.1.0-rc.7 → 0.1.0-rc.9

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 (69) hide show
  1. package/card/README.md +2 -1
  2. package/command/README.md +29 -0
  3. package/data/README.md +15 -3
  4. package/dialog/README.md +23 -1
  5. package/fesm2022/cngx-common-a11y.mjs +517 -184
  6. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  7. package/fesm2022/cngx-common-audio.mjs +62 -17
  8. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  9. package/fesm2022/cngx-common-card.mjs +301 -46
  10. package/fesm2022/cngx-common-card.mjs.map +1 -1
  11. package/fesm2022/cngx-common-chart.mjs +1221 -479
  12. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  13. package/fesm2022/cngx-common-command.mjs +97 -16
  14. package/fesm2022/cngx-common-command.mjs.map +1 -1
  15. package/fesm2022/cngx-common-data.mjs +1496 -499
  16. package/fesm2022/cngx-common-data.mjs.map +1 -1
  17. package/fesm2022/cngx-common-dialog.mjs +236 -61
  18. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  19. package/fesm2022/cngx-common-display.mjs +364 -93
  20. package/fesm2022/cngx-common-display.mjs.map +1 -1
  21. package/fesm2022/cngx-common-interactive.mjs +2040 -1046
  22. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  23. package/fesm2022/cngx-common-layout.mjs +955 -125
  24. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  25. package/fesm2022/cngx-common-popover.mjs +1293 -89
  26. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  27. package/fesm2022/cngx-common-stepper.mjs +997 -453
  28. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  29. package/fesm2022/cngx-common-tabs.mjs +1794 -1265
  30. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  31. package/fesm2022/cngx-common-timeline.mjs +151 -61
  32. package/fesm2022/cngx-common-timeline.mjs.map +1 -1
  33. package/fesm2022/cngx-common.mjs +1 -1
  34. package/interactive/README.md +15 -4
  35. package/layout/README.md +37 -1
  36. package/package.json +20 -7
  37. package/popover/README.md +58 -2
  38. package/schematics/collection.json +9 -0
  39. package/schematics/ng-add/index.js +9 -0
  40. package/schematics/ng-add/schema.json +91 -0
  41. package/schematics/package.json +3 -0
  42. package/stepper/README.md +11 -8
  43. package/theming/components/cngx-accordion.css +1 -1
  44. package/theming/components/cngx-backdrop.css +12 -0
  45. package/theming/components/cngx-button-toggle.css +29 -3
  46. package/theming/components/cngx-data-grid.css +168 -1
  47. package/theming/components/cngx-dialog.css +13 -0
  48. package/theming/components/cngx-listbox.css +21 -12
  49. package/theming/components/cngx-menu.css +56 -16
  50. package/theming/components/cngx-popover-sheet.css +402 -0
  51. package/theming/components/cngx-popover.css +28 -0
  52. package/theming/components/cngx-recycler-placeholder.css +196 -0
  53. package/theming/components/cngx-ripple.css +1 -1
  54. package/theming/components/cngx-slider.css +32 -1
  55. package/theming/components/cngx-tooltip.css +12 -0
  56. package/timeline/README.md +155 -0
  57. package/types/cngx-common-a11y.d.ts +205 -28
  58. package/types/cngx-common-card.d.ts +201 -17
  59. package/types/cngx-common-chart.d.ts +345 -48
  60. package/types/cngx-common-command.d.ts +50 -10
  61. package/types/cngx-common-data.d.ts +743 -92
  62. package/types/cngx-common-dialog.d.ts +161 -10
  63. package/types/cngx-common-display.d.ts +356 -142
  64. package/types/cngx-common-interactive.d.ts +910 -226
  65. package/types/cngx-common-layout.d.ts +603 -32
  66. package/types/cngx-common-popover.d.ts +612 -49
  67. package/types/cngx-common-stepper.d.ts +526 -237
  68. package/types/cngx-common-tabs.d.ts +358 -75
  69. package/types/cngx-common-timeline.d.ts +108 -22
@@ -183,6 +183,8 @@ declare class CngxDialog<T = unknown> implements DialogRef<T>, CngxDialogAriaReg
183
183
  private readonly renderer;
184
184
  private readonly destroyRef;
185
185
  private readonly dialogStack;
186
+ private readonly labels;
187
+ private pendingClose;
186
188
  private readonly titleDirective;
187
189
  private readonly descriptionDirective;
188
190
  private readonly registeredTitle;
@@ -325,6 +327,8 @@ declare class CngxDialog<T = unknown> implements DialogRef<T>, CngxDialogAriaReg
325
327
  protected readonly ariaDescribedBy: Signal<string | null>;
326
328
  protected readonly backdropOpacity: Signal<"0" | "1">;
327
329
  private liveRegion;
330
+ /** The title text the open announcement reads; `''` when there is none. */
331
+ private currentTitleText;
328
332
  /**
329
333
  * The modal mode latched at `open()`. Everything that depends on how the
330
334
  * dialog actually opened derives from this - scroll-lock release, stack
@@ -419,13 +423,6 @@ declare class CngxDialog<T = unknown> implements DialogRef<T>, CngxDialogAriaReg
419
423
  private scrollLockRelease;
420
424
  private acquireScrollLock;
421
425
  private releaseScrollLock;
422
- /**
423
- * The registry is single-slot per kind, so a second live registration
424
- * silently wins - surface the authoring error instead of letting the
425
- * two open paths resolve different labelling.
426
- */
427
- private warnDoubleRegistration;
428
- private warnNonModalA11y;
429
426
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxDialog<any>, never>;
430
427
  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>;
431
428
  }
@@ -575,10 +572,14 @@ declare class CngxDialogDescription {
575
572
  declare class CngxDialogClose {
576
573
  private readonly dialogRef;
577
574
  private readonly elRef;
575
+ private readonly labels;
578
576
  /** Value to pass to `close()`. When `undefined`, calls `dismiss()` instead. */
579
577
  readonly value: _angular_core.InputSignal<unknown>;
580
578
  /**
581
- * Explicit `aria-label` override.
579
+ * Explicit `aria-label` override. Bind a dynamic accessible name here,
580
+ * not through `[attr.aria-label]`: the directive owns the host's
581
+ * `aria-label` binding, so a second binding on the same attribute races it.
582
+ * A static `aria-label="..."` attribute on the host is kept as is.
582
583
  *
583
584
  * When not set, the directive auto-detects whether the host element
584
585
  * has descriptive text content. If it does (e.g. "Cancel", "Confirm"),
@@ -586,11 +587,13 @@ declare class CngxDialogClose {
586
587
  * empty, or visually an icon, `aria-label` defaults to `"Close dialog"`.
587
588
  */
588
589
  readonly label: _angular_core.InputSignal<string | undefined>;
590
+ private readonly consumerAriaLabel;
589
591
  /** Set type="button" on <button> hosts to prevent form submit. */
590
592
  protected readonly hostType: string | null;
591
593
  /**
592
594
  * Computed `aria-label`. Returns:
593
595
  * - explicit `label()` input if set
596
+ * - the consumer's static `aria-label` attribute, kept as is
594
597
  * - `null` if host text is descriptive (> 1 char, not whitespace-only)
595
598
  * - `'Close dialog'` for icon-only / single-char content
596
599
  */
@@ -703,6 +706,150 @@ interface CngxDialogConfig<D = unknown, T = unknown> {
703
706
  focusFallback?: HTMLElement;
704
707
  }
705
708
 
709
+ /**
710
+ * The dialog section of a {@link CngxLanguagePack}: the interaction strings
711
+ * the dialog family renders on its own behalf. {@link CngxDialogLabels} is
712
+ * this shape; it feeds the `labels` of `CNGX_DIALOG_DEFAULTS`.
713
+ *
714
+ * @category common/dialog/i18n
715
+ * @since 0.1.0
716
+ * @relatedTo CNGX_DIALOG_DEFAULTS
717
+ */
718
+ interface CngxDialogLanguageSection {
719
+ /** Implicit accessible name of `CngxDialogClose` when the trigger carries no text. */
720
+ readonly close: string;
721
+ /** Live-region text when a dialog error carries no message of its own. */
722
+ readonly errorFallback: string;
723
+ /** `aria-label` set on a promoted drag handle. */
724
+ readonly dragHandle: string;
725
+ /** `aria-roledescription` set on a promoted drag handle. */
726
+ readonly dragHandleRoleDescription: string;
727
+ /** Visually hidden keyboard-drag instruction the handle is described by. */
728
+ readonly dragInstructions: string;
729
+ }
730
+ /**
731
+ * The English dialog section: the single source of the dialog family's
732
+ * English copy. The `CNGX_DIALOG_DEFAULTS` labels default to it.
733
+ *
734
+ * @category common/dialog/i18n
735
+ * @since 0.1.0
736
+ * @relatedTo CNGX_DIALOG_DEFAULTS
737
+ */
738
+ declare const CNGX_DIALOG_LANGUAGE_EN: CngxDialogLanguageSection;
739
+ declare module '@cngx/core/i18n' {
740
+ interface CngxLanguagePack {
741
+ readonly dialog: CngxDialogLanguageSection;
742
+ }
743
+ }
744
+
745
+ /**
746
+ * The five interaction strings the dialog family renders on its own behalf.
747
+ * Every one is a fallback the consumer cannot reach declaratively: the close
748
+ * affordance only names itself when the trigger has no text of its own, the
749
+ * error fallback only fires when the thrown value is not a string, and the
750
+ * drag handle is labelled imperatively because the directive may promote any
751
+ * element to a handle. The same shape as the dialog section of a language
752
+ * pack, declared once as {@link CngxDialogLanguageSection}.
753
+ *
754
+ * @category common/dialog/config
755
+ */
756
+ type CngxDialogLabels = CngxDialogLanguageSection;
757
+ /**
758
+ * App-wide dialog defaults, populated via {@link provideDialogConfig} in the
759
+ * root providers (or {@link provideDialogConfigAt} in a component's
760
+ * `viewProviders` for a sub-tree scope).
761
+ *
762
+ * Distinct from `CngxDialogConfig`, which is the per-open option bag passed to
763
+ * `CngxDialogOpener.open()`. This one carries defaults for every dialog in the
764
+ * scope; that one configures a single dialog instance.
765
+ *
766
+ * `labels` is a plain bundle or a `Signal` of one; once
767
+ * {@link provideDialogConfig} ran it holds a `Signal`, so the strings follow
768
+ * a runtime language switch. Read it through `coerceSignal` from
769
+ * `@cngx/core/utils`.
770
+ *
771
+ * Only `labels` today. Size / backdrop / close-on-escape / focus-fallback
772
+ * defaults are deliberately absent - no consumer has asked for them, and a key
773
+ * with no caller is configuration for its own sake.
774
+ *
775
+ * @category common/dialog/config
776
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/config/dialog-config.ts
777
+ * @since 0.1.0
778
+ */
779
+ interface CngxDialogDefaults {
780
+ readonly labels: CngxDialogLabels | Signal<CngxDialogLabels>;
781
+ }
782
+ /**
783
+ * DI token carrying the merged {@link CngxDialogDefaults}. `providedIn: 'root'`:
784
+ * `labels` is the dialog section of the active language pack over the English
785
+ * defaults, so a consumer who provides nothing keeps today's behaviour
786
+ * exactly.
787
+ *
788
+ * @category common/dialog/config
789
+ * @wcag AA
790
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/config/dialog-config.ts
791
+ * @since 0.1.0
792
+ * @relatedTo CngxDialog, CngxDialogClose, CngxDialogDraggable
793
+ */
794
+ declare const CNGX_DIALOG_DEFAULTS: InjectionToken<CngxDialogDefaults>;
795
+ /**
796
+ * Feature returned by a `with*` function - merged by
797
+ * {@link provideDialogConfig}.
798
+ *
799
+ * @category common/dialog/config
800
+ */
801
+ interface CngxDialogConfigFeature {
802
+ /** @internal */
803
+ readonly labels?: Partial<CngxDialogLabels> | Signal<Partial<CngxDialogLabels>>;
804
+ }
805
+ /**
806
+ * Override dialog interaction strings. Unset keys keep the language pack's
807
+ * text, or the English default, and two calls merge rather than replace.
808
+ * Pass a `Signal` to switch the language at runtime.
809
+ *
810
+ * ```ts
811
+ * bootstrapApplication(AppComponent, {
812
+ * providers: [
813
+ * provideDialogConfig(
814
+ * withDialogLabels({ close: 'Dialog schließen', dragHandle: 'Dialog verschieben' }),
815
+ * ),
816
+ * ],
817
+ * });
818
+ * ```
819
+ *
820
+ * @category common/dialog/config
821
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/config/dialog-config.ts
822
+ * @since 0.1.0
823
+ */
824
+ declare function withDialogLabels(overrides: Partial<CngxDialogLabels> | Signal<Partial<CngxDialogLabels>>): CngxDialogConfigFeature;
825
+ /**
826
+ * Register app-wide dialog defaults composed from `with*` features, applied
827
+ * on top of the active language pack.
828
+ *
829
+ * @category common/dialog/config
830
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/config/dialog-config.ts
831
+ * @since 0.1.0
832
+ */
833
+ declare function provideDialogConfig(...features: CngxDialogConfigFeature[]): Provider[];
834
+ /**
835
+ * Sub-tree variant - use in `viewProviders` so the defaults only apply to
836
+ * dialogs opened from descendants of this component.
837
+ *
838
+ * @category common/dialog/config
839
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/config/dialog-config.ts
840
+ * @since 0.1.0
841
+ */
842
+ declare function provideDialogConfigAt(...features: CngxDialogConfigFeature[]): Provider[];
843
+ /**
844
+ * Inject the currently-resolved dialog defaults. Safe in any injection
845
+ * context; falls back to the English bundle when nothing is provided.
846
+ *
847
+ * @category common/dialog/config
848
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/common/dialog/config/dialog-config.ts
849
+ * @since 0.1.0
850
+ */
851
+ declare function injectDialogConfig(): CngxDialogDefaults;
852
+
706
853
  /**
707
854
  * Internal container component for programmatically opened dialogs.
708
855
  *
@@ -893,6 +1040,7 @@ declare class CngxDialogOpener {
893
1040
  */
894
1041
  closeAll(): void;
895
1042
  private cleanup;
1043
+ private discardOutlet;
896
1044
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxDialogOpener, never>;
897
1045
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<CngxDialogOpener>;
898
1046
  }
@@ -1015,6 +1163,7 @@ declare class CngxBottomSheet {
1015
1163
  declare class CngxDialogDraggable {
1016
1164
  private readonly elRef;
1017
1165
  private readonly doc;
1166
+ private readonly labels;
1018
1167
  private readonly destroyRef;
1019
1168
  private readonly ariaRegistry;
1020
1169
  /** Handle element for initiating drag. If not set, entire dialog is the handle. */
@@ -1071,6 +1220,8 @@ declare class CngxDialogDraggable {
1071
1220
  private handleKeyDown;
1072
1221
  /** Snap `x`/`y` to the nearest `gridSize` increment. Pass-through when grid is disabled. */
1073
1222
  private snap;
1223
+ /** Re-apply the handle labels and the instruction text this directive owns. */
1224
+ private applyLabels;
1074
1225
  private instructionNode;
1075
1226
  private releaseInstruction;
1076
1227
  private handleAddedDescribedBy;
@@ -1097,5 +1248,5 @@ declare class CngxDialogDraggable {
1097
1248
  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>;
1098
1249
  }
1099
1250
 
1100
- export { CNGX_DIALOG_DATA, CngxBottomSheet, CngxDialog, CngxDialogClose, CngxDialogDescription, CngxDialogDraggable, CngxDialogOpener, CngxDialogRef, CngxDialogStack, CngxDialogTitle, DIALOG_REF, provideDialog, provideDialogStack };
1101
- export type { CngxDialogConfig, DialogRef, DialogState };
1251
+ 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 };
1252
+ export type { CngxDialogConfig, CngxDialogConfigFeature, CngxDialogDefaults, CngxDialogLabels, CngxDialogLanguageSection, DialogRef, DialogState };