@ckui/core 0.1.0-next.1 → 0.1.0-next.3
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/README.md +337 -4
- package/fesm2022/ckui-core-badge.mjs +169 -0
- package/fesm2022/ckui-core-badge.mjs.map +1 -0
- package/fesm2022/ckui-core-chip.mjs +300 -0
- package/fesm2022/ckui-core-chip.mjs.map +1 -0
- package/fesm2022/ckui-core-dialog.mjs +18 -286
- package/fesm2022/ckui-core-dialog.mjs.map +1 -1
- package/fesm2022/ckui-core-drawer.mjs +342 -0
- package/fesm2022/ckui-core-drawer.mjs.map +1 -0
- package/fesm2022/ckui-core-internal-dialog.mjs +296 -0
- package/fesm2022/ckui-core-internal-dialog.mjs.map +1 -0
- package/fesm2022/ckui-core-internal-overlay.mjs +479 -0
- package/fesm2022/ckui-core-internal-overlay.mjs.map +1 -0
- package/fesm2022/ckui-core-internal.mjs +2 -463
- package/fesm2022/ckui-core-internal.mjs.map +1 -1
- package/fesm2022/ckui-core-progress.mjs +165 -0
- package/fesm2022/ckui-core-progress.mjs.map +1 -0
- package/fesm2022/ckui-core-segmented.mjs +184 -8
- package/fesm2022/ckui-core-segmented.mjs.map +1 -1
- package/fesm2022/ckui-core-stepper.mjs +842 -0
- package/fesm2022/ckui-core-stepper.mjs.map +1 -0
- package/fesm2022/ckui-core-switch.mjs +327 -0
- package/fesm2022/ckui-core-switch.mjs.map +1 -0
- package/fesm2022/ckui-core-tabs.mjs +678 -0
- package/fesm2022/ckui-core-tabs.mjs.map +1 -0
- package/fesm2022/ckui-core.mjs +2 -0
- package/fesm2022/ckui-core.mjs.map +1 -1
- package/package.json +37 -1
- package/types/ckui-core-badge.d.ts +44 -0
- package/types/ckui-core-chip.d.ts +62 -0
- package/types/ckui-core-dialog.d.ts +5 -40
- package/types/ckui-core-drawer.d.ts +153 -0
- package/types/ckui-core-internal-dialog.d.ts +102 -0
- package/types/ckui-core-internal-overlay.d.ts +83 -0
- package/types/ckui-core-internal.d.ts +2 -75
- package/types/ckui-core-progress.d.ts +43 -0
- package/types/ckui-core-segmented.d.ts +26 -0
- package/types/ckui-core-stepper.d.ts +186 -0
- package/types/ckui-core-switch.d.ts +90 -0
- package/types/ckui-core-tabs.d.ts +212 -0
- package/types/ckui-core.d.ts +2 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ComponentType } from "@angular/cdk/portal";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { Injector, TemplateRef } from "@angular/core";
|
|
4
|
+
type CkOverlayMode = 'auto' | 'modal' | 'sheet' | 'side';
|
|
5
|
+
type CkOverlayDismissReason = 'escape' | 'backdrop' | 'swipe';
|
|
6
|
+
interface CkOverlayConfig {
|
|
7
|
+
/**
|
|
8
|
+
* `auto` becomes a sheet when `CkMedia.sheet()` is true at the moment of opening, else a modal;
|
|
9
|
+
* it never becomes `side`. Default `auto`.
|
|
10
|
+
*/
|
|
11
|
+
mode?: CkOverlayMode;
|
|
12
|
+
/** The edge a `side` panel sits on; `end` is the right edge in a left-to-right page. Resolved when opening. Default `end`. */
|
|
13
|
+
side?: 'start' | 'end';
|
|
14
|
+
/** Escape and a click on the backdrop, and for a sheet a swipe down, may close the overlay. Default `true`. */
|
|
15
|
+
dismissible?: boolean;
|
|
16
|
+
/** A sheet as tall as the viewport allows instead of as tall as its content. */
|
|
17
|
+
fullHeight?: boolean;
|
|
18
|
+
panelClass?: string | string[];
|
|
19
|
+
/** Default `dialog`. */
|
|
20
|
+
role?: 'dialog' | 'alertdialog';
|
|
21
|
+
ariaLabel?: string;
|
|
22
|
+
ariaLabelledBy?: string;
|
|
23
|
+
ariaDescribedBy?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Called when the user asks to dismiss (Escape, backdrop, swipe) a dismissible overlay. It is
|
|
26
|
+
* expected to call `handle.close()` straight away; without it the host closes the overlay itself.
|
|
27
|
+
* A sheet that is still open after a swipe snaps back.
|
|
28
|
+
*/
|
|
29
|
+
onDismissRequest?: (reason: CkOverlayDismissReason) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Picks the element that takes focus once the overlay has rendered. Without it, or when it
|
|
32
|
+
* returns `null` or something that cannot take focus, the first tabbable element does.
|
|
33
|
+
*/
|
|
34
|
+
initialFocus?: () => HTMLElement | null;
|
|
35
|
+
}
|
|
36
|
+
interface CkOverlayHandle {
|
|
37
|
+
/** The mode resolved when the overlay opened. */
|
|
38
|
+
readonly mode: 'modal' | 'sheet' | 'side';
|
|
39
|
+
/** The element that carries `role`, `aria-modal` and the labels; set `aria-labelledby` here when the title appears later. */
|
|
40
|
+
readonly panel: HTMLElement;
|
|
41
|
+
/** Resolves once the opening animation and the initial focus are done. */
|
|
42
|
+
readonly opened: Promise<void>;
|
|
43
|
+
/** Resolves once the overlay is detached. */
|
|
44
|
+
readonly closed: Promise<void>;
|
|
45
|
+
/** Animates out, then detaches. Repeated calls return the same promise. */
|
|
46
|
+
close(): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Opens modal dialogs, bottom sheets and side panels on the CDK overlay: backdrop, scroll lock, focus trap and
|
|
50
|
+
* restore, `inert` background, Escape / backdrop / swipe dismissal and the open and close animation.
|
|
51
|
+
*/
|
|
52
|
+
export declare class CkOverlayHost {
|
|
53
|
+
private readonly overlay;
|
|
54
|
+
private readonly overlayContainer;
|
|
55
|
+
private readonly media;
|
|
56
|
+
private readonly inert;
|
|
57
|
+
private readonly focusTraps;
|
|
58
|
+
private readonly injector;
|
|
59
|
+
private readonly document;
|
|
60
|
+
private readonly isBrowser;
|
|
61
|
+
/** Open overlays, topmost last. A closing overlay has already left it. */
|
|
62
|
+
private readonly stack;
|
|
63
|
+
private readonly entries;
|
|
64
|
+
private scrollStrategy;
|
|
65
|
+
private scrollLocks;
|
|
66
|
+
private listening;
|
|
67
|
+
constructor();
|
|
68
|
+
open<C>(content: ComponentType<C> | TemplateRef<unknown>, config?: CkOverlayConfig, injector?: Injector): CkOverlayHandle;
|
|
69
|
+
/** Focus did not return to where it came from (opener disabled, inert or gone): find it a home. */
|
|
70
|
+
private restoreFocus;
|
|
71
|
+
/** Full height, flush against the physical left or right edge. */
|
|
72
|
+
private sidePosition;
|
|
73
|
+
private contentPortal;
|
|
74
|
+
/** What the server gets: nothing is rendered, and the overlay counts as closed. */
|
|
75
|
+
private inertHandle;
|
|
76
|
+
private lockScroll;
|
|
77
|
+
private unlockScroll;
|
|
78
|
+
private listen;
|
|
79
|
+
private readonly onKeydown;
|
|
80
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkOverlayHost, never>;
|
|
81
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
82
|
+
}
|
|
83
|
+
export type { CkOverlayConfig, CkOverlayDismissReason, CkOverlayHandle, CkOverlayMode };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import {
|
|
2
|
+
import { ModelSignal, Provider, Signal, Type } from "@angular/core";
|
|
3
3
|
import { ControlValueAccessor } from "@angular/forms";
|
|
4
4
|
import { FormValueControl } from "@angular/forms/signals";
|
|
5
|
-
import { ComponentType } from "@angular/cdk/portal";
|
|
6
5
|
/** Returns an id that is unique within the running page, e.g. `ck-field-3`. */
|
|
7
6
|
export declare function createCkId(prefix: string): string;
|
|
8
7
|
/** Viewport and user-preference signals. All `false` on the server, where nothing can match. */
|
|
@@ -153,78 +152,6 @@ export declare abstract class CkValueControl<T> implements ControlValueAccessor,
|
|
|
153
152
|
}
|
|
154
153
|
/** Registers the component as a value accessor: `providers: [provideCkValueAccessor(CkSegmented)]`. */
|
|
155
154
|
export declare function provideCkValueAccessor(type: Type<unknown>): Provider;
|
|
156
|
-
type CkOverlayMode = 'auto' | 'modal' | 'sheet';
|
|
157
|
-
type CkOverlayDismissReason = 'escape' | 'backdrop' | 'swipe';
|
|
158
|
-
interface CkOverlayConfig {
|
|
159
|
-
/** `auto` becomes a sheet when `CkMedia.sheet()` is true at the moment of opening. Default `auto`. */
|
|
160
|
-
mode?: CkOverlayMode;
|
|
161
|
-
/** Escape, a click on the backdrop and a swipe down may close the overlay. Default `true`. */
|
|
162
|
-
dismissible?: boolean;
|
|
163
|
-
/** A sheet as tall as the viewport allows instead of as tall as its content. */
|
|
164
|
-
fullHeight?: boolean;
|
|
165
|
-
panelClass?: string | string[];
|
|
166
|
-
/** Default `dialog`. */
|
|
167
|
-
role?: 'dialog' | 'alertdialog';
|
|
168
|
-
ariaLabel?: string;
|
|
169
|
-
ariaLabelledBy?: string;
|
|
170
|
-
ariaDescribedBy?: string;
|
|
171
|
-
/**
|
|
172
|
-
* Called when the user asks to dismiss (Escape, backdrop, swipe) a dismissible overlay. It is
|
|
173
|
-
* expected to call `handle.close()` straight away; without it the host closes the overlay itself.
|
|
174
|
-
* A sheet that is still open after a swipe snaps back.
|
|
175
|
-
*/
|
|
176
|
-
onDismissRequest?: (reason: CkOverlayDismissReason) => void;
|
|
177
|
-
/**
|
|
178
|
-
* Picks the element that takes focus once the overlay has rendered. Without it, or when it
|
|
179
|
-
* returns `null` or something that cannot take focus, the first tabbable element does.
|
|
180
|
-
*/
|
|
181
|
-
initialFocus?: () => HTMLElement | null;
|
|
182
|
-
}
|
|
183
|
-
interface CkOverlayHandle {
|
|
184
|
-
/** The mode resolved when the overlay opened. */
|
|
185
|
-
readonly mode: 'modal' | 'sheet';
|
|
186
|
-
/** The element that carries `role`, `aria-modal` and the labels; set `aria-labelledby` here when the title appears later. */
|
|
187
|
-
readonly panel: HTMLElement;
|
|
188
|
-
/** Resolves once the opening animation and the initial focus are done. */
|
|
189
|
-
readonly opened: Promise<void>;
|
|
190
|
-
/** Resolves once the overlay is detached. */
|
|
191
|
-
readonly closed: Promise<void>;
|
|
192
|
-
/** Animates out, then detaches. Repeated calls return the same promise. */
|
|
193
|
-
close(): Promise<void>;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Opens modal dialogs and bottom sheets on the CDK overlay: backdrop, scroll lock, focus trap and
|
|
197
|
-
* restore, `inert` background, Escape / backdrop / swipe dismissal and the open and close animation.
|
|
198
|
-
*/
|
|
199
|
-
export declare class CkOverlayHost {
|
|
200
|
-
private readonly overlay;
|
|
201
|
-
private readonly overlayContainer;
|
|
202
|
-
private readonly media;
|
|
203
|
-
private readonly inert;
|
|
204
|
-
private readonly focusTraps;
|
|
205
|
-
private readonly injector;
|
|
206
|
-
private readonly document;
|
|
207
|
-
private readonly isBrowser;
|
|
208
|
-
/** Open overlays, topmost last. A closing overlay has already left it. */
|
|
209
|
-
private readonly stack;
|
|
210
|
-
private readonly entries;
|
|
211
|
-
private scrollStrategy;
|
|
212
|
-
private scrollLocks;
|
|
213
|
-
private listening;
|
|
214
|
-
constructor();
|
|
215
|
-
open<C>(content: ComponentType<C> | TemplateRef<unknown>, config?: CkOverlayConfig, injector?: Injector): CkOverlayHandle;
|
|
216
|
-
/** Focus did not return to where it came from (opener disabled, inert or gone): find it a home. */
|
|
217
|
-
private restoreFocus;
|
|
218
|
-
private contentPortal;
|
|
219
|
-
/** What the server gets: nothing is rendered, and the overlay counts as closed. */
|
|
220
|
-
private inertHandle;
|
|
221
|
-
private lockScroll;
|
|
222
|
-
private unlockScroll;
|
|
223
|
-
private listen;
|
|
224
|
-
private readonly onKeydown;
|
|
225
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<CkOverlayHost, never>;
|
|
226
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
227
|
-
}
|
|
228
155
|
interface CkNameSources {
|
|
229
156
|
/** Count `title` as a name. */
|
|
230
157
|
readonly title: boolean;
|
|
@@ -235,4 +162,4 @@ interface CkNameSources {
|
|
|
235
162
|
}
|
|
236
163
|
/** Whether the element has an accessible name: a label attribute, a label reference or readable text. */
|
|
237
164
|
export declare function hasAccessibleName(element: Element, sources: CkNameSources): boolean;
|
|
238
|
-
export type { CkFocusTrap, CkIconName, CkNameSources
|
|
165
|
+
export type { CkFocusTrap, CkIconName, CkNameSources };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
/**
|
|
3
|
+
* A horizontal progress bar. A number `value` fills the track up to `value / max`; `null` (or a
|
|
4
|
+
* value that is not a number) shows an indeterminate bar. It is not a live region: announce
|
|
5
|
+
* milestones yourself.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CkProgress {
|
|
8
|
+
/**
|
|
9
|
+
* The progress, from 0 to `max`. Below 0 counts as 0 and above `max` as `max`. `null`,
|
|
10
|
+
* `undefined` and `NaN` show an indeterminate bar without `aria-valuenow`.
|
|
11
|
+
*/
|
|
12
|
+
readonly value: import("@angular/core").InputSignal<number | null | undefined>;
|
|
13
|
+
/** The value that means done. Anything that is not a number above 0 counts as 100. */
|
|
14
|
+
readonly max: import("@angular/core").InputSignal<number>;
|
|
15
|
+
/** Text for `aria-valuetext`, such as "Step 2 of 7". Without it assistive technology reads the percentage. */
|
|
16
|
+
readonly valueText: import("@angular/core").InputSignal<string | undefined>;
|
|
17
|
+
private readonly element;
|
|
18
|
+
/** @internal */
|
|
19
|
+
protected readonly limit: import("@angular/core").Signal<number>;
|
|
20
|
+
/** The clamped value, or `null` while the bar is indeterminate. */
|
|
21
|
+
protected readonly current: import("@angular/core").Signal<number | null>;
|
|
22
|
+
protected readonly indeterminate: import("@angular/core").Signal<boolean>;
|
|
23
|
+
protected readonly fraction: import("@angular/core").Signal<number>;
|
|
24
|
+
constructor();
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkProgress, never>;
|
|
26
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CkProgress, "ck-progress", never, {
|
|
27
|
+
"value": {
|
|
28
|
+
"alias": "value";
|
|
29
|
+
"required": false;
|
|
30
|
+
"isSignal": true;
|
|
31
|
+
};
|
|
32
|
+
"max": {
|
|
33
|
+
"alias": "max";
|
|
34
|
+
"required": false;
|
|
35
|
+
"isSignal": true;
|
|
36
|
+
};
|
|
37
|
+
"valueText": {
|
|
38
|
+
"alias": "valueText";
|
|
39
|
+
"required": false;
|
|
40
|
+
"isSignal": true;
|
|
41
|
+
};
|
|
42
|
+
}, {}, never, never, true, never>;
|
|
43
|
+
}
|
|
@@ -54,6 +54,9 @@ export declare class CkSegment<T = unknown> {
|
|
|
54
54
|
* A group of mutually exclusive options that behaves as one radio group: one tab stop, the arrow
|
|
55
55
|
* keys move and select. Direction comes from the `dir` attribute (`:dir(rtl)`), not from the CSS
|
|
56
56
|
* `direction` property. The value is the `value` of the selected `ck-segment`, or `null`.
|
|
57
|
+
*
|
|
58
|
+
* Segments are as wide as an equal share or their label, whichever is larger. Only when the labels
|
|
59
|
+
* cannot fit at all do they share the width equally and truncate with an ellipsis.
|
|
57
60
|
*/
|
|
58
61
|
export declare class CkSegmented<T = unknown> extends CkValueControl<T | null> implements CkSegmentedContext {
|
|
59
62
|
/** `undefined` uses the size from `provideCkui`. */
|
|
@@ -66,11 +69,34 @@ export declare class CkSegmented<T = unknown> extends CkValueControl<T | null> i
|
|
|
66
69
|
protected readonly modifierClasses: import("@angular/core").Signal<string>;
|
|
67
70
|
private readonly current;
|
|
68
71
|
protected readonly checkedIndex: import("@angular/core").Signal<number>;
|
|
72
|
+
/** The grid column of the checked segment, which the indicator is placed in. */
|
|
73
|
+
protected readonly column: import("@angular/core").Signal<number | null>;
|
|
74
|
+
/** Equal columns with truncated labels: the labels do not fit at their natural width. */
|
|
75
|
+
protected readonly compact: import("@angular/core").WritableSignal<boolean>;
|
|
76
|
+
private readonly media;
|
|
77
|
+
private readonly browser;
|
|
78
|
+
private destroyed;
|
|
79
|
+
private shownSegment;
|
|
80
|
+
private slide;
|
|
81
|
+
private observer;
|
|
82
|
+
private mutations;
|
|
83
|
+
private fonts;
|
|
69
84
|
/** @internal Used by `ck-segment`. */
|
|
70
85
|
readonly groupDisabled: import("@angular/core").Signal<boolean>;
|
|
71
86
|
/** @internal Used by `ck-segment`. The checked segment, else the first one that can be used. */
|
|
72
87
|
readonly tabStop: import("@angular/core").Signal<CkSegmentRef | null>;
|
|
73
88
|
constructor();
|
|
89
|
+
/** Slides the indicator after the layout moved it, unless it appears or motion is reduced. */
|
|
90
|
+
private slideTo;
|
|
91
|
+
/** Watches the group, its segments and their content, and switches the compact layout. */
|
|
92
|
+
private fit;
|
|
93
|
+
/**
|
|
94
|
+
* A label that changes (text, language, font) moves no box once the group is compact, so the
|
|
95
|
+
* resize observer is blind to it: watch the text itself and the fonts that finish loading.
|
|
96
|
+
*/
|
|
97
|
+
private watchContent;
|
|
98
|
+
private readonly onFontsLoaded;
|
|
99
|
+
private measure;
|
|
74
100
|
/** @internal Used by `ck-segment`. */
|
|
75
101
|
isChecked(value: unknown): boolean;
|
|
76
102
|
/** @internal Used by `ck-segment`. */
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { CkSize } from "@ckui/core";
|
|
2
|
+
import { CkValueControl } from "@ckui/core/internal";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
type Direction = 1 | -1;
|
|
5
|
+
/**
|
|
6
|
+
* A number field with a minus and a plus button. The value is a real text input with the
|
|
7
|
+
* `spinbutton` role: type a number (committed on Enter or blur, snapped to `step` and clamped to
|
|
8
|
+
* `min` / `max`), use the arrow keys, or press the buttons, which repeat while held. An empty
|
|
9
|
+
* field is `null`. The buttons are outside the tab order; the input is the one tab stop.
|
|
10
|
+
*
|
|
11
|
+
* Name it with `aria-label` or `aria-labelledby` on `ck-stepper`, or wrap it in a `<label>`. The
|
|
12
|
+
* attributes are inputs here and move to the input element.
|
|
13
|
+
*
|
|
14
|
+
* The input comes first in the DOM, so a wrapping `<label>` names it rather than a button; the
|
|
15
|
+
* minus button is moved in front of it with CSS `order`.
|
|
16
|
+
*/
|
|
17
|
+
export declare class CkStepper extends CkValueControl<number | null> {
|
|
18
|
+
/** Smallest value. Without it the value has no lower limit. When above `max`, `min` wins. */
|
|
19
|
+
readonly min: import("@angular/core").InputSignalWithTransform<number | null, unknown>;
|
|
20
|
+
/** Largest value. Without it the value has no upper limit. */
|
|
21
|
+
readonly max: import("@angular/core").InputSignalWithTransform<number | null, unknown>;
|
|
22
|
+
/** Distance between values, counted from `min` (else 0). Not a number above 0 counts as 1. */
|
|
23
|
+
readonly step: import("@angular/core").InputSignalWithTransform<number | null, unknown>;
|
|
24
|
+
/** What Page Up and Page Down move by. Default: 10 steps. */
|
|
25
|
+
readonly largeStep: import("@angular/core").InputSignalWithTransform<number | null, unknown>;
|
|
26
|
+
/** Text after the value, part of the value text for assistive technology: `W` reads "250 W". */
|
|
27
|
+
readonly unit: import("@angular/core").InputSignal<string>;
|
|
28
|
+
/** `undefined` uses the size from `provideCkui`. */
|
|
29
|
+
readonly size: import("@angular/core").InputSignal<CkSize | undefined>;
|
|
30
|
+
/** The value can be read and focused, but not typed or stepped. */
|
|
31
|
+
readonly readonly: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
32
|
+
/** Replaces the label of the minus button ("FTP minus 5"). */
|
|
33
|
+
readonly decrementLabel: import("@angular/core").InputSignal<string>;
|
|
34
|
+
/** Replaces the label of the plus button ("FTP plus 5"). */
|
|
35
|
+
readonly incrementLabel: import("@angular/core").InputSignal<string>;
|
|
36
|
+
/** The accessible name of the input. Moves from the host to the input element. */
|
|
37
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string | null>;
|
|
38
|
+
/** The ids of the elements that name the input. Moves from the host to the input element. */
|
|
39
|
+
readonly ariaLabelledby: import("@angular/core").InputSignal<string | null>;
|
|
40
|
+
/** The ids of a hint or error for the input. Moves from the host to the input element. */
|
|
41
|
+
readonly ariaDescribedby: import("@angular/core").InputSignal<string | null>;
|
|
42
|
+
private readonly config;
|
|
43
|
+
private readonly labels;
|
|
44
|
+
private readonly locale;
|
|
45
|
+
private readonly media;
|
|
46
|
+
private readonly document;
|
|
47
|
+
private readonly browser;
|
|
48
|
+
private readonly element;
|
|
49
|
+
private readonly inputRef;
|
|
50
|
+
/** Typed text that is not committed yet. */
|
|
51
|
+
protected editing: boolean;
|
|
52
|
+
/** The text last written into the input, so the render after a commit does not redo it. */
|
|
53
|
+
private shown;
|
|
54
|
+
private holding;
|
|
55
|
+
/** Set by an accepted pointerdown on a button; the click that follows it must not step again. */
|
|
56
|
+
private pressed;
|
|
57
|
+
private stopWatchingRelease;
|
|
58
|
+
private repeatTimer;
|
|
59
|
+
private repeatElapsed;
|
|
60
|
+
private repeatDirection;
|
|
61
|
+
protected readonly modifierClasses: import("@angular/core").Signal<string>;
|
|
62
|
+
/** The decimal keypad has no minus sign, so a range that allows negatives gets the text one. */
|
|
63
|
+
protected readonly inputMode: import("@angular/core").Signal<"decimal" | "text">;
|
|
64
|
+
protected readonly stepSize: import("@angular/core").Signal<number>;
|
|
65
|
+
/** The limits, with `max` raised to `min` when they cross. */
|
|
66
|
+
protected readonly bounds: import("@angular/core").Signal<{
|
|
67
|
+
min: number | null;
|
|
68
|
+
max: number | null;
|
|
69
|
+
}>;
|
|
70
|
+
private readonly digits;
|
|
71
|
+
private readonly grid;
|
|
72
|
+
private readonly largeDelta;
|
|
73
|
+
private readonly separators;
|
|
74
|
+
/** The committed value, `null` for none (or anything that is not a finite number). */
|
|
75
|
+
protected readonly current: import("@angular/core").Signal<number | null>;
|
|
76
|
+
private format;
|
|
77
|
+
protected readonly displayValue: import("@angular/core").Signal<string>;
|
|
78
|
+
protected readonly valueText: import("@angular/core").Signal<string | null>;
|
|
79
|
+
/** Width of the value in characters, from the formatted limits (else the value), at least 3. */
|
|
80
|
+
protected readonly chars: import("@angular/core").Signal<number>;
|
|
81
|
+
protected readonly decrementText: import("@angular/core").Signal<string>;
|
|
82
|
+
protected readonly incrementText: import("@angular/core").Signal<string>;
|
|
83
|
+
private readonly locked;
|
|
84
|
+
protected readonly decrementBlocked: import("@angular/core").Signal<boolean>;
|
|
85
|
+
protected readonly incrementBlocked: import("@angular/core").Signal<boolean>;
|
|
86
|
+
constructor();
|
|
87
|
+
private watchConfiguration;
|
|
88
|
+
/** Writes text into the input and drops any uncommitted typing. */
|
|
89
|
+
private show;
|
|
90
|
+
/** The value arrows and buttons start from: the typed text when valid, else the value. */
|
|
91
|
+
private base;
|
|
92
|
+
/** Moves by `count` steps from the base. Returns whether the committed value changed. */
|
|
93
|
+
private stepBy;
|
|
94
|
+
/** Commits a value from the user and shows what the control then holds. */
|
|
95
|
+
private settle;
|
|
96
|
+
private commitText;
|
|
97
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
98
|
+
protected onFocusOut(event: FocusEvent): void;
|
|
99
|
+
/** A click on the field around the value (the unit, the padding) focuses the input. */
|
|
100
|
+
protected focusInput(event: Event): void;
|
|
101
|
+
/** The press starts on pointerdown, so the first step happens at once and a hold can repeat. */
|
|
102
|
+
protected onPress(event: PointerEvent, direction: Direction): void;
|
|
103
|
+
/** A pointer that has moved off the button no longer holds it. */
|
|
104
|
+
protected onPressMove(event: PointerEvent): void;
|
|
105
|
+
/** The browser took the pointer away: no click follows. */
|
|
106
|
+
protected onPressCancel(): void;
|
|
107
|
+
/**
|
|
108
|
+
* The click after a pointer press was handled on pointerdown and is skipped. A click without a
|
|
109
|
+
* pointerdown (keyboard, a screen reader's activation, `button.click()`) steps once here.
|
|
110
|
+
*/
|
|
111
|
+
protected onButtonClick(direction: Direction): void;
|
|
112
|
+
private scheduleRepeat;
|
|
113
|
+
/**
|
|
114
|
+
* On a coarse pointer the input is not focused during a press, so the window losing focus and
|
|
115
|
+
* the document turning hidden are the only signals that the finger will not be released here.
|
|
116
|
+
*/
|
|
117
|
+
private watchRelease;
|
|
118
|
+
private unwatchRelease;
|
|
119
|
+
private clearRepeat;
|
|
120
|
+
/** Release, cancel, lost capture, leave, blur, hidden, a bound or a lock: stops, counts as touched. */
|
|
121
|
+
protected endPress(): void;
|
|
122
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkStepper, never>;
|
|
123
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CkStepper, "ck-stepper", never, {
|
|
124
|
+
"min": {
|
|
125
|
+
"alias": "min";
|
|
126
|
+
"required": false;
|
|
127
|
+
"isSignal": true;
|
|
128
|
+
};
|
|
129
|
+
"max": {
|
|
130
|
+
"alias": "max";
|
|
131
|
+
"required": false;
|
|
132
|
+
"isSignal": true;
|
|
133
|
+
};
|
|
134
|
+
"step": {
|
|
135
|
+
"alias": "step";
|
|
136
|
+
"required": false;
|
|
137
|
+
"isSignal": true;
|
|
138
|
+
};
|
|
139
|
+
"largeStep": {
|
|
140
|
+
"alias": "largeStep";
|
|
141
|
+
"required": false;
|
|
142
|
+
"isSignal": true;
|
|
143
|
+
};
|
|
144
|
+
"unit": {
|
|
145
|
+
"alias": "unit";
|
|
146
|
+
"required": false;
|
|
147
|
+
"isSignal": true;
|
|
148
|
+
};
|
|
149
|
+
"size": {
|
|
150
|
+
"alias": "size";
|
|
151
|
+
"required": false;
|
|
152
|
+
"isSignal": true;
|
|
153
|
+
};
|
|
154
|
+
"readonly": {
|
|
155
|
+
"alias": "readonly";
|
|
156
|
+
"required": false;
|
|
157
|
+
"isSignal": true;
|
|
158
|
+
};
|
|
159
|
+
"decrementLabel": {
|
|
160
|
+
"alias": "decrementLabel";
|
|
161
|
+
"required": false;
|
|
162
|
+
"isSignal": true;
|
|
163
|
+
};
|
|
164
|
+
"incrementLabel": {
|
|
165
|
+
"alias": "incrementLabel";
|
|
166
|
+
"required": false;
|
|
167
|
+
"isSignal": true;
|
|
168
|
+
};
|
|
169
|
+
"ariaLabel": {
|
|
170
|
+
"alias": "aria-label";
|
|
171
|
+
"required": false;
|
|
172
|
+
"isSignal": true;
|
|
173
|
+
};
|
|
174
|
+
"ariaLabelledby": {
|
|
175
|
+
"alias": "aria-labelledby";
|
|
176
|
+
"required": false;
|
|
177
|
+
"isSignal": true;
|
|
178
|
+
};
|
|
179
|
+
"ariaDescribedby": {
|
|
180
|
+
"alias": "aria-describedby";
|
|
181
|
+
"required": false;
|
|
182
|
+
"isSignal": true;
|
|
183
|
+
};
|
|
184
|
+
}, {}, never, never, true, never>;
|
|
185
|
+
}
|
|
186
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ModelSignal } from "@angular/core";
|
|
3
|
+
import { CkSize } from "@ckui/core";
|
|
4
|
+
import { CkValueControl } from "@ckui/core/internal";
|
|
5
|
+
/**
|
|
6
|
+
* An on/off switch with a label. It is one native `<input type="checkbox" role="switch">`, so the
|
|
7
|
+
* checked state, Space and a click on the whole row (label text, hint and switch) work natively.
|
|
8
|
+
* The value is a `boolean`; `null` or `undefined` from a form counts as off.
|
|
9
|
+
*
|
|
10
|
+
* The projected text names the switch; a `ck-switch-hint` describes it. Without visible text, give
|
|
11
|
+
* `ck-switch` an `aria-label` or `aria-labelledby`: they are inputs and move onto the input element.
|
|
12
|
+
*/
|
|
13
|
+
export declare class CkSwitch extends CkValueControl<boolean> {
|
|
14
|
+
/** On or off. `null` or `undefined` from a form counts as off. */
|
|
15
|
+
readonly value: ModelSignal<boolean>;
|
|
16
|
+
/** `undefined` uses the size from `provideCkui`. */
|
|
17
|
+
readonly size: import("@angular/core").InputSignal<CkSize | undefined>;
|
|
18
|
+
/** Where the text goes: `start` puts it first and the switch at the end of the row. */
|
|
19
|
+
readonly labelPosition: import("@angular/core").InputSignal<"start" | "end">;
|
|
20
|
+
/** The accessible name for a switch without visible text. Moves from the host to the input. */
|
|
21
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string | null>;
|
|
22
|
+
/** The ids of the elements that name the input. Moves from the host to the input. */
|
|
23
|
+
readonly ariaLabelledby: import("@angular/core").InputSignal<string | null>;
|
|
24
|
+
/** More ids that describe the input, after the hint. Moves from the host to the input. */
|
|
25
|
+
readonly ariaDescribedby: import("@angular/core").InputSignal<string | null>;
|
|
26
|
+
private readonly config;
|
|
27
|
+
private readonly element;
|
|
28
|
+
private readonly inputRef;
|
|
29
|
+
private readonly hint;
|
|
30
|
+
protected readonly textId: string;
|
|
31
|
+
protected readonly on: import("@angular/core").Signal<boolean>;
|
|
32
|
+
protected readonly modifierClasses: import("@angular/core").Signal<string>;
|
|
33
|
+
/** The consumer's names win; otherwise the projected text names the input. */
|
|
34
|
+
protected readonly labelledby: import("@angular/core").Signal<string | null>;
|
|
35
|
+
protected readonly describedby: import("@angular/core").Signal<string | null>;
|
|
36
|
+
constructor();
|
|
37
|
+
protected onToggle(): void;
|
|
38
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkSwitch, never>;
|
|
39
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CkSwitch, "ck-switch", never, {
|
|
40
|
+
"value": {
|
|
41
|
+
"alias": "value";
|
|
42
|
+
"required": false;
|
|
43
|
+
"isSignal": true;
|
|
44
|
+
};
|
|
45
|
+
"size": {
|
|
46
|
+
"alias": "size";
|
|
47
|
+
"required": false;
|
|
48
|
+
"isSignal": true;
|
|
49
|
+
};
|
|
50
|
+
"labelPosition": {
|
|
51
|
+
"alias": "labelPosition";
|
|
52
|
+
"required": false;
|
|
53
|
+
"isSignal": true;
|
|
54
|
+
};
|
|
55
|
+
"ariaLabel": {
|
|
56
|
+
"alias": "aria-label";
|
|
57
|
+
"required": false;
|
|
58
|
+
"isSignal": true;
|
|
59
|
+
};
|
|
60
|
+
"ariaLabelledby": {
|
|
61
|
+
"alias": "aria-labelledby";
|
|
62
|
+
"required": false;
|
|
63
|
+
"isSignal": true;
|
|
64
|
+
};
|
|
65
|
+
"ariaDescribedby": {
|
|
66
|
+
"alias": "aria-describedby";
|
|
67
|
+
"required": false;
|
|
68
|
+
"isSignal": true;
|
|
69
|
+
};
|
|
70
|
+
}, {
|
|
71
|
+
"value": "valueChange";
|
|
72
|
+
}, ["hint"], ["*", "ck-switch-hint"], true, never>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Help text under the label of a `ck-switch`. It is part of the row, so a click on it toggles the
|
|
76
|
+
* switch, and the switch's input is described by it. Give it an `id` to choose the id.
|
|
77
|
+
*/
|
|
78
|
+
export declare class CkSwitchHint {
|
|
79
|
+
readonly id: import("@angular/core").InputSignal<string>;
|
|
80
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkSwitchHint, never>;
|
|
81
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CkSwitchHint, "ck-switch-hint", never, {
|
|
82
|
+
"id": {
|
|
83
|
+
"alias": "id";
|
|
84
|
+
"required": false;
|
|
85
|
+
"isSignal": true;
|
|
86
|
+
};
|
|
87
|
+
}, {}, never, never, true, never>;
|
|
88
|
+
}
|
|
89
|
+
/** Everything a template needs for a switch: `imports: [CK_SWITCH_IMPORTS]`. */
|
|
90
|
+
export declare const CK_SWITCH_IMPORTS: readonly [typeof CkSwitch, typeof CkSwitchHint];
|