@radix-ng/primitives 0.37.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/index.d.ts +3 -1
- package/accordion/src/accordion-content-presence.directive.d.ts +6 -0
- package/accordion/src/accordion-content.directive.d.ts +7 -8
- package/accordion/src/accordion-header.directive.d.ts +2 -2
- package/accordion/src/accordion-item.directive.d.ts +29 -77
- package/accordion/src/accordion-root.directive.d.ts +49 -78
- package/accordion/src/accordion-trigger.directive.d.ts +6 -11
- package/collapsible/index.d.ts +11 -0
- package/collapsible/src/collapsible-content-presence.directive.d.ts +6 -0
- package/collapsible/src/collapsible-content.directive.d.ts +13 -9
- package/collapsible/src/collapsible-root.directive.d.ts +19 -37
- package/collapsible/src/collapsible-trigger.directive.d.ts +1 -21
- package/core/index.d.ts +5 -0
- package/core/src/accessor/control-value-accessor.d.ts +67 -0
- package/core/src/create-context.d.ts +10 -0
- package/core/src/date-time/comparators.d.ts +7 -1
- package/core/src/date-time/useDateField.d.ts +2 -2
- package/core/src/types.d.ts +24 -0
- package/{stepper/src/utils → core/src}/useArrowNavigation.d.ts +2 -2
- package/core/src/useResizeObserver.d.ts +15 -0
- package/fesm2022/radix-ng-primitives-accordion.mjs +231 -398
- package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-avatar.mjs +2 -10
- package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-calendar.mjs +3 -14
- package/fesm2022/radix-ng-primitives-calendar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-collapsible.mjs +151 -143
- package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-core.mjs +248 -7
- package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-hover-card.mjs +1 -3
- package/fesm2022/radix-ng-primitives-hover-card.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menubar.mjs +1 -8
- package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-pagination.mjs +2 -6
- package/fesm2022/radix-ng-primitives-pagination.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-popover.mjs +2 -6
- package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-presence.mjs +34 -1
- package/fesm2022/radix-ng-primitives-presence.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-progress.mjs +2 -7
- package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-radio.mjs +1 -3
- package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-select.mjs +75 -33
- package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-stepper.mjs +1 -84
- package/fesm2022/radix-ng-primitives-stepper.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-switch.mjs +61 -97
- package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tabs.mjs +4 -19
- package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-time-field.mjs +351 -0
- package/fesm2022/radix-ng-primitives-time-field.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle.mjs +1 -6
- package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tooltip.mjs +1 -3
- package/fesm2022/radix-ng-primitives-tooltip.mjs.map +1 -1
- package/hover-card/src/hover-card-root.directive.d.ts +4 -4
- package/package.json +5 -1
- package/popover/src/popover-root.directive.d.ts +4 -4
- package/presence/index.d.ts +1 -0
- package/presence/src/presence.directive.d.ts +27 -0
- package/select/src/select-trigger.directive.d.ts +8 -2
- package/select/src/select.component.d.ts +23 -6
- package/switch/index.d.ts +0 -1
- package/switch/src/switch-input.directive.d.ts +1 -1
- package/switch/src/switch-root.directive.d.ts +23 -43
- package/switch/src/switch-thumb.directive.d.ts +1 -1
- package/time-field/README.md +1 -0
- package/time-field/index.d.ts +11 -0
- package/time-field/src/time-field-context.token.d.ts +19 -0
- package/time-field/src/time-field-input.directive.d.ts +53 -0
- package/time-field/src/time-field-root.directive.d.ts +125 -0
- package/tooltip/src/tooltip-root.directive.d.ts +4 -4
- package/collapsible/src/collapsible-content.token.d.ts +0 -3
@@ -1,22 +1,39 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import {
|
3
|
-
import
|
2
|
+
import { inject, untracked, model, input, booleanAttribute, linkedSignal, computed, output, Directive, ElementRef, PLATFORM_ID, signal, effect, afterNextRender, NgModule } from '@angular/core';
|
3
|
+
import * as i1 from '@radix-ng/primitives/presence';
|
4
|
+
import { provideRdxPresenceContext, RdxPresenceDirective } from '@radix-ng/primitives/presence';
|
5
|
+
import { createContext } from '@radix-ng/primitives/core';
|
6
|
+
import { isPlatformBrowser } from '@angular/common';
|
4
7
|
|
5
|
-
const
|
6
|
-
|
7
|
-
const
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
const [injectCollapsibleRootContext, provideCollapsibleRootContext] = createContext('CollapsibleRootContext');
|
9
|
+
const rootContext = () => {
|
10
|
+
const instance = inject(RdxCollapsibleRootDirective);
|
11
|
+
return {
|
12
|
+
contentId: instance.contentId,
|
13
|
+
disabled: instance.isDisabled,
|
14
|
+
open: instance.open,
|
15
|
+
toggle: () => {
|
16
|
+
untracked(() => {
|
17
|
+
instance.open.set(!instance.open());
|
18
|
+
});
|
19
|
+
instance.onOpenChange.emit(instance.open());
|
20
|
+
}
|
21
|
+
};
|
22
|
+
};
|
11
23
|
/**
|
12
24
|
* @group Components
|
13
25
|
*/
|
14
26
|
class RdxCollapsibleRootDirective {
|
15
27
|
constructor() {
|
16
28
|
/**
|
17
|
-
*
|
29
|
+
* The controlled open state of the collapsible.
|
30
|
+
* Sets the state of the directive. `true` - expanded, `false` - collapsed
|
31
|
+
*
|
32
|
+
* @group Props
|
33
|
+
* @defaultValue false
|
18
34
|
*/
|
19
|
-
this.
|
35
|
+
this.open = model(false);
|
36
|
+
this.contentId = input('');
|
20
37
|
/**
|
21
38
|
* Determines whether a directive is available for interaction.
|
22
39
|
* When true, prevents the user from interacting with the collapsible.
|
@@ -24,10 +41,9 @@ class RdxCollapsibleRootDirective {
|
|
24
41
|
* @group Props
|
25
42
|
*/
|
26
43
|
this.disabled = input(false, { transform: booleanAttribute });
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
this._open = false;
|
44
|
+
this._disabled = linkedSignal(this.disabled);
|
45
|
+
this.isDisabled = this._disabled.asReadonly();
|
46
|
+
this.isOpen = computed(() => this.open());
|
31
47
|
/**
|
32
48
|
* Emitted with new value when directive state changed.
|
33
49
|
* Event handler called when the open state of the collapsible changes.
|
@@ -36,177 +52,169 @@ class RdxCollapsibleRootDirective {
|
|
36
52
|
*/
|
37
53
|
this.onOpenChange = output();
|
38
54
|
}
|
39
|
-
/**
|
40
|
-
* The controlled open state of the collapsible.
|
41
|
-
* Sets the state of the directive. `true` - expanded, `false` - collapsed
|
42
|
-
*
|
43
|
-
* @group Props
|
44
|
-
* @defaultValue false
|
45
|
-
*/
|
46
|
-
set open(value) {
|
47
|
-
if (value !== this._open) {
|
48
|
-
this.onOpenChange.emit(value);
|
49
|
-
}
|
50
|
-
this._open = value;
|
51
|
-
this.setPresence();
|
52
|
-
}
|
53
|
-
get open() {
|
54
|
-
return this._open;
|
55
|
-
}
|
56
|
-
/**
|
57
|
-
* Allows to change directive state
|
58
|
-
* @param {boolean | undefined} value
|
59
|
-
* @ignore
|
60
|
-
*/
|
61
|
-
setOpen(value) {
|
62
|
-
if (this.disabled()) {
|
63
|
-
return;
|
64
|
-
}
|
65
|
-
if (value === undefined) {
|
66
|
-
this.open = !this.open;
|
67
|
-
}
|
68
|
-
else {
|
69
|
-
this.open = value;
|
70
|
-
}
|
71
|
-
this.setPresence();
|
72
|
-
}
|
73
|
-
/**
|
74
|
-
* Returns directive state (open | closed)
|
75
|
-
* @ignore
|
76
|
-
*/
|
77
|
-
getState() {
|
78
|
-
return this.open ? 'open' : 'closed';
|
79
|
-
}
|
80
|
-
/**
|
81
|
-
* Returns current directive state
|
82
|
-
* @ignore
|
83
|
-
*/
|
84
|
-
isOpen() {
|
85
|
-
return this.open;
|
86
|
-
}
|
87
|
-
/**
|
88
|
-
* Controls visibility of content
|
89
|
-
*/
|
90
|
-
setPresence() {
|
91
|
-
if (!this.contentDirective) {
|
92
|
-
return;
|
93
|
-
}
|
94
|
-
if (this.isOpen()) {
|
95
|
-
this.contentDirective().elementRef.nativeElement.removeAttribute('hidden');
|
96
|
-
}
|
97
|
-
else {
|
98
|
-
asyncScheduler.schedule(() => {
|
99
|
-
const animations = this.contentDirective().elementRef.nativeElement.getAnimations();
|
100
|
-
if (animations === undefined || animations.length === 0) {
|
101
|
-
this.contentDirective().elementRef.nativeElement.setAttribute('hidden', '');
|
102
|
-
}
|
103
|
-
});
|
104
|
-
}
|
105
|
-
}
|
106
55
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxCollapsibleRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
107
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.
|
56
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: RdxCollapsibleRootDirective, isStandalone: true, selector: "[rdxCollapsibleRoot]", inputs: { open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, contentId: { classPropertyName: "contentId", publicName: "contentId", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", onOpenChange: "onOpenChange" }, host: { properties: { "attr.data-state": "open() ? \"open\" : \"closed\"", "attr.data-disabled": "disabled() ? \"\" : undefined" } }, providers: [provideCollapsibleRootContext(rootContext)], exportAs: ["rdxCollapsibleRoot"], ngImport: i0 }); }
|
108
57
|
}
|
109
58
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxCollapsibleRootDirective, decorators: [{
|
110
59
|
type: Directive,
|
111
60
|
args: [{
|
112
61
|
selector: '[rdxCollapsibleRoot]',
|
113
|
-
exportAs: '
|
114
|
-
providers: [
|
62
|
+
exportAs: 'rdxCollapsibleRoot',
|
63
|
+
providers: [provideCollapsibleRootContext(rootContext)],
|
115
64
|
host: {
|
116
|
-
'[attr.data-state]': '
|
65
|
+
'[attr.data-state]': 'open() ? "open" : "closed"',
|
117
66
|
'[attr.data-disabled]': 'disabled() ? "" : undefined'
|
118
67
|
}
|
119
68
|
}]
|
120
|
-
}]
|
121
|
-
|
122
|
-
|
69
|
+
}] });
|
70
|
+
|
71
|
+
class RdxCollapsibleContentPresenceDirective {
|
72
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxCollapsibleContentPresenceDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
73
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.4", type: RdxCollapsibleContentPresenceDirective, isStandalone: true, selector: "ng-template[rdxCollapsibleContentPresence]", providers: [
|
74
|
+
provideRdxPresenceContext(() => ({
|
75
|
+
present: injectCollapsibleRootContext().open
|
76
|
+
}))
|
77
|
+
], hostDirectives: [{ directive: i1.RdxPresenceDirective }], ngImport: i0 }); }
|
78
|
+
}
|
79
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxCollapsibleContentPresenceDirective, decorators: [{
|
80
|
+
type: Directive,
|
81
|
+
args: [{
|
82
|
+
selector: 'ng-template[rdxCollapsibleContentPresence]',
|
83
|
+
providers: [
|
84
|
+
provideRdxPresenceContext(() => ({
|
85
|
+
present: injectCollapsibleRootContext().open
|
86
|
+
}))
|
87
|
+
],
|
88
|
+
hostDirectives: [RdxPresenceDirective]
|
89
|
+
}]
|
90
|
+
}] });
|
123
91
|
|
124
92
|
class RdxCollapsibleContentDirective {
|
125
93
|
constructor() {
|
126
|
-
this.collapsible = inject(RdxCollapsibleRootDirective);
|
127
|
-
/**
|
128
|
-
* Reference to CollapsibleContent host element
|
129
|
-
* @ignore
|
130
|
-
*/
|
131
94
|
this.elementRef = inject(ElementRef);
|
95
|
+
this.platformId = inject(PLATFORM_ID);
|
96
|
+
this.rootContext = injectCollapsibleRootContext();
|
97
|
+
this.isOpen = computed(() => this.rootContext.open());
|
98
|
+
this.height = signal(null);
|
99
|
+
this.width = signal(null);
|
100
|
+
this.shouldHide = signal(true);
|
101
|
+
this.isMountAnimationPrevented = signal(true);
|
102
|
+
this.currentStyle = signal(null);
|
103
|
+
this.firstRender = true;
|
104
|
+
effect(() => {
|
105
|
+
const isOpen = this.isOpen();
|
106
|
+
if (!isPlatformBrowser(this.platformId)) {
|
107
|
+
return;
|
108
|
+
}
|
109
|
+
requestAnimationFrame(() => {
|
110
|
+
this.updateDimensions(isOpen);
|
111
|
+
});
|
112
|
+
});
|
113
|
+
afterNextRender(() => {
|
114
|
+
requestAnimationFrame(() => {
|
115
|
+
this.isMountAnimationPrevented.set(false);
|
116
|
+
});
|
117
|
+
});
|
132
118
|
}
|
133
|
-
|
134
|
-
|
119
|
+
onAnimationEnd() {
|
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 || '';
|
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: { properties: { "attr.data-state": "
|
138
|
-
{
|
139
|
-
provide: RdxCollapsibleContentToken,
|
140
|
-
useExisting: RdxCollapsibleContentDirective
|
141
|
-
}
|
142
|
-
], ngImport: i0 }); }
|
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 }); }
|
143
151
|
}
|
144
152
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxCollapsibleContentDirective, decorators: [{
|
145
153
|
type: Directive,
|
146
154
|
args: [{
|
147
155
|
selector: '[rdxCollapsibleContent]',
|
148
|
-
providers: [
|
149
|
-
{
|
150
|
-
provide: RdxCollapsibleContentToken,
|
151
|
-
useExisting: RdxCollapsibleContentDirective
|
152
|
-
}
|
153
|
-
],
|
154
156
|
host: {
|
155
|
-
'[
|
156
|
-
'[attr.data-
|
157
|
+
'[id]': 'rootContext.contentId()',
|
158
|
+
'[attr.data-state]': 'rootContext.open() ? "open" : "closed"',
|
159
|
+
'[attr.data-disabled]': 'rootContext.disabled() ? "true" : undefined',
|
160
|
+
'[attr.hidden]': 'shouldHide() ? "until-found" : undefined',
|
161
|
+
'[style.--radix-collapsible-content-width.px]': 'width()',
|
162
|
+
'[style.--radix-collapsible-content-height.px]': 'height()',
|
163
|
+
'(animationend)': 'onAnimationEnd()'
|
157
164
|
}
|
158
165
|
}]
|
159
|
-
}] });
|
166
|
+
}], ctorParameters: () => [] });
|
160
167
|
|
161
168
|
class RdxCollapsibleTriggerDirective {
|
162
169
|
constructor() {
|
163
|
-
|
164
|
-
* Reference to CollapsibleRoot
|
165
|
-
* @private
|
166
|
-
* @ignore
|
167
|
-
*/
|
168
|
-
this.collapsible = injectCollapsible();
|
169
|
-
}
|
170
|
-
/**
|
171
|
-
* Called on trigger clicked
|
172
|
-
*/
|
173
|
-
onOpenToggle() {
|
174
|
-
this.collapsible.setOpen();
|
175
|
-
}
|
176
|
-
/**
|
177
|
-
* Returns current directive state (open | closed)
|
178
|
-
* @ignore
|
179
|
-
*/
|
180
|
-
getState() {
|
181
|
-
return this.collapsible.getState();
|
182
|
-
}
|
183
|
-
/**
|
184
|
-
* Returns current trigger state
|
185
|
-
* @ignore
|
186
|
-
*/
|
187
|
-
getDisabled() {
|
188
|
-
return this.collapsible.disabled() ? 'disabled' : undefined;
|
170
|
+
this.rootContext = injectCollapsibleRootContext();
|
189
171
|
}
|
190
172
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxCollapsibleTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
191
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.4", type: RdxCollapsibleTriggerDirective, isStandalone: true, selector: "[rdxCollapsibleTrigger]", host: { listeners: { "click": "
|
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 }); }
|
192
174
|
}
|
193
175
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxCollapsibleTriggerDirective, decorators: [{
|
194
176
|
type: Directive,
|
195
177
|
args: [{
|
196
178
|
selector: '[rdxCollapsibleTrigger]',
|
197
179
|
host: {
|
198
|
-
'[attr.
|
199
|
-
'[attr.
|
200
|
-
'[attr.
|
201
|
-
'[disabled]': '
|
202
|
-
'
|
180
|
+
'[attr.aria-controls]': 'rootContext.contentId()',
|
181
|
+
'[attr.aria-expanded]': 'rootContext.open()',
|
182
|
+
'[attr.data-state]': 'rootContext.open() ? "open" : "closed"',
|
183
|
+
'[attr.data-disabled]': 'rootContext.disabled() ? "true" : undefined',
|
184
|
+
'[attr.disabled]': 'rootContext.disabled() || undefined',
|
185
|
+
'(click)': 'rootContext.toggle()'
|
203
186
|
}
|
204
187
|
}]
|
205
188
|
}] });
|
206
189
|
|
190
|
+
const _imports = [
|
191
|
+
RdxCollapsibleContentDirective,
|
192
|
+
RdxCollapsibleRootDirective,
|
193
|
+
RdxCollapsibleTriggerDirective,
|
194
|
+
RdxCollapsibleContentPresenceDirective
|
195
|
+
];
|
196
|
+
class RdxCollapsibleModule {
|
197
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxCollapsibleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
198
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.4", ngImport: i0, type: RdxCollapsibleModule, imports: [RdxCollapsibleContentDirective,
|
199
|
+
RdxCollapsibleRootDirective,
|
200
|
+
RdxCollapsibleTriggerDirective,
|
201
|
+
RdxCollapsibleContentPresenceDirective], exports: [RdxCollapsibleContentDirective,
|
202
|
+
RdxCollapsibleRootDirective,
|
203
|
+
RdxCollapsibleTriggerDirective,
|
204
|
+
RdxCollapsibleContentPresenceDirective] }); }
|
205
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxCollapsibleModule }); }
|
206
|
+
}
|
207
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: RdxCollapsibleModule, decorators: [{
|
208
|
+
type: NgModule,
|
209
|
+
args: [{
|
210
|
+
imports: [..._imports],
|
211
|
+
exports: [..._imports]
|
212
|
+
}]
|
213
|
+
}] });
|
214
|
+
|
207
215
|
/**
|
208
216
|
* Generated bundle index. Do not edit.
|
209
217
|
*/
|
210
218
|
|
211
|
-
export { RdxCollapsibleContentDirective, RdxCollapsibleRootDirective, RdxCollapsibleTriggerDirective,
|
219
|
+
export { RdxCollapsibleContentDirective, RdxCollapsibleContentPresenceDirective, RdxCollapsibleModule, RdxCollapsibleRootDirective, RdxCollapsibleTriggerDirective, injectCollapsibleRootContext, provideCollapsibleRootContext };
|
212
220
|
//# sourceMappingURL=radix-ng-primitives-collapsible.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-collapsible.mjs","sources":["../../../packages/primitives/collapsible/src/collapsible-content.token.ts","../../../packages/primitives/collapsible/src/collapsible-root.directive.ts","../../../packages/primitives/collapsible/src/collapsible-content.directive.ts","../../../packages/primitives/collapsible/src/collapsible-trigger.directive.ts","../../../packages/primitives/collapsible/radix-ng-primitives-collapsible.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { RdxCollapsibleContentDirective } from './collapsible-content.directive';\n\nexport const RdxCollapsibleContentToken = new InjectionToken<RdxCollapsibleContentDirective>(\n 'RdxCollapsibleContentToken'\n);\n","import { BooleanInput } from '@angular/cdk/coercion';\nimport { booleanAttribute, contentChild, Directive, inject, InjectionToken, input, Input, output } from '@angular/core';\nimport { asyncScheduler } from 'rxjs';\nimport { RdxCollapsibleContentToken } from './collapsible-content.token';\n\nconst RdxCollapsibleRootToken = new InjectionToken<RdxCollapsibleRootDirective>('RdxCollapsibleRootToken');\n\nexport function injectCollapsible(): RdxCollapsibleRootDirective {\n return inject(RdxCollapsibleRootDirective);\n}\n\nexport type RdxCollapsibleState = 'open' | 'closed';\n\n/**\n * @group Components\n */\n@Directive({\n selector: '[rdxCollapsibleRoot]',\n exportAs: 'collapsibleRoot',\n providers: [{ provide: RdxCollapsibleRootToken, useExisting: RdxCollapsibleRootDirective }],\n host: {\n '[attr.data-state]': 'getState()',\n '[attr.data-disabled]': 'disabled() ? \"\" : undefined'\n }\n})\nexport class RdxCollapsibleRootDirective {\n /**\n * Reference to RdxCollapsibleContent directive\n */\n private readonly contentDirective = contentChild.required(RdxCollapsibleContentToken);\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 /**\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 @Input() set open(value: boolean) {\n if (value !== this._open) {\n this.onOpenChange.emit(value);\n }\n\n this._open = value;\n this.setPresence();\n }\n\n get open(): boolean {\n return this._open;\n }\n\n /**\n * Stores collapsible state\n */\n private _open = false;\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 /**\n * Allows to change directive state\n * @param {boolean | undefined} value\n * @ignore\n */\n setOpen(value?: boolean) {\n if (this.disabled()) {\n return;\n }\n\n if (value === undefined) {\n this.open = !this.open;\n } else {\n this.open = value;\n }\n\n this.setPresence();\n }\n\n /**\n * Returns directive state (open | closed)\n * @ignore\n */\n getState(): RdxCollapsibleState {\n return this.open ? 'open' : 'closed';\n }\n\n /**\n * Returns current directive state\n * @ignore\n */\n isOpen(): boolean {\n return this.open;\n }\n\n /**\n * Controls visibility of content\n */\n private setPresence(): void {\n if (!this.contentDirective) {\n return;\n }\n\n if (this.isOpen()) {\n this.contentDirective().elementRef.nativeElement.removeAttribute('hidden');\n } else {\n asyncScheduler.schedule(() => {\n const animations = this.contentDirective().elementRef.nativeElement.getAnimations();\n\n if (animations === undefined || animations.length === 0) {\n this.contentDirective().elementRef.nativeElement.setAttribute('hidden', '');\n }\n });\n }\n }\n}\n","import { Directive, ElementRef, inject } from '@angular/core';\nimport { RdxCollapsibleContentToken } from './collapsible-content.token';\nimport { RdxCollapsibleRootDirective } from './collapsible-root.directive';\n\n@Directive({\n selector: '[rdxCollapsibleContent]',\n providers: [\n {\n provide: RdxCollapsibleContentToken,\n useExisting: RdxCollapsibleContentDirective\n }\n ],\n host: {\n '[attr.data-state]': 'collapsible.getState()',\n '[attr.data-disabled]': 'getDisabled()'\n }\n})\nexport class RdxCollapsibleContentDirective {\n protected readonly collapsible = inject(RdxCollapsibleRootDirective);\n\n /**\n * Reference to CollapsibleContent host element\n * @ignore\n */\n readonly elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n getDisabled(): string | undefined {\n return this.collapsible.disabled() ? 'disabled' : undefined;\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectCollapsible, RdxCollapsibleState } from './collapsible-root.directive';\n\n@Directive({\n selector: '[rdxCollapsibleTrigger]',\n host: {\n '[attr.data-state]': 'getState()',\n '[attr.data-disabled]': 'getDisabled()',\n '[attr.aria-expanded]': 'getState() === \"open\" ? \"true\" : \"false\"',\n '[disabled]': 'getDisabled()',\n\n '(click)': 'onOpenToggle()'\n }\n})\nexport class RdxCollapsibleTriggerDirective {\n /**\n * Reference to CollapsibleRoot\n * @private\n * @ignore\n */\n private readonly collapsible = injectCollapsible();\n\n /**\n * Called on trigger clicked\n */\n onOpenToggle(): void {\n this.collapsible.setOpen();\n }\n\n /**\n * Returns current directive state (open | closed)\n * @ignore\n */\n getState(): RdxCollapsibleState {\n return this.collapsible.getState();\n }\n\n /**\n * Returns current trigger state\n * @ignore\n */\n getDisabled(): string | undefined {\n return this.collapsible.disabled() ? 'disabled' : undefined;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGO,MAAM,0BAA0B,GAAG,IAAI,cAAc,CACxD,4BAA4B,CAC/B;;ACAD,MAAM,uBAAuB,GAAG,IAAI,cAAc,CAA8B,yBAAyB,CAAC;SAE1F,iBAAiB,GAAA;AAC7B,IAAA,OAAO,MAAM,CAAC,2BAA2B,CAAC;AAC9C;AAIA;;AAEG;MAUU,2BAA2B,CAAA;AATxC,IAAA,WAAA,GAAA;AAUI;;AAEG;AACc,QAAA,IAAA,CAAA,gBAAgB,GAAG,YAAY,CAAC,QAAQ,CAAC,0BAA0B,CAAC;AAErF;;;;;AAKG;QACM,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAwB,KAAK,EAAE,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;AAsBxF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,CAAA;AACP,oBAAA,QAAQ,EAAE,yBAAyB;AACnC,oBAAA,IAAI,EAAE;AACF,wBAAA,mBAAmB,EAAE,YAAY;AACjC,wBAAA,sBAAsB,EAAE,eAAe;AACvC,wBAAA,sBAAsB,EAAE,0CAA0C;AAClE,wBAAA,YAAY,EAAE,eAAe;AAE7B,wBAAA,SAAS,EAAE;AACd;AACJ,iBAAA;;;ACbD;;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,IAAI,EAAE,CAAC;AACvC,aAAC,CAAC;YACF,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;;KAElD;AACL,CAAC;AAED;;AAEG;MAUU,2BAA2B,CAAA;AATxC,IAAA,WAAA,GAAA;AAUI;;;;;;AAMG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