@radix-ng/primitives 0.38.0 → 0.39.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/accordion/src/accordion-content.directive.d.ts +3 -1
- package/accordion/src/accordion-item.directive.d.ts +13 -2
- package/accordion/src/accordion-root.directive.d.ts +32 -7
- package/accordion/src/accordion-trigger.directive.d.ts +1 -0
- package/collapsible/src/collapsible-content.directive.d.ts +8 -5
- package/fesm2022/radix-ng-primitives-accordion.mjs +88 -43
- package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-collapsible.mjs +51 -38
- package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-switch.mjs +3 -0
- package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
- package/hover-card/src/hover-card-root.directive.d.ts +4 -4
- package/package.json +1 -1
- package/popover/src/popover-root.directive.d.ts +4 -4
- package/switch/src/switch-root.directive.d.ts +3 -0
- package/tooltip/src/tooltip-root.directive.d.ts +4 -4
@@ -1,8 +1,10 @@
|
|
1
|
+
import { OnInit } from '@angular/core';
|
1
2
|
import * as i0 from "@angular/core";
|
2
3
|
import * as i1 from "@radix-ng/primitives/collapsible";
|
3
|
-
export declare class RdxAccordionContentDirective {
|
4
|
+
export declare class RdxAccordionContentDirective implements OnInit {
|
4
5
|
protected readonly rootContext: import("./accordion-root.directive").AccordionRootContext;
|
5
6
|
protected readonly itemContext: import("./accordion-item.directive").AccordionItemContext;
|
7
|
+
ngOnInit(): void;
|
6
8
|
static ɵfac: i0.ɵɵFactoryDeclaration<RdxAccordionContentDirective, never>;
|
7
9
|
static ɵdir: i0.ɵɵDirectiveDeclaration<RdxAccordionContentDirective, "[rdxAccordionContent]", never, {}, {}, never, never, true, [{ directive: typeof i1.RdxCollapsibleContentDirective; inputs: {}; outputs: {}; }]>;
|
8
10
|
}
|
@@ -11,6 +11,7 @@ export type AccordionItemContext = {
|
|
11
11
|
dataDisabled: Signal<boolean>;
|
12
12
|
currentElement: ElementRef<HTMLElement>;
|
13
13
|
value: Signal<string | undefined>;
|
14
|
+
updateOpen: () => void;
|
14
15
|
};
|
15
16
|
export declare const injectAccordionItemContext: (optional?: boolean) => AccordionItemContext | null, provideAccordionItemContext: (useFactory: () => AccordionItemContext) => import("@angular/core").Provider;
|
16
17
|
/**
|
@@ -20,13 +21,23 @@ export declare class RdxAccordionItemDirective {
|
|
20
21
|
readonly elementRef: ElementRef<HTMLElement>;
|
21
22
|
private readonly collapsibleContext;
|
22
23
|
protected readonly rootContext: import("./accordion-root.directive").AccordionRootContext;
|
24
|
+
/**
|
25
|
+
* A string value for the accordion item. All items within an accordion should use a unique value.
|
26
|
+
* @group Props
|
27
|
+
*/
|
23
28
|
readonly value: import("@angular/core").InputSignal<string | undefined>;
|
29
|
+
/**
|
30
|
+
* Whether or not an accordion item is disabled from user interaction.
|
31
|
+
* When `true`, prevents the user from interacting with the item.
|
32
|
+
* @group Props
|
33
|
+
*/
|
24
34
|
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
|
25
35
|
readonly isDisabled: Signal<boolean>;
|
26
|
-
readonly open: Signal<
|
36
|
+
readonly open: Signal<any>;
|
27
37
|
readonly dataState: Signal<RdxAccordionItemState>;
|
28
38
|
constructor();
|
39
|
+
updateOpen: () => void;
|
29
40
|
handleArrowKey(event: KeyboardEvent): void;
|
30
41
|
static ɵfac: i0.ɵɵFactoryDeclaration<RdxAccordionItemDirective, never>;
|
31
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<RdxAccordionItemDirective, "[rdxAccordionItem]", ["rdxAccordionItem"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.RdxCollapsibleRootDirective; inputs: { "disabled": "disabled"; }; outputs: {}; }]>;
|
42
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<RdxAccordionItemDirective, "[rdxAccordionItem]", ["rdxAccordionItem"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.RdxCollapsibleRootDirective; inputs: { "disabled": "disabled"; "open": "open"; }; outputs: {}; }]>;
|
32
43
|
}
|
@@ -3,16 +3,16 @@ import { BooleanInput } from '@angular/cdk/coercion';
|
|
3
3
|
import { ElementRef, InputSignal, InputSignalWithTransform, ModelSignal, Signal } from '@angular/core';
|
4
4
|
import { DataOrientation } from '@radix-ng/primitives/core';
|
5
5
|
import * as i0 from "@angular/core";
|
6
|
+
type AcceptableValue = string | Record<string, any> | null;
|
6
7
|
export type AccordionRootContext = {
|
7
8
|
disabled: InputSignalWithTransform<boolean, BooleanInput>;
|
8
9
|
direction: InputSignal<Direction>;
|
9
10
|
orientation: InputSignal<DataOrientation>;
|
10
|
-
value: ModelSignal<
|
11
|
+
value: ModelSignal<AcceptableValue | AcceptableValue[] | undefined>;
|
11
12
|
collapsible: Signal<boolean>;
|
12
13
|
isSingle: Signal<boolean>;
|
13
14
|
elementRef: ElementRef<HTMLElement>;
|
14
|
-
changeModelValue: (value: string
|
15
|
-
isItemOpen: (value: string) => boolean;
|
15
|
+
changeModelValue: (value: string) => void;
|
16
16
|
};
|
17
17
|
export declare const injectAccordionRootContext: (optional?: boolean) => AccordionRootContext | null, provideAccordionRootContext: (useFactory: () => AccordionRootContext) => import("@angular/core").Provider;
|
18
18
|
/**
|
@@ -21,6 +21,11 @@ export declare const injectAccordionRootContext: (optional?: boolean) => Accordi
|
|
21
21
|
export declare class RdxAccordionRootDirective {
|
22
22
|
readonly elementRef: ElementRef<HTMLElement>;
|
23
23
|
readonly id: InputSignal<string>;
|
24
|
+
/**
|
25
|
+
* The reading direction of the accordion when applicable. If omitted, assumes LTR (left-to-right) reading mode.
|
26
|
+
*
|
27
|
+
* @group Props
|
28
|
+
*/
|
24
29
|
readonly dir: InputSignal<Direction>;
|
25
30
|
/** Whether the Accordion is disabled.
|
26
31
|
* @defaultValue false
|
@@ -34,25 +39,45 @@ export declare class RdxAccordionRootDirective {
|
|
34
39
|
* @group Props
|
35
40
|
*/
|
36
41
|
readonly orientation: InputSignal<DataOrientation>;
|
42
|
+
/**
|
43
|
+
* The default active value of the item(s).
|
44
|
+
*
|
45
|
+
* Use when you do not need to control the state of the item(s).
|
46
|
+
* @group Props
|
47
|
+
*/
|
37
48
|
readonly defaultValue: InputSignal<string | string[] | undefined>;
|
38
49
|
/**
|
39
50
|
* The controlled value of the item to expand.
|
40
51
|
*
|
41
52
|
* @group Props
|
42
53
|
*/
|
43
|
-
readonly value: ModelSignal<
|
54
|
+
readonly value: ModelSignal<AcceptableValue | AcceptableValue[] | undefined>;
|
55
|
+
/**
|
56
|
+
* When type is "single", allows closing content when clicking trigger for an open item.
|
57
|
+
* When type is "multiple", this prop has no effect.
|
58
|
+
*
|
59
|
+
* @defaultValue false
|
60
|
+
* @group Props
|
61
|
+
*/
|
44
62
|
readonly collapsible: InputSignalWithTransform<boolean, BooleanInput>;
|
63
|
+
/**
|
64
|
+
* Determines whether a "single" or "multiple" items can be selected at a time.
|
65
|
+
*
|
66
|
+
* @defaultValue 'single'
|
67
|
+
* @group Props
|
68
|
+
*/
|
45
69
|
readonly type: InputSignal<"multiple" | "single">;
|
46
70
|
/**
|
47
71
|
* Event handler called when the expanded state of an item changes and type is "multiple".
|
48
72
|
* @group Emits
|
49
73
|
*/
|
50
74
|
readonly onValueChange: import("@angular/core").OutputEmitterRef<void>;
|
51
|
-
readonly isCollapsible: Signal<boolean>;
|
52
75
|
readonly isSingle: Signal<boolean>;
|
53
76
|
constructor();
|
54
|
-
changeModelValue: (
|
55
|
-
|
77
|
+
changeModelValue: (newValue: string) => void;
|
78
|
+
private isValueEqualOrExist;
|
79
|
+
private isEqual;
|
56
80
|
static ɵfac: i0.ɵɵFactoryDeclaration<RdxAccordionRootDirective, never>;
|
57
81
|
static ɵdir: i0.ɵɵDirectiveDeclaration<RdxAccordionRootDirective, "[rdxAccordionRoot]", ["rdxAccordionRoot"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "dir": { "alias": "dir"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "defaultValue": { "alias": "defaultValue"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "collapsible": { "alias": "collapsible"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "onValueChange": "onValueChange"; }, never, never, true, never>;
|
58
82
|
}
|
83
|
+
export {};
|
@@ -4,6 +4,7 @@ export declare class RdxAccordionTriggerDirective {
|
|
4
4
|
protected readonly rootContext: import("./accordion-root.directive").AccordionRootContext;
|
5
5
|
protected readonly itemContext: import("./accordion-item.directive").AccordionItemContext;
|
6
6
|
constructor();
|
7
|
+
changeItem(): void;
|
7
8
|
static ɵfac: i0.ɵɵFactoryDeclaration<RdxAccordionTriggerDirective, never>;
|
8
9
|
static ɵdir: i0.ɵɵDirectiveDeclaration<RdxAccordionTriggerDirective, "[rdxAccordionTrigger]", never, {}, {}, never, never, true, [{ directive: typeof i1.RdxCollapsibleTriggerDirective; inputs: {}; outputs: {}; }]>;
|
9
10
|
}
|
@@ -1,15 +1,18 @@
|
|
1
1
|
import * as i0 from "@angular/core";
|
2
2
|
export declare class RdxCollapsibleContentDirective {
|
3
3
|
private readonly elementRef;
|
4
|
+
private readonly platformId;
|
4
5
|
protected readonly rootContext: import("./collapsible-root.directive").CollapsibleRootContext;
|
5
6
|
readonly isOpen: import("@angular/core").Signal<boolean>;
|
6
|
-
readonly height: import("@angular/core").WritableSignal<number>;
|
7
|
-
readonly width: import("@angular/core").WritableSignal<number>;
|
8
|
-
readonly
|
9
|
-
private
|
10
|
-
|
7
|
+
readonly height: import("@angular/core").WritableSignal<number | null>;
|
8
|
+
readonly width: import("@angular/core").WritableSignal<number | null>;
|
9
|
+
readonly shouldHide: import("@angular/core").WritableSignal<boolean>;
|
10
|
+
private isMountAnimationPrevented;
|
11
|
+
private currentStyle;
|
12
|
+
private firstRender;
|
11
13
|
constructor();
|
12
14
|
onAnimationEnd(): void;
|
15
|
+
private updateDimensions;
|
13
16
|
static ɵfac: i0.ɵɵFactoryDeclaration<RdxCollapsibleContentDirective, never>;
|
14
17
|
static ɵdir: i0.ɵɵDirectiveDeclaration<RdxCollapsibleContentDirective, "[rdxCollapsibleContent]", never, {}, {}, never, never, true, never>;
|
15
18
|
}
|
@@ -23,13 +23,12 @@ const rootContext = () => {
|
|
23
23
|
return {
|
24
24
|
disabled: instance.disabled,
|
25
25
|
direction: instance.dir,
|
26
|
-
collapsible: instance.
|
26
|
+
collapsible: instance.collapsible,
|
27
27
|
orientation: instance.orientation,
|
28
28
|
elementRef: instance.elementRef,
|
29
29
|
value: instance.value,
|
30
30
|
isSingle: instance.isSingle,
|
31
|
-
changeModelValue: instance.changeModelValue
|
32
|
-
isItemOpen: instance.isItemOpen
|
31
|
+
changeModelValue: instance.changeModelValue
|
33
32
|
};
|
34
33
|
};
|
35
34
|
/**
|
@@ -39,6 +38,11 @@ class RdxAccordionRootDirective {
|
|
39
38
|
constructor() {
|
40
39
|
this.elementRef = inject(ElementRef);
|
41
40
|
this.id = input(inject(_IdGenerator).getId('rdx-accordion-'));
|
41
|
+
/**
|
42
|
+
* The reading direction of the accordion when applicable. If omitted, assumes LTR (left-to-right) reading mode.
|
43
|
+
*
|
44
|
+
* @group Props
|
45
|
+
*/
|
42
46
|
this.dir = input('ltr');
|
43
47
|
/** Whether the Accordion is disabled.
|
44
48
|
* @defaultValue false
|
@@ -52,6 +56,12 @@ class RdxAccordionRootDirective {
|
|
52
56
|
* @group Props
|
53
57
|
*/
|
54
58
|
this.orientation = input('vertical');
|
59
|
+
/**
|
60
|
+
* The default active value of the item(s).
|
61
|
+
*
|
62
|
+
* Use when you do not need to control the state of the item(s).
|
63
|
+
* @group Props
|
64
|
+
*/
|
55
65
|
this.defaultValue = input();
|
56
66
|
/**
|
57
67
|
* The controlled value of the item to expand.
|
@@ -59,47 +69,64 @@ class RdxAccordionRootDirective {
|
|
59
69
|
* @group Props
|
60
70
|
*/
|
61
71
|
this.value = model();
|
72
|
+
/**
|
73
|
+
* When type is "single", allows closing content when clicking trigger for an open item.
|
74
|
+
* When type is "multiple", this prop has no effect.
|
75
|
+
*
|
76
|
+
* @defaultValue false
|
77
|
+
* @group Props
|
78
|
+
*/
|
62
79
|
this.collapsible = input(false, { transform: booleanAttribute });
|
80
|
+
/**
|
81
|
+
* Determines whether a "single" or "multiple" items can be selected at a time.
|
82
|
+
*
|
83
|
+
* @defaultValue 'single'
|
84
|
+
* @group Props
|
85
|
+
*/
|
63
86
|
this.type = input('single');
|
64
87
|
/**
|
65
88
|
* Event handler called when the expanded state of an item changes and type is "multiple".
|
66
89
|
* @group Emits
|
67
90
|
*/
|
68
91
|
this.onValueChange = output();
|
69
|
-
this.isCollapsible = computed(() => {
|
70
|
-
return this.collapsible();
|
71
|
-
});
|
72
92
|
this.isSingle = computed(() => this.type() === 'single');
|
73
|
-
this.changeModelValue = (
|
74
|
-
if (
|
75
|
-
|
76
|
-
}
|
77
|
-
if (this.type() === 'multiple') {
|
78
|
-
this.value.update((v) => {
|
79
|
-
if (Array.isArray(v)) {
|
80
|
-
return isOpen ? [...v, value] : v.filter((i) => i !== value);
|
81
|
-
}
|
82
|
-
return isOpen ? [value] : [];
|
83
|
-
});
|
93
|
+
this.changeModelValue = (newValue) => {
|
94
|
+
if (this.type() === 'single') {
|
95
|
+
this.value.set(this.isEqual(newValue, this.value()) ? undefined : newValue);
|
84
96
|
}
|
85
97
|
else {
|
86
|
-
|
87
|
-
|
98
|
+
const currentValue = this.value();
|
99
|
+
let modelValueArray = [];
|
100
|
+
if (Array.isArray(currentValue)) {
|
101
|
+
modelValueArray = [...currentValue];
|
88
102
|
}
|
103
|
+
else if (currentValue !== undefined && currentValue !== null) {
|
104
|
+
modelValueArray = [currentValue];
|
105
|
+
}
|
106
|
+
if (this.isValueEqualOrExist(modelValueArray, newValue)) {
|
107
|
+
const index = modelValueArray.findIndex((item) => this.isEqual(item, newValue));
|
108
|
+
if (index !== -1) {
|
109
|
+
modelValueArray.splice(index, 1);
|
110
|
+
}
|
111
|
+
}
|
112
|
+
else {
|
113
|
+
modelValueArray.push(newValue);
|
114
|
+
}
|
115
|
+
this.value.set(modelValueArray);
|
89
116
|
}
|
90
117
|
};
|
91
|
-
this.isItemOpen = (value) => {
|
92
|
-
if (this.type() == 'multiple') {
|
93
|
-
return !!this.value()?.includes(value);
|
94
|
-
}
|
95
|
-
return this.value() === value;
|
96
|
-
};
|
97
118
|
effect(() => {
|
98
119
|
if (this.defaultValue() !== undefined) {
|
99
120
|
this.value.set(this.defaultValue());
|
100
121
|
}
|
101
122
|
});
|
102
123
|
}
|
124
|
+
isValueEqualOrExist(arr, value) {
|
125
|
+
return arr.some((item) => this.isEqual(item, value));
|
126
|
+
}
|
127
|
+
isEqual(a, b) {
|
128
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
129
|
+
}
|
103
130
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxAccordionRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
104
131
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxAccordionRootDirective, isStandalone: true, selector: "[rdxAccordionRoot]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, dir: { classPropertyName: "dir", publicName: "dir", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, defaultValue: { classPropertyName: "defaultValue", publicName: "defaultValue", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, collapsible: { classPropertyName: "collapsible", publicName: "collapsible", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", onValueChange: "onValueChange" }, host: { properties: { "attr.data-orientation": "orientation()" } }, providers: [provideAccordionRootContext(rootContext)], exportAs: ["rdxAccordionRoot"], ngImport: i0 }); }
|
105
132
|
}
|
@@ -125,7 +152,8 @@ const itemContext = () => {
|
|
125
152
|
dataDisabled: instance.isDisabled,
|
126
153
|
triggerId: '',
|
127
154
|
currentElement: instance.elementRef,
|
128
|
-
value: computed(() => instance.value())
|
155
|
+
value: computed(() => instance.value()),
|
156
|
+
updateOpen: instance.updateOpen
|
129
157
|
};
|
130
158
|
};
|
131
159
|
/**
|
@@ -136,25 +164,29 @@ class RdxAccordionItemDirective {
|
|
136
164
|
this.elementRef = inject(ElementRef);
|
137
165
|
this.collapsibleContext = injectCollapsibleRootContext();
|
138
166
|
this.rootContext = injectAccordionRootContext();
|
167
|
+
/**
|
168
|
+
* A string value for the accordion item. All items within an accordion should use a unique value.
|
169
|
+
* @group Props
|
170
|
+
*/
|
139
171
|
this.value = input();
|
172
|
+
/**
|
173
|
+
* Whether or not an accordion item is disabled from user interaction.
|
174
|
+
* When `true`, prevents the user from interacting with the item.
|
175
|
+
* @group Props
|
176
|
+
*/
|
140
177
|
this.disabled = input(false, { transform: booleanAttribute });
|
141
178
|
this.isDisabled = computed(() => {
|
142
179
|
return this.rootContext.disabled() || this.disabled();
|
143
180
|
});
|
144
|
-
this.open = computed(() => this.rootContext.
|
181
|
+
this.open = computed(() => this.rootContext.isSingle()
|
182
|
+
? this.value() === this.rootContext.value()
|
183
|
+
: Array.isArray(this.rootContext.value()) && this.rootContext.value().includes(this.value()));
|
145
184
|
this.dataState = computed(() => (this.open() ? 'open' : 'closed'));
|
185
|
+
this.updateOpen = () => {
|
186
|
+
this.collapsibleContext.open.set(this.open());
|
187
|
+
};
|
146
188
|
effect(() => {
|
147
|
-
this.
|
148
|
-
});
|
149
|
-
let onMount = false;
|
150
|
-
effect(() => {
|
151
|
-
if (!onMount && this.open() && !this.collapsibleContext.open()) {
|
152
|
-
this.collapsibleContext.toggle();
|
153
|
-
onMount = true;
|
154
|
-
}
|
155
|
-
if (!this.open() && this.collapsibleContext.open()) {
|
156
|
-
this.collapsibleContext.toggle();
|
157
|
-
}
|
189
|
+
this.updateOpen();
|
158
190
|
});
|
159
191
|
}
|
160
192
|
handleArrowKey(event) {
|
@@ -170,7 +202,7 @@ class RdxAccordionItemDirective {
|
|
170
202
|
});
|
171
203
|
}
|
172
204
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxAccordionItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
173
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxAccordionItemDirective, isStandalone: true, selector: "[rdxAccordionItem]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown.arrowDown": "handleArrowKey($event)", "keydown.arrowUp": "handleArrowKey($event)", "keydown.arrowLeft": "handleArrowKey($event)", "keydown.arrowRight": "handleArrowKey($event)", "keydown.home": "handleArrowKey($event)", "keydown.end": "handleArrowKey($event)" }, properties: { "attr.data-orientation": "rootContext.orientation()", "attr.data-disabled": "disabled() ? \"\" : undefined", "attr.data-state": "dataState()" } }, providers: [provideAccordionItemContext(itemContext)], exportAs: ["rdxAccordionItem"], hostDirectives: [{ directive: i1.RdxCollapsibleRootDirective, inputs: ["disabled", "disabled"] }], ngImport: i0 }); }
|
205
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxAccordionItemDirective, isStandalone: true, selector: "[rdxAccordionItem]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown.arrowDown": "handleArrowKey($event)", "keydown.arrowUp": "handleArrowKey($event)", "keydown.arrowLeft": "handleArrowKey($event)", "keydown.arrowRight": "handleArrowKey($event)", "keydown.home": "handleArrowKey($event)", "keydown.end": "handleArrowKey($event)" }, properties: { "attr.data-orientation": "rootContext.orientation()", "attr.data-disabled": "disabled() ? \"\" : undefined", "attr.data-state": "dataState()" } }, providers: [provideAccordionItemContext(itemContext)], exportAs: ["rdxAccordionItem"], hostDirectives: [{ directive: i1.RdxCollapsibleRootDirective, inputs: ["disabled", "disabled", "open", "open"] }], ngImport: i0 }); }
|
174
206
|
}
|
175
207
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxAccordionItemDirective, decorators: [{
|
176
208
|
type: Directive,
|
@@ -181,7 +213,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
181
213
|
hostDirectives: [
|
182
214
|
{
|
183
215
|
directive: RdxCollapsibleRootDirective,
|
184
|
-
inputs: ['disabled: disabled']
|
216
|
+
inputs: ['disabled: disabled', 'open: open']
|
185
217
|
}
|
186
218
|
],
|
187
219
|
host: {
|
@@ -203,6 +235,9 @@ class RdxAccordionContentDirective {
|
|
203
235
|
this.rootContext = injectAccordionRootContext();
|
204
236
|
this.itemContext = injectAccordionItemContext();
|
205
237
|
}
|
238
|
+
ngOnInit() {
|
239
|
+
this.rootContext.changeModelValue(this.itemContext.value());
|
240
|
+
}
|
206
241
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxAccordionContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
207
242
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.4", type: RdxAccordionContentDirective, isStandalone: true, selector: "[rdxAccordionContent]", host: { attributes: { "role": "region" }, properties: { "attr.aria-labelledby": "itemContext.triggerId", "attr.data-state": "itemContext.dataState()", "attr.data-disabled": "itemContext.dataDisabled()", "attr.data-orientation": "rootContext.orientation()", "style": "{\n '--radix-accordion-content-height': 'var(--radix-collapsible-content-height)',\n '--radix-accordion-content-width': 'var(--radix-collapsible-content-width)',\n }" } }, hostDirectives: [{ directive: i1.RdxCollapsibleContentDirective }], ngImport: i0 }); }
|
208
243
|
}
|
@@ -251,8 +286,16 @@ class RdxAccordionTriggerDirective {
|
|
251
286
|
this.itemContext = injectAccordionItemContext();
|
252
287
|
this.itemContext.triggerId = inject(_IdGenerator).getId('rdx-accordion-trigger-');
|
253
288
|
}
|
289
|
+
changeItem() {
|
290
|
+
const triggerDisabled = this.rootContext.isSingle() && this.itemContext.open() && !this.rootContext.collapsible();
|
291
|
+
if (this.itemContext.disabled() || triggerDisabled) {
|
292
|
+
this.itemContext.updateOpen();
|
293
|
+
return;
|
294
|
+
}
|
295
|
+
this.rootContext.changeModelValue(this.itemContext.value());
|
296
|
+
}
|
254
297
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxAccordionTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
255
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.4", type: RdxAccordionTriggerDirective, isStandalone: true, selector: "[rdxAccordionTrigger]", host: { properties: { "id": "itemContext.triggerId", "attr.data-rdx-collection-item": "\"\"", "attr.role": "\"button\"", "attr.aria-disabled": "itemContext.
|
298
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.4", type: RdxAccordionTriggerDirective, isStandalone: true, selector: "[rdxAccordionTrigger]", host: { listeners: { "click": "changeItem()" }, properties: { "id": "itemContext.triggerId", "attr.data-rdx-collection-item": "\"\"", "attr.role": "\"button\"", "attr.aria-disabled": "itemContext.open() && !rootContext.collapsible() ? \"true\" : undefined", "attr.data-orientation": "rootContext.orientation()", "disabled": "itemContext.disabled()" } }, hostDirectives: [{ directive: i1.RdxCollapsibleTriggerDirective }], ngImport: i0 }); }
|
256
299
|
}
|
257
300
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxAccordionTriggerDirective, decorators: [{
|
258
301
|
type: Directive,
|
@@ -263,8 +306,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
263
306
|
'[id]': 'itemContext.triggerId',
|
264
307
|
'[attr.data-rdx-collection-item]': '""',
|
265
308
|
'[attr.role]': '"button"',
|
266
|
-
'[attr.aria-disabled]': 'itemContext.
|
267
|
-
'[attr.data-orientation]': 'rootContext.orientation()'
|
309
|
+
'[attr.aria-disabled]': 'itemContext.open() && !rootContext.collapsible() ? "true" : undefined',
|
310
|
+
'[attr.data-orientation]': 'rootContext.orientation()',
|
311
|
+
'[disabled]': 'itemContext.disabled()',
|
312
|
+
'(click)': 'changeItem()'
|
268
313
|
}
|
269
314
|
}]
|
270
315
|
}], ctorParameters: () => [] });
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-accordion.mjs","sources":["../../../packages/primitives/accordion/src/accordion-content-presence.directive.ts","../../../packages/primitives/accordion/src/accordion-root.directive.ts","../../../packages/primitives/accordion/src/accordion-item.directive.ts","../../../packages/primitives/accordion/src/accordion-content.directive.ts","../../../packages/primitives/accordion/src/accordion-header.directive.ts","../../../packages/primitives/accordion/src/accordion-trigger.directive.ts","../../../packages/primitives/accordion/index.ts","../../../packages/primitives/accordion/radix-ng-primitives-accordion.ts"],"sourcesContent":["import { Directive } from '@angular/core';\nimport { RdxCollapsibleContentPresenceDirective } from '@radix-ng/primitives/collapsible';\n\n@Directive({\n selector: 'ng-template[rdxAccordionContentPresence]',\n hostDirectives: [RdxCollapsibleContentPresenceDirective]\n})\nexport class RdxAccordionContentPresenceDirective {}\n","import { _IdGenerator } from '@angular/cdk/a11y';\nimport { Direction } from '@angular/cdk/bidi';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n computed,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n InputSignal,\n InputSignalWithTransform,\n model,\n ModelSignal,\n output,\n Signal\n} from '@angular/core';\nimport { createContext, DataOrientation } from '@radix-ng/primitives/core';\n\nexport type AccordionRootContext = {\n disabled: InputSignalWithTransform<boolean, BooleanInput>;\n direction: InputSignal<Direction>;\n orientation: InputSignal<DataOrientation>;\n value: ModelSignal<string | string[] | undefined>;\n collapsible: Signal<boolean>;\n isSingle: Signal<boolean>;\n elementRef: ElementRef<HTMLElement>;\n changeModelValue: (value: string, isOpen: boolean) => void;\n isItemOpen: (value: string) => boolean;\n};\n\nexport const [injectAccordionRootContext, provideAccordionRootContext] =\n createContext<AccordionRootContext>('AccordionRootContext');\n\nconst rootContext = (): AccordionRootContext => {\n const instance = inject(RdxAccordionRootDirective);\n\n return {\n disabled: instance.disabled,\n direction: instance.dir,\n collapsible: instance.isCollapsible,\n orientation: instance.orientation,\n elementRef: instance.elementRef,\n value: instance.value,\n isSingle: instance.isSingle,\n changeModelValue: instance.changeModelValue,\n isItemOpen: instance.isItemOpen\n };\n};\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxAccordionRoot]',\n exportAs: 'rdxAccordionRoot',\n providers: [provideAccordionRootContext(rootContext)],\n host: {\n '[attr.data-orientation]': 'orientation()'\n }\n})\nexport class RdxAccordionRootDirective {\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n readonly id = input<string>(inject(_IdGenerator).getId('rdx-accordion-'));\n\n readonly dir = input<Direction>('ltr');\n\n /** Whether the Accordion is disabled.\n * @defaultValue false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * The orientation of the accordion.\n *\n * @defaultValue 'vertical'\n * @group Props\n */\n readonly orientation = input<DataOrientation>('vertical');\n\n readonly defaultValue = input<string | string[]>();\n\n /**\n * The controlled value of the item to expand.\n *\n * @group Props\n */\n readonly value = model<string | string[]>();\n\n readonly collapsible = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly type = input<'multiple' | 'single'>('single');\n\n /**\n * Event handler called when the expanded state of an item changes and type is \"multiple\".\n * @group Emits\n */\n readonly onValueChange = output();\n\n readonly isCollapsible = computed(() => {\n return this.collapsible();\n });\n\n readonly isSingle = computed(() => this.type() === 'single');\n\n constructor() {\n effect(() => {\n if (this.defaultValue() !== undefined) {\n this.value.set(this.defaultValue());\n }\n });\n }\n\n changeModelValue = (value: string, isOpen: boolean) => {\n if (!isOpen && !this.isCollapsible()) {\n return;\n }\n\n if (this.type() === 'multiple') {\n this.value.update((v) => {\n if (Array.isArray(v)) {\n return isOpen ? [...v, value] : v.filter((i) => i !== value);\n }\n return isOpen ? [value] : [];\n });\n } else {\n if (isOpen) {\n this.value.set(value);\n }\n }\n };\n\n isItemOpen = (value: string) => {\n if (this.type() == 'multiple') {\n return !!this.value()?.includes(value);\n }\n\n return this.value() === value;\n };\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, effect, ElementRef, inject, input, Signal } from '@angular/core';\nimport { injectCollapsibleRootContext, RdxCollapsibleRootDirective } from '@radix-ng/primitives/collapsible';\nimport { createContext, useArrowNavigation } from '@radix-ng/primitives/core';\nimport { injectAccordionRootContext } from './accordion-root.directive';\n\nexport type RdxAccordionItemState = 'open' | 'closed';\n\nexport type AccordionItemContext = {\n open: Signal<boolean>;\n disabled: Signal<boolean>;\n triggerId: string;\n dataState: Signal<RdxAccordionItemState>;\n dataDisabled: Signal<boolean>;\n currentElement: ElementRef<HTMLElement>;\n value: Signal<string | undefined>;\n};\n\nexport const [injectAccordionItemContext, provideAccordionItemContext] =\n createContext<AccordionItemContext>('AccordionItemContext');\n\nconst itemContext = (): AccordionItemContext => {\n const instance = inject(RdxAccordionItemDirective);\n\n return {\n open: instance.open,\n dataState: instance.dataState,\n disabled: instance.disabled,\n dataDisabled: instance.isDisabled,\n triggerId: '',\n currentElement: instance.elementRef,\n value: computed(() => instance.value())\n };\n};\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxAccordionItem]',\n exportAs: 'rdxAccordionItem',\n providers: [provideAccordionItemContext(itemContext)],\n hostDirectives: [\n {\n directive: RdxCollapsibleRootDirective,\n inputs: ['disabled: disabled']\n }\n ],\n host: {\n '[attr.data-orientation]': 'rootContext.orientation()',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined',\n '[attr.data-state]': 'dataState()',\n\n '(keydown.arrowDown)': 'handleArrowKey($event)',\n '(keydown.arrowUp)': 'handleArrowKey($event)',\n '(keydown.arrowLeft)': 'handleArrowKey($event)',\n '(keydown.arrowRight)': 'handleArrowKey($event)',\n '(keydown.home)': 'handleArrowKey($event)',\n '(keydown.end)': 'handleArrowKey($event)'\n }\n})\nexport class RdxAccordionItemDirective {\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n private readonly collapsibleContext = injectCollapsibleRootContext()!;\n\n protected readonly rootContext = injectAccordionRootContext()!;\n\n readonly value = input<string>();\n\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly isDisabled = computed(() => {\n return this.rootContext.disabled() || this.disabled();\n });\n\n readonly open = computed(() => this.rootContext.isItemOpen(this.value()!));\n\n readonly dataState = computed((): RdxAccordionItemState => (this.open() ? 'open' : 'closed'));\n\n constructor() {\n effect(() => {\n this.rootContext.changeModelValue(this.value()!, this.collapsibleContext.open());\n });\n\n let onMount = false;\n\n effect(() => {\n if (!onMount && this.open() && !this.collapsibleContext.open()) {\n this.collapsibleContext.toggle();\n onMount = true;\n }\n\n if (!this.open() && this.collapsibleContext.open()) {\n this.collapsibleContext.toggle();\n }\n });\n }\n\n handleArrowKey(event: KeyboardEvent) {\n const target = event.target as HTMLElement;\n const allCollectionItems: HTMLElement[] = Array.from(\n this.rootContext.elementRef.nativeElement?.querySelectorAll('[data-rdx-collection-item]') ?? []\n );\n\n const collectionItemIndex = allCollectionItems.findIndex((item) => item === target);\n if (collectionItemIndex === -1) return;\n\n useArrowNavigation(\n event,\n this.elementRef.nativeElement.querySelector('[data-rdx-collection-item]')!,\n this.rootContext.elementRef.nativeElement!,\n {\n arrowKeyOptions: this.rootContext.orientation(),\n dir: this.rootContext.direction(),\n focus: true\n }\n );\n }\n}\n","import { Directive } from '@angular/core';\nimport { RdxCollapsibleContentDirective } from '@radix-ng/primitives/collapsible';\nimport { injectAccordionItemContext } from './accordion-item.directive';\nimport { injectAccordionRootContext } from './accordion-root.directive';\n\n@Directive({\n selector: '[rdxAccordionContent]',\n hostDirectives: [RdxCollapsibleContentDirective],\n host: {\n role: 'region',\n '[attr.aria-labelledby]': 'itemContext.triggerId',\n '[attr.data-state]': 'itemContext.dataState()',\n '[attr.data-disabled]': 'itemContext.dataDisabled()',\n '[attr.data-orientation]': 'rootContext.orientation()',\n '[style]': `{\n '--radix-accordion-content-height': 'var(--radix-collapsible-content-height)',\n '--radix-accordion-content-width': 'var(--radix-collapsible-content-width)',\n }`\n }\n})\nexport class RdxAccordionContentDirective {\n protected readonly rootContext = injectAccordionRootContext()!;\n protected readonly itemContext = injectAccordionItemContext()!;\n}\n","import { Directive } from '@angular/core';\nimport { injectAccordionItemContext } from './accordion-item.directive';\nimport { injectAccordionRootContext } from './accordion-root.directive';\n\n@Directive({\n selector: '[rdxAccordionHeader]',\n host: {\n '[attr.data-state]': 'itemContext.dataState()',\n '[attr.data-disabled]': 'itemContext.dataDisabled()',\n '[attr.data-orientation]': 'rootContext.orientation()'\n }\n})\nexport class RdxAccordionHeaderDirective {\n protected readonly rootContext = injectAccordionRootContext()!;\n protected readonly itemContext = injectAccordionItemContext()!;\n}\n","import { _IdGenerator } from '@angular/cdk/a11y';\nimport { Directive, inject } from '@angular/core';\nimport { RdxCollapsibleTriggerDirective } from '@radix-ng/primitives/collapsible';\nimport { injectAccordionItemContext } from './accordion-item.directive';\nimport { injectAccordionRootContext } from './accordion-root.directive';\n\n@Directive({\n selector: '[rdxAccordionTrigger]',\n hostDirectives: [RdxCollapsibleTriggerDirective],\n host: {\n '[id]': 'itemContext.triggerId',\n '[attr.data-rdx-collection-item]': '\"\"',\n '[attr.role]': '\"button\"',\n '[attr.aria-disabled]': 'itemContext.disabled() || undefined',\n '[attr.data-orientation]': 'rootContext.orientation()'\n }\n})\nexport class RdxAccordionTriggerDirective {\n protected readonly rootContext = injectAccordionRootContext()!;\n protected readonly itemContext = injectAccordionItemContext()!;\n\n constructor() {\n this.itemContext.triggerId = inject(_IdGenerator).getId('rdx-accordion-trigger-');\n }\n}\n","import { NgModule } from '@angular/core';\nimport { RdxAccordionContentPresenceDirective } from './src/accordion-content-presence.directive';\nimport { RdxAccordionContentDirective } from './src/accordion-content.directive';\nimport { RdxAccordionHeaderDirective } from './src/accordion-header.directive';\nimport { RdxAccordionItemDirective } from './src/accordion-item.directive';\nimport { RdxAccordionRootDirective } from './src/accordion-root.directive';\nimport { RdxAccordionTriggerDirective } from './src/accordion-trigger.directive';\n\nexport * from './src/accordion-content-presence.directive';\nexport * from './src/accordion-content.directive';\nexport * from './src/accordion-header.directive';\nexport * from './src/accordion-item.directive';\nexport * from './src/accordion-root.directive';\nexport * from './src/accordion-trigger.directive';\n\nconst _imports = [\n RdxAccordionContentDirective,\n RdxAccordionHeaderDirective,\n RdxAccordionItemDirective,\n RdxAccordionRootDirective,\n RdxAccordionTriggerDirective,\n RdxAccordionContentPresenceDirective\n];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxAccordionModule {}\n","/**\n * Generated bundle index. Do not ed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AO3B,kBAAkB,EAAA,CAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;AC3BD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"radix-ng-primitives-accordion.mjs","sources":["../../../packages/primitives/accordion/src/accordion-content-presence.directive.ts","../../../packages/primitives/accordion/src/accordion-root.directive.ts","../../../packages/primitives/accordion/src/accordion-item.directive.ts","../../../packages/primitives/accordion/src/accordion-content.directive.ts","../../../packages/primitives/accordion/src/accordion-header.directive.ts","../../../packages/primitives/accordion/src/accordion-trigger.directive.ts","../../../packages/primitives/accordion/index.ts","../../../packages/primitives/accordion/radix-ng-primitives-accordion.ts"],"sourcesContent":["import { Directive } from '@angular/core';\nimport { RdxCollapsibleContentPresenceDirective } from '@radix-ng/primitives/collapsible';\n\n@Directive({\n selector: 'ng-template[rdxAccordionContentPresence]',\n hostDirectives: [RdxCollapsibleContentPresenceDirective]\n})\nexport class RdxAccordionContentPresenceDirective {}\n","import { _IdGenerator } from '@angular/cdk/a11y';\nimport { Direction } from '@angular/cdk/bidi';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n computed,\n Directive,\n effect,\n ElementRef,\n inject,\n input,\n InputSignal,\n InputSignalWithTransform,\n model,\n ModelSignal,\n output,\n Signal\n} from '@angular/core';\nimport { createContext, DataOrientation } from '@radix-ng/primitives/core';\n\ntype AcceptableValue = string | Record<string, any> | null;\n\nexport type AccordionRootContext = {\n disabled: InputSignalWithTransform<boolean, BooleanInput>;\n direction: InputSignal<Direction>;\n orientation: InputSignal<DataOrientation>;\n value: ModelSignal<AcceptableValue | AcceptableValue[] | undefined>;\n collapsible: Signal<boolean>;\n isSingle: Signal<boolean>;\n elementRef: ElementRef<HTMLElement>;\n changeModelValue: (value: string) => void;\n};\n\nexport const [injectAccordionRootContext, provideAccordionRootContext] =\n createContext<AccordionRootContext>('AccordionRootContext');\n\nconst rootContext = (): AccordionRootContext => {\n const instance = inject(RdxAccordionRootDirective);\n\n return {\n disabled: instance.disabled,\n direction: instance.dir,\n collapsible: instance.collapsible,\n orientation: instance.orientation,\n elementRef: instance.elementRef,\n value: instance.value,\n isSingle: instance.isSingle,\n changeModelValue: instance.changeModelValue\n };\n};\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxAccordionRoot]',\n exportAs: 'rdxAccordionRoot',\n providers: [provideAccordionRootContext(rootContext)],\n host: {\n '[attr.data-orientation]': 'orientation()'\n }\n})\nexport class RdxAccordionRootDirective {\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n readonly id = input<string>(inject(_IdGenerator).getId('rdx-accordion-'));\n\n /**\n * The reading direction of the accordion when applicable. If omitted, assumes LTR (left-to-right) reading mode.\n *\n * @group Props\n */\n readonly dir = input<Direction>('ltr');\n\n /** Whether the Accordion is disabled.\n * @defaultValue false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * The orientation of the accordion.\n *\n * @defaultValue 'vertical'\n * @group Props\n */\n readonly orientation = input<DataOrientation>('vertical');\n\n /**\n * The default active value of the item(s).\n *\n * Use when you do not need to control the state of the item(s).\n * @group Props\n */\n readonly defaultValue = input<string | string[]>();\n\n /**\n * The controlled value of the item to expand.\n *\n * @group Props\n */\n readonly value = model<AcceptableValue | AcceptableValue[]>();\n\n /**\n * When type is \"single\", allows closing content when clicking trigger for an open item.\n * When type is \"multiple\", this prop has no effect.\n *\n * @defaultValue false\n * @group Props\n */\n readonly collapsible = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * Determines whether a \"single\" or \"multiple\" items can be selected at a time.\n *\n * @defaultValue 'single'\n * @group Props\n */\n readonly type = input<'multiple' | 'single'>('single');\n\n /**\n * Event handler called when the expanded state of an item changes and type is \"multiple\".\n * @group Emits\n */\n readonly onValueChange = output();\n\n readonly isSingle = computed(() => this.type() === 'single');\n\n constructor() {\n effect(() => {\n if (this.defaultValue() !== undefined) {\n this.value.set(this.defaultValue());\n }\n });\n }\n\n changeModelValue = (newValue: string) => {\n if (this.type() === 'single') {\n this.value.set(this.isEqual(newValue, this.value()) ? undefined : newValue);\n } else {\n const currentValue = this.value();\n let modelValueArray: AcceptableValue[] = [];\n\n if (Array.isArray(currentValue)) {\n modelValueArray = [...currentValue];\n } else if (currentValue !== undefined && currentValue !== null) {\n modelValueArray = [currentValue];\n }\n\n if (this.isValueEqualOrExist(modelValueArray, newValue)) {\n const index = modelValueArray.findIndex((item) => this.isEqual(item, newValue));\n if (index !== -1) {\n modelValueArray.splice(index, 1);\n }\n } else {\n modelValueArray.push(newValue);\n }\n\n this.value.set(modelValueArray);\n }\n };\n\n private isValueEqualOrExist(arr: AcceptableValue[], value: AcceptableValue): boolean {\n return arr.some((item) => this.isEqual(item, value));\n }\n\n private isEqual(a: any, b: any): boolean {\n return JSON.stringify(a) === JSON.stringify(b);\n }\n}\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, computed, Directive, effect, ElementRef, inject, input, Signal } from '@angular/core';\nimport { injectCollapsibleRootContext, RdxCollapsibleRootDirective } from '@radix-ng/primitives/collapsible';\nimport { createContext, useArrowNavigation } from '@radix-ng/primitives/core';\nimport { injectAccordionRootContext } from './accordion-root.directive';\n\nexport type RdxAccordionItemState = 'open' | 'closed';\n\nexport type AccordionItemContext = {\n open: Signal<boolean>;\n disabled: Signal<boolean>;\n triggerId: string;\n dataState: Signal<RdxAccordionItemState>;\n dataDisabled: Signal<boolean>;\n currentElement: ElementRef<HTMLElement>;\n value: Signal<string | undefined>;\n updateOpen: () => void;\n};\n\nexport const [injectAccordionItemContext, provideAccordionItemContext] =\n createContext<AccordionItemContext>('AccordionItemContext');\n\nconst itemContext = (): AccordionItemContext => {\n const instance = inject(RdxAccordionItemDirective);\n\n return {\n open: instance.open,\n dataState: instance.dataState,\n disabled: instance.disabled,\n dataDisabled: instance.isDisabled,\n triggerId: '',\n currentElement: instance.elementRef,\n value: computed(() => instance.value()),\n updateOpen: instance.updateOpen\n };\n};\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxAccordionItem]',\n exportAs: 'rdxAccordionItem',\n providers: [provideAccordionItemContext(itemContext)],\n hostDirectives: [\n {\n directive: RdxCollapsibleRootDirective,\n inputs: ['disabled: disabled', 'open: open']\n }\n ],\n host: {\n '[attr.data-orientation]': 'rootContext.orientation()',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined',\n '[attr.data-state]': 'dataState()',\n\n '(keydown.arrowDown)': 'handleArrowKey($event)',\n '(keydown.arrowUp)': 'handleArrowKey($event)',\n '(keydown.arrowLeft)': 'handleArrowKey($event)',\n '(keydown.arrowRight)': 'handleArrowKey($event)',\n '(keydown.home)': 'handleArrowKey($event)',\n '(keydown.end)': 'handleArrowKey($event)'\n }\n})\nexport class RdxAccordionItemDirective {\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n private readonly collapsibleContext = injectCollapsibleRootContext()!;\n\n protected readonly rootContext = injectAccordionRootContext()!;\n\n /**\n * A string value for the accordion item. All items within an accordion should use a unique value.\n * @group Props\n */\n readonly value = input<string>();\n\n /**\n * Whether or not an accordion item is disabled from user interaction.\n * When `true`, prevents the user from interacting with the item.\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly isDisabled = computed(() => {\n return this.rootContext.disabled() || this.disabled();\n });\n\n readonly open = computed(() =>\n this.rootContext.isSingle()\n ? this.value() === this.rootContext.value()\n : Array.isArray(this.rootContext.value()) && this.rootContext.value()!.includes(this.value()!)\n );\n\n readonly dataState = computed((): RdxAccordionItemState => (this.open() ? 'open' : 'closed'));\n\n constructor() {\n effect(() => {\n this.updateOpen();\n });\n }\n\n updateOpen = () => {\n this.collapsibleContext.open.set(this.open());\n };\n\n handleArrowKey(event: KeyboardEvent) {\n const target = event.target as HTMLElement;\n const allCollectionItems: HTMLElement[] = Array.from(\n this.rootContext.elementRef.nativeElement?.querySelectorAll('[data-rdx-collection-item]') ?? []\n );\n\n const collectionItemIndex = allCollectionItems.findIndex((item) => item === target);\n if (collectionItemIndex === -1) return;\n\n useArrowNavigation(\n event,\n this.elementRef.nativeElement.querySelector('[data-rdx-collection-item]')!,\n this.rootContext.elementRef.nativeElement!,\n {\n arrowKeyOptions: this.rootContext.orientation(),\n dir: this.rootContext.direction(),\n focus: true\n }\n );\n }\n}\n","import { Directive, OnInit } from '@angular/core';\nimport { RdxCollapsibleContentDirective } from '@radix-ng/primitives/collapsible';\nimport { injectAccordionItemContext } from './accordion-item.directive';\nimport { injectAccordionRootContext } from './accordion-root.directive';\n\n@Directive({\n selector: '[rdxAccordionContent]',\n hostDirectives: [RdxCollapsibleContentDirective],\n host: {\n role: 'region',\n '[attr.aria-labelledby]': 'itemContext.triggerId',\n '[attr.data-state]': 'itemContext.dataState()',\n '[attr.data-disabled]': 'itemContext.dataDisabled()',\n '[attr.data-orientation]': 'rootContext.orientation()',\n '[style]': `{\n '--radix-accordion-content-height': 'var(--radix-collapsible-content-height)',\n '--radix-accordion-content-width': 'var(--radix-collapsible-content-width)',\n }`\n }\n})\nexport class RdxAccordionContentDirective implements OnInit {\n protected readonly rootContext = injectAccordionRootContext()!;\n protected readonly itemContext = injectAccordionItemContext()!;\n\n ngOnInit() {\n this.rootContext.changeModelValue(this.itemContext.value()!);\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectAccordionItemContext } from './accordion-item.directive';\nimport { injectAccordionRootContext } from './accordion-root.directive';\n\n@Directive({\n selector: '[rdxAccordionHeader]',\n host: {\n '[attr.data-state]': 'itemContext.dataState()',\n '[attr.data-disabled]': 'itemContext.dataDisabled()',\n '[attr.data-orientation]': 'rootContext.orientation()'\n }\n})\nexport class RdxAccordionHeaderDirective {\n protected readonly rootContext = injectAccordionRootContext()!;\n protected readonly itemContext = injectAccordionItemContext()!;\n}\n","import { _IdGenerator } from '@angular/cdk/a11y';\nimport { Directive, inject } from '@angular/core';\nimport { RdxCollapsibleTriggerDirective } from '@radix-ng/primitives/collapsible';\nimport { injectAccordionItemContext } from './accordion-item.directive';\nimport { injectAccordionRootContext } from './accordion-root.directive';\n\n@Directive({\n selector: '[rdxAccordionTrigger]',\n hostDirectives: [RdxCollapsibleTriggerDirective],\n host: {\n '[id]': 'itemContext.triggerId',\n '[attr.data-rdx-collection-item]': '\"\"',\n '[attr.role]': '\"button\"',\n '[attr.aria-disabled]': 'itemContext.open() && !rootContext.collapsible() ? \"true\" : undefined',\n '[attr.data-orientation]': 'rootContext.orientation()',\n '[disabled]': 'itemContext.disabled()',\n\n '(click)': 'changeItem()'\n }\n})\nexport class RdxAccordionTriggerDirective {\n protected readonly rootContext = injectAccordionRootContext()!;\n protected readonly itemContext = injectAccordionItemContext()!;\n\n constructor() {\n this.itemContext.triggerId = inject(_IdGenerator).getId('rdx-accordion-trigger-');\n }\n\n changeItem() {\n const triggerDisabled =\n this.rootContext.isSingle() && this.itemContext.open() && !this.rootContext.collapsible();\n\n if (this.itemContext.disabled() || triggerDisabled) {\n this.itemContext.updateOpen();\n return;\n }\n\n this.rootContext.changeModelValue(this.itemContext.value()!);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { RdxAccordionContentPresenceDirective } from './src/accordion-content-presence.directive';\nimport { RdxAccordionContentDirective } from './src/accordion-content.directive';\nimport { RdxAccordionHeaderDirective } from './src/accordion-header.directive';\nimport { RdxAccordionItemDirective } from './src/accordion-item.directive';\nimport { RdxAccordionRootDirective } from './src/accordion-root.directive';\nimport { RdxAccordionTriggerDirective } from './src/accordion-trigger.directive';\n\nexport * from './src/accordion-content-presence.directive';\nexport * from './src/accordion-content.directive';\nexport * from './src/accordion-header.directive';\nexport * from './src/accordion-item.directive';\nexport * from './src/accordion-root.directive';\nexport * from './src/accordion-trigger.directive';\n\nconst _imports = [\n RdxAccordionContentDirective,\n RdxAccordionHeaderDirective,\n RdxAccordionItemDirective,\n RdxAccordionRootDirective,\n RdxAccordionTriggerDirective,\n RdxAccordionContentPresenceDirective\n];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxAccordionModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAOa,oCAAoC,CAAA;8GAApC,oCAAoC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAApC,oCAAoC,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,0CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,sCAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAApC,oCAAoC,EAAA,UAAA,EAAA,CAAA;kBAJhD,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,0CAA0C;oBACpD,cAAc,EAAE,CAAC,sCAAsC;AAC1D,iBAAA;;;AC2BM,MAAM,CAAC,0BAA0B,EAAE,2BAA2B,CAAC,GAClE,aAAa,CAAuB,sBAAsB;AAE9D,MAAM,WAAW,GAAG,MAA2B;AAC3C,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,yBAAyB,CAAC;IAElD,OAAO;QACH,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,SAAS,EAAE,QAAQ,CAAC,GAAG;QACvB,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,gBAAgB,EAAE,QAAQ,CAAC;KAC9B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AA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;AC3BD;;AAEG;;;;"}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { inject, untracked, model, input, booleanAttribute, linkedSignal, computed, output, Directive, ElementRef, signal, afterNextRender, NgModule } from '@angular/core';
|
2
|
+
import { inject, untracked, model, input, booleanAttribute, linkedSignal, computed, output, Directive, ElementRef, PLATFORM_ID, signal, effect, afterNextRender, NgModule } from '@angular/core';
|
3
3
|
import * as i1 from '@radix-ng/primitives/presence';
|
4
4
|
import { provideRdxPresenceContext, RdxPresenceDirective } from '@radix-ng/primitives/presence';
|
5
|
-
import { createContext
|
5
|
+
import { createContext } from '@radix-ng/primitives/core';
|
6
|
+
import { isPlatformBrowser } from '@angular/common';
|
6
7
|
|
7
8
|
const [injectCollapsibleRootContext, provideCollapsibleRootContext] = createContext('CollapsibleRootContext');
|
8
9
|
const rootContext = () => {
|
@@ -12,7 +13,9 @@ const rootContext = () => {
|
|
12
13
|
disabled: instance.isDisabled,
|
13
14
|
open: instance.open,
|
14
15
|
toggle: () => {
|
15
|
-
untracked(() =>
|
16
|
+
untracked(() => {
|
17
|
+
instance.open.set(!instance.open());
|
18
|
+
});
|
16
19
|
instance.onOpenChange.emit(instance.open());
|
17
20
|
}
|
18
21
|
};
|
@@ -89,62 +92,72 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
89
92
|
class RdxCollapsibleContentDirective {
|
90
93
|
constructor() {
|
91
94
|
this.elementRef = inject(ElementRef);
|
95
|
+
this.platformId = inject(PLATFORM_ID);
|
92
96
|
this.rootContext = injectCollapsibleRootContext();
|
93
97
|
this.isOpen = computed(() => this.rootContext.open());
|
94
|
-
this.height = signal(
|
95
|
-
this.width = signal(
|
98
|
+
this.height = signal(null);
|
99
|
+
this.width = signal(null);
|
100
|
+
this.shouldHide = signal(true);
|
96
101
|
this.isMountAnimationPrevented = signal(true);
|
97
|
-
this.
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
if (isOpen) {
|
104
|
-
this.hiddenSignal.set(false);
|
105
|
-
setTimeout(() => {
|
106
|
-
const node = this.elementRef.nativeElement;
|
107
|
-
if (!node)
|
108
|
-
return;
|
109
|
-
node.style.transition = 'none';
|
110
|
-
node.style.animation = 'none';
|
111
|
-
const rect = node.getBoundingClientRect();
|
112
|
-
this.height.set(rect.height);
|
113
|
-
this.width.set(rect.width);
|
114
|
-
if (!this.isMountAnimationPrevented()) {
|
115
|
-
node.style.transition = this.originalStyles.transition;
|
116
|
-
node.style.animation = this.originalStyles.animation;
|
117
|
-
}
|
118
|
-
});
|
102
|
+
this.currentStyle = signal(null);
|
103
|
+
this.firstRender = true;
|
104
|
+
effect(() => {
|
105
|
+
const isOpen = this.isOpen();
|
106
|
+
if (!isPlatformBrowser(this.platformId)) {
|
107
|
+
return;
|
119
108
|
}
|
109
|
+
requestAnimationFrame(() => {
|
110
|
+
this.updateDimensions(isOpen);
|
111
|
+
});
|
120
112
|
});
|
121
113
|
afterNextRender(() => {
|
122
|
-
this.originalStyles = {
|
123
|
-
transition: this.elementRef.nativeElement.style.transition,
|
124
|
-
animation: this.elementRef.nativeElement.style.animation
|
125
|
-
};
|
126
114
|
requestAnimationFrame(() => {
|
127
115
|
this.isMountAnimationPrevented.set(false);
|
128
116
|
});
|
129
117
|
});
|
130
118
|
}
|
131
119
|
onAnimationEnd() {
|
132
|
-
if (!this.
|
133
|
-
this.
|
120
|
+
if (!this.isOpen()) {
|
121
|
+
this.shouldHide.set(true);
|
122
|
+
}
|
123
|
+
}
|
124
|
+
async updateDimensions(isOpen) {
|
125
|
+
const node = this.elementRef.nativeElement;
|
126
|
+
if (!node)
|
127
|
+
return;
|
128
|
+
if (!this.currentStyle()) {
|
129
|
+
this.currentStyle.set({
|
130
|
+
transitionDuration: node.style.transitionDuration,
|
131
|
+
animationName: node.style.animationName
|
132
|
+
});
|
133
|
+
}
|
134
|
+
if (isOpen) {
|
135
|
+
this.shouldHide.set(false);
|
136
|
+
node.hidden = false;
|
137
|
+
}
|
138
|
+
node.style.transitionDuration = '0s';
|
139
|
+
node.style.animationName = 'none';
|
140
|
+
const rect = node.getBoundingClientRect();
|
141
|
+
this.height.set(rect.height);
|
142
|
+
this.width.set(rect.width);
|
143
|
+
if (!this.isMountAnimationPrevented() && !this.firstRender) {
|
144
|
+
node.style.transitionDuration = this.currentStyle()?.transitionDuration || '';
|
145
|
+
node.style.animationName = this.currentStyle()?.animationName || '';
|
134
146
|
}
|
147
|
+
this.firstRender = false;
|
135
148
|
}
|
136
149
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxCollapsibleContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
137
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.4", type: RdxCollapsibleContentDirective, isStandalone: true, selector: "[rdxCollapsibleContent]", host: {
|
150
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.4", type: RdxCollapsibleContentDirective, isStandalone: true, selector: "[rdxCollapsibleContent]", host: { listeners: { "animationend": "onAnimationEnd()" }, properties: { "id": "rootContext.contentId()", "attr.data-state": "rootContext.open() ? \"open\" : \"closed\"", "attr.data-disabled": "rootContext.disabled() ? \"true\" : undefined", "attr.hidden": "shouldHide() ? \"until-found\" : undefined", "style.--radix-collapsible-content-width.px": "width()", "style.--radix-collapsible-content-height.px": "height()" } }, ngImport: i0 }); }
|
138
151
|
}
|
139
152
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxCollapsibleContentDirective, decorators: [{
|
140
153
|
type: Directive,
|
141
154
|
args: [{
|
142
155
|
selector: '[rdxCollapsibleContent]',
|
143
156
|
host: {
|
144
|
-
id: 'rootContext.contentId()',
|
157
|
+
'[id]': 'rootContext.contentId()',
|
145
158
|
'[attr.data-state]': 'rootContext.open() ? "open" : "closed"',
|
146
159
|
'[attr.data-disabled]': 'rootContext.disabled() ? "true" : undefined',
|
147
|
-
'[
|
160
|
+
'[attr.hidden]': 'shouldHide() ? "until-found" : undefined',
|
148
161
|
'[style.--radix-collapsible-content-width.px]': 'width()',
|
149
162
|
'[style.--radix-collapsible-content-height.px]': 'height()',
|
150
163
|
'(animationend)': 'onAnimationEnd()'
|
@@ -157,7 +170,7 @@ class RdxCollapsibleTriggerDirective {
|
|
157
170
|
this.rootContext = injectCollapsibleRootContext();
|
158
171
|
}
|
159
172
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxCollapsibleTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
160
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.4", type: RdxCollapsibleTriggerDirective, isStandalone: true, selector: "[rdxCollapsibleTrigger]", host: { listeners: { "click": "rootContext.toggle()" }, properties: { "attr.aria-controls": "rootContext.contentId()", "attr.aria-expanded": "rootContext.open()", "attr.data-state": "rootContext.open() ? \"open\" : \"closed\"", "attr.data-disabled": "rootContext.disabled() ? \"true\" : undefined", "disabled": "rootContext.disabled()" } }, ngImport: i0 }); }
|
173
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.4", type: RdxCollapsibleTriggerDirective, isStandalone: true, selector: "[rdxCollapsibleTrigger]", host: { listeners: { "click": "rootContext.toggle()" }, properties: { "attr.aria-controls": "rootContext.contentId()", "attr.aria-expanded": "rootContext.open()", "attr.data-state": "rootContext.open() ? \"open\" : \"closed\"", "attr.data-disabled": "rootContext.disabled() ? \"true\" : undefined", "attr.disabled": "rootContext.disabled() || undefined" } }, ngImport: i0 }); }
|
161
174
|
}
|
162
175
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxCollapsibleTriggerDirective, decorators: [{
|
163
176
|
type: Directive,
|
@@ -168,7 +181,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
168
181
|
'[attr.aria-expanded]': 'rootContext.open()',
|
169
182
|
'[attr.data-state]': 'rootContext.open() ? "open" : "closed"',
|
170
183
|
'[attr.data-disabled]': 'rootContext.disabled() ? "true" : undefined',
|
171
|
-
'[disabled]': 'rootContext.disabled()',
|
184
|
+
'[attr.disabled]': 'rootContext.disabled() || undefined',
|
172
185
|
'(click)': 'rootContext.toggle()'
|
173
186
|
}
|
174
187
|
}]
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-collapsible.mjs","sources":["../../../packages/primitives/collapsible/src/collapsible-root.directive.ts","../../../packages/primitives/collapsible/src/collapsible-content-presence.directive.ts","../../../packages/primitives/collapsible/src/collapsible-content.directive.ts","../../../packages/primitives/collapsible/src/collapsible-trigger.directive.ts","../../../packages/primitives/collapsible/index.ts","../../../packages/primitives/collapsible/radix-ng-primitives-collapsible.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n computed,\n Directive,\n inject,\n input,\n InputSignal,\n linkedSignal,\n model,\n ModelSignal,\n output,\n Signal,\n untracked\n} from '@angular/core';\nimport { createContext } from '@radix-ng/primitives/core';\n\nexport type RdxCollapsibleState = 'open' | 'closed';\n\nexport interface CollapsibleRootContext {\n contentId: InputSignal<string>;\n open: ModelSignal<boolean>;\n toggle: () => void;\n disabled: Signal<boolean>;\n}\n\nexport const [injectCollapsibleRootContext, provideCollapsibleRootContext] =\n createContext<CollapsibleRootContext>('CollapsibleRootContext');\n\nconst rootContext = (): CollapsibleRootContext => {\n const instance = inject(RdxCollapsibleRootDirective);\n\n return {\n contentId: instance.contentId,\n disabled: instance.isDisabled,\n open: instance.open,\n toggle: () => {\n untracked(() => instance.open.update((v) => !v));\n instance.onOpenChange.emit(instance.open());\n }\n };\n};\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxCollapsibleRoot]',\n exportAs: 'rdxCollapsibleRoot',\n providers: [provideCollapsibleRootContext(rootContext)],\n host: {\n '[attr.data-state]': 'open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined'\n }\n})\nexport class RdxCollapsibleRootDirective {\n /**\n * The controlled open state of the collapsible.\n * Sets the state of the directive. `true` - expanded, `false` - collapsed\n *\n * @group Props\n * @defaultValue false\n */\n readonly open = model<boolean>(false);\n\n readonly contentId = input<string>('');\n\n /**\n * Determines whether a directive is available for interaction.\n * When true, prevents the user from interacting with the collapsible.\n *\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly _disabled = linkedSignal(this.disabled);\n\n readonly isDisabled = this._disabled.asReadonly();\n\n readonly isOpen = computed(() => this.open());\n\n /**\n * Emitted with new value when directive state changed.\n * Event handler called when the open state of the collapsible changes.\n *\n * @group Emits\n */\n readonly onOpenChange = output<boolean>();\n}\n","import { Directive } from '@angular/core';\nimport { provideRdxPresenceContext, RdxPresenceDirective } from '@radix-ng/primitives/presence';\nimport { injectCollapsibleRootContext } from './collapsible-root.directive';\n\n@Directive({\n selector: 'ng-template[rdxCollapsibleContentPresence]',\n providers: [\n provideRdxPresenceContext(() => ({\n present: injectCollapsibleRootContext()!.open\n }))\n ],\n hostDirectives: [RdxPresenceDirective]\n})\nexport class RdxCollapsibleContentPresenceDirective {}\n","import { afterNextRender, computed, Directive, ElementRef, inject, signal } from '@angular/core';\nimport { watch } from '@radix-ng/primitives/core';\nimport { injectCollapsibleRootContext } from './collapsible-root.directive';\n\n@Directive({\n selector: '[rdxCollapsibleContent]',\n host: {\n id: 'rootContext.contentId()',\n\n '[attr.data-state]': 'rootContext.open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"true\" : undefined',\n '[style.display]': 'hiddenSignal() ? \"none\" : undefined',\n '[style.--radix-collapsible-content-width.px]': 'width()',\n '[style.--radix-collapsible-content-height.px]': 'height()',\n '(animationend)': 'onAnimationEnd()'\n }\n})\nexport class RdxCollapsibleContentDirective {\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n protected readonly rootContext = injectCollapsibleRootContext()!;\n\n readonly isOpen = computed(() => this.rootContext.open());\n\n readonly height = signal(0);\n readonly width = signal(0);\n readonly isMountAnimationPrevented = signal(true);\n\n private originalStyles: { transition: string; animation: string } = {\n transition: '',\n animation: ''\n };\n\n protected readonly hiddenSignal = signal(false);\n\n constructor() {\n watch([this.isOpen], ([isOpen]) => {\n if (isOpen) {\n this.hiddenSignal.set(false);\n\n setTimeout(() => {\n const node = this.elementRef.nativeElement;\n if (!node) return;\n\n node.style.transition = 'none';\n node.style.animation = 'none';\n\n const rect = node.getBoundingClientRect();\n this.height.set(rect.height);\n this.width.set(rect.width);\n\n if (!this.isMountAnimationPrevented()) {\n node.style.transition = this.originalStyles.transition;\n node.style.animation = this.originalStyles.animation;\n }\n });\n }\n });\n\n afterNextRender(() => {\n this.originalStyles = {\n transition: this.elementRef.nativeElement.style.transition,\n animation: this.elementRef.nativeElement.style.animation\n };\n requestAnimationFrame(() => {\n this.isMountAnimationPrevented.set(false);\n });\n });\n }\n\n onAnimationEnd() {\n if (!this.rootContext.open()) {\n this.hiddenSignal.set(true);\n }\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectCollapsibleRootContext } from './collapsible-root.directive';\n\n@Directive({\n selector: '[rdxCollapsibleTrigger]',\n host: {\n '[attr.aria-controls]': 'rootContext.contentId()',\n '[attr.aria-expanded]': 'rootContext.open()',\n '[attr.data-state]': 'rootContext.open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"true\" : undefined',\n '[disabled]': 'rootContext.disabled()',\n\n '(click)': 'rootContext.toggle()'\n }\n})\nexport class RdxCollapsibleTriggerDirective {\n protected readonly rootContext = injectCollapsibleRootContext()!;\n}\n","import { NgModule } from '@angular/core';\nimport { RdxCollapsibleContentPresenceDirective } from './src/collapsible-content-presence.directive';\nimport { RdxCollapsibleContentDirective } from './src/collapsible-content.directive';\nimport { RdxCollapsibleRootDirective } from './src/collapsible-root.directive';\nimport { RdxCollapsibleTriggerDirective } from './src/collapsible-trigger.directive';\n\nexport * from './src/collapsible-content-presence.directive';\nexport * from './src/collapsible-content.directive';\nexport * from './src/collapsible-root.directive';\nexport * from './src/collapsible-trigger.directive';\n\nconst _imports = [\n RdxCollapsibleContentDirective,\n RdxCollapsibleRootDirective,\n RdxCollapsibleTriggerDirective,\n RdxCollapsibleContentPresenceDirective\n];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxCollapsibleModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AA0BO,MAAM,CAAC,4BAA4B,EAAE,6BAA6B,CAAC,GACtE,aAAa,CAAyB,wBAAwB;AAElE,MAAM,WAAW,GAAG,MAA6B;AAC7C,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,2BAA2B,CAAC;IAEpD,OAAO;QACH,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,QAAQ,EAAE,QAAQ,CAAC,UAAU;QAC7B,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM,EAAE,MAAK;AACT,YAAA,SAAS,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAChD,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;;KAElD;AACL,CAAC;AAED;;AAEG;MAUU,2BAA2B,CAAA;AATxC,IAAA,WAAA,GAAA;AAUI;;;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AA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,YAV7B,8BAA8B;YAC9B,2BAA2B;YAC3B,8BAA8B;AAC9B,YAAA,sCAAsC,aAHtC,8BAA8B;YAC9B,2BAA2B;YAC3B,8BAA8B;YAC9B,sCAAsC,CAAA,EAAA,CAAA,CAAA;+GAO7B,oBAAoB,EAAA,CAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAJhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;ACrBD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"radix-ng-primitives-collapsible.mjs","sources":["../../../packages/primitives/collapsible/src/collapsible-root.directive.ts","../../../packages/primitives/collapsible/src/collapsible-content-presence.directive.ts","../../../packages/primitives/collapsible/src/collapsible-content.directive.ts","../../../packages/primitives/collapsible/src/collapsible-trigger.directive.ts","../../../packages/primitives/collapsible/index.ts","../../../packages/primitives/collapsible/radix-ng-primitives-collapsible.ts"],"sourcesContent":["import { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n computed,\n Directive,\n inject,\n input,\n InputSignal,\n linkedSignal,\n model,\n ModelSignal,\n output,\n Signal,\n untracked\n} from '@angular/core';\nimport { createContext } from '@radix-ng/primitives/core';\n\nexport type RdxCollapsibleState = 'open' | 'closed';\n\nexport interface CollapsibleRootContext {\n contentId: InputSignal<string>;\n open: ModelSignal<boolean>;\n toggle: () => void;\n disabled: Signal<boolean>;\n}\n\nexport const [injectCollapsibleRootContext, provideCollapsibleRootContext] =\n createContext<CollapsibleRootContext>('CollapsibleRootContext');\n\nconst rootContext = (): CollapsibleRootContext => {\n const instance = inject(RdxCollapsibleRootDirective);\n\n return {\n contentId: instance.contentId,\n disabled: instance.isDisabled,\n open: instance.open,\n toggle: () => {\n untracked(() => {\n instance.open.set(!instance.open());\n });\n instance.onOpenChange.emit(instance.open());\n }\n };\n};\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxCollapsibleRoot]',\n exportAs: 'rdxCollapsibleRoot',\n providers: [provideCollapsibleRootContext(rootContext)],\n host: {\n '[attr.data-state]': 'open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined'\n }\n})\nexport class RdxCollapsibleRootDirective {\n /**\n * The controlled open state of the collapsible.\n * Sets the state of the directive. `true` - expanded, `false` - collapsed\n *\n * @group Props\n * @defaultValue false\n */\n readonly open = model<boolean>(false);\n\n readonly contentId = input<string>('');\n\n /**\n * Determines whether a directive is available for interaction.\n * When true, prevents the user from interacting with the collapsible.\n *\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n readonly _disabled = linkedSignal(this.disabled);\n\n readonly isDisabled = this._disabled.asReadonly();\n\n readonly isOpen = computed(() => this.open());\n\n /**\n * Emitted with new value when directive state changed.\n * Event handler called when the open state of the collapsible changes.\n *\n * @group Emits\n */\n readonly onOpenChange = output<boolean>();\n}\n","import { Directive } from '@angular/core';\nimport { provideRdxPresenceContext, RdxPresenceDirective } from '@radix-ng/primitives/presence';\nimport { injectCollapsibleRootContext } from './collapsible-root.directive';\n\n@Directive({\n selector: 'ng-template[rdxCollapsibleContentPresence]',\n providers: [\n provideRdxPresenceContext(() => ({\n present: injectCollapsibleRootContext()!.open\n }))\n ],\n hostDirectives: [RdxPresenceDirective]\n})\nexport class RdxCollapsibleContentPresenceDirective {}\n","import { isPlatformBrowser } from '@angular/common';\nimport { afterNextRender, computed, Directive, effect, ElementRef, inject, PLATFORM_ID, signal } from '@angular/core';\nimport { injectCollapsibleRootContext } from './collapsible-root.directive';\n\n@Directive({\n selector: '[rdxCollapsibleContent]',\n host: {\n '[id]': 'rootContext.contentId()',\n '[attr.data-state]': 'rootContext.open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"true\" : undefined',\n '[attr.hidden]': 'shouldHide() ? \"until-found\" : undefined',\n '[style.--radix-collapsible-content-width.px]': 'width()',\n '[style.--radix-collapsible-content-height.px]': 'height()',\n '(animationend)': 'onAnimationEnd()'\n }\n})\nexport class RdxCollapsibleContentDirective {\n private readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platformId = inject(PLATFORM_ID);\n\n protected readonly rootContext = injectCollapsibleRootContext()!;\n\n readonly isOpen = computed(() => this.rootContext.open());\n\n readonly height = signal<number | null>(null);\n readonly width = signal<number | null>(null);\n readonly shouldHide = signal(true);\n private isMountAnimationPrevented = signal(true);\n private currentStyle = signal<{ transitionDuration: string; animationName: string } | null>(null);\n\n private firstRender = true;\n\n constructor() {\n effect(() => {\n const isOpen = this.isOpen();\n\n if (!isPlatformBrowser(this.platformId)) {\n return;\n }\n\n requestAnimationFrame(() => {\n this.updateDimensions(isOpen);\n });\n });\n\n afterNextRender(() => {\n requestAnimationFrame(() => {\n this.isMountAnimationPrevented.set(false);\n });\n });\n }\n\n onAnimationEnd() {\n if (!this.isOpen()) {\n this.shouldHide.set(true);\n }\n }\n\n private async updateDimensions(isOpen: boolean) {\n const node = this.elementRef.nativeElement;\n if (!node) return;\n\n if (!this.currentStyle()) {\n this.currentStyle.set({\n transitionDuration: node.style.transitionDuration,\n animationName: node.style.animationName\n });\n }\n\n if (isOpen) {\n this.shouldHide.set(false);\n node.hidden = false;\n }\n\n node.style.transitionDuration = '0s';\n node.style.animationName = 'none';\n\n const rect = node.getBoundingClientRect();\n this.height.set(rect.height);\n this.width.set(rect.width);\n\n if (!this.isMountAnimationPrevented() && !this.firstRender) {\n node.style.transitionDuration = this.currentStyle()?.transitionDuration || '';\n node.style.animationName = this.currentStyle()?.animationName || '';\n }\n\n this.firstRender = false;\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectCollapsibleRootContext } from './collapsible-root.directive';\n\n@Directive({\n selector: '[rdxCollapsibleTrigger]',\n host: {\n '[attr.aria-controls]': 'rootContext.contentId()',\n '[attr.aria-expanded]': 'rootContext.open()',\n '[attr.data-state]': 'rootContext.open() ? \"open\" : \"closed\"',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"true\" : undefined',\n '[attr.disabled]': 'rootContext.disabled() || undefined',\n\n '(click)': 'rootContext.toggle()'\n }\n})\nexport class RdxCollapsibleTriggerDirective {\n protected readonly rootContext = injectCollapsibleRootContext()!;\n}\n","import { NgModule } from '@angular/core';\nimport { RdxCollapsibleContentPresenceDirective } from './src/collapsible-content-presence.directive';\nimport { RdxCollapsibleContentDirective } from './src/collapsible-content.directive';\nimport { RdxCollapsibleRootDirective } from './src/collapsible-root.directive';\nimport { RdxCollapsibleTriggerDirective } from './src/collapsible-trigger.directive';\n\nexport * from './src/collapsible-content-presence.directive';\nexport * from './src/collapsible-content.directive';\nexport * from './src/collapsible-root.directive';\nexport * from './src/collapsible-trigger.directive';\n\nconst _imports = [\n RdxCollapsibleContentDirective,\n RdxCollapsibleRootDirective,\n RdxCollapsibleTriggerDirective,\n RdxCollapsibleContentPresenceDirective\n];\n\n@NgModule({\n imports: [..._imports],\n exports: [..._imports]\n})\nexport class RdxCollapsibleModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AA0BO,MAAM,CAAC,4BAA4B,EAAE,6BAA6B,CAAC,GACtE,aAAa,CAAyB,wBAAwB;AAElE,MAAM,WAAW,GAAG,MAA6B;AAC7C,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,2BAA2B,CAAC;IAEpD,OAAO;QACH,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,QAAQ,EAAE,QAAQ,CAAC,UAAU;QAC7B,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,MAAM,EAAE,MAAK;YACT,SAAS,CAAC,MAAK;gBACX,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,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,EAAE,yBAAyB;AACnC,oBAAA,IAAI,EAAE;AACF,wBAAA,sBAAsB,EAAE,yBAAyB;AACjD,wBAAA,sBAAsB,EAAE,oBAAoB;AAC5C,wBAAA,mBAAmB,EAAE,wCAAwC;AAC7D,wBAAA,sBAAsB,EAAE,6CAA6C;AACrE,wBAAA,iBAAiB,EAAE,qCAAqC;AAExD,wBAAA,SAAS,EAAE;AACd;AACJ,iBAAA;;;ACHD,MAAM,QAAQ,GAAG;IACb,8BAA8B;IAC9B,2BAA2B;IAC3B,8BAA8B;IAC9B;CACH;MAMY,oBAAoB,CAAA;8GAApB,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAApB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,YAV7B,8BAA8B;YAC9B,2BAA2B;YAC3B,8BAA8B;AAC9B,YAAA,sCAAsC,aAHtC,8BAA8B;YAC9B,2BAA2B;YAC3B,8BAA8B;YAC9B,sCAAsC,CAAA,EAAA,CAAA,CAAA;+GAO7B,oBAAoB,EAAA,CAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAJhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;AACtB,oBAAA,OAAO,EAAE,CAAC,GAAG,QAAQ;AACxB,iBAAA;;;ACrBD;;AAEG;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-switch.mjs","sources":["../../../packages/primitives/switch/src/switch-root.directive.ts","../../../packages/primitives/switch/src/switch-input.directive.ts","../../../packages/primitives/switch/src/switch-thumb.directive.ts","../../../packages/primitives/switch/index.ts","../../../packages/primitives/switch/radix-ng-primitives-switch.ts"],"sourcesContent":["import { _IdGenerator } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n Directive,\n inject,\n input,\n InputSignal,\n InputSignalWithTransform,\n model,\n Signal\n} from '@angular/core';\nimport { outputFromObservable, outputToObservable } from '@angular/core/rxjs-interop';\nimport { createContext, injectControlValueAccessor, RdxControlValueAccessor } from '@radix-ng/primitives/core';\n\nexport interface SwitchContext {\n required: InputSignalWithTransform<boolean, BooleanInput>;\n checked: Signal<boolean | undefined>;\n disabled: Signal<boolean | undefined>;\n ariaLabel: InputSignal<string | undefined>;\n ariaLabelledBy: InputSignal<string | undefined>;\n markAsTouched: () => void;\n toggle: () => void;\n}\n\nexport const [injectSwitchRootContext, provideSwitchRootContext] = createContext<SwitchContext>('Switch');\n\nconst rootContext = () => {\n const instance = inject(RdxSwitchRootDirective);\n const cva = injectControlValueAccessor<boolean | undefined>();\n\n return {\n required: instance.required,\n value: instance.checked,\n checked: cva.value,\n disabled: cva.disabled,\n ariaLabel: instance.ariaLabel,\n ariaLabelledBy: instance.ariaLabelledBy,\n markAsTouched: () => cva.markAsTouched(),\n toggle: () => instance.toggle()\n };\n};\n\n@Directive({\n selector: 'button[rdxSwitchRoot]',\n exportAs: 'rdxSwitchRoot',\n providers: [provideSwitchRootContext(rootContext)],\n hostDirectives: [{ directive: RdxControlValueAccessor, inputs: ['value: checked', 'disabled'] }],\n host: {\n role: 'switch',\n type: 'button',\n '[id]': 'id()',\n '[attr.aria-checked]': 'cva.value()',\n '[attr.aria-required]': 'required()',\n '[attr.data-state]': 'cva.value() ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'cva.disabled() ? \"true\" : undefined',\n '[attr.disabled]': 'cva.disabled() ? cva.disabled() : undefined',\n '[value]': 'cva.value()',\n\n '(click)': 'toggle()',\n '(keydown.enter)': '$event.preventDefault()'\n }\n})\nexport class RdxSwitchRootDirective {\n protected readonly cva = injectControlValueAccessor<boolean | undefined>();\n\n readonly id = input<string>(inject(_IdGenerator).getId('rdx-switch-'));\n\n /**\n * When true, indicates that the user must check the switch before the owning form can be submitted.\n *\n * @default false\n * @group Props\n */\n readonly required = input<boolean, BooleanInput>(false, {\n transform: booleanAttribute\n });\n\n /**\n * Establishes relationships between the component and label(s) where its value should be one or more element IDs.\n * @default null\n * @group Props\n */\n readonly ariaLabelledBy = input<string | undefined>(undefined, {\n alias: 'aria-labelledby'\n });\n\n /**\n * Used to define a string that autocomplete attribute the current element.\n * @default null\n * @group Props\n */\n readonly ariaLabel = input<string | undefined>(undefined, {\n alias: 'aria-label'\n });\n\n /**\n * The state of the switch when it is initially rendered. Use when you do not need to control its state.\n * @default false\n * @group Props\n */\n readonly defaultChecked = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * The controlled state of the switch. Must be used in conjunction with onCheckedChange.\n * @defaultValue false\n * @group Props\n */\n readonly checked = model<boolean>(this.defaultChecked());\n\n /**\n * When `true`, prevents the user from interacting with the switch.\n * @default false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n transform: booleanAttribute\n });\n\n /**\n * Event handler called when the state of the switch changes.\n *\n * @param {boolean} value - Boolean value indicates that the option is changed.\n * @group Emits\n */\n readonly onCheckedChange = outputFromObservable(outputToObservable(this.cva.valueChange));\n\n /**\n * Toggles the checked state of the switch.\n * If the switch is disabled, the function returns early.\n * @ignore\n */\n toggle(): void {\n const checked = this.cva.value();\n\n this.cva.setValue(!checked);\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectSwitchRootContext } from './switch-root.directive';\n\n/**\n * @group Components\n */\n@Directive({\n selector: 'input[rdxSwitchInput]',\n exportAs: 'rdxSwitchInput',\n host: {\n type: 'checkbox',\n tabindex: '-1',\n '[attr.defaultChecked]': 'rootContext.checked()',\n '[attr.aria-checked]': 'rootContext.checked()',\n '[attr.aria-hidden]': 'true',\n '[attr.aria-label]': 'rootContext.ariaLabel()',\n '[attr.aria-labelledby]': 'rootContext.ariaLabelledBy()',\n '[attr.aria-required]': 'rootContext.required()',\n '[attr.data-state]': 'rootContext.checked() ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"true\" : null',\n '[attr.disabled]': 'rootContext.disabled() ? rootContext.disabled() : undefined',\n '[attr.value]': 'rootContext.checked() ? \"on\" : \"off\"',\n style: 'transform: translateX(-100%); position: absolute; overflow: hidden; pointerEvents: none; opacity: 0; margin: 0;',\n\n '(blur)': 'onBlur()'\n }\n})\nexport class RdxSwitchInputDirective {\n protected readonly rootContext = injectSwitchRootContext()!;\n\n /** @ignore */\n protected onBlur() {\n this.rootContext?.markAsTouched();\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectSwitchRootContext } from './switch-root.directive';\n\n/**\n * @group Components\n */\n@Directive({\n selector: 'span[rdxSwitchThumb]',\n exportAs: 'rdxSwitchThumb',\n host: {\n '[attr.data-disabled]': 'rootContext?.disabled() ? \"\" : undefined',\n '[attr.data-state]': 'rootContext?.checked() ? \"checked\" : \"unchecked\"'\n }\n})\nexport class RdxSwitchThumbDirective {\n protected readonly rootContext = injectSwitchRootContext();\n}\n","import { NgModule } from '@angular/core';\nimport { RdxSwitchInputDirective } from './src/switch-input.directive';\nimport { RdxSwitchRootDirective } from './src/switch-root.directive';\nimport { RdxSwitchThumbDirective } from './src/switch-thumb.directive';\n\nexport * from './src/switch-input.directive';\nexport * from './src/switch-root.directive';\nexport * from './src/switch-thumb.directive';\n\nconst switchImports = [RdxSwitchRootDirective, RdxSwitchInputDirective, RdxSwitchThumbDirective];\n\n@NgModule({\n imports: [...switchImports],\n exports: [...switchImports]\n})\nexport class RdxSwitchModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAyBO,MAAM,CAAC,uBAAuB,EAAE,wBAAwB,CAAC,GAAG,aAAa,CAAgB,QAAQ;AAExG,MAAM,WAAW,GAAG,M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CAAA;;2FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBARnC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,IAAI,EAAE;AACF,wBAAA,sBAAsB,EAAE,0CAA0C;AAClE,wBAAA,mBAAmB,EAAE;AACxB;AACJ,iBAAA;;;ACJD,MAAM,aAAa,GAAG,CAAC,sBAAsB,EAAE,uBAAuB,EAAE,uBAAuB,CAAC;MAMnF,eAAe,CAAA;8GAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAf,eAAe,EAAA,OAAA,EAAA,CANL,sBAAsB,EAAE,uBAAuB,EAAE,uBAAuB,CAAA,EAAA,OAAA,EAAA,CAAxE,sBAAsB,EAAE,uBAAuB,EAAE,uBAAuB,CAAA,EAAA,CAAA,CAAA;+GAMlF,eAAe,EAAA,CAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,aAAa,CAAC;AAC3B,oBAAA,OAAO,EAAE,CAAC,GAAG,aAAa;AAC7B,iBAAA;;;ACdD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"radix-ng-primitives-switch.mjs","sources":["../../../packages/primitives/switch/src/switch-root.directive.ts","../../../packages/primitives/switch/src/switch-input.directive.ts","../../../packages/primitives/switch/src/switch-thumb.directive.ts","../../../packages/primitives/switch/index.ts","../../../packages/primitives/switch/radix-ng-primitives-switch.ts"],"sourcesContent":["import { _IdGenerator } from '@angular/cdk/a11y';\nimport { BooleanInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n Directive,\n inject,\n input,\n InputSignal,\n InputSignalWithTransform,\n model,\n Signal\n} from '@angular/core';\nimport { outputFromObservable, outputToObservable } from '@angular/core/rxjs-interop';\nimport { createContext, injectControlValueAccessor, RdxControlValueAccessor } from '@radix-ng/primitives/core';\n\nexport interface SwitchContext {\n required: InputSignalWithTransform<boolean, BooleanInput>;\n checked: Signal<boolean | undefined>;\n disabled: Signal<boolean | undefined>;\n ariaLabel: InputSignal<string | undefined>;\n ariaLabelledBy: InputSignal<string | undefined>;\n markAsTouched: () => void;\n toggle: () => void;\n}\n\nexport const [injectSwitchRootContext, provideSwitchRootContext] = createContext<SwitchContext>('Switch');\n\nconst rootContext = () => {\n const instance = inject(RdxSwitchRootDirective);\n const cva = injectControlValueAccessor<boolean | undefined>();\n\n return {\n required: instance.required,\n value: instance.checked,\n checked: cva.value,\n disabled: cva.disabled,\n ariaLabel: instance.ariaLabel,\n ariaLabelledBy: instance.ariaLabelledBy,\n markAsTouched: () => cva.markAsTouched(),\n toggle: () => instance.toggle()\n };\n};\n\n/**\n * @group Components\n */\n@Directive({\n selector: 'button[rdxSwitchRoot]',\n exportAs: 'rdxSwitchRoot',\n providers: [provideSwitchRootContext(rootContext)],\n hostDirectives: [{ directive: RdxControlValueAccessor, inputs: ['value: checked', 'disabled'] }],\n host: {\n role: 'switch',\n type: 'button',\n '[id]': 'id()',\n '[attr.aria-checked]': 'cva.value()',\n '[attr.aria-required]': 'required()',\n '[attr.data-state]': 'cva.value() ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'cva.disabled() ? \"true\" : undefined',\n '[attr.disabled]': 'cva.disabled() ? cva.disabled() : undefined',\n '[value]': 'cva.value()',\n\n '(click)': 'toggle()',\n '(keydown.enter)': '$event.preventDefault()'\n }\n})\nexport class RdxSwitchRootDirective {\n protected readonly cva = injectControlValueAccessor<boolean | undefined>();\n\n readonly id = input<string>(inject(_IdGenerator).getId('rdx-switch-'));\n\n /**\n * When true, indicates that the user must check the switch before the owning form can be submitted.\n *\n * @default false\n * @group Props\n */\n readonly required = input<boolean, BooleanInput>(false, {\n transform: booleanAttribute\n });\n\n /**\n * Establishes relationships between the component and label(s) where its value should be one or more element IDs.\n * @default null\n * @group Props\n */\n readonly ariaLabelledBy = input<string | undefined>(undefined, {\n alias: 'aria-labelledby'\n });\n\n /**\n * Used to define a string that autocomplete attribute the current element.\n * @default null\n * @group Props\n */\n readonly ariaLabel = input<string | undefined>(undefined, {\n alias: 'aria-label'\n });\n\n /**\n * The state of the switch when it is initially rendered. Use when you do not need to control its state.\n * @default false\n * @group Props\n */\n readonly defaultChecked = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n\n /**\n * The controlled state of the switch. Must be used in conjunction with onCheckedChange.\n * @defaultValue false\n * @group Props\n */\n readonly checked = model<boolean>(this.defaultChecked());\n\n /**\n * When `true`, prevents the user from interacting with the switch.\n * @default false\n * @group Props\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n transform: booleanAttribute\n });\n\n /**\n * Event handler called when the state of the switch changes.\n *\n * @param {boolean} value - Boolean value indicates that the option is changed.\n * @group Emits\n */\n readonly onCheckedChange = outputFromObservable(outputToObservable(this.cva.valueChange));\n\n /**\n * Toggles the checked state of the switch.\n * If the switch is disabled, the function returns early.\n * @ignore\n */\n toggle(): void {\n const checked = this.cva.value();\n\n this.cva.setValue(!checked);\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectSwitchRootContext } from './switch-root.directive';\n\n/**\n * @group Components\n */\n@Directive({\n selector: 'input[rdxSwitchInput]',\n exportAs: 'rdxSwitchInput',\n host: {\n type: 'checkbox',\n tabindex: '-1',\n '[attr.defaultChecked]': 'rootContext.checked()',\n '[attr.aria-checked]': 'rootContext.checked()',\n '[attr.aria-hidden]': 'true',\n '[attr.aria-label]': 'rootContext.ariaLabel()',\n '[attr.aria-labelledby]': 'rootContext.ariaLabelledBy()',\n '[attr.aria-required]': 'rootContext.required()',\n '[attr.data-state]': 'rootContext.checked() ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'rootContext.disabled() ? \"true\" : null',\n '[attr.disabled]': 'rootContext.disabled() ? rootContext.disabled() : undefined',\n '[attr.value]': 'rootContext.checked() ? \"on\" : \"off\"',\n style: 'transform: translateX(-100%); position: absolute; overflow: hidden; pointerEvents: none; opacity: 0; margin: 0;',\n\n '(blur)': 'onBlur()'\n }\n})\nexport class RdxSwitchInputDirective {\n protected readonly rootContext = injectSwitchRootContext()!;\n\n /** @ignore */\n protected onBlur() {\n this.rootContext?.markAsTouched();\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectSwitchRootContext } from './switch-root.directive';\n\n/**\n * @group Components\n */\n@Directive({\n selector: 'span[rdxSwitchThumb]',\n exportAs: 'rdxSwitchThumb',\n host: {\n '[attr.data-disabled]': 'rootContext?.disabled() ? \"\" : undefined',\n '[attr.data-state]': 'rootContext?.checked() ? \"checked\" : \"unchecked\"'\n }\n})\nexport class RdxSwitchThumbDirective {\n protected readonly rootContext = injectSwitchRootContext();\n}\n","import { NgModule } from '@angular/core';\nimport { RdxSwitchInputDirective } from './src/switch-input.directive';\nimport { RdxSwitchRootDirective } from './src/switch-root.directive';\nimport { RdxSwitchThumbDirective } from './src/switch-thumb.directive';\n\nexport * from './src/switch-input.directive';\nexport * from './src/switch-root.directive';\nexport * from './src/switch-thumb.directive';\n\nconst switchImports = [RdxSwitchRootDirective, RdxSwitchInputDirective, RdxSwitchThumbDirective];\n\n@NgModule({\n imports: [...switchImports],\n exports: [...switchImports]\n})\nexport class RdxSwitchModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAyBO,MAAM,CAAC,uBAAuB,EAAE,wBAAwB,CAAC,GAAG,aAAa,CAAgB,QAAQ;AAExG,MAAM,WAAW,GAAG,MAAK;AACrB,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,sBAAsB,CAAC;AAC/C,IAAA,MAAM,GAAG,GAAG,0BAA0B,EAAuB;IAE7D,OAAO;QACH,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,KAA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AAC1B,oBAAA,IAAI,EAAE;AACF,wBAAA,sBAAsB,EAAE,0CAA0C;AAClE,wBAAA,mBAAmB,EAAE;AACxB;AACJ,iBAAA;;;ACJD,MAAM,aAAa,GAAG,CAAC,sBAAsB,EAAE,uBAAuB,EAAE,uBAAuB,CAAC;MAMnF,eAAe,CAAA;8GAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAf,eAAe,EAAA,OAAA,EAAA,CANL,sBAAsB,EAAE,uBAAuB,EAAE,uBAAuB,CAAA,EAAA,OAAA,EAAA,CAAxE,sBAAsB,EAAE,uBAAuB,EAAE,uBAAuB,CAAA,EAAA,CAAA,CAAA;+GAMlF,eAAe,EAAA,CAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,GAAG,aAAa,CAAC;AAC3B,oBAAA,OAAO,EAAE,CAAC,GAAG,aAAa;AAC7B,iBAAA;;;ACdD;;AAEG;;;;"}
|
@@ -79,7 +79,7 @@ export declare class RdxHoverCardRootDirective {
|
|
79
79
|
window: Window & typeof globalThis;
|
80
80
|
primitiveConfigs?: import("./utils/types").PrimitiveConfigs;
|
81
81
|
onDestroyCallbacks: Set<() => void>;
|
82
|
-
"__#
|
82
|
+
"__#13533@#clickDomRootEventCallbacks": Set<(event: MouseEvent) => void>;
|
83
83
|
registerPrimitive<T extends object>(primitiveInstance: T): void;
|
84
84
|
deregisterPrimitive<T extends object>(primitiveInstance: T): void;
|
85
85
|
preventPrimitiveFromCdkEvent<T extends object>(primitiveInstance: T, eventType: import("./utils/types").EventType): void;
|
@@ -90,9 +90,9 @@ export declare class RdxHoverCardRootDirective {
|
|
90
90
|
primitivePreventedFromCdkEvent<T extends object>(primitiveInstance: T, eventType: import("./utils/types").EventType): boolean | undefined;
|
91
91
|
addClickDomRootEventCallback(callback: (event: MouseEvent) => void): void;
|
92
92
|
removeClickDomRootEventCallback(callback: (event: MouseEvent) => void): boolean;
|
93
|
-
"__#
|
94
|
-
"__#
|
95
|
-
"__#
|
93
|
+
"__#13533@#setPreventPrimitiveFromCdkEvent"<T extends object, R extends import("./utils/types").EventType, K extends import("./utils/types").PrimitiveConfig[`prevent${Capitalize<R>}`]>(primitiveInstance: T, eventType: R, value: K): void;
|
94
|
+
"__#13533@#registerOnDestroyCallbacks"(): void;
|
95
|
+
"__#13533@#listenToClickDomRootEvent"(): void;
|
96
96
|
} | null;
|
97
97
|
/** @ignore */
|
98
98
|
readonly destroyRef: DestroyRef;
|
package/package.json
CHANGED
@@ -70,7 +70,7 @@ export declare class RdxPopoverRootDirective {
|
|
70
70
|
window: Window & typeof globalThis;
|
71
71
|
primitiveConfigs?: import("./utils/types").PrimitiveConfigs;
|
72
72
|
onDestroyCallbacks: Set<() => void>;
|
73
|
-
"__#
|
73
|
+
"__#17912@#clickDomRootEventCallbacks": Set<(event: MouseEvent) => void>;
|
74
74
|
registerPrimitive<T extends object>(primitiveInstance: T): void;
|
75
75
|
deregisterPrimitive<T extends object>(primitiveInstance: T): void;
|
76
76
|
preventPrimitiveFromCdkEvent<T extends object>(primitiveInstance: T, eventType: import("./utils/types").EventType): void;
|
@@ -81,9 +81,9 @@ export declare class RdxPopoverRootDirective {
|
|
81
81
|
primitivePreventedFromCdkEvent<T extends object>(primitiveInstance: T, eventType: import("./utils/types").EventType): boolean | undefined;
|
82
82
|
addClickDomRootEventCallback(callback: (event: MouseEvent) => void): void;
|
83
83
|
removeClickDomRootEventCallback(callback: (event: MouseEvent) => void): boolean;
|
84
|
-
"__#
|
85
|
-
"__#
|
86
|
-
"__#
|
84
|
+
"__#17912@#setPreventPrimitiveFromCdkEvent"<T extends object, R extends import("./utils/types").EventType, K extends import("./utils/types").PrimitiveConfig[`prevent${Capitalize<R>}`]>(primitiveInstance: T, eventType: R, value: K): void;
|
85
|
+
"__#17912@#registerOnDestroyCallbacks"(): void;
|
86
|
+
"__#17912@#listenToClickDomRootEvent"(): void;
|
87
87
|
} | null;
|
88
88
|
/** @ignore */
|
89
89
|
readonly destroyRef: DestroyRef;
|
@@ -13,6 +13,9 @@ export interface SwitchContext {
|
|
13
13
|
toggle: () => void;
|
14
14
|
}
|
15
15
|
export declare const injectSwitchRootContext: (optional?: boolean) => SwitchContext | null, provideSwitchRootContext: (useFactory: () => SwitchContext) => import("@angular/core").Provider;
|
16
|
+
/**
|
17
|
+
* @group Components
|
18
|
+
*/
|
16
19
|
export declare class RdxSwitchRootDirective {
|
17
20
|
protected readonly cva: RdxControlValueAccessor<boolean | undefined>;
|
18
21
|
readonly id: InputSignal<string>;
|
@@ -79,7 +79,7 @@ export declare class RdxTooltipRootDirective {
|
|
79
79
|
window: Window & typeof globalThis;
|
80
80
|
primitiveConfigs?: import("./utils/types").PrimitiveConfigs;
|
81
81
|
onDestroyCallbacks: Set<() => void>;
|
82
|
-
"__#
|
82
|
+
"__#21759@#clickDomRootEventCallbacks": Set<(event: MouseEvent) => void>;
|
83
83
|
registerPrimitive<T extends object>(primitiveInstance: T): void;
|
84
84
|
deregisterPrimitive<T extends object>(primitiveInstance: T): void;
|
85
85
|
preventPrimitiveFromCdkEvent<T extends object>(primitiveInstance: T, eventType: import("./utils/types").EventType): void;
|
@@ -90,9 +90,9 @@ export declare class RdxTooltipRootDirective {
|
|
90
90
|
primitivePreventedFromCdkEvent<T extends object>(primitiveInstance: T, eventType: import("./utils/types").EventType): boolean | undefined;
|
91
91
|
addClickDomRootEventCallback(callback: (event: MouseEvent) => void): void;
|
92
92
|
removeClickDomRootEventCallback(callback: (event: MouseEvent) => void): boolean;
|
93
|
-
"__#
|
94
|
-
"__#
|
95
|
-
"__#
|
93
|
+
"__#21759@#setPreventPrimitiveFromCdkEvent"<T extends object, R extends import("./utils/types").EventType, K extends import("./utils/types").PrimitiveConfig[`prevent${Capitalize<R>}`]>(primitiveInstance: T, eventType: R, value: K): void;
|
94
|
+
"__#21759@#registerOnDestroyCallbacks"(): void;
|
95
|
+
"__#21759@#listenToClickDomRootEvent"(): void;
|
96
96
|
} | null;
|
97
97
|
/** @ignore */
|
98
98
|
readonly destroyRef: DestroyRef;
|