ng-primitives 0.90.0 → 0.91.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 (93) hide show
  1. package/a11y/index.d.ts +38 -46
  2. package/accordion/index.d.ts +252 -104
  3. package/ai/index.d.ts +1 -1
  4. package/autofill/index.d.ts +49 -9
  5. package/avatar/index.d.ts +96 -61
  6. package/breadcrumbs/index.d.ts +156 -16
  7. package/button/index.d.ts +23 -28
  8. package/checkbox/index.d.ts +93 -14
  9. package/combobox/index.d.ts +1 -1
  10. package/date-picker/index.d.ts +12 -11
  11. package/fesm2022/ng-primitives-a11y.mjs +36 -52
  12. package/fesm2022/ng-primitives-a11y.mjs.map +1 -1
  13. package/fesm2022/ng-primitives-accordion.mjs +210 -189
  14. package/fesm2022/ng-primitives-accordion.mjs.map +1 -1
  15. package/fesm2022/ng-primitives-ai.mjs +4 -4
  16. package/fesm2022/ng-primitives-ai.mjs.map +1 -1
  17. package/fesm2022/ng-primitives-autofill.mjs +53 -36
  18. package/fesm2022/ng-primitives-autofill.mjs.map +1 -1
  19. package/fesm2022/ng-primitives-avatar.mjs +97 -138
  20. package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
  21. package/fesm2022/ng-primitives-breadcrumbs.mjs +92 -35
  22. package/fesm2022/ng-primitives-breadcrumbs.mjs.map +1 -1
  23. package/fesm2022/ng-primitives-button.mjs +14 -36
  24. package/fesm2022/ng-primitives-button.mjs.map +1 -1
  25. package/fesm2022/ng-primitives-checkbox.mjs +87 -65
  26. package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
  27. package/fesm2022/ng-primitives-combobox.mjs +9 -9
  28. package/fesm2022/ng-primitives-combobox.mjs.map +1 -1
  29. package/fesm2022/ng-primitives-date-picker.mjs +5 -4
  30. package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
  31. package/fesm2022/ng-primitives-form-field.mjs +48 -16
  32. package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
  33. package/fesm2022/ng-primitives-input.mjs +32 -48
  34. package/fesm2022/ng-primitives-input.mjs.map +1 -1
  35. package/fesm2022/ng-primitives-interactions.mjs +4 -4
  36. package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
  37. package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
  38. package/fesm2022/ng-primitives-menu.mjs +13 -6
  39. package/fesm2022/ng-primitives-menu.mjs.map +1 -1
  40. package/fesm2022/ng-primitives-pagination.mjs +6 -6
  41. package/fesm2022/ng-primitives-pagination.mjs.map +1 -1
  42. package/fesm2022/ng-primitives-progress.mjs +2 -2
  43. package/fesm2022/ng-primitives-progress.mjs.map +1 -1
  44. package/fesm2022/ng-primitives-radio.mjs +3 -3
  45. package/fesm2022/ng-primitives-radio.mjs.map +1 -1
  46. package/fesm2022/ng-primitives-roving-focus.mjs +259 -236
  47. package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
  48. package/fesm2022/ng-primitives-search.mjs.map +1 -1
  49. package/fesm2022/ng-primitives-select.mjs +8 -8
  50. package/fesm2022/ng-primitives-select.mjs.map +1 -1
  51. package/fesm2022/ng-primitives-slider.mjs +195 -172
  52. package/fesm2022/ng-primitives-slider.mjs.map +1 -1
  53. package/fesm2022/ng-primitives-state.mjs +172 -2
  54. package/fesm2022/ng-primitives-state.mjs.map +1 -1
  55. package/fesm2022/ng-primitives-switch.mjs +90 -88
  56. package/fesm2022/ng-primitives-switch.mjs.map +1 -1
  57. package/fesm2022/ng-primitives-tabs.mjs +4 -1
  58. package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
  59. package/fesm2022/ng-primitives-textarea.mjs +27 -35
  60. package/fesm2022/ng-primitives-textarea.mjs.map +1 -1
  61. package/fesm2022/ng-primitives-toggle-group.mjs +134 -136
  62. package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
  63. package/fesm2022/ng-primitives-toggle.mjs +69 -58
  64. package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
  65. package/fesm2022/ng-primitives-toolbar.mjs +26 -35
  66. package/fesm2022/ng-primitives-toolbar.mjs.map +1 -1
  67. package/fesm2022/ng-primitives-utils.mjs +48 -35
  68. package/fesm2022/ng-primitives-utils.mjs.map +1 -1
  69. package/form-field/index.d.ts +7 -3
  70. package/input/index.d.ts +61 -24
  71. package/interactions/index.d.ts +5 -5
  72. package/listbox/index.d.ts +1 -1
  73. package/menu/index.d.ts +3 -2
  74. package/package.json +1 -1
  75. package/pagination/index.d.ts +7 -7
  76. package/roving-focus/index.d.ts +77 -101
  77. package/schematics/ng-add/schema.d.ts +0 -1
  78. package/schematics/ng-generate/templates/checkbox/checkbox.__fileSuffix@dasherize__.ts.template +2 -2
  79. package/schematics/ng-generate/templates/slider/slider.__fileSuffix@dasherize__.ts.template +6 -3
  80. package/schematics/ng-generate/templates/switch/switch.__fileSuffix@dasherize__.ts.template +2 -2
  81. package/schematics/ng-generate/templates/toggle/toggle.__fileSuffix@dasherize__.ts.template +2 -2
  82. package/schematics/ng-generate/templates/toggle-group/toggle-group.__fileSuffix@dasherize__.ts.template +2 -2
  83. package/schematics/ng-generate/templates/toolbar/toolbar.__fileSuffix@dasherize__.ts.template +1 -1
  84. package/search/index.d.ts +1 -1
  85. package/select/index.d.ts +2 -2
  86. package/slider/index.d.ts +195 -56
  87. package/state/index.d.ts +57 -3
  88. package/switch/index.d.ts +103 -28
  89. package/textarea/index.d.ts +63 -8
  90. package/toggle/index.d.ts +65 -24
  91. package/toggle-group/index.d.ts +79 -54
  92. package/toolbar/index.d.ts +27 -17
  93. package/utils/index.d.ts +1 -0
@@ -36,7 +36,7 @@ declare class NgpPaginationButton {
36
36
  * A click event may not be fired if this is on an anchor tag and the href is empty.
37
37
  * This is a workaround to ensure the click event is fired.
38
38
  */
39
- protected onEnter(event: KeyboardEvent): void;
39
+ protected onEnter(event: Event): void;
40
40
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpPaginationButton, never>;
41
41
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpPaginationButton, "[ngpPaginationButton]", ["ngpPaginationButton"], { "page": { "alias": "ngpPaginationButtonPage"; "required": true; "isSignal": true; }; "buttonDisabled": { "alias": "ngpPaginationButtonDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
42
42
  }
@@ -63,7 +63,7 @@ declare class NgpPaginationFirst {
63
63
  * A click event may not be fired if this is on an anchor tag and the href is empty.
64
64
  * This is a workaround to ensure the click event is fired.
65
65
  */
66
- protected onEnter(event: KeyboardEvent): void;
66
+ protected onEnter(event: Event): void;
67
67
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpPaginationFirst, never>;
68
68
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpPaginationFirst, "[ngpPaginationFirst]", ["ngpPaginationFirst"], { "buttonDisabled": { "alias": "ngpPaginationFirstDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
69
69
  }
@@ -75,7 +75,7 @@ declare class NgpPaginationLast {
75
75
  /**
76
76
  * Access the pagination state.
77
77
  */
78
- private readonly paginationState;
78
+ protected readonly paginationState: _angular_core.Signal<ng_primitives_state.State<ng_primitives_pagination.NgpPagination>>;
79
79
  /**
80
80
  * Whether the button is disabled.
81
81
  */
@@ -90,7 +90,7 @@ declare class NgpPaginationLast {
90
90
  * A click event may not be fired if this is on an anchor tag and the href is empty.
91
91
  * This is a workaround to ensure the click event is fired.
92
92
  */
93
- protected onEnter(event: KeyboardEvent): void;
93
+ protected onEnter(event: Event): void;
94
94
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpPaginationLast, never>;
95
95
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpPaginationLast, "[ngpPaginationLast]", ["ngpPaginationLast"], { "buttonDisabled": { "alias": "ngpPaginationLastDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
96
96
  }
@@ -120,7 +120,7 @@ declare class NgpPaginationNext {
120
120
  * A click event may not be fired if this is on an anchor tag and the href is empty.
121
121
  * This is a workaround to ensure the click event is fired.
122
122
  */
123
- protected onEnter(event: KeyboardEvent): void;
123
+ protected onEnter(event: Event): void;
124
124
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpPaginationNext, never>;
125
125
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpPaginationNext, "[ngpPaginationNext]", ["ngpPaginationNext"], { "buttonDisabled": { "alias": "ngpPaginationNextDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
126
126
  }
@@ -150,7 +150,7 @@ declare class NgpPaginationPrevious {
150
150
  * A click event may not be fired if this is on an anchor tag and the href is empty.
151
151
  * This is a workaround to ensure the click event is fired.
152
152
  */
153
- protected onEnter(event: KeyboardEvent): void;
153
+ protected onEnter(event: Event): void;
154
154
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpPaginationPrevious, never>;
155
155
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpPaginationPrevious, "[ngpPaginationPrevious]", ["ngpPaginationPrevious"], { "buttonDisabled": { "alias": "ngpPaginationPreviousDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
156
156
  }
@@ -189,7 +189,7 @@ declare class NgpPagination {
189
189
  * The control state for the pagination.
190
190
  * @internal
191
191
  */
192
- private readonly state;
192
+ protected readonly state: ng_primitives_state.CreatedState<NgpPagination>;
193
193
  /**
194
194
  * Go to the specified page.
195
195
  * @param page The page to go to.
@@ -1,56 +1,91 @@
1
- import * as ng_primitives_state from 'ng-primitives/state';
2
1
  import * as _angular_core from '@angular/core';
3
- import { OnInit, OnDestroy, ElementRef, InjectionToken, Type, FactoryProvider } from '@angular/core';
2
+ import { Signal, ElementRef, InjectionToken, Type, FactoryProvider } from '@angular/core';
4
3
  import { FocusOrigin } from '@angular/cdk/a11y';
5
- import { BooleanInput } from '@angular/cdk/coercion';
6
4
  import { NgpOrientation } from 'ng-primitives/common';
5
+ import { BooleanInput } from '@angular/cdk/coercion';
7
6
 
8
7
  /**
9
- * Apply the `ngpRovingFocusItem` directive to an element within a roving focus group to automatically manage focus.
8
+ * The state interface for the RovingFocusItem pattern.
10
9
  */
11
- declare class NgpRovingFocusItem implements OnInit, OnDestroy {
12
- /**
13
- * Access the group the roving focus item belongs to.
14
- */
15
- private readonly group;
16
- /**
17
- * Access the focus monitor service.
18
- */
19
- private readonly focusMonitor;
10
+ interface NgpRovingFocusItemState {
11
+ readonly id: Signal<string>;
12
+ readonly disabled: Signal<boolean>;
13
+ readonly tabindex: Signal<number>;
14
+ readonly element: ElementRef<HTMLElement>;
15
+ focus(origin: FocusOrigin): void;
16
+ }
17
+ /**
18
+ * The props interface for the RovingFocusItem pattern.
19
+ */
20
+ interface NgpRovingFocusItemProps {
20
21
  /**
21
- * Access the element the roving focus item is attached to.
22
+ * Whether the item is disabled.
22
23
  */
23
- readonly elementRef: ElementRef<HTMLElement>;
24
+ readonly disabled: Signal<boolean>;
25
+ }
26
+ declare const NgpRovingFocusItemStateToken: _angular_core.InjectionToken<_angular_core.WritableSignal<NgpRovingFocusItemState>>;
27
+ declare const ngpRovingFocusItem: ({ disabled }: NgpRovingFocusItemProps) => NgpRovingFocusItemState;
28
+ declare const injectRovingFocusItemState: {
29
+ (): Signal<NgpRovingFocusItemState>;
30
+ (options: {
31
+ hoisted: true;
32
+ }): Signal<NgpRovingFocusItemState | null>;
33
+ (options?: {
34
+ hoisted?: boolean;
35
+ }): Signal<NgpRovingFocusItemState | null>;
36
+ };
37
+ declare const provideRovingFocusItemState: (opts?: {
38
+ inherit?: boolean;
39
+ }) => _angular_core.FactoryProvider;
40
+
41
+ interface NgpRovingFocusGroupState {
42
+ orientation: Signal<NgpOrientation>;
43
+ wrap: Signal<boolean>;
44
+ homeEnd: Signal<boolean>;
45
+ disabled: Signal<boolean>;
46
+ activeItem: Signal<string | null>;
47
+ onKeydown(event: KeyboardEvent): void;
48
+ setActiveItem(id: string | null, origin?: FocusOrigin): void;
49
+ register(item: NgpRovingFocusItemState): void;
50
+ unregister(item: NgpRovingFocusItemState): void;
51
+ setOrientation(orientation: NgpOrientation): void;
52
+ }
53
+ interface NgpRovingFocusGroupProps {
54
+ orientation?: Signal<NgpOrientation>;
55
+ wrap?: Signal<boolean>;
56
+ homeEnd?: Signal<boolean>;
57
+ disabled?: Signal<boolean>;
58
+ inherit?: boolean;
59
+ }
60
+ declare const NgpRovingFocusGroupStateToken: _angular_core.InjectionToken<_angular_core.WritableSignal<NgpRovingFocusGroupState>>;
61
+ declare const ngpRovingFocusGroup: ({ orientation: _orientation, wrap, homeEnd, disabled, inherit, }: NgpRovingFocusGroupProps) => NgpRovingFocusGroupState;
62
+ declare const injectRovingFocusGroupState: {
63
+ (): Signal<NgpRovingFocusGroupState>;
64
+ (options: {
65
+ hoisted: true;
66
+ }): Signal<NgpRovingFocusGroupState | null>;
67
+ (options?: {
68
+ hoisted?: boolean;
69
+ }): Signal<NgpRovingFocusGroupState | null>;
70
+ };
71
+ declare const provideRovingFocusGroupState: (opts?: {
72
+ inherit?: boolean;
73
+ }) => _angular_core.FactoryProvider;
74
+
75
+ /**
76
+ * Apply the `ngpRovingFocusItem` directive to an element within a roving focus group to automatically manage focus.
77
+ */
78
+ declare class NgpRovingFocusItem {
24
79
  /**
25
80
  * Define if the item is disabled.
26
81
  */
27
82
  readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
83
+ private readonly state;
28
84
  /**
29
- * Derive the tabindex of the roving focus item.
30
- */
31
- readonly tabindex: _angular_core.Signal<0 | -1>;
32
- /**
33
- * Initialize the roving focus item.
34
- */
35
- ngOnInit(): void;
36
- /**
37
- * Clean up the roving focus item.
38
- */
39
- ngOnDestroy(): void;
40
- /**
41
- * Forward the keydown event to the roving focus group.
42
- * @param event The keyboard event
43
- */
44
- protected onKeydown(event: KeyboardEvent): void;
45
- /**
46
- * Activate the roving focus item on click.
47
- */
48
- protected activate(): void;
49
- /**
50
- * Focus the roving focus item.
51
- * @param origin The origin of the focus
85
+ * Expose the internal id of the roving focus item.
86
+ * @internal
52
87
  */
53
- focus(origin: FocusOrigin): void;
88
+ readonly id: _angular_core.Signal<string>;
54
89
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpRovingFocusItem, never>;
55
90
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpRovingFocusItem, "[ngpRovingFocusItem]", ["ngpRovingFocusItem"], { "disabled": { "alias": "ngpRovingFocusItemDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
56
91
  }
@@ -59,10 +94,6 @@ declare class NgpRovingFocusItem implements OnInit, OnDestroy {
59
94
  * Apply the `ngpRovingFocusGroup` directive to an element to manage focus for a group of child elements.
60
95
  */
61
96
  declare class NgpRovingFocusGroup {
62
- /**
63
- * Access the directionality service.
64
- */
65
- private readonly directionality;
66
97
  /**
67
98
  * Determine the orientation of the roving focus group.
68
99
  * @default 'vertical'
@@ -80,14 +111,6 @@ declare class NgpRovingFocusGroup {
80
111
  * Determine if the roving focus group is disabled.
81
112
  */
82
113
  readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
83
- /**
84
- * Store the items in the roving focus group.
85
- */
86
- private readonly items;
87
- /**
88
- * Get the items in the roving focus group sorted by order.
89
- */
90
- private get sortedItems();
91
114
  /**
92
115
  * Store the active item in the roving focus group.
93
116
  * @internal
@@ -96,64 +119,17 @@ declare class NgpRovingFocusGroup {
96
119
  /**
97
120
  * The state of the roving focus group.
98
121
  */
99
- readonly state: ng_primitives_state.CreatedState<NgpRovingFocusGroup>;
100
- /**
101
- * Register an item with the roving focus group.
102
- * @param item The item to register
103
- * @internal
104
- */
105
- register(item: NgpRovingFocusItem): void;
106
- /**
107
- * Unregister an item with the roving focus group.
108
- * @param item The item to unregister
109
- * @internal
110
- */
111
- unregister(item: NgpRovingFocusItem): void;
122
+ readonly state: NgpRovingFocusGroupState;
112
123
  /**
113
124
  * Activate an item in the roving focus group.
114
125
  * @param item The item to activate
115
126
  * @param origin The origin of the focus change
116
127
  */
117
128
  setActiveItem(item: NgpRovingFocusItem | null, origin?: FocusOrigin): void;
118
- /**
119
- * Activate the first item in the roving focus group.
120
- * @param origin The origin of the focus change
121
- */
122
- private activateFirstItem;
123
- /**
124
- * Activate the last item in the roving focus group.
125
- * @param origin The origin of the focus change
126
- */
127
- private activateLastItem;
128
- /**
129
- * Activate the next item in the roving focus group.
130
- * @param origin The origin of the focus change
131
- */
132
- private activateNextItem;
133
- /**
134
- * Activate the previous item in the roving focus group.
135
- * @param origin The origin of the focus change
136
- */
137
- private activatePreviousItem;
138
- /**
139
- * Handle keyboard navigation for the roving focus group.
140
- * @param event The keyboard event
141
- * @internal
142
- */
143
- onKeydown(event: KeyboardEvent): void;
144
129
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpRovingFocusGroup, never>;
145
130
  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>;
146
131
  }
147
132
 
148
- /**
149
- * Provides the RovingFocusGroup state.
150
- */
151
- declare const provideRovingFocusGroupState: (options?: ng_primitives_state.CreateStateProviderOptions) => _angular_core.FactoryProvider;
152
- /**
153
- * Injects the RovingFocusGroup state.
154
- */
155
- declare const injectRovingFocusGroupState: <U = NgpRovingFocusGroup>(injectOptions?: _angular_core.InjectOptions) => _angular_core.Signal<ng_primitives_state.State<U>>;
156
-
157
133
  declare const NgpRovingFocusGroupToken: InjectionToken<NgpRovingFocusGroup>;
158
134
  /**
159
135
  * Inject the RovingFocusGroup directive instance
@@ -174,5 +150,5 @@ interface NgpRovingFocusGroupOptions {
174
150
  */
175
151
  declare function provideRovingFocusGroup(type: Type<NgpRovingFocusGroup>, { inherit }?: NgpRovingFocusGroupOptions): FactoryProvider;
176
152
 
177
- export { NgpRovingFocusGroup, NgpRovingFocusGroupToken, NgpRovingFocusItem, injectRovingFocusGroup, injectRovingFocusGroupState, provideRovingFocusGroup, provideRovingFocusGroupState };
178
- export type { NgpRovingFocusGroupOptions };
153
+ export { NgpRovingFocusGroup, NgpRovingFocusGroupStateToken, NgpRovingFocusGroupToken, NgpRovingFocusItem, NgpRovingFocusItemStateToken, injectRovingFocusGroup, injectRovingFocusGroupState, injectRovingFocusItemState, ngpRovingFocusGroup, ngpRovingFocusItem, provideRovingFocusGroup, provideRovingFocusGroupState, provideRovingFocusItemState };
154
+ export type { NgpRovingFocusGroupOptions, NgpRovingFocusGroupProps, NgpRovingFocusGroupState, NgpRovingFocusItemProps, NgpRovingFocusItemState };
@@ -1,2 +1 @@
1
- // eslint-disable-next-line @typescript-eslint/no-empty-object-type, @typescript-eslint/no-empty-interface
2
1
  export interface Schema {}
@@ -91,7 +91,7 @@ export class Checkbox<%= componentSuffix %> implements ControlValueAccessor {
91
91
  }
92
92
 
93
93
  writeValue(checked: boolean): void {
94
- this.state().checked.set(checked);
94
+ this.state().setChecked(checked);
95
95
  }
96
96
 
97
97
  registerOnChange(fn: ChangeFn<boolean>): void {
@@ -103,6 +103,6 @@ export class Checkbox<%= componentSuffix %> implements ControlValueAccessor {
103
103
  }
104
104
 
105
105
  setDisabledState(isDisabled: boolean): void {
106
- this.state().disabled.set(isDisabled);
106
+ this.state().setDisabled(isDisabled);
107
107
  }
108
108
  }
@@ -1,4 +1,5 @@
1
1
  import { Component, input } from '@angular/core';
2
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
2
3
  import { ControlValueAccessor } from '@angular/forms';
3
4
  import {
4
5
  injectSliderState,
@@ -101,11 +102,13 @@ export class Slider<%= componentSuffix %> implements ControlValueAccessor {
101
102
 
102
103
  constructor() {
103
104
  // Whenever the user interacts with the slider, call the onChange function with the new value.
104
- this.state().valueChange.subscribe(value => this.onChange?.(value));
105
+ this.state()
106
+ .valueChange.pipe(takeUntilDestroyed())
107
+ .subscribe(value => this.onChange?.(value));
105
108
  }
106
109
 
107
110
  writeValue(value: number): void {
108
- this.state().value.set(value);
111
+ this.state().setValue(value);
109
112
  }
110
113
 
111
114
  registerOnChange(fn: ChangeFn<number>): void {
@@ -117,6 +120,6 @@ export class Slider<%= componentSuffix %> implements ControlValueAccessor {
117
120
  }
118
121
 
119
122
  setDisabledState(isDisabled: boolean): void {
120
- this.state().disabled.set(isDisabled);
123
+ this.state().setDisabled(isDisabled);
121
124
  }
122
125
  }
@@ -85,7 +85,7 @@ export class Switch<%= componentSuffix %> implements ControlValueAccessor {
85
85
 
86
86
  /** Write a new value to the switch. */
87
87
  writeValue(value: boolean): void {
88
- this.switch().checked.set(value);
88
+ this.switch().setChecked(value);
89
89
  }
90
90
 
91
91
  /** Register a callback function to be called when the value changes. */
@@ -100,6 +100,6 @@ export class Switch<%= componentSuffix %> implements ControlValueAccessor {
100
100
 
101
101
  /** Set the disabled state of the switch. */
102
102
  setDisabledState(isDisabled: boolean): void {
103
- this.switch().disabled.set(isDisabled);
103
+ this.switch().setDisabled(isDisabled);
104
104
  }
105
105
  }
@@ -74,7 +74,7 @@ export class Toggle<%= componentSuffix %> implements ControlValueAccessor {
74
74
 
75
75
  /** Write a new value to the toggle. */
76
76
  writeValue(value: boolean): void {
77
- this.toggle().selected.set(value);
77
+ this.toggle().setSelected(value);
78
78
  }
79
79
 
80
80
  /** Register a callback function to be called when the value changes. */
@@ -89,6 +89,6 @@ export class Toggle<%= componentSuffix %> implements ControlValueAccessor {
89
89
 
90
90
  /** Set the disabled state of the toggle. */
91
91
  setDisabledState(isDisabled: boolean): void {
92
- this.toggle().disabled.set(isDisabled);
92
+ this.toggle().setDisabled(isDisabled);
93
93
  }
94
94
  }
@@ -55,7 +55,7 @@ export class ToggleGroup<%= componentSuffix %> implements ControlValueAccessor {
55
55
 
56
56
  /** Write a new value to the toggle group. */
57
57
  writeValue(value: string[]): void {
58
- this.toggleGroup().value.set(value);
58
+ this.toggleGroup().setValue(value);
59
59
  }
60
60
 
61
61
  /** Register a callback function to be called when the value changes. */
@@ -70,6 +70,6 @@ export class ToggleGroup<%= componentSuffix %> implements ControlValueAccessor {
70
70
 
71
71
  /** Set the disabled state of the toggle group. */
72
72
  setDisabledState(isDisabled: boolean): void {
73
- this.toggleGroup().disabled.set(isDisabled);
73
+ this.toggleGroup().setDisabled(isDisabled);
74
74
  }
75
75
  }
@@ -32,6 +32,6 @@ export class Toolbar<%= componentSuffix %> {
32
32
 
33
33
  constructor() {
34
34
  // default to horizontal orientation
35
- this.toolbar().orientation.set('horizontal');
35
+ this.toolbar().setOrientation('horizontal');
36
36
  }
37
37
  }
package/search/index.d.ts CHANGED
@@ -38,7 +38,7 @@ declare class NgpSearch {
38
38
  * Whether the input field is empty.
39
39
  * @internal
40
40
  */
41
- protected readonly empty: _angular_core.Signal<boolean>;
41
+ readonly empty: _angular_core.Signal<boolean>;
42
42
  /**
43
43
  * The search field state.
44
44
  */
package/select/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
+ import * as ng_primitives_state from 'ng-primitives/state';
1
2
  import * as _angular_core from '@angular/core';
2
3
  import { OnInit, OnDestroy, Provider, Injector } from '@angular/core';
3
4
  import { BooleanInput } from '@angular/cdk/coercion';
4
- import * as ng_primitives_state from 'ng-primitives/state';
5
5
  import * as ng_primitives_internal from 'ng-primitives/internal';
6
6
  import * as ng_primitives_select from 'ng-primitives/select';
7
7
  import { NgpActivatable } from 'ng-primitives/a11y';
@@ -24,7 +24,7 @@ declare class NgpNativeSelect {
24
24
  /**
25
25
  * The select state.
26
26
  */
27
- private readonly state;
27
+ protected readonly state: ng_primitives_state.CreatedState<NgpNativeSelect>;
28
28
  constructor();
29
29
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpNativeSelect, never>;
30
30
  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>;