@cngx/ui 0.1.0-rc.2 → 0.1.0-rc.4

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 (48) hide show
  1. package/README.md +15 -7
  2. package/accordion/README.md +86 -0
  3. package/collection/README.md +167 -0
  4. package/data-grid-accordion/README.md +137 -0
  5. package/fesm2022/cngx-ui-accordion.mjs +853 -0
  6. package/fesm2022/cngx-ui-accordion.mjs.map +1 -0
  7. package/fesm2022/cngx-ui-action-button.mjs +2 -2
  8. package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
  9. package/fesm2022/cngx-ui-breadcrumb.mjs +1044 -0
  10. package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -0
  11. package/fesm2022/cngx-ui-collection.mjs +645 -0
  12. package/fesm2022/cngx-ui-collection.mjs.map +1 -0
  13. package/fesm2022/cngx-ui-data-grid-accordion.mjs +1135 -0
  14. package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -0
  15. package/fesm2022/cngx-ui-empty-state.mjs +2 -2
  16. package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
  17. package/fesm2022/cngx-ui-feedback.mjs +10 -10
  18. package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
  19. package/fesm2022/cngx-ui-mat-accordion.mjs +229 -0
  20. package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -0
  21. package/fesm2022/cngx-ui-mat-paginator.mjs +215 -0
  22. package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -0
  23. package/fesm2022/cngx-ui-paginator.mjs +1937 -0
  24. package/fesm2022/cngx-ui-paginator.mjs.map +1 -0
  25. package/fesm2022/cngx-ui-sidenav.mjs +547 -65
  26. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
  27. package/fesm2022/cngx-ui-tabs.mjs +8 -6
  28. package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
  29. package/fesm2022/cngx-ui.mjs +2 -2
  30. package/fesm2022/cngx-ui.mjs.map +1 -1
  31. package/mat-accordion/README.md +48 -0
  32. package/mat-paginator/README.md +135 -0
  33. package/package.json +29 -5
  34. package/paginator/README.md +134 -0
  35. package/sidenav/README.md +89 -3
  36. package/types/cngx-ui-accordion.d.ts +801 -0
  37. package/types/cngx-ui-breadcrumb.d.ts +890 -0
  38. package/types/cngx-ui-collection.d.ts +396 -0
  39. package/types/cngx-ui-data-grid-accordion.d.ts +912 -0
  40. package/types/cngx-ui-mat-accordion.d.ts +63 -0
  41. package/types/cngx-ui-mat-paginator.d.ts +108 -0
  42. package/types/cngx-ui-paginator.d.ts +1147 -0
  43. package/types/cngx-ui-sidenav.d.ts +429 -21
  44. package/types/cngx-ui-tabs.d.ts +2 -0
  45. package/fesm2022/cngx-ui-material.mjs +0 -90
  46. package/fesm2022/cngx-ui-material.mjs.map +0 -1
  47. package/material/README.md +0 -90
  48. package/types/cngx-ui-material.d.ts +0 -47
@@ -0,0 +1,63 @@
1
+ import * as i0 from '@angular/core';
2
+ import * as i1 from '@cngx/common/interactive';
3
+
4
+ /**
5
+ * The Material twin of the cngx accordion: attach `cngxMatAccordion` to
6
+ * a vanilla `<mat-accordion>` and it is driven by the headless
7
+ * {@link CngxAccordion} brain. Consumers gain the controlled
8
+ * `[(openIds)]` group model and single-open arbitration on Material
9
+ * markup — neither of which `<mat-accordion>` exposes (Material has only
10
+ * per-panel `[expanded]`). Mirrors `[cngxMatStepper]` / `[cngxMatTabs]`.
11
+ *
12
+ * This is the instrumentation pattern: Material owns rendering and the
13
+ * consumer authors native `<mat-expansion-panel>` markup; cngx is the
14
+ * behaviour layer. `[multi]` and the two-way `[(openIds)]` are forwarded
15
+ * from {@link CngxAccordion} via `hostDirectives`.
16
+ *
17
+ * ```html
18
+ * <mat-accordion cngxMatAccordion [(openIds)]="openIds" [multi]="false">
19
+ * <mat-expansion-panel>
20
+ * <mat-expansion-panel-header>Personal info</mat-expansion-panel-header>
21
+ * <p>Tell us who you are.</p>
22
+ * </mat-expansion-panel>
23
+ * <mat-expansion-panel>
24
+ * <mat-expansion-panel-header>Account</mat-expansion-panel-header>
25
+ * <p>Choose your sign-in method.</p>
26
+ * </mat-expansion-panel>
27
+ * </mat-accordion>
28
+ * ```
29
+ *
30
+ * `multi` is authoritative on the cngx side. `MatAccordion` inherits its
31
+ * own `multi` input from `CdkAccordion`, and both directives sit on the
32
+ * same host element, so a single `[multi]` binding feeds both — the
33
+ * directive therefore pins `matAccordion.multi = true` (via an `effect`
34
+ * that re-asserts on every `multi` change) so Material never runs its own
35
+ * single-open close while the cngx `effectiveOpenIds` clamp arbitrates.
36
+ *
37
+ * @playground Controlled open-set ./examples/bridge/bridge-example.component.ts
38
+ * @category ui/mat-accordion
39
+ * @docsKind primary
40
+ * @wcag AA
41
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-accordion/mat-accordion.directive.ts
42
+ * @since 0.1.0
43
+ * @relatedTo CngxAccordion, CngxAccordionItem, CngxMatStepper, CngxMatTabs
44
+ */
45
+ declare class CngxMatAccordion {
46
+ private readonly matAccordion;
47
+ /**
48
+ * The accordion brain on this host element (declared in
49
+ * `hostDirectives`). Same-host ownership — not a child→parent inject —
50
+ * so it stays decompose-safe.
51
+ */
52
+ private readonly accordion;
53
+ private readonly injector;
54
+ private readonly destroyRef;
55
+ private readonly panels;
56
+ private readonly idByPanel;
57
+ constructor();
58
+ private panelId;
59
+ static ɵfac: i0.ɵɵFactoryDeclaration<CngxMatAccordion, never>;
60
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CngxMatAccordion, "[cngxMatAccordion]", ["cngxMatAccordion"], {}, {}, ["panels"], never, true, [{ directive: typeof i1.CngxAccordion; inputs: { "multi": "multi"; "openIds": "openIds"; }; outputs: { "openIdsChange": "openIdsChange"; }; }]>;
61
+ }
62
+
63
+ export { CngxMatAccordion };
@@ -0,0 +1,108 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import * as i1 from '@cngx/common/data';
3
+ import { CngxPaginate } from '@cngx/common/data';
4
+ export { CngxPaginateResetOn, CngxPaginateRouting } from '@cngx/common/data';
5
+
6
+ /**
7
+ * Context handed to {@link CngxMatPaginator.announceLabel} to build the
8
+ * screen-reader announcement after each page / page-size change.
9
+ *
10
+ * @category ui/mat-paginator
11
+ */
12
+ interface CngxMatPaginatorAnnounceContext {
13
+ /** 1-based current page. */
14
+ readonly page: number;
15
+ /** Total page count (minimum 1). */
16
+ readonly totalPages: number;
17
+ /** 1-based index of the first item on the page. */
18
+ readonly start: number;
19
+ /** 1-based index of the last item on the page, capped at `total`. */
20
+ readonly end: number;
21
+ /** Total item count before pagination. */
22
+ readonly total: number;
23
+ }
24
+ /**
25
+ * The in-place adoption half of the Material paginator instrumentation: add
26
+ * `cngxMatPaginator` to an existing `<mat-paginator>` and the signal-native
27
+ * {@link CngxPaginate} brain takes over its state with no DOM rewrite, mirroring
28
+ * `[cngxMatStepper]` / `[cngxMatTabs]`.
29
+ *
30
+ * The bridge composes the untouched brain via `hostDirectives`, injects the
31
+ * consumer's own `MatPaginator` with `{ self: true }`, and syncs the four
32
+ * Material properties (`length` / `pageIndex` / `pageSize` / `disabled`) plus
33
+ * `pageSizeOptions` against the brain's `computed()` graph, forwarding `(page)`
34
+ * back into the brain.
35
+ *
36
+ * Beyond plain `<mat-paginator>`, the bridge adds:
37
+ * - `[resetOn]` - jump to the first page whenever a bound key (a sort / filter /
38
+ * search value) changes, so a filtered result set never strands the user on a
39
+ * now-empty page. Pass a primitive (or a `computed` string key); an inline
40
+ * array literal recomputes every change-detection pass and would reset on each.
41
+ * - `[announce]` - mount a visually-hidden `aria-live` region that speaks the new
42
+ * page + visible range after every change; `<mat-paginator>` only relabels its
43
+ * own range text, which AT does not announce. Localise via `[announceLabel]`.
44
+ * - `[cngxPaginateRouting]` (generic companion directive from `@cngx/common/data`)
45
+ * - persist the page / size in the URL query string for deep-linkable,
46
+ * back-button-safe pagination.
47
+ *
48
+ * ```html
49
+ * <mat-paginator
50
+ * cngxMatPaginator
51
+ * #pg="cngxMatPaginator"
52
+ * [total]="items.length"
53
+ * [pageSizeOptions]="[5, 10, 25]"
54
+ * />
55
+ * <ul>
56
+ * @for (item of items.slice(pg.paginate.range()[0], pg.paginate.range()[1]); track item.id) {
57
+ * <li>{{ item.label }}</li>
58
+ * }
59
+ * </ul>
60
+ * ```
61
+ *
62
+ * @category ui/mat-paginator
63
+ * @docsKind primary
64
+ * @wcag AA
65
+ * @github https://github.com/cngxjs/cngx/blob/main/projects/ui/mat-paginator/mat-paginator-bridge.directive.ts
66
+ * @since 0.1.0
67
+ * @relatedTo CngxPaginate, CngxMatStepper, CngxPaginator
68
+ * <example-url>http://localhost:4200/#/common/data/data-source/datasource-cngxpaginate-manual-pipeline</example-url>
69
+ * <example-url>http://localhost:4200/#/common/data/paginate-list/bridge-announce-page-changes</example-url>
70
+ * <example-url>http://localhost:4200/#/common/data/paginate-list/instrumentation-bridge-cngxmatpaginator</example-url>
71
+ * <example-url>http://localhost:4200/#/common/data/paginate-list/paginated-list-cngxpaginate-cngxmatpaginator</example-url>
72
+ * <example-url>http://localhost:4200/#/common/data/paginate-list/uncontrolled-mode-zero-class-boilerplate</example-url>
73
+ */
74
+ declare class CngxMatPaginator {
75
+ private readonly matPaginator;
76
+ /**
77
+ * The composed {@link CngxPaginate} brain. Public so a sibling list or table
78
+ * outside the `<mat-paginator>` reads `range()` via `#ref="cngxMatPaginator"`.
79
+ */
80
+ readonly paginate: CngxPaginate;
81
+ /** Options for the page-size selector. A Material-render concern, owned here. */
82
+ readonly pageSizeOptions: _angular_core.InputSignal<number[]>;
83
+ /**
84
+ * Reset key. When its value changes (after the initial render) the brain jumps
85
+ * to the first page. Bind the sort / filter / search value a result set
86
+ * depends on. Pass a primitive or a `computed` - an inline array / object
87
+ * literal recomputes every change-detection pass and would reset every time.
88
+ */
89
+ readonly resetOn: _angular_core.InputSignal<unknown>;
90
+ /** Speak page changes through a visually-hidden `aria-live` region when `true`. */
91
+ readonly announce: _angular_core.InputSignal<boolean>;
92
+ /** Builds the announcement string. Defaults to an English template. */
93
+ readonly announceLabel: _angular_core.InputSignal<(context: CngxMatPaginatorAnnounceContext) => string>;
94
+ private readonly elementRef;
95
+ private readonly renderer;
96
+ private readonly destroyRef;
97
+ /** The live-region message - derived, so it never drifts from brain state. */
98
+ private readonly announceMessage;
99
+ private liveRegion;
100
+ constructor();
101
+ /** A visually-hidden polite live region appended to the host paginator. */
102
+ private createLiveRegion;
103
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxMatPaginator, never>;
104
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxMatPaginator, "[cngxMatPaginator]", ["cngxMatPaginator"], { "pageSizeOptions": { "alias": "pageSizeOptions"; "required": false; "isSignal": true; }; "resetOn": { "alias": "resetOn"; "required": false; "isSignal": true; }; "announce": { "alias": "announce"; "required": false; "isSignal": true; }; "announceLabel": { "alias": "announceLabel"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.CngxPaginate; inputs: { "cngxPageIndex": "cngxPageIndex"; "cngxPageSize": "cngxPageSize"; "total": "total"; "state": "state"; }; outputs: { "pageChange": "pageChange"; "pageSizeChange": "pageSizeChange"; }; }]>;
105
+ }
106
+
107
+ export { CngxMatPaginator };
108
+ export type { CngxMatPaginatorAnnounceContext };