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.
Files changed (226) hide show
  1. package/a11y/index.d.ts +1 -1
  2. package/a11y/visually-hidden/visually-hidden-state.d.ts +52 -0
  3. package/a11y/visually-hidden/visually-hidden.d.ts +1 -0
  4. package/accordion/accordion/accordion-state.d.ts +1 -1
  5. package/accordion/accordion-item/accordion-item-state.d.ts +1 -1
  6. package/avatar/avatar/avatar-state.d.ts +1 -1
  7. package/avatar/avatar-image/avatar-image.d.ts +36 -1
  8. package/button/button/button-state.d.ts +12 -2
  9. package/button/button/button.d.ts +1 -2
  10. package/button/index.d.ts +1 -1
  11. package/checkbox/checkbox/checkbox-state.d.ts +1 -1
  12. package/checkbox/checkbox/checkbox.d.ts +3 -4
  13. package/date-picker/date-picker/date-picker-state.d.ts +1 -1
  14. package/date-picker/date-picker-date-button/date-picker-date-button.d.ts +1 -2
  15. package/date-picker/date-picker-next-month/date-picker-next-month.d.ts +2 -2
  16. package/date-picker/date-picker-previous-month/date-picker-previous-month.d.ts +2 -2
  17. package/date-picker/index.d.ts +5 -9
  18. package/dialog/dialog/dialog-state.d.ts +1 -1
  19. package/dialog/index.d.ts +0 -4
  20. package/fesm2022/ng-primitives-a11y.mjs +20 -9
  21. package/fesm2022/ng-primitives-a11y.mjs.map +1 -1
  22. package/fesm2022/ng-primitives-avatar.mjs +3 -3
  23. package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
  24. package/fesm2022/ng-primitives-button.mjs +18 -5
  25. package/fesm2022/ng-primitives-button.mjs.map +1 -1
  26. package/fesm2022/ng-primitives-checkbox.mjs +13 -8
  27. package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
  28. package/fesm2022/ng-primitives-date-picker.mjs +13 -65
  29. package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
  30. package/fesm2022/ng-primitives-dialog.mjs +5 -41
  31. package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
  32. package/fesm2022/ng-primitives-file-upload.mjs +12 -5
  33. package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
  34. package/fesm2022/ng-primitives-focus-trap.mjs +3 -12
  35. package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -1
  36. package/fesm2022/ng-primitives-form-field.mjs +103 -93
  37. package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
  38. package/fesm2022/ng-primitives-input.mjs +34 -21
  39. package/fesm2022/ng-primitives-input.mjs.map +1 -1
  40. package/fesm2022/ng-primitives-interactions.mjs +14 -80
  41. package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
  42. package/fesm2022/ng-primitives-internal.mjs +93 -65
  43. package/fesm2022/ng-primitives-internal.mjs.map +1 -1
  44. package/fesm2022/ng-primitives-listbox.mjs +19 -48
  45. package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
  46. package/fesm2022/ng-primitives-menu.mjs +1 -5
  47. package/fesm2022/ng-primitives-menu.mjs.map +1 -1
  48. package/fesm2022/ng-primitives-pagination.mjs +53 -147
  49. package/fesm2022/ng-primitives-pagination.mjs.map +1 -1
  50. package/fesm2022/ng-primitives-popover.mjs +105 -96
  51. package/fesm2022/ng-primitives-popover.mjs.map +1 -1
  52. package/fesm2022/ng-primitives-progress.mjs +4 -18
  53. package/fesm2022/ng-primitives-progress.mjs.map +1 -1
  54. package/fesm2022/ng-primitives-radio.mjs +9 -5
  55. package/fesm2022/ng-primitives-radio.mjs.map +1 -1
  56. package/fesm2022/ng-primitives-roving-focus.mjs +2 -12
  57. package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
  58. package/fesm2022/ng-primitives-select.mjs +35 -21
  59. package/fesm2022/ng-primitives-select.mjs.map +1 -1
  60. package/fesm2022/ng-primitives-separator.mjs +2 -11
  61. package/fesm2022/ng-primitives-separator.mjs.map +1 -1
  62. package/fesm2022/ng-primitives-slider.mjs +62 -120
  63. package/fesm2022/ng-primitives-slider.mjs.map +1 -1
  64. package/fesm2022/ng-primitives-state.mjs +10 -3
  65. package/fesm2022/ng-primitives-state.mjs.map +1 -1
  66. package/fesm2022/ng-primitives-switch.mjs +22 -35
  67. package/fesm2022/ng-primitives-switch.mjs.map +1 -1
  68. package/fesm2022/ng-primitives-tabs.mjs +17 -22
  69. package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
  70. package/fesm2022/ng-primitives-textarea.mjs +34 -21
  71. package/fesm2022/ng-primitives-textarea.mjs.map +1 -1
  72. package/fesm2022/ng-primitives-toast.mjs +27 -16
  73. package/fesm2022/ng-primitives-toast.mjs.map +1 -1
  74. package/fesm2022/ng-primitives-toggle-group.mjs +26 -49
  75. package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
  76. package/fesm2022/ng-primitives-toggle.mjs +4 -18
  77. package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
  78. package/fesm2022/ng-primitives-toolbar.mjs +3 -18
  79. package/fesm2022/ng-primitives-toolbar.mjs.map +1 -1
  80. package/fesm2022/ng-primitives-tooltip.mjs +103 -82
  81. package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
  82. package/fesm2022/ng-primitives-utils.mjs +18 -0
  83. package/fesm2022/ng-primitives-utils.mjs.map +1 -1
  84. package/file-upload/file-dropzone/file-dropzone-state.d.ts +2 -2
  85. package/file-upload/file-dropzone/file-dropzone.d.ts +3 -2
  86. package/file-upload/file-upload/file-upload-state.d.ts +2 -2
  87. package/file-upload/file-upload/file-upload.d.ts +3 -2
  88. package/focus-trap/index.d.ts +0 -1
  89. package/form-field/description/description.d.ts +25 -1
  90. package/form-field/error/error.d.ts +25 -1
  91. package/form-field/form-control/form-control-state.d.ts +58 -0
  92. package/form-field/form-control/form-control.d.ts +36 -7
  93. package/form-field/form-field/form-field-state.d.ts +41 -0
  94. package/form-field/form-field/form-field.d.ts +4 -0
  95. package/form-field/index.d.ts +2 -5
  96. package/form-field/label/label.d.ts +26 -2
  97. package/input/index.d.ts +1 -1
  98. package/input/input/input-state.d.ts +30 -0
  99. package/input/input/input.d.ts +7 -5
  100. package/interactions/focus/focus.d.ts +0 -4
  101. package/interactions/focus-visible/focus-visible.d.ts +0 -4
  102. package/interactions/hover/hover.d.ts +0 -4
  103. package/interactions/index.d.ts +0 -5
  104. package/interactions/move/move.d.ts +0 -4
  105. package/interactions/press/press.d.ts +0 -4
  106. package/internal/exit-animation/exit-animation-manager.d.ts +17 -0
  107. package/internal/exit-animation/exit-animation.d.ts +4 -17
  108. package/internal/index.d.ts +3 -2
  109. package/internal/interactions/interactions.d.ts +5 -1
  110. package/internal/signals/sync-state.d.ts +2 -0
  111. package/listbox/index.d.ts +0 -4
  112. package/listbox/listbox/listbox-state.d.ts +2 -2
  113. package/package.json +9 -9
  114. package/pagination/index.d.ts +0 -6
  115. package/pagination/pagination/pagination-state.d.ts +2 -2
  116. package/pagination/pagination/pagination.d.ts +5 -5
  117. package/pagination/pagination-button/pagination-button.d.ts +4 -8
  118. package/pagination/pagination-first/pagination-first.d.ts +4 -8
  119. package/pagination/pagination-last/pagination-last.d.ts +3 -7
  120. package/pagination/pagination-next/pagination-next.d.ts +4 -8
  121. package/pagination/pagination-previous/pagination-previous.d.ts +4 -8
  122. package/popover/index.d.ts +1 -2
  123. package/popover/popover/popover-token.d.ts +8 -5
  124. package/popover/popover/popover.d.ts +3 -2
  125. package/popover/popover-trigger/popover-trigger-state.d.ts +5 -3
  126. package/popover/popover-trigger/popover-trigger.d.ts +27 -19
  127. package/progress/index.d.ts +0 -1
  128. package/progress/progress/progress-state.d.ts +1 -1
  129. package/radio/radio-group/radio-group-state.d.ts +1 -1
  130. package/radio/radio-group/radio-group.d.ts +2 -2
  131. package/radio/radio-item/radio-item-state.d.ts +1 -1
  132. package/roving-focus/index.d.ts +2 -3
  133. package/roving-focus/roving-focus-group/roving-focus-group-state.d.ts +1 -1
  134. package/schematics/ng-generate/schema.d.ts +4 -1
  135. package/schematics/ng-generate/schema.json +4 -1
  136. package/schematics/ng-generate/templates/toast/toast.__fileSuffix@dasherize__.ts.template +111 -0
  137. package/schematics/ng-generate/templates/toolbar/toolbar-button.__fileSuffix@dasherize__.ts.template +58 -0
  138. package/schematics/ng-generate/templates/toolbar/toolbar.__fileSuffix@dasherize__.ts.template +29 -0
  139. package/schematics/ng-generate/templates/tooltip/tooltip-trigger.__fileSuffix@dasherize__.ts.template +35 -0
  140. package/schematics/ng-generate/templates/tooltip/tooltip.__fileSuffix@dasherize__.ts.template +60 -0
  141. package/search/search/search-state.d.ts +1 -1
  142. package/select/index.d.ts +1 -1
  143. package/select/select/select-state.d.ts +20 -0
  144. package/select/select/select.d.ts +7 -4
  145. package/separator/index.d.ts +1 -2
  146. package/slider/index.d.ts +0 -4
  147. package/slider/slider/slider-state.d.ts +1 -1
  148. package/slider/slider/slider.d.ts +2 -2
  149. package/slider/slider-range/slider-range.d.ts +1 -1
  150. package/slider/slider-thumb/slider-thumb.d.ts +3 -7
  151. package/slider/slider-track/slider-track.d.ts +1 -5
  152. package/state/index.d.ts +7 -1
  153. package/switch/index.d.ts +0 -1
  154. package/switch/switch/switch-state.d.ts +1 -1
  155. package/switch/switch/switch.d.ts +3 -4
  156. package/switch/switch-thumb/switch-thumb.d.ts +2 -2
  157. package/tabs/index.d.ts +1 -2
  158. package/tabs/tab-button/tab-button.d.ts +2 -2
  159. package/tabs/tabset/tabset-state.d.ts +1 -1
  160. package/textarea/index.d.ts +1 -1
  161. package/textarea/textarea/textarea-state.d.ts +20 -0
  162. package/textarea/textarea/textarea.d.ts +7 -4
  163. package/toast/index.d.ts +0 -1
  164. package/toast/toast/toast.d.ts +21 -1
  165. package/toggle/index.d.ts +0 -1
  166. package/toggle/toggle/toggle-state.d.ts +1 -1
  167. package/toggle-group/index.d.ts +0 -2
  168. package/toggle-group/toggle-group/toggle-group-state.d.ts +1 -1
  169. package/toggle-group/toggle-group-item/toggle-group-item-state.d.ts +15 -2
  170. package/toggle-group/toggle-group-item/toggle-group-item.d.ts +1 -1
  171. package/toolbar/index.d.ts +0 -1
  172. package/tooltip/index.d.ts +1 -2
  173. package/tooltip/tooltip/tooltip-token.d.ts +8 -5
  174. package/tooltip/tooltip/tooltip.d.ts +2 -1
  175. package/tooltip/tooltip-trigger/tooltip-trigger-state.d.ts +3 -3
  176. package/tooltip/tooltip-trigger/tooltip-trigger.d.ts +43 -22
  177. package/a11y/visually-hidden/visually-hidden-token.d.ts +0 -7
  178. package/date-picker/date-picker-cell/date-picker-cell-token.d.ts +0 -7
  179. package/date-picker/date-picker-grid/date-picker-grid-token.d.ts +0 -7
  180. package/date-picker/date-picker-next-month/date-picker-next-month-token.d.ts +0 -7
  181. package/date-picker/date-picker-previous-month/date-picker-previous-month-token.d.ts +0 -7
  182. package/dialog/dialog-description/dialog-description-token.d.ts +0 -7
  183. package/dialog/dialog-overlay/dialog-overlay-token.d.ts +0 -7
  184. package/dialog/dialog-title/dialog-title-token.d.ts +0 -7
  185. package/dialog/dialog-trigger/dialog-trigger-token.d.ts +0 -7
  186. package/focus-trap/focus-trap/focus-trap-token.d.ts +0 -7
  187. package/form-field/description/description-token.d.ts +0 -7
  188. package/form-field/error/error-token.d.ts +0 -7
  189. package/form-field/form-control/form-control-token.d.ts +0 -7
  190. package/form-field/form-field/form-field-token.d.ts +0 -8
  191. package/form-field/label/label-token.d.ts +0 -7
  192. package/input/input/input-token.d.ts +0 -7
  193. package/interactions/focus/focus-token.d.ts +0 -7
  194. package/interactions/focus-visible/focus-visible-token.d.ts +0 -7
  195. package/interactions/hover/hover-token.d.ts +0 -8
  196. package/interactions/move/move-token.d.ts +0 -7
  197. package/interactions/press/press-token.d.ts +0 -7
  198. package/internal/disabled/disabled.d.ts +0 -14
  199. package/listbox/listbox/listbox-token.d.ts +0 -7
  200. package/listbox/listbox-option/listbox-option-token.d.ts +0 -7
  201. package/listbox/listbox-section/listbox-section-token.d.ts +0 -7
  202. package/listbox/listbox-trigger/listbox-trigger-token.d.ts +0 -7
  203. package/pagination/pagination/pagination-token.d.ts +0 -8
  204. package/pagination/pagination-button/pagination-button-token.d.ts +0 -7
  205. package/pagination/pagination-first/pagination-first-token.d.ts +0 -7
  206. package/pagination/pagination-last/pagination-last-token.d.ts +0 -7
  207. package/pagination/pagination-next/pagination-next-token.d.ts +0 -7
  208. package/pagination/pagination-previous/pagination-previous-token.d.ts +0 -7
  209. package/popover/popover-trigger/popover-trigger-token.d.ts +0 -12
  210. package/progress/progress/progress-token.d.ts +0 -11
  211. package/roving-focus/roving-focus-item/roving-focus-item-token.d.ts +0 -8
  212. package/select/select/select-token.d.ts +0 -7
  213. package/separator/separator/separator-token.d.ts +0 -7
  214. package/slider/slider/slider-token.d.ts +0 -8
  215. package/slider/slider-range/slider-range-token.d.ts +0 -8
  216. package/slider/slider-thumb/slider-thumb-token.d.ts +0 -8
  217. package/slider/slider-track/slider-track-token.d.ts +0 -8
  218. package/switch/switch/switch-token.d.ts +0 -11
  219. package/tabs/tabset/tabset-token.d.ts +0 -11
  220. package/textarea/textarea/textarea-token.d.ts +0 -7
  221. package/toast/toast/toast-token.d.ts +0 -7
  222. package/toggle/toggle/toggle-token.d.ts +0 -11
  223. package/toggle-group/toggle-group/toggle-group-token.d.ts +0 -11
  224. package/toggle-group/toggle-group-item/toggle-group-item-token.d.ts +0 -11
  225. package/toolbar/toolbar/toolbar-token.d.ts +0 -11
  226. package/tooltip/tooltip-trigger/tooltip-trigger-token.d.ts +0 -15
@@ -1,17 +1,18 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, ElementRef, ViewContainerRef, Injector, input, booleanAttribute, output, numberAttribute, computed, signal, Directive } from '@angular/core';
2
+ import { InjectionToken, inject, ViewContainerRef, Injector, input, booleanAttribute, numberAttribute, signal, computed, ComponentRef, TemplateRef, Type, Directive } from '@angular/core';
3
3
  import { FocusMonitor, InteractivityChecker } from '@angular/cdk/a11y';
4
4
  import { ViewportRuler, BlockScrollStrategy, NoopScrollStrategy } from '@angular/cdk/overlay';
5
- import { TemplatePortal, DomPortalOutlet } from '@angular/cdk/portal';
5
+ import { TemplatePortal, ComponentPortal, DomPortalOutlet } from '@angular/cdk/portal';
6
6
  import { DOCUMENT } from '@angular/common';
7
7
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
8
8
  import { offset, shift, flip, autoUpdate, computePosition } from '@floating-ui/dom';
9
+ import * as i2 from 'ng-primitives/internal';
10
+ import { injectElementRef, injectExitAnimationManager, provideExitAnimationManager, NgpExitAnimation } from 'ng-primitives/internal';
9
11
  import { fromResizeEvent } from 'ng-primitives/resize';
10
- import { injectDisposables, onBooleanChange } from 'ng-primitives/utils';
12
+ import { injectDisposables } from 'ng-primitives/utils';
11
13
  import { createStateToken, createStateProvider, createStateInjector, createState } from 'ng-primitives/state';
12
14
  import * as i1 from 'ng-primitives/focus-trap';
13
15
  import { NgpFocusTrap } from 'ng-primitives/focus-trap';
14
- import { injectElementRef } from 'ng-primitives/internal';
15
16
 
16
17
  const defaultPopoverConfig = {
17
18
  offset: 4,
@@ -46,6 +47,20 @@ function injectPopoverConfig() {
46
47
  return inject(NgpPopoverConfigToken, { optional: true }) ?? defaultPopoverConfig;
47
48
  }
48
49
 
50
+ const NgpPopoverContextToken = new InjectionToken('NgpPopoverContextToken');
51
+ /**
52
+ * Inject the Popover context
53
+ */
54
+ function injectPopoverContext() {
55
+ return inject(NgpPopoverContextToken);
56
+ }
57
+ /**
58
+ * Provide the Popover context
59
+ */
60
+ function providePopoverContext(context) {
61
+ return { provide: NgpPopoverContextToken, useValue: context };
62
+ }
63
+
49
64
  /**
50
65
  * The state token for the PopoverTrigger primitive.
51
66
  */
@@ -63,21 +78,6 @@ const injectPopoverTriggerState = createStateInjector(NgpPopoverTriggerStateToke
63
78
  */
64
79
  const popoverTriggerState = createState(NgpPopoverTriggerStateToken);
65
80
 
66
- const NgpPopoverTriggerToken = new InjectionToken('NgpPopoverTriggerToken');
67
- /**
68
- * Inject the PopoverTrigger directive instance
69
- */
70
- function injectPopoverTrigger() {
71
- return inject(NgpPopoverTriggerToken);
72
- }
73
- /**
74
- * Provides the PopoverTrigger directive instance
75
- * @param trigger
76
- */
77
- function providePopoverTrigger(trigger) {
78
- return { provide: NgpPopoverTriggerToken, useExisting: trigger };
79
- }
80
-
81
81
  /**
82
82
  * Apply the `ngpPopoverTrigger` directive to an element that triggers the popover to show.
83
83
  */
@@ -86,13 +86,17 @@ class NgpPopoverTrigger {
86
86
  /**
87
87
  * Access the trigger element
88
88
  */
89
- this.trigger = inject((ElementRef));
89
+ this.trigger = injectElementRef();
90
+ /**
91
+ * Access the exit animation state.
92
+ */
93
+ this.exitAnimationState = injectExitAnimationManager();
90
94
  /**
91
95
  * Inject the parent popover trigger if available.
92
96
  */
93
- this.parentTrigger = inject(NgpPopoverTriggerToken, {
94
- optional: true,
97
+ this.parentTrigger = injectPopoverTriggerState({
95
98
  skipSelf: true,
99
+ optional: true,
96
100
  });
97
101
  /**
98
102
  * Access the view container ref.
@@ -125,23 +129,9 @@ class NgpPopoverTrigger {
125
129
  /**
126
130
  * Access the popover template ref.
127
131
  */
128
- this.popover = input.required({
132
+ this.popover = input(null, {
129
133
  alias: 'ngpPopoverTrigger',
130
134
  });
131
- /**
132
- * The open state of the popover.
133
- * @default false
134
- */
135
- this.open = input(false, {
136
- alias: 'ngpPopoverTriggerOpen',
137
- transform: booleanAttribute,
138
- });
139
- /**
140
- * Emit when the open state changes.
141
- */
142
- this.openChange = output({
143
- alias: 'ngpPopoverTriggerOpenChange',
144
- });
145
135
  /**
146
136
  * Define if the trigger should be disabled.
147
137
  * @default false
@@ -220,13 +210,20 @@ class NgpPopoverTrigger {
220
210
  alias: 'ngpPopoverTriggerScrollBehavior',
221
211
  });
222
212
  /**
223
- * The popover trigger state.
213
+ * Provide context to the popover.
214
+ * @default null
224
215
  */
225
- this.state = popoverTriggerState(this);
216
+ this.context = input(null, {
217
+ alias: 'ngpPopoverTriggerContext',
218
+ });
226
219
  /**
227
220
  * Store the popover view ref.
228
221
  */
229
- this.viewRef = null;
222
+ this.viewRef = signal(null);
223
+ /**
224
+ * Determines if the popover is open.
225
+ */
226
+ this.open = computed(() => this.viewRef() !== null);
230
227
  /**
231
228
  * Derive the popover middleware from the provided configuration.
232
229
  */
@@ -265,11 +262,14 @@ class NgpPopoverTrigger {
265
262
  * @internal
266
263
  * Register any child popover to the stack.
267
264
  */
265
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
268
266
  this.stack = [];
267
+ /**
268
+ * The popover trigger state.
269
+ */
270
+ this.state = popoverTriggerState(this);
269
271
  // if the trigger has a parent trigger then register it to the stack
270
- this.parentTrigger?.stack.push(this);
271
- // any time the open state changes then show or hide the popover
272
- onBooleanChange(this.state.open, this.show.bind(this, 'program'), this.hide.bind(this, 'program'));
272
+ this.parentTrigger()?.stack.push(this);
273
273
  // update the width of the trigger when it resizes
274
274
  fromResizeEvent(this.trigger.nativeElement)
275
275
  .pipe(takeUntilDestroyed())
@@ -277,7 +277,7 @@ class NgpPopoverTrigger {
277
277
  }
278
278
  ngOnDestroy() {
279
279
  // remove the trigger from the parent trigger's stack
280
- this.parentTrigger?.stack.splice(this.parentTrigger.stack.indexOf(this), 1);
280
+ this.parentTrigger()?.stack.splice(this.parentTrigger()?.stack.indexOf(this), 1);
281
281
  this.destroyPopover();
282
282
  }
283
283
  toggleOpenState(event) {
@@ -288,7 +288,7 @@ class NgpPopoverTrigger {
288
288
  // determine the origin of the event, 0 is keyboard, 1 is mouse
289
289
  const origin = event.detail === 0 ? 'keyboard' : 'mouse';
290
290
  // if the popover is open then hide it
291
- if (this.state.open()) {
291
+ if (this.open()) {
292
292
  this.hide(origin);
293
293
  }
294
294
  else {
@@ -296,20 +296,17 @@ class NgpPopoverTrigger {
296
296
  }
297
297
  }
298
298
  /**
299
- * @internal
300
299
  * Show the popover.
301
300
  */
302
301
  show(origin) {
303
302
  // if closing is in progress then clear the timeout to stop the popover from closing
304
303
  this.closeTimeout?.();
305
304
  // if the trigger is disabled or the popover is already open then do not show the popover
306
- if (this.state.disabled() || this.state.open() || this.openTimeout) {
305
+ if (this.state.disabled() || this.openTimeout) {
307
306
  return;
308
307
  }
309
308
  this.openTimeout = this.disposables.setTimeout(() => {
310
309
  this.openTimeout = undefined;
311
- this.state.open.set(true);
312
- this.openChange.emit(true);
313
310
  this.createPopover(origin);
314
311
  }, this.state.showDelay());
315
312
  // Add document click listener to detect outside clicks
@@ -326,27 +323,27 @@ class NgpPopoverTrigger {
326
323
  // if opening is in progress then clear the timeout to stop the popover from opening
327
324
  this.openTimeout?.();
328
325
  // if the trigger is disabled or the popover is not open then do not hide the popover
329
- if (this.state.disabled() || !this.state.open() || this.closeTimeout) {
326
+ if (this.state.disabled() || this.closeTimeout || !this.open()) {
330
327
  return;
331
328
  }
332
329
  // close all child popovers
333
330
  for (const child of this.stack) {
334
331
  child.hide(origin);
335
332
  }
336
- this.closeTimeout = this.disposables.setTimeout(() => {
333
+ this.closeTimeout = this.disposables.setTimeout(async () => {
337
334
  this.closeTimeout = undefined;
338
- this.state.open.set(false);
339
- this.openChange.emit(false);
340
- this.destroyPopover();
335
+ await this.destroyPopover();
341
336
  // ensure the trigger is focused after closing the popover
342
337
  this.disposables.setTimeout(() => this.focusTrigger(origin), 0);
343
338
  }, this.state.hideDelay());
344
339
  }
345
340
  onDocumentClick(event) {
346
341
  const target = event.target;
342
+ const viewRef = this.viewRef();
343
+ // get the popover element
344
+ const popoverElement = viewRef instanceof ComponentRef ? viewRef.location.nativeElement : viewRef?.rootNodes[0];
347
345
  // Check if the click is outside the trigger or the popover
348
- const isOutside = !this.trigger.nativeElement.contains(target) &&
349
- !this.viewRef?.rootNodes[0]?.contains(target);
346
+ const isOutside = !this.trigger.nativeElement.contains(target) && !popoverElement?.contains(target);
350
347
  // Determine if this is a click inside another popover
351
348
  if (isOutside) {
352
349
  // Close the popover
@@ -356,17 +353,37 @@ class NgpPopoverTrigger {
356
353
  createPopover(origin) {
357
354
  // clear the open timeout
358
355
  this.openTimeout = undefined;
359
- const portal = new TemplatePortal(this.state.popover(), this.viewContainerRef, undefined, this.injector);
360
- const domOutlet = new DomPortalOutlet(this.state.container() ?? this.document.body, undefined, undefined, Injector.create({
356
+ const popover = this.state.popover();
357
+ let portal;
358
+ // Create a new inject with the tooltip context
359
+ const injector = Injector.create({
361
360
  parent: this.injector,
362
- providers: [
363
- { provide: NgpPopoverTriggerToken, useValue: this },
364
- { provide: NgpPopoverTriggerStateToken, useValue: signal(this.state) },
365
- ],
366
- }));
367
- this.viewRef = domOutlet.attach(portal);
368
- this.viewRef.detectChanges();
369
- const outletElement = this.viewRef.rootNodes[0];
361
+ providers: [providePopoverContext(this.state.context())],
362
+ });
363
+ if (popover instanceof TemplateRef) {
364
+ portal = new TemplatePortal(popover, this.viewContainerRef, { $implicit: this.state.context() }, injector);
365
+ }
366
+ else if (popover instanceof Type) {
367
+ portal = new ComponentPortal(popover, this.viewContainerRef, injector);
368
+ }
369
+ else {
370
+ throw new Error('Popover must be either a TemplateRef or a ComponentType');
371
+ }
372
+ const domOutlet = new DomPortalOutlet(this.state.container() ?? this.document.body, undefined, undefined, injector);
373
+ const viewRef = domOutlet.attach(portal);
374
+ this.viewRef.set(viewRef);
375
+ let outletElement = null;
376
+ if (viewRef instanceof ComponentRef) {
377
+ viewRef.changeDetectorRef.detectChanges();
378
+ outletElement = viewRef.location.nativeElement;
379
+ }
380
+ else if (viewRef) {
381
+ viewRef.detectChanges();
382
+ outletElement = viewRef.rootNodes[0];
383
+ }
384
+ if (!outletElement) {
385
+ throw new Error('Outlet element is not available.');
386
+ }
370
387
  // determine if the popover is fixed or absolute
371
388
  const strategy = getComputedStyle(outletElement).position === 'fixed' ? 'fixed' : 'absolute';
372
389
  this.dispose = autoUpdate(this.trigger.nativeElement, outletElement, async () => {
@@ -376,24 +393,25 @@ class NgpPopoverTrigger {
376
393
  strategy,
377
394
  });
378
395
  this.position.set({ x: position.x, y: position.y });
379
- this.viewRef?.detectChanges();
396
+ viewRef?.detectChanges();
380
397
  });
381
398
  // activate the scroll strategy
382
399
  this.scrollStrategy().enable();
383
400
  // set the initial focus to the first tabbable element in the popover
384
401
  this.popoverInstance?.setInitialFocus(origin);
385
402
  }
386
- destroyPopover() {
403
+ async destroyPopover() {
387
404
  // clear the close timeout
388
405
  this.closeTimeout = undefined;
389
- this.state.open.set(false);
390
- this.openChange.emit(false);
406
+ await this.exitAnimationState.exit();
407
+ const viewRef = this.viewRef();
391
408
  // if the view is already destroyed then do not destroy it again
392
- if (this.viewRef && !this.viewRef.destroyed) {
409
+ const isDestroyed = viewRef instanceof ComponentRef ? false : viewRef?.destroyed;
410
+ if (viewRef && !isDestroyed) {
393
411
  // destroy the view ref
394
- this.viewRef.destroy();
412
+ viewRef.destroy();
395
413
  }
396
- this.viewRef = null;
414
+ this.viewRef.set(null);
397
415
  this.dispose?.();
398
416
  // deactivate the scroll strategy
399
417
  this.scrollStrategy().disable();
@@ -422,17 +440,17 @@ class NgpPopoverTrigger {
422
440
  this.popoverInstance = instance;
423
441
  }
424
442
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpPopoverTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
425
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpPopoverTrigger, isStandalone: true, selector: "[ngpPopoverTrigger]", inputs: { popover: { classPropertyName: "popover", publicName: "ngpPopoverTrigger", isSignal: true, isRequired: true, transformFunction: null }, open: { classPropertyName: "open", publicName: "ngpPopoverTriggerOpen", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpPopoverTriggerDisabled", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "ngpPopoverTriggerPlacement", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "ngpPopoverTriggerOffset", isSignal: true, isRequired: false, transformFunction: null }, showDelay: { classPropertyName: "showDelay", publicName: "ngpPopoverTriggerShowDelay", isSignal: true, isRequired: false, transformFunction: null }, hideDelay: { classPropertyName: "hideDelay", publicName: "ngpPopoverTriggerHideDelay", isSignal: true, isRequired: false, transformFunction: null }, flip: { classPropertyName: "flip", publicName: "ngpPopoverTriggerFlip", isSignal: true, isRequired: false, transformFunction: null }, container: { classPropertyName: "container", publicName: "ngpPopoverTriggerContainer", isSignal: true, isRequired: false, transformFunction: null }, closeOnOutsideClick: { classPropertyName: "closeOnOutsideClick", publicName: "ngpPopoverTriggerCloseOnOutsideClick", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "ngpPopoverTriggerCloseOnEscape", isSignal: true, isRequired: false, transformFunction: null }, scrollBehavior: { classPropertyName: "scrollBehavior", publicName: "ngpPopoverTriggerScrollBehavior", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { openChange: "ngpPopoverTriggerOpenChange" }, host: { listeners: { "click": "toggleOpenState($event)", "document:keydown.escape": "handleEscapeKey()" }, properties: { "attr.aria-expanded": "state.open() ? \"true\" : \"false\"", "attr.data-open": "state.open() ? \"\" : null", "attr.data-placement": "state.placement()", "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [providePopoverTrigger(NgpPopoverTrigger), providePopoverTriggerState()], exportAs: ["ngpPopoverTrigger"], ngImport: i0 }); }
443
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.7", type: NgpPopoverTrigger, isStandalone: true, selector: "[ngpPopoverTrigger]", inputs: { popover: { classPropertyName: "popover", publicName: "ngpPopoverTrigger", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpPopoverTriggerDisabled", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "ngpPopoverTriggerPlacement", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "ngpPopoverTriggerOffset", isSignal: true, isRequired: false, transformFunction: null }, showDelay: { classPropertyName: "showDelay", publicName: "ngpPopoverTriggerShowDelay", isSignal: true, isRequired: false, transformFunction: null }, hideDelay: { classPropertyName: "hideDelay", publicName: "ngpPopoverTriggerHideDelay", isSignal: true, isRequired: false, transformFunction: null }, flip: { classPropertyName: "flip", publicName: "ngpPopoverTriggerFlip", isSignal: true, isRequired: false, transformFunction: null }, container: { classPropertyName: "container", publicName: "ngpPopoverTriggerContainer", isSignal: true, isRequired: false, transformFunction: null }, closeOnOutsideClick: { classPropertyName: "closeOnOutsideClick", publicName: "ngpPopoverTriggerCloseOnOutsideClick", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "ngpPopoverTriggerCloseOnEscape", isSignal: true, isRequired: false, transformFunction: null }, scrollBehavior: { classPropertyName: "scrollBehavior", publicName: "ngpPopoverTriggerScrollBehavior", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "ngpPopoverTriggerContext", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "toggleOpenState($event)", "document:keydown.escape": "handleEscapeKey()" }, properties: { "attr.aria-expanded": "open() ? \"true\" : \"false\"", "attr.data-open": "open() ? \"\" : null", "attr.data-placement": "state.placement()", "attr.data-disabled": "state.disabled() ? \"\" : null" } }, providers: [providePopoverTriggerState({ inherit: false }), provideExitAnimationManager()], exportAs: ["ngpPopoverTrigger"], ngImport: i0 }); }
426
444
  }
427
445
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpPopoverTrigger, decorators: [{
428
446
  type: Directive,
429
447
  args: [{
430
448
  selector: '[ngpPopoverTrigger]',
431
449
  exportAs: 'ngpPopoverTrigger',
432
- providers: [providePopoverTrigger(NgpPopoverTrigger), providePopoverTriggerState()],
450
+ providers: [providePopoverTriggerState({ inherit: false }), provideExitAnimationManager()],
433
451
  host: {
434
- '[attr.aria-expanded]': 'state.open() ? "true" : "false"',
435
- '[attr.data-open]': 'state.open() ? "" : null',
452
+ '[attr.aria-expanded]': 'open() ? "true" : "false"',
453
+ '[attr.data-open]': 'open() ? "" : null',
436
454
  '[attr.data-placement]': 'state.placement()',
437
455
  '[attr.data-disabled]': 'state.disabled() ? "" : null',
438
456
  '(click)': 'toggleOpenState($event)',
@@ -469,14 +487,6 @@ function getTransformOrigin(placement) {
469
487
  return `${y} ${x}`;
470
488
  }
471
489
 
472
- const NgpPopoverToken = new InjectionToken('NgpPopoverToken');
473
- /**
474
- * Inject the Popover directive instance
475
- */
476
- function injectPopover() {
477
- return inject(NgpPopoverToken);
478
- }
479
-
480
490
  /**
481
491
  * Apply the `ngpPopover` directive to an element that represents the popover. This typically would be a `div` inside an `ng-template`.
482
492
  */
@@ -497,20 +507,20 @@ class NgpPopover {
497
507
  /**
498
508
  * Access the trigger instance.
499
509
  */
500
- this.trigger = injectPopoverTrigger();
510
+ this.trigger = injectPopoverTriggerState();
501
511
  /**
502
512
  * Compute the x position of the popover.
503
513
  */
504
- this.x = computed(() => this.trigger.position().x);
514
+ this.x = computed(() => this.trigger().position().x);
505
515
  /**
506
516
  * Compute the y position of the popover.
507
517
  */
508
- this.y = computed(() => this.trigger.position().y);
518
+ this.y = computed(() => this.trigger().position().y);
509
519
  /**
510
520
  * Derive the transform origin of the popover.
511
521
  */
512
- this.transformOrigin = computed(() => getTransformOrigin(this.trigger.placement()));
513
- this.trigger.setPopover(this);
522
+ this.transformOrigin = computed(() => getTransformOrigin(this.trigger().placement()));
523
+ this.trigger().setPopover(this);
514
524
  }
515
525
  /**
516
526
  * Focus the first tabbable element inside the popover.
@@ -534,22 +544,21 @@ class NgpPopover {
534
544
  }
535
545
  }
536
546
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpPopover, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
537
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpPopover, isStandalone: true, selector: "[ngpPopover]", host: { attributes: { "role": "menu" }, listeners: { "keydown.escape": "trigger.handleEscapeKey()" }, properties: { "style.left.px": "x()", "style.top.px": "y()", "style.--ngp-popover-trigger-width.px": "trigger.width()", "style.--ngp-popover-transform-origin": "transformOrigin()" } }, providers: [{ provide: NgpPopoverToken, useExisting: NgpPopover }], exportAs: ["ngpPopover"], hostDirectives: [{ directive: i1.NgpFocusTrap }], ngImport: i0 }); }
547
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.7", type: NgpPopover, isStandalone: true, selector: "[ngpPopover]", host: { attributes: { "role": "menu" }, listeners: { "keydown.escape": "trigger().handleEscapeKey()" }, properties: { "style.left.px": "x()", "style.top.px": "y()", "style.--ngp-popover-trigger-width.px": "trigger().width()", "style.--ngp-popover-transform-origin": "transformOrigin()" } }, exportAs: ["ngpPopover"], hostDirectives: [{ directive: i1.NgpFocusTrap }, { directive: i2.NgpExitAnimation }], ngImport: i0 }); }
538
548
  }
539
549
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImport: i0, type: NgpPopover, decorators: [{
540
550
  type: Directive,
541
551
  args: [{
542
552
  selector: '[ngpPopover]',
543
553
  exportAs: 'ngpPopover',
544
- hostDirectives: [NgpFocusTrap],
545
- providers: [{ provide: NgpPopoverToken, useExisting: NgpPopover }],
554
+ hostDirectives: [NgpFocusTrap, NgpExitAnimation],
546
555
  host: {
547
556
  role: 'menu',
548
557
  '[style.left.px]': 'x()',
549
558
  '[style.top.px]': 'y()',
550
- '[style.--ngp-popover-trigger-width.px]': 'trigger.width()',
559
+ '[style.--ngp-popover-trigger-width.px]': 'trigger().width()',
551
560
  '[style.--ngp-popover-transform-origin]': 'transformOrigin()',
552
- '(keydown.escape)': 'trigger.handleEscapeKey()',
561
+ '(keydown.escape)': 'trigger().handleEscapeKey()',
553
562
  },
554
563
  }]
555
564
  }], ctorParameters: () => [] });
@@ -558,5 +567,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.7", ngImpor
558
567
  * Generated bundle index. Do not edit.
559
568
  */
560
569
 
561
- export { NgpPopover, NgpPopoverToken, NgpPopoverTrigger, NgpPopoverTriggerToken, getTransformOrigin, injectPopover, injectPopoverTrigger, injectPopoverTriggerState, providePopoverConfig, providePopoverTrigger, providePopoverTriggerState };
570
+ export { NgpPopover, NgpPopoverContextToken, NgpPopoverTrigger, getTransformOrigin, injectPopoverContext, injectPopoverTriggerState, providePopoverConfig, providePopoverTriggerState };
562
571
  //# sourceMappingURL=ng-primitives-popover.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ng-primitives-popover.mjs","sources":["../../../../packages/ng-primitives/popover/src/config/popover-config.ts","../../../../packages/ng-primitives/popover/src/popover-trigger/popover-trigger-state.ts","../../../../packages/ng-primitives/popover/src/popover-trigger/popover-trigger-token.ts","../../../../packages/ng-primitives/popover/src/popover-trigger/popover-trigger.ts","../../../../packages/ng-primitives/popover/src/utils/transform-origin.ts","../../../../packages/ng-primitives/popover/src/popover/popover-token.ts","../../../../packages/ng-primitives/popover/src/popover/popover.ts","../../../../packages/ng-primitives/popover/src/ng-primitives-popover.ts"],"sourcesContent":["import { InjectionToken, Provider, inject } from '@angular/core';\nimport { type Placement } from '@floating-ui/dom';\n\nexport interface NgpPopoverConfig {\n /**\n * Define the offset of the popover relative to the trigger.\n * @default 4\n */\n offset: number;\n\n /**\n * Define the placement of the popover relative to the trigger.\n * @default 'bottom'\n */\n placement: Placement;\n\n /**\n * Define the delay before the popover is shown.\n * @default 0\n */\n showDelay: number;\n\n /**\n * Define the delay before the popover is hidden.\n * @default 0\n */\n hideDelay: number;\n\n /**\n * Define whether the popover should flip when there is not enough space for the popover.\n * @default true\n */\n flip: boolean;\n\n /**\n * Define the container in to which the popover should be attached.\n * @default document.body\n */\n container: HTMLElement | null;\n\n /**\n * Define whether the popover should close when clicking outside of it.\n * @default true\n */\n closeOnOutsideClick: boolean;\n\n /**\n * Define whether the popover should close when the escape key is pressed.\n * @default true\n */\n closeOnEscape: boolean;\n\n /**\n * Defines how the popover behaves when the window is scrolled.\n * @default scroll\n */\n scrollBehavior: 'reposition' | 'block';\n}\n\nexport const defaultPopoverConfig: NgpPopoverConfig = {\n offset: 4,\n placement: 'bottom',\n showDelay: 0,\n hideDelay: 0,\n flip: true,\n container: null,\n closeOnOutsideClick: true,\n closeOnEscape: true,\n scrollBehavior: 'reposition',\n};\n\nexport const NgpPopoverConfigToken = new InjectionToken<NgpPopoverConfig>('NgpPopoverConfigToken');\n\n/**\n * Provide the default Popover configuration\n * @param config The Popover configuration\n * @returns The provider\n */\nexport function providePopoverConfig(config: Partial<NgpPopoverConfig>): Provider[] {\n return [\n {\n provide: NgpPopoverConfigToken,\n useValue: { ...defaultPopoverConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the Popover configuration\n * @returns The global Popover configuration\n */\nexport function injectPopoverConfig(): NgpPopoverConfig {\n return inject(NgpPopoverConfigToken, { optional: true }) ?? defaultPopoverConfig;\n}\n","import {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n} from 'ng-primitives/state';\nimport type { NgpPopoverTrigger } from './popover-trigger';\n\n/**\n * The state token for the PopoverTrigger primitive.\n */\nexport const NgpPopoverTriggerStateToken = createStateToken<NgpPopoverTrigger>('PopoverTrigger');\n\n/**\n * Provides the PopoverTrigger state.\n */\nexport const providePopoverTriggerState = createStateProvider(NgpPopoverTriggerStateToken);\n\n/**\n * Injects the PopoverTrigger state.\n */\nexport const injectPopoverTriggerState = createStateInjector<NgpPopoverTrigger>(\n NgpPopoverTriggerStateToken,\n);\n\n/**\n * The PopoverTrigger state registration function.\n */\nexport const popoverTriggerState = createState(NgpPopoverTriggerStateToken);\n","import { ExistingProvider, InjectionToken, Type, inject } from '@angular/core';\nimport type { NgpPopoverTrigger } from './popover-trigger';\n\nexport const NgpPopoverTriggerToken = new InjectionToken<NgpPopoverTrigger>(\n 'NgpPopoverTriggerToken',\n);\n\n/**\n * Inject the PopoverTrigger directive instance\n */\nexport function injectPopoverTrigger(): NgpPopoverTrigger {\n return inject(NgpPopoverTriggerToken);\n}\n\n/**\n * Provides the PopoverTrigger directive instance\n * @param trigger\n */\nexport function providePopoverTrigger(trigger: Type<NgpPopoverTrigger>): ExistingProvider {\n return { provide: NgpPopoverTriggerToken, useExisting: trigger };\n}\n","import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';\nimport { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport { BlockScrollStrategy, NoopScrollStrategy, ViewportRuler } from '@angular/cdk/overlay';\nimport { DomPortalOutlet, TemplatePortal } from '@angular/cdk/portal';\nimport { DOCUMENT } from '@angular/common';\nimport {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n EmbeddedViewRef,\n inject,\n Injector,\n input,\n numberAttribute,\n OnDestroy,\n output,\n signal,\n TemplateRef,\n ViewContainerRef,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n autoUpdate,\n computePosition,\n flip,\n Middleware,\n offset,\n Placement,\n shift,\n} from '@floating-ui/dom';\nimport { fromResizeEvent } from 'ng-primitives/resize';\nimport { injectDisposables, onBooleanChange } from 'ng-primitives/utils';\nimport { injectPopoverConfig } from '../config/popover-config';\nimport type { NgpPopover } from '../popover/popover';\nimport {\n NgpPopoverTriggerStateToken,\n popoverTriggerState,\n providePopoverTriggerState,\n} from './popover-trigger-state';\nimport { NgpPopoverTriggerToken, providePopoverTrigger } from './popover-trigger-token';\n\n/**\n * Apply the `ngpPopoverTrigger` directive to an element that triggers the popover to show.\n */\n@Directive({\n selector: '[ngpPopoverTrigger]',\n exportAs: 'ngpPopoverTrigger',\n providers: [providePopoverTrigger(NgpPopoverTrigger), providePopoverTriggerState()],\n host: {\n '[attr.aria-expanded]': 'state.open() ? \"true\" : \"false\"',\n '[attr.data-open]': 'state.open() ? \"\" : null',\n '[attr.data-placement]': 'state.placement()',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '(click)': 'toggleOpenState($event)',\n '(document:keydown.escape)': 'handleEscapeKey()',\n },\n})\nexport class NgpPopoverTrigger implements OnDestroy {\n /**\n * Access the trigger element\n */\n private readonly trigger = inject(ElementRef<HTMLElement>);\n\n /**\n * Inject the parent popover trigger if available.\n */\n private readonly parentTrigger = inject(NgpPopoverTriggerToken, {\n optional: true,\n skipSelf: true,\n });\n\n /**\n * Access the view container ref.\n */\n private readonly viewContainerRef = inject(ViewContainerRef);\n\n /**\n * Access the document.\n */\n private readonly document = inject(DOCUMENT);\n\n /**\n * Access the viewport ruler.\n */\n private readonly viewportRuler = inject(ViewportRuler);\n\n /**\n * Access the injector.\n */\n private readonly injector = inject(Injector);\n\n /**\n * Access the global popover configuration.\n */\n private readonly config = injectPopoverConfig();\n\n /**\n * Access the disposable utilities\n */\n private readonly disposables = injectDisposables();\n\n /**\n * Access the focus monitor.\n */\n private readonly focusMonitor = inject(FocusMonitor);\n\n /**\n * Access the popover template ref.\n */\n readonly popover = input.required<TemplateRef<void>>({\n alias: 'ngpPopoverTrigger',\n });\n\n /**\n * The open state of the popover.\n * @default false\n */\n readonly open = input<boolean, BooleanInput>(false, {\n alias: 'ngpPopoverTriggerOpen',\n transform: booleanAttribute,\n });\n\n /**\n * Emit when the open state changes.\n */\n readonly openChange = output<boolean>({\n alias: 'ngpPopoverTriggerOpenChange',\n });\n\n /**\n * Define if the trigger should be disabled.\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpPopoverTriggerDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Define the placement of the popover relative to the trigger.\n * @default 'top'\n */\n readonly placement = input<Placement>(this.config.placement, {\n alias: 'ngpPopoverTriggerPlacement',\n });\n\n /**\n * Define the offset of the popover relative to the trigger.\n * @default 0\n */\n readonly offset = input<number, NumberInput>(this.config.offset, {\n alias: 'ngpPopoverTriggerOffset',\n transform: numberAttribute,\n });\n\n /**\n * Define the delay before the popover is displayed.\n * @default 0\n */\n readonly showDelay = input<number, NumberInput>(this.config.showDelay, {\n alias: 'ngpPopoverTriggerShowDelay',\n transform: numberAttribute,\n });\n\n /**\n * Define the delay before the popover is hidden.\n * @default 0\n */\n readonly hideDelay = input<number, NumberInput>(this.config.hideDelay, {\n alias: 'ngpPopoverTriggerHideDelay',\n transform: numberAttribute,\n });\n\n /**\n * Define whether the popover should flip when there is not enough space for the popover.\n * @default true\n */\n readonly flip = input<boolean, BooleanInput>(this.config.flip, {\n alias: 'ngpPopoverTriggerFlip',\n transform: booleanAttribute,\n });\n\n /**\n * Define the container in which the popover should be attached.\n * @default document.body\n */\n readonly container = input<HTMLElement | null>(this.config.container, {\n alias: 'ngpPopoverTriggerContainer',\n });\n\n /**\n * Define whether the popover should close when clicking outside of it.\n * @default true\n */\n readonly closeOnOutsideClick = input<boolean, BooleanInput>(this.config.closeOnOutsideClick, {\n alias: 'ngpPopoverTriggerCloseOnOutsideClick',\n transform: booleanAttribute,\n });\n\n /**\n * Define whether the popover should close when the escape key is pressed.\n * @default true\n */\n readonly closeOnEscape = input<boolean, BooleanInput>(this.config.closeOnEscape, {\n alias: 'ngpPopoverTriggerCloseOnEscape',\n transform: booleanAttribute,\n });\n\n /**\n * Defines how the popover behaves when the window is scrolled.\n * @default 'reposition'\n */\n readonly scrollBehavior = input<'reposition' | 'block'>(this.config.scrollBehavior, {\n alias: 'ngpPopoverTriggerScrollBehavior',\n });\n\n /**\n * The popover trigger state.\n */\n protected readonly state = popoverTriggerState<NgpPopoverTrigger>(this);\n\n /**\n * Store the popover view ref.\n */\n private viewRef: EmbeddedViewRef<void> | null = null;\n\n /**\n * Derive the popover middleware from the provided configuration.\n */\n private readonly middleware = computed(() => {\n const middleware: Middleware[] = [offset(this.state.offset()), shift()];\n\n if (this.state.flip()) {\n middleware.push(flip());\n }\n\n return middleware;\n });\n\n /**\n * Store the computed position of the popover.\n * @internal\n */\n readonly position = signal<{ x: number; y: number }>({\n x: 0,\n y: 0,\n });\n\n /**\n * @internal\n * Store the trigger width.\n */\n readonly width = signal<number | null>(null);\n\n /**\n * The dispose function to stop computing the position of the popover.\n */\n private dispose?: () => void;\n\n /**\n * A document-wide click listener that checks if the click\n * occurred outside of the popover and trigger elements.\n */\n private documentClickListener?: (event: MouseEvent) => void;\n\n /**\n * Store the popover instance.\n * @internal\n */\n private popoverInstance: NgpPopover | null = null;\n\n /**\n * Get the scroll strategy based on the configuration.\n */\n private readonly scrollStrategy = computed(() =>\n this.state.scrollBehavior() === 'block'\n ? new BlockScrollStrategy(this.viewportRuler, this.document)\n : new NoopScrollStrategy(),\n );\n\n /**\n * @internal\n * Register any child popover to the stack.\n */\n private readonly stack: NgpPopoverTrigger[] = [];\n\n /**\n * @internal\n * The timeout to open the popover.\n */\n private openTimeout?: () => void;\n\n /**\n * @internal\n * The timeout to close the popover.\n */\n private closeTimeout?: () => void;\n\n constructor() {\n // if the trigger has a parent trigger then register it to the stack\n this.parentTrigger?.stack.push(this);\n\n // any time the open state changes then show or hide the popover\n onBooleanChange(\n this.state.open,\n this.show.bind(this, 'program'),\n this.hide.bind(this, 'program'),\n );\n\n // update the width of the trigger when it resizes\n fromResizeEvent(this.trigger.nativeElement)\n .pipe(takeUntilDestroyed())\n .subscribe(() => this.width.set(this.trigger.nativeElement.offsetWidth));\n }\n\n ngOnDestroy(): void {\n // remove the trigger from the parent trigger's stack\n this.parentTrigger?.stack.splice(this.parentTrigger.stack.indexOf(this), 1);\n\n this.destroyPopover();\n }\n\n protected toggleOpenState(event: MouseEvent): void {\n // if the trigger is disabled then do not toggle the popover\n if (this.state.disabled()) {\n return;\n }\n\n // determine the origin of the event, 0 is keyboard, 1 is mouse\n const origin: FocusOrigin = event.detail === 0 ? 'keyboard' : 'mouse';\n\n // if the popover is open then hide it\n if (this.state.open()) {\n this.hide(origin);\n } else {\n this.show(origin);\n }\n }\n\n /**\n * @internal\n * Show the popover.\n */\n show(origin: FocusOrigin): void {\n // if closing is in progress then clear the timeout to stop the popover from closing\n this.closeTimeout?.();\n\n // if the trigger is disabled or the popover is already open then do not show the popover\n if (this.state.disabled() || this.state.open() || this.openTimeout) {\n return;\n }\n\n this.openTimeout = this.disposables.setTimeout(() => {\n this.openTimeout = undefined;\n this.state.open.set(true);\n this.openChange.emit(true);\n this.createPopover(origin);\n }, this.state.showDelay());\n\n // Add document click listener to detect outside clicks\n if (this.state.closeOnOutsideClick()) {\n this.documentClickListener = this.onDocumentClick.bind(this);\n this.document.addEventListener('mouseup', this.documentClickListener, true);\n }\n }\n\n /**\n * @internal\n * Hide the popover.\n */\n hide(origin: FocusOrigin = 'program'): void {\n // if opening is in progress then clear the timeout to stop the popover from opening\n this.openTimeout?.();\n\n // if the trigger is disabled or the popover is not open then do not hide the popover\n if (this.state.disabled() || !this.state.open() || this.closeTimeout) {\n return;\n }\n\n // close all child popovers\n for (const child of this.stack) {\n child.hide(origin);\n }\n\n this.closeTimeout = this.disposables.setTimeout(() => {\n this.closeTimeout = undefined;\n this.state.open.set(false);\n this.openChange.emit(false);\n\n this.destroyPopover();\n // ensure the trigger is focused after closing the popover\n this.disposables.setTimeout(() => this.focusTrigger(origin), 0);\n }, this.state.hideDelay());\n }\n\n private onDocumentClick(event: MouseEvent): void {\n const target = event.target as HTMLElement;\n\n // Check if the click is outside the trigger or the popover\n const isOutside =\n !this.trigger.nativeElement.contains(target) &&\n !(this.viewRef?.rootNodes[0] as HTMLElement)?.contains(target);\n\n // Determine if this is a click inside another popover\n\n if (isOutside) {\n // Close the popover\n this.hide('mouse');\n }\n }\n\n private createPopover(origin: FocusOrigin): void {\n // clear the open timeout\n this.openTimeout = undefined;\n\n const portal = new TemplatePortal(\n this.state.popover(),\n this.viewContainerRef,\n undefined,\n this.injector,\n );\n\n const domOutlet = new DomPortalOutlet(\n this.state.container() ?? this.document.body,\n undefined,\n undefined,\n Injector.create({\n parent: this.injector,\n providers: [\n { provide: NgpPopoverTriggerToken, useValue: this },\n { provide: NgpPopoverTriggerStateToken, useValue: signal(this.state) },\n ],\n }),\n );\n\n this.viewRef = domOutlet.attach(portal);\n this.viewRef.detectChanges();\n\n const outletElement = this.viewRef.rootNodes[0];\n\n // determine if the popover is fixed or absolute\n const strategy = getComputedStyle(outletElement).position === 'fixed' ? 'fixed' : 'absolute';\n\n this.dispose = autoUpdate(this.trigger.nativeElement, outletElement, async () => {\n const position = await computePosition(this.trigger.nativeElement, outletElement, {\n placement: this.state.placement(),\n middleware: this.middleware(),\n strategy,\n });\n\n this.position.set({ x: position.x, y: position.y });\n this.viewRef?.detectChanges();\n });\n\n // activate the scroll strategy\n this.scrollStrategy().enable();\n\n // set the initial focus to the first tabbable element in the popover\n this.popoverInstance?.setInitialFocus(origin);\n }\n\n private destroyPopover(): void {\n // clear the close timeout\n this.closeTimeout = undefined;\n\n this.state.open.set(false);\n this.openChange.emit(false);\n\n // if the view is already destroyed then do not destroy it again\n if (this.viewRef && !this.viewRef.destroyed) {\n // destroy the view ref\n this.viewRef.destroy();\n }\n\n this.viewRef = null;\n this.dispose?.();\n\n // deactivate the scroll strategy\n this.scrollStrategy().disable();\n\n // Remove the document click listener when the popover is hidden\n if (this.documentClickListener) {\n this.document.removeEventListener('mouseup', this.documentClickListener, true);\n }\n }\n\n /**\n * @internal\n * Handle escape key press to close the popover.\n */\n protected handleEscapeKey(): void {\n if (this.state.closeOnEscape()) {\n this.hide('keyboard');\n }\n }\n\n private focusTrigger(origin: FocusOrigin): void {\n this.focusMonitor.focusVia(this.trigger.nativeElement, origin);\n }\n\n /**\n * Set the popover instance.\n * @internal\n */\n setPopover(instance: NgpPopover): void {\n this.popoverInstance = instance;\n }\n}\n","import type { Placement } from '@floating-ui/dom';\n\nexport function getTransformOrigin(placement: Placement): string {\n const basePlacement = placement.split('-')[0]; // Extract \"top\", \"bottom\", etc.\n const alignment = placement.split('-')[1]; // Extract \"start\" or \"end\"\n\n const map: Record<string, string> = {\n top: 'bottom',\n bottom: 'top',\n left: 'right',\n right: 'left',\n };\n\n let x = 'center';\n let y = 'center';\n\n if (basePlacement === 'top' || basePlacement === 'bottom') {\n y = map[basePlacement];\n if (alignment === 'start') x = 'left';\n else if (alignment === 'end') x = 'right';\n } else {\n x = map[basePlacement];\n if (alignment === 'start') y = 'top';\n else if (alignment === 'end') y = 'bottom';\n }\n\n return `${y} ${x}`;\n}\n","import { InjectionToken, inject } from '@angular/core';\nimport type { NgpPopover } from './popover';\n\nexport const NgpPopoverToken = new InjectionToken<NgpPopover>('NgpPopoverToken');\n\n/**\n * Inject the Popover directive instance\n */\nexport function injectPopover(): NgpPopover {\n return inject(NgpPopoverToken);\n}\n","import { FocusMonitor, FocusOrigin, InteractivityChecker } from '@angular/cdk/a11y';\nimport { computed, Directive, inject } from '@angular/core';\nimport { NgpFocusTrap } from 'ng-primitives/focus-trap';\nimport { injectElementRef } from 'ng-primitives/internal';\nimport { injectPopoverTrigger } from '../popover-trigger/popover-trigger-token';\nimport { getTransformOrigin } from '../utils/transform-origin';\nimport { NgpPopoverToken } from './popover-token';\n\n/**\n * Apply the `ngpPopover` directive to an element that represents the popover. This typically would be a `div` inside an `ng-template`.\n */\n@Directive({\n selector: '[ngpPopover]',\n exportAs: 'ngpPopover',\n hostDirectives: [NgpFocusTrap],\n providers: [{ provide: NgpPopoverToken, useExisting: NgpPopover }],\n host: {\n role: 'menu',\n '[style.left.px]': 'x()',\n '[style.top.px]': 'y()',\n '[style.--ngp-popover-trigger-width.px]': 'trigger.width()',\n '[style.--ngp-popover-transform-origin]': 'transformOrigin()',\n '(keydown.escape)': 'trigger.handleEscapeKey()',\n },\n})\nexport class NgpPopover {\n /**\n * Access the popover element.\n */\n private readonly popover = injectElementRef();\n\n /**\n * Access the interactivity checker.\n */\n private readonly interactivity = inject(InteractivityChecker);\n\n /**\n * Access the focus monitor.\n */\n private readonly focusMonitor = inject(FocusMonitor);\n\n /**\n * Access the trigger instance.\n */\n protected readonly trigger = injectPopoverTrigger();\n\n /**\n * Compute the x position of the popover.\n */\n protected readonly x = computed(() => this.trigger.position().x);\n\n /**\n * Compute the y position of the popover.\n */\n protected readonly y = computed(() => this.trigger.position().y);\n\n /**\n * Derive the transform origin of the popover.\n */\n protected readonly transformOrigin = computed(() => getTransformOrigin(this.trigger.placement()));\n\n constructor() {\n this.trigger.setPopover(this);\n }\n\n /**\n * Focus the first tabbable element inside the popover.\n * If no tabbable element is found, focus the popover itself.\n * @internal\n */\n setInitialFocus(origin: FocusOrigin): void {\n // use a tree walker to find the first tabbable child\n const treeWalker = document.createTreeWalker(\n this.popover.nativeElement,\n NodeFilter.SHOW_ELEMENT,\n {\n acceptNode: node =>\n node instanceof HTMLElement && this.interactivity.isTabbable(node)\n ? NodeFilter.FILTER_ACCEPT\n : NodeFilter.FILTER_SKIP,\n },\n );\n\n const tabbableNode = treeWalker.nextNode() as HTMLElement | null;\n\n if (tabbableNode) {\n this.focusMonitor.focusVia(tabbableNode, origin);\n } else {\n // if no tabbable child is found, focus the popover element itself\n this.popover.nativeElement.focus();\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA2DO,MAAM,oBAAoB,GAAqB;AACpD,IAAA,MAAM,EAAE,CAAC;AACT,IAAA,SAAS,EAAE,QAAQ;AACnB,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,mBAAmB,EAAE,IAAI;AACzB,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,cAAc,EAAE,YAAY;CAC7B;AAEM,MAAM,qBAAqB,GAAG,IAAI,cAAc,CAAmB,uBAAuB,CAAC;AAElG;;;;AAIG;AACG,SAAU,oBAAoB,CAAC,MAAiC,EAAA;IACpE,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,qBAAqB;AAC9B,YAAA,QAAQ,EAAE,EAAE,GAAG,oBAAoB,EAAE,GAAG,MAAM,EAAE;AACjD,SAAA;KACF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A,CAAA;;2FAUvD,UAAU,EAAA,UAAA,EAAA,CAAA;kBAdtB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,cAAc;AACxB,oBAAA,QAAQ,EAAE,YAAY;oBACtB,cAAc,EAAE,CAAC,YAAY,CAAC;oBAC9B,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAY,UAAA,EAAE,CAAC;AAClE,oBAAA,IAAI,EAAE;AACJ,wBAAA,IAAI,EAAE,MAAM;AACZ,wBAAA,iBAAiB,EAAE,KAAK;AACxB,wBAAA,gBAAgB,EAAE,KAAK;AACvB,wBAAA,wCAAwC,EAAE,iBAAiB;AAC3D,wBAAA,wCAAwC,EAAE,mBAAmB;AAC7D,wBAAA,kBAAkB,EAAE,2BAA2B;AAChD,qBAAA;AACF,iBAAA;;;ACxBD;;AAEG;;;;"}
1
+ {"version":3,"file":"ng-primitives-popover.mjs","sources":["../../../../packages/ng-primitives/popover/src/config/popover-config.ts","../../../../packages/ng-primitives/popover/src/popover/popover-token.ts","../../../../packages/ng-primitives/popover/src/popover-trigger/popover-trigger-state.ts","../../../../packages/ng-primitives/popover/src/popover-trigger/popover-trigger.ts","../../../../packages/ng-primitives/popover/src/utils/transform-origin.ts","../../../../packages/ng-primitives/popover/src/popover/popover.ts","../../../../packages/ng-primitives/popover/src/ng-primitives-popover.ts"],"sourcesContent":["import { InjectionToken, Provider, inject } from '@angular/core';\nimport { type Placement } from '@floating-ui/dom';\n\nexport interface NgpPopoverConfig {\n /**\n * Define the offset of the popover relative to the trigger.\n * @default 4\n */\n offset: number;\n\n /**\n * Define the placement of the popover relative to the trigger.\n * @default 'bottom'\n */\n placement: Placement;\n\n /**\n * Define the delay before the popover is shown.\n * @default 0\n */\n showDelay: number;\n\n /**\n * Define the delay before the popover is hidden.\n * @default 0\n */\n hideDelay: number;\n\n /**\n * Define whether the popover should flip when there is not enough space for the popover.\n * @default true\n */\n flip: boolean;\n\n /**\n * Define the container in to which the popover should be attached.\n * @default document.body\n */\n container: HTMLElement | null;\n\n /**\n * Define whether the popover should close when clicking outside of it.\n * @default true\n */\n closeOnOutsideClick: boolean;\n\n /**\n * Define whether the popover should close when the escape key is pressed.\n * @default true\n */\n closeOnEscape: boolean;\n\n /**\n * Defines how the popover behaves when the window is scrolled.\n * @default scroll\n */\n scrollBehavior: 'reposition' | 'block';\n}\n\nexport const defaultPopoverConfig: NgpPopoverConfig = {\n offset: 4,\n placement: 'bottom',\n showDelay: 0,\n hideDelay: 0,\n flip: true,\n container: null,\n closeOnOutsideClick: true,\n closeOnEscape: true,\n scrollBehavior: 'reposition',\n};\n\nexport const NgpPopoverConfigToken = new InjectionToken<NgpPopoverConfig>('NgpPopoverConfigToken');\n\n/**\n * Provide the default Popover configuration\n * @param config The Popover configuration\n * @returns The provider\n */\nexport function providePopoverConfig(config: Partial<NgpPopoverConfig>): Provider[] {\n return [\n {\n provide: NgpPopoverConfigToken,\n useValue: { ...defaultPopoverConfig, ...config },\n },\n ];\n}\n\n/**\n * Inject the Popover configuration\n * @returns The global Popover configuration\n */\nexport function injectPopoverConfig(): NgpPopoverConfig {\n return inject(NgpPopoverConfigToken, { optional: true }) ?? defaultPopoverConfig;\n}\n","import { inject, InjectionToken, ValueProvider } from '@angular/core';\n\nexport const NgpPopoverContextToken = new InjectionToken<unknown>('NgpPopoverContextToken');\n\n/**\n * Inject the Popover context\n */\nexport function injectPopoverContext<T>(): T {\n return inject(NgpPopoverContextToken) as T;\n}\n\n/**\n * Provide the Popover context\n */\nexport function providePopoverContext<T>(context: T): ValueProvider {\n return { provide: NgpPopoverContextToken, useValue: context };\n}\n","import { InjectOptions, Signal } from '@angular/core';\nimport {\n createState,\n createStateInjector,\n createStateProvider,\n createStateToken,\n State,\n} from 'ng-primitives/state';\nimport type { NgpPopoverTrigger } from './popover-trigger';\n\n/**\n * The state token for the PopoverTrigger primitive.\n */\nexport const NgpPopoverTriggerStateToken = createStateToken<NgpPopoverTrigger>('PopoverTrigger');\n\n/**\n * Provides the PopoverTrigger state.\n */\nexport const providePopoverTriggerState = createStateProvider(NgpPopoverTriggerStateToken);\n\n/**\n * Injects the PopoverTrigger state.\n */\nexport const injectPopoverTriggerState = createStateInjector<NgpPopoverTrigger>(\n NgpPopoverTriggerStateToken,\n) as <T>(options?: InjectOptions) => Signal<State<NgpPopoverTrigger<T>>>;\n\n/**\n * The PopoverTrigger state registration function.\n */\nexport const popoverTriggerState = createState(NgpPopoverTriggerStateToken);\n","import { FocusMonitor, FocusOrigin } from '@angular/cdk/a11y';\nimport { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport { BlockScrollStrategy, NoopScrollStrategy, ViewportRuler } from '@angular/cdk/overlay';\nimport { ComponentPortal, DomPortalOutlet, TemplatePortal } from '@angular/cdk/portal';\nimport { DOCUMENT } from '@angular/common';\nimport {\n booleanAttribute,\n ComponentRef,\n computed,\n Directive,\n EmbeddedViewRef,\n inject,\n Injector,\n input,\n numberAttribute,\n OnDestroy,\n signal,\n TemplateRef,\n Type,\n ViewContainerRef,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n autoUpdate,\n computePosition,\n flip,\n Middleware,\n offset,\n Placement,\n shift,\n} from '@floating-ui/dom';\nimport {\n injectElementRef,\n injectExitAnimationManager,\n provideExitAnimationManager,\n} from 'ng-primitives/internal';\nimport { fromResizeEvent } from 'ng-primitives/resize';\nimport { injectDisposables } from 'ng-primitives/utils';\nimport { injectPopoverConfig } from '../config/popover-config';\nimport type { NgpPopover } from '../popover/popover';\nimport { providePopoverContext } from '../popover/popover-token';\nimport {\n injectPopoverTriggerState,\n popoverTriggerState,\n providePopoverTriggerState,\n} from './popover-trigger-state';\n\n/**\n * Apply the `ngpPopoverTrigger` directive to an element that triggers the popover to show.\n */\n@Directive({\n selector: '[ngpPopoverTrigger]',\n exportAs: 'ngpPopoverTrigger',\n providers: [providePopoverTriggerState({ inherit: false }), provideExitAnimationManager()],\n host: {\n '[attr.aria-expanded]': 'open() ? \"true\" : \"false\"',\n '[attr.data-open]': 'open() ? \"\" : null',\n '[attr.data-placement]': 'state.placement()',\n '[attr.data-disabled]': 'state.disabled() ? \"\" : null',\n '(click)': 'toggleOpenState($event)',\n '(document:keydown.escape)': 'handleEscapeKey()',\n },\n})\nexport class NgpPopoverTrigger<T = null> implements OnDestroy {\n /**\n * Access the trigger element\n */\n private readonly trigger = injectElementRef();\n\n /**\n * Access the exit animation state.\n */\n private readonly exitAnimationState = injectExitAnimationManager();\n\n /**\n * Inject the parent popover trigger if available.\n */\n private readonly parentTrigger = injectPopoverTriggerState<T>({\n skipSelf: true,\n optional: true,\n });\n\n /**\n * Access the view container ref.\n */\n private readonly viewContainerRef = inject(ViewContainerRef);\n\n /**\n * Access the document.\n */\n private readonly document = inject(DOCUMENT);\n\n /**\n * Access the viewport ruler.\n */\n private readonly viewportRuler = inject(ViewportRuler);\n\n /**\n * Access the injector.\n */\n private readonly injector = inject(Injector);\n\n /**\n * Access the global popover configuration.\n */\n private readonly config = injectPopoverConfig();\n\n /**\n * Access the disposable utilities\n */\n private readonly disposables = injectDisposables();\n\n /**\n * Access the focus monitor.\n */\n private readonly focusMonitor = inject(FocusMonitor);\n\n /**\n * Access the popover template ref.\n */\n readonly popover = input<NgpPopoverContent<T> | null>(null, {\n alias: 'ngpPopoverTrigger',\n });\n\n /**\n * Define if the trigger should be disabled.\n * @default false\n */\n readonly disabled = input<boolean, BooleanInput>(false, {\n alias: 'ngpPopoverTriggerDisabled',\n transform: booleanAttribute,\n });\n\n /**\n * Define the placement of the popover relative to the trigger.\n * @default 'top'\n */\n readonly placement = input<Placement>(this.config.placement, {\n alias: 'ngpPopoverTriggerPlacement',\n });\n\n /**\n * Define the offset of the popover relative to the trigger.\n * @default 0\n */\n readonly offset = input<number, NumberInput>(this.config.offset, {\n alias: 'ngpPopoverTriggerOffset',\n transform: numberAttribute,\n });\n\n /**\n * Define the delay before the popover is displayed.\n * @default 0\n */\n readonly showDelay = input<number, NumberInput>(this.config.showDelay, {\n alias: 'ngpPopoverTriggerShowDelay',\n transform: numberAttribute,\n });\n\n /**\n * Define the delay before the popover is hidden.\n * @default 0\n */\n readonly hideDelay = input<number, NumberInput>(this.config.hideDelay, {\n alias: 'ngpPopoverTriggerHideDelay',\n transform: numberAttribute,\n });\n\n /**\n * Define whether the popover should flip when there is not enough space for the popover.\n * @default true\n */\n readonly flip = input<boolean, BooleanInput>(this.config.flip, {\n alias: 'ngpPopoverTriggerFlip',\n transform: booleanAttribute,\n });\n\n /**\n * Define the container in which the popover should be attached.\n * @default document.body\n */\n readonly container = input<HTMLElement | null>(this.config.container, {\n alias: 'ngpPopoverTriggerContainer',\n });\n\n /**\n * Define whether the popover should close when clicking outside of it.\n * @default true\n */\n readonly closeOnOutsideClick = input<boolean, BooleanInput>(this.config.closeOnOutsideClick, {\n alias: 'ngpPopoverTriggerCloseOnOutsideClick',\n transform: booleanAttribute,\n });\n\n /**\n * Define whether the popover should close when the escape key is pressed.\n * @default true\n */\n readonly closeOnEscape = input<boolean, BooleanInput>(this.config.closeOnEscape, {\n alias: 'ngpPopoverTriggerCloseOnEscape',\n transform: booleanAttribute,\n });\n\n /**\n * Defines how the popover behaves when the window is scrolled.\n * @default 'reposition'\n */\n readonly scrollBehavior = input<'reposition' | 'block'>(this.config.scrollBehavior, {\n alias: 'ngpPopoverTriggerScrollBehavior',\n });\n\n /**\n * Provide context to the popover.\n * @default null\n */\n readonly context = input<T | null>(null, {\n alias: 'ngpPopoverTriggerContext',\n });\n\n /**\n * Store the popover view ref.\n */\n protected readonly viewRef = signal<ComponentRef<unknown> | EmbeddedViewRef<void> | null>(null);\n\n /**\n * Determines if the popover is open.\n */\n readonly open = computed(() => this.viewRef() !== null);\n\n /**\n * Derive the popover middleware from the provided configuration.\n */\n private readonly middleware = computed(() => {\n const middleware: Middleware[] = [offset(this.state.offset()), shift()];\n\n if (this.state.flip()) {\n middleware.push(flip());\n }\n\n return middleware;\n });\n\n /**\n * Store the computed position of the popover.\n * @internal\n */\n readonly position = signal<{ x: number; y: number }>({\n x: 0,\n y: 0,\n });\n\n /**\n * @internal\n * Store the trigger width.\n */\n readonly width = signal<number | null>(null);\n\n /**\n * The dispose function to stop computing the position of the popover.\n */\n private dispose?: () => void;\n\n /**\n * A document-wide click listener that checks if the click\n * occurred outside of the popover and trigger elements.\n */\n private documentClickListener?: (event: MouseEvent) => void;\n\n /**\n * Store the popover instance.\n * @internal\n */\n private popoverInstance: NgpPopover | null = null;\n\n /**\n * Get the scroll strategy based on the configuration.\n */\n private readonly scrollStrategy = computed(() =>\n this.state.scrollBehavior() === 'block'\n ? new BlockScrollStrategy(this.viewportRuler, this.document)\n : new NoopScrollStrategy(),\n );\n\n /**\n * @internal\n * Register any child popover to the stack.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n readonly stack: NgpPopoverTrigger<any>[] = [];\n\n /**\n * @internal\n * The timeout to open the popover.\n */\n private openTimeout?: () => void;\n\n /**\n * @internal\n * The timeout to close the popover.\n */\n private closeTimeout?: () => void;\n\n /**\n * The popover trigger state.\n */\n readonly state = popoverTriggerState<NgpPopoverTrigger<T>>(this);\n\n constructor() {\n // if the trigger has a parent trigger then register it to the stack\n this.parentTrigger()?.stack.push(this);\n\n // update the width of the trigger when it resizes\n fromResizeEvent(this.trigger.nativeElement)\n .pipe(takeUntilDestroyed())\n .subscribe(() => this.width.set(this.trigger.nativeElement.offsetWidth));\n }\n\n ngOnDestroy(): void {\n // remove the trigger from the parent trigger's stack\n this.parentTrigger()?.stack.splice(this.parentTrigger()?.stack.indexOf(this), 1);\n\n this.destroyPopover();\n }\n\n protected toggleOpenState(event: MouseEvent): void {\n // if the trigger is disabled then do not toggle the popover\n if (this.state.disabled()) {\n return;\n }\n\n // determine the origin of the event, 0 is keyboard, 1 is mouse\n const origin: FocusOrigin = event.detail === 0 ? 'keyboard' : 'mouse';\n\n // if the popover is open then hide it\n if (this.open()) {\n this.hide(origin);\n } else {\n this.show(origin);\n }\n }\n\n /**\n * Show the popover.\n */\n show(origin: FocusOrigin): void {\n // if closing is in progress then clear the timeout to stop the popover from closing\n this.closeTimeout?.();\n\n // if the trigger is disabled or the popover is already open then do not show the popover\n if (this.state.disabled() || this.openTimeout) {\n return;\n }\n\n this.openTimeout = this.disposables.setTimeout(() => {\n this.openTimeout = undefined;\n this.createPopover(origin);\n }, this.state.showDelay());\n\n // Add document click listener to detect outside clicks\n if (this.state.closeOnOutsideClick()) {\n this.documentClickListener = this.onDocumentClick.bind(this);\n this.document.addEventListener('mouseup', this.documentClickListener, true);\n }\n }\n\n /**\n * @internal\n * Hide the popover.\n */\n hide(origin: FocusOrigin = 'program'): void {\n // if opening is in progress then clear the timeout to stop the popover from opening\n this.openTimeout?.();\n\n // if the trigger is disabled or the popover is not open then do not hide the popover\n if (this.state.disabled() || this.closeTimeout || !this.open()) {\n return;\n }\n\n // close all child popovers\n for (const child of this.stack) {\n child.hide(origin);\n }\n\n this.closeTimeout = this.disposables.setTimeout(async () => {\n this.closeTimeout = undefined;\n\n await this.destroyPopover();\n // ensure the trigger is focused after closing the popover\n this.disposables.setTimeout(() => this.focusTrigger(origin), 0);\n }, this.state.hideDelay());\n }\n\n private onDocumentClick(event: MouseEvent): void {\n const target = event.target as HTMLElement;\n\n const viewRef = this.viewRef();\n\n // get the popover element\n const popoverElement =\n viewRef instanceof ComponentRef ? viewRef.location.nativeElement : viewRef?.rootNodes[0];\n\n // Check if the click is outside the trigger or the popover\n const isOutside =\n !this.trigger.nativeElement.contains(target) && !popoverElement?.contains(target);\n\n // Determine if this is a click inside another popover\n\n if (isOutside) {\n // Close the popover\n this.hide('mouse');\n }\n }\n\n private createPopover(origin: FocusOrigin): void {\n // clear the open timeout\n this.openTimeout = undefined;\n\n const popover = this.state.popover();\n\n let portal: TemplatePortal | ComponentPortal<unknown>;\n\n // Create a new inject with the tooltip context\n const injector = Injector.create({\n parent: this.injector,\n providers: [providePopoverContext(this.state.context())],\n });\n\n if (popover instanceof TemplateRef) {\n portal = new TemplatePortal<NgpPopoverTemplateContext<T>>(\n popover,\n this.viewContainerRef,\n { $implicit: this.state.context() } as NgpPopoverTemplateContext<T>,\n injector,\n );\n } else if (popover instanceof Type) {\n portal = new ComponentPortal(popover, this.viewContainerRef, injector);\n } else {\n throw new Error('Popover must be either a TemplateRef or a ComponentType');\n }\n\n const domOutlet = new DomPortalOutlet(\n this.state.container() ?? this.document.body,\n undefined,\n undefined,\n injector,\n );\n\n const viewRef = domOutlet.attach(portal);\n this.viewRef.set(viewRef);\n\n let outletElement: HTMLElement | null = null;\n\n if (viewRef instanceof ComponentRef) {\n viewRef.changeDetectorRef.detectChanges();\n outletElement = viewRef.location.nativeElement;\n } else if (viewRef) {\n viewRef.detectChanges();\n outletElement = viewRef.rootNodes[0] as HTMLElement;\n }\n\n if (!outletElement) {\n throw new Error('Outlet element is not available.');\n }\n\n // determine if the popover is fixed or absolute\n const strategy = getComputedStyle(outletElement).position === 'fixed' ? 'fixed' : 'absolute';\n\n this.dispose = autoUpdate(this.trigger.nativeElement, outletElement, async () => {\n const position = await computePosition(this.trigger.nativeElement, outletElement, {\n placement: this.state.placement(),\n middleware: this.middleware(),\n strategy,\n });\n\n this.position.set({ x: position.x, y: position.y });\n viewRef?.detectChanges();\n });\n\n // activate the scroll strategy\n this.scrollStrategy().enable();\n\n // set the initial focus to the first tabbable element in the popover\n this.popoverInstance?.setInitialFocus(origin);\n }\n\n private async destroyPopover(): Promise<void> {\n // clear the close timeout\n this.closeTimeout = undefined;\n\n await this.exitAnimationState.exit();\n\n const viewRef = this.viewRef();\n\n // if the view is already destroyed then do not destroy it again\n const isDestroyed = viewRef instanceof ComponentRef ? false : viewRef?.destroyed;\n\n if (viewRef && !isDestroyed) {\n // destroy the view ref\n viewRef.destroy();\n }\n\n this.viewRef.set(null);\n this.dispose?.();\n\n // deactivate the scroll strategy\n this.scrollStrategy().disable();\n\n // Remove the document click listener when the popover is hidden\n if (this.documentClickListener) {\n this.document.removeEventListener('mouseup', this.documentClickListener, true);\n }\n }\n\n /**\n * @internal\n * Handle escape key press to close the popover.\n */\n protected handleEscapeKey(): void {\n if (this.state.closeOnEscape()) {\n this.hide('keyboard');\n }\n }\n\n private focusTrigger(origin: FocusOrigin): void {\n this.focusMonitor.focusVia(this.trigger.nativeElement, origin);\n }\n\n /**\n * Set the popover instance.\n * @internal\n */\n setPopover(instance: NgpPopover): void {\n this.popoverInstance = instance;\n }\n}\n\ntype NgpPopoverTemplateContext<T> = {\n $implicit: T;\n};\ntype NgpPopoverContent<T> = TemplateRef<NgpPopoverTemplateContext<T>> | Type<unknown>;\n","import type { Placement } from '@floating-ui/dom';\n\nexport function getTransformOrigin(placement: Placement): string {\n const basePlacement = placement.split('-')[0]; // Extract \"top\", \"bottom\", etc.\n const alignment = placement.split('-')[1]; // Extract \"start\" or \"end\"\n\n const map: Record<string, string> = {\n top: 'bottom',\n bottom: 'top',\n left: 'right',\n right: 'left',\n };\n\n let x = 'center';\n let y = 'center';\n\n if (basePlacement === 'top' || basePlacement === 'bottom') {\n y = map[basePlacement];\n if (alignment === 'start') x = 'left';\n else if (alignment === 'end') x = 'right';\n } else {\n x = map[basePlacement];\n if (alignment === 'start') y = 'top';\n else if (alignment === 'end') y = 'bottom';\n }\n\n return `${y} ${x}`;\n}\n","import { FocusMonitor, FocusOrigin, InteractivityChecker } from '@angular/cdk/a11y';\nimport { computed, Directive, inject } from '@angular/core';\nimport { NgpFocusTrap } from 'ng-primitives/focus-trap';\nimport { injectElementRef, NgpExitAnimation } from 'ng-primitives/internal';\nimport { injectPopoverTriggerState } from '../popover-trigger/popover-trigger-state';\nimport { getTransformOrigin } from '../utils/transform-origin';\n\n/**\n * Apply the `ngpPopover` directive to an element that represents the popover. This typically would be a `div` inside an `ng-template`.\n */\n@Directive({\n selector: '[ngpPopover]',\n exportAs: 'ngpPopover',\n hostDirectives: [NgpFocusTrap, NgpExitAnimation],\n host: {\n role: 'menu',\n '[style.left.px]': 'x()',\n '[style.top.px]': 'y()',\n '[style.--ngp-popover-trigger-width.px]': 'trigger().width()',\n '[style.--ngp-popover-transform-origin]': 'transformOrigin()',\n '(keydown.escape)': 'trigger().handleEscapeKey()',\n },\n})\nexport class NgpPopover {\n /**\n * Access the popover element.\n */\n private readonly popover = injectElementRef();\n\n /**\n * Access the interactivity checker.\n */\n private readonly interactivity = inject(InteractivityChecker);\n\n /**\n * Access the focus monitor.\n */\n private readonly focusMonitor = inject(FocusMonitor);\n\n /**\n * Access the trigger instance.\n */\n protected readonly trigger = injectPopoverTriggerState();\n\n /**\n * Compute the x position of the popover.\n */\n protected readonly x = computed(() => this.trigger().position().x);\n\n /**\n * Compute the y position of the popover.\n */\n protected readonly y = computed(() => this.trigger().position().y);\n\n /**\n * Derive the transform origin of the popover.\n */\n protected readonly transformOrigin = computed(() =>\n getTransformOrigin(this.trigger().placement()),\n );\n\n constructor() {\n this.trigger().setPopover(this);\n }\n\n /**\n * Focus the first tabbable element inside the popover.\n * If no tabbable element is found, focus the popover itself.\n * @internal\n */\n setInitialFocus(origin: FocusOrigin): void {\n // use a tree walker to find the first tabbable child\n const treeWalker = document.createTreeWalker(\n this.popover.nativeElement,\n NodeFilter.SHOW_ELEMENT,\n {\n acceptNode: node =>\n node instanceof HTMLElement && this.interactivity.isTabbable(node)\n ? NodeFilter.FILTER_ACCEPT\n : NodeFilter.FILTER_SKIP,\n },\n );\n\n const tabbableNode = treeWalker.nextNode() as HTMLElement | null;\n\n if (tabbableNode) {\n this.focusMonitor.focusVia(tabbableNode, origin);\n } else {\n // if no tabbable child is found, focus the popover element itself\n this.popover.nativeElement.focus();\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA2DO,MAAM,oBAAoB,GAAqB;AACpD,IAAA,MAAM,EAAE,CAAC;AACT,IAAA,SAAS,EAAE,QAAQ;AACnB,IAAA,SAAS,EAAE,CAAC;AACZ,IAAA,SAA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