@cngx/common 0.0.1-rc.0 → 0.1.0-rc.1
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/a11y/README.md +13 -16
- package/card/README.md +2 -21
- package/chart/README.md +5 -8
- package/data/README.md +45 -47
- package/dialog/README.md +12 -15
- package/display/README.md +5 -9
- package/fesm2022/cngx-common-a11y.mjs +164 -51
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +157 -69
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +389 -92
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +311 -151
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +167 -29
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +445 -110
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +2059 -435
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +188 -31
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +711 -90
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +1479 -73
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +1144 -85
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +2 -2
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +5 -5
- package/layout/README.md +2 -2
- package/package.json +7 -6
- package/popover/README.md +8 -34
- package/stepper/README.md +69 -8
- package/tabs/README.md +6 -6
- package/theming/components/cngx-async.css +74 -0
- package/theming/components/cngx-backdrop.css +73 -0
- package/theming/components/cngx-badge.css +340 -0
- package/theming/components/cngx-bottom-sheet.css +201 -0
- package/theming/components/cngx-button-toggle.css +99 -0
- package/theming/components/cngx-dialog.css +358 -0
- package/theming/components/cngx-divider.css +145 -0
- package/theming/components/cngx-listbox.css +220 -0
- package/theming/components/cngx-menu.css +371 -0
- package/theming/components/cngx-ripple.css +116 -0
- package/theming/components/cngx-tooltip.css +265 -0
- package/theming/system-tokens.css +24 -0
- package/types/cngx-common-a11y.d.ts +159 -38
- package/types/cngx-common-card.d.ts +137 -22
- package/types/cngx-common-chart.d.ts +337 -40
- package/types/cngx-common-data.d.ts +277 -45
- package/types/cngx-common-dialog.d.ts +162 -22
- package/types/cngx-common-display.d.ts +422 -78
- package/types/cngx-common-interactive.d.ts +1880 -305
- package/types/cngx-common-layout.d.ts +191 -28
- package/types/cngx-common-popover.d.ts +632 -87
- package/types/cngx-common-stepper.d.ts +1360 -45
- package/types/cngx-common-tabs.d.ts +1139 -56
- package/types/cngx-common.d.ts +1 -1
- package/README.md +0 -18
|
@@ -1,14 +1,37 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, ChangeDetectionStrategy, Component, Directive, signal,
|
|
2
|
+
import { input, ViewEncapsulation, ChangeDetectionStrategy, Component, computed, Directive, signal, inject, ElementRef, Renderer2, afterRenderEffect, effect, DestroyRef, output, InjectionToken, TemplateRef, contentChild, makeEnvironmentProviders, contentChildren, afterNextRender, untracked, isDevMode } from '@angular/core';
|
|
3
3
|
import { nextUid } from '@cngx/core/utils';
|
|
4
4
|
import { NgTemplateOutlet } from '@angular/common';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Display atom for icons. Projects its content (font glyph, SVG, image, custom
|
|
8
|
-
* element) and adds size,
|
|
8
|
+
* element) and adds size, color, and ARIA semantics.
|
|
9
9
|
*
|
|
10
10
|
* Decorative by default (`aria-hidden="true"`); set `label` to make it
|
|
11
11
|
* informative (`role="img"`, `aria-label`).
|
|
12
|
+
*
|
|
13
|
+
* @category common/display
|
|
14
|
+
* @docsKind primary
|
|
15
|
+
* @wcag AA
|
|
16
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/icon/icon.component.ts
|
|
17
|
+
* @selector cngx-icon
|
|
18
|
+
* @since 0.1.0
|
|
19
|
+
* @relatedTo CngxAvatar, CngxBadge, CngxChip
|
|
20
|
+
* <example-url>http://localhost:4200/#/common/display/icon/decorative-vs-informative</example-url>
|
|
21
|
+
* <example-url>http://localhost:4200/#/common/display/icon/sizes</example-url>
|
|
22
|
+
* <example-url>http://localhost:4200/#/common/display/tag/app-wide-defaults-via-providetagconfig</example-url>
|
|
23
|
+
* <example-url>http://localhost:4200/#/common/display/tag/color-palette</example-url>
|
|
24
|
+
* <example-url>http://localhost:4200/#/common/display/tag/composition-with-cngxicon</example-url>
|
|
25
|
+
* <example-url>http://localhost:4200/#/common/display/tag/density</example-url>
|
|
26
|
+
* <example-url>http://localhost:4200/#/common/display/tag/group-semantic-list</example-url>
|
|
27
|
+
* <example-url>http://localhost:4200/#/common/display/tag/group-with-header-accessory</example-url>
|
|
28
|
+
* <example-url>http://localhost:4200/#/common/display/tag/layout-only-alignment</example-url>
|
|
29
|
+
* <example-url>http://localhost:4200/#/common/display/tag/layout-only-gap-variants</example-url>
|
|
30
|
+
* <example-url>http://localhost:4200/#/common/display/tag/link-mode</example-url>
|
|
31
|
+
* <example-url>http://localhost:4200/#/common/display/tag/slot-overrides-custom-label</example-url>
|
|
32
|
+
* <example-url>http://localhost:4200/#/common/display/tag/slot-overrides-prefix-label-suffix</example-url>
|
|
33
|
+
* <example-url>http://localhost:4200/#/common/display/tag/truncate-maxwidth</example-url>
|
|
34
|
+
* <example-url>http://localhost:4200/#/common/display/tag/variant-matrix</example-url>
|
|
12
35
|
*/
|
|
13
36
|
class CngxIcon {
|
|
14
37
|
/** Accessible label. When set, the icon is treated as informative content. */
|
|
@@ -16,11 +39,11 @@ class CngxIcon {
|
|
|
16
39
|
/** Size preset. Maps to CSS custom properties on the host. */
|
|
17
40
|
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
18
41
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxIcon, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
19
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxIcon, isStandalone: true, selector: "cngx-icon, [cngxIcon]", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.role": "label() ? \"img\" : null", "attr.aria-label": "label() ?? null", "attr.aria-hidden": "label() ? null : \"true\"", "class.cngx-icon--xs": "size() === \"xs\"", "class.cngx-icon--sm": "size() === \"sm\"", "class.cngx-icon--md": "size() === \"md\"", "class.cngx-icon--lg": "size() === \"lg\"", "class.cngx-icon--xl": "size() === \"xl\"" }, classAttribute: "cngx-icon" }, exportAs: ["cngxIcon"], ngImport: i0, template: '<ng-content />', isInline: true, styles: [":
|
|
42
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxIcon, isStandalone: true, selector: "cngx-icon, [cngxIcon]", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.role": "label() ? \"img\" : null", "attr.aria-label": "label() ?? null", "attr.aria-hidden": "label() ? null : \"true\"", "class.cngx-icon--xs": "size() === \"xs\"", "class.cngx-icon--sm": "size() === \"sm\"", "class.cngx-icon--md": "size() === \"md\"", "class.cngx-icon--lg": "size() === \"lg\"", "class.cngx-icon--xl": "size() === \"xl\"" }, classAttribute: "cngx-icon" }, exportAs: ["cngxIcon"], ngImport: i0, template: '<ng-content />', isInline: true, styles: ["@layer cngx.tokens{@property --cngx-icon-size{syntax: \"*\"; inherits: false; initial-value: 1.25em;}@property --cngx-icon-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-icon-size-xs{syntax: \"*\"; inherits: false; initial-value: .75em;}@property --cngx-icon-size-sm{syntax: \"*\"; inherits: false; initial-value: 1em;}@property --cngx-icon-size-md{syntax: \"*\"; inherits: false; initial-value: 1.25em;}@property --cngx-icon-size-lg{syntax: \"*\"; inherits: false; initial-value: 1.5em;}@property --cngx-icon-size-xl{syntax: \"*\"; inherits: false; initial-value: 2em;}}@layer cngx.components{@scope(.cngx-icon){:scope{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;line-height:1;flex:0 0 auto;font-size:var(--cngx-icon-size, var(--cngx-icon-size-md, 1.25em));color:var(--cngx-icon-color, currentColor)}:scope.cngx-icon--xs{--cngx-icon-size: var(--cngx-icon-size-xs, .75em)}:scope.cngx-icon--sm{--cngx-icon-size: var(--cngx-icon-size-sm, 1em)}:scope.cngx-icon--md{--cngx-icon-size: var(--cngx-icon-size-md, 1.25em)}:scope.cngx-icon--lg{--cngx-icon-size: var(--cngx-icon-size-lg, 1.5em)}:scope.cngx-icon--xl{--cngx-icon-size: var(--cngx-icon-size-xl, 2em)}:scope>svg{width:1em;height:1em;fill:currentColor;display:block}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
20
43
|
}
|
|
21
44
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxIcon, decorators: [{
|
|
22
45
|
type: Component,
|
|
23
|
-
args: [{ selector: 'cngx-icon, [cngxIcon]', exportAs: 'cngxIcon', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: '<ng-content />', host: {
|
|
46
|
+
args: [{ selector: 'cngx-icon, [cngxIcon]', exportAs: 'cngxIcon', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: '<ng-content />', host: {
|
|
24
47
|
class: 'cngx-icon',
|
|
25
48
|
'[attr.role]': 'label() ? "img" : null',
|
|
26
49
|
'[attr.aria-label]': 'label() ?? null',
|
|
@@ -30,17 +53,128 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
30
53
|
'[class.cngx-icon--md]': 'size() === "md"',
|
|
31
54
|
'[class.cngx-icon--lg]': 'size() === "lg"',
|
|
32
55
|
'[class.cngx-icon--xl]': 'size() === "xl"',
|
|
33
|
-
}, styles: [":
|
|
56
|
+
}, styles: ["@layer cngx.tokens{@property --cngx-icon-size{syntax: \"*\"; inherits: false; initial-value: 1.25em;}@property --cngx-icon-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-icon-size-xs{syntax: \"*\"; inherits: false; initial-value: .75em;}@property --cngx-icon-size-sm{syntax: \"*\"; inherits: false; initial-value: 1em;}@property --cngx-icon-size-md{syntax: \"*\"; inherits: false; initial-value: 1.25em;}@property --cngx-icon-size-lg{syntax: \"*\"; inherits: false; initial-value: 1.5em;}@property --cngx-icon-size-xl{syntax: \"*\"; inherits: false; initial-value: 2em;}}@layer cngx.components{@scope(.cngx-icon){:scope{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;line-height:1;flex:0 0 auto;font-size:var(--cngx-icon-size, var(--cngx-icon-size-md, 1.25em));color:var(--cngx-icon-color, currentColor)}:scope.cngx-icon--xs{--cngx-icon-size: var(--cngx-icon-size-xs, .75em)}:scope.cngx-icon--sm{--cngx-icon-size: var(--cngx-icon-size-sm, 1em)}:scope.cngx-icon--md{--cngx-icon-size: var(--cngx-icon-size-md, 1.25em)}:scope.cngx-icon--lg{--cngx-icon-size: var(--cngx-icon-size-lg, 1.5em)}:scope.cngx-icon--xl{--cngx-icon-size: var(--cngx-icon-size-xl, 2em)}:scope>svg{width:1em;height:1em;fill:currentColor;display:block}}}\n"] }]
|
|
34
57
|
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
35
58
|
|
|
59
|
+
const segmentsEqual = (a, b) => a.length === b.length && a.every((s, i) => s === b[i]);
|
|
60
|
+
/**
|
|
61
|
+
* Generic segmented position indicator - a discrete progress bar split
|
|
62
|
+
* into N segments. Reusable outside the stepper (lightboxes, carousels,
|
|
63
|
+
* onboarding), so it carries zero stepper dependency and no async
|
|
64
|
+
* semantics - distinct from the continuous `<cngx-progress>` loading bar.
|
|
65
|
+
*
|
|
66
|
+
* Drive it positionally with `[value]` / `[total]` (the segment states
|
|
67
|
+
* derive automatically), or hand it an explicit `[segments]` array when
|
|
68
|
+
* you need per-segment control (e.g. an `error` segment). ARIA
|
|
69
|
+
* (`role="progressbar"` + the `aria-value*` set + `aria-valuetext`) lives
|
|
70
|
+
* in the `computed()` graph (Pillar 2).
|
|
71
|
+
*
|
|
72
|
+
* ```html
|
|
73
|
+
* <cngx-segmented-progress [value]="3" [total]="8" />
|
|
74
|
+
* <cngx-segmented-progress [segments]="['done', 'error', 'active', 'todo']" />
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @category common/display
|
|
78
|
+
* @docsKind primary
|
|
79
|
+
* @wcag AA
|
|
80
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/segmented-progress/segmented-progress.component.ts
|
|
81
|
+
* @since 0.1.0
|
|
82
|
+
* @relatedTo CngxStepper, CngxBadge
|
|
83
|
+
* <example-url>http://localhost:4200/#/common/display/segmented-progress/value-total</example-url>
|
|
84
|
+
* <example-url>http://localhost:4200/#/common/display/segmented-progress/lightbox-position</example-url>
|
|
85
|
+
* <example-url>http://localhost:4200/#/common/display/segmented-progress/error-segment</example-url>
|
|
86
|
+
*/
|
|
87
|
+
class CngxSegmentedProgress {
|
|
88
|
+
/** Number of completed positions (0-based count). Drives derivation. */
|
|
89
|
+
value = input(0, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
90
|
+
/** Total number of segments when deriving from `[value]`. */
|
|
91
|
+
total = input(0, ...(ngDevMode ? [{ debugName: "total" }] : /* istanbul ignore next */ []));
|
|
92
|
+
/**
|
|
93
|
+
* Explicit per-segment states. When set, wins over `[value]`/`[total]`
|
|
94
|
+
* derivation - use it for an `error` segment or any non-linear layout.
|
|
95
|
+
*/
|
|
96
|
+
segments = input(undefined, ...(ngDevMode ? [{ debugName: "segments" }] : /* istanbul ignore next */ []));
|
|
97
|
+
/**
|
|
98
|
+
* Override the `aria-valuetext` string. Receives `(now, max)` - the
|
|
99
|
+
* completed-segment count and the total segment count. Mirrors
|
|
100
|
+
* `CngxStepperCount.format`; the default is `(now, max) => \`${now} of
|
|
101
|
+
* ${max}\``. Supply a localised closure for non-English position text
|
|
102
|
+
* (e.g. `(n, m) => \`Schritt ${n} von ${m}\``).
|
|
103
|
+
*/
|
|
104
|
+
valueTextFormat = input(undefined, ...(ngDevMode ? [{ debugName: "valueTextFormat" }] : /* istanbul ignore next */ []));
|
|
105
|
+
/** Segments actually rendered: explicit when supplied, else derived. */
|
|
106
|
+
resolvedSegments = computed(() => {
|
|
107
|
+
const explicit = this.segments();
|
|
108
|
+
if (explicit) {
|
|
109
|
+
return explicit;
|
|
110
|
+
}
|
|
111
|
+
const total = Math.max(0, Math.trunc(this.total()));
|
|
112
|
+
const value = Math.max(0, Math.min(Math.trunc(this.value()), total));
|
|
113
|
+
return Array.from({ length: total }, (_, i) => i < value ? 'done' : i === value ? 'active' : 'todo');
|
|
114
|
+
}, { ...(ngDevMode ? { debugName: "resolvedSegments" } : /* istanbul ignore next */ {}), equal: segmentsEqual });
|
|
115
|
+
/** `aria-valuemax` - segment count. */
|
|
116
|
+
max = computed(() => this.resolvedSegments().length, ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
117
|
+
/** `aria-valuenow` - count of completed (`done`) segments; the active in-progress segment is not counted. */
|
|
118
|
+
now = computed(() => {
|
|
119
|
+
const explicit = this.segments();
|
|
120
|
+
if (explicit) {
|
|
121
|
+
return explicit.filter((s) => s === 'done').length;
|
|
122
|
+
}
|
|
123
|
+
return Math.max(0, Math.min(Math.trunc(this.value()), this.max()));
|
|
124
|
+
}, ...(ngDevMode ? [{ debugName: "now" }] : /* istanbul ignore next */ []));
|
|
125
|
+
/** `aria-valuetext` - human-readable position via the resolved format closure. */
|
|
126
|
+
valueText = computed(() => {
|
|
127
|
+
const fmt = this.valueTextFormat() ?? ((now, max) => `${now} of ${max}`);
|
|
128
|
+
return fmt(this.now(), this.max());
|
|
129
|
+
}, ...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
|
|
130
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSegmentedProgress, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
131
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxSegmentedProgress, isStandalone: true, selector: "cngx-segmented-progress", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, segments: { classPropertyName: "segments", publicName: "segments", isSignal: true, isRequired: false, transformFunction: null }, valueTextFormat: { classPropertyName: "valueTextFormat", publicName: "valueTextFormat", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "progressbar" }, properties: { "attr.aria-valuemin": "0", "attr.aria-valuemax": "max()", "attr.aria-valuenow": "now()", "attr.aria-valuetext": "valueText()" }, classAttribute: "cngx-segmented-progress" }, ngImport: i0, template: `
|
|
132
|
+
@for (segment of resolvedSegments(); track $index) {
|
|
133
|
+
<span
|
|
134
|
+
class="cngx-segmented-progress__segment"
|
|
135
|
+
[attr.data-state]="segment"
|
|
136
|
+
aria-hidden="true"
|
|
137
|
+
></span>
|
|
138
|
+
}
|
|
139
|
+
`, isInline: true, styles: [".cngx-segmented-progress{display:flex;align-items:center;gap:var(--cngx-segmented-progress-gap, .25rem);inline-size:var(--cngx-segmented-progress-inline-size, 100%)}.cngx-segmented-progress__segment{flex:1 1 0;block-size:var(--cngx-segmented-progress-thickness, .375rem);border-radius:var(--cngx-segmented-progress-radius, 999px);background:var(--cngx-segmented-progress-todo-color, var(--mat-sys-surface-variant, #e0e0e0));transition:background var(--cngx-segmented-progress-transition, .15s ease)}.cngx-segmented-progress__segment[data-state=done]{background:var(--cngx-segmented-progress-done-color, var(--mat-sys-primary, #3f51b5))}.cngx-segmented-progress__segment[data-state=active]{background:var(--cngx-segmented-progress-active-color, var(--mat-sys-primary, #3f51b5));opacity:var(--cngx-segmented-progress-active-opacity, .6)}.cngx-segmented-progress__segment[data-state=error]{background:var(--cngx-segmented-progress-error-color, var(--mat-sys-error, #b3261e))}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
140
|
+
}
|
|
141
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSegmentedProgress, decorators: [{
|
|
142
|
+
type: Component,
|
|
143
|
+
args: [{ selector: 'cngx-segmented-progress', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
144
|
+
class: 'cngx-segmented-progress',
|
|
145
|
+
role: 'progressbar',
|
|
146
|
+
'[attr.aria-valuemin]': '0',
|
|
147
|
+
'[attr.aria-valuemax]': 'max()',
|
|
148
|
+
'[attr.aria-valuenow]': 'now()',
|
|
149
|
+
'[attr.aria-valuetext]': 'valueText()',
|
|
150
|
+
}, template: `
|
|
151
|
+
@for (segment of resolvedSegments(); track $index) {
|
|
152
|
+
<span
|
|
153
|
+
class="cngx-segmented-progress__segment"
|
|
154
|
+
[attr.data-state]="segment"
|
|
155
|
+
aria-hidden="true"
|
|
156
|
+
></span>
|
|
157
|
+
}
|
|
158
|
+
`, styles: [".cngx-segmented-progress{display:flex;align-items:center;gap:var(--cngx-segmented-progress-gap, .25rem);inline-size:var(--cngx-segmented-progress-inline-size, 100%)}.cngx-segmented-progress__segment{flex:1 1 0;block-size:var(--cngx-segmented-progress-thickness, .375rem);border-radius:var(--cngx-segmented-progress-radius, 999px);background:var(--cngx-segmented-progress-todo-color, var(--mat-sys-surface-variant, #e0e0e0));transition:background var(--cngx-segmented-progress-transition, .15s ease)}.cngx-segmented-progress__segment[data-state=done]{background:var(--cngx-segmented-progress-done-color, var(--mat-sys-primary, #3f51b5))}.cngx-segmented-progress__segment[data-state=active]{background:var(--cngx-segmented-progress-active-color, var(--mat-sys-primary, #3f51b5));opacity:var(--cngx-segmented-progress-active-opacity, .6)}.cngx-segmented-progress__segment[data-state=error]{background:var(--cngx-segmented-progress-error-color, var(--mat-sys-error, #b3261e))}\n"] }]
|
|
159
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], total: [{ type: i0.Input, args: [{ isSignal: true, alias: "total", required: false }] }], segments: [{ type: i0.Input, args: [{ isSignal: true, alias: "segments", required: false }] }], valueTextFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueTextFormat", required: false }] }] } });
|
|
160
|
+
|
|
36
161
|
/**
|
|
37
162
|
* Thin presentational separator with proper ARIA semantics.
|
|
38
163
|
*
|
|
39
|
-
* Renders `role="separator"` + `aria-orientation`
|
|
164
|
+
* Renders `role="separator"` + `aria-orientation` - required for assistive
|
|
40
165
|
* technologies to announce the divider correctly. Visual style is driven by
|
|
41
166
|
* CSS custom properties (`--cngx-divider-color`, `--cngx-divider-thickness`,
|
|
42
167
|
* `--cngx-divider-inset`). Consumers apply their own styles through
|
|
43
168
|
* `.cngx-divider` or override the variables.
|
|
169
|
+
*
|
|
170
|
+
* @category common/display
|
|
171
|
+
* @docsKind primary
|
|
172
|
+
* @wcag AA
|
|
173
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/divider/divider.directive.ts
|
|
174
|
+
* @selector cngx-divider
|
|
175
|
+
* @since 0.1.0
|
|
176
|
+
* <example-url>http://localhost:4200/#/common/display/divider/horizontal-vs-vertical</example-url>
|
|
177
|
+
* <example-url>http://localhost:4200/#/common/display/divider/inset</example-url>
|
|
44
178
|
*/
|
|
45
179
|
class CngxDivider {
|
|
46
180
|
/** Layout axis. Horizontal dividers sit between rows; vertical between columns. */
|
|
@@ -72,10 +206,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
72
206
|
* Rendering cascade:
|
|
73
207
|
* 1. Image (`src` set and not errored).
|
|
74
208
|
* 2. Initials (`initials` set).
|
|
75
|
-
* 3. Projected content (`<ng-content>`)
|
|
209
|
+
* 3. Projected content (`<ng-content>`) - typically a `<cngx-icon>`.
|
|
76
210
|
*
|
|
77
211
|
* Optional status indicator dot via `status`. Size and shape driven by
|
|
78
212
|
* CSS custom properties.
|
|
213
|
+
*
|
|
214
|
+
* @category common/display
|
|
215
|
+
* @docsKind primary
|
|
216
|
+
* @wcag AA
|
|
217
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/avatar/avatar.component.ts
|
|
218
|
+
* @since 0.1.0
|
|
219
|
+
* @relatedTo CngxIcon, CngxBadge, CngxChip
|
|
220
|
+
* <example-url>http://localhost:4200/#/common/display/avatar/cascade-image-initials-fallback</example-url>
|
|
221
|
+
* <example-url>http://localhost:4200/#/common/display/avatar/shapes-and-status</example-url>
|
|
222
|
+
* <example-url>http://localhost:4200/#/common/display/avatar/sizes</example-url>
|
|
79
223
|
*/
|
|
80
224
|
class CngxAvatar {
|
|
81
225
|
/** Image URL. When set and loads successfully, the image is shown. */
|
|
@@ -131,11 +275,11 @@ class CngxAvatar {
|
|
|
131
275
|
[attr.aria-label]="status()"
|
|
132
276
|
></span>
|
|
133
277
|
}
|
|
134
|
-
`, isInline: true, styles: [":
|
|
278
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-avatar-size{syntax: \"*\"; inherits: false; initial-value: 2.5rem;}@property --cngx-avatar-font-size{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-avatar-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .01 240);}@property --cngx-avatar-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.28 0 0);}@property --cngx-avatar-circle-radius{syntax: \"<length>\"; inherits: false; initial-value: 999px;}@property --cngx-avatar-square-radius{syntax: \"<length>\"; inherits: false; initial-value: 6px;}@property --cngx-avatar-size-xs{syntax: \"*\"; inherits: false; initial-value: 1.5rem;}@property --cngx-avatar-size-sm{syntax: \"*\"; inherits: false; initial-value: 2rem;}@property --cngx-avatar-size-md{syntax: \"*\"; inherits: false; initial-value: 2.5rem;}@property --cngx-avatar-size-lg{syntax: \"*\"; inherits: false; initial-value: 3rem;}@property --cngx-avatar-size-xl{syntax: \"*\"; inherits: false; initial-value: 4rem;}@property --cngx-avatar-font-size-xs{syntax: \"*\"; inherits: false; initial-value: .625rem;}@property --cngx-avatar-font-size-sm{syntax: \"*\"; inherits: false; initial-value: .75rem;}@property --cngx-avatar-font-size-md{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-avatar-font-size-lg{syntax: \"*\"; inherits: false; initial-value: 1.125rem;}@property --cngx-avatar-font-size-xl{syntax: \"*\"; inherits: false; initial-value: 1.5rem;}@property --cngx-avatar-status-size{syntax: \"*\"; inherits: false; initial-value: .65em;}@property --cngx-avatar-status-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-avatar-status-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.68 .01 240);}@property --cngx-avatar-status-online{syntax: \"<color>\"; inherits: true; initial-value: oklch(.68 .18 145);}@property --cngx-avatar-status-offline{syntax: \"<color>\"; inherits: true; initial-value: oklch(.68 .01 240);}@property --cngx-avatar-status-busy{syntax: \"<color>\"; inherits: true; initial-value: oklch(.62 .22 25);}@property --cngx-avatar-status-away{syntax: \"<color>\"; inherits: true; initial-value: oklch(.72 .18 70);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-avatar-bg: oklch(.36 .01 250);--cngx-avatar-color: oklch(.92 .01 250);--cngx-avatar-status-border: oklch(.2 .01 250)}}[data-color-scheme=dark],.dark{--cngx-avatar-bg: oklch(.36 .01 250);--cngx-avatar-color: oklch(.92 .01 250);--cngx-avatar-status-border: oklch(.2 .01 250)}[data-color-scheme=light],.light{--cngx-avatar-bg: oklch(.92 .01 240);--cngx-avatar-color: oklch(.28 0 0);--cngx-avatar-status-border: oklch(1 0 0)}}@layer cngx.components{@scope(.cngx-avatar){:scope{display:inline-flex;align-items:center;justify-content:center;position:relative;flex:0 0 auto;-webkit-user-select:none;user-select:none;overflow:visible;line-height:1;font-weight:600;width:var(--cngx-avatar-size, var(--cngx-avatar-size-md, 2.5rem));height:var(--cngx-avatar-size, var(--cngx-avatar-size-md, 2.5rem));font-size:var(--cngx-avatar-font-size, var(--cngx-avatar-font-size-md, 1rem));background:var(--cngx-avatar-bg, var(--cngx-color-border, oklch(.92 .01 240)));color:var(--cngx-avatar-color, var(--cngx-color-text, oklch(.28 0 0)))}:scope.cngx-avatar--circle{border-radius:var(--cngx-avatar-circle-radius, var(--cngx-radius-pill, 999px))}:scope.cngx-avatar--square{border-radius:var(--cngx-avatar-square-radius, 6px)}:scope.cngx-avatar--xs{--cngx-avatar-size: var(--cngx-avatar-size-xs, 1.5rem);--cngx-avatar-font-size: var(--cngx-avatar-font-size-xs, .625rem)}:scope.cngx-avatar--sm{--cngx-avatar-size: var(--cngx-avatar-size-sm, 2rem);--cngx-avatar-font-size: var(--cngx-avatar-font-size-sm, .75rem)}:scope.cngx-avatar--md{--cngx-avatar-size: var(--cngx-avatar-size-md, 2.5rem);--cngx-avatar-font-size: var(--cngx-avatar-font-size-md, 1rem)}:scope.cngx-avatar--lg{--cngx-avatar-size: var(--cngx-avatar-size-lg, 3rem);--cngx-avatar-font-size: var(--cngx-avatar-font-size-lg, 1.125rem)}:scope.cngx-avatar--xl{--cngx-avatar-size: var(--cngx-avatar-size-xl, 4rem);--cngx-avatar-font-size: var(--cngx-avatar-font-size-xl, 1.5rem)}.cngx-avatar__img{width:100%;height:100%;object-fit:cover;border-radius:inherit}.cngx-avatar__initials{text-transform:uppercase}.cngx-avatar__status{position:absolute;right:-2px;bottom:-2px;width:var(--cngx-avatar-status-size, .65em);height:var(--cngx-avatar-status-size, .65em);border-radius:var(--cngx-radius-pill, 999px);border:2px solid var(--cngx-avatar-status-border, var(--cngx-color-surface, oklch(1 0 0)));background:var(--cngx-avatar-status-bg, oklch(.68 .01 240))}.cngx-avatar__status--online{background:var(--cngx-avatar-status-online, var(--cngx-color-success, oklch(.68 .18 145)))}.cngx-avatar__status--offline{background:var(--cngx-avatar-status-offline, oklch(.68 .01 240))}.cngx-avatar__status--busy{background:var(--cngx-avatar-status-busy, var(--cngx-color-danger, oklch(.62 .22 25)))}.cngx-avatar__status--away{background:var(--cngx-avatar-status-away, var(--cngx-color-warning, oklch(.72 .18 70)))}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
135
279
|
}
|
|
136
280
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxAvatar, decorators: [{
|
|
137
281
|
type: Component,
|
|
138
|
-
args: [{ selector: 'cngx-avatar', exportAs: 'cngxAvatar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
282
|
+
args: [{ selector: 'cngx-avatar', exportAs: 'cngxAvatar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
139
283
|
class: 'cngx-avatar',
|
|
140
284
|
'[class.cngx-avatar--xs]': 'size() === "xs"',
|
|
141
285
|
'[class.cngx-avatar--sm]': 'size() === "sm"',
|
|
@@ -168,18 +312,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
168
312
|
[attr.aria-label]="status()"
|
|
169
313
|
></span>
|
|
170
314
|
}
|
|
171
|
-
`, styles: [":
|
|
315
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-avatar-size{syntax: \"*\"; inherits: false; initial-value: 2.5rem;}@property --cngx-avatar-font-size{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-avatar-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .01 240);}@property --cngx-avatar-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.28 0 0);}@property --cngx-avatar-circle-radius{syntax: \"<length>\"; inherits: false; initial-value: 999px;}@property --cngx-avatar-square-radius{syntax: \"<length>\"; inherits: false; initial-value: 6px;}@property --cngx-avatar-size-xs{syntax: \"*\"; inherits: false; initial-value: 1.5rem;}@property --cngx-avatar-size-sm{syntax: \"*\"; inherits: false; initial-value: 2rem;}@property --cngx-avatar-size-md{syntax: \"*\"; inherits: false; initial-value: 2.5rem;}@property --cngx-avatar-size-lg{syntax: \"*\"; inherits: false; initial-value: 3rem;}@property --cngx-avatar-size-xl{syntax: \"*\"; inherits: false; initial-value: 4rem;}@property --cngx-avatar-font-size-xs{syntax: \"*\"; inherits: false; initial-value: .625rem;}@property --cngx-avatar-font-size-sm{syntax: \"*\"; inherits: false; initial-value: .75rem;}@property --cngx-avatar-font-size-md{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-avatar-font-size-lg{syntax: \"*\"; inherits: false; initial-value: 1.125rem;}@property --cngx-avatar-font-size-xl{syntax: \"*\"; inherits: false; initial-value: 1.5rem;}@property --cngx-avatar-status-size{syntax: \"*\"; inherits: false; initial-value: .65em;}@property --cngx-avatar-status-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-avatar-status-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.68 .01 240);}@property --cngx-avatar-status-online{syntax: \"<color>\"; inherits: true; initial-value: oklch(.68 .18 145);}@property --cngx-avatar-status-offline{syntax: \"<color>\"; inherits: true; initial-value: oklch(.68 .01 240);}@property --cngx-avatar-status-busy{syntax: \"<color>\"; inherits: true; initial-value: oklch(.62 .22 25);}@property --cngx-avatar-status-away{syntax: \"<color>\"; inherits: true; initial-value: oklch(.72 .18 70);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-avatar-bg: oklch(.36 .01 250);--cngx-avatar-color: oklch(.92 .01 250);--cngx-avatar-status-border: oklch(.2 .01 250)}}[data-color-scheme=dark],.dark{--cngx-avatar-bg: oklch(.36 .01 250);--cngx-avatar-color: oklch(.92 .01 250);--cngx-avatar-status-border: oklch(.2 .01 250)}[data-color-scheme=light],.light{--cngx-avatar-bg: oklch(.92 .01 240);--cngx-avatar-color: oklch(.28 0 0);--cngx-avatar-status-border: oklch(1 0 0)}}@layer cngx.components{@scope(.cngx-avatar){:scope{display:inline-flex;align-items:center;justify-content:center;position:relative;flex:0 0 auto;-webkit-user-select:none;user-select:none;overflow:visible;line-height:1;font-weight:600;width:var(--cngx-avatar-size, var(--cngx-avatar-size-md, 2.5rem));height:var(--cngx-avatar-size, var(--cngx-avatar-size-md, 2.5rem));font-size:var(--cngx-avatar-font-size, var(--cngx-avatar-font-size-md, 1rem));background:var(--cngx-avatar-bg, var(--cngx-color-border, oklch(.92 .01 240)));color:var(--cngx-avatar-color, var(--cngx-color-text, oklch(.28 0 0)))}:scope.cngx-avatar--circle{border-radius:var(--cngx-avatar-circle-radius, var(--cngx-radius-pill, 999px))}:scope.cngx-avatar--square{border-radius:var(--cngx-avatar-square-radius, 6px)}:scope.cngx-avatar--xs{--cngx-avatar-size: var(--cngx-avatar-size-xs, 1.5rem);--cngx-avatar-font-size: var(--cngx-avatar-font-size-xs, .625rem)}:scope.cngx-avatar--sm{--cngx-avatar-size: var(--cngx-avatar-size-sm, 2rem);--cngx-avatar-font-size: var(--cngx-avatar-font-size-sm, .75rem)}:scope.cngx-avatar--md{--cngx-avatar-size: var(--cngx-avatar-size-md, 2.5rem);--cngx-avatar-font-size: var(--cngx-avatar-font-size-md, 1rem)}:scope.cngx-avatar--lg{--cngx-avatar-size: var(--cngx-avatar-size-lg, 3rem);--cngx-avatar-font-size: var(--cngx-avatar-font-size-lg, 1.125rem)}:scope.cngx-avatar--xl{--cngx-avatar-size: var(--cngx-avatar-size-xl, 4rem);--cngx-avatar-font-size: var(--cngx-avatar-font-size-xl, 1.5rem)}.cngx-avatar__img{width:100%;height:100%;object-fit:cover;border-radius:inherit}.cngx-avatar__initials{text-transform:uppercase}.cngx-avatar__status{position:absolute;right:-2px;bottom:-2px;width:var(--cngx-avatar-status-size, .65em);height:var(--cngx-avatar-status-size, .65em);border-radius:var(--cngx-radius-pill, 999px);border:2px solid var(--cngx-avatar-status-border, var(--cngx-color-surface, oklch(1 0 0)));background:var(--cngx-avatar-status-bg, oklch(.68 .01 240))}.cngx-avatar__status--online{background:var(--cngx-avatar-status-online, var(--cngx-color-success, oklch(.68 .18 145)))}.cngx-avatar__status--offline{background:var(--cngx-avatar-status-offline, oklch(.68 .01 240))}.cngx-avatar__status--busy{background:var(--cngx-avatar-status-busy, var(--cngx-color-danger, oklch(.62 .22 25)))}.cngx-avatar__status--away{background:var(--cngx-avatar-status-away, var(--cngx-color-warning, oklch(.72 .18 70)))}}}\n"] }]
|
|
172
316
|
}], propDecorators: { src: [{ type: i0.Input, args: [{ isSignal: true, alias: "src", required: false }] }], alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "alt", required: false }] }], initials: [{ type: i0.Input, args: [{ isSignal: true, alias: "initials", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], shape: [{ type: i0.Input, args: [{ isSignal: true, alias: "shape", required: false }] }], status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }] } });
|
|
173
317
|
|
|
174
318
|
/**
|
|
175
319
|
* Generic counter / dot indicator that attaches a small floating element to
|
|
176
|
-
* any host. Purely presentational (`aria-hidden="true"`)
|
|
320
|
+
* any host. Purely presentational (`aria-hidden="true"`) - semantic meaning
|
|
177
321
|
* must live on the host (`aria-label`).
|
|
178
322
|
*
|
|
179
323
|
* Supports:
|
|
180
324
|
* - Numeric values (capped by `max` with "N+" fallback)
|
|
181
325
|
* - String values (rendered verbatim)
|
|
182
326
|
* - Boolean `true` (dot mode, no text)
|
|
327
|
+
*
|
|
328
|
+
* @category common/display
|
|
329
|
+
* @docsKind primary
|
|
330
|
+
* @wcag AA
|
|
331
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/badge/badge.directive.ts
|
|
332
|
+
* @since 0.1.0
|
|
333
|
+
* @relatedTo CngxAvatar, CngxIcon, CngxChip
|
|
334
|
+
* <example-url>http://localhost:4200/#/common/display/badge/colors-and-dot-mode</example-url>
|
|
335
|
+
* <example-url>http://localhost:4200/#/common/display/badge/counts-with-overflow</example-url>
|
|
336
|
+
* <example-url>http://localhost:4200/#/common/display/badge/inline-and-hidden</example-url>
|
|
183
337
|
*/
|
|
184
338
|
class CngxBadge {
|
|
185
339
|
/** Raw value. Numbers show as text (respecting `max`); booleans flip dot mode; strings render verbatim. */
|
|
@@ -190,7 +344,7 @@ class CngxBadge {
|
|
|
190
344
|
position = input('above-end', ...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
191
345
|
/** Whether the indicator is hidden regardless of value. */
|
|
192
346
|
hidden = input(false, ...(ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []));
|
|
193
|
-
/** Cap for numeric values
|
|
347
|
+
/** Cap for numeric values - anything over renders as `"{max}+"`. */
|
|
194
348
|
max = input(99, ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
195
349
|
hostEl = inject((ElementRef));
|
|
196
350
|
renderer = inject(Renderer2);
|
|
@@ -310,7 +464,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
310
464
|
}], ctorParameters: () => [], propDecorators: { cngxBadge: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxBadge", required: true }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }] } });
|
|
311
465
|
|
|
312
466
|
/**
|
|
313
|
-
* Chip / tag molecule
|
|
467
|
+
* Chip / tag molecule - a small, self-contained pill rendering projected
|
|
314
468
|
* content plus an optional close affordance.
|
|
315
469
|
*
|
|
316
470
|
* **Why this exists.**
|
|
@@ -329,14 +483,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
329
483
|
* consumer-supplied).
|
|
330
484
|
*
|
|
331
485
|
* **Non-responsibilities.**
|
|
332
|
-
* - Selection state
|
|
333
|
-
* - Commit/async behaviour
|
|
486
|
+
* - Selection state - parent tracks which value(s) are picked.
|
|
487
|
+
* - Commit/async behaviour - remove simply fires an event; the parent
|
|
334
488
|
* decides whether to write state directly or route through a commit
|
|
335
489
|
* flow. This keeps the chip usable from any level of the stack.
|
|
490
|
+
*
|
|
491
|
+
* @category common/display
|
|
492
|
+
* @docsKind primary
|
|
493
|
+
* @wcag AA
|
|
494
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/chip/chip.component.ts
|
|
495
|
+
* @since 0.1.0
|
|
496
|
+
* @relatedTo CngxTag, CngxTagGroup, CngxBadge
|
|
497
|
+
* <example-url>http://localhost:4200/#/common/display/chip/basic</example-url>
|
|
498
|
+
* <example-url>http://localhost:4200/#/common/display/chip/removable</example-url>
|
|
499
|
+
* <example-url>http://localhost:4200/#/common/display/chip/color-palette</example-url>
|
|
500
|
+
* <example-url>http://localhost:4200/#/common/display/chip/custom-close-icon</example-url>
|
|
501
|
+
* <example-url>http://localhost:4200/#/common/interactive/chip/group/basic-pick-exactly-one-size</example-url>
|
|
502
|
+
* <example-url>http://localhost:4200/#/common/interactive/chip/interaction/basic-toggle-on-click-space-or-enter</example-url>
|
|
503
|
+
* <example-url>http://localhost:4200/#/common/interactive/chip/interaction/disabled-state</example-url>
|
|
504
|
+
* <example-url>http://localhost:4200/#/common/interactive/chip/interaction/removable-with-removerequest-on-backspace-delete</example-url>
|
|
505
|
+
* <example-url>http://localhost:4200/#/common/interactive/chip/multi-group/multi-select-chips-with-selection-count</example-url>
|
|
336
506
|
*/
|
|
337
507
|
class CngxChip {
|
|
338
508
|
/**
|
|
339
|
-
* Whether the close button is rendered. Typed as `boolean`
|
|
509
|
+
* Whether the close button is rendered. Typed as `boolean` - bind a
|
|
340
510
|
* signal getter (`[removable]="!select.disabled()"`) if the flag
|
|
341
511
|
* needs to react to upstream state.
|
|
342
512
|
*/
|
|
@@ -357,9 +527,9 @@ class CngxChip {
|
|
|
357
527
|
/** Fires when the user clicks the close button. */
|
|
358
528
|
remove = output();
|
|
359
529
|
autoId = nextUid('cngx-chip');
|
|
360
|
-
/** @internal
|
|
530
|
+
/** @internal - resolved DOM id for host binding. */
|
|
361
531
|
resolvedId = computed(() => this.id() ?? this.autoId, ...(ngDevMode ? [{ debugName: "resolvedId" }] : /* istanbul ignore next */ []));
|
|
362
|
-
/** @internal
|
|
532
|
+
/** @internal - delegates to the output; kept as a method so the click handler stays in the template. */
|
|
363
533
|
handleRemoveClick(event) {
|
|
364
534
|
this.remove.emit(event);
|
|
365
535
|
}
|
|
@@ -377,7 +547,7 @@ class CngxChip {
|
|
|
377
547
|
>
|
|
378
548
|
<!--
|
|
379
549
|
Named content slot for the close glyph. Default renders the
|
|
380
|
-
library's ×
|
|
550
|
+
library's × - consumers project any icon component by tagging
|
|
381
551
|
it with the attribute:
|
|
382
552
|
|
|
383
553
|
<cngx-chip [removable]="true">
|
|
@@ -394,11 +564,11 @@ class CngxChip {
|
|
|
394
564
|
</ng-content>
|
|
395
565
|
</button>
|
|
396
566
|
}
|
|
397
|
-
`, isInline: true, styles: [":
|
|
567
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chip-inner-gap{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-chip-padding-block{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-chip-padding-inline{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-chip-radius{syntax: \"<length>\"; inherits: false; initial-value: 999px;}@property --cngx-chip-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50 / .12);}@property --cngx-chip-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-chip-border{syntax: \"*\"; inherits: false; initial-value: 0 solid transparent;}@property --cngx-chip-font-size{syntax: \"*\"; inherits: false; initial-value: .875em;}@property --cngx-chip-transition{syntax: \"*\"; inherits: false; initial-value: background-color .15s ease,color .15s ease,border-color .15s ease;}@property --cngx-chip-hover-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50 / .2);}@property --cngx-chip-hover-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-chip-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid oklch(.66 .19 50);}@property --cngx-chip-focus-outline-offset{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-chip-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .38;}@property --cngx-chip-selected-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50 / .32);}@property --cngx-chip-selected-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-chip-info-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .12 240 / .16);}@property --cngx-chip-info-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.45 .12 240);}@property --cngx-chip-success-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .15 145 / .16);}@property --cngx-chip-success-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.45 .15 145);}@property --cngx-chip-warning-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.72 .15 75 / .18);}@property --cngx-chip-warning-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .15 75);}@property --cngx-chip-danger-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .22 25 / .18);}@property --cngx-chip-danger-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .2 25);}@property --cngx-chip-remove-opacity{syntax: \"<number>\"; inherits: false; initial-value: .7;}@property --cngx-chip-remove-opacity-hover{syntax: \"<number>\"; inherits: false; initial-value: 1;}@property --cngx-chip-remove-radius{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-chip-remove-focus-width{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-chip-remove-focus-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chip-remove-focus-offset{syntax: \"<length>\"; inherits: false; initial-value: 1px;}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-chip-info-color: oklch(.85 .13 250);--cngx-chip-success-color: oklch(.85 .13 145);--cngx-chip-warning-color: oklch(.88 .14 75);--cngx-chip-danger-color: oklch(.82 .15 25)}}[data-color-scheme=dark],.dark{--cngx-chip-info-color: oklch(.85 .13 250);--cngx-chip-success-color: oklch(.85 .13 145);--cngx-chip-warning-color: oklch(.88 .14 75);--cngx-chip-danger-color: oklch(.82 .15 25)}[data-color-scheme=light],.light{--cngx-chip-info-color: oklch(.45 .12 240);--cngx-chip-success-color: oklch(.45 .15 145);--cngx-chip-warning-color: oklch(.5 .15 75);--cngx-chip-danger-color: oklch(.5 .2 25)}}@layer cngx.components{@scope(.cngx-chip){:scope{display:inline-flex;align-items:center;line-height:1.25;max-width:100%;box-sizing:border-box;gap:var(--cngx-chip-inner-gap, var(--cngx-space-xs, 4px));padding-block:var(--cngx-chip-padding-block, 2px);padding-inline:var(--cngx-chip-padding-inline, var(--cngx-space-sm, 8px));border-radius:var(--cngx-chip-radius, var(--cngx-radius-pill, 999px));background:var(--cngx-chip-bg, oklch(.66 .19 50 / .12));color:var(--cngx-chip-color, inherit);border:var(--cngx-chip-border, 0 solid transparent);font-size:var(--cngx-chip-font-size, var(--cngx-font-size-sm, .8125rem));transition:var( --cngx-chip-transition, background-color .15s ease, color .15s ease, border-color .15s ease )}:scope[role=button],:scope[tabindex],:scope:has(.cngx-chip__remove){cursor:pointer}:scope[role=button]:hover,:scope[tabindex]:hover,:scope:has(.cngx-chip__remove):hover{background:var(--cngx-chip-hover-bg, oklch(.66 .19 50 / .2));color:var(--cngx-chip-hover-color, inherit)}:scope:focus-visible{outline:var( --cngx-chip-focus-outline, 2px solid var(--cngx-color-primary, oklch(.66 .19 50)) );outline-offset:var(--cngx-chip-focus-outline-offset, 2px)}:scope[aria-selected=true],:scope[aria-pressed=true]{background:var(--cngx-chip-selected-bg, oklch(.66 .19 50 / .32));color:var(--cngx-chip-selected-color, inherit)}:scope[aria-disabled=true],:scope:disabled{opacity:var(--cngx-chip-disabled-opacity, .38);cursor:not-allowed;pointer-events:none}:scope[data-color=info]{background:var(--cngx-chip-info-bg);color:var(--cngx-chip-info-color)}:scope[data-color=success]{background:var(--cngx-chip-success-bg);color:var(--cngx-chip-success-color)}:scope[data-color=warning]{background:var(--cngx-chip-warning-bg);color:var(--cngx-chip-warning-color)}:scope[data-color=danger]{background:var(--cngx-chip-danger-bg);color:var(--cngx-chip-danger-color)}.cngx-chip__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.cngx-chip__remove{appearance:none;border:0;background:transparent;color:inherit;cursor:pointer;padding:0 2px;font:inherit;line-height:1;flex:0 0 auto;opacity:var(--cngx-chip-remove-opacity, .7);border-radius:var(--cngx-chip-remove-radius, var(--cngx-radius-sm, 2px))}.cngx-chip__remove:hover{opacity:var(--cngx-chip-remove-opacity-hover, 1)}.cngx-chip__remove:focus-visible{outline:var(--cngx-chip-remove-focus-width, 2px) solid var(--cngx-chip-remove-focus-color, var(--cngx-color-primary, oklch(.66 .19 50)));outline-offset:var(--cngx-chip-remove-focus-offset, 1px)}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
398
568
|
}
|
|
399
569
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChip, decorators: [{
|
|
400
570
|
type: Component,
|
|
401
|
-
args: [{ selector: 'cngx-chip', exportAs: 'cngxChip', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
571
|
+
args: [{ selector: 'cngx-chip', exportAs: 'cngxChip', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
402
572
|
class: 'cngx-chip',
|
|
403
573
|
'[attr.id]': 'resolvedId()',
|
|
404
574
|
}, template: `
|
|
@@ -414,7 +584,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
414
584
|
>
|
|
415
585
|
<!--
|
|
416
586
|
Named content slot for the close glyph. Default renders the
|
|
417
|
-
library's ×
|
|
587
|
+
library's × - consumers project any icon component by tagging
|
|
418
588
|
it with the attribute:
|
|
419
589
|
|
|
420
590
|
<cngx-chip [removable]="true">
|
|
@@ -431,7 +601,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
431
601
|
</ng-content>
|
|
432
602
|
</button>
|
|
433
603
|
}
|
|
434
|
-
`, styles: [":
|
|
604
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chip-inner-gap{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-chip-padding-block{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-chip-padding-inline{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-chip-radius{syntax: \"<length>\"; inherits: false; initial-value: 999px;}@property --cngx-chip-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50 / .12);}@property --cngx-chip-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-chip-border{syntax: \"*\"; inherits: false; initial-value: 0 solid transparent;}@property --cngx-chip-font-size{syntax: \"*\"; inherits: false; initial-value: .875em;}@property --cngx-chip-transition{syntax: \"*\"; inherits: false; initial-value: background-color .15s ease,color .15s ease,border-color .15s ease;}@property --cngx-chip-hover-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50 / .2);}@property --cngx-chip-hover-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-chip-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid oklch(.66 .19 50);}@property --cngx-chip-focus-outline-offset{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-chip-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .38;}@property --cngx-chip-selected-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50 / .32);}@property --cngx-chip-selected-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-chip-info-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .12 240 / .16);}@property --cngx-chip-info-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.45 .12 240);}@property --cngx-chip-success-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .15 145 / .16);}@property --cngx-chip-success-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.45 .15 145);}@property --cngx-chip-warning-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.72 .15 75 / .18);}@property --cngx-chip-warning-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .15 75);}@property --cngx-chip-danger-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .22 25 / .18);}@property --cngx-chip-danger-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .2 25);}@property --cngx-chip-remove-opacity{syntax: \"<number>\"; inherits: false; initial-value: .7;}@property --cngx-chip-remove-opacity-hover{syntax: \"<number>\"; inherits: false; initial-value: 1;}@property --cngx-chip-remove-radius{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-chip-remove-focus-width{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-chip-remove-focus-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chip-remove-focus-offset{syntax: \"<length>\"; inherits: false; initial-value: 1px;}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-chip-info-color: oklch(.85 .13 250);--cngx-chip-success-color: oklch(.85 .13 145);--cngx-chip-warning-color: oklch(.88 .14 75);--cngx-chip-danger-color: oklch(.82 .15 25)}}[data-color-scheme=dark],.dark{--cngx-chip-info-color: oklch(.85 .13 250);--cngx-chip-success-color: oklch(.85 .13 145);--cngx-chip-warning-color: oklch(.88 .14 75);--cngx-chip-danger-color: oklch(.82 .15 25)}[data-color-scheme=light],.light{--cngx-chip-info-color: oklch(.45 .12 240);--cngx-chip-success-color: oklch(.45 .15 145);--cngx-chip-warning-color: oklch(.5 .15 75);--cngx-chip-danger-color: oklch(.5 .2 25)}}@layer cngx.components{@scope(.cngx-chip){:scope{display:inline-flex;align-items:center;line-height:1.25;max-width:100%;box-sizing:border-box;gap:var(--cngx-chip-inner-gap, var(--cngx-space-xs, 4px));padding-block:var(--cngx-chip-padding-block, 2px);padding-inline:var(--cngx-chip-padding-inline, var(--cngx-space-sm, 8px));border-radius:var(--cngx-chip-radius, var(--cngx-radius-pill, 999px));background:var(--cngx-chip-bg, oklch(.66 .19 50 / .12));color:var(--cngx-chip-color, inherit);border:var(--cngx-chip-border, 0 solid transparent);font-size:var(--cngx-chip-font-size, var(--cngx-font-size-sm, .8125rem));transition:var( --cngx-chip-transition, background-color .15s ease, color .15s ease, border-color .15s ease )}:scope[role=button],:scope[tabindex],:scope:has(.cngx-chip__remove){cursor:pointer}:scope[role=button]:hover,:scope[tabindex]:hover,:scope:has(.cngx-chip__remove):hover{background:var(--cngx-chip-hover-bg, oklch(.66 .19 50 / .2));color:var(--cngx-chip-hover-color, inherit)}:scope:focus-visible{outline:var( --cngx-chip-focus-outline, 2px solid var(--cngx-color-primary, oklch(.66 .19 50)) );outline-offset:var(--cngx-chip-focus-outline-offset, 2px)}:scope[aria-selected=true],:scope[aria-pressed=true]{background:var(--cngx-chip-selected-bg, oklch(.66 .19 50 / .32));color:var(--cngx-chip-selected-color, inherit)}:scope[aria-disabled=true],:scope:disabled{opacity:var(--cngx-chip-disabled-opacity, .38);cursor:not-allowed;pointer-events:none}:scope[data-color=info]{background:var(--cngx-chip-info-bg);color:var(--cngx-chip-info-color)}:scope[data-color=success]{background:var(--cngx-chip-success-bg);color:var(--cngx-chip-success-color)}:scope[data-color=warning]{background:var(--cngx-chip-warning-bg);color:var(--cngx-chip-warning-color)}:scope[data-color=danger]{background:var(--cngx-chip-danger-bg);color:var(--cngx-chip-danger-color)}.cngx-chip__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.cngx-chip__remove{appearance:none;border:0;background:transparent;color:inherit;cursor:pointer;padding:0 2px;font:inherit;line-height:1;flex:0 0 auto;opacity:var(--cngx-chip-remove-opacity, .7);border-radius:var(--cngx-chip-remove-radius, var(--cngx-radius-sm, 2px))}.cngx-chip__remove:hover{opacity:var(--cngx-chip-remove-opacity-hover, 1)}.cngx-chip__remove:focus-visible{outline:var(--cngx-chip-remove-focus-width, 2px) solid var(--cngx-chip-remove-focus-color, var(--cngx-color-primary, oklch(.66 .19 50)));outline-offset:var(--cngx-chip-remove-focus-offset, 1px)}}}\n"] }]
|
|
435
605
|
}], propDecorators: { removable: [{ type: i0.Input, args: [{ isSignal: true, alias: "removable", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], removeAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "removeAriaLabel", required: false }] }], remove: [{ type: i0.Output, args: ["remove"] }] } });
|
|
436
606
|
|
|
437
607
|
/**
|
|
@@ -443,7 +613,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
443
613
|
* a future grid/tree cell will want a checkbox with indeterminate state, and
|
|
444
614
|
* `ng decompose cngx-*` schematics should emit a consistent indicator shape
|
|
445
615
|
* regardless of which list-like component they originated from. This atom
|
|
446
|
-
* unifies all three surfaces behind a single presentational molecule
|
|
616
|
+
* unifies all three surfaces behind a single presentational molecule -
|
|
447
617
|
* purely decorative (`aria-hidden="true"`), zero outputs, two variants,
|
|
448
618
|
* full `--cngx-checkbox-*` theming.
|
|
449
619
|
*
|
|
@@ -454,32 +624,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
454
624
|
* - Apply size presets (`sm` / `md` / `lg`) as CSS-custom-property modifiers.
|
|
455
625
|
*
|
|
456
626
|
* **Non-responsibilities.**
|
|
457
|
-
* - Selection state
|
|
627
|
+
* - Selection state - controlled entirely by the parent via `checked` /
|
|
458
628
|
* `indeterminate` inputs.
|
|
459
|
-
* - Interaction
|
|
629
|
+
* - Interaction - no `click` output, no keyboard handling. The parent (option
|
|
460
630
|
* row, tree cell, grid row) owns the hit area and toggle semantics.
|
|
461
|
-
* - Accessibility announcements
|
|
631
|
+
* - Accessibility announcements - `aria-hidden="true"` unconditionally. The
|
|
462
632
|
* truth about "selected" is communicated by the row's own `aria-selected`
|
|
463
633
|
* / `role="option"` ARIA, not by this decoration.
|
|
634
|
+
*
|
|
635
|
+
* @category common/display
|
|
636
|
+
* @docsKind primary
|
|
637
|
+
* @wcag AA
|
|
638
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/checkbox-indicator/checkbox-indicator.component.ts
|
|
639
|
+
* @since 0.1.0
|
|
640
|
+
* @relatedTo CngxRadioIndicator, CngxIcon
|
|
641
|
+
* <example-url>http://localhost:4200/#/common/display/checkbox-indicator/states</example-url>
|
|
642
|
+
* <example-url>http://localhost:4200/#/common/display/checkbox-indicator/variant-matrix</example-url>
|
|
643
|
+
* <example-url>http://localhost:4200/#/common/display/checkbox-indicator/sizes</example-url>
|
|
644
|
+
* <example-url>http://localhost:4200/#/common/display/checkbox-indicator/custom-glyph</example-url>
|
|
464
645
|
*/
|
|
465
646
|
class CngxCheckboxIndicator {
|
|
466
647
|
/**
|
|
467
648
|
* Visual form. `'checkbox'` renders a bordered box containing the glyph;
|
|
468
649
|
* `'checkmark'` renders the bare glyph only (no box). Consumers pick the
|
|
469
|
-
* mode-appropriate form themselves
|
|
650
|
+
* mode-appropriate form themselves - `@cngx/forms/select` resolves it
|
|
470
651
|
* from its `selectionIndicatorVariant` config.
|
|
471
652
|
*/
|
|
472
653
|
variant = input('checkbox', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
473
654
|
/** Whether the current value is selected. */
|
|
474
655
|
checked = input(false, ...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
475
656
|
/**
|
|
476
|
-
* Partial-selection state. Takes precedence over `checked`
|
|
657
|
+
* Partial-selection state. Takes precedence over `checked` - when both
|
|
477
658
|
* are true, the dash glyph is rendered. Intended for tree / group rows
|
|
478
659
|
* where some-but-not-all descendants are selected.
|
|
479
660
|
*/
|
|
480
661
|
indeterminate = input(false, ...(ngDevMode ? [{ debugName: "indeterminate" }] : /* istanbul ignore next */ []));
|
|
481
662
|
/**
|
|
482
|
-
* Disabled visual state. Purely cosmetic (opacity dim)
|
|
663
|
+
* Disabled visual state. Purely cosmetic (opacity dim) - the indicator
|
|
483
664
|
* never intercepts events, so this is a hint, not a block.
|
|
484
665
|
*/
|
|
485
666
|
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
@@ -489,7 +670,7 @@ class CngxCheckboxIndicator {
|
|
|
489
670
|
* Consumer-supplied template for the check glyph. When `null` (default),
|
|
490
671
|
* the built-in `<span class="cngx-checkbox-indicator__check">✓</span>`
|
|
491
672
|
* is rendered. When set, the consumer template replaces the glyph span
|
|
492
|
-
* entirely
|
|
673
|
+
* entirely - the `__check` class is NOT applied to the custom content
|
|
493
674
|
* (consumers own the styling of their replacement).
|
|
494
675
|
*
|
|
495
676
|
* Convention-compatible with `*cngxSelectCheck` / `*cngxSelectOptionLabel`:
|
|
@@ -500,7 +681,7 @@ class CngxCheckboxIndicator {
|
|
|
500
681
|
checkGlyph = input(null, ...(ngDevMode ? [{ debugName: "checkGlyph" }] : /* istanbul ignore next */ []));
|
|
501
682
|
/**
|
|
502
683
|
* Consumer-supplied template for the indeterminate dash glyph. Mirrors
|
|
503
|
-
* {@link checkGlyph}
|
|
684
|
+
* {@link checkGlyph} - defaults to the built-in
|
|
504
685
|
* `<span class="cngx-checkbox-indicator__dash">−</span>`.
|
|
505
686
|
*/
|
|
506
687
|
dashGlyph = input(null, ...(ngDevMode ? [{ debugName: "dashGlyph" }] : /* istanbul ignore next */ []));
|
|
@@ -528,11 +709,11 @@ class CngxCheckboxIndicator {
|
|
|
528
709
|
<ng-container *ngTemplateOutlet="checkGlyph() ?? defaultCheckGlyph" />
|
|
529
710
|
}
|
|
530
711
|
}
|
|
531
|
-
`, isInline: true, styles: [":
|
|
712
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-checkbox-size{syntax: \"*\"; inherits: true; initial-value: 1em;}@property --cngx-checkbox-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-checkbox-bg{syntax: \"*\"; inherits: true; initial-value: transparent;}@property --cngx-checkbox-border{syntax: \"*\"; inherits: true; initial-value: 1.5px solid currentColor;}@property --cngx-checkbox-radius{syntax: \"<length>\"; inherits: true; initial-value: 2px;}@property --cngx-checkbox-checked-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-checkbox-checked-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-checkbox-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-checkbox-size-sm{syntax: \"*\"; inherits: true; initial-value: .875em;}@property --cngx-checkbox-size-md{syntax: \"*\"; inherits: true; initial-value: 1em;}@property --cngx-checkbox-size-lg{syntax: \"*\"; inherits: true; initial-value: 1.25em;}:root{--cngx-checkbox-checked-bg: var(--cngx-color-primary)}}@layer cngx.components{@scope(.cngx-checkbox-indicator){:scope{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;line-height:1;flex:0 0 auto;color:var(--cngx-checkbox-color, currentColor);width:var(--cngx-checkbox-size, 1em);height:var(--cngx-checkbox-size, 1em);box-sizing:border-box;overflow:hidden}:scope.cngx-checkbox-indicator--sm{--cngx-checkbox-size: var(--cngx-checkbox-size-sm, .875em)}:scope.cngx-checkbox-indicator--md{--cngx-checkbox-size: var(--cngx-checkbox-size-md, 1em)}:scope.cngx-checkbox-indicator--lg{--cngx-checkbox-size: var(--cngx-checkbox-size-lg, 1.25em)}.cngx-checkbox-indicator__box{display:inline-flex;align-items:center;justify-content:center;color:inherit;line-height:1;box-sizing:border-box;width:var(--cngx-checkbox-size, 1em);height:var(--cngx-checkbox-size, 1em);border:var(--cngx-checkbox-border, 1.5px solid currentColor);border-radius:var(--cngx-checkbox-radius, var(--cngx-radius-sm, 2px));background:var(--cngx-checkbox-bg, transparent)}:scope.cngx-checkbox-indicator--checked .cngx-checkbox-indicator__box,:scope.cngx-checkbox-indicator--indeterminate .cngx-checkbox-indicator__box{background:var(--cngx-checkbox-checked-bg, var(--cngx-color-primary, oklch(.66 .19 50)));border-color:var(--cngx-checkbox-checked-bg, var(--cngx-color-primary, oklch(.66 .19 50)));color:var(--cngx-checkbox-checked-color, oklch(1 0 0))}:scope.cngx-checkbox-indicator--disabled{opacity:var(--cngx-checkbox-disabled-opacity, .5)}.cngx-checkbox-indicator__check,.cngx-checkbox-indicator__dash{font-size:calc(var(--cngx-checkbox-size, 1em) * .75);line-height:1;font-weight:700;-webkit-user-select:none;user-select:none}:scope.cngx-checkbox-indicator--checkmark .cngx-checkbox-indicator__check,:scope.cngx-checkbox-indicator--checkmark .cngx-checkbox-indicator__dash{color:var(--cngx-checkbox-color, var(--cngx-color-primary, oklch(.66 .19 50)));font-size:var(--cngx-checkbox-size, 1em)}}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
532
713
|
}
|
|
533
714
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCheckboxIndicator, decorators: [{
|
|
534
715
|
type: Component,
|
|
535
|
-
args: [{ selector: 'cngx-checkbox-indicator', exportAs: 'cngxCheckboxIndicator', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet], host: {
|
|
716
|
+
args: [{ selector: 'cngx-checkbox-indicator', exportAs: 'cngxCheckboxIndicator', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [NgTemplateOutlet], host: {
|
|
536
717
|
class: 'cngx-checkbox-indicator',
|
|
537
718
|
'aria-hidden': 'true',
|
|
538
719
|
'[class.cngx-checkbox-indicator--checkbox]': "variant() === 'checkbox'",
|
|
@@ -566,19 +747,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
566
747
|
<ng-container *ngTemplateOutlet="checkGlyph() ?? defaultCheckGlyph" />
|
|
567
748
|
}
|
|
568
749
|
}
|
|
569
|
-
`, styles: [":
|
|
750
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-checkbox-size{syntax: \"*\"; inherits: true; initial-value: 1em;}@property --cngx-checkbox-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-checkbox-bg{syntax: \"*\"; inherits: true; initial-value: transparent;}@property --cngx-checkbox-border{syntax: \"*\"; inherits: true; initial-value: 1.5px solid currentColor;}@property --cngx-checkbox-radius{syntax: \"<length>\"; inherits: true; initial-value: 2px;}@property --cngx-checkbox-checked-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-checkbox-checked-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-checkbox-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-checkbox-size-sm{syntax: \"*\"; inherits: true; initial-value: .875em;}@property --cngx-checkbox-size-md{syntax: \"*\"; inherits: true; initial-value: 1em;}@property --cngx-checkbox-size-lg{syntax: \"*\"; inherits: true; initial-value: 1.25em;}:root{--cngx-checkbox-checked-bg: var(--cngx-color-primary)}}@layer cngx.components{@scope(.cngx-checkbox-indicator){:scope{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;line-height:1;flex:0 0 auto;color:var(--cngx-checkbox-color, currentColor);width:var(--cngx-checkbox-size, 1em);height:var(--cngx-checkbox-size, 1em);box-sizing:border-box;overflow:hidden}:scope.cngx-checkbox-indicator--sm{--cngx-checkbox-size: var(--cngx-checkbox-size-sm, .875em)}:scope.cngx-checkbox-indicator--md{--cngx-checkbox-size: var(--cngx-checkbox-size-md, 1em)}:scope.cngx-checkbox-indicator--lg{--cngx-checkbox-size: var(--cngx-checkbox-size-lg, 1.25em)}.cngx-checkbox-indicator__box{display:inline-flex;align-items:center;justify-content:center;color:inherit;line-height:1;box-sizing:border-box;width:var(--cngx-checkbox-size, 1em);height:var(--cngx-checkbox-size, 1em);border:var(--cngx-checkbox-border, 1.5px solid currentColor);border-radius:var(--cngx-checkbox-radius, var(--cngx-radius-sm, 2px));background:var(--cngx-checkbox-bg, transparent)}:scope.cngx-checkbox-indicator--checked .cngx-checkbox-indicator__box,:scope.cngx-checkbox-indicator--indeterminate .cngx-checkbox-indicator__box{background:var(--cngx-checkbox-checked-bg, var(--cngx-color-primary, oklch(.66 .19 50)));border-color:var(--cngx-checkbox-checked-bg, var(--cngx-color-primary, oklch(.66 .19 50)));color:var(--cngx-checkbox-checked-color, oklch(1 0 0))}:scope.cngx-checkbox-indicator--disabled{opacity:var(--cngx-checkbox-disabled-opacity, .5)}.cngx-checkbox-indicator__check,.cngx-checkbox-indicator__dash{font-size:calc(var(--cngx-checkbox-size, 1em) * .75);line-height:1;font-weight:700;-webkit-user-select:none;user-select:none}:scope.cngx-checkbox-indicator--checkmark .cngx-checkbox-indicator__check,:scope.cngx-checkbox-indicator--checkmark .cngx-checkbox-indicator__dash{color:var(--cngx-checkbox-color, var(--cngx-color-primary, oklch(.66 .19 50)));font-size:var(--cngx-checkbox-size, 1em)}}}\n"] }]
|
|
570
751
|
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], checkGlyph: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkGlyph", required: false }] }], dashGlyph: [{ type: i0.Input, args: [{ isSignal: true, alias: "dashGlyph", required: false }] }] } });
|
|
571
752
|
|
|
572
753
|
/**
|
|
573
|
-
* Presentational radio indicator
|
|
754
|
+
* Presentational radio indicator - circle with a centred dot when checked.
|
|
574
755
|
*
|
|
575
756
|
* **Why this exists.**
|
|
576
757
|
* The library's `@cngx/forms/select` panel currently composes
|
|
577
758
|
* {@link import('../checkbox-indicator/checkbox-indicator.component').CngxCheckboxIndicator}
|
|
578
759
|
* for both single-select (`'checkmark'`) and multi-select (`'checkbox'`)
|
|
579
760
|
* indicators. The form-primitives spec (Brain vs. Skin) introduces a
|
|
580
|
-
* radio variant
|
|
581
|
-
* panels
|
|
761
|
+
* radio variant - `selectionIndicatorVariant: 'radio'` for single-select
|
|
762
|
+
* panels - that needs the dot-in-circle visual independently of the
|
|
582
763
|
* box/checkmark shapes. This atom is the radio counterpart: same
|
|
583
764
|
* decorative-only contract, same `--cngx-*` theming surface, same
|
|
584
765
|
* `aria-hidden="true"` discipline. Future single-value form atoms in
|
|
@@ -590,24 +771,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
590
771
|
* - Express checked / disabled visual state via host classes the
|
|
591
772
|
* consumer (or upstream CSS) can theme.
|
|
592
773
|
* - Apply size presets (`sm` / `md` / `lg`) as CSS-custom-property
|
|
593
|
-
* modifiers
|
|
774
|
+
* modifiers - same scale token as `CngxCheckboxIndicator` so the
|
|
594
775
|
* two atoms render at matching sizes inside a select panel.
|
|
595
776
|
*
|
|
596
777
|
* **Non-responsibilities.**
|
|
597
|
-
* - Selection state
|
|
598
|
-
* - No `indeterminate`
|
|
778
|
+
* - Selection state - controlled by the parent via `checked`.
|
|
779
|
+
* - No `indeterminate` - radios are exclusive by definition; the
|
|
599
780
|
* group enforces single-selection at the brain layer.
|
|
600
|
-
* - Interaction
|
|
781
|
+
* - Interaction - no `click` output, no keyboard handling. The radio
|
|
601
782
|
* row (or the consuming select panel) owns the hit area.
|
|
602
|
-
* - Accessibility announcements
|
|
783
|
+
* - Accessibility announcements - `aria-hidden="true"` unconditionally.
|
|
603
784
|
* Selection is announced via the row's `role="radio"` /
|
|
604
785
|
* `aria-checked` ARIA, never by this decoration.
|
|
786
|
+
*
|
|
787
|
+
* @category common/display
|
|
788
|
+
* @docsKind primary
|
|
789
|
+
* @wcag AA
|
|
790
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/radio-indicator/radio-indicator.component.ts
|
|
791
|
+
* @since 0.1.0
|
|
792
|
+
* @relatedTo CngxCheckboxIndicator, CngxIcon
|
|
793
|
+
* <example-url>http://localhost:4200/#/common/display/radio-indicator/custom-dotglyph</example-url>
|
|
794
|
+
* <example-url>http://localhost:4200/#/common/display/radio-indicator/default-unchecked-vs-checked</example-url>
|
|
795
|
+
* <example-url>http://localhost:4200/#/common/display/radio-indicator/disabled</example-url>
|
|
796
|
+
* <example-url>http://localhost:4200/#/common/display/radio-indicator/sizes</example-url>
|
|
797
|
+
* <example-url>http://localhost:4200/#/common/display/radio-indicator/theming-via-css-custom-properties</example-url>
|
|
605
798
|
*/
|
|
606
799
|
class CngxRadioIndicator {
|
|
607
800
|
/** Whether the current value is selected. */
|
|
608
801
|
checked = input(false, ...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
609
802
|
/**
|
|
610
|
-
* Disabled visual state. Purely cosmetic (opacity dim)
|
|
803
|
+
* Disabled visual state. Purely cosmetic (opacity dim) - the indicator
|
|
611
804
|
* never intercepts events, so this is a hint, not a block.
|
|
612
805
|
*/
|
|
613
806
|
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
@@ -617,7 +810,7 @@ class CngxRadioIndicator {
|
|
|
617
810
|
* Consumer-supplied template for the centred dot. When `null` (default),
|
|
618
811
|
* the built-in `<span class="cngx-radio-indicator__dot"></span>` is
|
|
619
812
|
* rendered. When set, the consumer template replaces the dot span
|
|
620
|
-
* entirely
|
|
813
|
+
* entirely - the `__dot` class is NOT applied to the custom content
|
|
621
814
|
* (consumers own the styling of their replacement).
|
|
622
815
|
*
|
|
623
816
|
* Convention-compatible with `CngxCheckboxIndicator.checkGlyph`: pass a
|
|
@@ -637,11 +830,11 @@ class CngxRadioIndicator {
|
|
|
637
830
|
<ng-container *ngTemplateOutlet="dotGlyph() ?? defaultDotGlyph" />
|
|
638
831
|
}
|
|
639
832
|
</span>
|
|
640
|
-
`, isInline: true, styles: [":
|
|
833
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-radio-indicator-size{syntax: \"*\"; inherits: true; initial-value: 1em;}@property --cngx-radio-indicator-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-radio-indicator-bg{syntax: \"*\"; inherits: true; initial-value: transparent;}@property --cngx-radio-indicator-border-width{syntax: \"<length>\"; inherits: true; initial-value: 1.5px;}@property --cngx-radio-indicator-checked-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-radio-indicator-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-radio-indicator-transition{syntax: \"*\"; inherits: false; initial-value: border-color .12s ease,background-color .12s ease;}@property --cngx-radio-indicator-size-sm{syntax: \"*\"; inherits: true; initial-value: .875em;}@property --cngx-radio-indicator-size-md{syntax: \"*\"; inherits: true; initial-value: 1em;}@property --cngx-radio-indicator-size-lg{syntax: \"*\"; inherits: true; initial-value: 1.25em;}:root{--cngx-radio-indicator-checked-color: var(--cngx-color-primary)}}@layer cngx.components{@scope(.cngx-radio-indicator){:scope{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;line-height:1;flex:0 0 auto;color:var(--cngx-radio-indicator-color, currentColor)}:scope.cngx-radio-indicator--sm{--cngx-radio-indicator-size: var(--cngx-radio-indicator-size-sm, .875em)}:scope.cngx-radio-indicator--md{--cngx-radio-indicator-size: var(--cngx-radio-indicator-size-md, 1em)}:scope.cngx-radio-indicator--lg{--cngx-radio-indicator-size: var(--cngx-radio-indicator-size-lg, 1.25em)}.cngx-radio-indicator__circle{display:inline-flex;align-items:center;justify-content:center;border-radius:50%;color:inherit;line-height:1;width:var(--cngx-radio-indicator-size, 1em);height:var(--cngx-radio-indicator-size, 1em);border:var(--cngx-radio-indicator-border-width, 1.5px) solid currentColor;background:var(--cngx-radio-indicator-bg, transparent);transition:var( --cngx-radio-indicator-transition, border-color .12s ease, background-color .12s ease )}:scope.cngx-radio-indicator--checked .cngx-radio-indicator__circle{border-color:var( --cngx-radio-indicator-checked-color, var(--cngx-color-primary, oklch(.66 .19 50)) )}.cngx-radio-indicator__dot{display:inline-block;border-radius:50%;width:var( --cngx-radio-indicator-dot-size, calc(var(--cngx-radio-indicator-size, 1em) * .5) );height:var( --cngx-radio-indicator-dot-size, calc(var(--cngx-radio-indicator-size, 1em) * .5) );background:var( --cngx-radio-indicator-checked-color, var(--cngx-color-primary, oklch(.66 .19 50)) );transition:var(--cngx-radio-indicator-transition, transform .12s ease)}:scope.cngx-radio-indicator--disabled{opacity:var(--cngx-radio-indicator-disabled-opacity, .5)}@media(prefers-reduced-motion:reduce){.cngx-radio-indicator__circle,.cngx-radio-indicator__dot{transition:none}}}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
641
834
|
}
|
|
642
835
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxRadioIndicator, decorators: [{
|
|
643
836
|
type: Component,
|
|
644
|
-
args: [{ selector: 'cngx-radio-indicator', exportAs: 'cngxRadioIndicator', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet], host: {
|
|
837
|
+
args: [{ selector: 'cngx-radio-indicator', exportAs: 'cngxRadioIndicator', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [NgTemplateOutlet], host: {
|
|
645
838
|
class: 'cngx-radio-indicator',
|
|
646
839
|
'aria-hidden': 'true',
|
|
647
840
|
'[class.cngx-radio-indicator--checked]': 'checked()',
|
|
@@ -659,12 +852,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
659
852
|
<ng-container *ngTemplateOutlet="dotGlyph() ?? defaultDotGlyph" />
|
|
660
853
|
}
|
|
661
854
|
</span>
|
|
662
|
-
`, styles: [":
|
|
855
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-radio-indicator-size{syntax: \"*\"; inherits: true; initial-value: 1em;}@property --cngx-radio-indicator-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-radio-indicator-bg{syntax: \"*\"; inherits: true; initial-value: transparent;}@property --cngx-radio-indicator-border-width{syntax: \"<length>\"; inherits: true; initial-value: 1.5px;}@property --cngx-radio-indicator-checked-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-radio-indicator-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-radio-indicator-transition{syntax: \"*\"; inherits: false; initial-value: border-color .12s ease,background-color .12s ease;}@property --cngx-radio-indicator-size-sm{syntax: \"*\"; inherits: true; initial-value: .875em;}@property --cngx-radio-indicator-size-md{syntax: \"*\"; inherits: true; initial-value: 1em;}@property --cngx-radio-indicator-size-lg{syntax: \"*\"; inherits: true; initial-value: 1.25em;}:root{--cngx-radio-indicator-checked-color: var(--cngx-color-primary)}}@layer cngx.components{@scope(.cngx-radio-indicator){:scope{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;line-height:1;flex:0 0 auto;color:var(--cngx-radio-indicator-color, currentColor)}:scope.cngx-radio-indicator--sm{--cngx-radio-indicator-size: var(--cngx-radio-indicator-size-sm, .875em)}:scope.cngx-radio-indicator--md{--cngx-radio-indicator-size: var(--cngx-radio-indicator-size-md, 1em)}:scope.cngx-radio-indicator--lg{--cngx-radio-indicator-size: var(--cngx-radio-indicator-size-lg, 1.25em)}.cngx-radio-indicator__circle{display:inline-flex;align-items:center;justify-content:center;border-radius:50%;color:inherit;line-height:1;width:var(--cngx-radio-indicator-size, 1em);height:var(--cngx-radio-indicator-size, 1em);border:var(--cngx-radio-indicator-border-width, 1.5px) solid currentColor;background:var(--cngx-radio-indicator-bg, transparent);transition:var( --cngx-radio-indicator-transition, border-color .12s ease, background-color .12s ease )}:scope.cngx-radio-indicator--checked .cngx-radio-indicator__circle{border-color:var( --cngx-radio-indicator-checked-color, var(--cngx-color-primary, oklch(.66 .19 50)) )}.cngx-radio-indicator__dot{display:inline-block;border-radius:50%;width:var( --cngx-radio-indicator-dot-size, calc(var(--cngx-radio-indicator-size, 1em) * .5) );height:var( --cngx-radio-indicator-dot-size, calc(var(--cngx-radio-indicator-size, 1em) * .5) );background:var( --cngx-radio-indicator-checked-color, var(--cngx-color-primary, oklch(.66 .19 50)) );transition:var(--cngx-radio-indicator-transition, transform .12s ease)}:scope.cngx-radio-indicator--disabled{opacity:var(--cngx-radio-indicator-disabled-opacity, .5)}@media(prefers-reduced-motion:reduce){.cngx-radio-indicator__circle,.cngx-radio-indicator__dot{transition:none}}}}\n"] }]
|
|
663
856
|
}], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], dotGlyph: [{ type: i0.Input, args: [{ isSignal: true, alias: "dotGlyph", required: false }] }] } });
|
|
664
857
|
|
|
665
858
|
/**
|
|
666
859
|
* DI token for parent `CngxTagGroup` <-> child `CngxTag` ARIA wiring.
|
|
667
|
-
* Atomic-decompose rule 4
|
|
860
|
+
* Atomic-decompose rule 4 - communication via `InjectionToken`,
|
|
668
861
|
* never via concrete parent class injection.
|
|
669
862
|
*
|
|
670
863
|
* `CngxTag` injects the token `{ optional: true }` and, when present,
|
|
@@ -672,8 +865,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
672
865
|
* single `computed()`. When absent (Tag rendered outside any group),
|
|
673
866
|
* the role attribute stays unset.
|
|
674
867
|
*
|
|
675
|
-
* Defaults to no provider
|
|
868
|
+
* Defaults to no provider - the token resolves to `null` for any
|
|
676
869
|
* `CngxTag` that lives outside a `CngxTagGroup`.
|
|
870
|
+
*
|
|
871
|
+
* @category common/display
|
|
872
|
+
* @wcag AA
|
|
873
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/tag-group/tag-group.token.ts
|
|
874
|
+
* @since 0.1.0
|
|
677
875
|
*/
|
|
678
876
|
const CNGX_TAG_GROUP = new InjectionToken('CNGX_TAG_GROUP');
|
|
679
877
|
|
|
@@ -683,7 +881,7 @@ const CNGX_TAG_GROUP = new InjectionToken('CNGX_TAG_GROUP');
|
|
|
683
881
|
* the future `withAriaLabels` feature once it lands.
|
|
684
882
|
*
|
|
685
883
|
* Exported for intra-lib consumers (`provideTagConfig` deep-merges
|
|
686
|
-
* with this base) but **NOT** re-exported from `public-api.ts`
|
|
884
|
+
* with this base) but **NOT** re-exported from `public-api.ts` -
|
|
687
885
|
* downstream consumers should reach the defaults via
|
|
688
886
|
* `inject(CNGX_TAG_CONFIG)` so `provideTagConfig` /
|
|
689
887
|
* `provideTagConfigAt` overrides take precedence.
|
|
@@ -716,11 +914,15 @@ const CNGX_TAG_DEFAULTS = {
|
|
|
716
914
|
* 4. Library defaults (this token's `factory`).
|
|
717
915
|
*
|
|
718
916
|
* `providedIn: 'root'` with a default factory means consumers never
|
|
719
|
-
* need to provide the token explicitly
|
|
917
|
+
* need to provide the token explicitly - `inject(CNGX_TAG_CONFIG)`
|
|
720
918
|
* always resolves. Consumers who want overrides call
|
|
721
919
|
* `provideTagConfig(...features)` in `bootstrapApplication` providers
|
|
722
920
|
* (root cascade) or `provideTagConfigAt(...features)` in a component's
|
|
723
921
|
* `viewProviders` (sub-tree cascade).
|
|
922
|
+
*
|
|
923
|
+
* @category common/display
|
|
924
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/tag/config/tag.config.defaults.ts
|
|
925
|
+
* @since 0.1.0
|
|
724
926
|
*/
|
|
725
927
|
const CNGX_TAG_CONFIG = new InjectionToken('CNGX_TAG_CONFIG', {
|
|
726
928
|
providedIn: 'root',
|
|
@@ -745,6 +947,8 @@ const CNGX_TAG_CONFIG = new InjectionToken('CNGX_TAG_CONFIG', {
|
|
|
745
947
|
* );
|
|
746
948
|
* }
|
|
747
949
|
* ```
|
|
950
|
+
*
|
|
951
|
+
* @category common/display
|
|
748
952
|
*/
|
|
749
953
|
function injectTagConfig() {
|
|
750
954
|
return inject(CNGX_TAG_CONFIG);
|
|
@@ -800,7 +1004,7 @@ function injectResolvedTagTemplate(directive, configKey) {
|
|
|
800
1004
|
* bidi-safe rendering, an inline link, or a richer label
|
|
801
1005
|
* composition with icons + counts).
|
|
802
1006
|
*
|
|
803
|
-
* Replacing the label drops the default ellipsis hook
|
|
1007
|
+
* Replacing the label drops the default ellipsis hook - the
|
|
804
1008
|
* consumer template owns the overflow strategy.
|
|
805
1009
|
*
|
|
806
1010
|
* ```html
|
|
@@ -810,6 +1014,24 @@ function injectResolvedTagTemplate(directive, configKey) {
|
|
|
810
1014
|
* </ng-template>
|
|
811
1015
|
* </span>
|
|
812
1016
|
* ```
|
|
1017
|
+
*
|
|
1018
|
+
* @category common/display
|
|
1019
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/tag/slots/tag-label.directive.ts
|
|
1020
|
+
* @since 0.1.0
|
|
1021
|
+
* @relatedTo CngxTag, CngxTagPrefix, CngxTagSuffix
|
|
1022
|
+
* <example-url>http://localhost:4200/#/common/display/tag/app-wide-defaults-via-providetagconfig</example-url>
|
|
1023
|
+
* <example-url>http://localhost:4200/#/common/display/tag/color-palette</example-url>
|
|
1024
|
+
* <example-url>http://localhost:4200/#/common/display/tag/composition-with-cngxicon</example-url>
|
|
1025
|
+
* <example-url>http://localhost:4200/#/common/display/tag/density</example-url>
|
|
1026
|
+
* <example-url>http://localhost:4200/#/common/display/tag/group-semantic-list</example-url>
|
|
1027
|
+
* <example-url>http://localhost:4200/#/common/display/tag/group-with-header-accessory</example-url>
|
|
1028
|
+
* <example-url>http://localhost:4200/#/common/display/tag/layout-only-alignment</example-url>
|
|
1029
|
+
* <example-url>http://localhost:4200/#/common/display/tag/layout-only-gap-variants</example-url>
|
|
1030
|
+
* <example-url>http://localhost:4200/#/common/display/tag/link-mode</example-url>
|
|
1031
|
+
* <example-url>http://localhost:4200/#/common/display/tag/slot-overrides-custom-label</example-url>
|
|
1032
|
+
* <example-url>http://localhost:4200/#/common/display/tag/slot-overrides-prefix-label-suffix</example-url>
|
|
1033
|
+
* <example-url>http://localhost:4200/#/common/display/tag/truncate-maxwidth</example-url>
|
|
1034
|
+
* <example-url>http://localhost:4200/#/common/display/tag/variant-matrix</example-url>
|
|
813
1035
|
*/
|
|
814
1036
|
class CngxTagLabel {
|
|
815
1037
|
templateRef = inject(TemplateRef);
|
|
@@ -830,7 +1052,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
830
1052
|
* `<span cngxTag>`. Use for icon glyphs, status dots, count badges,
|
|
831
1053
|
* or any per-tag prefix decoration.
|
|
832
1054
|
*
|
|
833
|
-
* The slot has no default body
|
|
1055
|
+
* The slot has no default body - when not projected, no DOM is
|
|
834
1056
|
* rendered in the prefix position.
|
|
835
1057
|
*
|
|
836
1058
|
* ```html
|
|
@@ -841,6 +1063,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
841
1063
|
* Action required
|
|
842
1064
|
* </span>
|
|
843
1065
|
* ```
|
|
1066
|
+
*
|
|
1067
|
+
* @category common/display
|
|
1068
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/tag/slots/tag-prefix.directive.ts
|
|
1069
|
+
* @since 0.1.0
|
|
1070
|
+
* @relatedTo CngxTag, CngxTagLabel, CngxTagSuffix
|
|
1071
|
+
* <example-url>http://localhost:4200/#/common/display/tag/app-wide-defaults-via-providetagconfig</example-url>
|
|
1072
|
+
* <example-url>http://localhost:4200/#/common/display/tag/color-palette</example-url>
|
|
1073
|
+
* <example-url>http://localhost:4200/#/common/display/tag/composition-with-cngxicon</example-url>
|
|
1074
|
+
* <example-url>http://localhost:4200/#/common/display/tag/density</example-url>
|
|
1075
|
+
* <example-url>http://localhost:4200/#/common/display/tag/group-semantic-list</example-url>
|
|
1076
|
+
* <example-url>http://localhost:4200/#/common/display/tag/group-with-header-accessory</example-url>
|
|
1077
|
+
* <example-url>http://localhost:4200/#/common/display/tag/layout-only-alignment</example-url>
|
|
1078
|
+
* <example-url>http://localhost:4200/#/common/display/tag/layout-only-gap-variants</example-url>
|
|
1079
|
+
* <example-url>http://localhost:4200/#/common/display/tag/link-mode</example-url>
|
|
1080
|
+
* <example-url>http://localhost:4200/#/common/display/tag/slot-overrides-custom-label</example-url>
|
|
1081
|
+
* <example-url>http://localhost:4200/#/common/display/tag/slot-overrides-prefix-label-suffix</example-url>
|
|
1082
|
+
* <example-url>http://localhost:4200/#/common/display/tag/truncate-maxwidth</example-url>
|
|
1083
|
+
* <example-url>http://localhost:4200/#/common/display/tag/variant-matrix</example-url>
|
|
844
1084
|
*/
|
|
845
1085
|
class CngxTagPrefix {
|
|
846
1086
|
templateRef = inject(TemplateRef);
|
|
@@ -861,7 +1101,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
861
1101
|
* `<span cngxTag>`. Use for trailing chevrons, sort indicators, or
|
|
862
1102
|
* any per-tag suffix decoration.
|
|
863
1103
|
*
|
|
864
|
-
* The slot has no default body
|
|
1104
|
+
* The slot has no default body - when not projected, no DOM is
|
|
865
1105
|
* rendered in the suffix position. Removable affordances belong on
|
|
866
1106
|
* `CngxChip` (which ships its own remove button + announcer
|
|
867
1107
|
* wiring), not as a Tag suffix slot.
|
|
@@ -874,6 +1114,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
874
1114
|
* </ng-template>
|
|
875
1115
|
* </span>
|
|
876
1116
|
* ```
|
|
1117
|
+
*
|
|
1118
|
+
* @category common/display
|
|
1119
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/tag/slots/tag-suffix.directive.ts
|
|
1120
|
+
* @since 0.1.0
|
|
1121
|
+
* @relatedTo CngxTag, CngxTagLabel, CngxTagPrefix
|
|
1122
|
+
* <example-url>http://localhost:4200/#/common/display/tag/app-wide-defaults-via-providetagconfig</example-url>
|
|
1123
|
+
* <example-url>http://localhost:4200/#/common/display/tag/color-palette</example-url>
|
|
1124
|
+
* <example-url>http://localhost:4200/#/common/display/tag/composition-with-cngxicon</example-url>
|
|
1125
|
+
* <example-url>http://localhost:4200/#/common/display/tag/density</example-url>
|
|
1126
|
+
* <example-url>http://localhost:4200/#/common/display/tag/group-semantic-list</example-url>
|
|
1127
|
+
* <example-url>http://localhost:4200/#/common/display/tag/group-with-header-accessory</example-url>
|
|
1128
|
+
* <example-url>http://localhost:4200/#/common/display/tag/layout-only-alignment</example-url>
|
|
1129
|
+
* <example-url>http://localhost:4200/#/common/display/tag/layout-only-gap-variants</example-url>
|
|
1130
|
+
* <example-url>http://localhost:4200/#/common/display/tag/link-mode</example-url>
|
|
1131
|
+
* <example-url>http://localhost:4200/#/common/display/tag/slot-overrides-custom-label</example-url>
|
|
1132
|
+
* <example-url>http://localhost:4200/#/common/display/tag/slot-overrides-prefix-label-suffix</example-url>
|
|
1133
|
+
* <example-url>http://localhost:4200/#/common/display/tag/truncate-maxwidth</example-url>
|
|
1134
|
+
* <example-url>http://localhost:4200/#/common/display/tag/variant-matrix</example-url>
|
|
877
1135
|
*/
|
|
878
1136
|
class CngxTagSuffix {
|
|
879
1137
|
templateRef = inject(TemplateRef);
|
|
@@ -899,7 +1157,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
899
1157
|
* on a card, role markers in an admin table, pre-filter chips in a
|
|
900
1158
|
* dashboard sidebar. Two narrow atoms with non-overlapping
|
|
901
1159
|
* concerns beat one chip-tag hybrid with mode flags
|
|
902
|
-
* (Pillar 3
|
|
1160
|
+
* (Pillar 3 - Komposition statt Konfiguration).
|
|
903
1161
|
*
|
|
904
1162
|
* **Responsibilities (intentionally narrow).**
|
|
905
1163
|
* - Apply variant / color / size / truncate / maxWidth host
|
|
@@ -909,21 +1167,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
909
1167
|
* reactively expose `role="listitem"` so the parent's
|
|
910
1168
|
* `role="list"` semantics propagate without consumer wiring.
|
|
911
1169
|
* The cascade reads `CNGX_TAG_GROUP.semanticList()` through a
|
|
912
|
-
* single `computed<'listitem' | null>()` (Pillar 1
|
|
913
|
-
* derivation; Pillar 2
|
|
1170
|
+
* single `computed<'listitem' | null>()` (Pillar 1 -
|
|
1171
|
+
* derivation; Pillar 2 - ARIA in the reactive graph).
|
|
914
1172
|
*
|
|
915
1173
|
* **Non-responsibilities.**
|
|
916
|
-
* - Removable affordance
|
|
917
|
-
* - Clickable / interactive semantics
|
|
1174
|
+
* - Removable affordance - use `CngxChip` instead.
|
|
1175
|
+
* - Clickable / interactive semantics - wrap with native
|
|
918
1176
|
* `<button cngxTag>` or `<a cngxTag>` for keyboard +
|
|
919
1177
|
* focus + Enter/Space.
|
|
920
|
-
* - Configuration cascade
|
|
1178
|
+
* - Configuration cascade - deferred (see
|
|
921
1179
|
* `display-accepted-debt.md §1`).
|
|
1180
|
+
*
|
|
1181
|
+
* @category common/display
|
|
1182
|
+
* @docsKind primary
|
|
1183
|
+
* @wcag AA
|
|
1184
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/tag/tag.directive.ts
|
|
1185
|
+
* @selector cngx-tag
|
|
1186
|
+
* @since 0.1.0
|
|
1187
|
+
* @relatedTo CngxTagGroup, CngxChip, CngxBadge, CngxTagLabel
|
|
1188
|
+
* <example-url>http://localhost:4200/#/common/display/tag/app-wide-defaults-via-providetagconfig</example-url>
|
|
1189
|
+
* <example-url>http://localhost:4200/#/common/display/tag/color-palette</example-url>
|
|
1190
|
+
* <example-url>http://localhost:4200/#/common/display/tag/composition-with-cngxicon</example-url>
|
|
1191
|
+
* <example-url>http://localhost:4200/#/common/display/tag/density</example-url>
|
|
1192
|
+
* <example-url>http://localhost:4200/#/common/display/tag-group/semantic-list</example-url>
|
|
1193
|
+
* <example-url>http://localhost:4200/#/common/display/tag-group/with-header-accessory</example-url>
|
|
1194
|
+
* <example-url>http://localhost:4200/#/common/display/tag-group/alignment</example-url>
|
|
1195
|
+
* <example-url>http://localhost:4200/#/common/display/tag-group/gap-variants</example-url>
|
|
1196
|
+
* <example-url>http://localhost:4200/#/common/display/tag/link-mode</example-url>
|
|
1197
|
+
* <example-url>http://localhost:4200/#/common/display/tag/slot-overrides-custom-label</example-url>
|
|
1198
|
+
* <example-url>http://localhost:4200/#/common/display/tag/slot-overrides-prefix-label-suffix</example-url>
|
|
1199
|
+
* <example-url>http://localhost:4200/#/common/display/tag/truncate-maxwidth</example-url>
|
|
1200
|
+
* <example-url>http://localhost:4200/#/common/display/tag/variant-matrix</example-url>
|
|
922
1201
|
*/
|
|
923
1202
|
class CngxTag {
|
|
924
1203
|
/**
|
|
925
1204
|
* Snapshot of the resolved tag-family config at construction
|
|
926
|
-
* time. Drives the per-input fallback defaults below
|
|
1205
|
+
* time. Drives the per-input fallback defaults below - Angular's
|
|
927
1206
|
* input-default rule means per-instance `[variant]="..."`
|
|
928
1207
|
* bindings still win.
|
|
929
1208
|
*
|
|
@@ -934,7 +1213,7 @@ class CngxTag {
|
|
|
934
1213
|
* `undefined` at the input's init call site (runtime crash on
|
|
935
1214
|
* first construction). Per the
|
|
936
1215
|
* `tag-family-architectural-a-plus-pass` plan Architectural-
|
|
937
|
-
* Decisions table
|
|
1216
|
+
* Decisions table - flagged in cngx-plan-review 2026-04-29.
|
|
938
1217
|
*/
|
|
939
1218
|
cfg = injectTagConfig();
|
|
940
1219
|
/** Visual variant. `filled` (default) | `outline` | `subtle`. */
|
|
@@ -950,10 +1229,10 @@ class CngxTag {
|
|
|
950
1229
|
/**
|
|
951
1230
|
* When `true`, applies `text-overflow: ellipsis` + `white-space: nowrap`
|
|
952
1231
|
* to the inner `.cngx-tag__label` span. Pair with `[maxWidth]` for a
|
|
953
|
-
* hard upper bound. Visual-only
|
|
1232
|
+
* hard upper bound. Visual-only - the full text remains in the DOM
|
|
954
1233
|
* for AT.
|
|
955
1234
|
*
|
|
956
|
-
* Deliberately CSS-only
|
|
1235
|
+
* Deliberately CSS-only - `CngxTruncate` (`@cngx/common/layout`) is the
|
|
957
1236
|
* right tool for multi-line clamp + expand/collapse state on long-form
|
|
958
1237
|
* text, but its reactive machinery (effect + ResizeObserver + isClamped
|
|
959
1238
|
* signal) is overkill for a chip-style single-line overflow.
|
|
@@ -970,21 +1249,21 @@ class CngxTag {
|
|
|
970
1249
|
* default implementer). When present and `semanticList()` is
|
|
971
1250
|
* `true`, the host carries `role="listitem"` so the parent's
|
|
972
1251
|
* `role="list"` propagates. When absent, no synthetic role is
|
|
973
|
-
* set
|
|
1252
|
+
* set - `<a cngxTag>` keeps its native `role="link"`,
|
|
974
1253
|
* `<button cngxTag>` keeps its `role="button"`, etc.
|
|
975
1254
|
*/
|
|
976
1255
|
group = inject(CNGX_TAG_GROUP, { optional: true });
|
|
977
1256
|
/**
|
|
978
|
-
* Per-instance label-slot directive
|
|
1257
|
+
* Per-instance label-slot directive - projected as
|
|
979
1258
|
* `<ng-template cngxTagLabel>...</ng-template>`. Resolved through
|
|
980
1259
|
* {@link injectResolvedTagTemplate} so consumers can override the
|
|
981
1260
|
* default `<span class="cngx-tag__label">` wrapper without forking
|
|
982
1261
|
* the directive.
|
|
983
1262
|
*/
|
|
984
1263
|
labelSlot = contentChild(CngxTagLabel, ...(ngDevMode ? [{ debugName: "labelSlot" }] : /* istanbul ignore next */ []));
|
|
985
|
-
/** Per-instance prefix-slot directive
|
|
1264
|
+
/** Per-instance prefix-slot directive - projected before the label. */
|
|
986
1265
|
prefixSlot = contentChild(CngxTagPrefix, ...(ngDevMode ? [{ debugName: "prefixSlot" }] : /* istanbul ignore next */ []));
|
|
987
|
-
/** Per-instance suffix-slot directive
|
|
1266
|
+
/** Per-instance suffix-slot directive - projected after the label. */
|
|
988
1267
|
suffixSlot = contentChild(CngxTagSuffix, ...(ngDevMode ? [{ debugName: "suffixSlot" }] : /* istanbul ignore next */ []));
|
|
989
1268
|
/**
|
|
990
1269
|
* Resolved label template. Phase 1 cascade: instance slot → host
|
|
@@ -1004,7 +1283,7 @@ class CngxTag {
|
|
|
1004
1283
|
* templates `let-variant="variant"` etc. read the live state without
|
|
1005
1284
|
* injecting the directive.
|
|
1006
1285
|
*
|
|
1007
|
-
* Explicit structural `equal` fn
|
|
1286
|
+
* Explicit structural `equal` fn - without it, a fresh literal each
|
|
1008
1287
|
* CD cycle would force `ngTemplateOutlet` to rebind embedded views
|
|
1009
1288
|
* even when no input changed. Per `reference_signal_architecture` §1
|
|
1010
1289
|
* Equality Rule: every `computed` returning an object MUST pass an
|
|
@@ -1023,7 +1302,7 @@ class CngxTag {
|
|
|
1023
1302
|
/**
|
|
1024
1303
|
* Reactive `role` attribute. Returns `'listitem'` when projected
|
|
1025
1304
|
* inside a `<cngx-tag-group [semanticList]="true">`; `null`
|
|
1026
|
-
* otherwise. No explicit `equal` fn passed
|
|
1305
|
+
* otherwise. No explicit `equal` fn passed - primitive string
|
|
1027
1306
|
* output, default `Object.is` is correct (per
|
|
1028
1307
|
* `reference_signal_architecture` §1: equality discipline applies
|
|
1029
1308
|
* to object/array results, not primitives).
|
|
@@ -1044,7 +1323,7 @@ class CngxTag {
|
|
|
1044
1323
|
@if (suffixTpl(); as t) {
|
|
1045
1324
|
<ng-container *ngTemplateOutlet="t; context: slotContext()" />
|
|
1046
1325
|
}
|
|
1047
|
-
`, isInline: true, styles: [".cngx-tag{display:inline-flex;align-items:center;gap:var(--cngx-tag-gap, .25rem);padding:var(--cngx-tag-padding, .125rem .5rem);font-size:var(--cngx-tag-font-size, .75rem);line-height:1.25;max-width:100%}.cngx-tag--sm{padding:var(--cngx-tag-sm-padding, 0 .375rem);font-size:var(--cngx-tag-sm-font-size, .6875rem)}.cngx-tag--lg{padding:var(--cngx-tag-lg-padding, .25rem .625rem);font-size:var(--cngx-tag-lg-font-size, .875rem)}.cngx-tag--xl{padding:var(--cngx-tag-xl-padding, .375rem .75rem);font-size:var(--cngx-tag-xl-font-size, 1rem)}.cngx-tag__label{min-width:0;overflow:hidden}.cngx-tag--truncate .cngx-tag__label{text-overflow:ellipsis;white-space:nowrap}.cngx-tag-group{display:flex;flex-direction:column;gap:var(--cngx-tag-group-stack-gap, .5rem)}.cngx-tag-group__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--cngx-tag-group-gap, .5rem);justify-content:flex-start}.cngx-tag-group--gap-xs>.cngx-tag-group__row{gap:var(--cngx-tag-group-gap-xs, .25rem)}.cngx-tag-group--gap-md>.cngx-tag-group__row{gap:var(--cngx-tag-group-gap-md, .75rem)}.cngx-tag-group--align-start>.cngx-tag-group__row{justify-content:flex-start}.cngx-tag-group--align-center>.cngx-tag-group__row{justify-content:center}.cngx-tag-group--align-end>.cngx-tag-group__row{justify-content:flex-end}.cngx-tag-group--align-between>.cngx-tag-group__row{justify-content:space-between}\n", ".cngx-tag{border-radius:var(--cngx-tag-radius, 4px);font-weight:var(--cngx-tag-font-weight, 500);background:var(--cngx-tag-bg, transparent);color:var(--cngx-tag-color, inherit);border:var(--cngx-tag-border, 1px solid transparent)}.cngx-tag--filled[data-color=neutral]{--cngx-tag-bg: var(--cngx-tag-neutral-bg, #e5e7eb);--cngx-tag-color: var(--cngx-tag-neutral-color, #374151);--cngx-tag-border: 1px solid var(--cngx-tag-neutral-border, transparent)}.cngx-tag--filled[data-color=success]{--cngx-tag-bg: var(--cngx-tag-success-bg, #d1fae5);--cngx-tag-color: var(--cngx-tag-success-color, #065f46);--cngx-tag-border: 1px solid var(--cngx-tag-success-border, transparent)}.cngx-tag--filled[data-color=warning]{--cngx-tag-bg: var(--cngx-tag-warning-bg, #fef3c7);--cngx-tag-color: var(--cngx-tag-warning-color, #92400e);--cngx-tag-border: 1px solid var(--cngx-tag-warning-border, transparent)}.cngx-tag--filled[data-color=error]{--cngx-tag-bg: var(--cngx-tag-error-bg, #fee2e2);--cngx-tag-color: var(--cngx-tag-error-color, #991b1b);--cngx-tag-border: 1px solid var(--cngx-tag-error-border, transparent)}.cngx-tag--filled[data-color=info]{--cngx-tag-bg: var(--cngx-tag-info-bg, #dbeafe);--cngx-tag-color: var(--cngx-tag-info-color, #1e40af);--cngx-tag-border: 1px solid var(--cngx-tag-info-border, transparent)}.cngx-tag--outline[data-color=neutral]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-neutral-color, #374151);--cngx-tag-border: 1px solid var(--cngx-tag-neutral-color, #9ca3af)}.cngx-tag--outline[data-color=success]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-success-color, #065f46);--cngx-tag-border: 1px solid var(--cngx-tag-success-color, #10b981)}.cngx-tag--outline[data-color=warning]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-warning-color, #92400e);--cngx-tag-border: 1px solid var(--cngx-tag-warning-color, #f59e0b)}.cngx-tag--outline[data-color=error]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-error-color, #991b1b);--cngx-tag-border: 1px solid var(--cngx-tag-error-color, #ef4444)}.cngx-tag--outline[data-color=info]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-info-color, #1e40af);--cngx-tag-border: 1px solid var(--cngx-tag-info-color, #3b82f6)}.cngx-tag--subtle[data-color=neutral]{--cngx-tag-bg: var(--cngx-tag-neutral-subtle-bg, #f3f4f6);--cngx-tag-color: var(--cngx-tag-neutral-color, #374151);--cngx-tag-border: 1px solid transparent}.cngx-tag--subtle[data-color=success]{--cngx-tag-bg: var(--cngx-tag-success-subtle-bg, #ecfdf5);--cngx-tag-color: var(--cngx-tag-success-color, #065f46);--cngx-tag-border: 1px solid transparent}.cngx-tag--subtle[data-color=warning]{--cngx-tag-bg: var(--cngx-tag-warning-subtle-bg, #fffbeb);--cngx-tag-color: var(--cngx-tag-warning-color, #92400e);--cngx-tag-border: 1px solid transparent}.cngx-tag--subtle[data-color=error]{--cngx-tag-bg: var(--cngx-tag-error-subtle-bg, #fef2f2);--cngx-tag-color: var(--cngx-tag-error-color, #991b1b);--cngx-tag-border: 1px solid transparent}.cngx-tag--subtle[data-color=info]{--cngx-tag-bg: var(--cngx-tag-info-subtle-bg, #eff6ff);--cngx-tag-color: var(--cngx-tag-info-color, #1e40af);--cngx-tag-border: 1px solid transparent}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1326
|
+
`, isInline: true, styles: ["@layer cngx.components{@scope(.cngx-tag){:scope{display:inline-flex;align-items:center;line-height:1.25;max-width:100%;gap:var(--cngx-tag-gap, var(--cngx-space-xs, 4px));padding:var(--cngx-tag-padding, 2px 8px);font-size:var(--cngx-tag-font-size, var(--cngx-font-size-sm, .75rem))}:scope.cngx-tag--sm{padding:var(--cngx-tag-sm-padding, 0 6px);font-size:var(--cngx-tag-sm-font-size, .6875rem)}:scope.cngx-tag--lg{padding:var(--cngx-tag-lg-padding, 4px 10px);font-size:var(--cngx-tag-lg-font-size, .875rem)}:scope.cngx-tag--xl{padding:var(--cngx-tag-xl-padding, 6px 12px);font-size:var(--cngx-tag-xl-font-size, 1rem)}.cngx-tag__label{min-width:0;overflow:hidden}:scope.cngx-tag--truncate .cngx-tag__label{text-overflow:ellipsis;white-space:nowrap}}@scope(.cngx-tag-group){:scope{display:flex;flex-direction:column;gap:var(--cngx-tag-group-stack-gap, var(--cngx-space-sm, 8px))}.cngx-tag-group__row{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-start;gap:var(--cngx-tag-group-gap, var(--cngx-space-sm, 8px))}:scope.cngx-tag-group--gap-xs>.cngx-tag-group__row{gap:var(--cngx-tag-group-gap-xs, var(--cngx-space-xs, 4px))}:scope.cngx-tag-group--gap-md>.cngx-tag-group__row{gap:var(--cngx-tag-group-gap-md, 12px)}:scope.cngx-tag-group--align-start>.cngx-tag-group__row{justify-content:flex-start}:scope.cngx-tag-group--align-center>.cngx-tag-group__row{justify-content:center}:scope.cngx-tag-group--align-end>.cngx-tag-group__row{justify-content:flex-end}:scope.cngx-tag-group--align-between>.cngx-tag-group__row{justify-content:space-between}}}\n", "@layer cngx.tokens{@property --cngx-tag-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-tag-font-weight{syntax: \"*\"; inherits: false; initial-value: 500;}@property --cngx-tag-bg{syntax: \"*\"; inherits: false; initial-value: transparent;}@property --cngx-tag-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-tag-border{syntax: \"*\"; inherits: false; initial-value: 1px solid transparent;}@property --cngx-tag-gap{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-tag-padding{syntax: \"*\"; inherits: false; initial-value: 2px 8px;}@property --cngx-tag-font-size{syntax: \"*\"; inherits: false; initial-value: .75rem;}@property --cngx-tag-sm-padding{syntax: \"*\"; inherits: false; initial-value: 0 6px;}@property --cngx-tag-sm-font-size{syntax: \"*\"; inherits: false; initial-value: .6875rem;}@property --cngx-tag-lg-padding{syntax: \"*\"; inherits: false; initial-value: 4px 10px;}@property --cngx-tag-lg-font-size{syntax: \"*\"; inherits: false; initial-value: .875rem;}@property --cngx-tag-xl-padding{syntax: \"*\"; inherits: false; initial-value: 6px 12px;}@property --cngx-tag-xl-font-size{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-tag-neutral-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-tag-neutral-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.34 .015 250);}@property --cngx-tag-neutral-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(.68 .01 250);}@property --cngx-tag-neutral-subtle-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.96 .005 250);}@property --cngx-tag-success-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.95 .05 145);}@property --cngx-tag-success-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.4 .1 160);}@property --cngx-tag-success-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .15 155);}@property --cngx-tag-success-subtle-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.97 .025 145);}@property --cngx-tag-warning-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.95 .05 90);}@property --cngx-tag-warning-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.45 .12 60);}@property --cngx-tag-warning-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(.72 .18 70);}@property --cngx-tag-warning-subtle-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.98 .02 90);}@property --cngx-tag-error-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.94 .04 25);}@property --cngx-tag-error-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.4 .15 25);}@property --cngx-tag-error-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .22 25);}@property --cngx-tag-error-subtle-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.98 .015 25);}@property --cngx-tag-info-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.93 .04 240);}@property --cngx-tag-info-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.4 .15 250);}@property --cngx-tag-info-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(.62 .2 250);}@property --cngx-tag-info-subtle-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.97 .025 240);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-tag-neutral-bg: oklch(.32 .005 250);--cngx-tag-neutral-color: oklch(.85 .005 250);--cngx-tag-neutral-subtle-bg: oklch(.28 .005 250);--cngx-tag-success-bg: oklch(.32 .06 145);--cngx-tag-success-color: oklch(.85 .13 145);--cngx-tag-success-subtle-bg: oklch(.28 .04 145);--cngx-tag-warning-bg: oklch(.32 .06 75);--cngx-tag-warning-color: oklch(.88 .14 75);--cngx-tag-warning-subtle-bg: oklch(.28 .04 75);--cngx-tag-error-bg: oklch(.32 .05 25);--cngx-tag-error-color: oklch(.82 .15 25);--cngx-tag-error-subtle-bg: oklch(.28 .04 25);--cngx-tag-info-bg: oklch(.32 .05 250);--cngx-tag-info-color: oklch(.85 .13 250);--cngx-tag-info-subtle-bg: oklch(.28 .04 250)}}[data-color-scheme=dark],.dark{--cngx-tag-neutral-bg: oklch(.32 .005 250);--cngx-tag-neutral-color: oklch(.85 .005 250);--cngx-tag-neutral-subtle-bg: oklch(.28 .005 250);--cngx-tag-success-bg: oklch(.32 .06 145);--cngx-tag-success-color: oklch(.85 .13 145);--cngx-tag-success-subtle-bg: oklch(.28 .04 145);--cngx-tag-warning-bg: oklch(.32 .06 75);--cngx-tag-warning-color: oklch(.88 .14 75);--cngx-tag-warning-subtle-bg: oklch(.28 .04 75);--cngx-tag-error-bg: oklch(.32 .05 25);--cngx-tag-error-color: oklch(.82 .15 25);--cngx-tag-error-subtle-bg: oklch(.28 .04 25);--cngx-tag-info-bg: oklch(.32 .05 250);--cngx-tag-info-color: oklch(.85 .13 250);--cngx-tag-info-subtle-bg: oklch(.28 .04 250)}[data-color-scheme=light],.light{--cngx-tag-neutral-bg: oklch(.92 .005 250);--cngx-tag-neutral-color: oklch(.34 .015 250);--cngx-tag-neutral-subtle-bg: oklch(.96 .005 250);--cngx-tag-success-bg: oklch(.95 .05 145);--cngx-tag-success-color: oklch(.4 .1 160);--cngx-tag-success-subtle-bg: oklch(.97 .025 145);--cngx-tag-warning-bg: oklch(.95 .05 90);--cngx-tag-warning-color: oklch(.45 .12 60);--cngx-tag-warning-subtle-bg: oklch(.98 .02 90);--cngx-tag-error-bg: oklch(.94 .04 25);--cngx-tag-error-color: oklch(.4 .15 25);--cngx-tag-error-subtle-bg: oklch(.98 .015 25);--cngx-tag-info-bg: oklch(.93 .04 240);--cngx-tag-info-color: oklch(.4 .15 250);--cngx-tag-info-subtle-bg: oklch(.97 .025 240)}}@layer cngx.components{@scope(.cngx-tag){:scope{border-radius:var(--cngx-tag-radius, var(--cngx-radius-sm, 4px));font-weight:var(--cngx-tag-font-weight, 500);background:var(--cngx-tag-bg, transparent);color:var(--cngx-tag-color, inherit);border:var(--cngx-tag-border, 1px solid transparent)}:scope.cngx-tag--filled[data-color=neutral]{--cngx-tag-bg: var(--cngx-tag-neutral-bg);--cngx-tag-color: var(--cngx-tag-neutral-color);--cngx-tag-border: 1px solid var(--cngx-tag-neutral-border, transparent)}:scope.cngx-tag--filled[data-color=success]{--cngx-tag-bg: var(--cngx-tag-success-bg);--cngx-tag-color: var(--cngx-tag-success-color, var(--cngx-color-success));--cngx-tag-border: 1px solid var(--cngx-tag-success-border, transparent)}:scope.cngx-tag--filled[data-color=warning]{--cngx-tag-bg: var(--cngx-tag-warning-bg);--cngx-tag-color: var(--cngx-tag-warning-color, var(--cngx-color-warning));--cngx-tag-border: 1px solid var(--cngx-tag-warning-border, transparent)}:scope.cngx-tag--filled[data-color=error]{--cngx-tag-bg: var(--cngx-tag-error-bg);--cngx-tag-color: var(--cngx-tag-error-color, var(--cngx-color-danger));--cngx-tag-border: 1px solid var(--cngx-tag-error-border, transparent)}:scope.cngx-tag--filled[data-color=info]{--cngx-tag-bg: var(--cngx-tag-info-bg);--cngx-tag-color: var(--cngx-tag-info-color, var(--cngx-color-info));--cngx-tag-border: 1px solid var(--cngx-tag-info-border, transparent)}:scope.cngx-tag--outline[data-color=neutral]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-neutral-color);--cngx-tag-border: 1px solid var(--cngx-tag-neutral-color)}:scope.cngx-tag--outline[data-color=success]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-success-color, var(--cngx-color-success));--cngx-tag-border: 1px solid var(--cngx-tag-success-color, var(--cngx-color-success))}:scope.cngx-tag--outline[data-color=warning]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-warning-color, var(--cngx-color-warning));--cngx-tag-border: 1px solid var(--cngx-tag-warning-color, var(--cngx-color-warning))}:scope.cngx-tag--outline[data-color=error]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-error-color, var(--cngx-color-danger));--cngx-tag-border: 1px solid var(--cngx-tag-error-color, var(--cngx-color-danger))}:scope.cngx-tag--outline[data-color=info]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-info-color, var(--cngx-color-info));--cngx-tag-border: 1px solid var(--cngx-tag-info-color, var(--cngx-color-info))}:scope.cngx-tag--subtle[data-color=neutral]{--cngx-tag-bg: var(--cngx-tag-neutral-subtle-bg);--cngx-tag-color: var(--cngx-tag-neutral-color);--cngx-tag-border: 1px solid transparent}:scope.cngx-tag--subtle[data-color=success]{--cngx-tag-bg: var(--cngx-tag-success-subtle-bg);--cngx-tag-color: var(--cngx-tag-success-color, var(--cngx-color-success));--cngx-tag-border: 1px solid transparent}:scope.cngx-tag--subtle[data-color=warning]{--cngx-tag-bg: var(--cngx-tag-warning-subtle-bg);--cngx-tag-color: var(--cngx-tag-warning-color, var(--cngx-color-warning));--cngx-tag-border: 1px solid transparent}:scope.cngx-tag--subtle[data-color=error]{--cngx-tag-bg: var(--cngx-tag-error-subtle-bg);--cngx-tag-color: var(--cngx-tag-error-color, var(--cngx-color-danger));--cngx-tag-border: 1px solid transparent}:scope.cngx-tag--subtle[data-color=info]{--cngx-tag-bg: var(--cngx-tag-info-subtle-bg);--cngx-tag-color: var(--cngx-tag-info-color, var(--cngx-color-info));--cngx-tag-border: 1px solid transparent}}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1048
1327
|
}
|
|
1049
1328
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTag, decorators: [{
|
|
1050
1329
|
type: Component,
|
|
@@ -1073,7 +1352,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1073
1352
|
'[attr.data-color]': 'color()',
|
|
1074
1353
|
'[style.max-width]': 'maxWidth()',
|
|
1075
1354
|
'[attr.role]': 'roleAttr()',
|
|
1076
|
-
}, styles: [".cngx-tag{display:inline-flex;align-items:center;gap:var(--cngx-tag-gap, .25rem);padding:var(--cngx-tag-padding, .125rem .5rem);font-size:var(--cngx-tag-font-size, .75rem);line-height:1.25;max-width:100%}.cngx-tag--sm{padding:var(--cngx-tag-sm-padding, 0 .375rem);font-size:var(--cngx-tag-sm-font-size, .6875rem)}.cngx-tag--lg{padding:var(--cngx-tag-lg-padding, .25rem .625rem);font-size:var(--cngx-tag-lg-font-size, .875rem)}.cngx-tag--xl{padding:var(--cngx-tag-xl-padding, .375rem .75rem);font-size:var(--cngx-tag-xl-font-size, 1rem)}.cngx-tag__label{min-width:0;overflow:hidden}.cngx-tag--truncate .cngx-tag__label{text-overflow:ellipsis;white-space:nowrap}.cngx-tag-group{display:flex;flex-direction:column;gap:var(--cngx-tag-group-stack-gap, .5rem)}.cngx-tag-group__row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--cngx-tag-group-gap, .5rem);justify-content:flex-start}.cngx-tag-group--gap-xs>.cngx-tag-group__row{gap:var(--cngx-tag-group-gap-xs, .25rem)}.cngx-tag-group--gap-md>.cngx-tag-group__row{gap:var(--cngx-tag-group-gap-md, .75rem)}.cngx-tag-group--align-start>.cngx-tag-group__row{justify-content:flex-start}.cngx-tag-group--align-center>.cngx-tag-group__row{justify-content:center}.cngx-tag-group--align-end>.cngx-tag-group__row{justify-content:flex-end}.cngx-tag-group--align-between>.cngx-tag-group__row{justify-content:space-between}\n", ".cngx-tag{border-radius:var(--cngx-tag-radius, 4px);font-weight:var(--cngx-tag-font-weight, 500);background:var(--cngx-tag-bg, transparent);color:var(--cngx-tag-color, inherit);border:var(--cngx-tag-border, 1px solid transparent)}.cngx-tag--filled[data-color=neutral]{--cngx-tag-bg: var(--cngx-tag-neutral-bg, #e5e7eb);--cngx-tag-color: var(--cngx-tag-neutral-color, #374151);--cngx-tag-border: 1px solid var(--cngx-tag-neutral-border, transparent)}.cngx-tag--filled[data-color=success]{--cngx-tag-bg: var(--cngx-tag-success-bg, #d1fae5);--cngx-tag-color: var(--cngx-tag-success-color, #065f46);--cngx-tag-border: 1px solid var(--cngx-tag-success-border, transparent)}.cngx-tag--filled[data-color=warning]{--cngx-tag-bg: var(--cngx-tag-warning-bg, #fef3c7);--cngx-tag-color: var(--cngx-tag-warning-color, #92400e);--cngx-tag-border: 1px solid var(--cngx-tag-warning-border, transparent)}.cngx-tag--filled[data-color=error]{--cngx-tag-bg: var(--cngx-tag-error-bg, #fee2e2);--cngx-tag-color: var(--cngx-tag-error-color, #991b1b);--cngx-tag-border: 1px solid var(--cngx-tag-error-border, transparent)}.cngx-tag--filled[data-color=info]{--cngx-tag-bg: var(--cngx-tag-info-bg, #dbeafe);--cngx-tag-color: var(--cngx-tag-info-color, #1e40af);--cngx-tag-border: 1px solid var(--cngx-tag-info-border, transparent)}.cngx-tag--outline[data-color=neutral]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-neutral-color, #374151);--cngx-tag-border: 1px solid var(--cngx-tag-neutral-color, #9ca3af)}.cngx-tag--outline[data-color=success]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-success-color, #065f46);--cngx-tag-border: 1px solid var(--cngx-tag-success-color, #10b981)}.cngx-tag--outline[data-color=warning]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-warning-color, #92400e);--cngx-tag-border: 1px solid var(--cngx-tag-warning-color, #f59e0b)}.cngx-tag--outline[data-color=error]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-error-color, #991b1b);--cngx-tag-border: 1px solid var(--cngx-tag-error-color, #ef4444)}.cngx-tag--outline[data-color=info]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-info-color, #1e40af);--cngx-tag-border: 1px solid var(--cngx-tag-info-color, #3b82f6)}.cngx-tag--subtle[data-color=neutral]{--cngx-tag-bg: var(--cngx-tag-neutral-subtle-bg, #f3f4f6);--cngx-tag-color: var(--cngx-tag-neutral-color, #374151);--cngx-tag-border: 1px solid transparent}.cngx-tag--subtle[data-color=success]{--cngx-tag-bg: var(--cngx-tag-success-subtle-bg, #ecfdf5);--cngx-tag-color: var(--cngx-tag-success-color, #065f46);--cngx-tag-border: 1px solid transparent}.cngx-tag--subtle[data-color=warning]{--cngx-tag-bg: var(--cngx-tag-warning-subtle-bg, #fffbeb);--cngx-tag-color: var(--cngx-tag-warning-color, #92400e);--cngx-tag-border: 1px solid transparent}.cngx-tag--subtle[data-color=error]{--cngx-tag-bg: var(--cngx-tag-error-subtle-bg, #fef2f2);--cngx-tag-color: var(--cngx-tag-error-color, #991b1b);--cngx-tag-border: 1px solid transparent}.cngx-tag--subtle[data-color=info]{--cngx-tag-bg: var(--cngx-tag-info-subtle-bg, #eff6ff);--cngx-tag-color: var(--cngx-tag-info-color, #1e40af);--cngx-tag-border: 1px solid transparent}\n"] }]
|
|
1355
|
+
}, styles: ["@layer cngx.components{@scope(.cngx-tag){:scope{display:inline-flex;align-items:center;line-height:1.25;max-width:100%;gap:var(--cngx-tag-gap, var(--cngx-space-xs, 4px));padding:var(--cngx-tag-padding, 2px 8px);font-size:var(--cngx-tag-font-size, var(--cngx-font-size-sm, .75rem))}:scope.cngx-tag--sm{padding:var(--cngx-tag-sm-padding, 0 6px);font-size:var(--cngx-tag-sm-font-size, .6875rem)}:scope.cngx-tag--lg{padding:var(--cngx-tag-lg-padding, 4px 10px);font-size:var(--cngx-tag-lg-font-size, .875rem)}:scope.cngx-tag--xl{padding:var(--cngx-tag-xl-padding, 6px 12px);font-size:var(--cngx-tag-xl-font-size, 1rem)}.cngx-tag__label{min-width:0;overflow:hidden}:scope.cngx-tag--truncate .cngx-tag__label{text-overflow:ellipsis;white-space:nowrap}}@scope(.cngx-tag-group){:scope{display:flex;flex-direction:column;gap:var(--cngx-tag-group-stack-gap, var(--cngx-space-sm, 8px))}.cngx-tag-group__row{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-start;gap:var(--cngx-tag-group-gap, var(--cngx-space-sm, 8px))}:scope.cngx-tag-group--gap-xs>.cngx-tag-group__row{gap:var(--cngx-tag-group-gap-xs, var(--cngx-space-xs, 4px))}:scope.cngx-tag-group--gap-md>.cngx-tag-group__row{gap:var(--cngx-tag-group-gap-md, 12px)}:scope.cngx-tag-group--align-start>.cngx-tag-group__row{justify-content:flex-start}:scope.cngx-tag-group--align-center>.cngx-tag-group__row{justify-content:center}:scope.cngx-tag-group--align-end>.cngx-tag-group__row{justify-content:flex-end}:scope.cngx-tag-group--align-between>.cngx-tag-group__row{justify-content:space-between}}}\n", "@layer cngx.tokens{@property --cngx-tag-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-tag-font-weight{syntax: \"*\"; inherits: false; initial-value: 500;}@property --cngx-tag-bg{syntax: \"*\"; inherits: false; initial-value: transparent;}@property --cngx-tag-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-tag-border{syntax: \"*\"; inherits: false; initial-value: 1px solid transparent;}@property --cngx-tag-gap{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-tag-padding{syntax: \"*\"; inherits: false; initial-value: 2px 8px;}@property --cngx-tag-font-size{syntax: \"*\"; inherits: false; initial-value: .75rem;}@property --cngx-tag-sm-padding{syntax: \"*\"; inherits: false; initial-value: 0 6px;}@property --cngx-tag-sm-font-size{syntax: \"*\"; inherits: false; initial-value: .6875rem;}@property --cngx-tag-lg-padding{syntax: \"*\"; inherits: false; initial-value: 4px 10px;}@property --cngx-tag-lg-font-size{syntax: \"*\"; inherits: false; initial-value: .875rem;}@property --cngx-tag-xl-padding{syntax: \"*\"; inherits: false; initial-value: 6px 12px;}@property --cngx-tag-xl-font-size{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-tag-neutral-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-tag-neutral-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.34 .015 250);}@property --cngx-tag-neutral-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(.68 .01 250);}@property --cngx-tag-neutral-subtle-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.96 .005 250);}@property --cngx-tag-success-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.95 .05 145);}@property --cngx-tag-success-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.4 .1 160);}@property --cngx-tag-success-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .15 155);}@property --cngx-tag-success-subtle-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.97 .025 145);}@property --cngx-tag-warning-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.95 .05 90);}@property --cngx-tag-warning-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.45 .12 60);}@property --cngx-tag-warning-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(.72 .18 70);}@property --cngx-tag-warning-subtle-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.98 .02 90);}@property --cngx-tag-error-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.94 .04 25);}@property --cngx-tag-error-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.4 .15 25);}@property --cngx-tag-error-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .22 25);}@property --cngx-tag-error-subtle-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.98 .015 25);}@property --cngx-tag-info-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.93 .04 240);}@property --cngx-tag-info-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.4 .15 250);}@property --cngx-tag-info-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(.62 .2 250);}@property --cngx-tag-info-subtle-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.97 .025 240);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-tag-neutral-bg: oklch(.32 .005 250);--cngx-tag-neutral-color: oklch(.85 .005 250);--cngx-tag-neutral-subtle-bg: oklch(.28 .005 250);--cngx-tag-success-bg: oklch(.32 .06 145);--cngx-tag-success-color: oklch(.85 .13 145);--cngx-tag-success-subtle-bg: oklch(.28 .04 145);--cngx-tag-warning-bg: oklch(.32 .06 75);--cngx-tag-warning-color: oklch(.88 .14 75);--cngx-tag-warning-subtle-bg: oklch(.28 .04 75);--cngx-tag-error-bg: oklch(.32 .05 25);--cngx-tag-error-color: oklch(.82 .15 25);--cngx-tag-error-subtle-bg: oklch(.28 .04 25);--cngx-tag-info-bg: oklch(.32 .05 250);--cngx-tag-info-color: oklch(.85 .13 250);--cngx-tag-info-subtle-bg: oklch(.28 .04 250)}}[data-color-scheme=dark],.dark{--cngx-tag-neutral-bg: oklch(.32 .005 250);--cngx-tag-neutral-color: oklch(.85 .005 250);--cngx-tag-neutral-subtle-bg: oklch(.28 .005 250);--cngx-tag-success-bg: oklch(.32 .06 145);--cngx-tag-success-color: oklch(.85 .13 145);--cngx-tag-success-subtle-bg: oklch(.28 .04 145);--cngx-tag-warning-bg: oklch(.32 .06 75);--cngx-tag-warning-color: oklch(.88 .14 75);--cngx-tag-warning-subtle-bg: oklch(.28 .04 75);--cngx-tag-error-bg: oklch(.32 .05 25);--cngx-tag-error-color: oklch(.82 .15 25);--cngx-tag-error-subtle-bg: oklch(.28 .04 25);--cngx-tag-info-bg: oklch(.32 .05 250);--cngx-tag-info-color: oklch(.85 .13 250);--cngx-tag-info-subtle-bg: oklch(.28 .04 250)}[data-color-scheme=light],.light{--cngx-tag-neutral-bg: oklch(.92 .005 250);--cngx-tag-neutral-color: oklch(.34 .015 250);--cngx-tag-neutral-subtle-bg: oklch(.96 .005 250);--cngx-tag-success-bg: oklch(.95 .05 145);--cngx-tag-success-color: oklch(.4 .1 160);--cngx-tag-success-subtle-bg: oklch(.97 .025 145);--cngx-tag-warning-bg: oklch(.95 .05 90);--cngx-tag-warning-color: oklch(.45 .12 60);--cngx-tag-warning-subtle-bg: oklch(.98 .02 90);--cngx-tag-error-bg: oklch(.94 .04 25);--cngx-tag-error-color: oklch(.4 .15 25);--cngx-tag-error-subtle-bg: oklch(.98 .015 25);--cngx-tag-info-bg: oklch(.93 .04 240);--cngx-tag-info-color: oklch(.4 .15 250);--cngx-tag-info-subtle-bg: oklch(.97 .025 240)}}@layer cngx.components{@scope(.cngx-tag){:scope{border-radius:var(--cngx-tag-radius, var(--cngx-radius-sm, 4px));font-weight:var(--cngx-tag-font-weight, 500);background:var(--cngx-tag-bg, transparent);color:var(--cngx-tag-color, inherit);border:var(--cngx-tag-border, 1px solid transparent)}:scope.cngx-tag--filled[data-color=neutral]{--cngx-tag-bg: var(--cngx-tag-neutral-bg);--cngx-tag-color: var(--cngx-tag-neutral-color);--cngx-tag-border: 1px solid var(--cngx-tag-neutral-border, transparent)}:scope.cngx-tag--filled[data-color=success]{--cngx-tag-bg: var(--cngx-tag-success-bg);--cngx-tag-color: var(--cngx-tag-success-color, var(--cngx-color-success));--cngx-tag-border: 1px solid var(--cngx-tag-success-border, transparent)}:scope.cngx-tag--filled[data-color=warning]{--cngx-tag-bg: var(--cngx-tag-warning-bg);--cngx-tag-color: var(--cngx-tag-warning-color, var(--cngx-color-warning));--cngx-tag-border: 1px solid var(--cngx-tag-warning-border, transparent)}:scope.cngx-tag--filled[data-color=error]{--cngx-tag-bg: var(--cngx-tag-error-bg);--cngx-tag-color: var(--cngx-tag-error-color, var(--cngx-color-danger));--cngx-tag-border: 1px solid var(--cngx-tag-error-border, transparent)}:scope.cngx-tag--filled[data-color=info]{--cngx-tag-bg: var(--cngx-tag-info-bg);--cngx-tag-color: var(--cngx-tag-info-color, var(--cngx-color-info));--cngx-tag-border: 1px solid var(--cngx-tag-info-border, transparent)}:scope.cngx-tag--outline[data-color=neutral]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-neutral-color);--cngx-tag-border: 1px solid var(--cngx-tag-neutral-color)}:scope.cngx-tag--outline[data-color=success]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-success-color, var(--cngx-color-success));--cngx-tag-border: 1px solid var(--cngx-tag-success-color, var(--cngx-color-success))}:scope.cngx-tag--outline[data-color=warning]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-warning-color, var(--cngx-color-warning));--cngx-tag-border: 1px solid var(--cngx-tag-warning-color, var(--cngx-color-warning))}:scope.cngx-tag--outline[data-color=error]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-error-color, var(--cngx-color-danger));--cngx-tag-border: 1px solid var(--cngx-tag-error-color, var(--cngx-color-danger))}:scope.cngx-tag--outline[data-color=info]{--cngx-tag-bg: transparent;--cngx-tag-color: var(--cngx-tag-info-color, var(--cngx-color-info));--cngx-tag-border: 1px solid var(--cngx-tag-info-color, var(--cngx-color-info))}:scope.cngx-tag--subtle[data-color=neutral]{--cngx-tag-bg: var(--cngx-tag-neutral-subtle-bg);--cngx-tag-color: var(--cngx-tag-neutral-color);--cngx-tag-border: 1px solid transparent}:scope.cngx-tag--subtle[data-color=success]{--cngx-tag-bg: var(--cngx-tag-success-subtle-bg);--cngx-tag-color: var(--cngx-tag-success-color, var(--cngx-color-success));--cngx-tag-border: 1px solid transparent}:scope.cngx-tag--subtle[data-color=warning]{--cngx-tag-bg: var(--cngx-tag-warning-subtle-bg);--cngx-tag-color: var(--cngx-tag-warning-color, var(--cngx-color-warning));--cngx-tag-border: 1px solid transparent}:scope.cngx-tag--subtle[data-color=error]{--cngx-tag-bg: var(--cngx-tag-error-subtle-bg);--cngx-tag-color: var(--cngx-tag-error-color, var(--cngx-color-danger));--cngx-tag-border: 1px solid transparent}:scope.cngx-tag--subtle[data-color=info]{--cngx-tag-bg: var(--cngx-tag-info-subtle-bg);--cngx-tag-color: var(--cngx-tag-info-color, var(--cngx-color-info));--cngx-tag-border: 1px solid transparent}}}\n"] }]
|
|
1077
1356
|
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], truncate: [{ type: i0.Input, args: [{ isSignal: true, alias: "truncate", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], labelSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTagLabel), { isSignal: true }] }], prefixSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTagPrefix), { isSignal: true }] }], suffixSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTagSuffix), { isSignal: true }] }] } });
|
|
1078
1357
|
|
|
1079
1358
|
/**
|
|
@@ -1153,13 +1432,14 @@ function mergeConfig(base, partial) {
|
|
|
1153
1432
|
* ],
|
|
1154
1433
|
* });
|
|
1155
1434
|
* ```
|
|
1435
|
+
*
|
|
1436
|
+
* @category common/display
|
|
1156
1437
|
*/
|
|
1157
1438
|
function provideTagConfig(...features) {
|
|
1158
|
-
// Empty-features
|
|
1159
|
-
//
|
|
1439
|
+
// Empty-features: skip the override so the root factory's
|
|
1440
|
+
// `CNGX_TAG_DEFAULTS` reference flows through untouched. A fresh
|
|
1160
1441
|
// `mergeConfig(...)` would allocate identical content under a new
|
|
1161
|
-
// reference and bust downstream identity comparisons
|
|
1162
|
-
// of `injectTagConfig()` may rely on.
|
|
1442
|
+
// reference and bust downstream identity comparisons.
|
|
1163
1443
|
if (features.length === 0) {
|
|
1164
1444
|
return makeEnvironmentProviders([]);
|
|
1165
1445
|
}
|
|
@@ -1196,6 +1476,8 @@ function provideTagConfig(...features) {
|
|
|
1196
1476
|
* })
|
|
1197
1477
|
* class AdminSection {}
|
|
1198
1478
|
* ```
|
|
1479
|
+
*
|
|
1480
|
+
* @category common/display
|
|
1199
1481
|
*/
|
|
1200
1482
|
function provideTagConfigAt(...features) {
|
|
1201
1483
|
// Empty-features call: parent value flows through untouched.
|
|
@@ -1226,6 +1508,8 @@ function provideTagConfigAt(...features) {
|
|
|
1226
1508
|
* withTagDefaults({ variant: 'subtle', size: 'sm' }),
|
|
1227
1509
|
* );
|
|
1228
1510
|
* ```
|
|
1511
|
+
*
|
|
1512
|
+
* @category common/display
|
|
1229
1513
|
*/
|
|
1230
1514
|
function withTagDefaults(payload) {
|
|
1231
1515
|
return { kind: 'defaults', payload };
|
|
@@ -1239,6 +1523,8 @@ function withTagDefaults(payload) {
|
|
|
1239
1523
|
* withTagGroupDefaults({ gap: 'md', semanticList: true }),
|
|
1240
1524
|
* );
|
|
1241
1525
|
* ```
|
|
1526
|
+
*
|
|
1527
|
+
* @category common/display
|
|
1242
1528
|
*/
|
|
1243
1529
|
function withTagGroupDefaults(payload) {
|
|
1244
1530
|
return { kind: 'groupDefaults', payload };
|
|
@@ -1266,6 +1552,8 @@ function withTagGroupDefaults(payload) {
|
|
|
1266
1552
|
* }),
|
|
1267
1553
|
* );
|
|
1268
1554
|
* ```
|
|
1555
|
+
*
|
|
1556
|
+
* @category common/display
|
|
1269
1557
|
*/
|
|
1270
1558
|
function withTagColors(payload) {
|
|
1271
1559
|
return { kind: 'colors', payload };
|
|
@@ -1301,19 +1589,21 @@ function withTagColors(payload) {
|
|
|
1301
1589
|
* // Then in providers:
|
|
1302
1590
|
* provideTagConfig(withTagSlots({ label: shell.brandLabel() }));
|
|
1303
1591
|
* ```
|
|
1592
|
+
*
|
|
1593
|
+
* @category common/display
|
|
1304
1594
|
*/
|
|
1305
1595
|
function withTagSlots(payload) {
|
|
1306
1596
|
return { kind: 'templates', payload };
|
|
1307
1597
|
}
|
|
1308
1598
|
|
|
1309
1599
|
/**
|
|
1310
|
-
* Override template for the accessory zone of `<cngx-tag-group>`
|
|
1600
|
+
* Override template for the accessory zone of `<cngx-tag-group>` -
|
|
1311
1601
|
* projected BELOW the row of tags. Use for clear-all buttons,
|
|
1312
1602
|
* sort toggles that span the group, secondary actions, or any
|
|
1313
1603
|
* trailing decoration the consumer wants to bundle with the
|
|
1314
1604
|
* layout.
|
|
1315
1605
|
*
|
|
1316
|
-
* The slot has no default body
|
|
1606
|
+
* The slot has no default body - when not projected, no DOM is
|
|
1317
1607
|
* rendered below the tag row. The reactive count of projected
|
|
1318
1608
|
* `<span cngxTag>` siblings is exposed via the slot context so
|
|
1319
1609
|
* consumer "Clear all (5)" patterns work without injection.
|
|
@@ -1327,6 +1617,24 @@ function withTagSlots(payload) {
|
|
|
1327
1617
|
* </ng-template>
|
|
1328
1618
|
* </cngx-tag-group>
|
|
1329
1619
|
* ```
|
|
1620
|
+
*
|
|
1621
|
+
* @category common/display
|
|
1622
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/tag-group/slots/tag-group-accessory.directive.ts
|
|
1623
|
+
* @since 0.1.0
|
|
1624
|
+
* @relatedTo CngxTagGroup, CngxTagGroupHeader
|
|
1625
|
+
* <example-url>http://localhost:4200/#/common/display/tag/app-wide-defaults-via-providetagconfig</example-url>
|
|
1626
|
+
* <example-url>http://localhost:4200/#/common/display/tag/color-palette</example-url>
|
|
1627
|
+
* <example-url>http://localhost:4200/#/common/display/tag/composition-with-cngxicon</example-url>
|
|
1628
|
+
* <example-url>http://localhost:4200/#/common/display/tag/density</example-url>
|
|
1629
|
+
* <example-url>http://localhost:4200/#/common/display/tag/group-semantic-list</example-url>
|
|
1630
|
+
* <example-url>http://localhost:4200/#/common/display/tag/group-with-header-accessory</example-url>
|
|
1631
|
+
* <example-url>http://localhost:4200/#/common/display/tag/layout-only-alignment</example-url>
|
|
1632
|
+
* <example-url>http://localhost:4200/#/common/display/tag/layout-only-gap-variants</example-url>
|
|
1633
|
+
* <example-url>http://localhost:4200/#/common/display/tag/link-mode</example-url>
|
|
1634
|
+
* <example-url>http://localhost:4200/#/common/display/tag/slot-overrides-custom-label</example-url>
|
|
1635
|
+
* <example-url>http://localhost:4200/#/common/display/tag/slot-overrides-prefix-label-suffix</example-url>
|
|
1636
|
+
* <example-url>http://localhost:4200/#/common/display/tag/truncate-maxwidth</example-url>
|
|
1637
|
+
* <example-url>http://localhost:4200/#/common/display/tag/variant-matrix</example-url>
|
|
1330
1638
|
*/
|
|
1331
1639
|
class CngxTagGroupAccessory {
|
|
1332
1640
|
templateRef = inject(TemplateRef);
|
|
@@ -1343,13 +1651,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1343
1651
|
}] });
|
|
1344
1652
|
|
|
1345
1653
|
/**
|
|
1346
|
-
* Override template for the header zone of `<cngx-tag-group>`
|
|
1654
|
+
* Override template for the header zone of `<cngx-tag-group>` -
|
|
1347
1655
|
* projected ABOVE the row of tags. Use for label-prefix
|
|
1348
1656
|
* ("Filters"), count badges, sort toggles that span the group, or
|
|
1349
1657
|
* any header decoration the consumer wants to bundle with the
|
|
1350
1658
|
* layout.
|
|
1351
1659
|
*
|
|
1352
|
-
* The slot has no default body
|
|
1660
|
+
* The slot has no default body - when not projected, no DOM is
|
|
1353
1661
|
* rendered above the tag row. The reactive count of projected
|
|
1354
1662
|
* `<span cngxTag>` siblings is exposed via the slot context for
|
|
1355
1663
|
* consumer "Filters ({{ count }})" patterns without injection.
|
|
@@ -1363,6 +1671,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1363
1671
|
* <span cngxTag>Backend</span>
|
|
1364
1672
|
* </cngx-tag-group>
|
|
1365
1673
|
* ```
|
|
1674
|
+
*
|
|
1675
|
+
* @category common/display
|
|
1676
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/tag-group/slots/tag-group-header.directive.ts
|
|
1677
|
+
* @since 0.1.0
|
|
1678
|
+
* @relatedTo CngxTagGroup, CngxTagGroupAccessory
|
|
1679
|
+
* <example-url>http://localhost:4200/#/common/display/tag/app-wide-defaults-via-providetagconfig</example-url>
|
|
1680
|
+
* <example-url>http://localhost:4200/#/common/display/tag/color-palette</example-url>
|
|
1681
|
+
* <example-url>http://localhost:4200/#/common/display/tag/composition-with-cngxicon</example-url>
|
|
1682
|
+
* <example-url>http://localhost:4200/#/common/display/tag/density</example-url>
|
|
1683
|
+
* <example-url>http://localhost:4200/#/common/display/tag/group-semantic-list</example-url>
|
|
1684
|
+
* <example-url>http://localhost:4200/#/common/display/tag/group-with-header-accessory</example-url>
|
|
1685
|
+
* <example-url>http://localhost:4200/#/common/display/tag/layout-only-alignment</example-url>
|
|
1686
|
+
* <example-url>http://localhost:4200/#/common/display/tag/layout-only-gap-variants</example-url>
|
|
1687
|
+
* <example-url>http://localhost:4200/#/common/display/tag/link-mode</example-url>
|
|
1688
|
+
* <example-url>http://localhost:4200/#/common/display/tag/slot-overrides-custom-label</example-url>
|
|
1689
|
+
* <example-url>http://localhost:4200/#/common/display/tag/slot-overrides-prefix-label-suffix</example-url>
|
|
1690
|
+
* <example-url>http://localhost:4200/#/common/display/tag/truncate-maxwidth</example-url>
|
|
1691
|
+
* <example-url>http://localhost:4200/#/common/display/tag/variant-matrix</example-url>
|
|
1366
1692
|
*/
|
|
1367
1693
|
class CngxTagGroupHeader {
|
|
1368
1694
|
templateRef = inject(TemplateRef);
|
|
@@ -1389,8 +1715,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1389
1715
|
* accessory slot zones. The cascade that flips each child's
|
|
1390
1716
|
* `role="listitem"` lives on the `CngxTag` side (`tag.directive.ts`
|
|
1391
1717
|
* reads `CNGX_TAG_GROUP.semanticList()` through a `computed`); this
|
|
1392
|
-
* component just provides the implementer of that token (Pillar 1
|
|
1393
|
-
* derivation rather than imperative sync; Pillar 2
|
|
1718
|
+
* component just provides the implementer of that token (Pillar 1 -
|
|
1719
|
+
* derivation rather than imperative sync; Pillar 2 - ARIA in the
|
|
1394
1720
|
* reactive graph).
|
|
1395
1721
|
*
|
|
1396
1722
|
* **Responsibilities (intentionally narrow).**
|
|
@@ -1407,22 +1733,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1407
1733
|
* `CngxTag` children via the slot context.
|
|
1408
1734
|
*
|
|
1409
1735
|
* **Non-responsibilities.**
|
|
1410
|
-
* - No `role="listitem"` cascade implementation here
|
|
1736
|
+
* - No `role="listitem"` cascade implementation here - that lives in
|
|
1411
1737
|
* `CngxTag` so the cascade survives any future non-component
|
|
1412
1738
|
* implementer of `CngxTagGroupHost` (test doubles, programmatic
|
|
1413
1739
|
* groups).
|
|
1414
|
-
* - No `hostDirectives`
|
|
1740
|
+
* - No `hostDirectives` - decorative atoms have no shared cross-cutting
|
|
1415
1741
|
* behaviour to compose. Per atomic-decompose rule 1 the absence is
|
|
1416
1742
|
* the right call until a future shared concern lands.
|
|
1417
|
-
* - Configuration cascade (`provideTagConfig`)
|
|
1743
|
+
* - Configuration cascade (`provideTagConfig`) - deferred (see
|
|
1418
1744
|
* `display-accepted-debt.md §1`).
|
|
1745
|
+
*
|
|
1746
|
+
* @category common/display
|
|
1747
|
+
* @docsKind primary
|
|
1748
|
+
* @wcag AA
|
|
1749
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/tag-group/tag-group.component.ts
|
|
1750
|
+
* @since 0.1.0
|
|
1751
|
+
* @relatedTo CngxTag, CngxTagGroupHeader, CngxTagGroupAccessory, CNGX_TAG_GROUP
|
|
1752
|
+
* <example-url>http://localhost:4200/#/common/display/tag/app-wide-defaults-via-providetagconfig</example-url>
|
|
1753
|
+
* <example-url>http://localhost:4200/#/common/display/tag/color-palette</example-url>
|
|
1754
|
+
* <example-url>http://localhost:4200/#/common/display/tag/composition-with-cngxicon</example-url>
|
|
1755
|
+
* <example-url>http://localhost:4200/#/common/display/tag/density</example-url>
|
|
1756
|
+
* <example-url>http://localhost:4200/#/common/display/tag-group/semantic-list</example-url>
|
|
1757
|
+
* <example-url>http://localhost:4200/#/common/display/tag-group/with-header-accessory</example-url>
|
|
1758
|
+
* <example-url>http://localhost:4200/#/common/display/tag-group/alignment</example-url>
|
|
1759
|
+
* <example-url>http://localhost:4200/#/common/display/tag-group/gap-variants</example-url>
|
|
1760
|
+
* <example-url>http://localhost:4200/#/common/display/tag/link-mode</example-url>
|
|
1761
|
+
* <example-url>http://localhost:4200/#/common/display/tag/slot-overrides-custom-label</example-url>
|
|
1762
|
+
* <example-url>http://localhost:4200/#/common/display/tag/slot-overrides-prefix-label-suffix</example-url>
|
|
1763
|
+
* <example-url>http://localhost:4200/#/common/display/tag/truncate-maxwidth</example-url>
|
|
1764
|
+
* <example-url>http://localhost:4200/#/common/display/tag/variant-matrix</example-url>
|
|
1419
1765
|
*/
|
|
1420
1766
|
class CngxTagGroup {
|
|
1421
1767
|
/**
|
|
1422
1768
|
* Snapshot of the resolved tag-family config at construction
|
|
1423
1769
|
* time. Drives the per-input fallback defaults below.
|
|
1424
1770
|
*
|
|
1425
|
-
* **Field-init ordering is load-bearing**
|
|
1771
|
+
* **Field-init ordering is load-bearing** - must be declared
|
|
1426
1772
|
* before any input field that reads `this.cfg.groupDefaults?.*`.
|
|
1427
1773
|
* Per the `tag-family-architectural-a-plus-pass` plan
|
|
1428
1774
|
* Architectural-Decisions table.
|
|
@@ -1442,10 +1788,10 @@ class CngxTagGroup {
|
|
|
1442
1788
|
/**
|
|
1443
1789
|
* Input-binding hook for the public `[semanticList]` attribute.
|
|
1444
1790
|
* Accessed by Angular's template type-checker on consumer
|
|
1445
|
-
* markup
|
|
1791
|
+
* markup - therefore must be class-public (Angular rejects
|
|
1446
1792
|
* `private` per NG1053; `protected` blocks external template
|
|
1447
1793
|
* bindings). The hook is intentionally **not** the contract
|
|
1448
|
-
* surface
|
|
1794
|
+
* surface - that role belongs to `semanticList` below, typed
|
|
1449
1795
|
* `Signal<boolean>` so test doubles and programmatic
|
|
1450
1796
|
* implementers of `CngxTagGroupHost` can satisfy the interface
|
|
1451
1797
|
* without owning an Angular `input()`.
|
|
@@ -1470,13 +1816,13 @@ class CngxTagGroup {
|
|
|
1470
1816
|
*/
|
|
1471
1817
|
count = computed(() => this.projectedTags().length, ...(ngDevMode ? [{ debugName: "count" }] : /* istanbul ignore next */ []));
|
|
1472
1818
|
/**
|
|
1473
|
-
* Per-instance header-slot directive
|
|
1819
|
+
* Per-instance header-slot directive - projected as
|
|
1474
1820
|
* `<ng-template cngxTagGroupHeader>...</ng-template>`. Resolved
|
|
1475
1821
|
* through {@link injectResolvedTagTemplate} so consumers can
|
|
1476
1822
|
* project a header without wrapping the group component.
|
|
1477
1823
|
*/
|
|
1478
1824
|
headerSlot = contentChild(CngxTagGroupHeader, ...(ngDevMode ? [{ debugName: "headerSlot" }] : /* istanbul ignore next */ []));
|
|
1479
|
-
/** Per-instance accessory-slot directive
|
|
1825
|
+
/** Per-instance accessory-slot directive - projected below the row. */
|
|
1480
1826
|
accessorySlot = contentChild(CngxTagGroupAccessory, ...(ngDevMode ? [{ debugName: "accessorySlot" }] : /* istanbul ignore next */ []));
|
|
1481
1827
|
/**
|
|
1482
1828
|
* Resolved header template. Phase 2 cascade: instance slot → null
|
|
@@ -1490,7 +1836,7 @@ class CngxTagGroup {
|
|
|
1490
1836
|
/**
|
|
1491
1837
|
* Projected `<span cngxTag>` siblings. Default-scoped
|
|
1492
1838
|
* (`descendants: false`) so tags inside consumer-projected header /
|
|
1493
|
-
* accessory templates do NOT inflate the count
|
|
1839
|
+
* accessory templates do NOT inflate the count - the count
|
|
1494
1840
|
* represents the row's own taxonomy items, not arbitrary tag
|
|
1495
1841
|
* usage inside the slot zones.
|
|
1496
1842
|
*/
|
|
@@ -1502,7 +1848,7 @@ class CngxTagGroup {
|
|
|
1502
1848
|
* serves both. Consumer templates `let-count="count"` etc. read
|
|
1503
1849
|
* the live state without injecting the directive.
|
|
1504
1850
|
*
|
|
1505
|
-
* Explicit structural `equal` fn
|
|
1851
|
+
* Explicit structural `equal` fn - without it, a fresh literal
|
|
1506
1852
|
* each CD cycle would force `ngTemplateOutlet` to rebind embedded
|
|
1507
1853
|
* views even when no input changed. Per
|
|
1508
1854
|
* `reference_signal_architecture` §1 Equality Rule: every
|
|
@@ -1521,20 +1867,9 @@ class CngxTagGroup {
|
|
|
1521
1867
|
a.label === b.label &&
|
|
1522
1868
|
a.count === b.count });
|
|
1523
1869
|
constructor() {
|
|
1524
|
-
// Dev-mode advisory:
|
|
1525
|
-
// `
|
|
1526
|
-
//
|
|
1527
|
-
// but doesn't surface "list, N items" — likely not the
|
|
1528
|
-
// consumer's intent. One-shot post-mount check; tree-shaken in
|
|
1529
|
-
// prod via the `isDevMode()` guard.
|
|
1530
|
-
//
|
|
1531
|
-
// `afterNextRender` is the canonical hook for one-shot
|
|
1532
|
-
// post-mount checks (per `reference_signal_architecture` Hook
|
|
1533
|
-
// Selection Matrix); `effect()` would re-fire on every input
|
|
1534
|
-
// change. Reads are wrapped in `untracked()` defensively —
|
|
1535
|
-
// `afterNextRender` does not establish a reactive scope, but
|
|
1536
|
-
// the explicit wrapper documents one-shot intent and matches
|
|
1537
|
-
// the cngx style-guide bias toward signal-read hygiene.
|
|
1870
|
+
// Dev-mode advisory: `[label]` without `[semanticList]="true"` lands
|
|
1871
|
+
// `aria-label` on a bare `<div>` - AT reads the label but won't
|
|
1872
|
+
// announce "list, N items". One-shot, tree-shaken in prod.
|
|
1538
1873
|
afterNextRender(() => {
|
|
1539
1874
|
const { label, semanticList } = untracked(() => ({
|
|
1540
1875
|
label: this.label(),
|
|
@@ -1559,7 +1894,7 @@ class CngxTagGroup {
|
|
|
1559
1894
|
@if (accessoryTpl(); as t) {
|
|
1560
1895
|
<ng-container *ngTemplateOutlet="t; context: slotContext()" />
|
|
1561
1896
|
}
|
|
1562
|
-
`, isInline: true, styles: [".cngx-tag{display:inline-flex;align-items:center;gap:var(--cngx-tag-gap,
|
|
1897
|
+
`, isInline: true, styles: ["@layer cngx.components{@scope(.cngx-tag){:scope{display:inline-flex;align-items:center;line-height:1.25;max-width:100%;gap:var(--cngx-tag-gap, var(--cngx-space-xs, 4px));padding:var(--cngx-tag-padding, 2px 8px);font-size:var(--cngx-tag-font-size, var(--cngx-font-size-sm, .75rem))}:scope.cngx-tag--sm{padding:var(--cngx-tag-sm-padding, 0 6px);font-size:var(--cngx-tag-sm-font-size, .6875rem)}:scope.cngx-tag--lg{padding:var(--cngx-tag-lg-padding, 4px 10px);font-size:var(--cngx-tag-lg-font-size, .875rem)}:scope.cngx-tag--xl{padding:var(--cngx-tag-xl-padding, 6px 12px);font-size:var(--cngx-tag-xl-font-size, 1rem)}.cngx-tag__label{min-width:0;overflow:hidden}:scope.cngx-tag--truncate .cngx-tag__label{text-overflow:ellipsis;white-space:nowrap}}@scope(.cngx-tag-group){:scope{display:flex;flex-direction:column;gap:var(--cngx-tag-group-stack-gap, var(--cngx-space-sm, 8px))}.cngx-tag-group__row{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-start;gap:var(--cngx-tag-group-gap, var(--cngx-space-sm, 8px))}:scope.cngx-tag-group--gap-xs>.cngx-tag-group__row{gap:var(--cngx-tag-group-gap-xs, var(--cngx-space-xs, 4px))}:scope.cngx-tag-group--gap-md>.cngx-tag-group__row{gap:var(--cngx-tag-group-gap-md, 12px)}:scope.cngx-tag-group--align-start>.cngx-tag-group__row{justify-content:flex-start}:scope.cngx-tag-group--align-center>.cngx-tag-group__row{justify-content:center}:scope.cngx-tag-group--align-end>.cngx-tag-group__row{justify-content:flex-end}:scope.cngx-tag-group--align-between>.cngx-tag-group__row{justify-content:space-between}}}\n", "@layer cngx.tokens{@property --cngx-tag-group-stack-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-tag-group-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-tag-group-gap-xs{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-tag-group-gap-md{syntax: \"<length>\"; inherits: false; initial-value: 12px;}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1563
1898
|
}
|
|
1564
1899
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTagGroup, decorators: [{
|
|
1565
1900
|
type: Component,
|
|
@@ -1583,7 +1918,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1583
1918
|
'[class.cngx-tag-group--align-between]': "align() === 'between'",
|
|
1584
1919
|
'[attr.role]': "semanticList() ? 'list' : null",
|
|
1585
1920
|
'[attr.aria-label]': 'label() ?? null',
|
|
1586
|
-
}, styles: [".cngx-tag{display:inline-flex;align-items:center;gap:var(--cngx-tag-gap,
|
|
1921
|
+
}, styles: ["@layer cngx.components{@scope(.cngx-tag){:scope{display:inline-flex;align-items:center;line-height:1.25;max-width:100%;gap:var(--cngx-tag-gap, var(--cngx-space-xs, 4px));padding:var(--cngx-tag-padding, 2px 8px);font-size:var(--cngx-tag-font-size, var(--cngx-font-size-sm, .75rem))}:scope.cngx-tag--sm{padding:var(--cngx-tag-sm-padding, 0 6px);font-size:var(--cngx-tag-sm-font-size, .6875rem)}:scope.cngx-tag--lg{padding:var(--cngx-tag-lg-padding, 4px 10px);font-size:var(--cngx-tag-lg-font-size, .875rem)}:scope.cngx-tag--xl{padding:var(--cngx-tag-xl-padding, 6px 12px);font-size:var(--cngx-tag-xl-font-size, 1rem)}.cngx-tag__label{min-width:0;overflow:hidden}:scope.cngx-tag--truncate .cngx-tag__label{text-overflow:ellipsis;white-space:nowrap}}@scope(.cngx-tag-group){:scope{display:flex;flex-direction:column;gap:var(--cngx-tag-group-stack-gap, var(--cngx-space-sm, 8px))}.cngx-tag-group__row{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-start;gap:var(--cngx-tag-group-gap, var(--cngx-space-sm, 8px))}:scope.cngx-tag-group--gap-xs>.cngx-tag-group__row{gap:var(--cngx-tag-group-gap-xs, var(--cngx-space-xs, 4px))}:scope.cngx-tag-group--gap-md>.cngx-tag-group__row{gap:var(--cngx-tag-group-gap-md, 12px)}:scope.cngx-tag-group--align-start>.cngx-tag-group__row{justify-content:flex-start}:scope.cngx-tag-group--align-center>.cngx-tag-group__row{justify-content:center}:scope.cngx-tag-group--align-end>.cngx-tag-group__row{justify-content:flex-end}:scope.cngx-tag-group--align-between>.cngx-tag-group__row{justify-content:space-between}}}\n", "@layer cngx.tokens{@property --cngx-tag-group-stack-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-tag-group-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-tag-group-gap-xs{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-tag-group-gap-md{syntax: \"<length>\"; inherits: false; initial-value: 12px;}}\n"] }]
|
|
1587
1922
|
}], ctorParameters: () => [], propDecorators: { gap: [{ type: i0.Input, args: [{ isSignal: true, alias: "gap", required: false }] }], align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], semanticListInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "semanticList", required: false }] }], headerSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTagGroupHeader), { isSignal: true }] }], accessorySlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxTagGroupAccessory), { isSignal: true }] }], projectedTags: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxTag), { isSignal: true }] }] } });
|
|
1588
1923
|
|
|
1589
1924
|
/**
|
|
@@ -1599,5 +1934,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1599
1934
|
* Generated bundle index. Do not edit.
|
|
1600
1935
|
*/
|
|
1601
1936
|
|
|
1602
|
-
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 };
|
|
1937
|
+
export { CNGX_TAG_CONFIG, CNGX_TAG_GROUP, CngxAvatar, CngxBadge, CngxCheckboxIndicator, CngxChip, CngxDivider, CngxIcon, CngxRadioIndicator, CngxSegmentedProgress, CngxTag, CngxTagGroup, CngxTagGroupAccessory, CngxTagGroupHeader, CngxTagLabel, CngxTagPrefix, CngxTagSuffix, injectTagConfig, provideTagConfig, provideTagConfigAt, withTagColors, withTagDefaults, withTagGroupDefaults, withTagSlots };
|
|
1603
1938
|
//# sourceMappingURL=cngx-common-display.mjs.map
|