@hyalo/angular 0.0.0-stage → 0.1.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/CHANGELOG.md +41 -0
- package/LICENSE +21 -0
- package/README.md +32 -3
- package/fesm2022/hyalo-angular-accordion.mjs +230 -0
- package/fesm2022/hyalo-angular-accordion.mjs.map +1 -0
- package/fesm2022/hyalo-angular-button.mjs +203 -0
- package/fesm2022/hyalo-angular-button.mjs.map +1 -0
- package/fesm2022/hyalo-angular-card.mjs +221 -0
- package/fesm2022/hyalo-angular-card.mjs.map +1 -0
- package/fesm2022/hyalo-angular-choice.mjs +788 -0
- package/fesm2022/hyalo-angular-choice.mjs.map +1 -0
- package/fesm2022/hyalo-angular-dialog.mjs +571 -0
- package/fesm2022/hyalo-angular-dialog.mjs.map +1 -0
- package/fesm2022/hyalo-angular-field.mjs +312 -0
- package/fesm2022/hyalo-angular-field.mjs.map +1 -0
- package/fesm2022/hyalo-angular-icon.mjs +343 -0
- package/fesm2022/hyalo-angular-icon.mjs.map +1 -0
- package/fesm2022/hyalo-angular-interaction.mjs +455 -0
- package/fesm2022/hyalo-angular-interaction.mjs.map +1 -0
- package/fesm2022/hyalo-angular-navbar.mjs +343 -0
- package/fesm2022/hyalo-angular-navbar.mjs.map +1 -0
- package/fesm2022/hyalo-angular-overlay.mjs +94 -0
- package/fesm2022/hyalo-angular-overlay.mjs.map +1 -0
- package/fesm2022/hyalo-angular-popover-overlay-kit-6wPwnxln.mjs +3 -0
- package/fesm2022/hyalo-angular-popover.mjs +487 -0
- package/fesm2022/hyalo-angular-popover.mjs.map +1 -0
- package/fesm2022/hyalo-angular-segmented.mjs +223 -0
- package/fesm2022/hyalo-angular-segmented.mjs.map +1 -0
- package/fesm2022/hyalo-angular-select.mjs +464 -0
- package/fesm2022/hyalo-angular-select.mjs.map +1 -0
- package/fesm2022/hyalo-angular-tabs.mjs +324 -0
- package/fesm2022/hyalo-angular-tabs.mjs.map +1 -0
- package/fesm2022/hyalo-angular-theme.mjs +94 -0
- package/fesm2022/hyalo-angular-theme.mjs.map +1 -0
- package/fesm2022/hyalo-angular-toast.mjs +322 -0
- package/fesm2022/hyalo-angular-toast.mjs.map +1 -0
- package/fesm2022/hyalo-angular.mjs +473 -0
- package/fesm2022/hyalo-angular.mjs.map +1 -0
- package/package.json +133 -3
- package/styles/hyalo-core.css +25 -0
- package/styles/hyalo.css +17 -0
- package/styles/overlays/dialog.css +9 -0
- package/styles/overlays/popover.css +9 -0
- package/styles/overlays/select.css +9 -0
- package/styles/overlays/toast.css +8 -0
- package/styles/palettes/aurora.css +47 -0
- package/styles/palettes/ember.css +47 -0
- package/styles/palettes/graphite.css +47 -0
- package/styles/palettes/ocean.css +47 -0
- package/styles/palettes/orchid.css +47 -0
- package/styles/palettes/rose.css +47 -0
- package/styles/parts/card.css +49 -0
- package/styles/parts/dialog.css +116 -0
- package/styles/parts/drawer.css +124 -0
- package/styles/parts/field.css +36 -0
- package/styles/parts/glass.css +137 -0
- package/styles/parts/motion.css +82 -0
- package/styles/parts/navbar.css +55 -0
- package/styles/parts/popover.css +27 -0
- package/styles/parts/presence.css +55 -0
- package/styles/parts/reset.css +42 -0
- package/styles/parts/select.css +46 -0
- package/styles/parts/themes.css +105 -0
- package/styles/parts/toast.css +128 -0
- package/styles/parts/tokens.css +151 -0
- package/styles/parts/typography.css +64 -0
- package/types/hyalo-angular-accordion.d.ts +74 -0
- package/types/hyalo-angular-button.d.ts +88 -0
- package/types/hyalo-angular-card.d.ts +61 -0
- package/types/hyalo-angular-choice.d.ts +259 -0
- package/types/hyalo-angular-dialog.d.ts +170 -0
- package/types/hyalo-angular-field.d.ts +135 -0
- package/types/hyalo-angular-icon.d.ts +122 -0
- package/types/hyalo-angular-interaction.d.ts +131 -0
- package/types/hyalo-angular-navbar.d.ts +110 -0
- package/types/hyalo-angular-overlay.d.ts +31 -0
- package/types/hyalo-angular-popover.d.ts +142 -0
- package/types/hyalo-angular-segmented.d.ts +79 -0
- package/types/hyalo-angular-select.d.ts +130 -0
- package/types/hyalo-angular-tabs.d.ts +102 -0
- package/types/hyalo-angular-theme.d.ts +46 -0
- package/types/hyalo-angular-toast.d.ts +79 -0
- package/types/hyalo-angular.d.ts +345 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { FormCheckboxControl, FormValueControl } from "@angular/forms/signals";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* A checkbox with a label. It wraps a real `<input type="checkbox">`, so
|
|
5
|
+
* Space toggles it, clicking the label works and forms see it.
|
|
6
|
+
*
|
|
7
|
+
* ```html
|
|
8
|
+
* <hy-checkbox [formField]="form.terms">I accept the terms</hy-checkbox>
|
|
9
|
+
* <hy-checkbox [(checked)]="all" [indeterminate]="some">Select all</hy-checkbox>
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare class HyCheckbox implements FormCheckboxControl {
|
|
13
|
+
protected readonly descriptionId: string;
|
|
14
|
+
/** Whether the box is checked. Two-way bindable and works with `[formField]`. */
|
|
15
|
+
readonly checked: import("@angular/core").ModelSignal<boolean>;
|
|
16
|
+
/** Shows a dash for a partly selected group. Cleared when the user toggles. */
|
|
17
|
+
readonly indeterminate: import("@angular/core").ModelSignal<boolean>;
|
|
18
|
+
/** Secondary text under the label. */
|
|
19
|
+
readonly description: import("@angular/core").InputSignal<string | undefined>;
|
|
20
|
+
readonly name: import("@angular/core").InputSignal<string>;
|
|
21
|
+
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
22
|
+
readonly required: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
23
|
+
readonly invalid: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
24
|
+
readonly touched: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
25
|
+
/** Emits when focus leaves the checkbox. */
|
|
26
|
+
readonly touch: import("@angular/core").OutputEmitterRef<void>;
|
|
27
|
+
protected onChange(event: Event): void;
|
|
28
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyCheckbox, never>;
|
|
29
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<HyCheckbox, "hy-checkbox", never, {
|
|
30
|
+
"checked": {
|
|
31
|
+
"alias": "checked";
|
|
32
|
+
"required": false;
|
|
33
|
+
"isSignal": true;
|
|
34
|
+
};
|
|
35
|
+
"indeterminate": {
|
|
36
|
+
"alias": "indeterminate";
|
|
37
|
+
"required": false;
|
|
38
|
+
"isSignal": true;
|
|
39
|
+
};
|
|
40
|
+
"description": {
|
|
41
|
+
"alias": "description";
|
|
42
|
+
"required": false;
|
|
43
|
+
"isSignal": true;
|
|
44
|
+
};
|
|
45
|
+
"name": {
|
|
46
|
+
"alias": "name";
|
|
47
|
+
"required": false;
|
|
48
|
+
"isSignal": true;
|
|
49
|
+
};
|
|
50
|
+
"disabled": {
|
|
51
|
+
"alias": "disabled";
|
|
52
|
+
"required": false;
|
|
53
|
+
"isSignal": true;
|
|
54
|
+
};
|
|
55
|
+
"required": {
|
|
56
|
+
"alias": "required";
|
|
57
|
+
"required": false;
|
|
58
|
+
"isSignal": true;
|
|
59
|
+
};
|
|
60
|
+
"invalid": {
|
|
61
|
+
"alias": "invalid";
|
|
62
|
+
"required": false;
|
|
63
|
+
"isSignal": true;
|
|
64
|
+
};
|
|
65
|
+
"touched": {
|
|
66
|
+
"alias": "touched";
|
|
67
|
+
"required": false;
|
|
68
|
+
"isSignal": true;
|
|
69
|
+
};
|
|
70
|
+
}, {
|
|
71
|
+
"checked": "checkedChange";
|
|
72
|
+
"indeterminate": "indeterminateChange";
|
|
73
|
+
"touch": "touch";
|
|
74
|
+
}, never, ["*"], true, never>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A group of radio buttons. Holds the value; the radios inside only say
|
|
78
|
+
* which value they stand for.
|
|
79
|
+
*
|
|
80
|
+
* ```html
|
|
81
|
+
* <hy-radio-group label="Delivery" [formField]="form.delivery">
|
|
82
|
+
* <hy-radio value="standard" description="3 to 5 days">Standard</hy-radio>
|
|
83
|
+
* <hy-radio value="express">Express</hy-radio>
|
|
84
|
+
* </hy-radio-group>
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* The radios are native inputs sharing one name, so arrow keys move the
|
|
88
|
+
* selection the way the platform does, including in RTL.
|
|
89
|
+
*/
|
|
90
|
+
export declare class HyRadioGroup<T> implements FormValueControl<T | undefined> {
|
|
91
|
+
protected readonly labelId: string;
|
|
92
|
+
private readonly generatedName;
|
|
93
|
+
/** Selected value. Two-way bindable and works with `[formField]`. */
|
|
94
|
+
readonly value: import("@angular/core").ModelSignal<T | undefined>;
|
|
95
|
+
/** Visible group label. */
|
|
96
|
+
readonly label: import("@angular/core").InputSignal<string | undefined>;
|
|
97
|
+
/** Shared input name. Generated when not set. */
|
|
98
|
+
readonly name: import("@angular/core").InputSignal<string>;
|
|
99
|
+
readonly orientation: import("@angular/core").InputSignal<"vertical" | "horizontal">;
|
|
100
|
+
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
101
|
+
readonly required: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
102
|
+
readonly invalid: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
103
|
+
readonly touched: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
104
|
+
readonly errors: import("@angular/core").InputSignal<readonly {
|
|
105
|
+
readonly kind: string;
|
|
106
|
+
readonly message?: string;
|
|
107
|
+
}[]>;
|
|
108
|
+
/** Emits when focus leaves a radio. */
|
|
109
|
+
readonly touch: import("@angular/core").OutputEmitterRef<void>;
|
|
110
|
+
readonly groupName: import("@angular/core").Signal<string>;
|
|
111
|
+
protected readonly showsError: import("@angular/core").Signal<boolean>;
|
|
112
|
+
protected readonly errorMessage: import("@angular/core").Signal<string>;
|
|
113
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyRadioGroup<any>, never>;
|
|
114
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<HyRadioGroup<any>, "hy-radio-group", never, {
|
|
115
|
+
"value": {
|
|
116
|
+
"alias": "value";
|
|
117
|
+
"required": false;
|
|
118
|
+
"isSignal": true;
|
|
119
|
+
};
|
|
120
|
+
"label": {
|
|
121
|
+
"alias": "label";
|
|
122
|
+
"required": false;
|
|
123
|
+
"isSignal": true;
|
|
124
|
+
};
|
|
125
|
+
"name": {
|
|
126
|
+
"alias": "name";
|
|
127
|
+
"required": false;
|
|
128
|
+
"isSignal": true;
|
|
129
|
+
};
|
|
130
|
+
"orientation": {
|
|
131
|
+
"alias": "orientation";
|
|
132
|
+
"required": false;
|
|
133
|
+
"isSignal": true;
|
|
134
|
+
};
|
|
135
|
+
"disabled": {
|
|
136
|
+
"alias": "disabled";
|
|
137
|
+
"required": false;
|
|
138
|
+
"isSignal": true;
|
|
139
|
+
};
|
|
140
|
+
"required": {
|
|
141
|
+
"alias": "required";
|
|
142
|
+
"required": false;
|
|
143
|
+
"isSignal": true;
|
|
144
|
+
};
|
|
145
|
+
"invalid": {
|
|
146
|
+
"alias": "invalid";
|
|
147
|
+
"required": false;
|
|
148
|
+
"isSignal": true;
|
|
149
|
+
};
|
|
150
|
+
"touched": {
|
|
151
|
+
"alias": "touched";
|
|
152
|
+
"required": false;
|
|
153
|
+
"isSignal": true;
|
|
154
|
+
};
|
|
155
|
+
"errors": {
|
|
156
|
+
"alias": "errors";
|
|
157
|
+
"required": false;
|
|
158
|
+
"isSignal": true;
|
|
159
|
+
};
|
|
160
|
+
}, {
|
|
161
|
+
"value": "valueChange";
|
|
162
|
+
"touch": "touch";
|
|
163
|
+
}, never, ["*"], true, never>;
|
|
164
|
+
}
|
|
165
|
+
/** One option inside a `hy-radio-group`. */
|
|
166
|
+
export declare class HyRadio<T> {
|
|
167
|
+
protected readonly group: HyRadioGroup<T>;
|
|
168
|
+
protected readonly descriptionId: string;
|
|
169
|
+
/** The value this radio selects. */
|
|
170
|
+
readonly value: import("@angular/core").InputSignal<T>;
|
|
171
|
+
/** Secondary text under the label. */
|
|
172
|
+
readonly description: import("@angular/core").InputSignal<string | undefined>;
|
|
173
|
+
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
174
|
+
protected readonly checked: import("@angular/core").Signal<boolean>;
|
|
175
|
+
protected readonly isDisabled: import("@angular/core").Signal<boolean>;
|
|
176
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyRadio<any>, never>;
|
|
177
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<HyRadio<any>, "hy-radio", never, {
|
|
178
|
+
"value": {
|
|
179
|
+
"alias": "value";
|
|
180
|
+
"required": true;
|
|
181
|
+
"isSignal": true;
|
|
182
|
+
};
|
|
183
|
+
"description": {
|
|
184
|
+
"alias": "description";
|
|
185
|
+
"required": false;
|
|
186
|
+
"isSignal": true;
|
|
187
|
+
};
|
|
188
|
+
"disabled": {
|
|
189
|
+
"alias": "disabled";
|
|
190
|
+
"required": false;
|
|
191
|
+
"isSignal": true;
|
|
192
|
+
};
|
|
193
|
+
}, {}, never, ["*"], true, never>;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* An on/off switch for settings that apply right away. For choices that
|
|
197
|
+
* are submitted with a form, a checkbox is usually clearer.
|
|
198
|
+
*
|
|
199
|
+
* It is a native checkbox with `role="switch"`, so screen readers say
|
|
200
|
+
* "on" and "off" and Space toggles it. The thumb can also be dragged: it
|
|
201
|
+
* follows the pointer, and lands on whichever side it is let go nearer.
|
|
202
|
+
*
|
|
203
|
+
* ```html
|
|
204
|
+
* <hy-switch [(checked)]="notifications">Email notifications</hy-switch>
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
export declare class HySwitch implements FormCheckboxControl {
|
|
208
|
+
protected readonly descriptionId: string;
|
|
209
|
+
/** Physical thumb offset in px while it is dragged, otherwise null. */
|
|
210
|
+
protected readonly drag: import("@angular/core").WritableSignal<number | null>;
|
|
211
|
+
private press;
|
|
212
|
+
/** Where a finished drag landed, until the click it causes is handled. */
|
|
213
|
+
private landed;
|
|
214
|
+
/** Whether the switch is on. Two-way bindable and works with `[formField]`. */
|
|
215
|
+
readonly checked: import("@angular/core").ModelSignal<boolean>;
|
|
216
|
+
/** Secondary text under the label. */
|
|
217
|
+
readonly description: import("@angular/core").InputSignal<string | undefined>;
|
|
218
|
+
readonly name: import("@angular/core").InputSignal<string>;
|
|
219
|
+
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
220
|
+
readonly required: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
221
|
+
/** Emits when focus leaves the switch. */
|
|
222
|
+
readonly touch: import("@angular/core").OutputEmitterRef<void>;
|
|
223
|
+
protected onChange(event: Event): void;
|
|
224
|
+
protected onDown(event: PointerEvent): void;
|
|
225
|
+
protected onMove(event: PointerEvent): void;
|
|
226
|
+
protected onUp(cancelled?: boolean): void;
|
|
227
|
+
protected onClick(event: MouseEvent): void;
|
|
228
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HySwitch, never>;
|
|
229
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<HySwitch, "hy-switch", never, {
|
|
230
|
+
"checked": {
|
|
231
|
+
"alias": "checked";
|
|
232
|
+
"required": false;
|
|
233
|
+
"isSignal": true;
|
|
234
|
+
};
|
|
235
|
+
"description": {
|
|
236
|
+
"alias": "description";
|
|
237
|
+
"required": false;
|
|
238
|
+
"isSignal": true;
|
|
239
|
+
};
|
|
240
|
+
"name": {
|
|
241
|
+
"alias": "name";
|
|
242
|
+
"required": false;
|
|
243
|
+
"isSignal": true;
|
|
244
|
+
};
|
|
245
|
+
"disabled": {
|
|
246
|
+
"alias": "disabled";
|
|
247
|
+
"required": false;
|
|
248
|
+
"isSignal": true;
|
|
249
|
+
};
|
|
250
|
+
"required": {
|
|
251
|
+
"alias": "required";
|
|
252
|
+
"required": false;
|
|
253
|
+
"isSignal": true;
|
|
254
|
+
};
|
|
255
|
+
}, {
|
|
256
|
+
"checked": "checkedChange";
|
|
257
|
+
"touch": "touch";
|
|
258
|
+
}, never, ["*"], true, never>;
|
|
259
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { DialogConfig, DialogRef } from "@angular/cdk/dialog";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { InjectionToken, TemplateRef } from "@angular/core";
|
|
4
|
+
import { ComponentType } from "@angular/cdk/portal";
|
|
5
|
+
import { HyMaterial, HyTone } from "@hyalo/angular";
|
|
6
|
+
import "@angular/cdk/overlay";
|
|
7
|
+
/** Data passed to a dialog or drawer through `open(..., { data })`. */
|
|
8
|
+
export declare const HY_DIALOG_DATA: InjectionToken<unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* Handle to an open dialog or drawer. Inject it in the content component to
|
|
11
|
+
* close it, or keep the one `open()` returns.
|
|
12
|
+
*/
|
|
13
|
+
export declare class HyDialogRef<R = unknown> {
|
|
14
|
+
private readonly cdkRef;
|
|
15
|
+
private closing;
|
|
16
|
+
/** Resolves with the result once the surface has closed. */
|
|
17
|
+
readonly closed: Promise<R | undefined>;
|
|
18
|
+
/**
|
|
19
|
+
* @internal Set by surfaces that drive their own exit, like a sheet on a
|
|
20
|
+
* spring. Calls `finish` once the surface is out of view.
|
|
21
|
+
*/
|
|
22
|
+
exit: ((finish: () => void) => void) | null;
|
|
23
|
+
/** @internal */
|
|
24
|
+
constructor(cdkRef: DialogRef<R>);
|
|
25
|
+
/** Id of the dialog container element. */
|
|
26
|
+
get id(): string;
|
|
27
|
+
/** The element with `role="dialog"`. */
|
|
28
|
+
get containerElement(): HTMLElement | null;
|
|
29
|
+
/**
|
|
30
|
+
* Plays the exit animation, then closes. With reduced motion the exit is
|
|
31
|
+
* a short fade. Calling it again while the animation runs does nothing.
|
|
32
|
+
*/
|
|
33
|
+
close(result?: R): void;
|
|
34
|
+
/**
|
|
35
|
+
* @internal A sheet grabbed while it was closing stays open, and a later
|
|
36
|
+
* `close()` works again.
|
|
37
|
+
*/
|
|
38
|
+
cancelClose(): void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The dialog or drawer heading. Its id becomes the container's
|
|
42
|
+
* `aria-labelledby`, so screen readers announce it on open.
|
|
43
|
+
*/
|
|
44
|
+
export declare class HyDialogTitle {
|
|
45
|
+
protected readonly id: string;
|
|
46
|
+
constructor();
|
|
47
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyDialogTitle, never>;
|
|
48
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HyDialogTitle, "[hyDialogTitle]", never, {}, {}, never, never, true, never>;
|
|
49
|
+
}
|
|
50
|
+
/** The scrollable body. */
|
|
51
|
+
export declare class HyDialogContent {
|
|
52
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyDialogContent, never>;
|
|
53
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HyDialogContent, "[hyDialogContent]", never, {}, {}, never, never, true, never>;
|
|
54
|
+
}
|
|
55
|
+
/** The button row at the bottom. Primary action goes last. */
|
|
56
|
+
export declare class HyDialogActions {
|
|
57
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyDialogActions, never>;
|
|
58
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HyDialogActions, "[hyDialogActions]", never, {}, {}, never, never, true, never>;
|
|
59
|
+
}
|
|
60
|
+
/** Closes the surrounding dialog or drawer with an optional result. */
|
|
61
|
+
export declare class HyDialogClose {
|
|
62
|
+
protected readonly ref: HyDialogRef<any> | null;
|
|
63
|
+
/** The result to close with. A bare attribute closes with `undefined`. */
|
|
64
|
+
readonly hyDialogClose: import("@angular/core").InputSignalWithTransform<unknown, unknown>;
|
|
65
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyDialogClose, never>;
|
|
66
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HyDialogClose, "button[hyDialogClose]", never, {
|
|
67
|
+
"hyDialogClose": {
|
|
68
|
+
"alias": "hyDialogClose";
|
|
69
|
+
"required": false;
|
|
70
|
+
"isSignal": true;
|
|
71
|
+
};
|
|
72
|
+
}, {}, never, never, true, never>;
|
|
73
|
+
}
|
|
74
|
+
/** Everything needed to lay out dialog or drawer content. */
|
|
75
|
+
export declare const HY_DIALOG_PARTS: readonly [typeof HyDialogTitle, typeof HyDialogContent, typeof HyDialogActions, typeof HyDialogClose];
|
|
76
|
+
/**
|
|
77
|
+
* Which edge the drawer slides from. `start` and `end` follow the text
|
|
78
|
+
* direction, so `end` is the right edge in LTR and the left edge in RTL.
|
|
79
|
+
* `bottom` gives a sheet, handy on phones.
|
|
80
|
+
*/
|
|
81
|
+
export type HyDrawerSide = 'start' | 'end' | 'bottom';
|
|
82
|
+
/** Options for {@link HyDrawer.open}. */
|
|
83
|
+
export interface HyDrawerConfig<D = unknown> extends HySurfaceConfig<D> {
|
|
84
|
+
readonly side?: HyDrawerSide;
|
|
85
|
+
/** Any CSS length. Width for side drawers, height for the bottom sheet. */
|
|
86
|
+
readonly size?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Opens a modal drawer: navigation on phones, a cart, filters. It behaves
|
|
90
|
+
* like a dialog (focus trap, Escape, backdrop, focus restore) and uses the
|
|
91
|
+
* same content parts and `HyDialogRef`.
|
|
92
|
+
*
|
|
93
|
+
* It runs on a spring and follows the pointer: drag it toward its edge, or
|
|
94
|
+
* flick it, to close it, and grab it again while it moves. A bottom sheet
|
|
95
|
+
* shows a grabber. With reduced motion it cross-fades instead.
|
|
96
|
+
*
|
|
97
|
+
* ```ts
|
|
98
|
+
* this.drawer.open(CartPanel, { side: 'end', label: 'Cart' });
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export declare class HyDrawer {
|
|
102
|
+
private readonly cdk;
|
|
103
|
+
private readonly motion;
|
|
104
|
+
private readonly fidelity;
|
|
105
|
+
private readonly injector;
|
|
106
|
+
/** Opens a component or template in a drawer. */
|
|
107
|
+
open<R = unknown, D = unknown>(content: ComponentType<unknown> | TemplateRef<unknown>, config?: HyDrawerConfig<D>): HyDialogRef<R>;
|
|
108
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyDrawer, never>;
|
|
109
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
110
|
+
}
|
|
111
|
+
/** Options shared by dialogs and drawers. */
|
|
112
|
+
interface HySurfaceConfig<D> {
|
|
113
|
+
/** Passed to the content as `HY_DIALOG_DATA`. */
|
|
114
|
+
readonly data?: D;
|
|
115
|
+
/** Accessible name, when the content has no `hyDialogTitle`. */
|
|
116
|
+
readonly label?: string;
|
|
117
|
+
/** Close on Escape and backdrop click. Defaults to true. */
|
|
118
|
+
readonly dismissible?: boolean;
|
|
119
|
+
/** Glass material of the panel. */
|
|
120
|
+
readonly material?: HyMaterial;
|
|
121
|
+
/** Where focus goes on open. Defaults to the first tabbable element. */
|
|
122
|
+
readonly autoFocus?: DialogConfig['autoFocus'];
|
|
123
|
+
/** `alertdialog` for messages that need an answer. */
|
|
124
|
+
readonly role?: 'dialog' | 'alertdialog';
|
|
125
|
+
}
|
|
126
|
+
/** Dialog width. `full` fills the screen on small viewports. */
|
|
127
|
+
export type HyDialogSize = 'sm' | 'md' | 'lg' | 'full';
|
|
128
|
+
/** Options for {@link HyDialog.open}. */
|
|
129
|
+
export interface HyDialogConfig<D = unknown> extends HySurfaceConfig<D> {
|
|
130
|
+
readonly size?: HyDialogSize;
|
|
131
|
+
}
|
|
132
|
+
/** Options for {@link HyDialog.confirm}. */
|
|
133
|
+
export interface HyConfirmOptions {
|
|
134
|
+
readonly title: string;
|
|
135
|
+
readonly message?: string;
|
|
136
|
+
readonly confirmLabel?: string;
|
|
137
|
+
readonly cancelLabel?: string;
|
|
138
|
+
/** Use `danger` for destructive actions. */
|
|
139
|
+
readonly tone?: HyTone;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Opens modal dialogs. Focus is trapped inside while open and returns to
|
|
143
|
+
* the element that opened it. Escape and a backdrop click close it unless
|
|
144
|
+
* `dismissible` is false.
|
|
145
|
+
*
|
|
146
|
+
* ```ts
|
|
147
|
+
* const ref = this.dialog.open(EditAddress, { data: address, size: 'md' });
|
|
148
|
+
* const saved = await ref.closed;
|
|
149
|
+
*
|
|
150
|
+
* if (await this.dialog.confirm({ title: 'Delete this draft?', tone: 'danger', confirmLabel: 'Delete' })) {
|
|
151
|
+
* ...
|
|
152
|
+
* }
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* In the content component, inject `HyDialogRef` to close and
|
|
156
|
+
* `HY_DIALOG_DATA` to read the data. Lay it out with `hyDialogTitle`,
|
|
157
|
+
* `hyDialogContent` and `hyDialogActions`.
|
|
158
|
+
*/
|
|
159
|
+
export declare class HyDialog {
|
|
160
|
+
private readonly cdk;
|
|
161
|
+
private readonly motion;
|
|
162
|
+
private readonly fidelity;
|
|
163
|
+
/** Opens a component or template as a dialog. */
|
|
164
|
+
open<R = unknown, D = unknown>(content: ComponentType<unknown> | TemplateRef<unknown>, config?: HyDialogConfig<D>): HyDialogRef<R>;
|
|
165
|
+
/** Asks a yes or no question. Resolves to true only when confirmed. */
|
|
166
|
+
confirm(options: HyConfirmOptions): Promise<boolean>;
|
|
167
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyDialog, never>;
|
|
168
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
169
|
+
}
|
|
170
|
+
export type { HySurfaceConfig };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { InjectionToken, Signal } from "@angular/core";
|
|
3
|
+
import { HySize } from "@hyalo/angular";
|
|
4
|
+
/**
|
|
5
|
+
* What a control tells the field around it. Implemented by `hyInput` and
|
|
6
|
+
* `hy-select`. Custom controls can implement it too, so `hy-field` can
|
|
7
|
+
* label them and show their errors.
|
|
8
|
+
*/
|
|
9
|
+
export interface HyFieldControl {
|
|
10
|
+
/** Id of the focusable element. */
|
|
11
|
+
readonly id: Signal<string>;
|
|
12
|
+
/** True when the field should show as invalid. */
|
|
13
|
+
readonly invalid: Signal<boolean>;
|
|
14
|
+
/** First error message to show, if any. */
|
|
15
|
+
readonly errorMessage: Signal<string | undefined>;
|
|
16
|
+
readonly required: Signal<boolean>;
|
|
17
|
+
readonly disabled: Signal<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* True when the control is a native labelable element (input, textarea,
|
|
20
|
+
* select, button). Those get `<label for>`. Others rely on
|
|
21
|
+
* `aria-labelledby`.
|
|
22
|
+
*/
|
|
23
|
+
readonly labelable: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** The field a control sits in. */
|
|
26
|
+
export interface HyFieldContext {
|
|
27
|
+
readonly labelId: string;
|
|
28
|
+
readonly hintId: string;
|
|
29
|
+
readonly errorId: string;
|
|
30
|
+
/** True while the field displays an error. */
|
|
31
|
+
readonly errorShown: Signal<boolean>;
|
|
32
|
+
/** Space-separated ids for `aria-describedby`. */
|
|
33
|
+
readonly describedBy: Signal<string | null>;
|
|
34
|
+
register(control: HyFieldControl): void;
|
|
35
|
+
}
|
|
36
|
+
/** Provided by `hy-field` to the control inside it. */
|
|
37
|
+
export declare const HY_FIELD: InjectionToken<HyFieldContext>;
|
|
38
|
+
/**
|
|
39
|
+
* Marks a native `<input>` or `<textarea>` as the control of a `hy-field`.
|
|
40
|
+
* It wires the label, hint and error ids, and reads validity from Signal
|
|
41
|
+
* Forms when `[formField]` is on the same element.
|
|
42
|
+
*
|
|
43
|
+
* The element stays native, so Signal Forms, `ngModel`, autofill and
|
|
44
|
+
* mobile keyboards all work as usual.
|
|
45
|
+
*/
|
|
46
|
+
export declare class HyInput implements HyFieldControl {
|
|
47
|
+
protected readonly field: import("@hyalo/angular/field").HyFieldContext | null;
|
|
48
|
+
private readonly formField;
|
|
49
|
+
readonly labelable = true;
|
|
50
|
+
/** The element's own static `id` attribute, or a generated one. */
|
|
51
|
+
readonly id: import("@angular/core").Signal<string>;
|
|
52
|
+
readonly invalid: import("@angular/core").Signal<boolean>;
|
|
53
|
+
readonly errorMessage: import("@angular/core").Signal<string | undefined>;
|
|
54
|
+
protected readonly showsError: import("@angular/core").Signal<boolean>;
|
|
55
|
+
readonly required: import("@angular/core").Signal<boolean>;
|
|
56
|
+
readonly disabled: import("@angular/core").Signal<boolean>;
|
|
57
|
+
constructor();
|
|
58
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyInput, never>;
|
|
59
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HyInput, "input[hyInput], textarea[hyInput]", never, {}, {}, never, never, true, never>;
|
|
60
|
+
}
|
|
61
|
+
/** Content before the control inside the field box, such as an icon. */
|
|
62
|
+
export declare class HyPrefix {
|
|
63
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyPrefix, never>;
|
|
64
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HyPrefix, "[hyPrefix]", never, {}, {}, never, never, true, never>;
|
|
65
|
+
}
|
|
66
|
+
/** Content after the control inside the field box, such as a unit or a button. */
|
|
67
|
+
export declare class HySuffix {
|
|
68
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HySuffix, never>;
|
|
69
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HySuffix, "[hySuffix]", never, {}, {}, never, never, true, never>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Label, hint and error around one form control.
|
|
73
|
+
*
|
|
74
|
+
* ```html
|
|
75
|
+
* <hy-field label="Email" hint="Only used for the receipt">
|
|
76
|
+
* <hy-icon hyPrefix name="mail" />
|
|
77
|
+
* <input hyInput type="email" [formField]="form.email" />
|
|
78
|
+
* </hy-field>
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* With Signal Forms the error comes from the field state and shows once the
|
|
82
|
+
* field is touched. An explicit `error` input always wins, which is how
|
|
83
|
+
* server-side errors are shown.
|
|
84
|
+
*/
|
|
85
|
+
export declare class HyField implements HyFieldContext {
|
|
86
|
+
readonly labelId: string;
|
|
87
|
+
readonly hintId: string;
|
|
88
|
+
readonly errorId: string;
|
|
89
|
+
/** Visible label. Always set one, placeholders are not labels. */
|
|
90
|
+
readonly label: import("@angular/core").InputSignal<string | undefined>;
|
|
91
|
+
/** Help text under the control. Hidden while an error shows. */
|
|
92
|
+
readonly hint: import("@angular/core").InputSignal<string | undefined>;
|
|
93
|
+
/** Error text. Overrides errors from the form. */
|
|
94
|
+
readonly error: import("@angular/core").InputSignal<string | undefined>;
|
|
95
|
+
/** Show errors before the field is touched, for example after submit. */
|
|
96
|
+
readonly forceError: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
97
|
+
/** Height of the field box. */
|
|
98
|
+
readonly size: import("@angular/core").InputSignal<HySize>;
|
|
99
|
+
protected readonly control: import("@angular/core").WritableSignal<HyFieldControl | undefined>;
|
|
100
|
+
protected readonly labelFor: import("@angular/core").Signal<string | null>;
|
|
101
|
+
protected readonly errorText: import("@angular/core").Signal<string | undefined>;
|
|
102
|
+
readonly errorShown: import("@angular/core").Signal<boolean>;
|
|
103
|
+
readonly describedBy: import("@angular/core").Signal<string | null>;
|
|
104
|
+
register(control: HyFieldControl): void;
|
|
105
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyField, never>;
|
|
106
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<HyField, "hy-field", never, {
|
|
107
|
+
"label": {
|
|
108
|
+
"alias": "label";
|
|
109
|
+
"required": false;
|
|
110
|
+
"isSignal": true;
|
|
111
|
+
};
|
|
112
|
+
"hint": {
|
|
113
|
+
"alias": "hint";
|
|
114
|
+
"required": false;
|
|
115
|
+
"isSignal": true;
|
|
116
|
+
};
|
|
117
|
+
"error": {
|
|
118
|
+
"alias": "error";
|
|
119
|
+
"required": false;
|
|
120
|
+
"isSignal": true;
|
|
121
|
+
};
|
|
122
|
+
"forceError": {
|
|
123
|
+
"alias": "forceError";
|
|
124
|
+
"required": false;
|
|
125
|
+
"isSignal": true;
|
|
126
|
+
};
|
|
127
|
+
"size": {
|
|
128
|
+
"alias": "size";
|
|
129
|
+
"required": false;
|
|
130
|
+
"isSignal": true;
|
|
131
|
+
};
|
|
132
|
+
}, {}, never, ["[hyPrefix]", "*", "[hySuffix]"], true, never>;
|
|
133
|
+
}
|
|
134
|
+
/** Everything needed to build a text field. */
|
|
135
|
+
export declare const HY_TEXT_FIELD: readonly [typeof HyField, typeof HyInput, typeof HyPrefix, typeof HySuffix];
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { InjectionToken, Provider } from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Icon data in the same shape Lucide uses (`IconNode`), so any Lucide icon
|
|
5
|
+
* can be registered as is:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { ArrowRight } from 'lucide';
|
|
9
|
+
* provideHyaloIcons({ 'arrow-right': ArrowRight })
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Icons are data, not SVG strings, so nothing is ever parsed as HTML.
|
|
13
|
+
*/
|
|
14
|
+
export type HyIconNode = readonly (readonly [string, Readonly<Record<string, string | number>>])[];
|
|
15
|
+
/** An icon plus how it behaves in right-to-left layouts. */
|
|
16
|
+
export interface HyIconDef {
|
|
17
|
+
readonly node: HyIconNode;
|
|
18
|
+
/** Mirror the icon in RTL. Set it for icons that point somewhere, like arrows. */
|
|
19
|
+
readonly mirrorRtl?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const HY_BUILTIN_ICONS: Readonly<Record<string, HyIconDef>>;
|
|
22
|
+
type HyIconSet = Readonly<Record<string, HyIconDef | HyIconNode>>;
|
|
23
|
+
/** Icons added with {@link provideHyaloIcons}. Collected from every provider. */
|
|
24
|
+
export declare const HY_ICONS: InjectionToken<readonly Readonly<Record<string, HyIconDef | HyIconNode>>[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Registers icons by name. Only the icons you import end up in the bundle.
|
|
27
|
+
*
|
|
28
|
+
* ```ts
|
|
29
|
+
* provideHyaloIcons({ search: Search, 'arrow-end': { node: ArrowRight, mirrorRtl: true } })
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* Works in `app.config.ts` and in a route's or component's `providers`.
|
|
33
|
+
* Icons from the nearest provider win over app-wide ones.
|
|
34
|
+
*/
|
|
35
|
+
export declare function provideHyaloIcons(icons: Readonly<Record<string, HyIconDef | HyIconNode>>): Provider;
|
|
36
|
+
/** Looks up icons by name: built-ins first, then registered sets in order. */
|
|
37
|
+
export declare class HyIconRegistry {
|
|
38
|
+
private readonly icons;
|
|
39
|
+
private readonly sets;
|
|
40
|
+
constructor();
|
|
41
|
+
/** Adds or replaces an icon at runtime. */
|
|
42
|
+
register(name: string, icon: HyIconDef | HyIconNode): void;
|
|
43
|
+
/** Returns the icon, or undefined when the name is unknown. */
|
|
44
|
+
get(name: string): HyIconDef | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* @internal Looks in sets from a route or component injector first. This
|
|
47
|
+
* registry lives in the root injector, so it never sees those itself.
|
|
48
|
+
*/
|
|
49
|
+
lookup(name: string, sets: readonly HyIconSet[] | null): HyIconDef | undefined;
|
|
50
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyIconRegistry, never>;
|
|
51
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
52
|
+
}
|
|
53
|
+
/** Copies whitelisted geometry attributes onto an SVG child element. */
|
|
54
|
+
export declare class HyIconAttrs {
|
|
55
|
+
private readonly el;
|
|
56
|
+
private readonly renderer;
|
|
57
|
+
readonly hyIconAttrs: import("@angular/core").InputSignal<Readonly<Record<string, string | number>>>;
|
|
58
|
+
constructor();
|
|
59
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyIconAttrs, never>;
|
|
60
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HyIconAttrs, "[hyIconAttrs]", never, {
|
|
61
|
+
"hyIconAttrs": {
|
|
62
|
+
"alias": "hyIconAttrs";
|
|
63
|
+
"required": true;
|
|
64
|
+
"isSignal": true;
|
|
65
|
+
};
|
|
66
|
+
}, {}, never, never, true, never>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* An SVG icon from the registry, or passed in directly.
|
|
70
|
+
*
|
|
71
|
+
* ```html
|
|
72
|
+
* <hy-icon name="check" />
|
|
73
|
+
* <hy-icon [icon]="ArrowRight" label="Next" />
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* Icons are decorative (`aria-hidden`) unless `label` is set, in which case
|
|
77
|
+
* they get `role="img"` and that label. The size follows the font size.
|
|
78
|
+
*/
|
|
79
|
+
export declare class HyIcon {
|
|
80
|
+
private readonly registry;
|
|
81
|
+
private readonly sets;
|
|
82
|
+
/** Registered icon name. */
|
|
83
|
+
readonly name: import("@angular/core").InputSignal<string | undefined>;
|
|
84
|
+
/** Icon data, used instead of `name`. */
|
|
85
|
+
readonly icon: import("@angular/core").InputSignal<HyIconDef | HyIconNode | undefined>;
|
|
86
|
+
/** Accessible name. Leave empty for decorative icons. */
|
|
87
|
+
readonly label: import("@angular/core").InputSignal<string | undefined>;
|
|
88
|
+
/** Any CSS length. Defaults to 1.25em. */
|
|
89
|
+
readonly size: import("@angular/core").InputSignal<string | undefined>;
|
|
90
|
+
/** Stroke width in viewBox units. */
|
|
91
|
+
readonly strokeWidth: import("@angular/core").InputSignal<number>;
|
|
92
|
+
protected readonly def: import("@angular/core").Signal<HyIconDef | undefined>;
|
|
93
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyIcon, never>;
|
|
94
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<HyIcon, "hy-icon", never, {
|
|
95
|
+
"name": {
|
|
96
|
+
"alias": "name";
|
|
97
|
+
"required": false;
|
|
98
|
+
"isSignal": true;
|
|
99
|
+
};
|
|
100
|
+
"icon": {
|
|
101
|
+
"alias": "icon";
|
|
102
|
+
"required": false;
|
|
103
|
+
"isSignal": true;
|
|
104
|
+
};
|
|
105
|
+
"label": {
|
|
106
|
+
"alias": "label";
|
|
107
|
+
"required": false;
|
|
108
|
+
"isSignal": true;
|
|
109
|
+
};
|
|
110
|
+
"size": {
|
|
111
|
+
"alias": "size";
|
|
112
|
+
"required": false;
|
|
113
|
+
"isSignal": true;
|
|
114
|
+
};
|
|
115
|
+
"strokeWidth": {
|
|
116
|
+
"alias": "strokeWidth";
|
|
117
|
+
"required": false;
|
|
118
|
+
"isSignal": true;
|
|
119
|
+
};
|
|
120
|
+
}, {}, never, never, true, never>;
|
|
121
|
+
}
|
|
122
|
+
export {};
|