@cngx/common 0.1.0-rc.7 → 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/data/README.md +10 -1
- package/dialog/README.md +23 -1
- package/fesm2022/cngx-common-a11y.mjs +125 -111
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +47 -5
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +300 -46
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +1176 -453
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +37 -10
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +1318 -469
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +151 -14
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +340 -73
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +1744 -952
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +841 -114
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +350 -60
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +727 -317
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +1601 -1243
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +137 -53
- package/fesm2022/cngx-common-timeline.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +1 -1
- package/interactive/README.md +15 -4
- package/layout/README.md +21 -1
- package/package.json +3 -3
- package/popover/README.md +18 -2
- package/stepper/README.md +6 -4
- package/theming/components/cngx-accordion.css +1 -1
- package/theming/components/cngx-backdrop.css +12 -0
- package/theming/components/cngx-button-toggle.css +29 -3
- package/theming/components/cngx-data-grid.css +168 -1
- package/theming/components/cngx-dialog.css +13 -0
- package/theming/components/cngx-listbox.css +21 -12
- package/theming/components/cngx-menu.css +56 -16
- package/theming/components/cngx-popover.css +24 -0
- package/theming/components/cngx-recycler-placeholder.css +196 -0
- package/theming/components/cngx-ripple.css +1 -1
- package/theming/components/cngx-slider.css +32 -1
- package/theming/components/cngx-tooltip.css +12 -0
- package/timeline/README.md +155 -0
- package/types/cngx-common-a11y.d.ts +42 -18
- package/types/cngx-common-card.d.ts +201 -17
- package/types/cngx-common-chart.d.ts +343 -47
- package/types/cngx-common-command.d.ts +31 -8
- package/types/cngx-common-data.d.ts +581 -68
- package/types/cngx-common-dialog.d.ts +158 -3
- package/types/cngx-common-display.d.ts +356 -142
- package/types/cngx-common-interactive.d.ts +859 -210
- package/types/cngx-common-layout.d.ts +567 -28
- package/types/cngx-common-popover.d.ts +262 -39
- package/types/cngx-common-stepper.d.ts +366 -116
- package/types/cngx-common-tabs.d.ts +214 -50
- package/types/cngx-common-timeline.d.ts +82 -16
|
@@ -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;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)))}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
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;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)))}}}\n"] }]
|
|
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,10 +559,10 @@ 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
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
|
}
|
|
@@ -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
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"] }]
|
|
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 }] }] } });
|
|
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,7 +887,7 @@ 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
|
|
|
698
893
|
/** Tone glyph rendered inside the decorative dot - the non-colour signal. */
|
|
@@ -784,7 +979,7 @@ class CngxStatus {
|
|
|
784
979
|
@if (label()) {
|
|
785
980
|
<span class="cngx-status__label">{{ label() }}</span>
|
|
786
981
|
}
|
|
787
|
-
`, 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))}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
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 });
|
|
788
983
|
}
|
|
789
984
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStatus, decorators: [{
|
|
790
985
|
type: Component,
|
|
@@ -801,7 +996,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
801
996
|
@if (label()) {
|
|
802
997
|
<span class="cngx-status__label">{{ label() }}</span>
|
|
803
998
|
}
|
|
804
|
-
`, 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))}}}\n"] }]
|
|
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"] }]
|
|
805
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 }] }] } });
|
|
806
1001
|
|
|
807
1002
|
/**
|
|
@@ -970,7 +1165,7 @@ class CngxCheckboxIndicator {
|
|
|
970
1165
|
<ng-container *ngTemplateOutlet="checkGlyph() ?? defaultCheckGlyph" />
|
|
971
1166
|
}
|
|
972
1167
|
}
|
|
973
|
-
`, 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 });
|
|
974
1169
|
}
|
|
975
1170
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCheckboxIndicator, decorators: [{
|
|
976
1171
|
type: Component,
|
|
@@ -1008,7 +1203,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1008
1203
|
<ng-container *ngTemplateOutlet="checkGlyph() ?? defaultCheckGlyph" />
|
|
1009
1204
|
}
|
|
1010
1205
|
}
|
|
1011
|
-
`, 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"] }]
|
|
1012
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 }] }] } });
|
|
1013
1208
|
|
|
1014
1209
|
/**
|
|
@@ -1091,7 +1286,7 @@ class CngxRadioIndicator {
|
|
|
1091
1286
|
<ng-container *ngTemplateOutlet="dotGlyph() ?? defaultDotGlyph" />
|
|
1092
1287
|
}
|
|
1093
1288
|
</span>
|
|
1094
|
-
`, 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 });
|
|
1095
1290
|
}
|
|
1096
1291
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxRadioIndicator, decorators: [{
|
|
1097
1292
|
type: Component,
|
|
@@ -1113,7 +1308,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1113
1308
|
<ng-container *ngTemplateOutlet="dotGlyph() ?? defaultDotGlyph" />
|
|
1114
1309
|
}
|
|
1115
1310
|
</span>
|
|
1116
|
-
`, 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"] }]
|
|
1117
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 }] }] } });
|
|
1118
1313
|
|
|
1119
1314
|
/**
|
|
@@ -1121,6 +1316,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1121
1316
|
* count of that unit in the next-larger one; anything past `months` falls
|
|
1122
1317
|
* through to the `years` return.
|
|
1123
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' }));
|
|
1124
1325
|
const RELATIVE_DIVISIONS = [
|
|
1125
1326
|
{ amount: 60, unit: 'seconds' },
|
|
1126
1327
|
{ amount: 60, unit: 'minutes' },
|
|
@@ -1134,8 +1335,9 @@ const RELATIVE_DIVISIONS = [
|
|
|
1134
1335
|
* `datetime` attribute (ISO 8601) plus a human string in one of two modes:
|
|
1135
1336
|
* `absolute` (via `Intl.DateTimeFormat`) or `relative` (via
|
|
1136
1337
|
* `Intl.RelativeTimeFormat`, e.g. "3 days ago"). Formatting resolves against
|
|
1137
|
-
* the
|
|
1138
|
-
* 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.
|
|
1139
1341
|
*
|
|
1140
1342
|
* Relative mode is render-time, not live-ticking: it recomputes when `[date]`
|
|
1141
1343
|
* changes, not on a timer, so "2 minutes ago" does not self-update. A consumer
|
|
@@ -1155,7 +1357,7 @@ const RELATIVE_DIVISIONS = [
|
|
|
1155
1357
|
* @relatedTo CngxCardTimestamp
|
|
1156
1358
|
*/
|
|
1157
1359
|
class CngxTime {
|
|
1158
|
-
locale =
|
|
1360
|
+
locale = injectLocale();
|
|
1159
1361
|
/** Instant to render. Accepts a `Date`, an ISO string, or an epoch-ms number. */
|
|
1160
1362
|
date = input.required(...(ngDevMode ? [{ debugName: "date" }] : /* istanbul ignore next */ []));
|
|
1161
1363
|
/**
|
|
@@ -1169,29 +1371,55 @@ class CngxTime {
|
|
|
1169
1371
|
* Coerced instant. A `Date`; downstream reads its time value. The `equal` fn
|
|
1170
1372
|
* dedupes by time value so re-binding `[date]` to a fresh `Date` of the same
|
|
1171
1373
|
* instant (or the equivalent ISO string) does not cascade `iso`/`formatted` -
|
|
1172
|
-
* 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.
|
|
1173
1377
|
*/
|
|
1174
1378
|
instant = computed(() => {
|
|
1175
1379
|
const value = this.date();
|
|
1176
1380
|
return value instanceof Date ? value : new Date(value);
|
|
1177
|
-
}, { ...(ngDevMode ? { debugName: "instant" } : /* istanbul ignore next */ {}), equal: (a, b) =>
|
|
1178
|
-
|
|
1179
|
-
|
|
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 */ []));
|
|
1180
1394
|
/**
|
|
1181
1395
|
* Human string. Reads `Date.now()` in `relative` mode as a render-time
|
|
1182
1396
|
* snapshot - untracked by design, so the value recomputes only when `[date]`
|
|
1183
1397
|
* (or `mode`/`format`) changes, never on a timer.
|
|
1184
1398
|
*/
|
|
1185
1399
|
formatted = computed(() => {
|
|
1400
|
+
if (!this.isValidDate()) {
|
|
1401
|
+
return '';
|
|
1402
|
+
}
|
|
1186
1403
|
const instant = this.instant();
|
|
1404
|
+
const locale = this.locale();
|
|
1187
1405
|
if (this.mode() === 'relative') {
|
|
1188
|
-
return this.formatRelative(instant.getTime(), Date.now());
|
|
1406
|
+
return this.formatRelative(instant.getTime(), Date.now(), locale);
|
|
1189
1407
|
}
|
|
1190
1408
|
const format = this.format() ?? { year: 'numeric', month: 'short', day: 'numeric' };
|
|
1191
|
-
return
|
|
1409
|
+
return dateTimeFormatterFor(locale, format).format(instant);
|
|
1192
1410
|
}, ...(ngDevMode ? [{ debugName: "formatted" }] : /* istanbul ignore next */ []));
|
|
1193
|
-
|
|
1194
|
-
|
|
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);
|
|
1195
1423
|
let delta = (target - now) / 1000;
|
|
1196
1424
|
for (const division of RELATIVE_DIVISIONS) {
|
|
1197
1425
|
if (Math.abs(delta) < division.amount) {
|
|
@@ -1209,7 +1437,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1209
1437
|
args: [{ selector: 'cngx-time', exportAs: 'cngxTime', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
1210
1438
|
class: 'cngx-time',
|
|
1211
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"] }]
|
|
1212
|
-
}], 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 }] }] } });
|
|
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 }] }] } });
|
|
1213
1441
|
|
|
1214
1442
|
const SEGMENT_COUNT = 4;
|
|
1215
1443
|
const STRENGTH_LEVELS = ['none', 'weak', 'fair', 'good', 'strong'];
|
|
@@ -1257,7 +1485,7 @@ class CngxPasswordStrengthMeter {
|
|
|
1257
1485
|
aria-hidden="true"
|
|
1258
1486
|
></span>
|
|
1259
1487
|
}
|
|
1260
|
-
`, 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 });
|
|
1261
1489
|
}
|
|
1262
1490
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxPasswordStrengthMeter, decorators: [{
|
|
1263
1491
|
type: Component,
|
|
@@ -1273,7 +1501,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1273
1501
|
aria-hidden="true"
|
|
1274
1502
|
></span>
|
|
1275
1503
|
}
|
|
1276
|
-
`, 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"] }]
|
|
1277
1505
|
}], propDecorators: { score: [{ type: i0.Input, args: [{ isSignal: true, alias: "score", required: true }] }] } });
|
|
1278
1506
|
|
|
1279
1507
|
/**
|
|
@@ -1568,6 +1796,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1568
1796
|
}]
|
|
1569
1797
|
}] });
|
|
1570
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
|
+
]);
|
|
1571
1811
|
/**
|
|
1572
1812
|
* Decorative tag / label / badge atom.
|
|
1573
1813
|
*
|
|
@@ -1650,6 +1890,28 @@ class CngxTag {
|
|
|
1650
1890
|
color = input(this.cfg.defaults?.color ?? 'neutral', ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
1651
1891
|
/** Density. `md` (default) | `sm` | `lg` | `xl`. */
|
|
1652
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 */ []));
|
|
1653
1915
|
/**
|
|
1654
1916
|
* When `true`, applies `text-overflow: ellipsis` + `white-space: nowrap`
|
|
1655
1917
|
* to the inner `.cngx-tag__label` span. Pair with `[maxWidth]` for a
|
|
@@ -1702,10 +1964,9 @@ class CngxTag {
|
|
|
1702
1964
|
suffixTpl = injectResolvedTagTemplate(this.suffixSlot, 'suffix');
|
|
1703
1965
|
/**
|
|
1704
1966
|
* Reactive bundle exposed to every slot's `*ngTemplateOutletContext`.
|
|
1705
|
-
*
|
|
1706
|
-
*
|
|
1707
|
-
*
|
|
1708
|
-
* 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.
|
|
1709
1970
|
*
|
|
1710
1971
|
* Explicit structural `equal` fn - without it, a fresh literal each
|
|
1711
1972
|
* CD cycle would force `ngTemplateOutlet` to rebind embedded views
|
|
@@ -1735,7 +1996,7 @@ class CngxTag {
|
|
|
1735
1996
|
*/
|
|
1736
1997
|
roleAttr = computed(() => this.group?.semanticList() ? 'listitem' : null, ...(ngDevMode ? [{ debugName: "roleAttr" }] : /* istanbul ignore next */ []));
|
|
1737
1998
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxTag, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1738
|
-
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: `
|
|
1739
2000
|
@if (prefixTpl(); as t) {
|
|
1740
2001
|
<ng-container *ngTemplateOutlet="t; context: slotContext()" />
|
|
1741
2002
|
}
|
|
@@ -1774,6 +2035,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1774
2035
|
'[class.cngx-tag--xl]': "size() === 'xl'",
|
|
1775
2036
|
'[class.cngx-tag--truncate]': 'truncate()',
|
|
1776
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()',
|
|
1777
2041
|
'[style.max-width]': 'maxWidth()',
|
|
1778
2042
|
'[attr.role]': 'roleAttr()',
|
|
1779
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"] }]
|
|
@@ -1954,16 +2218,19 @@ function withTagGroupDefaults(payload) {
|
|
|
1954
2218
|
return { kind: 'groupDefaults', payload };
|
|
1955
2219
|
}
|
|
1956
2220
|
/**
|
|
1957
|
-
* Register consumer-defined colour entries.
|
|
1958
|
-
*
|
|
1959
|
-
* `--cngx-tag-bg
|
|
1960
|
-
*
|
|
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.
|
|
1961
2227
|
*
|
|
1962
2228
|
* The five predefined keys (`neutral`/`success`/`warning`/`error`/
|
|
1963
2229
|
* `info`) ship in `tag.css` and are NOT part of this map; passing
|
|
1964
|
-
* them here is a no-op against the predefined cascade.
|
|
1965
|
-
* keys
|
|
1966
|
-
*
|
|
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.
|
|
1967
2234
|
*
|
|
1968
2235
|
* ```ts
|
|
1969
2236
|
* provideTagConfig(
|
|
@@ -2269,10 +2536,10 @@ class CngxTagGroup {
|
|
|
2269
2536
|
projectedTags = contentChildren(CngxTag, ...(ngDevMode ? [{ debugName: "projectedTags" }] : /* istanbul ignore next */ []));
|
|
2270
2537
|
/**
|
|
2271
2538
|
* Reactive bundle exposed to header / accessory slots'
|
|
2272
|
-
* `*ngTemplateOutletContext`.
|
|
2273
|
-
*
|
|
2274
|
-
*
|
|
2275
|
-
*
|
|
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.
|
|
2276
2543
|
*
|
|
2277
2544
|
* Explicit structural `equal` fn - without it, a fresh literal
|
|
2278
2545
|
* each CD cycle would force `ngTemplateOutlet` to rebind embedded
|
|
@@ -2360,5 +2627,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2360
2627
|
* Generated bundle index. Do not edit.
|
|
2361
2628
|
*/
|
|
2362
2629
|
|
|
2363
|
-
export { 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, 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 };
|
|
2364
2631
|
//# sourceMappingURL=cngx-common-display.mjs.map
|