@cngx/ui 0.1.0-rc.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +118 -59
- package/action-button/README.md +170 -53
- package/breadcrumb/README.md +5 -6
- package/collection/README.md +1 -1
- package/command-palette/README.md +9 -5
- package/data-grid-accordion/README.md +1 -1
- package/empty-state/README.md +2 -3
- package/feedback/README.md +1 -1
- package/fesm2022/cngx-ui-a11y.mjs +13 -23
- package/fesm2022/cngx-ui-a11y.mjs.map +1 -1
- package/fesm2022/cngx-ui-accordion.mjs +55 -60
- package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-action-button.mjs +220 -339
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-breadcrumb.mjs +100 -80
- package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
- package/fesm2022/cngx-ui-chart-panel.mjs +18 -31
- package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -1
- package/fesm2022/cngx-ui-collection.mjs +28 -34
- package/fesm2022/cngx-ui-collection.mjs.map +1 -1
- package/fesm2022/cngx-ui-command-palette.mjs +29 -51
- package/fesm2022/cngx-ui-command-palette.mjs.map +1 -1
- package/fesm2022/cngx-ui-context-menu.mjs +138 -89
- package/fesm2022/cngx-ui-context-menu.mjs.map +1 -1
- package/fesm2022/cngx-ui-data-grid-accordion.mjs +135 -77
- package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-empty-state.mjs +17 -44
- package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +648 -495
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-layout.mjs +17 -13
- package/fesm2022/cngx-ui-layout.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-accordion.mjs +6 -7
- package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-paginator.mjs +5 -9
- package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-stepper.mjs +6 -9
- package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +315 -134
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-nav-rail.mjs +440 -0
- package/fesm2022/cngx-ui-nav-rail.mjs.map +1 -0
- package/fesm2022/cngx-ui-overlay.mjs +9 -10
- package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
- package/fesm2022/cngx-ui-paginator.mjs +212 -188
- package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +872 -721
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-skeleton.mjs +17 -19
- package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
- package/fesm2022/cngx-ui-speak.mjs +21 -74
- package/fesm2022/cngx-ui-speak.mjs.map +1 -1
- package/fesm2022/cngx-ui-stat-card.mjs +39 -62
- package/fesm2022/cngx-ui-stat-card.mjs.map +1 -1
- package/fesm2022/cngx-ui-stepper.mjs +259 -130
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +148 -50
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-timeline.mjs +48 -32
- package/fesm2022/cngx-ui-timeline.mjs.map +1 -1
- package/fesm2022/cngx-ui-toc.mjs +59 -48
- package/fesm2022/cngx-ui-toc.mjs.map +1 -1
- package/fesm2022/cngx-ui.mjs +5 -5
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/mat-tabs/README.md +57 -19
- package/mat-tabs/styles/mat-tabs.css +285 -163
- package/nav-rail/README.md +325 -0
- package/package.json +37 -8
- package/paginator/README.md +10 -0
- package/schematics/collection.json +9 -0
- package/schematics/ng-add/index.js +9 -0
- package/schematics/ng-add/schema.json +96 -0
- package/schematics/package.json +3 -0
- package/sidenav/README.md +150 -55
- package/skeleton/README.md +1 -1
- package/speak/README.md +1 -2
- package/stepper/README.md +20 -5
- package/tabs/README.md +13 -0
- package/timeline/README.md +1 -1
- package/toc/README.md +1 -1
- package/types/cngx-ui-a11y.d.ts +20 -38
- package/types/cngx-ui-accordion.d.ts +46 -71
- package/types/cngx-ui-action-button.d.ts +113 -151
- package/types/cngx-ui-breadcrumb.d.ts +60 -85
- package/types/cngx-ui-chart-panel.d.ts +22 -40
- package/types/cngx-ui-collection.d.ts +30 -43
- package/types/cngx-ui-command-palette.d.ts +40 -64
- package/types/cngx-ui-context-menu.d.ts +109 -48
- package/types/cngx-ui-data-grid-accordion.d.ts +50 -75
- package/types/cngx-ui-empty-state.d.ts +18 -8
- package/types/cngx-ui-feedback.d.ts +275 -292
- package/types/cngx-ui-layout.d.ts +4 -12
- package/types/cngx-ui-mat-accordion.d.ts +5 -5
- package/types/cngx-ui-mat-paginator.d.ts +4 -10
- package/types/cngx-ui-mat-stepper.d.ts +5 -10
- package/types/cngx-ui-mat-tabs.d.ts +86 -89
- package/types/cngx-ui-nav-rail.d.ts +416 -0
- package/types/cngx-ui-overlay.d.ts +4 -13
- package/types/cngx-ui-paginator.d.ts +186 -161
- package/types/cngx-ui-sidenav.d.ts +557 -437
- package/types/cngx-ui-skeleton.d.ts +7 -13
- package/types/cngx-ui-speak.d.ts +40 -24
- package/types/cngx-ui-stat-card.d.ts +45 -36
- package/types/cngx-ui-stepper.d.ts +205 -84
- package/types/cngx-ui-tabs.d.ts +104 -28
- package/types/cngx-ui-timeline.d.ts +31 -51
- package/types/cngx-ui-toc.d.ts +43 -54
- package/types/cngx-ui.d.ts +1 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { NgTemplateOutlet, DOCUMENT } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, TemplateRef, Directive, InjectionToken, signal, computed, contentChild, ViewEncapsulation, ChangeDetectionStrategy, Component, input, ElementRef, DestroyRef, effect, untracked, output } from '@angular/core';
|
|
3
|
+
import { inject, TemplateRef, Directive, InjectionToken, signal, computed, contentChild, linkedSignal, ViewEncapsulation, ChangeDetectionStrategy, Component, input, ElementRef, DestroyRef, effect, untracked, output } from '@angular/core';
|
|
4
4
|
import { outputToObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
5
|
import * as i1$1 from '@cngx/common/interactive';
|
|
6
|
-
import { CngxMenu, CNGX_SUBMENU_TRY_FALLBACKS, createContextMenuTriggerCore, CNGX_MENU_FOCUS_STACK_FACTORY, CNGX_MENU_NAV_STRATEGY, CNGX_MENU_ANNOUNCER_FACTORY, CNGX_MENU_DISMISS_HANDLER_FACTORY, injectMenuConfig, connectSubmenuHoverToFocusStack, CngxMenuItemIcon, CngxMenuItem, CngxMenuItemLabel, CngxMenuItemKbd, CngxMenuItemSuffix, CNGX_MENU_SUBMENU_WIRING, CngxMenuItemSubmenu, CngxMenuSeparator, CngxMenuItemCheckbox, CngxMenuItemRadio } from '@cngx/common/interactive';
|
|
6
|
+
import { CngxMenu, CNGX_SUBMENU_TRY_FALLBACKS, createContextMenuTriggerCore, CNGX_MENU_FOCUS_STACK_FACTORY, CNGX_MENU_NAV_STRATEGY, CNGX_MENU_ANNOUNCER_FACTORY, CNGX_MENU_DISMISS_HANDLER_FACTORY, injectMenuConfig, connectSubmenuHoverToFocusStack, CngxMenuItemIcon, CngxMenuItem, CngxMenuItemLabel, CngxMenuItemKbd, CngxMenuItemSuffix, CNGX_MENU_SUBMENU_WIRING, CngxMenuItemSubmenu, CngxMenuSeparator, CngxMenuItemCheckbox, CNGX_MENU_ITEM_OWN_INDICATOR, CngxMenuItemRadio } from '@cngx/common/interactive';
|
|
7
7
|
import * as i1 from '@cngx/common/popover';
|
|
8
8
|
import { CngxPopover } from '@cngx/common/popover';
|
|
9
9
|
import { injectDirection } from '@cngx/core';
|
|
10
10
|
import { CngxActiveDescendant } from '@cngx/common/a11y';
|
|
11
|
+
import { CngxIconSvg } from '@cngx/common/display';
|
|
12
|
+
import { CNGX_ICON_CHEVRON_RIGHT, CNGX_ICON_CHECK, CNGX_ICON_DOT } from '@cngx/utils';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Lazy content slot for {@link CngxContextMenu}. The template renders only
|
|
@@ -23,12 +25,11 @@ import { CngxActiveDescendant } from '@cngx/common/a11y';
|
|
|
23
25
|
* </cngx-context-menu>
|
|
24
26
|
* ```
|
|
25
27
|
*
|
|
26
|
-
* <example-url
|
|
27
|
-
* <example-url
|
|
28
|
-
* @category ui/context-menu
|
|
28
|
+
* <example-url>/#/ui/context-menu/grid/delegated-resolver</example-url>
|
|
29
|
+
* <example-url>/#/ui/context-menu/table/row-context-data</example-url>
|
|
29
30
|
* @wcag AA
|
|
30
31
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/context-menu/context-menu-content.directive.ts
|
|
31
|
-
* @since 0.
|
|
32
|
+
* @since 0.3.0
|
|
32
33
|
* @relatedTo CngxContextMenu, CngxContextMenuFor
|
|
33
34
|
*/
|
|
34
35
|
class CngxContextMenuContent {
|
|
@@ -94,17 +95,16 @@ const CNGX_CONTEXT_MENU_PANEL = new InjectionToken('CNGX_CONTEXT_MENU_PANEL');
|
|
|
94
95
|
* </cngx-context-menu>
|
|
95
96
|
* ```
|
|
96
97
|
*
|
|
97
|
-
* <example-url
|
|
98
|
-
* <example-url
|
|
99
|
-
* <example-url
|
|
100
|
-
* <example-url
|
|
101
|
-
* @category ui/context-menu
|
|
102
|
-
* @docsKind primary
|
|
98
|
+
* <example-url>/#/ui/context-menu/basic/static-items</example-url>
|
|
99
|
+
* <example-url>/#/ui/context-menu/grid/delegated-resolver</example-url>
|
|
100
|
+
* <example-url>/#/ui/context-menu/submenu/nested-export-menu</example-url>
|
|
101
|
+
* <example-url>/#/ui/context-menu/selection/checkbox-radio-items</example-url>
|
|
103
102
|
* @wcag AA
|
|
104
103
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/context-menu/context-menu.component.ts
|
|
105
|
-
* @since 0.
|
|
104
|
+
* @since 0.3.0
|
|
106
105
|
* @relatedTo CngxContextMenuFor, CngxContextMenuItem, CngxContextMenuContent, CngxMenu, CngxPopover
|
|
107
106
|
* @slot cngxContextMenuContent Replaces the projected items with lazy content rendered only while the menu is open; gets the trigger's per-open datum as $implicit (let-row).
|
|
107
|
+
* @axis level organism
|
|
108
108
|
*/
|
|
109
109
|
class CngxContextMenu {
|
|
110
110
|
/** The popover surface this panel drives. Consumed by the trigger core. */
|
|
@@ -139,6 +139,9 @@ class CngxContextMenu {
|
|
|
139
139
|
/** @internal Claim the current open for `owner`. See {@link CngxContextMenuPanel.claimOpen}. */
|
|
140
140
|
claimOpen(owner) {
|
|
141
141
|
this.openOwnerState.set(owner);
|
|
142
|
+
// A trigger open makes this a root: activation routes to the trigger,
|
|
143
|
+
// never to the panel a previous openAsSubmenu came from.
|
|
144
|
+
this.openedFrom.set(null);
|
|
142
145
|
// A trigger claim is always a ROOT open: it must not inherit the sticky
|
|
143
146
|
// submenu policy (non-exclusive, right-start + flip chain) a previous
|
|
144
147
|
// openAsSubmenu installed on this panel. Clearing here - in the open
|
|
@@ -162,12 +165,15 @@ class CngxContextMenu {
|
|
|
162
165
|
* reaching into the popover's `@internal` override setters - the ejected item
|
|
163
166
|
* skin stays off `CngxPopover` internals (decompose).
|
|
164
167
|
*/
|
|
165
|
-
openAsSubmenu(context) {
|
|
168
|
+
openAsSubmenu(context, parent) {
|
|
166
169
|
this.popover.setExclusiveOverride(false);
|
|
167
170
|
this.popover.setPlacementOverride('right-start');
|
|
168
171
|
this.popover.setPositionTryFallbacksOverride(CNGX_SUBMENU_TRY_FALLBACKS);
|
|
169
172
|
this.setContext(context);
|
|
170
173
|
this.popover.show();
|
|
174
|
+
// After show(): the link resets on every visibility edge, so it is set
|
|
175
|
+
// once this open has flipped the popover visible.
|
|
176
|
+
this.openedFrom.set(parent ?? null);
|
|
171
177
|
}
|
|
172
178
|
/** Keydown forwarder registered by the trigger; `null` while none is bound. */
|
|
173
179
|
keydownHandler = null;
|
|
@@ -175,6 +181,21 @@ class CngxContextMenu {
|
|
|
175
181
|
activationHandler = null;
|
|
176
182
|
/** Push-only submenu-note forwarder registered by the trigger; `null` while none bound. */
|
|
177
183
|
submenuNoteHandler = null;
|
|
184
|
+
/**
|
|
185
|
+
* The panel whose item opened this one as a submenu, `null` for a trigger
|
|
186
|
+
* open. Reset to `null` whenever this panel opens or closes, so a direct
|
|
187
|
+
* reopen never routes to the parent of an earlier open. Activation, keydown
|
|
188
|
+
* and the submenu note climb it to the root, whose trigger core resolves the
|
|
189
|
+
* deepest open menu itself.
|
|
190
|
+
*/
|
|
191
|
+
openedFrom = linkedSignal({ ...(ngDevMode ? { debugName: "openedFrom" } : /* istanbul ignore next */ {}), source: () => this.popover.isVisible(),
|
|
192
|
+
computation: () => null });
|
|
193
|
+
/**
|
|
194
|
+
* Set while this panel routes an event up the parent chain. A chain that
|
|
195
|
+
* leads back to a panel already routing is a submenu cycle; the event stops
|
|
196
|
+
* there instead of recursing without end.
|
|
197
|
+
*/
|
|
198
|
+
routingUp = false;
|
|
178
199
|
constructor() {
|
|
179
200
|
// Open moves focus into the menu container, so the container's
|
|
180
201
|
// CngxActiveDescendant owns Enter/Space and a forwarded keydown reaches the
|
|
@@ -183,7 +204,15 @@ class CngxContextMenu {
|
|
|
183
204
|
// decides, on both keyboard activation and pointer click.
|
|
184
205
|
outputToObservable(this.menuHost.ad.activated)
|
|
185
206
|
.pipe(takeUntilDestroyed())
|
|
186
|
-
.subscribe(() => this.
|
|
207
|
+
.subscribe(() => this.handleActivated());
|
|
208
|
+
}
|
|
209
|
+
/** @internal Route an activation to the trigger, else up the parent chain. */
|
|
210
|
+
handleActivated() {
|
|
211
|
+
if (this.activationHandler) {
|
|
212
|
+
this.activationHandler();
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
this.routeUp((parent) => parent.handleActivated?.());
|
|
187
216
|
}
|
|
188
217
|
/**
|
|
189
218
|
* @internal Register the trigger core's keydown handler. The core owns
|
|
@@ -210,13 +239,38 @@ class CngxContextMenu {
|
|
|
210
239
|
* ran, so the trigger's focus stack records an externally opened submenu
|
|
211
240
|
* (idempotent no-op for stack-driven hover/click opens). */
|
|
212
241
|
noteActiveSubmenuOpened() {
|
|
213
|
-
this.submenuNoteHandler
|
|
242
|
+
if (this.submenuNoteHandler) {
|
|
243
|
+
this.submenuNoteHandler();
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
this.routeUp((parent) => parent.noteActiveSubmenuOpened?.());
|
|
247
|
+
}
|
|
248
|
+
/** @internal Route a keydown to the trigger, else up the parent chain. */
|
|
249
|
+
routeKeydown(event) {
|
|
250
|
+
if (this.keydownHandler) {
|
|
251
|
+
this.keydownHandler(event);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
this.routeUp((parent) => parent.routeKeydown?.(event));
|
|
255
|
+
}
|
|
256
|
+
routeUp(forward) {
|
|
257
|
+
const parent = this.openedFrom();
|
|
258
|
+
if (!parent || this.routingUp) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
this.routingUp = true;
|
|
262
|
+
try {
|
|
263
|
+
forward(parent);
|
|
264
|
+
}
|
|
265
|
+
finally {
|
|
266
|
+
this.routingUp = false;
|
|
267
|
+
}
|
|
214
268
|
}
|
|
215
269
|
handleKeydown(event) {
|
|
216
|
-
this.
|
|
270
|
+
this.routeKeydown(event);
|
|
217
271
|
}
|
|
218
272
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxContextMenu, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
219
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxContextMenu, isStandalone: true, selector: "cngx-context-menu", host: { listeners: { "keydown": "handleKeydown($event)" } }, providers: [{ provide: CNGX_CONTEXT_MENU_PANEL, useExisting: CngxContextMenu }], queries: [{ propertyName: "contentTemplate", first: true, predicate: CngxContextMenuContent, descendants: true, isSignal: true }], exportAs: ["cngxContextMenu"], hostDirectives: [{ directive: i1.CngxPopover, inputs: ["offset", "offset", "closeOnEscape", "closeOnEscape"] }, { directive: i1$1.CngxMenu, inputs: ["label", "ariaLabel"] }], ngImport: i0, template: `
|
|
273
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxContextMenu, isStandalone: true, selector: "cngx-context-menu", host: { listeners: { "keydown": "handleKeydown($event)" } }, providers: [{ provide: CNGX_CONTEXT_MENU_PANEL, useExisting: CngxContextMenu }], queries: [{ propertyName: "contentTemplate", first: true, predicate: CngxContextMenuContent, descendants: true, isSignal: true }], exportAs: ["cngxContextMenu"], hostDirectives: [{ directive: i1.CngxPopover, inputs: ["offset", "offset", "closeOnEscape", "closeOnEscape"], outputs: ["opened", "opened", "closed", "closed"] }, { directive: i1$1.CngxMenu, inputs: ["label", "ariaLabel"] }], ngImport: i0, template: `
|
|
220
274
|
@if (contentTemplate(); as content) {
|
|
221
275
|
@if (popover.isVisible()) {
|
|
222
276
|
<ng-container *ngTemplateOutlet="content.templateRef; context: { $implicit: context() }" />
|
|
@@ -224,14 +278,14 @@ class CngxContextMenu {
|
|
|
224
278
|
} @else {
|
|
225
279
|
<ng-content />
|
|
226
280
|
}
|
|
227
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-context-menu-surface{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-context-menu-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 250);}@property --cngx-context-menu-border{syntax: \"*\"; inherits: true; initial-value: 1px solid oklch(.88 .005 250);}@property --cngx-context-menu-radius{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-context-menu-shadow{syntax: \"*\"; inherits: true; initial-value: 0 4px 16px oklch(0 0 0 / .12);}@property --cngx-context-menu-padding{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-context-menu-separator-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.88 .005 250);}@property --cngx-context-menu-separator-inset{syntax: \"<length>\"; inherits: false; initial-value: 4px;}:root{--cngx-context-menu-surface: var(--cngx-color-surface, oklch(1 0 0));--cngx-context-menu-color: var(--cngx-color-text, oklch(.2 .01 250));--cngx-context-menu-border: 1px solid var(--cngx-color-border, oklch(.88 .005 250));--cngx-context-menu-shadow: var(--cngx-shadow-md, 0 4px 16px oklch(0 0 0 / .12));--cngx-context-menu-separator-color: var(--cngx-color-border, oklch(.88 .005 250))}
|
|
281
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-context-menu-surface{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-context-menu-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 250);}@property --cngx-context-menu-border{syntax: \"*\"; inherits: true; initial-value: 1px solid oklch(.88 .005 250);}@property --cngx-context-menu-radius{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-context-menu-shadow{syntax: \"*\"; inherits: true; initial-value: 0 4px 16px oklch(0 0 0 / .12);}@property --cngx-context-menu-padding{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-context-menu-separator-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.88 .005 250);}@property --cngx-context-menu-separator-inset{syntax: \"<length>\"; inherits: false; initial-value: 4px;}:root{--cngx-context-menu-surface: var(--cngx-color-surface, oklch(1 0 0));--cngx-context-menu-color: var(--cngx-color-text, oklch(.2 .01 250));--cngx-context-menu-border: 1px solid var(--cngx-color-border, oklch(.88 .005 250));--cngx-context-menu-shadow: var(--cngx-shadow-md, 0 4px 16px oklch(0 0 0 / .12));--cngx-context-menu-separator-color: var(--cngx-color-border, oklch(.88 .005 250))}cngx-context-menu-divider,hr[cngxContextMenuDivider]{--cngx-context-menu-separator-inset: var(--cngx-space-xs)}}@layer cngx.components{cngx-context-menu{--cngx-context-menu-padding: var(--cngx-space-xs);box-sizing:border-box;position:fixed;inset:unset;min-inline-size:max-content;background:var(--cngx-context-menu-surface);color:var(--cngx-context-menu-color);border:var(--cngx-context-menu-border, 1px solid oklch(.88 .005 250));border-radius:var(--cngx-context-menu-radius, 8px);box-shadow:var(--cngx-context-menu-shadow, 0 4px 16px oklch(0 0 0 / .12));padding:var(--cngx-context-menu-padding, 4px);outline:none;transition:opacity var(--cngx-duration-base, .2s) var(--cngx-easing-standard, cubic-bezier(.4, 0, .2, 1)),transform var(--cngx-duration-base, .2s) var(--cngx-easing-standard, cubic-bezier(.4, 0, .2, 1))}cngx-context-menu:popover-open{display:flex;flex-direction:column}cngx-context-menu.cngx-popover--opening,cngx-context-menu.cngx-popover--closing{opacity:0;transform:translateY(4px) scale(.98)}cngx-context-menu.cngx-popover--open{opacity:1;transform:translateY(0) scale(1)}@media(prefers-reduced-motion:reduce){cngx-context-menu{transition:none}}cngx-context-menu:focus-visible{outline:2px solid var(--cngx-color-primary, oklch(.66 .19 50));outline-offset:-2px}cngx-context-menu-divider,hr[cngxContextMenuDivider]{display:block;block-size:1px;border:0;margin-block:var(--cngx-context-menu-separator-inset, 4px);margin-inline:var(--cngx-space-sm, 8px);background:var(--cngx-context-menu-separator-color)}}@media(forced-colors:active){cngx-context-menu-divider,hr[cngxContextMenuDivider]{background:CanvasText}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
228
282
|
}
|
|
229
283
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxContextMenu, decorators: [{
|
|
230
284
|
type: Component,
|
|
231
285
|
args: [{ selector: 'cngx-context-menu', standalone: true, imports: [NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'cngxContextMenu', providers: [{ provide: CNGX_CONTEXT_MENU_PANEL, useExisting: CngxContextMenu }], host: {
|
|
232
286
|
'(keydown)': 'handleKeydown($event)',
|
|
233
287
|
}, hostDirectives: [
|
|
234
|
-
{ directive: CngxPopover, inputs: ['offset', 'closeOnEscape'] },
|
|
288
|
+
{ directive: CngxPopover, inputs: ['offset', 'closeOnEscape'], outputs: ['opened', 'closed'] },
|
|
235
289
|
{ directive: CngxMenu, inputs: ['label: ariaLabel'] },
|
|
236
290
|
], template: `
|
|
237
291
|
@if (contentTemplate(); as content) {
|
|
@@ -241,7 +295,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
241
295
|
} @else {
|
|
242
296
|
<ng-content />
|
|
243
297
|
}
|
|
244
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-context-menu-surface{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-context-menu-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 250);}@property --cngx-context-menu-border{syntax: \"*\"; inherits: true; initial-value: 1px solid oklch(.88 .005 250);}@property --cngx-context-menu-radius{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-context-menu-shadow{syntax: \"*\"; inherits: true; initial-value: 0 4px 16px oklch(0 0 0 / .12);}@property --cngx-context-menu-padding{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-context-menu-separator-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.88 .005 250);}@property --cngx-context-menu-separator-inset{syntax: \"<length>\"; inherits: false; initial-value: 4px;}:root{--cngx-context-menu-surface: var(--cngx-color-surface, oklch(1 0 0));--cngx-context-menu-color: var(--cngx-color-text, oklch(.2 .01 250));--cngx-context-menu-border: 1px solid var(--cngx-color-border, oklch(.88 .005 250));--cngx-context-menu-shadow: var(--cngx-shadow-md, 0 4px 16px oklch(0 0 0 / .12));--cngx-context-menu-separator-color: var(--cngx-color-border, oklch(.88 .005 250))}
|
|
298
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-context-menu-surface{syntax: \"<color>\"; inherits: true; initial-value: oklch(1 0 0);}@property --cngx-context-menu-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.2 .01 250);}@property --cngx-context-menu-border{syntax: \"*\"; inherits: true; initial-value: 1px solid oklch(.88 .005 250);}@property --cngx-context-menu-radius{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-context-menu-shadow{syntax: \"*\"; inherits: true; initial-value: 0 4px 16px oklch(0 0 0 / .12);}@property --cngx-context-menu-padding{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-context-menu-separator-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.88 .005 250);}@property --cngx-context-menu-separator-inset{syntax: \"<length>\"; inherits: false; initial-value: 4px;}:root{--cngx-context-menu-surface: var(--cngx-color-surface, oklch(1 0 0));--cngx-context-menu-color: var(--cngx-color-text, oklch(.2 .01 250));--cngx-context-menu-border: 1px solid var(--cngx-color-border, oklch(.88 .005 250));--cngx-context-menu-shadow: var(--cngx-shadow-md, 0 4px 16px oklch(0 0 0 / .12));--cngx-context-menu-separator-color: var(--cngx-color-border, oklch(.88 .005 250))}cngx-context-menu-divider,hr[cngxContextMenuDivider]{--cngx-context-menu-separator-inset: var(--cngx-space-xs)}}@layer cngx.components{cngx-context-menu{--cngx-context-menu-padding: var(--cngx-space-xs);box-sizing:border-box;position:fixed;inset:unset;min-inline-size:max-content;background:var(--cngx-context-menu-surface);color:var(--cngx-context-menu-color);border:var(--cngx-context-menu-border, 1px solid oklch(.88 .005 250));border-radius:var(--cngx-context-menu-radius, 8px);box-shadow:var(--cngx-context-menu-shadow, 0 4px 16px oklch(0 0 0 / .12));padding:var(--cngx-context-menu-padding, 4px);outline:none;transition:opacity var(--cngx-duration-base, .2s) var(--cngx-easing-standard, cubic-bezier(.4, 0, .2, 1)),transform var(--cngx-duration-base, .2s) var(--cngx-easing-standard, cubic-bezier(.4, 0, .2, 1))}cngx-context-menu:popover-open{display:flex;flex-direction:column}cngx-context-menu.cngx-popover--opening,cngx-context-menu.cngx-popover--closing{opacity:0;transform:translateY(4px) scale(.98)}cngx-context-menu.cngx-popover--open{opacity:1;transform:translateY(0) scale(1)}@media(prefers-reduced-motion:reduce){cngx-context-menu{transition:none}}cngx-context-menu:focus-visible{outline:2px solid var(--cngx-color-primary, oklch(.66 .19 50));outline-offset:-2px}cngx-context-menu-divider,hr[cngxContextMenuDivider]{display:block;block-size:1px;border:0;margin-block:var(--cngx-context-menu-separator-inset, 4px);margin-inline:var(--cngx-space-sm, 8px);background:var(--cngx-context-menu-separator-color)}}@media(forced-colors:active){cngx-context-menu-divider,hr[cngxContextMenuDivider]{background:CanvasText}}\n"] }]
|
|
245
299
|
}], ctorParameters: () => [], propDecorators: { contentTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxContextMenuContent), { isSignal: true }] }] } });
|
|
246
300
|
|
|
247
301
|
/**
|
|
@@ -276,12 +330,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
276
330
|
* <cngx-context-menu #menu ariaLabel="Row actions">…</cngx-context-menu>
|
|
277
331
|
* ```
|
|
278
332
|
*
|
|
279
|
-
* <example-url
|
|
280
|
-
* <example-url
|
|
281
|
-
* @category ui/context-menu
|
|
333
|
+
* <example-url>/#/ui/context-menu/grid/delegated-resolver</example-url>
|
|
334
|
+
* <example-url>/#/ui/context-menu/basic/static-items</example-url>
|
|
282
335
|
* @wcag AA
|
|
283
336
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/context-menu/context-menu-for.directive.ts
|
|
284
|
-
* @since 0.
|
|
337
|
+
* @since 0.3.0
|
|
285
338
|
* @relatedTo CngxContextMenu, CngxContextMenuItem, CngxContextMenuTrigger
|
|
286
339
|
*/
|
|
287
340
|
class CngxContextMenuFor {
|
|
@@ -471,9 +524,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
471
524
|
* `public-api.ts`. Extracting it keeps `CngxContextMenuItem`'s class body a
|
|
472
525
|
* thin shell (reference_atomic_decompose rule 1).
|
|
473
526
|
*
|
|
474
|
-
* @
|
|
527
|
+
* @internal
|
|
475
528
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/context-menu/context-menu-item-submenu-facade.ts
|
|
476
|
-
* @since 0.
|
|
529
|
+
* @since 0.3.0
|
|
477
530
|
*/
|
|
478
531
|
function createContextMenuItemSubmenuFacade(target, open) {
|
|
479
532
|
return {
|
|
@@ -490,30 +543,6 @@ function createContextMenuItemSubmenuFacade(target, open) {
|
|
|
490
543
|
};
|
|
491
544
|
}
|
|
492
545
|
|
|
493
|
-
/**
|
|
494
|
-
* Default single-character glyphs for the context-menu item skin. Plain
|
|
495
|
-
* `as const` (not `TemplateRef`, not a `Directive`) so the strings stay inline
|
|
496
|
-
* at their `aria-hidden` call sites and tree-shake when unused. Consolidates
|
|
497
|
-
* the trailing submenu caret and the checkbox / radio checked indicators into
|
|
498
|
-
* one source, mirroring `CNGX_SELECT_GLYPHS`.
|
|
499
|
-
*
|
|
500
|
-
* Internal to this organism: not exported from `public-api.ts`, not a consumer
|
|
501
|
-
* override surface (that tier stays deferred, menu-accepted-debt §2). Lives
|
|
502
|
-
* here rather than in `@cngx/common/interactive` because the base menu
|
|
503
|
-
* directives hardcode none of these glyphs, so the organism is the only
|
|
504
|
-
* consumer today; hoisting to the brain lib waits for a second menu consumer.
|
|
505
|
-
*
|
|
506
|
-
* @internal
|
|
507
|
-
*/
|
|
508
|
-
const CNGX_MENU_GLYPHS = {
|
|
509
|
-
/** Trailing caret on an item that opens a submenu. */
|
|
510
|
-
submenuCaret: '▸',
|
|
511
|
-
/** Leading indicator on a checked `menuitemcheckbox`. */
|
|
512
|
-
checkboxChecked: '✓',
|
|
513
|
-
/** Leading indicator on a checked `menuitemradio`. */
|
|
514
|
-
radioChecked: '●',
|
|
515
|
-
};
|
|
516
|
-
|
|
517
546
|
/**
|
|
518
547
|
* A single actionable context-menu item. Thin shell over `CngxMenuItem`: the
|
|
519
548
|
* brain owns `role="menuitem"`, the active-descendant registration, the
|
|
@@ -544,13 +573,12 @@ const CNGX_MENU_GLYPHS = {
|
|
|
544
573
|
* </cngx-context-menu>
|
|
545
574
|
* ```
|
|
546
575
|
*
|
|
547
|
-
* <example-url
|
|
548
|
-
* <example-url
|
|
549
|
-
* <example-url
|
|
550
|
-
* @category ui/context-menu
|
|
576
|
+
* <example-url>/#/ui/context-menu/basic/static-items</example-url>
|
|
577
|
+
* <example-url>/#/ui/context-menu/submenu/nested-export-menu</example-url>
|
|
578
|
+
* <example-url>/#/ui/context-menu/attribute-form/native-buttons</example-url>
|
|
551
579
|
* @wcag AA
|
|
552
580
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/context-menu/context-menu-item.component.ts
|
|
553
|
-
* @since 0.
|
|
581
|
+
* @since 0.3.0
|
|
554
582
|
* @relatedTo CngxContextMenu, CngxContextMenuDivider, CngxMenuItem, CngxMenuItemSubmenu
|
|
555
583
|
*/
|
|
556
584
|
class CngxContextMenuItem {
|
|
@@ -577,9 +605,9 @@ class CngxContextMenuItem {
|
|
|
577
605
|
/** Fires when this item is activated by click or Enter/Space. */
|
|
578
606
|
select = output();
|
|
579
607
|
/** @internal Decorative caret rendered while `submenu` is set. RTL flip is
|
|
580
|
-
* a CSS concern (`.cngx-menu-item__suffix` under
|
|
608
|
+
* a CSS concern (`.cngx-menu-item__suffix` under `:dir(rtl)`), not a
|
|
581
609
|
* swapped glyph. */
|
|
582
|
-
|
|
610
|
+
caretIcon = CNGX_ICON_CHEVRON_RIGHT;
|
|
583
611
|
parentPanel = inject(CNGX_CONTEXT_MENU_PANEL, { optional: true });
|
|
584
612
|
/**
|
|
585
613
|
* Facade the submenu brain drives instead of a `[cngxMenuItemSubmenu]`
|
|
@@ -629,7 +657,7 @@ class CngxContextMenuItem {
|
|
|
629
657
|
// non-exclusive open, parent-datum mirror - to the panel. The item drives
|
|
630
658
|
// one seam instead of reaching into the popover's override signals, so an
|
|
631
659
|
// ejected item skin never carries CngxPopover internals (decompose).
|
|
632
|
-
target.openAsSubmenu(this.parentPanel?.context() ?? null);
|
|
660
|
+
target.openAsSubmenu(this.parentPanel?.context() ?? null, this.parentPanel ?? undefined);
|
|
633
661
|
// openAsSubmenu is the terminal for every open path (hover, keyboard,
|
|
634
662
|
// click all funnel here through the trigger's focus stack). The note is
|
|
635
663
|
// the safety net for opens the stack did not perform itself
|
|
@@ -650,13 +678,13 @@ class CngxContextMenuItem {
|
|
|
650
678
|
<span cngxMenuItemKbd>{{ shortcut }}</span>
|
|
651
679
|
}
|
|
652
680
|
@if (submenu()) {
|
|
653
|
-
<span cngxMenuItemSuffix
|
|
681
|
+
<span cngxMenuItemSuffix><svg [cngxIconSvg]="caretIcon"></svg></span>
|
|
654
682
|
}
|
|
655
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-context-menu-item-padding{syntax: \"*\"; inherits: false; initial-value: 6px 10px;}@property --cngx-context-menu-item-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-context-menu-item-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-context-menu-item-caret-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-context-menu-item-check-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}:root{--cngx-context-menu-item-caret-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-context-menu-item-check-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@layer cngx.components{cngx-context-menu-item,button[cngxContextMenuItem],cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]{--cngx-context-menu-item-padding: var(--cngx-space-xs) var(--cngx-space-sm);--cngx-context-menu-item-gap: var(--cngx-space-sm);display:flex;align-items:center;gap:var(--cngx-context-menu-item-gap, 8px);padding:var(--cngx-context-menu-item-padding, 6px 10px);border-radius:var(--cngx-context-menu-item-radius, 4px);cursor:pointer;-webkit-user-select:none;user-select:none;color:inherit;min-block-size:var(--cngx-target-min, 0px)}cngx-context-menu-item .cngx-menu-item__suffix,button[cngxContextMenuItem] .cngx-menu-item__suffix{color:var(--cngx-context-menu-item-caret-color, var(--cngx-
|
|
683
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-context-menu-item-padding{syntax: \"*\"; inherits: false; initial-value: 6px 10px;}@property --cngx-context-menu-item-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-context-menu-item-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-context-menu-item-caret-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-context-menu-item-check-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}:root{--cngx-context-menu-item-caret-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-context-menu-item-check-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@layer cngx.components{cngx-context-menu-item,button[cngxContextMenuItem],cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]{--cngx-context-menu-item-padding: var(--cngx-space-xs) var(--cngx-space-sm);--cngx-context-menu-item-gap: var(--cngx-space-sm);display:flex;align-items:center;gap:var(--cngx-context-menu-item-gap, 8px);padding:var(--cngx-context-menu-item-padding, 6px 10px);border-radius:var(--cngx-context-menu-item-radius, 4px);cursor:pointer;-webkit-user-select:none;user-select:none;color:inherit;min-block-size:var(--cngx-target-min, 0px)}cngx-context-menu-item .cngx-menu-item__suffix,button[cngxContextMenuItem] .cngx-menu-item__suffix{color:var(--cngx-context-menu-item-caret-color)}cngx-context-menu-item .cngx-menu-item__suffix>.cngx-icon-svg,button[cngxContextMenuItem] .cngx-menu-item__suffix>.cngx-icon-svg{display:block;--cngx-icon-svg-size: max(.75em, var(--cngx-icon-svg-micro-floor, .75rem))}cngx-context-menu-item:dir(rtl) .cngx-menu-item__suffix,button[cngxContextMenuItem]:dir(rtl) .cngx-menu-item__suffix{transform:scaleX(-1)}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check{position:relative;flex:none;align-self:stretch;inline-size:1.25rem;color:var(--cngx-context-menu-item-check-color)}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check>.cngx-icon-svg{position:absolute;left:50%;top:50%;translate:-50% -50%}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox])>.cngx-menu-item__check>.cngx-icon-svg{--cngx-icon-svg-size: 1rem}:is(cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check>.cngx-icon-svg{--cngx-icon-svg-size: 2.19em }}@media(forced-colors:active){:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]).cngx-menu-item--highlighted>.cngx-menu-item__check,:is(cngx-context-menu-item,button[cngxContextMenuItem]).cngx-menu-item--highlighted .cngx-menu-item__suffix{color:var(--_cngx-forced-ink, currentColor)}}\n"], dependencies: [{ kind: "component", type: CngxIconSvg, selector: "svg[cngxIconSvg]", inputs: ["cngxIconSvg"] }, { kind: "directive", type: CngxMenuItemIcon, selector: "[cngxMenuItemIcon]", exportAs: ["cngxMenuItemIcon"] }, { kind: "directive", type: CngxMenuItemLabel, selector: "[cngxMenuItemLabel]", exportAs: ["cngxMenuItemLabel"] }, { kind: "directive", type: CngxMenuItemKbd, selector: "[cngxMenuItemKbd]", exportAs: ["cngxMenuItemKbd"] }, { kind: "directive", type: CngxMenuItemSuffix, selector: "[cngxMenuItemSuffix]", exportAs: ["cngxMenuItemSuffix"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
656
684
|
}
|
|
657
685
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxContextMenuItem, decorators: [{
|
|
658
686
|
type: Component,
|
|
659
|
-
args: [{ selector: 'cngx-context-menu-item, button[cngxContextMenuItem]', standalone: true, imports: [CngxMenuItemIcon, CngxMenuItemLabel, CngxMenuItemKbd, CngxMenuItemSuffix], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'cngxContextMenuItem', providers: [{ provide: CNGX_MENU_SUBMENU_WIRING, useExisting: CngxContextMenuItem }], hostDirectives: [
|
|
687
|
+
args: [{ selector: 'cngx-context-menu-item, button[cngxContextMenuItem]', standalone: true, imports: [CngxIconSvg, CngxMenuItemIcon, CngxMenuItemLabel, CngxMenuItemKbd, CngxMenuItemSuffix], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'cngxContextMenuItem', providers: [{ provide: CNGX_MENU_SUBMENU_WIRING, useExisting: CngxContextMenuItem }], hostDirectives: [
|
|
660
688
|
{ directive: CngxMenuItem, inputs: ['disabled', 'value'] },
|
|
661
689
|
CngxMenuItemSubmenu,
|
|
662
690
|
], template: `
|
|
@@ -669,9 +697,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
669
697
|
<span cngxMenuItemKbd>{{ shortcut }}</span>
|
|
670
698
|
}
|
|
671
699
|
@if (submenu()) {
|
|
672
|
-
<span cngxMenuItemSuffix
|
|
700
|
+
<span cngxMenuItemSuffix><svg [cngxIconSvg]="caretIcon"></svg></span>
|
|
673
701
|
}
|
|
674
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-context-menu-item-padding{syntax: \"*\"; inherits: false; initial-value: 6px 10px;}@property --cngx-context-menu-item-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-context-menu-item-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-context-menu-item-caret-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-context-menu-item-check-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}:root{--cngx-context-menu-item-caret-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-context-menu-item-check-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@layer cngx.components{cngx-context-menu-item,button[cngxContextMenuItem],cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]{--cngx-context-menu-item-padding: var(--cngx-space-xs) var(--cngx-space-sm);--cngx-context-menu-item-gap: var(--cngx-space-sm);display:flex;align-items:center;gap:var(--cngx-context-menu-item-gap, 8px);padding:var(--cngx-context-menu-item-padding, 6px 10px);border-radius:var(--cngx-context-menu-item-radius, 4px);cursor:pointer;-webkit-user-select:none;user-select:none;color:inherit;min-block-size:var(--cngx-target-min, 0px)}cngx-context-menu-item .cngx-menu-item__suffix,button[cngxContextMenuItem] .cngx-menu-item__suffix{color:var(--cngx-context-menu-item-caret-color, var(--cngx-
|
|
702
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-context-menu-item-padding{syntax: \"*\"; inherits: false; initial-value: 6px 10px;}@property --cngx-context-menu-item-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-context-menu-item-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-context-menu-item-caret-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-context-menu-item-check-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}:root{--cngx-context-menu-item-caret-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-context-menu-item-check-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@layer cngx.components{cngx-context-menu-item,button[cngxContextMenuItem],cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]{--cngx-context-menu-item-padding: var(--cngx-space-xs) var(--cngx-space-sm);--cngx-context-menu-item-gap: var(--cngx-space-sm);display:flex;align-items:center;gap:var(--cngx-context-menu-item-gap, 8px);padding:var(--cngx-context-menu-item-padding, 6px 10px);border-radius:var(--cngx-context-menu-item-radius, 4px);cursor:pointer;-webkit-user-select:none;user-select:none;color:inherit;min-block-size:var(--cngx-target-min, 0px)}cngx-context-menu-item .cngx-menu-item__suffix,button[cngxContextMenuItem] .cngx-menu-item__suffix{color:var(--cngx-context-menu-item-caret-color)}cngx-context-menu-item .cngx-menu-item__suffix>.cngx-icon-svg,button[cngxContextMenuItem] .cngx-menu-item__suffix>.cngx-icon-svg{display:block;--cngx-icon-svg-size: max(.75em, var(--cngx-icon-svg-micro-floor, .75rem))}cngx-context-menu-item:dir(rtl) .cngx-menu-item__suffix,button[cngxContextMenuItem]:dir(rtl) .cngx-menu-item__suffix{transform:scaleX(-1)}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check{position:relative;flex:none;align-self:stretch;inline-size:1.25rem;color:var(--cngx-context-menu-item-check-color)}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check>.cngx-icon-svg{position:absolute;left:50%;top:50%;translate:-50% -50%}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox])>.cngx-menu-item__check>.cngx-icon-svg{--cngx-icon-svg-size: 1rem}:is(cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check>.cngx-icon-svg{--cngx-icon-svg-size: 2.19em }}@media(forced-colors:active){:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]).cngx-menu-item--highlighted>.cngx-menu-item__check,:is(cngx-context-menu-item,button[cngxContextMenuItem]).cngx-menu-item--highlighted .cngx-menu-item__suffix{color:var(--_cngx-forced-ink, currentColor)}}\n"] }]
|
|
675
703
|
}], ctorParameters: () => [], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], projectedIcon: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxMenuItemIcon), { isSignal: true }] }], kbd: [{ type: i0.Input, args: [{ isSignal: true, alias: "kbd", required: false }] }], submenu: [{ type: i0.Input, args: [{ isSignal: true, alias: "submenu", required: false }] }], select: [{ type: i0.Output, args: ["select"] }] } });
|
|
676
704
|
|
|
677
705
|
/**
|
|
@@ -685,12 +713,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
685
713
|
* <hr cngxContextMenuDivider />
|
|
686
714
|
* ```
|
|
687
715
|
*
|
|
688
|
-
* <example-url
|
|
689
|
-
* <example-url
|
|
690
|
-
* @category ui/context-menu
|
|
716
|
+
* <example-url>/#/ui/context-menu/basic/static-items</example-url>
|
|
717
|
+
* <example-url>/#/ui/context-menu/attribute-form/native-buttons</example-url>
|
|
691
718
|
* @wcag AA
|
|
692
719
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/context-menu/context-menu-divider.component.ts
|
|
693
|
-
* @since 0.
|
|
720
|
+
* @since 0.3.0
|
|
694
721
|
* @relatedTo CngxContextMenu, CngxContextMenuItem, CngxMenuSeparator
|
|
695
722
|
*/
|
|
696
723
|
class CngxContextMenuDivider {
|
|
@@ -721,11 +748,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
721
748
|
* <cngx-context-menu-item-checkbox [(checked)]="wrap">Word wrap</cngx-context-menu-item-checkbox>
|
|
722
749
|
* ```
|
|
723
750
|
*
|
|
724
|
-
* <example-url
|
|
725
|
-
* @category ui/context-menu
|
|
751
|
+
* <example-url>/#/ui/context-menu/selection/checkbox-radio-items</example-url>
|
|
726
752
|
* @wcag AA
|
|
727
753
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/context-menu/context-menu-item-checkbox.component.ts
|
|
728
|
-
* @since 0.
|
|
754
|
+
* @since 0.3.0
|
|
729
755
|
* @relatedTo CngxContextMenu, CngxContextMenuItem, CngxContextMenuItemRadio, CngxMenuItemCheckbox
|
|
730
756
|
*/
|
|
731
757
|
class CngxContextMenuItemCheckbox {
|
|
@@ -744,11 +770,18 @@ class CngxContextMenuItemCheckbox {
|
|
|
744
770
|
* string `[icon]` shorthand off so the projected icon is the only one drawn.
|
|
745
771
|
*/
|
|
746
772
|
projectedIcon = contentChild(CngxMenuItemIcon, ...(ngDevMode ? [{ debugName: "projectedIcon" }] : /* istanbul ignore next */ []));
|
|
747
|
-
/** @internal
|
|
748
|
-
|
|
749
|
-
|
|
773
|
+
/** @internal The brain host directive; its `checked()` gates the indicator. */
|
|
774
|
+
brain = inject(CngxMenuItemCheckbox, { host: true });
|
|
775
|
+
/** @internal Leading checked indicator, drawn in an always-present gutter so
|
|
776
|
+
* the label does not shift when the item is checked or unchecked. */
|
|
777
|
+
checkIcon = CNGX_ICON_CHECK;
|
|
750
778
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxContextMenuItemCheckbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
751
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxContextMenuItemCheckbox, isStandalone: true, selector: "cngx-context-menu-item-checkbox, button[cngxContextMenuItemCheckbox]", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, kbd: { classPropertyName: "kbd", publicName: "kbd", isSignal: true, isRequired: false, transformFunction: null } },
|
|
779
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxContextMenuItemCheckbox, isStandalone: true, selector: "cngx-context-menu-item-checkbox, button[cngxContextMenuItemCheckbox]", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, kbd: { classPropertyName: "kbd", publicName: "kbd", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_MENU_ITEM_OWN_INDICATOR, useValue: true }], queries: [{ propertyName: "projectedIcon", first: true, predicate: CngxMenuItemIcon, descendants: true, isSignal: true }], exportAs: ["cngxContextMenuItemCheckbox"], hostDirectives: [{ directive: i1$1.CngxMenuItemCheckbox, inputs: ["disabled", "disabled", "value", "value", "checked", "checked", "label", "label"], outputs: ["checkedChange", "checkedChange"] }], ngImport: i0, template: `
|
|
780
|
+
<span class="cngx-menu-item__check" aria-hidden="true">
|
|
781
|
+
@if (brain.checked()) {
|
|
782
|
+
<svg [cngxIconSvg]="checkIcon"></svg>
|
|
783
|
+
}
|
|
784
|
+
</span>
|
|
752
785
|
<ng-content select="[cngxMenuItemIcon]" />
|
|
753
786
|
@if (!projectedIcon() && icon(); as glyph) {
|
|
754
787
|
<span cngxMenuItemIcon>{{ glyph }}</span>
|
|
@@ -757,17 +790,22 @@ class CngxContextMenuItemCheckbox {
|
|
|
757
790
|
@if (kbd(); as shortcut) {
|
|
758
791
|
<span cngxMenuItemKbd>{{ shortcut }}</span>
|
|
759
792
|
}
|
|
760
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-context-menu-item-padding{syntax: \"*\"; inherits: false; initial-value: 6px 10px;}@property --cngx-context-menu-item-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-context-menu-item-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-context-menu-item-caret-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-context-menu-item-check-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}:root{--cngx-context-menu-item-caret-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-context-menu-item-check-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@layer cngx.components{cngx-context-menu-item,button[cngxContextMenuItem],cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]{--cngx-context-menu-item-padding: var(--cngx-space-xs) var(--cngx-space-sm);--cngx-context-menu-item-gap: var(--cngx-space-sm);display:flex;align-items:center;gap:var(--cngx-context-menu-item-gap, 8px);padding:var(--cngx-context-menu-item-padding, 6px 10px);border-radius:var(--cngx-context-menu-item-radius, 4px);cursor:pointer;-webkit-user-select:none;user-select:none;color:inherit;min-block-size:var(--cngx-target-min, 0px)}cngx-context-menu-item .cngx-menu-item__suffix,button[cngxContextMenuItem] .cngx-menu-item__suffix{color:var(--cngx-context-menu-item-caret-color, var(--cngx-
|
|
793
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-context-menu-item-padding{syntax: \"*\"; inherits: false; initial-value: 6px 10px;}@property --cngx-context-menu-item-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-context-menu-item-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-context-menu-item-caret-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-context-menu-item-check-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}:root{--cngx-context-menu-item-caret-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-context-menu-item-check-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@layer cngx.components{cngx-context-menu-item,button[cngxContextMenuItem],cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]{--cngx-context-menu-item-padding: var(--cngx-space-xs) var(--cngx-space-sm);--cngx-context-menu-item-gap: var(--cngx-space-sm);display:flex;align-items:center;gap:var(--cngx-context-menu-item-gap, 8px);padding:var(--cngx-context-menu-item-padding, 6px 10px);border-radius:var(--cngx-context-menu-item-radius, 4px);cursor:pointer;-webkit-user-select:none;user-select:none;color:inherit;min-block-size:var(--cngx-target-min, 0px)}cngx-context-menu-item .cngx-menu-item__suffix,button[cngxContextMenuItem] .cngx-menu-item__suffix{color:var(--cngx-context-menu-item-caret-color)}cngx-context-menu-item .cngx-menu-item__suffix>.cngx-icon-svg,button[cngxContextMenuItem] .cngx-menu-item__suffix>.cngx-icon-svg{display:block;--cngx-icon-svg-size: max(.75em, var(--cngx-icon-svg-micro-floor, .75rem))}cngx-context-menu-item:dir(rtl) .cngx-menu-item__suffix,button[cngxContextMenuItem]:dir(rtl) .cngx-menu-item__suffix{transform:scaleX(-1)}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check{position:relative;flex:none;align-self:stretch;inline-size:1.25rem;color:var(--cngx-context-menu-item-check-color)}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check>.cngx-icon-svg{position:absolute;left:50%;top:50%;translate:-50% -50%}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox])>.cngx-menu-item__check>.cngx-icon-svg{--cngx-icon-svg-size: 1rem}:is(cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check>.cngx-icon-svg{--cngx-icon-svg-size: 2.19em }}@media(forced-colors:active){:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]).cngx-menu-item--highlighted>.cngx-menu-item__check,:is(cngx-context-menu-item,button[cngxContextMenuItem]).cngx-menu-item--highlighted .cngx-menu-item__suffix{color:var(--_cngx-forced-ink, currentColor)}}\n"], dependencies: [{ kind: "component", type: CngxIconSvg, selector: "svg[cngxIconSvg]", inputs: ["cngxIconSvg"] }, { kind: "directive", type: CngxMenuItemIcon, selector: "[cngxMenuItemIcon]", exportAs: ["cngxMenuItemIcon"] }, { kind: "directive", type: CngxMenuItemLabel, selector: "[cngxMenuItemLabel]", exportAs: ["cngxMenuItemLabel"] }, { kind: "directive", type: CngxMenuItemKbd, selector: "[cngxMenuItemKbd]", exportAs: ["cngxMenuItemKbd"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
761
794
|
}
|
|
762
795
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxContextMenuItemCheckbox, decorators: [{
|
|
763
796
|
type: Component,
|
|
764
|
-
args: [{ selector: 'cngx-context-menu-item-checkbox, button[cngxContextMenuItemCheckbox]', standalone: true, imports: [CngxMenuItemIcon, CngxMenuItemLabel, CngxMenuItemKbd], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'cngxContextMenuItemCheckbox',
|
|
797
|
+
args: [{ selector: 'cngx-context-menu-item-checkbox, button[cngxContextMenuItemCheckbox]', standalone: true, imports: [CngxIconSvg, CngxMenuItemIcon, CngxMenuItemLabel, CngxMenuItemKbd], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'cngxContextMenuItemCheckbox', providers: [{ provide: CNGX_MENU_ITEM_OWN_INDICATOR, useValue: true }], hostDirectives: [
|
|
765
798
|
{
|
|
766
799
|
directive: CngxMenuItemCheckbox,
|
|
767
800
|
inputs: ['disabled', 'value', 'checked', 'label'],
|
|
768
801
|
outputs: ['checkedChange'],
|
|
769
802
|
},
|
|
770
803
|
], template: `
|
|
804
|
+
<span class="cngx-menu-item__check" aria-hidden="true">
|
|
805
|
+
@if (brain.checked()) {
|
|
806
|
+
<svg [cngxIconSvg]="checkIcon"></svg>
|
|
807
|
+
}
|
|
808
|
+
</span>
|
|
771
809
|
<ng-content select="[cngxMenuItemIcon]" />
|
|
772
810
|
@if (!projectedIcon() && icon(); as glyph) {
|
|
773
811
|
<span cngxMenuItemIcon>{{ glyph }}</span>
|
|
@@ -776,7 +814,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
776
814
|
@if (kbd(); as shortcut) {
|
|
777
815
|
<span cngxMenuItemKbd>{{ shortcut }}</span>
|
|
778
816
|
}
|
|
779
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-context-menu-item-padding{syntax: \"*\"; inherits: false; initial-value: 6px 10px;}@property --cngx-context-menu-item-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-context-menu-item-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-context-menu-item-caret-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-context-menu-item-check-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}:root{--cngx-context-menu-item-caret-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-context-menu-item-check-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@layer cngx.components{cngx-context-menu-item,button[cngxContextMenuItem],cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]{--cngx-context-menu-item-padding: var(--cngx-space-xs) var(--cngx-space-sm);--cngx-context-menu-item-gap: var(--cngx-space-sm);display:flex;align-items:center;gap:var(--cngx-context-menu-item-gap, 8px);padding:var(--cngx-context-menu-item-padding, 6px 10px);border-radius:var(--cngx-context-menu-item-radius, 4px);cursor:pointer;-webkit-user-select:none;user-select:none;color:inherit;min-block-size:var(--cngx-target-min, 0px)}cngx-context-menu-item .cngx-menu-item__suffix,button[cngxContextMenuItem] .cngx-menu-item__suffix{color:var(--cngx-context-menu-item-caret-color, var(--cngx-
|
|
817
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-context-menu-item-padding{syntax: \"*\"; inherits: false; initial-value: 6px 10px;}@property --cngx-context-menu-item-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-context-menu-item-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-context-menu-item-caret-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-context-menu-item-check-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}:root{--cngx-context-menu-item-caret-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-context-menu-item-check-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@layer cngx.components{cngx-context-menu-item,button[cngxContextMenuItem],cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]{--cngx-context-menu-item-padding: var(--cngx-space-xs) var(--cngx-space-sm);--cngx-context-menu-item-gap: var(--cngx-space-sm);display:flex;align-items:center;gap:var(--cngx-context-menu-item-gap, 8px);padding:var(--cngx-context-menu-item-padding, 6px 10px);border-radius:var(--cngx-context-menu-item-radius, 4px);cursor:pointer;-webkit-user-select:none;user-select:none;color:inherit;min-block-size:var(--cngx-target-min, 0px)}cngx-context-menu-item .cngx-menu-item__suffix,button[cngxContextMenuItem] .cngx-menu-item__suffix{color:var(--cngx-context-menu-item-caret-color)}cngx-context-menu-item .cngx-menu-item__suffix>.cngx-icon-svg,button[cngxContextMenuItem] .cngx-menu-item__suffix>.cngx-icon-svg{display:block;--cngx-icon-svg-size: max(.75em, var(--cngx-icon-svg-micro-floor, .75rem))}cngx-context-menu-item:dir(rtl) .cngx-menu-item__suffix,button[cngxContextMenuItem]:dir(rtl) .cngx-menu-item__suffix{transform:scaleX(-1)}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check{position:relative;flex:none;align-self:stretch;inline-size:1.25rem;color:var(--cngx-context-menu-item-check-color)}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check>.cngx-icon-svg{position:absolute;left:50%;top:50%;translate:-50% -50%}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox])>.cngx-menu-item__check>.cngx-icon-svg{--cngx-icon-svg-size: 1rem}:is(cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check>.cngx-icon-svg{--cngx-icon-svg-size: 2.19em }}@media(forced-colors:active){:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]).cngx-menu-item--highlighted>.cngx-menu-item__check,:is(cngx-context-menu-item,button[cngxContextMenuItem]).cngx-menu-item--highlighted .cngx-menu-item__suffix{color:var(--_cngx-forced-ink, currentColor)}}\n"] }]
|
|
780
818
|
}], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], kbd: [{ type: i0.Input, args: [{ isSignal: true, alias: "kbd", required: false }] }], projectedIcon: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxMenuItemIcon), { isSignal: true }] }] } });
|
|
781
819
|
|
|
782
820
|
/**
|
|
@@ -793,11 +831,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
793
831
|
* </div>
|
|
794
832
|
* ```
|
|
795
833
|
*
|
|
796
|
-
* <example-url
|
|
797
|
-
* @category ui/context-menu
|
|
834
|
+
* <example-url>/#/ui/context-menu/selection/checkbox-radio-items</example-url>
|
|
798
835
|
* @wcag AA
|
|
799
836
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/ui/context-menu/context-menu-item-radio.component.ts
|
|
800
|
-
* @since 0.
|
|
837
|
+
* @since 0.3.0
|
|
801
838
|
* @relatedTo CngxContextMenu, CngxContextMenuItem, CngxContextMenuItemCheckbox, CngxMenuItemRadio, CngxMenuGroup
|
|
802
839
|
*/
|
|
803
840
|
class CngxContextMenuItemRadio {
|
|
@@ -816,11 +853,18 @@ class CngxContextMenuItemRadio {
|
|
|
816
853
|
* string `[icon]` shorthand off so the projected icon is the only one drawn.
|
|
817
854
|
*/
|
|
818
855
|
projectedIcon = contentChild(CngxMenuItemIcon, ...(ngDevMode ? [{ debugName: "projectedIcon" }] : /* istanbul ignore next */ []));
|
|
819
|
-
/** @internal
|
|
820
|
-
|
|
821
|
-
|
|
856
|
+
/** @internal The brain host directive; its `checked()` gates the indicator. */
|
|
857
|
+
brain = inject(CngxMenuItemRadio, { host: true });
|
|
858
|
+
/** @internal Leading checked indicator, drawn in an always-present gutter so
|
|
859
|
+
* the label does not shift when the item is checked or unchecked. */
|
|
860
|
+
checkIcon = CNGX_ICON_DOT;
|
|
822
861
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxContextMenuItemRadio, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
823
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxContextMenuItemRadio, isStandalone: true, selector: "cngx-context-menu-item-radio, button[cngxContextMenuItemRadio]", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, kbd: { classPropertyName: "kbd", publicName: "kbd", isSignal: true, isRequired: false, transformFunction: null } },
|
|
862
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxContextMenuItemRadio, isStandalone: true, selector: "cngx-context-menu-item-radio, button[cngxContextMenuItemRadio]", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, kbd: { classPropertyName: "kbd", publicName: "kbd", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_MENU_ITEM_OWN_INDICATOR, useValue: true }], queries: [{ propertyName: "projectedIcon", first: true, predicate: CngxMenuItemIcon, descendants: true, isSignal: true }], exportAs: ["cngxContextMenuItemRadio"], hostDirectives: [{ directive: i1$1.CngxMenuItemRadio, inputs: ["disabled", "disabled", "value", "value", "label", "label"] }], ngImport: i0, template: `
|
|
863
|
+
<span class="cngx-menu-item__check" aria-hidden="true">
|
|
864
|
+
@if (brain.checked()) {
|
|
865
|
+
<svg [cngxIconSvg]="checkIcon"></svg>
|
|
866
|
+
}
|
|
867
|
+
</span>
|
|
824
868
|
<ng-content select="[cngxMenuItemIcon]" />
|
|
825
869
|
@if (!projectedIcon() && icon(); as glyph) {
|
|
826
870
|
<span cngxMenuItemIcon>{{ glyph }}</span>
|
|
@@ -829,11 +873,16 @@ class CngxContextMenuItemRadio {
|
|
|
829
873
|
@if (kbd(); as shortcut) {
|
|
830
874
|
<span cngxMenuItemKbd>{{ shortcut }}</span>
|
|
831
875
|
}
|
|
832
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-context-menu-item-padding{syntax: \"*\"; inherits: false; initial-value: 6px 10px;}@property --cngx-context-menu-item-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-context-menu-item-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-context-menu-item-caret-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-context-menu-item-check-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}:root{--cngx-context-menu-item-caret-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-context-menu-item-check-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@layer cngx.components{cngx-context-menu-item,button[cngxContextMenuItem],cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]{--cngx-context-menu-item-padding: var(--cngx-space-xs) var(--cngx-space-sm);--cngx-context-menu-item-gap: var(--cngx-space-sm);display:flex;align-items:center;gap:var(--cngx-context-menu-item-gap, 8px);padding:var(--cngx-context-menu-item-padding, 6px 10px);border-radius:var(--cngx-context-menu-item-radius, 4px);cursor:pointer;-webkit-user-select:none;user-select:none;color:inherit;min-block-size:var(--cngx-target-min, 0px)}cngx-context-menu-item .cngx-menu-item__suffix,button[cngxContextMenuItem] .cngx-menu-item__suffix{color:var(--cngx-context-menu-item-caret-color, var(--cngx-
|
|
876
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-context-menu-item-padding{syntax: \"*\"; inherits: false; initial-value: 6px 10px;}@property --cngx-context-menu-item-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-context-menu-item-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-context-menu-item-caret-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-context-menu-item-check-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}:root{--cngx-context-menu-item-caret-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-context-menu-item-check-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@layer cngx.components{cngx-context-menu-item,button[cngxContextMenuItem],cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]{--cngx-context-menu-item-padding: var(--cngx-space-xs) var(--cngx-space-sm);--cngx-context-menu-item-gap: var(--cngx-space-sm);display:flex;align-items:center;gap:var(--cngx-context-menu-item-gap, 8px);padding:var(--cngx-context-menu-item-padding, 6px 10px);border-radius:var(--cngx-context-menu-item-radius, 4px);cursor:pointer;-webkit-user-select:none;user-select:none;color:inherit;min-block-size:var(--cngx-target-min, 0px)}cngx-context-menu-item .cngx-menu-item__suffix,button[cngxContextMenuItem] .cngx-menu-item__suffix{color:var(--cngx-context-menu-item-caret-color)}cngx-context-menu-item .cngx-menu-item__suffix>.cngx-icon-svg,button[cngxContextMenuItem] .cngx-menu-item__suffix>.cngx-icon-svg{display:block;--cngx-icon-svg-size: max(.75em, var(--cngx-icon-svg-micro-floor, .75rem))}cngx-context-menu-item:dir(rtl) .cngx-menu-item__suffix,button[cngxContextMenuItem]:dir(rtl) .cngx-menu-item__suffix{transform:scaleX(-1)}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check{position:relative;flex:none;align-self:stretch;inline-size:1.25rem;color:var(--cngx-context-menu-item-check-color)}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check>.cngx-icon-svg{position:absolute;left:50%;top:50%;translate:-50% -50%}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox])>.cngx-menu-item__check>.cngx-icon-svg{--cngx-icon-svg-size: 1rem}:is(cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check>.cngx-icon-svg{--cngx-icon-svg-size: 2.19em }}@media(forced-colors:active){:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]).cngx-menu-item--highlighted>.cngx-menu-item__check,:is(cngx-context-menu-item,button[cngxContextMenuItem]).cngx-menu-item--highlighted .cngx-menu-item__suffix{color:var(--_cngx-forced-ink, currentColor)}}\n"], dependencies: [{ kind: "component", type: CngxIconSvg, selector: "svg[cngxIconSvg]", inputs: ["cngxIconSvg"] }, { kind: "directive", type: CngxMenuItemIcon, selector: "[cngxMenuItemIcon]", exportAs: ["cngxMenuItemIcon"] }, { kind: "directive", type: CngxMenuItemLabel, selector: "[cngxMenuItemLabel]", exportAs: ["cngxMenuItemLabel"] }, { kind: "directive", type: CngxMenuItemKbd, selector: "[cngxMenuItemKbd]", exportAs: ["cngxMenuItemKbd"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
833
877
|
}
|
|
834
878
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxContextMenuItemRadio, decorators: [{
|
|
835
879
|
type: Component,
|
|
836
|
-
args: [{ selector: 'cngx-context-menu-item-radio, button[cngxContextMenuItemRadio]', standalone: true, imports: [CngxMenuItemIcon, CngxMenuItemLabel, CngxMenuItemKbd], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'cngxContextMenuItemRadio',
|
|
880
|
+
args: [{ selector: 'cngx-context-menu-item-radio, button[cngxContextMenuItemRadio]', standalone: true, imports: [CngxIconSvg, CngxMenuItemIcon, CngxMenuItemLabel, CngxMenuItemKbd], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'cngxContextMenuItemRadio', providers: [{ provide: CNGX_MENU_ITEM_OWN_INDICATOR, useValue: true }], hostDirectives: [{ directive: CngxMenuItemRadio, inputs: ['disabled', 'value', 'label'] }], template: `
|
|
881
|
+
<span class="cngx-menu-item__check" aria-hidden="true">
|
|
882
|
+
@if (brain.checked()) {
|
|
883
|
+
<svg [cngxIconSvg]="checkIcon"></svg>
|
|
884
|
+
}
|
|
885
|
+
</span>
|
|
837
886
|
<ng-content select="[cngxMenuItemIcon]" />
|
|
838
887
|
@if (!projectedIcon() && icon(); as glyph) {
|
|
839
888
|
<span cngxMenuItemIcon>{{ glyph }}</span>
|
|
@@ -842,11 +891,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
842
891
|
@if (kbd(); as shortcut) {
|
|
843
892
|
<span cngxMenuItemKbd>{{ shortcut }}</span>
|
|
844
893
|
}
|
|
845
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-context-menu-item-padding{syntax: \"*\"; inherits: false; initial-value: 6px 10px;}@property --cngx-context-menu-item-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-context-menu-item-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-context-menu-item-caret-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-context-menu-item-check-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}:root{--cngx-context-menu-item-caret-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-context-menu-item-check-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@layer cngx.components{cngx-context-menu-item,button[cngxContextMenuItem],cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]{--cngx-context-menu-item-padding: var(--cngx-space-xs) var(--cngx-space-sm);--cngx-context-menu-item-gap: var(--cngx-space-sm);display:flex;align-items:center;gap:var(--cngx-context-menu-item-gap, 8px);padding:var(--cngx-context-menu-item-padding, 6px 10px);border-radius:var(--cngx-context-menu-item-radius, 4px);cursor:pointer;-webkit-user-select:none;user-select:none;color:inherit;min-block-size:var(--cngx-target-min, 0px)}cngx-context-menu-item .cngx-menu-item__suffix,button[cngxContextMenuItem] .cngx-menu-item__suffix{color:var(--cngx-context-menu-item-caret-color, var(--cngx-
|
|
894
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-context-menu-item-padding{syntax: \"*\"; inherits: false; initial-value: 6px 10px;}@property --cngx-context-menu-item-gap{syntax: \"<length>\"; inherits: false; initial-value: 8px;}@property --cngx-context-menu-item-radius{syntax: \"<length>\"; inherits: false; initial-value: 4px;}@property --cngx-context-menu-item-caret-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .01 250);}@property --cngx-context-menu-item-check-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}:root{--cngx-context-menu-item-caret-color: var(--cngx-color-text-muted, oklch(.5 .01 250));--cngx-context-menu-item-check-color: var(--cngx-color-primary, oklch(.66 .19 50))}}@layer cngx.components{cngx-context-menu-item,button[cngxContextMenuItem],cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]{--cngx-context-menu-item-padding: var(--cngx-space-xs) var(--cngx-space-sm);--cngx-context-menu-item-gap: var(--cngx-space-sm);display:flex;align-items:center;gap:var(--cngx-context-menu-item-gap, 8px);padding:var(--cngx-context-menu-item-padding, 6px 10px);border-radius:var(--cngx-context-menu-item-radius, 4px);cursor:pointer;-webkit-user-select:none;user-select:none;color:inherit;min-block-size:var(--cngx-target-min, 0px)}cngx-context-menu-item .cngx-menu-item__suffix,button[cngxContextMenuItem] .cngx-menu-item__suffix{color:var(--cngx-context-menu-item-caret-color)}cngx-context-menu-item .cngx-menu-item__suffix>.cngx-icon-svg,button[cngxContextMenuItem] .cngx-menu-item__suffix>.cngx-icon-svg{display:block;--cngx-icon-svg-size: max(.75em, var(--cngx-icon-svg-micro-floor, .75rem))}cngx-context-menu-item:dir(rtl) .cngx-menu-item__suffix,button[cngxContextMenuItem]:dir(rtl) .cngx-menu-item__suffix{transform:scaleX(-1)}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check{position:relative;flex:none;align-self:stretch;inline-size:1.25rem;color:var(--cngx-context-menu-item-check-color)}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check>.cngx-icon-svg{position:absolute;left:50%;top:50%;translate:-50% -50%}:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox])>.cngx-menu-item__check>.cngx-icon-svg{--cngx-icon-svg-size: 1rem}:is(cngx-context-menu-item-radio,button[cngxContextMenuItemRadio])>.cngx-menu-item__check>.cngx-icon-svg{--cngx-icon-svg-size: 2.19em }}@media(forced-colors:active){:is(cngx-context-menu-item-checkbox,button[cngxContextMenuItemCheckbox],cngx-context-menu-item-radio,button[cngxContextMenuItemRadio]).cngx-menu-item--highlighted>.cngx-menu-item__check,:is(cngx-context-menu-item,button[cngxContextMenuItem]).cngx-menu-item--highlighted .cngx-menu-item__suffix{color:var(--_cngx-forced-ink, currentColor)}}\n"] }]
|
|
846
895
|
}], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], kbd: [{ type: i0.Input, args: [{ isSignal: true, alias: "kbd", required: false }] }], projectedIcon: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxMenuItemIcon), { isSignal: true }] }] } });
|
|
847
896
|
|
|
848
897
|
/**
|
|
849
|
-
* @module
|
|
898
|
+
* @module `@cngx/ui/context-menu`
|
|
850
899
|
*/
|
|
851
900
|
|
|
852
901
|
/**
|