@cngx/common 0.1.0-rc.5 → 0.1.0-rc.7
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/chart/README.md +85 -0
- package/command/README.md +157 -0
- package/data/README.md +23 -0
- package/fesm2022/cngx-common-a11y.mjs +247 -85
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +37 -37
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +13 -9
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +3404 -1392
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +144 -0
- package/fesm2022/cngx-common-command.mjs.map +1 -0
- package/fesm2022/cngx-common-data.mjs +304 -213
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +369 -100
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +144 -30
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +1089 -459
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +113 -61
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +430 -54
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +107 -49
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +1170 -752
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +1086 -0
- package/fesm2022/cngx-common-timeline.mjs.map +1 -0
- package/fesm2022/cngx-common.mjs +2 -2
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/package.json +11 -1
- package/stepper/README.md +1 -1
- package/theming/components/cngx-accordion.css +20 -6
- package/theming/components/cngx-badge.css +22 -0
- package/theming/components/cngx-bottom-sheet.css +14 -2
- package/theming/components/cngx-breadcrumb.css +9 -1
- package/theming/components/cngx-button-toggle.css +44 -2
- package/theming/components/cngx-data-grid.css +69 -4
- package/theming/components/cngx-dialog.css +12 -0
- package/theming/components/cngx-divider.css +12 -0
- package/theming/components/cngx-listbox.css +27 -0
- package/theming/components/cngx-menu.css +36 -0
- package/theming/components/cngx-ripple.css +1 -1
- package/theming/components/cngx-slider.css +1 -1
- package/theming/components/cngx-tooltip.css +11 -0
- package/types/cngx-common-a11y.d.ts +63 -17
- package/types/cngx-common-audio.d.ts +32 -32
- package/types/cngx-common-card.d.ts +10 -3
- package/types/cngx-common-chart.d.ts +1281 -141
- package/types/cngx-common-command.d.ts +167 -0
- package/types/cngx-common-data.d.ts +264 -98
- package/types/cngx-common-dialog.d.ts +214 -25
- package/types/cngx-common-display.d.ts +83 -13
- package/types/cngx-common-interactive.d.ts +708 -174
- package/types/cngx-common-layout.d.ts +48 -1
- package/types/cngx-common-popover.d.ts +120 -3
- package/types/cngx-common-stepper.d.ts +55 -5
- package/types/cngx-common-tabs.d.ts +386 -25
- package/types/cngx-common-timeline.d.ts +1059 -0
- package/types/cngx-common.d.ts +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, DestroyRef, input, signal, computed, Directive, TemplateRef, isDevMode, contentChild, output, ViewEncapsulation, ChangeDetectionStrategy, Component, Injectable, InjectionToken, effect, afterNextRender, model, booleanAttribute, linkedSignal, contentChildren, viewChild,
|
|
2
|
+
import { inject, ElementRef, DestroyRef, input, signal, computed, Directive, TemplateRef, isDevMode, contentChild, output, ViewEncapsulation, ChangeDetectionStrategy, Component, Injectable, InjectionToken, effect, afterNextRender, Renderer2, untracked, model, booleanAttribute, linkedSignal, contentChildren, viewChild, makeEnvironmentProviders, SkipSelf, Optional, PLATFORM_ID, provideEnvironmentInitializer } from '@angular/core';
|
|
3
3
|
import { buildAsyncStateView, nextUid, CNGX_SELECTION_CONTROLLER_FACTORY, CNGX_STATEFUL, matchesKeyCombo, parseKeyCombo } from '@cngx/core/utils';
|
|
4
4
|
import { isObservable, firstValueFrom, timer, take, fromEvent, filter, switchMap, merge, tap, takeUntil, map } from 'rxjs';
|
|
5
5
|
import { DOCUMENT, NgTemplateOutlet, NgComponentOutlet, isPlatformBrowser } from '@angular/common';
|
|
6
6
|
import { decimalPlaces, arrayEqual, setEqual, flattenTree, isNodeVisible, collectDescendantValues } from '@cngx/utils';
|
|
7
|
+
import { resolveInlineStep, injectDirection, resolveInlineArrowKey } from '@cngx/core';
|
|
7
8
|
import { CNGX_FORM_FIELD_HOST, CNGX_FORM_FIELD_CONTROL } from '@cngx/core/tokens';
|
|
8
9
|
import * as i1 from '@cngx/common/a11y';
|
|
9
|
-
import { CngxRovingTabindex, CngxRovingItem, CngxActiveDescendant, CNGX_AD_ITEM } from '@cngx/common/a11y';
|
|
10
|
+
import { CngxRovingTabindex, CngxRovingItem, CngxActiveDescendant, CNGX_AD_ITEM, CngxLiveAnnouncer } from '@cngx/common/a11y';
|
|
10
11
|
import { CngxCheckboxIndicator, CngxRadioIndicator } from '@cngx/common/display';
|
|
11
12
|
import { takeUntilDestroyed, toObservable, outputFromObservable, outputToObservable } from '@angular/core/rxjs-interop';
|
|
12
13
|
import { Router, NavigationStart } from '@angular/router';
|
|
@@ -332,6 +333,9 @@ function reflectAsyncDisplayStatus(state) {
|
|
|
332
333
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/interactive/async-status/async-status.directive.ts
|
|
333
334
|
* @since 0.1.0
|
|
334
335
|
* @relatedTo CngxAsyncClick, CngxPending, CngxSucceeded, CngxFailed
|
|
336
|
+
* @slot cngxPending Rendered while the tracked operation is in flight.
|
|
337
|
+
* @slot cngxSucceeded Rendered after the operation resolves successfully.
|
|
338
|
+
* @slot cngxFailed Rendered when the operation rejects; gets the error.
|
|
335
339
|
*/
|
|
336
340
|
class CngxAsyncStatus {
|
|
337
341
|
coPlacedAsyncClick = inject(CngxAsyncClick, { self: true, optional: true });
|
|
@@ -568,7 +572,7 @@ class CngxCopyBlock {
|
|
|
568
572
|
{{ cp.copied() ? srAnnouncement() : '' }}
|
|
569
573
|
</span>
|
|
570
574
|
</button>
|
|
571
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-copy-block-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-copy-block-btn-border{syntax: \"*\"; inherits: false; initial-value: currentColor;}@property --cngx-copy-block-btn-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-copy-block-btn-color{syntax: \"*\"; inherits: false; initial-value: currentColor;}@property --cngx-copy-block-btn-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-copy-block-btn-padding{syntax: \"*\"; inherits: true; initial-value: 4px 8px;}@property --cngx-copy-block-btn-font-size{syntax: \"*\"; inherits: false; initial-value: .75rem;}@property --cngx-copy-block-btn-copied-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.96 .025 145);}@property --cngx-copy-block-btn-copied-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .12 145);}@property --cngx-copy-block-btn-copied-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .12 145);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-copy-block-btn-copied-bg: oklch(.32 .06 145);--cngx-copy-block-btn-copied-color: oklch(.85 .13 145)}}[data-color-scheme=dark],.dark{--cngx-copy-block-btn-copied-bg: oklch(.32 .06 145);--cngx-copy-block-btn-copied-color: oklch(.85 .13 145)}[data-color-scheme=light],.light{--cngx-copy-block-btn-copied-bg: oklch(.96 .025 145);--cngx-copy-block-btn-copied-color: oklch(.5 .12 145)}}@layer cngx.components{@scope(.cngx-copy-block){:scope{--cngx-copy-block-gap: var(--cngx-space-sm);--cngx-copy-block-btn-padding: var(--cngx-space-xs) var(--cngx-space-sm);display:flex;align-items:flex-start;gap:var(--cngx-copy-block-gap, var(--cngx-space-sm, 8px))}.cngx-copy-block__content{flex:1;min-width:0;overflow:hidden}.cngx-copy-block__button{flex-shrink:0;cursor:pointer;border:1px solid var(--cngx-copy-block-btn-border, currentColor);background:var(--cngx-copy-block-btn-bg, transparent);color:var(--cngx-copy-block-btn-color, inherit);border-radius:var(--cngx-copy-block-btn-radius, var(--cngx-radius-sm, 4px));padding:var(--cngx-copy-block-btn-padding, 4px 8px);font-size:var(--cngx-copy-block-btn-font-size, var(--cngx-font-size-sm, .75rem));transition:background .15s,border-color .15s}.cngx-copy-block__button--copied{background:var(--cngx-copy-block-btn-copied-bg, oklch(.96 .025 145));border-color:var( --cngx-copy-block-btn-copied-border, var(--cngx-color-success, oklch(.5 .12 145)) );color:var( --cngx-copy-block-btn-copied-color, var(--cngx-color-success, oklch(.5 .12 145)) )}.cngx-sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}}}\n"], dependencies: [{ kind: "directive", type: CngxCopyText, selector: "[cngxCopyText]", inputs: ["cngxCopyText", "resetDelay"], outputs: ["didCopy", "copyFailed"], exportAs: ["cngxCopyText"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
575
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-copy-block-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-copy-block-btn-border{syntax: \"*\"; inherits: false; initial-value: currentColor;}@property --cngx-copy-block-btn-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-copy-block-btn-color{syntax: \"*\"; inherits: false; initial-value: currentColor;}@property --cngx-copy-block-btn-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-copy-block-btn-padding{syntax: \"*\"; inherits: true; initial-value: 4px 8px;}@property --cngx-copy-block-btn-font-size{syntax: \"*\"; inherits: false; initial-value: .75rem;}@property --cngx-copy-block-btn-copied-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.96 .025 145);}@property --cngx-copy-block-btn-copied-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .12 145);}@property --cngx-copy-block-btn-copied-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .12 145);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-copy-block-btn-copied-bg: oklch(.32 .06 145);--cngx-copy-block-btn-copied-color: oklch(.85 .13 145)}}[data-color-scheme=dark],.dark{--cngx-copy-block-btn-copied-bg: oklch(.32 .06 145);--cngx-copy-block-btn-copied-color: oklch(.85 .13 145)}[data-color-scheme=light],.light{--cngx-copy-block-btn-copied-bg: oklch(.96 .025 145);--cngx-copy-block-btn-copied-color: oklch(.5 .12 145)}}@layer cngx.components{@scope(.cngx-copy-block){:scope{--cngx-copy-block-gap: var(--cngx-space-sm);--cngx-copy-block-btn-padding: var(--cngx-space-xs) var(--cngx-space-sm);display:flex;align-items:flex-start;gap:var(--cngx-copy-block-gap, var(--cngx-space-sm, 8px))}.cngx-copy-block__content{flex:1;min-width:0;overflow:hidden;unicode-bidi:var(--cngx-copy-block-bidi, isolate)}.cngx-copy-block__button{flex-shrink:0;min-inline-size:var(--cngx-target-min, 0px);min-block-size:var(--cngx-target-min, 0px);cursor:pointer;border:1px solid var(--cngx-copy-block-btn-border, currentColor);background:var(--cngx-copy-block-btn-bg, transparent);color:var(--cngx-copy-block-btn-color, inherit);border-radius:var(--cngx-copy-block-btn-radius, var(--cngx-radius-sm, 4px));padding:var(--cngx-copy-block-btn-padding, 4px 8px);font-size:var(--cngx-copy-block-btn-font-size, var(--cngx-font-size-sm, .75rem));transition:background .15s,border-color .15s}.cngx-copy-block__button--copied{background:var(--cngx-copy-block-btn-copied-bg, oklch(.96 .025 145));border-color:var( --cngx-copy-block-btn-copied-border, var(--cngx-color-success, oklch(.5 .12 145)) );color:var( --cngx-copy-block-btn-copied-color, var(--cngx-color-success, oklch(.5 .12 145)) )}.cngx-sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}}}\n"], dependencies: [{ kind: "directive", type: CngxCopyText, selector: "[cngxCopyText]", inputs: ["cngxCopyText", "resetDelay"], outputs: ["didCopy", "copyFailed"], exportAs: ["cngxCopyText"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
572
576
|
}
|
|
573
577
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCopyBlock, decorators: [{
|
|
574
578
|
type: Component,
|
|
@@ -590,7 +594,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
590
594
|
{{ cp.copied() ? srAnnouncement() : '' }}
|
|
591
595
|
</span>
|
|
592
596
|
</button>
|
|
593
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-copy-block-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-copy-block-btn-border{syntax: \"*\"; inherits: false; initial-value: currentColor;}@property --cngx-copy-block-btn-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-copy-block-btn-color{syntax: \"*\"; inherits: false; initial-value: currentColor;}@property --cngx-copy-block-btn-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-copy-block-btn-padding{syntax: \"*\"; inherits: true; initial-value: 4px 8px;}@property --cngx-copy-block-btn-font-size{syntax: \"*\"; inherits: false; initial-value: .75rem;}@property --cngx-copy-block-btn-copied-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.96 .025 145);}@property --cngx-copy-block-btn-copied-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .12 145);}@property --cngx-copy-block-btn-copied-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .12 145);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-copy-block-btn-copied-bg: oklch(.32 .06 145);--cngx-copy-block-btn-copied-color: oklch(.85 .13 145)}}[data-color-scheme=dark],.dark{--cngx-copy-block-btn-copied-bg: oklch(.32 .06 145);--cngx-copy-block-btn-copied-color: oklch(.85 .13 145)}[data-color-scheme=light],.light{--cngx-copy-block-btn-copied-bg: oklch(.96 .025 145);--cngx-copy-block-btn-copied-color: oklch(.5 .12 145)}}@layer cngx.components{@scope(.cngx-copy-block){:scope{--cngx-copy-block-gap: var(--cngx-space-sm);--cngx-copy-block-btn-padding: var(--cngx-space-xs) var(--cngx-space-sm);display:flex;align-items:flex-start;gap:var(--cngx-copy-block-gap, var(--cngx-space-sm, 8px))}.cngx-copy-block__content{flex:1;min-width:0;overflow:hidden}.cngx-copy-block__button{flex-shrink:0;cursor:pointer;border:1px solid var(--cngx-copy-block-btn-border, currentColor);background:var(--cngx-copy-block-btn-bg, transparent);color:var(--cngx-copy-block-btn-color, inherit);border-radius:var(--cngx-copy-block-btn-radius, var(--cngx-radius-sm, 4px));padding:var(--cngx-copy-block-btn-padding, 4px 8px);font-size:var(--cngx-copy-block-btn-font-size, var(--cngx-font-size-sm, .75rem));transition:background .15s,border-color .15s}.cngx-copy-block__button--copied{background:var(--cngx-copy-block-btn-copied-bg, oklch(.96 .025 145));border-color:var( --cngx-copy-block-btn-copied-border, var(--cngx-color-success, oklch(.5 .12 145)) );color:var( --cngx-copy-block-btn-copied-color, var(--cngx-color-success, oklch(.5 .12 145)) )}.cngx-sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}}}\n"] }]
|
|
597
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-copy-block-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-copy-block-btn-border{syntax: \"*\"; inherits: false; initial-value: currentColor;}@property --cngx-copy-block-btn-bg{syntax: \"<color>\"; inherits: false; initial-value: transparent;}@property --cngx-copy-block-btn-color{syntax: \"*\"; inherits: false; initial-value: currentColor;}@property --cngx-copy-block-btn-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-copy-block-btn-padding{syntax: \"*\"; inherits: true; initial-value: 4px 8px;}@property --cngx-copy-block-btn-font-size{syntax: \"*\"; inherits: false; initial-value: .75rem;}@property --cngx-copy-block-btn-copied-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(.96 .025 145);}@property --cngx-copy-block-btn-copied-border{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .12 145);}@property --cngx-copy-block-btn-copied-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .12 145);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-copy-block-btn-copied-bg: oklch(.32 .06 145);--cngx-copy-block-btn-copied-color: oklch(.85 .13 145)}}[data-color-scheme=dark],.dark{--cngx-copy-block-btn-copied-bg: oklch(.32 .06 145);--cngx-copy-block-btn-copied-color: oklch(.85 .13 145)}[data-color-scheme=light],.light{--cngx-copy-block-btn-copied-bg: oklch(.96 .025 145);--cngx-copy-block-btn-copied-color: oklch(.5 .12 145)}}@layer cngx.components{@scope(.cngx-copy-block){:scope{--cngx-copy-block-gap: var(--cngx-space-sm);--cngx-copy-block-btn-padding: var(--cngx-space-xs) var(--cngx-space-sm);display:flex;align-items:flex-start;gap:var(--cngx-copy-block-gap, var(--cngx-space-sm, 8px))}.cngx-copy-block__content{flex:1;min-width:0;overflow:hidden;unicode-bidi:var(--cngx-copy-block-bidi, isolate)}.cngx-copy-block__button{flex-shrink:0;min-inline-size:var(--cngx-target-min, 0px);min-block-size:var(--cngx-target-min, 0px);cursor:pointer;border:1px solid var(--cngx-copy-block-btn-border, currentColor);background:var(--cngx-copy-block-btn-bg, transparent);color:var(--cngx-copy-block-btn-color, inherit);border-radius:var(--cngx-copy-block-btn-radius, var(--cngx-radius-sm, 4px));padding:var(--cngx-copy-block-btn-padding, 4px 8px);font-size:var(--cngx-copy-block-btn-font-size, var(--cngx-font-size-sm, .75rem));transition:background .15s,border-color .15s}.cngx-copy-block__button--copied{background:var(--cngx-copy-block-btn-copied-bg, oklch(.96 .025 145));border-color:var( --cngx-copy-block-btn-copied-border, var(--cngx-color-success, oklch(.5 .12 145)) );color:var( --cngx-copy-block-btn-copied-color, var(--cngx-color-success, oklch(.5 .12 145)) )}.cngx-sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}}}\n"] }]
|
|
594
598
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], buttonLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonLabel", required: false }] }], copiedLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "copiedLabel", required: false }] }], srAnnouncement: [{ type: i0.Input, args: [{ isSignal: true, alias: "srAnnouncement", required: false }] }] } });
|
|
595
599
|
|
|
596
600
|
/**
|
|
@@ -1558,9 +1562,24 @@ class CngxHoverIntent {
|
|
|
1558
1562
|
inject(DestroyRef).onDestroy(() => this.clearPending());
|
|
1559
1563
|
}
|
|
1560
1564
|
handleEnter() {
|
|
1561
|
-
this.
|
|
1565
|
+
this.notifyEnter();
|
|
1562
1566
|
}
|
|
1563
1567
|
handleLeave() {
|
|
1568
|
+
this.notifyLeave();
|
|
1569
|
+
}
|
|
1570
|
+
/**
|
|
1571
|
+
* Feed a satellite element's `pointerenter` into the debounce. For hosts
|
|
1572
|
+
* whose hover surface spans more than the directive's own element (a submenu
|
|
1573
|
+
* parent item plus its popover panel), forward the extra element's pointer
|
|
1574
|
+
* events here so ONE debounced intent covers the combined surface: an enter
|
|
1575
|
+
* on either element cancels a pending leave timer exactly like the host's
|
|
1576
|
+
* own listeners, so crossing the gap between the elements never flickers.
|
|
1577
|
+
*/
|
|
1578
|
+
notifyEnter() {
|
|
1579
|
+
this.schedule(true, this.enterDelay());
|
|
1580
|
+
}
|
|
1581
|
+
/** Satellite counterpart to {@link notifyEnter} for `pointerleave`. */
|
|
1582
|
+
notifyLeave() {
|
|
1564
1583
|
this.schedule(false, this.leaveDelay());
|
|
1565
1584
|
}
|
|
1566
1585
|
schedule(target, delay) {
|
|
@@ -1692,6 +1711,72 @@ function createSliderCore(options) {
|
|
|
1692
1711
|
};
|
|
1693
1712
|
}
|
|
1694
1713
|
|
|
1714
|
+
/**
|
|
1715
|
+
* Internal disabled-"why" mechanism shared by `CngxSliderTrack` and
|
|
1716
|
+
* `CngxRangeSliderTrack`. Appends an sr-only description span to the host
|
|
1717
|
+
* via `Renderer2` (the tracks are headless directives on consumer markup,
|
|
1718
|
+
* so there is no template to project into - same constraint and same shape
|
|
1719
|
+
* as `CngxChipInteraction`). Always-in-DOM per Pillar 2; both the span's
|
|
1720
|
+
* `aria-hidden` and the emitted id reference are gated on
|
|
1721
|
+
* `disabled() && reason()` (Toggle/Radio convergence): accname 1.2 §2A
|
|
1722
|
+
* traverses a directly referenced hidden node, so the id must only be
|
|
1723
|
+
* emitted while the description applies.
|
|
1724
|
+
*
|
|
1725
|
+
* Must run in an injection context (field initializer / constructor).
|
|
1726
|
+
* Not exported from `public-api.ts` - decompose glue, not a consumer
|
|
1727
|
+
* contract.
|
|
1728
|
+
*
|
|
1729
|
+
* @category common/interactive/slider
|
|
1730
|
+
*/
|
|
1731
|
+
function createSliderDisabledReason(opts) {
|
|
1732
|
+
const hostEl = inject(ElementRef).nativeElement;
|
|
1733
|
+
const renderer = inject(Renderer2);
|
|
1734
|
+
const describedId = nextUid(opts.idPrefix);
|
|
1735
|
+
const span = renderer.createElement('span');
|
|
1736
|
+
renderer.setAttribute(span, 'id', describedId);
|
|
1737
|
+
renderer.setAttribute(span, 'aria-hidden', 'true');
|
|
1738
|
+
// sr-only via inline styles - the directive runs in arbitrary markup, so it
|
|
1739
|
+
// cannot require a consumer stylesheet. Every value reads `--cngx-sr-only-*`
|
|
1740
|
+
// first so consumers can still override (structural/thematic split).
|
|
1741
|
+
renderer.setStyle(span, 'position', 'var(--cngx-sr-only-position, absolute)');
|
|
1742
|
+
renderer.setStyle(span, 'width', 'var(--cngx-sr-only-size, 1px)');
|
|
1743
|
+
renderer.setStyle(span, 'height', 'var(--cngx-sr-only-size, 1px)');
|
|
1744
|
+
renderer.setStyle(span, 'overflow', 'var(--cngx-sr-only-overflow, hidden)');
|
|
1745
|
+
renderer.setStyle(span, 'clip', 'var(--cngx-sr-only-clip, rect(0, 0, 0, 0))');
|
|
1746
|
+
renderer.setStyle(span, 'white-space', 'var(--cngx-sr-only-white-space, nowrap)');
|
|
1747
|
+
renderer.appendChild(hostEl, span);
|
|
1748
|
+
// Host may outlive the directive (structural re-projection) - without
|
|
1749
|
+
// explicit removal the span leaks and the next instance collides on id.
|
|
1750
|
+
inject(DestroyRef).onDestroy(() => {
|
|
1751
|
+
// Host may already be detached by a parent structural directive at the
|
|
1752
|
+
// same destroy tick; removeChild on a stale parent throws.
|
|
1753
|
+
if (span.parentNode === hostEl) {
|
|
1754
|
+
renderer.removeChild(hostEl, span);
|
|
1755
|
+
}
|
|
1756
|
+
});
|
|
1757
|
+
effect(() => {
|
|
1758
|
+
const reason = opts.disabled() && opts.reason() ? opts.reason() : '';
|
|
1759
|
+
untracked(() => {
|
|
1760
|
+
if (reason) {
|
|
1761
|
+
renderer.removeAttribute(span, 'aria-hidden');
|
|
1762
|
+
span.textContent = reason;
|
|
1763
|
+
}
|
|
1764
|
+
else {
|
|
1765
|
+
renderer.setAttribute(span, 'aria-hidden', 'true');
|
|
1766
|
+
span.textContent = '';
|
|
1767
|
+
}
|
|
1768
|
+
});
|
|
1769
|
+
});
|
|
1770
|
+
return {
|
|
1771
|
+
resolvedDescribedBy: computed(() => {
|
|
1772
|
+
if (opts.disabled() && opts.reason()) {
|
|
1773
|
+
return describedId;
|
|
1774
|
+
}
|
|
1775
|
+
return opts.describedBy();
|
|
1776
|
+
}),
|
|
1777
|
+
};
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1695
1780
|
/**
|
|
1696
1781
|
* Maps a pointer position to a `0..1` track fraction against `el`'s geometry.
|
|
1697
1782
|
* Vertical sliders measure bottom-up (fraction 0 at the lower edge) to match the
|
|
@@ -1739,14 +1824,22 @@ function createSliderInteraction(options) {
|
|
|
1739
1824
|
}
|
|
1740
1825
|
const big = options.pageStep();
|
|
1741
1826
|
switch (event.key) {
|
|
1742
|
-
case 'ArrowRight':
|
|
1743
1827
|
case 'ArrowUp':
|
|
1744
1828
|
core.stepBy(1);
|
|
1745
1829
|
break;
|
|
1746
|
-
case 'ArrowLeft':
|
|
1747
1830
|
case 'ArrowDown':
|
|
1748
1831
|
core.stepBy(-1);
|
|
1749
1832
|
break;
|
|
1833
|
+
case 'ArrowRight':
|
|
1834
|
+
case 'ArrowLeft': {
|
|
1835
|
+
// Inline axis: increase/decrease meaning flips under rtl.
|
|
1836
|
+
const step = resolveInlineStep(event.key, options.direction());
|
|
1837
|
+
if (step === null) {
|
|
1838
|
+
return;
|
|
1839
|
+
}
|
|
1840
|
+
core.stepBy(step);
|
|
1841
|
+
break;
|
|
1842
|
+
}
|
|
1750
1843
|
case 'PageUp':
|
|
1751
1844
|
core.setValue(core.clampedValue() + big);
|
|
1752
1845
|
break;
|
|
@@ -1848,13 +1941,38 @@ class CngxSliderTrack {
|
|
|
1848
1941
|
* larger of one step and a tenth of the range.
|
|
1849
1942
|
*/
|
|
1850
1943
|
largeStep = input(undefined, ...(ngDevMode ? [{ debugName: "largeStep" }] : /* istanbul ignore next */ []));
|
|
1851
|
-
/**
|
|
1852
|
-
|
|
1944
|
+
/**
|
|
1945
|
+
* Whether the slider is disabled (blocks keyboard and pointer, `tabindex=-1`).
|
|
1946
|
+
* A `ModelSignal` so form-field bridges can drive it programmatically,
|
|
1947
|
+
* mirroring the checkbox/toggle family's bridge write path.
|
|
1948
|
+
*/
|
|
1949
|
+
disabled = model(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1950
|
+
/**
|
|
1951
|
+
* Consumer-supplied "why" for the disabled state (no library default per
|
|
1952
|
+
* the EN-defaults rule). Announced via an sr-only span the directive
|
|
1953
|
+
* appends to the host; both the span's visibility and the host's
|
|
1954
|
+
* `aria-describedby` reference are gated on `disabled() &&
|
|
1955
|
+
* disabledReason()` (Toggle/Radio convergence).
|
|
1956
|
+
*/
|
|
1957
|
+
disabledReason = input('', ...(ngDevMode ? [{ debugName: "disabledReason" }] : /* istanbul ignore next */ []));
|
|
1958
|
+
/**
|
|
1959
|
+
* Optional consumer-supplied id of an external description element.
|
|
1960
|
+
* Consumers bind via `[cngxDescribedBy]="someId"` - same surface as
|
|
1961
|
+
* `CngxChipInteraction`. The active disabled-reason wins.
|
|
1962
|
+
*/
|
|
1963
|
+
describedBy = input(null, { ...(ngDevMode ? { debugName: "describedBy" } : /* istanbul ignore next */ {}), alias: 'cngxDescribedBy' });
|
|
1853
1964
|
/** Track axis. Drives `aria-orientation` and the pointer-to-fraction math. */
|
|
1854
1965
|
orientation = input('horizontal', ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
1855
1966
|
/** Optional `aria-valuetext` formatter (currency, dates, named stops). */
|
|
1856
1967
|
valueText = input(undefined, ...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
|
|
1857
1968
|
el = inject((ElementRef)).nativeElement;
|
|
1969
|
+
/** Disabled-"why" span + gated `aria-describedby` resolution. */
|
|
1970
|
+
reason = createSliderDisabledReason({
|
|
1971
|
+
idPrefix: 'cngx-slider-desc',
|
|
1972
|
+
disabled: () => this.disabled(),
|
|
1973
|
+
reason: () => this.disabledReason(),
|
|
1974
|
+
describedBy: () => this.describedBy(),
|
|
1975
|
+
});
|
|
1858
1976
|
/** Shared value/step/aria derivation. */
|
|
1859
1977
|
core = createSliderCore({
|
|
1860
1978
|
value: this.value,
|
|
@@ -1887,9 +2005,10 @@ class CngxSliderTrack {
|
|
|
1887
2005
|
disabled: () => this.disabled(),
|
|
1888
2006
|
pageStep: () => this.pageStep(),
|
|
1889
2007
|
fractionFromPointer: (x, y) => pointerFraction(this.el, this.orientation(), x, y),
|
|
2008
|
+
direction: injectDirection(),
|
|
1890
2009
|
});
|
|
1891
2010
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSliderTrack, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1892
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxSliderTrack, isStandalone: true, selector: "[cngxSliderTrack]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, largeStep: { classPropertyName: "largeStep", publicName: "largeStep", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, valueText: { classPropertyName: "valueText", publicName: "valueText", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "slider" }, listeners: { "keydown": "interaction.handleKeydown($event)", "pointerdown": "interaction.handlePointerDown($event)", "pointermove": "interaction.handlePointerMove($event)", "pointerup": "interaction.handlePointerUp($event)", "pointercancel": "interaction.handlePointerUp($event)" }, properties: { "attr.aria-valuemin": "min()", "attr.aria-valuemax": "max()", "attr.aria-valuenow": "core.clampedValue()", "attr.aria-valuetext": "core.ariaValueText()", "attr.aria-orientation": "orientation()", "attr.aria-disabled": "disabled() || null", "attr.tabindex": "disabled() ? -1 : 0", "style.touch-action": "'none'", "style.--cngx-slider-fraction": "core.fraction()" } }, exportAs: ["cngxSliderTrack"], ngImport: i0 });
|
|
2011
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxSliderTrack, isStandalone: true, selector: "[cngxSliderTrack]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, largeStep: { classPropertyName: "largeStep", publicName: "largeStep", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, disabledReason: { classPropertyName: "disabledReason", publicName: "disabledReason", isSignal: true, isRequired: false, transformFunction: null }, describedBy: { classPropertyName: "describedBy", publicName: "cngxDescribedBy", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, valueText: { classPropertyName: "valueText", publicName: "valueText", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", disabled: "disabledChange" }, host: { attributes: { "role": "slider" }, listeners: { "keydown": "interaction.handleKeydown($event)", "pointerdown": "interaction.handlePointerDown($event)", "pointermove": "interaction.handlePointerMove($event)", "pointerup": "interaction.handlePointerUp($event)", "pointercancel": "interaction.handlePointerUp($event)" }, properties: { "attr.aria-valuemin": "min()", "attr.aria-valuemax": "max()", "attr.aria-valuenow": "core.clampedValue()", "attr.aria-valuetext": "core.ariaValueText()", "attr.aria-orientation": "orientation()", "attr.aria-disabled": "disabled() || null", "attr.aria-describedby": "reason.resolvedDescribedBy()", "attr.tabindex": "disabled() ? -1 : 0", "style.touch-action": "'none'", "style.--cngx-slider-fraction": "core.fraction()" } }, exportAs: ["cngxSliderTrack"], ngImport: i0 });
|
|
1893
2012
|
}
|
|
1894
2013
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSliderTrack, decorators: [{
|
|
1895
2014
|
type: Directive,
|
|
@@ -1905,6 +2024,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1905
2024
|
'[attr.aria-valuetext]': 'core.ariaValueText()',
|
|
1906
2025
|
'[attr.aria-orientation]': 'orientation()',
|
|
1907
2026
|
'[attr.aria-disabled]': 'disabled() || null',
|
|
2027
|
+
'[attr.aria-describedby]': 'reason.resolvedDescribedBy()',
|
|
1908
2028
|
'[attr.tabindex]': 'disabled() ? -1 : 0',
|
|
1909
2029
|
'[style.touch-action]': "'none'",
|
|
1910
2030
|
'[style.--cngx-slider-fraction]': 'core.fraction()',
|
|
@@ -1915,7 +2035,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1915
2035
|
'(pointercancel)': 'interaction.handlePointerUp($event)',
|
|
1916
2036
|
},
|
|
1917
2037
|
}]
|
|
1918
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], largeStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "largeStep", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], valueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueText", required: false }] }] } });
|
|
2038
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], largeStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "largeStep", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], disabledReason: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledReason", required: false }] }], describedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxDescribedBy", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], valueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueText", required: false }] }] } });
|
|
1919
2039
|
|
|
1920
2040
|
/**
|
|
1921
2041
|
* Tick stops from `min` to `max` stepping by `step`, for rendering tick marks +
|
|
@@ -2030,7 +2150,7 @@ class CngxSlider {
|
|
|
2030
2150
|
return formatter ? formatter(value) : String(value);
|
|
2031
2151
|
}
|
|
2032
2152
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSlider, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2033
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxSlider, isStandalone: true, selector: "cngx-slider", inputs: { showValue: { classPropertyName: "showValue", publicName: "showValue", isSignal: true, isRequired: false, transformFunction: null }, showValueBubble: { classPropertyName: "showValueBubble", publicName: "showValueBubble", isSignal: true, isRequired: false, transformFunction: null }, showTicks: { classPropertyName: "showTicks", publicName: "showTicks", isSignal: true, isRequired: false, transformFunction: null }, showTickLabels: { classPropertyName: "showTickLabels", publicName: "showTickLabels", isSignal: true, isRequired: false, transformFunction: null }, thumbGlyph: { classPropertyName: "thumbGlyph", publicName: "thumbGlyph", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cngx-slider--ticks": "showTicks()", "class.cngx-slider--bubble": "showValueBubble()", "style.--cngx-slider-tick-interval": "ticks.interval()" }, classAttribute: "cngx-slider" }, exportAs: ["cngxSlider"], hostDirectives: [{ directive: CngxSliderTrack, inputs: ["value", "value", "min", "min", "max", "max", "step", "step", "largeStep", "largeStep", "disabled", "disabled", "orientation", "orientation", "valueText", "valueText"], outputs: ["valueChange", "valueChange"] }], ngImport: i0, template: `
|
|
2153
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxSlider, isStandalone: true, selector: "cngx-slider", inputs: { showValue: { classPropertyName: "showValue", publicName: "showValue", isSignal: true, isRequired: false, transformFunction: null }, showValueBubble: { classPropertyName: "showValueBubble", publicName: "showValueBubble", isSignal: true, isRequired: false, transformFunction: null }, showTicks: { classPropertyName: "showTicks", publicName: "showTicks", isSignal: true, isRequired: false, transformFunction: null }, showTickLabels: { classPropertyName: "showTickLabels", publicName: "showTickLabels", isSignal: true, isRequired: false, transformFunction: null }, thumbGlyph: { classPropertyName: "thumbGlyph", publicName: "thumbGlyph", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cngx-slider--ticks": "showTicks()", "class.cngx-slider--bubble": "showValueBubble()", "style.--cngx-slider-tick-interval": "ticks.interval()" }, classAttribute: "cngx-slider" }, exportAs: ["cngxSlider"], hostDirectives: [{ directive: CngxSliderTrack, inputs: ["value", "value", "min", "min", "max", "max", "step", "step", "largeStep", "largeStep", "disabled", "disabled", "disabledReason", "disabledReason", "cngxDescribedBy", "cngxDescribedBy", "orientation", "orientation", "valueText", "valueText"], outputs: ["valueChange", "valueChange"] }], ngImport: i0, template: `
|
|
2034
2154
|
<span class="cngx-slider__track"><span class="cngx-slider__fill"></span></span>
|
|
2035
2155
|
<span class="cngx-slider__thumb">
|
|
2036
2156
|
@if (thumbGlyph(); as glyph) {
|
|
@@ -2052,14 +2172,25 @@ class CngxSlider {
|
|
|
2052
2172
|
@if (showValueBubble()) {
|
|
2053
2173
|
<span class="cngx-slider__bubble" aria-hidden="true">{{ brain.displayValue() }}</span>
|
|
2054
2174
|
}
|
|
2055
|
-
`, isInline: true, styles: ["cngx-slider{position:relative;display:flex;align-items:center;box-sizing:border-box;inline-size:100%;min-block-size:var(--cngx-slider-thumb-size, 16px);cursor:pointer;touch-action:none}cngx-slider[aria-disabled=true]{opacity:.5;cursor:not-allowed}cngx-slider .cngx-slider__track{position:relative;flex:1 1 auto;block-size:var(--cngx-slider-track-size, 4px);border-radius:999px;background:var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250)))}cngx-slider .cngx-slider__fill{position:absolute;inset-block:0;inset-inline-start:0;inline-size:calc(var(--cngx-slider-fraction, 0) * 100%);border-radius:inherit;background:var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50)))}cngx-slider .cngx-slider__thumb{position:absolute;display:grid;place-items:center;inset-block-start:50%;inset-inline-start:calc(var(--cngx-slider-fraction, 0) * 100%);inline-size:var(--cngx-slider-thumb-size, 16px);block-size:var(--cngx-slider-thumb-size, 16px);border-radius:50%;background:var(--cngx-slider-thumb-color, var(--cngx-color-surface, oklch(1 0 0)));border:var(--cngx-slider-thumb-border-width, 2px) solid var(--cngx-slider-thumb-border-color, var(--cngx-color-primary, oklch(.66 .19 50)));translate:-50% -50%;pointer-events:none}cngx-slider.cngx-slider--ticks .cngx-slider__track:before{content:\"\";position:absolute;inset:0;border-radius:inherit;background-image:repeating-linear-gradient(to right,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) 0,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-interval, 10%))}cngx-slider .cngx-slider__value{position:absolute;inset-block-end:calc(100% + var(--cngx-slider-value-gap, .25rem));inset-inline-start:calc(var(--cngx-slider-fraction, 0) * 100%);translate:-50% 0;font-size:var(--cngx-font-size-sm, .8125rem);font-variant-numeric:tabular-nums;color:var(--cngx-color-text, oklch(.2 .01 250));pointer-events:none;white-space:nowrap}cngx-slider .cngx-slider__bubble{position:absolute;inset-block-end:calc(100% + var(--cngx-slider-bubble-gap, .5rem));inset-inline-start:calc(var(--cngx-slider-fraction, 0) * 100%);translate:-50% 0;padding:var(--cngx-slider-bubble-padding, .125rem .4rem);border-radius:var(--cngx-radius-sm, .25rem);background:var(--cngx-slider-bubble-bg, var(--cngx-color-primary, oklch(.66 .19 50)));color:var(--cngx-slider-bubble-color, var(--cngx-color-on-primary, oklch(.99 .01 250)));font-size:var(--cngx-font-size-sm, .8125rem);font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .12s ease}cngx-slider:focus .cngx-slider__bubble,cngx-slider:active .cngx-slider__bubble{opacity:1}cngx-slider .cngx-slider__ticks{position:absolute;inset-inline:0;inset-block-start:calc(100% + .35rem);block-size:1em;pointer-events:none}cngx-slider .cngx-slider__tick-label{position:absolute;inset-inline-start:calc(var(--cngx-slider-tick-fraction, 0) * 100%);translate:-50% 0;font-size:var(--cngx-slider-tick-font-size, .6875rem);font-variant-numeric:tabular-nums;color:var(--cngx-slider-tick-label-color, var(--cngx-color-text-muted, oklch(.55 .01 250)));white-space:nowrap}cngx-slider:focus-visible{outline:none}cngx-slider:focus-visible .cngx-slider__thumb{outline:var(--cngx-slider-focus-ring-width, 2px) solid var(--cngx-slider-focus-ring-color, var(--cngx-color-primary, oklch(.66 .19 50)));outline-offset:2px}cngx-slider[aria-orientation=vertical] .cngx-slider__ticks{inset-inline:auto;inset-block:0;inset-inline-start:calc(100% + .35rem);inline-size:3ch;block-size:auto}cngx-slider[aria-orientation=vertical] .cngx-slider__tick-label{inset-inline-start:auto;inset-inline-end:0;inset-block-start:calc(100% - var(--cngx-slider-tick-fraction, 0) * 100%);text-align:end;translate:0 -50%}cngx-slider[aria-orientation=vertical]{flex-direction:column;inline-size:max-content;min-inline-size:var(--cngx-slider-thumb-size, 16px);block-size:var(--cngx-slider-length, 9rem);min-block-size:0}cngx-slider[aria-orientation=vertical] .cngx-slider__track{flex:1 1 auto;inline-size:var(--cngx-slider-track-size, 4px);block-size:auto}cngx-slider[aria-orientation=vertical] .cngx-slider__fill{inset-inline:0;inset-block:auto 0;inline-size:100%;block-size:calc(var(--cngx-slider-fraction, 0) * 100%)}cngx-slider[aria-orientation=vertical].cngx-slider--ticks .cngx-slider__track:before{background-image:repeating-linear-gradient(to top,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) 0,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-interval, 10%))}cngx-slider[aria-orientation=vertical] .cngx-slider__thumb{inset-inline-start:50%;inset-block-start:auto;inset-block-end:calc(var(--cngx-slider-fraction, 0) * 100%);translate:-50% 50%}cngx-slider[aria-orientation=vertical] .cngx-slider__value{inset-block-end:auto;inset-block-start:calc(100% - var(--cngx-slider-fraction, 0) * 100%);inset-inline-start:auto;inset-inline-end:calc(100% + .5rem);translate:0 -50%}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2175
|
+
`, isInline: true, styles: ["cngx-slider{--cngx-slider-value-gap: var(--cngx-space-xs, .25rem);--cngx-slider-bubble-gap: var(--cngx-space-sm, .5rem);--cngx-slider-bubble-padding: var(--cngx-space-xs, .125rem) var(--cngx-space-sm, .4rem);position:relative;display:flex;align-items:center;box-sizing:border-box;inline-size:100%;min-block-size:var(--cngx-slider-thumb-size, 16px);cursor:pointer;touch-action:none}cngx-slider[aria-disabled=true]{opacity:.5;cursor:not-allowed}cngx-slider .cngx-slider__track{position:relative;flex:1 1 auto;block-size:var(--cngx-slider-track-size, 4px);border-radius:999px;background:var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250)))}cngx-slider .cngx-slider__fill{position:absolute;inset-block:0;inset-inline-start:0;inline-size:calc(var(--cngx-slider-fraction, 0) * 100%);border-radius:inherit;background:var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50)))}cngx-slider .cngx-slider__thumb{position:absolute;display:grid;place-items:center;inset-block-start:50%;inset-inline-start:calc(var(--cngx-slider-fraction, 0) * 100%);inline-size:var(--cngx-slider-thumb-size, 16px);block-size:var(--cngx-slider-thumb-size, 16px);border-radius:50%;background:var(--cngx-slider-thumb-color, var(--cngx-color-surface, oklch(1 0 0)));border:var(--cngx-slider-thumb-border-width, 2px) solid var(--cngx-slider-thumb-border-color, var(--cngx-color-primary, oklch(.66 .19 50)));translate:-50% -50%;pointer-events:none}cngx-slider.cngx-slider--ticks .cngx-slider__track:before{content:\"\";position:absolute;inset:0;border-radius:inherit;background-image:repeating-linear-gradient(to right,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) 0,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-interval, 10%))}cngx-slider .cngx-slider__value{position:absolute;inset-block-end:calc(100% + var(--cngx-slider-value-gap, .25rem));inset-inline-start:calc(var(--cngx-slider-fraction, 0) * 100%);translate:-50% 0;font-size:var(--cngx-font-size-sm, .8125rem);font-variant-numeric:tabular-nums;color:var(--cngx-color-text, oklch(.2 .01 250));pointer-events:none;white-space:nowrap;unicode-bidi:var(--cngx-slider-value-bidi, isolate)}cngx-slider .cngx-slider__bubble{position:absolute;inset-block-end:calc(100% + var(--cngx-slider-bubble-gap, .5rem));inset-inline-start:calc(var(--cngx-slider-fraction, 0) * 100%);translate:-50% 0;padding:var(--cngx-slider-bubble-padding, .125rem .4rem);border-radius:var(--cngx-radius-sm, .25rem);background:var(--cngx-slider-bubble-bg, var(--cngx-color-primary, oklch(.66 .19 50)));color:var(--cngx-slider-bubble-color, var(--cngx-color-on-primary, oklch(.99 .01 250)));font-size:var(--cngx-font-size-sm, .8125rem);font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .12s ease;unicode-bidi:var(--cngx-slider-value-bidi, isolate)}cngx-slider:focus .cngx-slider__bubble,cngx-slider:active .cngx-slider__bubble{opacity:1}cngx-slider .cngx-slider__ticks{position:absolute;inset-inline:0;inset-block-start:calc(100% + .35rem);block-size:1em;pointer-events:none}cngx-slider .cngx-slider__tick-label{position:absolute;inset-inline-start:calc(var(--cngx-slider-tick-fraction, 0) * 100%);translate:-50% 0;font-size:var(--cngx-slider-tick-font-size, .6875rem);font-variant-numeric:tabular-nums;color:var(--cngx-slider-tick-label-color, var(--cngx-color-text-muted, oklch(.55 .01 250)));white-space:nowrap;unicode-bidi:var(--cngx-slider-value-bidi, isolate)}cngx-slider:focus-visible{outline:none}cngx-slider:focus-visible .cngx-slider__thumb{outline:var(--cngx-slider-focus-ring-width, 2px) solid var(--cngx-slider-focus-ring-color, var(--cngx-color-primary, oklch(.66 .19 50)));outline-offset:2px}cngx-slider[aria-orientation=vertical] .cngx-slider__ticks{inset-inline:auto;inset-block:0;inset-inline-start:calc(100% + .35rem);inline-size:3ch;block-size:auto}cngx-slider[aria-orientation=vertical] .cngx-slider__tick-label{inset-inline-start:auto;inset-inline-end:0;inset-block-start:calc(100% - var(--cngx-slider-tick-fraction, 0) * 100%);text-align:end;translate:0 -50%}cngx-slider[aria-orientation=vertical]{flex-direction:column;inline-size:max-content;min-inline-size:var(--cngx-slider-thumb-size, 16px);block-size:var(--cngx-slider-length, 9rem);min-block-size:0}cngx-slider[aria-orientation=vertical] .cngx-slider__track{flex:1 1 auto;inline-size:var(--cngx-slider-track-size, 4px);block-size:auto}cngx-slider[aria-orientation=vertical] .cngx-slider__fill{inset-inline:0;inset-block:auto 0;inline-size:100%;block-size:calc(var(--cngx-slider-fraction, 0) * 100%)}cngx-slider[aria-orientation=vertical].cngx-slider--ticks .cngx-slider__track:before{background-image:repeating-linear-gradient(to top,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) 0,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-interval, 10%))}cngx-slider[aria-orientation=vertical] .cngx-slider__thumb{inset-inline-start:50%;inset-block-start:auto;inset-block-end:calc(var(--cngx-slider-fraction, 0) * 100%);translate:-50% 50%}cngx-slider[aria-orientation=vertical] .cngx-slider__value{inset-block-end:auto;inset-block-start:calc(100% - var(--cngx-slider-fraction, 0) * 100%);inset-inline-start:auto;inset-inline-end:calc(100% + .5rem);translate:0 -50%}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2056
2176
|
}
|
|
2057
2177
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSlider, decorators: [{
|
|
2058
2178
|
type: Component,
|
|
2059
2179
|
args: [{ selector: 'cngx-slider', exportAs: 'cngxSlider', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [NgTemplateOutlet], hostDirectives: [
|
|
2060
2180
|
{
|
|
2061
2181
|
directive: CngxSliderTrack,
|
|
2062
|
-
inputs: [
|
|
2182
|
+
inputs: [
|
|
2183
|
+
'value',
|
|
2184
|
+
'min',
|
|
2185
|
+
'max',
|
|
2186
|
+
'step',
|
|
2187
|
+
'largeStep',
|
|
2188
|
+
'disabled',
|
|
2189
|
+
'disabledReason',
|
|
2190
|
+
'cngxDescribedBy',
|
|
2191
|
+
'orientation',
|
|
2192
|
+
'valueText',
|
|
2193
|
+
],
|
|
2063
2194
|
outputs: ['valueChange'],
|
|
2064
2195
|
},
|
|
2065
2196
|
], host: {
|
|
@@ -2089,7 +2220,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2089
2220
|
@if (showValueBubble()) {
|
|
2090
2221
|
<span class="cngx-slider__bubble" aria-hidden="true">{{ brain.displayValue() }}</span>
|
|
2091
2222
|
}
|
|
2092
|
-
`, styles: ["cngx-slider{position:relative;display:flex;align-items:center;box-sizing:border-box;inline-size:100%;min-block-size:var(--cngx-slider-thumb-size, 16px);cursor:pointer;touch-action:none}cngx-slider[aria-disabled=true]{opacity:.5;cursor:not-allowed}cngx-slider .cngx-slider__track{position:relative;flex:1 1 auto;block-size:var(--cngx-slider-track-size, 4px);border-radius:999px;background:var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250)))}cngx-slider .cngx-slider__fill{position:absolute;inset-block:0;inset-inline-start:0;inline-size:calc(var(--cngx-slider-fraction, 0) * 100%);border-radius:inherit;background:var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50)))}cngx-slider .cngx-slider__thumb{position:absolute;display:grid;place-items:center;inset-block-start:50%;inset-inline-start:calc(var(--cngx-slider-fraction, 0) * 100%);inline-size:var(--cngx-slider-thumb-size, 16px);block-size:var(--cngx-slider-thumb-size, 16px);border-radius:50%;background:var(--cngx-slider-thumb-color, var(--cngx-color-surface, oklch(1 0 0)));border:var(--cngx-slider-thumb-border-width, 2px) solid var(--cngx-slider-thumb-border-color, var(--cngx-color-primary, oklch(.66 .19 50)));translate:-50% -50%;pointer-events:none}cngx-slider.cngx-slider--ticks .cngx-slider__track:before{content:\"\";position:absolute;inset:0;border-radius:inherit;background-image:repeating-linear-gradient(to right,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) 0,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-interval, 10%))}cngx-slider .cngx-slider__value{position:absolute;inset-block-end:calc(100% + var(--cngx-slider-value-gap, .25rem));inset-inline-start:calc(var(--cngx-slider-fraction, 0) * 100%);translate:-50% 0;font-size:var(--cngx-font-size-sm, .8125rem);font-variant-numeric:tabular-nums;color:var(--cngx-color-text, oklch(.2 .01 250));pointer-events:none;white-space:nowrap}cngx-slider .cngx-slider__bubble{position:absolute;inset-block-end:calc(100% + var(--cngx-slider-bubble-gap, .5rem));inset-inline-start:calc(var(--cngx-slider-fraction, 0) * 100%);translate:-50% 0;padding:var(--cngx-slider-bubble-padding, .125rem .4rem);border-radius:var(--cngx-radius-sm, .25rem);background:var(--cngx-slider-bubble-bg, var(--cngx-color-primary, oklch(.66 .19 50)));color:var(--cngx-slider-bubble-color, var(--cngx-color-on-primary, oklch(.99 .01 250)));font-size:var(--cngx-font-size-sm, .8125rem);font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .12s ease}cngx-slider:focus .cngx-slider__bubble,cngx-slider:active .cngx-slider__bubble{opacity:1}cngx-slider .cngx-slider__ticks{position:absolute;inset-inline:0;inset-block-start:calc(100% + .35rem);block-size:1em;pointer-events:none}cngx-slider .cngx-slider__tick-label{position:absolute;inset-inline-start:calc(var(--cngx-slider-tick-fraction, 0) * 100%);translate:-50% 0;font-size:var(--cngx-slider-tick-font-size, .6875rem);font-variant-numeric:tabular-nums;color:var(--cngx-slider-tick-label-color, var(--cngx-color-text-muted, oklch(.55 .01 250)));white-space:nowrap}cngx-slider:focus-visible{outline:none}cngx-slider:focus-visible .cngx-slider__thumb{outline:var(--cngx-slider-focus-ring-width, 2px) solid var(--cngx-slider-focus-ring-color, var(--cngx-color-primary, oklch(.66 .19 50)));outline-offset:2px}cngx-slider[aria-orientation=vertical] .cngx-slider__ticks{inset-inline:auto;inset-block:0;inset-inline-start:calc(100% + .35rem);inline-size:3ch;block-size:auto}cngx-slider[aria-orientation=vertical] .cngx-slider__tick-label{inset-inline-start:auto;inset-inline-end:0;inset-block-start:calc(100% - var(--cngx-slider-tick-fraction, 0) * 100%);text-align:end;translate:0 -50%}cngx-slider[aria-orientation=vertical]{flex-direction:column;inline-size:max-content;min-inline-size:var(--cngx-slider-thumb-size, 16px);block-size:var(--cngx-slider-length, 9rem);min-block-size:0}cngx-slider[aria-orientation=vertical] .cngx-slider__track{flex:1 1 auto;inline-size:var(--cngx-slider-track-size, 4px);block-size:auto}cngx-slider[aria-orientation=vertical] .cngx-slider__fill{inset-inline:0;inset-block:auto 0;inline-size:100%;block-size:calc(var(--cngx-slider-fraction, 0) * 100%)}cngx-slider[aria-orientation=vertical].cngx-slider--ticks .cngx-slider__track:before{background-image:repeating-linear-gradient(to top,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) 0,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-interval, 10%))}cngx-slider[aria-orientation=vertical] .cngx-slider__thumb{inset-inline-start:50%;inset-block-start:auto;inset-block-end:calc(var(--cngx-slider-fraction, 0) * 100%);translate:-50% 50%}cngx-slider[aria-orientation=vertical] .cngx-slider__value{inset-block-end:auto;inset-block-start:calc(100% - var(--cngx-slider-fraction, 0) * 100%);inset-inline-start:auto;inset-inline-end:calc(100% + .5rem);translate:0 -50%}\n"] }]
|
|
2223
|
+
`, styles: ["cngx-slider{--cngx-slider-value-gap: var(--cngx-space-xs, .25rem);--cngx-slider-bubble-gap: var(--cngx-space-sm, .5rem);--cngx-slider-bubble-padding: var(--cngx-space-xs, .125rem) var(--cngx-space-sm, .4rem);position:relative;display:flex;align-items:center;box-sizing:border-box;inline-size:100%;min-block-size:var(--cngx-slider-thumb-size, 16px);cursor:pointer;touch-action:none}cngx-slider[aria-disabled=true]{opacity:.5;cursor:not-allowed}cngx-slider .cngx-slider__track{position:relative;flex:1 1 auto;block-size:var(--cngx-slider-track-size, 4px);border-radius:999px;background:var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250)))}cngx-slider .cngx-slider__fill{position:absolute;inset-block:0;inset-inline-start:0;inline-size:calc(var(--cngx-slider-fraction, 0) * 100%);border-radius:inherit;background:var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50)))}cngx-slider .cngx-slider__thumb{position:absolute;display:grid;place-items:center;inset-block-start:50%;inset-inline-start:calc(var(--cngx-slider-fraction, 0) * 100%);inline-size:var(--cngx-slider-thumb-size, 16px);block-size:var(--cngx-slider-thumb-size, 16px);border-radius:50%;background:var(--cngx-slider-thumb-color, var(--cngx-color-surface, oklch(1 0 0)));border:var(--cngx-slider-thumb-border-width, 2px) solid var(--cngx-slider-thumb-border-color, var(--cngx-color-primary, oklch(.66 .19 50)));translate:-50% -50%;pointer-events:none}cngx-slider.cngx-slider--ticks .cngx-slider__track:before{content:\"\";position:absolute;inset:0;border-radius:inherit;background-image:repeating-linear-gradient(to right,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) 0,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-interval, 10%))}cngx-slider .cngx-slider__value{position:absolute;inset-block-end:calc(100% + var(--cngx-slider-value-gap, .25rem));inset-inline-start:calc(var(--cngx-slider-fraction, 0) * 100%);translate:-50% 0;font-size:var(--cngx-font-size-sm, .8125rem);font-variant-numeric:tabular-nums;color:var(--cngx-color-text, oklch(.2 .01 250));pointer-events:none;white-space:nowrap;unicode-bidi:var(--cngx-slider-value-bidi, isolate)}cngx-slider .cngx-slider__bubble{position:absolute;inset-block-end:calc(100% + var(--cngx-slider-bubble-gap, .5rem));inset-inline-start:calc(var(--cngx-slider-fraction, 0) * 100%);translate:-50% 0;padding:var(--cngx-slider-bubble-padding, .125rem .4rem);border-radius:var(--cngx-radius-sm, .25rem);background:var(--cngx-slider-bubble-bg, var(--cngx-color-primary, oklch(.66 .19 50)));color:var(--cngx-slider-bubble-color, var(--cngx-color-on-primary, oklch(.99 .01 250)));font-size:var(--cngx-font-size-sm, .8125rem);font-variant-numeric:tabular-nums;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .12s ease;unicode-bidi:var(--cngx-slider-value-bidi, isolate)}cngx-slider:focus .cngx-slider__bubble,cngx-slider:active .cngx-slider__bubble{opacity:1}cngx-slider .cngx-slider__ticks{position:absolute;inset-inline:0;inset-block-start:calc(100% + .35rem);block-size:1em;pointer-events:none}cngx-slider .cngx-slider__tick-label{position:absolute;inset-inline-start:calc(var(--cngx-slider-tick-fraction, 0) * 100%);translate:-50% 0;font-size:var(--cngx-slider-tick-font-size, .6875rem);font-variant-numeric:tabular-nums;color:var(--cngx-slider-tick-label-color, var(--cngx-color-text-muted, oklch(.55 .01 250)));white-space:nowrap;unicode-bidi:var(--cngx-slider-value-bidi, isolate)}cngx-slider:focus-visible{outline:none}cngx-slider:focus-visible .cngx-slider__thumb{outline:var(--cngx-slider-focus-ring-width, 2px) solid var(--cngx-slider-focus-ring-color, var(--cngx-color-primary, oklch(.66 .19 50)));outline-offset:2px}cngx-slider[aria-orientation=vertical] .cngx-slider__ticks{inset-inline:auto;inset-block:0;inset-inline-start:calc(100% + .35rem);inline-size:3ch;block-size:auto}cngx-slider[aria-orientation=vertical] .cngx-slider__tick-label{inset-inline-start:auto;inset-inline-end:0;inset-block-start:calc(100% - var(--cngx-slider-tick-fraction, 0) * 100%);text-align:end;translate:0 -50%}cngx-slider[aria-orientation=vertical]{flex-direction:column;inline-size:max-content;min-inline-size:var(--cngx-slider-thumb-size, 16px);block-size:var(--cngx-slider-length, 9rem);min-block-size:0}cngx-slider[aria-orientation=vertical] .cngx-slider__track{flex:1 1 auto;inline-size:var(--cngx-slider-track-size, 4px);block-size:auto}cngx-slider[aria-orientation=vertical] .cngx-slider__fill{inset-inline:0;inset-block:auto 0;inline-size:100%;block-size:calc(var(--cngx-slider-fraction, 0) * 100%)}cngx-slider[aria-orientation=vertical].cngx-slider--ticks .cngx-slider__track:before{background-image:repeating-linear-gradient(to top,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) 0,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-interval, 10%))}cngx-slider[aria-orientation=vertical] .cngx-slider__thumb{inset-inline-start:50%;inset-block-start:auto;inset-block-end:calc(var(--cngx-slider-fraction, 0) * 100%);translate:-50% 50%}cngx-slider[aria-orientation=vertical] .cngx-slider__value{inset-block-end:auto;inset-block-start:calc(100% - var(--cngx-slider-fraction, 0) * 100%);inset-inline-start:auto;inset-inline-end:calc(100% + .5rem);translate:0 -50%}\n"] }]
|
|
2093
2224
|
}], propDecorators: { showValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "showValue", required: false }] }], showValueBubble: [{ type: i0.Input, args: [{ isSignal: true, alias: "showValueBubble", required: false }] }], showTicks: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTicks", required: false }] }], showTickLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTickLabels", required: false }] }], thumbGlyph: [{ type: i0.Input, args: [{ isSignal: true, alias: "thumbGlyph", required: false }] }] } });
|
|
2094
2225
|
|
|
2095
2226
|
/**
|
|
@@ -2146,12 +2277,37 @@ class CngxRangeSliderTrack {
|
|
|
2146
2277
|
* Defaults to the larger of one step and a tenth of the range.
|
|
2147
2278
|
*/
|
|
2148
2279
|
largeStep = input(undefined, ...(ngDevMode ? [{ debugName: "largeStep" }] : /* istanbul ignore next */ []));
|
|
2149
|
-
/**
|
|
2150
|
-
|
|
2280
|
+
/**
|
|
2281
|
+
* Whether the range slider is disabled. A `ModelSignal` so form-field
|
|
2282
|
+
* bridges can drive it programmatically, mirroring the checkbox/toggle
|
|
2283
|
+
* family's bridge write path.
|
|
2284
|
+
*/
|
|
2285
|
+
disabled = model(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
2286
|
+
/**
|
|
2287
|
+
* Consumer-supplied "why" for the disabled state (no library default per
|
|
2288
|
+
* the EN-defaults rule). Announced via an sr-only span the directive
|
|
2289
|
+
* appends to the group host; both the span's visibility and the host's
|
|
2290
|
+
* `aria-describedby` reference are gated on `disabled() &&
|
|
2291
|
+
* disabledReason()` (Toggle/Radio convergence).
|
|
2292
|
+
*/
|
|
2293
|
+
disabledReason = input('', ...(ngDevMode ? [{ debugName: "disabledReason" }] : /* istanbul ignore next */ []));
|
|
2294
|
+
/**
|
|
2295
|
+
* Optional consumer-supplied id of an external description element.
|
|
2296
|
+
* Consumers bind via `[cngxDescribedBy]="someId"` - same surface as
|
|
2297
|
+
* `CngxChipInteraction`. The active disabled-reason wins.
|
|
2298
|
+
*/
|
|
2299
|
+
describedBy = input(null, { ...(ngDevMode ? { debugName: "describedBy" } : /* istanbul ignore next */ {}), alias: 'cngxDescribedBy' });
|
|
2151
2300
|
/** Track axis shared by both thumbs. */
|
|
2152
2301
|
orientation = input('horizontal', ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
2153
2302
|
/** Optional `aria-valuetext` formatter shared across both thumbs. */
|
|
2154
2303
|
valueText = input(undefined, ...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
|
|
2304
|
+
/** Disabled-"why" span + gated `aria-describedby` resolution. */
|
|
2305
|
+
reason = createSliderDisabledReason({
|
|
2306
|
+
idPrefix: 'cngx-range-slider-desc',
|
|
2307
|
+
disabled: () => this.disabled(),
|
|
2308
|
+
reason: () => this.disabledReason(),
|
|
2309
|
+
describedBy: () => this.describedBy(),
|
|
2310
|
+
});
|
|
2155
2311
|
// Sibling-clamp bounds. The start thumb's ceiling tracks the end value;
|
|
2156
2312
|
// the end thumb's floor tracks the start value. Held as stable signals
|
|
2157
2313
|
// (not recreated per boundsFor call) so each thumb's core reads one node.
|
|
@@ -2193,7 +2349,7 @@ class CngxRangeSliderTrack {
|
|
|
2193
2349
|
return pointerFraction(this.el, this.orientation(), clientX, clientY);
|
|
2194
2350
|
}
|
|
2195
2351
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxRangeSliderTrack, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2196
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxRangeSliderTrack, isStandalone: true, selector: "[cngxRangeSliderTrack]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, largeStep: { classPropertyName: "largeStep", publicName: "largeStep", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, valueText: { classPropertyName: "valueText", publicName: "valueText", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "group" }, properties: { "attr.aria-disabled": "disabled() || null", "attr.aria-orientation": "orientation()", "style.--cngx-slider-start-fraction": "startFraction()", "style.--cngx-slider-end-fraction": "endFraction()" } }, providers: [{ provide: CNGX_SLIDER_RANGE, useExisting: CngxRangeSliderTrack }], exportAs: ["cngxRangeSliderTrack"], ngImport: i0 });
|
|
2352
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxRangeSliderTrack, isStandalone: true, selector: "[cngxRangeSliderTrack]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, largeStep: { classPropertyName: "largeStep", publicName: "largeStep", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, disabledReason: { classPropertyName: "disabledReason", publicName: "disabledReason", isSignal: true, isRequired: false, transformFunction: null }, describedBy: { classPropertyName: "describedBy", publicName: "cngxDescribedBy", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, valueText: { classPropertyName: "valueText", publicName: "valueText", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", disabled: "disabledChange" }, host: { attributes: { "role": "group" }, properties: { "attr.aria-disabled": "disabled() || null", "attr.aria-describedby": "reason.resolvedDescribedBy()", "attr.aria-orientation": "orientation()", "style.--cngx-slider-start-fraction": "startFraction()", "style.--cngx-slider-end-fraction": "endFraction()" } }, providers: [{ provide: CNGX_SLIDER_RANGE, useExisting: CngxRangeSliderTrack }], exportAs: ["cngxRangeSliderTrack"], ngImport: i0 });
|
|
2197
2353
|
}
|
|
2198
2354
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxRangeSliderTrack, decorators: [{
|
|
2199
2355
|
type: Directive,
|
|
@@ -2205,12 +2361,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2205
2361
|
host: {
|
|
2206
2362
|
role: 'group',
|
|
2207
2363
|
'[attr.aria-disabled]': 'disabled() || null',
|
|
2364
|
+
'[attr.aria-describedby]': 'reason.resolvedDescribedBy()',
|
|
2208
2365
|
'[attr.aria-orientation]': 'orientation()',
|
|
2209
2366
|
'[style.--cngx-slider-start-fraction]': 'startFraction()',
|
|
2210
2367
|
'[style.--cngx-slider-end-fraction]': 'endFraction()',
|
|
2211
2368
|
},
|
|
2212
2369
|
}]
|
|
2213
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], largeStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "largeStep", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], valueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueText", required: false }] }] } });
|
|
2370
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], largeStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "largeStep", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], disabledReason: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledReason", required: false }] }], describedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxDescribedBy", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], valueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueText", required: false }] }] } });
|
|
2214
2371
|
|
|
2215
2372
|
/**
|
|
2216
2373
|
* Builds a `WritableSignal<number>` view over one end of the range tuple:
|
|
@@ -2286,6 +2443,7 @@ class CngxSliderThumb {
|
|
|
2286
2443
|
disabled: () => this.range.disabled(),
|
|
2287
2444
|
pageStep: () => this.pageStep(),
|
|
2288
2445
|
fractionFromPointer: (x, y) => this.range.fractionFromPointer(x, y),
|
|
2446
|
+
direction: injectDirection(),
|
|
2289
2447
|
});
|
|
2290
2448
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSliderThumb, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2291
2449
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxSliderThumb, isStandalone: true, selector: "[cngxSliderThumb]", inputs: { position: { classPropertyName: "position", publicName: "cngxSliderThumb", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "slider" }, listeners: { "keydown": "interaction.handleKeydown($event)", "pointerdown": "interaction.handlePointerDown($event)", "pointermove": "interaction.handlePointerMove($event)", "pointerup": "interaction.handlePointerUp($event)", "pointercancel": "interaction.handlePointerUp($event)" }, properties: { "attr.aria-valuemin": "bounds().min()", "attr.aria-valuemax": "bounds().max()", "attr.aria-valuenow": "core.clampedValue()", "attr.aria-valuetext": "core.ariaValueText()", "attr.aria-orientation": "range.orientation()", "attr.aria-disabled": "range.disabled() || null", "attr.tabindex": "range.disabled() ? -1 : 0", "style.touch-action": "'none'", "style.--cngx-slider-fraction": "core.fraction()" } }, exportAs: ["cngxSliderThumb"], ngImport: i0 });
|
|
@@ -2372,7 +2530,7 @@ class CngxRangeSlider {
|
|
|
2372
2530
|
return formatter ? formatter(value) : String(value);
|
|
2373
2531
|
}
|
|
2374
2532
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxRangeSlider, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2375
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxRangeSlider, isStandalone: true, selector: "cngx-range-slider", inputs: { startLabel: { classPropertyName: "startLabel", publicName: "startLabel", isSignal: true, isRequired: false, transformFunction: null }, endLabel: { classPropertyName: "endLabel", publicName: "endLabel", isSignal: true, isRequired: false, transformFunction: null }, showValue: { classPropertyName: "showValue", publicName: "showValue", isSignal: true, isRequired: false, transformFunction: null }, showValueBubble: { classPropertyName: "showValueBubble", publicName: "showValueBubble", isSignal: true, isRequired: false, transformFunction: null }, showTicks: { classPropertyName: "showTicks", publicName: "showTicks", isSignal: true, isRequired: false, transformFunction: null }, showTickLabels: { classPropertyName: "showTickLabels", publicName: "showTickLabels", isSignal: true, isRequired: false, transformFunction: null }, thumbGlyph: { classPropertyName: "thumbGlyph", publicName: "thumbGlyph", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cngx-slider--ticks": "showTicks()", "class.cngx-slider--bubble": "showValueBubble()", "style.--cngx-slider-tick-interval": "ticks.interval()" }, classAttribute: "cngx-slider cngx-range-slider" }, exportAs: ["cngxRangeSlider"], hostDirectives: [{ directive: CngxRangeSliderTrack, inputs: ["value", "value", "min", "min", "max", "max", "step", "step", "largeStep", "largeStep", "disabled", "disabled", "orientation", "orientation", "valueText", "valueText"], outputs: ["valueChange", "valueChange"] }], ngImport: i0, template: `
|
|
2533
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxRangeSlider, isStandalone: true, selector: "cngx-range-slider", inputs: { startLabel: { classPropertyName: "startLabel", publicName: "startLabel", isSignal: true, isRequired: false, transformFunction: null }, endLabel: { classPropertyName: "endLabel", publicName: "endLabel", isSignal: true, isRequired: false, transformFunction: null }, showValue: { classPropertyName: "showValue", publicName: "showValue", isSignal: true, isRequired: false, transformFunction: null }, showValueBubble: { classPropertyName: "showValueBubble", publicName: "showValueBubble", isSignal: true, isRequired: false, transformFunction: null }, showTicks: { classPropertyName: "showTicks", publicName: "showTicks", isSignal: true, isRequired: false, transformFunction: null }, showTickLabels: { classPropertyName: "showTickLabels", publicName: "showTickLabels", isSignal: true, isRequired: false, transformFunction: null }, thumbGlyph: { classPropertyName: "thumbGlyph", publicName: "thumbGlyph", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.cngx-slider--ticks": "showTicks()", "class.cngx-slider--bubble": "showValueBubble()", "style.--cngx-slider-tick-interval": "ticks.interval()" }, classAttribute: "cngx-slider cngx-range-slider" }, exportAs: ["cngxRangeSlider"], hostDirectives: [{ directive: CngxRangeSliderTrack, inputs: ["value", "value", "min", "min", "max", "max", "step", "step", "largeStep", "largeStep", "disabled", "disabled", "disabledReason", "disabledReason", "cngxDescribedBy", "cngxDescribedBy", "orientation", "orientation", "valueText", "valueText"], outputs: ["valueChange", "valueChange"] }], ngImport: i0, template: `
|
|
2376
2534
|
<span class="cngx-slider__track"></span>
|
|
2377
2535
|
<span cngxSliderThumb="start" [attr.aria-label]="startLabel()">
|
|
2378
2536
|
@if (thumbGlyph(); as glyph) {
|
|
@@ -2403,14 +2561,25 @@ class CngxRangeSlider {
|
|
|
2403
2561
|
{{ format(brain.value()[0]) }} - {{ format(brain.value()[1]) }}
|
|
2404
2562
|
</span>
|
|
2405
2563
|
}
|
|
2406
|
-
`, isInline: true, styles: ["cngx-range-slider{position:relative;display:flex;align-items:center;box-sizing:border-box;inline-size:100%;min-block-size:var(--cngx-slider-thumb-size, 16px);cursor:pointer;touch-action:none}cngx-range-slider[aria-disabled=true]{opacity:.5;cursor:not-allowed}cngx-range-slider .cngx-slider__track{position:relative;flex:1 1 auto;block-size:var(--cngx-slider-track-size, 4px);border-radius:999px;background:linear-gradient(to right,var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) 0,var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) calc(var(--cngx-slider-start-fraction, 0) * 100%),var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50))) calc(var(--cngx-slider-start-fraction, 0) * 100%),var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50))) calc(var(--cngx-slider-end-fraction, 1) * 100%),var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) calc(var(--cngx-slider-end-fraction, 1) * 100%))}cngx-range-slider.cngx-slider--ticks .cngx-slider__track:before{content:\"\";position:absolute;inset:0;border-radius:inherit;background-image:repeating-linear-gradient(to right,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) 0,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-interval, 10%))}cngx-range-slider [cngxSliderThumb]{position:absolute;display:grid;place-items:center;inset-block-start:50%;inset-inline-start:calc(var(--cngx-slider-fraction, 0) * 100%);inline-size:var(--cngx-slider-thumb-size, 16px);block-size:var(--cngx-slider-thumb-size, 16px);border-radius:50%;background:var(--cngx-slider-thumb-color, var(--cngx-color-surface, oklch(1 0 0)));border:var(--cngx-slider-thumb-border-width, 2px) solid var(--cngx-slider-thumb-border-color, var(--cngx-color-primary, oklch(.66 .19 50)));translate:-50% -50%;cursor:grab}cngx-range-slider [cngxSliderThumb]:focus-visible{outline:var(--cngx-slider-focus-ring-width, 2px) solid var(--cngx-slider-focus-ring-color, var(--cngx-color-primary, oklch(.66 .19 50)));outline-offset:2px}cngx-range-slider .cngx-slider__ticks{position:absolute;inset-inline:0;inset-block-start:calc(100% + .35rem);block-size:1em;pointer-events:none}cngx-range-slider .cngx-slider__tick-label{position:absolute;inset-inline-start:calc(var(--cngx-slider-tick-fraction, 0) * 100%);translate:-50% 0;font-size:var(--cngx-slider-tick-font-size, .6875rem);font-variant-numeric:tabular-nums;color:var(--cngx-slider-tick-label-color, var(--cngx-color-text-muted, oklch(.55 .01 250)));white-space:nowrap}cngx-range-slider[aria-orientation=vertical] .cngx-slider__ticks{inset-inline:auto;inset-block:0;inset-inline-start:calc(100% + .35rem);inline-size:3ch;block-size:auto}cngx-range-slider[aria-orientation=vertical] .cngx-slider__tick-label{inset-inline-start:auto;inset-inline-end:0;inset-block-start:calc(100% - var(--cngx-slider-tick-fraction, 0) * 100%);text-align:end;translate:0 -50%}cngx-range-slider .cngx-slider__value--range{position:absolute;inset-block-end:calc(100% + var(--cngx-slider-value-gap, .25rem));inset-inline-start:calc(var(--cngx-slider-mid-fraction, .5) * 100%);translate:-50% 0;font-size:var(--cngx-font-size-sm, .8125rem);font-variant-numeric:tabular-nums;color:var(--cngx-color-text, oklch(.2 .01 250));pointer-events:none;white-space:nowrap}cngx-range-slider .cngx-slider__value--range.cngx-slider__bubble{inset-block-end:calc(100% + var(--cngx-slider-bubble-gap, .5rem));padding:var(--cngx-slider-bubble-padding, .125rem .4rem);border-radius:var(--cngx-radius-sm, .25rem);background:var(--cngx-slider-bubble-bg, var(--cngx-color-primary, oklch(.66 .19 50)));color:var(--cngx-slider-bubble-color, var(--cngx-color-on-primary, oklch(.99 .01 250)));opacity:0;transition:opacity .12s ease}cngx-range-slider:focus-within .cngx-slider__bubble,cngx-range-slider:active .cngx-slider__bubble{opacity:1}cngx-range-slider[aria-orientation=vertical]{flex-direction:column;inline-size:max-content;min-inline-size:var(--cngx-slider-thumb-size, 16px);block-size:var(--cngx-slider-length, 9rem);min-block-size:0}cngx-range-slider[aria-orientation=vertical] .cngx-slider__track{flex:1 1 auto;inline-size:var(--cngx-slider-track-size, 4px);block-size:auto;background:linear-gradient(to top,var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) 0,var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) calc(var(--cngx-slider-start-fraction, 0) * 100%),var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50))) calc(var(--cngx-slider-start-fraction, 0) * 100%),var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50))) calc(var(--cngx-slider-end-fraction, 1) * 100%),var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) calc(var(--cngx-slider-end-fraction, 1) * 100%))}cngx-range-slider[aria-orientation=vertical].cngx-slider--ticks .cngx-slider__track:before{background-image:repeating-linear-gradient(to top,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) 0,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-interval, 10%))}cngx-range-slider[aria-orientation=vertical] [cngxSliderThumb]{inset-inline-start:50%;inset-block-start:auto;inset-block-end:calc(var(--cngx-slider-fraction, 0) * 100%);translate:-50% 50%}cngx-range-slider[aria-orientation=vertical] .cngx-slider__value--range{inset-block-end:auto;inset-block-start:calc(100% - var(--cngx-slider-mid-fraction, .5) * 100%);inset-inline-start:calc(100% + .5rem);translate:0 -50%}\n"], dependencies: [{ kind: "directive", type: CngxSliderThumb, selector: "[cngxSliderThumb]", inputs: ["cngxSliderThumb"], exportAs: ["cngxSliderThumb"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2564
|
+
`, isInline: true, styles: ["cngx-range-slider{--cngx-slider-value-gap: var(--cngx-space-xs, .25rem);--cngx-slider-bubble-gap: var(--cngx-space-sm, .5rem);--cngx-slider-bubble-padding: var(--cngx-space-xs, .125rem) var(--cngx-space-sm, .4rem);position:relative;display:flex;align-items:center;box-sizing:border-box;inline-size:100%;min-block-size:var(--cngx-slider-thumb-size, 16px);cursor:pointer;touch-action:none}cngx-range-slider[aria-disabled=true]{opacity:.5;cursor:not-allowed}cngx-range-slider .cngx-slider__track{position:relative;flex:1 1 auto;block-size:var(--cngx-slider-track-size, 4px);border-radius:999px;background:linear-gradient(to right,var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) 0,var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) calc(var(--cngx-slider-start-fraction, 0) * 100%),var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50))) calc(var(--cngx-slider-start-fraction, 0) * 100%),var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50))) calc(var(--cngx-slider-end-fraction, 1) * 100%),var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) calc(var(--cngx-slider-end-fraction, 1) * 100%))}cngx-range-slider.cngx-slider--ticks .cngx-slider__track:before{content:\"\";position:absolute;inset:0;border-radius:inherit;background-image:repeating-linear-gradient(to right,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) 0,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-interval, 10%))}cngx-range-slider [cngxSliderThumb]{position:absolute;display:grid;place-items:center;inset-block-start:50%;inset-inline-start:calc(var(--cngx-slider-fraction, 0) * 100%);inline-size:var(--cngx-slider-thumb-size, 16px);block-size:var(--cngx-slider-thumb-size, 16px);border-radius:50%;background:var(--cngx-slider-thumb-color, var(--cngx-color-surface, oklch(1 0 0)));border:var(--cngx-slider-thumb-border-width, 2px) solid var(--cngx-slider-thumb-border-color, var(--cngx-color-primary, oklch(.66 .19 50)));translate:-50% -50%;cursor:grab}cngx-range-slider [cngxSliderThumb]:focus-visible{outline:var(--cngx-slider-focus-ring-width, 2px) solid var(--cngx-slider-focus-ring-color, var(--cngx-color-primary, oklch(.66 .19 50)));outline-offset:2px}cngx-range-slider .cngx-slider__ticks{position:absolute;inset-inline:0;inset-block-start:calc(100% + .35rem);block-size:1em;pointer-events:none}cngx-range-slider .cngx-slider__tick-label{position:absolute;inset-inline-start:calc(var(--cngx-slider-tick-fraction, 0) * 100%);translate:-50% 0;font-size:var(--cngx-slider-tick-font-size, .6875rem);font-variant-numeric:tabular-nums;color:var(--cngx-slider-tick-label-color, var(--cngx-color-text-muted, oklch(.55 .01 250)));white-space:nowrap}cngx-range-slider[aria-orientation=vertical] .cngx-slider__ticks{inset-inline:auto;inset-block:0;inset-inline-start:calc(100% + .35rem);inline-size:3ch;block-size:auto}cngx-range-slider[aria-orientation=vertical] .cngx-slider__tick-label{inset-inline-start:auto;inset-inline-end:0;inset-block-start:calc(100% - var(--cngx-slider-tick-fraction, 0) * 100%);text-align:end;translate:0 -50%}cngx-range-slider .cngx-slider__value--range{position:absolute;inset-block-end:calc(100% + var(--cngx-slider-value-gap, .25rem));inset-inline-start:calc(var(--cngx-slider-mid-fraction, .5) * 100%);translate:-50% 0;font-size:var(--cngx-font-size-sm, .8125rem);font-variant-numeric:tabular-nums;color:var(--cngx-color-text, oklch(.2 .01 250));pointer-events:none;white-space:nowrap;unicode-bidi:var(--cngx-slider-range-bidi, isolate);direction:var(--cngx-slider-range-direction, ltr)}cngx-range-slider .cngx-slider__value--range.cngx-slider__bubble{inset-block-end:calc(100% + var(--cngx-slider-bubble-gap, .5rem));padding:var(--cngx-slider-bubble-padding, .125rem .4rem);border-radius:var(--cngx-radius-sm, .25rem);background:var(--cngx-slider-bubble-bg, var(--cngx-color-primary, oklch(.66 .19 50)));color:var(--cngx-slider-bubble-color, var(--cngx-color-on-primary, oklch(.99 .01 250)));opacity:0;transition:opacity .12s ease}cngx-range-slider:focus-within .cngx-slider__bubble,cngx-range-slider:active .cngx-slider__bubble{opacity:1}cngx-range-slider[aria-orientation=vertical]{flex-direction:column;inline-size:max-content;min-inline-size:var(--cngx-slider-thumb-size, 16px);block-size:var(--cngx-slider-length, 9rem);min-block-size:0}cngx-range-slider[aria-orientation=vertical] .cngx-slider__track{flex:1 1 auto;inline-size:var(--cngx-slider-track-size, 4px);block-size:auto;background:linear-gradient(to top,var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) 0,var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) calc(var(--cngx-slider-start-fraction, 0) * 100%),var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50))) calc(var(--cngx-slider-start-fraction, 0) * 100%),var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50))) calc(var(--cngx-slider-end-fraction, 1) * 100%),var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) calc(var(--cngx-slider-end-fraction, 1) * 100%))}cngx-range-slider[aria-orientation=vertical].cngx-slider--ticks .cngx-slider__track:before{background-image:repeating-linear-gradient(to top,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) 0,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-interval, 10%))}cngx-range-slider[aria-orientation=vertical] [cngxSliderThumb]{inset-inline-start:50%;inset-block-start:auto;inset-block-end:calc(var(--cngx-slider-fraction, 0) * 100%);translate:-50% 50%}cngx-range-slider[aria-orientation=vertical] .cngx-slider__value--range{inset-block-end:auto;inset-block-start:calc(100% - var(--cngx-slider-mid-fraction, .5) * 100%);inset-inline-start:calc(100% + .5rem);translate:0 -50%}\n"], dependencies: [{ kind: "directive", type: CngxSliderThumb, selector: "[cngxSliderThumb]", inputs: ["cngxSliderThumb"], exportAs: ["cngxSliderThumb"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2407
2565
|
}
|
|
2408
2566
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxRangeSlider, decorators: [{
|
|
2409
2567
|
type: Component,
|
|
2410
2568
|
args: [{ selector: 'cngx-range-slider', exportAs: 'cngxRangeSlider', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [CngxSliderThumb, NgTemplateOutlet], hostDirectives: [
|
|
2411
2569
|
{
|
|
2412
2570
|
directive: CngxRangeSliderTrack,
|
|
2413
|
-
inputs: [
|
|
2571
|
+
inputs: [
|
|
2572
|
+
'value',
|
|
2573
|
+
'min',
|
|
2574
|
+
'max',
|
|
2575
|
+
'step',
|
|
2576
|
+
'largeStep',
|
|
2577
|
+
'disabled',
|
|
2578
|
+
'disabledReason',
|
|
2579
|
+
'cngxDescribedBy',
|
|
2580
|
+
'orientation',
|
|
2581
|
+
'valueText',
|
|
2582
|
+
],
|
|
2414
2583
|
outputs: ['valueChange'],
|
|
2415
2584
|
},
|
|
2416
2585
|
], host: {
|
|
@@ -2449,7 +2618,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2449
2618
|
{{ format(brain.value()[0]) }} - {{ format(brain.value()[1]) }}
|
|
2450
2619
|
</span>
|
|
2451
2620
|
}
|
|
2452
|
-
`, styles: ["cngx-range-slider{position:relative;display:flex;align-items:center;box-sizing:border-box;inline-size:100%;min-block-size:var(--cngx-slider-thumb-size, 16px);cursor:pointer;touch-action:none}cngx-range-slider[aria-disabled=true]{opacity:.5;cursor:not-allowed}cngx-range-slider .cngx-slider__track{position:relative;flex:1 1 auto;block-size:var(--cngx-slider-track-size, 4px);border-radius:999px;background:linear-gradient(to right,var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) 0,var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) calc(var(--cngx-slider-start-fraction, 0) * 100%),var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50))) calc(var(--cngx-slider-start-fraction, 0) * 100%),var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50))) calc(var(--cngx-slider-end-fraction, 1) * 100%),var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) calc(var(--cngx-slider-end-fraction, 1) * 100%))}cngx-range-slider.cngx-slider--ticks .cngx-slider__track:before{content:\"\";position:absolute;inset:0;border-radius:inherit;background-image:repeating-linear-gradient(to right,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) 0,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-interval, 10%))}cngx-range-slider [cngxSliderThumb]{position:absolute;display:grid;place-items:center;inset-block-start:50%;inset-inline-start:calc(var(--cngx-slider-fraction, 0) * 100%);inline-size:var(--cngx-slider-thumb-size, 16px);block-size:var(--cngx-slider-thumb-size, 16px);border-radius:50%;background:var(--cngx-slider-thumb-color, var(--cngx-color-surface, oklch(1 0 0)));border:var(--cngx-slider-thumb-border-width, 2px) solid var(--cngx-slider-thumb-border-color, var(--cngx-color-primary, oklch(.66 .19 50)));translate:-50% -50%;cursor:grab}cngx-range-slider [cngxSliderThumb]:focus-visible{outline:var(--cngx-slider-focus-ring-width, 2px) solid var(--cngx-slider-focus-ring-color, var(--cngx-color-primary, oklch(.66 .19 50)));outline-offset:2px}cngx-range-slider .cngx-slider__ticks{position:absolute;inset-inline:0;inset-block-start:calc(100% + .35rem);block-size:1em;pointer-events:none}cngx-range-slider .cngx-slider__tick-label{position:absolute;inset-inline-start:calc(var(--cngx-slider-tick-fraction, 0) * 100%);translate:-50% 0;font-size:var(--cngx-slider-tick-font-size, .6875rem);font-variant-numeric:tabular-nums;color:var(--cngx-slider-tick-label-color, var(--cngx-color-text-muted, oklch(.55 .01 250)));white-space:nowrap}cngx-range-slider[aria-orientation=vertical] .cngx-slider__ticks{inset-inline:auto;inset-block:0;inset-inline-start:calc(100% + .35rem);inline-size:3ch;block-size:auto}cngx-range-slider[aria-orientation=vertical] .cngx-slider__tick-label{inset-inline-start:auto;inset-inline-end:0;inset-block-start:calc(100% - var(--cngx-slider-tick-fraction, 0) * 100%);text-align:end;translate:0 -50%}cngx-range-slider .cngx-slider__value--range{position:absolute;inset-block-end:calc(100% + var(--cngx-slider-value-gap, .25rem));inset-inline-start:calc(var(--cngx-slider-mid-fraction, .5) * 100%);translate:-50% 0;font-size:var(--cngx-font-size-sm, .8125rem);font-variant-numeric:tabular-nums;color:var(--cngx-color-text, oklch(.2 .01 250));pointer-events:none;white-space:nowrap}cngx-range-slider .cngx-slider__value--range.cngx-slider__bubble{inset-block-end:calc(100% + var(--cngx-slider-bubble-gap, .5rem));padding:var(--cngx-slider-bubble-padding, .125rem .4rem);border-radius:var(--cngx-radius-sm, .25rem);background:var(--cngx-slider-bubble-bg, var(--cngx-color-primary, oklch(.66 .19 50)));color:var(--cngx-slider-bubble-color, var(--cngx-color-on-primary, oklch(.99 .01 250)));opacity:0;transition:opacity .12s ease}cngx-range-slider:focus-within .cngx-slider__bubble,cngx-range-slider:active .cngx-slider__bubble{opacity:1}cngx-range-slider[aria-orientation=vertical]{flex-direction:column;inline-size:max-content;min-inline-size:var(--cngx-slider-thumb-size, 16px);block-size:var(--cngx-slider-length, 9rem);min-block-size:0}cngx-range-slider[aria-orientation=vertical] .cngx-slider__track{flex:1 1 auto;inline-size:var(--cngx-slider-track-size, 4px);block-size:auto;background:linear-gradient(to top,var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) 0,var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) calc(var(--cngx-slider-start-fraction, 0) * 100%),var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50))) calc(var(--cngx-slider-start-fraction, 0) * 100%),var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50))) calc(var(--cngx-slider-end-fraction, 1) * 100%),var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) calc(var(--cngx-slider-end-fraction, 1) * 100%))}cngx-range-slider[aria-orientation=vertical].cngx-slider--ticks .cngx-slider__track:before{background-image:repeating-linear-gradient(to top,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) 0,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-interval, 10%))}cngx-range-slider[aria-orientation=vertical] [cngxSliderThumb]{inset-inline-start:50%;inset-block-start:auto;inset-block-end:calc(var(--cngx-slider-fraction, 0) * 100%);translate:-50% 50%}cngx-range-slider[aria-orientation=vertical] .cngx-slider__value--range{inset-block-end:auto;inset-block-start:calc(100% - var(--cngx-slider-mid-fraction, .5) * 100%);inset-inline-start:calc(100% + .5rem);translate:0 -50%}\n"] }]
|
|
2621
|
+
`, styles: ["cngx-range-slider{--cngx-slider-value-gap: var(--cngx-space-xs, .25rem);--cngx-slider-bubble-gap: var(--cngx-space-sm, .5rem);--cngx-slider-bubble-padding: var(--cngx-space-xs, .125rem) var(--cngx-space-sm, .4rem);position:relative;display:flex;align-items:center;box-sizing:border-box;inline-size:100%;min-block-size:var(--cngx-slider-thumb-size, 16px);cursor:pointer;touch-action:none}cngx-range-slider[aria-disabled=true]{opacity:.5;cursor:not-allowed}cngx-range-slider .cngx-slider__track{position:relative;flex:1 1 auto;block-size:var(--cngx-slider-track-size, 4px);border-radius:999px;background:linear-gradient(to right,var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) 0,var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) calc(var(--cngx-slider-start-fraction, 0) * 100%),var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50))) calc(var(--cngx-slider-start-fraction, 0) * 100%),var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50))) calc(var(--cngx-slider-end-fraction, 1) * 100%),var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) calc(var(--cngx-slider-end-fraction, 1) * 100%))}cngx-range-slider.cngx-slider--ticks .cngx-slider__track:before{content:\"\";position:absolute;inset:0;border-radius:inherit;background-image:repeating-linear-gradient(to right,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) 0,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-interval, 10%))}cngx-range-slider [cngxSliderThumb]{position:absolute;display:grid;place-items:center;inset-block-start:50%;inset-inline-start:calc(var(--cngx-slider-fraction, 0) * 100%);inline-size:var(--cngx-slider-thumb-size, 16px);block-size:var(--cngx-slider-thumb-size, 16px);border-radius:50%;background:var(--cngx-slider-thumb-color, var(--cngx-color-surface, oklch(1 0 0)));border:var(--cngx-slider-thumb-border-width, 2px) solid var(--cngx-slider-thumb-border-color, var(--cngx-color-primary, oklch(.66 .19 50)));translate:-50% -50%;cursor:grab}cngx-range-slider [cngxSliderThumb]:focus-visible{outline:var(--cngx-slider-focus-ring-width, 2px) solid var(--cngx-slider-focus-ring-color, var(--cngx-color-primary, oklch(.66 .19 50)));outline-offset:2px}cngx-range-slider .cngx-slider__ticks{position:absolute;inset-inline:0;inset-block-start:calc(100% + .35rem);block-size:1em;pointer-events:none}cngx-range-slider .cngx-slider__tick-label{position:absolute;inset-inline-start:calc(var(--cngx-slider-tick-fraction, 0) * 100%);translate:-50% 0;font-size:var(--cngx-slider-tick-font-size, .6875rem);font-variant-numeric:tabular-nums;color:var(--cngx-slider-tick-label-color, var(--cngx-color-text-muted, oklch(.55 .01 250)));white-space:nowrap}cngx-range-slider[aria-orientation=vertical] .cngx-slider__ticks{inset-inline:auto;inset-block:0;inset-inline-start:calc(100% + .35rem);inline-size:3ch;block-size:auto}cngx-range-slider[aria-orientation=vertical] .cngx-slider__tick-label{inset-inline-start:auto;inset-inline-end:0;inset-block-start:calc(100% - var(--cngx-slider-tick-fraction, 0) * 100%);text-align:end;translate:0 -50%}cngx-range-slider .cngx-slider__value--range{position:absolute;inset-block-end:calc(100% + var(--cngx-slider-value-gap, .25rem));inset-inline-start:calc(var(--cngx-slider-mid-fraction, .5) * 100%);translate:-50% 0;font-size:var(--cngx-font-size-sm, .8125rem);font-variant-numeric:tabular-nums;color:var(--cngx-color-text, oklch(.2 .01 250));pointer-events:none;white-space:nowrap;unicode-bidi:var(--cngx-slider-range-bidi, isolate);direction:var(--cngx-slider-range-direction, ltr)}cngx-range-slider .cngx-slider__value--range.cngx-slider__bubble{inset-block-end:calc(100% + var(--cngx-slider-bubble-gap, .5rem));padding:var(--cngx-slider-bubble-padding, .125rem .4rem);border-radius:var(--cngx-radius-sm, .25rem);background:var(--cngx-slider-bubble-bg, var(--cngx-color-primary, oklch(.66 .19 50)));color:var(--cngx-slider-bubble-color, var(--cngx-color-on-primary, oklch(.99 .01 250)));opacity:0;transition:opacity .12s ease}cngx-range-slider:focus-within .cngx-slider__bubble,cngx-range-slider:active .cngx-slider__bubble{opacity:1}cngx-range-slider[aria-orientation=vertical]{flex-direction:column;inline-size:max-content;min-inline-size:var(--cngx-slider-thumb-size, 16px);block-size:var(--cngx-slider-length, 9rem);min-block-size:0}cngx-range-slider[aria-orientation=vertical] .cngx-slider__track{flex:1 1 auto;inline-size:var(--cngx-slider-track-size, 4px);block-size:auto;background:linear-gradient(to top,var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) 0,var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) calc(var(--cngx-slider-start-fraction, 0) * 100%),var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50))) calc(var(--cngx-slider-start-fraction, 0) * 100%),var(--cngx-slider-fill-color, var(--cngx-color-primary, oklch(.66 .19 50))) calc(var(--cngx-slider-end-fraction, 1) * 100%),var(--cngx-slider-track-color, var(--cngx-color-border, oklch(.88 .005 250))) calc(var(--cngx-slider-end-fraction, 1) * 100%))}cngx-range-slider[aria-orientation=vertical].cngx-slider--ticks .cngx-slider__track:before{background-image:repeating-linear-gradient(to top,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) 0,var(--cngx-slider-tick-color, var(--cngx-color-border, oklch(.7 .01 250))) var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-width, 1px),transparent var(--cngx-slider-tick-interval, 10%))}cngx-range-slider[aria-orientation=vertical] [cngxSliderThumb]{inset-inline-start:50%;inset-block-start:auto;inset-block-end:calc(var(--cngx-slider-fraction, 0) * 100%);translate:-50% 50%}cngx-range-slider[aria-orientation=vertical] .cngx-slider__value--range{inset-block-end:auto;inset-block-start:calc(100% - var(--cngx-slider-mid-fraction, .5) * 100%);inset-inline-start:calc(100% + .5rem);translate:0 -50%}\n"] }]
|
|
2453
2622
|
}], propDecorators: { startLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "startLabel", required: false }] }], endLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "endLabel", required: false }] }], showValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "showValue", required: false }] }], showValueBubble: [{ type: i0.Input, args: [{ isSignal: true, alias: "showValueBubble", required: false }] }], showTicks: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTicks", required: false }] }], showTickLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTickLabels", required: false }] }], thumbGlyph: [{ type: i0.Input, args: [{ isSignal: true, alias: "thumbGlyph", required: false }] }] } });
|
|
2454
2623
|
|
|
2455
2624
|
/**
|
|
@@ -3090,11 +3259,13 @@ const CNGX_ERROR_AGGREGATOR = new InjectionToken('CngxErrorAggregator');
|
|
|
3090
3259
|
* one direction.
|
|
3091
3260
|
*
|
|
3092
3261
|
* `disabledReason` is consumer-supplied free text (no library default
|
|
3093
|
-
* per `feedback_en_default_locale`)
|
|
3094
|
-
*
|
|
3095
|
-
*
|
|
3096
|
-
*
|
|
3097
|
-
*
|
|
3262
|
+
* per `feedback_en_default_locale`). Per Pillar 2 the description span is
|
|
3263
|
+
* always in the DOM, but both its `aria-hidden` and the host's
|
|
3264
|
+
* `aria-describedby` reference are gated on `disabled() && disabledReason()`,
|
|
3265
|
+
* so a reason set on an enabled control announces nothing and stays out of
|
|
3266
|
+
* reading order. Gating the reference alone is not enough: accname 1.2 §2A
|
|
3267
|
+
* traverses a directly-referenced hidden node, so the span's visibility must
|
|
3268
|
+
* track the same condition as the reference.
|
|
3098
3269
|
*
|
|
3099
3270
|
* Typical usage prefers the `<div>`/`<cngx-toggle>` element form because
|
|
3100
3271
|
* `role="switch"` on a native `<button>` would conflict with the
|
|
@@ -3160,7 +3331,7 @@ class CngxToggle {
|
|
|
3160
3331
|
thumbGlyph = input(null, ...(ngDevMode ? [{ debugName: "thumbGlyph" }] : /* istanbul ignore next */ []));
|
|
3161
3332
|
describedId = nextUid('cngx-toggle-desc');
|
|
3162
3333
|
labelId = nextUid('cngx-toggle-label');
|
|
3163
|
-
describedById = computed(() => this.disabledReason() ? this.describedId : null, ...(ngDevMode ? [{ debugName: "describedById" }] : /* istanbul ignore next */ []));
|
|
3334
|
+
describedById = computed(() => this.disabled() && this.disabledReason() ? this.describedId : null, ...(ngDevMode ? [{ debugName: "describedById" }] : /* istanbul ignore next */ []));
|
|
3164
3335
|
labelRef = viewChild('label', ...(ngDevMode ? [{ debugName: "labelRef" }] : /* istanbul ignore next */ []));
|
|
3165
3336
|
hasProjectedLabelState = signal(false, ...(ngDevMode ? [{ debugName: "hasProjectedLabelState" }] : /* istanbul ignore next */ []));
|
|
3166
3337
|
/**
|
|
@@ -3242,10 +3413,10 @@ class CngxToggle {
|
|
|
3242
3413
|
<span
|
|
3243
3414
|
[id]="describedId"
|
|
3244
3415
|
class="cngx-toggle__sr-only"
|
|
3245
|
-
[attr.aria-hidden]="disabledReason() ? null : 'true'"
|
|
3416
|
+
[attr.aria-hidden]="disabled() && disabledReason() ? null : 'true'"
|
|
3246
3417
|
>{{ disabledReason() }}</span
|
|
3247
3418
|
>
|
|
3248
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-toggle-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}@property --cngx-toggle-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-toggle-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-toggle-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid currentColor;}@property --cngx-toggle-focus-offset{syntax: \"*\"; inherits: false; initial-value: 2px;}@property --cngx-toggle-focus-radius{syntax: \"*\"; inherits: false; initial-value: .25rem;}@property --cngx-toggle-transition{syntax: \"*\"; inherits: false; initial-value: .15s ease;}@property --cngx-toggle-track-width{syntax: \"*\"; inherits: false; initial-value: 2.25rem;}@property --cngx-toggle-track-height{syntax: \"*\"; inherits: false; initial-value: 1.25rem;}@property --cngx-toggle-track-radius{syntax: \"<length>\"; inherits: false; initial-value: 9999px;}@property --cngx-toggle-track-bg-off{syntax: \"<color>\"; inherits: true; initial-value: oklch(0 0 0 / .25);}@property --cngx-toggle-track-bg-on{syntax: \"<color>\"; inherits: false; initial-value: oklch(.66 .19 50);}@property --cngx-toggle-thumb-inset{syntax: \"*\"; inherits: true; initial-value: .125rem;}@property --cngx-toggle-thumb-size{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-toggle-thumb-travel{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-toggle-thumb-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(1 0 0);}@property --cngx-toggle-thumb-shadow{syntax: \"*\"; inherits: false; initial-value: 0 1px 2px oklch(0 0 0 / .25);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-toggle-track-bg-off: oklch(1 0 0 / .25)}}[data-color-scheme=dark],.dark{--cngx-toggle-track-bg-off: oklch(1 0 0 / .25)}[data-color-scheme=light],.light{--cngx-toggle-track-bg-off: oklch(0 0 0 / .25)}}@layer cngx.components{@scope(.cngx-toggle){:scope{--cngx-toggle-gap: var(--cngx-space-sm);--cngx-toggle-thumb-inset: var(--cngx-
|
|
3419
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-toggle-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}@property --cngx-toggle-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-toggle-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-toggle-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid currentColor;}@property --cngx-toggle-focus-offset{syntax: \"*\"; inherits: false; initial-value: 2px;}@property --cngx-toggle-focus-radius{syntax: \"*\"; inherits: false; initial-value: .25rem;}@property --cngx-toggle-transition{syntax: \"*\"; inherits: false; initial-value: .15s ease;}@property --cngx-toggle-track-width{syntax: \"*\"; inherits: false; initial-value: 2.25rem;}@property --cngx-toggle-track-height{syntax: \"*\"; inherits: false; initial-value: 1.25rem;}@property --cngx-toggle-track-radius{syntax: \"<length>\"; inherits: false; initial-value: 9999px;}@property --cngx-toggle-track-bg-off{syntax: \"<color>\"; inherits: true; initial-value: oklch(0 0 0 / .25);}@property --cngx-toggle-track-bg-on{syntax: \"<color>\"; inherits: false; initial-value: oklch(.66 .19 50);}@property --cngx-toggle-thumb-inset{syntax: \"*\"; inherits: true; initial-value: .125rem;}@property --cngx-toggle-thumb-size{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-toggle-thumb-travel{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-toggle-thumb-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(1 0 0);}@property --cngx-toggle-thumb-shadow{syntax: \"*\"; inherits: false; initial-value: 0 1px 2px oklch(0 0 0 / .25);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-toggle-track-bg-off: oklch(1 0 0 / .25)}}[data-color-scheme=dark],.dark{--cngx-toggle-track-bg-off: oklch(1 0 0 / .25)}[data-color-scheme=light],.light{--cngx-toggle-track-bg-off: oklch(0 0 0 / .25)}}@layer cngx.components{@scope(.cngx-toggle){:scope{--cngx-toggle-gap: var(--cngx-space-sm);--cngx-toggle-thumb-inset: calc( (var(--cngx-toggle-track-height) - var(--cngx-toggle-thumb-size)) / 2 );display:inline-flex;align-items:center;gap:var(--cngx-toggle-gap, var(--cngx-space-sm, .5rem));cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;font:inherit;color:var(--cngx-toggle-color, inherit);min-block-size:var(--cngx-target-min, 0px)}:scope.cngx-toggle--label-before{flex-direction:row-reverse}:scope.cngx-toggle--disabled{cursor:not-allowed;opacity:var(--cngx-toggle-disabled-opacity, .5)}:scope:focus-visible{outline:var(--cngx-toggle-focus-outline, 2px solid currentColor);outline-offset:var(--cngx-toggle-focus-offset, 2px);border-radius:var(--cngx-toggle-focus-radius, var(--cngx-radius-sm, .25rem))}.cngx-toggle__track{position:relative;flex:0 0 auto;inline-size:var(--cngx-toggle-track-width, 2.25rem);block-size:var(--cngx-toggle-track-height, 1.25rem);border-radius:var(--cngx-toggle-track-radius, var(--cngx-radius-pill, 9999px));background:var(--cngx-toggle-track-bg-off, oklch(0 0 0 / .25));transition:background-color var(--cngx-toggle-transition, .15s ease)}:scope.cngx-toggle--checked .cngx-toggle__track{background:var(--cngx-toggle-track-bg-on, var(--cngx-color-primary, oklch(.66 .19 50)))}.cngx-toggle__thumb{position:absolute;inset-block-start:var(--cngx-toggle-thumb-inset, .125rem);inset-inline-start:var(--cngx-toggle-thumb-inset, .125rem);inline-size:var(--cngx-toggle-thumb-size, 1rem);block-size:var(--cngx-toggle-thumb-size, 1rem);display:inline-flex;align-items:center;justify-content:center;line-height:1;border-radius:50%;background:var(--cngx-toggle-thumb-bg, oklch(1 0 0));box-shadow:var(--cngx-toggle-thumb-shadow, 0 1px 2px oklch(0 0 0 / .25));transition:transform var(--cngx-toggle-transition, .15s ease)}.cngx-toggle__thumb:has(*){background:transparent;box-shadow:none;font-size:var(--cngx-toggle-thumb-size, 1rem);color:var(--cngx-toggle-thumb-bg, oklch(1 0 0))}:scope.cngx-toggle--checked .cngx-toggle__thumb{transform:translate(var(--cngx-toggle-thumb-travel, 1rem))}.cngx-toggle__label{flex:0 1 auto;min-inline-size:0}.cngx-toggle__sr-only{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media(prefers-reduced-motion:reduce){.cngx-toggle__track,.cngx-toggle__thumb{transition:none}}}}@media(forced-colors:active){.cngx-toggle__track{border:1px solid ButtonBorder}.cngx-toggle__thumb{border:1px solid ButtonText}.cngx-toggle.cngx-toggle--checked .cngx-toggle__track{background:Highlight!important}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3249
3420
|
}
|
|
3250
3421
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxToggle, decorators: [{
|
|
3251
3422
|
type: Component,
|
|
@@ -3285,10 +3456,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
3285
3456
|
<span
|
|
3286
3457
|
[id]="describedId"
|
|
3287
3458
|
class="cngx-toggle__sr-only"
|
|
3288
|
-
[attr.aria-hidden]="disabledReason() ? null : 'true'"
|
|
3459
|
+
[attr.aria-hidden]="disabled() && disabledReason() ? null : 'true'"
|
|
3289
3460
|
>{{ disabledReason() }}</span
|
|
3290
3461
|
>
|
|
3291
|
-
`, encapsulation: ViewEncapsulation.None, styles: ["@layer cngx.tokens{@property --cngx-toggle-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}@property --cngx-toggle-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-toggle-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-toggle-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid currentColor;}@property --cngx-toggle-focus-offset{syntax: \"*\"; inherits: false; initial-value: 2px;}@property --cngx-toggle-focus-radius{syntax: \"*\"; inherits: false; initial-value: .25rem;}@property --cngx-toggle-transition{syntax: \"*\"; inherits: false; initial-value: .15s ease;}@property --cngx-toggle-track-width{syntax: \"*\"; inherits: false; initial-value: 2.25rem;}@property --cngx-toggle-track-height{syntax: \"*\"; inherits: false; initial-value: 1.25rem;}@property --cngx-toggle-track-radius{syntax: \"<length>\"; inherits: false; initial-value: 9999px;}@property --cngx-toggle-track-bg-off{syntax: \"<color>\"; inherits: true; initial-value: oklch(0 0 0 / .25);}@property --cngx-toggle-track-bg-on{syntax: \"<color>\"; inherits: false; initial-value: oklch(.66 .19 50);}@property --cngx-toggle-thumb-inset{syntax: \"*\"; inherits: true; initial-value: .125rem;}@property --cngx-toggle-thumb-size{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-toggle-thumb-travel{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-toggle-thumb-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(1 0 0);}@property --cngx-toggle-thumb-shadow{syntax: \"*\"; inherits: false; initial-value: 0 1px 2px oklch(0 0 0 / .25);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-toggle-track-bg-off: oklch(1 0 0 / .25)}}[data-color-scheme=dark],.dark{--cngx-toggle-track-bg-off: oklch(1 0 0 / .25)}[data-color-scheme=light],.light{--cngx-toggle-track-bg-off: oklch(0 0 0 / .25)}}@layer cngx.components{@scope(.cngx-toggle){:scope{--cngx-toggle-gap: var(--cngx-space-sm);--cngx-toggle-thumb-inset: var(--cngx-
|
|
3462
|
+
`, encapsulation: ViewEncapsulation.None, styles: ["@layer cngx.tokens{@property --cngx-toggle-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}@property --cngx-toggle-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-toggle-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-toggle-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid currentColor;}@property --cngx-toggle-focus-offset{syntax: \"*\"; inherits: false; initial-value: 2px;}@property --cngx-toggle-focus-radius{syntax: \"*\"; inherits: false; initial-value: .25rem;}@property --cngx-toggle-transition{syntax: \"*\"; inherits: false; initial-value: .15s ease;}@property --cngx-toggle-track-width{syntax: \"*\"; inherits: false; initial-value: 2.25rem;}@property --cngx-toggle-track-height{syntax: \"*\"; inherits: false; initial-value: 1.25rem;}@property --cngx-toggle-track-radius{syntax: \"<length>\"; inherits: false; initial-value: 9999px;}@property --cngx-toggle-track-bg-off{syntax: \"<color>\"; inherits: true; initial-value: oklch(0 0 0 / .25);}@property --cngx-toggle-track-bg-on{syntax: \"<color>\"; inherits: false; initial-value: oklch(.66 .19 50);}@property --cngx-toggle-thumb-inset{syntax: \"*\"; inherits: true; initial-value: .125rem;}@property --cngx-toggle-thumb-size{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-toggle-thumb-travel{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-toggle-thumb-bg{syntax: \"<color>\"; inherits: false; initial-value: oklch(1 0 0);}@property --cngx-toggle-thumb-shadow{syntax: \"*\"; inherits: false; initial-value: 0 1px 2px oklch(0 0 0 / .25);}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-toggle-track-bg-off: oklch(1 0 0 / .25)}}[data-color-scheme=dark],.dark{--cngx-toggle-track-bg-off: oklch(1 0 0 / .25)}[data-color-scheme=light],.light{--cngx-toggle-track-bg-off: oklch(0 0 0 / .25)}}@layer cngx.components{@scope(.cngx-toggle){:scope{--cngx-toggle-gap: var(--cngx-space-sm);--cngx-toggle-thumb-inset: calc( (var(--cngx-toggle-track-height) - var(--cngx-toggle-thumb-size)) / 2 );display:inline-flex;align-items:center;gap:var(--cngx-toggle-gap, var(--cngx-space-sm, .5rem));cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;font:inherit;color:var(--cngx-toggle-color, inherit);min-block-size:var(--cngx-target-min, 0px)}:scope.cngx-toggle--label-before{flex-direction:row-reverse}:scope.cngx-toggle--disabled{cursor:not-allowed;opacity:var(--cngx-toggle-disabled-opacity, .5)}:scope:focus-visible{outline:var(--cngx-toggle-focus-outline, 2px solid currentColor);outline-offset:var(--cngx-toggle-focus-offset, 2px);border-radius:var(--cngx-toggle-focus-radius, var(--cngx-radius-sm, .25rem))}.cngx-toggle__track{position:relative;flex:0 0 auto;inline-size:var(--cngx-toggle-track-width, 2.25rem);block-size:var(--cngx-toggle-track-height, 1.25rem);border-radius:var(--cngx-toggle-track-radius, var(--cngx-radius-pill, 9999px));background:var(--cngx-toggle-track-bg-off, oklch(0 0 0 / .25));transition:background-color var(--cngx-toggle-transition, .15s ease)}:scope.cngx-toggle--checked .cngx-toggle__track{background:var(--cngx-toggle-track-bg-on, var(--cngx-color-primary, oklch(.66 .19 50)))}.cngx-toggle__thumb{position:absolute;inset-block-start:var(--cngx-toggle-thumb-inset, .125rem);inset-inline-start:var(--cngx-toggle-thumb-inset, .125rem);inline-size:var(--cngx-toggle-thumb-size, 1rem);block-size:var(--cngx-toggle-thumb-size, 1rem);display:inline-flex;align-items:center;justify-content:center;line-height:1;border-radius:50%;background:var(--cngx-toggle-thumb-bg, oklch(1 0 0));box-shadow:var(--cngx-toggle-thumb-shadow, 0 1px 2px oklch(0 0 0 / .25));transition:transform var(--cngx-toggle-transition, .15s ease)}.cngx-toggle__thumb:has(*){background:transparent;box-shadow:none;font-size:var(--cngx-toggle-thumb-size, 1rem);color:var(--cngx-toggle-thumb-bg, oklch(1 0 0))}:scope.cngx-toggle--checked .cngx-toggle__thumb{transform:translate(var(--cngx-toggle-thumb-travel, 1rem))}.cngx-toggle__label{flex:0 1 auto;min-inline-size:0}.cngx-toggle__sr-only{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@media(prefers-reduced-motion:reduce){.cngx-toggle__track,.cngx-toggle__thumb{transition:none}}}}@media(forced-colors:active){.cngx-toggle__track{border:1px solid ButtonBorder}.cngx-toggle__thumb{border:1px solid ButtonText}.cngx-toggle.cngx-toggle--checked .cngx-toggle__track{background:Highlight!important}}\n"] }]
|
|
3292
3463
|
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }, { type: i0.Output, args: ["invalidChange"] }], errorMessageId: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessageId", required: false }] }], disabledReason: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledReason", required: false }] }], labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }], thumbGlyph: [{ type: i0.Input, args: [{ isSignal: true, alias: "thumbGlyph", required: false }] }], labelRef: [{ type: i0.ViewChild, args: ['label', { isSignal: true }] }] } });
|
|
3293
3464
|
|
|
3294
3465
|
/**
|
|
@@ -3315,8 +3486,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
3315
3486
|
*
|
|
3316
3487
|
* `aria-checked` is a reactive computed: `indeterminate() ? 'mixed' :
|
|
3317
3488
|
* value() ? 'true' : 'false'`. The description span for
|
|
3318
|
-
* `disabledReason` follows the same always
|
|
3319
|
-
* `
|
|
3489
|
+
* `disabledReason` follows the same rule as `CngxToggle`: always in the
|
|
3490
|
+
* DOM, but both its `aria-hidden` and the host's `aria-describedby`
|
|
3491
|
+
* reference are gated on `disabled() && disabledReason()`, so a reason
|
|
3492
|
+
* set on an enabled checkbox announces nothing and stays out of reading
|
|
3493
|
+
* order.
|
|
3320
3494
|
*
|
|
3321
3495
|
* ```html
|
|
3322
3496
|
* <cngx-checkbox [(value)]="acceptTerms">I accept the terms</cngx-checkbox>
|
|
@@ -3360,7 +3534,7 @@ class CngxCheckbox {
|
|
|
3360
3534
|
* Optional id of an external error message element (e.g. a sibling
|
|
3361
3535
|
* rendered by `<cngx-form-field>` or a consumer-owned `<span>`).
|
|
3362
3536
|
* The host emits `aria-errormessage="<id>"` only when
|
|
3363
|
-
* `aria-invalid="true"`
|
|
3537
|
+
* `aria-invalid="true"` - symmetric with the sibling `aria-invalid`
|
|
3364
3538
|
* host binding (both gate on `invalid() || errorState()`). Consumers
|
|
3365
3539
|
* MUST render an element with the supplied id; passing an id without
|
|
3366
3540
|
* a matching element produces a dangling AT reference. Default
|
|
@@ -3371,6 +3545,13 @@ class CngxCheckbox {
|
|
|
3371
3545
|
checkGlyph = input(null, ...(ngDevMode ? [{ debugName: "checkGlyph" }] : /* istanbul ignore next */ []));
|
|
3372
3546
|
dashGlyph = input(null, ...(ngDevMode ? [{ debugName: "dashGlyph" }] : /* istanbul ignore next */ []));
|
|
3373
3547
|
describedId = nextUid('cngx-checkbox-desc');
|
|
3548
|
+
/**
|
|
3549
|
+
* `aria-describedby` reference, gated on `disabled() && disabledReason()`
|
|
3550
|
+
* (Toggle/Radio convergence): accname 1.2 §2A traverses a directly
|
|
3551
|
+
* referenced hidden node, so the id must only be emitted while the
|
|
3552
|
+
* description applies.
|
|
3553
|
+
*/
|
|
3554
|
+
describedById = computed(() => this.disabled() && this.disabledReason() ? this.describedId : null, ...(ngDevMode ? [{ debugName: "describedById" }] : /* istanbul ignore next */ []));
|
|
3374
3555
|
rovingParent = inject(CngxRovingTabindex, {
|
|
3375
3556
|
optional: true,
|
|
3376
3557
|
skipSelf: true,
|
|
@@ -3428,7 +3609,7 @@ class CngxCheckbox {
|
|
|
3428
3609
|
this.value.update((v) => !v);
|
|
3429
3610
|
}
|
|
3430
3611
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCheckbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3431
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxCheckbox, isStandalone: true, selector: "cngx-checkbox, [cngxCheckbox]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, errorMessageId: { classPropertyName: "errorMessageId", publicName: "errorMessageId", isSignal: true, isRequired: false, transformFunction: null }, disabledReason: { classPropertyName: "disabledReason", publicName: "disabledReason", isSignal: true, isRequired: false, transformFunction: null }, checkGlyph: { classPropertyName: "checkGlyph", publicName: "checkGlyph", isSignal: true, isRequired: false, transformFunction: null }, dashGlyph: { classPropertyName: "dashGlyph", publicName: "dashGlyph", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", indeterminate: "indeterminateChange", disabled: "disabledChange", invalid: "invalidChange" }, host: { attributes: { "role": "checkbox" }, listeners: { "click": "handleClick()", "keydown.space": "handleKeydown($event)", "keydown.enter": "handleKeydown($event)", "focusin": "handleFocusIn()", "focusout": "handleFocusOut()" }, properties: { "attr.id": "id()", "attr.aria-checked": "ariaChecked()", "attr.aria-disabled": "disabled() ? \"true\" : null", "attr.aria-invalid": "ariaInvalid() ? \"true\" : null", "attr.aria-errormessage": "ariaInvalid() ? errorMessageId() : null", "attr.aria-describedby": "
|
|
3612
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxCheckbox, isStandalone: true, selector: "cngx-checkbox, [cngxCheckbox]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, errorMessageId: { classPropertyName: "errorMessageId", publicName: "errorMessageId", isSignal: true, isRequired: false, transformFunction: null }, disabledReason: { classPropertyName: "disabledReason", publicName: "disabledReason", isSignal: true, isRequired: false, transformFunction: null }, checkGlyph: { classPropertyName: "checkGlyph", publicName: "checkGlyph", isSignal: true, isRequired: false, transformFunction: null }, dashGlyph: { classPropertyName: "dashGlyph", publicName: "dashGlyph", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", indeterminate: "indeterminateChange", disabled: "disabledChange", invalid: "invalidChange" }, host: { attributes: { "role": "checkbox" }, listeners: { "click": "handleClick()", "keydown.space": "handleKeydown($event)", "keydown.enter": "handleKeydown($event)", "focusin": "handleFocusIn()", "focusout": "handleFocusOut()" }, properties: { "attr.id": "id()", "attr.aria-checked": "ariaChecked()", "attr.aria-disabled": "disabled() ? \"true\" : null", "attr.aria-invalid": "ariaInvalid() ? \"true\" : null", "attr.aria-errormessage": "ariaInvalid() ? errorMessageId() : null", "attr.aria-describedby": "describedById()", "attr.tabindex": "hostTabindex()", "class.cngx-checkbox--checked": "value()", "class.cngx-checkbox--indeterminate": "indeterminate()", "class.cngx-checkbox--disabled": "disabled()" }, classAttribute: "cngx-checkbox" }, providers: [
|
|
3432
3613
|
{ provide: CNGX_CONTROL_VALUE, useExisting: CngxCheckbox },
|
|
3433
3614
|
{ provide: CNGX_FORM_FIELD_CONTROL, useExisting: CngxCheckbox },
|
|
3434
3615
|
], exportAs: ["cngxCheckbox"], hostDirectives: [{ directive: i1.CngxRovingItem, inputs: ["cngxRovingItemDisabled", "disabled"] }], ngImport: i0, template: `
|
|
@@ -3446,10 +3627,10 @@ class CngxCheckbox {
|
|
|
3446
3627
|
<span
|
|
3447
3628
|
[id]="describedId"
|
|
3448
3629
|
class="cngx-checkbox__sr-only"
|
|
3449
|
-
[attr.aria-hidden]="disabledReason() ? null : 'true'"
|
|
3630
|
+
[attr.aria-hidden]="disabled() && disabledReason() ? null : 'true'"
|
|
3450
3631
|
>{{ disabledReason() }}</span
|
|
3451
3632
|
>
|
|
3452
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-checkbox-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}@property --cngx-checkbox-sibling-gap{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-checkbox-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid currentColor;}@property --cngx-checkbox-focus-offset{syntax: \"*\"; inherits: false; initial-value: 2px;}@property --cngx-checkbox-focus-radius{syntax: \"*\"; inherits: false; initial-value: .25rem;}}@layer cngx.components{@scope(.cngx-checkbox){:scope{--cngx-checkbox-gap: var(--cngx-space-sm);--cngx-checkbox-sibling-gap: var(--cngx-space-md);display:inline-flex;align-items:center;gap:var(--cngx-checkbox-gap, var(--cngx-space-sm, .5rem));cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;font:inherit;color:var(--cngx-checkbox-color, inherit);vertical-align:middle}:scope.cngx-checkbox--disabled{cursor:not-allowed;opacity:var(--cngx-checkbox-disabled-opacity, .5)}:scope:focus-visible{outline:var(--cngx-checkbox-focus-outline, 2px solid currentColor);outline-offset:var(--cngx-checkbox-focus-offset, 2px);border-radius:var(--cngx-checkbox-focus-radius, var(--cngx-radius-sm, .25rem))}.cngx-checkbox__label{flex:0 1 auto;min-inline-size:0}.cngx-checkbox__sr-only{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}}.cngx-checkbox+.cngx-checkbox{margin-inline-start:var(--cngx-checkbox-sibling-gap, 1rem)}}\n"], dependencies: [{ kind: "component", type: CngxCheckboxIndicator, selector: "cngx-checkbox-indicator", inputs: ["variant", "checked", "indeterminate", "disabled", "size", "checkGlyph", "dashGlyph"], exportAs: ["cngxCheckboxIndicator"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3633
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-checkbox-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}@property --cngx-checkbox-sibling-gap{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-checkbox-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid currentColor;}@property --cngx-checkbox-focus-offset{syntax: \"*\"; inherits: false; initial-value: 2px;}@property --cngx-checkbox-focus-radius{syntax: \"*\"; inherits: false; initial-value: .25rem;}}@layer cngx.components{@scope(.cngx-checkbox){:scope{--cngx-checkbox-gap: var(--cngx-space-sm);--cngx-checkbox-sibling-gap: var(--cngx-space-md);display:inline-flex;align-items:center;gap:var(--cngx-checkbox-gap, var(--cngx-space-sm, .5rem));cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;font:inherit;color:var(--cngx-checkbox-color, inherit);min-block-size:var(--cngx-target-min, 0px);min-inline-size:var(--cngx-target-min, 0px);vertical-align:middle}:scope.cngx-checkbox--disabled{cursor:not-allowed;opacity:var(--cngx-checkbox-disabled-opacity, .5)}:scope:focus-visible{outline:var(--cngx-checkbox-focus-outline, 2px solid currentColor);outline-offset:var(--cngx-checkbox-focus-offset, 2px);border-radius:var(--cngx-checkbox-focus-radius, var(--cngx-radius-sm, .25rem))}.cngx-checkbox__label{flex:0 1 auto;min-inline-size:0}.cngx-checkbox__sr-only{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}}.cngx-checkbox+.cngx-checkbox{margin-inline-start:var(--cngx-checkbox-sibling-gap, 1rem)}}\n"], dependencies: [{ kind: "component", type: CngxCheckboxIndicator, selector: "cngx-checkbox-indicator", inputs: ["variant", "checked", "indeterminate", "disabled", "size", "checkGlyph", "dashGlyph"], exportAs: ["cngxCheckboxIndicator"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3453
3634
|
}
|
|
3454
3635
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCheckbox, decorators: [{
|
|
3455
3636
|
type: Component,
|
|
@@ -3466,7 +3647,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
3466
3647
|
'[attr.aria-disabled]': 'disabled() ? "true" : null',
|
|
3467
3648
|
'[attr.aria-invalid]': 'ariaInvalid() ? "true" : null',
|
|
3468
3649
|
'[attr.aria-errormessage]': 'ariaInvalid() ? errorMessageId() : null',
|
|
3469
|
-
'[attr.aria-describedby]': '
|
|
3650
|
+
'[attr.aria-describedby]': 'describedById()',
|
|
3470
3651
|
'[attr.tabindex]': 'hostTabindex()',
|
|
3471
3652
|
'[class.cngx-checkbox--checked]': 'value()',
|
|
3472
3653
|
'[class.cngx-checkbox--indeterminate]': 'indeterminate()',
|
|
@@ -3494,10 +3675,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
3494
3675
|
<span
|
|
3495
3676
|
[id]="describedId"
|
|
3496
3677
|
class="cngx-checkbox__sr-only"
|
|
3497
|
-
[attr.aria-hidden]="disabledReason() ? null : 'true'"
|
|
3678
|
+
[attr.aria-hidden]="disabled() && disabledReason() ? null : 'true'"
|
|
3498
3679
|
>{{ disabledReason() }}</span
|
|
3499
3680
|
>
|
|
3500
|
-
`, encapsulation: ViewEncapsulation.None, styles: ["@layer cngx.tokens{@property --cngx-checkbox-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}@property --cngx-checkbox-sibling-gap{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-checkbox-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid currentColor;}@property --cngx-checkbox-focus-offset{syntax: \"*\"; inherits: false; initial-value: 2px;}@property --cngx-checkbox-focus-radius{syntax: \"*\"; inherits: false; initial-value: .25rem;}}@layer cngx.components{@scope(.cngx-checkbox){:scope{--cngx-checkbox-gap: var(--cngx-space-sm);--cngx-checkbox-sibling-gap: var(--cngx-space-md);display:inline-flex;align-items:center;gap:var(--cngx-checkbox-gap, var(--cngx-space-sm, .5rem));cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;font:inherit;color:var(--cngx-checkbox-color, inherit);vertical-align:middle}:scope.cngx-checkbox--disabled{cursor:not-allowed;opacity:var(--cngx-checkbox-disabled-opacity, .5)}:scope:focus-visible{outline:var(--cngx-checkbox-focus-outline, 2px solid currentColor);outline-offset:var(--cngx-checkbox-focus-offset, 2px);border-radius:var(--cngx-checkbox-focus-radius, var(--cngx-radius-sm, .25rem))}.cngx-checkbox__label{flex:0 1 auto;min-inline-size:0}.cngx-checkbox__sr-only{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}}.cngx-checkbox+.cngx-checkbox{margin-inline-start:var(--cngx-checkbox-sibling-gap, 1rem)}}\n"] }]
|
|
3681
|
+
`, encapsulation: ViewEncapsulation.None, styles: ["@layer cngx.tokens{@property --cngx-checkbox-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}@property --cngx-checkbox-sibling-gap{syntax: \"*\"; inherits: false; initial-value: 1rem;}@property --cngx-checkbox-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid currentColor;}@property --cngx-checkbox-focus-offset{syntax: \"*\"; inherits: false; initial-value: 2px;}@property --cngx-checkbox-focus-radius{syntax: \"*\"; inherits: false; initial-value: .25rem;}}@layer cngx.components{@scope(.cngx-checkbox){:scope{--cngx-checkbox-gap: var(--cngx-space-sm);--cngx-checkbox-sibling-gap: var(--cngx-space-md);display:inline-flex;align-items:center;gap:var(--cngx-checkbox-gap, var(--cngx-space-sm, .5rem));cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;font:inherit;color:var(--cngx-checkbox-color, inherit);min-block-size:var(--cngx-target-min, 0px);min-inline-size:var(--cngx-target-min, 0px);vertical-align:middle}:scope.cngx-checkbox--disabled{cursor:not-allowed;opacity:var(--cngx-checkbox-disabled-opacity, .5)}:scope:focus-visible{outline:var(--cngx-checkbox-focus-outline, 2px solid currentColor);outline-offset:var(--cngx-checkbox-focus-offset, 2px);border-radius:var(--cngx-checkbox-focus-radius, var(--cngx-radius-sm, .25rem))}.cngx-checkbox__label{flex:0 1 auto;min-inline-size:0}.cngx-checkbox__sr-only{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}}.cngx-checkbox+.cngx-checkbox{margin-inline-start:var(--cngx-checkbox-sibling-gap, 1rem)}}\n"] }]
|
|
3501
3682
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }, { type: i0.Output, args: ["indeterminateChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }, { type: i0.Output, args: ["invalidChange"] }], errorMessageId: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessageId", required: false }] }], disabledReason: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledReason", required: false }] }], checkGlyph: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkGlyph", required: false }] }], dashGlyph: [{ type: i0.Input, args: [{ isSignal: true, alias: "dashGlyph", required: false }] }] } });
|
|
3502
3683
|
|
|
3503
3684
|
/**
|
|
@@ -3583,7 +3764,7 @@ class CngxCheckboxGroup {
|
|
|
3583
3764
|
invalid = model(false, ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
3584
3765
|
/**
|
|
3585
3766
|
* Optional id of an external error message element. The host emits
|
|
3586
|
-
* `aria-errormessage="<id>"` only when `aria-invalid="true"`
|
|
3767
|
+
* `aria-errormessage="<id>"` only when `aria-invalid="true"` -
|
|
3587
3768
|
* symmetric with the sibling `aria-invalid` host binding (both gate
|
|
3588
3769
|
* on `invalid() || errorState()`). Consumers MUST render an element
|
|
3589
3770
|
* with the supplied id. Default `null` skips the attribute.
|
|
@@ -3705,7 +3886,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
3705
3886
|
* The leaf injects this token AND `CNGX_BUTTON_MULTI_TOGGLE_GROUP`
|
|
3706
3887
|
* with `{ optional: true }` on both; the present token determines the
|
|
3707
3888
|
* leaf's keyboard semantics + ARIA pattern (`aria-checked` for single,
|
|
3708
|
-
* `aria-
|
|
3889
|
+
* `aria-pressed` for multi), chosen at injection time, NOT at
|
|
3709
3890
|
* runtime - there is no `[selectionMode]` flag.
|
|
3710
3891
|
*
|
|
3711
3892
|
* @category common/interactive
|
|
@@ -3878,7 +4059,7 @@ const CNGX_BUTTON_MULTI_TOGGLE_GROUP = new InjectionToken('CngxButtonMultiToggle
|
|
|
3878
4059
|
* `feedback_select_family_split`). Consumers pick this component or
|
|
3879
4060
|
* `<cngx-button-toggle-group>` at template authoring time. Leaves
|
|
3880
4061
|
* (`CngxButtonToggle`) inject EITHER token with `{ optional: true }`
|
|
3881
|
-
* and choose `aria-checked` (single) vs `aria-
|
|
4062
|
+
* and choose `aria-checked` (single) vs `aria-pressed` (multi)
|
|
3882
4063
|
* AT INJECTION TIME, never at runtime.
|
|
3883
4064
|
*
|
|
3884
4065
|
* Internals lean on `createSelectionController` from
|
|
@@ -4042,8 +4223,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4042
4223
|
*
|
|
4043
4224
|
* The present token determines:
|
|
4044
4225
|
*
|
|
4045
|
-
* - the ARIA pattern
|
|
4046
|
-
*
|
|
4226
|
+
* - the ARIA pattern, bound on the host AT INJECTION TIME: a single leaf
|
|
4227
|
+
* takes `role="radio"` + `aria-checked` (radiogroup APG); a multi leaf
|
|
4228
|
+
* stays a native `role="button"` toggle with `aria-pressed` (toolbar
|
|
4229
|
+
* APG). Both `aria-checked` and the listbox `selected` state are
|
|
4230
|
+
* undefined for `role="button"` in ARIA 1.2, so the single leaf carries
|
|
4231
|
+
* the radio role that makes `aria-checked` valid rather than dropped,
|
|
4047
4232
|
* - the activation contract (single: `group.value.set(...)`; multi:
|
|
4048
4233
|
* `group.toggle(...)`),
|
|
4049
4234
|
* - whether `(focus)` consumes the parent's pending arrow-select
|
|
@@ -4105,8 +4290,12 @@ class CngxButtonToggle {
|
|
|
4105
4290
|
return this.resolved.group.isSelected(this.value())();
|
|
4106
4291
|
}, ...(ngDevMode ? [{ debugName: "toggleChecked" }] : /* istanbul ignore next */ []));
|
|
4107
4292
|
toggleDisabled = computed(() => this.resolved.group.disabled() || this.disabled(), ...(ngDevMode ? [{ debugName: "toggleDisabled" }] : /* istanbul ignore next */ []));
|
|
4293
|
+
// Single leaves are radios in a radiogroup (aria-checked is valid there);
|
|
4294
|
+
// multi leaves stay native buttons (implicit role="button" carries
|
|
4295
|
+
// aria-pressed). aria-checked is undefined for role="button".
|
|
4296
|
+
hostRole = computed(() => this.resolved.mode === 'single' ? 'radio' : null, ...(ngDevMode ? [{ debugName: "hostRole" }] : /* istanbul ignore next */ []));
|
|
4108
4297
|
ariaChecked = computed(() => this.resolved.mode === 'single' ? (this.toggleChecked() ? 'true' : 'false') : null, ...(ngDevMode ? [{ debugName: "ariaChecked" }] : /* istanbul ignore next */ []));
|
|
4109
|
-
|
|
4298
|
+
ariaPressed = computed(() => this.resolved.mode === 'multi' ? (this.toggleChecked() ? 'true' : 'false') : null, ...(ngDevMode ? [{ debugName: "ariaPressed" }] : /* istanbul ignore next */ []));
|
|
4110
4299
|
handleFocus() {
|
|
4111
4300
|
if (this.toggleDisabled()) {
|
|
4112
4301
|
return;
|
|
@@ -4137,7 +4326,7 @@ class CngxButtonToggle {
|
|
|
4137
4326
|
this.resolved.group.toggle(this.value());
|
|
4138
4327
|
}
|
|
4139
4328
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxButtonToggle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4140
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxButtonToggle, isStandalone: true, selector: "button[cngxButtonToggle]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, describedBy: { classPropertyName: "describedBy", publicName: "cngxDescribedBy", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "button" }, listeners: { "focus": "handleFocus()", "click": "handleSelect()", "keydown.space": "handleKeydown($event)", "keydown.enter": "handleKeydown($event)" }, properties: { "attr.aria-checked": "ariaChecked()", "attr.aria-
|
|
4329
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxButtonToggle, isStandalone: true, selector: "button[cngxButtonToggle]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, describedBy: { classPropertyName: "describedBy", publicName: "cngxDescribedBy", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "button" }, listeners: { "focus": "handleFocus()", "click": "handleSelect()", "keydown.space": "handleKeydown($event)", "keydown.enter": "handleKeydown($event)" }, properties: { "attr.role": "hostRole()", "attr.aria-checked": "ariaChecked()", "attr.aria-pressed": "ariaPressed()", "attr.aria-disabled": "toggleDisabled() ? \"true\" : null", "attr.aria-describedby": "describedBy()", "attr.disabled": "toggleDisabled() ? \"\" : null", "class.cngx-button-toggle--checked": "toggleChecked()", "class.cngx-button-toggle--disabled": "toggleDisabled()" }, classAttribute: "cngx-button-toggle" }, exportAs: ["cngxButtonToggle"], hostDirectives: [{ directive: i1.CngxRovingItem, inputs: ["cngxRovingItemDisabled", "disabled"] }], ngImport: i0 });
|
|
4141
4330
|
}
|
|
4142
4331
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxButtonToggle, decorators: [{
|
|
4143
4332
|
type: Directive,
|
|
@@ -4154,8 +4343,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4154
4343
|
host: {
|
|
4155
4344
|
class: 'cngx-button-toggle',
|
|
4156
4345
|
type: 'button',
|
|
4346
|
+
'[attr.role]': 'hostRole()',
|
|
4157
4347
|
'[attr.aria-checked]': 'ariaChecked()',
|
|
4158
|
-
'[attr.aria-
|
|
4348
|
+
'[attr.aria-pressed]': 'ariaPressed()',
|
|
4159
4349
|
'[attr.aria-disabled]': 'toggleDisabled() ? "true" : null',
|
|
4160
4350
|
'[attr.aria-describedby]': 'describedBy()',
|
|
4161
4351
|
'[attr.disabled]': 'toggleDisabled() ? "" : null',
|
|
@@ -4419,7 +4609,17 @@ class CngxRadio {
|
|
|
4419
4609
|
describedId = nextUid('cngx-radio-desc');
|
|
4420
4610
|
radioChecked = computed(() => this.group.value() === this.value(), ...(ngDevMode ? [{ debugName: "radioChecked" }] : /* istanbul ignore next */ []));
|
|
4421
4611
|
radioDisabled = computed(() => this.group.disabled() || this.disabled(), ...(ngDevMode ? [{ debugName: "radioDisabled" }] : /* istanbul ignore next */ []));
|
|
4422
|
-
|
|
4612
|
+
/**
|
|
4613
|
+
* `aria-describedby` reference to the reason span, gated on
|
|
4614
|
+
* `radioDisabled() && disabledReason()` - the effective disabled state
|
|
4615
|
+
* (`aria-disabled` reflects the same signal), so a reason set on an
|
|
4616
|
+
* enabled leaf announces nothing while a group-disabled leaf still
|
|
4617
|
+
* surfaces its reason. Gating on the per-leaf `disabled()` alone would
|
|
4618
|
+
* drop the announcement when the parent group disables the leaf. accname
|
|
4619
|
+
* 1.2 §2A traverses a directly-referenced hidden node, so the span's
|
|
4620
|
+
* `aria-hidden` tracks the same condition.
|
|
4621
|
+
*/
|
|
4622
|
+
describedById = computed(() => this.radioDisabled() && this.disabledReason() ? this.describedId : null, ...(ngDevMode ? [{ debugName: "describedById" }] : /* istanbul ignore next */ []));
|
|
4423
4623
|
constructor() {
|
|
4424
4624
|
this.group.register({
|
|
4425
4625
|
id: this.id,
|
|
@@ -4460,10 +4660,10 @@ class CngxRadio {
|
|
|
4460
4660
|
<span
|
|
4461
4661
|
[id]="describedId"
|
|
4462
4662
|
class="cngx-radio__sr-only"
|
|
4463
|
-
[attr.aria-hidden]="disabledReason() ? null : 'true'"
|
|
4663
|
+
[attr.aria-hidden]="radioDisabled() && disabledReason() ? null : 'true'"
|
|
4464
4664
|
>{{ disabledReason() }}</span
|
|
4465
4665
|
>
|
|
4466
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-radio-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}@property --cngx-radio-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-radio-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-radio-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid oklch(.66 .19 50);}@property --cngx-radio-focus-offset{syntax: \"*\"; inherits: false; initial-value: 3px;}@property --cngx-radio-focus-radius{syntax: \"*\"; inherits: false; initial-value: .25rem;}}@layer cngx.components{@scope(.cngx-radio){:scope{--cngx-radio-gap: var(--cngx-space-sm);display:inline-flex;align-items:center;gap:var(--cngx-radio-gap, var(--cngx-space-sm, .5rem));cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;font:inherit;color:var(--cngx-radio-color, inherit)}:scope.cngx-radio--disabled{cursor:not-allowed;opacity:var(--cngx-radio-disabled-opacity, .5)}:scope:focus-visible{outline:var( --cngx-radio-focus-outline, 2px solid var(--cngx-color-primary, oklch(.66 .19 50)) );outline-offset:var(--cngx-radio-focus-offset, 3px);border-radius:var(--cngx-radio-focus-radius, var(--cngx-radius-sm, .25rem))}.cngx-radio__label{flex:0 1 auto;min-inline-size:0}.cngx-radio__sr-only{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}}}\n"], dependencies: [{ kind: "component", type: CngxRadioIndicator, selector: "cngx-radio-indicator", inputs: ["checked", "disabled", "size", "dotGlyph"], exportAs: ["cngxRadioIndicator"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4666
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-radio-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}@property --cngx-radio-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-radio-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-radio-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid oklch(.66 .19 50);}@property --cngx-radio-focus-offset{syntax: \"*\"; inherits: false; initial-value: 3px;}@property --cngx-radio-focus-radius{syntax: \"*\"; inherits: false; initial-value: .25rem;}}@layer cngx.components{@scope(.cngx-radio){:scope{--cngx-radio-gap: var(--cngx-space-sm);display:inline-flex;align-items:center;gap:var(--cngx-radio-gap, var(--cngx-space-sm, .5rem));cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;font:inherit;color:var(--cngx-radio-color, inherit);min-block-size:var(--cngx-target-min, 0px);min-inline-size:var(--cngx-target-min, 0px)}:scope.cngx-radio--disabled{cursor:not-allowed;opacity:var(--cngx-radio-disabled-opacity, .5)}:scope:focus-visible{outline:var( --cngx-radio-focus-outline, 2px solid var(--cngx-color-primary, oklch(.66 .19 50)) );outline-offset:var(--cngx-radio-focus-offset, 3px);border-radius:var(--cngx-radio-focus-radius, var(--cngx-radius-sm, .25rem))}.cngx-radio__label{flex:0 1 auto;min-inline-size:0}.cngx-radio__sr-only{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}}}\n"], dependencies: [{ kind: "component", type: CngxRadioIndicator, selector: "cngx-radio-indicator", inputs: ["checked", "disabled", "size", "dotGlyph"], exportAs: ["cngxRadioIndicator"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4467
4667
|
}
|
|
4468
4668
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxRadio, decorators: [{
|
|
4469
4669
|
type: Component,
|
|
@@ -4497,10 +4697,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4497
4697
|
<span
|
|
4498
4698
|
[id]="describedId"
|
|
4499
4699
|
class="cngx-radio__sr-only"
|
|
4500
|
-
[attr.aria-hidden]="disabledReason() ? null : 'true'"
|
|
4700
|
+
[attr.aria-hidden]="radioDisabled() && disabledReason() ? null : 'true'"
|
|
4501
4701
|
>{{ disabledReason() }}</span
|
|
4502
4702
|
>
|
|
4503
|
-
`, encapsulation: ViewEncapsulation.None, styles: ["@layer cngx.tokens{@property --cngx-radio-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}@property --cngx-radio-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-radio-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-radio-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid oklch(.66 .19 50);}@property --cngx-radio-focus-offset{syntax: \"*\"; inherits: false; initial-value: 3px;}@property --cngx-radio-focus-radius{syntax: \"*\"; inherits: false; initial-value: .25rem;}}@layer cngx.components{@scope(.cngx-radio){:scope{--cngx-radio-gap: var(--cngx-space-sm);display:inline-flex;align-items:center;gap:var(--cngx-radio-gap, var(--cngx-space-sm, .5rem));cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;font:inherit;color:var(--cngx-radio-color, inherit)}:scope.cngx-radio--disabled{cursor:not-allowed;opacity:var(--cngx-radio-disabled-opacity, .5)}:scope:focus-visible{outline:var( --cngx-radio-focus-outline, 2px solid var(--cngx-color-primary, oklch(.66 .19 50)) );outline-offset:var(--cngx-radio-focus-offset, 3px);border-radius:var(--cngx-radio-focus-radius, var(--cngx-radius-sm, .25rem))}.cngx-radio__label{flex:0 1 auto;min-inline-size:0}.cngx-radio__sr-only{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}}}\n"] }]
|
|
4703
|
+
`, encapsulation: ViewEncapsulation.None, styles: ["@layer cngx.tokens{@property --cngx-radio-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}@property --cngx-radio-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-radio-disabled-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-radio-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid oklch(.66 .19 50);}@property --cngx-radio-focus-offset{syntax: \"*\"; inherits: false; initial-value: 3px;}@property --cngx-radio-focus-radius{syntax: \"*\"; inherits: false; initial-value: .25rem;}}@layer cngx.components{@scope(.cngx-radio){:scope{--cngx-radio-gap: var(--cngx-space-sm);display:inline-flex;align-items:center;gap:var(--cngx-radio-gap, var(--cngx-space-sm, .5rem));cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;font:inherit;color:var(--cngx-radio-color, inherit);min-block-size:var(--cngx-target-min, 0px);min-inline-size:var(--cngx-target-min, 0px)}:scope.cngx-radio--disabled{cursor:not-allowed;opacity:var(--cngx-radio-disabled-opacity, .5)}:scope:focus-visible{outline:var( --cngx-radio-focus-outline, 2px solid var(--cngx-color-primary, oklch(.66 .19 50)) );outline-offset:var(--cngx-radio-focus-offset, 3px);border-radius:var(--cngx-radio-focus-radius, var(--cngx-radius-sm, .25rem))}.cngx-radio__label{flex:0 1 auto;min-inline-size:0}.cngx-radio__sr-only{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}}}\n"] }]
|
|
4504
4704
|
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], disabledReason: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabledReason", required: false }] }], dotGlyph: [{ type: i0.Input, args: [{ isSignal: true, alias: "dotGlyph", required: false }] }] } });
|
|
4505
4705
|
|
|
4506
4706
|
/**
|
|
@@ -4564,13 +4764,16 @@ const CNGX_CHIP_GROUP_HOST = new InjectionToken('CngxChipGroupHost');
|
|
|
4564
4764
|
* toggle does not double-fire alongside the chip's `(remove)`
|
|
4565
4765
|
* output.
|
|
4566
4766
|
*
|
|
4567
|
-
* **Disabled "why".**
|
|
4568
|
-
*
|
|
4569
|
-
*
|
|
4570
|
-
* `
|
|
4571
|
-
*
|
|
4572
|
-
*
|
|
4573
|
-
*
|
|
4767
|
+
* **Disabled "why".** The directive appends a hidden span to the host
|
|
4768
|
+
* via `Renderer2` (always-in-DOM per Pillar 2 - the id stays stable
|
|
4769
|
+
* across renders). Both the span's `aria-hidden` and the host's
|
|
4770
|
+
* `aria-describedby` reference are gated on `disabled() &&
|
|
4771
|
+
* disabledReason()` (Toggle/Radio convergence): a reason set on an
|
|
4772
|
+
* enabled chip announces nothing and stays out of reading order.
|
|
4773
|
+
* Outside that state, consumers may still pass a custom id via
|
|
4774
|
+
* `cngxDescribedBy` and the `aria-describedby` host binding routes to
|
|
4775
|
+
* that. The two paths are mutually exclusive: the active
|
|
4776
|
+
* disabled-reason wins.
|
|
4574
4777
|
*
|
|
4575
4778
|
* ```html
|
|
4576
4779
|
* <cngx-chip cngxChipInteraction [value]="'red'" [(selected)]="redOn">
|
|
@@ -4654,7 +4857,11 @@ class CngxChipInteraction {
|
|
|
4654
4857
|
removeRequest = output();
|
|
4655
4858
|
describedId = nextUid('cngx-chip-desc');
|
|
4656
4859
|
resolvedDescribedBy = computed(() => {
|
|
4657
|
-
|
|
4860
|
+
// Gate on the effective disabled state, not the reason text alone
|
|
4861
|
+
// (Toggle/Radio convergence): accname 1.2 §2A traverses a directly
|
|
4862
|
+
// referenced hidden node, so the id must only be emitted while the
|
|
4863
|
+
// description applies.
|
|
4864
|
+
if (this.disabled() && this.disabledReason()) {
|
|
4658
4865
|
return this.describedId;
|
|
4659
4866
|
}
|
|
4660
4867
|
return this.describedBy();
|
|
@@ -4697,7 +4904,7 @@ class CngxChipInteraction {
|
|
|
4697
4904
|
}
|
|
4698
4905
|
});
|
|
4699
4906
|
effect(() => {
|
|
4700
|
-
const reason = this.disabledReason();
|
|
4907
|
+
const reason = this.disabled() && this.disabledReason() ? this.disabledReason() : '';
|
|
4701
4908
|
untracked(() => {
|
|
4702
4909
|
if (reason) {
|
|
4703
4910
|
renderer.removeAttribute(span, 'aria-hidden');
|
|
@@ -5066,7 +5273,7 @@ class CngxChipGroup {
|
|
|
5066
5273
|
{ provide: CNGX_CHIP_GROUP_HOST, useExisting: CngxChipGroup },
|
|
5067
5274
|
{ provide: CNGX_CONTROL_VALUE, useExisting: CngxChipGroup },
|
|
5068
5275
|
{ provide: CNGX_FORM_FIELD_CONTROL, useExisting: CngxChipGroup },
|
|
5069
|
-
], exportAs: ["cngxChipGroup"], hostDirectives: [{ directive: i1.CngxRovingTabindex, inputs: ["orientation", "orientation"] }], ngImport: i0, template: `<ng-content />`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chip-group-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}}@layer cngx.components{@scope(.cngx-chip-group){:scope{--cngx-chip-group-gap: var(--cngx-space-sm);display:inline-flex;flex-direction:column;gap:var(--cngx-chip-group-gap, var(--cngx-space-sm, .5rem))}:scope.cngx-chip-group--horizontal{flex-direction:row;flex-wrap:wrap}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
5276
|
+
], exportAs: ["cngxChipGroup"], hostDirectives: [{ directive: i1.CngxRovingTabindex, inputs: ["orientation", "orientation"] }], ngImport: i0, template: `<ng-content />`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chip-group-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}}@layer cngx.components{@scope(.cngx-chip-group){:scope{--cngx-chip-group-gap: var(--cngx-space-sm);display:inline-flex;flex-direction:column;gap:max(var(--cngx-chip-group-gap, var(--cngx-space-sm, .5rem)),var(--cngx-target-gap, 0px))}:scope.cngx-chip-group--horizontal{flex-direction:row;flex-wrap:wrap}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
5070
5277
|
}
|
|
5071
5278
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChipGroup, decorators: [{
|
|
5072
5279
|
type: Component,
|
|
@@ -5092,7 +5299,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
5092
5299
|
{ provide: CNGX_CHIP_GROUP_HOST, useExisting: CngxChipGroup },
|
|
5093
5300
|
{ provide: CNGX_CONTROL_VALUE, useExisting: CngxChipGroup },
|
|
5094
5301
|
{ provide: CNGX_FORM_FIELD_CONTROL, useExisting: CngxChipGroup },
|
|
5095
|
-
], template: `<ng-content />`, encapsulation: ViewEncapsulation.None, styles: ["@layer cngx.tokens{@property --cngx-chip-group-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}}@layer cngx.components{@scope(.cngx-chip-group){:scope{--cngx-chip-group-gap: var(--cngx-space-sm);display:inline-flex;flex-direction:column;gap:var(--cngx-chip-group-gap, var(--cngx-space-sm, .5rem))}:scope.cngx-chip-group--horizontal{flex-direction:row;flex-wrap:wrap}}}\n"] }]
|
|
5302
|
+
], template: `<ng-content />`, encapsulation: ViewEncapsulation.None, styles: ["@layer cngx.tokens{@property --cngx-chip-group-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}}@layer cngx.components{@scope(.cngx-chip-group){:scope{--cngx-chip-group-gap: var(--cngx-space-sm);display:inline-flex;flex-direction:column;gap:max(var(--cngx-chip-group-gap, var(--cngx-space-sm, .5rem)),var(--cngx-target-gap, 0px))}:scope.cngx-chip-group--horizontal{flex-direction:row;flex-wrap:wrap}}}\n"] }]
|
|
5096
5303
|
}], propDecorators: { selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }, { type: i0.Output, args: ["selectedChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }, { type: i0.Output, args: ["requiredChange"] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }, { type: i0.Output, args: ["invalidChange"] }], errorMessageId: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessageId", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }] } });
|
|
5097
5304
|
|
|
5098
5305
|
/**
|
|
@@ -5247,7 +5454,7 @@ class CngxMultiChipGroup {
|
|
|
5247
5454
|
{ provide: CNGX_CHIP_GROUP_HOST, useExisting: CngxMultiChipGroup },
|
|
5248
5455
|
{ provide: CNGX_CONTROL_VALUE, useExisting: CngxMultiChipGroup },
|
|
5249
5456
|
{ provide: CNGX_FORM_FIELD_CONTROL, useExisting: CngxMultiChipGroup },
|
|
5250
|
-
], exportAs: ["cngxMultiChipGroup"], hostDirectives: [{ directive: i1.CngxRovingTabindex, inputs: ["orientation", "orientation"] }], ngImport: i0, template: `<ng-content />`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-multi-chip-group-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}}@layer cngx.components{@scope(.cngx-multi-chip-group){:scope{--cngx-multi-chip-group-gap: var(--cngx-space-sm);display:inline-flex;flex-direction:column;gap:var(
|
|
5457
|
+
], exportAs: ["cngxMultiChipGroup"], hostDirectives: [{ directive: i1.CngxRovingTabindex, inputs: ["orientation", "orientation"] }], ngImport: i0, template: `<ng-content />`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-multi-chip-group-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}}@layer cngx.components{@scope(.cngx-multi-chip-group){:scope{--cngx-multi-chip-group-gap: var(--cngx-space-sm);display:inline-flex;flex-direction:column;gap:max(var(--cngx-multi-chip-group-gap, var(--cngx-chip-group-gap, var(--cngx-space-sm, .5rem))),var(--cngx-target-gap, 0px))}:scope.cngx-multi-chip-group--horizontal{flex-direction:row;flex-wrap:wrap}}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
5251
5458
|
}
|
|
5252
5459
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMultiChipGroup, decorators: [{
|
|
5253
5460
|
type: Component,
|
|
@@ -5274,7 +5481,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
5274
5481
|
{ provide: CNGX_CHIP_GROUP_HOST, useExisting: CngxMultiChipGroup },
|
|
5275
5482
|
{ provide: CNGX_CONTROL_VALUE, useExisting: CngxMultiChipGroup },
|
|
5276
5483
|
{ provide: CNGX_FORM_FIELD_CONTROL, useExisting: CngxMultiChipGroup },
|
|
5277
|
-
], template: `<ng-content />`, encapsulation: ViewEncapsulation.None, styles: ["@layer cngx.tokens{@property --cngx-multi-chip-group-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}}@layer cngx.components{@scope(.cngx-multi-chip-group){:scope{--cngx-multi-chip-group-gap: var(--cngx-space-sm);display:inline-flex;flex-direction:column;gap:var(
|
|
5484
|
+
], template: `<ng-content />`, encapsulation: ViewEncapsulation.None, styles: ["@layer cngx.tokens{@property --cngx-multi-chip-group-gap{syntax: \"*\"; inherits: false; initial-value: .5rem;}}@layer cngx.components{@scope(.cngx-multi-chip-group){:scope{--cngx-multi-chip-group-gap: var(--cngx-space-sm);display:inline-flex;flex-direction:column;gap:max(var(--cngx-multi-chip-group-gap, var(--cngx-chip-group-gap, var(--cngx-space-sm, .5rem))),var(--cngx-target-gap, 0px))}:scope.cngx-multi-chip-group--horizontal{flex-direction:row;flex-wrap:wrap}}}\n"] }]
|
|
5278
5485
|
}], ctorParameters: () => [], propDecorators: { selectedValues: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedValues", required: false }] }, { type: i0.Output, args: ["selectedValuesChange"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }, { type: i0.Output, args: ["disabledChange"] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }, { type: i0.Output, args: ["requiredChange"] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }, { type: i0.Output, args: ["invalidChange"] }], errorMessageId: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessageId", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], keyFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyFn", required: false }] }] } });
|
|
5279
5486
|
|
|
5280
5487
|
/**
|
|
@@ -5920,6 +6127,13 @@ const NOOP$1 = { kind: 'noop' };
|
|
|
5920
6127
|
* `'noop'` when it didn't - so consumers bound to `(movedToChild)` /
|
|
5921
6128
|
* `(movedToParent)` only see state-change-truthful emissions.
|
|
5922
6129
|
*
|
|
6130
|
+
* `onArrowRight` / `onArrowLeft` are the inline-forward / inline-back
|
|
6131
|
+
* intents, not physical keys. `CngxHierarchicalNav` resolves the physical
|
|
6132
|
+
* arrow to its logical intent by writing direction (`resolveInlineArrowKey`)
|
|
6133
|
+
* before calling the strategy, so under `rtl` physical ArrowLeft routes to
|
|
6134
|
+
* `onArrowRight`. Custom strategies stay direction-naive and inherit correct
|
|
6135
|
+
* RTL behaviour for free.
|
|
6136
|
+
*
|
|
5923
6137
|
* @category common/interactive/tree
|
|
5924
6138
|
*/
|
|
5925
6139
|
function createW3CTreeStrategy() {
|
|
@@ -6054,6 +6268,7 @@ class CngxHierarchicalNav {
|
|
|
6054
6268
|
optional: true,
|
|
6055
6269
|
});
|
|
6056
6270
|
strategy = inject(CNGX_HIERARCHICAL_NAV_STRATEGY);
|
|
6271
|
+
direction = injectDirection();
|
|
6057
6272
|
/** Emitted with the id that was just expanded via ArrowRight. */
|
|
6058
6273
|
expand = output();
|
|
6059
6274
|
/** Emitted with the id that was just collapsed via ArrowLeft. */
|
|
@@ -6063,10 +6278,30 @@ class CngxHierarchicalNav {
|
|
|
6063
6278
|
/** Emitted with the id of the child the active-descendant moved to. */
|
|
6064
6279
|
movedToChild = output();
|
|
6065
6280
|
handleRight(event) {
|
|
6066
|
-
this.
|
|
6281
|
+
this.handlePhysicalArrow('ArrowRight', event);
|
|
6067
6282
|
}
|
|
6068
6283
|
handleLeft(event) {
|
|
6069
|
-
this.
|
|
6284
|
+
this.handlePhysicalArrow('ArrowLeft', event);
|
|
6285
|
+
}
|
|
6286
|
+
/**
|
|
6287
|
+
* Resolve the physical arrow to its inline-logical intent before routing:
|
|
6288
|
+
* under `rtl` physical ArrowLeft expands / moves-to-child and physical
|
|
6289
|
+
* ArrowRight collapses / moves-to-parent. The strategy stays direction-naive.
|
|
6290
|
+
*/
|
|
6291
|
+
handlePhysicalArrow(key, event) {
|
|
6292
|
+
// Never hijack browser/app shortcuts: Ctrl/Cmd/Alt+Arrow combos pass
|
|
6293
|
+
// through untouched - the same guard the nav strategies apply. The
|
|
6294
|
+
// key-filtered host listener types `$event` as plain Event; keydown
|
|
6295
|
+
// always delivers a KeyboardEvent.
|
|
6296
|
+
const kbd = event;
|
|
6297
|
+
if (kbd.ctrlKey || kbd.metaKey || kbd.altKey) {
|
|
6298
|
+
return;
|
|
6299
|
+
}
|
|
6300
|
+
const logical = resolveInlineArrowKey(key, this.direction());
|
|
6301
|
+
const step = logical === 'ArrowRight'
|
|
6302
|
+
? (ctx) => this.strategy.onArrowRight(ctx)
|
|
6303
|
+
: (ctx) => this.strategy.onArrowLeft(ctx);
|
|
6304
|
+
this.dispatch(event, step);
|
|
6070
6305
|
}
|
|
6071
6306
|
/**
|
|
6072
6307
|
* Shared guard + action-dispatch wrapper. Degrades silently when AD
|
|
@@ -6239,7 +6474,7 @@ function withRetry(action, config) {
|
|
|
6239
6474
|
* On success, applies the server-confirmed value. On failure, rolls back to the
|
|
6240
6475
|
* previous value.
|
|
6241
6476
|
*
|
|
6242
|
-
* This is a utility function, not a directive
|
|
6477
|
+
* This is a utility function, not a directive - it composes with any signal.
|
|
6243
6478
|
*
|
|
6244
6479
|
* ```typescript
|
|
6245
6480
|
* readonly name = signal('Alice');
|
|
@@ -6254,7 +6489,7 @@ function withRetry(action, config) {
|
|
|
6254
6489
|
* @if (nameState.rolledBack()) { <span>Reverted</span> }
|
|
6255
6490
|
* ```
|
|
6256
6491
|
*
|
|
6257
|
-
* **Note:** The internal subscription is unmanaged
|
|
6492
|
+
* **Note:** The internal subscription is unmanaged - there is no `DestroyRef` available
|
|
6258
6493
|
* in a plain factory function. If the component is destroyed mid-flight, the subscription
|
|
6259
6494
|
* completes silently. For long-running actions, ensure the component outlives the action
|
|
6260
6495
|
* or cancel via the Observable itself.
|
|
@@ -6279,11 +6514,11 @@ function optimistic(current, action) {
|
|
|
6279
6514
|
error: errorState.asReadonly(),
|
|
6280
6515
|
state: asyncState,
|
|
6281
6516
|
};
|
|
6282
|
-
// Last confirmed value
|
|
6517
|
+
// Last confirmed value - rollback target under concurrent calls.
|
|
6283
6518
|
let confirmedValue = current();
|
|
6284
6519
|
let activeSub;
|
|
6285
6520
|
const apply = (newValue) => {
|
|
6286
|
-
// Cancel in-flight subscription
|
|
6521
|
+
// Cancel in-flight subscription - prevents stale closure rollback
|
|
6287
6522
|
activeSub?.unsubscribe();
|
|
6288
6523
|
rolledBackState.set(false);
|
|
6289
6524
|
errorState.set(undefined);
|
|
@@ -6795,6 +7030,7 @@ class CngxReorder {
|
|
|
6795
7030
|
dragOverIndex = computed(() => this.activeDrag()?.currentIndex ?? null, ...(ngDevMode ? [{ debugName: "dragOverIndex" }] : /* istanbul ignore next */ []));
|
|
6796
7031
|
hostEl = inject((ElementRef)).nativeElement;
|
|
6797
7032
|
doc = inject(DOCUMENT);
|
|
7033
|
+
direction = injectDirection();
|
|
6798
7034
|
destroyRef = inject(DestroyRef);
|
|
6799
7035
|
constructor() {
|
|
6800
7036
|
this.wirePointer();
|
|
@@ -6911,14 +7147,22 @@ class CngxReorder {
|
|
|
6911
7147
|
}
|
|
6912
7148
|
let toIndex;
|
|
6913
7149
|
switch (e.key) {
|
|
6914
|
-
case 'ArrowLeft':
|
|
6915
7150
|
case 'ArrowUp':
|
|
6916
7151
|
toIndex = fromIndex - 1;
|
|
6917
7152
|
break;
|
|
6918
|
-
case 'ArrowRight':
|
|
6919
7153
|
case 'ArrowDown':
|
|
6920
7154
|
toIndex = fromIndex + 1;
|
|
6921
7155
|
break;
|
|
7156
|
+
case 'ArrowLeft':
|
|
7157
|
+
case 'ArrowRight': {
|
|
7158
|
+
// Inline axis: move-forward/back flips under rtl.
|
|
7159
|
+
const step = resolveInlineStep(e.key, this.direction());
|
|
7160
|
+
if (step === null) {
|
|
7161
|
+
return;
|
|
7162
|
+
}
|
|
7163
|
+
toIndex = fromIndex + step;
|
|
7164
|
+
break;
|
|
7165
|
+
}
|
|
6922
7166
|
case 'Home':
|
|
6923
7167
|
toIndex = 0;
|
|
6924
7168
|
break;
|
|
@@ -7082,6 +7326,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
7082
7326
|
function createChipStripRoving(opts) {
|
|
7083
7327
|
const attr = opts.indexAttr ?? 'data-reorder-index';
|
|
7084
7328
|
const activeIndexState = signal(0, ...(ngDevMode ? [{ debugName: "activeIndexState" }] : /* istanbul ignore next */ []));
|
|
7329
|
+
const direction = opts.direction ?? injectDirection();
|
|
7085
7330
|
// Clamp on count shrink - a removed-last-chip or clear-all must not
|
|
7086
7331
|
// leave `activeIndex` pointing past the end. Reading the signal
|
|
7087
7332
|
// inside `untracked()` avoids a self-dependency, so the effect's
|
|
@@ -7126,14 +7371,22 @@ function createChipStripRoving(opts) {
|
|
|
7126
7371
|
const current = activeIndexState();
|
|
7127
7372
|
let nextIdx;
|
|
7128
7373
|
switch (event.key) {
|
|
7129
|
-
case 'ArrowLeft':
|
|
7130
7374
|
case 'ArrowUp':
|
|
7131
7375
|
nextIdx = Math.max(0, current - 1);
|
|
7132
7376
|
break;
|
|
7133
|
-
case 'ArrowRight':
|
|
7134
7377
|
case 'ArrowDown':
|
|
7135
7378
|
nextIdx = Math.min(count - 1, current + 1);
|
|
7136
7379
|
break;
|
|
7380
|
+
case 'ArrowLeft':
|
|
7381
|
+
case 'ArrowRight': {
|
|
7382
|
+
// Inline axis: rove-forward/back flips under rtl.
|
|
7383
|
+
const step = resolveInlineStep(event.key, direction());
|
|
7384
|
+
if (step === null) {
|
|
7385
|
+
return;
|
|
7386
|
+
}
|
|
7387
|
+
nextIdx = Math.min(count - 1, Math.max(0, current + step));
|
|
7388
|
+
break;
|
|
7389
|
+
}
|
|
7137
7390
|
case 'Home':
|
|
7138
7391
|
nextIdx = 0;
|
|
7139
7392
|
break;
|
|
@@ -7468,7 +7721,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
7468
7721
|
* Works with Angular's `CanDeactivateFn`. The `isDirty` callback is evaluated
|
|
7469
7722
|
* on each navigation attempt. When dirty, shows a `confirm` dialog.
|
|
7470
7723
|
*
|
|
7471
|
-
* Uses `DOCUMENT` injection for SSR safety
|
|
7724
|
+
* Uses `DOCUMENT` injection for SSR safety - returns `true` (allow) when
|
|
7472
7725
|
* no window is available.
|
|
7473
7726
|
*
|
|
7474
7727
|
* Pair with `CngxBeforeUnload` for full coverage (browser close + route change):
|
|
@@ -7493,7 +7746,7 @@ function canDeactivateWhenClean(isDirty, message = 'You have unsaved changes. Le
|
|
|
7493
7746
|
if (!isDirty()) {
|
|
7494
7747
|
return true;
|
|
7495
7748
|
}
|
|
7496
|
-
// inject() is valid here
|
|
7749
|
+
// inject() is valid here - Angular calls the guard in an injection context
|
|
7497
7750
|
const win = inject(DOCUMENT).defaultView;
|
|
7498
7751
|
if (!win) {
|
|
7499
7752
|
return true;
|
|
@@ -7578,7 +7831,7 @@ class CngxCloseButton {
|
|
|
7578
7831
|
}
|
|
7579
7832
|
</ng-content>
|
|
7580
7833
|
</button>
|
|
7581
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-close-button-bg{syntax: \"*\"; inherits: false; initial-value: none;}@property --cngx-close-button-border{syntax: \"*\"; inherits: false; initial-value: none;}@property --cngx-close-button-size{syntax: \"<length>\"; inherits: false; initial-value: 32px;}@property --cngx-close-button-padding{syntax: \"<length>\"; inherits: true; initial-value: 8px;}@property --cngx-close-button-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-close-button-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-close-button-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-close-button-transition{syntax: \"<time>\"; inherits: false; initial-value: .15s;}@property --cngx-close-button-hover-opacity{syntax: \"<number>\"; inherits: false; initial-value: 1;}@property --cngx-close-button-hover-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(0 0 0 / .04);}@property --cngx-close-button-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid currentColor;}@property --cngx-close-button-focus-offset{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-close-button-active-opacity{syntax: \"<number>\"; inherits: false; initial-value: .8;}@property --cngx-close-button-icon-size{syntax: \"<length>\"; inherits: false; initial-value: 16px;}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-close-button-hover-bg: oklch(1 0 0 / .06)}}[data-color-scheme=dark],.dark{--cngx-close-button-hover-bg: oklch(1 0 0 / .06)}[data-color-scheme=light],.light{--cngx-close-button-hover-bg: oklch(0 0 0 / .04)}}@layer cngx.components{@scope(.cngx-close-button){:scope{--cngx-close-button-padding: var(--cngx-space-sm);display:inline-flex;align-items:center;justify-content:center;vertical-align:middle}.cngx-close-button__btn{display:inline-flex;align-items:center;justify-content:center;appearance:none;background:var(--cngx-close-button-bg, none);border:var(--cngx-close-button-border, none);min-width:var(--cngx-close-button-size, 32px);min-height:var(--cngx-close-button-size, 32px);padding:var(--cngx-close-button-padding, var(--cngx-space-sm, 8px));cursor:pointer;color:var(--cngx-close-button-color, inherit);opacity:var(--cngx-close-button-opacity, .5);border-radius:var(--cngx-close-button-radius, var(--cngx-radius-sm, 4px));transition:opacity var(--cngx-close-button-transition, .15s) ease}.cngx-close-button__btn:hover{opacity:var(--cngx-close-button-hover-opacity, 1);background:var(--cngx-close-button-hover-bg, oklch(0 0 0 / .04))}.cngx-close-button__btn:focus-visible{outline:var(--cngx-close-button-focus-outline, 2px solid currentColor);outline-offset:var(--cngx-close-button-focus-offset, 2px);opacity:1}.cngx-close-button__btn:active{opacity:var(--cngx-close-button-active-opacity, .8)}.cngx-close-button__icon{width:var(--cngx-close-button-icon-size, 16px);height:var(--cngx-close-button-icon-size, 16px);flex-shrink:0}}}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
7834
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-close-button-bg{syntax: \"*\"; inherits: false; initial-value: none;}@property --cngx-close-button-border{syntax: \"*\"; inherits: false; initial-value: none;}@property --cngx-close-button-size{syntax: \"<length>\"; inherits: false; initial-value: 32px;}@property --cngx-close-button-padding{syntax: \"<length>\"; inherits: true; initial-value: 8px;}@property --cngx-close-button-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-close-button-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-close-button-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-close-button-transition{syntax: \"<time>\"; inherits: false; initial-value: .15s;}@property --cngx-close-button-hover-opacity{syntax: \"<number>\"; inherits: false; initial-value: 1;}@property --cngx-close-button-hover-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(0 0 0 / .04);}@property --cngx-close-button-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid currentColor;}@property --cngx-close-button-focus-offset{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-close-button-active-opacity{syntax: \"<number>\"; inherits: false; initial-value: .8;}@property --cngx-close-button-icon-size{syntax: \"<length>\"; inherits: false; initial-value: 16px;}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-close-button-hover-bg: oklch(1 0 0 / .06)}}[data-color-scheme=dark],.dark{--cngx-close-button-hover-bg: oklch(1 0 0 / .06)}[data-color-scheme=light],.light{--cngx-close-button-hover-bg: oklch(0 0 0 / .04)}}@layer cngx.components{@scope(.cngx-close-button){:scope{--cngx-close-button-padding: var(--cngx-space-sm);display:inline-flex;align-items:center;justify-content:center;vertical-align:middle}.cngx-close-button__btn{display:inline-flex;align-items:center;justify-content:center;appearance:none;background:var(--cngx-close-button-bg, none);border:var(--cngx-close-button-border, none);min-width:max(var(--cngx-close-button-size, 32px),var(--cngx-target-min, 0px));min-height:max(var(--cngx-close-button-size, 32px),var(--cngx-target-min, 0px));padding:var(--cngx-close-button-padding, var(--cngx-space-sm, 8px));cursor:pointer;color:var(--cngx-close-button-color, inherit);opacity:var(--cngx-close-button-opacity, .5);border-radius:var(--cngx-close-button-radius, var(--cngx-radius-sm, 4px));transition:opacity var(--cngx-close-button-transition, .15s) ease}.cngx-close-button__btn:hover{opacity:var(--cngx-close-button-hover-opacity, 1);background:var(--cngx-close-button-hover-bg, oklch(0 0 0 / .04))}.cngx-close-button__btn:focus-visible{outline:var(--cngx-close-button-focus-outline, 2px solid currentColor);outline-offset:var(--cngx-close-button-focus-offset, 2px);opacity:1}.cngx-close-button__btn:active{opacity:var(--cngx-close-button-active-opacity, .8)}.cngx-close-button__icon{width:var(--cngx-close-button-icon-size, 16px);height:var(--cngx-close-button-icon-size, 16px);flex-shrink:0}}}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
7582
7835
|
}
|
|
7583
7836
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxCloseButton, decorators: [{
|
|
7584
7837
|
type: Component,
|
|
@@ -7606,7 +7859,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
7606
7859
|
}
|
|
7607
7860
|
</ng-content>
|
|
7608
7861
|
</button>
|
|
7609
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-close-button-bg{syntax: \"*\"; inherits: false; initial-value: none;}@property --cngx-close-button-border{syntax: \"*\"; inherits: false; initial-value: none;}@property --cngx-close-button-size{syntax: \"<length>\"; inherits: false; initial-value: 32px;}@property --cngx-close-button-padding{syntax: \"<length>\"; inherits: true; initial-value: 8px;}@property --cngx-close-button-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-close-button-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-close-button-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-close-button-transition{syntax: \"<time>\"; inherits: false; initial-value: .15s;}@property --cngx-close-button-hover-opacity{syntax: \"<number>\"; inherits: false; initial-value: 1;}@property --cngx-close-button-hover-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(0 0 0 / .04);}@property --cngx-close-button-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid currentColor;}@property --cngx-close-button-focus-offset{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-close-button-active-opacity{syntax: \"<number>\"; inherits: false; initial-value: .8;}@property --cngx-close-button-icon-size{syntax: \"<length>\"; inherits: false; initial-value: 16px;}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-close-button-hover-bg: oklch(1 0 0 / .06)}}[data-color-scheme=dark],.dark{--cngx-close-button-hover-bg: oklch(1 0 0 / .06)}[data-color-scheme=light],.light{--cngx-close-button-hover-bg: oklch(0 0 0 / .04)}}@layer cngx.components{@scope(.cngx-close-button){:scope{--cngx-close-button-padding: var(--cngx-space-sm);display:inline-flex;align-items:center;justify-content:center;vertical-align:middle}.cngx-close-button__btn{display:inline-flex;align-items:center;justify-content:center;appearance:none;background:var(--cngx-close-button-bg, none);border:var(--cngx-close-button-border, none);min-width:var(--cngx-close-button-size, 32px);min-height:var(--cngx-close-button-size, 32px);padding:var(--cngx-close-button-padding, var(--cngx-space-sm, 8px));cursor:pointer;color:var(--cngx-close-button-color, inherit);opacity:var(--cngx-close-button-opacity, .5);border-radius:var(--cngx-close-button-radius, var(--cngx-radius-sm, 4px));transition:opacity var(--cngx-close-button-transition, .15s) ease}.cngx-close-button__btn:hover{opacity:var(--cngx-close-button-hover-opacity, 1);background:var(--cngx-close-button-hover-bg, oklch(0 0 0 / .04))}.cngx-close-button__btn:focus-visible{outline:var(--cngx-close-button-focus-outline, 2px solid currentColor);outline-offset:var(--cngx-close-button-focus-offset, 2px);opacity:1}.cngx-close-button__btn:active{opacity:var(--cngx-close-button-active-opacity, .8)}.cngx-close-button__icon{width:var(--cngx-close-button-icon-size, 16px);height:var(--cngx-close-button-icon-size, 16px);flex-shrink:0}}}\n"] }]
|
|
7862
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-close-button-bg{syntax: \"*\"; inherits: false; initial-value: none;}@property --cngx-close-button-border{syntax: \"*\"; inherits: false; initial-value: none;}@property --cngx-close-button-size{syntax: \"<length>\"; inherits: false; initial-value: 32px;}@property --cngx-close-button-padding{syntax: \"<length>\"; inherits: true; initial-value: 8px;}@property --cngx-close-button-color{syntax: \"*\"; inherits: true; initial-value: currentColor;}@property --cngx-close-button-opacity{syntax: \"<number>\"; inherits: false; initial-value: .5;}@property --cngx-close-button-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-close-button-transition{syntax: \"<time>\"; inherits: false; initial-value: .15s;}@property --cngx-close-button-hover-opacity{syntax: \"<number>\"; inherits: false; initial-value: 1;}@property --cngx-close-button-hover-bg{syntax: \"<color>\"; inherits: true; initial-value: oklch(0 0 0 / .04);}@property --cngx-close-button-focus-outline{syntax: \"*\"; inherits: false; initial-value: 2px solid currentColor;}@property --cngx-close-button-focus-offset{syntax: \"<length>\"; inherits: false; initial-value: 2px;}@property --cngx-close-button-active-opacity{syntax: \"<number>\"; inherits: false; initial-value: .8;}@property --cngx-close-button-icon-size{syntax: \"<length>\"; inherits: false; initial-value: 16px;}@media(prefers-color-scheme:dark){:root:not([data-color-scheme=light]):not(.light){--cngx-close-button-hover-bg: oklch(1 0 0 / .06)}}[data-color-scheme=dark],.dark{--cngx-close-button-hover-bg: oklch(1 0 0 / .06)}[data-color-scheme=light],.light{--cngx-close-button-hover-bg: oklch(0 0 0 / .04)}}@layer cngx.components{@scope(.cngx-close-button){:scope{--cngx-close-button-padding: var(--cngx-space-sm);display:inline-flex;align-items:center;justify-content:center;vertical-align:middle}.cngx-close-button__btn{display:inline-flex;align-items:center;justify-content:center;appearance:none;background:var(--cngx-close-button-bg, none);border:var(--cngx-close-button-border, none);min-width:max(var(--cngx-close-button-size, 32px),var(--cngx-target-min, 0px));min-height:max(var(--cngx-close-button-size, 32px),var(--cngx-target-min, 0px));padding:var(--cngx-close-button-padding, var(--cngx-space-sm, 8px));cursor:pointer;color:var(--cngx-close-button-color, inherit);opacity:var(--cngx-close-button-opacity, .5);border-radius:var(--cngx-close-button-radius, var(--cngx-radius-sm, 4px));transition:opacity var(--cngx-close-button-transition, .15s) ease}.cngx-close-button__btn:hover{opacity:var(--cngx-close-button-hover-opacity, 1);background:var(--cngx-close-button-hover-bg, oklch(0 0 0 / .04))}.cngx-close-button__btn:focus-visible{outline:var(--cngx-close-button-focus-outline, 2px solid currentColor);outline-offset:var(--cngx-close-button-focus-offset, 2px);opacity:1}.cngx-close-button__btn:active{opacity:var(--cngx-close-button-active-opacity, .8)}.cngx-close-button__icon{width:var(--cngx-close-button-icon-size, 16px);height:var(--cngx-close-button-icon-size, 16px);flex-shrink:0}}}\n"] }]
|
|
7610
7863
|
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }] } });
|
|
7611
7864
|
|
|
7612
7865
|
/**
|
|
@@ -8380,7 +8633,7 @@ class CngxListbox {
|
|
|
8380
8633
|
}
|
|
8381
8634
|
}
|
|
8382
8635
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxListbox, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
8383
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.4", type: CngxListbox, isStandalone: true, selector: "[cngxListbox]", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, selectedValues: { classPropertyName: "selectedValues", publicName: "selectedValues", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "compareWith", isSignal: true, isRequired: false, transformFunction: null }, cngxSearchRef: { classPropertyName: "cngxSearchRef", publicName: "cngxSearchRef", isSignal: true, isRequired: false, transformFunction: null }, externalActivation: { classPropertyName: "externalActivation", publicName: "externalActivation", isSignal: true, isRequired: false, transformFunction: null }, explicitOptions: { classPropertyName: "explicitOptions", publicName: "explicitOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", selectedValues: "selectedValuesChange" }, host: { attributes: { "role": "listbox" }, properties: { "attr.aria-label": "label()", "attr.aria-multiselectable": "multiple() ? \"true\" : null" } }, queries: [{ propertyName: "contentOptions", predicate: CngxOption, descendants: true, isSignal: true }], exportAs: ["cngxListbox"], hostDirectives: [{ directive: i1.CngxActiveDescendant, inputs: ["items", "items", "orientation", "orientation", "loop", "loop", "typeahead", "typeahead", "autoHighlightFirst", "autoHighlightFirst", "virtualCount", "virtualCount"] }], ngImport: i0 });
|
|
8636
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.4", type: CngxListbox, isStandalone: true, selector: "[cngxListbox]", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, selectedValues: { classPropertyName: "selectedValues", publicName: "selectedValues", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "compareWith", isSignal: true, isRequired: false, transformFunction: null }, cngxSearchRef: { classPropertyName: "cngxSearchRef", publicName: "cngxSearchRef", isSignal: true, isRequired: false, transformFunction: null }, externalActivation: { classPropertyName: "externalActivation", publicName: "externalActivation", isSignal: true, isRequired: false, transformFunction: null }, explicitOptions: { classPropertyName: "explicitOptions", publicName: "explicitOptions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", selectedValues: "selectedValuesChange" }, host: { attributes: { "role": "listbox" }, properties: { "attr.aria-label": "label()", "attr.aria-multiselectable": "multiple() ? \"true\" : null" } }, queries: [{ propertyName: "contentOptions", predicate: CngxOption, descendants: true, isSignal: true }], exportAs: ["cngxListbox"], hostDirectives: [{ directive: i1.CngxActiveDescendant, inputs: ["items", "items", "orientation", "orientation", "loop", "loop", "typeahead", "typeahead", "autoHighlightFirst", "autoHighlightFirst", "virtualCount", "virtualCount", "windowStart", "windowStart"] }], ngImport: i0 });
|
|
8384
8637
|
}
|
|
8385
8638
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxListbox, decorators: [{
|
|
8386
8639
|
type: Directive,
|
|
@@ -8391,7 +8644,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
8391
8644
|
hostDirectives: [
|
|
8392
8645
|
{
|
|
8393
8646
|
directive: CngxActiveDescendant,
|
|
8394
|
-
inputs: [
|
|
8647
|
+
inputs: [
|
|
8648
|
+
'items',
|
|
8649
|
+
'orientation',
|
|
8650
|
+
'loop',
|
|
8651
|
+
'typeahead',
|
|
8652
|
+
'autoHighlightFirst',
|
|
8653
|
+
'virtualCount',
|
|
8654
|
+
'windowStart',
|
|
8655
|
+
],
|
|
8395
8656
|
},
|
|
8396
8657
|
],
|
|
8397
8658
|
host: {
|
|
@@ -8513,6 +8774,12 @@ class CngxListboxTrigger {
|
|
|
8513
8774
|
search = inject(CngxListboxSearch, { optional: true, self: true });
|
|
8514
8775
|
el = inject(ElementRef);
|
|
8515
8776
|
handleKeydown(event) {
|
|
8777
|
+
// Never hijack browser/app shortcuts: Ctrl/Cmd/Alt combos pass through
|
|
8778
|
+
// untouched - the same guard the nav strategies apply. Without it,
|
|
8779
|
+
// Ctrl+ArrowDown on a trigger would navigate and swallow the event.
|
|
8780
|
+
if (event.ctrlKey || event.metaKey || event.altKey) {
|
|
8781
|
+
return;
|
|
8782
|
+
}
|
|
8516
8783
|
const key = event.key;
|
|
8517
8784
|
const ad = this.listbox().ad;
|
|
8518
8785
|
// Tag-input convention: Backspace on an empty co-located search input
|
|
@@ -8604,13 +8871,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
8604
8871
|
}], propDecorators: { listbox: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxListboxTrigger", required: true }] }], popover: [{ type: i0.Input, args: [{ isSignal: true, alias: "popover", required: true }] }], closeOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnSelect", required: false }] }], backspaceOnEmpty: [{ type: i0.Output, args: ["backspaceOnEmpty"] }] } });
|
|
8605
8872
|
|
|
8606
8873
|
/**
|
|
8607
|
-
* Global polite live-region announcer for the menu family.
|
|
8608
|
-
*
|
|
8609
|
-
*
|
|
8874
|
+
* Global polite live-region announcer for the menu family. Delegates to
|
|
8875
|
+
* the shared {@link CngxLiveAnnouncer}, announcing menu state transitions
|
|
8876
|
+
* (submenu open/close, item activation) through its polite region.
|
|
8610
8877
|
*
|
|
8611
8878
|
* Scoped `providedIn: 'root'` so every menu in the app shares the same
|
|
8612
|
-
* region;
|
|
8613
|
-
*
|
|
8879
|
+
* region; the announcer clears then re-sets one frame later so screen
|
|
8880
|
+
* readers treat repeated identical messages as fresh events.
|
|
8614
8881
|
*
|
|
8615
8882
|
* Default factory output for {@link CNGX_MENU_ANNOUNCER_FACTORY}.
|
|
8616
8883
|
* Consumers obtain the announcer via the factory token, never by
|
|
@@ -8623,9 +8890,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
8623
8890
|
* @relatedTo CngxMenu, CngxMenuTrigger, CngxMenuItemSubmenu
|
|
8624
8891
|
*/
|
|
8625
8892
|
class CngxMenuAnnouncer {
|
|
8626
|
-
|
|
8627
|
-
politeElement = null;
|
|
8628
|
-
clearTimer = null;
|
|
8893
|
+
announcer = inject(CngxLiveAnnouncer);
|
|
8629
8894
|
/**
|
|
8630
8895
|
* Announce a message via the polite live region. Empty messages are
|
|
8631
8896
|
* ignored. The region is cleared ~16ms before being repopulated so AT
|
|
@@ -8635,37 +8900,7 @@ class CngxMenuAnnouncer {
|
|
|
8635
8900
|
if (!message) {
|
|
8636
8901
|
return;
|
|
8637
8902
|
}
|
|
8638
|
-
|
|
8639
|
-
if (!element) {
|
|
8640
|
-
return;
|
|
8641
|
-
}
|
|
8642
|
-
element.textContent = '';
|
|
8643
|
-
if (this.clearTimer) {
|
|
8644
|
-
clearTimeout(this.clearTimer);
|
|
8645
|
-
}
|
|
8646
|
-
this.clearTimer = setTimeout(() => {
|
|
8647
|
-
element.textContent = message;
|
|
8648
|
-
this.clearTimer = null;
|
|
8649
|
-
}, 16);
|
|
8650
|
-
}
|
|
8651
|
-
ensureRegion() {
|
|
8652
|
-
if (this.politeElement) {
|
|
8653
|
-
return this.politeElement;
|
|
8654
|
-
}
|
|
8655
|
-
const body = this.doc.body;
|
|
8656
|
-
if (!body) {
|
|
8657
|
-
return null;
|
|
8658
|
-
}
|
|
8659
|
-
const el = this.doc.createElement('div');
|
|
8660
|
-
el.setAttribute('aria-live', 'polite');
|
|
8661
|
-
el.setAttribute('role', 'status');
|
|
8662
|
-
el.setAttribute('aria-atomic', 'true');
|
|
8663
|
-
el.className = 'cngx-menu-announcer';
|
|
8664
|
-
el.style.cssText =
|
|
8665
|
-
'position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0';
|
|
8666
|
-
body.appendChild(el);
|
|
8667
|
-
this.politeElement = el;
|
|
8668
|
-
return el;
|
|
8903
|
+
this.announcer.announce(message, 'polite');
|
|
8669
8904
|
}
|
|
8670
8905
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMenuAnnouncer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
8671
8906
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMenuAnnouncer, providedIn: 'root' });
|
|
@@ -8836,18 +9071,10 @@ function injectMenuConfig() {
|
|
|
8836
9071
|
*/
|
|
8837
9072
|
const CNGX_MENU_HOST = new InjectionToken('CNGX_MENU_HOST');
|
|
8838
9073
|
|
|
8839
|
-
/**
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
*
|
|
8844
|
-
* @category common/interactive/menu
|
|
8845
|
-
* @wcag AA
|
|
8846
|
-
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/interactive/menu/menu-submenu.token.ts
|
|
8847
|
-
* @since 0.1.0
|
|
8848
|
-
*/
|
|
8849
|
-
const CNGX_MENU_SUBMENU_ITEM = new InjectionToken('CNGX_MENU_SUBMENU_ITEM');
|
|
8850
|
-
|
|
9074
|
+
/** Shallow identity/length equality for the submenu registry signal. */
|
|
9075
|
+
function sameSubmenuItems(a, b) {
|
|
9076
|
+
return a.length === b.length && a.every((item, i) => item === b[i]);
|
|
9077
|
+
}
|
|
8851
9078
|
const warnedFocusHosts = new WeakSet();
|
|
8852
9079
|
/**
|
|
8853
9080
|
* Navigable menu container with WAI-ARIA `role="menu"` semantics.
|
|
@@ -8875,12 +9102,27 @@ class CngxMenu {
|
|
|
8875
9102
|
elementRef = inject(ElementRef);
|
|
8876
9103
|
announcer = inject(CNGX_MENU_ANNOUNCER_FACTORY)();
|
|
8877
9104
|
menuConfig = injectMenuConfig();
|
|
9105
|
+
/** Internal registry backing {@link submenuItems}. */
|
|
9106
|
+
_submenuItems = signal([], { ...(ngDevMode ? { debugName: "_submenuItems" } : /* istanbul ignore next */ {}), equal: sameSubmenuItems });
|
|
8878
9107
|
/**
|
|
8879
|
-
* Submenu directives registered
|
|
8880
|
-
*
|
|
8881
|
-
* arrow-
|
|
9108
|
+
* Submenu directives registered against this menu via DI. Empty when the
|
|
9109
|
+
* menu has no submenus. Drives the trigger's focus-stack arrow-right /
|
|
9110
|
+
* arrow-left semantics. Registration (not a content query) so a
|
|
9111
|
+
* `[cngxMenuItemSubmenu]` declared inside a wrapper component's template
|
|
9112
|
+
* is still discovered - see {@link registerSubmenuItem}.
|
|
8882
9113
|
*/
|
|
8883
|
-
submenuItems =
|
|
9114
|
+
submenuItems = this._submenuItems.asReadonly();
|
|
9115
|
+
/**
|
|
9116
|
+
* Register a submenu companion (a {@link CngxMenuSubmenuLike}) and return
|
|
9117
|
+
* its deregister callback. Called from `CngxMenuItemSubmenu`'s constructor;
|
|
9118
|
+
* the companion invokes the returned callback on destroy.
|
|
9119
|
+
*/
|
|
9120
|
+
registerSubmenuItem(item) {
|
|
9121
|
+
this._submenuItems.update((items) => [...items, item]);
|
|
9122
|
+
return () => {
|
|
9123
|
+
this._submenuItems.update((items) => items.filter((i) => i !== item));
|
|
9124
|
+
};
|
|
9125
|
+
}
|
|
8884
9126
|
/** Emits the activated item's value on Enter/Space/click. */
|
|
8885
9127
|
itemActivated = outputFromObservable(outputToObservable(this.ad.activated).pipe(takeUntilDestroyed()));
|
|
8886
9128
|
constructor() {
|
|
@@ -8913,7 +9155,7 @@ class CngxMenu {
|
|
|
8913
9155
|
el.focus({ preventScroll: true });
|
|
8914
9156
|
}
|
|
8915
9157
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMenu, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
8916
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.
|
|
9158
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxMenu, isStandalone: true, selector: "[cngxMenu]", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { itemActivated: "itemActivated" }, host: { attributes: { "role": "menu", "tabindex": "0" }, properties: { "attr.aria-label": "label()" } }, providers: [{ provide: CNGX_MENU_HOST, useExisting: CngxMenu }], exportAs: ["cngxMenu"], hostDirectives: [{ directive: i1.CngxActiveDescendant, inputs: ["orientation", "orientation", "loop", "loop", "typeahead", "typeahead", "autoHighlightFirst", "autoHighlightFirst"] }], ngImport: i0 });
|
|
8917
9159
|
}
|
|
8918
9160
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMenu, decorators: [{
|
|
8919
9161
|
type: Directive,
|
|
@@ -8934,9 +9176,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
8934
9176
|
'[attr.aria-label]': 'label()',
|
|
8935
9177
|
},
|
|
8936
9178
|
}]
|
|
8937
|
-
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }],
|
|
8938
|
-
|
|
8939
|
-
|
|
9179
|
+
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], itemActivated: [{ type: i0.Output, args: ["itemActivated"] }] } });
|
|
9180
|
+
|
|
9181
|
+
/**
|
|
9182
|
+
* DI token a submenu-companion directive provides so composers can resolve
|
|
9183
|
+
* its {@link CngxMenuSubmenuLike} contract via `inject(CNGX_MENU_SUBMENU_ITEM)`
|
|
9184
|
+
* from within the submenu subtree.
|
|
9185
|
+
*
|
|
9186
|
+
* Note: the surrounding `CngxMenu` does NOT discover submenus through this
|
|
9187
|
+
* token. Discovery is DI registration via
|
|
9188
|
+
* {@link CngxMenuHost.registerSubmenuItem} (which crosses component view
|
|
9189
|
+
* boundaries a content query cannot), and the result is exposed on
|
|
9190
|
+
* `CngxMenuHost.submenuItems`.
|
|
9191
|
+
*
|
|
9192
|
+
* @category common/interactive/menu
|
|
9193
|
+
* @wcag AA
|
|
9194
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/interactive/menu/menu-submenu.token.ts
|
|
9195
|
+
* @since 0.1.0
|
|
9196
|
+
*/
|
|
9197
|
+
const CNGX_MENU_SUBMENU_ITEM = new InjectionToken('CNGX_MENU_SUBMENU_ITEM');
|
|
9198
|
+
/**
|
|
9199
|
+
* DI token a component shell provides to wire `CngxMenuItemSubmenu`'s popover
|
|
9200
|
+
* and inner menu without template inputs. Resolution order in the brain:
|
|
9201
|
+
* explicit input first, then this token, else inert.
|
|
9202
|
+
*
|
|
9203
|
+
* @category common/interactive/menu
|
|
9204
|
+
* @wcag AA
|
|
9205
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/interactive/menu/menu-submenu.token.ts
|
|
9206
|
+
* @since 0.1.0
|
|
9207
|
+
*/
|
|
9208
|
+
const CNGX_MENU_SUBMENU_WIRING = new InjectionToken('CNGX_MENU_SUBMENU_WIRING');
|
|
8940
9209
|
|
|
8941
9210
|
/**
|
|
8942
9211
|
* A single action menuitem registered with a surrounding `CngxActiveDescendant`.
|
|
@@ -9145,14 +9414,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
9145
9414
|
* submenu source so the menu trigger can drive arrow-right / arrow-left
|
|
9146
9415
|
* focus-stack semantics.
|
|
9147
9416
|
*
|
|
9148
|
-
*
|
|
9149
|
-
* - `cngxMenuItemSubmenu
|
|
9150
|
-
*
|
|
9151
|
-
*
|
|
9417
|
+
* Wiring, two ways (Bridge-Input-Regel):
|
|
9418
|
+
* - `cngxMenuItemSubmenu` + `submenuMenu` inputs bind the popover and the
|
|
9419
|
+
* inner `CngxMenu` directly, or
|
|
9420
|
+
* - a component shell provides `CNGX_MENU_SUBMENU_WIRING` and omits both
|
|
9421
|
+
* inputs, so the brain resolves them from DI.
|
|
9152
9422
|
*
|
|
9153
|
-
*
|
|
9154
|
-
*
|
|
9155
|
-
*
|
|
9423
|
+
* Until one source is present the brain stays inert: it renders neither
|
|
9424
|
+
* `aria-haspopup` nor `aria-expanded` and opens nothing.
|
|
9425
|
+
*
|
|
9426
|
+
* The submenu popover needs no `[exclusive]` binding: a popover nested
|
|
9427
|
+
* inside another never evicts its ancestor, so opening the submenu leaves
|
|
9428
|
+
* the parent popover open by default. An explicit `[exclusive]="false"`
|
|
9429
|
+
* remains valid (it additionally opts the submenu out of evicting
|
|
9430
|
+
* unrelated sibling popovers) but is no longer required for nesting.
|
|
9156
9431
|
*
|
|
9157
9432
|
* @category common/interactive/menu
|
|
9158
9433
|
* @docsKind primary
|
|
@@ -9163,74 +9438,85 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
9163
9438
|
* <example-url>http://localhost:4200/#/common/interactive/menu/submenu/two-level-submenu</example-url>
|
|
9164
9439
|
*/
|
|
9165
9440
|
class CngxMenuItemSubmenu {
|
|
9166
|
-
/**
|
|
9167
|
-
|
|
9168
|
-
|
|
9169
|
-
|
|
9441
|
+
/**
|
|
9442
|
+
* Popover wrapping the submenu. Optional - a component shell can instead
|
|
9443
|
+
* provide `CNGX_MENU_SUBMENU_WIRING` (Bridge-Input-Regel: an optional DI
|
|
9444
|
+
* fallback forbids `input.required`; the empty-string transform keeps a
|
|
9445
|
+
* bare `cngxMenuItemSubmenu` attribute from binding `''`).
|
|
9446
|
+
*/
|
|
9447
|
+
popover = input(undefined, { ...(ngDevMode ? { debugName: "popover" } : /* istanbul ignore next */ {}), alias: 'cngxMenuItemSubmenu',
|
|
9448
|
+
transform: (v) => (typeof v === 'string' ? undefined : v) });
|
|
9449
|
+
/** Inner `CngxMenuHost` (the submenu's own `CngxMenu`). Optional; resolved from DI wiring when omitted. */
|
|
9450
|
+
submenuMenu = input(undefined, { ...(ngDevMode ? { debugName: "submenuMenu" } : /* istanbul ignore next */ {}), transform: (v) => (typeof v === 'string' ? undefined : v) });
|
|
9170
9451
|
elementRef = inject((ElementRef));
|
|
9171
9452
|
menuItem = inject(CngxMenuItem, { optional: true, self: true });
|
|
9453
|
+
menuHost = inject(CNGX_MENU_HOST, { optional: true });
|
|
9454
|
+
wiring = inject(CNGX_MENU_SUBMENU_WIRING, { optional: true });
|
|
9455
|
+
announcer = inject(CNGX_MENU_ANNOUNCER_FACTORY)();
|
|
9456
|
+
menuConfig = injectMenuConfig();
|
|
9457
|
+
destroyRef = inject(DestroyRef);
|
|
9172
9458
|
ownId = nextUid('cngx-menu-submenu');
|
|
9459
|
+
/** Popover resolved from the input, else the DI wiring fallback. */
|
|
9460
|
+
resolvedPopover = computed(() => this.popover() ?? this.wiring?.popover() ?? null, ...(ngDevMode ? [{ debugName: "resolvedPopover" }] : /* istanbul ignore next */ []));
|
|
9461
|
+
/** Inner menu resolved from the input, else the DI wiring fallback. */
|
|
9462
|
+
resolvedMenu = computed(() => this.submenuMenu() ?? this.wiring?.menu() ?? null, ...(ngDevMode ? [{ debugName: "resolvedMenu" }] : /* istanbul ignore next */ []));
|
|
9463
|
+
/** True once both the popover and inner menu are wired (input or DI). */
|
|
9464
|
+
wired = computed(() => this.resolvedPopover() !== null && this.resolvedMenu() !== null, ...(ngDevMode ? [{ debugName: "wired" }] : /* istanbul ignore next */ []));
|
|
9173
9465
|
/**
|
|
9174
|
-
* Effective id used by `
|
|
9466
|
+
* Effective id used by `CngxMenuHost.submenuItems().find(s => s.id ===
|
|
9175
9467
|
* activeId)`. When applied alongside `[cngxMenuItem]` the directive
|
|
9176
9468
|
* mirrors the sibling's id so the trigger's lookup matches the AD's
|
|
9177
9469
|
* `activeId`. When applied alone (no sibling), falls back to a fresh
|
|
9178
|
-
* `nextUid
|
|
9179
|
-
* lookup is moot, but the host element still receives a valid id.
|
|
9470
|
+
* `nextUid`.
|
|
9180
9471
|
*/
|
|
9181
9472
|
get id() {
|
|
9182
9473
|
return this.menuItem?.id ?? this.ownId;
|
|
9183
9474
|
}
|
|
9184
|
-
isOpen = computed(() => this.
|
|
9185
|
-
/**
|
|
9186
|
-
|
|
9475
|
+
isOpen = computed(() => this.resolvedPopover()?.isVisible() ?? false, ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
9476
|
+
/** `aria-haspopup="menu"` only while wired; `null` keeps the brain inert. */
|
|
9477
|
+
ariaHaspopup = computed(() => (this.wired() ? 'menu' : null), ...(ngDevMode ? [{ debugName: "ariaHaspopup" }] : /* istanbul ignore next */ []));
|
|
9478
|
+
/** `aria-expanded` mirrors open state while wired; `null` otherwise. */
|
|
9479
|
+
ariaExpanded = computed(() => this.wired() ? this.isOpen() : null, ...(ngDevMode ? [{ debugName: "ariaExpanded" }] : /* istanbul ignore next */ []));
|
|
9480
|
+
/** CSS Anchor Positioning name - `null` while unwired. */
|
|
9481
|
+
cssAnchorName = computed(() => {
|
|
9482
|
+
const popover = this.resolvedPopover();
|
|
9483
|
+
return popover ? `--cngx-pop-${popover.id()}` : null;
|
|
9484
|
+
}, ...(ngDevMode ? [{ debugName: "cssAnchorName" }] : /* istanbul ignore next */ []));
|
|
9187
9485
|
get inner() {
|
|
9188
|
-
return this.
|
|
9486
|
+
return this.resolvedMenu();
|
|
9189
9487
|
}
|
|
9190
9488
|
open() {
|
|
9191
|
-
this.
|
|
9192
|
-
if (!
|
|
9193
|
-
|
|
9489
|
+
const popover = this.resolvedPopover();
|
|
9490
|
+
if (!popover) {
|
|
9491
|
+
return;
|
|
9194
9492
|
}
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
|
-
|
|
9198
|
-
this.popover().hide();
|
|
9493
|
+
popover.anchorElement.set(this.elementRef.nativeElement);
|
|
9494
|
+
if (!popover.isVisible()) {
|
|
9495
|
+
popover.show();
|
|
9199
9496
|
}
|
|
9200
9497
|
}
|
|
9201
|
-
|
|
9202
|
-
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
anyHovered = computed(() => this.parentHovered() || this.popoverHovered(), ...(ngDevMode ? [{ debugName: "anyHovered" }] : /* istanbul ignore next */ []));
|
|
9206
|
-
closeTimer = null;
|
|
9207
|
-
handleParentEnter() {
|
|
9208
|
-
this.parentHovered.set(true);
|
|
9209
|
-
}
|
|
9210
|
-
handleParentLeave() {
|
|
9211
|
-
this.parentHovered.set(false);
|
|
9212
|
-
}
|
|
9213
|
-
cancelCloseTimer() {
|
|
9214
|
-
if (this.closeTimer !== null) {
|
|
9215
|
-
clearTimeout(this.closeTimer);
|
|
9216
|
-
this.closeTimer = null;
|
|
9217
|
-
}
|
|
9218
|
-
}
|
|
9219
|
-
scheduleClose() {
|
|
9220
|
-
this.cancelCloseTimer();
|
|
9221
|
-
const delay = this.menuConfig.submenuCloseDelay;
|
|
9222
|
-
if (delay <= 0) {
|
|
9223
|
-
this.close();
|
|
9224
|
-
return;
|
|
9498
|
+
close() {
|
|
9499
|
+
const popover = this.resolvedPopover();
|
|
9500
|
+
if (popover?.isVisible()) {
|
|
9501
|
+
popover.hide();
|
|
9225
9502
|
}
|
|
9226
|
-
this.closeTimer = setTimeout(() => {
|
|
9227
|
-
this.closeTimer = null;
|
|
9228
|
-
this.close();
|
|
9229
|
-
}, delay);
|
|
9230
9503
|
}
|
|
9231
|
-
|
|
9232
|
-
|
|
9233
|
-
|
|
9504
|
+
/**
|
|
9505
|
+
* Composed hover-intent atom (hostDirective). Its own host listeners cover
|
|
9506
|
+
* the parent item; the constructor effect feeds the popover panel in as a
|
|
9507
|
+
* satellite surface, so `active()` settles `true` after `submenuOpenDelay`
|
|
9508
|
+
* ms over either element and back `false` after `submenuCloseDelay` ms off
|
|
9509
|
+
* both. The atom owns every timer (and its destroy cleanup).
|
|
9510
|
+
*/
|
|
9511
|
+
intent = inject(CngxHoverIntent, { host: true });
|
|
9512
|
+
/**
|
|
9513
|
+
* `CngxMenuSubmenuLike.hoverIntent` - the debounced combined-surface hover
|
|
9514
|
+
* state. Derivation only: the brain never opens or closes anything off it.
|
|
9515
|
+
* The surrounding trigger routes the edges through its focus stack
|
|
9516
|
+
* (`connectSubmenuHoverToFocusStack`), so a hover-opened submenu is
|
|
9517
|
+
* stack-tracked and keyboard-visible exactly like a keyboard-opened one.
|
|
9518
|
+
*/
|
|
9519
|
+
hoverIntent = this.intent.active;
|
|
9234
9520
|
/**
|
|
9235
9521
|
* Transition tracker for `isOpen`. `linkedSignal` carries an explicit
|
|
9236
9522
|
* structural `equal` so the effect below only fires on a real
|
|
@@ -9243,6 +9529,14 @@ class CngxMenuItemSubmenu {
|
|
|
9243
9529
|
}),
|
|
9244
9530
|
equal: (a, b) => a.current === b.current && a.previous === b.previous });
|
|
9245
9531
|
constructor() {
|
|
9532
|
+
// Register with the surrounding menu via DI (not a content query) so this
|
|
9533
|
+
// submenu is discovered even when declared inside a wrapper component's
|
|
9534
|
+
// template. The menu reads `id` / `inner` / `isOpen` lazily at routing
|
|
9535
|
+
// time, by which point the wiring (input or DI) is resolved.
|
|
9536
|
+
const deregister = this.menuHost?.registerSubmenuItem(this);
|
|
9537
|
+
if (deregister) {
|
|
9538
|
+
this.destroyRef.onDestroy(deregister);
|
|
9539
|
+
}
|
|
9246
9540
|
effect(() => {
|
|
9247
9541
|
const { current, previous } = this.transition();
|
|
9248
9542
|
if (current === previous) {
|
|
@@ -9257,28 +9551,23 @@ class CngxMenuItemSubmenu {
|
|
|
9257
9551
|
}
|
|
9258
9552
|
});
|
|
9259
9553
|
});
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9268
|
-
|
|
9269
|
-
|
|
9270
|
-
|
|
9271
|
-
|
|
9272
|
-
afterNextRender(() => {
|
|
9273
|
-
const popoverEl = this.popover().elementRef.nativeElement;
|
|
9274
|
-
const onEnter = () => this.popoverHovered.set(true);
|
|
9275
|
-
const onLeave = () => this.popoverHovered.set(false);
|
|
9554
|
+
// Feed the popover panel into the composed hover intent as a satellite
|
|
9555
|
+
// surface. An effect (not a one-shot afterNextRender) so a popover that
|
|
9556
|
+
// resolves late - DI wiring bound after first render - still gets its
|
|
9557
|
+
// listeners, and `onCleanup` removes them unconditionally on destroy.
|
|
9558
|
+
effect((onCleanup) => {
|
|
9559
|
+
const popover = this.resolvedPopover();
|
|
9560
|
+
if (!popover) {
|
|
9561
|
+
return;
|
|
9562
|
+
}
|
|
9563
|
+
const popoverEl = popover.elementRef.nativeElement;
|
|
9564
|
+
const onEnter = () => this.intent.notifyEnter();
|
|
9565
|
+
const onLeave = () => this.intent.notifyLeave();
|
|
9276
9566
|
popoverEl.addEventListener('pointerenter', onEnter);
|
|
9277
9567
|
popoverEl.addEventListener('pointerleave', onLeave);
|
|
9278
|
-
|
|
9568
|
+
onCleanup(() => {
|
|
9279
9569
|
popoverEl.removeEventListener('pointerenter', onEnter);
|
|
9280
9570
|
popoverEl.removeEventListener('pointerleave', onLeave);
|
|
9281
|
-
this.cancelCloseTimer();
|
|
9282
9571
|
});
|
|
9283
9572
|
});
|
|
9284
9573
|
if (isDevMode()) {
|
|
@@ -9289,12 +9578,29 @@ class CngxMenuItemSubmenu {
|
|
|
9289
9578
|
'because CngxActiveDescendant only highlights CngxMenuItem nodes. ' +
|
|
9290
9579
|
'Add [cngxMenuItem] alongside [cngxMenuItemSubmenu] on the same element.');
|
|
9291
9580
|
}
|
|
9292
|
-
|
|
9581
|
+
if (!this.wired() && !this.wiring) {
|
|
9582
|
+
console.warn('[cngxMenuItemSubmenu] has no popover/menu source. Bind [cngxMenuItemSubmenu] and ' +
|
|
9583
|
+
'[submenuMenu], or provide CNGX_MENU_SUBMENU_WIRING from a wrapping component. ' +
|
|
9584
|
+
'The brain stays inert (no aria-haspopup / aria-expanded) until one is present.');
|
|
9585
|
+
}
|
|
9586
|
+
const popover = this.resolvedPopover();
|
|
9587
|
+
if (popover) {
|
|
9588
|
+
warnMissingSubmenuFallbacks(popover.elementRef.nativeElement);
|
|
9589
|
+
}
|
|
9293
9590
|
});
|
|
9294
9591
|
}
|
|
9295
9592
|
}
|
|
9296
9593
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMenuItemSubmenu, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
9297
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxMenuItemSubmenu, isStandalone: true, selector: "[cngxMenuItemSubmenu]", inputs: { popover: { classPropertyName: "popover", publicName: "cngxMenuItemSubmenu", isSignal: true, isRequired:
|
|
9594
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxMenuItemSubmenu, isStandalone: true, selector: "[cngxMenuItemSubmenu]", inputs: { popover: { classPropertyName: "popover", publicName: "cngxMenuItemSubmenu", isSignal: true, isRequired: false, transformFunction: null }, submenuMenu: { classPropertyName: "submenuMenu", publicName: "submenuMenu", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "id": "id", "attr.aria-haspopup": "ariaHaspopup()", "attr.aria-expanded": "ariaExpanded()", "style.anchor-name": "cssAnchorName()" } }, providers: [
|
|
9595
|
+
{ provide: CNGX_MENU_SUBMENU_ITEM, useExisting: CngxMenuItemSubmenu },
|
|
9596
|
+
{
|
|
9597
|
+
provide: CNGX_HOVER_INTENT_DEFAULTS,
|
|
9598
|
+
useFactory: () => {
|
|
9599
|
+
const cfg = injectMenuConfig();
|
|
9600
|
+
return { enterDelay: cfg.submenuOpenDelay, leaveDelay: cfg.submenuCloseDelay };
|
|
9601
|
+
},
|
|
9602
|
+
},
|
|
9603
|
+
], exportAs: ["cngxMenuItemSubmenu"], hostDirectives: [{ directive: CngxHoverIntent }], ngImport: i0 });
|
|
9298
9604
|
}
|
|
9299
9605
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMenuItemSubmenu, decorators: [{
|
|
9300
9606
|
type: Directive,
|
|
@@ -9302,17 +9608,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
9302
9608
|
selector: '[cngxMenuItemSubmenu]',
|
|
9303
9609
|
exportAs: 'cngxMenuItemSubmenu',
|
|
9304
9610
|
standalone: true,
|
|
9305
|
-
|
|
9611
|
+
// Debounced hover intent over the parent item: CngxHoverIntent's own
|
|
9612
|
+
// pointerenter/pointerleave listeners replace hand-rolled ones; the popover
|
|
9613
|
+
// panel is fed in as a satellite surface (see the constructor effect), so
|
|
9614
|
+
// ONE debounce covers parent + panel and crossing the gap never flickers.
|
|
9615
|
+
hostDirectives: [CngxHoverIntent],
|
|
9616
|
+
// Element-injector provider: the composed CngxHoverIntent resolves its dwell
|
|
9617
|
+
// defaults from here, so the menu config's submenuOpenDelay/submenuCloseDelay
|
|
9618
|
+
// reach the atom without per-instance inputs (mirrors CngxSidenav).
|
|
9619
|
+
providers: [
|
|
9620
|
+
{ provide: CNGX_MENU_SUBMENU_ITEM, useExisting: CngxMenuItemSubmenu },
|
|
9621
|
+
{
|
|
9622
|
+
provide: CNGX_HOVER_INTENT_DEFAULTS,
|
|
9623
|
+
useFactory: () => {
|
|
9624
|
+
const cfg = injectMenuConfig();
|
|
9625
|
+
return { enterDelay: cfg.submenuOpenDelay, leaveDelay: cfg.submenuCloseDelay };
|
|
9626
|
+
},
|
|
9627
|
+
},
|
|
9628
|
+
],
|
|
9306
9629
|
host: {
|
|
9307
9630
|
'[id]': 'id',
|
|
9308
|
-
'[attr.aria-haspopup]': '
|
|
9309
|
-
'[attr.aria-expanded]': '
|
|
9631
|
+
'[attr.aria-haspopup]': 'ariaHaspopup()',
|
|
9632
|
+
'[attr.aria-expanded]': 'ariaExpanded()',
|
|
9310
9633
|
'[style.anchor-name]': 'cssAnchorName()',
|
|
9311
|
-
'(pointerenter)': 'handleParentEnter()',
|
|
9312
|
-
'(pointerleave)': 'handleParentLeave()',
|
|
9313
9634
|
},
|
|
9314
9635
|
}]
|
|
9315
|
-
}], ctorParameters: () => [], propDecorators: { popover: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxMenuItemSubmenu", required:
|
|
9636
|
+
}], ctorParameters: () => [], propDecorators: { popover: [{ type: i0.Input, args: [{ isSignal: true, alias: "cngxMenuItemSubmenu", required: false }] }], submenuMenu: [{ type: i0.Input, args: [{ isSignal: true, alias: "submenuMenu", required: false }] }] } });
|
|
9316
9637
|
/**
|
|
9317
9638
|
* @internal
|
|
9318
9639
|
* Tracks which Documents have already warned about a submenu popover missing position-try-fallbacks.
|
|
@@ -9358,18 +9679,18 @@ function warnMissingSubmenuFallbacks(popoverEl) {
|
|
|
9358
9679
|
*
|
|
9359
9680
|
* The chain matches the
|
|
9360
9681
|
* `projects/forms/select/shared/select-base.css:759` precedent
|
|
9361
|
-
* (`flip-block, flip-inline, flip-block flip-inline`)
|
|
9682
|
+
* (`flip-block, flip-inline, flip-block flip-inline`) - `flip-inline`
|
|
9362
9683
|
* is the dominant submenu clip case (right submenu hits the viewport
|
|
9363
9684
|
* right edge → flips to the left side of its parent item),
|
|
9364
9685
|
* `flip-block` covers the vertical case, and the composed form
|
|
9365
9686
|
* covers diagonal clipping.
|
|
9366
9687
|
*
|
|
9367
9688
|
* `CngxMenuItemSubmenu` emits a one-shot dev-mode warning when a
|
|
9368
|
-
* submenu popover ships without `positionTryFallbacks`
|
|
9689
|
+
* submenu popover ships without `positionTryFallbacks` - the const
|
|
9369
9690
|
* is documented as the canonical opt-in.
|
|
9370
9691
|
*
|
|
9371
9692
|
* Typed as a string-literal tuple via `as const` rather than the
|
|
9372
|
-
* `PopoverPositionTryFallback` union from `@cngx/common/popover`
|
|
9693
|
+
* `PopoverPositionTryFallback` union from `@cngx/common/popover` -
|
|
9373
9694
|
* the cross-entry-point import would reverse the existing
|
|
9374
9695
|
* `popover -> interactive` dependency direction and break ng-packagr.
|
|
9375
9696
|
* Consumers binding the const to `[positionTryFallbacks]` get
|
|
@@ -9657,6 +9978,13 @@ const NOOP = { kind: 'noop' };
|
|
|
9657
9978
|
* `close-submenu`. Otherwise → `move-to-parent` (an enclosing menubar
|
|
9658
9979
|
* interprets that; a standalone menu trigger treats it as noop).
|
|
9659
9980
|
*
|
|
9981
|
+
* `onArrowRight` / `onArrowLeft` are the inline-forward / inline-back
|
|
9982
|
+
* intents, not physical keys. The dispatch site resolves the physical
|
|
9983
|
+
* arrow to its logical intent by writing direction before calling the
|
|
9984
|
+
* strategy (`resolveInlineArrowKey`), so under `rtl` physical ArrowLeft
|
|
9985
|
+
* routes to `onArrowRight`. Custom strategies therefore stay
|
|
9986
|
+
* direction-naive and inherit correct RTL behaviour for free.
|
|
9987
|
+
*
|
|
9660
9988
|
* @category common/interactive/menu
|
|
9661
9989
|
*/
|
|
9662
9990
|
function createW3CMenuStrategy() {
|
|
@@ -9688,6 +10016,266 @@ function createW3CMenuStrategy() {
|
|
|
9688
10016
|
*/
|
|
9689
10017
|
const CNGX_MENU_NAV_STRATEGY = new InjectionToken('CngxMenuNavStrategy', { providedIn: 'root', factory: createW3CMenuStrategy });
|
|
9690
10018
|
|
|
10019
|
+
/**
|
|
10020
|
+
* Default focus-stack implementation. Behaviour matches the W3C APG Menu
|
|
10021
|
+
* Button pattern that `CngxMenuTrigger` shipped inline before extraction.
|
|
10022
|
+
*
|
|
10023
|
+
* @category common/interactive/menu
|
|
10024
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/interactive/menu/menu-focus-stack.ts
|
|
10025
|
+
* @since 0.1.0
|
|
10026
|
+
*/
|
|
10027
|
+
function createMenuFocusStack(deps) {
|
|
10028
|
+
const submenuStack = signal([], ...(ngDevMode ? [{ debugName: "submenuStack" }] : /* istanbul ignore next */ []));
|
|
10029
|
+
let savedFocus = null;
|
|
10030
|
+
const effectiveMenu = () => {
|
|
10031
|
+
const stack = submenuStack();
|
|
10032
|
+
return stack.length === 0 ? deps.rootMenu() : stack[stack.length - 1];
|
|
10033
|
+
};
|
|
10034
|
+
const findSubmenu = (menu, activeId) => {
|
|
10035
|
+
if (!activeId) {
|
|
10036
|
+
return undefined;
|
|
10037
|
+
}
|
|
10038
|
+
return menu.submenuItems().find((s) => s.id === activeId);
|
|
10039
|
+
};
|
|
10040
|
+
// Push the submenu's inner menu onto the stack and highlight its first item,
|
|
10041
|
+
// but only once - the external-open note (organism openAsSubmenu) and the open
|
|
10042
|
+
// paths (ArrowRight / click) both funnel here, so the guard keeps a submenu
|
|
10043
|
+
// from being pushed or re-highlighted twice. `inner` is null for an inert
|
|
10044
|
+
// brain: the context-menu organism applies CngxMenuItemSubmenu to every item,
|
|
10045
|
+
// so leaf items register a submenu-less brain whose `inner` never resolves.
|
|
10046
|
+
// Skip those - a leaf has no submenu to track.
|
|
10047
|
+
const pushIfAbsent = (submenu) => {
|
|
10048
|
+
const inner = submenu.inner;
|
|
10049
|
+
if (inner === null || submenuStack().includes(inner)) {
|
|
10050
|
+
return;
|
|
10051
|
+
}
|
|
10052
|
+
submenuStack.update((s) => [...s, inner]);
|
|
10053
|
+
inner.ad.highlightFirst();
|
|
10054
|
+
};
|
|
10055
|
+
const openSubmenu = (submenu) => {
|
|
10056
|
+
submenu.open();
|
|
10057
|
+
pushIfAbsent(submenu);
|
|
10058
|
+
};
|
|
10059
|
+
const popSubmenu = () => {
|
|
10060
|
+
const stack = submenuStack();
|
|
10061
|
+
if (stack.length === 0) {
|
|
10062
|
+
return;
|
|
10063
|
+
}
|
|
10064
|
+
const top = stack[stack.length - 1];
|
|
10065
|
+
const parent = stack.length === 1 ? deps.rootMenu() : stack[stack.length - 2];
|
|
10066
|
+
const submenu = parent.submenuItems().find((s) => s.inner === top);
|
|
10067
|
+
submenu?.close();
|
|
10068
|
+
submenuStack.update((prev) => prev.slice(0, -1));
|
|
10069
|
+
};
|
|
10070
|
+
const reset = () => {
|
|
10071
|
+
const stack = submenuStack();
|
|
10072
|
+
for (let i = stack.length - 1; i >= 0; i--) {
|
|
10073
|
+
const inner = stack[i];
|
|
10074
|
+
const parent = i === 0 ? deps.rootMenu() : stack[i - 1];
|
|
10075
|
+
const submenu = parent.submenuItems().find((s) => s.inner === inner);
|
|
10076
|
+
submenu?.close();
|
|
10077
|
+
}
|
|
10078
|
+
submenuStack.set([]);
|
|
10079
|
+
};
|
|
10080
|
+
const closeAll = () => {
|
|
10081
|
+
reset();
|
|
10082
|
+
deps.popover().hide();
|
|
10083
|
+
};
|
|
10084
|
+
return {
|
|
10085
|
+
stack: submenuStack.asReadonly(),
|
|
10086
|
+
effectiveMenu,
|
|
10087
|
+
activeSubmenu() {
|
|
10088
|
+
const menu = effectiveMenu();
|
|
10089
|
+
return findSubmenu(menu, menu.ad.activeId());
|
|
10090
|
+
},
|
|
10091
|
+
captureFocus() {
|
|
10092
|
+
if (savedFocus === null) {
|
|
10093
|
+
const active = deps.document.activeElement;
|
|
10094
|
+
savedFocus = active instanceof HTMLElement ? active : null;
|
|
10095
|
+
}
|
|
10096
|
+
},
|
|
10097
|
+
restoreFocus() {
|
|
10098
|
+
const target = savedFocus;
|
|
10099
|
+
savedFocus = null;
|
|
10100
|
+
if (!target) {
|
|
10101
|
+
return;
|
|
10102
|
+
}
|
|
10103
|
+
queueMicrotask(() => {
|
|
10104
|
+
target.focus();
|
|
10105
|
+
});
|
|
10106
|
+
},
|
|
10107
|
+
handleEscape(event) {
|
|
10108
|
+
event.preventDefault();
|
|
10109
|
+
if (submenuStack().length > 0) {
|
|
10110
|
+
event.stopPropagation();
|
|
10111
|
+
popSubmenu();
|
|
10112
|
+
}
|
|
10113
|
+
else {
|
|
10114
|
+
deps.popover().hide();
|
|
10115
|
+
}
|
|
10116
|
+
},
|
|
10117
|
+
handleArrowRight(menu, event) {
|
|
10118
|
+
const activeId = menu.ad.activeId();
|
|
10119
|
+
const submenu = findSubmenu(menu, activeId);
|
|
10120
|
+
const action = deps.nav.onArrowRight({
|
|
10121
|
+
activeId,
|
|
10122
|
+
hasSubmenu: !!submenu,
|
|
10123
|
+
submenuOpen: submenu?.isOpen() ?? false,
|
|
10124
|
+
});
|
|
10125
|
+
if (action.kind === 'open-submenu' && submenu) {
|
|
10126
|
+
event.preventDefault();
|
|
10127
|
+
openSubmenu(submenu);
|
|
10128
|
+
}
|
|
10129
|
+
},
|
|
10130
|
+
handleArrowLeft(menu, event) {
|
|
10131
|
+
const stackOpen = submenuStack().length > 0;
|
|
10132
|
+
const action = deps.nav.onArrowLeft({
|
|
10133
|
+
activeId: menu.ad.activeId(),
|
|
10134
|
+
hasSubmenu: false,
|
|
10135
|
+
submenuOpen: stackOpen,
|
|
10136
|
+
});
|
|
10137
|
+
if (action.kind === 'close-submenu' && stackOpen) {
|
|
10138
|
+
event.preventDefault();
|
|
10139
|
+
popSubmenu();
|
|
10140
|
+
}
|
|
10141
|
+
},
|
|
10142
|
+
handleActivation(menu, event) {
|
|
10143
|
+
const ad = menu.ad;
|
|
10144
|
+
if (!ad.activeItem()) {
|
|
10145
|
+
return;
|
|
10146
|
+
}
|
|
10147
|
+
event.preventDefault();
|
|
10148
|
+
const submenu = findSubmenu(menu, ad.activeId());
|
|
10149
|
+
if (submenu) {
|
|
10150
|
+
openSubmenu(submenu);
|
|
10151
|
+
}
|
|
10152
|
+
else {
|
|
10153
|
+
ad.activateCurrent();
|
|
10154
|
+
closeAll();
|
|
10155
|
+
}
|
|
10156
|
+
},
|
|
10157
|
+
openSubmenuFor(submenu) {
|
|
10158
|
+
// Inert brain (organism leaf item - no popover, `inner` never resolves):
|
|
10159
|
+
// nothing to open, and chain-correcting for it would tear down the open
|
|
10160
|
+
// branch on an incidental pointer sweep across a leaf row.
|
|
10161
|
+
const inner = submenu.inner;
|
|
10162
|
+
if (inner === null || submenuStack().includes(inner)) {
|
|
10163
|
+
return;
|
|
10164
|
+
}
|
|
10165
|
+
// Chain correction: locate the submenu's parent menu in the open chain
|
|
10166
|
+
// and pop any levels above it, so a hover onto a sibling parent while
|
|
10167
|
+
// another branch is open never produces a forked stack. Keyboard paths
|
|
10168
|
+
// always call with the parent already on top, so the loop no-ops there.
|
|
10169
|
+
const chain = [deps.rootMenu(), ...submenuStack()];
|
|
10170
|
+
const parentIndex = chain.findIndex((menu) => menu.submenuItems().includes(submenu));
|
|
10171
|
+
if (parentIndex < 0) {
|
|
10172
|
+
// Parent menu is not part of the open chain (its branch was popped
|
|
10173
|
+
// between the intent edge and this call): opening would show an
|
|
10174
|
+
// orphaned popover and push a forked stack entry.
|
|
10175
|
+
return;
|
|
10176
|
+
}
|
|
10177
|
+
while (submenuStack().length > parentIndex) {
|
|
10178
|
+
popSubmenu();
|
|
10179
|
+
}
|
|
10180
|
+
openSubmenu(submenu);
|
|
10181
|
+
},
|
|
10182
|
+
closeSubmenuFor(submenu) {
|
|
10183
|
+
const inner = submenu.inner;
|
|
10184
|
+
if (inner === null) {
|
|
10185
|
+
// Inert brain - nothing was ever open.
|
|
10186
|
+
return;
|
|
10187
|
+
}
|
|
10188
|
+
if (!submenuStack().includes(inner)) {
|
|
10189
|
+
// Not stack-tracked (e.g. already popped by a sibling's
|
|
10190
|
+
// chain-correcting open) - only ensure the popover is hidden.
|
|
10191
|
+
submenu.close();
|
|
10192
|
+
return;
|
|
10193
|
+
}
|
|
10194
|
+
while (submenuStack().includes(inner)) {
|
|
10195
|
+
popSubmenu();
|
|
10196
|
+
}
|
|
10197
|
+
},
|
|
10198
|
+
noteSubmenuOpened(submenu) {
|
|
10199
|
+
pushIfAbsent(submenu);
|
|
10200
|
+
},
|
|
10201
|
+
closeAll,
|
|
10202
|
+
reset,
|
|
10203
|
+
};
|
|
10204
|
+
}
|
|
10205
|
+
/**
|
|
10206
|
+
* Route submenu hover intent through the focus stack. Watches the
|
|
10207
|
+
* {@link CngxMenuSubmenuLike.hoverIntent} signal of every submenu companion
|
|
10208
|
+
* registered anywhere in the menu tree and routes its edges through the same
|
|
10209
|
+
* primitives keyboard and click use: a settled hover opens via
|
|
10210
|
+
* {@link CngxMenuFocusStack.openSubmenuFor} (stack-tracked, first item
|
|
10211
|
+
* highlighted, keyboard-visible), a settled un-hover closes via
|
|
10212
|
+
* {@link CngxMenuFocusStack.closeSubmenuFor} (stack popped innermost-first).
|
|
10213
|
+
* The submenu companion itself owns NO open/close mechanics for hover - it
|
|
10214
|
+
* only derives intent.
|
|
10215
|
+
*
|
|
10216
|
+
* The walk covers the WHOLE registered tree, not just the open chain: a
|
|
10217
|
+
* submenu whose menu drops out of the chain (popped by a chain-correcting
|
|
10218
|
+
* open, cleared by `reset()`) still decays its intent afterwards, and that
|
|
10219
|
+
* false edge must be observed or the bookkeeping would go stale and fire a
|
|
10220
|
+
* spurious close when the menu re-enters the chain. Items in a hidden menu
|
|
10221
|
+
* cannot produce real pointer events, so the extra tracking never opens
|
|
10222
|
+
* anything on its own.
|
|
10223
|
+
*
|
|
10224
|
+
* Edge-driven, not state-reconciling: a keyboard-opened submenu whose intent
|
|
10225
|
+
* never settled `true` is left alone, so pointer-less operation is unchanged.
|
|
10226
|
+
*
|
|
10227
|
+
* Must run in an injection context (constructor / field initializer) - it
|
|
10228
|
+
* installs an `effect`. Every focus-stack owner wires it once:
|
|
10229
|
+
* `CngxMenuTrigger`, `CngxContextMenuTrigger`, and `CngxContextMenuFor`.
|
|
10230
|
+
*
|
|
10231
|
+
* @category common/interactive/menu
|
|
10232
|
+
* @wcag AA
|
|
10233
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/interactive/menu/menu-focus-stack.ts
|
|
10234
|
+
* @since 0.1.0
|
|
10235
|
+
* @relatedTo CngxMenuItemSubmenu, CngxMenuTrigger, CngxContextMenuTrigger, CNGX_MENU_FOCUS_STACK_FACTORY
|
|
10236
|
+
*/
|
|
10237
|
+
function connectSubmenuHoverToFocusStack(deps) {
|
|
10238
|
+
const lastIntent = new WeakMap();
|
|
10239
|
+
const visit = (menu) => {
|
|
10240
|
+
for (const submenu of menu.submenuItems()) {
|
|
10241
|
+
const intent = submenu.hoverIntent?.() ?? false;
|
|
10242
|
+
if ((lastIntent.get(submenu) ?? false) !== intent) {
|
|
10243
|
+
lastIntent.set(submenu, intent);
|
|
10244
|
+
untracked(() => {
|
|
10245
|
+
if (intent) {
|
|
10246
|
+
if (deps.rootOpen?.() === false) {
|
|
10247
|
+
return;
|
|
10248
|
+
}
|
|
10249
|
+
deps.focusStack.openSubmenuFor(submenu);
|
|
10250
|
+
}
|
|
10251
|
+
else {
|
|
10252
|
+
deps.focusStack.closeSubmenuFor(submenu);
|
|
10253
|
+
}
|
|
10254
|
+
});
|
|
10255
|
+
}
|
|
10256
|
+
const inner = submenu.inner;
|
|
10257
|
+
if (inner !== null) {
|
|
10258
|
+
visit(inner);
|
|
10259
|
+
}
|
|
10260
|
+
}
|
|
10261
|
+
};
|
|
10262
|
+
effect(() => visit(deps.rootMenu()));
|
|
10263
|
+
}
|
|
10264
|
+
/**
|
|
10265
|
+
* DI token carrying the {@link CngxMenuFocusStackFactory}. Defaults to
|
|
10266
|
+
* {@link createMenuFocusStack}; override via `providers` / `viewProviders`
|
|
10267
|
+
* to swap the submenu focus-stack model (non-W3C keyboard routing,
|
|
10268
|
+
* telemetry-wrapped traversal, test-doubled stack) without forking the
|
|
10269
|
+
* trigger.
|
|
10270
|
+
*
|
|
10271
|
+
* @category common/interactive/menu
|
|
10272
|
+
* @wcag AA
|
|
10273
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/interactive/menu/menu-focus-stack.ts
|
|
10274
|
+
* @since 0.1.0
|
|
10275
|
+
* @relatedTo CngxMenuTrigger, CngxContextMenuTrigger, CNGX_MENU_NAV_STRATEGY
|
|
10276
|
+
*/
|
|
10277
|
+
const CNGX_MENU_FOCUS_STACK_FACTORY = new InjectionToken('CNGX_MENU_FOCUS_STACK_FACTORY', { providedIn: 'root', factory: () => createMenuFocusStack });
|
|
10278
|
+
|
|
9691
10279
|
/**
|
|
9692
10280
|
* Override one or more ARIA strings (English defaults). Unset keys keep
|
|
9693
10281
|
* their default value, so consumers can supply only the locale strings
|
|
@@ -9711,9 +10299,11 @@ function withTypeaheadDebounce(ms) {
|
|
|
9711
10299
|
return defineMenuConfigFeature((cfg) => ({ ...cfg, typeaheadDebounce: ms }));
|
|
9712
10300
|
}
|
|
9713
10301
|
/**
|
|
9714
|
-
* Override the
|
|
9715
|
-
* submenu
|
|
9716
|
-
*
|
|
10302
|
+
* Override the hover dwell (milliseconds) before a hovered submenu parent
|
|
10303
|
+
* opens its submenu. Feeds the enter delay of the hover intent
|
|
10304
|
+
* `CngxMenuItemSubmenu` composes - a pointer that merely sweeps across the
|
|
10305
|
+
* parent never opens. Default: `0` (open on the first settled hover tick).
|
|
10306
|
+
* Keyboard and click open paths are unaffected.
|
|
9717
10307
|
*
|
|
9718
10308
|
* @category common/interactive/menu
|
|
9719
10309
|
*/
|
|
@@ -9721,9 +10311,11 @@ function withSubmenuOpenDelay(ms) {
|
|
|
9721
10311
|
return defineMenuConfigFeature((cfg) => ({ ...cfg, submenuOpenDelay: ms }));
|
|
9722
10312
|
}
|
|
9723
10313
|
/**
|
|
9724
|
-
* Override the
|
|
9725
|
-
*
|
|
9726
|
-
*
|
|
10314
|
+
* Override the hover dwell (milliseconds) before a hover-opened submenu
|
|
10315
|
+
* closes after the pointer has left both the parent item and the submenu
|
|
10316
|
+
* popover. Feeds the leave delay of the hover intent `CngxMenuItemSubmenu`
|
|
10317
|
+
* composes - the grace window for crossing the gap between parent and
|
|
10318
|
+
* popover. Default: `150`.
|
|
9727
10319
|
*
|
|
9728
10320
|
* @category common/interactive/menu
|
|
9729
10321
|
*/
|
|
@@ -9732,7 +10324,7 @@ function withSubmenuCloseDelay(ms) {
|
|
|
9732
10324
|
}
|
|
9733
10325
|
/**
|
|
9734
10326
|
* Whether activating a leaf item closes the menu. Default: `true`
|
|
9735
|
-
* (menu semantics
|
|
10327
|
+
* (menu semantics - distinct from listbox/combobox which stay open).
|
|
9736
10328
|
*
|
|
9737
10329
|
* @category common/interactive/menu
|
|
9738
10330
|
*/
|
|
@@ -9960,6 +10552,165 @@ function createMenuTriggerDismissBinding(opts) {
|
|
|
9960
10552
|
};
|
|
9961
10553
|
}
|
|
9962
10554
|
|
|
10555
|
+
const DEFAULT_RESOLVE_OPEN = () => ({
|
|
10556
|
+
open: true,
|
|
10557
|
+
context: undefined,
|
|
10558
|
+
});
|
|
10559
|
+
/**
|
|
10560
|
+
* Build a {@link CngxContextMenuTriggerCore} from its dependencies. Pure
|
|
10561
|
+
* factory - no Angular DI; the caller resolves collaborators and passes
|
|
10562
|
+
* them in.
|
|
10563
|
+
*
|
|
10564
|
+
* @category common/interactive/menu
|
|
10565
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/interactive/menu/context-menu-trigger-core.ts
|
|
10566
|
+
* @since 0.1.0
|
|
10567
|
+
*/
|
|
10568
|
+
function createContextMenuTriggerCore(deps) {
|
|
10569
|
+
const resolveOpen = deps.resolveOpen ?? DEFAULT_RESOLVE_OPEN;
|
|
10570
|
+
// Shared submenu focus-stack model - identical W3C APG keyboard contract to
|
|
10571
|
+
// CngxMenuTrigger. The core owns the ArrowRight/ArrowLeft/Escape routing;
|
|
10572
|
+
// whoever forwards keydown into `handleKeydown` (the trigger host, and the
|
|
10573
|
+
// organism panel in @cngx/ui/context-menu) drives it.
|
|
10574
|
+
const focusStack = deps.focusStackFactory({
|
|
10575
|
+
rootMenu: () => deps.menu(),
|
|
10576
|
+
popover: () => deps.popover(),
|
|
10577
|
+
nav: deps.nav,
|
|
10578
|
+
document: deps.document,
|
|
10579
|
+
});
|
|
10580
|
+
const dismissBinding = createMenuTriggerDismissBinding({
|
|
10581
|
+
popover: () => deps.popover(),
|
|
10582
|
+
hostElement: deps.hostElement,
|
|
10583
|
+
menuConfig: deps.menuConfig,
|
|
10584
|
+
factory: deps.dismissFactory,
|
|
10585
|
+
onDismiss: () => deps.announcer.announce(deps.menuConfig.ariaLabels.menuDismissed),
|
|
10586
|
+
});
|
|
10587
|
+
let virtualAnchor = null;
|
|
10588
|
+
const ensureVirtualAnchor = () => {
|
|
10589
|
+
if (virtualAnchor) {
|
|
10590
|
+
return virtualAnchor;
|
|
10591
|
+
}
|
|
10592
|
+
const el = deps.document.createElement('div');
|
|
10593
|
+
el.setAttribute('aria-hidden', 'true');
|
|
10594
|
+
el.className = 'cngx-context-menu-anchor';
|
|
10595
|
+
el.style.cssText = 'position:fixed;width:0;height:0;pointer-events:none';
|
|
10596
|
+
deps.document.body.appendChild(el);
|
|
10597
|
+
virtualAnchor = el;
|
|
10598
|
+
return el;
|
|
10599
|
+
};
|
|
10600
|
+
const removeVirtualAnchor = () => {
|
|
10601
|
+
virtualAnchor?.remove();
|
|
10602
|
+
virtualAnchor = null;
|
|
10603
|
+
};
|
|
10604
|
+
const openAt = (x, y) => {
|
|
10605
|
+
// Capture the pre-open focus eagerly BEFORE show(): the effect-driven
|
|
10606
|
+
// capture races the queueMicrotask focus transfer below in real browsers
|
|
10607
|
+
// and ends up storing the menu UL instead of the pre-open target. The
|
|
10608
|
+
// effect still runs (it also attaches the dismiss binding) but the focus
|
|
10609
|
+
// stack's own `savedFocus === null` guard keeps this earlier capture.
|
|
10610
|
+
focusStack.captureFocus();
|
|
10611
|
+
const anchor = ensureVirtualAnchor();
|
|
10612
|
+
anchor.style.left = `${x}px`;
|
|
10613
|
+
anchor.style.top = `${y}px`;
|
|
10614
|
+
anchor.style.setProperty('anchor-name', `--cngx-pop-${deps.popover().id()}`);
|
|
10615
|
+
deps.popover().anchorElement.set(anchor);
|
|
10616
|
+
if (!deps.popover().isVisible()) {
|
|
10617
|
+
deps.popover().show();
|
|
10618
|
+
}
|
|
10619
|
+
// Attach the dismiss listeners eagerly here, not only from the `isOpen`
|
|
10620
|
+
// effect: `showPopover()` makes the menu visible synchronously, but the
|
|
10621
|
+
// effect runs a change-detection flush later, leaving a
|
|
10622
|
+
// visible-but-not-listening window in which an immediate scroll / blur /
|
|
10623
|
+
// outside-pointerdown would fail to dismiss. `attach()` is idempotent, so
|
|
10624
|
+
// the effect's later call is a no-op.
|
|
10625
|
+
dismissBinding.attach();
|
|
10626
|
+
deps.menu().ad.highlightFirst();
|
|
10627
|
+
// Defer one microtask so showPopover()'s top-layer DOM mutation settles
|
|
10628
|
+
// before focus moves into the menu container - matches the close-time
|
|
10629
|
+
// `restoreFocus` pattern.
|
|
10630
|
+
queueMicrotask(() => deps.menu().focus());
|
|
10631
|
+
};
|
|
10632
|
+
return {
|
|
10633
|
+
lastDismissSource: dismissBinding.lastSource,
|
|
10634
|
+
focusStack,
|
|
10635
|
+
handleContextMenu(event) {
|
|
10636
|
+
const decision = resolveOpen(event);
|
|
10637
|
+
if (!decision.open) {
|
|
10638
|
+
return;
|
|
10639
|
+
}
|
|
10640
|
+
event.preventDefault();
|
|
10641
|
+
deps.commitContext?.(decision.context);
|
|
10642
|
+
openAt(event.clientX, event.clientY);
|
|
10643
|
+
},
|
|
10644
|
+
handleKeydown(event) {
|
|
10645
|
+
// Never hijack browser/app shortcuts: Ctrl/Cmd/Alt combos pass through
|
|
10646
|
+
// untouched - the same guard the nav strategies apply. Shift stays
|
|
10647
|
+
// allowed (Shift+F10 below is the open gesture).
|
|
10648
|
+
if (event.ctrlKey || event.metaKey || event.altKey) {
|
|
10649
|
+
return;
|
|
10650
|
+
}
|
|
10651
|
+
if (event.key === 'F10' && event.shiftKey) {
|
|
10652
|
+
event.preventDefault();
|
|
10653
|
+
const rect = deps.hostElement.getBoundingClientRect();
|
|
10654
|
+
openAt(rect.left + rect.width / 2, rect.top + rect.height / 2);
|
|
10655
|
+
return;
|
|
10656
|
+
}
|
|
10657
|
+
// Submenu keyboard routing while the menu is open. Down/Up/Home/End/Enter
|
|
10658
|
+
// are owned by the menu container's CngxActiveDescendant; the focus stack
|
|
10659
|
+
// adds ArrowRight/ArrowLeft (open/close a submenu) and innermost-first
|
|
10660
|
+
// Escape. Root-level Escape stays owned by CngxPopover's global listener,
|
|
10661
|
+
// so it is only routed here once a submenu is on the stack.
|
|
10662
|
+
if (!deps.popover().isVisible()) {
|
|
10663
|
+
return;
|
|
10664
|
+
}
|
|
10665
|
+
const menu = focusStack.effectiveMenu();
|
|
10666
|
+
switch (resolveInlineArrowKey(event.key, deps.direction())) {
|
|
10667
|
+
case 'ArrowRight':
|
|
10668
|
+
focusStack.handleArrowRight(menu, event);
|
|
10669
|
+
return;
|
|
10670
|
+
case 'ArrowLeft':
|
|
10671
|
+
focusStack.handleArrowLeft(menu, event);
|
|
10672
|
+
return;
|
|
10673
|
+
case 'Escape':
|
|
10674
|
+
if (focusStack.stack().length > 0) {
|
|
10675
|
+
focusStack.handleEscape(event);
|
|
10676
|
+
}
|
|
10677
|
+
return;
|
|
10678
|
+
}
|
|
10679
|
+
},
|
|
10680
|
+
openActiveSubmenu() {
|
|
10681
|
+
const submenu = focusStack.activeSubmenu();
|
|
10682
|
+
if (submenu) {
|
|
10683
|
+
focusStack.openSubmenuFor(submenu);
|
|
10684
|
+
}
|
|
10685
|
+
},
|
|
10686
|
+
noteActiveSubmenuOpened() {
|
|
10687
|
+
const submenu = focusStack.activeSubmenu();
|
|
10688
|
+
if (submenu) {
|
|
10689
|
+
focusStack.noteSubmenuOpened(submenu);
|
|
10690
|
+
}
|
|
10691
|
+
},
|
|
10692
|
+
syncOpenState(open) {
|
|
10693
|
+
if (open) {
|
|
10694
|
+
focusStack.captureFocus();
|
|
10695
|
+
dismissBinding.attach();
|
|
10696
|
+
}
|
|
10697
|
+
else {
|
|
10698
|
+
dismissBinding.detach();
|
|
10699
|
+
// Clear any open submenu chain: a non-Escape dismissal (outside-click,
|
|
10700
|
+
// blur, scroll) hides the root popover without touching the stack, so
|
|
10701
|
+
// without this a reopened menu's effectiveMenu() would be a submenu
|
|
10702
|
+
// that no longer exists and Arrow/Home/Enter would route into thin air.
|
|
10703
|
+
focusStack.reset();
|
|
10704
|
+
focusStack.restoreFocus();
|
|
10705
|
+
}
|
|
10706
|
+
},
|
|
10707
|
+
destroy() {
|
|
10708
|
+
removeVirtualAnchor();
|
|
10709
|
+
dismissBinding.detach();
|
|
10710
|
+
},
|
|
10711
|
+
};
|
|
10712
|
+
}
|
|
10713
|
+
|
|
9963
10714
|
/**
|
|
9964
10715
|
* Opens a `CngxMenu`-bearing popover at pointer coordinates in response to
|
|
9965
10716
|
* `contextmenu` (right-click) or `Shift+F10` (keyboard equivalent).
|
|
@@ -9971,6 +10722,13 @@ function createMenuTriggerDismissBinding(opts) {
|
|
|
9971
10722
|
* `[exclusive]="true"` (default) so that opening this menu light-dismisses
|
|
9972
10723
|
* any other popover.
|
|
9973
10724
|
*
|
|
10725
|
+
* A thin shell over {@link createContextMenuTriggerCore}: the core owns the
|
|
10726
|
+
* `contextmenu` / `Shift+F10` handling, the transient pointer anchor, the
|
|
10727
|
+
* dismiss binding, and focus save/restore, so `CngxContextMenuFor`
|
|
10728
|
+
* (`@cngx/ui/context-menu`) can reuse the same implementation without
|
|
10729
|
+
* inheritance. This directive supplies no `resolveOpen` seam, so it keeps
|
|
10730
|
+
* the always-open, always-`preventDefault` behaviour.
|
|
10731
|
+
*
|
|
9974
10732
|
* Anchoring uses a transient zero-size DOM element positioned at the
|
|
9975
10733
|
* pointer coords, set on the popover's `anchorElement` signal - virtual
|
|
9976
10734
|
* `getBoundingClientRect` objects are not yet supported as anchors, so
|
|
@@ -10009,111 +10767,43 @@ class CngxContextMenuTrigger {
|
|
|
10009
10767
|
popover = input.required(...(ngDevMode ? [{ debugName: "popover" }] : /* istanbul ignore next */ []));
|
|
10010
10768
|
/** Mirrors `popover.isVisible()`. */
|
|
10011
10769
|
isOpen = computed(() => this.popover().isVisible(), ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
menuConfig = injectMenuConfig();
|
|
10015
|
-
announcer = inject(CNGX_MENU_ANNOUNCER_FACTORY)();
|
|
10016
|
-
dismissBinding = createMenuTriggerDismissBinding({
|
|
10770
|
+
core = createContextMenuTriggerCore({
|
|
10771
|
+
menu: () => this.menu(),
|
|
10017
10772
|
popover: () => this.popover(),
|
|
10018
|
-
hostElement:
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10773
|
+
hostElement: inject(ElementRef).nativeElement,
|
|
10774
|
+
document: inject(DOCUMENT),
|
|
10775
|
+
menuConfig: injectMenuConfig(),
|
|
10776
|
+
dismissFactory: inject(CNGX_MENU_DISMISS_HANDLER_FACTORY),
|
|
10777
|
+
announcer: inject(CNGX_MENU_ANNOUNCER_FACTORY)(),
|
|
10778
|
+
nav: inject(CNGX_MENU_NAV_STRATEGY),
|
|
10779
|
+
direction: injectDirection(),
|
|
10780
|
+
focusStackFactory: inject(CNGX_MENU_FOCUS_STACK_FACTORY),
|
|
10022
10781
|
});
|
|
10023
|
-
virtualAnchor = null;
|
|
10024
|
-
savedFocus = null;
|
|
10025
10782
|
/**
|
|
10026
10783
|
* The dismissal source that closed the menu most recently. `null`
|
|
10027
10784
|
* before the first close. Surface for demos, telemetry, and audit
|
|
10028
10785
|
* sinks - reads which path fired without re-installing listeners.
|
|
10029
10786
|
*/
|
|
10030
|
-
lastDismissSource = this.
|
|
10787
|
+
lastDismissSource = this.core.lastDismissSource;
|
|
10031
10788
|
constructor() {
|
|
10032
|
-
inject(DestroyRef).onDestroy(() =>
|
|
10033
|
-
this.removeVirtualAnchor();
|
|
10034
|
-
this.dismissBinding.detach();
|
|
10035
|
-
});
|
|
10789
|
+
inject(DestroyRef).onDestroy(() => this.core.destroy());
|
|
10036
10790
|
effect(() => {
|
|
10037
10791
|
const open = this.isOpen();
|
|
10038
|
-
untracked(() =>
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
else {
|
|
10047
|
-
this.dismissBinding.detach();
|
|
10048
|
-
if (this.savedFocus !== null) {
|
|
10049
|
-
this.restoreFocus();
|
|
10050
|
-
}
|
|
10051
|
-
}
|
|
10052
|
-
});
|
|
10792
|
+
untracked(() => this.core.syncOpenState(open));
|
|
10793
|
+
});
|
|
10794
|
+
// Hover routing: route submenu hover-intent edges through the core's
|
|
10795
|
+
// focus stack, same primitives as keyboard/click (see CngxMenuTrigger).
|
|
10796
|
+
connectSubmenuHoverToFocusStack({
|
|
10797
|
+
focusStack: this.core.focusStack,
|
|
10798
|
+
rootMenu: () => this.menu(),
|
|
10799
|
+
rootOpen: () => this.isOpen(),
|
|
10053
10800
|
});
|
|
10054
10801
|
}
|
|
10055
10802
|
handleContextMenu(event) {
|
|
10056
|
-
|
|
10057
|
-
this.openAt(event.clientX, event.clientY);
|
|
10803
|
+
this.core.handleContextMenu(event);
|
|
10058
10804
|
}
|
|
10059
10805
|
handleKeydown(event) {
|
|
10060
|
-
|
|
10061
|
-
// into the menu container by the time the user can press it.
|
|
10062
|
-
if (event.key === 'F10' && event.shiftKey) {
|
|
10063
|
-
event.preventDefault();
|
|
10064
|
-
const rect = this.hostElRef.nativeElement.getBoundingClientRect();
|
|
10065
|
-
this.openAt(rect.left + rect.width / 2, rect.top + rect.height / 2);
|
|
10066
|
-
}
|
|
10067
|
-
}
|
|
10068
|
-
openAt(x, y) {
|
|
10069
|
-
// Capture savedFocus eagerly BEFORE show(): the effect-driven capture
|
|
10070
|
-
// races the queueMicrotask focus transfer below in real browsers and
|
|
10071
|
-
// ends up storing the menu UL instead of the pre-open target. The
|
|
10072
|
-
// effect still runs (it also attaches the dismiss binding) but the
|
|
10073
|
-
// `savedFocus === null` guard keeps this earlier capture.
|
|
10074
|
-
if (this.savedFocus === null) {
|
|
10075
|
-
const active = this.doc.activeElement;
|
|
10076
|
-
this.savedFocus = active instanceof HTMLElement ? active : null;
|
|
10077
|
-
}
|
|
10078
|
-
const anchor = this.ensureVirtualAnchor();
|
|
10079
|
-
anchor.style.left = `${x}px`;
|
|
10080
|
-
anchor.style.top = `${y}px`;
|
|
10081
|
-
anchor.style.setProperty('anchor-name', `--cngx-pop-${this.popover().id()}`);
|
|
10082
|
-
this.popover().anchorElement.set(anchor);
|
|
10083
|
-
if (!this.popover().isVisible()) {
|
|
10084
|
-
this.popover().show();
|
|
10085
|
-
}
|
|
10086
|
-
this.menu().ad.highlightFirst();
|
|
10087
|
-
// Defer one microtask so showPopover()'s top-layer DOM mutation
|
|
10088
|
-
// settles before focus moves into the menu container - matches the
|
|
10089
|
-
// existing close-time `restoreFocus` pattern below.
|
|
10090
|
-
queueMicrotask(() => this.menu().focus());
|
|
10091
|
-
}
|
|
10092
|
-
restoreFocus() {
|
|
10093
|
-
const target = this.savedFocus;
|
|
10094
|
-
this.savedFocus = null;
|
|
10095
|
-
if (!target) {
|
|
10096
|
-
return;
|
|
10097
|
-
}
|
|
10098
|
-
queueMicrotask(() => {
|
|
10099
|
-
target.focus();
|
|
10100
|
-
});
|
|
10101
|
-
}
|
|
10102
|
-
ensureVirtualAnchor() {
|
|
10103
|
-
if (this.virtualAnchor) {
|
|
10104
|
-
return this.virtualAnchor;
|
|
10105
|
-
}
|
|
10106
|
-
const el = this.doc.createElement('div');
|
|
10107
|
-
el.setAttribute('aria-hidden', 'true');
|
|
10108
|
-
el.className = 'cngx-context-menu-anchor';
|
|
10109
|
-
el.style.cssText = 'position:fixed;width:0;height:0;pointer-events:none';
|
|
10110
|
-
this.doc.body.appendChild(el);
|
|
10111
|
-
this.virtualAnchor = el;
|
|
10112
|
-
return el;
|
|
10113
|
-
}
|
|
10114
|
-
removeVirtualAnchor() {
|
|
10115
|
-
this.virtualAnchor?.remove();
|
|
10116
|
-
this.virtualAnchor = null;
|
|
10806
|
+
this.core.handleKeydown(event);
|
|
10117
10807
|
}
|
|
10118
10808
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxContextMenuTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
10119
10809
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxContextMenuTrigger, isStandalone: true, selector: "[cngxContextMenuTrigger]", inputs: { menu: { classPropertyName: "menu", publicName: "cngxContextMenuTrigger", isSignal: true, isRequired: true, transformFunction: null }, popover: { classPropertyName: "popover", publicName: "popover", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "contextmenu": "handleContextMenu($event)", "keydown": "handleKeydown($event)" }, properties: { "attr.aria-haspopup": "\"menu\"", "attr.aria-expanded": "isOpen()" } }, exportAs: ["cngxContextMenuTrigger"], ngImport: i0 });
|
|
@@ -10174,7 +10864,9 @@ function provideCngxMenu(...features) {
|
|
|
10174
10864
|
* its inner `CngxMenu` is pushed onto the stack so subsequent ArrowDown /
|
|
10175
10865
|
* Up / Home / End / Enter target the submenu's items via its own
|
|
10176
10866
|
* `CngxActiveDescendant`. ArrowLeft / Escape pop the stack and close the
|
|
10177
|
-
* top submenu.
|
|
10867
|
+
* top submenu. The stack model is supplied by
|
|
10868
|
+
* {@link CNGX_MENU_FOCUS_STACK_FACTORY}, so it is shared verbatim with the
|
|
10869
|
+
* context-menu trigger core and swappable enterprise-wide.
|
|
10178
10870
|
*
|
|
10179
10871
|
* ### Focus model
|
|
10180
10872
|
*
|
|
@@ -10215,25 +10907,23 @@ class CngxMenuTrigger {
|
|
|
10215
10907
|
popover = input.required(...(ngDevMode ? [{ debugName: "popover" }] : /* istanbul ignore next */ []));
|
|
10216
10908
|
/** Mirrors `CngxPopover.isVisible()`. */
|
|
10217
10909
|
isOpen = computed(() => this.popover().isVisible(), ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
10218
|
-
nav = inject(CNGX_MENU_NAV_STRATEGY);
|
|
10219
|
-
/**
|
|
10220
|
-
* Active submenu chain - empty when only the outer menu is open. Each
|
|
10221
|
-
* entry is the `inner` host of an open submenu, top entry being the
|
|
10222
|
-
* deepest. Keystrokes target the top entry's AD.
|
|
10223
|
-
*/
|
|
10224
|
-
submenuStack = signal([], ...(ngDevMode ? [{ debugName: "submenuStack" }] : /* istanbul ignore next */ []));
|
|
10225
|
-
/**
|
|
10226
|
-
* Focused element captured at popover-open time. Restored after close via
|
|
10227
|
-
* `queueMicrotask` so the focus write happens after the popover-close DOM
|
|
10228
|
-
* mutation settles. Captured reactively via the `isOpen` effect below so
|
|
10229
|
-
* mouse-driven open paths (consumer's `(click)="pop.toggle()"`) get the
|
|
10230
|
-
* same treatment as keyboard-driven open paths.
|
|
10231
|
-
*/
|
|
10232
|
-
savedFocus = null;
|
|
10233
10910
|
doc = inject(DOCUMENT);
|
|
10911
|
+
direction = injectDirection();
|
|
10234
10912
|
hostElRef = inject(ElementRef);
|
|
10235
10913
|
menuConfig = injectMenuConfig();
|
|
10236
10914
|
announcer = inject(CNGX_MENU_ANNOUNCER_FACTORY)();
|
|
10915
|
+
/**
|
|
10916
|
+
* Submenu focus-stack model - the active submenu chain, the saved-focus
|
|
10917
|
+
* slot restored after close, and the ArrowRight / ArrowLeft / Escape /
|
|
10918
|
+
* activation routing that consults `CNGX_MENU_NAV_STRATEGY`. Shared with
|
|
10919
|
+
* the context-menu trigger core via {@link CNGX_MENU_FOCUS_STACK_FACTORY}.
|
|
10920
|
+
*/
|
|
10921
|
+
focusStack = inject(CNGX_MENU_FOCUS_STACK_FACTORY)({
|
|
10922
|
+
rootMenu: () => this.menu(),
|
|
10923
|
+
popover: () => this.popover(),
|
|
10924
|
+
nav: inject(CNGX_MENU_NAV_STRATEGY),
|
|
10925
|
+
document: this.doc,
|
|
10926
|
+
});
|
|
10237
10927
|
dismissBinding = createMenuTriggerDismissBinding({
|
|
10238
10928
|
popover: () => this.popover(),
|
|
10239
10929
|
hostElement: this.hostElRef.nativeElement,
|
|
@@ -10253,26 +10943,52 @@ class CngxMenuTrigger {
|
|
|
10253
10943
|
const open = this.isOpen();
|
|
10254
10944
|
untracked(() => {
|
|
10255
10945
|
if (open) {
|
|
10256
|
-
|
|
10257
|
-
const active = this.doc.activeElement;
|
|
10258
|
-
this.savedFocus = active instanceof HTMLElement ? active : null;
|
|
10259
|
-
}
|
|
10946
|
+
this.focusStack.captureFocus();
|
|
10260
10947
|
this.dismissBinding.attach();
|
|
10261
10948
|
}
|
|
10262
10949
|
else {
|
|
10263
10950
|
this.dismissBinding.detach();
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
|
|
10951
|
+
// Clear any open submenu chain so a non-Escape dismissal never leaves
|
|
10952
|
+
// a stale submenu on the stack for the next open (mirrors the
|
|
10953
|
+
// context-menu trigger core).
|
|
10954
|
+
this.focusStack.reset();
|
|
10955
|
+
this.focusStack.restoreFocus();
|
|
10267
10956
|
}
|
|
10268
10957
|
});
|
|
10269
10958
|
});
|
|
10959
|
+
// Click on a submenu-parent item routes through the menu's `activated`
|
|
10960
|
+
// output (CngxMenuItem funnels click into `activateCurrent`), so open the
|
|
10961
|
+
// parent's submenu off that deterministic event rather than the keydown
|
|
10962
|
+
// path. Enter/Space already open it via `handleActivation`; both funnel to
|
|
10963
|
+
// the idempotent `openSubmenuFor`, so the parent never double-opens.
|
|
10964
|
+
effect((onCleanup) => {
|
|
10965
|
+
const menu = this.menu();
|
|
10966
|
+
const sub = outputToObservable(menu.ad.activated).subscribe(() => this.openActiveSubmenu());
|
|
10967
|
+
onCleanup(() => sub.unsubscribe());
|
|
10968
|
+
});
|
|
10969
|
+
// Hover routing: submenu companions only derive debounced hover intent;
|
|
10970
|
+
// this connector routes the edges through the same openSubmenuFor /
|
|
10971
|
+
// closeSubmenuFor primitives keyboard and click use, so a hover-opened
|
|
10972
|
+
// submenu is stack-tracked (keyboard-visible, ArrowLeft/Escape pop it).
|
|
10973
|
+
connectSubmenuHoverToFocusStack({
|
|
10974
|
+
focusStack: this.focusStack,
|
|
10975
|
+
rootMenu: () => this.menu(),
|
|
10976
|
+
rootOpen: () => this.isOpen(),
|
|
10977
|
+
});
|
|
10270
10978
|
}
|
|
10271
|
-
|
|
10272
|
-
const
|
|
10273
|
-
|
|
10979
|
+
openActiveSubmenu() {
|
|
10980
|
+
const submenu = this.focusStack.activeSubmenu();
|
|
10981
|
+
if (submenu) {
|
|
10982
|
+
this.focusStack.openSubmenuFor(submenu);
|
|
10983
|
+
}
|
|
10274
10984
|
}
|
|
10275
10985
|
handleKeydown(event) {
|
|
10986
|
+
// Never hijack browser/app shortcuts: Ctrl/Cmd/Alt combos pass through
|
|
10987
|
+
// untouched - the same guard the nav strategies and CngxListboxTrigger
|
|
10988
|
+
// apply. Shift stays allowed.
|
|
10989
|
+
if (event.ctrlKey || event.metaKey || event.altKey) {
|
|
10990
|
+
return;
|
|
10991
|
+
}
|
|
10276
10992
|
const key = event.key;
|
|
10277
10993
|
if (!this.isOpen()) {
|
|
10278
10994
|
if (key === 'ArrowDown' || key === 'Enter' || key === ' ') {
|
|
@@ -10289,18 +11005,14 @@ class CngxMenuTrigger {
|
|
|
10289
11005
|
}
|
|
10290
11006
|
return;
|
|
10291
11007
|
}
|
|
10292
|
-
const menu = this.effectiveMenu();
|
|
11008
|
+
const menu = this.focusStack.effectiveMenu();
|
|
10293
11009
|
const ad = menu.ad;
|
|
10294
|
-
|
|
11010
|
+
// Resolve the physical arrow to its inline-logical intent: under `rtl`
|
|
11011
|
+
// physical ArrowLeft opens the submenu and physical ArrowRight pops it.
|
|
11012
|
+
// Vertical / Home / End / activation keys pass through unchanged.
|
|
11013
|
+
switch (resolveInlineArrowKey(key, this.direction())) {
|
|
10295
11014
|
case 'Escape':
|
|
10296
|
-
|
|
10297
|
-
if (this.submenuStack().length > 0) {
|
|
10298
|
-
event.stopPropagation();
|
|
10299
|
-
this.popSubmenu();
|
|
10300
|
-
}
|
|
10301
|
-
else {
|
|
10302
|
-
this.popover().hide();
|
|
10303
|
-
}
|
|
11015
|
+
this.focusStack.handleEscape(event);
|
|
10304
11016
|
return;
|
|
10305
11017
|
case 'ArrowDown':
|
|
10306
11018
|
event.preventDefault();
|
|
@@ -10319,99 +11031,17 @@ class CngxMenuTrigger {
|
|
|
10319
11031
|
ad.highlightLast();
|
|
10320
11032
|
return;
|
|
10321
11033
|
case 'ArrowRight':
|
|
10322
|
-
this.handleArrowRight(menu,
|
|
11034
|
+
this.focusStack.handleArrowRight(menu, event);
|
|
10323
11035
|
return;
|
|
10324
11036
|
case 'ArrowLeft':
|
|
10325
|
-
this.handleArrowLeft(
|
|
11037
|
+
this.focusStack.handleArrowLeft(menu, event);
|
|
10326
11038
|
return;
|
|
10327
11039
|
case 'Enter':
|
|
10328
11040
|
case ' ':
|
|
10329
|
-
this.handleActivation(menu,
|
|
11041
|
+
this.focusStack.handleActivation(menu, event);
|
|
10330
11042
|
return;
|
|
10331
11043
|
}
|
|
10332
11044
|
}
|
|
10333
|
-
handleArrowRight(menu, ad, event) {
|
|
10334
|
-
const activeId = ad.activeId();
|
|
10335
|
-
const submenu = this.findSubmenu(menu, activeId);
|
|
10336
|
-
const action = this.nav.onArrowRight({
|
|
10337
|
-
activeId,
|
|
10338
|
-
hasSubmenu: !!submenu,
|
|
10339
|
-
submenuOpen: submenu?.isOpen() ?? false,
|
|
10340
|
-
});
|
|
10341
|
-
if (action.kind === 'open-submenu' && submenu) {
|
|
10342
|
-
event.preventDefault();
|
|
10343
|
-
this.openSubmenu(submenu);
|
|
10344
|
-
}
|
|
10345
|
-
}
|
|
10346
|
-
handleArrowLeft(ad, event) {
|
|
10347
|
-
const stackOpen = this.submenuStack().length > 0;
|
|
10348
|
-
const action = this.nav.onArrowLeft({
|
|
10349
|
-
activeId: ad.activeId(),
|
|
10350
|
-
hasSubmenu: false,
|
|
10351
|
-
submenuOpen: stackOpen,
|
|
10352
|
-
});
|
|
10353
|
-
if (action.kind === 'close-submenu' && stackOpen) {
|
|
10354
|
-
event.preventDefault();
|
|
10355
|
-
this.popSubmenu();
|
|
10356
|
-
}
|
|
10357
|
-
}
|
|
10358
|
-
handleActivation(menu, ad, event) {
|
|
10359
|
-
if (!ad.activeItem()) {
|
|
10360
|
-
return;
|
|
10361
|
-
}
|
|
10362
|
-
event.preventDefault();
|
|
10363
|
-
const submenu = this.findSubmenu(menu, ad.activeId());
|
|
10364
|
-
if (submenu) {
|
|
10365
|
-
this.openSubmenu(submenu);
|
|
10366
|
-
}
|
|
10367
|
-
else {
|
|
10368
|
-
ad.activateCurrent();
|
|
10369
|
-
this.closeAll();
|
|
10370
|
-
}
|
|
10371
|
-
}
|
|
10372
|
-
findSubmenu(menu, activeId) {
|
|
10373
|
-
if (!activeId) {
|
|
10374
|
-
return undefined;
|
|
10375
|
-
}
|
|
10376
|
-
return menu.submenuItems().find((s) => s.id === activeId);
|
|
10377
|
-
}
|
|
10378
|
-
openSubmenu(submenu) {
|
|
10379
|
-
submenu.open();
|
|
10380
|
-
this.submenuStack.update((s) => [...s, submenu.inner]);
|
|
10381
|
-
submenu.inner.ad.highlightFirst();
|
|
10382
|
-
}
|
|
10383
|
-
popSubmenu() {
|
|
10384
|
-
const stack = this.submenuStack();
|
|
10385
|
-
if (stack.length === 0) {
|
|
10386
|
-
return;
|
|
10387
|
-
}
|
|
10388
|
-
const top = stack[stack.length - 1];
|
|
10389
|
-
const parent = stack.length === 1 ? this.menu() : stack[stack.length - 2];
|
|
10390
|
-
const submenu = parent.submenuItems().find((s) => s.inner === top);
|
|
10391
|
-
submenu?.close();
|
|
10392
|
-
this.submenuStack.update((prev) => prev.slice(0, -1));
|
|
10393
|
-
}
|
|
10394
|
-
closeAll() {
|
|
10395
|
-
const stack = this.submenuStack();
|
|
10396
|
-
for (let i = stack.length - 1; i >= 0; i--) {
|
|
10397
|
-
const inner = stack[i];
|
|
10398
|
-
const parent = i === 0 ? this.menu() : stack[i - 1];
|
|
10399
|
-
const submenu = parent.submenuItems().find((s) => s.inner === inner);
|
|
10400
|
-
submenu?.close();
|
|
10401
|
-
}
|
|
10402
|
-
this.submenuStack.set([]);
|
|
10403
|
-
this.popover().hide();
|
|
10404
|
-
}
|
|
10405
|
-
restoreFocus() {
|
|
10406
|
-
const target = this.savedFocus;
|
|
10407
|
-
this.savedFocus = null;
|
|
10408
|
-
if (!target) {
|
|
10409
|
-
return;
|
|
10410
|
-
}
|
|
10411
|
-
queueMicrotask(() => {
|
|
10412
|
-
target.focus();
|
|
10413
|
-
});
|
|
10414
|
-
}
|
|
10415
11045
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMenuTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
10416
11046
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.4", type: CngxMenuTrigger, isStandalone: true, selector: "[cngxMenuTrigger]", inputs: { menu: { classPropertyName: "menu", publicName: "cngxMenuTrigger", isSignal: true, isRequired: true, transformFunction: null }, popover: { classPropertyName: "popover", publicName: "popover", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "keydown": "handleKeydown($event)" }, properties: { "attr.aria-haspopup": "\"menu\"", "attr.aria-expanded": "isOpen()" } }, exportAs: ["cngxMenuTrigger"], ngImport: i0 });
|
|
10417
11047
|
}
|
|
@@ -10519,7 +11149,7 @@ const CNGX_ERROR_SCOPE = new InjectionToken('CngxErrorScope');
|
|
|
10519
11149
|
* **Swap-is-noop semantics.** Combined with the registry's
|
|
10520
11150
|
* `register*(name, ref)` helpers, this equal fn means re-registering a
|
|
10521
11151
|
* *different* contract instance under an *existing* name is absorbed
|
|
10522
|
-
* silently
|
|
11152
|
+
* silently - `getScope(name)`/`getAggregator(name)` continue returning
|
|
10523
11153
|
* the originally registered instance until either an `unregister*(name)`
|
|
10524
11154
|
* + `register*(name, newRef)` cycle runs (the unregister changes the key
|
|
10525
11155
|
* set, breaking the equal short-circuit) or a different name is added.
|
|
@@ -10597,12 +11227,12 @@ function errorSourceMapEqual(a, b) {
|
|
|
10597
11227
|
* inputs auto-register here when the registry is provided in the host
|
|
10598
11228
|
* environment (via {@link provideErrorRegistry}, ships in commit 3).
|
|
10599
11229
|
*
|
|
10600
|
-
* Not `providedIn: 'root'`
|
|
11230
|
+
* Not `providedIn: 'root'` - consumers opt in by including
|
|
10601
11231
|
* `provideErrorRegistry()` in their `bootstrapApplication` providers. When
|
|
10602
11232
|
* the registry is absent, the directives skip registration and keep their
|
|
10603
11233
|
* pure DOM behaviour.
|
|
10604
11234
|
*
|
|
10605
|
-
* @internal Staged API
|
|
11235
|
+
* @internal Staged API - single-consumer.
|
|
10606
11236
|
* See form-primitives-accepted-debt.md §A for the re-evaluation trigger
|
|
10607
11237
|
* and collapse plan.
|
|
10608
11238
|
*/
|
|
@@ -10646,7 +11276,7 @@ class CngxErrorRegistry {
|
|
|
10646
11276
|
* registered instance.
|
|
10647
11277
|
*
|
|
10648
11278
|
* To perform a true swap, call `unregisterScope(name)` first, then
|
|
10649
|
-
* `registerScope(name, newScope)`
|
|
11279
|
+
* `registerScope(name, newScope)` - the unregister cycle changes the
|
|
10650
11280
|
* key set, the equal fn emits, and the new instance becomes the live
|
|
10651
11281
|
* value.
|
|
10652
11282
|
*/
|
|
@@ -10993,7 +11623,7 @@ function createErrorAggregatorContract(deps) {
|
|
|
10993
11623
|
* toggles. The span carries `role="status"` (or `role="alert"` when
|
|
10994
11624
|
* politeness is `'assertive'`), `aria-live`, `aria-atomic="true"`, and
|
|
10995
11625
|
* `aria-relevant="additions text"`. Visually-hidden styling is applied
|
|
10996
|
-
* inline via `--cngx-sr-only-*` CSS custom properties
|
|
11626
|
+
* inline via `--cngx-sr-only-*` CSS custom properties - no global
|
|
10997
11627
|
* stylesheet required.
|
|
10998
11628
|
*
|
|
10999
11629
|
* Set `[autoAnnounce]="false"` to take ownership of the live region in
|
|
@@ -11154,7 +11784,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
11154
11784
|
* Creates a programmatic {@link CngxErrorScopeContract}, optionally
|
|
11155
11785
|
* registered under `name` in the ambient {@link CngxErrorRegistry}.
|
|
11156
11786
|
*
|
|
11157
|
-
* Use when an error scope must exist without a DOM host
|
|
11787
|
+
* Use when an error scope must exist without a DOM host - e.g. inside a
|
|
11158
11788
|
* route guard, an HTTP interceptor, or a service that drives error
|
|
11159
11789
|
* visibility programmatically. When `name` is set and a registry is
|
|
11160
11790
|
* provided in the host environment, the scope auto-registers and
|
|
@@ -11163,7 +11793,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
11163
11793
|
* Must be called in an injection context (constructor, factory provider,
|
|
11164
11794
|
* `runInInjectionContext`).
|
|
11165
11795
|
*
|
|
11166
|
-
* @internal Staged API
|
|
11796
|
+
* @internal Staged API - single-consumer.
|
|
11167
11797
|
* See form-primitives-accepted-debt.md §A for the re-evaluation trigger
|
|
11168
11798
|
* and collapse plan.
|
|
11169
11799
|
*/
|
|
@@ -11269,7 +11899,7 @@ function buildInitialSources(sources, labels) {
|
|
|
11269
11899
|
* });
|
|
11270
11900
|
* ```
|
|
11271
11901
|
*
|
|
11272
|
-
* @internal Staged API
|
|
11902
|
+
* @internal Staged API - single-consumer.
|
|
11273
11903
|
* See form-primitives-accepted-debt.md §A for the re-evaluation trigger
|
|
11274
11904
|
* and collapse plan.
|
|
11275
11905
|
*/
|
|
@@ -11310,7 +11940,7 @@ function provideErrorRegistry(...features) {
|
|
|
11310
11940
|
/**
|
|
11311
11941
|
* Reveals every registered scope on any DOM `submit` event.
|
|
11312
11942
|
*
|
|
11313
|
-
* **Coarse-grained
|
|
11943
|
+
* **Coarse-grained - affects every registered scope, every form.** The
|
|
11314
11944
|
* feature installs a capture-phase document listener that calls
|
|
11315
11945
|
* `registry.revealAll()` on any submit anywhere in the document, even
|
|
11316
11946
|
* when the submit fires from a form unrelated to the scope of interest.
|
|
@@ -11319,10 +11949,10 @@ function provideErrorRegistry(...features) {
|
|
|
11319
11949
|
*
|
|
11320
11950
|
* For finer-grained reveals (per-form, per-flow), skip this feature and
|
|
11321
11951
|
* call `registry.reveal(name)` from the consumer's submit handler
|
|
11322
|
-
* instead
|
|
11952
|
+
* instead - the scope-name registration path stays available without
|
|
11323
11953
|
* the global listener.
|
|
11324
11954
|
*
|
|
11325
|
-
* @internal Staged API
|
|
11955
|
+
* @internal Staged API - single-consumer.
|
|
11326
11956
|
* See form-primitives-accepted-debt.md §A for the re-evaluation trigger
|
|
11327
11957
|
* and collapse plan.
|
|
11328
11958
|
*/
|
|
@@ -11342,7 +11972,7 @@ function withGlobalRevealOnSubmit() {
|
|
|
11342
11972
|
* the common pattern (reveal-all on attempted navigation) but surface
|
|
11343
11973
|
* the implication when wiring a guard that cancels based on form errors.
|
|
11344
11974
|
*
|
|
11345
|
-
* @internal Staged API
|
|
11975
|
+
* @internal Staged API - single-consumer.
|
|
11346
11976
|
* See form-primitives-accepted-debt.md §A for the re-evaluation trigger
|
|
11347
11977
|
* and collapse plan.
|
|
11348
11978
|
*/
|
|
@@ -11358,5 +11988,5 @@ function withRevealOnNavigate() {
|
|
|
11358
11988
|
* Generated bundle index. Do not edit.
|
|
11359
11989
|
*/
|
|
11360
11990
|
|
|
11361
|
-
export { CNGX_ACCORDION, CNGX_BREADCRUMB, CNGX_BREADCRUMB_COLLAPSE_STRATEGY, CNGX_BUTTON_MULTI_TOGGLE_GROUP, CNGX_BUTTON_TOGGLE_GROUP, CNGX_CHIP_GROUP_HOST, CNGX_CHIP_STRIP_ROVING_FACTORY, CNGX_CLOSE_ICON, CNGX_CONTROL_VALUE, CNGX_ERROR_AGGREGATOR, CNGX_ERROR_SCOPE, CNGX_HIERARCHICAL_NAV_STRATEGY, CNGX_HOVER_INTENT_DEFAULTS, CNGX_MENU_ANNOUNCER_FACTORY, CNGX_MENU_CONFIG, CNGX_MENU_DISMISS_HANDLER_FACTORY, CNGX_MENU_HOST, CNGX_MENU_NAV_STRATEGY, CNGX_MENU_RADIO_GROUP, CNGX_MENU_SUBMENU_ITEM, CNGX_NAV_CONFIG, CNGX_OPTION_CONTAINER, CNGX_OPTION_FILTER_HOST, CNGX_OPTION_INTERACTION_HOST, CNGX_OPTION_STATUS_HOST, CNGX_RADIO_GROUP, CNGX_SLIDER_RANGE, CNGX_SUBMENU_TRY_FALLBACKS, CNGX_TREE_CONFIG, CNGX_TREE_CONTROLLER_FACTORY, CngxAccordion, CngxAccordionPanel, CngxAsyncClick, CngxAsyncStatus, CngxBeforeUnload, CngxBreadcrumb, CngxBreadcrumbItem, CngxBreadcrumbSeparator, CngxButtonMultiToggleGroup, CngxButtonToggle, CngxButtonToggleGroup, CngxCheckbox, CngxCheckboxGroup, CngxChipGroup, CngxChipInGroup, CngxChipInput, CngxChipInteraction, CngxClickOutside, CngxCloseButton, CngxContextMenuTrigger, CngxCopyBlock, CngxCopyText, CngxDisclosure, CngxErrorAggregator, CngxErrorRegistry, CngxErrorScope, CngxErrorSource, CngxErrorState, CngxExpandable, CngxFailed, CngxHierarchicalNav, CngxHoverIntent, CngxHoverable, CngxKeyboardShortcut, CngxListbox, CngxListboxSearch, CngxListboxTrigger, CngxLongPress, CngxMenu, CngxMenuAnnouncer, CngxMenuGroup, CngxMenuItem, CngxMenuItemCheckbox, CngxMenuItemIcon, CngxMenuItemKbd, CngxMenuItemLabel, CngxMenuItemRadio, CngxMenuItemSubmenu, CngxMenuItemSuffix, CngxMenuSeparator, CngxMenuTrigger, CngxMultiChipGroup, CngxNavBadge, CngxNavGroup, CngxNavGroupRegistry, CngxNavLabel, CngxNavLink, CngxOption, CngxOptionGroup, CngxPending, CngxPressRipple, CngxPressable, CngxRadio, CngxRadioGroup, CngxRangeSlider, CngxRangeSliderTrack, CngxReorder, CngxRipple, CngxSearch, CngxSlider, CngxSliderThumb, CngxSliderTrack, CngxSpeak, CngxSucceeded, CngxSwipe, CngxSwipeDismiss, CngxToggle, DEFAULT_BREADCRUMB_WIDTH_TIERS, DEFAULT_MENU_CONFIG, canDeactivateWhenClean, createAccordionKeyboardNav, createBreadcrumbCollapse, createChipStripRoving, createMenuAnnouncer, createMenuDismissHandler, createMenuRadioController, createMenuTriggerDismissBinding, createSliderCore, createTreeAdItems, createTreeController, createW3CMenuStrategy, createW3CTreeStrategy, injectErrorAggregator, injectErrorScope, injectMenuAnnouncer, injectMenuConfig, injectNavConfig, injectTreeConfig, optimistic, provideCngxMenu, provideErrorRegistry, provideMenuConfig, provideMenuConfigAt, provideNavConfig, provideTreeConfig, provideTreeConfigAt, reflectAsyncDisplayStatus, resolveBreadcrumbTier, withAriaLabels, withCloseOnSelect, withDefaultInitiallyExpanded, withDefaultKeyFn, withDefaultLabelFn, withDefaultNodeIdFn, withDismissOnBlur, withDismissOnOutsideClick, withDismissOnScroll, withGlobalRevealOnSubmit, withNavAnimation, withNavIndent, withRetry, withRevealOnNavigate, withSingleAccordion, withSubmenuCloseDelay, withSubmenuOpenDelay, withTreeCacheLimit, withTypeaheadDebounce };
|
|
11991
|
+
export { CNGX_ACCORDION, CNGX_BREADCRUMB, CNGX_BREADCRUMB_COLLAPSE_STRATEGY, CNGX_BUTTON_MULTI_TOGGLE_GROUP, CNGX_BUTTON_TOGGLE_GROUP, CNGX_CHIP_GROUP_HOST, CNGX_CHIP_STRIP_ROVING_FACTORY, CNGX_CLOSE_ICON, CNGX_CONTROL_VALUE, CNGX_ERROR_AGGREGATOR, CNGX_ERROR_SCOPE, CNGX_HIERARCHICAL_NAV_STRATEGY, CNGX_HOVER_INTENT_DEFAULTS, CNGX_MENU_ANNOUNCER_FACTORY, CNGX_MENU_CONFIG, CNGX_MENU_DISMISS_HANDLER_FACTORY, CNGX_MENU_FOCUS_STACK_FACTORY, CNGX_MENU_HOST, CNGX_MENU_NAV_STRATEGY, CNGX_MENU_RADIO_GROUP, CNGX_MENU_SUBMENU_ITEM, CNGX_MENU_SUBMENU_WIRING, CNGX_NAV_CONFIG, CNGX_OPTION_CONTAINER, CNGX_OPTION_FILTER_HOST, CNGX_OPTION_INTERACTION_HOST, CNGX_OPTION_STATUS_HOST, CNGX_RADIO_GROUP, CNGX_SLIDER_RANGE, CNGX_SUBMENU_TRY_FALLBACKS, CNGX_TREE_CONFIG, CNGX_TREE_CONTROLLER_FACTORY, CngxAccordion, CngxAccordionPanel, CngxAsyncClick, CngxAsyncStatus, CngxBeforeUnload, CngxBreadcrumb, CngxBreadcrumbItem, CngxBreadcrumbSeparator, CngxButtonMultiToggleGroup, CngxButtonToggle, CngxButtonToggleGroup, CngxCheckbox, CngxCheckboxGroup, CngxChipGroup, CngxChipInGroup, CngxChipInput, CngxChipInteraction, CngxClickOutside, CngxCloseButton, CngxContextMenuTrigger, CngxCopyBlock, CngxCopyText, CngxDisclosure, CngxErrorAggregator, CngxErrorRegistry, CngxErrorScope, CngxErrorSource, CngxErrorState, CngxExpandable, CngxFailed, CngxHierarchicalNav, CngxHoverIntent, CngxHoverable, CngxKeyboardShortcut, CngxListbox, CngxListboxSearch, CngxListboxTrigger, CngxLongPress, CngxMenu, CngxMenuAnnouncer, CngxMenuGroup, CngxMenuItem, CngxMenuItemCheckbox, CngxMenuItemIcon, CngxMenuItemKbd, CngxMenuItemLabel, CngxMenuItemRadio, CngxMenuItemSubmenu, CngxMenuItemSuffix, CngxMenuSeparator, CngxMenuTrigger, CngxMultiChipGroup, CngxNavBadge, CngxNavGroup, CngxNavGroupRegistry, CngxNavLabel, CngxNavLink, CngxOption, CngxOptionGroup, CngxPending, CngxPressRipple, CngxPressable, CngxRadio, CngxRadioGroup, CngxRangeSlider, CngxRangeSliderTrack, CngxReorder, CngxRipple, CngxSearch, CngxSlider, CngxSliderThumb, CngxSliderTrack, CngxSpeak, CngxSucceeded, CngxSwipe, CngxSwipeDismiss, CngxToggle, DEFAULT_BREADCRUMB_WIDTH_TIERS, DEFAULT_MENU_CONFIG, canDeactivateWhenClean, connectSubmenuHoverToFocusStack, createAccordionKeyboardNav, createBreadcrumbCollapse, createChipStripRoving, createContextMenuTriggerCore, createMenuAnnouncer, createMenuDismissHandler, createMenuFocusStack, createMenuRadioController, createMenuTriggerDismissBinding, createSliderCore, createTreeAdItems, createTreeController, createW3CMenuStrategy, createW3CTreeStrategy, injectErrorAggregator, injectErrorScope, injectMenuAnnouncer, injectMenuConfig, injectNavConfig, injectTreeConfig, optimistic, provideCngxMenu, provideErrorRegistry, provideMenuConfig, provideMenuConfigAt, provideNavConfig, provideTreeConfig, provideTreeConfigAt, reflectAsyncDisplayStatus, resolveBreadcrumbTier, withAriaLabels, withCloseOnSelect, withDefaultInitiallyExpanded, withDefaultKeyFn, withDefaultLabelFn, withDefaultNodeIdFn, withDismissOnBlur, withDismissOnOutsideClick, withDismissOnScroll, withGlobalRevealOnSubmit, withNavAnimation, withNavIndent, withRetry, withRevealOnNavigate, withSingleAccordion, withSubmenuCloseDelay, withSubmenuOpenDelay, withTreeCacheLimit, withTypeaheadDebounce };
|
|
11362
11992
|
//# sourceMappingURL=cngx-common-interactive.mjs.map
|