@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
@@ -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.
@@ -874,7 +881,7 @@ interface CngxTimelineLabels {
874
881
  readonly errorFallback?: string;
875
882
  /**
876
883
  * Body text for the empty surface when no `*cngxTimelineEmpty` slot is
877
- * bound. Default `'No events yet.'`
884
+ * bound. Default `'No events yet'`
878
885
  */
879
886
  readonly emptyFallback?: string;
880
887
  /**
@@ -913,11 +920,13 @@ interface CngxTimelineLabels {
913
920
  /**
914
921
  * Formats a group's header when no `*cngxTimelineDateHeader` slot is
915
922
  * 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.
923
+ * count into the header. The second argument is the app locale
924
+ * (`CNGX_LOCALE`, falling back to the nearest `LOCALE_ID`), read live,
925
+ * so a formatter that uses it follows a locale switch. Defaults to the
926
+ * group's start date as a numeric date in that locale, placed by the
927
+ * `groupHeader` message of the timeline language section.
919
928
  */
920
- readonly groupLabel?: (group: TimelineGroup<unknown>) => string;
929
+ readonly groupLabel?: (group: TimelineGroup<unknown>, locale: string) => string;
921
930
  }
922
931
  /**
923
932
  * App-wide template defaults for the timeline's slot regions - the middle
@@ -961,12 +970,18 @@ interface CngxTimelineTemplates {
961
970
  * @category common/timeline
962
971
  */
963
972
  interface CngxTimelineConfig {
964
- readonly labels?: CngxTimelineLabels;
973
+ /**
974
+ * A plain bundle or a `Signal` of one; once {@link withTimelineLabels} ran
975
+ * it holds a `Signal`, so the copy follows a runtime language switch. Read
976
+ * it through `coerceSignal` from `@cngx/core/utils`.
977
+ */
978
+ readonly labels?: CngxTimelineLabels | Signal<CngxTimelineLabels>;
965
979
  readonly templates?: CngxTimelineTemplates;
966
980
  }
967
981
  /**
968
982
  * DI token for the resolved timeline config. \
969
- * `providedIn: 'root'` with the library defaults; override via
983
+ * `providedIn: 'root'` with the library defaults, `labels` read from the
984
+ * timeline section of the active language pack; override via
970
985
  * {@link provideTimelineConfig} (root) or {@link provideTimelineConfigAt}
971
986
  * (component scope).
972
987
  *
@@ -986,23 +1001,23 @@ declare const CNGX_TIMELINE_CONFIG: InjectionToken<CngxTimelineConfig>;
986
1001
  */
987
1002
  type CngxTimelineConfigFeature = (config: CngxTimelineConfig) => CngxTimelineConfig;
988
1003
  /**
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.
1004
+ * Merge label overrides into the cascade. Keys left out keep the language
1005
+ * pack's copy, or the English library default, so a consumer translates
1006
+ * what they need and nothing more. Pass a `Signal` to switch the language at runtime.
992
1007
  *
993
1008
  * ```ts
994
1009
  * provideTimelineConfig(
995
1010
  * withTimelineLabels({
996
1011
  * retry: 'Erneut versuchen',
997
1012
  * emptyFallback: 'Noch keine Ereignisse.',
998
- * groupLabel: (group) => group.start.toLocaleDateString('de-AT'),
1013
+ * groupLabel: (group, locale) => group.start.toLocaleDateString(locale, { dateStyle: 'medium' }),
999
1014
  * }),
1000
1015
  * )
1001
1016
  * ```
1002
1017
  *
1003
1018
  * @category common/timeline
1004
1019
  */
1005
- declare function withTimelineLabels(labels: CngxTimelineLabels): CngxTimelineConfigFeature;
1020
+ declare function withTimelineLabels(labels: CngxTimelineLabels | Signal<CngxTimelineLabels>): CngxTimelineConfigFeature;
1006
1021
  /**
1007
1022
  * Merge app-wide slot template defaults into the cascade. Keys left out
1008
1023
  * keep whatever an earlier feature set, and a per-instance slot directive
@@ -1055,5 +1070,56 @@ declare function provideTimelineConfigAt(...features: readonly CngxTimelineConfi
1055
1070
  */
1056
1071
  declare function injectTimelineConfig(): CngxTimelineConfig;
1057
1072
 
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 };
1073
+ /**
1074
+ * The timeline section of a {@link CngxLanguagePack}: every string the
1075
+ * timeline renders without a consumer slot. It feeds the `labels` of
1076
+ * `CNGX_TIMELINE_CONFIG`.
1077
+ *
1078
+ * @category common/timeline
1079
+ * @since 0.1.0
1080
+ * @relatedTo CNGX_TIMELINE_CONFIG, withTimelineLabels
1081
+ */
1082
+ interface CngxTimelineLanguageSection {
1083
+ /** Accessible name of the timeline list. */
1084
+ readonly timelineRegion: string;
1085
+ /** Label of the built-in retry control. */
1086
+ readonly retry: string;
1087
+ /** Body of the error surface. */
1088
+ readonly errorFallback: string;
1089
+ /** Body of the empty surface. */
1090
+ readonly emptyFallback: string;
1091
+ /** Accessible name of the loading body. */
1092
+ readonly loading: string;
1093
+ /** Refreshing tail below the list. */
1094
+ readonly refreshing: string;
1095
+ /** Screen-reader text of a pending item. */
1096
+ readonly itemBusy: string;
1097
+ /** Inline error text of a failed item. */
1098
+ readonly itemErrorFallback: string;
1099
+ /** Screen-reader wording per process status. */
1100
+ readonly status: {
1101
+ readonly done: string;
1102
+ readonly active: string;
1103
+ readonly upcoming: string;
1104
+ readonly rejected: string;
1105
+ };
1106
+ /** `{date}`: a group header, `{date}` being the group's start date in the app locale. */
1107
+ readonly groupHeader: CngxMessage;
1108
+ }
1109
+ /**
1110
+ * The English timeline section: the single source of the timeline's English
1111
+ * copy. `CNGX_TIMELINE_CONFIG` defaults its `labels` to it.
1112
+ *
1113
+ * @category common/timeline
1114
+ * @since 0.1.0
1115
+ * @relatedTo CNGX_TIMELINE_CONFIG
1116
+ */
1117
+ declare const CNGX_TIMELINE_LANGUAGE_EN: CngxTimelineLanguageSection;
1118
+ declare module '@cngx/core/i18n' {
1119
+ interface CngxLanguagePack {
1120
+ readonly timeline: CngxTimelineLanguageSection;
1121
+ }
1122
+ }
1123
+
1124
+ 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 };
1125
+ export type { CngxTimelineConfig, CngxTimelineConfigFeature, CngxTimelineDateHeaderContext, CngxTimelineEmptyContext, CngxTimelineErrorContext, CngxTimelineGroupingFactory, CngxTimelineItemContext, CngxTimelineLabels, CngxTimelineLanguageSection, CngxTimelineMarkerContext, CngxTimelineMarkerHost, CngxTimelineRetryButtonContext, CngxTimelineTemplates, TimelineConnectorPosition, TimelineDateAccessor, TimelineDirection, TimelineGroup, TimelineGroupBy, TimelineGroupKey, TimelineGrouping, TimelineGroupingFn, TimelineGroupingOptions, TimelineStatus };