@radix-ng/primitives 0.29.0 → 0.30.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/checkbox/src/checkbox.directive.d.ts +11 -0
- package/core/index.d.ts +2 -0
- package/core/src/isNumber.d.ts +1 -0
- package/core/src/nullish.d.ts +1 -0
- package/dialog/src/dialog.config.d.ts +1 -0
- package/fesm2022/radix-ng-primitives-accordion.mjs +20 -20
- package/fesm2022/radix-ng-primitives-alert-dialog.mjs +22 -22
- package/fesm2022/radix-ng-primitives-aspect-ratio.mjs +3 -3
- package/fesm2022/radix-ng-primitives-avatar.mjs +16 -16
- package/fesm2022/radix-ng-primitives-checkbox.mjs +28 -17
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-collapsible.mjs +10 -10
- package/fesm2022/radix-ng-primitives-context-menu.mjs +36 -36
- package/fesm2022/radix-ng-primitives-core.mjs +14 -8
- package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-dialog.mjs +40 -38
- package/fesm2022/radix-ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-dropdown-menu.mjs +35 -35
- package/fesm2022/radix-ng-primitives-hover-card.mjs +30 -33
- package/fesm2022/radix-ng-primitives-hover-card.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-label.mjs +3 -3
- package/fesm2022/radix-ng-primitives-menu.mjs +429 -62
- package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menubar.mjs +87 -139
- package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-popover.mjs +30 -33
- package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-progress.mjs +68 -90
- package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-radio.mjs +13 -13
- package/fesm2022/radix-ng-primitives-roving-focus.mjs +7 -7
- package/fesm2022/radix-ng-primitives-select.mjs +36 -36
- package/fesm2022/radix-ng-primitives-separator.mjs +3 -3
- package/fesm2022/radix-ng-primitives-slider.mjs +32 -32
- package/fesm2022/radix-ng-primitives-switch.mjs +13 -13
- package/fesm2022/radix-ng-primitives-tabs.mjs +16 -16
- package/fesm2022/radix-ng-primitives-toggle-group.mjs +9 -9
- package/fesm2022/radix-ng-primitives-toggle.mjs +6 -6
- package/fesm2022/radix-ng-primitives-toolbar.mjs +22 -22
- package/fesm2022/radix-ng-primitives-tooltip.mjs +30 -33
- package/fesm2022/radix-ng-primitives-tooltip.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-visually-hidden.mjs +9 -9
- package/hover-card/src/hover-card-root.directive.d.ts +4 -4
- package/menu/index.d.ts +20 -9
- package/menu/src/menu-content.directive.d.ts +1 -1
- package/menu/src/menu-directive.d.ts +1 -1
- package/menu/src/menu-group.directive.d.ts +1 -1
- package/menu/src/menu-item-checkbox.directive.d.ts +21 -0
- package/menu/src/menu-item-indicator.directive.d.ts +10 -0
- package/menu/src/menu-item-radio.directive.d.ts +20 -0
- package/menu/src/menu-item.directive.d.ts +8 -2
- package/menu/src/menu-label.directive.d.ts +1 -1
- package/menu/src/menu-radio-group.directive.d.ts +6 -0
- package/menu/src/menu-separator.directive.d.ts +1 -2
- package/menu/src/menu-trigger.directive.d.ts +35 -0
- package/menu/src/utils.d.ts +3 -0
- package/menubar/index.d.ts +1 -1
- package/menubar/src/menubar-content.directive.d.ts +2 -2
- package/menubar/src/menubar-item-checkbox.directive.d.ts +2 -10
- package/menubar/src/menubar-item-indicator.directive.d.ts +2 -1
- package/menubar/src/menubar-item-radio.directive.d.ts +2 -10
- package/menubar/src/menubar-item.directive.d.ts +1 -3
- package/menubar/src/menubar-radio-group.directive.d.ts +1 -1
- package/menubar/src/menubar-root.directive.d.ts +3 -4
- package/menubar/src/menubar-separator.directive.d.ts +1 -1
- package/menubar/src/menubar-trigger.directive.d.ts +2 -7
- package/package.json +9 -133
- package/popover/src/popover-root.directive.d.ts +4 -4
- package/progress/src/progress-root.directive.d.ts +19 -33
- package/schematics/collection.json +2 -3
- package/schematics/ng-add/index.d.ts +1 -2
- package/schematics/ng-add/index.js +48 -18
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/package-config.d.ts +18 -0
- package/schematics/ng-add/package-config.js +51 -0
- package/schematics/ng-add/package-config.js.map +1 -0
- package/tooltip/src/tooltip-root.directive.d.ts +4 -4
- package/schematics/ng-add/schema.d.ts +0 -3
- package/schematics/ng-add/schema.js +0 -3
- package/schematics/ng-add/schema.js.map +0 -1
@@ -1,46 +1,45 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { Directive, inject, input, booleanAttribute, computed, effect,
|
2
|
+
import { Directive, inject, input, booleanAttribute, computed, signal, effect, numberAttribute, untracked, SimpleChange, NgModule } from '@angular/core';
|
3
3
|
import * as i1 from '@angular/cdk/menu';
|
4
|
-
import { CdkMenu, CdkMenuGroup, CdkMenuItem } from '@angular/cdk/menu';
|
5
|
-
import
|
6
|
-
import { RdxSeparatorRootDirective } from '@radix-ng/primitives/separator';
|
4
|
+
import { CdkMenu, CdkMenuGroup, CdkMenuItemCheckbox, CdkMenuItemRadio, CdkMenuItem, CdkMenuTrigger } from '@angular/cdk/menu';
|
5
|
+
import { outputFromObservable } from '@angular/core/rxjs-interop';
|
7
6
|
|
8
7
|
class RdxMenuContentDirective {
|
9
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
10
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.
|
8
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
9
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.4", type: RdxMenuContentDirective, isStandalone: true, selector: "[RdxMenuContent]", host: { attributes: { "role": "menu" }, properties: { "attr.aria-orientation": "\"vertical\"" } }, hostDirectives: [{ directive: i1.CdkMenu }], ngImport: i0 }); }
|
11
10
|
}
|
12
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
11
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuContentDirective, decorators: [{
|
13
12
|
type: Directive,
|
14
13
|
args: [{
|
15
|
-
selector: '[
|
16
|
-
|
17
|
-
|
14
|
+
selector: '[RdxMenuContent]',
|
15
|
+
hostDirectives: [CdkMenu],
|
16
|
+
host: {
|
17
|
+
role: 'menu',
|
18
|
+
'[attr.aria-orientation]': '"vertical"'
|
19
|
+
}
|
18
20
|
}]
|
19
21
|
}] });
|
20
22
|
|
21
23
|
class RdxMenuDirective {
|
22
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
23
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.
|
24
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
25
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.4", type: RdxMenuDirective, isStandalone: true, selector: "[RdxMenuRoot],[RdxMenuSub]", hostDirectives: [{ directive: i1.CdkMenu }], ngImport: i0 }); }
|
24
26
|
}
|
25
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
27
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuDirective, decorators: [{
|
26
28
|
type: Directive,
|
27
29
|
args: [{
|
28
|
-
selector: '[
|
29
|
-
standalone: true,
|
30
|
-
host: {},
|
30
|
+
selector: '[RdxMenuRoot],[RdxMenuSub]',
|
31
31
|
hostDirectives: [CdkMenu]
|
32
32
|
}]
|
33
33
|
}] });
|
34
34
|
|
35
35
|
class RdxMenuGroupDirective {
|
36
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
37
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.
|
36
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
37
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.4", type: RdxMenuGroupDirective, isStandalone: true, selector: "[RdxMenuGroup]", host: { attributes: { "role": "group" } }, hostDirectives: [{ directive: i1.CdkMenuGroup }], ngImport: i0 }); }
|
38
38
|
}
|
39
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
39
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuGroupDirective, decorators: [{
|
40
40
|
type: Directive,
|
41
41
|
args: [{
|
42
|
-
selector: '[
|
43
|
-
standalone: true,
|
42
|
+
selector: '[RdxMenuGroup]',
|
44
43
|
hostDirectives: [CdkMenuGroup],
|
45
44
|
host: {
|
46
45
|
role: 'group'
|
@@ -48,70 +47,255 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
48
47
|
}]
|
49
48
|
}] });
|
50
49
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
function isIndeterminate(checked) {
|
51
|
+
return checked === 'indeterminate';
|
52
|
+
}
|
53
|
+
function getCheckedState(checked) {
|
54
|
+
return isIndeterminate(checked) ? 'indeterminate' : checked ? 'checked' : 'unchecked';
|
55
|
+
}
|
56
|
+
|
57
|
+
class RdxMenuItemCheckboxDirective {
|
58
|
+
constructor() {
|
59
|
+
this.cdkMenuItemCheckbox = inject(CdkMenuItemCheckbox, { host: true });
|
60
|
+
this.disabled = input(false, { transform: booleanAttribute });
|
61
|
+
this.checked = input(false);
|
62
|
+
this.onCheckedChange = outputFromObservable(this.cdkMenuItemCheckbox.triggered);
|
63
|
+
this.disabledState = computed(() => this.disabled);
|
64
|
+
this.highlightedState = computed(() => this.isFocused());
|
65
|
+
this.isFocused = signal(false);
|
66
|
+
this.isIndeterminate = isIndeterminate;
|
67
|
+
this.getCheckedState = getCheckedState;
|
68
|
+
effect(() => {
|
69
|
+
if (isIndeterminate(this.checked())) {
|
70
|
+
this.cdkMenuItemCheckbox.checked = true;
|
71
|
+
}
|
72
|
+
else {
|
73
|
+
this.cdkMenuItemCheckbox.checked = !this.checked();
|
74
|
+
}
|
75
|
+
this.cdkMenuItemCheckbox.disabled = this.disabled();
|
76
|
+
});
|
77
|
+
}
|
78
|
+
onFocus() {
|
79
|
+
if (!this.disabled()) {
|
80
|
+
this.isFocused.set(true);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
onBlur() {
|
84
|
+
this.isFocused.set(false);
|
85
|
+
}
|
86
|
+
onPointerMove(event) {
|
87
|
+
if (event.defaultPrevented)
|
88
|
+
return;
|
89
|
+
if (!(event.pointerType === 'mouse'))
|
90
|
+
return;
|
91
|
+
if (!this.disabled()) {
|
92
|
+
const item = event.currentTarget;
|
93
|
+
item?.focus({ preventScroll: true });
|
94
|
+
}
|
95
|
+
}
|
96
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuItemCheckboxDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
97
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.4", type: RdxMenuItemCheckboxDirective, isStandalone: true, selector: "[RdxMenuItemCheckbox]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onCheckedChange: "onCheckedChange" }, host: { attributes: { "role": "menuitemcheckbox" }, listeners: { "focus": "onFocus()", "blur": "onBlur()", "pointermove": "onPointerMove($event)" }, properties: { "attr.aria-checked": "isIndeterminate(checked()) ? \"mixed\" : checked()", "attr.data-state": "getCheckedState(checked())", "attr.data-highlighted": "highlightedState() ? '' : undefined" } }, hostDirectives: [{ directive: i1.CdkMenuItemCheckbox, outputs: ["cdkMenuItemTriggered", "menuItemTriggered"] }], ngImport: i0 }); }
|
98
|
+
}
|
99
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuItemCheckboxDirective, decorators: [{
|
100
|
+
type: Directive,
|
101
|
+
args: [{
|
102
|
+
selector: '[RdxMenuItemCheckbox]',
|
103
|
+
hostDirectives: [
|
104
|
+
{
|
105
|
+
directive: CdkMenuItemCheckbox,
|
106
|
+
outputs: ['cdkMenuItemTriggered: menuItemTriggered']
|
107
|
+
}
|
108
|
+
],
|
109
|
+
host: {
|
110
|
+
role: 'menuitemcheckbox',
|
111
|
+
'[attr.aria-checked]': 'isIndeterminate(checked()) ? "mixed" : checked()',
|
112
|
+
'[attr.data-state]': 'getCheckedState(checked())',
|
113
|
+
'[attr.data-highlighted]': "highlightedState() ? '' : undefined",
|
114
|
+
'(focus)': 'onFocus()',
|
115
|
+
'(blur)': 'onBlur()',
|
116
|
+
'(pointermove)': 'onPointerMove($event)'
|
117
|
+
}
|
118
|
+
}]
|
119
|
+
}], ctorParameters: () => [] });
|
120
|
+
|
121
|
+
class RdxMenuItemRadioDirective {
|
122
|
+
constructor() {
|
123
|
+
this.cdkMenuItemRadio = inject(CdkMenuItemRadio, { host: true });
|
124
|
+
this.disabled = input(false, { transform: booleanAttribute });
|
125
|
+
this.checked = input(false, { transform: booleanAttribute });
|
126
|
+
this.onValueChange = outputFromObservable(this.cdkMenuItemRadio.triggered);
|
127
|
+
this.disabledState = computed(() => this.disabled());
|
128
|
+
this.highlightedState = computed(() => this.isFocused());
|
129
|
+
this.isFocused = signal(false);
|
130
|
+
this.getCheckedState = getCheckedState;
|
131
|
+
effect(() => {
|
132
|
+
this.cdkMenuItemRadio.checked = this.checked();
|
133
|
+
this.cdkMenuItemRadio.disabled = this.disabled();
|
134
|
+
});
|
135
|
+
}
|
136
|
+
onFocus() {
|
137
|
+
if (!this.disabled()) {
|
138
|
+
this.isFocused.set(true);
|
139
|
+
}
|
140
|
+
}
|
141
|
+
onBlur() {
|
142
|
+
this.isFocused.set(false);
|
143
|
+
}
|
144
|
+
onPointerMove(event) {
|
145
|
+
if (event.defaultPrevented)
|
146
|
+
return;
|
147
|
+
if (!(event.pointerType === 'mouse'))
|
148
|
+
return;
|
149
|
+
if (!this.disabled()) {
|
150
|
+
const item = event.currentTarget;
|
151
|
+
item?.focus({ preventScroll: true });
|
152
|
+
}
|
153
|
+
}
|
154
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuItemRadioDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
155
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.4", type: RdxMenuItemRadioDirective, isStandalone: true, selector: "[RdxMenuItemRadio]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onValueChange: "onValueChange" }, host: { attributes: { "role": "menuitemradio" }, listeners: { "focus": "onFocus()", "blur": "onBlur()", "pointermove": "onPointerMove($event)" }, properties: { "attr.aria-checked": "checked()", "attr.data-state": "getCheckedState(checked())", "attr.data-highlighted": "highlightedState() ? '' : undefined" } }, hostDirectives: [{ directive: i1.CdkMenuItemRadio, outputs: ["cdkMenuItemTriggered", "menuItemTriggered"] }], ngImport: i0 }); }
|
156
|
+
}
|
157
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuItemRadioDirective, decorators: [{
|
158
|
+
type: Directive,
|
159
|
+
args: [{
|
160
|
+
selector: '[RdxMenuItemRadio]',
|
161
|
+
hostDirectives: [
|
162
|
+
{
|
163
|
+
directive: CdkMenuItemRadio,
|
164
|
+
outputs: ['cdkMenuItemTriggered: menuItemTriggered']
|
165
|
+
}
|
166
|
+
],
|
167
|
+
host: {
|
168
|
+
role: 'menuitemradio',
|
169
|
+
'[attr.aria-checked]': 'checked()',
|
170
|
+
'[attr.data-state]': 'getCheckedState(checked())',
|
171
|
+
'[attr.data-highlighted]': "highlightedState() ? '' : undefined",
|
172
|
+
'(focus)': 'onFocus()',
|
173
|
+
'(blur)': 'onBlur()',
|
174
|
+
'(pointermove)': 'onPointerMove($event)'
|
175
|
+
}
|
176
|
+
}]
|
177
|
+
}], ctorParameters: () => [] });
|
178
|
+
|
179
|
+
class RdxMenuItemIndicatorDirective {
|
180
|
+
constructor() {
|
181
|
+
this.menuItemRadio = inject(RdxMenuItemRadioDirective, { host: true, optional: true });
|
182
|
+
this.menuCheckboxItem = inject(RdxMenuItemCheckboxDirective, { host: true, optional: true });
|
183
|
+
this.getCheckedState = getCheckedState;
|
184
|
+
}
|
185
|
+
get isChecked() {
|
186
|
+
if (this.menuItemRadio) {
|
187
|
+
return this.menuItemRadio.checked();
|
188
|
+
}
|
189
|
+
if (this.menuCheckboxItem) {
|
190
|
+
return isIndeterminate(this.menuCheckboxItem.checked()) || this.menuCheckboxItem.checked() === true;
|
191
|
+
}
|
192
|
+
return false;
|
193
|
+
}
|
194
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuItemIndicatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
195
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.4", type: RdxMenuItemIndicatorDirective, isStandalone: true, selector: "[RdxMenuItemIndicator]", host: { properties: { "attr.data-state": "getCheckedState(isChecked)", "style.display": "isChecked ? \"\" : \"none\"" } }, ngImport: i0 }); }
|
196
|
+
}
|
197
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuItemIndicatorDirective, decorators: [{
|
198
|
+
type: Directive,
|
199
|
+
args: [{
|
200
|
+
selector: '[RdxMenuItemIndicator]',
|
201
|
+
host: {
|
202
|
+
'[attr.data-state]': 'getCheckedState(isChecked)',
|
203
|
+
'[style.display]': 'isChecked ? "" : "none"'
|
204
|
+
}
|
205
|
+
}]
|
206
|
+
}] });
|
207
|
+
|
55
208
|
class RdxMenuItemDirective {
|
56
209
|
constructor() {
|
57
210
|
this.cdkMenuItem = inject(CdkMenuItem, { host: true });
|
58
|
-
|
59
|
-
this.
|
60
|
-
|
61
|
-
alias: 'rdxDisabled'
|
62
|
-
});
|
211
|
+
this.disabled = input(false, { transform: booleanAttribute });
|
212
|
+
this.onSelect = outputFromObservable(this.cdkMenuItem.triggered);
|
213
|
+
this.isFocused = signal(false);
|
63
214
|
this.disabledState = computed(() => this.disabled());
|
64
|
-
|
65
|
-
this.
|
215
|
+
this.isOpenState = signal(false);
|
216
|
+
this.highlightedState = computed(() => this.isFocused());
|
66
217
|
effect(() => {
|
67
218
|
this.cdkMenuItem.disabled = this.disabled();
|
219
|
+
this.isOpenState.set(this.cdkMenuItem.isMenuOpen());
|
68
220
|
});
|
69
221
|
}
|
70
|
-
|
71
|
-
|
222
|
+
onFocus() {
|
223
|
+
if (!this.disabled()) {
|
224
|
+
this.isFocused.set(true);
|
225
|
+
}
|
226
|
+
}
|
227
|
+
onBlur() {
|
228
|
+
this.isFocused.set(false);
|
229
|
+
}
|
230
|
+
onPointerMove(event) {
|
231
|
+
if (event.defaultPrevented)
|
232
|
+
return;
|
233
|
+
if (!(event.pointerType === 'mouse'))
|
234
|
+
return;
|
235
|
+
if (!this.disabled()) {
|
236
|
+
const item = event.currentTarget;
|
237
|
+
item?.focus({ preventScroll: true });
|
238
|
+
}
|
239
|
+
}
|
240
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
241
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.4", type: RdxMenuItemDirective, isStandalone: true, selector: "[RdxMenuItem]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSelect: "onSelect" }, host: { attributes: { "role": "menuitem", "tabindex": "-1" }, listeners: { "focus": "onFocus()", "blur": "onBlur()", "pointermove": "onPointerMove($event)" }, properties: { "attr.data-orientation": "'horizontal'", "attr.data-state": "isOpenState()", "attr.aria-disabled": "disabledState() ? '' : undefined", "attr.data-disabled": "disabledState() ? '' : undefined", "attr.data-highlighted": "highlightedState() ? '' : undefined" } }, hostDirectives: [{ directive: i1.CdkMenuItem, outputs: ["cdkMenuItemTriggered", "menuItemTriggered"] }], ngImport: i0 }); }
|
72
242
|
}
|
73
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
243
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuItemDirective, decorators: [{
|
74
244
|
type: Directive,
|
75
245
|
args: [{
|
76
|
-
selector: '[
|
77
|
-
|
78
|
-
|
246
|
+
selector: '[RdxMenuItem]',
|
247
|
+
hostDirectives: [
|
248
|
+
{
|
249
|
+
directive: CdkMenuItem,
|
250
|
+
outputs: ['cdkMenuItemTriggered: menuItemTriggered']
|
251
|
+
}
|
252
|
+
],
|
79
253
|
host: {
|
80
254
|
role: 'menuitem',
|
81
|
-
|
82
|
-
tabindex: '0',
|
255
|
+
tabindex: '-1',
|
83
256
|
'[attr.data-orientation]': "'horizontal'",
|
84
|
-
|
257
|
+
'[attr.data-state]': 'isOpenState()',
|
258
|
+
'[attr.aria-disabled]': "disabledState() ? '' : undefined",
|
85
259
|
'[attr.data-disabled]': "disabledState() ? '' : undefined",
|
86
|
-
'[
|
260
|
+
'[attr.data-highlighted]': "highlightedState() ? '' : undefined",
|
261
|
+
'(focus)': 'onFocus()',
|
262
|
+
'(blur)': 'onBlur()',
|
263
|
+
'(pointermove)': 'onPointerMove($event)'
|
87
264
|
}
|
88
265
|
}]
|
89
|
-
}], ctorParameters: () => []
|
90
|
-
type: Output
|
91
|
-
}] } });
|
266
|
+
}], ctorParameters: () => [] });
|
92
267
|
|
93
268
|
class RdxMenuLabelDirective {
|
94
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
95
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.
|
269
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuLabelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
270
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.4", type: RdxMenuLabelDirective, isStandalone: true, selector: "[RdxMenuLabel]", ngImport: i0 }); }
|
271
|
+
}
|
272
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuLabelDirective, decorators: [{
|
273
|
+
type: Directive,
|
274
|
+
args: [{
|
275
|
+
selector: '[RdxMenuLabel]'
|
276
|
+
}]
|
277
|
+
}] });
|
278
|
+
|
279
|
+
class RdxMenuRadioGroupDirective {
|
280
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuRadioGroupDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
281
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.4", type: RdxMenuRadioGroupDirective, isStandalone: true, selector: "[RdxMenuRadioGroup]", hostDirectives: [{ directive: i1.CdkMenuGroup }], ngImport: i0 }); }
|
96
282
|
}
|
97
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
283
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuRadioGroupDirective, decorators: [{
|
98
284
|
type: Directive,
|
99
285
|
args: [{
|
100
|
-
selector: '
|
101
|
-
|
286
|
+
selector: '[RdxMenuRadioGroup]',
|
287
|
+
hostDirectives: [CdkMenuGroup]
|
102
288
|
}]
|
103
289
|
}] });
|
104
290
|
|
105
291
|
class RdxMenuSeparatorDirective {
|
106
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
107
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.
|
292
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuSeparatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
293
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.4", type: RdxMenuSeparatorDirective, isStandalone: true, selector: "[RdxMenuSeparator]", host: { attributes: { "role": "separator" }, properties: { "attr.aria-orientation": "'horizontal'" } }, ngImport: i0 }); }
|
108
294
|
}
|
109
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
295
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuSeparatorDirective, decorators: [{
|
110
296
|
type: Directive,
|
111
297
|
args: [{
|
112
|
-
selector: '[
|
113
|
-
standalone: true,
|
114
|
-
hostDirectives: [RdxSeparatorRootDirective],
|
298
|
+
selector: '[RdxMenuSeparator]',
|
115
299
|
host: {
|
116
300
|
role: 'separator',
|
117
301
|
'[attr.aria-orientation]': "'horizontal'"
|
@@ -119,30 +303,213 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
119
303
|
}]
|
120
304
|
}] });
|
121
305
|
|
306
|
+
class RdxMenuTriggerDirective {
|
307
|
+
computePositions() {
|
308
|
+
if (this.align() || this.sideOffset() || this.alignOffset() || this.side()) {
|
309
|
+
this.enablePositions = true;
|
310
|
+
}
|
311
|
+
const side = this.side() || 'bottom';
|
312
|
+
const align = this.align() || 'center';
|
313
|
+
const sideOffset = this.sideOffset() || 0;
|
314
|
+
const alignOffset = this.alignOffset() || 0;
|
315
|
+
let originX = 'center';
|
316
|
+
let originY = 'center';
|
317
|
+
let overlayX = 'center';
|
318
|
+
let overlayY = 'center';
|
319
|
+
let offsetX = 0;
|
320
|
+
let offsetY = 0;
|
321
|
+
switch (side) {
|
322
|
+
case 'top':
|
323
|
+
originY = 'top';
|
324
|
+
overlayY = 'bottom';
|
325
|
+
offsetY = -sideOffset;
|
326
|
+
break;
|
327
|
+
case 'bottom':
|
328
|
+
originY = 'bottom';
|
329
|
+
overlayY = 'top';
|
330
|
+
offsetY = sideOffset;
|
331
|
+
break;
|
332
|
+
case 'left':
|
333
|
+
originX = 'start';
|
334
|
+
overlayX = 'end';
|
335
|
+
offsetX = -sideOffset;
|
336
|
+
break;
|
337
|
+
case 'right':
|
338
|
+
originX = 'end';
|
339
|
+
overlayX = 'start';
|
340
|
+
offsetX = sideOffset;
|
341
|
+
break;
|
342
|
+
}
|
343
|
+
switch (align) {
|
344
|
+
case 'start':
|
345
|
+
if (side === 'top' || side === 'bottom') {
|
346
|
+
originX = 'start';
|
347
|
+
overlayX = 'start';
|
348
|
+
offsetX = alignOffset;
|
349
|
+
}
|
350
|
+
else {
|
351
|
+
originY = 'top';
|
352
|
+
overlayY = 'top';
|
353
|
+
offsetY = alignOffset;
|
354
|
+
}
|
355
|
+
break;
|
356
|
+
case 'end':
|
357
|
+
if (side === 'top' || side === 'bottom') {
|
358
|
+
originX = 'end';
|
359
|
+
overlayX = 'end';
|
360
|
+
offsetX = -alignOffset;
|
361
|
+
}
|
362
|
+
else {
|
363
|
+
originY = 'bottom';
|
364
|
+
overlayY = 'bottom';
|
365
|
+
offsetY = -alignOffset;
|
366
|
+
}
|
367
|
+
break;
|
368
|
+
case 'center':
|
369
|
+
default:
|
370
|
+
if (side === 'top' || side === 'bottom') {
|
371
|
+
originX = 'center';
|
372
|
+
overlayX = 'center';
|
373
|
+
}
|
374
|
+
else {
|
375
|
+
originY = 'center';
|
376
|
+
overlayY = 'center';
|
377
|
+
}
|
378
|
+
break;
|
379
|
+
}
|
380
|
+
return {
|
381
|
+
originX,
|
382
|
+
originY,
|
383
|
+
overlayX,
|
384
|
+
overlayY,
|
385
|
+
offsetX,
|
386
|
+
offsetY
|
387
|
+
};
|
388
|
+
}
|
389
|
+
constructor() {
|
390
|
+
this.cdkTrigger = inject(CdkMenuTrigger, { host: true });
|
391
|
+
this.menuTriggerFor = input.required();
|
392
|
+
/**
|
393
|
+
* @description The preferred side of the trigger to render against when open. Will be reversed when collisions occur and avoidCollisions is enabled.
|
394
|
+
*/
|
395
|
+
this.side = input();
|
396
|
+
this.align = input();
|
397
|
+
/**
|
398
|
+
* @description The distance in pixels from the trigger.
|
399
|
+
*/
|
400
|
+
this.sideOffset = input(NaN, {
|
401
|
+
transform: numberAttribute
|
402
|
+
});
|
403
|
+
/**
|
404
|
+
* @description An offset in pixels from the "start" or "end" alignment options.
|
405
|
+
*/
|
406
|
+
this.alignOffset = input(NaN, {
|
407
|
+
transform: numberAttribute
|
408
|
+
});
|
409
|
+
this.disabled = input(false, {
|
410
|
+
transform: booleanAttribute
|
411
|
+
});
|
412
|
+
this.enablePositions = false;
|
413
|
+
// TODO
|
414
|
+
this.positions = computed(() => this.computePositions());
|
415
|
+
this.onMenuPositionEffect();
|
416
|
+
}
|
417
|
+
/** @ignore */
|
418
|
+
onPointerDown($event) {
|
419
|
+
// only call handler if it's the left button (mousedown gets triggered by all mouse buttons)
|
420
|
+
// but not when the control key is pressed (avoiding MacOS right click)
|
421
|
+
if (!this.disabled() && $event.button === 0 && !$event.ctrlKey) {
|
422
|
+
/* empty */
|
423
|
+
if (!this.cdkTrigger.isOpen()) {
|
424
|
+
// prevent trigger focusing when opening
|
425
|
+
// this allows the content to be given focus without competition
|
426
|
+
$event.preventDefault();
|
427
|
+
}
|
428
|
+
}
|
429
|
+
}
|
430
|
+
onMenuPositionEffect() {
|
431
|
+
effect(() => {
|
432
|
+
const positions = this.positions();
|
433
|
+
untracked(() => {
|
434
|
+
if (this.enablePositions) {
|
435
|
+
this.setMenuPositions([positions]);
|
436
|
+
}
|
437
|
+
});
|
438
|
+
});
|
439
|
+
}
|
440
|
+
setMenuPositions(positions) {
|
441
|
+
const prevMenuPosition = this.cdkTrigger.menuPosition;
|
442
|
+
this.cdkTrigger.menuPosition = positions;
|
443
|
+
this.fireNgOnChanges('menuPosition', this.cdkTrigger.menuPosition, prevMenuPosition);
|
444
|
+
}
|
445
|
+
fireNgOnChanges(input, currentValue, previousValue, firstChange = false) {
|
446
|
+
this.cdkTrigger.ngOnChanges({
|
447
|
+
[input]: new SimpleChange(previousValue, currentValue, firstChange)
|
448
|
+
});
|
449
|
+
}
|
450
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
451
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.1.4", type: RdxMenuTriggerDirective, isStandalone: true, selector: "[RdxMenuTrigger]", inputs: { menuTriggerFor: { classPropertyName: "menuTriggerFor", publicName: "menuTriggerFor", isSignal: true, isRequired: true, transformFunction: null }, side: { classPropertyName: "side", publicName: "side", isSignal: true, isRequired: false, transformFunction: null }, align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null }, sideOffset: { classPropertyName: "sideOffset", publicName: "sideOffset", isSignal: true, isRequired: false, transformFunction: null }, alignOffset: { classPropertyName: "alignOffset", publicName: "alignOffset", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "menuitem" }, listeners: { "pointerdown": "onPointerDown($event)" }, properties: { "attr.aria-haspopup": "'menu'", "attr.aria-expanded": "cdkTrigger.isOpen()", "attr.data-state": "cdkTrigger.isOpen() ? 'open': 'closed'", "attr.data-disabled": "disabled() ? '' : undefined" } }, hostDirectives: [{ directive: i1.CdkMenuTrigger, inputs: ["cdkMenuTriggerFor", "menuTriggerFor", "cdkMenuPosition", "menuPosition"] }], ngImport: i0 }); }
|
452
|
+
}
|
453
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuTriggerDirective, decorators: [{
|
454
|
+
type: Directive,
|
455
|
+
args: [{
|
456
|
+
selector: '[RdxMenuTrigger]',
|
457
|
+
hostDirectives: [
|
458
|
+
{
|
459
|
+
directive: CdkMenuTrigger,
|
460
|
+
inputs: ['cdkMenuTriggerFor: menuTriggerFor', 'cdkMenuPosition: menuPosition']
|
461
|
+
}
|
462
|
+
],
|
463
|
+
host: {
|
464
|
+
role: 'menuitem',
|
465
|
+
'[attr.aria-haspopup]': "'menu'",
|
466
|
+
'[attr.aria-expanded]': 'cdkTrigger.isOpen()',
|
467
|
+
'[attr.data-state]': "cdkTrigger.isOpen() ? 'open': 'closed'",
|
468
|
+
'[attr.data-disabled]': "disabled() ? '' : undefined",
|
469
|
+
'(pointerdown)': 'onPointerDown($event)'
|
470
|
+
}
|
471
|
+
}]
|
472
|
+
}], ctorParameters: () => [] });
|
473
|
+
|
122
474
|
const menuImports = [
|
123
475
|
RdxMenuDirective,
|
476
|
+
RdxMenuItemCheckboxDirective,
|
477
|
+
RdxMenuItemRadioDirective,
|
478
|
+
RdxMenuItemIndicatorDirective,
|
479
|
+
RdxMenuTriggerDirective,
|
124
480
|
RdxMenuGroupDirective,
|
481
|
+
RdxMenuRadioGroupDirective,
|
125
482
|
RdxMenuItemDirective,
|
126
483
|
RdxMenuSeparatorDirective,
|
127
484
|
RdxMenuContentDirective,
|
128
485
|
RdxMenuLabelDirective
|
129
486
|
];
|
130
|
-
class
|
131
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
132
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.
|
487
|
+
class RdxMenuModule {
|
488
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
489
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuModule, imports: [RdxMenuDirective,
|
490
|
+
RdxMenuItemCheckboxDirective,
|
491
|
+
RdxMenuItemRadioDirective,
|
492
|
+
RdxMenuItemIndicatorDirective,
|
493
|
+
RdxMenuTriggerDirective,
|
133
494
|
RdxMenuGroupDirective,
|
495
|
+
RdxMenuRadioGroupDirective,
|
134
496
|
RdxMenuItemDirective,
|
135
497
|
RdxMenuSeparatorDirective,
|
136
498
|
RdxMenuContentDirective,
|
137
499
|
RdxMenuLabelDirective], exports: [RdxMenuDirective,
|
500
|
+
RdxMenuItemCheckboxDirective,
|
501
|
+
RdxMenuItemRadioDirective,
|
502
|
+
RdxMenuItemIndicatorDirective,
|
503
|
+
RdxMenuTriggerDirective,
|
138
504
|
RdxMenuGroupDirective,
|
505
|
+
RdxMenuRadioGroupDirective,
|
139
506
|
RdxMenuItemDirective,
|
140
507
|
RdxMenuSeparatorDirective,
|
141
508
|
RdxMenuContentDirective,
|
142
509
|
RdxMenuLabelDirective] }); }
|
143
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.
|
510
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuModule }); }
|
144
511
|
}
|
145
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
512
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: RdxMenuModule, decorators: [{
|
146
513
|
type: NgModule,
|
147
514
|
args: [{
|
148
515
|
imports: [...menuImports],
|
@@ -154,5 +521,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
|
|
154
521
|
* Generated bundle index. Do not edit.
|
155
522
|
*/
|
156
523
|
|
157
|
-
export {
|
524
|
+
export { RdxMenuContentDirective, RdxMenuDirective, RdxMenuGroupDirective, RdxMenuItemCheckboxDirective, RdxMenuItemDirective, RdxMenuItemIndicatorDirective, RdxMenuItemRadioDirective, RdxMenuLabelDirective, RdxMenuModule, RdxMenuRadioGroupDirective, RdxMenuSeparatorDirective, RdxMenuTriggerDirective };
|
158
525
|
//# sourceMappingURL=radix-ng-primitives-menu.mjs.map
|