@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
@@ -3,6 +3,7 @@ import { InjectionToken, Signal, TemplateRef, EnvironmentProviders, Provider } f
3
3
  import * as _cngx_common_timeline from '@cngx/common/timeline';
4
4
  import { CngxAsyncState } from '@cngx/core/utils';
5
5
  import { EmptyReason } from '@cngx/common/card';
6
+ import { CngxMessage } from '@cngx/core/i18n';
6
7
 
7
8
  /**
8
9
  * One rendered band of a timeline - a calendar bucket plus the items that
@@ -98,6 +99,12 @@ interface TimelineGroupingOptions<T> {
98
99
  readonly groupBy?: () => TimelineGroupBy<T>;
99
100
  /** Sort direction. Defaults to `'desc'`. */
100
101
  readonly direction?: () => TimelineDirection;
102
+ /**
103
+ * BCP 47 locale whose first day of the week starts a `'week'` bucket
104
+ * (`Intl.Locale` week info: Sunday in `en-US`, Monday in `de`). Unset, or
105
+ * where the runtime has no week info, weeks start on Monday (ISO 8601).
106
+ */
107
+ readonly locale?: () => string;
101
108
  }
102
109
  /**
103
110
  * What {@link createTimelineGrouping} hands back. An object rather than a
@@ -442,7 +449,7 @@ declare class CngxTimelineContent {
442
449
  * @since 0.1.0
443
450
  */
444
451
  declare class CngxTimelineItem {
445
- private readonly config;
452
+ private readonly labels;
446
453
  private readonly host;
447
454
  /**
448
455
  * Where the event sits in the history. Drives the marker and rail
@@ -599,7 +606,7 @@ interface CngxTimelineDateHeaderContext<T> {
599
606
  /**
600
607
  * The per-group header. Falls back to
601
608
  * `CNGX_TIMELINE_CONFIG.labels.groupLabel`, which formats the group's
602
- * start date in the browser locale.
609
+ * start date in the app locale.
603
610
  *
604
611
  * The element this renders into is what the group's `aria-labelledby`
605
612
  * points at, so a header that renders nothing leaves the group unnamed.
@@ -785,14 +792,33 @@ declare class CngxTimelineLoadingTail {
785
792
  static ɵfac: i0.ɵɵFactoryDeclaration<CngxTimelineLoadingTail, never>;
786
793
  static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTimelineLoadingTail, "ng-template[cngxTimelineLoadingTail]", ["cngxTimelineLoadingTail"], {}, {}, never, never, true, never>;
787
794
  }
795
+ /**
796
+ * Context of one `*cngxTimelineSkeleton` placeholder row. A placeholder has
797
+ * no data, only a position: the same index, row count and side the built-in
798
+ * placeholder uses, so a custom shape lands where the content row will.
799
+ *
800
+ * @category common/timeline
801
+ * @since 0.1.0
802
+ */
803
+ interface CngxTimelineSkeletonContext {
804
+ /** Same as `index`, for `let-index` shorthand. */
805
+ readonly $implicit: number;
806
+ /** 0-based position of the placeholder row. */
807
+ readonly index: number;
808
+ /** Number of placeholder rows (`[skeletonRowCount]`). */
809
+ readonly count: number;
810
+ /** Side the content row at this index will sit on, from `placement` and `mode`. */
811
+ readonly side: 'start' | 'end';
812
+ }
788
813
  /**
789
814
  * One placeholder row in the first-load body, replacing the built-in
790
815
  * marker-rail-and-two-bars shape. Rendered `[skeletonRowCount]` times.
791
816
  *
792
- * Contextless, and deliberately so: a placeholder stands in for a row whose
793
- * data has not arrived, so there is nothing to hand it. Bind this when the
794
- * real rows are taller or busier than the default shape and the swap to
795
- * content would otherwise reflow the page.
817
+ * The context carries the row's position only ({@link CngxTimelineSkeletonContext}):
818
+ * `index`, `count` and the `side` the content row will sit on, so a custom
819
+ * shape follows `placement="end"` / `"alternate"` and the swap to content
820
+ * does not reflow. Bind this when the real rows are taller or busier than
821
+ * the default shape.
796
822
  *
797
823
  * Whatever renders here sits inside an `aria-hidden` wrapper - the load is
798
824
  * announced through the timeline's live region, not through the placeholder.
@@ -803,7 +829,8 @@ declare class CngxTimelineLoadingTail {
803
829
  * @since 0.1.0
804
830
  */
805
831
  declare class CngxTimelineSkeleton {
806
- readonly templateRef: TemplateRef<void>;
832
+ readonly templateRef: TemplateRef<CngxTimelineSkeletonContext>;
833
+ static ngTemplateContextGuard(_dir: CngxTimelineSkeleton, ctx: unknown): ctx is CngxTimelineSkeletonContext;
807
834
  static ɵfac: i0.ɵɵFactoryDeclaration<CngxTimelineSkeleton, never>;
808
835
  static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTimelineSkeleton, "ng-template[cngxTimelineSkeleton]", ["cngxTimelineSkeleton"], {}, {}, never, never, true, never>;
809
836
  }
@@ -874,7 +901,7 @@ interface CngxTimelineLabels {
874
901
  readonly errorFallback?: string;
875
902
  /**
876
903
  * Body text for the empty surface when no `*cngxTimelineEmpty` slot is
877
- * bound. Default `'No events yet.'`
904
+ * bound. Default `'No events yet'`
878
905
  */
879
906
  readonly emptyFallback?: string;
880
907
  /**
@@ -913,11 +940,13 @@ interface CngxTimelineLabels {
913
940
  /**
914
941
  * Formats a group's header when no `*cngxTimelineDateHeader` slot is
915
942
  * bound. Receives the whole group so a consumer can fold the item
916
- * count into the header. Defaults to the group's start date in the
917
- * browser locale - a date, unlike the strings above, has no sensible
918
- * English-only default.
943
+ * count into the header. The second argument is the app locale
944
+ * (`CNGX_LOCALE`, falling back to the nearest `LOCALE_ID`), read live,
945
+ * so a formatter that uses it follows a locale switch. Defaults to the
946
+ * group's start date as a numeric date in that locale, placed by the
947
+ * `groupHeader` message of the timeline language section.
919
948
  */
920
- readonly groupLabel?: (group: TimelineGroup<unknown>) => string;
949
+ readonly groupLabel?: (group: TimelineGroup<unknown>, locale: string) => string;
921
950
  }
922
951
  /**
923
952
  * App-wide template defaults for the timeline's slot regions - the middle
@@ -946,7 +975,7 @@ interface CngxTimelineTemplates {
946
975
  /** Default refreshing tail (`*cngxTimelineLoadingTail`). */
947
976
  readonly loadingTail?: TemplateRef<void>;
948
977
  /** Default placeholder row for the first-load body (`*cngxTimelineSkeleton`). */
949
- readonly skeleton?: TemplateRef<void>;
978
+ readonly skeleton?: TemplateRef<CngxTimelineSkeletonContext>;
950
979
  }
951
980
  /**
952
981
  * Timeline config surface. Resolution priority: \
@@ -961,12 +990,18 @@ interface CngxTimelineTemplates {
961
990
  * @category common/timeline
962
991
  */
963
992
  interface CngxTimelineConfig {
964
- readonly labels?: CngxTimelineLabels;
993
+ /**
994
+ * A plain bundle or a `Signal` of one; once {@link withTimelineLabels} ran
995
+ * it holds a `Signal`, so the copy follows a runtime language switch. Read
996
+ * it through `coerceSignal` from `@cngx/core/utils`.
997
+ */
998
+ readonly labels?: CngxTimelineLabels | Signal<CngxTimelineLabels>;
965
999
  readonly templates?: CngxTimelineTemplates;
966
1000
  }
967
1001
  /**
968
1002
  * DI token for the resolved timeline config. \
969
- * `providedIn: 'root'` with the library defaults; override via
1003
+ * `providedIn: 'root'` with the library defaults, `labels` read from the
1004
+ * timeline section of the active language pack; override via
970
1005
  * {@link provideTimelineConfig} (root) or {@link provideTimelineConfigAt}
971
1006
  * (component scope).
972
1007
  *
@@ -986,23 +1021,23 @@ declare const CNGX_TIMELINE_CONFIG: InjectionToken<CngxTimelineConfig>;
986
1021
  */
987
1022
  type CngxTimelineConfigFeature = (config: CngxTimelineConfig) => CngxTimelineConfig;
988
1023
  /**
989
- * Merge label overrides into the cascade. Keys left out keep their
990
- * English library default, so a consumer translates what they need and
991
- * nothing more.
1024
+ * Merge label overrides into the cascade. Keys left out keep the language
1025
+ * pack's copy, or the English library default, so a consumer translates
1026
+ * what they need and nothing more. Pass a `Signal` to switch the language at runtime.
992
1027
  *
993
1028
  * ```ts
994
1029
  * provideTimelineConfig(
995
1030
  * withTimelineLabels({
996
1031
  * retry: 'Erneut versuchen',
997
1032
  * emptyFallback: 'Noch keine Ereignisse.',
998
- * groupLabel: (group) => group.start.toLocaleDateString('de-AT'),
1033
+ * groupLabel: (group, locale) => group.start.toLocaleDateString(locale, { dateStyle: 'medium' }),
999
1034
  * }),
1000
1035
  * )
1001
1036
  * ```
1002
1037
  *
1003
1038
  * @category common/timeline
1004
1039
  */
1005
- declare function withTimelineLabels(labels: CngxTimelineLabels): CngxTimelineConfigFeature;
1040
+ declare function withTimelineLabels(labels: CngxTimelineLabels | Signal<CngxTimelineLabels>): CngxTimelineConfigFeature;
1006
1041
  /**
1007
1042
  * Merge app-wide slot template defaults into the cascade. Keys left out
1008
1043
  * keep whatever an earlier feature set, and a per-instance slot directive
@@ -1055,5 +1090,56 @@ declare function provideTimelineConfigAt(...features: readonly CngxTimelineConfi
1055
1090
  */
1056
1091
  declare function injectTimelineConfig(): CngxTimelineConfig;
1057
1092
 
1058
- export { CNGX_TIMELINE_CONFIG, CNGX_TIMELINE_GROUPING_FACTORY, CNGX_TIMELINE_MARKER_HOST, CngxTimelineConnector, CngxTimelineContent, CngxTimelineDateHeader, CngxTimelineEmpty, CngxTimelineError, CngxTimelineItem, CngxTimelineItemTpl, CngxTimelineLoadingTail, CngxTimelineMarker, CngxTimelineMarkerContent, CngxTimelineMarkerTpl, CngxTimelineOpposite, CngxTimelineRetryButton, CngxTimelineSkeleton, CngxTimelineTime, createTimelineGrouping, injectTimelineConfig, provideTimelineConfig, provideTimelineConfigAt, withTimelineLabels, withTimelineTemplates };
1059
- export type { CngxTimelineConfig, CngxTimelineConfigFeature, CngxTimelineDateHeaderContext, CngxTimelineEmptyContext, CngxTimelineErrorContext, CngxTimelineGroupingFactory, CngxTimelineItemContext, CngxTimelineLabels, CngxTimelineMarkerContext, CngxTimelineMarkerHost, CngxTimelineRetryButtonContext, CngxTimelineTemplates, TimelineConnectorPosition, TimelineDateAccessor, TimelineDirection, TimelineGroup, TimelineGroupBy, TimelineGroupKey, TimelineGrouping, TimelineGroupingFn, TimelineGroupingOptions, TimelineStatus };
1093
+ /**
1094
+ * The timeline section of a {@link CngxLanguagePack}: every string the
1095
+ * timeline renders without a consumer slot. It feeds the `labels` of
1096
+ * `CNGX_TIMELINE_CONFIG`.
1097
+ *
1098
+ * @category common/timeline
1099
+ * @since 0.1.0
1100
+ * @relatedTo CNGX_TIMELINE_CONFIG, withTimelineLabels
1101
+ */
1102
+ interface CngxTimelineLanguageSection {
1103
+ /** Accessible name of the timeline list. */
1104
+ readonly timelineRegion: string;
1105
+ /** Label of the built-in retry control. */
1106
+ readonly retry: string;
1107
+ /** Body of the error surface. */
1108
+ readonly errorFallback: string;
1109
+ /** Body of the empty surface. */
1110
+ readonly emptyFallback: string;
1111
+ /** Accessible name of the loading body. */
1112
+ readonly loading: string;
1113
+ /** Refreshing tail below the list. */
1114
+ readonly refreshing: string;
1115
+ /** Screen-reader text of a pending item. */
1116
+ readonly itemBusy: string;
1117
+ /** Inline error text of a failed item. */
1118
+ readonly itemErrorFallback: string;
1119
+ /** Screen-reader wording per process status. */
1120
+ readonly status: {
1121
+ readonly done: string;
1122
+ readonly active: string;
1123
+ readonly upcoming: string;
1124
+ readonly rejected: string;
1125
+ };
1126
+ /** `{date}`: a group header, `{date}` being the group's start date in the app locale. */
1127
+ readonly groupHeader: CngxMessage;
1128
+ }
1129
+ /**
1130
+ * The English timeline section: the single source of the timeline's English
1131
+ * copy. `CNGX_TIMELINE_CONFIG` defaults its `labels` to it.
1132
+ *
1133
+ * @category common/timeline
1134
+ * @since 0.1.0
1135
+ * @relatedTo CNGX_TIMELINE_CONFIG
1136
+ */
1137
+ declare const CNGX_TIMELINE_LANGUAGE_EN: CngxTimelineLanguageSection;
1138
+ declare module '@cngx/core/i18n' {
1139
+ interface CngxLanguagePack {
1140
+ readonly timeline: CngxTimelineLanguageSection;
1141
+ }
1142
+ }
1143
+
1144
+ export { CNGX_TIMELINE_CONFIG, CNGX_TIMELINE_GROUPING_FACTORY, CNGX_TIMELINE_LANGUAGE_EN, CNGX_TIMELINE_MARKER_HOST, CngxTimelineConnector, CngxTimelineContent, CngxTimelineDateHeader, CngxTimelineEmpty, CngxTimelineError, CngxTimelineItem, CngxTimelineItemTpl, CngxTimelineLoadingTail, CngxTimelineMarker, CngxTimelineMarkerContent, CngxTimelineMarkerTpl, CngxTimelineOpposite, CngxTimelineRetryButton, CngxTimelineSkeleton, CngxTimelineTime, createTimelineGrouping, injectTimelineConfig, provideTimelineConfig, provideTimelineConfigAt, withTimelineLabels, withTimelineTemplates };
1145
+ export type { CngxTimelineConfig, CngxTimelineConfigFeature, CngxTimelineDateHeaderContext, CngxTimelineEmptyContext, CngxTimelineErrorContext, CngxTimelineGroupingFactory, CngxTimelineItemContext, CngxTimelineLabels, CngxTimelineLanguageSection, CngxTimelineMarkerContext, CngxTimelineMarkerHost, CngxTimelineRetryButtonContext, CngxTimelineSkeletonContext, CngxTimelineTemplates, TimelineConnectorPosition, TimelineDateAccessor, TimelineDirection, TimelineGroup, TimelineGroupBy, TimelineGroupKey, TimelineGrouping, TimelineGroupingFn, TimelineGroupingOptions, TimelineStatus };