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,6 +1,7 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { Provider, Signal } from '@angular/core';
3
3
  import { NgpOrientation } from 'ng-primitives/common';
4
+ import * as ng_primitives_state from 'ng-primitives/state';
4
5
 
5
6
  interface NgpSeparatorConfig {
6
7
  /**
@@ -38,16 +39,8 @@ interface NgpSeparatorProps {
38
39
  declare const ngpSeparator: ({ orientation }: NgpSeparatorProps) => {};
39
40
  declare const injectSeparatorState: {
40
41
  (): Signal<{}>;
41
- (options: {
42
- hoisted: true;
43
- optional?: boolean;
44
- skipSelf?: boolean;
45
- }): Signal<{} | null>;
46
- (options?: {
47
- hoisted?: boolean;
48
- optional?: boolean;
49
- skipSelf?: boolean;
50
- }): Signal<{}> | Signal<{} | null>;
42
+ (options: ng_primitives_state.StateInjectionOptions): Signal<{} | null>;
43
+ (options?: ng_primitives_state.StateInjectionOptions): Signal<{}> | Signal<{} | null>;
51
44
  };
52
45
  declare const provideSeparatorState: (opts?: {
53
46
  inherit?: boolean;
@@ -1,9 +1,11 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { Signal, WritableSignal, ElementRef } from '@angular/core';
3
+ import * as ng_primitives_state from 'ng-primitives/state';
3
4
  import { FocusOrigin } from '@angular/cdk/a11y';
5
+ import * as ng_primitives_slider from 'ng-primitives/slider';
6
+ import { NumberInput, BooleanInput } from '@angular/cdk/coercion';
4
7
  import { NgpOrientation } from 'ng-primitives/common';
5
8
  import { Observable } from 'rxjs';
6
- import { NumberInput, BooleanInput } from '@angular/cdk/coercion';
7
9
 
8
10
  /**
9
11
  * Apply the `ngpSliderRange` directive to an element that represents the range of the slider.
@@ -27,16 +29,8 @@ interface NgpSliderRangeProps {
27
29
  declare const ngpSliderRange: ({}: NgpSliderRangeProps) => NgpSliderRangeState;
28
30
  declare const injectSliderRangeState: {
29
31
  (): _angular_core.Signal<NgpSliderRangeState>;
30
- (options: {
31
- hoisted: true;
32
- optional?: boolean;
33
- skipSelf?: boolean;
34
- }): _angular_core.Signal<NgpSliderRangeState | null>;
35
- (options?: {
36
- hoisted?: boolean;
37
- optional?: boolean;
38
- skipSelf?: boolean;
39
- }): _angular_core.Signal<NgpSliderRangeState> | _angular_core.Signal<NgpSliderRangeState | null>;
32
+ (options: ng_primitives_state.StateInjectionOptions): _angular_core.Signal<NgpSliderRangeState | null>;
33
+ (options?: ng_primitives_state.StateInjectionOptions): _angular_core.Signal<NgpSliderRangeState> | _angular_core.Signal<NgpSliderRangeState | null>;
40
34
  };
41
35
  declare const provideSliderRangeState: (opts?: {
42
36
  inherit?: boolean;
@@ -88,16 +82,8 @@ interface NgpSliderThumbProps {
88
82
  declare const ngpSliderThumb: ({ onDragStart, onDragEnd }: NgpSliderThumbProps) => NgpSliderThumbState;
89
83
  declare const injectSliderThumbState: {
90
84
  (): Signal<NgpSliderThumbState>;
91
- (options: {
92
- hoisted: true;
93
- optional?: boolean;
94
- skipSelf?: boolean;
95
- }): Signal<NgpSliderThumbState | null>;
96
- (options?: {
97
- hoisted?: boolean;
98
- optional?: boolean;
99
- skipSelf?: boolean;
100
- }): Signal<NgpSliderThumbState> | Signal<NgpSliderThumbState | null>;
85
+ (options: ng_primitives_state.StateInjectionOptions): Signal<NgpSliderThumbState | null>;
86
+ (options?: ng_primitives_state.StateInjectionOptions): Signal<NgpSliderThumbState> | Signal<NgpSliderThumbState | null>;
101
87
  };
102
88
  declare const provideSliderThumbState: (opts?: {
103
89
  inherit?: boolean;
@@ -125,21 +111,70 @@ interface NgpSliderTrackProps {
125
111
  declare const ngpSliderTrack: ({}: NgpSliderTrackProps) => NgpSliderTrackState;
126
112
  declare const injectSliderTrackState: {
127
113
  (): _angular_core.Signal<NgpSliderTrackState>;
128
- (options: {
129
- hoisted: true;
130
- optional?: boolean;
131
- skipSelf?: boolean;
132
- }): _angular_core.Signal<NgpSliderTrackState | null>;
133
- (options?: {
134
- hoisted?: boolean;
135
- optional?: boolean;
136
- skipSelf?: boolean;
137
- }): _angular_core.Signal<NgpSliderTrackState> | _angular_core.Signal<NgpSliderTrackState | null>;
114
+ (options: ng_primitives_state.StateInjectionOptions): _angular_core.Signal<NgpSliderTrackState | null>;
115
+ (options?: ng_primitives_state.StateInjectionOptions): _angular_core.Signal<NgpSliderTrackState> | _angular_core.Signal<NgpSliderTrackState | null>;
138
116
  };
139
117
  declare const provideSliderTrackState: (opts?: {
140
118
  inherit?: boolean;
141
119
  }) => _angular_core.FactoryProvider;
142
120
 
121
+ /**
122
+ * Apply the `ngpSlider` directive to an element that represents the slider and contains the track, range, and thumb.
123
+ */
124
+ declare class NgpSlider {
125
+ /**
126
+ * The id of the slider. If not provided, a unique id will be generated.
127
+ */
128
+ readonly id: _angular_core.InputSignal<string>;
129
+ /**
130
+ * The value of the slider.
131
+ */
132
+ readonly value: _angular_core.InputSignalWithTransform<number, NumberInput>;
133
+ /**
134
+ * Emits when the value changes.
135
+ */
136
+ readonly valueChange: _angular_core.OutputEmitterRef<number>;
137
+ /**
138
+ * The minimum value of the slider.
139
+ */
140
+ readonly min: _angular_core.InputSignalWithTransform<number, NumberInput>;
141
+ /**
142
+ * The maximum value of the slider.
143
+ */
144
+ readonly max: _angular_core.InputSignalWithTransform<number, NumberInput>;
145
+ /**
146
+ * The step value of the slider.
147
+ */
148
+ readonly step: _angular_core.InputSignalWithTransform<number, NumberInput>;
149
+ /**
150
+ * The orientation of the slider.
151
+ */
152
+ readonly orientation: _angular_core.InputSignal<NgpOrientation>;
153
+ /**
154
+ * The disabled state of the slider.
155
+ */
156
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
157
+ /**
158
+ * The state of the slider. We use this for the slider state rather than relying on the inputs.
159
+ * @internal
160
+ */
161
+ protected readonly state: ng_primitives_slider.NgpSliderState;
162
+ /**
163
+ * Set the value of the slider.
164
+ */
165
+ setValue(value: number): void;
166
+ /**
167
+ * Set the disabled state.
168
+ */
169
+ setDisabled(disabled: boolean): void;
170
+ /**
171
+ * Set the orientation.
172
+ */
173
+ setOrientation(orientation: NgpOrientation): void;
174
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpSlider, never>;
175
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpSlider, "[ngpSlider]", ["ngpSlider"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "value": { "alias": "ngpSliderValue"; "required": false; "isSignal": true; }; "min": { "alias": "ngpSliderMin"; "required": false; "isSignal": true; }; "max": { "alias": "ngpSliderMax"; "required": false; "isSignal": true; }; "step": { "alias": "ngpSliderStep"; "required": false; "isSignal": true; }; "orientation": { "alias": "ngpSliderOrientation"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpSliderDisabled"; "required": false; "isSignal": true; }; }, { "valueChange": "ngpSliderValueChange"; }, never, never, true, never>;
176
+ }
177
+
143
178
  /**
144
179
  * Public state surface for the Slider primitive.
145
180
  */
@@ -253,78 +288,13 @@ interface NgpSliderProps {
253
288
  declare const ngpSlider: ({ id, value: _value, min, max, step, orientation: _orientation, disabled: _disabled, onValueChange, }: NgpSliderProps) => NgpSliderState;
254
289
  declare const injectSliderState: {
255
290
  (): Signal<NgpSliderState>;
256
- (options: {
257
- hoisted: true;
258
- optional?: boolean;
259
- skipSelf?: boolean;
260
- }): Signal<NgpSliderState | null>;
261
- (options?: {
262
- hoisted?: boolean;
263
- optional?: boolean;
264
- skipSelf?: boolean;
265
- }): Signal<NgpSliderState> | Signal<NgpSliderState | null>;
291
+ (options: ng_primitives_state.StateInjectionOptions): Signal<NgpSliderState | null>;
292
+ (options?: ng_primitives_state.StateInjectionOptions): Signal<NgpSliderState> | Signal<NgpSliderState | null>;
266
293
  };
267
294
  declare const provideSliderState: (opts?: {
268
295
  inherit?: boolean;
269
296
  }) => _angular_core.FactoryProvider;
270
297
 
271
- /**
272
- * Apply the `ngpSlider` directive to an element that represents the slider and contains the track, range, and thumb.
273
- */
274
- declare class NgpSlider {
275
- /**
276
- * The id of the slider. If not provided, a unique id will be generated.
277
- */
278
- readonly id: _angular_core.InputSignal<string>;
279
- /**
280
- * The value of the slider.
281
- */
282
- readonly value: _angular_core.InputSignalWithTransform<number, NumberInput>;
283
- /**
284
- * Emits when the value changes.
285
- */
286
- readonly valueChange: _angular_core.OutputEmitterRef<number>;
287
- /**
288
- * The minimum value of the slider.
289
- */
290
- readonly min: _angular_core.InputSignalWithTransform<number, NumberInput>;
291
- /**
292
- * The maximum value of the slider.
293
- */
294
- readonly max: _angular_core.InputSignalWithTransform<number, NumberInput>;
295
- /**
296
- * The step value of the slider.
297
- */
298
- readonly step: _angular_core.InputSignalWithTransform<number, NumberInput>;
299
- /**
300
- * The orientation of the slider.
301
- */
302
- readonly orientation: _angular_core.InputSignal<NgpOrientation>;
303
- /**
304
- * The disabled state of the slider.
305
- */
306
- readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
307
- /**
308
- * The state of the slider. We use this for the slider state rather than relying on the inputs.
309
- * @internal
310
- */
311
- protected readonly state: NgpSliderState;
312
- /**
313
- * Set the value of the slider.
314
- */
315
- setValue(value: number): void;
316
- /**
317
- * Set the disabled state.
318
- */
319
- setDisabled(disabled: boolean): void;
320
- /**
321
- * Set the orientation.
322
- */
323
- setOrientation(orientation: NgpOrientation): void;
324
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpSlider, never>;
325
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpSlider, "[ngpSlider]", ["ngpSlider"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "value": { "alias": "ngpSliderValue"; "required": false; "isSignal": true; }; "min": { "alias": "ngpSliderMin"; "required": false; "isSignal": true; }; "max": { "alias": "ngpSliderMax"; "required": false; "isSignal": true; }; "step": { "alias": "ngpSliderStep"; "required": false; "isSignal": true; }; "orientation": { "alias": "ngpSliderOrientation"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpSliderDisabled"; "required": false; "isSignal": true; }; }, { "valueChange": "ngpSliderValueChange"; }, never, never, true, never>;
326
- }
327
-
328
298
  /**
329
299
  * Apply the `ngpRangeSliderRange` directive to an element that represents the range between the low and high values.
330
300
  */
@@ -347,16 +317,8 @@ interface NgpRangeSliderRangeProps {
347
317
  declare const ngpRangeSliderRange: ({}: NgpRangeSliderRangeProps) => {};
348
318
  declare const injectRangeSliderRangeState: {
349
319
  (): _angular_core.Signal<{}>;
350
- (options: {
351
- hoisted: true;
352
- optional?: boolean;
353
- skipSelf?: boolean;
354
- }): _angular_core.Signal<{} | null>;
355
- (options?: {
356
- hoisted?: boolean;
357
- optional?: boolean;
358
- skipSelf?: boolean;
359
- }): _angular_core.Signal<{}> | _angular_core.Signal<{} | null>;
320
+ (options: ng_primitives_state.StateInjectionOptions): _angular_core.Signal<{} | null>;
321
+ (options?: ng_primitives_state.StateInjectionOptions): _angular_core.Signal<{}> | _angular_core.Signal<{} | null>;
360
322
  };
361
323
  declare const provideRangeSliderRangeState: (opts?: {
362
324
  inherit?: boolean;
@@ -421,20 +383,12 @@ declare const injectRangeSliderThumbState: {
421
383
  value: Signal<number>;
422
384
  percentage: Signal<number>;
423
385
  }>;
424
- (options: {
425
- hoisted: true;
426
- optional?: boolean;
427
- skipSelf?: boolean;
428
- }): Signal<{
386
+ (options: ng_primitives_state.StateInjectionOptions): Signal<{
429
387
  thumb: Signal<"low" | "high">;
430
388
  value: Signal<number>;
431
389
  percentage: Signal<number>;
432
390
  } | null>;
433
- (options?: {
434
- hoisted?: boolean;
435
- optional?: boolean;
436
- skipSelf?: boolean;
437
- }): Signal<{
391
+ (options?: ng_primitives_state.StateInjectionOptions): Signal<{
438
392
  thumb: Signal<"low" | "high">;
439
393
  value: Signal<number>;
440
394
  percentage: Signal<number>;
@@ -470,16 +424,8 @@ interface NgpRangeSliderTrackProps {
470
424
  declare const ngpRangeSliderTrack: ({}: NgpRangeSliderTrackProps) => {};
471
425
  declare const injectRangeSliderTrackState: {
472
426
  (): _angular_core.Signal<{}>;
473
- (options: {
474
- hoisted: true;
475
- optional?: boolean;
476
- skipSelf?: boolean;
477
- }): _angular_core.Signal<{} | null>;
478
- (options?: {
479
- hoisted?: boolean;
480
- optional?: boolean;
481
- skipSelf?: boolean;
482
- }): _angular_core.Signal<{}> | _angular_core.Signal<{} | null>;
427
+ (options: ng_primitives_state.StateInjectionOptions): _angular_core.Signal<{} | null>;
428
+ (options?: ng_primitives_state.StateInjectionOptions): _angular_core.Signal<{}> | _angular_core.Signal<{} | null>;
483
429
  };
484
430
  declare const provideRangeSliderTrackState: (opts?: {
485
431
  inherit?: boolean;
@@ -689,16 +635,8 @@ interface NgpRangeSliderState {
689
635
  declare const ngpRangeSlider: ({ id, low: _low, high: _high, min, max, step, orientation: _orientation, disabled: _disabled, onLowChange, onHighChange, }: NgpRangeSliderProps) => NgpRangeSliderState;
690
636
  declare const injectRangeSliderState: {
691
637
  (): Signal<NgpRangeSliderState>;
692
- (options: {
693
- hoisted: true;
694
- optional?: boolean;
695
- skipSelf?: boolean;
696
- }): Signal<NgpRangeSliderState | null>;
697
- (options?: {
698
- hoisted?: boolean;
699
- optional?: boolean;
700
- skipSelf?: boolean;
701
- }): Signal<NgpRangeSliderState> | Signal<NgpRangeSliderState | null>;
638
+ (options: ng_primitives_state.StateInjectionOptions): Signal<NgpRangeSliderState | null>;
639
+ (options?: ng_primitives_state.StateInjectionOptions): Signal<NgpRangeSliderState> | Signal<NgpRangeSliderState | null>;
702
640
  };
703
641
  declare const provideRangeSliderState: (opts?: {
704
642
  inherit?: boolean;
@@ -27,6 +27,11 @@ interface CreateStateProviderOptions {
27
27
  */
28
28
  inherit?: boolean;
29
29
  }
30
+ type StateInjectionOptions = {
31
+ hoisted?: boolean;
32
+ optional?: boolean;
33
+ skipSelf?: boolean;
34
+ } | undefined;
30
35
  /**
31
36
  * Create a new provider for the state. It first tries to inject the state from the parent injector,
32
37
  * as this allows for the state to be hoisted to a higher level in the component tree. This can
@@ -60,29 +65,13 @@ interface CreatePrimitiveOptions {
60
65
  type PrimitiveState<TFactory extends (...args: any[]) => unknown> = TFactory extends (props: unknown) => infer R ? R : TFactory extends (...args: any[]) => infer R ? R : never;
61
66
  type BasePrimitiveInjectionFn<TState> = {
62
67
  (): Signal<TState>;
63
- (options: {
64
- hoisted: true;
65
- optional?: boolean;
66
- skipSelf?: boolean;
67
- }): Signal<TState | null>;
68
- (options?: {
69
- hoisted?: boolean;
70
- optional?: boolean;
71
- skipSelf?: boolean;
72
- }): Signal<TState | null> | Signal<TState>;
68
+ (options: StateInjectionOptions): Signal<TState | null>;
69
+ (options?: StateInjectionOptions): Signal<TState | null> | Signal<TState>;
73
70
  };
74
71
  type PrimitiveInjectionFn<TFactory extends (...args: any[]) => unknown> = TFactory extends (props: unknown) => infer R ? {
75
72
  (): Signal<R>;
76
- (options: {
77
- hoisted: true;
78
- optional?: boolean;
79
- skipSelf?: boolean;
80
- }): Signal<R | null>;
81
- (options?: {
82
- hoisted?: boolean;
83
- optional?: boolean;
84
- skipSelf?: boolean;
85
- }): Signal<R | null> | Signal<R>;
73
+ (options: StateInjectionOptions): Signal<R | null>;
74
+ (options?: StateInjectionOptions): Signal<R | null> | Signal<R>;
86
75
  } : BasePrimitiveInjectionFn<PrimitiveState<TFactory>>;
87
76
  declare function createPrimitive<TFactory extends (...args: any[]) => unknown>(name: string, fn: TFactory, options?: CreatePrimitiveOptions): [
88
77
  InjectionToken<WritableSignal<PrimitiveState<TFactory>>>,
@@ -92,6 +81,22 @@ declare function createPrimitive<TFactory extends (...args: any[]) => unknown>(n
92
81
  inherit?: boolean;
93
82
  }) => FactoryProvider
94
83
  ];
84
+ /**
85
+ * Wraps an external signal in a `linkedSignal` so it can be written to internally
86
+ * while still re-syncing whenever the source input changes.
87
+ *
88
+ * Only use this when the primitive needs to mutate the value internally (e.g. a
89
+ * setter, toggle, or other internal update) but must also remain in sync with the
90
+ * input. If the value is read-only — passed straight through to bindings or exposed
91
+ * to consumers without internal mutation — use the input signal directly instead.
92
+ *
93
+ * When `value` is `undefined`, falls back to a plain writable signal seeded with
94
+ * `defaultValue`, supporting uncontrolled usage.
95
+ *
96
+ * @param value - The external signal to synchronize with
97
+ * @param defaultValue - The default value to use when `value` is `undefined`
98
+ * @returns A writable signal linked to the external signal
99
+ */
95
100
  declare function controlled<T>(value: Signal<T>): WritableSignal<T>;
96
101
  declare function controlled<T>(value: Signal<T> | undefined, defaultValue: T): WritableSignal<T>;
97
102
  interface ControlledStateOptions<T> {
@@ -163,4 +168,4 @@ declare function emitter<T>({ injector, }?: {
163
168
  }): Emitter<T>;
164
169
 
165
170
  export { attrBinding, controlled, controlledState, createPrimitive, createState, createStateInjector, createStateProvider, createStateToken, dataBinding, deprecatedSetter, emitter, injectInheritedState, listener, onDestroy, onMount, styleBinding };
166
- export type { ControlledState, ControlledStateOptions, CreatePrimitiveOptions, CreateStateProviderOptions, CreatedState, Emitter, InjectedState, SetterOptions, State };
171
+ export type { ControlledState, ControlledStateOptions, CreatePrimitiveOptions, CreateStateProviderOptions, CreatedState, Emitter, InjectedState, SetterOptions, State, StateInjectionOptions };
@@ -1,7 +1,9 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { Signal, WritableSignal } from '@angular/core';
3
- import { Observable } from 'rxjs';
3
+ import * as ng_primitives_state from 'ng-primitives/state';
4
+ import * as ng_primitives_switch from 'ng-primitives/switch';
4
5
  import { BooleanInput } from '@angular/cdk/coercion';
6
+ import { Observable } from 'rxjs';
5
7
 
6
8
  /**
7
9
  * Apply the `ngpSwitchThumb` directive to an element within a switch to represent the thumb.
@@ -33,21 +35,56 @@ interface NgpSwitchThumbProps {
33
35
  declare const ngpSwitchThumb: ({}: NgpSwitchThumbProps) => NgpSwitchThumbState;
34
36
  declare const injectSwitchThumbState: {
35
37
  (): Signal<NgpSwitchThumbState>;
36
- (options: {
37
- hoisted: true;
38
- optional?: boolean;
39
- skipSelf?: boolean;
40
- }): Signal<NgpSwitchThumbState | null>;
41
- (options?: {
42
- hoisted?: boolean;
43
- optional?: boolean;
44
- skipSelf?: boolean;
45
- }): Signal<NgpSwitchThumbState> | Signal<NgpSwitchThumbState | null>;
38
+ (options: ng_primitives_state.StateInjectionOptions): Signal<NgpSwitchThumbState | null>;
39
+ (options?: ng_primitives_state.StateInjectionOptions): Signal<NgpSwitchThumbState> | Signal<NgpSwitchThumbState | null>;
46
40
  };
47
41
  declare const provideSwitchThumbState: (opts?: {
48
42
  inherit?: boolean;
49
43
  }) => _angular_core.FactoryProvider;
50
44
 
45
+ /**
46
+ * Apply the `ngpSwitch` directive to an element to manage the checked state.
47
+ */
48
+ declare class NgpSwitch {
49
+ /**
50
+ * The id of the switch. If not provided, a unique id will be generated.
51
+ */
52
+ readonly id: _angular_core.InputSignal<string>;
53
+ /**
54
+ * Determine if the switch is checked.
55
+ * @default false
56
+ */
57
+ readonly checked: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
58
+ /**
59
+ * Emits when the checked state changes.
60
+ */
61
+ readonly checkedChange: _angular_core.OutputEmitterRef<boolean>;
62
+ /**
63
+ * Determine if the switch is disabled.
64
+ * @default false
65
+ */
66
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
67
+ /**
68
+ * The switch state.
69
+ * @internal
70
+ */
71
+ readonly state: ng_primitives_switch.NgpSwitchState;
72
+ /**
73
+ * Toggle the checked state.
74
+ */
75
+ toggle(): void;
76
+ /**
77
+ * Update the checked value.
78
+ */
79
+ setChecked(value: boolean): void;
80
+ /**
81
+ * Update the disabled value.
82
+ */
83
+ setDisabled(value: boolean): void;
84
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpSwitch, never>;
85
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpSwitch, "[ngpSwitch]", ["ngpSwitch"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "checked": { "alias": "ngpSwitchChecked"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpSwitchDisabled"; "required": false; "isSignal": true; }; }, { "checkedChange": "ngpSwitchCheckedChange"; }, never, never, true, never>;
86
+ }
87
+
51
88
  /**
52
89
  * Public state surface for the Switch primitive.
53
90
  */
@@ -105,63 +142,12 @@ interface NgpSwitchProps {
105
142
  declare const ngpSwitch: ({ id, checked: _checked, disabled: _disabled, onCheckedChange, }: NgpSwitchProps) => NgpSwitchState;
106
143
  declare const injectSwitchState: {
107
144
  (): Signal<NgpSwitchState>;
108
- (options: {
109
- hoisted: true;
110
- optional?: boolean;
111
- skipSelf?: boolean;
112
- }): Signal<NgpSwitchState | null>;
113
- (options?: {
114
- hoisted?: boolean;
115
- optional?: boolean;
116
- skipSelf?: boolean;
117
- }): Signal<NgpSwitchState> | Signal<NgpSwitchState | null>;
145
+ (options: ng_primitives_state.StateInjectionOptions): Signal<NgpSwitchState | null>;
146
+ (options?: ng_primitives_state.StateInjectionOptions): Signal<NgpSwitchState> | Signal<NgpSwitchState | null>;
118
147
  };
119
148
  declare const provideSwitchState: (opts?: {
120
149
  inherit?: boolean;
121
150
  }) => _angular_core.FactoryProvider;
122
151
 
123
- /**
124
- * Apply the `ngpSwitch` directive to an element to manage the checked state.
125
- */
126
- declare class NgpSwitch {
127
- /**
128
- * The id of the switch. If not provided, a unique id will be generated.
129
- */
130
- readonly id: _angular_core.InputSignal<string>;
131
- /**
132
- * Determine if the switch is checked.
133
- * @default false
134
- */
135
- readonly checked: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
136
- /**
137
- * Emits when the checked state changes.
138
- */
139
- readonly checkedChange: _angular_core.OutputEmitterRef<boolean>;
140
- /**
141
- * Determine if the switch is disabled.
142
- * @default false
143
- */
144
- readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
145
- /**
146
- * The switch state.
147
- * @internal
148
- */
149
- readonly state: NgpSwitchState;
150
- /**
151
- * Toggle the checked state.
152
- */
153
- toggle(): void;
154
- /**
155
- * Update the checked value.
156
- */
157
- setChecked(value: boolean): void;
158
- /**
159
- * Update the disabled value.
160
- */
161
- setDisabled(value: boolean): void;
162
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpSwitch, never>;
163
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpSwitch, "[ngpSwitch]", ["ngpSwitch"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "checked": { "alias": "ngpSwitchChecked"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpSwitchDisabled"; "required": false; "isSignal": true; }; }, { "checkedChange": "ngpSwitchCheckedChange"; }, never, never, true, never>;
164
- }
165
-
166
152
  export { NgpSwitch, NgpSwitchThumb, injectSwitchState, injectSwitchThumbState, ngpSwitch, ngpSwitchThumb, provideSwitchState, provideSwitchThumbState };
167
153
  export type { NgpSwitchProps, NgpSwitchState, NgpSwitchThumbProps, NgpSwitchThumbState };
@@ -2,6 +2,7 @@ import * as _angular_core from '@angular/core';
2
2
  import { Provider, Signal, WritableSignal } from '@angular/core';
3
3
  import { NgpOrientation } from 'ng-primitives/common';
4
4
  import { BooleanInput } from '@angular/cdk/coercion';
5
+ import * as ng_primitives_state from 'ng-primitives/state';
5
6
 
6
7
  interface NgpTabsConfig {
7
8
  /**
@@ -110,20 +111,12 @@ declare const injectTabButtonState: {
110
111
  active: Signal<boolean>;
111
112
  select: () => void;
112
113
  }>;
113
- (options: {
114
- hoisted: true;
115
- optional?: boolean;
116
- skipSelf?: boolean;
117
- }): Signal<{
114
+ (options: ng_primitives_state.StateInjectionOptions): Signal<{
118
115
  id: Signal<string>;
119
116
  active: Signal<boolean>;
120
117
  select: () => void;
121
118
  } | null>;
122
- (options?: {
123
- hoisted?: boolean;
124
- optional?: boolean;
125
- skipSelf?: boolean;
126
- }): Signal<{
119
+ (options?: ng_primitives_state.StateInjectionOptions): Signal<{
127
120
  id: Signal<string>;
128
121
  active: Signal<boolean>;
129
122
  select: () => void;
@@ -160,16 +153,8 @@ declare const NgpTabListStateToken: _angular_core.InjectionToken<_angular_core.W
160
153
  declare const ngpTabList: ({}: NgpTabListProps) => {};
161
154
  declare const injectTabListState: {
162
155
  (): _angular_core.Signal<{}>;
163
- (options: {
164
- hoisted: true;
165
- optional?: boolean;
166
- skipSelf?: boolean;
167
- }): _angular_core.Signal<{} | null>;
168
- (options?: {
169
- hoisted?: boolean;
170
- optional?: boolean;
171
- skipSelf?: boolean;
172
- }): _angular_core.Signal<{}> | _angular_core.Signal<{} | null>;
156
+ (options: ng_primitives_state.StateInjectionOptions): _angular_core.Signal<{} | null>;
157
+ (options?: ng_primitives_state.StateInjectionOptions): _angular_core.Signal<{}> | _angular_core.Signal<{} | null>;
173
158
  };
174
159
  declare const provideTabListState: (opts?: {
175
160
  inherit?: boolean;
@@ -244,20 +229,12 @@ declare const injectTabPanelState: {
244
229
  labelledBy: Signal<string>;
245
230
  active: Signal<boolean>;
246
231
  }>;
247
- (options: {
248
- hoisted: true;
249
- optional?: boolean;
250
- skipSelf?: boolean;
251
- }): Signal<{
232
+ (options: ng_primitives_state.StateInjectionOptions): Signal<{
252
233
  panelId: Signal<string>;
253
234
  labelledBy: Signal<string>;
254
235
  active: Signal<boolean>;
255
236
  } | null>;
256
- (options?: {
257
- hoisted?: boolean;
258
- optional?: boolean;
259
- skipSelf?: boolean;
260
- }): Signal<{
237
+ (options?: ng_primitives_state.StateInjectionOptions): Signal<{
261
238
  panelId: Signal<string>;
262
239
  labelledBy: Signal<string>;
263
240
  active: Signal<boolean>;
@@ -427,11 +404,7 @@ declare const injectTabsetState: {
427
404
  unregisterTab: (tabValue: string) => void;
428
405
  setActivateOnFocus: (newActivateOnFocus: boolean) => void;
429
406
  }>;
430
- (options: {
431
- hoisted: true;
432
- optional?: boolean;
433
- skipSelf?: boolean;
434
- }): Signal<{
407
+ (options: ng_primitives_state.StateInjectionOptions): Signal<{
435
408
  id: Signal<string>;
436
409
  orientation: WritableSignal<NgpOrientation>;
437
410
  activateOnFocus: WritableSignal<boolean>;
@@ -443,11 +416,7 @@ declare const injectTabsetState: {
443
416
  unregisterTab: (tabValue: string) => void;
444
417
  setActivateOnFocus: (newActivateOnFocus: boolean) => void;
445
418
  } | null>;
446
- (options?: {
447
- hoisted?: boolean;
448
- optional?: boolean;
449
- skipSelf?: boolean;
450
- }): Signal<{
419
+ (options?: ng_primitives_state.StateInjectionOptions): Signal<{
451
420
  id: Signal<string>;
452
421
  orientation: WritableSignal<NgpOrientation>;
453
422
  activateOnFocus: WritableSignal<boolean>;
@@ -1,6 +1,7 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { Signal, WritableSignal } from '@angular/core';
3
3
  import { BooleanInput } from '@angular/cdk/coercion';
4
+ import * as ng_primitives_state from 'ng-primitives/state';
4
5
 
5
6
  declare class NgpTextarea {
6
7
  /**
@@ -69,20 +70,12 @@ declare const injectTextareaState: {
69
70
  disabled: WritableSignal<boolean>;
70
71
  setDisabled: (value: boolean) => void;
71
72
  }>;
72
- (options: {
73
- hoisted: true;
74
- optional?: boolean;
75
- skipSelf?: boolean;
76
- }): Signal<{
73
+ (options: ng_primitives_state.StateInjectionOptions): Signal<{
77
74
  id: Signal<string>;
78
75
  disabled: WritableSignal<boolean>;
79
76
  setDisabled: (value: boolean) => void;
80
77
  } | null>;
81
- (options?: {
82
- hoisted?: boolean;
83
- optional?: boolean;
84
- skipSelf?: boolean;
85
- }): Signal<{
78
+ (options?: ng_primitives_state.StateInjectionOptions): Signal<{
86
79
  id: Signal<string>;
87
80
  disabled: WritableSignal<boolean>;
88
81
  setDisabled: (value: boolean) => void;