@cngx/ui 0.0.1-rc.0

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 (60) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +550 -0
  3. package/action-button/README.md +98 -0
  4. package/empty-state/README.md +103 -0
  5. package/feedback/README.md +33 -0
  6. package/fesm2022/cngx-ui-action-button.mjs +319 -0
  7. package/fesm2022/cngx-ui-action-button.mjs.map +1 -0
  8. package/fesm2022/cngx-ui-empty-state.mjs +138 -0
  9. package/fesm2022/cngx-ui-empty-state.mjs.map +1 -0
  10. package/fesm2022/cngx-ui-feedback.mjs +2962 -0
  11. package/fesm2022/cngx-ui-feedback.mjs.map +1 -0
  12. package/fesm2022/cngx-ui-layout.mjs +89 -0
  13. package/fesm2022/cngx-ui-layout.mjs.map +1 -0
  14. package/fesm2022/cngx-ui-mat-stepper.mjs +567 -0
  15. package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -0
  16. package/fesm2022/cngx-ui-mat-tabs.mjs +1405 -0
  17. package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -0
  18. package/fesm2022/cngx-ui-material.mjs +79 -0
  19. package/fesm2022/cngx-ui-material.mjs.map +1 -0
  20. package/fesm2022/cngx-ui-overlay.mjs +91 -0
  21. package/fesm2022/cngx-ui-overlay.mjs.map +1 -0
  22. package/fesm2022/cngx-ui-sidenav.mjs +521 -0
  23. package/fesm2022/cngx-ui-sidenav.mjs.map +1 -0
  24. package/fesm2022/cngx-ui-skeleton.mjs +158 -0
  25. package/fesm2022/cngx-ui-skeleton.mjs.map +1 -0
  26. package/fesm2022/cngx-ui-speak.mjs +112 -0
  27. package/fesm2022/cngx-ui-speak.mjs.map +1 -0
  28. package/fesm2022/cngx-ui-stepper.mjs +312 -0
  29. package/fesm2022/cngx-ui-stepper.mjs.map +1 -0
  30. package/fesm2022/cngx-ui-tabs.mjs +507 -0
  31. package/fesm2022/cngx-ui-tabs.mjs.map +1 -0
  32. package/fesm2022/cngx-ui.mjs +45 -0
  33. package/fesm2022/cngx-ui.mjs.map +1 -0
  34. package/layout/README.md +133 -0
  35. package/mat-stepper/README.md +34 -0
  36. package/mat-tabs/README.md +163 -0
  37. package/mat-tabs/styles/mat-tabs.css +233 -0
  38. package/material/README.md +90 -0
  39. package/overlay/README.md +99 -0
  40. package/package.json +98 -0
  41. package/sidenav/README.md +127 -0
  42. package/skeleton/README.md +98 -0
  43. package/speak/README.md +93 -0
  44. package/speak/speak-button-theme.scss +78 -0
  45. package/stepper/README.md +40 -0
  46. package/tabs/README.md +28 -0
  47. package/types/cngx-ui-action-button.d.ts +126 -0
  48. package/types/cngx-ui-empty-state.d.ts +41 -0
  49. package/types/cngx-ui-feedback.d.ts +1174 -0
  50. package/types/cngx-ui-layout.d.ts +56 -0
  51. package/types/cngx-ui-mat-stepper.d.ts +234 -0
  52. package/types/cngx-ui-mat-tabs.d.ts +664 -0
  53. package/types/cngx-ui-material.d.ts +36 -0
  54. package/types/cngx-ui-overlay.d.ts +57 -0
  55. package/types/cngx-ui-sidenav.d.ts +209 -0
  56. package/types/cngx-ui-skeleton.d.ts +97 -0
  57. package/types/cngx-ui-speak.d.ts +31 -0
  58. package/types/cngx-ui-stepper.d.ts +129 -0
  59. package/types/cngx-ui-tabs.d.ts +165 -0
  60. package/types/cngx-ui.d.ts +18 -0
@@ -0,0 +1,56 @@
1
+ import * as _angular_core from '@angular/core';
2
+
3
+ /** Main-axis direction for {@link CngxStack}. */
4
+ type StackDirection = 'row' | 'column';
5
+ /** Cross-axis alignment for {@link CngxStack}. */
6
+ type StackAlign = 'start' | 'center' | 'end' | 'stretch';
7
+ /** Spacing scale for {@link CngxStack}. Maps to `--cngx-gap-*` tokens. */
8
+ type StackGap = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
9
+ /**
10
+ * Composable flex-based stack layout component.
11
+ *
12
+ * Gap tokens use CSS custom properties (`--cngx-gap-xs` through `--cngx-gap-xl`)
13
+ * with sensible fallback defaults. Override them at any scope to match your
14
+ * application's spacing scale.
15
+ *
16
+ * <cngx-stack direction="row" gap="md" align="center">
17
+ * <div>Item 1</div>
18
+ * <div>Item 2</div>
19
+ * </cngx-stack>
20
+ */
21
+ declare class CngxStack {
22
+ /** Flex direction of the stack. */
23
+ readonly direction: _angular_core.InputSignal<StackDirection>;
24
+ /** Named spacing token between stack items. Resolves via `--cngx-gap-*` CSS custom properties. */
25
+ readonly gap: _angular_core.InputSignal<StackGap>;
26
+ /** Cross-axis alignment of stack items. */
27
+ readonly align: _angular_core.InputSignal<StackAlign>;
28
+ /** @internal */
29
+ protected readonly alignItems: _angular_core.Signal<string>;
30
+ /** @internal */
31
+ protected readonly gapValue: _angular_core.Signal<string>;
32
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxStack, never>;
33
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxStack, "cngx-stack", never, { "direction": { "alias": "direction"; "required": false; "isSignal": true; }; "gap": { "alias": "gap"; "required": false; "isSignal": true; }; "align": { "alias": "align"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
34
+ }
35
+
36
+ /**
37
+ * Composable CSS grid layout component.
38
+ *
39
+ * <cngx-grid columns="3" gap="16px">
40
+ * <div>Cell 1</div>
41
+ * <div>Cell 2</div>
42
+ * </cngx-grid>
43
+ */
44
+ declare class CngxGrid {
45
+ /** Number of equal columns, or a custom `grid-template-columns` value. */
46
+ readonly columns: _angular_core.InputSignal<string | number>;
47
+ /** CSS gap between cells. */
48
+ readonly gap: _angular_core.InputSignal<string>;
49
+ /** @internal */
50
+ protected readonly gridTemplateColumns: _angular_core.Signal<string>;
51
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxGrid, never>;
52
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxGrid, "cngx-grid", never, { "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "gap": { "alias": "gap"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
53
+ }
54
+
55
+ export { CngxGrid, CngxStack };
56
+ export type { StackAlign, StackDirection, StackGap };
@@ -0,0 +1,234 @@
1
+ import * as i1 from '@cngx/common/stepper';
2
+ import { CngxStepPanelHost, CngxStepNode, CngxStepLabelContext, CngxStepContentContext, CngxStepRegistration } from '@cngx/common/stepper';
3
+ import * as i0 from '@angular/core';
4
+ import { Signal, TemplateRef, InjectionToken } from '@angular/core';
5
+ import { MatStepper, MatStep } from '@angular/material/stepper';
6
+
7
+ /**
8
+ * Material-twin stepper organism. Wraps `<mat-stepper>` and shares
9
+ * the `CngxStepperPresenter` brain with `<cngx-stepper>` — Material
10
+ * consumers gain the commit-action lifecycle, router sync, and error
11
+ * aggregation.
12
+ *
13
+ * Bidirectional sync between presenter and `MatStepper.selectedIndex`
14
+ * runs in a single `effect()` with `untracked()` writes so neither
15
+ * direction tracks the other.
16
+ *
17
+ * Material owns keyboard nav and focus on `MatStepperHeader`, so the
18
+ * organism does NOT compose `CngxRovingTabindex` /
19
+ * `CngxFocusRestore`. Group nodes flatten — `<mat-stepper>` does not
20
+ * support nesting — with the depth preserved as a `data-step-depth`
21
+ * hint on the rendered label.
22
+ */
23
+ declare class CngxMatStepper implements CngxStepPanelHost {
24
+ protected readonly presenter: i1.CngxStepperHost;
25
+ private readonly destroyRef;
26
+ private readonly injector;
27
+ protected readonly matStepper: Signal<MatStepper>;
28
+ private readonly hostCdr;
29
+ readonly flatSteps: Signal<readonly CngxStepNode[]>;
30
+ readonly activeStepIndex: Signal<number>;
31
+ readonly activeStepId: Signal<string | null>;
32
+ private readonly stepDirectives;
33
+ /**
34
+ * Consumer-projected `<ng-template matStepperIcon>` templates,
35
+ * forwarded into `MatStepper._iconOverrides` from the
36
+ * `afterNextRender` patch below. `<ng-content>` projection cannot
37
+ * reach Material's `@ContentChildren(MatStepperIcon)` — content-init
38
+ * resolves the inner query before the wrapper's projection lands.
39
+ * `_iconOverrides` is a Material-internal slot;
40
+ * `tabs-accepted-debt §5`.
41
+ */
42
+ private readonly stepperIcons;
43
+ /**
44
+ * `Map<id, CngxStep>` so `labelTemplateFor` / `contentTemplateFor`
45
+ * are O(1). Structural `equal` on the id-set + per-id directive
46
+ * identity stops the map from cascading on shape-stable
47
+ * `contentChildren` re-emits.
48
+ */
49
+ private readonly stepDirectiveById;
50
+ /**
51
+ * Step-only flat projection — `<mat-step>` does not nest, so
52
+ * groups collapse into the same level. Memoised via
53
+ * `flatStepsEqual` so consumers (`stepLabel`, panel `@for`,
54
+ * `stepLabelContextFor`) don't re-walk on shape-stable
55
+ * `flatSteps()` re-emits. Sibling-symmetric with
56
+ * `CngxStepper.stepsOnly`.
57
+ */
58
+ protected readonly stepsOnly: Signal<readonly CngxStepNode[]>;
59
+ /** Material orientation literal — narrows our `'horizontal'|'vertical'` to its own union. */
60
+ protected readonly matOrientation: Signal<"horizontal" | "vertical">;
61
+ protected stepIndexOf(node: CngxStepNode): number;
62
+ /** Editability rule — non-linear lets every step click; linear only past completed. */
63
+ protected isEditable(node: CngxStepNode): boolean;
64
+ protected hasError(node: CngxStepNode): boolean;
65
+ protected isCompleted(node: CngxStepNode): boolean;
66
+ protected stepLabel(node: CngxStepNode): string;
67
+ /** Group nodes carry a depth marker so the label can distinguish nested rows. */
68
+ protected stepDepth(node: CngxStepNode): number;
69
+ labelTemplateFor(id: string): TemplateRef<CngxStepLabelContext> | null;
70
+ contentTemplateFor(id: string): TemplateRef<CngxStepContentContext> | null;
71
+ /**
72
+ * Per-node-id slot-context cache for `*cngxStepLabel` /
73
+ * `*cngxStepContent`. Mutating fields in place preserves the
74
+ * object reference, so `*ngTemplateOutlet`'s `Object.is` diff
75
+ * short-circuits the embedded-view rebind; the embedded view's
76
+ * `let-` bindings re-read the mutated fields on the next CD pass.
77
+ * Stale ids are pruned by the constructor effect tied to
78
+ * `presenter.flatSteps`.
79
+ */
80
+ private readonly stepLabelContextCache;
81
+ /** Build the {@link CngxStepLabelContext} for the projected label template. */
82
+ protected stepLabelContextFor(node: CngxStepNode): CngxStepLabelContext;
83
+ /** Build the {@link CngxStepContentContext} for the projected content template. */
84
+ protected stepContentContextFor(node: CngxStepNode): CngxStepContentContext;
85
+ constructor();
86
+ static ɵfac: i0.ɵɵFactoryDeclaration<CngxMatStepper, never>;
87
+ static ɵcmp: i0.ɵɵComponentDeclaration<CngxMatStepper, "cngx-mat-stepper", ["cngxMatStepper"], {}, {}, ["stepDirectives", "stepperIcons"], never, true, [{ directive: typeof i1.CngxStepperPresenter; inputs: { "activeStepIndex": "activeStepIndex"; "linear": "linear"; "orientation": "orientation"; "commitAction": "commitAction"; "commitMode": "commitMode"; }; outputs: { "activeStepIndexChange": "activeStepIndexChange"; }; }]>;
88
+ }
89
+
90
+ /**
91
+ * Attaches to an existing `<mat-stepper>` and bridges it to a
92
+ * {@link CngxStepperPresenter} — consumers gain the commit-action
93
+ * lifecycle, `CNGX_STATEFUL` (so `<cngx-toast-on />` /
94
+ * `<cngx-banner-on />` compose as children), and the step-handle
95
+ * registry from one attribute.
96
+ *
97
+ * Sibling-additive to `<cngx-mat-stepper>` (the thin-wrapper
98
+ * organism in `@cngx/ui/mat-stepper`): the wrapper authors fresh
99
+ * markup, this directive upgrades existing Material markup.
100
+ * `exportAs` differs (`cngxMatStepperDirective`) to avoid colliding
101
+ * with the wrapper's `cngxMatStepper`.
102
+ *
103
+ * Topology mirrors `[cngxMatTabs]`: Material is the host, cngx is
104
+ * the instrumentation layer. `stepper-accepted-debt §1`'s blocker
105
+ * applies to adoption, not this direction.
106
+ */
107
+ declare class CngxMatStepperBridge {
108
+ private readonly matStepper;
109
+ private readonly presenter;
110
+ private readonly destroyRef;
111
+ private readonly injector;
112
+ private readonly matSteps;
113
+ private readonly setupsByStep;
114
+ private readonly createHandle;
115
+ constructor();
116
+ private syncHandles;
117
+ static ɵfac: i0.ɵɵFactoryDeclaration<CngxMatStepperBridge, never>;
118
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CngxMatStepperBridge, "[cngxMatStepper]", ["cngxMatStepperDirective"], {}, {}, ["matSteps"], never, true, [{ directive: typeof i1.CngxStepperPresenter; inputs: { "activeStepIndex": "activeStepIndex"; "linear": "linear"; "orientation": "orientation"; "commitAction": "commitAction"; "commitMode": "commitMode"; }; outputs: { "activeStepIndexChange": "activeStepIndexChange"; }; }]>;
119
+ }
120
+
121
+ /**
122
+ * Wiring bundle returned from {@link createMatStepHandle}. The
123
+ * instrumentation directive holds the bundle in a `Map<MatStep,
124
+ * Setup>` for diff-only registry churn; only `handle` is exposed to
125
+ * the presenter.
126
+ */
127
+ interface CngxMatStepHandleSetup {
128
+ readonly handle: CngxStepRegistration;
129
+ }
130
+ /**
131
+ * Translates a Material `MatStep` into a cngx
132
+ * {@link CngxStepRegistration}.
133
+ *
134
+ * - `id` — always a fresh `idSeed()` value. Mirrors the tabs
135
+ * instrumentation handle: a label-keyed id would collide when
136
+ * two steps share a label.
137
+ * - `kind` — fixed at `'step'`. The instrumentation path does not
138
+ * project nested `<mat-step>` groups (Material's stepper has no
139
+ * group-of-steps concept; group-aware semantics belong to the
140
+ * `<cngx-stepper>` thin-wrapper organism).
141
+ * - `label` — snapshot signal resolved through a four-tier fallback at
142
+ * registration time so cngx-side phrases (announcements,
143
+ * `aria-label` composition, telemetry) never read empty when
144
+ * Material consumers project a `<ng-template matStepLabel>`:
145
+ * 1. `MatStep.label` when it is a plain string — the canonical
146
+ * shape and the only one that emits a runtime change Material
147
+ * itself observes.
148
+ * 2. `MatStep.ariaLabel` when the consumer set the input —
149
+ * designed exactly as the substitute for template labels.
150
+ * 3. Static-text read from `MatStep.stepLabel.template` via a
151
+ * throwaway detached `EmbeddedViewRef` ({@link readMatStepLabelTemplateText}).
152
+ * Captures literal `matStepLabel` markup; dynamic interpolation
153
+ * bails through to (4).
154
+ * 4. `Step <id>` — deterministic, derived from the cngx handle
155
+ * id. Always non-empty.
156
+ * Phase-2 limitation: runtime label changes do not propagate. CDK's
157
+ * `CdkStep` does not expose a `_stateChanges` Subject analogous to
158
+ * `MatTab._stateChanges`, so cngx cannot re-trigger the snapshot
159
+ * when Material flips the input later. Tracked under
160
+ * `stepper-accepted-debt §4` alongside the matStepperIcon
161
+ * forwarding limitations — both surface the same Material-internal
162
+ * coupling family typed in
163
+ * `MaterialPrivateSurfaces.CompletedOverrideSource` (see Phase 6.1).
164
+ * - `disabled` — fixed `false`. Material owns step gating via
165
+ * `linear` + `editable` + `completed`; surfacing a cngx-side
166
+ * `disabled` would duplicate Material's own click-time enforcement
167
+ * and is ignored by `<mat-stepper>` itself.
168
+ * - `state` — `computed()` over `MatStep.hasError` / `MatStep.completed`.
169
+ * `CdkStep.completed`'s getter reads `_completedOverride()` — a
170
+ * `WritableSignal<boolean | null>` typed in
171
+ * `MaterialPrivateSurfaces.CompletedOverrideSource`. The cngx
172
+ * computed transitively tracks that signal through the getter and
173
+ * re-fires whenever Material flips completion. `hasError` is a
174
+ * plain property setter on `CdkStep`, NOT a Signal — a `hasError`
175
+ * write that is not paired with a `completed` change does not
176
+ * re-trigger this computed. In practice Material wizards write the
177
+ * two together (`step.hasError = true; step.completed = false` in
178
+ * error-handler patterns and inside Material's own error-state
179
+ * matchers) so the limitation is benign for the documented usage
180
+ * pattern. Tracked under `stepper-accepted-debt §4` as the
181
+ * `_completedOverride` re-fire contract; the Re-Eval Trigger fires
182
+ * when Material exposes a public `_stateChanges`-equivalent Subject
183
+ * on `CdkStep` OR a consumer issue confirms an unpaired-`hasError`
184
+ * write reaches production.
185
+ * - `errorAggregator` — points at the shared
186
+ * {@link NO_ERROR_AGGREGATOR} constant.
187
+ */
188
+ declare function createMatStepHandle(matStep: MatStep, idSeed: () => string): CngxMatStepHandleSetup;
189
+ /**
190
+ * Factory signature for {@link createMatStepHandle}. The DI token
191
+ * {@link CNGX_MAT_STEP_HANDLE_FACTORY} resolves to a function with
192
+ * this exact shape — overrides match it identically.
193
+ */
194
+ type CngxMatStepHandleFactory = typeof createMatStepHandle;
195
+ /**
196
+ * DI token fronting the per-step handle factory used by the
197
+ * `[cngxMatStepper]` instrumentation directive. Default is
198
+ * {@link createMatStepHandle}.
199
+ *
200
+ * Symmetric with the tabs sibling
201
+ * `CNGX_MAT_TAB_HANDLE_FACTORY` and with `CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY`
202
+ * — every Material-bridge logic block ships the same swap surface so
203
+ * consumers can layer telemetry, alternate id strategies, or
204
+ * test-environment id keying via `providers` / `viewProviders`
205
+ * without forking the directive.
206
+ *
207
+ * Override capability — the swap surface separates **handle shape**
208
+ * (factory body) from **id keying** (the supplied `idSeed` closure).
209
+ * The directive constructs `idSeed` as `() => nextUid('cngx-mat-step-')`
210
+ * and hands it to the factory as a default suggestion; an override is
211
+ * free to call it, ignore it, or replace it with a server-synced /
212
+ * deterministic-test / consumer-domain id strategy. Both axes are
213
+ * independently swappable from one DI seam.
214
+ *
215
+ * Tracked-debt: ships under family-uniformity staging (single
216
+ * in-package consumer today). See `stepper-accepted-debt §7`.
217
+ *
218
+ * ```ts
219
+ * providers: [
220
+ * {
221
+ * provide: CNGX_MAT_STEP_HANDLE_FACTORY,
222
+ * useValue: ((step, idSeed) => {
223
+ * const setup = createMatStepHandle(step, idSeed);
224
+ * reportStepRegistered(setup.handle.id);
225
+ * return setup;
226
+ * }) satisfies CngxMatStepHandleFactory,
227
+ * },
228
+ * ]
229
+ * ```
230
+ */
231
+ declare const CNGX_MAT_STEP_HANDLE_FACTORY: InjectionToken<typeof createMatStepHandle>;
232
+
233
+ export { CNGX_MAT_STEP_HANDLE_FACTORY, CngxMatStepper, CngxMatStepperBridge, createMatStepHandle };
234
+ export type { CngxMatStepHandleFactory };