@cngx/common 0.1.0-rc.6 → 0.1.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/card/README.md +2 -1
- package/chart/README.md +85 -0
- package/command/README.md +157 -0
- package/data/README.md +33 -1
- package/dialog/README.md +23 -1
- package/fesm2022/cngx-common-a11y.mjs +356 -180
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +84 -42
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +311 -53
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +4360 -1625
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +171 -0
- package/fesm2022/cngx-common-command.mjs.map +1 -0
- package/fesm2022/cngx-common-data.mjs +1556 -616
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +518 -112
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +468 -87
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +2725 -1303
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +943 -164
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +769 -103
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +816 -348
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +2330 -1554
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +1170 -0
- package/fesm2022/cngx-common-timeline.mjs.map +1 -0
- package/fesm2022/cngx-common.mjs +2 -2
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +15 -4
- package/layout/README.md +21 -1
- package/package.json +11 -1
- package/popover/README.md +18 -2
- package/stepper/README.md +7 -5
- package/theming/components/cngx-accordion.css +4 -1
- package/theming/components/cngx-backdrop.css +12 -0
- package/theming/components/cngx-badge.css +22 -0
- package/theming/components/cngx-bottom-sheet.css +14 -2
- package/theming/components/cngx-breadcrumb.css +8 -0
- package/theming/components/cngx-button-toggle.css +73 -5
- package/theming/components/cngx-data-grid.css +234 -1
- package/theming/components/cngx-dialog.css +25 -0
- package/theming/components/cngx-divider.css +12 -0
- package/theming/components/cngx-listbox.css +48 -12
- package/theming/components/cngx-menu.css +91 -15
- package/theming/components/cngx-popover.css +24 -0
- package/theming/components/cngx-recycler-placeholder.css +196 -0
- package/theming/components/cngx-ripple.css +2 -2
- package/theming/components/cngx-slider.css +32 -1
- package/theming/components/cngx-tooltip.css +23 -0
- package/timeline/README.md +155 -0
- package/types/cngx-common-a11y.d.ts +101 -31
- package/types/cngx-common-audio.d.ts +32 -32
- package/types/cngx-common-card.d.ts +211 -20
- package/types/cngx-common-chart.d.ts +1605 -169
- package/types/cngx-common-command.d.ts +190 -0
- package/types/cngx-common-data.d.ts +842 -163
- package/types/cngx-common-dialog.d.ts +372 -28
- package/types/cngx-common-display.d.ts +432 -148
- package/types/cngx-common-interactive.d.ts +1553 -370
- package/types/cngx-common-layout.d.ts +613 -27
- package/types/cngx-common-popover.d.ts +376 -36
- package/types/cngx-common-stepper.d.ts +414 -114
- package/types/cngx-common-tabs.d.ts +597 -72
- package/types/cngx-common-timeline.d.ts +1125 -0
- package/types/cngx-common.d.ts +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, ViewEncapsulation, ChangeDetectionStrategy, Component, computed, Directive,
|
|
3
|
-
import {
|
|
2
|
+
import { input, ViewEncapsulation, ChangeDetectionStrategy, Component, InjectionToken, inject, computed, Directive, linkedSignal, ElementRef, contentChildren, afterRenderEffect, Renderer2, effect, DestroyRef, output, booleanAttribute, isDevMode, afterNextRender, TemplateRef, contentChild, makeEnvironmentProviders, untracked } from '@angular/core';
|
|
3
|
+
import { formatMessage, createNestedLanguageSection, createSectionBundle } from '@cngx/core/i18n';
|
|
4
|
+
import { createOverrideMerge, injectLocale, numberFormatterFor, nextUid, memoize, dateTimeFormatterFor } from '@cngx/core/utils';
|
|
4
5
|
import { NgTemplateOutlet } from '@angular/common';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -56,6 +57,131 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
56
57
|
}, 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"] }]
|
|
57
58
|
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
58
59
|
|
|
60
|
+
/**
|
|
61
|
+
* The English display section: the single source of the display atoms'
|
|
62
|
+
* English copy. `CNGX_DISPLAY_I18N` defaults to it.
|
|
63
|
+
*
|
|
64
|
+
* @category common/display/i18n
|
|
65
|
+
* @since 0.1.0
|
|
66
|
+
* @relatedTo CNGX_DISPLAY_I18N
|
|
67
|
+
*/
|
|
68
|
+
const CNGX_DISPLAY_LANGUAGE_EN = {
|
|
69
|
+
avatarStatus: { online: 'online', offline: 'offline', busy: 'busy', away: 'away' },
|
|
70
|
+
avatarGroupNoun: 'avatars',
|
|
71
|
+
avatarGroupLabel: '{count} {noun}',
|
|
72
|
+
avatarGroupLabelHidden: '{count} {noun}, {hidden} not shown',
|
|
73
|
+
avatarGroupOverflow: '+{count}',
|
|
74
|
+
segmentedProgressValueText: '{now} of {max}',
|
|
75
|
+
chipRemove: 'Remove',
|
|
76
|
+
badgeOverflow: '{max}+',
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @internal Marks an `avatarGroupLabel` built from a language section, not by
|
|
81
|
+
* a consumer. The mark travels on the function itself, non-enumerable, so no
|
|
82
|
+
* global registry is written.
|
|
83
|
+
*/
|
|
84
|
+
const SECTION_AVATAR_GROUP_LABEL = Symbol('cngxSectionAvatarGroupLabel');
|
|
85
|
+
/**
|
|
86
|
+
* @internal Whether an `avatarGroupLabel` came from a language section. Such a
|
|
87
|
+
* formatter composes from `avatarGroupLabelFor` and the resolved noun, so a
|
|
88
|
+
* noun-only override still reaches AT; a consumer formatter owns the phrase.
|
|
89
|
+
*/
|
|
90
|
+
function isSectionAvatarGroupLabel(format) {
|
|
91
|
+
return SECTION_AVATAR_GROUP_LABEL in format;
|
|
92
|
+
}
|
|
93
|
+
/** @internal Turns a display section into the token's keys for a locale. */
|
|
94
|
+
function displayBundleFrom(section, locale) {
|
|
95
|
+
const avatarGroupLabelFor = (count, hidden, noun) => formatMessage(hidden > 0 ? section.avatarGroupLabelHidden : section.avatarGroupLabel, { count, hidden, noun }, locale);
|
|
96
|
+
const avatarGroupLabel = (total, hidden) => avatarGroupLabelFor(total, hidden, section.avatarGroupNoun);
|
|
97
|
+
Object.defineProperty(avatarGroupLabel, SECTION_AVATAR_GROUP_LABEL, { value: true });
|
|
98
|
+
return {
|
|
99
|
+
avatarStatus: (status) => section.avatarStatus[status],
|
|
100
|
+
avatarGroupNoun: section.avatarGroupNoun,
|
|
101
|
+
avatarGroupLabel,
|
|
102
|
+
avatarGroupLabelFor,
|
|
103
|
+
avatarGroupOverflow: (count) => formatMessage(section.avatarGroupOverflow, { count }, locale),
|
|
104
|
+
segmentedProgressValueText: (now, max) => formatMessage(section.segmentedProgressValueText, { now, max }, locale),
|
|
105
|
+
chipRemove: section.chipRemove,
|
|
106
|
+
badgeOverflow: (max) => formatMessage(section.badgeOverflow, { max }, locale),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/** @internal The display section of the active pack over English. */
|
|
110
|
+
const injectDisplaySection = createNestedLanguageSection('display', CNGX_DISPLAY_LANGUAGE_EN, 'avatarStatus');
|
|
111
|
+
/** @internal Builds and reads the token, formatted for the reading locale. */
|
|
112
|
+
const displayBundle = createSectionBundle({
|
|
113
|
+
section: injectDisplaySection,
|
|
114
|
+
toBundle: displayBundleFrom,
|
|
115
|
+
});
|
|
116
|
+
/**
|
|
117
|
+
* DI token for the display i18n bundle. `providedIn: 'root'`: the display
|
|
118
|
+
* section of the active language pack over the English defaults, formatted
|
|
119
|
+
* for the app locale; the value is a `Signal`, shared by every reader under
|
|
120
|
+
* one injector.
|
|
121
|
+
*
|
|
122
|
+
* @category common/display/i18n
|
|
123
|
+
* @wcag AA
|
|
124
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/i18n/display-i18n.ts
|
|
125
|
+
* @since 0.1.0
|
|
126
|
+
* @relatedTo CngxAvatar, CngxAvatarGroup, CngxSegmentedProgress, CngxChip
|
|
127
|
+
*/
|
|
128
|
+
const CNGX_DISPLAY_I18N = new InjectionToken('CngxDisplayI18n', {
|
|
129
|
+
providedIn: 'root',
|
|
130
|
+
factory: () => displayBundle.build(),
|
|
131
|
+
});
|
|
132
|
+
/** @internal */
|
|
133
|
+
function defineDisplayI18nFeature(fn) {
|
|
134
|
+
return Object.assign(fn, { _target: 'i18n' });
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Override display labels via a partial bundle - unset keys keep the
|
|
138
|
+
* language pack's copy, or the English default. Pass a `Signal` of a partial
|
|
139
|
+
* bundle to switch languages at runtime.
|
|
140
|
+
*
|
|
141
|
+
* @category common/display/i18n
|
|
142
|
+
* @since 0.1.0
|
|
143
|
+
*/
|
|
144
|
+
function withDisplayI18nLabels(overrides) {
|
|
145
|
+
return defineDisplayI18nFeature((bundle) => createOverrideMerge(bundle, overrides));
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Provider for the display i18n bundle. Returns a plain `Provider`, so it also
|
|
149
|
+
* scopes a subtree through `viewProviders`. The features apply on top of the
|
|
150
|
+
* active language pack.
|
|
151
|
+
*
|
|
152
|
+
* ```ts
|
|
153
|
+
* bootstrapApplication(AppComponent, {
|
|
154
|
+
* providers: [
|
|
155
|
+
* provideDisplayI18n(
|
|
156
|
+
* withDisplayI18nLabels({
|
|
157
|
+
* avatarStatus: (status) => ({ online: 'online', offline: 'offline', busy: 'beschaeftigt', away: 'abwesend' })[status],
|
|
158
|
+
* chipRemove: 'Entfernen',
|
|
159
|
+
* }),
|
|
160
|
+
* ),
|
|
161
|
+
* ],
|
|
162
|
+
* });
|
|
163
|
+
* ```
|
|
164
|
+
*
|
|
165
|
+
* @category common/display/i18n
|
|
166
|
+
* @since 0.1.0
|
|
167
|
+
*/
|
|
168
|
+
function provideDisplayI18n(...features) {
|
|
169
|
+
return {
|
|
170
|
+
provide: CNGX_DISPLAY_I18N,
|
|
171
|
+
useFactory: () => displayBundle.build(features),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Inject the resolved display i18n bundle signal. Read it inside a
|
|
176
|
+
* `computed()` or template so a runtime override flip re-derives.
|
|
177
|
+
*
|
|
178
|
+
* @category common/display/i18n
|
|
179
|
+
* @since 0.1.0
|
|
180
|
+
*/
|
|
181
|
+
function injectDisplayI18n() {
|
|
182
|
+
return displayBundle.resolve(inject(CNGX_DISPLAY_I18N));
|
|
183
|
+
}
|
|
184
|
+
|
|
59
185
|
const segmentsEqual = (a, b) => a.length === b.length && a.every((s, i) => s === b[i]);
|
|
60
186
|
/**
|
|
61
187
|
* Generic segmented position indicator - a discrete progress bar split
|
|
@@ -85,6 +211,7 @@ const segmentsEqual = (a, b) => a.length === b.length && a.every((s, i) => s ===
|
|
|
85
211
|
* <example-url>http://localhost:4200/#/common/display/segmented-progress/error-segment</example-url>
|
|
86
212
|
*/
|
|
87
213
|
class CngxSegmentedProgress {
|
|
214
|
+
i18n = injectDisplayI18n();
|
|
88
215
|
/** Number of completed positions (0-based count). Drives derivation. */
|
|
89
216
|
value = input(0, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
90
217
|
/** Total number of segments when deriving from `[value]`. */
|
|
@@ -97,9 +224,10 @@ class CngxSegmentedProgress {
|
|
|
97
224
|
/**
|
|
98
225
|
* Override the `aria-valuetext` string. Receives `(now, max)` - the
|
|
99
226
|
* completed-segment count and the total segment count. Mirrors
|
|
100
|
-
* `CngxStepperCount.format`;
|
|
101
|
-
*
|
|
102
|
-
*
|
|
227
|
+
* `CngxStepperCount.format`; wins over the app-wide
|
|
228
|
+
* `CNGX_DISPLAY_I18N.segmentedProgressValueText` (English default
|
|
229
|
+
* `(now, max) => \`${now} of ${max}\``). Supply a closure for per-instance
|
|
230
|
+
* position text (e.g. `(n, m) => \`Schritt ${n} von ${m}\``).
|
|
103
231
|
*/
|
|
104
232
|
valueTextFormat = input(undefined, ...(ngDevMode ? [{ debugName: "valueTextFormat" }] : /* istanbul ignore next */ []));
|
|
105
233
|
/** Segments actually rendered: explicit when supplied, else derived. */
|
|
@@ -124,7 +252,7 @@ class CngxSegmentedProgress {
|
|
|
124
252
|
}, ...(ngDevMode ? [{ debugName: "now" }] : /* istanbul ignore next */ []));
|
|
125
253
|
/** `aria-valuetext` - human-readable position via the resolved format closure. */
|
|
126
254
|
valueText = computed(() => {
|
|
127
|
-
const fmt = this.valueTextFormat() ?? (
|
|
255
|
+
const fmt = this.valueTextFormat() ?? this.i18n().segmentedProgressValueText;
|
|
128
256
|
return fmt(this.now(), this.max());
|
|
129
257
|
}, ...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
|
|
130
258
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSegmentedProgress, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -136,7 +264,7 @@ class CngxSegmentedProgress {
|
|
|
136
264
|
aria-hidden="true"
|
|
137
265
|
></span>
|
|
138
266
|
}
|
|
139
|
-
`, isInline: true, styles: [".cngx-segmented-progress{--cngx-segmented-progress-gap: var(--cngx-space-xs, .25rem);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(--
|
|
267
|
+
`, isInline: true, styles: [".cngx-segmented-progress{--cngx-segmented-progress-gap: var(--cngx-space-xs, .25rem);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(--cngx-color-border, oklch(.88 .005 250)));transition:background var(--cngx-segmented-progress-transition, var(--cngx-duration-fast, .15s) ease)}.cngx-segmented-progress__segment[data-state=done]{background:var(--cngx-segmented-progress-done-color, var(--cngx-color-primary, oklch(.66 .19 50)))}.cngx-segmented-progress__segment[data-state=active]{background:color-mix(in oklab,var(--cngx-segmented-progress-active-color, var(--cngx-color-primary, oklch(.66 .19 50))) 60%,var(--cngx-color-surface, oklch(1 0 0)))}.cngx-segmented-progress__segment[data-state=error]{background:var(--cngx-segmented-progress-error-color, var(--cngx-color-danger, oklch(.6 .18 25)))}@media(forced-colors:active){.cngx-segmented-progress__segment{forced-color-adjust:none;background:Canvas;outline:1px solid CanvasText;outline-offset:-1px}.cngx-segmented-progress__segment[data-state=done]{background:Highlight;outline-color:Highlight}.cngx-segmented-progress__segment[data-state=active]{background:Canvas;outline:2px solid Highlight;outline-offset:-2px}.cngx-segmented-progress__segment[data-state=error]{background:Mark}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
140
268
|
}
|
|
141
269
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSegmentedProgress, decorators: [{
|
|
142
270
|
type: Component,
|
|
@@ -155,7 +283,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
155
283
|
aria-hidden="true"
|
|
156
284
|
></span>
|
|
157
285
|
}
|
|
158
|
-
`, styles: [".cngx-segmented-progress{--cngx-segmented-progress-gap: var(--cngx-space-xs, .25rem);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(--
|
|
286
|
+
`, styles: [".cngx-segmented-progress{--cngx-segmented-progress-gap: var(--cngx-space-xs, .25rem);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(--cngx-color-border, oklch(.88 .005 250)));transition:background var(--cngx-segmented-progress-transition, var(--cngx-duration-fast, .15s) ease)}.cngx-segmented-progress__segment[data-state=done]{background:var(--cngx-segmented-progress-done-color, var(--cngx-color-primary, oklch(.66 .19 50)))}.cngx-segmented-progress__segment[data-state=active]{background:color-mix(in oklab,var(--cngx-segmented-progress-active-color, var(--cngx-color-primary, oklch(.66 .19 50))) 60%,var(--cngx-color-surface, oklch(1 0 0)))}.cngx-segmented-progress__segment[data-state=error]{background:var(--cngx-segmented-progress-error-color, var(--cngx-color-danger, oklch(.6 .18 25)))}@media(forced-colors:active){.cngx-segmented-progress__segment{forced-color-adjust:none;background:Canvas;outline:1px solid CanvasText;outline-offset:-1px}.cngx-segmented-progress__segment[data-state=done]{background:Highlight;outline-color:Highlight}.cngx-segmented-progress__segment[data-state=active]{background:Canvas;outline:2px solid Highlight;outline-offset:-2px}.cngx-segmented-progress__segment[data-state=error]{background:Mark}}\n"] }]
|
|
159
287
|
}], 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
288
|
|
|
161
289
|
/**
|
|
@@ -222,6 +350,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
222
350
|
* <example-url>http://localhost:4200/#/common/display/avatar/sizes</example-url>
|
|
223
351
|
*/
|
|
224
352
|
class CngxAvatar {
|
|
353
|
+
i18n = injectDisplayI18n();
|
|
225
354
|
/** Image URL. When set and loads successfully, the image is shown. */
|
|
226
355
|
src = input(undefined, ...(ngDevMode ? [{ debugName: "src" }] : /* istanbul ignore next */ []));
|
|
227
356
|
/** Alternate text for the image. Required when `src` is used. */
|
|
@@ -234,8 +363,27 @@ class CngxAvatar {
|
|
|
234
363
|
shape = input('circle', ...(ngDevMode ? [{ debugName: "shape" }] : /* istanbul ignore next */ []));
|
|
235
364
|
/** Optional user-presence status indicator. */
|
|
236
365
|
status = input(undefined, ...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
|
|
237
|
-
|
|
238
|
-
|
|
366
|
+
/**
|
|
367
|
+
* Format closure for the status dot's accessible label. When set, it wins
|
|
368
|
+
* over the app-wide `CNGX_DISPLAY_I18N.avatarStatus` (English default: the
|
|
369
|
+
* status word). Mirrors the `labelFormat` closure on `CngxAvatarGroup`.
|
|
370
|
+
*/
|
|
371
|
+
statusLabel = input(undefined, ...(ngDevMode ? [{ debugName: "statusLabel" }] : /* istanbul ignore next */ []));
|
|
372
|
+
/** Accessible label of the status dot - the closure's output when set, else `CNGX_DISPLAY_I18N.avatarStatus`. */
|
|
373
|
+
statusAriaLabel = computed(() => {
|
|
374
|
+
const status = this.status();
|
|
375
|
+
if (!status) {
|
|
376
|
+
return null;
|
|
377
|
+
}
|
|
378
|
+
const format = this.statusLabel() ?? this.i18n().avatarStatus;
|
|
379
|
+
return format(status);
|
|
380
|
+
}, ...(ngDevMode ? [{ debugName: "statusAriaLabel" }] : /* istanbul ignore next */ []));
|
|
381
|
+
// Keyed on src(): a new URL resets both flags, so a failed image recovers
|
|
382
|
+
// when the consumer rebinds [src].
|
|
383
|
+
imageLoadedState = linkedSignal({ ...(ngDevMode ? { debugName: "imageLoadedState" } : /* istanbul ignore next */ {}), source: this.src,
|
|
384
|
+
computation: () => false });
|
|
385
|
+
imageErroredState = linkedSignal({ ...(ngDevMode ? { debugName: "imageErroredState" } : /* istanbul ignore next */ {}), source: this.src,
|
|
386
|
+
computation: () => false });
|
|
239
387
|
/** Whether the image loaded successfully. */
|
|
240
388
|
imageLoaded = this.imageLoadedState.asReadonly();
|
|
241
389
|
/** Whether the fallback path (initials or ng-content) is currently rendered. */
|
|
@@ -251,7 +399,7 @@ class CngxAvatar {
|
|
|
251
399
|
this.imageErroredState.set(true);
|
|
252
400
|
}
|
|
253
401
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxAvatar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
254
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxAvatar, isStandalone: true, selector: "cngx-avatar", inputs: { src: { classPropertyName: "src", publicName: "src", isSignal: true, isRequired: false, transformFunction: null }, alt: { classPropertyName: "alt", publicName: "alt", isSignal: true, isRequired: false, transformFunction: null }, initials: { classPropertyName: "initials", publicName: "initials", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cngx-avatar--xs": "size() === \"xs\"", "class.cngx-avatar--sm": "size() === \"sm\"", "class.cngx-avatar--md": "size() === \"md\"", "class.cngx-avatar--lg": "size() === \"lg\"", "class.cngx-avatar--xl": "size() === \"xl\"", "class.cngx-avatar--square": "shape() === \"square\"", "class.cngx-avatar--circle": "shape() === \"circle\"" }, classAttribute: "cngx-avatar" }, exportAs: ["cngxAvatar"], ngImport: i0, template: `
|
|
402
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxAvatar, isStandalone: true, selector: "cngx-avatar", inputs: { src: { classPropertyName: "src", publicName: "src", isSignal: true, isRequired: false, transformFunction: null }, alt: { classPropertyName: "alt", publicName: "alt", isSignal: true, isRequired: false, transformFunction: null }, initials: { classPropertyName: "initials", publicName: "initials", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null }, statusLabel: { classPropertyName: "statusLabel", publicName: "statusLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cngx-avatar--xs": "size() === \"xs\"", "class.cngx-avatar--sm": "size() === \"sm\"", "class.cngx-avatar--md": "size() === \"md\"", "class.cngx-avatar--lg": "size() === \"lg\"", "class.cngx-avatar--xl": "size() === \"xl\"", "class.cngx-avatar--square": "shape() === \"square\"", "class.cngx-avatar--circle": "shape() === \"circle\"" }, classAttribute: "cngx-avatar" }, exportAs: ["cngxAvatar"], ngImport: i0, template: `
|
|
255
403
|
@if (showImage()) {
|
|
256
404
|
<img
|
|
257
405
|
class="cngx-avatar__img"
|
|
@@ -272,10 +420,11 @@ class CngxAvatar {
|
|
|
272
420
|
[class.cngx-avatar__status--offline]="status() === 'offline'"
|
|
273
421
|
[class.cngx-avatar__status--busy]="status() === 'busy'"
|
|
274
422
|
[class.cngx-avatar__status--away]="status() === 'away'"
|
|
275
|
-
|
|
423
|
+
role="img"
|
|
424
|
+
[attr.aria-label]="statusAriaLabel()"
|
|
276
425
|
></span>
|
|
277
426
|
}
|
|
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;
|
|
427
|
+
`, 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;inset-inline-end:-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)))}}}@media(forced-colors:active){.cngx-avatar{outline:1px solid CanvasText;outline-offset:-1px}.cngx-avatar .cngx-avatar__status{width:max(var(--cngx-avatar-status-size, .65em),.8em);height:max(var(--cngx-avatar-status-size, .65em),.8em);forced-color-adjust:none;border-color:Canvas;background:CanvasText}.cngx-avatar .cngx-avatar__status--offline{background:Canvas;box-shadow:inset 0 0 0 1.5px CanvasText}.cngx-avatar .cngx-avatar__status--away{background:linear-gradient(90deg,CanvasText 50%,Canvas 50%);box-shadow:inset 0 0 0 1.5px CanvasText}.cngx-avatar .cngx-avatar__status--busy{background:linear-gradient(Canvas 0 0) center / 60% 22% no-repeat,CanvasText}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
279
428
|
}
|
|
280
429
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxAvatar, decorators: [{
|
|
281
430
|
type: Component,
|
|
@@ -309,11 +458,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
309
458
|
[class.cngx-avatar__status--offline]="status() === 'offline'"
|
|
310
459
|
[class.cngx-avatar__status--busy]="status() === 'busy'"
|
|
311
460
|
[class.cngx-avatar__status--away]="status() === 'away'"
|
|
312
|
-
|
|
461
|
+
role="img"
|
|
462
|
+
[attr.aria-label]="statusAriaLabel()"
|
|
313
463
|
></span>
|
|
314
464
|
}
|
|
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;
|
|
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 }] }] } });
|
|
465
|
+
`, 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;inset-inline-end:-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)))}}}@media(forced-colors:active){.cngx-avatar{outline:1px solid CanvasText;outline-offset:-1px}.cngx-avatar .cngx-avatar__status{width:max(var(--cngx-avatar-status-size, .65em),.8em);height:max(var(--cngx-avatar-status-size, .65em),.8em);forced-color-adjust:none;border-color:Canvas;background:CanvasText}.cngx-avatar .cngx-avatar__status--offline{background:Canvas;box-shadow:inset 0 0 0 1.5px CanvasText}.cngx-avatar .cngx-avatar__status--away{background:linear-gradient(90deg,CanvasText 50%,Canvas 50%);box-shadow:inset 0 0 0 1.5px CanvasText}.cngx-avatar .cngx-avatar__status--busy{background:linear-gradient(Canvas 0 0) center / 60% 22% no-repeat,CanvasText}}\n"] }]
|
|
466
|
+
}], 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 }] }], statusLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "statusLabel", required: false }] }] } });
|
|
317
467
|
|
|
318
468
|
/**
|
|
319
469
|
* Stacked avatar group with an overflow pill. Project `<cngx-avatar>` children;
|
|
@@ -341,32 +491,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
341
491
|
* @relatedTo CngxAvatar
|
|
342
492
|
*/
|
|
343
493
|
class CngxAvatarGroup {
|
|
494
|
+
i18n = injectDisplayI18n();
|
|
344
495
|
/** Maximum avatars to show before collapsing the rest into the pill. Unset = show all. */
|
|
345
496
|
max = input(undefined, ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
346
497
|
/** Size preset for the overflow pill and stacking overlap (mirrors `CngxAvatar`). */
|
|
347
498
|
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
348
499
|
/** Pill shape (mirrors `CngxAvatar`). */
|
|
349
500
|
shape = input('circle', ...(ngDevMode ? [{ debugName: "shape" }] : /* istanbul ignore next */ []));
|
|
350
|
-
/**
|
|
351
|
-
|
|
501
|
+
/**
|
|
502
|
+
* Entity noun used in the `aria-label` summary. Unbound, it follows
|
|
503
|
+
* `CNGX_DISPLAY_I18N.avatarGroupNoun` (or its `avatarGroupLabel`
|
|
504
|
+
* formatter); a bound noun goes into the language's summary message.
|
|
505
|
+
*/
|
|
506
|
+
label = input(undefined, ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
507
|
+
/**
|
|
508
|
+
* Format closure for the accessible summary. When set, it wins over
|
|
509
|
+
* `CNGX_DISPLAY_I18N.avatarGroupLabel` and the bound `label` noun.
|
|
510
|
+
* `hidden` is `0` when nothing is collapsed.
|
|
511
|
+
*/
|
|
512
|
+
labelFormat = input(undefined, ...(ngDevMode ? [{ debugName: "labelFormat" }] : /* istanbul ignore next */ []));
|
|
352
513
|
el = inject((ElementRef)).nativeElement;
|
|
353
514
|
avatars = contentChildren(CngxAvatar, ...(ngDevMode ? [{ debugName: "avatars" }] : /* istanbul ignore next */ []));
|
|
354
515
|
/** Total number of projected avatars. */
|
|
355
516
|
total = computed(() => this.avatars().length, ...(ngDevMode ? [{ debugName: "total" }] : /* istanbul ignore next */ []));
|
|
356
|
-
/** How many avatars are actually shown (capped by `max`). */
|
|
517
|
+
/** How many avatars are actually shown (capped by `max`). `max=0` collapses all; negatives clamp to `0`. */
|
|
357
518
|
visibleCount = computed(() => {
|
|
358
519
|
const cap = this.max();
|
|
359
520
|
const count = this.total();
|
|
360
|
-
|
|
521
|
+
if (cap == null) {
|
|
522
|
+
return count;
|
|
523
|
+
}
|
|
524
|
+
const clamped = Math.max(0, cap);
|
|
525
|
+
return clamped < count ? clamped : count;
|
|
361
526
|
}, ...(ngDevMode ? [{ debugName: "visibleCount" }] : /* istanbul ignore next */ []));
|
|
362
527
|
/** How many avatars are collapsed into the `+N` pill. */
|
|
363
528
|
hiddenCount = computed(() => this.total() - this.visibleCount(), ...(ngDevMode ? [{ debugName: "hiddenCount" }] : /* istanbul ignore next */ []));
|
|
529
|
+
/** Visible `+N` pill text, with the count in the app locale. */
|
|
530
|
+
overflowText = computed(() => this.i18n().avatarGroupOverflow(this.hiddenCount()), ...(ngDevMode ? [{ debugName: "overflowText" }] : /* istanbul ignore next */ []));
|
|
364
531
|
/** Accessible summary of total and hidden counts. */
|
|
365
532
|
ariaLabel = computed(() => {
|
|
366
533
|
const total = this.total();
|
|
367
534
|
const hidden = this.hiddenCount();
|
|
535
|
+
const format = this.labelFormat();
|
|
536
|
+
if (format) {
|
|
537
|
+
return format(total, hidden);
|
|
538
|
+
}
|
|
539
|
+
const i18n = this.i18n();
|
|
368
540
|
const noun = this.label();
|
|
369
|
-
|
|
541
|
+
if (noun !== undefined) {
|
|
542
|
+
return i18n.avatarGroupLabelFor(total, hidden, noun);
|
|
543
|
+
}
|
|
544
|
+
// A consumer formatter owns word order and plurals; otherwise the resolved
|
|
545
|
+
// noun composes, so a noun-only override still reaches AT.
|
|
546
|
+
if (!isSectionAvatarGroupLabel(i18n.avatarGroupLabel)) {
|
|
547
|
+
return i18n.avatarGroupLabel(total, hidden);
|
|
548
|
+
}
|
|
549
|
+
return i18n.avatarGroupLabelFor(total, hidden, i18n.avatarGroupNoun);
|
|
370
550
|
}, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
371
551
|
constructor() {
|
|
372
552
|
// Cap the visible avatars by toggling `hidden` on the overflow hosts. Runs
|
|
@@ -379,12 +559,12 @@ class CngxAvatarGroup {
|
|
|
379
559
|
});
|
|
380
560
|
}
|
|
381
561
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxAvatarGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
382
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxAvatarGroup, isStandalone: true, selector: "cngx-avatar-group", inputs: { max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "attr.aria-label": "ariaLabel()", "class.cngx-avatar-group--xs": "size() === \"xs\"", "class.cngx-avatar-group--sm": "size() === \"sm\"", "class.cngx-avatar-group--md": "size() === \"md\"", "class.cngx-avatar-group--lg": "size() === \"lg\"", "class.cngx-avatar-group--xl": "size() === \"xl\"", "class.cngx-avatar-group--square": "shape() === \"square\"" }, classAttribute: "cngx-avatar-group" }, queries: [{ propertyName: "avatars", predicate: CngxAvatar, isSignal: true }], exportAs: ["cngxAvatarGroup"], ngImport: i0, template: `
|
|
562
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxAvatarGroup, isStandalone: true, selector: "cngx-avatar-group", inputs: { max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelFormat: { classPropertyName: "labelFormat", publicName: "labelFormat", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "attr.aria-label": "ariaLabel()", "class.cngx-avatar-group--xs": "size() === \"xs\"", "class.cngx-avatar-group--sm": "size() === \"sm\"", "class.cngx-avatar-group--md": "size() === \"md\"", "class.cngx-avatar-group--lg": "size() === \"lg\"", "class.cngx-avatar-group--xl": "size() === \"xl\"", "class.cngx-avatar-group--square": "shape() === \"square\"" }, classAttribute: "cngx-avatar-group" }, queries: [{ propertyName: "avatars", predicate: CngxAvatar, isSignal: true }], exportAs: ["cngxAvatarGroup"], ngImport: i0, template: `
|
|
383
563
|
<ng-content select="cngx-avatar" />
|
|
384
564
|
@if (hiddenCount() > 0) {
|
|
385
|
-
<span class="cngx-avatar-group__overflow" aria-hidden="true"
|
|
565
|
+
<span class="cngx-avatar-group__overflow" aria-hidden="true">{{ overflowText() }}</span>
|
|
386
566
|
}
|
|
387
|
-
`, isInline: true, styles: [".cngx-avatar-group{display:inline-flex;align-items:center}.cngx-avatar-group>.cngx-avatar,.cngx-avatar-group__overflow{border:var(--cngx-avatar-group-ring-width, 2px) solid var(--cngx-avatar-group-ring-color, var(--cngx-color-surface, oklch(1 0 0)))}.cngx-avatar-group>.cngx-avatar:not(:first-child),.cngx-avatar-group__overflow{margin-inline-start:var(--cngx-avatar-group-overlap, -.5rem)}.cngx-avatar-group__overflow{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;inline-size:var(--cngx-avatar-group-pill-size, 2.5rem);block-size:var(--cngx-avatar-group-pill-size, 2.5rem);border-radius:50%;background:var(--cngx-avatar-group-pill-bg, var(--cngx-color-muted, oklch(.92 .005 250)));color:var(--cngx-avatar-group-pill-color, var(--cngx-color-text, oklch(.2 .01 250)));font-size:var(--cngx-avatar-group-pill-font-size, .8125rem);font-weight:600;line-height:1}.cngx-avatar-group--square .cngx-avatar-group__overflow{border-radius:var(--cngx-radius-md, .375rem)}.cngx-avatar-group--xs{--cngx-avatar-group-pill-size: 1.5rem;--cngx-avatar-group-overlap: -.375rem;--cngx-avatar-group-pill-font-size: .625rem}.cngx-avatar-group--sm{--cngx-avatar-group-pill-size: 2rem;--cngx-avatar-group-overlap: -.5rem;--cngx-avatar-group-pill-font-size: .75rem}.cngx-avatar-group--md{--cngx-avatar-group-pill-size: 2.5rem;--cngx-avatar-group-overlap: -.625rem;--cngx-avatar-group-pill-font-size: .8125rem}.cngx-avatar-group--lg{--cngx-avatar-group-pill-size: 3rem;--cngx-avatar-group-overlap: -.75rem;--cngx-avatar-group-pill-font-size: .875rem}.cngx-avatar-group--xl{--cngx-avatar-group-pill-size: 4rem;--cngx-avatar-group-overlap: -1rem;--cngx-avatar-group-pill-font-size: 1rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
567
|
+
`, isInline: true, styles: [".cngx-avatar-group{display:inline-flex;align-items:center}.cngx-avatar-group>.cngx-avatar,.cngx-avatar-group__overflow{border:var(--cngx-avatar-group-ring-width, 2px) solid var(--cngx-avatar-group-ring-color, var(--cngx-color-surface, oklch(1 0 0)))}.cngx-avatar-group>.cngx-avatar:not(:first-child),.cngx-avatar-group__overflow{margin-inline-start:var(--cngx-avatar-group-overlap, -.5rem)}.cngx-avatar-group__overflow{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;inline-size:var(--cngx-avatar-group-pill-size, 2.5rem);block-size:var(--cngx-avatar-group-pill-size, 2.5rem);border-radius:50%;background:var(--cngx-avatar-group-pill-bg, var(--cngx-color-muted, oklch(.92 .005 250)));color:var(--cngx-avatar-group-pill-color, var(--cngx-color-text, oklch(.2 .01 250)));font-size:var(--cngx-avatar-group-pill-font-size, .8125rem);font-weight:600;line-height:1;unicode-bidi:var(--cngx-avatar-group-overflow-bidi, isolate);direction:var(--cngx-avatar-group-overflow-direction, ltr)}.cngx-avatar-group--square .cngx-avatar-group__overflow{border-radius:var(--cngx-radius-md, .375rem)}.cngx-avatar-group--xs{--cngx-avatar-group-pill-size: 1.5rem;--cngx-avatar-group-overlap: -.375rem;--cngx-avatar-group-pill-font-size: .625rem}.cngx-avatar-group--sm{--cngx-avatar-group-pill-size: 2rem;--cngx-avatar-group-overlap: -.5rem;--cngx-avatar-group-pill-font-size: .75rem}.cngx-avatar-group--md{--cngx-avatar-group-pill-size: 2.5rem;--cngx-avatar-group-overlap: -.625rem;--cngx-avatar-group-pill-font-size: .8125rem}.cngx-avatar-group--lg{--cngx-avatar-group-pill-size: 3rem;--cngx-avatar-group-overlap: -.75rem;--cngx-avatar-group-pill-font-size: .875rem}.cngx-avatar-group--xl{--cngx-avatar-group-pill-size: 4rem;--cngx-avatar-group-overlap: -1rem;--cngx-avatar-group-pill-font-size: 1rem}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
388
568
|
}
|
|
389
569
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxAvatarGroup, decorators: [{
|
|
390
570
|
type: Component,
|
|
@@ -401,11 +581,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
401
581
|
}, template: `
|
|
402
582
|
<ng-content select="cngx-avatar" />
|
|
403
583
|
@if (hiddenCount() > 0) {
|
|
404
|
-
<span class="cngx-avatar-group__overflow" aria-hidden="true"
|
|
584
|
+
<span class="cngx-avatar-group__overflow" aria-hidden="true">{{ overflowText() }}</span>
|
|
405
585
|
}
|
|
406
|
-
`, styles: [".cngx-avatar-group{display:inline-flex;align-items:center}.cngx-avatar-group>.cngx-avatar,.cngx-avatar-group__overflow{border:var(--cngx-avatar-group-ring-width, 2px) solid var(--cngx-avatar-group-ring-color, var(--cngx-color-surface, oklch(1 0 0)))}.cngx-avatar-group>.cngx-avatar:not(:first-child),.cngx-avatar-group__overflow{margin-inline-start:var(--cngx-avatar-group-overlap, -.5rem)}.cngx-avatar-group__overflow{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;inline-size:var(--cngx-avatar-group-pill-size, 2.5rem);block-size:var(--cngx-avatar-group-pill-size, 2.5rem);border-radius:50%;background:var(--cngx-avatar-group-pill-bg, var(--cngx-color-muted, oklch(.92 .005 250)));color:var(--cngx-avatar-group-pill-color, var(--cngx-color-text, oklch(.2 .01 250)));font-size:var(--cngx-avatar-group-pill-font-size, .8125rem);font-weight:600;line-height:1}.cngx-avatar-group--square .cngx-avatar-group__overflow{border-radius:var(--cngx-radius-md, .375rem)}.cngx-avatar-group--xs{--cngx-avatar-group-pill-size: 1.5rem;--cngx-avatar-group-overlap: -.375rem;--cngx-avatar-group-pill-font-size: .625rem}.cngx-avatar-group--sm{--cngx-avatar-group-pill-size: 2rem;--cngx-avatar-group-overlap: -.5rem;--cngx-avatar-group-pill-font-size: .75rem}.cngx-avatar-group--md{--cngx-avatar-group-pill-size: 2.5rem;--cngx-avatar-group-overlap: -.625rem;--cngx-avatar-group-pill-font-size: .8125rem}.cngx-avatar-group--lg{--cngx-avatar-group-pill-size: 3rem;--cngx-avatar-group-overlap: -.75rem;--cngx-avatar-group-pill-font-size: .875rem}.cngx-avatar-group--xl{--cngx-avatar-group-pill-size: 4rem;--cngx-avatar-group-overlap: -1rem;--cngx-avatar-group-pill-font-size: 1rem}\n"] }]
|
|
407
|
-
}], ctorParameters: () => [], propDecorators: { max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], shape: [{ type: i0.Input, args: [{ isSignal: true, alias: "shape", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], avatars: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxAvatar), { isSignal: true }] }] } });
|
|
586
|
+
`, styles: [".cngx-avatar-group{display:inline-flex;align-items:center}.cngx-avatar-group>.cngx-avatar,.cngx-avatar-group__overflow{border:var(--cngx-avatar-group-ring-width, 2px) solid var(--cngx-avatar-group-ring-color, var(--cngx-color-surface, oklch(1 0 0)))}.cngx-avatar-group>.cngx-avatar:not(:first-child),.cngx-avatar-group__overflow{margin-inline-start:var(--cngx-avatar-group-overlap, -.5rem)}.cngx-avatar-group__overflow{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;inline-size:var(--cngx-avatar-group-pill-size, 2.5rem);block-size:var(--cngx-avatar-group-pill-size, 2.5rem);border-radius:50%;background:var(--cngx-avatar-group-pill-bg, var(--cngx-color-muted, oklch(.92 .005 250)));color:var(--cngx-avatar-group-pill-color, var(--cngx-color-text, oklch(.2 .01 250)));font-size:var(--cngx-avatar-group-pill-font-size, .8125rem);font-weight:600;line-height:1;unicode-bidi:var(--cngx-avatar-group-overflow-bidi, isolate);direction:var(--cngx-avatar-group-overflow-direction, ltr)}.cngx-avatar-group--square .cngx-avatar-group__overflow{border-radius:var(--cngx-radius-md, .375rem)}.cngx-avatar-group--xs{--cngx-avatar-group-pill-size: 1.5rem;--cngx-avatar-group-overlap: -.375rem;--cngx-avatar-group-pill-font-size: .625rem}.cngx-avatar-group--sm{--cngx-avatar-group-pill-size: 2rem;--cngx-avatar-group-overlap: -.5rem;--cngx-avatar-group-pill-font-size: .75rem}.cngx-avatar-group--md{--cngx-avatar-group-pill-size: 2.5rem;--cngx-avatar-group-overlap: -.625rem;--cngx-avatar-group-pill-font-size: .8125rem}.cngx-avatar-group--lg{--cngx-avatar-group-pill-size: 3rem;--cngx-avatar-group-overlap: -.75rem;--cngx-avatar-group-pill-font-size: .875rem}.cngx-avatar-group--xl{--cngx-avatar-group-pill-size: 4rem;--cngx-avatar-group-overlap: -1rem;--cngx-avatar-group-pill-font-size: 1rem}\n"] }]
|
|
587
|
+
}], ctorParameters: () => [], propDecorators: { max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], shape: [{ type: i0.Input, args: [{ isSignal: true, alias: "shape", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], labelFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelFormat", required: false }] }], avatars: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxAvatar), { isSignal: true }] }] } });
|
|
408
588
|
|
|
589
|
+
const NUMBER_FORMAT = {};
|
|
409
590
|
/**
|
|
410
591
|
* Generic counter / dot indicator that attaches a small floating element to
|
|
411
592
|
* any host. Purely presentational (`aria-hidden="true"`) - semantic meaning
|
|
@@ -427,7 +608,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
427
608
|
* <example-url>http://localhost:4200/#/common/display/badge/inline-and-hidden</example-url>
|
|
428
609
|
*/
|
|
429
610
|
class CngxBadge {
|
|
430
|
-
/**
|
|
611
|
+
/**
|
|
612
|
+
* Raw value. Numbers show as text (respecting `max`); booleans flip dot
|
|
613
|
+
* mode; strings render verbatim. Numbers at or below `0` count as empty -
|
|
614
|
+
* a negative count never renders, mirroring the `0` behaviour.
|
|
615
|
+
*/
|
|
431
616
|
cngxBadge = input.required(...(ngDevMode ? [{ debugName: "cngxBadge" }] : /* istanbul ignore next */ []));
|
|
432
617
|
/** Color variant. */
|
|
433
618
|
color = input('primary', ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
@@ -435,8 +620,13 @@ class CngxBadge {
|
|
|
435
620
|
position = input('above-end', ...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
436
621
|
/** Whether the indicator is hidden regardless of value. */
|
|
437
622
|
hidden = input(false, ...(ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []));
|
|
438
|
-
/**
|
|
623
|
+
/**
|
|
624
|
+
* Cap for numeric values - anything over renders through
|
|
625
|
+
* `CNGX_DISPLAY_I18N.badgeOverflow` (English `"99+"`).
|
|
626
|
+
*/
|
|
439
627
|
max = input(99, ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
628
|
+
i18n = injectDisplayI18n();
|
|
629
|
+
locale = injectLocale();
|
|
440
630
|
hostEl = inject((ElementRef));
|
|
441
631
|
renderer = inject(Renderer2);
|
|
442
632
|
badgeEl = null;
|
|
@@ -446,7 +636,7 @@ class CngxBadge {
|
|
|
446
636
|
isEmpty = computed(() => {
|
|
447
637
|
const v = this.cngxBadge();
|
|
448
638
|
if (typeof v === 'number') {
|
|
449
|
-
return v
|
|
639
|
+
return v <= 0;
|
|
450
640
|
}
|
|
451
641
|
if (typeof v === 'boolean') {
|
|
452
642
|
return v === false;
|
|
@@ -461,7 +651,9 @@ class CngxBadge {
|
|
|
461
651
|
}
|
|
462
652
|
if (typeof v === 'number') {
|
|
463
653
|
const m = this.max();
|
|
464
|
-
return v > m
|
|
654
|
+
return v > m
|
|
655
|
+
? this.i18n().badgeOverflow(m)
|
|
656
|
+
: numberFormatterFor(this.locale(), NUMBER_FORMAT).format(v);
|
|
465
657
|
}
|
|
466
658
|
return v;
|
|
467
659
|
}, ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
@@ -596,6 +788,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
596
788
|
* <example-url>http://localhost:4200/#/common/interactive/chip/multi-group/multi-select-chips-with-selection-count</example-url>
|
|
597
789
|
*/
|
|
598
790
|
class CngxChip {
|
|
791
|
+
i18n = injectDisplayI18n();
|
|
599
792
|
/**
|
|
600
793
|
* Whether the close button is rendered. Typed as `boolean` - bind a
|
|
601
794
|
* signal getter (`[removable]="!select.disabled()"`) if the flag
|
|
@@ -609,12 +802,14 @@ class CngxChip {
|
|
|
609
802
|
*/
|
|
610
803
|
id = input(null, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
611
804
|
/**
|
|
612
|
-
* A11y label for the close button.
|
|
613
|
-
* consumers with option
|
|
805
|
+
* A11y label for the close button. Unbound, it follows
|
|
806
|
+
* `CNGX_DISPLAY_I18N.chipRemove` (English "Remove"); consumers with option
|
|
807
|
+
* labels on hand should supply something more
|
|
614
808
|
* specific (e.g. `"Remove Red"`) so screen readers know which chip
|
|
615
809
|
* the button removes.
|
|
616
810
|
*/
|
|
617
|
-
removeAriaLabel = input(
|
|
811
|
+
removeAriaLabel = input(undefined, ...(ngDevMode ? [{ debugName: "removeAriaLabel" }] : /* istanbul ignore next */ []));
|
|
812
|
+
resolvedRemoveAriaLabel = computed(() => this.removeAriaLabel() ?? this.i18n().chipRemove, ...(ngDevMode ? [{ debugName: "resolvedRemoveAriaLabel" }] : /* istanbul ignore next */ []));
|
|
618
813
|
/** Fires when the user clicks the close button. */
|
|
619
814
|
remove = output();
|
|
620
815
|
autoId = nextUid('cngx-chip');
|
|
@@ -633,7 +828,7 @@ class CngxChip {
|
|
|
633
828
|
<button
|
|
634
829
|
type="button"
|
|
635
830
|
class="cngx-chip__remove"
|
|
636
|
-
[attr.aria-label]="
|
|
831
|
+
[attr.aria-label]="resolvedRemoveAriaLabel()"
|
|
637
832
|
(click)="handleRemoveClick($event)"
|
|
638
833
|
>
|
|
639
834
|
<!--
|
|
@@ -655,7 +850,7 @@ class CngxChip {
|
|
|
655
850
|
</ng-content>
|
|
656
851
|
</button>
|
|
657
852
|
}
|
|
658
|
-
`, 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-
|
|
853
|
+
`, 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;}:where(.cngx-chip){--cngx-chip-transition: background-color var(--cngx-duration-fast) ease, color var(--cngx-duration-fast) ease, border-color var(--cngx-duration-fast) 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-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-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;--cngx-chip-inner-gap: var(--cngx-space-xs);--cngx-chip-padding-block: var(--cngx-space-xs);--cngx-chip-padding-inline: var(--cngx-space-sm);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;justify-content:center;min-block-size:var(--cngx-target-min, 0px);min-inline-size:var(--cngx-target-min, 0px)}: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[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)}:scope[aria-disabled=true],:scope:disabled{background:color-mix(in oklab,var(--cngx-color-text, oklch(.2 .01 250)) 6%,transparent);color:color-mix(in oklab,var(--cngx-color-text, oklch(.2 .01 250)) 38%,transparent);cursor:not-allowed;pointer-events:none}:scope:is([aria-disabled=true],:disabled):is([aria-selected=true],[aria-pressed=true]){background:color-mix(in oklab,var(--cngx-color-text, oklch(.2 .01 250)) 16%,transparent)}.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;color:color-mix(in oklab,currentColor 70%,transparent);border-radius:var(--cngx-chip-remove-radius, var(--cngx-radius-sm, 2px));display:inline-flex;align-items:center;justify-content:center;min-inline-size:max(var(--cngx-chip-remove-target, 1.5rem),var(--cngx-target-min, 0px));min-block-size:max(var(--cngx-chip-remove-target, 1.5rem),var(--cngx-target-min, 0px));margin:calc(-.5*max(0px,var(--cngx-chip-remove-target, 1.5rem) - max(1em,var(--cngx-target-min, 0px))))}.cngx-chip__remove:hover{color:inherit}.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)}}}@media(forced-colors:active){.cngx-chip{border:1px solid ButtonBorder}.cngx-chip[aria-selected=true],.cngx-chip[aria-pressed=true]{background:Highlight!important;color:HighlightText!important;border-color:Highlight!important;forced-color-adjust:none;--_cngx-forced-ink: HighlightText}.cngx-chip:is([aria-disabled=true],:disabled){color:GrayText;border-color:GrayText}.cngx-chip:is([aria-disabled=true],:disabled):is([aria-selected=true],[aria-pressed=true]){background:GrayText!important;color:Canvas!important;border-color:GrayText!important}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
659
854
|
}
|
|
660
855
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChip, decorators: [{
|
|
661
856
|
type: Component,
|
|
@@ -670,7 +865,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
670
865
|
<button
|
|
671
866
|
type="button"
|
|
672
867
|
class="cngx-chip__remove"
|
|
673
|
-
[attr.aria-label]="
|
|
868
|
+
[attr.aria-label]="resolvedRemoveAriaLabel()"
|
|
674
869
|
(click)="handleRemoveClick($event)"
|
|
675
870
|
>
|
|
676
871
|
<!--
|
|
@@ -692,9 +887,118 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
692
887
|
</ng-content>
|
|
693
888
|
</button>
|
|
694
889
|
}
|
|
695
|
-
`, 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-
|
|
890
|
+
`, 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;}:where(.cngx-chip){--cngx-chip-transition: background-color var(--cngx-duration-fast) ease, color var(--cngx-duration-fast) ease, border-color var(--cngx-duration-fast) 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-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-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;--cngx-chip-inner-gap: var(--cngx-space-xs);--cngx-chip-padding-block: var(--cngx-space-xs);--cngx-chip-padding-inline: var(--cngx-space-sm);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;justify-content:center;min-block-size:var(--cngx-target-min, 0px);min-inline-size:var(--cngx-target-min, 0px)}: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[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)}:scope[aria-disabled=true],:scope:disabled{background:color-mix(in oklab,var(--cngx-color-text, oklch(.2 .01 250)) 6%,transparent);color:color-mix(in oklab,var(--cngx-color-text, oklch(.2 .01 250)) 38%,transparent);cursor:not-allowed;pointer-events:none}:scope:is([aria-disabled=true],:disabled):is([aria-selected=true],[aria-pressed=true]){background:color-mix(in oklab,var(--cngx-color-text, oklch(.2 .01 250)) 16%,transparent)}.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;color:color-mix(in oklab,currentColor 70%,transparent);border-radius:var(--cngx-chip-remove-radius, var(--cngx-radius-sm, 2px));display:inline-flex;align-items:center;justify-content:center;min-inline-size:max(var(--cngx-chip-remove-target, 1.5rem),var(--cngx-target-min, 0px));min-block-size:max(var(--cngx-chip-remove-target, 1.5rem),var(--cngx-target-min, 0px));margin:calc(-.5*max(0px,var(--cngx-chip-remove-target, 1.5rem) - max(1em,var(--cngx-target-min, 0px))))}.cngx-chip__remove:hover{color:inherit}.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)}}}@media(forced-colors:active){.cngx-chip{border:1px solid ButtonBorder}.cngx-chip[aria-selected=true],.cngx-chip[aria-pressed=true]{background:Highlight!important;color:HighlightText!important;border-color:Highlight!important;forced-color-adjust:none;--_cngx-forced-ink: HighlightText}.cngx-chip:is([aria-disabled=true],:disabled){color:GrayText;border-color:GrayText}.cngx-chip:is([aria-disabled=true],:disabled):is([aria-selected=true],[aria-pressed=true]){background:GrayText!important;color:Canvas!important;border-color:GrayText!important}}\n"] }]
|
|
696
891
|
}], 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"] }] } });
|
|
697
892
|
|
|
893
|
+
/** Tone glyph rendered inside the decorative dot - the non-colour signal. */
|
|
894
|
+
const TONE_GLYPH = {
|
|
895
|
+
success: '✓',
|
|
896
|
+
warning: '!',
|
|
897
|
+
danger: '✕',
|
|
898
|
+
info: 'i',
|
|
899
|
+
neutral: '•',
|
|
900
|
+
};
|
|
901
|
+
/**
|
|
902
|
+
* Semantic health indicator - a decorative tone dot paired with a visible
|
|
903
|
+
* label. Distinct from `CngxBadge` (count overlay), `CngxChip` (interactive)
|
|
904
|
+
* and `CngxTag` (labeled token): its single job is to communicate a status
|
|
905
|
+
* (operational / degraded / down / info).
|
|
906
|
+
*
|
|
907
|
+
* Colour is never the only signal (Pillar 2): the tone drives the dot colour
|
|
908
|
+
* *and* a tone glyph, so a colour-blind reader still distinguishes the states,
|
|
909
|
+
* and the visible `label` carries the meaning for assistive tech (the dot is
|
|
910
|
+
* `aria-hidden`). Set `live` for a status that changes in place.
|
|
911
|
+
*
|
|
912
|
+
* ### Basic
|
|
913
|
+
* ```html
|
|
914
|
+
* <cngx-status tone="success" label="Operational" />
|
|
915
|
+
* ```
|
|
916
|
+
*
|
|
917
|
+
* ### Live-updating
|
|
918
|
+
* ```html
|
|
919
|
+
* <cngx-status tone="danger" label="Outage" live="assertive" />
|
|
920
|
+
* ```
|
|
921
|
+
*
|
|
922
|
+
* ### Dot-only (bare coloured dot + label)
|
|
923
|
+
* ```html
|
|
924
|
+
* <cngx-status tone="success" label="Operational" [glyph]="false" />
|
|
925
|
+
* ```
|
|
926
|
+
* `[glyph]="false"` drops the glyph for a GitHub-style coloured dot. Keep a
|
|
927
|
+
* visible `label`: without the glyph, colour is the dot's only signal, which a
|
|
928
|
+
* sighted colour-blind reader cannot resolve (a dev-mode warning enforces this).
|
|
929
|
+
*
|
|
930
|
+
* @category common/display
|
|
931
|
+
* @docsKind primary
|
|
932
|
+
* @wcag AA
|
|
933
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/status/status.component.ts
|
|
934
|
+
* @since 0.1.0
|
|
935
|
+
* @relatedTo CngxBadge, CngxTag, CngxChip
|
|
936
|
+
*
|
|
937
|
+
* <example-url>http://localhost:4200/#/common/display/status/tone-matrix</example-url>
|
|
938
|
+
* <example-url>http://localhost:4200/#/common/display/status/dot-only</example-url>
|
|
939
|
+
*/
|
|
940
|
+
class CngxStatus {
|
|
941
|
+
elRef = inject((ElementRef));
|
|
942
|
+
/** Semantic health. Drives both the dot colour and the tone glyph. */
|
|
943
|
+
tone = input('neutral', ...(ngDevMode ? [{ debugName: "tone" }] : /* istanbul ignore next */ []));
|
|
944
|
+
/** Visible status text. Carries the meaning for assistive tech. */
|
|
945
|
+
label = input(undefined, ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
946
|
+
/**
|
|
947
|
+
* Politeness of the live region. `off` (default) for a static status;
|
|
948
|
+
* `polite` / `assertive` for a status that changes in place.
|
|
949
|
+
*/
|
|
950
|
+
live = input('off', ...(ngDevMode ? [{ debugName: "live" }] : /* istanbul ignore next */ []));
|
|
951
|
+
/**
|
|
952
|
+
* Show the tone glyph inside the dot. `false` renders a bare coloured dot
|
|
953
|
+
* (GitHub-style) - sound only when a visible `label` carries the meaning,
|
|
954
|
+
* since colour alone fails a sighted colour-blind reader (Pillar 2).
|
|
955
|
+
*/
|
|
956
|
+
glyph = input(true, { ...(ngDevMode ? { debugName: "glyph" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
957
|
+
/** @internal Tone glyph char bound into the decorative dot. */
|
|
958
|
+
glyphChar = computed(() => TONE_GLYPH[this.tone()], ...(ngDevMode ? [{ debugName: "glyphChar" }] : /* istanbul ignore next */ []));
|
|
959
|
+
constructor() {
|
|
960
|
+
if (isDevMode()) {
|
|
961
|
+
afterNextRender(() => {
|
|
962
|
+
const el = this.elRef.nativeElement;
|
|
963
|
+
if (!this.label() && !el.getAttribute('aria-label') && !el.getAttribute('aria-labelledby')) {
|
|
964
|
+
console.warn('cngx-status: no `label` and no external `aria-label`/`aria-labelledby`; ' +
|
|
965
|
+
'the status has no accessible name and reads only as a coloured dot. ' +
|
|
966
|
+
'Set [label] or an aria-label on the host.');
|
|
967
|
+
}
|
|
968
|
+
if (!this.glyph() && !this.label()) {
|
|
969
|
+
console.warn('cngx-status: [glyph]="false" with no visible `label`; a bare coloured ' +
|
|
970
|
+
'dot is colour-only for a sighted colour-blind reader even with an ' +
|
|
971
|
+
'aria-label. Set [label] or show the glyph.');
|
|
972
|
+
}
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStatus, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
977
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxStatus, isStandalone: true, selector: "cngx-status", inputs: { tone: { classPropertyName: "tone", publicName: "tone", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, live: { classPropertyName: "live", publicName: "live", isSignal: true, isRequired: false, transformFunction: null }, glyph: { classPropertyName: "glyph", publicName: "glyph", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cngx-status--success": "tone() === 'success'", "class.cngx-status--warning": "tone() === 'warning'", "class.cngx-status--danger": "tone() === 'danger'", "class.cngx-status--info": "tone() === 'info'", "class.cngx-status--neutral": "tone() === 'neutral'", "attr.aria-live": "live()" }, classAttribute: "cngx-status" }, ngImport: i0, template: `
|
|
978
|
+
<span class="cngx-status__dot" aria-hidden="true">@if (glyph()) { {{ glyphChar() }} }</span>
|
|
979
|
+
@if (label()) {
|
|
980
|
+
<span class="cngx-status__label">{{ label() }}</span>
|
|
981
|
+
}
|
|
982
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-status-gap{syntax: \"<length>\"; inherits: true; initial-value: 6px;}@property --cngx-status-dot-size{syntax: \"<length>\"; inherits: true; initial-value: 16px;}@property --cngx-status-glyph-size{syntax: \"*\"; inherits: true; initial-value: .7em;}@property --cngx-status-dot-fg{syntax: \"<color>\"; inherits: true; initial-value: white;}@property --cngx-status-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-status-weight{syntax: \"<number>\"; inherits: true; initial-value: 500;}@property --cngx-status-success-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .18 145);}@property --cngx-status-warning-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.75 .15 85);}@property --cngx-status-danger-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .22 25);}@property --cngx-status-info-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .14 250);}@property --cngx-status-neutral-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .02 290);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-status-success-color: oklch(.78 .16 145);--cngx-status-warning-color: oklch(.82 .13 85);--cngx-status-danger-color: oklch(.75 .18 25);--cngx-status-info-color: oklch(.72 .12 250);--cngx-status-neutral-color: oklch(.7 .02 290)}}[data-color-scheme=dark],.dark{--cngx-status-success-color: oklch(.78 .16 145);--cngx-status-warning-color: oklch(.82 .13 85);--cngx-status-danger-color: oklch(.75 .18 25);--cngx-status-info-color: oklch(.72 .12 250);--cngx-status-neutral-color: oklch(.7 .02 290)}[data-color-scheme=light],.light{--cngx-status-success-color: oklch(.65 .18 145);--cngx-status-warning-color: oklch(.75 .15 85);--cngx-status-danger-color: oklch(.65 .22 25);--cngx-status-info-color: oklch(.6 .14 250);--cngx-status-neutral-color: oklch(.6 .02 290)}}@layer cngx.components{@scope(.cngx-status){:scope{--cngx-status-gap: var(--cngx-space-sm);display:inline-flex;align-items:center;gap:var(--cngx-status-gap, 6px);font-size:var(--cngx-status-size, .8125rem);font-weight:var(--cngx-status-weight, 500)}.cngx-status__dot{display:inline-flex;align-items:center;justify-content:center;flex:none;inline-size:var(--cngx-status-dot-size, 16px);block-size:var(--cngx-status-dot-size, 16px);border-radius:50%;font-size:var(--cngx-status-glyph-size, .7em);line-height:1;color:var(--cngx-status-dot-fg, white);background:var(--cngx-status-neutral-color, oklch(.6 .02 290))}:scope.cngx-status--success .cngx-status__dot{background:var(--cngx-status-success-color, var(--cngx-color-success, oklch(.65 .18 145)))}:scope.cngx-status--warning .cngx-status__dot{background:var(--cngx-status-warning-color, oklch(.75 .15 85))}:scope.cngx-status--danger .cngx-status__dot{background:var(--cngx-status-danger-color, var(--cngx-color-danger, oklch(.65 .22 25)))}:scope.cngx-status--info .cngx-status__dot{background:var(--cngx-status-info-color, oklch(.6 .14 250))}:scope.cngx-status--neutral .cngx-status__dot{background:var(--cngx-status-neutral-color, oklch(.6 .02 290))}}}@media(forced-colors:active){.cngx-status .cngx-status__dot:empty{background:CanvasText}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
983
|
+
}
|
|
984
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStatus, decorators: [{
|
|
985
|
+
type: Component,
|
|
986
|
+
args: [{ selector: 'cngx-status', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
987
|
+
class: 'cngx-status',
|
|
988
|
+
'[class.cngx-status--success]': "tone() === 'success'",
|
|
989
|
+
'[class.cngx-status--warning]': "tone() === 'warning'",
|
|
990
|
+
'[class.cngx-status--danger]': "tone() === 'danger'",
|
|
991
|
+
'[class.cngx-status--info]': "tone() === 'info'",
|
|
992
|
+
'[class.cngx-status--neutral]': "tone() === 'neutral'",
|
|
993
|
+
'[attr.aria-live]': 'live()',
|
|
994
|
+
}, template: `
|
|
995
|
+
<span class="cngx-status__dot" aria-hidden="true">@if (glyph()) { {{ glyphChar() }} }</span>
|
|
996
|
+
@if (label()) {
|
|
997
|
+
<span class="cngx-status__label">{{ label() }}</span>
|
|
998
|
+
}
|
|
999
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-status-gap{syntax: \"<length>\"; inherits: true; initial-value: 6px;}@property --cngx-status-dot-size{syntax: \"<length>\"; inherits: true; initial-value: 16px;}@property --cngx-status-glyph-size{syntax: \"*\"; inherits: true; initial-value: .7em;}@property --cngx-status-dot-fg{syntax: \"<color>\"; inherits: true; initial-value: white;}@property --cngx-status-size{syntax: \"*\"; inherits: true; initial-value: .8125rem;}@property --cngx-status-weight{syntax: \"<number>\"; inherits: true; initial-value: 500;}@property --cngx-status-success-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .18 145);}@property --cngx-status-warning-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.75 .15 85);}@property --cngx-status-danger-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .22 25);}@property --cngx-status-info-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .14 250);}@property --cngx-status-neutral-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.6 .02 290);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-status-success-color: oklch(.78 .16 145);--cngx-status-warning-color: oklch(.82 .13 85);--cngx-status-danger-color: oklch(.75 .18 25);--cngx-status-info-color: oklch(.72 .12 250);--cngx-status-neutral-color: oklch(.7 .02 290)}}[data-color-scheme=dark],.dark{--cngx-status-success-color: oklch(.78 .16 145);--cngx-status-warning-color: oklch(.82 .13 85);--cngx-status-danger-color: oklch(.75 .18 25);--cngx-status-info-color: oklch(.72 .12 250);--cngx-status-neutral-color: oklch(.7 .02 290)}[data-color-scheme=light],.light{--cngx-status-success-color: oklch(.65 .18 145);--cngx-status-warning-color: oklch(.75 .15 85);--cngx-status-danger-color: oklch(.65 .22 25);--cngx-status-info-color: oklch(.6 .14 250);--cngx-status-neutral-color: oklch(.6 .02 290)}}@layer cngx.components{@scope(.cngx-status){:scope{--cngx-status-gap: var(--cngx-space-sm);display:inline-flex;align-items:center;gap:var(--cngx-status-gap, 6px);font-size:var(--cngx-status-size, .8125rem);font-weight:var(--cngx-status-weight, 500)}.cngx-status__dot{display:inline-flex;align-items:center;justify-content:center;flex:none;inline-size:var(--cngx-status-dot-size, 16px);block-size:var(--cngx-status-dot-size, 16px);border-radius:50%;font-size:var(--cngx-status-glyph-size, .7em);line-height:1;color:var(--cngx-status-dot-fg, white);background:var(--cngx-status-neutral-color, oklch(.6 .02 290))}:scope.cngx-status--success .cngx-status__dot{background:var(--cngx-status-success-color, var(--cngx-color-success, oklch(.65 .18 145)))}:scope.cngx-status--warning .cngx-status__dot{background:var(--cngx-status-warning-color, oklch(.75 .15 85))}:scope.cngx-status--danger .cngx-status__dot{background:var(--cngx-status-danger-color, var(--cngx-color-danger, oklch(.65 .22 25)))}:scope.cngx-status--info .cngx-status__dot{background:var(--cngx-status-info-color, oklch(.6 .14 250))}:scope.cngx-status--neutral .cngx-status__dot{background:var(--cngx-status-neutral-color, oklch(.6 .02 290))}}}@media(forced-colors:active){.cngx-status .cngx-status__dot:empty{background:CanvasText}}\n"] }]
|
|
1000
|
+
}], ctorParameters: () => [], propDecorators: { tone: [{ type: i0.Input, args: [{ isSignal: true, alias: "tone", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], live: [{ type: i0.Input, args: [{ isSignal: true, alias: "live", required: false }] }], glyph: [{ type: i0.Input, args: [{ isSignal: true, alias: "glyph", required: false }] }] } });
|
|
1001
|
+
|
|
698
1002
|
/**
|
|
699
1003
|
* An inline, wrapping metadata line - a flex row of projected {@link CngxMeta}
|
|
700
1004
|
* pairs separated by a consistent gap. It carries the shared muted colour + gap
|
|
@@ -745,7 +1049,7 @@ class CngxMeta {
|
|
|
745
1049
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMeta, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
746
1050
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxMeta, isStandalone: true, selector: "cngx-meta", inputs: { term: { classPropertyName: "term", publicName: "term", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-meta" }, exportAs: ["cngxMeta"], ngImport: i0, template: `@if (term(); as t) {
|
|
747
1051
|
<span class="cngx-meta__term">{{ t }}</span>
|
|
748
|
-
}<span class="cngx-meta__value"><ng-content /></span>`, isInline: true, styles: [".cngx-meta{--cngx-meta-gap: var(--cngx-space-xs, .35em);display:inline-flex;align-items:baseline;gap:var(--cngx-meta-gap, .35em);min-inline-size:0}.cngx-meta__term{font-weight:var(--cngx-meta-term-weight, 600);color:var(--cngx-meta-term-color, inherit)}.cngx-meta__value{min-inline-size:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1052
|
+
}<span class="cngx-meta__value"><ng-content /></span>`, isInline: true, styles: [".cngx-meta{--cngx-meta-gap: var(--cngx-space-xs, .35em);display:inline-flex;align-items:baseline;gap:var(--cngx-meta-gap, .35em);min-inline-size:0}.cngx-meta__term{font-weight:var(--cngx-meta-term-weight, 600);color:var(--cngx-meta-term-color, inherit)}.cngx-meta__value{min-inline-size:0;unicode-bidi:var(--cngx-meta-value-bidi, isolate)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
749
1053
|
}
|
|
750
1054
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMeta, decorators: [{
|
|
751
1055
|
type: Component,
|
|
@@ -753,7 +1057,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
753
1057
|
<span class="cngx-meta__term">{{ t }}</span>
|
|
754
1058
|
}<span class="cngx-meta__value"><ng-content /></span>`, host: {
|
|
755
1059
|
class: 'cngx-meta',
|
|
756
|
-
}, styles: [".cngx-meta{--cngx-meta-gap: var(--cngx-space-xs, .35em);display:inline-flex;align-items:baseline;gap:var(--cngx-meta-gap, .35em);min-inline-size:0}.cngx-meta__term{font-weight:var(--cngx-meta-term-weight, 600);color:var(--cngx-meta-term-color, inherit)}.cngx-meta__value{min-inline-size:0}\n"] }]
|
|
1060
|
+
}, styles: [".cngx-meta{--cngx-meta-gap: var(--cngx-space-xs, .35em);display:inline-flex;align-items:baseline;gap:var(--cngx-meta-gap, .35em);min-inline-size:0}.cngx-meta__term{font-weight:var(--cngx-meta-term-weight, 600);color:var(--cngx-meta-term-color, inherit)}.cngx-meta__value{min-inline-size:0;unicode-bidi:var(--cngx-meta-value-bidi, isolate)}\n"] }]
|
|
757
1061
|
}], propDecorators: { term: [{ type: i0.Input, args: [{ isSignal: true, alias: "term", required: false }] }] } });
|
|
758
1062
|
|
|
759
1063
|
/**
|
|
@@ -861,7 +1165,7 @@ class CngxCheckboxIndicator {
|
|
|
861
1165
|
<ng-container *ngTemplateOutlet="checkGlyph() ?? defaultCheckGlyph" />
|
|
862
1166
|
}
|
|
863
1167
|
}
|
|
864
|
-
`, 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-
|
|
1168
|
+
`, 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-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{--cngx-checkbox-checked-bg: color-mix(in oklab, var(--cngx-color-text, oklch(.2 .01 250)) 38%, transparent);--cngx-checkbox-checked-color: var(--cngx-color-surface, oklch(1 0 0));color:color-mix(in oklab,var(--cngx-color-text, oklch(.2 .01 250)) 38%,transparent)}.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)}}}@media(forced-colors:active){.cngx-checkbox-indicator:is(.cngx-checkbox-indicator--checked,.cngx-checkbox-indicator--indeterminate) .cngx-checkbox-indicator__box{background:transparent;border-color:currentColor;color:currentColor}.cngx-checkbox-indicator.cngx-checkbox-indicator--checkmark :is(.cngx-checkbox-indicator__check,.cngx-checkbox-indicator__dash){color:currentColor}.cngx-checkbox-indicator.cngx-checkbox-indicator--disabled{color:GrayText}.cngx-checkbox-indicator.cngx-checkbox-indicator--disabled:is(.cngx-checkbox-indicator--checked,.cngx-checkbox-indicator--indeterminate) .cngx-checkbox-indicator__box{forced-color-adjust:none;background:GrayText;border-color:GrayText;color:Canvas}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
865
1169
|
}
|
|
866
1170
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCheckboxIndicator, decorators: [{
|
|
867
1171
|
type: Component,
|
|
@@ -899,7 +1203,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
899
1203
|
<ng-container *ngTemplateOutlet="checkGlyph() ?? defaultCheckGlyph" />
|
|
900
1204
|
}
|
|
901
1205
|
}
|
|
902
|
-
`, 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-
|
|
1206
|
+
`, 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-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{--cngx-checkbox-checked-bg: color-mix(in oklab, var(--cngx-color-text, oklch(.2 .01 250)) 38%, transparent);--cngx-checkbox-checked-color: var(--cngx-color-surface, oklch(1 0 0));color:color-mix(in oklab,var(--cngx-color-text, oklch(.2 .01 250)) 38%,transparent)}.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)}}}@media(forced-colors:active){.cngx-checkbox-indicator:is(.cngx-checkbox-indicator--checked,.cngx-checkbox-indicator--indeterminate) .cngx-checkbox-indicator__box{background:transparent;border-color:currentColor;color:currentColor}.cngx-checkbox-indicator.cngx-checkbox-indicator--checkmark :is(.cngx-checkbox-indicator__check,.cngx-checkbox-indicator__dash){color:currentColor}.cngx-checkbox-indicator.cngx-checkbox-indicator--disabled{color:GrayText}.cngx-checkbox-indicator.cngx-checkbox-indicator--disabled:is(.cngx-checkbox-indicator--checked,.cngx-checkbox-indicator--indeterminate) .cngx-checkbox-indicator__box{forced-color-adjust:none;background:GrayText;border-color:GrayText;color:Canvas}}\n"] }]
|
|
903
1207
|
}], 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 }] }] } });
|
|
904
1208
|
|
|
905
1209
|
/**
|
|
@@ -982,7 +1286,7 @@ class CngxRadioIndicator {
|
|
|
982
1286
|
<ng-container *ngTemplateOutlet="dotGlyph() ?? defaultDotGlyph" />
|
|
983
1287
|
}
|
|
984
1288
|
</span>
|
|
985
|
-
`, 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-
|
|
1289
|
+
`, 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-transition{syntax: \"*\"; inherits: false; initial-value: border-color .12s ease,background-color .12s ease;}:where(.cngx-radio-indicator,.cngx-radio-indicator *){--cngx-radio-indicator-transition: border-color var(--cngx-duration-fast) ease, background-color var(--cngx-duration-fast) 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{--cngx-radio-indicator-checked-color: currentColor;color:color-mix(in oklab,var(--cngx-color-text, oklch(.2 .01 250)) 38%,transparent)}@media(prefers-reduced-motion:reduce){.cngx-radio-indicator__circle,.cngx-radio-indicator__dot{transition:none}}}}@media(forced-colors:active){.cngx-radio-indicator__dot{background:var(--_cngx-forced-ink, CanvasText)}.cngx-radio-indicator.cngx-radio-indicator--checked .cngx-radio-indicator__circle{border-color:currentColor}.cngx-radio-indicator.cngx-radio-indicator--disabled{color:GrayText}.cngx-radio-indicator.cngx-radio-indicator--disabled .cngx-radio-indicator__circle{border-color:GrayText}.cngx-radio-indicator.cngx-radio-indicator--disabled .cngx-radio-indicator__dot{background:GrayText}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
986
1290
|
}
|
|
987
1291
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxRadioIndicator, decorators: [{
|
|
988
1292
|
type: Component,
|
|
@@ -1004,7 +1308,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1004
1308
|
<ng-container *ngTemplateOutlet="dotGlyph() ?? defaultDotGlyph" />
|
|
1005
1309
|
}
|
|
1006
1310
|
</span>
|
|
1007
|
-
`, 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-
|
|
1311
|
+
`, 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-transition{syntax: \"*\"; inherits: false; initial-value: border-color .12s ease,background-color .12s ease;}:where(.cngx-radio-indicator,.cngx-radio-indicator *){--cngx-radio-indicator-transition: border-color var(--cngx-duration-fast) ease, background-color var(--cngx-duration-fast) 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{--cngx-radio-indicator-checked-color: currentColor;color:color-mix(in oklab,var(--cngx-color-text, oklch(.2 .01 250)) 38%,transparent)}@media(prefers-reduced-motion:reduce){.cngx-radio-indicator__circle,.cngx-radio-indicator__dot{transition:none}}}}@media(forced-colors:active){.cngx-radio-indicator__dot{background:var(--_cngx-forced-ink, CanvasText)}.cngx-radio-indicator.cngx-radio-indicator--checked .cngx-radio-indicator__circle{border-color:currentColor}.cngx-radio-indicator.cngx-radio-indicator--disabled{color:GrayText}.cngx-radio-indicator.cngx-radio-indicator--disabled .cngx-radio-indicator__circle{border-color:GrayText}.cngx-radio-indicator.cngx-radio-indicator--disabled .cngx-radio-indicator__dot{background:GrayText}}\n"] }]
|
|
1008
1312
|
}], 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 }] }] } });
|
|
1009
1313
|
|
|
1010
1314
|
/**
|
|
@@ -1012,6 +1316,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1012
1316
|
* count of that unit in the next-larger one; anything past `months` falls
|
|
1013
1317
|
* through to the `years` return.
|
|
1014
1318
|
*/
|
|
1319
|
+
/**
|
|
1320
|
+
* Per-locale `Intl.RelativeTimeFormat` cache - the options are fixed, so the
|
|
1321
|
+
* locale alone keys the instance. Constructing Intl formatters is the
|
|
1322
|
+
* expensive half of formatting; the cache makes recomputes allocation-free.
|
|
1323
|
+
*/
|
|
1324
|
+
const relativeFormatterFor = memoize((locale) => new Intl.RelativeTimeFormat(locale, { numeric: 'auto' }));
|
|
1015
1325
|
const RELATIVE_DIVISIONS = [
|
|
1016
1326
|
{ amount: 60, unit: 'seconds' },
|
|
1017
1327
|
{ amount: 60, unit: 'minutes' },
|
|
@@ -1025,8 +1335,9 @@ const RELATIVE_DIVISIONS = [
|
|
|
1025
1335
|
* `datetime` attribute (ISO 8601) plus a human string in one of two modes:
|
|
1026
1336
|
* `absolute` (via `Intl.DateTimeFormat`) or `relative` (via
|
|
1027
1337
|
* `Intl.RelativeTimeFormat`, e.g. "3 days ago"). Formatting resolves against
|
|
1028
|
-
* the
|
|
1029
|
-
* provides one
|
|
1338
|
+
* the app locale (`CNGX_LOCALE`, falling back to the nearest `LOCALE_ID`) -
|
|
1339
|
+
* English out of the box, locale-driven when the app provides one, re-formatted
|
|
1340
|
+
* on a locale flip; no hardcoded strings.
|
|
1030
1341
|
*
|
|
1031
1342
|
* Relative mode is render-time, not live-ticking: it recomputes when `[date]`
|
|
1032
1343
|
* changes, not on a timer, so "2 minutes ago" does not self-update. A consumer
|
|
@@ -1046,7 +1357,7 @@ const RELATIVE_DIVISIONS = [
|
|
|
1046
1357
|
* @relatedTo CngxCardTimestamp
|
|
1047
1358
|
*/
|
|
1048
1359
|
class CngxTime {
|
|
1049
|
-
locale =
|
|
1360
|
+
locale = injectLocale();
|
|
1050
1361
|
/** Instant to render. Accepts a `Date`, an ISO string, or an epoch-ms number. */
|
|
1051
1362
|
date = input.required(...(ngDevMode ? [{ debugName: "date" }] : /* istanbul ignore next */ []));
|
|
1052
1363
|
/**
|
|
@@ -1060,29 +1371,55 @@ class CngxTime {
|
|
|
1060
1371
|
* Coerced instant. A `Date`; downstream reads its time value. The `equal` fn
|
|
1061
1372
|
* dedupes by time value so re-binding `[date]` to a fresh `Date` of the same
|
|
1062
1373
|
* instant (or the equivalent ISO string) does not cascade `iso`/`formatted` -
|
|
1063
|
-
* the object-computed equality rule.
|
|
1374
|
+
* the object-computed equality rule. NaN pairs compare equal - without the
|
|
1375
|
+
* arm, two Invalid Dates would defeat the dedupe (NaN !== NaN) and cascade
|
|
1376
|
+
* on every rebind.
|
|
1064
1377
|
*/
|
|
1065
1378
|
instant = computed(() => {
|
|
1066
1379
|
const value = this.date();
|
|
1067
1380
|
return value instanceof Date ? value : new Date(value);
|
|
1068
|
-
}, { ...(ngDevMode ? { debugName: "instant" } : /* istanbul ignore next */ {}), equal: (a, b) =>
|
|
1069
|
-
|
|
1070
|
-
|
|
1381
|
+
}, { ...(ngDevMode ? { debugName: "instant" } : /* istanbul ignore next */ {}), equal: (a, b) => {
|
|
1382
|
+
const ta = a.getTime();
|
|
1383
|
+
const tb = b.getTime();
|
|
1384
|
+
return ta === tb || (Number.isNaN(ta) && Number.isNaN(tb));
|
|
1385
|
+
} });
|
|
1386
|
+
/**
|
|
1387
|
+
* Invalid Date guard. `toISOString()` throws and `Intl.format` renders
|
|
1388
|
+
* garbage on an invalid instant - a bad ISO string must degrade to an
|
|
1389
|
+
* empty render, not crash change detection.
|
|
1390
|
+
*/
|
|
1391
|
+
isValidDate = computed(() => !Number.isNaN(this.instant().getTime()), ...(ngDevMode ? [{ debugName: "isValidDate" }] : /* istanbul ignore next */ []));
|
|
1392
|
+
/** Machine-readable ISO 8601 for the `datetime` attribute. `null` (attribute removed) when the instant is invalid. */
|
|
1393
|
+
iso = computed(() => (this.isValidDate() ? this.instant().toISOString() : null), ...(ngDevMode ? [{ debugName: "iso" }] : /* istanbul ignore next */ []));
|
|
1071
1394
|
/**
|
|
1072
1395
|
* Human string. Reads `Date.now()` in `relative` mode as a render-time
|
|
1073
1396
|
* snapshot - untracked by design, so the value recomputes only when `[date]`
|
|
1074
1397
|
* (or `mode`/`format`) changes, never on a timer.
|
|
1075
1398
|
*/
|
|
1076
1399
|
formatted = computed(() => {
|
|
1400
|
+
if (!this.isValidDate()) {
|
|
1401
|
+
return '';
|
|
1402
|
+
}
|
|
1077
1403
|
const instant = this.instant();
|
|
1404
|
+
const locale = this.locale();
|
|
1078
1405
|
if (this.mode() === 'relative') {
|
|
1079
|
-
return this.formatRelative(instant.getTime(), Date.now());
|
|
1406
|
+
return this.formatRelative(instant.getTime(), Date.now(), locale);
|
|
1080
1407
|
}
|
|
1081
1408
|
const format = this.format() ?? { year: 'numeric', month: 'short', day: 'numeric' };
|
|
1082
|
-
return
|
|
1409
|
+
return dateTimeFormatterFor(locale, format).format(instant);
|
|
1083
1410
|
}, ...(ngDevMode ? [{ debugName: "formatted" }] : /* istanbul ignore next */ []));
|
|
1084
|
-
|
|
1085
|
-
|
|
1411
|
+
constructor() {
|
|
1412
|
+
if (isDevMode()) {
|
|
1413
|
+
effect(() => {
|
|
1414
|
+
if (!this.isValidDate()) {
|
|
1415
|
+
console.warn('[CngxTime] [date] resolved to an Invalid Date - rendering empty. ' +
|
|
1416
|
+
'Check the bound value (bad ISO string?).');
|
|
1417
|
+
}
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
formatRelative(target, now, locale) {
|
|
1422
|
+
const rtf = relativeFormatterFor(locale);
|
|
1086
1423
|
let delta = (target - now) / 1000;
|
|
1087
1424
|
for (const division of RELATIVE_DIVISIONS) {
|
|
1088
1425
|
if (Math.abs(delta) < division.amount) {
|
|
@@ -1093,14 +1430,14 @@ class CngxTime {
|
|
|
1093
1430
|
return rtf.format(Math.round(delta), 'years');
|
|
1094
1431
|
}
|
|
1095
1432
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTime, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1096
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxTime, isStandalone: true, selector: "cngx-time", inputs: { date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: true, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-time" }, exportAs: ["cngxTime"], ngImport: i0, template: `<time [attr.datetime]="iso()">{{ formatted() }}</time>`, isInline: true, styles: [".cngx-time{display:inline;font-family:var(--cngx-time-font, inherit);font-size:var(--cngx-time-size, inherit);font-variant-numeric:var(--cngx-time-numeric, tabular-nums);color:var(--cngx-time-color, inherit)}.cngx-time time{font:inherit;color:inherit}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1433
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxTime, isStandalone: true, selector: "cngx-time", inputs: { date: { classPropertyName: "date", publicName: "date", isSignal: true, isRequired: true, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-time" }, exportAs: ["cngxTime"], ngImport: i0, template: `<time [attr.datetime]="iso()">{{ formatted() }}</time>`, isInline: true, styles: [".cngx-time{display:inline;font-family:var(--cngx-time-font, inherit);font-size:var(--cngx-time-size, inherit);font-variant-numeric:var(--cngx-time-numeric, tabular-nums);color:var(--cngx-time-color, inherit);unicode-bidi:var(--cngx-time-bidi, isolate)}.cngx-time time{font:inherit;color:inherit}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1097
1434
|
}
|
|
1098
1435
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTime, decorators: [{
|
|
1099
1436
|
type: Component,
|
|
1100
1437
|
args: [{ selector: 'cngx-time', exportAs: 'cngxTime', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
1101
1438
|
class: 'cngx-time',
|
|
1102
|
-
}, template: `<time [attr.datetime]="iso()">{{ formatted() }}</time>`, styles: [".cngx-time{display:inline;font-family:var(--cngx-time-font, inherit);font-size:var(--cngx-time-size, inherit);font-variant-numeric:var(--cngx-time-numeric, tabular-nums);color:var(--cngx-time-color, inherit)}.cngx-time time{font:inherit;color:inherit}\n"] }]
|
|
1103
|
-
}], propDecorators: { date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: true }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }] } });
|
|
1439
|
+
}, template: `<time [attr.datetime]="iso()">{{ formatted() }}</time>`, styles: [".cngx-time{display:inline;font-family:var(--cngx-time-font, inherit);font-size:var(--cngx-time-size, inherit);font-variant-numeric:var(--cngx-time-numeric, tabular-nums);color:var(--cngx-time-color, inherit);unicode-bidi:var(--cngx-time-bidi, isolate)}.cngx-time time{font:inherit;color:inherit}\n"] }]
|
|
1440
|
+
}], ctorParameters: () => [], propDecorators: { date: [{ type: i0.Input, args: [{ isSignal: true, alias: "date", required: true }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }] } });
|
|
1104
1441
|
|
|
1105
1442
|
const SEGMENT_COUNT = 4;
|
|
1106
1443
|
const STRENGTH_LEVELS = ['none', 'weak', 'fair', 'good', 'strong'];
|
|
@@ -1148,7 +1485,7 @@ class CngxPasswordStrengthMeter {
|
|
|
1148
1485
|
aria-hidden="true"
|
|
1149
1486
|
></span>
|
|
1150
1487
|
}
|
|
1151
|
-
`, isInline: true, styles: [".cngx-password-strength-meter{--cngx-password-strength-meter-gap: var(--cngx-space-xs, .25rem);display:flex;align-items:center;gap:var(--cngx-password-strength-meter-gap, .25rem);inline-size:var(--cngx-password-strength-meter-inline-size, 100%)}.cngx-password-strength-meter__segment{flex:1 1 0;block-size:var(--cngx-password-strength-meter-thickness, .375rem);border-radius:var(--cngx-password-strength-meter-radius, 999px);background:var(--cngx-password-strength-meter-empty-color, #e0e0e0);transition:background var(--cngx-password-strength-meter-transition, .15s ease)}.cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-fill-color, #3f51b5)}.cngx-password-strength-meter[data-strength=weak] .cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-weak-color, #b3261e)}.cngx-password-strength-meter[data-strength=fair] .cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-fair-color, #ed6c02)}.cngx-password-strength-meter[data-strength=good] .cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-good-color, #0288d1)}.cngx-password-strength-meter[data-strength=strong] .cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-strong-color, #2e7d32)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1488
|
+
`, isInline: true, styles: [".cngx-password-strength-meter{--cngx-password-strength-meter-gap: var(--cngx-space-xs, .25rem);display:flex;align-items:center;gap:var(--cngx-password-strength-meter-gap, .25rem);inline-size:var(--cngx-password-strength-meter-inline-size, 100%)}.cngx-password-strength-meter__segment{flex:1 1 0;block-size:var(--cngx-password-strength-meter-thickness, .375rem);border-radius:var(--cngx-password-strength-meter-radius, 999px);background:var(--cngx-password-strength-meter-empty-color, #e0e0e0);transition:background var(--cngx-password-strength-meter-transition, var(--cngx-duration-fast, .15s) ease)}.cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-fill-color, #3f51b5)}.cngx-password-strength-meter[data-strength=weak] .cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-weak-color, #b3261e)}.cngx-password-strength-meter[data-strength=fair] .cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-fair-color, #ed6c02)}.cngx-password-strength-meter[data-strength=good] .cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-good-color, #0288d1)}.cngx-password-strength-meter[data-strength=strong] .cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-strong-color, #2e7d32)}@media(forced-colors:active){.cngx-password-strength-meter .cngx-password-strength-meter__segment{background:Canvas;outline:1px solid CanvasText;outline-offset:-1px}.cngx-password-strength-meter .cngx-password-strength-meter__segment[data-filled=true],.cngx-password-strength-meter[data-strength] .cngx-password-strength-meter__segment[data-filled=true]{background:CanvasText}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
1152
1489
|
}
|
|
1153
1490
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPasswordStrengthMeter, decorators: [{
|
|
1154
1491
|
type: Component,
|
|
@@ -1164,7 +1501,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1164
1501
|
aria-hidden="true"
|
|
1165
1502
|
></span>
|
|
1166
1503
|
}
|
|
1167
|
-
`, styles: [".cngx-password-strength-meter{--cngx-password-strength-meter-gap: var(--cngx-space-xs, .25rem);display:flex;align-items:center;gap:var(--cngx-password-strength-meter-gap, .25rem);inline-size:var(--cngx-password-strength-meter-inline-size, 100%)}.cngx-password-strength-meter__segment{flex:1 1 0;block-size:var(--cngx-password-strength-meter-thickness, .375rem);border-radius:var(--cngx-password-strength-meter-radius, 999px);background:var(--cngx-password-strength-meter-empty-color, #e0e0e0);transition:background var(--cngx-password-strength-meter-transition, .15s ease)}.cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-fill-color, #3f51b5)}.cngx-password-strength-meter[data-strength=weak] .cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-weak-color, #b3261e)}.cngx-password-strength-meter[data-strength=fair] .cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-fair-color, #ed6c02)}.cngx-password-strength-meter[data-strength=good] .cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-good-color, #0288d1)}.cngx-password-strength-meter[data-strength=strong] .cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-strong-color, #2e7d32)}\n"] }]
|
|
1504
|
+
`, styles: [".cngx-password-strength-meter{--cngx-password-strength-meter-gap: var(--cngx-space-xs, .25rem);display:flex;align-items:center;gap:var(--cngx-password-strength-meter-gap, .25rem);inline-size:var(--cngx-password-strength-meter-inline-size, 100%)}.cngx-password-strength-meter__segment{flex:1 1 0;block-size:var(--cngx-password-strength-meter-thickness, .375rem);border-radius:var(--cngx-password-strength-meter-radius, 999px);background:var(--cngx-password-strength-meter-empty-color, #e0e0e0);transition:background var(--cngx-password-strength-meter-transition, var(--cngx-duration-fast, .15s) ease)}.cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-fill-color, #3f51b5)}.cngx-password-strength-meter[data-strength=weak] .cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-weak-color, #b3261e)}.cngx-password-strength-meter[data-strength=fair] .cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-fair-color, #ed6c02)}.cngx-password-strength-meter[data-strength=good] .cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-good-color, #0288d1)}.cngx-password-strength-meter[data-strength=strong] .cngx-password-strength-meter__segment[data-filled=true]{background:var(--cngx-password-strength-meter-strong-color, #2e7d32)}@media(forced-colors:active){.cngx-password-strength-meter .cngx-password-strength-meter__segment{background:Canvas;outline:1px solid CanvasText;outline-offset:-1px}.cngx-password-strength-meter .cngx-password-strength-meter__segment[data-filled=true],.cngx-password-strength-meter[data-strength] .cngx-password-strength-meter__segment[data-filled=true]{background:CanvasText}}\n"] }]
|
|
1168
1505
|
}], propDecorators: { score: [{ type: i0.Input, args: [{ isSignal: true, alias: "score", required: true }] }] } });
|
|
1169
1506
|
|
|
1170
1507
|
/**
|
|
@@ -1247,7 +1584,7 @@ const CNGX_TAG_CONFIG = new InjectionToken('CNGX_TAG_CONFIG', {
|
|
|
1247
1584
|
* (per-instance Input → `provideTagConfigAt` → `provideTagConfig`
|
|
1248
1585
|
* → library defaults).
|
|
1249
1586
|
*
|
|
1250
|
-
* Equivalent to `inject(CNGX_TAG_CONFIG)`
|
|
1587
|
+
* Equivalent to `inject(CNGX_TAG_CONFIG)` - the helper exists so
|
|
1251
1588
|
* consumers don't need to import the token directly. Mirrors
|
|
1252
1589
|
* `injectSelectConfig` in `@cngx/forms/select`.
|
|
1253
1590
|
*
|
|
@@ -1270,7 +1607,7 @@ function injectTagConfig() {
|
|
|
1270
1607
|
* Wraps a `contentChild` directive query in a 3-stage slot-resolution
|
|
1271
1608
|
* cascade:
|
|
1272
1609
|
*
|
|
1273
|
-
* 1. Instance directive (highest)
|
|
1610
|
+
* 1. Instance directive (highest) - consumer-projected
|
|
1274
1611
|
* `<ng-template cngxTag*>` template.
|
|
1275
1612
|
* 2. `CNGX_TAG_CONFIG.templates[<key>]` (app-wide cascade via
|
|
1276
1613
|
* `provideTagConfig` / `provideTagConfigAt`).
|
|
@@ -1279,7 +1616,7 @@ function injectTagConfig() {
|
|
|
1279
1616
|
* label fallback).
|
|
1280
1617
|
*
|
|
1281
1618
|
* `inject(CNGX_TAG_CONFIG, { optional: true })` mirrors the select-
|
|
1282
|
-
* shared helper exactly
|
|
1619
|
+
* shared helper exactly - `providedIn: 'root'` always resolves so
|
|
1283
1620
|
* the optional flag is defensive, not load-bearing.
|
|
1284
1621
|
*
|
|
1285
1622
|
* **Why a copy and not an import from `@cngx/forms/select/shared`.**
|
|
@@ -1289,7 +1626,7 @@ function injectTagConfig() {
|
|
|
1289
1626
|
* select call site and belongs in a separate utils-consolidation
|
|
1290
1627
|
* plan (see
|
|
1291
1628
|
* `.internal/architektur/plans/tag-family-architectural-a-plus-pass-plan.md`,
|
|
1292
|
-
* "Architectural decisions (locked)"
|
|
1629
|
+
* "Architectural decisions (locked)" - `injectResolvedTemplate
|
|
1293
1630
|
* location` row).
|
|
1294
1631
|
*
|
|
1295
1632
|
* @internal
|
|
@@ -1459,6 +1796,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1459
1796
|
}]
|
|
1460
1797
|
}] });
|
|
1461
1798
|
|
|
1799
|
+
/**
|
|
1800
|
+
* Colour keys whose `[data-color]` cascade ships in `tag.css`. A
|
|
1801
|
+
* `withTagColors()` entry under one of these keys stays a no-op - the
|
|
1802
|
+
* stylesheet cascade owns them.
|
|
1803
|
+
*/
|
|
1804
|
+
const PREDEFINED_TAG_COLORS = new Set([
|
|
1805
|
+
'neutral',
|
|
1806
|
+
'success',
|
|
1807
|
+
'warning',
|
|
1808
|
+
'error',
|
|
1809
|
+
'info',
|
|
1810
|
+
]);
|
|
1462
1811
|
/**
|
|
1463
1812
|
* Decorative tag / label / badge atom.
|
|
1464
1813
|
*
|
|
@@ -1497,6 +1846,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1497
1846
|
* @selector cngx-tag
|
|
1498
1847
|
* @since 0.1.0
|
|
1499
1848
|
* @relatedTo CngxTagGroup, CngxChip, CngxBadge, CngxTagLabel
|
|
1849
|
+
* @slot cngxTagLabel Replaces the tag's text body.
|
|
1850
|
+
* @slot cngxTagPrefix Content before the label, typically an icon or swatch.
|
|
1851
|
+
* @slot cngxTagSuffix Content after the label, typically a remove affordance.
|
|
1500
1852
|
* <example-url>http://localhost:4200/#/common/display/tag/app-wide-defaults-via-providetagconfig</example-url>
|
|
1501
1853
|
* <example-url>http://localhost:4200/#/common/display/tag/color-palette</example-url>
|
|
1502
1854
|
* <example-url>http://localhost:4200/#/common/display/tag/composition-with-cngxicon</example-url>
|
|
@@ -1538,6 +1890,28 @@ class CngxTag {
|
|
|
1538
1890
|
color = input(this.cfg.defaults?.color ?? 'neutral', ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
1539
1891
|
/** Density. `md` (default) | `sm` | `lg` | `xl`. */
|
|
1540
1892
|
size = input(this.cfg.defaults?.size ?? 'md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
1893
|
+
/**
|
|
1894
|
+
* Registered `withTagColors` entry for the current colour key.
|
|
1895
|
+
* Consumer keys only - the five predefined keys resolve in
|
|
1896
|
+
* `tag.css`, so a config entry under a predefined key stays a
|
|
1897
|
+
* no-op per the `withTagColors` contract. The entry is emitted as
|
|
1898
|
+
* element-level `--cngx-tag-bg/-color/-border` values ONLY when
|
|
1899
|
+
* the config carries the key; an unregistered key emits nothing,
|
|
1900
|
+
* so the plain consumer CSS authoring path (`[data-color="..."]`
|
|
1901
|
+
* rules) is never shadowed by an element style.
|
|
1902
|
+
*/
|
|
1903
|
+
configColor = computed(() => {
|
|
1904
|
+
const key = this.color();
|
|
1905
|
+
if (PREDEFINED_TAG_COLORS.has(key)) {
|
|
1906
|
+
return undefined;
|
|
1907
|
+
}
|
|
1908
|
+
return this.cfg.colors?.[key];
|
|
1909
|
+
}, ...(ngDevMode ? [{ debugName: "configColor" }] : /* istanbul ignore next */ []));
|
|
1910
|
+
/** Border shorthand for the registered entry (mirrors the `1px solid <color>` shape of the predefined cascade). */
|
|
1911
|
+
configBorder = computed(() => {
|
|
1912
|
+
const entry = this.configColor();
|
|
1913
|
+
return entry ? `1px solid ${entry.border}` : null;
|
|
1914
|
+
}, ...(ngDevMode ? [{ debugName: "configBorder" }] : /* istanbul ignore next */ []));
|
|
1541
1915
|
/**
|
|
1542
1916
|
* When `true`, applies `text-overflow: ellipsis` + `white-space: nowrap`
|
|
1543
1917
|
* to the inner `.cngx-tag__label` span. Pair with `[maxWidth]` for a
|
|
@@ -1590,10 +1964,9 @@ class CngxTag {
|
|
|
1590
1964
|
suffixTpl = injectResolvedTagTemplate(this.suffixSlot, 'suffix');
|
|
1591
1965
|
/**
|
|
1592
1966
|
* Reactive bundle exposed to every slot's `*ngTemplateOutletContext`.
|
|
1593
|
-
*
|
|
1594
|
-
*
|
|
1595
|
-
*
|
|
1596
|
-
* injecting the directive.
|
|
1967
|
+
* All three slots share `CngxTagSlotContext`, so the same computed
|
|
1968
|
+
* source serves them. Consumer templates `let-variant="variant"` etc.
|
|
1969
|
+
* read the live state without injecting the directive.
|
|
1597
1970
|
*
|
|
1598
1971
|
* Explicit structural `equal` fn - without it, a fresh literal each
|
|
1599
1972
|
* CD cycle would force `ngTemplateOutlet` to rebind embedded views
|
|
@@ -1623,7 +1996,7 @@ class CngxTag {
|
|
|
1623
1996
|
*/
|
|
1624
1997
|
roleAttr = computed(() => this.group?.semanticList() ? 'listitem' : null, ...(ngDevMode ? [{ debugName: "roleAttr" }] : /* istanbul ignore next */ []));
|
|
1625
1998
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTag, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1626
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxTag, isStandalone: true, selector: "[cngxTag], cngx-tag", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, truncate: { classPropertyName: "truncate", publicName: "truncate", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cngx-tag--filled": "variant() === 'filled'", "class.cngx-tag--outline": "variant() === 'outline'", "class.cngx-tag--subtle": "variant() === 'subtle'", "class.cngx-tag--sm": "size() === 'sm'", "class.cngx-tag--md": "size() === 'md'", "class.cngx-tag--lg": "size() === 'lg'", "class.cngx-tag--xl": "size() === 'xl'", "class.cngx-tag--truncate": "truncate()", "attr.data-color": "color()", "style.max-width": "maxWidth()", "attr.role": "roleAttr()" }, classAttribute: "cngx-tag" }, queries: [{ propertyName: "labelSlot", first: true, predicate: CngxTagLabel, descendants: true, isSignal: true }, { propertyName: "prefixSlot", first: true, predicate: CngxTagPrefix, descendants: true, isSignal: true }, { propertyName: "suffixSlot", first: true, predicate: CngxTagSuffix, descendants: true, isSignal: true }], exportAs: ["cngxTag"], ngImport: i0, template: `
|
|
1999
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxTag, isStandalone: true, selector: "[cngxTag], cngx-tag", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, truncate: { classPropertyName: "truncate", publicName: "truncate", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cngx-tag--filled": "variant() === 'filled'", "class.cngx-tag--outline": "variant() === 'outline'", "class.cngx-tag--subtle": "variant() === 'subtle'", "class.cngx-tag--sm": "size() === 'sm'", "class.cngx-tag--md": "size() === 'md'", "class.cngx-tag--lg": "size() === 'lg'", "class.cngx-tag--xl": "size() === 'xl'", "class.cngx-tag--truncate": "truncate()", "attr.data-color": "color()", "style.--cngx-tag-bg": "configColor()?.bg ?? null", "style.--cngx-tag-color": "configColor()?.color ?? null", "style.--cngx-tag-border": "configBorder()", "style.max-width": "maxWidth()", "attr.role": "roleAttr()" }, classAttribute: "cngx-tag" }, queries: [{ propertyName: "labelSlot", first: true, predicate: CngxTagLabel, descendants: true, isSignal: true }, { propertyName: "prefixSlot", first: true, predicate: CngxTagPrefix, descendants: true, isSignal: true }, { propertyName: "suffixSlot", first: true, predicate: CngxTagSuffix, descendants: true, isSignal: true }], exportAs: ["cngxTag"], ngImport: i0, template: `
|
|
1627
2000
|
@if (prefixTpl(); as t) {
|
|
1628
2001
|
<ng-container *ngTemplateOutlet="t; context: slotContext()" />
|
|
1629
2002
|
}
|
|
@@ -1662,13 +2035,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1662
2035
|
'[class.cngx-tag--xl]': "size() === 'xl'",
|
|
1663
2036
|
'[class.cngx-tag--truncate]': 'truncate()',
|
|
1664
2037
|
'[attr.data-color]': 'color()',
|
|
2038
|
+
'[style.--cngx-tag-bg]': 'configColor()?.bg ?? null',
|
|
2039
|
+
'[style.--cngx-tag-color]': 'configColor()?.color ?? null',
|
|
2040
|
+
'[style.--cngx-tag-border]': 'configBorder()',
|
|
1665
2041
|
'[style.max-width]': 'maxWidth()',
|
|
1666
2042
|
'[attr.role]': 'roleAttr()',
|
|
1667
2043
|
}, styles: ["@layer cngx.components{@scope(.cngx-tag){:scope{--cngx-tag-gap: var(--cngx-space-xs);--cngx-tag-padding: var(--cngx-space-xs) var(--cngx-space-sm);--cngx-tag-sm-padding: 0 var(--cngx-space-xs);--cngx-tag-lg-padding: var(--cngx-space-xs) var(--cngx-space-sm);--cngx-tag-xl-padding: var(--cngx-space-xs) var(--cngx-space-sm);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{--cngx-tag-group-stack-gap: var(--cngx-space-sm);display:flex;flex-direction:column;gap:var(--cngx-tag-group-stack-gap, var(--cngx-space-sm, 8px))}.cngx-tag-group__row{--cngx-tag-group-gap: var(--cngx-space-sm);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{--cngx-tag-group-gap-xs: var(--cngx-space-xs);gap:var(--cngx-tag-group-gap-xs, var(--cngx-space-xs, 4px))}:scope.cngx-tag-group--gap-md>.cngx-tag-group__row{--cngx-tag-group-gap-md: var(--cngx-space-sm);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"] }]
|
|
1668
2044
|
}], 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 }] }] } });
|
|
1669
2045
|
|
|
1670
2046
|
/**
|
|
1671
|
-
* Reduces a list of feature objects into a partial config
|
|
2047
|
+
* Reduces a list of feature objects into a partial config - last
|
|
1672
2048
|
* write wins per sub-tree. Inner objects are spread-merged so
|
|
1673
2049
|
* partial overrides (e.g. just `variant` without `color`) compose
|
|
1674
2050
|
* cleanly with prior writes.
|
|
@@ -1770,7 +2146,7 @@ function provideTagConfig(...features) {
|
|
|
1770
2146
|
*
|
|
1771
2147
|
* Unlike `provideTagConfig` (root-only), `provideTagConfigAt` injects
|
|
1772
2148
|
* the parent injector's `CNGX_TAG_CONFIG` value (resolves through
|
|
1773
|
-
* the priority chain
|
|
2149
|
+
* the priority chain - root provider, library defaults, or another
|
|
1774
2150
|
* `provideTagConfigAt` further up) and deep-merges the supplied
|
|
1775
2151
|
* features on top. This produces cumulative cascade behaviour:
|
|
1776
2152
|
* descendant tag instances see the merged config, sibling sub-trees
|
|
@@ -1813,7 +2189,7 @@ function provideTagConfigAt(...features) {
|
|
|
1813
2189
|
/**
|
|
1814
2190
|
* Override the default `CngxTag` input values (`variant`, `color`,
|
|
1815
2191
|
* `size`, `truncate`, `maxWidth`). Per-instance bindings still win
|
|
1816
|
-
* over the cascade
|
|
2192
|
+
* over the cascade - this only sets the *fallback* per directive.
|
|
1817
2193
|
*
|
|
1818
2194
|
* ```ts
|
|
1819
2195
|
* provideTagConfig(
|
|
@@ -1842,16 +2218,19 @@ function withTagGroupDefaults(payload) {
|
|
|
1842
2218
|
return { kind: 'groupDefaults', payload };
|
|
1843
2219
|
}
|
|
1844
2220
|
/**
|
|
1845
|
-
* Register consumer-defined colour entries.
|
|
1846
|
-
*
|
|
1847
|
-
* `--cngx-tag-bg
|
|
1848
|
-
*
|
|
2221
|
+
* Register consumer-defined colour entries. When a tag's `color`
|
|
2222
|
+
* resolves to a registered key, the directive emits the entry as
|
|
2223
|
+
* element-level `--cngx-tag-bg` / `--cngx-tag-color` /
|
|
2224
|
+
* `--cngx-tag-border` values (border wrapped as `1px solid <color>`
|
|
2225
|
+
* to mirror the predefined cascade). The entry applies uniformly
|
|
2226
|
+
* across variants - config colours carry no per-variant surfaces.
|
|
1849
2227
|
*
|
|
1850
2228
|
* The five predefined keys (`neutral`/`success`/`warning`/`error`/
|
|
1851
2229
|
* `info`) ship in `tag.css` and are NOT part of this map; passing
|
|
1852
|
-
* them here is a no-op against the predefined cascade.
|
|
1853
|
-
* keys
|
|
1854
|
-
*
|
|
2230
|
+
* them here is a no-op against the predefined cascade. Unregistered
|
|
2231
|
+
* consumer keys emit nothing, so authoring plain
|
|
2232
|
+
* `[data-color="my-brand"]` CSS remains a first-class alternative -
|
|
2233
|
+
* the emitter never shadows it with an element style.
|
|
1855
2234
|
*
|
|
1856
2235
|
* ```ts
|
|
1857
2236
|
* provideTagConfig(
|
|
@@ -1872,12 +2251,12 @@ function withTagColors(payload) {
|
|
|
1872
2251
|
}
|
|
1873
2252
|
/**
|
|
1874
2253
|
* Register app-wide template overrides for the five Tag-family
|
|
1875
|
-
* slots. Resolved in tier 2 of the slot cascade
|
|
2254
|
+
* slots. Resolved in tier 2 of the slot cascade - instance
|
|
1876
2255
|
* directives still win, the host's `<ng-template>` default body is
|
|
1877
2256
|
* the floor.
|
|
1878
2257
|
*
|
|
1879
2258
|
* **Staging note.** This factory ships ahead of a documented second
|
|
1880
|
-
* consumer
|
|
2259
|
+
* consumer - the headless `CngxTag` + `CngxTagGroup` are the only
|
|
1881
2260
|
* current consumers. The staging is intentional and tracked in
|
|
1882
2261
|
* `display-accepted-debt.md §2` (Material organism deferral): a
|
|
1883
2262
|
* future `cngx-mat-tag` / `cngx-mat-tag-group` wrapper inherits the
|
|
@@ -2061,6 +2440,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2061
2440
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/display/tag-group/tag-group.component.ts
|
|
2062
2441
|
* @since 0.1.0
|
|
2063
2442
|
* @relatedTo CngxTag, CngxTagGroupHeader, CngxTagGroupAccessory, CNGX_TAG_GROUP
|
|
2443
|
+
* @slot cngxTagGroupHeader Replaces the group's heading row.
|
|
2444
|
+
* @slot cngxTagGroupAccessory Trailing control beside the header, e.g. a clear-all button.
|
|
2064
2445
|
* <example-url>http://localhost:4200/#/common/display/tag/app-wide-defaults-via-providetagconfig</example-url>
|
|
2065
2446
|
* <example-url>http://localhost:4200/#/common/display/tag/color-palette</example-url>
|
|
2066
2447
|
* <example-url>http://localhost:4200/#/common/display/tag/composition-with-cngxicon</example-url>
|
|
@@ -2155,10 +2536,10 @@ class CngxTagGroup {
|
|
|
2155
2536
|
projectedTags = contentChildren(CngxTag, ...(ngDevMode ? [{ debugName: "projectedTags" }] : /* istanbul ignore next */ []));
|
|
2156
2537
|
/**
|
|
2157
2538
|
* Reactive bundle exposed to header / accessory slots'
|
|
2158
|
-
* `*ngTemplateOutletContext`.
|
|
2159
|
-
*
|
|
2160
|
-
*
|
|
2161
|
-
*
|
|
2539
|
+
* `*ngTemplateOutletContext`. Both slots share
|
|
2540
|
+
* `CngxTagGroupSlotContext`, so the same computed source serves
|
|
2541
|
+
* them. Consumer templates `let-count="count"` etc. read the live
|
|
2542
|
+
* state without injecting the directive.
|
|
2162
2543
|
*
|
|
2163
2544
|
* Explicit structural `equal` fn - without it, a fresh literal
|
|
2164
2545
|
* each CD cycle would force `ngTemplateOutlet` to rebind embedded
|
|
@@ -2237,7 +2618,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2237
2618
|
* @module @cngx/common/display
|
|
2238
2619
|
*
|
|
2239
2620
|
* Display-only atoms: no behavior, no state beyond presentational flags.
|
|
2240
|
-
* Icons, avatars, badges, dividers
|
|
2621
|
+
* Icons, avatars, badges, dividers - building blocks that render content
|
|
2241
2622
|
* without reacting to user input. For interactive atoms (ripple, async-click,
|
|
2242
2623
|
* nav badges) see `@cngx/common/interactive`.
|
|
2243
2624
|
*/
|
|
@@ -2246,5 +2627,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2246
2627
|
* Generated bundle index. Do not edit.
|
|
2247
2628
|
*/
|
|
2248
2629
|
|
|
2249
|
-
export { CNGX_TAG_CONFIG, CNGX_TAG_GROUP, CngxAvatar, CngxAvatarGroup, CngxBadge, CngxCheckboxIndicator, CngxChip, CngxDivider, CngxIcon, CngxMeta, CngxMetaList, CngxPasswordStrengthMeter, CngxRadioIndicator, CngxSegmentedProgress, CngxTag, CngxTagGroup, CngxTagGroupAccessory, CngxTagGroupHeader, CngxTagLabel, CngxTagPrefix, CngxTagSuffix, CngxTime, injectTagConfig, provideTagConfig, provideTagConfigAt, withTagColors, withTagDefaults, withTagGroupDefaults, withTagSlots };
|
|
2630
|
+
export { CNGX_DISPLAY_I18N, CNGX_DISPLAY_LANGUAGE_EN, CNGX_TAG_CONFIG, CNGX_TAG_GROUP, CngxAvatar, CngxAvatarGroup, CngxBadge, CngxCheckboxIndicator, CngxChip, CngxDivider, CngxIcon, CngxMeta, CngxMetaList, CngxPasswordStrengthMeter, CngxRadioIndicator, CngxSegmentedProgress, CngxStatus, CngxTag, CngxTagGroup, CngxTagGroupAccessory, CngxTagGroupHeader, CngxTagLabel, CngxTagPrefix, CngxTagSuffix, CngxTime, injectDisplayI18n, injectTagConfig, provideDisplayI18n, provideTagConfig, provideTagConfigAt, withDisplayI18nLabels, withTagColors, withTagDefaults, withTagGroupDefaults, withTagSlots };
|
|
2250
2631
|
//# sourceMappingURL=cngx-common-display.mjs.map
|