@cngx/common 0.1.0-rc.7 → 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 (63) hide show
  1. package/card/README.md +2 -1
  2. package/data/README.md +10 -1
  3. package/dialog/README.md +23 -1
  4. package/fesm2022/cngx-common-a11y.mjs +125 -111
  5. package/fesm2022/cngx-common-a11y.mjs.map +1 -1
  6. package/fesm2022/cngx-common-audio.mjs +47 -5
  7. package/fesm2022/cngx-common-audio.mjs.map +1 -1
  8. package/fesm2022/cngx-common-card.mjs +300 -46
  9. package/fesm2022/cngx-common-card.mjs.map +1 -1
  10. package/fesm2022/cngx-common-chart.mjs +1176 -453
  11. package/fesm2022/cngx-common-chart.mjs.map +1 -1
  12. package/fesm2022/cngx-common-command.mjs +37 -10
  13. package/fesm2022/cngx-common-command.mjs.map +1 -1
  14. package/fesm2022/cngx-common-data.mjs +1318 -469
  15. package/fesm2022/cngx-common-data.mjs.map +1 -1
  16. package/fesm2022/cngx-common-dialog.mjs +151 -14
  17. package/fesm2022/cngx-common-dialog.mjs.map +1 -1
  18. package/fesm2022/cngx-common-display.mjs +340 -73
  19. package/fesm2022/cngx-common-display.mjs.map +1 -1
  20. package/fesm2022/cngx-common-interactive.mjs +1744 -952
  21. package/fesm2022/cngx-common-interactive.mjs.map +1 -1
  22. package/fesm2022/cngx-common-layout.mjs +841 -114
  23. package/fesm2022/cngx-common-layout.mjs.map +1 -1
  24. package/fesm2022/cngx-common-popover.mjs +350 -60
  25. package/fesm2022/cngx-common-popover.mjs.map +1 -1
  26. package/fesm2022/cngx-common-stepper.mjs +727 -317
  27. package/fesm2022/cngx-common-stepper.mjs.map +1 -1
  28. package/fesm2022/cngx-common-tabs.mjs +1601 -1243
  29. package/fesm2022/cngx-common-tabs.mjs.map +1 -1
  30. package/fesm2022/cngx-common-timeline.mjs +137 -53
  31. package/fesm2022/cngx-common-timeline.mjs.map +1 -1
  32. package/fesm2022/cngx-common.mjs +1 -1
  33. package/interactive/README.md +15 -4
  34. package/layout/README.md +21 -1
  35. package/package.json +3 -3
  36. package/popover/README.md +18 -2
  37. package/stepper/README.md +6 -4
  38. package/theming/components/cngx-accordion.css +1 -1
  39. package/theming/components/cngx-backdrop.css +12 -0
  40. package/theming/components/cngx-button-toggle.css +29 -3
  41. package/theming/components/cngx-data-grid.css +168 -1
  42. package/theming/components/cngx-dialog.css +13 -0
  43. package/theming/components/cngx-listbox.css +21 -12
  44. package/theming/components/cngx-menu.css +56 -16
  45. package/theming/components/cngx-popover.css +24 -0
  46. package/theming/components/cngx-recycler-placeholder.css +196 -0
  47. package/theming/components/cngx-ripple.css +1 -1
  48. package/theming/components/cngx-slider.css +32 -1
  49. package/theming/components/cngx-tooltip.css +12 -0
  50. package/timeline/README.md +155 -0
  51. package/types/cngx-common-a11y.d.ts +42 -18
  52. package/types/cngx-common-card.d.ts +201 -17
  53. package/types/cngx-common-chart.d.ts +343 -47
  54. package/types/cngx-common-command.d.ts +31 -8
  55. package/types/cngx-common-data.d.ts +581 -68
  56. package/types/cngx-common-dialog.d.ts +158 -3
  57. package/types/cngx-common-display.d.ts +356 -142
  58. package/types/cngx-common-interactive.d.ts +859 -210
  59. package/types/cngx-common-layout.d.ts +567 -28
  60. package/types/cngx-common-popover.d.ts +262 -39
  61. package/types/cngx-common-stepper.d.ts +366 -116
  62. package/types/cngx-common-tabs.d.ts +214 -50
  63. package/types/cngx-common-timeline.d.ts +82 -16
@@ -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;
@@ -575,10 +577,14 @@ declare class CngxDialogDescription {
575
577
  declare class CngxDialogClose {
576
578
  private readonly dialogRef;
577
579
  private readonly elRef;
580
+ private readonly labels;
578
581
  /** Value to pass to `close()`. When `undefined`, calls `dismiss()` instead. */
579
582
  readonly value: _angular_core.InputSignal<unknown>;
580
583
  /**
581
- * 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.
582
588
  *
583
589
  * When not set, the directive auto-detects whether the host element
584
590
  * has descriptive text content. If it does (e.g. "Cancel", "Confirm"),
@@ -586,11 +592,13 @@ declare class CngxDialogClose {
586
592
  * empty, or visually an icon, `aria-label` defaults to `"Close dialog"`.
587
593
  */
588
594
  readonly label: _angular_core.InputSignal<string | undefined>;
595
+ private readonly consumerAriaLabel;
589
596
  /** Set type="button" on <button> hosts to prevent form submit. */
590
597
  protected readonly hostType: string | null;
591
598
  /**
592
599
  * Computed `aria-label`. Returns:
593
600
  * - explicit `label()` input if set
601
+ * - the consumer's static `aria-label` attribute, kept as is
594
602
  * - `null` if host text is descriptive (> 1 char, not whitespace-only)
595
603
  * - `'Close dialog'` for icon-only / single-char content
596
604
  */
@@ -703,6 +711,150 @@ interface CngxDialogConfig<D = unknown, T = unknown> {
703
711
  focusFallback?: HTMLElement;
704
712
  }
705
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
+ }
748
+ }
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
+
706
858
  /**
707
859
  * Internal container component for programmatically opened dialogs.
708
860
  *
@@ -1015,6 +1167,7 @@ declare class CngxBottomSheet {
1015
1167
  declare class CngxDialogDraggable {
1016
1168
  private readonly elRef;
1017
1169
  private readonly doc;
1170
+ private readonly labels;
1018
1171
  private readonly destroyRef;
1019
1172
  private readonly ariaRegistry;
1020
1173
  /** Handle element for initiating drag. If not set, entire dialog is the handle. */
@@ -1071,6 +1224,8 @@ declare class CngxDialogDraggable {
1071
1224
  private handleKeyDown;
1072
1225
  /** Snap `x`/`y` to the nearest `gridSize` increment. Pass-through when grid is disabled. */
1073
1226
  private snap;
1227
+ /** Re-apply the handle labels and the instruction text this directive owns. */
1228
+ private applyLabels;
1074
1229
  private instructionNode;
1075
1230
  private releaseInstruction;
1076
1231
  private handleAddedDescribedBy;
@@ -1097,5 +1252,5 @@ declare class CngxDialogDraggable {
1097
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>;
1098
1253
  }
1099
1254
 
1100
- export { CNGX_DIALOG_DATA, CngxBottomSheet, CngxDialog, CngxDialogClose, CngxDialogDescription, CngxDialogDraggable, CngxDialogOpener, CngxDialogRef, CngxDialogStack, CngxDialogTitle, DIALOG_REF, provideDialog, provideDialogStack };
1101
- 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 };