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
@@ -0,0 +1,687 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { Signal, ElementRef, WritableSignal, OnDestroy, Provider } from '@angular/core';
3
+ import { BooleanInput } from '@angular/cdk/coercion';
4
+ import * as ng_primitives_state from 'ng-primitives/state';
5
+ import { StateInjectionOptions, SetterOptions } from 'ng-primitives/state';
6
+ import { Placement } from '@floating-ui/dom';
7
+ import * as ng_primitives_a11y from 'ng-primitives/a11y';
8
+ import { activeDescendantManager } from 'ng-primitives/a11y';
9
+ import * as ng_primitives_portal from 'ng-primitives/portal';
10
+ import { NgpOverlay, NgpFlip, NgpOffset, NgpFlipInput, NgpOffsetInput } from 'ng-primitives/portal';
11
+ import { Observable } from 'rxjs';
12
+ import * as ng_primitives_select from 'ng-primitives/select';
13
+
14
+ /**
15
+ * Apply the `ngpNativeSelect` directive to a select element that you want to enhance.
16
+ */
17
+ declare class NgpNativeSelect {
18
+ /**
19
+ * The id of the select. If not provided, a unique id will be generated.
20
+ */
21
+ readonly id: _angular_core.InputSignal<string>;
22
+ /**
23
+ * Whether the select is disabled.
24
+ */
25
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
26
+ constructor();
27
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpNativeSelect, never>;
28
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpNativeSelect, "select[ngpNativeSelect]", ["ngpNativeSelect"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpNativeSelectDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
29
+ }
30
+
31
+ declare const injectNativeSelectState: {
32
+ (): Signal<{
33
+ disabled: _angular_core.WritableSignal<boolean>;
34
+ setDisabled: (value: boolean) => void;
35
+ }>;
36
+ (options: ng_primitives_state.StateInjectionOptions): Signal<{
37
+ disabled: _angular_core.WritableSignal<boolean>;
38
+ setDisabled: (value: boolean) => void;
39
+ } | null>;
40
+ (options?: ng_primitives_state.StateInjectionOptions): Signal<{
41
+ disabled: _angular_core.WritableSignal<boolean>;
42
+ setDisabled: (value: boolean) => void;
43
+ }> | Signal<{
44
+ disabled: _angular_core.WritableSignal<boolean>;
45
+ setDisabled: (value: boolean) => void;
46
+ } | null>;
47
+ };
48
+ declare const provideNativeSelectState: (opts?: {
49
+ inherit?: boolean;
50
+ }) => _angular_core.FactoryProvider;
51
+
52
+ declare class NgpSelectDropdown {
53
+ /** The id of the dropdown. */
54
+ readonly id: _angular_core.InputSignal<string>;
55
+ constructor();
56
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpSelectDropdown, never>;
57
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpSelectDropdown, "[ngpSelectDropdown]", ["ngpSelectDropdown"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
58
+ }
59
+
60
+ interface NgpSelectDropdownState {
61
+ /**
62
+ * @internal Access the element reference.
63
+ */
64
+ readonly elementRef: ElementRef<HTMLElement>;
65
+ /** The id of the dropdown. */
66
+ readonly id: Signal<string>;
67
+ }
68
+ interface NgpSelectDropdownProps {
69
+ /** The id of the dropdown. */
70
+ readonly id?: Signal<string>;
71
+ }
72
+ declare const NgpSelectDropdownStateToken: _angular_core.InjectionToken<_angular_core.WritableSignal<{
73
+ elementRef: ElementRef<HTMLElement>;
74
+ id: Signal<string>;
75
+ }>>;
76
+ declare const ngpSelectDropdown: ({ id: _id }: NgpSelectDropdownProps) => {
77
+ elementRef: ElementRef<HTMLElement>;
78
+ id: Signal<string>;
79
+ };
80
+ declare const provideSelectDropdownState: (opts?: {
81
+ inherit?: boolean;
82
+ }) => _angular_core.FactoryProvider;
83
+ declare function injectSelectDropdownState(options?: StateInjectionOptions): Signal<NgpSelectDropdownState>;
84
+
85
+ interface NgpSelectOptionState {
86
+ /**
87
+ * @internal Access the element reference.
88
+ */
89
+ readonly elementRef: ElementRef<HTMLElement>;
90
+ /** The id of the option. */
91
+ readonly id: Signal<string>;
92
+ /** The value of the option. */
93
+ readonly value: Signal<any>;
94
+ /** The disabled state of the option. */
95
+ readonly disabled: Signal<boolean>;
96
+ /** The index of the option in the list. */
97
+ readonly index: Signal<number | undefined>;
98
+ /**
99
+ * Whether this option is the active descendant.
100
+ * @internal
101
+ */
102
+ readonly active: Signal<boolean>;
103
+ /**
104
+ * Whether this option is selected.
105
+ * @internal
106
+ */
107
+ readonly selected: Signal<boolean>;
108
+ /**
109
+ * Select the option.
110
+ * @internal
111
+ */
112
+ select(): void;
113
+ /**
114
+ * Scroll the option into view.
115
+ * @internal
116
+ */
117
+ scrollIntoView(): void;
118
+ /**
119
+ * Activate on pointer enter.
120
+ * @internal
121
+ */
122
+ activateOnPointerEnter(): void;
123
+ /**
124
+ * Deactivate on pointer leave.
125
+ * @internal
126
+ */
127
+ deactivateOnPointerLeave(): void;
128
+ /**
129
+ * Emit activated event.
130
+ * @internal
131
+ */
132
+ emitActivated(): void;
133
+ }
134
+ interface NgpSelectOptionProps {
135
+ /** The id of the option. */
136
+ readonly id?: Signal<string>;
137
+ /** The value of the option. */
138
+ readonly value?: Signal<any>;
139
+ /** The disabled state of the option. */
140
+ readonly disabled?: Signal<boolean>;
141
+ /** The index of the option in the list. */
142
+ readonly index?: Signal<number | undefined>;
143
+ /** Callback when option is activated. */
144
+ readonly onActivated?: () => void;
145
+ }
146
+ declare const NgpSelectOptionStateToken: _angular_core.InjectionToken<_angular_core.WritableSignal<{
147
+ elementRef: ElementRef<HTMLElement>;
148
+ id: Signal<string>;
149
+ value: Signal<any>;
150
+ disabled: Signal<boolean>;
151
+ index: Signal<number | undefined>;
152
+ active: Signal<boolean>;
153
+ selected: Signal<boolean>;
154
+ select: () => void;
155
+ scrollIntoView: () => void;
156
+ activateOnPointerEnter: () => void;
157
+ deactivateOnPointerLeave: () => void;
158
+ emitActivated: () => void | undefined;
159
+ }>>;
160
+ declare const ngpSelectOption: ({ id, value, disabled, index, onActivated, }: NgpSelectOptionProps) => {
161
+ elementRef: ElementRef<HTMLElement>;
162
+ id: Signal<string>;
163
+ value: Signal<any>;
164
+ disabled: Signal<boolean>;
165
+ index: Signal<number | undefined>;
166
+ active: Signal<boolean>;
167
+ selected: Signal<boolean>;
168
+ select: () => void;
169
+ scrollIntoView: () => void;
170
+ activateOnPointerEnter: () => void;
171
+ deactivateOnPointerLeave: () => void;
172
+ emitActivated: () => void | undefined;
173
+ };
174
+ declare const provideSelectOptionState: (opts?: {
175
+ inherit?: boolean;
176
+ }) => _angular_core.FactoryProvider;
177
+ declare function injectSelectOptionState(options?: StateInjectionOptions): Signal<NgpSelectOptionState>;
178
+
179
+ interface NgpSelectPortalState {
180
+ /**
181
+ * The overlay that manages the dropdown.
182
+ * @internal
183
+ */
184
+ readonly overlay: Signal<NgpOverlay<void> | null>;
185
+ /**
186
+ * Show the portal.
187
+ * @internal
188
+ */
189
+ show(): Promise<void>;
190
+ /**
191
+ * Hide the portal.
192
+ * @internal
193
+ */
194
+ hide(): void;
195
+ /**
196
+ * Destroy the overlay. The directive class calls this from ngOnDestroy so
197
+ * the overlay's onClose callback fires while the parent NgpSelect's output
198
+ * bindings are still attached — destroyRef.onDestroy callbacks fire after
199
+ * Angular has already torn those bindings down, which would prevent
200
+ * openChange(false) from reaching the consumer on fixture.destroy().
201
+ * @internal
202
+ */
203
+ destroy(): void;
204
+ }
205
+ interface NgpSelectPortalProps {
206
+ }
207
+ declare const NgpSelectPortalStateToken: _angular_core.InjectionToken<_angular_core.WritableSignal<NgpSelectPortalState>>;
208
+ declare const ngpSelectPortal: ({}: NgpSelectPortalProps) => NgpSelectPortalState;
209
+ declare const provideSelectPortalState: (opts?: {
210
+ inherit?: boolean;
211
+ }) => _angular_core.FactoryProvider;
212
+ declare function injectSelectPortalState(options?: StateInjectionOptions): Signal<NgpSelectPortalState>;
213
+
214
+ interface NgpSelectState<T> {
215
+ /**
216
+ * @internal Access the select element.
217
+ */
218
+ readonly elementRef: ElementRef<HTMLElement>;
219
+ /** The unique id of the select. */
220
+ readonly id: Signal<string>;
221
+ /** The value of the select. */
222
+ readonly value: WritableSignal<T | undefined>;
223
+ /** Whether the select is multiple selection. */
224
+ readonly multiple: Signal<boolean>;
225
+ /** Whether the select is disabled. */
226
+ readonly disabled: WritableSignal<boolean>;
227
+ /** The comparator function used to compare options. */
228
+ readonly compareWith: Signal<(a: T | undefined, b: T | undefined) => boolean>;
229
+ /** The position of the dropdown. */
230
+ readonly placement: Signal<Placement>;
231
+ /** The container for the dropdown. */
232
+ readonly container: Signal<HTMLElement | string | null>;
233
+ /** Whether the dropdown should flip when there is not enough space. Can be a boolean to enable/disable, or an object with padding and fallbackPlacements options. */
234
+ readonly flip: Signal<NgpFlip>;
235
+ /**
236
+ * Define the offset of the select dropdown relative to the trigger.
237
+ * Can be a number (applies to mainAxis) or an object with mainAxis, crossAxis, and alignmentAxis.
238
+ */
239
+ readonly offset: Signal<NgpOffset>;
240
+ /**
241
+ * A function that will scroll the active option into view. This can be overridden
242
+ * for cases such as virtual scrolling where we cannot scroll the option directly because
243
+ * it may not be rendered.
244
+ */
245
+ readonly scrollToOption: Signal<((index: number) => void) | undefined>;
246
+ /**
247
+ * Provide all the option values to the select. This is useful for virtual scrolling scenarios
248
+ * where not all options are rendered in the DOM. This is not an alternative to adding the options
249
+ * in the DOM, it is only to provide the select with the full list of options. This list should match
250
+ * the order of the options as they would appear in the DOM.
251
+ */
252
+ readonly allOptions: Signal<T[] | undefined>;
253
+ /**
254
+ * Store the select portal.
255
+ * @internal
256
+ */
257
+ readonly portal: WritableSignal<NgpSelectPortalState | undefined>;
258
+ /**
259
+ * Store the select dropdown.
260
+ * @internal
261
+ */
262
+ readonly dropdown: WritableSignal<NgpSelectDropdownState | undefined>;
263
+ /**
264
+ * Store the select options.
265
+ * @internal
266
+ */
267
+ readonly options: WritableSignal<NgpSelectOptionState[]>;
268
+ /**
269
+ * Access the overlay
270
+ * @internal
271
+ */
272
+ readonly overlay: Signal<NgpOverlay<void> | null | undefined>;
273
+ /**
274
+ * The open state of the select.
275
+ * @internal
276
+ */
277
+ readonly open: Signal<boolean>;
278
+ /**
279
+ * The options sorted by their index or DOM position.
280
+ * @internal
281
+ */
282
+ readonly sortedOptions: Signal<NgpSelectOptionState[]>;
283
+ /**
284
+ * The active key descendant manager.
285
+ * @internal
286
+ */
287
+ readonly activeDescendantManager: ReturnType<typeof activeDescendantManager>;
288
+ /**
289
+ * Open the dropdown.
290
+ * @internal
291
+ */
292
+ openDropdown(): Promise<void>;
293
+ /**
294
+ * Close the dropdown.
295
+ * @internal
296
+ */
297
+ closeDropdown(): void;
298
+ /**
299
+ * Handle the overlay being closed (e.g. via outside click or Escape).
300
+ * Emits the openChange event and resets the active descendant.
301
+ * @internal
302
+ */
303
+ onOverlayClose(): void;
304
+ /**
305
+ * Toggle the dropdown.
306
+ * @internal
307
+ */
308
+ toggleDropdown(): Promise<void>;
309
+ /**
310
+ * Select an option.
311
+ * @param index The index of the option to select.
312
+ * @internal
313
+ */
314
+ selectOption(id: string): void;
315
+ /**
316
+ * Deselect an option.
317
+ * @param option The option to deselect.
318
+ * @internal
319
+ */
320
+ deselectOption(option: NgpSelectOptionState): void;
321
+ /**
322
+ * Toggle the selection of an option.
323
+ * @param id The id of the option to toggle.
324
+ * @internal
325
+ */
326
+ toggleOption(id: string): void;
327
+ /**
328
+ * Determine if an option is selected.
329
+ * @param option The option to check.
330
+ * @internal
331
+ */
332
+ isOptionSelected(option: T): boolean;
333
+ /**
334
+ * Activate the next option in the list if there is one.
335
+ * If there is no option currently active, activate the selected option or the first option.
336
+ * @internal
337
+ */
338
+ activateNextOption(): void;
339
+ /**
340
+ * Activate the previous option in the list if there is one.
341
+ * @internal
342
+ */
343
+ activatePreviousOption(): void;
344
+ /**
345
+ * Register the dropdown portal with the select.
346
+ * @param portal The dropdown portal.
347
+ * @internal
348
+ */
349
+ registerPortal(portal: NgpSelectPortalState): void;
350
+ /**
351
+ * Register the dropdown with the select.
352
+ * @param dropdown The dropdown to register.
353
+ * @internal
354
+ */
355
+ registerDropdown(dropdown: NgpSelectDropdownState): void;
356
+ /**
357
+ * Register an option with the select.
358
+ * @param option The option to register.
359
+ * @internal
360
+ */
361
+ registerOption(option: NgpSelectOptionState): void;
362
+ /**
363
+ * Unregister an option from the select.
364
+ * @param option The option to unregister.
365
+ * @internal
366
+ */
367
+ unregisterOption(option: NgpSelectOptionState): void;
368
+ /**
369
+ * Focus the select.
370
+ * @internal
371
+ */
372
+ focus(): void;
373
+ /**
374
+ * Programmatically set the value of the select. Fires `onValueChange` and
375
+ * emits on `valueChange` by default. Pass `{ emit: false }` for cases like
376
+ * form `writeValue` where the internal state should sync without notifying.
377
+ */
378
+ setValue(value: T | undefined, options?: SetterOptions): void;
379
+ /**
380
+ * Programmatically set the disabled state of the select. Used by the form
381
+ * `setDisabledState` integration.
382
+ */
383
+ setDisabled(disabled: boolean): void;
384
+ /**
385
+ * Observable that emits whenever the value changes.
386
+ */
387
+ readonly valueChange: Observable<T | undefined>;
388
+ }
389
+ interface NgpSelectProps<T> {
390
+ /** The unique id of the select. */
391
+ readonly id?: Signal<string>;
392
+ /** The value of the select. */
393
+ readonly value?: Signal<T | undefined>;
394
+ /** Event emitted when the value changes. */
395
+ readonly onValueChange?: (value: T) => void;
396
+ /** Whether the select is multiple selection. */
397
+ readonly multiple?: Signal<boolean>;
398
+ /** Whether the select is disabled. */
399
+ readonly disabled?: Signal<boolean>;
400
+ /** Emit when the dropdown open state changes. */
401
+ readonly onOpenChange?: (open: boolean) => void;
402
+ /** The comparator function used to compare options. */
403
+ readonly compareWith?: Signal<(a: T | undefined, b: T | undefined) => boolean>;
404
+ /** The position of the dropdown. */
405
+ readonly placement?: Signal<Placement>;
406
+ /** The container for the dropdown. */
407
+ readonly container?: Signal<HTMLElement | string | null>;
408
+ /** Whether the dropdown should flip when there is not enough space. Can be a boolean to enable/disable, or an object with padding and fallbackPlacements options. */
409
+ readonly flip?: Signal<NgpFlip>;
410
+ /**
411
+ * Define the offset of the select dropdown relative to the trigger.
412
+ * Can be a number (applies to mainAxis) or an object with mainAxis, crossAxis, and alignmentAxis.
413
+ */
414
+ readonly offset?: Signal<NgpOffset>;
415
+ /**
416
+ * A function that will scroll the active option into view. This can be overridden
417
+ * for cases such as virtual scrolling where we cannot scroll the option directly because
418
+ * it may not be rendered.
419
+ */
420
+ readonly scrollToOption?: Signal<((index: number) => void) | undefined>;
421
+ /**
422
+ * Provide all the option values to the select. This is useful for virtual scrolling scenarios
423
+ * where not all options are rendered in the DOM. This is not an alternative to adding the options
424
+ * in the DOM, it is only to provide the select with the full list of options. This list should match
425
+ * the order of the options as they would appear in the DOM.
426
+ */
427
+ readonly allOptions?: Signal<T[] | undefined>;
428
+ }
429
+ declare const NgpSelectStateToken: _angular_core.InjectionToken<WritableSignal<NgpSelectState<unknown>>>;
430
+ declare const ngpSelect: <T>({ id, value: _value, multiple, disabled: _disabled, compareWith, placement, container, flip, offset, scrollToOption, allOptions, onValueChange, onOpenChange, }: NgpSelectProps<T>) => NgpSelectState<T>;
431
+ declare const provideSelectState: (opts?: {
432
+ inherit?: boolean;
433
+ }) => _angular_core.FactoryProvider;
434
+ declare function injectSelectState<T>(options?: StateInjectionOptions): Signal<NgpSelectState<T>>;
435
+
436
+ declare class NgpSelectOption {
437
+ /** Access the select state. */
438
+ protected readonly selectState: _angular_core.Signal<NgpSelectState<unknown>>;
439
+ /** The id of the option. */
440
+ readonly id: _angular_core.InputSignal<string>;
441
+ /** @required The value of the option. */
442
+ readonly value: _angular_core.InputSignal<any>;
443
+ /** The disabled state of the option. */
444
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
445
+ /** The index of the option in the list. */
446
+ readonly index: _angular_core.InputSignal<number | undefined>;
447
+ /**
448
+ * Event emitted when the option is activated via click or keyboard.
449
+ * This is useful for options without values that need custom behavior.
450
+ */
451
+ readonly activated: _angular_core.OutputEmitterRef<void>;
452
+ /** Access the select option state */
453
+ protected readonly state: {
454
+ elementRef: _angular_core.ElementRef<HTMLElement>;
455
+ id: _angular_core.Signal<string>;
456
+ value: _angular_core.Signal<any>;
457
+ disabled: _angular_core.Signal<boolean>;
458
+ index: _angular_core.Signal<number | undefined>;
459
+ active: _angular_core.Signal<boolean>;
460
+ selected: _angular_core.Signal<boolean>;
461
+ select: () => void;
462
+ scrollIntoView: () => void;
463
+ activateOnPointerEnter: () => void;
464
+ deactivateOnPointerLeave: () => void;
465
+ emitActivated: () => void | undefined;
466
+ };
467
+ /**
468
+ * Select the option.
469
+ * @internal
470
+ */
471
+ select(): void;
472
+ /**
473
+ * Scroll the option into view.
474
+ * @internal
475
+ */
476
+ scrollIntoView(): void;
477
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpSelectOption, never>;
478
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpSelectOption, "[ngpSelectOption]", ["ngpSelectOption"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "value": { "alias": "ngpSelectOptionValue"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpSelectOptionDisabled"; "required": false; "isSignal": true; }; "index": { "alias": "ngpSelectOptionIndex"; "required": false; "isSignal": true; }; }, { "activated": "ngpSelectOptionActivated"; }, never, never, true, never>;
479
+ }
480
+
481
+ declare class NgpSelectPortal implements OnDestroy {
482
+ protected readonly state: NgpSelectPortalState;
483
+ /**
484
+ * Attach the portal.
485
+ * @internal
486
+ */
487
+ show(): Promise<void>;
488
+ /**
489
+ * Detach the portal.
490
+ * @internal
491
+ */
492
+ detach(): void;
493
+ ngOnDestroy(): void;
494
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpSelectPortal, never>;
495
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpSelectPortal, "[ngpSelectPortal]", ["ngpSelectPortal"], {}, {}, never, never, true, never>;
496
+ }
497
+
498
+ /**
499
+ * Ideally we would use a generic type here, unfortunately, unlike in React,
500
+ * we cannot infer the type based on another input. For example, if multiple
501
+ * is true, we cannot infer that the value is an array of T. Using a union
502
+ * type is not ideal either because it requires the user to handle multiple cases.
503
+ * Using a generic also isn't ideal because we need to use T as both an array and
504
+ * a single value.
505
+ *
506
+ * Any seems to be used by Angular Material, ng-select, and other libraries
507
+ * so we will use it here as well.
508
+ */
509
+ type T = any;
510
+ declare class NgpSelect {
511
+ /** Access the select configuration. */
512
+ protected readonly config: ng_primitives_select.NgpSelectConfig;
513
+ /** The unique id of the select. */
514
+ readonly id: _angular_core.InputSignal<string>;
515
+ /** The value of the select. */
516
+ readonly value: _angular_core.InputSignal<any>;
517
+ /** Event emitted when the value changes. */
518
+ readonly valueChange: _angular_core.OutputEmitterRef<any>;
519
+ /** Whether the select is multiple selection. */
520
+ readonly multiple: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
521
+ /** Whether the select is disabled. */
522
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
523
+ /** Emit when the dropdown open state changes. */
524
+ readonly openChange: _angular_core.OutputEmitterRef<boolean>;
525
+ /** The comparator function used to compare options. */
526
+ readonly compareWith: _angular_core.InputSignal<(a: T | undefined, b: T | undefined) => boolean>;
527
+ /** The position of the dropdown. */
528
+ readonly placement: _angular_core.InputSignal<Placement>;
529
+ /** The container for the dropdown. */
530
+ readonly container: _angular_core.InputSignal<string | HTMLElement | null>;
531
+ /** Whether the dropdown should flip when there is not enough space. Can be a boolean to enable/disable, or an object with padding and fallbackPlacements options. */
532
+ readonly flip: _angular_core.InputSignalWithTransform<NgpFlip, NgpFlipInput>;
533
+ /**
534
+ * Define the offset of the select dropdown relative to the trigger.
535
+ * Can be a number (applies to mainAxis) or an object with mainAxis, crossAxis, and alignmentAxis.
536
+ * @default 0
537
+ */
538
+ readonly offset: _angular_core.InputSignalWithTransform<NgpOffset, NgpOffsetInput>;
539
+ /**
540
+ * A function that will scroll the active option into view. This can be overridden
541
+ * for cases such as virtual scrolling where we cannot scroll the option directly because
542
+ * it may not be rendered.
543
+ */
544
+ readonly scrollToOption: _angular_core.InputSignal<((index: number) => void) | undefined>;
545
+ /**
546
+ * Provide all the option values to the select. This is useful for virtual scrolling scenarios
547
+ * where not all options are rendered in the DOM. This is not an alternative to adding the options
548
+ * in the DOM, it is only to provide the select with the full list of options. This list should match
549
+ * the order of the options as they would appear in the DOM.
550
+ */
551
+ readonly allOptions: _angular_core.InputSignal<any[] | undefined>;
552
+ /** The state of the select. */
553
+ protected readonly state: NgpSelectState<any>;
554
+ /** @internal Access the select element. */
555
+ readonly elementRef: _angular_core.ElementRef<HTMLElement>;
556
+ /**
557
+ * Store the select portal.
558
+ * @internal
559
+ */
560
+ readonly portal: _angular_core.WritableSignal<NgpSelectPortalState | undefined>;
561
+ /**
562
+ * Store the select dropdown.
563
+ * @internal
564
+ */
565
+ readonly dropdown: _angular_core.WritableSignal<NgpSelectDropdownState | undefined>;
566
+ /**
567
+ * Store the select options.
568
+ * @internal
569
+ */
570
+ readonly options: _angular_core.WritableSignal<NgpSelectOptionState[]>;
571
+ /**
572
+ * Access the overlay
573
+ * @internal
574
+ */
575
+ readonly overlay: _angular_core.Signal<ng_primitives_portal.NgpOverlay<void> | null | undefined>;
576
+ /**
577
+ * The open state of the select.
578
+ * @internal
579
+ */
580
+ readonly open: _angular_core.Signal<boolean>;
581
+ /**
582
+ * The options sorted by their index or DOM position.
583
+ * @internal
584
+ */
585
+ readonly sortedOptions: _angular_core.Signal<NgpSelectOptionState[]>;
586
+ /**
587
+ * The active key descendant manager.
588
+ * @internal
589
+ */
590
+ readonly activeDescendantManager: {
591
+ id: _angular_core.Signal<string | undefined>;
592
+ index: _angular_core.WritableSignal<number>;
593
+ activateByIndex: (index: number, { scroll, origin }?: ng_primitives_a11y.ActivationOptions) => void;
594
+ activateById: (id: string, options?: ng_primitives_a11y.ActivationOptions) => void;
595
+ first: (options?: ng_primitives_a11y.ActivationOptions) => void;
596
+ last: (options?: ng_primitives_a11y.ActivationOptions) => void;
597
+ next: (options?: ng_primitives_a11y.ActivationOptions) => void;
598
+ previous: (options?: ng_primitives_a11y.ActivationOptions) => void;
599
+ reset: ({ scroll, origin }?: ng_primitives_a11y.ActivationOptions) => void;
600
+ validate: () => void;
601
+ };
602
+ /**
603
+ * Open the dropdown.
604
+ * @internal
605
+ */
606
+ openDropdown(): Promise<void>;
607
+ /**
608
+ * Close the dropdown.
609
+ * @internal
610
+ */
611
+ closeDropdown(): void;
612
+ /**
613
+ * Toggle the dropdown.
614
+ * @internal
615
+ */
616
+ toggleDropdown(): Promise<void>;
617
+ /**
618
+ * Select an option.
619
+ * @param id The id of the option to select.
620
+ * @internal
621
+ */
622
+ selectOption(id: string): void;
623
+ /**
624
+ * Determine if an option is selected.
625
+ * @param option The option to check.
626
+ * @internal
627
+ */
628
+ isOptionSelected(option: T): boolean;
629
+ /**
630
+ * Activate the next option in the list if there is one.
631
+ * If there is no option currently active, activate the selected option or the first option.
632
+ * @internal
633
+ */
634
+ activateNextOption(): void;
635
+ /**
636
+ * Activate the previous option in the list if there is one.
637
+ * @internal
638
+ */
639
+ activatePreviousOption(): void;
640
+ /**
641
+ * Focus the select.
642
+ * @internal
643
+ */
644
+ focus(): void;
645
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpSelect, never>;
646
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpSelect, "[ngpSelect]", ["ngpSelect"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "value": { "alias": "ngpSelectValue"; "required": false; "isSignal": true; }; "multiple": { "alias": "ngpSelectMultiple"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpSelectDisabled"; "required": false; "isSignal": true; }; "compareWith": { "alias": "ngpSelectCompareWith"; "required": false; "isSignal": true; }; "placement": { "alias": "ngpSelectDropdownPlacement"; "required": false; "isSignal": true; }; "container": { "alias": "ngpSelectDropdownContainer"; "required": false; "isSignal": true; }; "flip": { "alias": "ngpSelectDropdownFlip"; "required": false; "isSignal": true; }; "offset": { "alias": "ngpSelectDropdownOffset"; "required": false; "isSignal": true; }; "scrollToOption": { "alias": "ngpSelectScrollToOption"; "required": false; "isSignal": true; }; "allOptions": { "alias": "ngpSelectOptions"; "required": false; "isSignal": true; }; }, { "valueChange": "ngpSelectValueChange"; "openChange": "ngpSelectOpenChange"; }, never, never, true, never>;
647
+ }
648
+
649
+ interface NgpSelectConfig {
650
+ /**
651
+ * The default placement for the select dropdown.
652
+ * @default 'bottom'
653
+ */
654
+ placement: Placement;
655
+ /**
656
+ * The container element or selector for the select dropdown.
657
+ * This can be used to control where the dropdown is rendered in the DOM.
658
+ * @default 'body'
659
+ */
660
+ container: HTMLElement | string | null;
661
+ /**
662
+ * Whether the select dropdown should flip when there is not enough space.
663
+ * Can be a boolean to enable/disable, or an object with padding and fallbackPlacements options.
664
+ * @default true
665
+ */
666
+ flip: NgpFlip;
667
+ /**
668
+ * Define the offset of the select dropdown relative to the trigger.
669
+ * Can be a number (applies to mainAxis) or an object with mainAxis, crossAxis, and alignmentAxis.
670
+ * @default 0
671
+ */
672
+ offset: NgpOffset;
673
+ }
674
+ /**
675
+ * Provide the default Select configuration
676
+ * @param config The Select configuration
677
+ * @returns The provider
678
+ */
679
+ declare function provideSelectConfig(config: Partial<NgpSelectConfig>): Provider[];
680
+ /**
681
+ * Inject the Select configuration
682
+ * @returns The global Select configuration
683
+ */
684
+ declare function injectSelectConfig(): NgpSelectConfig;
685
+
686
+ export { NgpNativeSelect, NgpSelect, NgpSelectDropdown, NgpSelectDropdownStateToken, NgpSelectOption, NgpSelectOptionStateToken, NgpSelectPortal, NgpSelectPortalStateToken, NgpSelectStateToken, injectNativeSelectState, injectSelectConfig, injectSelectDropdownState, injectSelectOptionState, injectSelectPortalState, injectSelectState, ngpSelect, ngpSelectDropdown, ngpSelectOption, ngpSelectPortal, provideNativeSelectState, provideSelectConfig, provideSelectDropdownState, provideSelectOptionState, provideSelectPortalState, provideSelectState };
687
+ export type { NgpSelectConfig };