@cngx/common 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.
- package/LICENSE +21 -0
- package/README.md +18 -0
- package/a11y/README.md +77 -0
- package/card/README.md +79 -0
- package/chart/README.md +31 -0
- package/data/README.md +883 -0
- package/dialog/README.md +84 -0
- package/display/README.md +30 -0
- package/fesm2022/cngx-common-a11y.mjs +1260 -0
- package/fesm2022/cngx-common-a11y.mjs.map +1 -0
- package/fesm2022/cngx-common-card.mjs +765 -0
- package/fesm2022/cngx-common-card.mjs.map +1 -0
- package/fesm2022/cngx-common-chart.mjs +2943 -0
- package/fesm2022/cngx-common-chart.mjs.map +1 -0
- package/fesm2022/cngx-common-data.mjs +2886 -0
- package/fesm2022/cngx-common-data.mjs.map +1 -0
- package/fesm2022/cngx-common-dialog.mjs +1366 -0
- package/fesm2022/cngx-common-dialog.mjs.map +1 -0
- package/fesm2022/cngx-common-display.mjs +1603 -0
- package/fesm2022/cngx-common-display.mjs.map +1 -0
- package/fesm2022/cngx-common-interactive.mjs +8185 -0
- package/fesm2022/cngx-common-interactive.mjs.map +1 -0
- package/fesm2022/cngx-common-layout.mjs +1335 -0
- package/fesm2022/cngx-common-layout.mjs.map +1 -0
- package/fesm2022/cngx-common-popover.mjs +1200 -0
- package/fesm2022/cngx-common-popover.mjs.map +1 -0
- package/fesm2022/cngx-common-stepper.mjs +1350 -0
- package/fesm2022/cngx-common-stepper.mjs.map +1 -0
- package/fesm2022/cngx-common-tabs.mjs +1551 -0
- package/fesm2022/cngx-common-tabs.mjs.map +1 -0
- package/fesm2022/cngx-common.mjs +34 -0
- package/fesm2022/cngx-common.mjs.map +1 -0
- package/interactive/README.md +211 -0
- package/layout/README.md +117 -0
- package/package.json +100 -0
- package/popover/README.md +218 -0
- package/stepper/README.md +102 -0
- package/tabs/README.md +32 -0
- package/types/cngx-common-a11y.d.ts +616 -0
- package/types/cngx-common-card.d.ts +413 -0
- package/types/cngx-common-chart.d.ts +1081 -0
- package/types/cngx-common-data.d.ts +1460 -0
- package/types/cngx-common-dialog.d.ts +772 -0
- package/types/cngx-common-display.d.ts +1136 -0
- package/types/cngx-common-interactive.d.ts +5013 -0
- package/types/cngx-common-layout.d.ts +737 -0
- package/types/cngx-common-popover.d.ts +520 -0
- package/types/cngx-common-stepper.d.ts +982 -0
- package/types/cngx-common-tabs.d.ts +1237 -0
- package/types/cngx-common.d.ts +13 -0
|
@@ -0,0 +1,1136 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { TemplateRef, InjectionToken, Signal, EnvironmentProviders, Provider } from '@angular/core';
|
|
3
|
+
import * as _cngx_common_display from '@cngx/common/display';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Display atom for icons. Projects its content (font glyph, SVG, image, custom
|
|
7
|
+
* element) and adds size, colour, and ARIA semantics.
|
|
8
|
+
*
|
|
9
|
+
* Decorative by default (`aria-hidden="true"`); set `label` to make it
|
|
10
|
+
* informative (`role="img"`, `aria-label`).
|
|
11
|
+
*/
|
|
12
|
+
declare class CngxIcon {
|
|
13
|
+
/** Accessible label. When set, the icon is treated as informative content. */
|
|
14
|
+
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
15
|
+
/** Size preset. Maps to CSS custom properties on the host. */
|
|
16
|
+
readonly size: _angular_core.InputSignal<"xs" | "sm" | "md" | "lg" | "xl">;
|
|
17
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxIcon, never>;
|
|
18
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxIcon, "cngx-icon, [cngxIcon]", ["cngxIcon"], { "label": { "alias": "label"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Thin presentational separator with proper ARIA semantics.
|
|
23
|
+
*
|
|
24
|
+
* Renders `role="separator"` + `aria-orientation` — required for assistive
|
|
25
|
+
* technologies to announce the divider correctly. Visual style is driven by
|
|
26
|
+
* CSS custom properties (`--cngx-divider-color`, `--cngx-divider-thickness`,
|
|
27
|
+
* `--cngx-divider-inset`). Consumers apply their own styles through
|
|
28
|
+
* `.cngx-divider` or override the variables.
|
|
29
|
+
*/
|
|
30
|
+
declare class CngxDivider {
|
|
31
|
+
/** Layout axis. Horizontal dividers sit between rows; vertical between columns. */
|
|
32
|
+
readonly orientation: _angular_core.InputSignal<"horizontal" | "vertical">;
|
|
33
|
+
/** Whether start/end padding is applied inside the separator. */
|
|
34
|
+
readonly inset: _angular_core.InputSignal<boolean>;
|
|
35
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxDivider, never>;
|
|
36
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxDivider, "cngx-divider, [cngxDivider]", ["cngxDivider"], { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "inset": { "alias": "inset"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Display atom for user/person/entity avatars.
|
|
41
|
+
*
|
|
42
|
+
* Rendering cascade:
|
|
43
|
+
* 1. Image (`src` set and not errored).
|
|
44
|
+
* 2. Initials (`initials` set).
|
|
45
|
+
* 3. Projected content (`<ng-content>`) — typically a `<cngx-icon>`.
|
|
46
|
+
*
|
|
47
|
+
* Optional status indicator dot via `status`. Size and shape driven by
|
|
48
|
+
* CSS custom properties.
|
|
49
|
+
*/
|
|
50
|
+
declare class CngxAvatar {
|
|
51
|
+
/** Image URL. When set and loads successfully, the image is shown. */
|
|
52
|
+
readonly src: _angular_core.InputSignal<string | undefined>;
|
|
53
|
+
/** Alternate text for the image. Required when `src` is used. */
|
|
54
|
+
readonly alt: _angular_core.InputSignal<string | undefined>;
|
|
55
|
+
/** Initials fallback used when no image loads. */
|
|
56
|
+
readonly initials: _angular_core.InputSignal<string | undefined>;
|
|
57
|
+
/** Size preset driving CSS custom properties on the host. */
|
|
58
|
+
readonly size: _angular_core.InputSignal<"xs" | "sm" | "md" | "lg" | "xl">;
|
|
59
|
+
/** Visual shape. */
|
|
60
|
+
readonly shape: _angular_core.InputSignal<"circle" | "square">;
|
|
61
|
+
/** Optional user-presence status indicator. */
|
|
62
|
+
readonly status: _angular_core.InputSignal<"online" | "offline" | "busy" | "away" | undefined>;
|
|
63
|
+
private readonly imageLoadedState;
|
|
64
|
+
private readonly imageErroredState;
|
|
65
|
+
/** Whether the image loaded successfully. */
|
|
66
|
+
readonly imageLoaded: _angular_core.Signal<boolean>;
|
|
67
|
+
/** Whether the fallback path (initials or ng-content) is currently rendered. */
|
|
68
|
+
readonly showFallback: _angular_core.Signal<boolean>;
|
|
69
|
+
/** Whether the `<img>` element should be rendered. */
|
|
70
|
+
readonly showImage: _angular_core.Signal<boolean>;
|
|
71
|
+
protected handleLoad(): void;
|
|
72
|
+
protected handleError(): void;
|
|
73
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxAvatar, never>;
|
|
74
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxAvatar, "cngx-avatar", ["cngxAvatar"], { "src": { "alias": "src"; "required": false; "isSignal": true; }; "alt": { "alias": "alt"; "required": false; "isSignal": true; }; "initials": { "alias": "initials"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "shape": { "alias": "shape"; "required": false; "isSignal": true; }; "status": { "alias": "status"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Color palette options for the badge. */
|
|
78
|
+
type CngxBadgeColor = 'primary' | 'error' | 'warning' | 'neutral';
|
|
79
|
+
/** Positioning anchors relative to the host element. */
|
|
80
|
+
type CngxBadgePosition = 'inline' | 'above-start' | 'above-end' | 'below-start' | 'below-end';
|
|
81
|
+
/**
|
|
82
|
+
* Generic counter / dot indicator that attaches a small floating element to
|
|
83
|
+
* any host. Purely presentational (`aria-hidden="true"`) — semantic meaning
|
|
84
|
+
* must live on the host (`aria-label`).
|
|
85
|
+
*
|
|
86
|
+
* Supports:
|
|
87
|
+
* - Numeric values (capped by `max` with "N+" fallback)
|
|
88
|
+
* - String values (rendered verbatim)
|
|
89
|
+
* - Boolean `true` (dot mode, no text)
|
|
90
|
+
*/
|
|
91
|
+
declare class CngxBadge {
|
|
92
|
+
/** Raw value. Numbers show as text (respecting `max`); booleans flip dot mode; strings render verbatim. */
|
|
93
|
+
readonly cngxBadge: _angular_core.InputSignal<string | number | boolean>;
|
|
94
|
+
/** Color variant. */
|
|
95
|
+
readonly color: _angular_core.InputSignal<CngxBadgeColor>;
|
|
96
|
+
/** Anchor position relative to the host. */
|
|
97
|
+
readonly position: _angular_core.InputSignal<CngxBadgePosition>;
|
|
98
|
+
/** Whether the indicator is hidden regardless of value. */
|
|
99
|
+
readonly hidden: _angular_core.InputSignal<boolean>;
|
|
100
|
+
/** Cap for numeric values — anything over renders as `"{max}+"`. */
|
|
101
|
+
readonly max: _angular_core.InputSignal<number>;
|
|
102
|
+
private readonly hostEl;
|
|
103
|
+
private readonly renderer;
|
|
104
|
+
private badgeEl;
|
|
105
|
+
/** Whether the badge shows as a solid dot (no text). */
|
|
106
|
+
readonly isDotMode: _angular_core.Signal<boolean>;
|
|
107
|
+
/** Whether the badge is empty (no value, 0, empty string, or false). */
|
|
108
|
+
readonly isEmpty: _angular_core.Signal<boolean>;
|
|
109
|
+
/** Displayed text, or `null` when in dot mode or empty. */
|
|
110
|
+
readonly displayValue: _angular_core.Signal<string | null>;
|
|
111
|
+
constructor();
|
|
112
|
+
private ensureBadge;
|
|
113
|
+
private applyClasses;
|
|
114
|
+
private applyContent;
|
|
115
|
+
private removeBadge;
|
|
116
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxBadge, never>;
|
|
117
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxBadge, "[cngxBadge]", ["cngxBadge"], { "cngxBadge": { "alias": "cngxBadge"; "required": true; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "hidden": { "alias": "hidden"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Chip / tag molecule — a small, self-contained pill rendering projected
|
|
122
|
+
* content plus an optional close affordance.
|
|
123
|
+
*
|
|
124
|
+
* **Why this exists.**
|
|
125
|
+
* Multi-value triggers (`CngxMultiSelect` today; `CngxMultiCombobox`,
|
|
126
|
+
* `CngxTagInput`, toolbar filter-chips tomorrow) all want the same pill
|
|
127
|
+
* surface and the same remove interaction. Inlining `<span>`/`<button>`
|
|
128
|
+
* pairs per consumer (a) duplicates ARIA wiring and (b) defeats
|
|
129
|
+
* atomic-decompose: ejecting a parent component drags a block of raw
|
|
130
|
+
* markup into the consumer's source instead of a clean molecule.
|
|
131
|
+
*
|
|
132
|
+
* **Responsibilities (intentionally narrow).**
|
|
133
|
+
* - Render projected `<ng-content>` as the chip label.
|
|
134
|
+
* - Render a close button when `removable()` is true, emit `(remove)`
|
|
135
|
+
* on click.
|
|
136
|
+
* - Provide a stable DOM id for ARIA wiring (auto-generated or
|
|
137
|
+
* consumer-supplied).
|
|
138
|
+
*
|
|
139
|
+
* **Non-responsibilities.**
|
|
140
|
+
* - Selection state — parent tracks which value(s) are picked.
|
|
141
|
+
* - Commit/async behaviour — remove simply fires an event; the parent
|
|
142
|
+
* decides whether to write state directly or route through a commit
|
|
143
|
+
* flow. This keeps the chip usable from any level of the stack.
|
|
144
|
+
*/
|
|
145
|
+
declare class CngxChip {
|
|
146
|
+
/**
|
|
147
|
+
* Whether the close button is rendered. Typed as `boolean` — bind a
|
|
148
|
+
* signal getter (`[removable]="!select.disabled()"`) if the flag
|
|
149
|
+
* needs to react to upstream state.
|
|
150
|
+
*/
|
|
151
|
+
readonly removable: _angular_core.InputSignal<boolean>;
|
|
152
|
+
/**
|
|
153
|
+
* Optional DOM id. When unset, a stable auto-id (`cngx-chip-N`) is
|
|
154
|
+
* applied so `aria-describedby` / `aria-labelledby` hooks from the
|
|
155
|
+
* parent can reference the chip.
|
|
156
|
+
*/
|
|
157
|
+
readonly id: _angular_core.InputSignal<string | null>;
|
|
158
|
+
/**
|
|
159
|
+
* A11y label for the close button. Defaults to a generic "Remove";
|
|
160
|
+
* consumers with option labels on hand should supply something more
|
|
161
|
+
* specific (e.g. `"Remove Red"`) so screen readers know which chip
|
|
162
|
+
* the button removes.
|
|
163
|
+
*/
|
|
164
|
+
readonly removeAriaLabel: _angular_core.InputSignal<string>;
|
|
165
|
+
/** Fires when the user clicks the close button. */
|
|
166
|
+
readonly remove: _angular_core.OutputEmitterRef<MouseEvent>;
|
|
167
|
+
private readonly autoId;
|
|
168
|
+
/** @internal — resolved DOM id for host binding. */
|
|
169
|
+
protected readonly resolvedId: _angular_core.Signal<string>;
|
|
170
|
+
/** @internal — delegates to the output; kept as a method so the click handler stays in the template. */
|
|
171
|
+
protected handleRemoveClick(event: MouseEvent): void;
|
|
172
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxChip, never>;
|
|
173
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxChip, "cngx-chip", ["cngxChip"], { "removable": { "alias": "removable"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "removeAriaLabel": { "alias": "removeAriaLabel"; "required": false; "isSignal": true; }; }, { "remove": "remove"; }, never, ["*", "[cngxChipClose]"], true, never>;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Presentational checkbox / checkmark indicator.
|
|
178
|
+
*
|
|
179
|
+
* **Why this exists.**
|
|
180
|
+
* Across the library, "is this row selected?" shows up as a bare
|
|
181
|
+
* `<span class="cngx-select__check">✓</span>` in the forms/select panel,
|
|
182
|
+
* a future grid/tree cell will want a checkbox with indeterminate state, and
|
|
183
|
+
* `ng decompose cngx-*` schematics should emit a consistent indicator shape
|
|
184
|
+
* regardless of which list-like component they originated from. This atom
|
|
185
|
+
* unifies all three surfaces behind a single presentational molecule —
|
|
186
|
+
* purely decorative (`aria-hidden="true"`), zero outputs, two variants,
|
|
187
|
+
* full `--cngx-checkbox-*` theming.
|
|
188
|
+
*
|
|
189
|
+
* **Responsibilities (intentionally narrow).**
|
|
190
|
+
* - Render a boxed checkbox or a bare checkmark glyph (`variant`).
|
|
191
|
+
* - Express checked / indeterminate / disabled visual state via host classes
|
|
192
|
+
* the consumer (or upstream CSS) can theme.
|
|
193
|
+
* - Apply size presets (`sm` / `md` / `lg`) as CSS-custom-property modifiers.
|
|
194
|
+
*
|
|
195
|
+
* **Non-responsibilities.**
|
|
196
|
+
* - Selection state — controlled entirely by the parent via `checked` /
|
|
197
|
+
* `indeterminate` inputs.
|
|
198
|
+
* - Interaction — no `click` output, no keyboard handling. The parent (option
|
|
199
|
+
* row, tree cell, grid row) owns the hit area and toggle semantics.
|
|
200
|
+
* - Accessibility announcements — `aria-hidden="true"` unconditionally. The
|
|
201
|
+
* truth about "selected" is communicated by the row's own `aria-selected`
|
|
202
|
+
* / `role="option"` ARIA, not by this decoration.
|
|
203
|
+
*/
|
|
204
|
+
declare class CngxCheckboxIndicator {
|
|
205
|
+
/**
|
|
206
|
+
* Visual form. `'checkbox'` renders a bordered box containing the glyph;
|
|
207
|
+
* `'checkmark'` renders the bare glyph only (no box). Consumers pick the
|
|
208
|
+
* mode-appropriate form themselves — `@cngx/forms/select` resolves it
|
|
209
|
+
* from its `selectionIndicatorVariant` config.
|
|
210
|
+
*/
|
|
211
|
+
readonly variant: _angular_core.InputSignal<"checkbox" | "checkmark">;
|
|
212
|
+
/** Whether the current value is selected. */
|
|
213
|
+
readonly checked: _angular_core.InputSignal<boolean>;
|
|
214
|
+
/**
|
|
215
|
+
* Partial-selection state. Takes precedence over `checked` — when both
|
|
216
|
+
* are true, the dash glyph is rendered. Intended for tree / group rows
|
|
217
|
+
* where some-but-not-all descendants are selected.
|
|
218
|
+
*/
|
|
219
|
+
readonly indeterminate: _angular_core.InputSignal<boolean>;
|
|
220
|
+
/**
|
|
221
|
+
* Disabled visual state. Purely cosmetic (opacity dim) — the indicator
|
|
222
|
+
* never intercepts events, so this is a hint, not a block.
|
|
223
|
+
*/
|
|
224
|
+
readonly disabled: _angular_core.InputSignal<boolean>;
|
|
225
|
+
/** Size preset. Maps to a `--cngx-checkbox-size` custom property. */
|
|
226
|
+
readonly size: _angular_core.InputSignal<"sm" | "md" | "lg">;
|
|
227
|
+
/**
|
|
228
|
+
* Consumer-supplied template for the check glyph. When `null` (default),
|
|
229
|
+
* the built-in `<span class="cngx-checkbox-indicator__check">✓</span>`
|
|
230
|
+
* is rendered. When set, the consumer template replaces the glyph span
|
|
231
|
+
* entirely — the `__check` class is NOT applied to the custom content
|
|
232
|
+
* (consumers own the styling of their replacement).
|
|
233
|
+
*
|
|
234
|
+
* Convention-compatible with `*cngxSelectCheck` / `*cngxSelectOptionLabel`:
|
|
235
|
+
* pass a `TemplateRef<void>` obtained via `#myGlyphTpl`. Useful for
|
|
236
|
+
* `CngxTreeCheckboxHeader` or other consumers that need a custom glyph
|
|
237
|
+
* without forking the atom.
|
|
238
|
+
*/
|
|
239
|
+
readonly checkGlyph: _angular_core.InputSignal<TemplateRef<void> | null>;
|
|
240
|
+
/**
|
|
241
|
+
* Consumer-supplied template for the indeterminate dash glyph. Mirrors
|
|
242
|
+
* {@link checkGlyph} — defaults to the built-in
|
|
243
|
+
* `<span class="cngx-checkbox-indicator__dash">−</span>`.
|
|
244
|
+
*/
|
|
245
|
+
readonly dashGlyph: _angular_core.InputSignal<TemplateRef<void> | null>;
|
|
246
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxCheckboxIndicator, never>;
|
|
247
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxCheckboxIndicator, "cngx-checkbox-indicator", ["cngxCheckboxIndicator"], { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "indeterminate": { "alias": "indeterminate"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "checkGlyph": { "alias": "checkGlyph"; "required": false; "isSignal": true; }; "dashGlyph": { "alias": "dashGlyph"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Presentational radio indicator — circle with a centred dot when checked.
|
|
252
|
+
*
|
|
253
|
+
* **Why this exists.**
|
|
254
|
+
* The library's `@cngx/forms/select` panel currently composes
|
|
255
|
+
* {@link import('../checkbox-indicator/checkbox-indicator.component').CngxCheckboxIndicator}
|
|
256
|
+
* for both single-select (`'checkmark'`) and multi-select (`'checkbox'`)
|
|
257
|
+
* indicators. The form-primitives spec (Brain vs. Skin) introduces a
|
|
258
|
+
* radio variant — `selectionIndicatorVariant: 'radio'` for single-select
|
|
259
|
+
* panels — that needs the dot-in-circle visual independently of the
|
|
260
|
+
* box/checkmark shapes. This atom is the radio counterpart: same
|
|
261
|
+
* decorative-only contract, same `--cngx-*` theming surface, same
|
|
262
|
+
* `aria-hidden="true"` discipline. Future single-value form atoms in
|
|
263
|
+
* `@cngx/common/interactive` will compose this same skin once they
|
|
264
|
+
* land in their own phase.
|
|
265
|
+
*
|
|
266
|
+
* **Responsibilities (intentionally narrow).**
|
|
267
|
+
* - Render a circle frame and, when `checked` is true, a centred dot.
|
|
268
|
+
* - Express checked / disabled visual state via host classes the
|
|
269
|
+
* consumer (or upstream CSS) can theme.
|
|
270
|
+
* - Apply size presets (`sm` / `md` / `lg`) as CSS-custom-property
|
|
271
|
+
* modifiers — same scale token as `CngxCheckboxIndicator` so the
|
|
272
|
+
* two atoms render at matching sizes inside a select panel.
|
|
273
|
+
*
|
|
274
|
+
* **Non-responsibilities.**
|
|
275
|
+
* - Selection state — controlled by the parent via `checked`.
|
|
276
|
+
* - No `indeterminate` — radios are exclusive by definition; the
|
|
277
|
+
* group enforces single-selection at the brain layer.
|
|
278
|
+
* - Interaction — no `click` output, no keyboard handling. The radio
|
|
279
|
+
* row (or the consuming select panel) owns the hit area.
|
|
280
|
+
* - Accessibility announcements — `aria-hidden="true"` unconditionally.
|
|
281
|
+
* Selection is announced via the row's `role="radio"` /
|
|
282
|
+
* `aria-checked` ARIA, never by this decoration.
|
|
283
|
+
*/
|
|
284
|
+
declare class CngxRadioIndicator {
|
|
285
|
+
/** Whether the current value is selected. */
|
|
286
|
+
readonly checked: _angular_core.InputSignal<boolean>;
|
|
287
|
+
/**
|
|
288
|
+
* Disabled visual state. Purely cosmetic (opacity dim) — the indicator
|
|
289
|
+
* never intercepts events, so this is a hint, not a block.
|
|
290
|
+
*/
|
|
291
|
+
readonly disabled: _angular_core.InputSignal<boolean>;
|
|
292
|
+
/** Size preset. Maps to a `--cngx-radio-indicator-size` custom property. */
|
|
293
|
+
readonly size: _angular_core.InputSignal<"sm" | "md" | "lg">;
|
|
294
|
+
/**
|
|
295
|
+
* Consumer-supplied template for the centred dot. When `null` (default),
|
|
296
|
+
* the built-in `<span class="cngx-radio-indicator__dot"></span>` is
|
|
297
|
+
* rendered. When set, the consumer template replaces the dot span
|
|
298
|
+
* entirely — the `__dot` class is NOT applied to the custom content
|
|
299
|
+
* (consumers own the styling of their replacement).
|
|
300
|
+
*
|
|
301
|
+
* Convention-compatible with `CngxCheckboxIndicator.checkGlyph`: pass a
|
|
302
|
+
* `TemplateRef<void>` obtained via `#myDotTpl`. Useful for
|
|
303
|
+
* design-system overrides that want a brand-glyph dot without
|
|
304
|
+
* forking the atom.
|
|
305
|
+
*/
|
|
306
|
+
readonly dotGlyph: _angular_core.InputSignal<TemplateRef<void> | null>;
|
|
307
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxRadioIndicator, never>;
|
|
308
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxRadioIndicator, "cngx-radio-indicator", ["cngxRadioIndicator"], { "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "dotGlyph": { "alias": "dotGlyph"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Context exposed by the `*cngxTagLabel` slot — the full reactive
|
|
313
|
+
* Tag state bundled so consumer templates can switch on variant /
|
|
314
|
+
* colour / size / truncate without injecting the directive.
|
|
315
|
+
*
|
|
316
|
+
* `$implicit` is `void` because the slot has no positional payload —
|
|
317
|
+
* consumers reach for the named fields below. Pattern mirrors
|
|
318
|
+
* `CngxSelectInputSlotContext` in `@cngx/forms/select/shared`.
|
|
319
|
+
*/
|
|
320
|
+
interface CngxTagLabelContext {
|
|
321
|
+
readonly $implicit: void;
|
|
322
|
+
readonly variant: CngxTagVariant;
|
|
323
|
+
readonly color: CngxTagColor;
|
|
324
|
+
readonly size: CngxTagSize;
|
|
325
|
+
readonly truncate: boolean;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Context exposed by the `*cngxTagPrefix` slot. Structurally
|
|
329
|
+
* identical to {@link CngxTagLabelContext}; kept as a separate
|
|
330
|
+
* interface so future per-slot fields (e.g. spacing tokens) can
|
|
331
|
+
* land without breaking label-slot consumers.
|
|
332
|
+
*/
|
|
333
|
+
interface CngxTagPrefixContext {
|
|
334
|
+
readonly $implicit: void;
|
|
335
|
+
readonly variant: CngxTagVariant;
|
|
336
|
+
readonly color: CngxTagColor;
|
|
337
|
+
readonly size: CngxTagSize;
|
|
338
|
+
readonly truncate: boolean;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Context exposed by the `*cngxTagSuffix` slot. Structurally
|
|
342
|
+
* identical to {@link CngxTagLabelContext}; kept as a separate
|
|
343
|
+
* interface so future per-slot fields can land without breaking
|
|
344
|
+
* label-slot consumers.
|
|
345
|
+
*/
|
|
346
|
+
interface CngxTagSuffixContext {
|
|
347
|
+
readonly $implicit: void;
|
|
348
|
+
readonly variant: CngxTagVariant;
|
|
349
|
+
readonly color: CngxTagColor;
|
|
350
|
+
readonly size: CngxTagSize;
|
|
351
|
+
readonly truncate: boolean;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Override template for the label region of `<span cngxTag>`.
|
|
356
|
+
*
|
|
357
|
+
* The default label slot wraps projected content in
|
|
358
|
+
* `<span class="cngx-tag__label">` so `text-overflow: ellipsis`
|
|
359
|
+
* has a shrinkable inner with `min-width: 0`. Replace this slot
|
|
360
|
+
* when you need a different inner element (e.g. `<bdi>` for
|
|
361
|
+
* bidi-safe rendering, an inline link, or a richer label
|
|
362
|
+
* composition with icons + counts).
|
|
363
|
+
*
|
|
364
|
+
* Replacing the label drops the default ellipsis hook — the
|
|
365
|
+
* consumer template owns the overflow strategy.
|
|
366
|
+
*
|
|
367
|
+
* ```html
|
|
368
|
+
* <span cngxTag [color]="'success'">
|
|
369
|
+
* <ng-template cngxTagLabel>
|
|
370
|
+
* <bdi>{{ user.name }}</bdi>
|
|
371
|
+
* </ng-template>
|
|
372
|
+
* </span>
|
|
373
|
+
* ```
|
|
374
|
+
*/
|
|
375
|
+
declare class CngxTagLabel {
|
|
376
|
+
readonly templateRef: TemplateRef<CngxTagLabelContext>;
|
|
377
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxTagLabel, never>;
|
|
378
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxTagLabel, "ng-template[cngxTagLabel]", ["cngxTagLabel"], {}, {}, never, never, true, never>;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Override template for content rendered BEFORE the label region of
|
|
383
|
+
* `<span cngxTag>`. Use for icon glyphs, status dots, count badges,
|
|
384
|
+
* or any per-tag prefix decoration.
|
|
385
|
+
*
|
|
386
|
+
* The slot has no default body — when not projected, no DOM is
|
|
387
|
+
* rendered in the prefix position.
|
|
388
|
+
*
|
|
389
|
+
* ```html
|
|
390
|
+
* <span cngxTag [color]="'warning'">
|
|
391
|
+
* <ng-template cngxTagPrefix>
|
|
392
|
+
* <cngx-icon name="alert-triangle" />
|
|
393
|
+
* </ng-template>
|
|
394
|
+
* Action required
|
|
395
|
+
* </span>
|
|
396
|
+
* ```
|
|
397
|
+
*/
|
|
398
|
+
declare class CngxTagPrefix {
|
|
399
|
+
readonly templateRef: TemplateRef<CngxTagPrefixContext>;
|
|
400
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxTagPrefix, never>;
|
|
401
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxTagPrefix, "ng-template[cngxTagPrefix]", ["cngxTagPrefix"], {}, {}, never, never, true, never>;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Override template for content rendered AFTER the label region of
|
|
406
|
+
* `<span cngxTag>`. Use for trailing chevrons, sort indicators, or
|
|
407
|
+
* any per-tag suffix decoration.
|
|
408
|
+
*
|
|
409
|
+
* The slot has no default body — when not projected, no DOM is
|
|
410
|
+
* rendered in the suffix position. Removable affordances belong on
|
|
411
|
+
* `CngxChip` (which ships its own remove button + announcer
|
|
412
|
+
* wiring), not as a Tag suffix slot.
|
|
413
|
+
*
|
|
414
|
+
* ```html
|
|
415
|
+
* <span cngxTag [color]="'info'">
|
|
416
|
+
* Filter
|
|
417
|
+
* <ng-template cngxTagSuffix>
|
|
418
|
+
* <cngx-icon name="chevron-down" />
|
|
419
|
+
* </ng-template>
|
|
420
|
+
* </span>
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
declare class CngxTagSuffix {
|
|
424
|
+
readonly templateRef: TemplateRef<CngxTagSuffixContext>;
|
|
425
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxTagSuffix, never>;
|
|
426
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxTagSuffix, "ng-template[cngxTagSuffix]", ["cngxTagSuffix"], {}, {}, never, never, true, never>;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/** Visual variant. `filled` is the default solid pill; `outline` swaps fill for border; `subtle` softens both. */
|
|
430
|
+
type CngxTagVariant = 'filled' | 'outline' | 'subtle';
|
|
431
|
+
/**
|
|
432
|
+
* Semantic colour key. The five named values cascade through the
|
|
433
|
+
* matching `--cngx-tag-{name}-bg/-color/-border` custom properties
|
|
434
|
+
* with English-readable fallback hex values (see `tag.css`).
|
|
435
|
+
*
|
|
436
|
+
* Open-ended `(string & {})` accepts any consumer-defined palette
|
|
437
|
+
* key (e.g. `'my-brand'`); the directive emits it as a `data-color`
|
|
438
|
+
* attribute so consumers can author `[data-color="my-brand"]`
|
|
439
|
+
* styles against their own design tokens. Re-evaluation trigger
|
|
440
|
+
* toward a `withTagColors()` cascade is tracked in
|
|
441
|
+
* `display-accepted-debt.md §1`.
|
|
442
|
+
*/
|
|
443
|
+
type CngxTagColor = 'neutral' | 'success' | 'warning' | 'error' | 'info' | (string & {});
|
|
444
|
+
/**
|
|
445
|
+
* Density. `md` is the default. Each step scales padding + font-size
|
|
446
|
+
* via the `--cngx-tag-{sm|lg|xl}-padding` and matching font-size
|
|
447
|
+
* custom properties (see `tag.css`). Sizing of nested atoms
|
|
448
|
+
* (`cngx-icon`, `cngx-avatar`) is the consumer's call — Tag does not
|
|
449
|
+
* cascade a sub-token contract.
|
|
450
|
+
*/
|
|
451
|
+
type CngxTagSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
452
|
+
/**
|
|
453
|
+
* Decorative tag / label / badge atom.
|
|
454
|
+
*
|
|
455
|
+
* **Why this exists.**
|
|
456
|
+
* `CngxChip` (`@cngx/common/display`) covers the *removable pill*
|
|
457
|
+
* surface inside chip strips. `CngxTag` covers the long tail of
|
|
458
|
+
* static labels: status indicators on a list row, taxonomy badges
|
|
459
|
+
* on a card, role markers in an admin table, pre-filter chips in a
|
|
460
|
+
* dashboard sidebar. Two narrow atoms with non-overlapping
|
|
461
|
+
* concerns beat one chip-tag hybrid with mode flags
|
|
462
|
+
* (Pillar 3 — Komposition statt Konfiguration).
|
|
463
|
+
*
|
|
464
|
+
* **Responsibilities (intentionally narrow).**
|
|
465
|
+
* - Apply variant / color / size / truncate / maxWidth host
|
|
466
|
+
* classes + style bindings to any host element (`<span>`,
|
|
467
|
+
* `<a>`, `<button>`, `<div>`).
|
|
468
|
+
* - When projected inside a `<cngx-tag-group [semanticList]="true">`,
|
|
469
|
+
* reactively expose `role="listitem"` so the parent's
|
|
470
|
+
* `role="list"` semantics propagate without consumer wiring.
|
|
471
|
+
* The cascade reads `CNGX_TAG_GROUP.semanticList()` through a
|
|
472
|
+
* single `computed<'listitem' | null>()` (Pillar 1 —
|
|
473
|
+
* derivation; Pillar 2 — ARIA in the reactive graph).
|
|
474
|
+
*
|
|
475
|
+
* **Non-responsibilities.**
|
|
476
|
+
* - Removable affordance — use `CngxChip` instead.
|
|
477
|
+
* - Clickable / interactive semantics — wrap with native
|
|
478
|
+
* `<button cngxTag>` or `<a cngxTag>` for keyboard +
|
|
479
|
+
* focus + Enter/Space.
|
|
480
|
+
* - Configuration cascade — deferred (see
|
|
481
|
+
* `display-accepted-debt.md §1`).
|
|
482
|
+
*/
|
|
483
|
+
declare class CngxTag {
|
|
484
|
+
/**
|
|
485
|
+
* Snapshot of the resolved tag-family config at construction
|
|
486
|
+
* time. Drives the per-input fallback defaults below — Angular's
|
|
487
|
+
* input-default rule means per-instance `[variant]="..."`
|
|
488
|
+
* bindings still win.
|
|
489
|
+
*
|
|
490
|
+
* **Field-init ordering is load-bearing.** TypeScript class-field
|
|
491
|
+
* initialisers run in source order; `cfg` MUST be declared before
|
|
492
|
+
* any input field that reads `this.cfg`. A reorder pass that
|
|
493
|
+
* moved this declaration below the inputs would silently produce
|
|
494
|
+
* `undefined` at the input's init call site (runtime crash on
|
|
495
|
+
* first construction). Per the
|
|
496
|
+
* `tag-family-architectural-a-plus-pass` plan Architectural-
|
|
497
|
+
* Decisions table — flagged in cngx-plan-review 2026-04-29.
|
|
498
|
+
*/
|
|
499
|
+
private readonly cfg;
|
|
500
|
+
/** Visual variant. `filled` (default) | `outline` | `subtle`. */
|
|
501
|
+
readonly variant: _angular_core.InputSignal<CngxTagVariant>;
|
|
502
|
+
/**
|
|
503
|
+
* Semantic colour. Predefined keys (`neutral` default, `success`,
|
|
504
|
+
* `warning`, `error`, `info`) plus any consumer-defined string
|
|
505
|
+
* which is emitted verbatim as a `data-color` attribute.
|
|
506
|
+
*/
|
|
507
|
+
readonly color: _angular_core.InputSignal<CngxTagColor>;
|
|
508
|
+
/** Density. `md` (default) | `sm` | `lg` | `xl`. */
|
|
509
|
+
readonly size: _angular_core.InputSignal<CngxTagSize>;
|
|
510
|
+
/**
|
|
511
|
+
* When `true`, applies `text-overflow: ellipsis` + `white-space: nowrap`
|
|
512
|
+
* to the inner `.cngx-tag__label` span. Pair with `[maxWidth]` for a
|
|
513
|
+
* hard upper bound. Visual-only — the full text remains in the DOM
|
|
514
|
+
* for AT.
|
|
515
|
+
*
|
|
516
|
+
* Deliberately CSS-only — `CngxTruncate` (`@cngx/common/layout`) is the
|
|
517
|
+
* right tool for multi-line clamp + expand/collapse state on long-form
|
|
518
|
+
* text, but its reactive machinery (effect + ResizeObserver + isClamped
|
|
519
|
+
* signal) is overkill for a chip-style single-line overflow.
|
|
520
|
+
*/
|
|
521
|
+
readonly truncate: _angular_core.InputSignal<boolean>;
|
|
522
|
+
/**
|
|
523
|
+
* Optional CSS `max-width` (e.g. `'12rem'`, `'200px'`). Bound
|
|
524
|
+
* inline so consumers don't need a CSS authoring step for ad-hoc
|
|
525
|
+
* width caps. `null` clears the binding.
|
|
526
|
+
*/
|
|
527
|
+
readonly maxWidth: _angular_core.InputSignal<string | null>;
|
|
528
|
+
/**
|
|
529
|
+
* Optional parent group (Phase 3 ships `CngxTagGroup` as the
|
|
530
|
+
* default implementer). When present and `semanticList()` is
|
|
531
|
+
* `true`, the host carries `role="listitem"` so the parent's
|
|
532
|
+
* `role="list"` propagates. When absent, no synthetic role is
|
|
533
|
+
* set — `<a cngxTag>` keeps its native `role="link"`,
|
|
534
|
+
* `<button cngxTag>` keeps its `role="button"`, etc.
|
|
535
|
+
*/
|
|
536
|
+
private readonly group;
|
|
537
|
+
/**
|
|
538
|
+
* Per-instance label-slot directive — projected as
|
|
539
|
+
* `<ng-template cngxTagLabel>...</ng-template>`. Resolved through
|
|
540
|
+
* {@link injectResolvedTagTemplate} so consumers can override the
|
|
541
|
+
* default `<span class="cngx-tag__label">` wrapper without forking
|
|
542
|
+
* the directive.
|
|
543
|
+
*/
|
|
544
|
+
protected readonly labelSlot: _angular_core.Signal<CngxTagLabel | undefined>;
|
|
545
|
+
/** Per-instance prefix-slot directive — projected before the label. */
|
|
546
|
+
protected readonly prefixSlot: _angular_core.Signal<CngxTagPrefix | undefined>;
|
|
547
|
+
/** Per-instance suffix-slot directive — projected after the label. */
|
|
548
|
+
protected readonly suffixSlot: _angular_core.Signal<CngxTagSuffix | undefined>;
|
|
549
|
+
/**
|
|
550
|
+
* Resolved label template. Phase 1 cascade: instance slot → host
|
|
551
|
+
* `@else` default (`<span class="cngx-tag__label"><ng-content /></span>`).
|
|
552
|
+
* Phase 4 commit 5 inserts `CNGX_TAG_CONFIG.templates.label` as a
|
|
553
|
+
* middle tier without touching this call site.
|
|
554
|
+
*/
|
|
555
|
+
protected readonly labelTpl: _angular_core.Signal<_angular_core.TemplateRef<CngxTagLabelContext> | null>;
|
|
556
|
+
/** Resolved prefix template. Same 2-stage cascade as {@link labelTpl}. */
|
|
557
|
+
protected readonly prefixTpl: _angular_core.Signal<_angular_core.TemplateRef<_cngx_common_display.CngxTagPrefixContext> | null>;
|
|
558
|
+
/** Resolved suffix template. Same 2-stage cascade as {@link labelTpl}. */
|
|
559
|
+
protected readonly suffixTpl: _angular_core.Signal<_angular_core.TemplateRef<_cngx_common_display.CngxTagSuffixContext> | null>;
|
|
560
|
+
/**
|
|
561
|
+
* Reactive bundle exposed to every slot's `*ngTemplateOutletContext`.
|
|
562
|
+
* The three slot context interfaces are structurally identical in
|
|
563
|
+
* Phase 1; the same computed source serves all three. Consumer
|
|
564
|
+
* templates `let-variant="variant"` etc. read the live state without
|
|
565
|
+
* injecting the directive.
|
|
566
|
+
*
|
|
567
|
+
* Explicit structural `equal` fn — without it, a fresh literal each
|
|
568
|
+
* CD cycle would force `ngTemplateOutlet` to rebind embedded views
|
|
569
|
+
* even when no input changed. Per `reference_signal_architecture` §1
|
|
570
|
+
* Equality Rule: every `computed` returning an object MUST pass an
|
|
571
|
+
* `equal` fn.
|
|
572
|
+
*/
|
|
573
|
+
protected readonly slotContext: _angular_core.Signal<CngxTagLabelContext>;
|
|
574
|
+
/**
|
|
575
|
+
* Reactive `role` attribute. Returns `'listitem'` when projected
|
|
576
|
+
* inside a `<cngx-tag-group [semanticList]="true">`; `null`
|
|
577
|
+
* otherwise. No explicit `equal` fn passed — primitive string
|
|
578
|
+
* output, default `Object.is` is correct (per
|
|
579
|
+
* `reference_signal_architecture` §1: equality discipline applies
|
|
580
|
+
* to object/array results, not primitives).
|
|
581
|
+
*
|
|
582
|
+
* @internal
|
|
583
|
+
*/
|
|
584
|
+
protected readonly roleAttr: _angular_core.Signal<"listitem" | null>;
|
|
585
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxTag, never>;
|
|
586
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxTag, "[cngxTag], cngx-tag", ["cngxTag"], { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "truncate": { "alias": "truncate"; "required": false; "isSignal": true; }; "maxWidth": { "alias": "maxWidth"; "required": false; "isSignal": true; }; }, {}, ["labelSlot", "prefixSlot", "suffixSlot"], ["*"], true, never>;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Context exposed by the `*cngxTagGroupHeader` slot — the full
|
|
591
|
+
* reactive group state plus the live `count` of projected
|
|
592
|
+
* `CngxTag` children. Lets consumer headers render
|
|
593
|
+
* `"Filters ({{ count }})"` without injecting the group.
|
|
594
|
+
*
|
|
595
|
+
* `$implicit` is `void` because the slot has no positional payload —
|
|
596
|
+
* consumers reach for the named fields below.
|
|
597
|
+
*/
|
|
598
|
+
interface CngxTagGroupHeaderContext {
|
|
599
|
+
readonly $implicit: void;
|
|
600
|
+
readonly gap: CngxTagGroupGap;
|
|
601
|
+
readonly align: CngxTagGroupAlign;
|
|
602
|
+
readonly semanticList: boolean;
|
|
603
|
+
readonly label: string | undefined;
|
|
604
|
+
readonly count: number;
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Context exposed by the `*cngxTagGroupAccessory` slot. Structurally
|
|
608
|
+
* identical to {@link CngxTagGroupHeaderContext}; kept separate so
|
|
609
|
+
* future per-slot fields can land without breaking header-slot
|
|
610
|
+
* consumers.
|
|
611
|
+
*/
|
|
612
|
+
interface CngxTagGroupAccessoryContext {
|
|
613
|
+
readonly $implicit: void;
|
|
614
|
+
readonly gap: CngxTagGroupGap;
|
|
615
|
+
readonly align: CngxTagGroupAlign;
|
|
616
|
+
readonly semanticList: boolean;
|
|
617
|
+
readonly label: string | undefined;
|
|
618
|
+
readonly count: number;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Override template for the accessory zone of `<cngx-tag-group>` —
|
|
623
|
+
* projected BELOW the row of tags. Use for clear-all buttons,
|
|
624
|
+
* sort toggles that span the group, secondary actions, or any
|
|
625
|
+
* trailing decoration the consumer wants to bundle with the
|
|
626
|
+
* layout.
|
|
627
|
+
*
|
|
628
|
+
* The slot has no default body — when not projected, no DOM is
|
|
629
|
+
* rendered below the tag row. The reactive count of projected
|
|
630
|
+
* `<span cngxTag>` siblings is exposed via the slot context so
|
|
631
|
+
* consumer "Clear all (5)" patterns work without injection.
|
|
632
|
+
*
|
|
633
|
+
* ```html
|
|
634
|
+
* <cngx-tag-group [semanticList]="true" label="Active filters">
|
|
635
|
+
* <span cngxTag>Frontend</span>
|
|
636
|
+
* <span cngxTag>Backend</span>
|
|
637
|
+
* <ng-template cngxTagGroupAccessory let-count="count">
|
|
638
|
+
* <button (click)="clearAll()">Clear all ({{ count }})</button>
|
|
639
|
+
* </ng-template>
|
|
640
|
+
* </cngx-tag-group>
|
|
641
|
+
* ```
|
|
642
|
+
*/
|
|
643
|
+
declare class CngxTagGroupAccessory {
|
|
644
|
+
readonly templateRef: TemplateRef<CngxTagGroupAccessoryContext>;
|
|
645
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxTagGroupAccessory, never>;
|
|
646
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxTagGroupAccessory, "ng-template[cngxTagGroupAccessory]", ["cngxTagGroupAccessory"], {}, {}, never, never, true, never>;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Override template for the header zone of `<cngx-tag-group>` —
|
|
651
|
+
* projected ABOVE the row of tags. Use for label-prefix
|
|
652
|
+
* ("Filters"), count badges, sort toggles that span the group, or
|
|
653
|
+
* any header decoration the consumer wants to bundle with the
|
|
654
|
+
* layout.
|
|
655
|
+
*
|
|
656
|
+
* The slot has no default body — when not projected, no DOM is
|
|
657
|
+
* rendered above the tag row. The reactive count of projected
|
|
658
|
+
* `<span cngxTag>` siblings is exposed via the slot context for
|
|
659
|
+
* consumer "Filters ({{ count }})" patterns without injection.
|
|
660
|
+
*
|
|
661
|
+
* ```html
|
|
662
|
+
* <cngx-tag-group [semanticList]="true" label="Filters">
|
|
663
|
+
* <ng-template cngxTagGroupHeader let-count="count">
|
|
664
|
+
* <strong>Filters ({{ count }})</strong>
|
|
665
|
+
* </ng-template>
|
|
666
|
+
* <span cngxTag>Frontend</span>
|
|
667
|
+
* <span cngxTag>Backend</span>
|
|
668
|
+
* </cngx-tag-group>
|
|
669
|
+
* ```
|
|
670
|
+
*/
|
|
671
|
+
declare class CngxTagGroupHeader {
|
|
672
|
+
readonly templateRef: TemplateRef<CngxTagGroupHeaderContext>;
|
|
673
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxTagGroupHeader, never>;
|
|
674
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxTagGroupHeader, "ng-template[cngxTagGroupHeader]", ["cngxTagGroupHeader"], {}, {}, never, never, true, never>;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Public host contract that `CngxTagGroup` and any future
|
|
679
|
+
* non-component implementer must satisfy. Surfaced through
|
|
680
|
+
* `CNGX_TAG_GROUP` so child `CngxTag` directives can read parent state
|
|
681
|
+
* reactively without injecting a concrete parent class.
|
|
682
|
+
*
|
|
683
|
+
* The field is typed `Signal<boolean>` (the public parent type),
|
|
684
|
+
* NOT `InputSignal<boolean>` — test doubles and programmatic groups
|
|
685
|
+
* must be able to satisfy the contract without owning an Angular
|
|
686
|
+
* `input()`. The `CngxTagGroup` implementer narrows its
|
|
687
|
+
* `InputSignal<boolean>` to this public type via direct assignment
|
|
688
|
+
* (`readonly semanticList: Signal<boolean> = this.semanticListInput`).
|
|
689
|
+
* `InputSignal` already structurally extends `Signal`, so no runtime
|
|
690
|
+
* conversion is needed — and `.asReadonly()` does NOT exist on
|
|
691
|
+
* `InputSignal` (it lives on `WritableSignal` only); the type-only
|
|
692
|
+
* narrowing is the canonical bridge.
|
|
693
|
+
*/
|
|
694
|
+
interface CngxTagGroupHost {
|
|
695
|
+
readonly semanticList: Signal<boolean>;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* DI token for parent `CngxTagGroup` <-> child `CngxTag` ARIA wiring.
|
|
699
|
+
* Atomic-decompose rule 4 — communication via `InjectionToken`,
|
|
700
|
+
* never via concrete parent class injection.
|
|
701
|
+
*
|
|
702
|
+
* `CngxTag` injects the token `{ optional: true }` and, when present,
|
|
703
|
+
* derives its own `role="listitem"` from `host.semanticList()` via a
|
|
704
|
+
* single `computed()`. When absent (Tag rendered outside any group),
|
|
705
|
+
* the role attribute stays unset.
|
|
706
|
+
*
|
|
707
|
+
* Defaults to no provider — the token resolves to `null` for any
|
|
708
|
+
* `CngxTag` that lives outside a `CngxTagGroup`.
|
|
709
|
+
*/
|
|
710
|
+
declare const CNGX_TAG_GROUP: InjectionToken<CngxTagGroupHost>;
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Spacing between projected tags. Maps to the
|
|
714
|
+
* `--cngx-tag-group-gap{,-xs,-md}` CSS custom property cascade with
|
|
715
|
+
* fallback defaults (see `tag-group.component.css`). `sm` is the
|
|
716
|
+
* default — matches the tag's own padding rhythm.
|
|
717
|
+
*
|
|
718
|
+
* - `xs` → 0.25rem (tight chip strips)
|
|
719
|
+
* - `sm` → 0.5rem (default)
|
|
720
|
+
* - `md` → 0.75rem (roomy taxonomy clusters)
|
|
721
|
+
*/
|
|
722
|
+
type CngxTagGroupGap = 'xs' | 'sm' | 'md';
|
|
723
|
+
/**
|
|
724
|
+
* Cross-axis distribution of projected tags within the flex-wrap row.
|
|
725
|
+
* Resolves to a `justify-content` value:
|
|
726
|
+
*
|
|
727
|
+
* - `start` (default) → `flex-start`
|
|
728
|
+
* - `center` → `center`
|
|
729
|
+
* - `end` → `flex-end`
|
|
730
|
+
* - `between` → `space-between`
|
|
731
|
+
*
|
|
732
|
+
* Only meaningful when the group has more horizontal room than its
|
|
733
|
+
* intrinsic content; otherwise the row hugs its tags.
|
|
734
|
+
*/
|
|
735
|
+
type CngxTagGroupAlign = 'start' | 'center' | 'end' | 'between';
|
|
736
|
+
/**
|
|
737
|
+
* Layout-only container for a row of `CngxTag` siblings.
|
|
738
|
+
*
|
|
739
|
+
* **Why this exists.**
|
|
740
|
+
* Pairs with `CngxTag` to satisfy the long tail of "render N taxonomy
|
|
741
|
+
* badges in a row, optionally as a semantic list" needs. The component
|
|
742
|
+
* owns *only* the flex-wrap layout (gap / align), the `role="list"` +
|
|
743
|
+
* `aria-label` ARIA opt-in, and the `<ng-template>`-driven header /
|
|
744
|
+
* accessory slot zones. The cascade that flips each child's
|
|
745
|
+
* `role="listitem"` lives on the `CngxTag` side (`tag.directive.ts`
|
|
746
|
+
* reads `CNGX_TAG_GROUP.semanticList()` through a `computed`); this
|
|
747
|
+
* component just provides the implementer of that token (Pillar 1 —
|
|
748
|
+
* derivation rather than imperative sync; Pillar 2 — ARIA in the
|
|
749
|
+
* reactive graph).
|
|
750
|
+
*
|
|
751
|
+
* **Responsibilities (intentionally narrow).**
|
|
752
|
+
* - Apply gap / align host-class modifiers + thematic CSS custom
|
|
753
|
+
* properties.
|
|
754
|
+
* - Bind `role="list"` reactively from `[semanticList]`.
|
|
755
|
+
* - Bind `aria-label` reactively from `[label]`.
|
|
756
|
+
* - Provide `CNGX_TAG_GROUP` so descendant `CngxTag` directives can
|
|
757
|
+
* read `semanticList()` without injecting this concrete class
|
|
758
|
+
* (atomic-decompose rule 4).
|
|
759
|
+
* - Project consumer-supplied `*cngxTagGroupHeader` /
|
|
760
|
+
* `*cngxTagGroupAccessory` templates above / below the tag row,
|
|
761
|
+
* exposing the live group state plus `count` of projected
|
|
762
|
+
* `CngxTag` children via the slot context.
|
|
763
|
+
*
|
|
764
|
+
* **Non-responsibilities.**
|
|
765
|
+
* - No `role="listitem"` cascade implementation here — that lives in
|
|
766
|
+
* `CngxTag` so the cascade survives any future non-component
|
|
767
|
+
* implementer of `CngxTagGroupHost` (test doubles, programmatic
|
|
768
|
+
* groups).
|
|
769
|
+
* - No `hostDirectives` — decorative atoms have no shared cross-cutting
|
|
770
|
+
* behaviour to compose. Per atomic-decompose rule 1 the absence is
|
|
771
|
+
* the right call until a future shared concern lands.
|
|
772
|
+
* - Configuration cascade (`provideTagConfig`) — deferred (see
|
|
773
|
+
* `display-accepted-debt.md §1`).
|
|
774
|
+
*/
|
|
775
|
+
declare class CngxTagGroup implements CngxTagGroupHost {
|
|
776
|
+
/**
|
|
777
|
+
* Snapshot of the resolved tag-family config at construction
|
|
778
|
+
* time. Drives the per-input fallback defaults below.
|
|
779
|
+
*
|
|
780
|
+
* **Field-init ordering is load-bearing** — must be declared
|
|
781
|
+
* before any input field that reads `this.cfg.groupDefaults?.*`.
|
|
782
|
+
* Per the `tag-family-architectural-a-plus-pass` plan
|
|
783
|
+
* Architectural-Decisions table.
|
|
784
|
+
*/
|
|
785
|
+
private readonly cfg;
|
|
786
|
+
/** Spacing between projected tags. `sm` (default) | `xs` | `md`. */
|
|
787
|
+
readonly gap: _angular_core.InputSignal<CngxTagGroupGap>;
|
|
788
|
+
/** Cross-axis distribution. `start` (default) | `center` | `end` | `between`. */
|
|
789
|
+
readonly align: _angular_core.InputSignal<CngxTagGroupAlign>;
|
|
790
|
+
/**
|
|
791
|
+
* Optional label rendered as `aria-label` on the host. When the
|
|
792
|
+
* group also opts into `[semanticList]="true"`, AT reads "Tags,
|
|
793
|
+
* list, N items"; without `semanticList`, the label sits on a
|
|
794
|
+
* decorative grouping (no `role`).
|
|
795
|
+
*/
|
|
796
|
+
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
797
|
+
/**
|
|
798
|
+
* Input-binding hook for the public `[semanticList]` attribute.
|
|
799
|
+
* Accessed by Angular's template type-checker on consumer
|
|
800
|
+
* markup — therefore must be class-public (Angular rejects
|
|
801
|
+
* `private` per NG1053; `protected` blocks external template
|
|
802
|
+
* bindings). The hook is intentionally **not** the contract
|
|
803
|
+
* surface — that role belongs to `semanticList` below, typed
|
|
804
|
+
* `Signal<boolean>` so test doubles and programmatic
|
|
805
|
+
* implementers of `CngxTagGroupHost` can satisfy the interface
|
|
806
|
+
* without owning an Angular `input()`.
|
|
807
|
+
*
|
|
808
|
+
* @internal
|
|
809
|
+
*/
|
|
810
|
+
readonly semanticListInput: _angular_core.InputSignal<boolean>;
|
|
811
|
+
/**
|
|
812
|
+
* Public host-contract field. `InputSignal<boolean>` already
|
|
813
|
+
* structurally extends `Signal<boolean>`, so the assignment narrows
|
|
814
|
+
* the public type without a runtime conversion. Read by
|
|
815
|
+
* `CngxTag.roleAttr` through `CNGX_TAG_GROUP` to derive
|
|
816
|
+
* `role="listitem"` reactively.
|
|
817
|
+
*/
|
|
818
|
+
readonly semanticList: Signal<boolean>;
|
|
819
|
+
/**
|
|
820
|
+
* Live count of projected `<span cngxTag>` direct children. Drives
|
|
821
|
+
* the `count` field of the header / accessory slot contexts so
|
|
822
|
+
* consumer "Filters ({{ count }})" patterns work without
|
|
823
|
+
* injection. Default `Object.is` equality is correct for a
|
|
824
|
+
* primitive number.
|
|
825
|
+
*/
|
|
826
|
+
readonly count: Signal<number>;
|
|
827
|
+
/**
|
|
828
|
+
* Per-instance header-slot directive — projected as
|
|
829
|
+
* `<ng-template cngxTagGroupHeader>...</ng-template>`. Resolved
|
|
830
|
+
* through {@link injectResolvedTagTemplate} so consumers can
|
|
831
|
+
* project a header without wrapping the group component.
|
|
832
|
+
*/
|
|
833
|
+
protected readonly headerSlot: Signal<CngxTagGroupHeader | undefined>;
|
|
834
|
+
/** Per-instance accessory-slot directive — projected below the row. */
|
|
835
|
+
protected readonly accessorySlot: Signal<CngxTagGroupAccessory | undefined>;
|
|
836
|
+
/**
|
|
837
|
+
* Resolved header template. Phase 2 cascade: instance slot → null
|
|
838
|
+
* (no DOM rendered above the row when not projected). Phase 4
|
|
839
|
+
* commit 5 inserts `CNGX_TAG_CONFIG.templates.header` as a middle
|
|
840
|
+
* tier without touching this call site.
|
|
841
|
+
*/
|
|
842
|
+
protected readonly headerTpl: Signal<_angular_core.TemplateRef<CngxTagGroupHeaderContext> | null>;
|
|
843
|
+
/** Resolved accessory template. Same 2-stage cascade as {@link headerTpl}. */
|
|
844
|
+
protected readonly accessoryTpl: Signal<_angular_core.TemplateRef<_cngx_common_display.CngxTagGroupAccessoryContext> | null>;
|
|
845
|
+
/**
|
|
846
|
+
* Projected `<span cngxTag>` siblings. Default-scoped
|
|
847
|
+
* (`descendants: false`) so tags inside consumer-projected header /
|
|
848
|
+
* accessory templates do NOT inflate the count — the count
|
|
849
|
+
* represents the row's own taxonomy items, not arbitrary tag
|
|
850
|
+
* usage inside the slot zones.
|
|
851
|
+
*/
|
|
852
|
+
private readonly projectedTags;
|
|
853
|
+
/**
|
|
854
|
+
* Reactive bundle exposed to header / accessory slots'
|
|
855
|
+
* `*ngTemplateOutletContext`. The two slot context interfaces are
|
|
856
|
+
* structurally identical in Phase 2; the same computed source
|
|
857
|
+
* serves both. Consumer templates `let-count="count"` etc. read
|
|
858
|
+
* the live state without injecting the directive.
|
|
859
|
+
*
|
|
860
|
+
* Explicit structural `equal` fn — without it, a fresh literal
|
|
861
|
+
* each CD cycle would force `ngTemplateOutlet` to rebind embedded
|
|
862
|
+
* views even when no input changed. Per
|
|
863
|
+
* `reference_signal_architecture` §1 Equality Rule: every
|
|
864
|
+
* `computed` returning an object MUST pass an `equal` fn.
|
|
865
|
+
*/
|
|
866
|
+
protected readonly slotContext: Signal<CngxTagGroupHeaderContext>;
|
|
867
|
+
constructor();
|
|
868
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxTagGroup, never>;
|
|
869
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<CngxTagGroup, "cngx-tag-group", ["cngxTagGroup"], { "gap": { "alias": "gap"; "required": false; "isSignal": true; }; "align": { "alias": "align"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "semanticListInput": { "alias": "semanticList"; "required": false; "isSignal": true; }; }, {}, ["headerSlot", "accessorySlot", "projectedTags"], ["*"], true, never>;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* App-wide cascade for `CngxTag` + `CngxTagGroup` defaults, colour
|
|
874
|
+
* palette, slot templates, and ARIA-string fallbacks.
|
|
875
|
+
*
|
|
876
|
+
* Resolution priority (high → low):
|
|
877
|
+
* 1. Per-instance Input binding (e.g. `[variant]="'subtle'"`).
|
|
878
|
+
* 2. `provideTagConfigAt(...)` in a parent component's
|
|
879
|
+
* `viewProviders` (component-scoped override).
|
|
880
|
+
* 3. `provideTagConfig(...)` at the application root.
|
|
881
|
+
* 4. Library defaults (English; merged in via `CNGX_TAG_DEFAULTS`).
|
|
882
|
+
*
|
|
883
|
+
* Every key is optional — partial overrides are deep-merged with
|
|
884
|
+
* the library defaults so consumers only declare the keys they want
|
|
885
|
+
* to override.
|
|
886
|
+
*/
|
|
887
|
+
interface CngxTagConfig {
|
|
888
|
+
/** Default values for `CngxTag` inputs when no per-instance binding wins. */
|
|
889
|
+
readonly defaults?: {
|
|
890
|
+
readonly variant?: CngxTagVariant;
|
|
891
|
+
readonly color?: CngxTagColor;
|
|
892
|
+
readonly size?: CngxTagSize;
|
|
893
|
+
readonly truncate?: boolean;
|
|
894
|
+
readonly maxWidth?: string | null;
|
|
895
|
+
};
|
|
896
|
+
/** Default values for `CngxTagGroup` inputs when no per-instance binding wins. */
|
|
897
|
+
readonly groupDefaults?: {
|
|
898
|
+
readonly gap?: CngxTagGroupGap;
|
|
899
|
+
readonly align?: CngxTagGroupAlign;
|
|
900
|
+
readonly semanticList?: boolean;
|
|
901
|
+
};
|
|
902
|
+
/**
|
|
903
|
+
* Consumer-defined colour map. Each entry adds a `[data-color="<key>"]`
|
|
904
|
+
* cascade entry that resolves through `--cngx-tag-bg/-color/-border`
|
|
905
|
+
* custom properties. Predefined keys (`neutral`/`success`/`warning`/
|
|
906
|
+
* `error`/`info`) ship in `tag.css` and are not part of this map —
|
|
907
|
+
* extending the predefined palette overrides the consumer key only.
|
|
908
|
+
*/
|
|
909
|
+
readonly colors?: Readonly<Record<string, Readonly<{
|
|
910
|
+
readonly bg: string;
|
|
911
|
+
readonly color: string;
|
|
912
|
+
readonly border: string;
|
|
913
|
+
}>>>;
|
|
914
|
+
/**
|
|
915
|
+
* App-wide template overrides for the five Tag-family slots.
|
|
916
|
+
* Resolved in tier 2 of the slot cascade (instance directive wins;
|
|
917
|
+
* config templates are the middle tier; the host's `<ng-template>`
|
|
918
|
+
* default body is the floor).
|
|
919
|
+
*/
|
|
920
|
+
readonly templates?: {
|
|
921
|
+
readonly label?: TemplateRef<unknown> | null;
|
|
922
|
+
readonly prefix?: TemplateRef<unknown> | null;
|
|
923
|
+
readonly suffix?: TemplateRef<unknown> | null;
|
|
924
|
+
readonly header?: TemplateRef<unknown> | null;
|
|
925
|
+
readonly accessory?: TemplateRef<unknown> | null;
|
|
926
|
+
};
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
/**
|
|
930
|
+
* App-wide configuration cascade for the tag family. Resolves in
|
|
931
|
+
* priority order:
|
|
932
|
+
*
|
|
933
|
+
* 1. Per-instance Input binding.
|
|
934
|
+
* 2. `provideTagConfigAt(...)` in a parent component's `viewProviders`.
|
|
935
|
+
* 3. `provideTagConfig(...)` at the application root.
|
|
936
|
+
* 4. Library defaults (this token's `factory`).
|
|
937
|
+
*
|
|
938
|
+
* `providedIn: 'root'` with a default factory means consumers never
|
|
939
|
+
* need to provide the token explicitly — `inject(CNGX_TAG_CONFIG)`
|
|
940
|
+
* always resolves. Consumers who want overrides call
|
|
941
|
+
* `provideTagConfig(...features)` in `bootstrapApplication` providers
|
|
942
|
+
* (root cascade) or `provideTagConfigAt(...features)` in a component's
|
|
943
|
+
* `viewProviders` (sub-tree cascade).
|
|
944
|
+
*/
|
|
945
|
+
declare const CNGX_TAG_CONFIG: InjectionToken<CngxTagConfig>;
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* Discriminated-union shape returned by `withTagDefaults` /
|
|
949
|
+
* `withTagGroupDefaults` / `withTagColors` / `withTagSlots`. The
|
|
950
|
+
* reducer in `provideTagConfig` / `provideTagConfigAt` matches on
|
|
951
|
+
* `kind` and merges `payload` into the corresponding config sub-tree.
|
|
952
|
+
*
|
|
953
|
+
* Mirrors the `CngxSelectConfigFeature` discriminated-union shape
|
|
954
|
+
* from `@cngx/forms/select` so the consumer's mental model is one
|
|
955
|
+
* across feature areas.
|
|
956
|
+
*/
|
|
957
|
+
type CngxTagConfigFeature = {
|
|
958
|
+
readonly kind: 'defaults';
|
|
959
|
+
readonly payload: NonNullable<CngxTagConfig['defaults']>;
|
|
960
|
+
} | {
|
|
961
|
+
readonly kind: 'groupDefaults';
|
|
962
|
+
readonly payload: NonNullable<CngxTagConfig['groupDefaults']>;
|
|
963
|
+
} | {
|
|
964
|
+
readonly kind: 'colors';
|
|
965
|
+
readonly payload: NonNullable<CngxTagConfig['colors']>;
|
|
966
|
+
} | {
|
|
967
|
+
readonly kind: 'templates';
|
|
968
|
+
readonly payload: NonNullable<CngxTagConfig['templates']>;
|
|
969
|
+
};
|
|
970
|
+
/**
|
|
971
|
+
* Application-root configuration cascade for the tag family. Pass
|
|
972
|
+
* any combination of `withTagDefaults` / `withTagGroupDefaults` /
|
|
973
|
+
* `withTagColors` / `withTagSlots` features in
|
|
974
|
+
* `bootstrapApplication`'s providers array.
|
|
975
|
+
*
|
|
976
|
+
* Resolution priority (high → low):
|
|
977
|
+
* 1. Per-instance Input binding.
|
|
978
|
+
* 2. `provideTagConfigAt(...)` in a parent component's
|
|
979
|
+
* `viewProviders`.
|
|
980
|
+
* 3. `provideTagConfig(...)` at the application root.
|
|
981
|
+
* 4. Library defaults (`CNGX_TAG_DEFAULTS`).
|
|
982
|
+
*
|
|
983
|
+
* The provider deep-merges supplied features with the library
|
|
984
|
+
* defaults so consumers only declare keys they want to override.
|
|
985
|
+
*
|
|
986
|
+
* ```ts
|
|
987
|
+
* bootstrapApplication(AppComponent, {
|
|
988
|
+
* providers: [
|
|
989
|
+
* provideTagConfig(
|
|
990
|
+
* withTagDefaults({ variant: 'subtle' }),
|
|
991
|
+
* withTagColors({
|
|
992
|
+
* 'my-brand': {
|
|
993
|
+
* bg: '#4f46e5',
|
|
994
|
+
* color: '#ffffff',
|
|
995
|
+
* border: 'transparent',
|
|
996
|
+
* },
|
|
997
|
+
* }),
|
|
998
|
+
* ),
|
|
999
|
+
* ],
|
|
1000
|
+
* });
|
|
1001
|
+
* ```
|
|
1002
|
+
*/
|
|
1003
|
+
declare function provideTagConfig(...features: CngxTagConfigFeature[]): EnvironmentProviders;
|
|
1004
|
+
/**
|
|
1005
|
+
* Component-scoped configuration cascade for the tag family. Pass
|
|
1006
|
+
* any combination of feature factories in a parent component's
|
|
1007
|
+
* `viewProviders` array.
|
|
1008
|
+
*
|
|
1009
|
+
* Unlike `provideTagConfig` (root-only), `provideTagConfigAt` injects
|
|
1010
|
+
* the parent injector's `CNGX_TAG_CONFIG` value (resolves through
|
|
1011
|
+
* the priority chain — root provider, library defaults, or another
|
|
1012
|
+
* `provideTagConfigAt` further up) and deep-merges the supplied
|
|
1013
|
+
* features on top. This produces cumulative cascade behaviour:
|
|
1014
|
+
* descendant tag instances see the merged config, sibling sub-trees
|
|
1015
|
+
* keep the inherited value untouched.
|
|
1016
|
+
*
|
|
1017
|
+
* ```ts
|
|
1018
|
+
* @Component({
|
|
1019
|
+
* selector: 'admin-section',
|
|
1020
|
+
* viewProviders: [
|
|
1021
|
+
* provideTagConfigAt(
|
|
1022
|
+
* withTagDefaults({ size: 'sm' }),
|
|
1023
|
+
* ),
|
|
1024
|
+
* ],
|
|
1025
|
+
* template: '<span cngxTag>Compact</span>',
|
|
1026
|
+
* })
|
|
1027
|
+
* class AdminSection {}
|
|
1028
|
+
* ```
|
|
1029
|
+
*/
|
|
1030
|
+
declare function provideTagConfigAt(...features: CngxTagConfigFeature[]): Provider[];
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* Convenience accessor for the tag-family configuration cascade.
|
|
1034
|
+
* Runs in injection context; resolves through the priority chain
|
|
1035
|
+
* (per-instance Input → `provideTagConfigAt` → `provideTagConfig`
|
|
1036
|
+
* → library defaults).
|
|
1037
|
+
*
|
|
1038
|
+
* Equivalent to `inject(CNGX_TAG_CONFIG)` — the helper exists so
|
|
1039
|
+
* consumers don't need to import the token directly. Mirrors
|
|
1040
|
+
* `injectSelectConfig` in `@cngx/forms/select`.
|
|
1041
|
+
*
|
|
1042
|
+
* ```ts
|
|
1043
|
+
* export class MyDirective {
|
|
1044
|
+
* private readonly cfg = injectTagConfig();
|
|
1045
|
+
* readonly variant = input<CngxTagVariant>(
|
|
1046
|
+
* this.cfg.defaults?.variant ?? 'filled',
|
|
1047
|
+
* );
|
|
1048
|
+
* }
|
|
1049
|
+
* ```
|
|
1050
|
+
*/
|
|
1051
|
+
declare function injectTagConfig(): CngxTagConfig;
|
|
1052
|
+
|
|
1053
|
+
/**
|
|
1054
|
+
* Override the default `CngxTag` input values (`variant`, `color`,
|
|
1055
|
+
* `size`, `truncate`, `maxWidth`). Per-instance bindings still win
|
|
1056
|
+
* over the cascade — this only sets the *fallback* per directive.
|
|
1057
|
+
*
|
|
1058
|
+
* ```ts
|
|
1059
|
+
* provideTagConfig(
|
|
1060
|
+
* withTagDefaults({ variant: 'subtle', size: 'sm' }),
|
|
1061
|
+
* );
|
|
1062
|
+
* ```
|
|
1063
|
+
*/
|
|
1064
|
+
declare function withTagDefaults(payload: NonNullable<CngxTagConfig['defaults']>): CngxTagConfigFeature;
|
|
1065
|
+
/**
|
|
1066
|
+
* Override the default `CngxTagGroup` input values (`gap`, `align`,
|
|
1067
|
+
* `semanticList`). Per-instance bindings still win.
|
|
1068
|
+
*
|
|
1069
|
+
* ```ts
|
|
1070
|
+
* provideTagConfig(
|
|
1071
|
+
* withTagGroupDefaults({ gap: 'md', semanticList: true }),
|
|
1072
|
+
* );
|
|
1073
|
+
* ```
|
|
1074
|
+
*/
|
|
1075
|
+
declare function withTagGroupDefaults(payload: NonNullable<CngxTagConfig['groupDefaults']>): CngxTagConfigFeature;
|
|
1076
|
+
/**
|
|
1077
|
+
* Register consumer-defined colour entries. Each key adds a
|
|
1078
|
+
* `[data-color="<key>"]` cascade entry resolved through
|
|
1079
|
+
* `--cngx-tag-bg/-color/-border` custom properties at the consumer's
|
|
1080
|
+
* own CSS layer.
|
|
1081
|
+
*
|
|
1082
|
+
* The five predefined keys (`neutral`/`success`/`warning`/`error`/
|
|
1083
|
+
* `info`) ship in `tag.css` and are NOT part of this map; passing
|
|
1084
|
+
* them here is a no-op against the predefined cascade. Consumer
|
|
1085
|
+
* keys composed via `data-color="my-brand"` resolve through the
|
|
1086
|
+
* registered entry.
|
|
1087
|
+
*
|
|
1088
|
+
* ```ts
|
|
1089
|
+
* provideTagConfig(
|
|
1090
|
+
* withTagColors({
|
|
1091
|
+
* 'my-brand': {
|
|
1092
|
+
* bg: '#4f46e5',
|
|
1093
|
+
* color: '#ffffff',
|
|
1094
|
+
* border: 'transparent',
|
|
1095
|
+
* },
|
|
1096
|
+
* }),
|
|
1097
|
+
* );
|
|
1098
|
+
* ```
|
|
1099
|
+
*/
|
|
1100
|
+
declare function withTagColors(payload: NonNullable<CngxTagConfig['colors']>): CngxTagConfigFeature;
|
|
1101
|
+
/**
|
|
1102
|
+
* Register app-wide template overrides for the five Tag-family
|
|
1103
|
+
* slots. Resolved in tier 2 of the slot cascade — instance
|
|
1104
|
+
* directives still win, the host's `<ng-template>` default body is
|
|
1105
|
+
* the floor.
|
|
1106
|
+
*
|
|
1107
|
+
* **Staging note.** This factory ships ahead of a documented second
|
|
1108
|
+
* consumer — the headless `CngxTag` + `CngxTagGroup` are the only
|
|
1109
|
+
* current consumers. The staging is intentional and tracked in
|
|
1110
|
+
* `display-accepted-debt.md §2` (Material organism deferral): a
|
|
1111
|
+
* future `cngx-mat-tag` / `cngx-mat-tag-group` wrapper inherits the
|
|
1112
|
+
* cascade for free without forking. If §2 is rejected outright,
|
|
1113
|
+
* `withTagSlots` re-evaluates as a sunsetting candidate at the same
|
|
1114
|
+
* time. Per the cngx-review architecture lens, the surface is
|
|
1115
|
+
* tracked rather than left silent.
|
|
1116
|
+
*
|
|
1117
|
+
* ```ts
|
|
1118
|
+
* @Component({
|
|
1119
|
+
* template: `
|
|
1120
|
+
* <ng-template #brandLabel let-color="color">
|
|
1121
|
+
* <strong>{{ color }}</strong>
|
|
1122
|
+
* </ng-template>
|
|
1123
|
+
* `,
|
|
1124
|
+
* })
|
|
1125
|
+
* class AppShell {
|
|
1126
|
+
* readonly brandLabel = viewChild.required<TemplateRef<unknown>>('brandLabel');
|
|
1127
|
+
* }
|
|
1128
|
+
*
|
|
1129
|
+
* // Then in providers:
|
|
1130
|
+
* provideTagConfig(withTagSlots({ label: shell.brandLabel() }));
|
|
1131
|
+
* ```
|
|
1132
|
+
*/
|
|
1133
|
+
declare function withTagSlots(payload: NonNullable<CngxTagConfig['templates']>): CngxTagConfigFeature;
|
|
1134
|
+
|
|
1135
|
+
export { CNGX_TAG_CONFIG, CNGX_TAG_GROUP, CngxAvatar, CngxBadge, CngxCheckboxIndicator, CngxChip, CngxDivider, CngxIcon, CngxRadioIndicator, CngxTag, CngxTagGroup, CngxTagGroupAccessory, CngxTagGroupHeader, CngxTagLabel, CngxTagPrefix, CngxTagSuffix, injectTagConfig, provideTagConfig, provideTagConfigAt, withTagColors, withTagDefaults, withTagGroupDefaults, withTagSlots };
|
|
1136
|
+
export type { CngxBadgeColor, CngxBadgePosition, CngxTagColor, CngxTagConfig, CngxTagConfigFeature, CngxTagGroupAccessoryContext, CngxTagGroupAlign, CngxTagGroupGap, CngxTagGroupHeaderContext, CngxTagGroupHost, CngxTagLabelContext, CngxTagPrefixContext, CngxTagSize, CngxTagSuffixContext, CngxTagVariant };
|