ng-primitives 0.34.0 → 0.36.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/a11y/index.d.ts +1 -1
- package/a11y/visually-hidden/visually-hidden-state.d.ts +52 -0
- package/a11y/visually-hidden/visually-hidden.d.ts +1 -0
- package/accordion/accordion/accordion-state.d.ts +1 -1
- package/accordion/accordion-item/accordion-item-state.d.ts +1 -1
- package/avatar/avatar/avatar-state.d.ts +1 -1
- package/avatar/avatar-image/avatar-image.d.ts +36 -1
- package/button/button/button-state.d.ts +12 -2
- package/button/button/button.d.ts +1 -2
- package/button/index.d.ts +1 -1
- package/checkbox/checkbox/checkbox-state.d.ts +1 -1
- package/checkbox/checkbox/checkbox.d.ts +3 -4
- package/date-picker/date-picker/date-picker-state.d.ts +1 -1
- package/date-picker/date-picker-date-button/date-picker-date-button.d.ts +1 -2
- package/date-picker/date-picker-next-month/date-picker-next-month.d.ts +2 -2
- package/date-picker/date-picker-previous-month/date-picker-previous-month.d.ts +2 -2
- package/date-picker/index.d.ts +5 -9
- package/dialog/dialog/dialog-state.d.ts +1 -1
- package/dialog/index.d.ts +0 -4
- package/fesm2022/ng-primitives-a11y.mjs +20 -9
- package/fesm2022/ng-primitives-a11y.mjs.map +1 -1
- package/fesm2022/ng-primitives-avatar.mjs +3 -3
- package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
- package/fesm2022/ng-primitives-button.mjs +18 -5
- package/fesm2022/ng-primitives-button.mjs.map +1 -1
- package/fesm2022/ng-primitives-checkbox.mjs +13 -8
- package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/ng-primitives-date-picker.mjs +13 -65
- package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
- package/fesm2022/ng-primitives-dialog.mjs +5 -41
- package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/ng-primitives-file-upload.mjs +12 -5
- package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
- package/fesm2022/ng-primitives-focus-trap.mjs +3 -12
- package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -1
- package/fesm2022/ng-primitives-form-field.mjs +103 -93
- package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
- package/fesm2022/ng-primitives-input.mjs +34 -21
- package/fesm2022/ng-primitives-input.mjs.map +1 -1
- package/fesm2022/ng-primitives-interactions.mjs +14 -80
- package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
- package/fesm2022/ng-primitives-internal.mjs +93 -65
- package/fesm2022/ng-primitives-internal.mjs.map +1 -1
- package/fesm2022/ng-primitives-listbox.mjs +19 -48
- package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
- package/fesm2022/ng-primitives-menu.mjs +1 -5
- package/fesm2022/ng-primitives-menu.mjs.map +1 -1
- package/fesm2022/ng-primitives-pagination.mjs +53 -147
- package/fesm2022/ng-primitives-pagination.mjs.map +1 -1
- package/fesm2022/ng-primitives-popover.mjs +105 -96
- package/fesm2022/ng-primitives-popover.mjs.map +1 -1
- package/fesm2022/ng-primitives-progress.mjs +4 -18
- package/fesm2022/ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/ng-primitives-radio.mjs +9 -5
- package/fesm2022/ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/ng-primitives-roving-focus.mjs +2 -12
- package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
- package/fesm2022/ng-primitives-select.mjs +35 -21
- package/fesm2022/ng-primitives-select.mjs.map +1 -1
- package/fesm2022/ng-primitives-separator.mjs +2 -11
- package/fesm2022/ng-primitives-separator.mjs.map +1 -1
- package/fesm2022/ng-primitives-slider.mjs +62 -120
- package/fesm2022/ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/ng-primitives-state.mjs +10 -3
- package/fesm2022/ng-primitives-state.mjs.map +1 -1
- package/fesm2022/ng-primitives-switch.mjs +22 -35
- package/fesm2022/ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/ng-primitives-tabs.mjs +17 -22
- package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/ng-primitives-textarea.mjs +34 -21
- package/fesm2022/ng-primitives-textarea.mjs.map +1 -1
- package/fesm2022/ng-primitives-toast.mjs +27 -16
- package/fesm2022/ng-primitives-toast.mjs.map +1 -1
- package/fesm2022/ng-primitives-toggle-group.mjs +26 -49
- package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/ng-primitives-toggle.mjs +4 -18
- package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
- package/fesm2022/ng-primitives-toolbar.mjs +3 -18
- package/fesm2022/ng-primitives-toolbar.mjs.map +1 -1
- package/fesm2022/ng-primitives-tooltip.mjs +103 -82
- package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
- package/fesm2022/ng-primitives-utils.mjs +18 -0
- package/fesm2022/ng-primitives-utils.mjs.map +1 -1
- package/file-upload/file-dropzone/file-dropzone-state.d.ts +2 -2
- package/file-upload/file-dropzone/file-dropzone.d.ts +3 -2
- package/file-upload/file-upload/file-upload-state.d.ts +2 -2
- package/file-upload/file-upload/file-upload.d.ts +3 -2
- package/focus-trap/index.d.ts +0 -1
- package/form-field/description/description.d.ts +25 -1
- package/form-field/error/error.d.ts +25 -1
- package/form-field/form-control/form-control-state.d.ts +58 -0
- package/form-field/form-control/form-control.d.ts +36 -7
- package/form-field/form-field/form-field-state.d.ts +41 -0
- package/form-field/form-field/form-field.d.ts +4 -0
- package/form-field/index.d.ts +2 -5
- package/form-field/label/label.d.ts +26 -2
- package/input/index.d.ts +1 -1
- package/input/input/input-state.d.ts +30 -0
- package/input/input/input.d.ts +7 -5
- package/interactions/focus/focus.d.ts +0 -4
- package/interactions/focus-visible/focus-visible.d.ts +0 -4
- package/interactions/hover/hover.d.ts +0 -4
- package/interactions/index.d.ts +0 -5
- package/interactions/move/move.d.ts +0 -4
- package/interactions/press/press.d.ts +0 -4
- package/internal/exit-animation/exit-animation-manager.d.ts +17 -0
- package/internal/exit-animation/exit-animation.d.ts +4 -17
- package/internal/index.d.ts +3 -2
- package/internal/interactions/interactions.d.ts +5 -1
- package/internal/signals/sync-state.d.ts +2 -0
- package/listbox/index.d.ts +0 -4
- package/listbox/listbox/listbox-state.d.ts +2 -2
- package/package.json +9 -9
- package/pagination/index.d.ts +0 -6
- package/pagination/pagination/pagination-state.d.ts +2 -2
- package/pagination/pagination/pagination.d.ts +5 -5
- package/pagination/pagination-button/pagination-button.d.ts +4 -8
- package/pagination/pagination-first/pagination-first.d.ts +4 -8
- package/pagination/pagination-last/pagination-last.d.ts +3 -7
- package/pagination/pagination-next/pagination-next.d.ts +4 -8
- package/pagination/pagination-previous/pagination-previous.d.ts +4 -8
- package/popover/index.d.ts +1 -2
- package/popover/popover/popover-token.d.ts +8 -5
- package/popover/popover/popover.d.ts +3 -2
- package/popover/popover-trigger/popover-trigger-state.d.ts +5 -3
- package/popover/popover-trigger/popover-trigger.d.ts +27 -19
- package/progress/index.d.ts +0 -1
- package/progress/progress/progress-state.d.ts +1 -1
- package/radio/radio-group/radio-group-state.d.ts +1 -1
- package/radio/radio-group/radio-group.d.ts +2 -2
- package/radio/radio-item/radio-item-state.d.ts +1 -1
- package/roving-focus/index.d.ts +2 -3
- package/roving-focus/roving-focus-group/roving-focus-group-state.d.ts +1 -1
- package/schematics/ng-generate/schema.d.ts +4 -1
- package/schematics/ng-generate/schema.json +4 -1
- package/schematics/ng-generate/templates/toast/toast.__fileSuffix@dasherize__.ts.template +111 -0
- package/schematics/ng-generate/templates/toolbar/toolbar-button.__fileSuffix@dasherize__.ts.template +58 -0
- package/schematics/ng-generate/templates/toolbar/toolbar.__fileSuffix@dasherize__.ts.template +29 -0
- package/schematics/ng-generate/templates/tooltip/tooltip-trigger.__fileSuffix@dasherize__.ts.template +35 -0
- package/schematics/ng-generate/templates/tooltip/tooltip.__fileSuffix@dasherize__.ts.template +60 -0
- package/search/search/search-state.d.ts +1 -1
- package/select/index.d.ts +1 -1
- package/select/select/select-state.d.ts +20 -0
- package/select/select/select.d.ts +7 -4
- package/separator/index.d.ts +1 -2
- package/slider/index.d.ts +0 -4
- package/slider/slider/slider-state.d.ts +1 -1
- package/slider/slider/slider.d.ts +2 -2
- package/slider/slider-range/slider-range.d.ts +1 -1
- package/slider/slider-thumb/slider-thumb.d.ts +3 -7
- package/slider/slider-track/slider-track.d.ts +1 -5
- package/state/index.d.ts +7 -1
- package/switch/index.d.ts +0 -1
- package/switch/switch/switch-state.d.ts +1 -1
- package/switch/switch/switch.d.ts +3 -4
- package/switch/switch-thumb/switch-thumb.d.ts +2 -2
- package/tabs/index.d.ts +1 -2
- package/tabs/tab-button/tab-button.d.ts +2 -2
- package/tabs/tabset/tabset-state.d.ts +1 -1
- package/textarea/index.d.ts +1 -1
- package/textarea/textarea/textarea-state.d.ts +20 -0
- package/textarea/textarea/textarea.d.ts +7 -4
- package/toast/index.d.ts +0 -1
- package/toast/toast/toast.d.ts +21 -1
- package/toggle/index.d.ts +0 -1
- package/toggle/toggle/toggle-state.d.ts +1 -1
- package/toggle-group/index.d.ts +0 -2
- package/toggle-group/toggle-group/toggle-group-state.d.ts +1 -1
- package/toggle-group/toggle-group-item/toggle-group-item-state.d.ts +15 -2
- package/toggle-group/toggle-group-item/toggle-group-item.d.ts +1 -1
- package/toolbar/index.d.ts +0 -1
- package/tooltip/index.d.ts +1 -2
- package/tooltip/tooltip/tooltip-token.d.ts +8 -5
- package/tooltip/tooltip/tooltip.d.ts +2 -1
- package/tooltip/tooltip-trigger/tooltip-trigger-state.d.ts +3 -3
- package/tooltip/tooltip-trigger/tooltip-trigger.d.ts +43 -22
- package/a11y/visually-hidden/visually-hidden-token.d.ts +0 -7
- package/date-picker/date-picker-cell/date-picker-cell-token.d.ts +0 -7
- package/date-picker/date-picker-grid/date-picker-grid-token.d.ts +0 -7
- package/date-picker/date-picker-next-month/date-picker-next-month-token.d.ts +0 -7
- package/date-picker/date-picker-previous-month/date-picker-previous-month-token.d.ts +0 -7
- package/dialog/dialog-description/dialog-description-token.d.ts +0 -7
- package/dialog/dialog-overlay/dialog-overlay-token.d.ts +0 -7
- package/dialog/dialog-title/dialog-title-token.d.ts +0 -7
- package/dialog/dialog-trigger/dialog-trigger-token.d.ts +0 -7
- package/focus-trap/focus-trap/focus-trap-token.d.ts +0 -7
- package/form-field/description/description-token.d.ts +0 -7
- package/form-field/error/error-token.d.ts +0 -7
- package/form-field/form-control/form-control-token.d.ts +0 -7
- package/form-field/form-field/form-field-token.d.ts +0 -8
- package/form-field/label/label-token.d.ts +0 -7
- package/input/input/input-token.d.ts +0 -7
- package/interactions/focus/focus-token.d.ts +0 -7
- package/interactions/focus-visible/focus-visible-token.d.ts +0 -7
- package/interactions/hover/hover-token.d.ts +0 -8
- package/interactions/move/move-token.d.ts +0 -7
- package/interactions/press/press-token.d.ts +0 -7
- package/internal/disabled/disabled.d.ts +0 -14
- package/listbox/listbox/listbox-token.d.ts +0 -7
- package/listbox/listbox-option/listbox-option-token.d.ts +0 -7
- package/listbox/listbox-section/listbox-section-token.d.ts +0 -7
- package/listbox/listbox-trigger/listbox-trigger-token.d.ts +0 -7
- package/pagination/pagination/pagination-token.d.ts +0 -8
- package/pagination/pagination-button/pagination-button-token.d.ts +0 -7
- package/pagination/pagination-first/pagination-first-token.d.ts +0 -7
- package/pagination/pagination-last/pagination-last-token.d.ts +0 -7
- package/pagination/pagination-next/pagination-next-token.d.ts +0 -7
- package/pagination/pagination-previous/pagination-previous-token.d.ts +0 -7
- package/popover/popover-trigger/popover-trigger-token.d.ts +0 -12
- package/progress/progress/progress-token.d.ts +0 -11
- package/roving-focus/roving-focus-item/roving-focus-item-token.d.ts +0 -8
- package/select/select/select-token.d.ts +0 -7
- package/separator/separator/separator-token.d.ts +0 -7
- package/slider/slider/slider-token.d.ts +0 -8
- package/slider/slider-range/slider-range-token.d.ts +0 -8
- package/slider/slider-thumb/slider-thumb-token.d.ts +0 -8
- package/slider/slider-track/slider-track-token.d.ts +0 -8
- package/switch/switch/switch-token.d.ts +0 -11
- package/tabs/tabset/tabset-token.d.ts +0 -11
- package/textarea/textarea/textarea-token.d.ts +0 -7
- package/toast/toast/toast-token.d.ts +0 -7
- package/toggle/toggle/toggle-token.d.ts +0 -11
- package/toggle-group/toggle-group/toggle-group-token.d.ts +0 -11
- package/toggle-group/toggle-group-item/toggle-group-item-token.d.ts +0 -11
- package/toolbar/toolbar/toolbar-token.d.ts +0 -11
- package/tooltip/tooltip-trigger/tooltip-trigger-token.d.ts +0 -15
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { inject, ElementRef, Injectable, Renderer2, Directive, signal, PLATFORM_ID, effect, untracked } from '@angular/core';
|
|
3
3
|
import { injectDisposables, onBooleanChange } from 'ng-primitives/utils';
|
|
4
4
|
import { FocusMonitor } from '@angular/cdk/a11y';
|
|
5
5
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
6
|
import { isPlatformServer, DOCUMENT, isPlatformBrowser } from '@angular/common';
|
|
7
7
|
import { fromResizeEvent } from 'ng-primitives/resize';
|
|
8
8
|
|
|
9
|
-
const NgpDisabledToken = new InjectionToken('NgpDisabledToken');
|
|
10
|
-
/**
|
|
11
|
-
* Determine if we are in a disabled context.
|
|
12
|
-
* @param disabled The disabled signal for the local context.
|
|
13
|
-
* @returns The disabled signal.
|
|
14
|
-
*/
|
|
15
|
-
function injectDisabled(disabled = signal(false)) {
|
|
16
|
-
const provider = inject(NgpDisabledToken, { optional: true, self: true });
|
|
17
|
-
return computed(() => provider?.disabled() || disabled());
|
|
18
|
-
}
|
|
19
|
-
|
|
20
9
|
/**
|
|
21
10
|
* A simple utility function to inject an element reference with less boilerplate.
|
|
22
11
|
* @returns The element reference.
|
|
@@ -25,90 +14,113 @@ function injectElementRef() {
|
|
|
25
14
|
return inject(ElementRef);
|
|
26
15
|
}
|
|
27
16
|
|
|
17
|
+
class NgpExitAnimationManager {
|
|
18
|
+
constructor() {
|
|
19
|
+
/** Store the instances of the exit animation directive. */
|
|
20
|
+
this.instances = [];
|
|
21
|
+
}
|
|
22
|
+
/** Add an instance to the manager. */
|
|
23
|
+
add(instance) {
|
|
24
|
+
this.instances.push(instance);
|
|
25
|
+
}
|
|
26
|
+
/** Remove an instance from the manager. */
|
|
27
|
+
remove(instance) {
|
|
28
|
+
const index = this.instances.indexOf(instance);
|
|
29
|
+
if (index !== -1) {
|
|
30
|
+
this.instances.splice(index, 1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** Exit all instances. */
|
|
34
|
+
exit() {
|
|
35
|
+
return Promise.all(this.instances.map(instance => instance.exit()));
|
|
36
|
+
}
|
|
37
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpExitAnimationManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
38
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpExitAnimationManager }); }
|
|
39
|
+
}
|
|
40
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpExitAnimationManager, decorators: [{
|
|
41
|
+
type: Injectable
|
|
42
|
+
}] });
|
|
43
|
+
function provideExitAnimationManager() {
|
|
44
|
+
return { provide: NgpExitAnimationManager, useClass: NgpExitAnimationManager };
|
|
45
|
+
}
|
|
46
|
+
function injectExitAnimationManager() {
|
|
47
|
+
return inject(NgpExitAnimationManager);
|
|
48
|
+
}
|
|
49
|
+
|
|
28
50
|
class NgpExitAnimation {
|
|
29
51
|
constructor() {
|
|
30
52
|
/** The animation manager. */
|
|
31
|
-
this.animationManager =
|
|
53
|
+
this.animationManager = injectExitAnimationManager();
|
|
32
54
|
/** The element to animate. */
|
|
33
|
-
this.
|
|
34
|
-
/** Access the
|
|
35
|
-
this.
|
|
36
|
-
/** The animation state */
|
|
37
|
-
this.state = signal('enter');
|
|
55
|
+
this.elementRef = injectElementRef();
|
|
56
|
+
/** Access the renderer. */
|
|
57
|
+
this.renderer = inject(Renderer2);
|
|
38
58
|
this.animationManager.add(this);
|
|
59
|
+
this.setAnimationState('enter');
|
|
39
60
|
}
|
|
40
61
|
ngOnDestroy() {
|
|
41
62
|
this.animationManager.remove(this);
|
|
42
63
|
}
|
|
43
64
|
/** Mark the element as exiting. */
|
|
44
65
|
exit() {
|
|
45
|
-
|
|
46
|
-
this.
|
|
66
|
+
// Capture the initial animation name before changing state
|
|
67
|
+
const initialStyle = window.getComputedStyle(this.elementRef.nativeElement);
|
|
68
|
+
const initialAnimationName = initialStyle.animationName;
|
|
69
|
+
const initialTransitionProperty = initialStyle.transitionProperty;
|
|
70
|
+
this.setAnimationState('exit');
|
|
47
71
|
return new Promise(resolve => {
|
|
48
72
|
// check if there are any exit animations or transitions
|
|
49
|
-
const computedStyle = window.getComputedStyle(this.
|
|
73
|
+
const computedStyle = window.getComputedStyle(this.elementRef.nativeElement);
|
|
50
74
|
const hasTransition = parseFloat(computedStyle.transitionDuration) > 0;
|
|
51
75
|
const hasAnimation = parseFloat(computedStyle.animationDuration) > 0;
|
|
52
|
-
|
|
76
|
+
// Compare animation properties to see if they've changed
|
|
77
|
+
const animationChanged = computedStyle.animationName !== initialAnimationName &&
|
|
78
|
+
computedStyle.animationName !== 'none';
|
|
79
|
+
const transitionChanged = computedStyle.transitionProperty !== initialTransitionProperty &&
|
|
80
|
+
computedStyle.transitionProperty !== 'none';
|
|
81
|
+
// If no new animations/transitions, resolve immediately
|
|
82
|
+
if ((!hasTransition && !hasAnimation) || (!animationChanged && !transitionChanged)) {
|
|
53
83
|
resolve();
|
|
54
84
|
return;
|
|
55
85
|
}
|
|
56
86
|
// wait for the exit animation to finish
|
|
57
87
|
const done = (event) => {
|
|
58
88
|
// check if the event is for this element
|
|
59
|
-
if (event.target !== this.
|
|
89
|
+
if (event.target !== this.elementRef.nativeElement) {
|
|
60
90
|
return;
|
|
61
91
|
}
|
|
62
|
-
this.
|
|
63
|
-
this.
|
|
92
|
+
this.elementRef.nativeElement.removeEventListener('transitionend', done);
|
|
93
|
+
this.elementRef.nativeElement.removeEventListener('animationend', done);
|
|
94
|
+
// reset the animation state
|
|
95
|
+
this.setAnimationState(null);
|
|
64
96
|
resolve();
|
|
65
97
|
};
|
|
66
|
-
this.
|
|
67
|
-
this.
|
|
98
|
+
this.elementRef.nativeElement.addEventListener('transitionend', done);
|
|
99
|
+
this.elementRef.nativeElement.addEventListener('animationend', done);
|
|
68
100
|
});
|
|
69
101
|
}
|
|
102
|
+
setAnimationState(state) {
|
|
103
|
+
// remove all current animation state attributes
|
|
104
|
+
this.renderer.removeAttribute(this.elementRef.nativeElement, 'data-enter');
|
|
105
|
+
this.renderer.removeAttribute(this.elementRef.nativeElement, 'data-exit');
|
|
106
|
+
// add the new animation state attribute
|
|
107
|
+
if (state === 'enter') {
|
|
108
|
+
this.renderer.setAttribute(this.elementRef.nativeElement, 'data-enter', '');
|
|
109
|
+
}
|
|
110
|
+
else if (state === 'exit') {
|
|
111
|
+
this.renderer.setAttribute(this.elementRef.nativeElement, 'data-exit', '');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
70
114
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpExitAnimation, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
71
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpExitAnimation, isStandalone: true, selector: "[ngpExitAnimation]",
|
|
115
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpExitAnimation, isStandalone: true, selector: "[ngpExitAnimation]", exportAs: ["ngpExitAnimation"], ngImport: i0 }); }
|
|
72
116
|
}
|
|
73
117
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpExitAnimation, decorators: [{
|
|
74
118
|
type: Directive,
|
|
75
119
|
args: [{
|
|
76
120
|
selector: '[ngpExitAnimation]',
|
|
77
121
|
exportAs: 'ngpExitAnimation',
|
|
78
|
-
host: {
|
|
79
|
-
// Deprecated - use data-exit instead
|
|
80
|
-
'[attr.data-closing]': 'state() === "exit" ? "" : null',
|
|
81
|
-
'[attr.data-exit]': 'state() === "exit" ? "" : null',
|
|
82
|
-
},
|
|
83
122
|
}]
|
|
84
123
|
}], ctorParameters: () => [] });
|
|
85
|
-
class NgpExitAnimationManager {
|
|
86
|
-
constructor() {
|
|
87
|
-
/** Store the instances of the exit animation directive. */
|
|
88
|
-
this.instances = [];
|
|
89
|
-
}
|
|
90
|
-
/** Add an instance to the manager. */
|
|
91
|
-
add(instance) {
|
|
92
|
-
this.instances.push(instance);
|
|
93
|
-
}
|
|
94
|
-
/** Remove an instance from the manager. */
|
|
95
|
-
remove(instance) {
|
|
96
|
-
const index = this.instances.indexOf(instance);
|
|
97
|
-
if (index !== -1) {
|
|
98
|
-
this.instances.splice(index, 1);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
/** Exit all instances. */
|
|
102
|
-
exit() {
|
|
103
|
-
const promises = this.instances.map(instance => instance.exit());
|
|
104
|
-
return Promise.all(promises);
|
|
105
|
-
}
|
|
106
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpExitAnimationManager, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
107
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpExitAnimationManager }); }
|
|
108
|
-
}
|
|
109
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpExitAnimationManager, decorators: [{
|
|
110
|
-
type: Injectable
|
|
111
|
-
}] });
|
|
112
124
|
|
|
113
125
|
function setupFocus({ focus, blur, disabled = signal(false), }) {
|
|
114
126
|
/**
|
|
@@ -508,10 +520,19 @@ function setupPress({ pressStart, pressEnd, disabled = signal(false), }) {
|
|
|
508
520
|
/**
|
|
509
521
|
* Setup the interactions without relying on HostDirectives.
|
|
510
522
|
*/
|
|
511
|
-
function setupInteractions({ disabled = signal(false) }) {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
523
|
+
function setupInteractions({ focus, hover, press, focusVisible, disabled = signal(false), }) {
|
|
524
|
+
if (hover) {
|
|
525
|
+
setupHover({ disabled });
|
|
526
|
+
}
|
|
527
|
+
if (press) {
|
|
528
|
+
setupPress({ disabled });
|
|
529
|
+
}
|
|
530
|
+
if (focus) {
|
|
531
|
+
setupFocus({ disabled });
|
|
532
|
+
}
|
|
533
|
+
if (focusVisible) {
|
|
534
|
+
setupFocusVisible({ disabled });
|
|
535
|
+
}
|
|
515
536
|
}
|
|
516
537
|
|
|
517
538
|
/**
|
|
@@ -531,6 +552,13 @@ function explicitEffect(deps, fn, options) {
|
|
|
531
552
|
}, options);
|
|
532
553
|
}
|
|
533
554
|
|
|
555
|
+
function syncState(source, target) {
|
|
556
|
+
effect(() => {
|
|
557
|
+
const sourceValue = source();
|
|
558
|
+
untracked(() => target.set(sourceValue));
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
|
|
534
562
|
/**
|
|
535
563
|
* A utility service for injecting styles into the document.
|
|
536
564
|
* Angular doesn't allow directives to specify styles, only components.
|
|
@@ -641,5 +669,5 @@ function scrollIntoViewIfNeeded(element) {
|
|
|
641
669
|
* Generated bundle index. Do not edit.
|
|
642
670
|
*/
|
|
643
671
|
|
|
644
|
-
export {
|
|
672
|
+
export { NgpExitAnimation, NgpExitAnimationManager, StyleInjector, explicitEffect, injectElementRef, injectExitAnimationManager, injectStyleInjector, onDomRemoval, provideExitAnimationManager, scrollIntoViewIfNeeded, setupFocus, setupFocusVisible, setupHover, setupInteractions, setupPress, syncState };
|
|
645
673
|
//# sourceMappingURL=ng-primitives-internal.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-primitives-internal.mjs","sources":["../../../../packages/ng-primitives/internal/src/disabled/disabled.ts","../../../../packages/ng-primitives/internal/src/utilities/element-ref.ts","../../../../packages/ng-primitives/internal/src/exit-animation/exit-animation.ts","../../../../packages/ng-primitives/internal/src/interactions/focus.ts","../../../../packages/ng-primitives/internal/src/interactions/focus-visible.ts","../../../../packages/ng-primitives/internal/src/utilities/dom-removal.ts","../../../../packages/ng-primitives/internal/src/interactions/hover.ts","../../../../packages/ng-primitives/internal/src/interactions/press.ts","../../../../packages/ng-primitives/internal/src/interactions/interactions.ts","../../../../packages/ng-primitives/internal/src/signals/explicit-effect.ts","../../../../packages/ng-primitives/internal/src/style-injector/style-injector.ts","../../../../packages/ng-primitives/internal/src/utilities/scrolling.ts","../../../../packages/ng-primitives/internal/src/ng-primitives-internal.ts"],"sourcesContent":["import { computed, inject, InjectionToken, signal, Signal } from '@angular/core';\n\nexport const NgpDisabledToken = new InjectionToken<NgpCanDisable>('NgpDisabledToken');\n\nexport interface NgpCanDisable {\n /**\n * Whether the element is disabled.\n */\n readonly disabled: Signal<boolean>;\n}\n\n/**\n * Determine if we are in a disabled context.\n * @param disabled The disabled signal for the local context.\n * @returns The disabled signal.\n */\nexport function injectDisabled(\n disabled: Signal<boolean> = signal<boolean>(false),\n): Signal<boolean> {\n const provider = inject(NgpDisabledToken, { optional: true, self: true });\n\n return computed(() => provider?.disabled() || disabled());\n}\n","import { ElementRef, inject } from '@angular/core';\n\n/**\n * A simple utility function to inject an element reference with less boilerplate.\n * @returns The element reference.\n */\nexport function injectElementRef<T extends HTMLElement>(): ElementRef<T> {\n return inject(ElementRef);\n}\n","import { ChangeDetectorRef, Directive, inject, Injectable, OnDestroy, signal } from '@angular/core';\nimport { injectElementRef } from '../utilities/element-ref';\n\n@Directive({\n selector: '[ngpExitAnimation]',\n exportAs: 'ngpExitAnimation',\n host: {\n // Deprecated - use data-exit instead\n '[attr.data-closing]': 'state() === \"exit\" ? \"\" : null',\n '[attr.data-exit]': 'state() === \"exit\" ? \"\" : null',\n },\n})\nexport class NgpExitAnimation implements OnDestroy {\n /** The animation manager. */\n private readonly animationManager = inject(NgpExitAnimationManager);\n /** The element to animate. */\n private readonly element = injectElementRef();\n /** Access the change detector. */\n private readonly changeDetector = inject(ChangeDetectorRef);\n\n /** The animation state */\n private readonly state = signal<'enter' | 'exit'>('enter');\n\n constructor() {\n this.animationManager.add(this);\n }\n\n ngOnDestroy(): void {\n this.animationManager.remove(this);\n }\n\n /** Mark the element as exiting. */\n exit(): Promise<void> {\n this.state.set('exit');\n this.changeDetector.detectChanges();\n return new Promise(resolve => {\n // check if there are any exit animations or transitions\n const computedStyle = window.getComputedStyle(this.element.nativeElement);\n const hasTransition = parseFloat(computedStyle.transitionDuration) > 0;\n const hasAnimation = parseFloat(computedStyle.animationDuration) > 0;\n\n if (!hasTransition && !hasAnimation) {\n resolve();\n return;\n }\n\n // wait for the exit animation to finish\n const done = (event: AnimationEvent | TransitionEvent) => {\n // check if the event is for this element\n if (event.target !== this.element.nativeElement) {\n return;\n }\n\n this.element.nativeElement.removeEventListener('transitionend', done);\n this.element.nativeElement.removeEventListener('animationend', done);\n resolve();\n };\n\n this.element.nativeElement.addEventListener('transitionend', done);\n this.element.nativeElement.addEventListener('animationend', done);\n });\n }\n}\n\n@Injectable()\nexport class NgpExitAnimationManager {\n /** Store the instances of the exit animation directive. */\n private readonly instances: NgpExitAnimation[] = [];\n\n /** Add an instance to the manager. */\n add(instance: NgpExitAnimation): void {\n this.instances.push(instance);\n }\n\n /** Remove an instance from the manager. */\n remove(instance: NgpExitAnimation): void {\n const index = this.instances.indexOf(instance);\n if (index !== -1) {\n this.instances.splice(index, 1);\n }\n }\n\n /** Exit all instances. */\n exit(): Promise<void[]> {\n const promises = this.instances.map(instance => instance.exit());\n return Promise.all(promises);\n }\n}\n","import { ElementRef, Renderer2, Signal, inject, signal } from '@angular/core';\nimport { injectDisposables } from 'ng-primitives/utils';\n\nexport interface NgpFocusOptions {\n disabled?: Signal<boolean>;\n focus?: () => void;\n blur?: () => void;\n}\n\nexport interface NgpFocusState {\n isFocused: Signal<boolean>;\n}\n\nexport function setupFocus({\n focus,\n blur,\n disabled = signal(false),\n}: NgpFocusOptions): NgpFocusState {\n /**\n * Access the element reference.\n */\n const elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the disposables helper.\n */\n const disposables = injectDisposables();\n\n /**\n * Access the renderer.\n */\n const renderer = inject(Renderer2);\n\n /**\n * Whether the element is currently focused.\n */\n const isFocused = signal<boolean>(false);\n\n // setup event listeners\n disposables.addEventListener(elementRef.nativeElement, 'focus', onFocus);\n disposables.addEventListener(elementRef.nativeElement, 'blur', onBlur);\n\n /**\n * Listen for focus events.\n * @param event\n */\n function onFocus(event: FocusEvent): void {\n if (disabled()) {\n return;\n }\n\n const ownerDocument = (event.target as HTMLElement)?.ownerDocument ?? document;\n\n // ensure this element is still focused\n if (ownerDocument.activeElement === event.target && event.currentTarget === event.target) {\n focus?.();\n isFocused.set(true);\n // set the data-focus attribute\n renderer.setAttribute(elementRef.nativeElement, 'data-focus', '');\n }\n }\n\n /**\n * Listen for blur events.\n * @param event\n */\n function onBlur(event: FocusEvent): void {\n if (disabled()) {\n return;\n }\n\n if (event.currentTarget === event.target) {\n blur?.();\n isFocused.set(false);\n // remove the data-focus attribute\n renderer.removeAttribute(elementRef.nativeElement, 'data-focus');\n }\n }\n\n return {\n isFocused,\n };\n}\n","import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';\nimport { ElementRef, inject, Renderer2, Signal, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { onBooleanChange } from 'ng-primitives/utils';\n\nexport interface NgpFocusVisibleOptions {\n disabled?: Signal<boolean>;\n focusChange?: (value: boolean) => void;\n}\n\nexport interface NgpFocusVisibleState {\n isFocused: Signal<boolean>;\n}\n\nexport function setupFocusVisible({\n focusChange,\n disabled = signal(false),\n}: NgpFocusVisibleOptions): NgpFocusVisibleState {\n /**\n * Access the element that the directive is applied to.\n */\n const elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the renderer.\n */\n const renderer = inject(Renderer2);\n\n /**\n * Access the focus monitor.\n */\n const focusMonitor = inject(FocusMonitor);\n\n /**\n * Whether the element is currently focused.\n */\n const isFocused = signal<boolean>(false);\n\n // handle focus state\n focusMonitor\n .monitor(elementRef.nativeElement)\n .pipe(takeUntilDestroyed())\n .subscribe(origin =>\n // null indicates the element was blurred\n origin === null ? onBlur() : onFocus(origin),\n );\n\n // if the component becomes disabled and it is focused, hide the focus\n onBooleanChange(disabled, () => focus(false));\n\n function onFocus(origin: FocusOrigin): void {\n if (disabled() || isFocused()) {\n return;\n }\n\n // for some elements the focus visible state should always appear on focus\n if (alwaysShowFocus()) {\n focus(true);\n return;\n }\n\n // if the focus origin is keyboard or program(focused programmatically), then the focus is visible\n if (origin === 'keyboard') {\n focus(true);\n return;\n }\n }\n\n function onBlur(): void {\n if (disabled() || !isFocused()) {\n return;\n }\n\n focus(false);\n }\n\n /**\n * Trigger the focus signal along with the focusChange event.\n */\n function focus(value: boolean) {\n if (isFocused() === value) {\n return;\n }\n\n isFocused.set(value);\n focusChange?.(value);\n\n if (value) {\n renderer.setAttribute(elementRef.nativeElement, 'data-focus-visible', '');\n } else {\n renderer.removeAttribute(elementRef.nativeElement, 'data-focus-visible');\n }\n }\n\n function alwaysShowFocus(): boolean {\n const nonTextInputTypes = [\n 'checkbox',\n 'radio',\n 'range',\n 'color',\n 'file',\n 'image',\n 'button',\n 'submit',\n 'reset',\n ];\n\n // if this is an input element and it is a text input\n if (\n elementRef.nativeElement instanceof HTMLInputElement &&\n !nonTextInputTypes.includes(elementRef.nativeElement.type)\n ) {\n return true;\n }\n\n // if this is a textarea\n if (elementRef.nativeElement instanceof HTMLTextAreaElement) {\n return true;\n }\n\n // if this is an element with contenteditable\n if (\n elementRef.nativeElement.isContentEditable ||\n elementRef.nativeElement.hasAttribute('contenteditable')\n ) {\n return true;\n }\n\n return false;\n }\n\n return {\n isFocused,\n };\n}\n","import { isPlatformServer } from '@angular/common';\nimport { inject, PLATFORM_ID } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { fromResizeEvent } from 'ng-primitives/resize';\n\n/**\n * Whenever an element is removed from the DOM, we call the callback.\n * @param element The element to watch for removal.\n * @param callback The callback to call when the element is removed.\n */\nexport function onDomRemoval(element: HTMLElement, callback: () => void): void {\n const platform = inject(PLATFORM_ID);\n\n // Dont run this on the server\n if (isPlatformServer(platform)) {\n return;\n }\n\n // This is a bit of a hack, but it works. If the element dimensions become zero,\n // it's likely that the element has been removed from the DOM.\n fromResizeEvent(element)\n .pipe(takeUntilDestroyed())\n .subscribe(dimensions => {\n // we check the dimensions first to short-circuit the check as it's faster\n if (dimensions.width === 0 && dimensions.height === 0 && !document.body.contains(element)) {\n callback();\n }\n });\n}\n","import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { effect, ElementRef, inject, Injectable, PLATFORM_ID, Signal, signal } from '@angular/core';\nimport { injectDisposables, onBooleanChange } from 'ng-primitives/utils';\nimport { onDomRemoval } from '../utilities/dom-removal';\n\n/**\n * We use a service here as this value is a singleton\n * and allows us to register the dom events once.\n */\n@Injectable({\n providedIn: 'root',\n})\nclass GlobalPointerEvents {\n /**\n * Whether global mouse events should be ignored.\n */\n ignoreEmulatedMouseEvents: boolean = false;\n\n /**\n * Access the document.\n */\n private readonly document = inject(DOCUMENT);\n\n /**\n * Determine the platform id.\n */\n private readonly platformId = inject(PLATFORM_ID);\n\n constructor() {\n // we only want to setup events on the client\n if (isPlatformBrowser(this.platformId)) {\n this.setupGlobalTouchEvents();\n }\n }\n\n private setupGlobalTouchEvents(): void {\n this.document.addEventListener('pointerup', this.handleGlobalPointerEvent.bind(this));\n this.document.addEventListener('touchend', this.setGlobalIgnoreEmulatedMouseEvents.bind(this));\n }\n\n private setGlobalIgnoreEmulatedMouseEvents(): void {\n this.ignoreEmulatedMouseEvents = true;\n // Clear globalIgnoreEmulatedMouseEvents after a short timeout. iOS fires onPointerEnter\n // with pointerType=\"mouse\" immediately after onPointerUp and before onFocus. On other\n // devices that don't have this quirk, we don't want to ignore a mouse hover sometime in\n // the distant future because a user previously touched the element.\n setTimeout(() => (this.ignoreEmulatedMouseEvents = false), 50);\n }\n\n private handleGlobalPointerEvent(event: PointerEvent): void {\n if (event.pointerType === 'touch') {\n this.setGlobalIgnoreEmulatedMouseEvents();\n }\n }\n}\n\ninterface NgpHoverOptions {\n disabled?: Signal<boolean>;\n hoverStart?: () => void;\n hoverEnd?: () => void;\n}\n\nexport interface NgpHoverState {\n hovered: Signal<boolean>;\n}\n\n/**\n * Programatically add the hover functionality to an element.\n * This is useful in cases where we can't necessarily use a HostDirective,\n * because there is a chance the directive has already been used.\n */\nexport function setupHover({\n hoverStart,\n hoverEnd,\n disabled = signal(false),\n}: NgpHoverOptions): NgpHoverState {\n /**\n * Access the element.\n */\n const elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the global pointer events handler.\n */\n const globalPointerEvents = inject(GlobalPointerEvents);\n\n /**\n * Access the disposable helper.\n */\n const disposables = injectDisposables();\n\n /**\n * Store the current hover state.\n */\n const hovered = signal<boolean>(false);\n\n /**\n * Whether this element should ignore emulated mouse events.\n */\n let ignoreEmulatedMouseEvents: boolean = false;\n\n /**\n * Setup event listeners.\n */\n disposables.addEventListener(elementRef.nativeElement, 'pointerenter', onPointerEnter);\n disposables.addEventListener(elementRef.nativeElement, 'pointerleave', onPointerLeave);\n disposables.addEventListener(elementRef.nativeElement, 'touchstart', onTouchStart);\n disposables.addEventListener(elementRef.nativeElement, 'mouseenter', onMouseEnter);\n disposables.addEventListener(elementRef.nativeElement, 'mouseleave', onMouseLeave);\n\n // anytime the disabled state changes to true, we must reset the hover state\n if (disabled) {\n onBooleanChange(disabled, reset);\n }\n\n // if the element is removed from the dom, we want to reset the hover state\n onDomRemoval(elementRef.nativeElement, reset);\n\n // anytime the hover state changes we want to update the attribute\n effect(() =>\n hovered()\n ? elementRef.nativeElement.setAttribute('data-hover', '')\n : elementRef.nativeElement.removeAttribute('data-hover'),\n );\n\n /**\n * Reset the hover state.\n */\n function reset(): void {\n onHoverEnd('mouse');\n }\n\n /**\n * Trigger the hover start events.\n * @param event\n * @param pointerType\n */\n function onHoverStart(event: Event, pointerType: string): void {\n if (\n disabled() ||\n pointerType === 'touch' ||\n hovered() ||\n !(event.currentTarget as Element)?.contains(event.target as Element)\n ) {\n return;\n }\n\n hovered.set(true);\n hoverStart?.();\n }\n\n /**\n * Trigger the hover end events.\n * @param pointerType\n */\n function onHoverEnd(pointerType: string): void {\n if (pointerType === 'touch' || !hovered()) {\n return;\n }\n\n hovered.set(false);\n hoverEnd?.();\n }\n\n function onPointerEnter(event: PointerEvent): void {\n if (globalPointerEvents.ignoreEmulatedMouseEvents && event.pointerType === 'mouse') {\n return;\n }\n\n onHoverStart(event, event.pointerType);\n }\n\n function onPointerLeave(event: PointerEvent): void {\n if (!disabled() && (event.currentTarget as Element)?.contains(event.target as Element)) {\n onHoverEnd(event.pointerType);\n }\n }\n\n function onTouchStart(): void {\n ignoreEmulatedMouseEvents = true;\n }\n\n function onMouseEnter(event: MouseEvent): void {\n if (!ignoreEmulatedMouseEvents && !globalPointerEvents.ignoreEmulatedMouseEvents) {\n onHoverStart(event, 'mouse');\n }\n\n ignoreEmulatedMouseEvents = false;\n }\n\n function onMouseLeave(event: MouseEvent): void {\n if (!disabled() && (event.currentTarget as Element)?.contains(event.target as Element)) {\n onHoverEnd('mouse');\n }\n }\n\n return { hovered };\n}\n","import { ElementRef, Signal, effect, inject, signal } from '@angular/core';\nimport { injectDisposables } from 'ng-primitives/utils';\n\ninterface NgpPressState {\n pressed: Signal<boolean>;\n}\n\ninterface NgpPressOptions {\n disabled?: Signal<boolean>;\n pressStart?: () => void;\n pressEnd?: () => void;\n}\n\nexport function setupPress({\n pressStart,\n pressEnd,\n disabled = signal(false),\n}: NgpPressOptions): NgpPressState {\n /**\n * Access the element reference.\n */\n const elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the disposables helper.\n */\n const disposables = injectDisposables();\n\n /**\n * Whether the element is currently pressed.\n */\n const pressed = signal<boolean>(false);\n\n // setup event listeners\n disposables.addEventListener(elementRef.nativeElement, 'pointerdown', onPointerDown);\n\n // anytime the press state changes we want to update the attribute\n effect(() =>\n pressed() && !disabled()\n ? elementRef.nativeElement.setAttribute('data-press', '')\n : elementRef.nativeElement.removeAttribute('data-press'),\n );\n\n /**\n * Reset the press state.\n */\n function reset(): void {\n // if we are not pressing, then do nothing\n if (!pressed()) {\n return;\n }\n\n // clear any existing disposables\n disposableListeners.forEach(dispose => dispose());\n pressed.set(false);\n pressEnd?.();\n }\n\n /**\n * Store the list of disposables.\n */\n let disposableListeners: (() => void)[] = [];\n\n function onPointerDown(): void {\n if (disabled()) {\n return;\n }\n\n // clear any existing disposables\n disposableListeners.forEach(dispose => dispose());\n\n // update the press state\n pressed.set(true);\n pressStart?.();\n\n // setup global event listeners to catch events on elements outside the directive\n const ownerDocument = elementRef.nativeElement.ownerDocument ?? document;\n\n // if the pointer up event happens on any elements, then we are no longer pressing on this element\n const pointerUp = disposables.addEventListener(\n ownerDocument,\n 'pointerup',\n () => reset(),\n false,\n );\n\n // Instead of relying on the `pointerleave` event, which is not consistently called on iOS Safari,\n // we use the `pointermove` event to determine if we are still \"pressing\".\n // By checking if the target is still within the element, we can determine if the press is ongoing.\n const pointerMove = disposables.addEventListener(\n ownerDocument,\n 'pointermove',\n () => onPointerMove as EventListener,\n false,\n );\n\n // if the pointer is cancelled, then we are no longer pressing on this element\n const pointerCancel = disposables.addEventListener(\n ownerDocument,\n 'pointercancel',\n () => reset(),\n false,\n );\n\n disposableListeners = [pointerUp, pointerMove, pointerCancel];\n }\n\n function onPointerMove(event: PointerEvent): void {\n if (\n elementRef.nativeElement !== event.target &&\n !elementRef.nativeElement.contains(event.target as Node)\n ) {\n reset();\n }\n }\n\n return { pressed };\n}\n","import { signal, Signal } from '@angular/core';\nimport { setupFocusVisible } from './focus-visible';\nimport { setupHover } from './hover';\nimport { setupPress } from './press';\n\nexport interface NgpInteractionOptions {\n disabled?: Signal<boolean>;\n}\n\n/**\n * Setup the interactions without relying on HostDirectives.\n */\nexport function setupInteractions({ disabled = signal(false) }: NgpInteractionOptions): void {\n setupHover({ disabled });\n setupPress({ disabled });\n setupFocusVisible({ disabled });\n}\n","/**\n * This implementation is heavily inspired by the great work on ngextension!\n * https://github.com/ngxtension/ngxtension-platform/blob/main/libs/ngxtension/explicit-effect/src/explicit-effect.ts\n */\nimport {\n CreateEffectOptions,\n EffectCleanupRegisterFn,\n EffectRef,\n effect,\n untracked,\n} from '@angular/core';\n\n/**\n * We want to have the Tuple in order to use the types in the function signature\n */\ntype ExplicitEffectValues<T> = {\n [K in keyof T]: () => T[K];\n};\n\n/**\n * This explicit effect function will take the dependencies and the function to run when the dependencies change.\n * @param deps - The dependencies that the effect will run on\n * @param fn - The function to run when the dependencies change\n * @param options - The options for the effect with the addition of defer (it allows the computation to run on first change, not immediately)\n */\nexport function explicitEffect<Input extends readonly unknown[], Params = Input>(\n deps: readonly [...ExplicitEffectValues<Input>],\n fn: (deps: Params, onCleanup: EffectCleanupRegisterFn) => void,\n options?: CreateEffectOptions,\n): EffectRef {\n return effect(onCleanup => {\n const depValues = deps.map(s => s());\n untracked(() => fn(depValues as Params, onCleanup));\n }, options);\n}\n","import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { inject, Injectable, PLATFORM_ID } from '@angular/core';\n\n/**\n * A utility service for injecting styles into the document.\n * Angular doesn't allow directives to specify styles, only components.\n * As we ship directives, occasionally we need to associate styles with them.\n * This service allows us to programmatically inject styles into the document.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class StyleInjector {\n /**\n * Access the document.\n */\n private readonly document = inject(DOCUMENT);\n\n /**\n * Detect the platform.\n */\n private readonly platformId = inject(PLATFORM_ID);\n\n /**\n * Store the map of style elements with their unique identifiers.\n */\n private readonly styleElements = new Map<string, HTMLStyleElement>();\n\n constructor() {\n if (isPlatformBrowser(this.platformId)) {\n this.collectServerStyles();\n }\n }\n\n /**\n * Inject a style into the document.\n * @param id The unique identifier for the style.\n * @param style The style to inject.\n */\n add(id: string, style: string): void {\n if (this.styleElements.has(id)) {\n return;\n }\n\n const styleElement = this.document.createElement('style');\n styleElement.setAttribute('data-ngp-style', id);\n styleElement.textContent = style;\n\n this.document.head.appendChild(styleElement);\n this.styleElements.set(id, styleElement);\n }\n\n /**\n * Remove a style from the document.\n * @param id The unique identifier for the style.\n */\n remove(id: string): void {\n const styleElement = this.styleElements.get(id);\n\n if (styleElement) {\n this.document.head.removeChild(styleElement);\n this.styleElements.delete(id);\n }\n }\n\n /**\n * Collect any styles that were rendered by the server.\n */\n private collectServerStyles(): void {\n const styleElements = this.document.querySelectorAll<HTMLStyleElement>('style[data-ngp-style]');\n\n styleElements.forEach(styleElement => {\n const id = styleElement.getAttribute('data-ngp-style');\n\n if (id) {\n this.styleElements.set(id, styleElement);\n }\n });\n }\n}\n\nexport function injectStyleInjector(): StyleInjector {\n return inject(StyleInjector);\n}\n","function getScrollableAncestor(element: HTMLElement): HTMLElement | null {\n let parent = element.parentElement;\n while (parent) {\n const style = window.getComputedStyle(parent);\n if (/(auto|scroll)/.test(style.overflowY) || /(auto|scroll)/.test(style.overflowX)) {\n return parent;\n }\n parent = parent.parentElement;\n }\n return null;\n}\n\nexport function scrollIntoViewIfNeeded(element: HTMLElement): void {\n const scrollableAncestor = getScrollableAncestor(element);\n if (!scrollableAncestor) return;\n\n const parentRect = scrollableAncestor.getBoundingClientRect();\n const elementRect = element.getBoundingClientRect();\n\n if (elementRect.top < parentRect.top) {\n scrollableAncestor.scrollTop -= parentRect.top - elementRect.top;\n } else if (elementRect.bottom > parentRect.bottom) {\n scrollableAncestor.scrollTop += elementRect.bottom - parentRect.bottom;\n }\n\n if (elementRect.left < parentRect.left) {\n scrollableAncestor.scrollLeft -= parentRect.left - elementRect.left;\n } else if (elementRect.right > parentRect.right) {\n scrollableAncestor.scrollLeft += elementRect.right - parentRect.right;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAEa,gBAAgB,GAAG,IAAI,cAAc,CAAgB,kBAAkB;AASpF;;;;AAIG;SACa,cAAc,CAC5B,WAA4B,MAAM,CAAU,KAAK,CAAC,EAAA;AAElD,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAEzE,IAAA,OAAO,QAAQ,CAAC,MAAM,QAAQ,EAAE,QAAQ,EAAE,IAAI,QAAQ,EAAE,CAAC;AAC3D;;ACpBA;;;AAGG;SACa,gBAAgB,GAAA;AAC9B,IAAA,OAAO,MAAM,CAAC,UAAU,CAAC;AAC3B;;MCIa,gBAAgB,CAAA;AAW3B,IAAA,WAAA,GAAA;;AATiB,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,uBAAuB,CAAC;;QAElD,IAAO,CAAA,OAAA,GAAG,gBAAgB,EAAE;;AAE5B,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;;AAG1C,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAmB,OAAO,CAAC;AAGxD,QAAA,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC;;IAGjC,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC;;;IAIpC,IAAI,GAAA;AACF,QAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;AACtB,QAAA,IAAI,CAAC,cAAc,CAAC,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BAAkB;QAAE;AAEzB,IAAA,MAAM,UAAU,GAAG,kBAAkB,CAAC,qBAAqB,EAAE;AAC7D,IAAA,MAAM,WAAW,GAAG,OAAO,CAAC,qBAAqB,EAAE;IAEnD,IAAI,WAAW,CAAC,GAAG,GAAG,UAAU,CAAC,GAAG,EAAE;QACpC,kBAAkB,CAAC,SAAS,IAAI,UAAU,CAAC,GAAG,GAAG,WAAW,CAAC,GAAG;;SAC3D,IAAI,WAAW,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE;QACjD,kBAAkB,CAAC,SAAS,IAAI,WAAW,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM;;IAGxE,IAAI,WAAW,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE;QACtC,kBAAkB,CAAC,UAAU,IAAI,UAAU,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI;;SAC9D,IAAI,WAAW,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE;QAC/C,kBAAkB,CAAC,UAAU,IAAI,WAAW,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK;;AAEzE;;AC9BA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-primitives-internal.mjs","sources":["../../../../packages/ng-primitives/internal/src/utilities/element-ref.ts","../../../../packages/ng-primitives/internal/src/exit-animation/exit-animation-manager.ts","../../../../packages/ng-primitives/internal/src/exit-animation/exit-animation.ts","../../../../packages/ng-primitives/internal/src/interactions/focus.ts","../../../../packages/ng-primitives/internal/src/interactions/focus-visible.ts","../../../../packages/ng-primitives/internal/src/utilities/dom-removal.ts","../../../../packages/ng-primitives/internal/src/interactions/hover.ts","../../../../packages/ng-primitives/internal/src/interactions/press.ts","../../../../packages/ng-primitives/internal/src/interactions/interactions.ts","../../../../packages/ng-primitives/internal/src/signals/explicit-effect.ts","../../../../packages/ng-primitives/internal/src/signals/sync-state.ts","../../../../packages/ng-primitives/internal/src/style-injector/style-injector.ts","../../../../packages/ng-primitives/internal/src/utilities/scrolling.ts","../../../../packages/ng-primitives/internal/src/ng-primitives-internal.ts"],"sourcesContent":["import { ElementRef, inject } from '@angular/core';\n\n/**\n * A simple utility function to inject an element reference with less boilerplate.\n * @returns The element reference.\n */\nexport function injectElementRef<T extends HTMLElement>(): ElementRef<T> {\n return inject(ElementRef);\n}\n","import { ClassProvider, inject, Injectable } from '@angular/core';\nimport type { NgpExitAnimation } from './exit-animation';\n\n@Injectable()\nexport class NgpExitAnimationManager {\n /** Store the instances of the exit animation directive. */\n private readonly instances: NgpExitAnimation[] = [];\n\n /** Add an instance to the manager. */\n add(instance: NgpExitAnimation): void {\n this.instances.push(instance);\n }\n\n /** Remove an instance from the manager. */\n remove(instance: NgpExitAnimation): void {\n const index = this.instances.indexOf(instance);\n if (index !== -1) {\n this.instances.splice(index, 1);\n }\n }\n\n /** Exit all instances. */\n exit(): Promise<void[]> {\n return Promise.all(this.instances.map(instance => instance.exit()));\n }\n}\n\nexport function provideExitAnimationManager(): ClassProvider {\n return { provide: NgpExitAnimationManager, useClass: NgpExitAnimationManager };\n}\n\nexport function injectExitAnimationManager(): NgpExitAnimationManager {\n return inject(NgpExitAnimationManager);\n}\n","import { Directive, inject, OnDestroy, Renderer2 } from '@angular/core';\nimport { injectElementRef } from '../utilities/element-ref';\nimport { injectExitAnimationManager } from './exit-animation-manager';\n\n@Directive({\n selector: '[ngpExitAnimation]',\n exportAs: 'ngpExitAnimation',\n})\nexport class NgpExitAnimation implements OnDestroy {\n /** The animation manager. */\n private readonly animationManager = injectExitAnimationManager();\n /** The element to animate. */\n private readonly elementRef = injectElementRef();\n /** Access the renderer. */\n private readonly renderer = inject(Renderer2);\n\n constructor() {\n this.animationManager.add(this);\n this.setAnimationState('enter');\n }\n\n ngOnDestroy(): void {\n this.animationManager.remove(this);\n }\n\n /** Mark the element as exiting. */\n exit(): Promise<void> {\n // Capture the initial animation name before changing state\n const initialStyle = window.getComputedStyle(this.elementRef.nativeElement);\n const initialAnimationName = initialStyle.animationName;\n const initialTransitionProperty = initialStyle.transitionProperty;\n\n this.setAnimationState('exit');\n\n return new Promise(resolve => {\n // check if there are any exit animations or transitions\n const computedStyle = window.getComputedStyle(this.elementRef.nativeElement);\n const hasTransition = parseFloat(computedStyle.transitionDuration) > 0;\n const hasAnimation = parseFloat(computedStyle.animationDuration) > 0;\n\n // Compare animation properties to see if they've changed\n const animationChanged =\n computedStyle.animationName !== initialAnimationName &&\n computedStyle.animationName !== 'none';\n const transitionChanged =\n computedStyle.transitionProperty !== initialTransitionProperty &&\n computedStyle.transitionProperty !== 'none';\n\n // If no new animations/transitions, resolve immediately\n if ((!hasTransition && !hasAnimation) || (!animationChanged && !transitionChanged)) {\n resolve();\n return;\n }\n\n // wait for the exit animation to finish\n const done = (event: AnimationEvent | TransitionEvent) => {\n // check if the event is for this element\n if (event.target !== this.elementRef.nativeElement) {\n return;\n }\n\n this.elementRef.nativeElement.removeEventListener('transitionend', done);\n this.elementRef.nativeElement.removeEventListener('animationend', done);\n\n // reset the animation state\n this.setAnimationState(null);\n\n resolve();\n };\n\n this.elementRef.nativeElement.addEventListener('transitionend', done);\n this.elementRef.nativeElement.addEventListener('animationend', done);\n });\n }\n\n private setAnimationState(state: 'enter' | 'exit' | null): void {\n // remove all current animation state attributes\n this.renderer.removeAttribute(this.elementRef.nativeElement, 'data-enter');\n this.renderer.removeAttribute(this.elementRef.nativeElement, 'data-exit');\n\n // add the new animation state attribute\n if (state === 'enter') {\n this.renderer.setAttribute(this.elementRef.nativeElement, 'data-enter', '');\n } else if (state === 'exit') {\n this.renderer.setAttribute(this.elementRef.nativeElement, 'data-exit', '');\n }\n }\n}\n","import { ElementRef, Renderer2, Signal, inject, signal } from '@angular/core';\nimport { injectDisposables } from 'ng-primitives/utils';\n\nexport interface NgpFocusOptions {\n disabled?: Signal<boolean>;\n focus?: () => void;\n blur?: () => void;\n}\n\nexport interface NgpFocusState {\n isFocused: Signal<boolean>;\n}\n\nexport function setupFocus({\n focus,\n blur,\n disabled = signal(false),\n}: NgpFocusOptions): NgpFocusState {\n /**\n * Access the element reference.\n */\n const elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the disposables helper.\n */\n const disposables = injectDisposables();\n\n /**\n * Access the renderer.\n */\n const renderer = inject(Renderer2);\n\n /**\n * Whether the element is currently focused.\n */\n const isFocused = signal<boolean>(false);\n\n // setup event listeners\n disposables.addEventListener(elementRef.nativeElement, 'focus', onFocus);\n disposables.addEventListener(elementRef.nativeElement, 'blur', onBlur);\n\n /**\n * Listen for focus events.\n * @param event\n */\n function onFocus(event: FocusEvent): void {\n if (disabled()) {\n return;\n }\n\n const ownerDocument = (event.target as HTMLElement)?.ownerDocument ?? document;\n\n // ensure this element is still focused\n if (ownerDocument.activeElement === event.target && event.currentTarget === event.target) {\n focus?.();\n isFocused.set(true);\n // set the data-focus attribute\n renderer.setAttribute(elementRef.nativeElement, 'data-focus', '');\n }\n }\n\n /**\n * Listen for blur events.\n * @param event\n */\n function onBlur(event: FocusEvent): void {\n if (disabled()) {\n return;\n }\n\n if (event.currentTarget === event.target) {\n blur?.();\n isFocused.set(false);\n // remove the data-focus attribute\n renderer.removeAttribute(elementRef.nativeElement, 'data-focus');\n }\n }\n\n return {\n isFocused,\n };\n}\n","import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';\nimport { ElementRef, inject, Renderer2, Signal, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { onBooleanChange } from 'ng-primitives/utils';\n\nexport interface NgpFocusVisibleOptions {\n disabled?: Signal<boolean>;\n focusChange?: (value: boolean) => void;\n}\n\nexport interface NgpFocusVisibleState {\n isFocused: Signal<boolean>;\n}\n\nexport function setupFocusVisible({\n focusChange,\n disabled = signal(false),\n}: NgpFocusVisibleOptions): NgpFocusVisibleState {\n /**\n * Access the element that the directive is applied to.\n */\n const elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the renderer.\n */\n const renderer = inject(Renderer2);\n\n /**\n * Access the focus monitor.\n */\n const focusMonitor = inject(FocusMonitor);\n\n /**\n * Whether the element is currently focused.\n */\n const isFocused = signal<boolean>(false);\n\n // handle focus state\n focusMonitor\n .monitor(elementRef.nativeElement)\n .pipe(takeUntilDestroyed())\n .subscribe(origin =>\n // null indicates the element was blurred\n origin === null ? onBlur() : onFocus(origin),\n );\n\n // if the component becomes disabled and it is focused, hide the focus\n onBooleanChange(disabled, () => focus(false));\n\n function onFocus(origin: FocusOrigin): void {\n if (disabled() || isFocused()) {\n return;\n }\n\n // for some elements the focus visible state should always appear on focus\n if (alwaysShowFocus()) {\n focus(true);\n return;\n }\n\n // if the focus origin is keyboard or program(focused programmatically), then the focus is visible\n if (origin === 'keyboard') {\n focus(true);\n return;\n }\n }\n\n function onBlur(): void {\n if (disabled() || !isFocused()) {\n return;\n }\n\n focus(false);\n }\n\n /**\n * Trigger the focus signal along with the focusChange event.\n */\n function focus(value: boolean) {\n if (isFocused() === value) {\n return;\n }\n\n isFocused.set(value);\n focusChange?.(value);\n\n if (value) {\n renderer.setAttribute(elementRef.nativeElement, 'data-focus-visible', '');\n } else {\n renderer.removeAttribute(elementRef.nativeElement, 'data-focus-visible');\n }\n }\n\n function alwaysShowFocus(): boolean {\n const nonTextInputTypes = [\n 'checkbox',\n 'radio',\n 'range',\n 'color',\n 'file',\n 'image',\n 'button',\n 'submit',\n 'reset',\n ];\n\n // if this is an input element and it is a text input\n if (\n elementRef.nativeElement instanceof HTMLInputElement &&\n !nonTextInputTypes.includes(elementRef.nativeElement.type)\n ) {\n return true;\n }\n\n // if this is a textarea\n if (elementRef.nativeElement instanceof HTMLTextAreaElement) {\n return true;\n }\n\n // if this is an element with contenteditable\n if (\n elementRef.nativeElement.isContentEditable ||\n elementRef.nativeElement.hasAttribute('contenteditable')\n ) {\n return true;\n }\n\n return false;\n }\n\n return {\n isFocused,\n };\n}\n","import { isPlatformServer } from '@angular/common';\nimport { inject, PLATFORM_ID } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { fromResizeEvent } from 'ng-primitives/resize';\n\n/**\n * Whenever an element is removed from the DOM, we call the callback.\n * @param element The element to watch for removal.\n * @param callback The callback to call when the element is removed.\n */\nexport function onDomRemoval(element: HTMLElement, callback: () => void): void {\n const platform = inject(PLATFORM_ID);\n\n // Dont run this on the server\n if (isPlatformServer(platform)) {\n return;\n }\n\n // This is a bit of a hack, but it works. If the element dimensions become zero,\n // it's likely that the element has been removed from the DOM.\n fromResizeEvent(element)\n .pipe(takeUntilDestroyed())\n .subscribe(dimensions => {\n // we check the dimensions first to short-circuit the check as it's faster\n if (dimensions.width === 0 && dimensions.height === 0 && !document.body.contains(element)) {\n callback();\n }\n });\n}\n","import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { effect, ElementRef, inject, Injectable, PLATFORM_ID, Signal, signal } from '@angular/core';\nimport { injectDisposables, onBooleanChange } from 'ng-primitives/utils';\nimport { onDomRemoval } from '../utilities/dom-removal';\n\n/**\n * We use a service here as this value is a singleton\n * and allows us to register the dom events once.\n */\n@Injectable({\n providedIn: 'root',\n})\nclass GlobalPointerEvents {\n /**\n * Whether global mouse events should be ignored.\n */\n ignoreEmulatedMouseEvents: boolean = false;\n\n /**\n * Access the document.\n */\n private readonly document = inject(DOCUMENT);\n\n /**\n * Determine the platform id.\n */\n private readonly platformId = inject(PLATFORM_ID);\n\n constructor() {\n // we only want to setup events on the client\n if (isPlatformBrowser(this.platformId)) {\n this.setupGlobalTouchEvents();\n }\n }\n\n private setupGlobalTouchEvents(): void {\n this.document.addEventListener('pointerup', this.handleGlobalPointerEvent.bind(this));\n this.document.addEventListener('touchend', this.setGlobalIgnoreEmulatedMouseEvents.bind(this));\n }\n\n private setGlobalIgnoreEmulatedMouseEvents(): void {\n this.ignoreEmulatedMouseEvents = true;\n // Clear globalIgnoreEmulatedMouseEvents after a short timeout. iOS fires onPointerEnter\n // with pointerType=\"mouse\" immediately after onPointerUp and before onFocus. On other\n // devices that don't have this quirk, we don't want to ignore a mouse hover sometime in\n // the distant future because a user previously touched the element.\n setTimeout(() => (this.ignoreEmulatedMouseEvents = false), 50);\n }\n\n private handleGlobalPointerEvent(event: PointerEvent): void {\n if (event.pointerType === 'touch') {\n this.setGlobalIgnoreEmulatedMouseEvents();\n }\n }\n}\n\ninterface NgpHoverOptions {\n disabled?: Signal<boolean>;\n hoverStart?: () => void;\n hoverEnd?: () => void;\n}\n\nexport interface NgpHoverState {\n hovered: Signal<boolean>;\n}\n\n/**\n * Programatically add the hover functionality to an element.\n * This is useful in cases where we can't necessarily use a HostDirective,\n * because there is a chance the directive has already been used.\n */\nexport function setupHover({\n hoverStart,\n hoverEnd,\n disabled = signal(false),\n}: NgpHoverOptions): NgpHoverState {\n /**\n * Access the element.\n */\n const elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the global pointer events handler.\n */\n const globalPointerEvents = inject(GlobalPointerEvents);\n\n /**\n * Access the disposable helper.\n */\n const disposables = injectDisposables();\n\n /**\n * Store the current hover state.\n */\n const hovered = signal<boolean>(false);\n\n /**\n * Whether this element should ignore emulated mouse events.\n */\n let ignoreEmulatedMouseEvents: boolean = false;\n\n /**\n * Setup event listeners.\n */\n disposables.addEventListener(elementRef.nativeElement, 'pointerenter', onPointerEnter);\n disposables.addEventListener(elementRef.nativeElement, 'pointerleave', onPointerLeave);\n disposables.addEventListener(elementRef.nativeElement, 'touchstart', onTouchStart);\n disposables.addEventListener(elementRef.nativeElement, 'mouseenter', onMouseEnter);\n disposables.addEventListener(elementRef.nativeElement, 'mouseleave', onMouseLeave);\n\n // anytime the disabled state changes to true, we must reset the hover state\n if (disabled) {\n onBooleanChange(disabled, reset);\n }\n\n // if the element is removed from the dom, we want to reset the hover state\n onDomRemoval(elementRef.nativeElement, reset);\n\n // anytime the hover state changes we want to update the attribute\n effect(() =>\n hovered()\n ? elementRef.nativeElement.setAttribute('data-hover', '')\n : elementRef.nativeElement.removeAttribute('data-hover'),\n );\n\n /**\n * Reset the hover state.\n */\n function reset(): void {\n onHoverEnd('mouse');\n }\n\n /**\n * Trigger the hover start events.\n * @param event\n * @param pointerType\n */\n function onHoverStart(event: Event, pointerType: string): void {\n if (\n disabled() ||\n pointerType === 'touch' ||\n hovered() ||\n !(event.currentTarget as Element)?.contains(event.target as Element)\n ) {\n return;\n }\n\n hovered.set(true);\n hoverStart?.();\n }\n\n /**\n * Trigger the hover end events.\n * @param pointerType\n */\n function onHoverEnd(pointerType: string): void {\n if (pointerType === 'touch' || !hovered()) {\n return;\n }\n\n hovered.set(false);\n hoverEnd?.();\n }\n\n function onPointerEnter(event: PointerEvent): void {\n if (globalPointerEvents.ignoreEmulatedMouseEvents && event.pointerType === 'mouse') {\n return;\n }\n\n onHoverStart(event, event.pointerType);\n }\n\n function onPointerLeave(event: PointerEvent): void {\n if (!disabled() && (event.currentTarget as Element)?.contains(event.target as Element)) {\n onHoverEnd(event.pointerType);\n }\n }\n\n function onTouchStart(): void {\n ignoreEmulatedMouseEvents = true;\n }\n\n function onMouseEnter(event: MouseEvent): void {\n if (!ignoreEmulatedMouseEvents && !globalPointerEvents.ignoreEmulatedMouseEvents) {\n onHoverStart(event, 'mouse');\n }\n\n ignoreEmulatedMouseEvents = false;\n }\n\n function onMouseLeave(event: MouseEvent): void {\n if (!disabled() && (event.currentTarget as Element)?.contains(event.target as Element)) {\n onHoverEnd('mouse');\n }\n }\n\n return { hovered };\n}\n","import { ElementRef, Signal, effect, inject, signal } from '@angular/core';\nimport { injectDisposables } from 'ng-primitives/utils';\n\ninterface NgpPressState {\n pressed: Signal<boolean>;\n}\n\ninterface NgpPressOptions {\n disabled?: Signal<boolean>;\n pressStart?: () => void;\n pressEnd?: () => void;\n}\n\nexport function setupPress({\n pressStart,\n pressEnd,\n disabled = signal(false),\n}: NgpPressOptions): NgpPressState {\n /**\n * Access the element reference.\n */\n const elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Access the disposables helper.\n */\n const disposables = injectDisposables();\n\n /**\n * Whether the element is currently pressed.\n */\n const pressed = signal<boolean>(false);\n\n // setup event listeners\n disposables.addEventListener(elementRef.nativeElement, 'pointerdown', onPointerDown);\n\n // anytime the press state changes we want to update the attribute\n effect(() =>\n pressed() && !disabled()\n ? elementRef.nativeElement.setAttribute('data-press', '')\n : elementRef.nativeElement.removeAttribute('data-press'),\n );\n\n /**\n * Reset the press state.\n */\n function reset(): void {\n // if we are not pressing, then do nothing\n if (!pressed()) {\n return;\n }\n\n // clear any existing disposables\n disposableListeners.forEach(dispose => dispose());\n pressed.set(false);\n pressEnd?.();\n }\n\n /**\n * Store the list of disposables.\n */\n let disposableListeners: (() => void)[] = [];\n\n function onPointerDown(): void {\n if (disabled()) {\n return;\n }\n\n // clear any existing disposables\n disposableListeners.forEach(dispose => dispose());\n\n // update the press state\n pressed.set(true);\n pressStart?.();\n\n // setup global event listeners to catch events on elements outside the directive\n const ownerDocument = elementRef.nativeElement.ownerDocument ?? document;\n\n // if the pointer up event happens on any elements, then we are no longer pressing on this element\n const pointerUp = disposables.addEventListener(\n ownerDocument,\n 'pointerup',\n () => reset(),\n false,\n );\n\n // Instead of relying on the `pointerleave` event, which is not consistently called on iOS Safari,\n // we use the `pointermove` event to determine if we are still \"pressing\".\n // By checking if the target is still within the element, we can determine if the press is ongoing.\n const pointerMove = disposables.addEventListener(\n ownerDocument,\n 'pointermove',\n () => onPointerMove as EventListener,\n false,\n );\n\n // if the pointer is cancelled, then we are no longer pressing on this element\n const pointerCancel = disposables.addEventListener(\n ownerDocument,\n 'pointercancel',\n () => reset(),\n false,\n );\n\n disposableListeners = [pointerUp, pointerMove, pointerCancel];\n }\n\n function onPointerMove(event: PointerEvent): void {\n if (\n elementRef.nativeElement !== event.target &&\n !elementRef.nativeElement.contains(event.target as Node)\n ) {\n reset();\n }\n }\n\n return { pressed };\n}\n","import { signal, Signal } from '@angular/core';\nimport { setupFocus } from './focus';\nimport { setupFocusVisible } from './focus-visible';\nimport { setupHover } from './hover';\nimport { setupPress } from './press';\n\nexport interface NgpInteractionOptions {\n hover?: boolean;\n press?: boolean;\n focus?: boolean;\n focusVisible?: boolean;\n disabled?: Signal<boolean>;\n}\n\n/**\n * Setup the interactions without relying on HostDirectives.\n */\nexport function setupInteractions({\n focus,\n hover,\n press,\n focusVisible,\n disabled = signal(false),\n}: NgpInteractionOptions): void {\n if (hover) {\n setupHover({ disabled });\n }\n if (press) {\n setupPress({ disabled });\n }\n if (focus) {\n setupFocus({ disabled });\n }\n if (focusVisible) {\n setupFocusVisible({ disabled });\n }\n}\n","/**\n * This implementation is heavily inspired by the great work on ngextension!\n * https://github.com/ngxtension/ngxtension-platform/blob/main/libs/ngxtension/explicit-effect/src/explicit-effect.ts\n */\nimport {\n CreateEffectOptions,\n EffectCleanupRegisterFn,\n EffectRef,\n effect,\n untracked,\n} from '@angular/core';\n\n/**\n * We want to have the Tuple in order to use the types in the function signature\n */\ntype ExplicitEffectValues<T> = {\n [K in keyof T]: () => T[K];\n};\n\n/**\n * This explicit effect function will take the dependencies and the function to run when the dependencies change.\n * @param deps - The dependencies that the effect will run on\n * @param fn - The function to run when the dependencies change\n * @param options - The options for the effect with the addition of defer (it allows the computation to run on first change, not immediately)\n */\nexport function explicitEffect<Input extends readonly unknown[], Params = Input>(\n deps: readonly [...ExplicitEffectValues<Input>],\n fn: (deps: Params, onCleanup: EffectCleanupRegisterFn) => void,\n options?: CreateEffectOptions,\n): EffectRef {\n return effect(onCleanup => {\n const depValues = deps.map(s => s());\n untracked(() => fn(depValues as Params, onCleanup));\n }, options);\n}\n","import { effect, Signal, untracked, WritableSignal } from '@angular/core';\n\nexport function syncState<T>(source: Signal<T>, target: WritableSignal<T>) {\n effect(() => {\n const sourceValue = source();\n untracked(() => target.set(sourceValue));\n });\n}\n","import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { inject, Injectable, PLATFORM_ID } from '@angular/core';\n\n/**\n * A utility service for injecting styles into the document.\n * Angular doesn't allow directives to specify styles, only components.\n * As we ship directives, occasionally we need to associate styles with them.\n * This service allows us to programmatically inject styles into the document.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class StyleInjector {\n /**\n * Access the document.\n */\n private readonly document = inject(DOCUMENT);\n\n /**\n * Detect the platform.\n */\n private readonly platformId = inject(PLATFORM_ID);\n\n /**\n * Store the map of style elements with their unique identifiers.\n */\n private readonly styleElements = new Map<string, HTMLStyleElement>();\n\n constructor() {\n if (isPlatformBrowser(this.platformId)) {\n this.collectServerStyles();\n }\n }\n\n /**\n * Inject a style into the document.\n * @param id The unique identifier for the style.\n * @param style The style to inject.\n */\n add(id: string, style: string): void {\n if (this.styleElements.has(id)) {\n return;\n }\n\n const styleElement = this.document.createElement('style');\n styleElement.setAttribute('data-ngp-style', id);\n styleElement.textContent = style;\n\n this.document.head.appendChild(styleElement);\n this.styleElements.set(id, styleElement);\n }\n\n /**\n * Remove a style from the document.\n * @param id The unique identifier for the style.\n */\n remove(id: string): void {\n const styleElement = this.styleElements.get(id);\n\n if (styleElement) {\n this.document.head.removeChild(styleElement);\n this.styleElements.delete(id);\n }\n }\n\n /**\n * Collect any styles that were rendered by the server.\n */\n private collectServerStyles(): void {\n const styleElements = this.document.querySelectorAll<HTMLStyleElement>('style[data-ngp-style]');\n\n styleElements.forEach(styleElement => {\n const id = styleElement.getAttribute('data-ngp-style');\n\n if (id) {\n this.styleElements.set(id, styleElement);\n }\n });\n }\n}\n\nexport function injectStyleInjector(): StyleInjector {\n return inject(StyleInjector);\n}\n","function getScrollableAncestor(element: HTMLElement): HTMLElement | null {\n let parent = element.parentElement;\n while (parent) {\n const style = window.getComputedStyle(parent);\n if (/(auto|scroll)/.test(style.overflowY) || /(auto|scroll)/.test(style.overflowX)) {\n return parent;\n }\n parent = parent.parentElement;\n }\n return null;\n}\n\nexport function scrollIntoViewIfNeeded(element: HTMLElement): void {\n const scrollableAncestor = getScrollableAncestor(element);\n if (!scrollableAncestor) return;\n\n const parentRect = scrollableAncestor.getBoundingClientRect();\n const elementRect = element.getBoundingClientRect();\n\n if (elementRect.top < parentRect.top) {\n scrollableAncestor.scrollTop -= parentRect.top - elementRect.top;\n } else if (elementRect.bottom > parentRect.bottom) {\n scrollableAncestor.scrollTop += elementRect.bottom - parentRect.bottom;\n }\n\n if (elementRect.left < parentRect.left) {\n scrollableAncestor.scrollLeft -= parentRect.left - elementRect.left;\n } else if (elementRect.right > parentRect.right) {\n scrollableAncestor.scrollLeft += elementRect.right - parentRect.right;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAEA;;;AAGG;SACa,gBAAgB,GAAA;AAC9B,IAAA,OAAO,MAAM,CAAC,UAAU,CAAC;AAC3B;;MCJa,uBAAuB,CAAA;AADpC,IAAA,WAAA,GAAA;;QAGmB,IAAS,CAAA,SAAA,GAAuB,EAAE;AAmBpD;;AAhBC,IAAA,GAAG,CAAC,QAA0B,EAAA;AAC5B,QAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC;;;AAI/B,IAAA,MAAM,CAAC,QAA0B,EAAA;QAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC;AAC9C,QAAA,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YAChB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;;;;IAKnC,IAAI,GAAA;QACF,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;;8GAnB1D,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAvB,uBAAuB,EAAA,CAAA,CAAA;;2FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC;;SAwBe,2BAA2B,GAA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AC,GAAG,GAAG,UAAU,CAAC,GAAG,EAAE;QACpC,kBAAkB,CAAC,SAAS,IAAI,UAAU,CAAC,GAAG,GAAG,WAAW,CAAC,GAAG;;SAC3D,IAAI,WAAW,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE;QACjD,kBAAkB,CAAC,SAAS,IAAI,WAAW,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM;;IAGxE,IAAI,WAAW,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE;QACtC,kBAAkB,CAAC,UAAU,IAAI,UAAU,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI;;SAC9D,IAAI,WAAW,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE;QAC/C,kBAAkB,CAAC,UAAU,IAAI,WAAW,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK;;AAEzE;;AC9BA;;AAEG;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { input, booleanAttribute, signal, computed, effect, Directive, contentChild, HostListener, inject, Injector, DestroyRef, output } from '@angular/core';
|
|
3
3
|
import { injectElementRef, setupInteractions, onDomRemoval, scrollIntoViewIfNeeded, setupFocusVisible, explicitEffect } from 'ng-primitives/internal';
|
|
4
4
|
import { uniqueId } from 'ng-primitives/utils';
|
|
5
5
|
import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
|
|
6
6
|
import { NgpHeaderToken } from 'ng-primitives/common';
|
|
7
|
-
import {
|
|
7
|
+
import { injectPopoverTriggerState } from 'ng-primitives/popover';
|
|
8
8
|
import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
|
|
9
9
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
10
10
|
|
|
@@ -25,14 +25,6 @@ const injectListboxState = createStateInjector(NgpListboxStateToken, { deferred:
|
|
|
25
25
|
*/
|
|
26
26
|
const listboxState = createState(NgpListboxStateToken);
|
|
27
27
|
|
|
28
|
-
const NgpListboxOptionToken = new InjectionToken('NgpListboxOptionToken');
|
|
29
|
-
/**
|
|
30
|
-
* Inject the ListboxOption directive instance
|
|
31
|
-
*/
|
|
32
|
-
function injectListboxOption() {
|
|
33
|
-
return inject(NgpListboxOptionToken);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
28
|
class NgpListboxOption {
|
|
37
29
|
/**
|
|
38
30
|
* @internal
|
|
@@ -74,7 +66,13 @@ class NgpListboxOption {
|
|
|
74
66
|
* Whether the option is disabled.
|
|
75
67
|
*/
|
|
76
68
|
this._disabled = computed(() => this.optionDisabled() || (this.listbox()?.disabled() ?? false));
|
|
77
|
-
setupInteractions({
|
|
69
|
+
setupInteractions({
|
|
70
|
+
hover: true,
|
|
71
|
+
press: true,
|
|
72
|
+
focusVisible: true,
|
|
73
|
+
focus: true,
|
|
74
|
+
disabled: this._disabled,
|
|
75
|
+
});
|
|
78
76
|
// the listbox may not be available when the option is initialized
|
|
79
77
|
// so we need to add the option when the listbox is available
|
|
80
78
|
effect(() => this.listbox()?.addOption(this));
|
|
@@ -128,14 +126,13 @@ class NgpListboxOption {
|
|
|
128
126
|
this.listbox()?.activateOption(this.value());
|
|
129
127
|
}
|
|
130
128
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpListboxOption, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
131
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpListboxOption, isStandalone: true, selector: "[ngpListboxOption]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "ngpListboxOptionValue", isSignal: true, isRequired: true, transformFunction: null }, optionDisabled: { classPropertyName: "optionDisabled", publicName: "ngpListboxOptionDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "option" }, listeners: { "click": "select(\"mouse\")", "mouseenter": "activate()", "keydown.enter": "select(\"keyboard\")", "keydown.space": "select(\"keyboard\")" }, properties: { "attr.id": "id()", "attr.aria-disabled": "optionDisabled()", "attr.data-active": "listbox()?.isFocused() && active() ? \"\" : undefined", "attr.data-selected": "selected() ? \"\" : undefined", "attr.data-disabled": "optionDisabled() ? \"\" : undefined" } },
|
|
129
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpListboxOption, isStandalone: true, selector: "[ngpListboxOption]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "ngpListboxOptionValue", isSignal: true, isRequired: true, transformFunction: null }, optionDisabled: { classPropertyName: "optionDisabled", publicName: "ngpListboxOptionDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "option" }, listeners: { "click": "select(\"mouse\")", "mouseenter": "activate()", "keydown.enter": "select(\"keyboard\")", "keydown.space": "select(\"keyboard\")" }, properties: { "attr.id": "id()", "attr.aria-disabled": "optionDisabled()", "attr.data-active": "listbox()?.isFocused() && active() ? \"\" : undefined", "attr.data-selected": "selected() ? \"\" : undefined", "attr.data-disabled": "optionDisabled() ? \"\" : undefined" } }, exportAs: ["ngpListboxOption"], ngImport: i0 }); }
|
|
132
130
|
}
|
|
133
131
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpListboxOption, decorators: [{
|
|
134
132
|
type: Directive,
|
|
135
133
|
args: [{
|
|
136
134
|
selector: '[ngpListboxOption]',
|
|
137
135
|
exportAs: 'ngpListboxOption',
|
|
138
|
-
providers: [{ provide: NgpListboxOptionToken, useExisting: NgpListboxOption }],
|
|
139
136
|
host: {
|
|
140
137
|
role: 'option',
|
|
141
138
|
'[attr.id]': 'id()',
|
|
@@ -151,14 +148,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
|
|
|
151
148
|
}]
|
|
152
149
|
}], ctorParameters: () => [] });
|
|
153
150
|
|
|
154
|
-
const NgpListboxSectionToken = new InjectionToken('NgpListboxSectionToken');
|
|
155
|
-
/**
|
|
156
|
-
* Inject the ListboxSection directive instance
|
|
157
|
-
*/
|
|
158
|
-
function injectListboxSection() {
|
|
159
|
-
return inject(NgpListboxSectionToken);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
151
|
class NgpListboxSection {
|
|
163
152
|
constructor() {
|
|
164
153
|
/**
|
|
@@ -167,14 +156,13 @@ class NgpListboxSection {
|
|
|
167
156
|
this.header = contentChild(NgpHeaderToken, { descendants: true });
|
|
168
157
|
}
|
|
169
158
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpListboxSection, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
170
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.0.7", type: NgpListboxSection, isStandalone: true, selector: "[ngpListboxSection]", host: { attributes: { "role": "group" }, properties: { "attr.aria-labelledby": "header()?.id()" } },
|
|
159
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.0.7", type: NgpListboxSection, isStandalone: true, selector: "[ngpListboxSection]", host: { attributes: { "role": "group" }, properties: { "attr.aria-labelledby": "header()?.id()" } }, queries: [{ propertyName: "header", first: true, predicate: NgpHeaderToken, descendants: true, isSignal: true }], exportAs: ["ngpListboxSection"], ngImport: i0 }); }
|
|
171
160
|
}
|
|
172
161
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpListboxSection, decorators: [{
|
|
173
162
|
type: Directive,
|
|
174
163
|
args: [{
|
|
175
164
|
selector: '[ngpListboxSection]',
|
|
176
165
|
exportAs: 'ngpListboxSection',
|
|
177
|
-
providers: [{ provide: NgpListboxSectionToken, useExisting: NgpListboxSection }],
|
|
178
166
|
host: {
|
|
179
167
|
role: 'group',
|
|
180
168
|
'[attr.aria-labelledby]': 'header()?.id()',
|
|
@@ -182,53 +170,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
|
|
|
182
170
|
}]
|
|
183
171
|
}] });
|
|
184
172
|
|
|
185
|
-
const NgpListboxTriggerToken = new InjectionToken('NgpListboxTriggerToken');
|
|
186
|
-
/**
|
|
187
|
-
* Inject the ListboxTrigger directive instance
|
|
188
|
-
*/
|
|
189
|
-
function injectListboxTrigger() {
|
|
190
|
-
return inject(NgpListboxTriggerToken);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
173
|
class NgpListboxTrigger {
|
|
194
174
|
constructor() {
|
|
195
175
|
/**
|
|
196
176
|
* There must also be a popover trigger directive associated with this element.
|
|
197
177
|
*/
|
|
198
|
-
this.popoverTrigger =
|
|
178
|
+
this.popoverTrigger = injectPopoverTriggerState();
|
|
199
179
|
}
|
|
200
180
|
/**
|
|
201
181
|
* When the up or down arrow key is pressed, open the popover.
|
|
202
182
|
*/
|
|
203
183
|
openPopover(event) {
|
|
204
184
|
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
205
|
-
this.popoverTrigger.show('keyboard');
|
|
185
|
+
this.popoverTrigger().show('keyboard');
|
|
206
186
|
event.preventDefault();
|
|
207
187
|
}
|
|
208
188
|
}
|
|
209
189
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpListboxTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
210
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpListboxTrigger, isStandalone: true, selector: "[ngpListboxTrigger]", host: { listeners: { "keydown": "openPopover($event)" } },
|
|
190
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpListboxTrigger, isStandalone: true, selector: "[ngpListboxTrigger]", host: { listeners: { "keydown": "openPopover($event)" } }, exportAs: ["ngpListboxTrigger"], ngImport: i0 }); }
|
|
211
191
|
}
|
|
212
192
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpListboxTrigger, decorators: [{
|
|
213
193
|
type: Directive,
|
|
214
194
|
args: [{
|
|
215
195
|
selector: '[ngpListboxTrigger]',
|
|
216
196
|
exportAs: 'ngpListboxTrigger',
|
|
217
|
-
providers: [{ provide: NgpListboxTriggerToken, useExisting: NgpListboxTrigger }],
|
|
218
197
|
}]
|
|
219
198
|
}], propDecorators: { openPopover: [{
|
|
220
199
|
type: HostListener,
|
|
221
200
|
args: ['keydown', ['$event']]
|
|
222
201
|
}] } });
|
|
223
202
|
|
|
224
|
-
const NgpListboxToken = new InjectionToken('NgpListboxToken');
|
|
225
|
-
/**
|
|
226
|
-
* Inject the Listbox directive instance
|
|
227
|
-
*/
|
|
228
|
-
function injectListbox() {
|
|
229
|
-
return inject(NgpListboxToken);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
203
|
class NgpListbox {
|
|
233
204
|
constructor() {
|
|
234
205
|
/**
|
|
@@ -242,7 +213,7 @@ class NgpListbox {
|
|
|
242
213
|
/**
|
|
243
214
|
* The listbox may be used within a popover, which we may want to close on selection.
|
|
244
215
|
*/
|
|
245
|
-
this.popoverTrigger =
|
|
216
|
+
this.popoverTrigger = injectPopoverTriggerState({ optional: true });
|
|
246
217
|
/**
|
|
247
218
|
* The id of the listbox.
|
|
248
219
|
*/
|
|
@@ -369,7 +340,7 @@ class NgpListbox {
|
|
|
369
340
|
}
|
|
370
341
|
// If the listbox is within a popover, close the popover on selection if it is not in a multiple selection mode.
|
|
371
342
|
if (this.state.mode() !== 'multiple') {
|
|
372
|
-
this.popoverTrigger?.hide(origin);
|
|
343
|
+
this.popoverTrigger()?.hide(origin);
|
|
373
344
|
}
|
|
374
345
|
}
|
|
375
346
|
/**
|
|
@@ -407,14 +378,14 @@ class NgpListbox {
|
|
|
407
378
|
this.options.update(options => options.filter(o => o !== option));
|
|
408
379
|
}
|
|
409
380
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpListbox, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
410
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpListbox, isStandalone: true, selector: "[ngpListbox]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "ngpListboxMode", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "ngpListboxValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpListboxDisabled", isSignal: true, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "ngpListboxCompareWith", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "ngpListboxValueChange" }, host: { attributes: { "role": "listbox" }, listeners: { "focusin": "isFocused.set(true)", "focusout": "isFocused.set(false)", "keydown": "onKeydown($event)" }, properties: { "id": "state.id()", "attr.tabindex": "tabindex()", "attr.aria-disabled": "state.disabled()", "attr.aria-multiselectable": "state.mode() === \"multiple\"", "attr.aria-activedescendant": "activeDescendant()" } }, providers: [
|
|
381
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpListbox, isStandalone: true, selector: "[ngpListbox]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "ngpListboxMode", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "ngpListboxValue", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpListboxDisabled", isSignal: true, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "ngpListboxCompareWith", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "ngpListboxValueChange" }, host: { attributes: { "role": "listbox" }, listeners: { "focusin": "isFocused.set(true)", "focusout": "isFocused.set(false)", "keydown": "onKeydown($event)" }, properties: { "id": "state.id()", "attr.tabindex": "tabindex()", "attr.aria-disabled": "state.disabled()", "attr.aria-multiselectable": "state.mode() === \"multiple\"", "attr.aria-activedescendant": "activeDescendant()" } }, providers: [provideListboxState()], exportAs: ["ngpListbox"], ngImport: i0 }); }
|
|
411
382
|
}
|
|
412
383
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpListbox, decorators: [{
|
|
413
384
|
type: Directive,
|
|
414
385
|
args: [{
|
|
415
386
|
selector: '[ngpListbox]',
|
|
416
387
|
exportAs: 'ngpListbox',
|
|
417
|
-
providers: [
|
|
388
|
+
providers: [provideListboxState()],
|
|
418
389
|
host: {
|
|
419
390
|
'[id]': 'state.id()',
|
|
420
391
|
role: 'listbox',
|
|
@@ -435,5 +406,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
|
|
|
435
406
|
* Generated bundle index. Do not edit.
|
|
436
407
|
*/
|
|
437
408
|
|
|
438
|
-
export { NgpListbox, NgpListboxOption,
|
|
409
|
+
export { NgpListbox, NgpListboxOption, NgpListboxSection, NgpListboxTrigger, injectListboxState, provideListboxState };
|
|
439
410
|
//# sourceMappingURL=ng-primitives-listbox.mjs.map
|