ng-primitives 0.124.0 → 0.126.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/date-time-date-fns/README.md +3 -0
- package/fesm2022/ng-primitives-avatar.mjs +4 -2
- package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
- package/fesm2022/ng-primitives-checkbox.mjs +4 -2
- package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/ng-primitives-date-picker.mjs +42 -44
- package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
- package/fesm2022/ng-primitives-date-time-date-fns.mjs +95 -0
- package/fesm2022/ng-primitives-date-time-date-fns.mjs.map +1 -0
- package/fesm2022/ng-primitives-date-time-luxon.mjs +21 -3
- package/fesm2022/ng-primitives-date-time-luxon.mjs.map +1 -1
- package/fesm2022/ng-primitives-date-time.mjs +18 -3
- package/fesm2022/ng-primitives-date-time.mjs.map +1 -1
- package/fesm2022/ng-primitives-dialog.mjs +11 -4
- package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/ng-primitives-form-field.mjs +3 -0
- package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
- package/fesm2022/ng-primitives-input-otp.mjs +15 -7
- package/fesm2022/ng-primitives-input-otp.mjs.map +1 -1
- package/fesm2022/ng-primitives-listbox.mjs +5 -4
- package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
- package/fesm2022/ng-primitives-menu.mjs +8 -0
- package/fesm2022/ng-primitives-menu.mjs.map +1 -1
- package/fesm2022/ng-primitives-meter.mjs +20 -5
- package/fesm2022/ng-primitives-meter.mjs.map +1 -1
- package/fesm2022/ng-primitives-number-field.mjs +10 -0
- package/fesm2022/ng-primitives-number-field.mjs.map +1 -1
- package/fesm2022/ng-primitives-pagination.mjs +16 -6
- package/fesm2022/ng-primitives-pagination.mjs.map +1 -1
- package/fesm2022/ng-primitives-password.mjs +293 -0
- package/fesm2022/ng-primitives-password.mjs.map +1 -0
- package/fesm2022/ng-primitives-popover.mjs +4 -0
- package/fesm2022/ng-primitives-popover.mjs.map +1 -1
- package/fesm2022/ng-primitives-progress.mjs +36 -11
- package/fesm2022/ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/ng-primitives-roving-focus.mjs +13 -2
- package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
- package/fesm2022/ng-primitives-search.mjs +2 -1
- package/fesm2022/ng-primitives-search.mjs.map +1 -1
- package/fesm2022/ng-primitives-slider.mjs +38 -18
- package/fesm2022/ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/ng-primitives-switch.mjs +18 -8
- package/fesm2022/ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/ng-primitives-tabs.mjs +22 -6
- package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/ng-primitives-textarea.mjs +10 -8
- package/fesm2022/ng-primitives-textarea.mjs.map +1 -1
- package/fesm2022/ng-primitives-toast.mjs +3 -0
- package/fesm2022/ng-primitives-toast.mjs.map +1 -1
- package/fesm2022/ng-primitives-toggle-group.mjs +31 -8
- package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
- package/package.json +12 -1
- package/password/README.md +3 -0
- package/schematics/ng-generate/templates/checkbox/checkbox.__fileSuffix@dasherize__.ts.template +2 -1
- package/schematics/ng-generate/templates/combobox/combobox.__fileSuffix@dasherize__.ts.template +3 -2
- package/schematics/ng-generate/templates/date-picker/date-picker.__fileSuffix@dasherize__.ts.template +2 -1
- package/schematics/ng-generate/templates/listbox/listbox.__fileSuffix@dasherize__.ts.template +9 -4
- package/schematics/ng-generate/templates/pagination/pagination.__fileSuffix@dasherize__.ts.template +7 -1
- package/schematics/ng-generate/templates/password/password.__fileSuffix@dasherize__.ts.template +141 -0
- package/schematics/ng-generate/templates/range-slider/range-slider.__fileSuffix@dasherize__.ts.template +4 -3
- package/schematics/ng-generate/templates/slider/slider.__fileSuffix@dasherize__.ts.template +2 -1
- package/schematics/ng-generate/templates/switch/switch.__fileSuffix@dasherize__.ts.template +2 -1
- package/types/ng-primitives-checkbox.d.ts +5 -1
- package/types/ng-primitives-date-picker.d.ts +7 -9
- package/types/ng-primitives-date-time-date-fns.d.ts +30 -0
- package/types/ng-primitives-date-time.d.ts +15 -3
- package/types/ng-primitives-dialog.d.ts +4 -0
- package/types/ng-primitives-input-otp.d.ts +5 -5
- package/types/ng-primitives-meter.d.ts +9 -2
- package/types/ng-primitives-pagination.d.ts +34 -8
- package/types/ng-primitives-password.d.ts +296 -0
- package/types/ng-primitives-progress.d.ts +4 -2
- package/types/ng-primitives-roving-focus.d.ts +7 -0
- package/types/ng-primitives-slider.d.ts +5 -4
- package/types/ng-primitives-switch.d.ts +14 -4
- package/types/ng-primitives-tabs.d.ts +6 -1
- package/types/ng-primitives-toggle-group.d.ts +51 -37
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
2
|
import { Signal, WritableSignal } from '@angular/core';
|
|
3
3
|
import * as ng_primitives_state from 'ng-primitives/state';
|
|
4
|
+
import { SetterOptions } from 'ng-primitives/state';
|
|
4
5
|
import * as ng_primitives_switch from 'ng-primitives/switch';
|
|
5
6
|
import { BooleanInput } from '@angular/cdk/coercion';
|
|
6
7
|
import { Observable } from 'rxjs';
|
|
@@ -64,6 +65,11 @@ declare class NgpSwitch {
|
|
|
64
65
|
* @default false
|
|
65
66
|
*/
|
|
66
67
|
readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
68
|
+
/**
|
|
69
|
+
* Whether the switch is required.
|
|
70
|
+
* @default false
|
|
71
|
+
*/
|
|
72
|
+
readonly required: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
67
73
|
/**
|
|
68
74
|
* The switch state.
|
|
69
75
|
* @internal
|
|
@@ -76,13 +82,13 @@ declare class NgpSwitch {
|
|
|
76
82
|
/**
|
|
77
83
|
* Update the checked value.
|
|
78
84
|
*/
|
|
79
|
-
setChecked(value: boolean): void;
|
|
85
|
+
setChecked(value: boolean, options?: SetterOptions): void;
|
|
80
86
|
/**
|
|
81
87
|
* Update the disabled value.
|
|
82
88
|
*/
|
|
83
89
|
setDisabled(value: boolean): void;
|
|
84
90
|
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>;
|
|
91
|
+
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; }; "required": { "alias": "ngpSwitchRequired"; "required": false; "isSignal": true; }; }, { "checkedChange": "ngpSwitchCheckedChange"; }, never, never, true, never>;
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
/**
|
|
@@ -112,7 +118,7 @@ interface NgpSwitchState {
|
|
|
112
118
|
/**
|
|
113
119
|
* Update the checked value.
|
|
114
120
|
*/
|
|
115
|
-
setChecked(value: boolean): void;
|
|
121
|
+
setChecked(value: boolean, options?: SetterOptions): void;
|
|
116
122
|
/**
|
|
117
123
|
* Update the disabled value.
|
|
118
124
|
*/
|
|
@@ -134,12 +140,16 @@ interface NgpSwitchProps {
|
|
|
134
140
|
* Whether the switch is disabled.
|
|
135
141
|
*/
|
|
136
142
|
readonly disabled?: Signal<boolean>;
|
|
143
|
+
/**
|
|
144
|
+
* Whether the switch is required.
|
|
145
|
+
*/
|
|
146
|
+
readonly required?: Signal<boolean>;
|
|
137
147
|
/**
|
|
138
148
|
* Callback fired when the checked state changes.
|
|
139
149
|
*/
|
|
140
150
|
readonly onCheckedChange?: (checked: boolean) => void;
|
|
141
151
|
}
|
|
142
|
-
declare const ngpSwitch: ({ id, checked: _checked, disabled: _disabled, onCheckedChange, }: NgpSwitchProps) => NgpSwitchState;
|
|
152
|
+
declare const ngpSwitch: ({ id, checked: _checked, disabled: _disabled, required: _required, onCheckedChange, }: NgpSwitchProps) => NgpSwitchState;
|
|
143
153
|
declare const injectSwitchState: {
|
|
144
154
|
(): Signal<NgpSwitchState>;
|
|
145
155
|
(options: ng_primitives_state.StateInjectionOptions): Signal<NgpSwitchState | null>;
|
|
@@ -277,6 +277,11 @@ declare class NgpTabset {
|
|
|
277
277
|
* Whether tabs should activate on focus
|
|
278
278
|
*/
|
|
279
279
|
readonly activateOnFocus: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
280
|
+
/**
|
|
281
|
+
* Whether keyboard focus should wrap around the tab list.
|
|
282
|
+
* @default true (from the global tabs config)
|
|
283
|
+
*/
|
|
284
|
+
readonly wrap: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
280
285
|
private readonly state;
|
|
281
286
|
/**
|
|
282
287
|
* @internal
|
|
@@ -294,7 +299,7 @@ declare class NgpTabset {
|
|
|
294
299
|
*/
|
|
295
300
|
setOrientation(orientation: NgpOrientation): void;
|
|
296
301
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpTabset, never>;
|
|
297
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpTabset, "[ngpTabset]", ["ngpTabset"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "value": { "alias": "ngpTabsetValue"; "required": false; "isSignal": true; }; "orientation": { "alias": "ngpTabsetOrientation"; "required": false; "isSignal": true; }; "activateOnFocus": { "alias": "ngpTabsetActivateOnFocus"; "required": false; "isSignal": true; }; }, { "valueChange": "ngpTabsetValueChange"; }, never, never, true, never>;
|
|
302
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpTabset, "[ngpTabset]", ["ngpTabset"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "value": { "alias": "ngpTabsetValue"; "required": false; "isSignal": true; }; "orientation": { "alias": "ngpTabsetOrientation"; "required": false; "isSignal": true; }; "activateOnFocus": { "alias": "ngpTabsetActivateOnFocus"; "required": false; "isSignal": true; }; "wrap": { "alias": "ngpTabsetWrap"; "required": false; "isSignal": true; }; }, { "valueChange": "ngpTabsetValueChange"; }, never, never, true, never>;
|
|
298
303
|
}
|
|
299
304
|
|
|
300
305
|
/**
|
|
@@ -3,7 +3,7 @@ import { Provider, OnInit, Signal, WritableSignal } from '@angular/core';
|
|
|
3
3
|
import { NgpOrientation } from 'ng-primitives/common';
|
|
4
4
|
import { BooleanInput } from '@angular/cdk/coercion';
|
|
5
5
|
import * as ng_primitives_state from 'ng-primitives/state';
|
|
6
|
-
import { SetterOptions } from 'ng-primitives/state';
|
|
6
|
+
import { SetterOptions, StateInjectionOptions } from 'ng-primitives/state';
|
|
7
7
|
import * as ng_primitives_toggle_group from 'ng-primitives/toggle-group';
|
|
8
8
|
import { Observable } from 'rxjs';
|
|
9
9
|
|
|
@@ -36,20 +36,20 @@ interface NgpToggleGroupConfig {
|
|
|
36
36
|
*/
|
|
37
37
|
declare function provideToggleGroupConfig(config: Partial<NgpToggleGroupConfig>): Provider[];
|
|
38
38
|
|
|
39
|
-
declare class NgpToggleGroupItem implements OnInit {
|
|
39
|
+
declare class NgpToggleGroupItem<T = string> implements OnInit {
|
|
40
40
|
/**
|
|
41
41
|
* The value of the item.
|
|
42
42
|
* @required
|
|
43
43
|
*/
|
|
44
|
-
readonly value: _angular_core.InputSignal<
|
|
44
|
+
readonly value: _angular_core.InputSignal<T | undefined>;
|
|
45
45
|
/**
|
|
46
46
|
* Whether the item is disabled.
|
|
47
47
|
*/
|
|
48
48
|
readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
49
49
|
constructor();
|
|
50
50
|
ngOnInit(): void;
|
|
51
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpToggleGroupItem
|
|
52
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpToggleGroupItem
|
|
51
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpToggleGroupItem<any>, never>;
|
|
52
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpToggleGroupItem<any>, "[ngpToggleGroupItem]", ["ngpToggleGroupItem"], { "value": { "alias": "ngpToggleGroupItemValue"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpToggleGroupItemDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/**
|
|
@@ -62,17 +62,17 @@ interface NgpToggleGroupItemState {
|
|
|
62
62
|
/**
|
|
63
63
|
* The props interface for the ToggleGroupItem pattern.
|
|
64
64
|
*/
|
|
65
|
-
interface NgpToggleGroupItemProps {
|
|
65
|
+
interface NgpToggleGroupItemProps<T = string> {
|
|
66
66
|
/**
|
|
67
67
|
* The value of the toggle group item.
|
|
68
68
|
*/
|
|
69
|
-
value: Signal<
|
|
69
|
+
value: Signal<T>;
|
|
70
70
|
/**
|
|
71
71
|
* Whether the toggle group item is disabled.
|
|
72
72
|
*/
|
|
73
73
|
disabled?: Signal<boolean>;
|
|
74
74
|
}
|
|
75
|
-
declare const ngpToggleGroupItem: ({ value, disabled }: NgpToggleGroupItemProps) => NgpToggleGroupItemState;
|
|
75
|
+
declare const ngpToggleGroupItem: <T = string>({ value, disabled, }: NgpToggleGroupItemProps<T>) => NgpToggleGroupItemState;
|
|
76
76
|
declare const injectToggleGroupItemState: {
|
|
77
77
|
(): Signal<NgpToggleGroupItemState>;
|
|
78
78
|
(options: ng_primitives_state.StateInjectionOptions): Signal<NgpToggleGroupItemState | null>;
|
|
@@ -82,7 +82,7 @@ declare const provideToggleGroupItemState: (opts?: {
|
|
|
82
82
|
inherit?: boolean;
|
|
83
83
|
}) => _angular_core.FactoryProvider;
|
|
84
84
|
|
|
85
|
-
declare class NgpToggleGroup {
|
|
85
|
+
declare class NgpToggleGroup<T = string> {
|
|
86
86
|
/**
|
|
87
87
|
* Access the global toggle group configuration.
|
|
88
88
|
*/
|
|
@@ -108,16 +108,22 @@ declare class NgpToggleGroup {
|
|
|
108
108
|
/**
|
|
109
109
|
* The selected value(s) of the toggle group.
|
|
110
110
|
*/
|
|
111
|
-
readonly value: _angular_core.InputSignal<
|
|
111
|
+
readonly value: _angular_core.InputSignal<T[] | undefined>;
|
|
112
112
|
/**
|
|
113
113
|
* The default selected value(s) for uncontrolled usage.
|
|
114
114
|
* @default []
|
|
115
115
|
*/
|
|
116
|
-
readonly defaultValue: _angular_core.InputSignal<
|
|
116
|
+
readonly defaultValue: _angular_core.InputSignal<T[]>;
|
|
117
117
|
/**
|
|
118
118
|
* Emits when the value of the toggle group changes.
|
|
119
119
|
*/
|
|
120
|
-
readonly valueChange: _angular_core.OutputEmitterRef<
|
|
120
|
+
readonly valueChange: _angular_core.OutputEmitterRef<T[]>;
|
|
121
|
+
/**
|
|
122
|
+
* The comparator used to determine whether two values are equal.
|
|
123
|
+
* Useful when values are objects and equality should be checked by value rather than by reference.
|
|
124
|
+
* @default (a, b) => a === b
|
|
125
|
+
*/
|
|
126
|
+
readonly compareWith: _angular_core.InputSignal<(a: T, b: T) => boolean>;
|
|
121
127
|
/**
|
|
122
128
|
* Whether the toggle group is disabled.
|
|
123
129
|
*/
|
|
@@ -125,19 +131,19 @@ declare class NgpToggleGroup {
|
|
|
125
131
|
/**
|
|
126
132
|
* The state of the toggle group.
|
|
127
133
|
*/
|
|
128
|
-
protected readonly state: ng_primitives_toggle_group.NgpToggleGroupState
|
|
134
|
+
protected readonly state: ng_primitives_toggle_group.NgpToggleGroupState<T>;
|
|
129
135
|
/**
|
|
130
136
|
* Toggle a value in the toggle group.
|
|
131
137
|
*/
|
|
132
|
-
toggle(value:
|
|
138
|
+
toggle(value: T): void;
|
|
133
139
|
/**
|
|
134
140
|
* Set the value(s) of the toggle group.
|
|
135
141
|
*/
|
|
136
|
-
setValue(newValue:
|
|
142
|
+
setValue(newValue: T[], options?: SetterOptions): void;
|
|
137
143
|
/**
|
|
138
144
|
* Set the default value(s) of the toggle group.
|
|
139
145
|
*/
|
|
140
|
-
setDefaultValue(defaultValue:
|
|
146
|
+
setDefaultValue(defaultValue: T[]): void;
|
|
141
147
|
/**
|
|
142
148
|
* Set the disabled state of the toggle group.
|
|
143
149
|
*/
|
|
@@ -146,22 +152,22 @@ declare class NgpToggleGroup {
|
|
|
146
152
|
* Set the orientation of the toggle group.
|
|
147
153
|
*/
|
|
148
154
|
setOrientation(newOrientation: NgpOrientation): void;
|
|
149
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpToggleGroup
|
|
150
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpToggleGroup
|
|
155
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgpToggleGroup<any>, never>;
|
|
156
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgpToggleGroup<any>, "[ngpToggleGroup]", ["ngpToggleGroup"], { "orientation": { "alias": "ngpToggleGroupOrientation"; "required": false; "isSignal": true; }; "wrap": { "alias": "ngpToggleGroupWrap"; "required": false; "isSignal": true; }; "allowDeselection": { "alias": "ngpToggleGroupAllowDeselection"; "required": false; "isSignal": true; }; "type": { "alias": "ngpToggleGroupType"; "required": false; "isSignal": true; }; "value": { "alias": "ngpToggleGroupValue"; "required": false; "isSignal": true; }; "defaultValue": { "alias": "ngpToggleGroupDefaultValue"; "required": false; "isSignal": true; }; "compareWith": { "alias": "ngpToggleGroupCompareWith"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpToggleGroupDisabled"; "required": false; "isSignal": true; }; }, { "valueChange": "ngpToggleGroupValueChange"; }, never, never, true, never>;
|
|
151
157
|
}
|
|
152
158
|
|
|
153
159
|
/**
|
|
154
160
|
* The state interface for the ToggleGroup pattern.
|
|
155
161
|
*/
|
|
156
|
-
interface NgpToggleGroupState {
|
|
162
|
+
interface NgpToggleGroupState<T = string> {
|
|
157
163
|
/**
|
|
158
164
|
* The current value(s) of the toggle group.
|
|
159
165
|
*/
|
|
160
|
-
readonly value: WritableSignal<
|
|
166
|
+
readonly value: WritableSignal<T[]>;
|
|
161
167
|
/**
|
|
162
168
|
* Emit when the value changes.
|
|
163
169
|
*/
|
|
164
|
-
readonly valueChange: Observable<
|
|
170
|
+
readonly valueChange: Observable<T[]>;
|
|
165
171
|
/**
|
|
166
172
|
* Whether the toggle group is disabled.
|
|
167
173
|
*/
|
|
@@ -170,30 +176,34 @@ interface NgpToggleGroupState {
|
|
|
170
176
|
* The orientation of the toggle group.
|
|
171
177
|
*/
|
|
172
178
|
readonly orientation: WritableSignal<NgpOrientation>;
|
|
179
|
+
/**
|
|
180
|
+
* The type of the toggle group, whether only one item can be selected or multiple.
|
|
181
|
+
*/
|
|
182
|
+
readonly type: Signal<'single' | 'multiple'>;
|
|
173
183
|
/**
|
|
174
184
|
* Select a value in the toggle group.
|
|
175
185
|
*/
|
|
176
|
-
select(selection:
|
|
186
|
+
select(selection: T): void;
|
|
177
187
|
/**
|
|
178
188
|
* De-select a value in the toggle group.
|
|
179
189
|
*/
|
|
180
|
-
deselect(selection:
|
|
190
|
+
deselect(selection: T): void;
|
|
181
191
|
/**
|
|
182
192
|
* Check if a value is selected in the toggle group.
|
|
183
193
|
*/
|
|
184
|
-
isSelected(selection:
|
|
194
|
+
isSelected(selection: T): boolean;
|
|
185
195
|
/**
|
|
186
196
|
* Toggle a value in the toggle group.
|
|
187
197
|
*/
|
|
188
|
-
toggle(selection:
|
|
198
|
+
toggle(selection: T): void;
|
|
189
199
|
/**
|
|
190
200
|
* Set the value(s) of the toggle group.
|
|
191
201
|
*/
|
|
192
|
-
setValue(newValue:
|
|
202
|
+
setValue(newValue: T[], options?: SetterOptions): void;
|
|
193
203
|
/**
|
|
194
204
|
* Set the default value(s) of the toggle group.
|
|
195
205
|
*/
|
|
196
|
-
setDefaultValue(defaultValue:
|
|
206
|
+
setDefaultValue(defaultValue: T[]): void;
|
|
197
207
|
/**
|
|
198
208
|
* Set the disabled state of the toggle group.
|
|
199
209
|
*/
|
|
@@ -206,7 +216,7 @@ interface NgpToggleGroupState {
|
|
|
206
216
|
/**
|
|
207
217
|
* The props interface for the ToggleGroup pattern.
|
|
208
218
|
*/
|
|
209
|
-
interface NgpToggleGroupProps {
|
|
219
|
+
interface NgpToggleGroupProps<T = string> {
|
|
210
220
|
/**
|
|
211
221
|
* The orientation of the toggle-group.
|
|
212
222
|
*/
|
|
@@ -226,29 +236,33 @@ interface NgpToggleGroupProps {
|
|
|
226
236
|
/**
|
|
227
237
|
* The value(s) of the toggle-group.
|
|
228
238
|
*/
|
|
229
|
-
readonly value: Signal<
|
|
239
|
+
readonly value: Signal<T[] | undefined>;
|
|
230
240
|
/**
|
|
231
241
|
* The default value(s) of the toggle-group for uncontrolled usage.
|
|
232
242
|
*/
|
|
233
|
-
readonly defaultValue?: Signal<
|
|
243
|
+
readonly defaultValue?: Signal<T[]>;
|
|
234
244
|
/**
|
|
235
245
|
* Whether the toggle-group is disabled.
|
|
236
246
|
*/
|
|
237
247
|
readonly disabled?: Signal<boolean>;
|
|
248
|
+
/**
|
|
249
|
+
* The comparator used to determine whether two values are equal.
|
|
250
|
+
* @default (a, b) => a === b
|
|
251
|
+
*/
|
|
252
|
+
readonly compareWith?: Signal<(a: T, b: T) => boolean>;
|
|
238
253
|
/**
|
|
239
254
|
* Emit when the value changes.
|
|
240
255
|
*/
|
|
241
|
-
readonly onValueChange?: (value:
|
|
256
|
+
readonly onValueChange?: (value: T[]) => void;
|
|
242
257
|
}
|
|
243
|
-
declare const ngpToggleGroup: ({ orientation: _orientation, wrap: _wrap, allowDeselection: _allowDeselection, type: _type, value: _value, defaultValue: _defaultValue, disabled: _disabled, onValueChange, }: NgpToggleGroupProps) => NgpToggleGroupState
|
|
244
|
-
declare const injectToggleGroupState: {
|
|
245
|
-
(): Signal<NgpToggleGroupState>;
|
|
246
|
-
(options: ng_primitives_state.StateInjectionOptions): Signal<NgpToggleGroupState | null>;
|
|
247
|
-
(options?: ng_primitives_state.StateInjectionOptions): Signal<NgpToggleGroupState> | Signal<NgpToggleGroupState | null>;
|
|
248
|
-
};
|
|
258
|
+
declare const ngpToggleGroup: <T = string>({ orientation: _orientation, wrap: _wrap, allowDeselection: _allowDeselection, type: _type, value: _value, defaultValue: _defaultValue, disabled: _disabled, compareWith: _compareWith, onValueChange, }: NgpToggleGroupProps<T>) => NgpToggleGroupState<T>;
|
|
249
259
|
declare const provideToggleGroupState: (opts?: {
|
|
250
260
|
inherit?: boolean;
|
|
251
261
|
}) => _angular_core.FactoryProvider;
|
|
262
|
+
/**
|
|
263
|
+
* Injects the ToggleGroup state, typed to the value type `T`.
|
|
264
|
+
*/
|
|
265
|
+
declare function injectToggleGroupState<T = string>(options?: StateInjectionOptions): Signal<NgpToggleGroupState<T>>;
|
|
252
266
|
|
|
253
267
|
export { NgpToggleGroup, NgpToggleGroupItem, injectToggleGroupItemState, injectToggleGroupState, ngpToggleGroup, ngpToggleGroupItem, provideToggleGroupConfig, provideToggleGroupItemState, provideToggleGroupState };
|
|
254
268
|
export type { NgpToggleGroupConfig, NgpToggleGroupItemProps, NgpToggleGroupItemState, NgpToggleGroupProps, NgpToggleGroupState };
|