@radix-ng/primitives 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/avatar/README.md +1 -0
- package/avatar/index.d.ts +4 -0
- package/avatar/src/avatar-fallback.directive.d.ts +34 -0
- package/avatar/src/avatar-image.directive.d.ts +17 -0
- package/avatar/src/avatar.config.d.ts +12 -0
- package/avatar/src/avatar.directive.d.ts +22 -0
- package/avatar/src/avatar.token.d.ts +4 -0
- package/checkbox/index.d.ts +1 -1
- package/esm2022/avatar/index.mjs +5 -0
- package/esm2022/avatar/radix-ng-primitives-avatar.mjs +5 -0
- package/esm2022/avatar/src/avatar-fallback.directive.mjs +61 -0
- package/esm2022/avatar/src/avatar-image.directive.mjs +50 -0
- package/esm2022/avatar/src/avatar.config.mjs +17 -0
- package/esm2022/avatar/src/avatar.directive.mjs +38 -0
- package/esm2022/avatar/src/avatar.token.mjs +6 -0
- package/esm2022/checkbox/index.mjs +2 -2
- package/esm2022/checkbox/src/checkbox-indicator.directive.mjs +1 -1
- package/esm2022/checkbox/src/checkbox.directive.mjs +2 -2
- package/esm2022/checkbox/src/checkbox.token.mjs +2 -2
- package/esm2022/overlay/index.mjs +5 -0
- package/esm2022/overlay/radix-ng-primitives-overlay.mjs +5 -0
- package/esm2022/overlay/src/overlay-arrow.directive.mjs +59 -0
- package/esm2022/overlay/src/overlay-arrow.token.mjs +3 -0
- package/esm2022/overlay/src/overlay-trigger.directive.mjs +279 -0
- package/esm2022/overlay/src/overlay-trigger.token.mjs +9 -0
- package/esm2022/overlay/src/overlay.directive.mjs +51 -0
- package/esm2022/overlay/src/overlay.token.mjs +3 -0
- package/esm2022/progress/src/progress-indicator.directive.mjs +1 -1
- package/esm2022/progress/src/progress.directive.mjs +1 -1
- package/esm2022/progress/src/progress.token.mjs +2 -2
- package/esm2022/radio/index.mjs +2 -2
- package/esm2022/radio/src/radio-group.directive.mjs +2 -2
- package/esm2022/radio/src/radio-group.token.mjs +2 -2
- package/esm2022/radio/src/radio-indicator.directive.mjs +1 -1
- package/esm2022/radio/src/radio-item.directive.mjs +4 -4
- package/esm2022/radio/src/radio-item.token.mjs +2 -2
- package/esm2022/roving-focus/src/roving-focus-group.directive.mjs +2 -2
- package/esm2022/roving-focus/src/roving-focus-group.token.mjs +2 -2
- package/esm2022/roving-focus/src/roving-focus-item.directive.mjs +2 -2
- package/esm2022/roving-focus/src/roving-focus-item.token.mjs +2 -2
- package/esm2022/separator/src/separator.directive.mjs +2 -2
- package/esm2022/switch/index.mjs +2 -2
- package/esm2022/switch/src/switch-thumb.directive.mjs +1 -1
- package/esm2022/switch/src/switch.directive.mjs +2 -2
- package/esm2022/switch/src/switch.token.mjs +2 -2
- package/esm2022/tooltip/index.mjs +5 -0
- package/esm2022/tooltip/radix-ng-primitives-tooltip.mjs +5 -0
- package/esm2022/tooltip/src/tooltip-arrow.directive.mjs +17 -0
- package/esm2022/tooltip/src/tooltip-trigger.directive.mjs +148 -0
- package/esm2022/tooltip/src/tooltip-trigger.token.mjs +6 -0
- package/esm2022/tooltip/src/tooltip.config.mjs +31 -0
- package/esm2022/tooltip/src/tooltip.directive.mjs +46 -0
- package/esm2022/visually-hidden/src/visually-hidden.directive.mjs +1 -1
- package/fesm2022/radix-ng-primitives-avatar.mjs +167 -0
- package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-checkbox.mjs +21 -21
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-overlay.mjs +399 -0
- package/fesm2022/radix-ng-primitives-overlay.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-radio.mjs +26 -26
- package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-separator.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-switch.mjs +23 -23
- package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tooltip.mjs +242 -0
- package/fesm2022/radix-ng-primitives-tooltip.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-visually-hidden.mjs.map +1 -1
- package/overlay/README.md +1 -0
- package/overlay/index.d.ts +4 -0
- package/overlay/src/overlay-arrow.directive.d.ts +29 -0
- package/overlay/src/overlay-arrow.token.d.ts +3 -0
- package/overlay/src/overlay-trigger.directive.d.ts +163 -0
- package/overlay/src/overlay-trigger.token.d.ts +7 -0
- package/overlay/src/overlay.directive.d.ts +29 -0
- package/overlay/src/overlay.token.d.ts +3 -0
- package/package.json +23 -4
- package/radio/index.d.ts +1 -1
- package/switch/index.d.ts +1 -1
- package/tooltip/README.md +1 -0
- package/tooltip/index.d.ts +4 -0
- package/tooltip/src/tooltip-arrow.directive.d.ts +6 -0
- package/tooltip/src/tooltip-trigger.directive.d.ts +79 -0
- package/tooltip/src/tooltip-trigger.token.d.ts +4 -0
- package/tooltip/src/tooltip.config.d.ts +46 -0
- package/tooltip/src/tooltip.directive.d.ts +17 -0
@@ -0,0 +1,399 @@
|
|
1
|
+
import * as i0 from '@angular/core';
|
2
|
+
import { InjectionToken, inject, ElementRef, Directive, ApplicationRef, ComponentFactoryResolver, Injector, ViewContainerRef, booleanAttribute, numberAttribute, Input } from '@angular/core';
|
3
|
+
import { DomPortalOutlet, TemplatePortal } from '@angular/cdk/portal';
|
4
|
+
import { offset, shift, flip, arrow, autoUpdate, computePosition } from '@floating-ui/dom';
|
5
|
+
|
6
|
+
const OverlayArrowToken = new InjectionToken('OverlayArrowToken');
|
7
|
+
|
8
|
+
const OverlayTriggerToken = new InjectionToken('OverlayTriggerToken');
|
9
|
+
/**
|
10
|
+
* Inject the overlay trigger directive
|
11
|
+
*/
|
12
|
+
function injectOverlayTrigger() {
|
13
|
+
return inject(OverlayTriggerToken);
|
14
|
+
}
|
15
|
+
|
16
|
+
class OverlayArrowDirective {
|
17
|
+
constructor() {
|
18
|
+
/**
|
19
|
+
* Access the arrow element
|
20
|
+
*/
|
21
|
+
this.elementRef = inject((ElementRef));
|
22
|
+
/**
|
23
|
+
* Access the overlay trigger
|
24
|
+
*/
|
25
|
+
this.overlayTrigger = injectOverlayTrigger();
|
26
|
+
}
|
27
|
+
/**
|
28
|
+
* Register the arrow on init
|
29
|
+
* @internal
|
30
|
+
*/
|
31
|
+
ngOnInit() {
|
32
|
+
this.overlayTrigger.registerArrow(this);
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* Unregister the arrow on destroy
|
36
|
+
* @internal
|
37
|
+
*/
|
38
|
+
ngOnDestroy() {
|
39
|
+
this.overlayTrigger.unregisterArrow();
|
40
|
+
}
|
41
|
+
/**
|
42
|
+
* Define the position of the arrow.
|
43
|
+
*/
|
44
|
+
setPosition(placement, arrowX, arrowY) {
|
45
|
+
const staticSide = {
|
46
|
+
top: 'bottom',
|
47
|
+
right: 'left',
|
48
|
+
bottom: 'top',
|
49
|
+
left: 'right'
|
50
|
+
}[placement.split('-')[0]];
|
51
|
+
Object.assign(this.elementRef.nativeElement.style, {
|
52
|
+
left: arrowX != null ? `${arrowX}px` : '',
|
53
|
+
top: arrowY != null ? `${arrowY}px` : '',
|
54
|
+
right: '',
|
55
|
+
bottom: '',
|
56
|
+
[staticSide]: `-${this.elementRef.nativeElement.offsetWidth / 2}px`
|
57
|
+
});
|
58
|
+
}
|
59
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: OverlayArrowDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
60
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.3", type: OverlayArrowDirective, isStandalone: true, selector: "[rdxOverlayArrow]", providers: [{ provide: OverlayArrowToken, useExisting: OverlayArrowDirective }], ngImport: i0 }); }
|
61
|
+
}
|
62
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: OverlayArrowDirective, decorators: [{
|
63
|
+
type: Directive,
|
64
|
+
args: [{
|
65
|
+
selector: '[rdxOverlayArrow]',
|
66
|
+
standalone: true,
|
67
|
+
providers: [{ provide: OverlayArrowToken, useExisting: OverlayArrowDirective }]
|
68
|
+
}]
|
69
|
+
}] });
|
70
|
+
|
71
|
+
/* eslint-disable @angular-eslint/no-input-rename */
|
72
|
+
class OverlayTriggerDirective {
|
73
|
+
constructor() {
|
74
|
+
/**
|
75
|
+
* Access the application ref
|
76
|
+
*/
|
77
|
+
this.appRef = inject(ApplicationRef);
|
78
|
+
/**
|
79
|
+
* Access the component factory resolver
|
80
|
+
*/
|
81
|
+
this.componentFactoryResolver = inject(ComponentFactoryResolver);
|
82
|
+
/**
|
83
|
+
* Access the injector
|
84
|
+
*/
|
85
|
+
this.injector = inject(Injector);
|
86
|
+
/**
|
87
|
+
* Access the trigger element
|
88
|
+
*/
|
89
|
+
this.trigger = inject((ElementRef));
|
90
|
+
/**
|
91
|
+
* Access the view container
|
92
|
+
*/
|
93
|
+
this.viewContainer = inject(ViewContainerRef);
|
94
|
+
/**
|
95
|
+
* Define if the trigger should be disabled.
|
96
|
+
* @default false
|
97
|
+
*/
|
98
|
+
this.disabled = false;
|
99
|
+
/**
|
100
|
+
* Define the placement of the overlay relative to the trigger.
|
101
|
+
* @default 'bottom'
|
102
|
+
*/
|
103
|
+
this.placement = 'top';
|
104
|
+
/**
|
105
|
+
* Define the offset of the overlay relative to the trigger.
|
106
|
+
* @default 4
|
107
|
+
*/
|
108
|
+
this.offset = 4;
|
109
|
+
/**
|
110
|
+
* Define the delay before the overlay is displayed.
|
111
|
+
* @default 0
|
112
|
+
*/
|
113
|
+
this.showDelay = 0;
|
114
|
+
/**
|
115
|
+
* Define the delay before the overlay is hidden.
|
116
|
+
* @default 0
|
117
|
+
*/
|
118
|
+
this.hideDelay = 0;
|
119
|
+
/**
|
120
|
+
* Define whether the overlay should shift when the overlay is near the edge of the viewport.
|
121
|
+
* @default true
|
122
|
+
*/
|
123
|
+
this.shift = true;
|
124
|
+
/**
|
125
|
+
* Define whether the overlay should flip when there is not enough space for the overlay.
|
126
|
+
* @default true
|
127
|
+
*/
|
128
|
+
this.flip = true;
|
129
|
+
/**
|
130
|
+
* Define the container in to which the overlay should be attached.
|
131
|
+
* @default document.body
|
132
|
+
*/
|
133
|
+
this.container = document.body;
|
134
|
+
/**
|
135
|
+
* Store the overlay content instance.
|
136
|
+
*/
|
137
|
+
this.overlay = null;
|
138
|
+
/**
|
139
|
+
* Store the overlay arrow instance.
|
140
|
+
*/
|
141
|
+
this.arrow = null;
|
142
|
+
/**
|
143
|
+
* Store the view ref
|
144
|
+
*/
|
145
|
+
this.viewRef = null;
|
146
|
+
/**
|
147
|
+
* Store the show delay timeout
|
148
|
+
*/
|
149
|
+
this.showDelayTimeout = null;
|
150
|
+
/**
|
151
|
+
* Store the hide delay timeout
|
152
|
+
*/
|
153
|
+
this.hideDelayTimeout = null;
|
154
|
+
/**
|
155
|
+
* Store additional providers to register on the overlay.
|
156
|
+
*/
|
157
|
+
this.providers = [];
|
158
|
+
}
|
159
|
+
/**
|
160
|
+
* Determine the state of the overlay.
|
161
|
+
*/
|
162
|
+
get isOpen() {
|
163
|
+
return !!this.viewRef;
|
164
|
+
}
|
165
|
+
/**
|
166
|
+
* Determine the state of the overlay.
|
167
|
+
*/
|
168
|
+
get state() {
|
169
|
+
if (this.showDelayTimeout) {
|
170
|
+
return 'opening';
|
171
|
+
}
|
172
|
+
if (this.hideDelayTimeout) {
|
173
|
+
return 'closing';
|
174
|
+
}
|
175
|
+
return this.isOpen ? 'open' : 'closed';
|
176
|
+
}
|
177
|
+
/**
|
178
|
+
* Create the overlay.
|
179
|
+
*/
|
180
|
+
createOverlay() {
|
181
|
+
const domPortal = new DomPortalOutlet(this.container, this.componentFactoryResolver, this.appRef, this.injector);
|
182
|
+
const templatePortal = new TemplatePortal(this.templateRef, this.viewContainer, undefined, Injector.create({
|
183
|
+
parent: this.injector,
|
184
|
+
providers: [
|
185
|
+
{
|
186
|
+
provide: OverlayTriggerToken,
|
187
|
+
useValue: this
|
188
|
+
},
|
189
|
+
...this.providers
|
190
|
+
]
|
191
|
+
}));
|
192
|
+
this.viewRef = domPortal.attach(templatePortal);
|
193
|
+
this.viewRef.detectChanges();
|
194
|
+
this.updateOverlayPosition();
|
195
|
+
this.showDelayTimeout = null;
|
196
|
+
}
|
197
|
+
/**
|
198
|
+
* Update the overlay position.
|
199
|
+
*/
|
200
|
+
updateOverlayPosition() {
|
201
|
+
if (!this.viewRef) {
|
202
|
+
return;
|
203
|
+
}
|
204
|
+
const overlayElement = this.viewRef.rootNodes[0];
|
205
|
+
const middleware = [];
|
206
|
+
if (this.offset) {
|
207
|
+
middleware.push(offset(this.offset));
|
208
|
+
}
|
209
|
+
if (this.shift) {
|
210
|
+
middleware.push(shift());
|
211
|
+
}
|
212
|
+
if (this.flip) {
|
213
|
+
middleware.push(flip());
|
214
|
+
}
|
215
|
+
// if there is an arrow defined, we need to add the arrow middleware
|
216
|
+
if (this.arrow) {
|
217
|
+
middleware.push(arrow({ element: this.arrow.elementRef.nativeElement }));
|
218
|
+
}
|
219
|
+
this.dispose = autoUpdate(this.trigger.nativeElement, overlayElement, async () => {
|
220
|
+
const position = await computePosition(this.trigger.nativeElement, overlayElement, {
|
221
|
+
placement: this.placement,
|
222
|
+
middleware
|
223
|
+
});
|
224
|
+
this.overlay?.setPosition(position.x, position.y);
|
225
|
+
if (position.middlewareData.arrow) {
|
226
|
+
this.arrow?.setPosition(this.placement, position.middlewareData.arrow.x, position.middlewareData.arrow.y);
|
227
|
+
}
|
228
|
+
});
|
229
|
+
}
|
230
|
+
/**
|
231
|
+
* Destroy the overlay.
|
232
|
+
*/
|
233
|
+
destroyOverlay() {
|
234
|
+
this.viewRef?.destroy();
|
235
|
+
this.viewRef = null;
|
236
|
+
this.dispose?.();
|
237
|
+
this.hideDelayTimeout = null;
|
238
|
+
}
|
239
|
+
/**
|
240
|
+
* Show the overlay.
|
241
|
+
*/
|
242
|
+
show() {
|
243
|
+
if (this.disabled || this.isOpen) {
|
244
|
+
return;
|
245
|
+
}
|
246
|
+
if (this.hideDelayTimeout) {
|
247
|
+
clearTimeout(this.hideDelayTimeout);
|
248
|
+
this.hideDelayTimeout = null;
|
249
|
+
}
|
250
|
+
this.showDelayTimeout = window.setTimeout(() => this.createOverlay(), this.showDelay);
|
251
|
+
}
|
252
|
+
/**
|
253
|
+
* Hide the overlay.
|
254
|
+
*/
|
255
|
+
hide() {
|
256
|
+
if (!this.isOpen) {
|
257
|
+
return;
|
258
|
+
}
|
259
|
+
if (this.showDelayTimeout) {
|
260
|
+
clearTimeout(this.showDelayTimeout);
|
261
|
+
this.showDelayTimeout = null;
|
262
|
+
}
|
263
|
+
this.hideDelayTimeout = window.setTimeout(() => this.destroyOverlay(), this.hideDelay);
|
264
|
+
}
|
265
|
+
/**
|
266
|
+
* Register the overlay.
|
267
|
+
* @param overlay The overlay to register.
|
268
|
+
* @internal
|
269
|
+
*/
|
270
|
+
registerOverlay(overlay) {
|
271
|
+
this.overlay = overlay;
|
272
|
+
}
|
273
|
+
/**
|
274
|
+
* Unregister the overlay.
|
275
|
+
* @internal
|
276
|
+
*/
|
277
|
+
unregisterOverlay() {
|
278
|
+
this.overlay = null;
|
279
|
+
}
|
280
|
+
/**
|
281
|
+
* Register the arrow.
|
282
|
+
* @param arrow The arrow to register.
|
283
|
+
* @internal
|
284
|
+
*/
|
285
|
+
registerArrow(arrow) {
|
286
|
+
this.arrow = arrow;
|
287
|
+
}
|
288
|
+
/**
|
289
|
+
* Unregister the arrow.
|
290
|
+
* @internal
|
291
|
+
*/
|
292
|
+
unregisterArrow() {
|
293
|
+
this.arrow = null;
|
294
|
+
}
|
295
|
+
/**
|
296
|
+
* Register a provider on the overlay.
|
297
|
+
* @param provider The provider to register.
|
298
|
+
* @internal
|
299
|
+
*/
|
300
|
+
registerProvider(provider) {
|
301
|
+
this.providers.push(provider);
|
302
|
+
}
|
303
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: OverlayTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
304
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "17.3.3", type: OverlayTriggerDirective, isStandalone: true, selector: "[rdxOverlayTrigger]", inputs: { templateRef: ["rdxOverlayTrigger", "templateRef"], disabled: ["rdxOverlayDisabled", "disabled", booleanAttribute], placement: ["rdxOverlayPlacement", "placement"], offset: ["rdxOverlayOffset", "offset", numberAttribute], showDelay: ["rdxOverlayShowDelay", "showDelay", numberAttribute], hideDelay: ["rdxOverlayHideDelay", "hideDelay", numberAttribute], shift: ["rdxOverlayShift", "shift", booleanAttribute], flip: ["rdxOverlayFlip", "flip", booleanAttribute], container: ["rdxOverlayContainer", "container"] }, host: { properties: { "attr.data-state": "state" } }, exportAs: ["rdxOverlayTrigger"], ngImport: i0 }); }
|
305
|
+
}
|
306
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: OverlayTriggerDirective, decorators: [{
|
307
|
+
type: Directive,
|
308
|
+
args: [{
|
309
|
+
selector: '[rdxOverlayTrigger]',
|
310
|
+
standalone: true,
|
311
|
+
exportAs: 'rdxOverlayTrigger',
|
312
|
+
host: {
|
313
|
+
'[attr.data-state]': 'state'
|
314
|
+
}
|
315
|
+
}]
|
316
|
+
}], propDecorators: { templateRef: [{
|
317
|
+
type: Input,
|
318
|
+
args: [{ alias: 'rdxOverlayTrigger', required: true }]
|
319
|
+
}], disabled: [{
|
320
|
+
type: Input,
|
321
|
+
args: [{ alias: 'rdxOverlayDisabled', transform: booleanAttribute }]
|
322
|
+
}], placement: [{
|
323
|
+
type: Input,
|
324
|
+
args: ['rdxOverlayPlacement']
|
325
|
+
}], offset: [{
|
326
|
+
type: Input,
|
327
|
+
args: [{ alias: 'rdxOverlayOffset', transform: numberAttribute }]
|
328
|
+
}], showDelay: [{
|
329
|
+
type: Input,
|
330
|
+
args: [{ alias: 'rdxOverlayShowDelay', transform: numberAttribute }]
|
331
|
+
}], hideDelay: [{
|
332
|
+
type: Input,
|
333
|
+
args: [{ alias: 'rdxOverlayHideDelay', transform: numberAttribute }]
|
334
|
+
}], shift: [{
|
335
|
+
type: Input,
|
336
|
+
args: [{ alias: 'rdxOverlayShift', transform: booleanAttribute }]
|
337
|
+
}], flip: [{
|
338
|
+
type: Input,
|
339
|
+
args: [{ alias: 'rdxOverlayFlip', transform: booleanAttribute }]
|
340
|
+
}], container: [{
|
341
|
+
type: Input,
|
342
|
+
args: ['rdxOverlayContainer']
|
343
|
+
}] } });
|
344
|
+
|
345
|
+
const OverlayToken = new InjectionToken('OverlayToken');
|
346
|
+
|
347
|
+
class OverlayDirective {
|
348
|
+
constructor() {
|
349
|
+
/**
|
350
|
+
* Access the overlay element
|
351
|
+
*/
|
352
|
+
this.elementRef = inject((ElementRef));
|
353
|
+
/**
|
354
|
+
* Access the overlay trigger
|
355
|
+
*/
|
356
|
+
this.overlayTrigger = injectOverlayTrigger();
|
357
|
+
}
|
358
|
+
/**
|
359
|
+
* Register the overlay on init
|
360
|
+
*/
|
361
|
+
ngOnInit() {
|
362
|
+
this.overlayTrigger.registerOverlay(this);
|
363
|
+
}
|
364
|
+
/**
|
365
|
+
* Unregister the overlay on destroy
|
366
|
+
*/
|
367
|
+
ngOnDestroy() {
|
368
|
+
this.overlayTrigger.unregisterOverlay();
|
369
|
+
}
|
370
|
+
/**
|
371
|
+
* Set the position of the overlay
|
372
|
+
* @param x The x position
|
373
|
+
* @param y The y position
|
374
|
+
* @internal
|
375
|
+
*/
|
376
|
+
setPosition(x, y) {
|
377
|
+
Object.assign(this.elementRef.nativeElement.style, {
|
378
|
+
left: `${x}px`,
|
379
|
+
top: `${y}px`
|
380
|
+
});
|
381
|
+
}
|
382
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: OverlayDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
383
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.3", type: OverlayDirective, isStandalone: true, selector: "[rdxOverlay]", providers: [{ provide: OverlayToken, useExisting: OverlayDirective }], ngImport: i0 }); }
|
384
|
+
}
|
385
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: OverlayDirective, decorators: [{
|
386
|
+
type: Directive,
|
387
|
+
args: [{
|
388
|
+
selector: '[rdxOverlay]',
|
389
|
+
standalone: true,
|
390
|
+
providers: [{ provide: OverlayToken, useExisting: OverlayDirective }]
|
391
|
+
}]
|
392
|
+
}] });
|
393
|
+
|
394
|
+
/**
|
395
|
+
* Generated bundle index. Do not edit.
|
396
|
+
*/
|
397
|
+
|
398
|
+
export { OverlayArrowDirective, OverlayDirective, OverlayTriggerDirective, OverlayTriggerToken, injectOverlayTrigger };
|
399
|
+
//# sourceMappingURL=radix-ng-primitives-overlay.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"radix-ng-primitives-overlay.mjs","sources":["../../../packages/primitives/overlay/src/overlay-arrow.token.ts","../../../packages/primitives/overlay/src/overlay-trigger.token.ts","../../../packages/primitives/overlay/src/overlay-arrow.directive.ts","../../../packages/primitives/overlay/src/overlay-trigger.directive.ts","../../../packages/primitives/overlay/src/overlay.token.ts","../../../packages/primitives/overlay/src/overlay.directive.ts","../../../packages/primitives/overlay/radix-ng-primitives-overlay.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport type { OverlayArrowDirective } from './overlay-arrow.directive';\n\nexport const OverlayArrowToken = new InjectionToken<OverlayArrowDirective>('OverlayArrowToken');\n","import { inject, InjectionToken } from '@angular/core';\n\nimport type { OverlayTriggerDirective } from './overlay-trigger.directive';\n\nexport const OverlayTriggerToken = new InjectionToken<OverlayTriggerDirective>(\n 'OverlayTriggerToken'\n);\n\n/**\n * Inject the overlay trigger directive\n */\nexport function injectOverlayTrigger(): OverlayTriggerDirective {\n return inject(OverlayTriggerToken);\n}\n","import { Directive, ElementRef, inject, OnDestroy, OnInit } from '@angular/core';\n\nimport { Placement } from '@floating-ui/dom';\n\nimport { OverlayArrowToken } from './overlay-arrow.token';\nimport { injectOverlayTrigger } from './overlay-trigger.token';\n\n@Directive({\n selector: '[rdxOverlayArrow]',\n standalone: true,\n providers: [{ provide: OverlayArrowToken, useExisting: OverlayArrowDirective }]\n})\nexport class OverlayArrowDirective implements OnInit, OnDestroy {\n /**\n * Access the arrow element\n */\n readonly elementRef = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the overlay trigger\n */\n private readonly overlayTrigger = injectOverlayTrigger();\n\n /**\n * Register the arrow on init\n * @internal\n */\n ngOnInit(): void {\n this.overlayTrigger.registerArrow(this);\n }\n\n /**\n * Unregister the arrow on destroy\n * @internal\n */\n ngOnDestroy(): void {\n this.overlayTrigger.unregisterArrow();\n }\n\n /**\n * Define the position of the arrow.\n */\n setPosition(placement: Placement, arrowX?: number, arrowY?: number): void {\n const staticSide = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right'\n }[placement.split('-')[0]] as string;\n\n Object.assign(this.elementRef.nativeElement.style, {\n left: arrowX != null ? `${arrowX}px` : '',\n top: arrowY != null ? `${arrowY}px` : '',\n right: '',\n bottom: '',\n [staticSide]: `-${this.elementRef.nativeElement.offsetWidth / 2}px`\n });\n }\n}\n","/* eslint-disable @angular-eslint/no-input-rename */\nimport { DomPortalOutlet, TemplatePortal } from '@angular/cdk/portal';\nimport {\n ApplicationRef,\n booleanAttribute,\n ComponentFactoryResolver,\n Directive,\n ElementRef,\n EmbeddedViewRef,\n inject,\n Injector,\n Input,\n numberAttribute,\n StaticProvider,\n TemplateRef,\n ViewContainerRef\n} from '@angular/core';\n\nimport {\n arrow,\n autoUpdate,\n computePosition,\n flip,\n Middleware,\n offset,\n Placement,\n shift\n} from '@floating-ui/dom';\n\nimport type { OverlayArrowDirective } from './overlay-arrow.directive';\nimport { OverlayTriggerToken } from './overlay-trigger.token';\nimport type { OverlayDirective } from './overlay.directive';\n\n@Directive({\n selector: '[rdxOverlayTrigger]',\n standalone: true,\n exportAs: 'rdxOverlayTrigger',\n host: {\n '[attr.data-state]': 'state'\n }\n})\nexport class OverlayTriggerDirective {\n /**\n * Access the application ref\n */\n private readonly appRef = inject(ApplicationRef);\n\n /**\n * Access the component factory resolver\n */\n private readonly componentFactoryResolver = inject(ComponentFactoryResolver);\n\n /**\n * Access the injector\n */\n private readonly injector = inject(Injector);\n\n /**\n * Access the trigger element\n */\n private readonly trigger = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the view container\n */\n private readonly viewContainer = inject(ViewContainerRef);\n\n /**\n * Define the overlay to display when the trigger is activated.\n */\n @Input({ alias: 'rdxOverlayTrigger', required: true }) templateRef!: TemplateRef<void>;\n\n /**\n * Define if the trigger should be disabled.\n * @default false\n */\n @Input({ alias: 'rdxOverlayDisabled', transform: booleanAttribute }) disabled = false;\n\n /**\n * Define the placement of the overlay relative to the trigger.\n * @default 'bottom'\n */\n @Input('rdxOverlayPlacement') placement: Placement = 'top';\n\n /**\n * Define the offset of the overlay relative to the trigger.\n * @default 4\n */\n @Input({ alias: 'rdxOverlayOffset', transform: numberAttribute }) offset = 4;\n\n /**\n * Define the delay before the overlay is displayed.\n * @default 0\n */\n @Input({ alias: 'rdxOverlayShowDelay', transform: numberAttribute }) showDelay = 0;\n\n /**\n * Define the delay before the overlay is hidden.\n * @default 0\n */\n @Input({ alias: 'rdxOverlayHideDelay', transform: numberAttribute }) hideDelay = 0;\n\n /**\n * Define whether the overlay should shift when the overlay is near the edge of the viewport.\n * @default true\n */\n @Input({ alias: 'rdxOverlayShift', transform: booleanAttribute }) shift = true;\n\n /**\n * Define whether the overlay should flip when there is not enough space for the overlay.\n * @default true\n */\n @Input({ alias: 'rdxOverlayFlip', transform: booleanAttribute }) flip = true;\n\n /**\n * Define the container in to which the overlay should be attached.\n * @default document.body\n */\n @Input('rdxOverlayContainer') container: HTMLElement = document.body;\n\n /**\n * Store the overlay content instance.\n */\n private overlay: OverlayDirective | null = null;\n\n /**\n * Store the overlay arrow instance.\n */\n private arrow: OverlayArrowDirective | null = null;\n\n /**\n * Store the view ref\n */\n private viewRef: EmbeddedViewRef<void> | null = null;\n\n /**\n * Store the show delay timeout\n */\n private showDelayTimeout: number | null = null;\n\n /**\n * Store the hide delay timeout\n */\n private hideDelayTimeout: number | null = null;\n\n /**\n * Store the dispose function\n */\n private dispose?: () => void;\n\n /**\n * Store additional providers to register on the overlay.\n */\n private readonly providers: StaticProvider[] = [];\n\n /**\n * Determine the state of the overlay.\n */\n private get isOpen(): boolean {\n return !!this.viewRef;\n }\n\n /**\n * Determine the state of the overlay.\n */\n protected get state(): 'closed' | 'opening' | 'open' | 'closing' {\n if (this.showDelayTimeout) {\n return 'opening';\n }\n\n if (this.hideDelayTimeout) {\n return 'closing';\n }\n\n return this.isOpen ? 'open' : 'closed';\n }\n\n /**\n * Create the overlay.\n */\n private createOverlay(): void {\n const domPortal = new DomPortalOutlet(\n this.container,\n this.componentFactoryResolver,\n this.appRef,\n this.injector\n );\n\n const templatePortal = new TemplatePortal(\n this.templateRef,\n this.viewContainer,\n undefined,\n Injector.create({\n parent: this.injector,\n providers: [\n {\n provide: OverlayTriggerToken,\n useValue: this\n },\n ...this.providers\n ]\n })\n );\n\n this.viewRef = domPortal.attach(templatePortal);\n this.viewRef.detectChanges();\n\n this.updateOverlayPosition();\n this.showDelayTimeout = null;\n }\n\n /**\n * Update the overlay position.\n */\n private updateOverlayPosition(): void {\n if (!this.viewRef) {\n return;\n }\n\n const overlayElement = this.viewRef.rootNodes[0] as HTMLElement;\n\n const middleware: Middleware[] = [];\n\n if (this.offset) {\n middleware.push(offset(this.offset));\n }\n\n if (this.shift) {\n middleware.push(shift());\n }\n\n if (this.flip) {\n middleware.push(flip());\n }\n\n // if there is an arrow defined, we need to add the arrow middleware\n if (this.arrow) {\n middleware.push(arrow({ element: this.arrow.elementRef.nativeElement }));\n }\n\n this.dispose = autoUpdate(this.trigger.nativeElement, overlayElement, async () => {\n const position = await computePosition(this.trigger.nativeElement, overlayElement, {\n placement: this.placement,\n middleware\n });\n\n this.overlay?.setPosition(position.x, position.y);\n\n if (position.middlewareData.arrow) {\n this.arrow?.setPosition(\n this.placement,\n position.middlewareData.arrow.x,\n position.middlewareData.arrow.y\n );\n }\n });\n }\n\n /**\n * Destroy the overlay.\n */\n private destroyOverlay(): void {\n this.viewRef?.destroy();\n this.viewRef = null;\n\n this.dispose?.();\n this.hideDelayTimeout = null;\n }\n\n /**\n * Show the overlay.\n */\n show(): void {\n if (this.disabled || this.isOpen) {\n return;\n }\n\n if (this.hideDelayTimeout) {\n clearTimeout(this.hideDelayTimeout);\n this.hideDelayTimeout = null;\n }\n\n this.showDelayTimeout = window.setTimeout(() => this.createOverlay(), this.showDelay);\n }\n\n /**\n * Hide the overlay.\n */\n hide(): void {\n if (!this.isOpen) {\n return;\n }\n\n if (this.showDelayTimeout) {\n clearTimeout(this.showDelayTimeout);\n this.showDelayTimeout = null;\n }\n\n this.hideDelayTimeout = window.setTimeout(() => this.destroyOverlay(), this.hideDelay);\n }\n\n /**\n * Register the overlay.\n * @param overlay The overlay to register.\n * @internal\n */\n registerOverlay(overlay: OverlayDirective): void {\n this.overlay = overlay;\n }\n\n /**\n * Unregister the overlay.\n * @internal\n */\n unregisterOverlay(): void {\n this.overlay = null;\n }\n\n /**\n * Register the arrow.\n * @param arrow The arrow to register.\n * @internal\n */\n registerArrow(arrow: OverlayArrowDirective): void {\n this.arrow = arrow;\n }\n\n /**\n * Unregister the arrow.\n * @internal\n */\n unregisterArrow(): void {\n this.arrow = null;\n }\n\n /**\n * Register a provider on the overlay.\n * @param provider The provider to register.\n * @internal\n */\n registerProvider(provider: StaticProvider): void {\n this.providers.push(provider);\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nimport type { OverlayDirective } from './overlay.directive';\n\nexport const OverlayToken = new InjectionToken<OverlayDirective>('OverlayToken');\n","import { Directive, ElementRef, inject, OnDestroy, OnInit } from '@angular/core';\n\nimport { injectOverlayTrigger } from './overlay-trigger.token';\nimport { OverlayToken } from './overlay.token';\n\n@Directive({\n selector: '[rdxOverlay]',\n standalone: true,\n providers: [{ provide: OverlayToken, useExisting: OverlayDirective }]\n})\nexport class OverlayDirective implements OnInit, OnDestroy {\n /**\n * Access the overlay element\n */\n private readonly elementRef = inject(ElementRef<HTMLElement>);\n\n /**\n * Access the overlay trigger\n */\n private readonly overlayTrigger = injectOverlayTrigger();\n\n /**\n * Register the overlay on init\n */\n ngOnInit(): void {\n this.overlayTrigger.registerOverlay(this);\n }\n\n /**\n * Unregister the overlay on destroy\n */\n ngOnDestroy(): void {\n this.overlayTrigger.unregisterOverlay();\n }\n\n /**\n * Set the position of the overlay\n * @param x The x position\n * @param y The y position\n * @internal\n */\n setPosition(x?: number, y?: number): void {\n Object.assign(this.elementRef.nativeElement.style, {\n left: `${x}px`,\n top: `${y}px`\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAIO,MAAM,iBAAiB,GAAG,IAAI,cAAc,CAAwB,mBAAmB,CAAC;;MCAlF,mBAAmB,GAAG,IAAI,cAAc,CACjD,qBAAqB,EACvB;AAEF;;AAEG;SACa,oBAAoB,GAAA;AAChC,IAAA,OAAO,MAAM,CAAC,mBAAmB,CAAC,CAAC;AACvC;;MCDa,qBAAqB,CAAA;AALlC,IAAA,WAAA,GAAA;AAMI;;AAEG;AACM,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,EAAC,UAAuB,EAAC,CAAC;AAEtD;;AAEG;QACc,IAAc,CAAA,cAAA,GAAG,oBAAoB,EAAE,CAAC;AAqC5D,KAAA;AAn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CQ,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;kGAAhB,gBAAgB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,SAAA,EAFd,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAE5D,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAL5B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,cAAc;AACxB,oBAAA,UAAU,EAAE,IAAI;oBAChB,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAkB,gBAAA,EAAE,CAAC;AACxE,iBAAA,CAAA;;;ACTD;;AAEG;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-progress.mjs","sources":["../../../packages/primitives/progress/src/progress.token.ts","../../../packages/primitives/progress/src/progress-indicator.directive.ts","../../../packages/primitives/progress/src/progress.directive.ts","../../../packages/primitives/progress/radix-ng-primitives-progress.ts"],"sourcesContent":["import {
|
1
|
+
{"version":3,"file":"radix-ng-primitives-progress.mjs","sources":["../../../packages/primitives/progress/src/progress.token.ts","../../../packages/primitives/progress/src/progress-indicator.directive.ts","../../../packages/primitives/progress/src/progress.directive.ts","../../../packages/primitives/progress/radix-ng-primitives-progress.ts"],"sourcesContent":["import { inject, InjectionToken } from '@angular/core';\n\nimport type { ProgressDirective } from './progress.directive';\n\nexport const ProgressToken = new InjectionToken<ProgressDirective>('ProgressDirective');\n\nexport function injectProgress(): ProgressDirective {\n return inject(ProgressToken);\n}\n","import { Directive } from '@angular/core';\n\nimport { injectProgress } from './progress.token';\n\n@Directive({\n selector: '[rdxProgressIndicator]',\n standalone: true,\n host: {\n '[attr.data-state]': 'progress.state',\n '[attr.data-value]': 'progress.value',\n '[attr.data-max]': 'progress.max'\n }\n})\nexport class ProgressIndicatorDirective {\n protected readonly progress = injectProgress();\n}\n","import { Directive, Input, numberAttribute } from '@angular/core';\n\nimport { ProgressToken } from './progress.token';\n\n@Directive({\n selector: '[rdxProgress]',\n standalone: true,\n providers: [{ provide: ProgressToken, useExisting: ProgressDirective }],\n host: {\n role: 'progressbar',\n '[attr.aria-valuemax]': 'max',\n '[attr.aria-valuemin]': '0',\n '[attr.aria-valuenow]': 'value',\n '[attr.aria-valuetext]': 'valueLabel(value, max)',\n '[attr.data-state]': 'state',\n '[attr.data-value]': 'value',\n '[attr.data-max]': 'max'\n }\n})\nexport class ProgressDirective {\n /**\n * Define the progress value.\n */\n @Input({ alias: 'rdxProgressValue', transform: numberAttribute }) value = 0;\n\n /**\n * Define the progress max value.\n * @default 100\n */\n @Input({ alias: 'rdxProgressMax', transform: numberAttribute }) max = 100;\n\n /**\n * Define a function that returns the progress value label.\n */\n @Input('rdxProgressValueLabel') valueLabel: (value: number, max: number) => string = (\n value,\n max\n ) => `${Math.round((value / max) * 100)}%`;\n\n /**\n * Get the state of the progress bar.\n * @returns 'indeterminate' | 'loading' | 'complete'\n * @internal\n */\n get state(): 'indeterminate' | 'loading' | 'complete' {\n return this.value == null\n ? 'indeterminate'\n : this.value === this.max\n ? 'complete'\n : 'loading';\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAIO,MAAM,aAAa,GAAG,IAAI,cAAc,CAAoB,mBAAmB,CAAC,CAAC;SAExE,cAAc,GAAA;AAC1B,IAAA,OAAO,MAAM,CAAC,aAAa,CAAC,CAAC;AACjC;;MCKa,0BAA0B,CAAA;AATvC,IAAA,WAAA,GAAA;QAUuB,IAAQ,CAAA,QAAA,GAAG,cAAc,EAAE,CAAC;AAClD,KAAA;8GAFY,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,E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A;sBAAlE,KAAK;AAAC,gBAAA,IAAA,EAAA,CAAA,EAAE,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,eAAe,EAAE,CAAA;gBAK9B,UAAU,EAAA,CAAA;sBAAzC,KAAK;uBAAC,uBAAuB,CAAA;;;AClClC;;AAEG;;;;"}
|
@@ -115,6 +115,32 @@ function injectRadioItem() {
|
|
115
115
|
return inject(RadioItemToken);
|
116
116
|
}
|
117
117
|
|
118
|
+
class RadioIndicatorDirective {
|
119
|
+
constructor() {
|
120
|
+
/**
|
121
|
+
* Access the radio group.
|
122
|
+
*/
|
123
|
+
this.radioGroup = injectRadioGroup();
|
124
|
+
/**
|
125
|
+
* Access the radio group item.
|
126
|
+
*/
|
127
|
+
this.radioItem = injectRadioItem();
|
128
|
+
}
|
129
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RadioIndicatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
130
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.3", type: RadioIndicatorDirective, isStandalone: true, selector: "[rdxRadioIndicator]", host: { properties: { "attr.data-state": "radioGroup.value === this.radioItem.value ? \"checked\" : \"unchecked\"", "attr.data-disabled": "radioItem.disabled ? \"\" : null" } }, ngImport: i0 }); }
|
131
|
+
}
|
132
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RadioIndicatorDirective, decorators: [{
|
133
|
+
type: Directive,
|
134
|
+
args: [{
|
135
|
+
selector: '[rdxRadioIndicator]',
|
136
|
+
standalone: true,
|
137
|
+
host: {
|
138
|
+
'[attr.data-state]': 'radioGroup.value === this.radioItem.value ? "checked" : "unchecked"',
|
139
|
+
'[attr.data-disabled]': 'radioItem.disabled ? "" : null'
|
140
|
+
}
|
141
|
+
}]
|
142
|
+
}] });
|
143
|
+
|
118
144
|
class RadioItemDirective {
|
119
145
|
constructor() {
|
120
146
|
/**
|
@@ -187,32 +213,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImpor
|
|
187
213
|
args: ['click']
|
188
214
|
}] } });
|
189
215
|
|
190
|
-
class RadioIndicatorDirective {
|
191
|
-
constructor() {
|
192
|
-
/**
|
193
|
-
* Access the radio group.
|
194
|
-
*/
|
195
|
-
this.radioGroup = injectRadioGroup();
|
196
|
-
/**
|
197
|
-
* Access the radio group item.
|
198
|
-
*/
|
199
|
-
this.radioItem = injectRadioItem();
|
200
|
-
}
|
201
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RadioIndicatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
202
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.3", type: RadioIndicatorDirective, isStandalone: true, selector: "[rdxRadioIndicator]", host: { properties: { "attr.data-state": "radioGroup.value === this.radioItem.value ? \"checked\" : \"unchecked\"", "attr.data-disabled": "radioItem.disabled ? \"\" : null" } }, ngImport: i0 }); }
|
203
|
-
}
|
204
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.3", ngImport: i0, type: RadioIndicatorDirective, decorators: [{
|
205
|
-
type: Directive,
|
206
|
-
args: [{
|
207
|
-
selector: '[rdxRadioIndicator]',
|
208
|
-
standalone: true,
|
209
|
-
host: {
|
210
|
-
'[attr.data-state]': 'radioGroup.value === this.radioItem.value ? "checked" : "unchecked"',
|
211
|
-
'[attr.data-disabled]': 'radioItem.disabled ? "" : null'
|
212
|
-
}
|
213
|
-
}]
|
214
|
-
}] });
|
215
|
-
|
216
216
|
/**
|
217
217
|
* Generated bundle index. Do not edit.
|
218
218
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"radix-ng-primitives-radio.mjs","sources":["../../../packages/primitives/radio/src/radio-group.token.ts","../../../packages/primitives/radio/src/radio-group.directive.ts","../../../packages/primitives/radio/src/radio-item.token.ts","../../../packages/primitives/radio/src/radio-item.directive.ts","../../../packages/primitives/radio/src/radio-indicator.directive.ts","../../../packages/primitives/radio/radix-ng-primitives-radio.ts"],"sourcesContent":["import { InjectionToken, inject } from '@angular/core';\nimport type { RadioGroupDirective } from './radio-group.directive';\n\nexport const RadioGroupToken = new InjectionToken<RadioGroupDirective>('RadioGroupToken');\n\nexport function injectRadioGroup(): RadioGroupDirective {\n return inject(RadioGroupToken);\n}\n","import {\n Directive,\n EventEmitter,\n HostListener,\n Input,\n Output,\n booleanAttribute\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { RovingFocusGroupDirective } from '@radix-ng/primitives/roving-focus';\nimport { RadioGroupToken } from './radio-group.token';\n\n@Directive({\n selector: '[rdxRadioGroup]',\n standalone: true,\n providers: [\n { provide: RadioGroupToken, useExisting: RadioGroupDirective },\n { provide: NG_VALUE_ACCESSOR, useExisting: RadioGroupDirective, multi: true }\n ],\n hostDirectives: [RovingFocusGroupDirective],\n host: {\n role: 'radiogroup',\n '[attr.aria-orientation]': 'orientation',\n '[attr.data-disabled]': 'disabled ? \"\" : null'\n }\n})\nexport class RadioGroupDirective implements ControlValueAccessor {\n /**\n * The value of the radio group.\n */\n @Input('rdxRadioGroupValue') value?: string;\n\n /**\n * Whether the radio group is disabled.\n */\n @Input({\n alias: 'rdxRadioGroupDisabled',\n transform: booleanAttribute\n })\n disabled = false;\n\n /**\n * The orientation of the radio group.\n * @default 'horizontal'\n */\n @Input('rdxRadioGroupOrientation') orientation: 'horizontal' | 'vertical' = 'horizontal';\n\n /**\n * Event emitted when the value of the radio group changes.\n */\n @Output('rdxRadioGroupValueChange') readonly valueChange = new EventEmitter<string>();\n\n /**\n * The callback function to call when the value of the radio group changes.\n * @internal\n */\n private onChange?: (value: string) => void;\n\n /**\n * The callback function to call when the radio group is touched.\n * @internal\n */\n private onTouched?: () => void;\n\n /**\n * Select a radio item.\n * @param value The value of the radio item to select.\n */\n select(value: string): void {\n this.value = value;\n this.valueChange.emit(value);\n this.onChange?.(value);\n }\n\n /**\n * Update the value of the radio group.\n * @param value The new value of the radio group.\n * @internal\n */\n writeValue(value: string): void {\n this.value = value;\n }\n\n /**\n * Register a callback function to call when the value of the radio group changes.\n * @param fn The callback function to call when the value of the radio group changes.\n * @internal\n */\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /**\n * Set the disabled state of the radio group.\n * @param isDisabled Whether the radio group is disabled.\n * @internal\n */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n /**\n * When focus leaves the radio group, mark it as touched.\n * @internal\n */\n @HostListener('focusout')\n protected onFocusout(): void {\n this.onTouched?.();\n }\n}\n","import { InjectionToken, inject } from '@angular/core';\nimport type { RadioItemDirective } from './radio-item.directive';\n\nexport const RadioItemToken = new InjectionToken<RadioItemDirective>('RadioItemToken');\n\nexport function injectRadioItem(): RadioItemDirective {\n return inject(RadioItemToken);\n}\n","import { Directive, HostListener, Input, booleanAttribute } from '@angular/core';\nimport { injectRadioGroup } from './radio-group.token';\nimport { RadioItemToken } from './radio-item.token';\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { RovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';\n\n@Directive({\n selector: 'button[rdxRadioItem]',\n standalone: true,\n hostDirectives: [RovingFocusItemDirective],\n providers: [{ provide: RadioItemToken, useExisting: RadioItemDirective }],\n host: {\n type: 'button',\n role: 'radio',\n '[attr.aria-checked]': 'radioGroup.value === value ? \"true\" : \"false\"',\n '[attr.data-disabled]': 'disabled ? \"\" : null',\n '[attr.data-state]': 'radioGroup.value === value ? \"checked\" : \"unchecked\"'\n }\n})\nexport class RadioItemDirective {\n /**\n * Access the radio group.\n */\n protected readonly radioGroup = injectRadioGroup();\n\n /**\n * The value of the radio item.\n */\n @Input({ required: true }) value!: string;\n\n /**\n * Whether the radio item is disabled.\n * @default false\n */\n @Input({ transform: booleanAttribute }) disabled = false;\n\n /**\n * Handle keydown events.\n * @param event The keydown event.\n * @internal\n */\n @HostListener('keydown', ['$event'])\n protected onKeydown(event: KeyboardEvent): void {\n // According to WAI ARIA, radio groups don't activate items on enter keypress\n if (event.key === 'Enter') {\n event.preventDefault();\n }\n }\n\n /**\n * When the item receives focus, select it.\n * @internal\n */\n @HostListener('focus')\n protected onFocus(): void {\n this.radioGroup.select(this.value);\n }\n\n /**\n * When the item receives a click, select it.\n * @internal\n */\n @HostListener('click')\n protected onClick(): void {\n this.radioGroup.select(this.value);\n }\n}\n","import { Directive } from '@angular/core';\nimport { injectRadioGroup } from './radio-group.token';\nimport { injectRadioItem } from './radio-item.token';\n\n@Directive({\n selector: '[rdxRadioIndicator]',\n standalone: true,\n host: {\n '[attr.data-state]': 'radioGroup.value === this.radioItem.value ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'radioItem.disabled ? \"\" : null'\n }\n})\nexport class RadioIndicatorDirective {\n /**\n * Access the radio group.\n */\n protected readonly radioGroup = injectRadioGroup();\n\n /**\n * Access the radio group item.\n */\n protected readonly radioItem = injectRadioItem();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAGa,eAAe,GAAG,IAAI,cAAc,CAAsB,iBAAiB,EAAE;SAE1E,gBAAgB,GAAA;AAC5B,IAAA,OAAO,MAAM,CAAC,eAAe,CAAC,CAAC;AACnC;;MCoBa,mBAAmB,CAAA;AAdhC,IAAA,WAAA,GAAA;AAoBI;;AAEG;QAKH,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;AAEjB;;;AAGG;QACgC,IAAW,CAAA,WAAA,GAA8B,YAAY,CAAC;AAEzF;;AAEG;AAC0C,QAAA,IAAA,CAAA,WAAW,GAA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BAQ5B,SAAS,EAAA,CAAA;sBADlB,YAAY;uBAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,CAAA;gBAazB,OAAO,EAAA,CAAA;sBADhB,YAAY;uBAAC,OAAO,CAAA;gBAUX,OAAO,EAAA,CAAA;sBADhB,YAAY;uBAAC,OAAO,CAAA;;;MClDZ,uBAAuB,CAAA;AARpC,IAAA,WAAA,GAAA;AASI;;AAEG;QACgB,IAAU,CAAA,UAAA,GAAG,gBAAgB,EAAE,CAAC;AAEnD;;AAEG;QACgB,IAAS,CAAA,SAAA,GAAG,eAAe,EAAE,CAAC;AACpD,KAAA;8GAVY,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;kGAAvB,uBAAuB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,qBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,yEAAA,EAAA,oBAAA,EAAA,kCAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBARnC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,qBAAqB;AAC/B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,mBAAmB,EAAE,qEAAqE;AAC1F,wBAAA,sBAAsB,EAAE,gCAAgC;AAC3D,qBAAA;AACJ,iBAAA,CAAA;;;ACXD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"radix-ng-primitives-radio.mjs","sources":["../../../packages/primitives/radio/src/radio-group.token.ts","../../../packages/primitives/radio/src/radio-group.directive.ts","../../../packages/primitives/radio/src/radio-item.token.ts","../../../packages/primitives/radio/src/radio-indicator.directive.ts","../../../packages/primitives/radio/src/radio-item.directive.ts","../../../packages/primitives/radio/radix-ng-primitives-radio.ts"],"sourcesContent":["import { inject, InjectionToken } from '@angular/core';\n\nimport type { RadioGroupDirective } from './radio-group.directive';\n\nexport const RadioGroupToken = new InjectionToken<RadioGroupDirective>('RadioGroupToken');\n\nexport function injectRadioGroup(): RadioGroupDirective {\n return inject(RadioGroupToken);\n}\n","import {\n booleanAttribute,\n Directive,\n EventEmitter,\n HostListener,\n Input,\n Output\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { RovingFocusGroupDirective } from '@radix-ng/primitives/roving-focus';\n\nimport { RadioGroupToken } from './radio-group.token';\n\n@Directive({\n selector: '[rdxRadioGroup]',\n standalone: true,\n providers: [\n { provide: RadioGroupToken, useExisting: RadioGroupDirective },\n { provide: NG_VALUE_ACCESSOR, useExisting: RadioGroupDirective, multi: true }\n ],\n hostDirectives: [RovingFocusGroupDirective],\n host: {\n role: 'radiogroup',\n '[attr.aria-orientation]': 'orientation',\n '[attr.data-disabled]': 'disabled ? \"\" : null'\n }\n})\nexport class RadioGroupDirective implements ControlValueAccessor {\n /**\n * The value of the radio group.\n */\n @Input('rdxRadioGroupValue') value?: string;\n\n /**\n * Whether the radio group is disabled.\n */\n @Input({\n alias: 'rdxRadioGroupDisabled',\n transform: booleanAttribute\n })\n disabled = false;\n\n /**\n * The orientation of the radio group.\n * @default 'horizontal'\n */\n @Input('rdxRadioGroupOrientation') orientation: 'horizontal' | 'vertical' = 'horizontal';\n\n /**\n * Event emitted when the value of the radio group changes.\n */\n @Output('rdxRadioGroupValueChange') readonly valueChange = new EventEmitter<string>();\n\n /**\n * The callback function to call when the value of the radio group changes.\n * @internal\n */\n private onChange?: (value: string) => void;\n\n /**\n * The callback function to call when the radio group is touched.\n * @internal\n */\n private onTouched?: () => void;\n\n /**\n * Select a radio item.\n * @param value The value of the radio item to select.\n */\n select(value: string): void {\n this.value = value;\n this.valueChange.emit(value);\n this.onChange?.(value);\n }\n\n /**\n * Update the value of the radio group.\n * @param value The new value of the radio group.\n * @internal\n */\n writeValue(value: string): void {\n this.value = value;\n }\n\n /**\n * Register a callback function to call when the value of the radio group changes.\n * @param fn The callback function to call when the value of the radio group changes.\n * @internal\n */\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n /**\n * Set the disabled state of the radio group.\n * @param isDisabled Whether the radio group is disabled.\n * @internal\n */\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n /**\n * When focus leaves the radio group, mark it as touched.\n * @internal\n */\n @HostListener('focusout')\n protected onFocusout(): void {\n this.onTouched?.();\n }\n}\n","import { inject, InjectionToken } from '@angular/core';\n\nimport type { RadioItemDirective } from './radio-item.directive';\n\nexport const RadioItemToken = new InjectionToken<RadioItemDirective>('RadioItemToken');\n\nexport function injectRadioItem(): RadioItemDirective {\n return inject(RadioItemToken);\n}\n","import { Directive } from '@angular/core';\n\nimport { injectRadioGroup } from './radio-group.token';\nimport { injectRadioItem } from './radio-item.token';\n\n@Directive({\n selector: '[rdxRadioIndicator]',\n standalone: true,\n host: {\n '[attr.data-state]': 'radioGroup.value === this.radioItem.value ? \"checked\" : \"unchecked\"',\n '[attr.data-disabled]': 'radioItem.disabled ? \"\" : null'\n }\n})\nexport class RadioIndicatorDirective {\n /**\n * Access the radio group.\n */\n protected readonly radioGroup = injectRadioGroup();\n\n /**\n * Access the radio group item.\n */\n protected readonly radioItem = injectRadioItem();\n}\n","import { booleanAttribute, Directive, HostListener, Input } from '@angular/core';\n\n// eslint-disable-next-line @nx/enforce-module-boundaries\nimport { RovingFocusItemDirective } from '@radix-ng/primitives/roving-focus';\n\nimport { injectRadioGroup } from './radio-group.token';\nimport { RadioItemToken } from './radio-item.token';\n\n@Directive({\n selector: 'button[rdxRadioItem]',\n standalone: true,\n hostDirectives: [RovingFocusItemDirective],\n providers: [{ provide: RadioItemToken, useExisting: RadioItemDirective }],\n host: {\n type: 'button',\n role: 'radio',\n '[attr.aria-checked]': 'radioGroup.value === value ? \"true\" : \"false\"',\n '[attr.data-disabled]': 'disabled ? \"\" : null',\n '[attr.data-state]': 'radioGroup.value === value ? \"checked\" : \"unchecked\"'\n }\n})\nexport class RadioItemDirective {\n /**\n * Access the radio group.\n */\n protected readonly radioGroup = injectRadioGroup();\n\n /**\n * The value of the radio item.\n */\n @Input({ required: true }) value!: string;\n\n /**\n * Whether the radio item is disabled.\n * @default false\n */\n @Input({ transform: booleanAttribute }) disabled = false;\n\n /**\n * Handle keydown events.\n * @param event The keydown event.\n * @internal\n */\n @HostListener('keydown', ['$event'])\n protected onKeydown(event: KeyboardEvent): void {\n // According to WAI ARIA, radio groups don't activate items on enter keypress\n if (event.key === 'Enter') {\n event.preventDefault();\n }\n }\n\n /**\n * When the item receives focus, select it.\n * @internal\n */\n @HostListener('focus')\n protected onFocus(): void {\n this.radioGroup.select(this.value);\n }\n\n /**\n * When the item receives a click, select it.\n * @internal\n */\n @HostListener('click')\n protected onClick(): void {\n this.radioGroup.select(this.value);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAIa,eAAe,GAAG,IAAI,cAAc,CAAsB,iBAAiB,EAAE;SAE1E,gBAAgB,GAAA;AAC5B,IAAA,OAAO,MAAM,CAAC,eAAe,CAAC,CAAC;AACnC;;MCqBa,mBAAmB,CAAA;AAdhC,IAAA,WAAA,GAAA;AAoBI;;AAEG;QAKH,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;AAEjB;;;AAGG;QACgC,IAAW,CAAA,WAAA,GAA8B,YAAY,CAAC;AAEzF;;AAEG;AAC0C,QAAA,IAAA,CAAA,WAAW,GAAG,IAAI,YAAY,EAAU,CAAC;AA+DzF,KAAA;AAjDG;;;AAGG;AACH,IAAA,MAAM,CAAC,KAAa,EAAA;AAChB,QAAA,IAAI,CAAC,KAAK,GAAG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