ng-primitives 0.91.2 → 0.93.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 +3 -1
- package/accordion/index.d.ts +8 -1
- package/autofill/index.d.ts +4 -0
- package/avatar/index.d.ts +11 -2
- package/breadcrumbs/index.d.ts +21 -7
- package/button/index.d.ts +3 -1
- package/checkbox/index.d.ts +3 -1
- package/fesm2022/ng-primitives-checkbox.mjs +7 -8
- package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/ng-primitives-file-upload.mjs +209 -202
- package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
- package/fesm2022/ng-primitives-focus-trap.mjs +107 -138
- package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -1
- package/fesm2022/ng-primitives-form-field.mjs +323 -399
- package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
- package/fesm2022/ng-primitives-interactions.mjs +57 -58
- package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
- package/fesm2022/ng-primitives-listbox.mjs +2 -2
- package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
- package/fesm2022/ng-primitives-menu.mjs.map +1 -1
- package/fesm2022/ng-primitives-portal.mjs +5 -1
- package/fesm2022/ng-primitives-portal.mjs.map +1 -1
- package/fesm2022/ng-primitives-slider.mjs +4 -5
- package/fesm2022/ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/ng-primitives-state.mjs +36 -8
- package/fesm2022/ng-primitives-state.mjs.map +1 -1
- package/fesm2022/ng-primitives-switch.mjs +4 -5
- package/fesm2022/ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/ng-primitives-tabs.mjs +194 -192
- package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/ng-primitives-toggle-group.mjs +4 -5
- package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/ng-primitives-toggle.mjs +4 -5
- package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
- package/fesm2022/ng-primitives-tooltip.mjs +4 -4
- package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
- package/fesm2022/ng-primitives-utils.mjs +23 -14
- package/fesm2022/ng-primitives-utils.mjs.map +1 -1
- package/file-upload/index.d.ts +100 -52
- package/focus-trap/index.d.ts +33 -75
- package/form-field/index.d.ts +320 -123
- package/input/index.d.ts +6 -0
- package/interactions/index.d.ts +16 -16
- package/package.json +1 -1
- package/roving-focus/index.d.ts +6 -2
- package/schematics/ng-generate/templates/tabs/tabs.__fileSuffix@dasherize__.ts.template +2 -2
- package/slider/index.d.ts +14 -6
- package/state/index.d.ts +23 -8
- package/switch/index.d.ts +8 -4
- package/tabs/index.d.ts +333 -84
- package/textarea/index.d.ts +6 -0
- package/toggle/index.d.ts +5 -3
- package/toggle-group/index.d.ts +6 -2
- package/toolbar/index.d.ts +5 -0
- package/utils/index.d.ts +1 -1
package/form-field/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as ng_primitives_state from 'ng-primitives/state';
|
|
2
|
-
import * as ng_primitives_form_field from 'ng-primitives/form-field';
|
|
3
1
|
import * as _angular_core from '@angular/core';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
2
|
+
import { Signal } from '@angular/core';
|
|
3
|
+
import * as ng_primitives_utils from 'ng-primitives/utils';
|
|
6
4
|
import { NgpControlStatus } from 'ng-primitives/utils';
|
|
5
|
+
import { BooleanInput } from '@angular/cdk/coercion';
|
|
6
|
+
import { NgControl } from '@angular/forms';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The `NgpDescription` directive is used to mark a description element within a form field. There may be multiple descriptions associated with a form control.
|
|
@@ -14,22 +14,61 @@ declare class NgpDescription {
|
|
|
14
14
|
*/
|
|
15
15
|
readonly id: _angular_core.InputSignal<string>;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* The description state.
|
|
18
18
|
*/
|
|
19
|
-
protected readonly formField: _angular_core.Signal<ng_primitives_state.State<ng_primitives_form_field.NgpFormField>>;
|
|
20
19
|
constructor();
|
|
21
20
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpDescription, never>;
|
|
22
21
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpDescription, "[ngpDescription]", ["ngpDescription"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
|
-
* The
|
|
25
|
+
* The state interface for the Description primitive.
|
|
27
26
|
*/
|
|
28
|
-
|
|
27
|
+
interface NgpDescriptionState {
|
|
29
28
|
/**
|
|
30
|
-
*
|
|
29
|
+
* The id of the description.
|
|
31
30
|
*/
|
|
32
|
-
|
|
31
|
+
readonly id: Signal<string>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The props interface for the Description primitive.
|
|
35
|
+
*/
|
|
36
|
+
interface NgpDescriptionProps {
|
|
37
|
+
/**
|
|
38
|
+
* The id of the description.
|
|
39
|
+
*/
|
|
40
|
+
readonly id: Signal<string>;
|
|
41
|
+
}
|
|
42
|
+
declare const ngpDescription: ({ id }: NgpDescriptionProps) => {
|
|
43
|
+
id: Signal<string>;
|
|
44
|
+
};
|
|
45
|
+
declare const injectDescriptionState: {
|
|
46
|
+
(): Signal<{
|
|
47
|
+
id: Signal<string>;
|
|
48
|
+
}>;
|
|
49
|
+
(options: {
|
|
50
|
+
hoisted: true;
|
|
51
|
+
optional?: boolean;
|
|
52
|
+
}): Signal<{
|
|
53
|
+
id: Signal<string>;
|
|
54
|
+
} | null>;
|
|
55
|
+
(options?: {
|
|
56
|
+
hoisted?: boolean;
|
|
57
|
+
optional?: boolean;
|
|
58
|
+
}): Signal<{
|
|
59
|
+
id: Signal<string>;
|
|
60
|
+
}> | Signal<{
|
|
61
|
+
id: Signal<string>;
|
|
62
|
+
} | null>;
|
|
63
|
+
};
|
|
64
|
+
declare const provideDescriptionState: (opts?: {
|
|
65
|
+
inherit?: boolean;
|
|
66
|
+
}) => _angular_core.FactoryProvider;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The `NgpError` directive is used to mark an error message element within a form field. There may be multiple error messages associated with a form control.
|
|
70
|
+
*/
|
|
71
|
+
declare class NgpError {
|
|
33
72
|
/**
|
|
34
73
|
* The id of the error message. If not provided, a unique id will be generated.
|
|
35
74
|
*/
|
|
@@ -38,20 +77,79 @@ declare class NgpError implements OnChanges, OnDestroy {
|
|
|
38
77
|
* The validator associated with the error message.
|
|
39
78
|
*/
|
|
40
79
|
readonly validator: _angular_core.InputSignal<string | null>;
|
|
80
|
+
/**
|
|
81
|
+
* The error state.
|
|
82
|
+
*/
|
|
83
|
+
constructor();
|
|
84
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpError, never>;
|
|
85
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpError, "[ngpError]", ["ngpError"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "validator": { "alias": "ngpErrorValidator"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The state interface for the Error primitive.
|
|
90
|
+
*/
|
|
91
|
+
interface NgpErrorState {
|
|
92
|
+
/**
|
|
93
|
+
* The id of the error message.
|
|
94
|
+
*/
|
|
95
|
+
readonly id: Signal<string>;
|
|
41
96
|
/**
|
|
42
97
|
* Determine if there is an error message.
|
|
43
98
|
*/
|
|
44
|
-
|
|
99
|
+
readonly hasError: Signal<boolean>;
|
|
45
100
|
/**
|
|
46
101
|
* Determine whether the validator associated with this error is failing.
|
|
47
102
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
103
|
+
readonly state: Signal<'fail' | 'pass'>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The props interface for the Error primitive.
|
|
107
|
+
*/
|
|
108
|
+
interface NgpErrorProps {
|
|
109
|
+
/**
|
|
110
|
+
* The id of the error message.
|
|
111
|
+
*/
|
|
112
|
+
readonly id: Signal<string>;
|
|
113
|
+
/**
|
|
114
|
+
* The validator associated with the error message.
|
|
115
|
+
*/
|
|
116
|
+
readonly validator?: Signal<string | null>;
|
|
54
117
|
}
|
|
118
|
+
declare const ngpError: ({ id, validator }: NgpErrorProps) => {
|
|
119
|
+
id: Signal<string>;
|
|
120
|
+
hasError: Signal<boolean>;
|
|
121
|
+
state: Signal<"fail" | "pass">;
|
|
122
|
+
};
|
|
123
|
+
declare const injectErrorState: {
|
|
124
|
+
(): Signal<{
|
|
125
|
+
id: Signal<string>;
|
|
126
|
+
hasError: Signal<boolean>;
|
|
127
|
+
state: Signal<"fail" | "pass">;
|
|
128
|
+
}>;
|
|
129
|
+
(options: {
|
|
130
|
+
hoisted: true;
|
|
131
|
+
optional?: boolean;
|
|
132
|
+
}): Signal<{
|
|
133
|
+
id: Signal<string>;
|
|
134
|
+
hasError: Signal<boolean>;
|
|
135
|
+
state: Signal<"fail" | "pass">;
|
|
136
|
+
} | null>;
|
|
137
|
+
(options?: {
|
|
138
|
+
hoisted?: boolean;
|
|
139
|
+
optional?: boolean;
|
|
140
|
+
}): Signal<{
|
|
141
|
+
id: Signal<string>;
|
|
142
|
+
hasError: Signal<boolean>;
|
|
143
|
+
state: Signal<"fail" | "pass">;
|
|
144
|
+
}> | Signal<{
|
|
145
|
+
id: Signal<string>;
|
|
146
|
+
hasError: Signal<boolean>;
|
|
147
|
+
state: Signal<"fail" | "pass">;
|
|
148
|
+
} | null>;
|
|
149
|
+
};
|
|
150
|
+
declare const provideErrorState: (opts?: {
|
|
151
|
+
inherit?: boolean;
|
|
152
|
+
}) => _angular_core.FactoryProvider;
|
|
55
153
|
|
|
56
154
|
/**
|
|
57
155
|
* Typically this primitive would be not be used directly, but instead a more specific form control primitive would be used (e.g. `ngpInput`). All of our form control primitives use `ngpFormControl` internally so they will have the same accessibility features as described below.
|
|
@@ -70,168 +168,227 @@ declare class NgpFormControl {
|
|
|
70
168
|
/**
|
|
71
169
|
* The status of the form control.
|
|
72
170
|
*/
|
|
73
|
-
readonly status: Signal<NgpControlStatus>;
|
|
74
|
-
/**
|
|
75
|
-
* The element reference.
|
|
76
|
-
*/
|
|
77
|
-
private readonly elementRef;
|
|
78
|
-
/**
|
|
79
|
-
* Whether the element supports the disabled attribute.
|
|
80
|
-
*/
|
|
81
|
-
protected readonly supportsDisabledAttribute: boolean;
|
|
82
|
-
/**
|
|
83
|
-
* The state of the form control.
|
|
84
|
-
*/
|
|
85
|
-
private readonly state;
|
|
86
|
-
constructor();
|
|
171
|
+
readonly status: _angular_core.Signal<ng_primitives_utils.NgpControlStatus>;
|
|
87
172
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpFormControl, never>;
|
|
88
173
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpFormControl, "[ngpFormControl]", ["ngpFormControl"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpFormControlDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
89
174
|
}
|
|
175
|
+
|
|
90
176
|
interface NgpFormControlProps {
|
|
91
|
-
|
|
92
|
-
|
|
177
|
+
/**
|
|
178
|
+
* The id of the form control.
|
|
179
|
+
*/
|
|
180
|
+
readonly id: Signal<string>;
|
|
181
|
+
/**
|
|
182
|
+
* Whether the form control is disabled by a parent.
|
|
183
|
+
*/
|
|
184
|
+
readonly disabled?: Signal<boolean>;
|
|
93
185
|
}
|
|
94
186
|
declare function ngpFormControl({ id, disabled, }: NgpFormControlProps): Signal<NgpControlStatus>;
|
|
95
187
|
|
|
96
|
-
/**
|
|
97
|
-
* Provides the FormControl state.
|
|
98
|
-
*/
|
|
99
|
-
declare const provideFormControlState: (options?: ng_primitives_state.CreateStateProviderOptions) => _angular_core.FactoryProvider;
|
|
100
|
-
/**
|
|
101
|
-
* Injects the FormControl state.
|
|
102
|
-
*/
|
|
103
|
-
declare const injectFormControlState: <U = NgpFormControl>(injectOptions?: _angular_core.InjectOptions) => _angular_core.Signal<ng_primitives_state.State<U>>;
|
|
104
|
-
|
|
105
188
|
/**
|
|
106
189
|
* The `NgpFormField` directive is a container for form field elements. Any labels, form controls, or descriptions should be placed within this directive.
|
|
107
190
|
*/
|
|
108
|
-
declare class NgpFormField
|
|
191
|
+
declare class NgpFormField {
|
|
109
192
|
/**
|
|
110
|
-
*
|
|
193
|
+
* Find any NgControl within the form field.
|
|
111
194
|
* @internal
|
|
112
195
|
*/
|
|
113
|
-
readonly
|
|
196
|
+
private readonly ngControl;
|
|
114
197
|
/**
|
|
115
|
-
*
|
|
116
|
-
* @internal
|
|
198
|
+
* The form field state.
|
|
117
199
|
*/
|
|
118
|
-
|
|
200
|
+
constructor();
|
|
201
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpFormField, never>;
|
|
202
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpFormField, "[ngpFormField]", ["ngpFormField"], {}, {}, ["ngControl"], never, true, never>;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* The state interface for the FormField primitive.
|
|
207
|
+
*/
|
|
208
|
+
interface NgpFormFieldState {
|
|
119
209
|
/**
|
|
120
|
-
*
|
|
121
|
-
* @internal
|
|
210
|
+
* The form labels.
|
|
122
211
|
*/
|
|
123
|
-
readonly
|
|
212
|
+
readonly labels: Signal<string[]>;
|
|
124
213
|
/**
|
|
125
|
-
*
|
|
126
|
-
* @internal
|
|
214
|
+
* The form descriptions.
|
|
127
215
|
*/
|
|
128
|
-
|
|
216
|
+
readonly descriptions: Signal<string[]>;
|
|
129
217
|
/**
|
|
130
|
-
*
|
|
131
|
-
* @internal
|
|
218
|
+
* The id of the associated form control.
|
|
132
219
|
*/
|
|
133
|
-
readonly
|
|
220
|
+
readonly formControl: Signal<string | null>;
|
|
221
|
+
/**
|
|
222
|
+
* The validation error messages.
|
|
223
|
+
*/
|
|
224
|
+
readonly errors: Signal<string[]>;
|
|
134
225
|
/**
|
|
135
226
|
* Whether the control is pristine.
|
|
136
|
-
* @internal
|
|
137
227
|
*/
|
|
138
|
-
readonly pristine:
|
|
228
|
+
readonly pristine: Signal<boolean | null>;
|
|
139
229
|
/**
|
|
140
230
|
* Whether the control is touched.
|
|
141
|
-
* @internal
|
|
142
231
|
*/
|
|
143
|
-
readonly touched:
|
|
232
|
+
readonly touched: Signal<boolean | null>;
|
|
144
233
|
/**
|
|
145
234
|
* Whether the control is dirty.
|
|
146
|
-
* @internal
|
|
147
235
|
*/
|
|
148
|
-
readonly dirty:
|
|
236
|
+
readonly dirty: Signal<boolean | null>;
|
|
149
237
|
/**
|
|
150
238
|
* Whether the control is valid.
|
|
151
239
|
*/
|
|
152
|
-
readonly valid:
|
|
240
|
+
readonly valid: Signal<boolean | null>;
|
|
153
241
|
/**
|
|
154
242
|
* Whether the control is invalid.
|
|
155
|
-
* @internal
|
|
156
243
|
*/
|
|
157
|
-
readonly invalid:
|
|
244
|
+
readonly invalid: Signal<boolean | null>;
|
|
158
245
|
/**
|
|
159
246
|
* Whether the control is pending.
|
|
160
|
-
* @internal
|
|
161
247
|
*/
|
|
162
|
-
readonly pending:
|
|
248
|
+
readonly pending: Signal<boolean | null>;
|
|
163
249
|
/**
|
|
164
250
|
* Whether the control is disabled.
|
|
165
|
-
* @internal
|
|
166
|
-
*/
|
|
167
|
-
readonly disabled: _angular_core.WritableSignal<boolean | null>;
|
|
168
|
-
/**
|
|
169
|
-
* Store the current status subscription.
|
|
170
|
-
*/
|
|
171
|
-
private subscription?;
|
|
172
|
-
/**
|
|
173
|
-
* Injector for creating effects outside the constructor.
|
|
174
|
-
*/
|
|
175
|
-
private readonly injector;
|
|
176
|
-
/**
|
|
177
|
-
* The form field state.
|
|
178
|
-
*/
|
|
179
|
-
protected readonly state: ng_primitives_state.CreatedState<NgpFormField>;
|
|
180
|
-
constructor();
|
|
181
|
-
ngOnDestroy(): void;
|
|
182
|
-
/**
|
|
183
|
-
* Setup a listener for the form control status.
|
|
184
|
-
* @param control
|
|
185
251
|
*/
|
|
186
|
-
|
|
187
|
-
private updateStatus;
|
|
252
|
+
readonly disabled: Signal<boolean | null>;
|
|
188
253
|
/**
|
|
189
254
|
* Register the id of the associated form control.
|
|
190
|
-
* @param id
|
|
191
|
-
* @internal
|
|
192
255
|
*/
|
|
193
256
|
setFormControl(id: string): void;
|
|
194
257
|
/**
|
|
195
258
|
* Register a label with the form field.
|
|
196
|
-
* @param label
|
|
197
|
-
* @internal
|
|
198
259
|
*/
|
|
199
260
|
addLabel(label: string): void;
|
|
200
261
|
/**
|
|
201
262
|
* Register a description with the form field.
|
|
202
|
-
* @param description
|
|
203
|
-
* @internal
|
|
204
263
|
*/
|
|
205
264
|
addDescription(description: string): void;
|
|
206
265
|
/**
|
|
207
266
|
* Remove the associated form control.
|
|
208
|
-
* @internal
|
|
209
267
|
*/
|
|
210
268
|
removeFormControl(): void;
|
|
211
269
|
/**
|
|
212
270
|
* Remove a label from the form field.
|
|
213
|
-
* @param label
|
|
214
|
-
* @internal
|
|
215
271
|
*/
|
|
216
272
|
removeLabel(label: string): void;
|
|
217
273
|
/**
|
|
218
274
|
* Remove a description from the form field.
|
|
219
|
-
* @param description
|
|
220
|
-
* @internal
|
|
221
275
|
*/
|
|
222
276
|
removeDescription(description: string): void;
|
|
223
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpFormField, never>;
|
|
224
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpFormField, "[ngpFormField]", ["ngpFormField"], {}, {}, ["ngControl"], never, true, never>;
|
|
225
277
|
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Provides the FormField state.
|
|
229
|
-
*/
|
|
230
|
-
declare const provideFormFieldState: (options?: ng_primitives_state.CreateStateProviderOptions) => _angular_core.FactoryProvider;
|
|
231
278
|
/**
|
|
232
|
-
*
|
|
279
|
+
* The props interface for the FormField primitive.
|
|
233
280
|
*/
|
|
234
|
-
|
|
281
|
+
interface NgpFormFieldProps {
|
|
282
|
+
/**
|
|
283
|
+
* Find any NgControl within the form field.
|
|
284
|
+
*/
|
|
285
|
+
readonly ngControl: Signal<NgControl | undefined>;
|
|
286
|
+
}
|
|
287
|
+
declare const ngpFormField: ({ ngControl }: NgpFormFieldProps) => {
|
|
288
|
+
labels: _angular_core.WritableSignal<string[]>;
|
|
289
|
+
descriptions: _angular_core.WritableSignal<string[]>;
|
|
290
|
+
formControl: _angular_core.WritableSignal<string | null>;
|
|
291
|
+
errors: _angular_core.WritableSignal<string[]>;
|
|
292
|
+
pristine: _angular_core.WritableSignal<boolean | null>;
|
|
293
|
+
touched: _angular_core.WritableSignal<boolean | null>;
|
|
294
|
+
dirty: _angular_core.WritableSignal<boolean | null>;
|
|
295
|
+
valid: _angular_core.WritableSignal<boolean | null>;
|
|
296
|
+
invalid: _angular_core.WritableSignal<boolean | null>;
|
|
297
|
+
pending: _angular_core.WritableSignal<boolean | null>;
|
|
298
|
+
disabled: _angular_core.WritableSignal<boolean | null>;
|
|
299
|
+
setFormControl: (id: string) => void;
|
|
300
|
+
addLabel: (label: string) => void;
|
|
301
|
+
addDescription: (description: string) => void;
|
|
302
|
+
removeFormControl: () => void;
|
|
303
|
+
removeLabel: (label: string) => void;
|
|
304
|
+
removeDescription: (description: string) => void;
|
|
305
|
+
};
|
|
306
|
+
declare const injectFormFieldState: {
|
|
307
|
+
(): Signal<{
|
|
308
|
+
labels: _angular_core.WritableSignal<string[]>;
|
|
309
|
+
descriptions: _angular_core.WritableSignal<string[]>;
|
|
310
|
+
formControl: _angular_core.WritableSignal<string | null>;
|
|
311
|
+
errors: _angular_core.WritableSignal<string[]>;
|
|
312
|
+
pristine: _angular_core.WritableSignal<boolean | null>;
|
|
313
|
+
touched: _angular_core.WritableSignal<boolean | null>;
|
|
314
|
+
dirty: _angular_core.WritableSignal<boolean | null>;
|
|
315
|
+
valid: _angular_core.WritableSignal<boolean | null>;
|
|
316
|
+
invalid: _angular_core.WritableSignal<boolean | null>;
|
|
317
|
+
pending: _angular_core.WritableSignal<boolean | null>;
|
|
318
|
+
disabled: _angular_core.WritableSignal<boolean | null>;
|
|
319
|
+
setFormControl: (id: string) => void;
|
|
320
|
+
addLabel: (label: string) => void;
|
|
321
|
+
addDescription: (description: string) => void;
|
|
322
|
+
removeFormControl: () => void;
|
|
323
|
+
removeLabel: (label: string) => void;
|
|
324
|
+
removeDescription: (description: string) => void;
|
|
325
|
+
}>;
|
|
326
|
+
(options: {
|
|
327
|
+
hoisted: true;
|
|
328
|
+
optional?: boolean;
|
|
329
|
+
}): Signal<{
|
|
330
|
+
labels: _angular_core.WritableSignal<string[]>;
|
|
331
|
+
descriptions: _angular_core.WritableSignal<string[]>;
|
|
332
|
+
formControl: _angular_core.WritableSignal<string | null>;
|
|
333
|
+
errors: _angular_core.WritableSignal<string[]>;
|
|
334
|
+
pristine: _angular_core.WritableSignal<boolean | null>;
|
|
335
|
+
touched: _angular_core.WritableSignal<boolean | null>;
|
|
336
|
+
dirty: _angular_core.WritableSignal<boolean | null>;
|
|
337
|
+
valid: _angular_core.WritableSignal<boolean | null>;
|
|
338
|
+
invalid: _angular_core.WritableSignal<boolean | null>;
|
|
339
|
+
pending: _angular_core.WritableSignal<boolean | null>;
|
|
340
|
+
disabled: _angular_core.WritableSignal<boolean | null>;
|
|
341
|
+
setFormControl: (id: string) => void;
|
|
342
|
+
addLabel: (label: string) => void;
|
|
343
|
+
addDescription: (description: string) => void;
|
|
344
|
+
removeFormControl: () => void;
|
|
345
|
+
removeLabel: (label: string) => void;
|
|
346
|
+
removeDescription: (description: string) => void;
|
|
347
|
+
} | null>;
|
|
348
|
+
(options?: {
|
|
349
|
+
hoisted?: boolean;
|
|
350
|
+
optional?: boolean;
|
|
351
|
+
}): Signal<{
|
|
352
|
+
labels: _angular_core.WritableSignal<string[]>;
|
|
353
|
+
descriptions: _angular_core.WritableSignal<string[]>;
|
|
354
|
+
formControl: _angular_core.WritableSignal<string | null>;
|
|
355
|
+
errors: _angular_core.WritableSignal<string[]>;
|
|
356
|
+
pristine: _angular_core.WritableSignal<boolean | null>;
|
|
357
|
+
touched: _angular_core.WritableSignal<boolean | null>;
|
|
358
|
+
dirty: _angular_core.WritableSignal<boolean | null>;
|
|
359
|
+
valid: _angular_core.WritableSignal<boolean | null>;
|
|
360
|
+
invalid: _angular_core.WritableSignal<boolean | null>;
|
|
361
|
+
pending: _angular_core.WritableSignal<boolean | null>;
|
|
362
|
+
disabled: _angular_core.WritableSignal<boolean | null>;
|
|
363
|
+
setFormControl: (id: string) => void;
|
|
364
|
+
addLabel: (label: string) => void;
|
|
365
|
+
addDescription: (description: string) => void;
|
|
366
|
+
removeFormControl: () => void;
|
|
367
|
+
removeLabel: (label: string) => void;
|
|
368
|
+
removeDescription: (description: string) => void;
|
|
369
|
+
} | null> | Signal<{
|
|
370
|
+
labels: _angular_core.WritableSignal<string[]>;
|
|
371
|
+
descriptions: _angular_core.WritableSignal<string[]>;
|
|
372
|
+
formControl: _angular_core.WritableSignal<string | null>;
|
|
373
|
+
errors: _angular_core.WritableSignal<string[]>;
|
|
374
|
+
pristine: _angular_core.WritableSignal<boolean | null>;
|
|
375
|
+
touched: _angular_core.WritableSignal<boolean | null>;
|
|
376
|
+
dirty: _angular_core.WritableSignal<boolean | null>;
|
|
377
|
+
valid: _angular_core.WritableSignal<boolean | null>;
|
|
378
|
+
invalid: _angular_core.WritableSignal<boolean | null>;
|
|
379
|
+
pending: _angular_core.WritableSignal<boolean | null>;
|
|
380
|
+
disabled: _angular_core.WritableSignal<boolean | null>;
|
|
381
|
+
setFormControl: (id: string) => void;
|
|
382
|
+
addLabel: (label: string) => void;
|
|
383
|
+
addDescription: (description: string) => void;
|
|
384
|
+
removeFormControl: () => void;
|
|
385
|
+
removeLabel: (label: string) => void;
|
|
386
|
+
removeDescription: (description: string) => void;
|
|
387
|
+
}>;
|
|
388
|
+
};
|
|
389
|
+
declare const provideFormFieldState: (opts?: {
|
|
390
|
+
inherit?: boolean;
|
|
391
|
+
}) => _angular_core.FactoryProvider;
|
|
235
392
|
|
|
236
393
|
/**
|
|
237
394
|
* The `NgpLabel` directive is used to mark a label element within a form field. Preferably, there should use an HTML `<label>` element.
|
|
@@ -242,25 +399,65 @@ declare class NgpLabel {
|
|
|
242
399
|
*/
|
|
243
400
|
readonly id: _angular_core.InputSignal<string>;
|
|
244
401
|
/**
|
|
245
|
-
*
|
|
402
|
+
* The label state.
|
|
246
403
|
*/
|
|
247
|
-
|
|
404
|
+
constructor();
|
|
405
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpLabel, never>;
|
|
406
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpLabel, "[ngpLabel]", ["ngpLabel"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* The state interface for the Label primitive.
|
|
411
|
+
*/
|
|
412
|
+
interface NgpLabelState {
|
|
248
413
|
/**
|
|
249
|
-
*
|
|
414
|
+
* The id of the label.
|
|
250
415
|
*/
|
|
251
|
-
|
|
416
|
+
readonly id: Signal<string>;
|
|
252
417
|
/**
|
|
253
|
-
*
|
|
418
|
+
* The htmlFor attribute value.
|
|
254
419
|
*/
|
|
255
|
-
|
|
420
|
+
readonly htmlFor: Signal<string | null>;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* The props interface for the Label primitive.
|
|
424
|
+
*/
|
|
425
|
+
interface NgpLabelProps {
|
|
256
426
|
/**
|
|
257
|
-
*
|
|
427
|
+
* The id of the label.
|
|
258
428
|
*/
|
|
259
|
-
|
|
260
|
-
constructor();
|
|
261
|
-
protected onClick(event: MouseEvent): void;
|
|
262
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpLabel, never>;
|
|
263
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpLabel, "[ngpLabel]", ["ngpLabel"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
429
|
+
readonly id: Signal<string>;
|
|
264
430
|
}
|
|
431
|
+
declare const ngpLabel: ({ id }: NgpLabelProps) => {
|
|
432
|
+
id: Signal<string>;
|
|
433
|
+
htmlFor: Signal<string | null>;
|
|
434
|
+
};
|
|
435
|
+
declare const injectLabelState: {
|
|
436
|
+
(): Signal<{
|
|
437
|
+
id: Signal<string>;
|
|
438
|
+
htmlFor: Signal<string | null>;
|
|
439
|
+
}>;
|
|
440
|
+
(options: {
|
|
441
|
+
hoisted: true;
|
|
442
|
+
optional?: boolean;
|
|
443
|
+
}): Signal<{
|
|
444
|
+
id: Signal<string>;
|
|
445
|
+
htmlFor: Signal<string | null>;
|
|
446
|
+
} | null>;
|
|
447
|
+
(options?: {
|
|
448
|
+
hoisted?: boolean;
|
|
449
|
+
optional?: boolean;
|
|
450
|
+
}): Signal<{
|
|
451
|
+
id: Signal<string>;
|
|
452
|
+
htmlFor: Signal<string | null>;
|
|
453
|
+
}> | Signal<{
|
|
454
|
+
id: Signal<string>;
|
|
455
|
+
htmlFor: Signal<string | null>;
|
|
456
|
+
} | null>;
|
|
457
|
+
};
|
|
458
|
+
declare const provideLabelState: (opts?: {
|
|
459
|
+
inherit?: boolean;
|
|
460
|
+
}) => _angular_core.FactoryProvider;
|
|
265
461
|
|
|
266
|
-
export { NgpDescription, NgpError, NgpFormControl, NgpFormField, NgpLabel,
|
|
462
|
+
export { NgpDescription, NgpError, NgpFormControl, NgpFormField, NgpLabel, injectDescriptionState, injectErrorState, injectFormFieldState, injectLabelState, ngpDescription, ngpError, ngpFormControl, ngpFormField, ngpLabel, provideDescriptionState, provideErrorState, provideFormFieldState, provideLabelState };
|
|
463
|
+
export type { NgpDescriptionProps, NgpDescriptionState, NgpErrorProps, NgpErrorState, NgpFormFieldProps, NgpFormFieldState, NgpLabelProps, NgpLabelState };
|
package/input/index.d.ts
CHANGED
|
@@ -63,6 +63,7 @@ declare const injectInputState: {
|
|
|
63
63
|
}>;
|
|
64
64
|
(options: {
|
|
65
65
|
hoisted: true;
|
|
66
|
+
optional?: boolean;
|
|
66
67
|
}): Signal<{
|
|
67
68
|
id: Signal<string>;
|
|
68
69
|
disabled: WritableSignal<boolean>;
|
|
@@ -70,10 +71,15 @@ declare const injectInputState: {
|
|
|
70
71
|
} | null>;
|
|
71
72
|
(options?: {
|
|
72
73
|
hoisted?: boolean;
|
|
74
|
+
optional?: boolean;
|
|
73
75
|
}): Signal<{
|
|
74
76
|
id: Signal<string>;
|
|
75
77
|
disabled: WritableSignal<boolean>;
|
|
76
78
|
status: Signal<ng_primitives_utils.NgpControlStatus>;
|
|
79
|
+
}> | Signal<{
|
|
80
|
+
id: Signal<string>;
|
|
81
|
+
disabled: WritableSignal<boolean>;
|
|
82
|
+
status: Signal<ng_primitives_utils.NgpControlStatus>;
|
|
77
83
|
} | null>;
|
|
78
84
|
};
|
|
79
85
|
declare const provideInputState: (opts?: {
|
package/interactions/index.d.ts
CHANGED
|
@@ -53,9 +53,9 @@ declare class NgpFocusVisible {
|
|
|
53
53
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpFocusVisible, "[ngpFocusVisible]", ["ngpFocusVisible"], { "disabled": { "alias": "ngpFocusVisibleDisabled"; "required": false; "isSignal": true; }; }, { "focusChange": "ngpFocusVisible"; }, never, never, true, never>;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
interface
|
|
56
|
+
interface NgpFocusVisibleProps {
|
|
57
57
|
disabled?: Signal<boolean>;
|
|
58
|
-
|
|
58
|
+
onFocusChange?: (value: boolean) => void;
|
|
59
59
|
}
|
|
60
60
|
interface NgpFocusVisibleState {
|
|
61
61
|
isFocused: Signal<boolean>;
|
|
@@ -63,7 +63,7 @@ interface NgpFocusVisibleState {
|
|
|
63
63
|
/**
|
|
64
64
|
* @internal
|
|
65
65
|
*/
|
|
66
|
-
declare function
|
|
66
|
+
declare function ngpFocusVisible({ onFocusChange, disabled, }: NgpFocusVisibleProps): NgpFocusVisibleState;
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* This was inspired by the React Aria useFocus hook.
|
|
@@ -83,11 +83,11 @@ declare class NgpFocus {
|
|
|
83
83
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpFocus, "[ngpFocus]", ["ngpFocus"], { "disabled": { "alias": "ngpFocusDisabled"; "required": false; "isSignal": true; }; }, { "focus": "ngpFocus"; }, never, never, true, never>;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
interface
|
|
86
|
+
interface NgpFocusProps {
|
|
87
87
|
disabled?: Signal<boolean>;
|
|
88
88
|
focusWithin?: boolean;
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
onFocus?: () => void;
|
|
90
|
+
onBlur?: () => void;
|
|
91
91
|
}
|
|
92
92
|
interface NgpFocusState {
|
|
93
93
|
isFocused: Signal<boolean>;
|
|
@@ -95,7 +95,7 @@ interface NgpFocusState {
|
|
|
95
95
|
/**
|
|
96
96
|
* @internal
|
|
97
97
|
*/
|
|
98
|
-
declare function
|
|
98
|
+
declare function ngpFocus({ onFocus, onBlur, focusWithin, disabled, }: NgpFocusProps): NgpFocusState;
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
101
|
* Apply the `ngpHover` directive to an element that you want to listen for hover events. T
|
|
@@ -127,10 +127,10 @@ declare class NgpHover {
|
|
|
127
127
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpHover, "[ngpHover]", ["ngpHover"], { "disabled": { "alias": "ngpHoverDisabled"; "required": false; "isSignal": true; }; }, { "hoverStart": "ngpHoverStart"; "hoverEnd": "ngpHoverEnd"; "hoverChange": "ngpHover"; }, never, never, true, never>;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
interface
|
|
130
|
+
interface NgpHoverProps {
|
|
131
131
|
disabled?: Signal<boolean>;
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
onHoverStart?: () => void;
|
|
133
|
+
onHoverEnd?: () => void;
|
|
134
134
|
}
|
|
135
135
|
interface NgpHoverState {
|
|
136
136
|
hovered: Signal<boolean>;
|
|
@@ -141,7 +141,7 @@ interface NgpHoverState {
|
|
|
141
141
|
* because there is a chance the directive has already been used.
|
|
142
142
|
* @internal
|
|
143
143
|
*/
|
|
144
|
-
declare function
|
|
144
|
+
declare function ngpHover({ onHoverStart, onHoverEnd, disabled, }: NgpHoverProps): NgpHoverState;
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
147
|
* The `NgpMove` directive is used to enable the pointer and keyboard move interactions on an element.
|
|
@@ -281,15 +281,15 @@ declare class NgpPress {
|
|
|
281
281
|
interface NgpPressState {
|
|
282
282
|
pressed: Signal<boolean>;
|
|
283
283
|
}
|
|
284
|
-
interface
|
|
284
|
+
interface NgpPressProps {
|
|
285
285
|
disabled?: Signal<boolean>;
|
|
286
|
-
|
|
287
|
-
|
|
286
|
+
onPressStart?: () => void;
|
|
287
|
+
onPressEnd?: () => void;
|
|
288
288
|
}
|
|
289
289
|
/**
|
|
290
290
|
* @internal
|
|
291
291
|
*/
|
|
292
|
-
declare function
|
|
292
|
+
declare function ngpPress({ onPressStart, onPressEnd, disabled, }: NgpPressProps): NgpPressState;
|
|
293
293
|
|
|
294
|
-
export { NgpFocus, NgpFocusVisible, NgpHover, NgpMove, NgpPress,
|
|
294
|
+
export { NgpFocus, NgpFocusVisible, NgpHover, NgpMove, NgpPress, ngpFocus, ngpFocusVisible, ngpHover, ngpInteractions, ngpPress, provideInteractionsConfig, ngpInteractions as setupInteractions };
|
|
295
295
|
export type { NgpInteractionsConfig, NgpMoveEvent };
|