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.
- package/a11y/index.d.ts +38 -46
- package/accordion/index.d.ts +252 -104
- package/ai/index.d.ts +1 -1
- package/autofill/index.d.ts +49 -9
- package/avatar/index.d.ts +96 -61
- package/breadcrumbs/index.d.ts +156 -16
- package/button/index.d.ts +23 -28
- package/checkbox/index.d.ts +93 -14
- package/combobox/index.d.ts +1 -1
- package/date-picker/index.d.ts +12 -11
- package/fesm2022/ng-primitives-a11y.mjs +36 -52
- package/fesm2022/ng-primitives-a11y.mjs.map +1 -1
- package/fesm2022/ng-primitives-accordion.mjs +210 -189
- package/fesm2022/ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/ng-primitives-ai.mjs +4 -4
- package/fesm2022/ng-primitives-ai.mjs.map +1 -1
- package/fesm2022/ng-primitives-autofill.mjs +53 -36
- package/fesm2022/ng-primitives-autofill.mjs.map +1 -1
- package/fesm2022/ng-primitives-avatar.mjs +97 -138
- package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
- package/fesm2022/ng-primitives-breadcrumbs.mjs +92 -35
- package/fesm2022/ng-primitives-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ng-primitives-button.mjs +14 -36
- package/fesm2022/ng-primitives-button.mjs.map +1 -1
- package/fesm2022/ng-primitives-checkbox.mjs +87 -65
- package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/ng-primitives-combobox.mjs +9 -9
- package/fesm2022/ng-primitives-combobox.mjs.map +1 -1
- package/fesm2022/ng-primitives-date-picker.mjs +5 -4
- package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
- package/fesm2022/ng-primitives-form-field.mjs +48 -16
- package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
- package/fesm2022/ng-primitives-input.mjs +32 -48
- package/fesm2022/ng-primitives-input.mjs.map +1 -1
- package/fesm2022/ng-primitives-interactions.mjs +4 -4
- package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
- package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
- package/fesm2022/ng-primitives-menu.mjs +13 -6
- package/fesm2022/ng-primitives-menu.mjs.map +1 -1
- package/fesm2022/ng-primitives-pagination.mjs +6 -6
- package/fesm2022/ng-primitives-pagination.mjs.map +1 -1
- package/fesm2022/ng-primitives-progress.mjs +2 -2
- package/fesm2022/ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/ng-primitives-radio.mjs +3 -3
- package/fesm2022/ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/ng-primitives-roving-focus.mjs +259 -236
- package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
- package/fesm2022/ng-primitives-search.mjs.map +1 -1
- package/fesm2022/ng-primitives-select.mjs +8 -8
- package/fesm2022/ng-primitives-select.mjs.map +1 -1
- package/fesm2022/ng-primitives-slider.mjs +195 -172
- package/fesm2022/ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/ng-primitives-state.mjs +172 -2
- package/fesm2022/ng-primitives-state.mjs.map +1 -1
- package/fesm2022/ng-primitives-switch.mjs +90 -88
- package/fesm2022/ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/ng-primitives-tabs.mjs +4 -1
- package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/ng-primitives-textarea.mjs +27 -35
- package/fesm2022/ng-primitives-textarea.mjs.map +1 -1
- package/fesm2022/ng-primitives-toggle-group.mjs +134 -136
- package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/ng-primitives-toggle.mjs +69 -58
- package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
- package/fesm2022/ng-primitives-toolbar.mjs +26 -35
- package/fesm2022/ng-primitives-toolbar.mjs.map +1 -1
- package/fesm2022/ng-primitives-utils.mjs +48 -35
- package/fesm2022/ng-primitives-utils.mjs.map +1 -1
- package/form-field/index.d.ts +7 -3
- package/input/index.d.ts +61 -24
- package/interactions/index.d.ts +5 -5
- package/listbox/index.d.ts +1 -1
- package/menu/index.d.ts +3 -2
- package/package.json +1 -1
- package/pagination/index.d.ts +7 -7
- package/roving-focus/index.d.ts +77 -101
- package/schematics/ng-add/schema.d.ts +0 -1
- package/schematics/ng-generate/templates/checkbox/checkbox.__fileSuffix@dasherize__.ts.template +2 -2
- package/schematics/ng-generate/templates/slider/slider.__fileSuffix@dasherize__.ts.template +6 -3
- package/schematics/ng-generate/templates/switch/switch.__fileSuffix@dasherize__.ts.template +2 -2
- package/schematics/ng-generate/templates/toggle/toggle.__fileSuffix@dasherize__.ts.template +2 -2
- package/schematics/ng-generate/templates/toggle-group/toggle-group.__fileSuffix@dasherize__.ts.template +2 -2
- package/schematics/ng-generate/templates/toolbar/toolbar.__fileSuffix@dasherize__.ts.template +1 -1
- package/search/index.d.ts +1 -1
- package/select/index.d.ts +2 -2
- package/slider/index.d.ts +195 -56
- package/state/index.d.ts +57 -3
- package/switch/index.d.ts +103 -28
- package/textarea/index.d.ts +63 -8
- package/toggle/index.d.ts +65 -24
- package/toggle-group/index.d.ts +79 -54
- package/toolbar/index.d.ts +27 -17
- package/utils/index.d.ts +1 -0
package/slider/index.d.ts
CHANGED
|
@@ -1,72 +1,229 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { OnDestroy } from '@angular/core';
|
|
2
|
+
import { Signal, WritableSignal, ElementRef, OnDestroy } from '@angular/core';
|
|
3
|
+
import { NgpOrientation } from 'ng-primitives/common';
|
|
4
|
+
import { Subject } from 'rxjs';
|
|
5
|
+
import { NumberInput, BooleanInput } from '@angular/cdk/coercion';
|
|
3
6
|
import * as ng_primitives_state from 'ng-primitives/state';
|
|
4
7
|
import * as ng_primitives_slider from 'ng-primitives/slider';
|
|
5
|
-
import { NumberInput, BooleanInput } from '@angular/cdk/coercion';
|
|
6
|
-
import { NgpOrientation } from 'ng-primitives/common';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Apply the `ngpSliderRange` directive to an element that represents the range of the slider.
|
|
10
11
|
*/
|
|
11
12
|
declare class NgpSliderRange {
|
|
12
|
-
|
|
13
|
-
* Access the slider state.
|
|
14
|
-
*/
|
|
15
|
-
protected readonly sliderState: _angular_core.Signal<ng_primitives_state.State<ng_primitives_slider.NgpSlider>>;
|
|
13
|
+
constructor();
|
|
16
14
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpSliderRange, never>;
|
|
17
15
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpSliderRange, "[ngpSliderRange]", ["ngpSliderRange"], {}, {}, never, never, true, never>;
|
|
18
16
|
}
|
|
19
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Public state surface for the Slider Range primitive.
|
|
20
|
+
*/
|
|
21
|
+
interface NgpSliderRangeState {
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Inputs for configuring the Slider Range primitive.
|
|
25
|
+
*/
|
|
26
|
+
interface NgpSliderRangeProps {
|
|
27
|
+
}
|
|
28
|
+
declare const ngpSliderRange: ({}: NgpSliderRangeProps) => NgpSliderRangeState;
|
|
29
|
+
declare const injectSliderRangeState: {
|
|
30
|
+
(): _angular_core.Signal<NgpSliderRangeState>;
|
|
31
|
+
(options: {
|
|
32
|
+
hoisted: true;
|
|
33
|
+
}): _angular_core.Signal<NgpSliderRangeState | null>;
|
|
34
|
+
(options?: {
|
|
35
|
+
hoisted?: boolean;
|
|
36
|
+
}): _angular_core.Signal<NgpSliderRangeState | null>;
|
|
37
|
+
};
|
|
38
|
+
declare const provideSliderRangeState: (opts?: {
|
|
39
|
+
inherit?: boolean;
|
|
40
|
+
}) => _angular_core.FactoryProvider;
|
|
41
|
+
|
|
20
42
|
/**
|
|
21
43
|
* Apply the `ngpSliderThumb` directive to an element that represents the thumb of the slider.
|
|
22
44
|
*/
|
|
23
45
|
declare class NgpSliderThumb {
|
|
46
|
+
constructor();
|
|
47
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpSliderThumb, never>;
|
|
48
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpSliderThumb, "[ngpSliderThumb]", ["ngpSliderThumb"], {}, {}, never, never, true, never>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Public state surface for the Slider Thumb primitive.
|
|
53
|
+
*/
|
|
54
|
+
interface NgpSliderThumbState {
|
|
24
55
|
/**
|
|
25
|
-
*
|
|
56
|
+
* Whether the thumb is currently dragging.
|
|
26
57
|
*/
|
|
27
|
-
|
|
58
|
+
readonly dragging: Signal<boolean>;
|
|
28
59
|
/**
|
|
29
|
-
*
|
|
60
|
+
* Focus the thumb element.
|
|
30
61
|
*/
|
|
31
|
-
|
|
62
|
+
focus(): void;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Inputs for configuring the Slider Thumb primitive.
|
|
66
|
+
*/
|
|
67
|
+
interface NgpSliderThumbProps {
|
|
68
|
+
}
|
|
69
|
+
declare const ngpSliderThumb: ({}: NgpSliderThumbProps) => NgpSliderThumbState;
|
|
70
|
+
declare const injectSliderThumbState: {
|
|
71
|
+
(): Signal<NgpSliderThumbState>;
|
|
72
|
+
(options: {
|
|
73
|
+
hoisted: true;
|
|
74
|
+
}): Signal<NgpSliderThumbState | null>;
|
|
75
|
+
(options?: {
|
|
76
|
+
hoisted?: boolean;
|
|
77
|
+
}): Signal<NgpSliderThumbState | null>;
|
|
78
|
+
};
|
|
79
|
+
declare const provideSliderThumbState: (opts?: {
|
|
80
|
+
inherit?: boolean;
|
|
81
|
+
}) => _angular_core.FactoryProvider;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Apply the `ngpSliderTrack` directive to an element that represents the track of the slider.
|
|
85
|
+
*/
|
|
86
|
+
declare class NgpSliderTrack {
|
|
87
|
+
constructor();
|
|
88
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpSliderTrack, never>;
|
|
89
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpSliderTrack, "[ngpSliderTrack]", ["ngpSliderTrack"], {}, {}, never, never, true, never>;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Public state surface for the Slider Track primitive.
|
|
94
|
+
*/
|
|
95
|
+
interface NgpSliderTrackState {
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Inputs for configuring the Slider Track primitive.
|
|
99
|
+
*/
|
|
100
|
+
interface NgpSliderTrackProps {
|
|
101
|
+
}
|
|
102
|
+
declare const ngpSliderTrack: ({}: NgpSliderTrackProps) => NgpSliderTrackState;
|
|
103
|
+
declare const injectSliderTrackState: {
|
|
104
|
+
(): _angular_core.Signal<NgpSliderTrackState>;
|
|
105
|
+
(options: {
|
|
106
|
+
hoisted: true;
|
|
107
|
+
}): _angular_core.Signal<NgpSliderTrackState | null>;
|
|
108
|
+
(options?: {
|
|
109
|
+
hoisted?: boolean;
|
|
110
|
+
}): _angular_core.Signal<NgpSliderTrackState | null>;
|
|
111
|
+
};
|
|
112
|
+
declare const provideSliderTrackState: (opts?: {
|
|
113
|
+
inherit?: boolean;
|
|
114
|
+
}) => _angular_core.FactoryProvider;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Public state surface for the Slider primitive.
|
|
118
|
+
*/
|
|
119
|
+
interface NgpSliderState {
|
|
32
120
|
/**
|
|
33
|
-
*
|
|
121
|
+
* The id of the slider.
|
|
34
122
|
*/
|
|
35
|
-
|
|
36
|
-
constructor();
|
|
37
|
-
protected handlePointerDown(event: PointerEvent): void;
|
|
38
|
-
protected handlePointerUp(): void;
|
|
39
|
-
protected handlePointerMove(event: PointerEvent): void;
|
|
123
|
+
readonly id: Signal<string>;
|
|
40
124
|
/**
|
|
41
|
-
*
|
|
42
|
-
* @param event
|
|
125
|
+
* The slider value.
|
|
43
126
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
127
|
+
readonly value: WritableSignal<number>;
|
|
128
|
+
/**
|
|
129
|
+
* The slider orientation.
|
|
130
|
+
*/
|
|
131
|
+
readonly orientation: WritableSignal<NgpOrientation>;
|
|
132
|
+
/**
|
|
133
|
+
* Whether the slider is disabled (includes form control state).
|
|
134
|
+
*/
|
|
135
|
+
readonly disabled: WritableSignal<boolean>;
|
|
136
|
+
/**
|
|
137
|
+
* The percentage position of the thumb.
|
|
138
|
+
*/
|
|
139
|
+
readonly percentage: Signal<number>;
|
|
140
|
+
/**
|
|
141
|
+
* The minimum value of the slider.
|
|
142
|
+
*/
|
|
143
|
+
readonly min: Signal<number>;
|
|
144
|
+
/**
|
|
145
|
+
* The maximum value of the slider.
|
|
146
|
+
*/
|
|
147
|
+
readonly max: Signal<number>;
|
|
148
|
+
/**
|
|
149
|
+
* The step value of the slider.
|
|
150
|
+
*/
|
|
151
|
+
readonly step: Signal<number>;
|
|
152
|
+
/**
|
|
153
|
+
* @internal The track element reference.
|
|
154
|
+
*/
|
|
155
|
+
readonly track: Signal<ElementRef<HTMLElement> | undefined>;
|
|
156
|
+
/**
|
|
157
|
+
* Emit when the value changes.
|
|
158
|
+
*/
|
|
159
|
+
readonly valueChange: Subject<number>;
|
|
160
|
+
/**
|
|
161
|
+
* Set the current value (clamped).
|
|
162
|
+
*/
|
|
163
|
+
setValue(value: number): void;
|
|
164
|
+
/**
|
|
165
|
+
* Register the track element.
|
|
166
|
+
*/
|
|
167
|
+
setTrack(track: ElementRef<HTMLElement> | undefined): void;
|
|
168
|
+
/**
|
|
169
|
+
* Set the disabled state.
|
|
170
|
+
*/
|
|
171
|
+
setDisabled(disabled: boolean): void;
|
|
172
|
+
/**
|
|
173
|
+
* Set the orientation.
|
|
174
|
+
*/
|
|
175
|
+
setOrientation(orientation: NgpOrientation): void;
|
|
47
176
|
}
|
|
48
|
-
|
|
49
177
|
/**
|
|
50
|
-
*
|
|
178
|
+
* Inputs for configuring the Slider primitive.
|
|
51
179
|
*/
|
|
52
|
-
|
|
180
|
+
interface NgpSliderProps {
|
|
53
181
|
/**
|
|
54
|
-
*
|
|
182
|
+
* The id of the slider.
|
|
55
183
|
*/
|
|
56
|
-
|
|
184
|
+
readonly id?: Signal<string>;
|
|
57
185
|
/**
|
|
58
|
-
* The
|
|
186
|
+
* The slider value.
|
|
59
187
|
*/
|
|
60
|
-
readonly
|
|
61
|
-
constructor();
|
|
188
|
+
readonly value?: Signal<number>;
|
|
62
189
|
/**
|
|
63
|
-
*
|
|
64
|
-
* @param event The click event.
|
|
190
|
+
* The minimum value.
|
|
65
191
|
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
192
|
+
readonly min?: Signal<number>;
|
|
193
|
+
/**
|
|
194
|
+
* The maximum value.
|
|
195
|
+
*/
|
|
196
|
+
readonly max?: Signal<number>;
|
|
197
|
+
/**
|
|
198
|
+
* The step value.
|
|
199
|
+
*/
|
|
200
|
+
readonly step?: Signal<number>;
|
|
201
|
+
/**
|
|
202
|
+
* The slider orientation.
|
|
203
|
+
*/
|
|
204
|
+
readonly orientation?: Signal<NgpOrientation>;
|
|
205
|
+
/**
|
|
206
|
+
* Whether the slider is disabled.
|
|
207
|
+
*/
|
|
208
|
+
readonly disabled?: Signal<boolean>;
|
|
209
|
+
/**
|
|
210
|
+
* Callback fired when the value changes.
|
|
211
|
+
*/
|
|
212
|
+
readonly onValueChange?: (value: number) => void;
|
|
69
213
|
}
|
|
214
|
+
declare const ngpSlider: ({ id, value: _value, min, max, step, orientation: _orientation, disabled: _disabled, onValueChange, }: NgpSliderProps) => NgpSliderState;
|
|
215
|
+
declare const injectSliderState: {
|
|
216
|
+
(): Signal<NgpSliderState>;
|
|
217
|
+
(options: {
|
|
218
|
+
hoisted: true;
|
|
219
|
+
}): Signal<NgpSliderState | null>;
|
|
220
|
+
(options?: {
|
|
221
|
+
hoisted?: boolean;
|
|
222
|
+
}): Signal<NgpSliderState | null>;
|
|
223
|
+
};
|
|
224
|
+
declare const provideSliderState: (opts?: {
|
|
225
|
+
inherit?: boolean;
|
|
226
|
+
}) => _angular_core.FactoryProvider;
|
|
70
227
|
|
|
71
228
|
/**
|
|
72
229
|
* Apply the `ngpSlider` directive to an element that represents the slider and contains the track, range, and thumb.
|
|
@@ -104,34 +261,15 @@ declare class NgpSlider {
|
|
|
104
261
|
* The disabled state of the slider.
|
|
105
262
|
*/
|
|
106
263
|
readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
107
|
-
/**
|
|
108
|
-
* Access the slider track.
|
|
109
|
-
* @internal
|
|
110
|
-
*/
|
|
111
|
-
readonly track: _angular_core.WritableSignal<NgpSliderTrack | undefined>;
|
|
112
|
-
/**
|
|
113
|
-
* The value as a percentage based on the min and max values.
|
|
114
|
-
*/
|
|
115
|
-
protected readonly percentage: _angular_core.Signal<number>;
|
|
116
264
|
/**
|
|
117
265
|
* The state of the slider. We use this for the slider state rather than relying on the inputs.
|
|
118
266
|
* @internal
|
|
119
267
|
*/
|
|
120
|
-
protected readonly state:
|
|
121
|
-
constructor();
|
|
268
|
+
protected readonly state: NgpSliderState;
|
|
122
269
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpSlider, never>;
|
|
123
270
|
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>;
|
|
124
271
|
}
|
|
125
272
|
|
|
126
|
-
/**
|
|
127
|
-
* Provides the Slider state.
|
|
128
|
-
*/
|
|
129
|
-
declare const provideSliderState: (options?: ng_primitives_state.CreateStateProviderOptions) => _angular_core.FactoryProvider;
|
|
130
|
-
/**
|
|
131
|
-
* Injects the Slider state.
|
|
132
|
-
*/
|
|
133
|
-
declare const injectSliderState: <U = NgpSlider>(injectOptions?: _angular_core.InjectOptions) => _angular_core.Signal<ng_primitives_state.State<U>>;
|
|
134
|
-
|
|
135
273
|
/**
|
|
136
274
|
* Apply the `ngpRangeSliderRange` directive to an element that represents the range between the low and high values.
|
|
137
275
|
*/
|
|
@@ -329,4 +467,5 @@ declare const provideRangeSliderState: (options?: ng_primitives_state.CreateStat
|
|
|
329
467
|
*/
|
|
330
468
|
declare const injectRangeSliderState: <U = NgpRangeSlider>(injectOptions?: _angular_core.InjectOptions) => _angular_core.Signal<ng_primitives_state.State<U>>;
|
|
331
469
|
|
|
332
|
-
export { NgpRangeSlider, NgpRangeSliderRange, NgpRangeSliderThumb, NgpRangeSliderTrack, NgpSlider, NgpSliderRange, NgpSliderThumb, NgpSliderTrack, injectRangeSliderState, injectSliderState, provideRangeSliderState, provideSliderState };
|
|
470
|
+
export { NgpRangeSlider, NgpRangeSliderRange, NgpRangeSliderThumb, NgpRangeSliderTrack, NgpSlider, NgpSliderRange, NgpSliderThumb, NgpSliderTrack, injectRangeSliderState, injectSliderRangeState, injectSliderState, injectSliderThumbState, injectSliderTrackState, ngpSlider, ngpSliderRange, ngpSliderThumb, ngpSliderTrack, provideRangeSliderState, provideSliderRangeState, provideSliderState, provideSliderThumbState, provideSliderTrackState };
|
|
471
|
+
export type { NgpSliderProps, NgpSliderRangeProps, NgpSliderRangeState, NgpSliderState, NgpSliderThumbProps, NgpSliderThumbState, NgpSliderTrackProps, NgpSliderTrackState };
|
package/state/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InputSignalWithTransform, WritableSignal, InputSignal, Signal, InjectionToken, ProviderToken, FactoryProvider, InjectOptions } from '@angular/core';
|
|
1
|
+
import { InputSignalWithTransform, WritableSignal, InputSignal, Signal, InjectionToken, ProviderToken, FactoryProvider, InjectOptions, Injector, ElementRef } from '@angular/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* This converts the state object to a writable state object.
|
|
@@ -52,6 +52,60 @@ declare function createStateInjector<T>(token: ProviderToken<State<T>>, options?
|
|
|
52
52
|
* @param token The token for the state
|
|
53
53
|
*/
|
|
54
54
|
declare function createState(token: ProviderToken<WritableSignal<State<unknown>>>): <U>(state: U) => CreatedState<U>;
|
|
55
|
+
interface CreatePrimitiveOptions {
|
|
56
|
+
injector?: Injector;
|
|
57
|
+
elementRef?: ElementRef<HTMLElement>;
|
|
58
|
+
}
|
|
59
|
+
type PrimitiveState<TFactory extends (...args: any[]) => unknown> = TFactory extends (props: unknown) => infer R ? R : TFactory extends (...args: any[]) => infer R ? R : never;
|
|
60
|
+
type BasePrimitiveInjectionFn<TState> = {
|
|
61
|
+
(): Signal<TState>;
|
|
62
|
+
(options: {
|
|
63
|
+
hoisted: true;
|
|
64
|
+
}): Signal<TState | null>;
|
|
65
|
+
(options?: {
|
|
66
|
+
hoisted?: boolean;
|
|
67
|
+
}): Signal<TState | null>;
|
|
68
|
+
};
|
|
69
|
+
type PrimitiveInjectionFn<TFactory extends (...args: any[]) => unknown> = TFactory extends (props: unknown) => infer R ? {
|
|
70
|
+
(): Signal<R>;
|
|
71
|
+
(options: {
|
|
72
|
+
hoisted: true;
|
|
73
|
+
}): Signal<R | null>;
|
|
74
|
+
(options?: {
|
|
75
|
+
hoisted?: boolean;
|
|
76
|
+
}): Signal<R | null>;
|
|
77
|
+
} : BasePrimitiveInjectionFn<PrimitiveState<TFactory>>;
|
|
78
|
+
declare function createPrimitive<TFactory extends (...args: any[]) => unknown>(name: string, fn: TFactory, options?: CreatePrimitiveOptions): [
|
|
79
|
+
InjectionToken<WritableSignal<PrimitiveState<TFactory>>>,
|
|
80
|
+
TFactory,
|
|
81
|
+
PrimitiveInjectionFn<TFactory>,
|
|
82
|
+
(opts?: {
|
|
83
|
+
inherit?: boolean;
|
|
84
|
+
}) => FactoryProvider
|
|
85
|
+
];
|
|
86
|
+
declare function controlled<T>(value: Signal<T>): WritableSignal<T>;
|
|
87
|
+
declare function attrBinding(element: ElementRef<HTMLElement>, attr: string, value: (() => string | number | boolean | null | undefined) | string | number | boolean | null | undefined): void;
|
|
88
|
+
declare function styleBinding(element: ElementRef<HTMLElement>, style: string, value: (() => string | number | null) | string | number | null): void;
|
|
89
|
+
declare function dataBinding(element: ElementRef<HTMLElement>, attr: string, value: (() => string | boolean | null) | string | boolean | null): void;
|
|
90
|
+
declare function listener<K extends keyof HTMLElementEventMap>(element: HTMLElement | ElementRef<HTMLElement>, event: K, handler: (event: HTMLElementEventMap[K]) => void, options?: {
|
|
91
|
+
injector?: Injector;
|
|
92
|
+
}): void;
|
|
93
|
+
declare function listener(element: HTMLElement | ElementRef<HTMLElement>, event: string, handler: (event: Event) => void, options?: {
|
|
94
|
+
injector?: Injector;
|
|
95
|
+
}): void;
|
|
96
|
+
declare function onDestroy(callback: () => void): void;
|
|
97
|
+
/**
|
|
98
|
+
* Previously, with our state approach, we allowed signals to be written directly using their setters.
|
|
99
|
+
* However, with our new approach, we want people to use the appropriate set method instead. This function takes in a writable
|
|
100
|
+
* signal and returns a proxy that warns the user when set is called directly.
|
|
101
|
+
*/
|
|
102
|
+
declare function deprecatedSetter<T>(signal: WritableSignal<T>, methodName: string): WritableSignal<T>;
|
|
103
|
+
/**
|
|
104
|
+
* A utility function to inject an inherited state from a parent injector. This is useful for cases
|
|
105
|
+
* where a primitive needs to inherit state from a parent primitive, such as in roving focus groups.
|
|
106
|
+
* We could use inject with a forwardRef, but forwardRef returns an any - no thanks...
|
|
107
|
+
*/
|
|
108
|
+
declare function injectInheritedState<T>(token: () => InjectionToken<T>, injectOptions?: InjectOptions): T | null;
|
|
55
109
|
|
|
56
|
-
export { createState, createStateInjector, createStateProvider, createStateToken };
|
|
57
|
-
export type { CreateStateProviderOptions, CreatedState, InjectedState, State };
|
|
110
|
+
export { attrBinding, controlled, createPrimitive, createState, createStateInjector, createStateProvider, createStateToken, dataBinding, deprecatedSetter, injectInheritedState, listener, onDestroy, styleBinding };
|
|
111
|
+
export type { CreatePrimitiveOptions, CreateStateProviderOptions, CreatedState, InjectedState, State };
|
package/switch/index.d.ts
CHANGED
|
@@ -1,33 +1,121 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { Signal, WritableSignal } from '@angular/core';
|
|
3
|
+
import { Subject } from 'rxjs/internal/Subject';
|
|
4
4
|
import { BooleanInput } from '@angular/cdk/coercion';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Apply the `ngpSwitchThumb` directive to an element within a switch to represent the thumb.
|
|
8
8
|
*/
|
|
9
9
|
declare class NgpSwitchThumb {
|
|
10
|
-
/**
|
|
11
|
-
* Access the switch state.
|
|
12
|
-
*/
|
|
13
|
-
protected readonly state: _angular_core.Signal<ng_primitives_state.State<ng_primitives_switch.NgpSwitch>>;
|
|
14
10
|
constructor();
|
|
15
11
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpSwitchThumb, never>;
|
|
16
12
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpSwitchThumb, "[ngpSwitchThumb]", never, {}, {}, never, never, true, never>;
|
|
17
13
|
}
|
|
18
14
|
|
|
19
15
|
/**
|
|
20
|
-
*
|
|
16
|
+
* Public state surface for the Switch Thumb primitive.
|
|
21
17
|
*/
|
|
22
|
-
|
|
18
|
+
interface NgpSwitchThumbState {
|
|
19
|
+
/**
|
|
20
|
+
* Whether the switch is checked.
|
|
21
|
+
*/
|
|
22
|
+
readonly checked: Signal<boolean>;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the switch is disabled.
|
|
25
|
+
*/
|
|
26
|
+
readonly disabled: Signal<boolean>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Inputs for configuring the Switch Thumb primitive.
|
|
30
|
+
*/
|
|
31
|
+
interface NgpSwitchThumbProps {
|
|
32
|
+
}
|
|
33
|
+
declare const ngpSwitchThumb: ({}: NgpSwitchThumbProps) => NgpSwitchThumbState;
|
|
34
|
+
declare const injectSwitchThumbState: {
|
|
35
|
+
(): Signal<NgpSwitchThumbState>;
|
|
36
|
+
(options: {
|
|
37
|
+
hoisted: true;
|
|
38
|
+
}): Signal<NgpSwitchThumbState | null>;
|
|
39
|
+
(options?: {
|
|
40
|
+
hoisted?: boolean;
|
|
41
|
+
}): Signal<NgpSwitchThumbState | null>;
|
|
42
|
+
};
|
|
43
|
+
declare const provideSwitchThumbState: (opts?: {
|
|
44
|
+
inherit?: boolean;
|
|
45
|
+
}) => _angular_core.FactoryProvider;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Public state surface for the Switch primitive.
|
|
49
|
+
*/
|
|
50
|
+
interface NgpSwitchState {
|
|
51
|
+
/**
|
|
52
|
+
* The id of the switch.
|
|
53
|
+
*/
|
|
54
|
+
readonly id: Signal<string>;
|
|
23
55
|
/**
|
|
24
|
-
*
|
|
56
|
+
* Whether the switch is checked.
|
|
25
57
|
*/
|
|
26
|
-
|
|
58
|
+
readonly checked: WritableSignal<boolean>;
|
|
27
59
|
/**
|
|
28
|
-
*
|
|
60
|
+
* Whether the switch is disabled (includes form control state).
|
|
61
|
+
*/
|
|
62
|
+
readonly disabled: WritableSignal<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* Emits when the checked state changes.
|
|
29
65
|
*/
|
|
30
|
-
|
|
66
|
+
readonly checkedChange: Subject<boolean>;
|
|
67
|
+
/**
|
|
68
|
+
* Toggle the switch state.
|
|
69
|
+
*/
|
|
70
|
+
toggle(event?: Event): void;
|
|
71
|
+
/**
|
|
72
|
+
* Update the checked value.
|
|
73
|
+
*/
|
|
74
|
+
setChecked(value: boolean): void;
|
|
75
|
+
/**
|
|
76
|
+
* Update the disabled value.
|
|
77
|
+
*/
|
|
78
|
+
setDisabled(value: boolean): void;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Inputs for configuring the Switch primitive.
|
|
82
|
+
*/
|
|
83
|
+
interface NgpSwitchProps {
|
|
84
|
+
/**
|
|
85
|
+
* The id of the switch.
|
|
86
|
+
*/
|
|
87
|
+
readonly id?: Signal<string>;
|
|
88
|
+
/**
|
|
89
|
+
* Whether the switch is checked.
|
|
90
|
+
*/
|
|
91
|
+
readonly checked?: Signal<boolean>;
|
|
92
|
+
/**
|
|
93
|
+
* Whether the switch is disabled.
|
|
94
|
+
*/
|
|
95
|
+
readonly disabled?: Signal<boolean>;
|
|
96
|
+
/**
|
|
97
|
+
* Callback fired when the checked state changes.
|
|
98
|
+
*/
|
|
99
|
+
readonly onCheckedChange?: (checked: boolean) => void;
|
|
100
|
+
}
|
|
101
|
+
declare const ngpSwitch: ({ id, checked: _checked, disabled: _disabled, onCheckedChange, }: NgpSwitchProps) => NgpSwitchState;
|
|
102
|
+
declare const injectSwitchState: {
|
|
103
|
+
(): Signal<NgpSwitchState>;
|
|
104
|
+
(options: {
|
|
105
|
+
hoisted: true;
|
|
106
|
+
}): Signal<NgpSwitchState | null>;
|
|
107
|
+
(options?: {
|
|
108
|
+
hoisted?: boolean;
|
|
109
|
+
}): Signal<NgpSwitchState | null>;
|
|
110
|
+
};
|
|
111
|
+
declare const provideSwitchState: (opts?: {
|
|
112
|
+
inherit?: boolean;
|
|
113
|
+
}) => _angular_core.FactoryProvider;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Apply the `ngpSwitch` directive to an element to manage the checked state.
|
|
117
|
+
*/
|
|
118
|
+
declare class NgpSwitch {
|
|
31
119
|
/**
|
|
32
120
|
* The id of the switch. If not provided, a unique id will be generated.
|
|
33
121
|
*/
|
|
@@ -50,27 +138,14 @@ declare class NgpSwitch {
|
|
|
50
138
|
* The switch state.
|
|
51
139
|
* @internal
|
|
52
140
|
*/
|
|
53
|
-
readonly state:
|
|
54
|
-
constructor();
|
|
141
|
+
readonly state: NgpSwitchState;
|
|
55
142
|
/**
|
|
56
143
|
* Toggle the checked state.
|
|
57
144
|
*/
|
|
58
145
|
toggle(): void;
|
|
59
|
-
/**
|
|
60
|
-
* Handle the keydown event.
|
|
61
|
-
*/
|
|
62
|
-
protected onKeyDown(event: KeyboardEvent): void;
|
|
63
146
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpSwitch, never>;
|
|
64
147
|
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>;
|
|
65
148
|
}
|
|
66
149
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
*/
|
|
70
|
-
declare const provideSwitchState: (options?: ng_primitives_state.CreateStateProviderOptions) => _angular_core.FactoryProvider;
|
|
71
|
-
/**
|
|
72
|
-
* Injects the Switch state.
|
|
73
|
-
*/
|
|
74
|
-
declare const injectSwitchState: <U = NgpSwitch>(injectOptions?: _angular_core.InjectOptions) => _angular_core.Signal<ng_primitives_state.State<U>>;
|
|
75
|
-
|
|
76
|
-
export { NgpSwitch, NgpSwitchThumb, injectSwitchState, provideSwitchState };
|
|
150
|
+
export { NgpSwitch, NgpSwitchThumb, injectSwitchState, injectSwitchThumbState, ngpSwitch, ngpSwitchThumb, provideSwitchState, provideSwitchThumbState };
|
|
151
|
+
export type { NgpSwitchProps, NgpSwitchState, NgpSwitchThumbProps, NgpSwitchThumbState };
|
package/textarea/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as ng_primitives_state from 'ng-primitives/state';
|
|
2
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { Signal, WritableSignal } from '@angular/core';
|
|
3
3
|
import { BooleanInput } from '@angular/cdk/coercion';
|
|
4
4
|
|
|
5
5
|
declare class NgpTextarea {
|
|
@@ -14,19 +14,74 @@ declare class NgpTextarea {
|
|
|
14
14
|
/**
|
|
15
15
|
* The state of the textarea.
|
|
16
16
|
*/
|
|
17
|
-
protected readonly state:
|
|
18
|
-
|
|
17
|
+
protected readonly state: {
|
|
18
|
+
id: _angular_core.Signal<string>;
|
|
19
|
+
disabled: _angular_core.WritableSignal<boolean>;
|
|
20
|
+
setDisabled: (value: boolean) => void;
|
|
21
|
+
};
|
|
19
22
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpTextarea, never>;
|
|
20
23
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpTextarea, "[ngpTextarea]", ["ngpTextarea"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
|
-
*
|
|
27
|
+
* Public state surface for the Textarea primitive.
|
|
25
28
|
*/
|
|
26
|
-
|
|
29
|
+
interface NgpTextareaState {
|
|
30
|
+
/**
|
|
31
|
+
* The id of the textarea.
|
|
32
|
+
*/
|
|
33
|
+
readonly id: Signal<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the textarea is disabled.
|
|
36
|
+
*/
|
|
37
|
+
readonly disabled: WritableSignal<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Set the disabled state of the textarea.
|
|
40
|
+
*/
|
|
41
|
+
setDisabled(disabled: boolean): void;
|
|
42
|
+
}
|
|
27
43
|
/**
|
|
28
|
-
*
|
|
44
|
+
* Inputs for configuring the Textarea primitive.
|
|
29
45
|
*/
|
|
30
|
-
|
|
46
|
+
interface NgpTextareaProps {
|
|
47
|
+
/**
|
|
48
|
+
* The id of the textarea.
|
|
49
|
+
*/
|
|
50
|
+
readonly id?: Signal<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the textarea is disabled.
|
|
53
|
+
*/
|
|
54
|
+
readonly disabled?: Signal<boolean>;
|
|
55
|
+
}
|
|
56
|
+
declare const ngpTextarea: ({ id, disabled: _disabled, }: NgpTextareaProps) => {
|
|
57
|
+
id: Signal<string>;
|
|
58
|
+
disabled: WritableSignal<boolean>;
|
|
59
|
+
setDisabled: (value: boolean) => void;
|
|
60
|
+
};
|
|
61
|
+
declare const injectTextareaState: {
|
|
62
|
+
(): Signal<{
|
|
63
|
+
id: Signal<string>;
|
|
64
|
+
disabled: WritableSignal<boolean>;
|
|
65
|
+
setDisabled: (value: boolean) => void;
|
|
66
|
+
}>;
|
|
67
|
+
(options: {
|
|
68
|
+
hoisted: true;
|
|
69
|
+
}): Signal<{
|
|
70
|
+
id: Signal<string>;
|
|
71
|
+
disabled: WritableSignal<boolean>;
|
|
72
|
+
setDisabled: (value: boolean) => void;
|
|
73
|
+
} | null>;
|
|
74
|
+
(options?: {
|
|
75
|
+
hoisted?: boolean;
|
|
76
|
+
}): Signal<{
|
|
77
|
+
id: Signal<string>;
|
|
78
|
+
disabled: WritableSignal<boolean>;
|
|
79
|
+
setDisabled: (value: boolean) => void;
|
|
80
|
+
} | null>;
|
|
81
|
+
};
|
|
82
|
+
declare const provideTextareaState: (opts?: {
|
|
83
|
+
inherit?: boolean;
|
|
84
|
+
}) => _angular_core.FactoryProvider;
|
|
31
85
|
|
|
32
|
-
export { NgpTextarea, injectTextareaState, provideTextareaState };
|
|
86
|
+
export { NgpTextarea, injectTextareaState, ngpTextarea, provideTextareaState };
|
|
87
|
+
export type { NgpTextareaProps, NgpTextareaState };
|