ng-primitives 0.120.4 → 0.121.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 (147) hide show
  1. package/example-theme/index.css +9 -0
  2. package/fesm2022/ng-primitives-a11y.mjs +5 -5
  3. package/fesm2022/ng-primitives-a11y.mjs.map +1 -1
  4. package/fesm2022/ng-primitives-accordion.mjs +34 -51
  5. package/fesm2022/ng-primitives-accordion.mjs.map +1 -1
  6. package/fesm2022/ng-primitives-ai.mjs +39 -52
  7. package/fesm2022/ng-primitives-ai.mjs.map +1 -1
  8. package/fesm2022/ng-primitives-autofill.mjs +4 -4
  9. package/fesm2022/ng-primitives-autofill.mjs.map +1 -1
  10. package/fesm2022/ng-primitives-avatar.mjs +14 -17
  11. package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
  12. package/fesm2022/ng-primitives-breadcrumbs.mjs +21 -21
  13. package/fesm2022/ng-primitives-breadcrumbs.mjs.map +1 -1
  14. package/fesm2022/ng-primitives-button.mjs +7 -9
  15. package/fesm2022/ng-primitives-button.mjs.map +1 -1
  16. package/fesm2022/ng-primitives-checkbox.mjs +15 -30
  17. package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
  18. package/fesm2022/ng-primitives-combobox.mjs +60 -92
  19. package/fesm2022/ng-primitives-combobox.mjs.map +1 -1
  20. package/fesm2022/ng-primitives-common.mjs +4 -4
  21. package/fesm2022/ng-primitives-common.mjs.map +1 -1
  22. package/fesm2022/ng-primitives-context-menu.mjs +68 -121
  23. package/fesm2022/ng-primitives-context-menu.mjs.map +1 -1
  24. package/fesm2022/ng-primitives-date-picker.mjs +91 -115
  25. package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
  26. package/fesm2022/ng-primitives-dialog.mjs +35 -51
  27. package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
  28. package/fesm2022/ng-primitives-file-upload.mjs +26 -53
  29. package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
  30. package/fesm2022/ng-primitives-focus-trap.mjs +5 -8
  31. package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -1
  32. package/fesm2022/ng-primitives-form-field.mjs +39 -44
  33. package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
  34. package/fesm2022/ng-primitives-input-otp.mjs +30 -43
  35. package/fesm2022/ng-primitives-input-otp.mjs.map +1 -1
  36. package/fesm2022/ng-primitives-input.mjs +6 -8
  37. package/fesm2022/ng-primitives-input.mjs.map +1 -1
  38. package/fesm2022/ng-primitives-interactions.mjs +31 -48
  39. package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
  40. package/fesm2022/ng-primitives-internal.mjs +39 -35
  41. package/fesm2022/ng-primitives-internal.mjs.map +1 -1
  42. package/fesm2022/ng-primitives-listbox.mjs +34 -48
  43. package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
  44. package/fesm2022/ng-primitives-menu.mjs +85 -151
  45. package/fesm2022/ng-primitives-menu.mjs.map +1 -1
  46. package/fesm2022/ng-primitives-meter.mjs +25 -36
  47. package/fesm2022/ng-primitives-meter.mjs.map +1 -1
  48. package/fesm2022/ng-primitives-navigation-menu.mjs +60 -108
  49. package/fesm2022/ng-primitives-navigation-menu.mjs.map +1 -1
  50. package/fesm2022/ng-primitives-number-field.mjs +35 -59
  51. package/fesm2022/ng-primitives-number-field.mjs.map +1 -1
  52. package/fesm2022/ng-primitives-pagination.mjs +270 -297
  53. package/fesm2022/ng-primitives-pagination.mjs.map +1 -1
  54. package/fesm2022/ng-primitives-popover.mjs +209 -223
  55. package/fesm2022/ng-primitives-popover.mjs.map +1 -1
  56. package/fesm2022/ng-primitives-portal.mjs +88 -59
  57. package/fesm2022/ng-primitives-portal.mjs.map +1 -1
  58. package/fesm2022/ng-primitives-progress.mjs +30 -41
  59. package/fesm2022/ng-primitives-progress.mjs.map +1 -1
  60. package/fesm2022/ng-primitives-radio.mjs +20 -30
  61. package/fesm2022/ng-primitives-radio.mjs.map +1 -1
  62. package/fesm2022/ng-primitives-resize.mjs +3 -3
  63. package/fesm2022/ng-primitives-resize.mjs.map +1 -1
  64. package/fesm2022/ng-primitives-roving-focus.mjs +20 -34
  65. package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
  66. package/fesm2022/ng-primitives-search.mjs +9 -9
  67. package/fesm2022/ng-primitives-search.mjs.map +1 -1
  68. package/fesm2022/ng-primitives-select.mjs +720 -620
  69. package/fesm2022/ng-primitives-select.mjs.map +1 -1
  70. package/fesm2022/ng-primitives-separator.mjs +4 -6
  71. package/fesm2022/ng-primitives-separator.mjs.map +1 -1
  72. package/fesm2022/ng-primitives-slider.mjs +63 -100
  73. package/fesm2022/ng-primitives-slider.mjs.map +1 -1
  74. package/fesm2022/ng-primitives-state.mjs +3 -3
  75. package/fesm2022/ng-primitives-state.mjs.map +1 -1
  76. package/fesm2022/ng-primitives-switch.mjs +15 -21
  77. package/fesm2022/ng-primitives-switch.mjs.map +1 -1
  78. package/fesm2022/ng-primitives-tabs.mjs +31 -41
  79. package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
  80. package/fesm2022/ng-primitives-textarea.mjs +5 -7
  81. package/fesm2022/ng-primitives-textarea.mjs.map +1 -1
  82. package/fesm2022/ng-primitives-toast.mjs +30 -23
  83. package/fesm2022/ng-primitives-toast.mjs.map +1 -1
  84. package/fesm2022/ng-primitives-toggle-group.mjs +20 -36
  85. package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
  86. package/fesm2022/ng-primitives-toggle.mjs +10 -19
  87. package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
  88. package/fesm2022/ng-primitives-toolbar.mjs +4 -6
  89. package/fesm2022/ng-primitives-toolbar.mjs.map +1 -1
  90. package/fesm2022/ng-primitives-tooltip.mjs +401 -402
  91. package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
  92. package/fesm2022/ng-primitives-utils.mjs +5 -4
  93. package/fesm2022/ng-primitives-utils.mjs.map +1 -1
  94. package/package.json +56 -55
  95. package/schematics/ng-generate/templates/select/select.__fileSuffix@dasherize__.ts.template +48 -48
  96. package/{a11y/index.d.ts → types/ng-primitives-a11y.d.ts} +18 -24
  97. package/{accordion/index.d.ts → types/ng-primitives-accordion.d.ts} +85 -98
  98. package/{autofill/index.d.ts → types/ng-primitives-autofill.d.ts} +3 -10
  99. package/{avatar/index.d.ts → types/ng-primitives-avatar.d.ts} +7 -30
  100. package/{breadcrumbs/index.d.ts → types/ng-primitives-breadcrumbs.d.ts} +15 -70
  101. package/{button/index.d.ts → types/ng-primitives-button.d.ts} +23 -29
  102. package/{checkbox/index.d.ts → types/ng-primitives-checkbox.d.ts} +68 -74
  103. package/{combobox/index.d.ts → types/ng-primitives-combobox.d.ts} +35 -35
  104. package/{context-menu/index.d.ts → types/ng-primitives-context-menu.d.ts} +2 -1
  105. package/{date-picker/index.d.ts → types/ng-primitives-date-picker.d.ts} +2 -2
  106. package/{dialog/index.d.ts → types/ng-primitives-dialog.d.ts} +7 -2
  107. package/{file-upload/index.d.ts → types/ng-primitives-file-upload.d.ts} +5 -20
  108. package/{focus-trap/index.d.ts → types/ng-primitives-focus-trap.d.ts} +3 -10
  109. package/{form-field/index.d.ts → types/ng-primitives-form-field.d.ts} +9 -40
  110. package/{input/index.d.ts → types/ng-primitives-input.d.ts} +3 -10
  111. package/{menu/index.d.ts → types/ng-primitives-menu.d.ts} +17 -63
  112. package/{navigation-menu/index.d.ts → types/ng-primitives-navigation-menu.d.ts} +15 -70
  113. package/{number-field/index.d.ts → types/ng-primitives-number-field.d.ts} +80 -110
  114. package/types/ng-primitives-pagination.d.ts +502 -0
  115. package/{popover/index.d.ts → types/ng-primitives-popover.d.ts} +244 -57
  116. package/{portal/index.d.ts → types/ng-primitives-portal.d.ts} +22 -13
  117. package/{progress/index.d.ts → types/ng-primitives-progress.d.ts} +3 -10
  118. package/{roving-focus/index.d.ts → types/ng-primitives-roving-focus.d.ts} +65 -79
  119. package/types/ng-primitives-select.d.ts +687 -0
  120. package/{separator/index.d.ts → types/ng-primitives-separator.d.ts} +3 -10
  121. package/{slider/index.d.ts → types/ng-primitives-slider.d.ts} +76 -138
  122. package/{state/index.d.ts → types/ng-primitives-state.d.ts} +26 -21
  123. package/{switch/index.d.ts → types/ng-primitives-switch.d.ts} +50 -64
  124. package/{tabs/index.d.ts → types/ng-primitives-tabs.d.ts} +9 -40
  125. package/{textarea/index.d.ts → types/ng-primitives-textarea.d.ts} +3 -10
  126. package/{toast/index.d.ts → types/ng-primitives-toast.d.ts} +13 -1
  127. package/{toggle-group/index.d.ts → types/ng-primitives-toggle-group.d.ts} +75 -89
  128. package/{toggle/index.d.ts → types/ng-primitives-toggle.d.ts} +50 -56
  129. package/{toolbar/index.d.ts → types/ng-primitives-toolbar.d.ts} +3 -10
  130. package/types/ng-primitives-tooltip.d.ts +691 -0
  131. package/pagination/index.d.ts +0 -211
  132. package/select/index.d.ts +0 -396
  133. package/tooltip/index.d.ts +0 -384
  134. /package/{ai/index.d.ts → types/ng-primitives-ai.d.ts} +0 -0
  135. /package/{common/index.d.ts → types/ng-primitives-common.d.ts} +0 -0
  136. /package/{date-time-luxon/index.d.ts → types/ng-primitives-date-time-luxon.d.ts} +0 -0
  137. /package/{date-time/index.d.ts → types/ng-primitives-date-time.d.ts} +0 -0
  138. /package/{input-otp/index.d.ts → types/ng-primitives-input-otp.d.ts} +0 -0
  139. /package/{interactions/index.d.ts → types/ng-primitives-interactions.d.ts} +0 -0
  140. /package/{internal/index.d.ts → types/ng-primitives-internal.d.ts} +0 -0
  141. /package/{listbox/index.d.ts → types/ng-primitives-listbox.d.ts} +0 -0
  142. /package/{meter/index.d.ts → types/ng-primitives-meter.d.ts} +0 -0
  143. /package/{radio/index.d.ts → types/ng-primitives-radio.d.ts} +0 -0
  144. /package/{resize/index.d.ts → types/ng-primitives-resize.d.ts} +0 -0
  145. /package/{search/index.d.ts → types/ng-primitives-search.d.ts} +0 -0
  146. /package/{utils/index.d.ts → types/ng-primitives-utils.d.ts} +0 -0
  147. /package/{index.d.ts → types/ng-primitives.d.ts} +0 -0
@@ -1,12 +1,12 @@
1
- import * as ng_primitives_portal from 'ng-primitives/portal';
2
- import { NgpOffset, NgpFlip, NgpDismissGuard, NgpShift, NgpOverlayArrowState, NgpOverlayArrowProps, NgpOverlayContent, NgpOffsetInput, NgpFlipInput, NgpShiftInput, NgpDismissGuardInput, NgpOverlay } from 'ng-primitives/portal';
1
+ import { NgpOffset, NgpFlip, NgpDismissGuard, NgpShift, NgpOverlayArrowState, NgpOverlayArrowProps, NgpOverlayContent, NgpOverlay, NgpOffsetInput, NgpFlipInput, NgpShiftInput, NgpDismissGuardInput } from 'ng-primitives/portal';
3
2
  export { NgpOverlayArrowProps as NgpPopoverArrowProps, NgpOverlayArrowState as NgpPopoverArrowState, injectOverlayContext as injectPopoverContext } from 'ng-primitives/portal';
4
3
  import * as _angular_core from '@angular/core';
5
- import { Provider, OnDestroy, InjectOptions, Signal } from '@angular/core';
4
+ import { Provider, WritableSignal, ElementRef, Signal, OnDestroy } from '@angular/core';
6
5
  import { Placement } from '@floating-ui/dom';
7
6
  import { NumberInput, BooleanInput } from '@angular/cdk/coercion';
8
7
  import * as ng_primitives_state from 'ng-primitives/state';
9
- import { State } from 'ng-primitives/state';
8
+ import { StateInjectionOptions } from 'ng-primitives/state';
9
+ import * as ng_primitives_popover from 'ng-primitives/popover';
10
10
  import { FocusOrigin } from '@angular/cdk/a11y';
11
11
  import * as i1 from 'ng-primitives/focus-trap';
12
12
 
@@ -105,37 +105,220 @@ declare const NgpPopoverArrowStateToken: _angular_core.InjectionToken<_angular_c
105
105
  declare const ngpPopoverArrow: ({ padding }: NgpOverlayArrowProps) => NgpOverlayArrowState;
106
106
  declare const injectPopoverArrowState: {
107
107
  (): _angular_core.Signal<NgpOverlayArrowState>;
108
- (options: {
109
- hoisted: true;
110
- optional?: boolean;
111
- skipSelf?: boolean;
112
- }): _angular_core.Signal<NgpOverlayArrowState | null>;
113
- (options?: {
114
- hoisted?: boolean;
115
- optional?: boolean;
116
- skipSelf?: boolean;
117
- }): _angular_core.Signal<NgpOverlayArrowState> | _angular_core.Signal<NgpOverlayArrowState | null>;
108
+ (options: ng_primitives_state.StateInjectionOptions): _angular_core.Signal<NgpOverlayArrowState | null>;
109
+ (options?: ng_primitives_state.StateInjectionOptions): _angular_core.Signal<NgpOverlayArrowState> | _angular_core.Signal<NgpOverlayArrowState | null>;
118
110
  };
119
111
  declare const providePopoverArrowState: (opts?: {
120
112
  inherit?: boolean;
121
113
  }) => _angular_core.FactoryProvider;
122
114
 
123
- /**
124
- * Apply the `ngpPopoverTrigger` directive to an element that triggers the popover to show.
125
- */
126
- declare class NgpPopoverTrigger<T = null> implements OnDestroy {
115
+ interface NgpPopoverTriggerState<T> {
116
+ /** Access the trigger element. */
117
+ readonly elementRef: ElementRef;
118
+ /** Access the popover template ref. */
119
+ readonly popover: WritableSignal<NgpOverlayContent<T> | undefined>;
120
+ /**
121
+ * Define if the trigger should be disabled.
122
+ * @default false
123
+ */
124
+ readonly disabled: Signal<boolean>;
125
+ /**
126
+ * Define the placement of the popover relative to the trigger.
127
+ * @default 'top'
128
+ */
129
+ readonly placement: Signal<NgpPopoverPlacement>;
130
+ /**
131
+ * Define the offset of the popover relative to the trigger.
132
+ * Can be a number (applies to mainAxis) or an object with mainAxis, crossAxis, and alignmentAxis.
133
+ * @default 0
134
+ */
135
+ readonly offset: Signal<NgpOffset>;
136
+ /**
137
+ * Define the delay before the popover is displayed.
138
+ * @default 0
139
+ */
140
+ readonly showDelay: Signal<number>;
141
+ /**
142
+ * Define the delay before the popover is hidden.
143
+ * @default 0
144
+ */
145
+ readonly hideDelay: Signal<number>;
146
+ /**
147
+ * Define whether the popover should flip when there is not enough space for the popover.
148
+ * Can be a boolean to enable/disable, or an object with padding and fallbackPlacements options.
149
+ * @default true
150
+ */
151
+ readonly flip: Signal<NgpFlip>;
152
+ /**
153
+ * Configure shift behavior to keep the popover in view.
154
+ * Can be a boolean to enable/disable, or an object with padding and limiter options.
155
+ * @default undefined (enabled by default in overlay)
156
+ */
157
+ readonly shift: Signal<NgpShift>;
158
+ /**
159
+ * Define the container in which the popover should be attached.
160
+ * @default document.body
161
+ */
162
+ readonly container: Signal<HTMLElement | string | null>;
163
+ /**
164
+ * Define whether the popover should close when clicking outside of it, or a guard function.
165
+ * @default true
166
+ */
167
+ readonly closeOnOutsideClick: Signal<NgpDismissGuard<Element>>;
168
+ /**
169
+ * Define whether the popover should close when the escape key is pressed, or a guard function.
170
+ * @default true
171
+ */
172
+ readonly closeOnEscape: Signal<NgpDismissGuard<KeyboardEvent>>;
173
+ /**
174
+ * Defines how the popover behaves when the window is scrolled.
175
+ * @default 'reposition'
176
+ */
177
+ readonly scrollBehavior: Signal<'reposition' | 'block' | 'close'>;
178
+ /**
179
+ * Provide context to the popover. This can be used to pass data to the popover content.
180
+ */
181
+ readonly context: Signal<T | undefined>;
182
+ /**
183
+ * Define an anchor element for positioning the popover.
184
+ * If provided, the popover will be positioned relative to this element instead of the trigger.
185
+ */
186
+ readonly anchor: Signal<HTMLElement | null>;
187
+ /**
188
+ * Define whether to track the trigger element position on every animation frame.
189
+ * Useful for moving elements like slider thumbs.
190
+ * @default false
191
+ */
192
+ readonly trackPosition: Signal<boolean>;
193
+ /**
194
+ * Define the cooldown duration in milliseconds.
195
+ * When moving from one popover to another within this duration,
196
+ * the showDelay is skipped for the new popover.
197
+ * @default 0
198
+ */
199
+ readonly cooldown: Signal<number>;
200
+ /**
201
+ * The overlay that manages the popover
202
+ * @internal
203
+ */
204
+ readonly overlay: Signal<NgpOverlay<T> | null>;
205
+ /**
206
+ * The open state of the popover.
207
+ * @internal
208
+ */
209
+ readonly open: Signal<boolean>;
210
+ /** @internal onDestroy callback */
211
+ destroy: () => void;
212
+ /**
213
+ * Show the popover.
214
+ * @returns A promise that resolves when the popover has been shown
215
+ */
216
+ show: () => Promise<void>;
217
+ /**
218
+ * @internal
219
+ * Hide the popover.
220
+ * @returns A promise that resolves when the popover has been hidden
221
+ */
222
+ hide: (origin: FocusOrigin) => Promise<void>;
223
+ }
224
+ interface NgpPopoverTriggerProps<T> {
225
+ /** Access the popover template ref. */
226
+ readonly popover?: Signal<NgpOverlayContent<T> | undefined>;
227
+ /**
228
+ * Define if the trigger should be disabled.
229
+ * @default false
230
+ */
231
+ readonly disabled?: Signal<boolean>;
232
+ /**
233
+ * Define the placement of the popover relative to the trigger.
234
+ * @default 'top'
235
+ */
236
+ readonly placement?: Signal<NgpPopoverPlacement>;
237
+ /**
238
+ * Define the offset of the popover relative to the trigger.
239
+ * Can be a number (applies to mainAxis) or an object with mainAxis, crossAxis, and alignmentAxis.
240
+ * @default 0
241
+ */
242
+ readonly offset?: Signal<NgpOffset>;
243
+ /**
244
+ * Define the delay before the popover is displayed.
245
+ * @default 0
246
+ */
247
+ readonly showDelay?: Signal<number>;
248
+ /**
249
+ * Define the delay before the popover is hidden.
250
+ * @default 0
251
+ */
252
+ readonly hideDelay?: Signal<number>;
253
+ /**
254
+ * Define whether the popover should flip when there is not enough space for the popover.
255
+ * Can be a boolean to enable/disable, or an object with padding and fallbackPlacements options.
256
+ * @default true
257
+ */
258
+ readonly flip?: Signal<NgpFlip>;
259
+ /**
260
+ * Configure shift behavior to keep the popover in view.
261
+ * Can be a boolean to enable/disable, or an object with padding and limiter options.
262
+ * @default undefined (enabled by default in overlay)
263
+ */
264
+ readonly shift?: Signal<NgpShift>;
265
+ /**
266
+ * Define the container in which the popover should be attached.
267
+ * @default document.body
268
+ */
269
+ readonly container?: Signal<HTMLElement | string | null>;
270
+ /**
271
+ * Define whether the popover should close when clicking outside of it, or a guard function.
272
+ * @default true
273
+ */
274
+ readonly closeOnOutsideClick?: Signal<NgpDismissGuard<Element>>;
275
+ /**
276
+ * Define whether the popover should close when the escape key is pressed, or a guard function.
277
+ * @default true
278
+ */
279
+ readonly closeOnEscape?: Signal<NgpDismissGuard<KeyboardEvent>>;
280
+ /**
281
+ * Defines how the popover behaves when the window is scrolled.
282
+ * @default 'reposition'
283
+ */
284
+ readonly scrollBehavior?: Signal<'reposition' | 'block' | 'close'>;
285
+ /**
286
+ * Provide context to the popover. This can be used to pass data to the popover content.
287
+ */
288
+ readonly context?: Signal<T | undefined>;
127
289
  /**
128
- * Access the trigger element
290
+ * Define an anchor element for positioning the popover.
291
+ * If provided, the popover will be positioned relative to this element instead of the trigger.
129
292
  */
130
- private readonly trigger;
293
+ readonly anchor?: Signal<HTMLElement | null>;
131
294
  /**
132
- * Access the injector.
295
+ * Define whether to track the trigger element position on every animation frame.
296
+ * Useful for moving elements like slider thumbs.
297
+ * @default false
133
298
  */
134
- private readonly injector;
299
+ readonly trackPosition?: Signal<boolean>;
135
300
  /**
136
- * Access the view container reference.
301
+ * Define the cooldown duration in milliseconds.
302
+ * When moving from one popover to another within this duration,
303
+ * the showDelay is skipped for the new popover.
304
+ * @default 0
137
305
  */
138
- private readonly viewContainerRef;
306
+ readonly cooldown?: Signal<number>;
307
+ /** Callback fired when the open state changes. */
308
+ readonly onOpenChange?: (value: boolean) => void;
309
+ }
310
+ declare const NgpPopoverTriggerStateToken: _angular_core.InjectionToken<WritableSignal<NgpPopoverTriggerState<unknown>>>;
311
+ declare const ngpPopoverTrigger: <T>({ popover: _popover, disabled, placement, offset, showDelay, hideDelay, flip, shift, container, closeOnOutsideClick, closeOnEscape, scrollBehavior, context, anchor, trackPosition, cooldown, onOpenChange, }: NgpPopoverTriggerProps<T>) => NgpPopoverTriggerState<T>;
312
+ declare const providePopoverTriggerState: (opts?: {
313
+ inherit?: boolean;
314
+ }) => _angular_core.FactoryProvider;
315
+ declare function injectPopoverTriggerState<T>(options?: StateInjectionOptions): Signal<NgpPopoverTriggerState<T>>;
316
+ type NgpPopoverPlacement = 'top' | 'right' | 'bottom' | 'left' | 'top-start' | 'top-end' | 'right-start' | 'right-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end';
317
+
318
+ /**
319
+ * Apply the `ngpPopoverTrigger` directive to an element that triggers the popover to show.
320
+ */
321
+ declare class NgpPopoverTrigger<T = null> implements OnDestroy {
139
322
  /**
140
323
  * Access the global popover configuration.
141
324
  */
@@ -224,16 +407,6 @@ declare class NgpPopoverTrigger<T = null> implements OnDestroy {
224
407
  * @default 0
225
408
  */
226
409
  readonly cooldown: _angular_core.InputSignalWithTransform<number, NumberInput>;
227
- /**
228
- * The overlay that manages the popover
229
- * @internal
230
- */
231
- readonly overlay: _angular_core.WritableSignal<NgpOverlay<T> | null>;
232
- /**
233
- * The open state of the popover.
234
- * @internal
235
- */
236
- readonly open: _angular_core.Signal<boolean>;
237
410
  /**
238
411
  * Event emitted when the popover open state changes.
239
412
  */
@@ -241,9 +414,8 @@ declare class NgpPopoverTrigger<T = null> implements OnDestroy {
241
414
  /**
242
415
  * The popover trigger state.
243
416
  */
244
- readonly state: ng_primitives_state.CreatedState<NgpPopoverTrigger<T>>;
417
+ protected readonly state: ng_primitives_popover.NgpPopoverTriggerState<T>;
245
418
  ngOnDestroy(): void;
246
- protected toggle(event: MouseEvent): void;
247
419
  /**
248
420
  * Show the popover.
249
421
  * @returns A promise that resolves when the popover has been shown
@@ -255,40 +427,55 @@ declare class NgpPopoverTrigger<T = null> implements OnDestroy {
255
427
  * @returns A promise that resolves when the popover has been hidden
256
428
  */
257
429
  hide(origin?: FocusOrigin): Promise<void>;
258
- /**
259
- * Create the overlay that will contain the popover
260
- */
261
- private createOverlay;
262
430
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpPopoverTrigger<any>, never>;
263
431
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpPopoverTrigger<any>, "[ngpPopoverTrigger]", ["ngpPopoverTrigger"], { "popover": { "alias": "ngpPopoverTrigger"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpPopoverTriggerDisabled"; "required": false; "isSignal": true; }; "placement": { "alias": "ngpPopoverTriggerPlacement"; "required": false; "isSignal": true; }; "offset": { "alias": "ngpPopoverTriggerOffset"; "required": false; "isSignal": true; }; "showDelay": { "alias": "ngpPopoverTriggerShowDelay"; "required": false; "isSignal": true; }; "hideDelay": { "alias": "ngpPopoverTriggerHideDelay"; "required": false; "isSignal": true; }; "flip": { "alias": "ngpPopoverTriggerFlip"; "required": false; "isSignal": true; }; "shift": { "alias": "ngpPopoverTriggerShift"; "required": false; "isSignal": true; }; "container": { "alias": "ngpPopoverTriggerContainer"; "required": false; "isSignal": true; }; "closeOnOutsideClick": { "alias": "ngpPopoverTriggerCloseOnOutsideClick"; "required": false; "isSignal": true; }; "closeOnEscape": { "alias": "ngpPopoverTriggerCloseOnEscape"; "required": false; "isSignal": true; }; "scrollBehavior": { "alias": "ngpPopoverTriggerScrollBehavior"; "required": false; "isSignal": true; }; "context": { "alias": "ngpPopoverTriggerContext"; "required": false; "isSignal": true; }; "anchor": { "alias": "ngpPopoverTriggerAnchor"; "required": false; "isSignal": true; }; "trackPosition": { "alias": "ngpPopoverTriggerTrackPosition"; "required": false; "isSignal": true; }; "cooldown": { "alias": "ngpPopoverTriggerCooldown"; "required": false; "isSignal": true; }; }, { "openChange": "ngpPopoverTriggerOpenChange"; }, never, never, true, never>;
264
432
  }
265
- type NgpPopoverPlacement = 'top' | 'right' | 'bottom' | 'left' | 'top-start' | 'top-end' | 'right-start' | 'right-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end';
266
-
267
- /**
268
- * Provides the PopoverTrigger state.
269
- */
270
- declare const providePopoverTriggerState: (options?: ng_primitives_state.CreateStateProviderOptions) => _angular_core.FactoryProvider;
271
- /**
272
- * Injects the PopoverTrigger state.
273
- */
274
- declare const injectPopoverTriggerState: <T>(options?: InjectOptions) => Signal<State<NgpPopoverTrigger<T>>>;
275
433
 
276
434
  /**
277
435
  * Apply the `ngpPopover` directive to an element that represents the popover. This typically would be a `div` inside an `ng-template`.
278
436
  */
279
437
  declare class NgpPopover {
280
- /**
281
- * Access the overlay.
282
- */
283
- protected readonly overlay: ng_primitives_portal.NgpOverlay<unknown>;
284
438
  /**
285
439
  * The unique id of the tooltip.
286
440
  */
287
441
  readonly id: _angular_core.InputSignal<string>;
288
- constructor();
442
+ protected readonly state: {
443
+ id: _angular_core.WritableSignal<string>;
444
+ };
289
445
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpPopover, never>;
290
446
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpPopover, "[ngpPopover]", ["ngpPopover"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.NgpFocusTrap; inputs: {}; outputs: {}; }]>;
291
447
  }
292
448
 
293
- export { NgpPopover, NgpPopoverArrow, NgpPopoverArrowStateToken, NgpPopoverTrigger, injectPopoverArrowState, injectPopoverTriggerState, ngpPopoverArrow, providePopoverArrowState, providePopoverConfig, providePopoverTriggerState };
294
- export type { NgpPopoverConfig, NgpPopoverPlacement };
449
+ interface NgpPopoverState {
450
+ /** The unique id of the tooltip. */
451
+ readonly id: Signal<string>;
452
+ }
453
+ interface NgpPopoverProps {
454
+ /** The unique id of the tooltip. */
455
+ readonly id?: Signal<string>;
456
+ }
457
+ declare const NgpPopoverStateToken: _angular_core.InjectionToken<_angular_core.WritableSignal<{
458
+ id: _angular_core.WritableSignal<string>;
459
+ }>>;
460
+ declare const ngpPopover: ({ id: _id }: NgpPopoverProps) => {
461
+ id: _angular_core.WritableSignal<string>;
462
+ };
463
+ declare const injectPopoverState: {
464
+ (): Signal<{
465
+ id: _angular_core.WritableSignal<string>;
466
+ }>;
467
+ (options: ng_primitives_state.StateInjectionOptions): Signal<{
468
+ id: _angular_core.WritableSignal<string>;
469
+ } | null>;
470
+ (options?: ng_primitives_state.StateInjectionOptions): Signal<{
471
+ id: _angular_core.WritableSignal<string>;
472
+ }> | Signal<{
473
+ id: _angular_core.WritableSignal<string>;
474
+ } | null>;
475
+ };
476
+ declare const providePopoverState: (opts?: {
477
+ inherit?: boolean;
478
+ }) => _angular_core.FactoryProvider;
479
+
480
+ export { NgpPopover, NgpPopoverArrow, NgpPopoverArrowStateToken, NgpPopoverStateToken, NgpPopoverTrigger, NgpPopoverTriggerStateToken, injectPopoverArrowState, injectPopoverState, injectPopoverTriggerState, ngpPopover, ngpPopoverArrow, ngpPopoverTrigger, providePopoverArrowState, providePopoverConfig, providePopoverState, providePopoverTriggerState };
481
+ export type { NgpPopoverConfig, NgpPopoverPlacement, NgpPopoverProps, NgpPopoverState, NgpPopoverTriggerProps, NgpPopoverTriggerState };
@@ -1,11 +1,28 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { Provider, WritableSignal, TemplateRef, Type, Injector, ViewContainerRef, Signal, ValueProvider, ApplicationRef } from '@angular/core';
1
3
  import * as _floating_ui_dom from '@floating-ui/dom';
2
4
  import { Placement, Strategy, Middleware } from '@floating-ui/dom';
3
- import * as _angular_core from '@angular/core';
4
- import { WritableSignal, TemplateRef, Type, Injector, ViewContainerRef, Signal, Provider, ValueProvider, ApplicationRef } from '@angular/core';
5
5
  import { FocusOrigin } from '@angular/cdk/a11y';
6
6
  import { Subject } from 'rxjs';
7
+ import * as ng_primitives_state from 'ng-primitives/state';
7
8
  import { ViewportRuler } from '@angular/cdk/scrolling';
8
9
 
10
+ /**
11
+ * Provide a null `ControlContainer` at the element level of an overlay-content root directive
12
+ * (e.g. `NgpPopover`, `NgpTooltip`, `NgpMenu`).
13
+ *
14
+ * Overlay content is portaled but its template is often declared inside a form, so its
15
+ * element-injector chain can reach that outer form's `ControlContainer` and leak it into the
16
+ * overlay (ngp#677 / angular#57390). This backstop resolves `ControlContainer` to `null` at the
17
+ * content root: a form declared *inside* the content sits closer in the injector chain and still
18
+ * wins, while a control with no inner form resolves to `null` here instead of escaping to the
19
+ * outer form.
20
+ *
21
+ * Pairs with the `EmbeddedViewInjector` in `overlay.ts`, which returns `notFoundValue` for the
22
+ * `Host`/`SkipSelf` `ControlContainer` lookup so the element-injector walk runs and reaches this.
23
+ */
24
+ declare function provideControlContainerIsolation(): Provider;
25
+
9
26
  /**
10
27
  * Options for configuring flip behavior to keep the floating element in view.
11
28
  * The flip middleware ensures the floating element flips to the opposite side
@@ -745,22 +762,14 @@ declare const injectOverlayArrowState: {
745
762
  padding: WritableSignal<number | undefined>;
746
763
  setPadding: (value: number | undefined) => void;
747
764
  }>;
748
- (options: {
749
- hoisted: true;
750
- optional?: boolean;
751
- skipSelf?: boolean;
752
- }): Signal<{
765
+ (options: ng_primitives_state.StateInjectionOptions): Signal<{
753
766
  x: Signal<number | undefined>;
754
767
  y: Signal<number | undefined>;
755
768
  placement: Signal<_floating_ui_dom.Placement | undefined>;
756
769
  padding: WritableSignal<number | undefined>;
757
770
  setPadding: (value: number | undefined) => void;
758
771
  } | null>;
759
- (options?: {
760
- hoisted?: boolean;
761
- optional?: boolean;
762
- skipSelf?: boolean;
763
- }): Signal<{
772
+ (options?: ng_primitives_state.StateInjectionOptions): Signal<{
764
773
  x: Signal<number | undefined>;
765
774
  y: Signal<number | undefined>;
766
775
  placement: Signal<_floating_ui_dom.Placement | undefined>;
@@ -940,5 +949,5 @@ declare class NoopScrollStrategy implements ScrollStrategy {
940
949
  disable(): void;
941
950
  }
942
951
 
943
- export { BlockScrollStrategy, CloseScrollStrategy, NgpComponentPortal, NgpOverlay, NgpOverlayArrowStateToken, NgpOverlayCooldownManager, NgpOverlayRegistry, NgpPortal, NgpTemplatePortal, NoopScrollStrategy, coerceFlip, coerceOffset, coerceShift, createOverlay, createPortal, dismissGuardAttribute, injectOverlay, injectOverlayArrowState, injectOverlayContext, ngpOverlayArrow, provideOverlayArrowState, provideOverlayContext };
952
+ export { BlockScrollStrategy, CloseScrollStrategy, NgpComponentPortal, NgpOverlay, NgpOverlayArrowStateToken, NgpOverlayCooldownManager, NgpOverlayRegistry, NgpPortal, NgpTemplatePortal, NoopScrollStrategy, coerceFlip, coerceOffset, coerceShift, createOverlay, createPortal, dismissGuardAttribute, injectOverlay, injectOverlayArrowState, injectOverlayContext, ngpOverlayArrow, provideControlContainerIsolation, provideOverlayArrowState, provideOverlayContext };
944
953
  export type { NgpDismissGuard, NgpDismissGuardInput, NgpDismissPolicy, NgpFlip, NgpFlipInput, NgpFlipOptions, NgpOffset, NgpOffsetInput, NgpOffsetOptions, NgpOverlayArrowProps, NgpOverlayArrowState, NgpOverlayConfig, NgpOverlayContent, NgpOverlayEntry, NgpOverlayRef, NgpOverlayTemplateContext, NgpPosition, NgpShift, NgpShiftInput, NgpShiftOptions, ScrollStrategy };
@@ -1,6 +1,7 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { Signal, WritableSignal } from '@angular/core';
3
3
  import { NumberInput } from '@angular/cdk/coercion';
4
+ import * as ng_primitives_state from 'ng-primitives/state';
4
5
 
5
6
  /**
6
7
  * Apply the `ngpProgressIndicator` directive to an element that represents the current progress.
@@ -222,11 +223,7 @@ declare const injectProgressState: {
222
223
  setMin: (newMin: number) => void;
223
224
  setMax: (newMax: number) => void;
224
225
  }>;
225
- (options: {
226
- hoisted: true;
227
- optional?: boolean;
228
- skipSelf?: boolean;
229
- }): Signal<{
226
+ (options: ng_primitives_state.StateInjectionOptions): Signal<{
230
227
  max: WritableSignal<number>;
231
228
  min: WritableSignal<number>;
232
229
  value: WritableSignal<number | null>;
@@ -241,11 +238,7 @@ declare const injectProgressState: {
241
238
  setMin: (newMin: number) => void;
242
239
  setMax: (newMax: number) => void;
243
240
  } | null>;
244
- (options?: {
245
- hoisted?: boolean;
246
- optional?: boolean;
247
- skipSelf?: boolean;
248
- }): Signal<{
241
+ (options?: ng_primitives_state.StateInjectionOptions): Signal<{
249
242
  max: WritableSignal<number>;
250
243
  min: WritableSignal<number>;
251
244
  value: WritableSignal<number | null>;
@@ -1,8 +1,68 @@
1
+ import * as ng_primitives_roving_focus from 'ng-primitives/roving-focus';
1
2
  import * as _angular_core from '@angular/core';
2
3
  import { Signal, ElementRef, InjectionToken, Type, FactoryProvider } from '@angular/core';
3
4
  import { FocusOrigin } from '@angular/cdk/a11y';
4
- import { NgpOrientation } from 'ng-primitives/common';
5
5
  import { BooleanInput } from '@angular/cdk/coercion';
6
+ import { NgpOrientation } from 'ng-primitives/common';
7
+ import * as ng_primitives_state from 'ng-primitives/state';
8
+
9
+ /**
10
+ * Apply the `ngpRovingFocusItem` directive to an element within a roving focus group to automatically manage focus.
11
+ */
12
+ declare class NgpRovingFocusItem {
13
+ /**
14
+ * Define if the item is disabled.
15
+ */
16
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
17
+ private readonly state;
18
+ /**
19
+ * Expose the internal id of the roving focus item.
20
+ * @internal
21
+ */
22
+ readonly id: _angular_core.Signal<string>;
23
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpRovingFocusItem, never>;
24
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpRovingFocusItem, "[ngpRovingFocusItem]", ["ngpRovingFocusItem"], { "disabled": { "alias": "ngpRovingFocusItemDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
25
+ }
26
+
27
+ /**
28
+ * Apply the `ngpRovingFocusGroup` directive to an element to manage focus for a group of child elements.
29
+ */
30
+ declare class NgpRovingFocusGroup {
31
+ /**
32
+ * Determine the orientation of the roving focus group.
33
+ * @default 'vertical'
34
+ */
35
+ readonly orientation: _angular_core.InputSignal<NgpOrientation>;
36
+ /**
37
+ * Determine if focus should wrap when the end or beginning is reached.
38
+ */
39
+ readonly wrap: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
40
+ /**
41
+ * Determine if the home and end keys should navigate to the first and last items.
42
+ */
43
+ readonly homeEnd: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
44
+ /**
45
+ * Determine if the roving focus group is disabled.
46
+ */
47
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
48
+ /**
49
+ * Store the active item in the roving focus group.
50
+ * @internal
51
+ */
52
+ readonly activeItem: _angular_core.WritableSignal<NgpRovingFocusItem | null>;
53
+ /**
54
+ * The state of the roving focus group.
55
+ */
56
+ readonly state: ng_primitives_roving_focus.NgpRovingFocusGroupState;
57
+ /**
58
+ * Activate an item in the roving focus group.
59
+ * @param item The item to activate
60
+ * @param origin The origin of the focus change
61
+ */
62
+ setActiveItem(item: NgpRovingFocusItem | null, origin?: FocusOrigin): void;
63
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpRovingFocusGroup, never>;
64
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpRovingFocusGroup, "[ngpRovingFocusGroup]", ["ngpRovingFocusGroup"], { "orientation": { "alias": "ngpRovingFocusGroupOrientation"; "required": false; "isSignal": true; }; "wrap": { "alias": "ngpRovingFocusGroupWrap"; "required": false; "isSignal": true; }; "homeEnd": { "alias": "ngpRovingFocusGroupHomeEnd"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpRovingFocusGroupDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
65
+ }
6
66
 
7
67
  /**
8
68
  * The state interface for the RovingFocusItem pattern.
@@ -43,16 +103,8 @@ declare const NgpRovingFocusItemStateToken: _angular_core.InjectionToken<_angula
43
103
  declare const ngpRovingFocusItem: ({ disabled }: NgpRovingFocusItemProps) => NgpRovingFocusItemState;
44
104
  declare const injectRovingFocusItemState: {
45
105
  (): Signal<NgpRovingFocusItemState>;
46
- (options: {
47
- hoisted: true;
48
- optional?: boolean;
49
- skipSelf?: boolean;
50
- }): Signal<NgpRovingFocusItemState | null>;
51
- (options?: {
52
- hoisted?: boolean;
53
- optional?: boolean;
54
- skipSelf?: boolean;
55
- }): Signal<NgpRovingFocusItemState> | Signal<NgpRovingFocusItemState | null>;
106
+ (options: ng_primitives_state.StateInjectionOptions): Signal<NgpRovingFocusItemState | null>;
107
+ (options?: ng_primitives_state.StateInjectionOptions): Signal<NgpRovingFocusItemState> | Signal<NgpRovingFocusItemState | null>;
56
108
  };
57
109
  declare const provideRovingFocusItemState: (opts?: {
58
110
  inherit?: boolean;
@@ -143,79 +195,13 @@ declare const NgpRovingFocusGroupStateToken: _angular_core.InjectionToken<_angul
143
195
  declare const ngpRovingFocusGroup: ({ orientation: _orientation, wrap, homeEnd, disabled, inherit, }: NgpRovingFocusGroupProps) => NgpRovingFocusGroupState;
144
196
  declare const injectRovingFocusGroupState: {
145
197
  (): Signal<NgpRovingFocusGroupState>;
146
- (options: {
147
- hoisted: true;
148
- optional?: boolean;
149
- skipSelf?: boolean;
150
- }): Signal<NgpRovingFocusGroupState | null>;
151
- (options?: {
152
- hoisted?: boolean;
153
- optional?: boolean;
154
- skipSelf?: boolean;
155
- }): Signal<NgpRovingFocusGroupState> | Signal<NgpRovingFocusGroupState | null>;
198
+ (options: ng_primitives_state.StateInjectionOptions): Signal<NgpRovingFocusGroupState | null>;
199
+ (options?: ng_primitives_state.StateInjectionOptions): Signal<NgpRovingFocusGroupState> | Signal<NgpRovingFocusGroupState | null>;
156
200
  };
157
201
  declare const provideRovingFocusGroupState: (opts?: {
158
202
  inherit?: boolean;
159
203
  }) => _angular_core.FactoryProvider;
160
204
 
161
- /**
162
- * Apply the `ngpRovingFocusItem` directive to an element within a roving focus group to automatically manage focus.
163
- */
164
- declare class NgpRovingFocusItem {
165
- /**
166
- * Define if the item is disabled.
167
- */
168
- readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
169
- private readonly state;
170
- /**
171
- * Expose the internal id of the roving focus item.
172
- * @internal
173
- */
174
- readonly id: _angular_core.Signal<string>;
175
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpRovingFocusItem, never>;
176
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpRovingFocusItem, "[ngpRovingFocusItem]", ["ngpRovingFocusItem"], { "disabled": { "alias": "ngpRovingFocusItemDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
177
- }
178
-
179
- /**
180
- * Apply the `ngpRovingFocusGroup` directive to an element to manage focus for a group of child elements.
181
- */
182
- declare class NgpRovingFocusGroup {
183
- /**
184
- * Determine the orientation of the roving focus group.
185
- * @default 'vertical'
186
- */
187
- readonly orientation: _angular_core.InputSignal<NgpOrientation>;
188
- /**
189
- * Determine if focus should wrap when the end or beginning is reached.
190
- */
191
- readonly wrap: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
192
- /**
193
- * Determine if the home and end keys should navigate to the first and last items.
194
- */
195
- readonly homeEnd: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
196
- /**
197
- * Determine if the roving focus group is disabled.
198
- */
199
- readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
200
- /**
201
- * Store the active item in the roving focus group.
202
- * @internal
203
- */
204
- readonly activeItem: _angular_core.WritableSignal<NgpRovingFocusItem | null>;
205
- /**
206
- * The state of the roving focus group.
207
- */
208
- readonly state: NgpRovingFocusGroupState;
209
- /**
210
- * Activate an item in the roving focus group.
211
- * @param item The item to activate
212
- * @param origin The origin of the focus change
213
- */
214
- setActiveItem(item: NgpRovingFocusItem | null, origin?: FocusOrigin): void;
215
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpRovingFocusGroup, never>;
216
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpRovingFocusGroup, "[ngpRovingFocusGroup]", ["ngpRovingFocusGroup"], { "orientation": { "alias": "ngpRovingFocusGroupOrientation"; "required": false; "isSignal": true; }; "wrap": { "alias": "ngpRovingFocusGroupWrap"; "required": false; "isSignal": true; }; "homeEnd": { "alias": "ngpRovingFocusGroupHomeEnd"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpRovingFocusGroupDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
217
- }
218
-
219
205
  declare const NgpRovingFocusGroupToken: InjectionToken<NgpRovingFocusGroup>;
220
206
  /**
221
207
  * Inject the RovingFocusGroup directive instance