@gridkitjs/forms-dom 0.0.0-dev-20261206092422 → 0.0.0-dev-20261206150419
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/dist/index.d.ts +373 -2
- package/dist/index.js +1014 -37
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import { WritingDirection, VisibleRange, Schedule, StepDirection, StepSize,
|
|
1
|
+
import { AbortFactory, FieldController, TypeaheadRow, DisabledOptions, PopupOpenReason, PopupCloseReason, FormsMessages, WritingDirection, VisibleRange, Schedule, StepDirection, StepSize, SegmentContext, SegmentState } from '@gridkitjs/forms-core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The browser's `AbortController` as a forms-core `AbortFactory`: each call
|
|
5
|
+
* makes a fresh signal and the function that aborts it, for an option
|
|
6
|
+
* source controller to hand each request.
|
|
7
|
+
*/
|
|
8
|
+
declare const abortSignals: AbortFactory<AbortSignal>;
|
|
2
9
|
|
|
3
10
|
/** A live region to report changes through. */
|
|
4
11
|
interface LiveAnnouncer {
|
|
@@ -71,6 +78,66 @@ interface AttachedFocusGroup {
|
|
|
71
78
|
*/
|
|
72
79
|
declare function attachFocusGroup(root: HTMLElement, initialOptions: FocusGroupOptions): AttachedFocusGroup;
|
|
73
80
|
|
|
81
|
+
interface RovingFocusOptions {
|
|
82
|
+
/** The selector of the stops inside the root. A disabled one is passed over. */
|
|
83
|
+
readonly items: string;
|
|
84
|
+
/** Which arrow keys move: ← and → (mirrored right to left), ↑ and ↓, or all four. */
|
|
85
|
+
readonly orientation: "horizontal" | "vertical" | "both";
|
|
86
|
+
/** Whether a move past the last stop lands on the first, and back. */
|
|
87
|
+
readonly wrap: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Whether the root is one tab stop: the stop focus was last on holds
|
|
90
|
+
* `tabindex="0"`, the others `-1`. False leaves every stop at `-1`, for
|
|
91
|
+
* stops reached from another control (a combobox's chips). Default true.
|
|
92
|
+
*/
|
|
93
|
+
readonly tabStop?: boolean | undefined;
|
|
94
|
+
/** A key moved focus to `item`: radio behaviour selects it here. */
|
|
95
|
+
readonly onMove?: ((item: HTMLElement, nativeEvent: KeyboardEvent) => void) | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* A key it does not take on the stop holding focus: one with no move, or
|
|
98
|
+
* a move past an end without `wrap` (→ past the last chip returns to the
|
|
99
|
+
* combobox).
|
|
100
|
+
*/
|
|
101
|
+
readonly onKey?: ((item: HTMLElement, nativeEvent: KeyboardEvent) => void) | undefined;
|
|
102
|
+
}
|
|
103
|
+
interface AttachedRovingFocus {
|
|
104
|
+
/** Replaces the options, from the next key on. */
|
|
105
|
+
readonly setOptions: (options: RovingFocusOptions) => void;
|
|
106
|
+
/** Focuses `item`, one of the stops, making it the tab stop. */
|
|
107
|
+
readonly focusItem: (item: HTMLElement) => void;
|
|
108
|
+
/** Removes the listeners and the observer; the stops keep their `tabindex`. */
|
|
109
|
+
readonly detach: () => void;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Makes the stops inside `root` (a toolbar's buttons, a list of chips) one
|
|
113
|
+
* group the arrow keys move focus through, as the WAI-ARIA roving
|
|
114
|
+
* `tabindex` pattern does: the arrows of `orientation` move to the
|
|
115
|
+
* previous or next stop, Home and End to the first and last, each taking
|
|
116
|
+
* focus and, with `tabStop`, `tabindex="0"`. Stops come and go as the page
|
|
117
|
+
* changes; an observer keeps one of them the tab stop.
|
|
118
|
+
*
|
|
119
|
+
* It holds its listeners on the root, the observer and the stop focus was
|
|
120
|
+
* last on; `detach` releases them.
|
|
121
|
+
*/
|
|
122
|
+
declare function attachRovingFocus(root: HTMLElement, initialOptions: RovingFocusOptions): AttachedRovingFocus;
|
|
123
|
+
|
|
124
|
+
/** What `attachValidityCarrier` reads of the field. */
|
|
125
|
+
type ValidityController = Pick<FieldController<unknown>, "getMessages" | "subscribe">;
|
|
126
|
+
interface AttachedValidityCarrier {
|
|
127
|
+
/** Removes the listeners and clears the carrier's custom validity. */
|
|
128
|
+
readonly detach: () => void;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Makes `carrier`, a visually hidden `<input>` the renderer drew beside a
|
|
132
|
+
* control that cannot take constraint validation (a `<button
|
|
133
|
+
* role="combobox">`), hold the field's first error as its custom
|
|
134
|
+
* validity, shown or not yet, so a plain `<form>` refuses to submit. The
|
|
135
|
+
* browser, or a form, focusing the carrier to report it moves focus on to
|
|
136
|
+
* `control`. The renderer gives the carrier no `name`, `tabindex="-1"`
|
|
137
|
+
* and `aria-hidden="true"`, so it is neither submitted nor reached.
|
|
138
|
+
*/
|
|
139
|
+
declare function attachValidityCarrier(carrier: HTMLInputElement, control: HTMLElement, controller: ValidityController): AttachedValidityCarrier;
|
|
140
|
+
|
|
74
141
|
/**
|
|
75
142
|
* The first control of `form`, in document order, that holds an invalid
|
|
76
143
|
* value: a field showing an error, which forms sets as the control's
|
|
@@ -123,6 +190,37 @@ interface AttachedFitCount {
|
|
|
123
190
|
*/
|
|
124
191
|
declare function attachFitCount(root: HTMLElement, { max, onCount }: FitCountOptions): AttachedFitCount;
|
|
125
192
|
|
|
193
|
+
interface OverflowCountOptions {
|
|
194
|
+
/** The selector of the items counted, inside the container: the chips. */
|
|
195
|
+
readonly items: string;
|
|
196
|
+
/**
|
|
197
|
+
* The selector of the element kept at the end of the line when not every
|
|
198
|
+
* item fits ("+3"), inside the container; its width is kept free.
|
|
199
|
+
* `null` for none.
|
|
200
|
+
*/
|
|
201
|
+
readonly reserve: string | null;
|
|
202
|
+
/** Called with how many items fit on the line now, and again whenever that changes. */
|
|
203
|
+
readonly onCount: (count: number) => void;
|
|
204
|
+
}
|
|
205
|
+
interface AttachedOverflowCount {
|
|
206
|
+
/** Stops watching. */
|
|
207
|
+
readonly detach: () => void;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Counts how many of the items in `container`, in order, fit on its one
|
|
211
|
+
* line with its column gap between them: every one when all fit, else as
|
|
212
|
+
* many as leave room for the reserve element after them. What chips show
|
|
213
|
+
* before "+3 more". It measures every item, so the renderer keeps the ones
|
|
214
|
+
* it hides in the page and out of the line (`position: absolute` and
|
|
215
|
+
* `visibility: hidden`), at their own width.
|
|
216
|
+
*
|
|
217
|
+
* It recounts whenever the container, an item or the reserve changes
|
|
218
|
+
* width (a `ResizeObserver`) and as items come and go (a
|
|
219
|
+
* `MutationObserver`), and calls `onCount` only when the count changes.
|
|
220
|
+
* It holds both observers and the last count; `detach` disconnects them.
|
|
221
|
+
*/
|
|
222
|
+
declare function attachOverflowCount(container: HTMLElement, { items, reserve, onCount }: OverflowCountOptions): AttachedOverflowCount;
|
|
223
|
+
|
|
126
224
|
interface ChecklistOptions {
|
|
127
225
|
/**
|
|
128
226
|
* The item at `index` — its place in the whole list — asks to be checked
|
|
@@ -191,6 +289,273 @@ interface AttachedChecklist {
|
|
|
191
289
|
*/
|
|
192
290
|
declare function attachChecklist(list: HTMLElement, options: ChecklistOptions): AttachedChecklist;
|
|
193
291
|
|
|
292
|
+
/**
|
|
293
|
+
* How the active row is shown to assistive technology:
|
|
294
|
+
* `"active-descendant"` keeps focus on a combobox, whose
|
|
295
|
+
* `aria-activedescendant` points at the row; `"roving"` gives the active
|
|
296
|
+
* row focus, the list's one tab stop.
|
|
297
|
+
*/
|
|
298
|
+
type ListboxFocus = "active-descendant" | "roving";
|
|
299
|
+
/** What the listbox needs of each row, mounted or not. */
|
|
300
|
+
interface ListboxRow extends TypeaheadRow {
|
|
301
|
+
/**
|
|
302
|
+
* What identifies the row across changes of the list: an option's key
|
|
303
|
+
* as text, or the action's kind. The active row is kept by it.
|
|
304
|
+
*/
|
|
305
|
+
readonly key: string;
|
|
306
|
+
}
|
|
307
|
+
/** What a choice asks for. */
|
|
308
|
+
type ListboxChoice =
|
|
309
|
+
/** Enter or a click with one value; Space in a popup or with one value. */
|
|
310
|
+
{
|
|
311
|
+
readonly kind: "one";
|
|
312
|
+
}
|
|
313
|
+
/** Enter, Space or a click with several values; Ctrl or Cmd with a click. */
|
|
314
|
+
| {
|
|
315
|
+
readonly kind: "toggle";
|
|
316
|
+
}
|
|
317
|
+
/** Several values: every row from `anchor` to the chosen one. */
|
|
318
|
+
| {
|
|
319
|
+
readonly kind: "range";
|
|
320
|
+
readonly anchor: number;
|
|
321
|
+
}
|
|
322
|
+
/** Ctrl+A with several values. */
|
|
323
|
+
| {
|
|
324
|
+
readonly kind: "all";
|
|
325
|
+
};
|
|
326
|
+
/**
|
|
327
|
+
* What made a row active: a key, the mouse, the renderer as the search
|
|
328
|
+
* text changed (`"typing"`) or as the popup opened (`"open"`), or the list
|
|
329
|
+
* changing under the active row (`"list"`).
|
|
330
|
+
*/
|
|
331
|
+
type ListboxActivation = "keyboard" | "pointer" | "typing" | "open" | "list";
|
|
332
|
+
/** How a row is brought into view: by as little as it takes, or to the middle. */
|
|
333
|
+
type ListboxAlign = "nearest" | "center";
|
|
334
|
+
interface ListboxOptions {
|
|
335
|
+
readonly focus: ListboxFocus;
|
|
336
|
+
/** Several values: Space and clicks toggle, Shift ranges, Ctrl+A chooses all. */
|
|
337
|
+
readonly multiple: boolean;
|
|
338
|
+
/** Printable keys find a row by its label; off where a text box takes them. */
|
|
339
|
+
readonly typeahead: boolean;
|
|
340
|
+
/** The locale the typed text is folded in, as the rows' `typeahead` was. */
|
|
341
|
+
readonly locale?: Intl.LocalesArgument;
|
|
342
|
+
/** Whether the keys reach disabled options. Default `"skip"`. */
|
|
343
|
+
readonly disabledOptions?: DisabledOptions | undefined;
|
|
344
|
+
/** With one value, a key that moves the active row also chooses it. */
|
|
345
|
+
readonly selectionFollowsFocus?: boolean | undefined;
|
|
346
|
+
readonly onActiveChange: (index: number | null, by: ListboxActivation) => void;
|
|
347
|
+
/** A row is chosen. Never a header or a disabled row. */
|
|
348
|
+
readonly onChoose: (index: number, choice: ListboxChoice, nativeEvent: Event) => void;
|
|
349
|
+
/**
|
|
350
|
+
* Brings row `index` into view, mounting it if the list's window does
|
|
351
|
+
* not hold it: a virtualized renderer forwards this to its virtualizer's
|
|
352
|
+
* `scrollToIndex` with `block` set to `align`.
|
|
353
|
+
*/
|
|
354
|
+
readonly scrollToIndex: (index: number, align: ListboxAlign) => void;
|
|
355
|
+
/**
|
|
356
|
+
* One of the last five rows mounted or became active: time to load the
|
|
357
|
+
* next page. Called once for each length of the list.
|
|
358
|
+
*/
|
|
359
|
+
readonly onNearEnd?: (() => void) | undefined;
|
|
360
|
+
}
|
|
361
|
+
interface AttachedListbox {
|
|
362
|
+
/** The list element it was attached to. */
|
|
363
|
+
readonly element: HTMLElement;
|
|
364
|
+
/**
|
|
365
|
+
* Every row, mounted or not; call after each change of the list. The
|
|
366
|
+
* active row is kept by `key`, else it moves to the nearest row it can
|
|
367
|
+
* land on, and `onActiveChange` hears it with `"list"`.
|
|
368
|
+
*/
|
|
369
|
+
readonly setRows: (rows: readonly ListboxRow[]) => void;
|
|
370
|
+
/** Replaces the options, from the next event on. */
|
|
371
|
+
readonly setOptions: (options: ListboxOptions) => void;
|
|
372
|
+
/**
|
|
373
|
+
* Makes row `index` active and scrolls to it (to the middle when `by` is
|
|
374
|
+
* `"open"`, not at all when it is `"pointer"`); in roving mode it also
|
|
375
|
+
* takes focus, once mounted. `null` clears the active row.
|
|
376
|
+
*/
|
|
377
|
+
readonly activate: (index: number | null, by: ListboxActivation) => void;
|
|
378
|
+
/**
|
|
379
|
+
* Active-descendant mode: a key pressed in the combobox. True when the
|
|
380
|
+
* listbox acted on it, and then the key is prevented.
|
|
381
|
+
*/
|
|
382
|
+
readonly handleKey: (event: KeyboardEvent) => boolean;
|
|
383
|
+
/** Chooses the active row as Enter with one value would; false when none can be. */
|
|
384
|
+
readonly chooseActive: (nativeEvent: Event) => boolean;
|
|
385
|
+
readonly getActive: () => number | null;
|
|
386
|
+
/** The active row's `id` while it is mounted, else `null`: what `aria-activedescendant` holds. */
|
|
387
|
+
readonly activeId: () => string | null;
|
|
388
|
+
/** Calls `listener` whenever `activeId()` may have changed. */
|
|
389
|
+
readonly subscribe: (listener: () => void) => () => void;
|
|
390
|
+
/**
|
|
391
|
+
* Removes every listener, the observer and the type-ahead timer; every
|
|
392
|
+
* method does nothing after it. The rows keep their `tabindex`.
|
|
393
|
+
*/
|
|
394
|
+
readonly detach: () => void;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Makes `list`, a `role="listbox"` the renderer drew (usually virtualized,
|
|
398
|
+
* so only a window of a long list is mounted), behave as the WAI-ARIA
|
|
399
|
+
* listbox: the arrow keys, Home, End, PageUp and PageDown move the active
|
|
400
|
+
* row, stopping at the ends; printable keys find a row by its label; Enter,
|
|
401
|
+
* Space and clicks choose; with several values Shift ranges and Ctrl+A
|
|
402
|
+
* chooses all. It decides; the renderer is told through the callbacks and
|
|
403
|
+
* draws the outcome, `aria-selected` or `aria-checked` included.
|
|
404
|
+
*
|
|
405
|
+
* Rows are the list's descendants with `data-gridkit-forms-row` holding
|
|
406
|
+
* their place in the whole list, which is all that survives a row being
|
|
407
|
+
* unmounted and mounted again; `setRows` describes every row, mounted or
|
|
408
|
+
* not. Headers are never active, and disabled options only with
|
|
409
|
+
* `disabledOptions: "focus"`; neither is ever chosen. The list is the
|
|
410
|
+
* element that scrolls: PageUp and PageDown move by as many rows as it
|
|
411
|
+
* shows whole.
|
|
412
|
+
*
|
|
413
|
+
* In `"active-descendant"` mode focus stays in a combobox, which hands its
|
|
414
|
+
* keys to `handleKey` (`attachCombobox` does) and points
|
|
415
|
+
* `aria-activedescendant` at `activeId()`, so rows need an `id`. The mouse
|
|
416
|
+
* moving over a row makes it active (a touch does not, so nothing lights
|
|
417
|
+
* up before a tap), and a click chooses. A move key while the active row
|
|
418
|
+
* is scrolled out of the window first scrolls back to it.
|
|
419
|
+
*
|
|
420
|
+
* In `"roving"` mode the active row holds focus and is the one row with
|
|
421
|
+
* `tabindex="0"` (the first mounted row it can land on while none is
|
|
422
|
+
* active or the active one is scrolled away), kept so by an observer as
|
|
423
|
+
* rows mount. Enter is left for a form around the list. A click chooses
|
|
424
|
+
* and focuses, Ctrl or Cmd with a click toggles, Shift with a click
|
|
425
|
+
* ranges.
|
|
426
|
+
*
|
|
427
|
+
* The list itself gets `tabindex="-1"` in both modes: a browser may make
|
|
428
|
+
* an element that scrolls a tab stop of its own, as Firefox does.
|
|
429
|
+
*/
|
|
430
|
+
declare function attachListbox(list: HTMLElement, initialOptions: ListboxOptions): AttachedListbox;
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* What `attachCombobox` asks of the field: a select-only control has no
|
|
434
|
+
* text pipeline, so it starts, commits, ends and reverts the edit itself.
|
|
435
|
+
*/
|
|
436
|
+
type ComboboxController<V, D extends object> = Pick<FieldController<V, D, Event>, "focus" | "blur" | "commit" | "revert">;
|
|
437
|
+
/** What a renderer can change about a combobox while it is attached. */
|
|
438
|
+
interface ComboboxOptions {
|
|
439
|
+
/** The open popup's listbox, attached in `"active-descendant"` mode; `null` while closed. */
|
|
440
|
+
readonly listbox: AttachedListbox | null;
|
|
441
|
+
/** The popup panel while open, so a press in it leaves focus in the control. */
|
|
442
|
+
readonly panel: HTMLElement | null;
|
|
443
|
+
/**
|
|
444
|
+
* A text box (a searchable select, an autocomplete, a tag input), which
|
|
445
|
+
* `attachTextInput` drives and keeps its typing, Home, End and Space; or
|
|
446
|
+
* a select-only button, whose keys all go to the list.
|
|
447
|
+
*/
|
|
448
|
+
readonly editable: boolean;
|
|
449
|
+
/**
|
|
450
|
+
* Whether the combobox calls the controller's `focus`, `blur`,
|
|
451
|
+
* `commit` and `revert` itself: a control no text pipeline drives, as a
|
|
452
|
+
* select-only button, or a search box whose text is only a query (a select
|
|
453
|
+
* with several values, whose chips hold its value). Default `!editable`.
|
|
454
|
+
*/
|
|
455
|
+
readonly drivesField?: boolean | undefined;
|
|
456
|
+
/**
|
|
457
|
+
* Focus moving to an element this accepts stays in the field (a chip's
|
|
458
|
+
* remove button): the popup closes, but the field is not left.
|
|
459
|
+
*/
|
|
460
|
+
readonly isInside?: ((element: Element) => boolean) | undefined;
|
|
461
|
+
/** Several values: Shift with the arrows and Ctrl+A reach a select-only list. */
|
|
462
|
+
readonly multiple: boolean;
|
|
463
|
+
/** Tab with the popup open chooses the active row, with one value. */
|
|
464
|
+
readonly tabChooses: boolean;
|
|
465
|
+
/** Nothing opens the popup. */
|
|
466
|
+
readonly readOnly: boolean;
|
|
467
|
+
readonly onOpenRequest: (reason: PopupOpenReason, nativeEvent: Event) => void;
|
|
468
|
+
readonly onCloseRequest: (reason: PopupCloseReason, nativeEvent: Event) => void;
|
|
469
|
+
/**
|
|
470
|
+
* The chips before the text: the key toward them (←, or → right to left)
|
|
471
|
+
* at the start of the text, or Backspace with no text.
|
|
472
|
+
*/
|
|
473
|
+
readonly onChipKey?: ((key: "previous" | "remove-last", nativeEvent: KeyboardEvent) => void) | undefined;
|
|
474
|
+
}
|
|
475
|
+
interface AttachedCombobox {
|
|
476
|
+
/** Replaces the options: the latest listbox and panel, after each open and close. */
|
|
477
|
+
readonly setOptions: (options: ComboboxOptions) => void;
|
|
478
|
+
/**
|
|
479
|
+
* Removes every listener and the `aria-controls` and
|
|
480
|
+
* `aria-activedescendant` it wrote. The controller is left as it is.
|
|
481
|
+
*/
|
|
482
|
+
readonly detach: () => void;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Makes `control`, a `role="combobox"` the renderer drew (a text box or a
|
|
486
|
+
* select-only button), drive the popup listbox of the WAI-ARIA combobox:
|
|
487
|
+
* focus stays in the control, and its keys open the popup, move the list's
|
|
488
|
+
* active row and choose.
|
|
489
|
+
*
|
|
490
|
+
* - Closed, ↓, ↑, F4 and Alt+↓ ask to open it (`"keyboard"`); a
|
|
491
|
+
* select-only control also opens on Enter, Space, Home and End, and on a
|
|
492
|
+
* printable key (`"typing"`), which goes on to the list's type-ahead
|
|
493
|
+
* once it is open. A text box opens as it is typed in (`"typing"`), and
|
|
494
|
+
* either opens on a press (`"button"`).
|
|
495
|
+
* - Open, the keys go to `listbox.handleKey`: in a text box only ↓, ↑,
|
|
496
|
+
* PageDown, PageUp and Enter (Home and End move the caret and clear the
|
|
497
|
+
* active row, as the WAI-ARIA editable combobox does). Escape asks to
|
|
498
|
+
* close (`"escape"`), F4 and Alt+↑ too (`"button"`), and so does a press
|
|
499
|
+
* on a select-only control. Tab leaves, choosing the active row first
|
|
500
|
+
* with `tabChooses`, and asks to close (`"blur"`), as leaving does.
|
|
501
|
+
* - It listens in the capture phase, so a key it takes is prevented before
|
|
502
|
+
* `attachTextInput` sees it and skips it.
|
|
503
|
+
* - A select-only control calls the controller's `focus` and `blur`,
|
|
504
|
+
* commits on Tab (staying when the commit is refused), and reverts on
|
|
505
|
+
* Escape while closed; so does a search box with `drivesField`, which
|
|
506
|
+
* also commits on Enter while closed. Another text box leaves those to
|
|
507
|
+
* `attachTextInput`. Focus moving to an element `isInside` accepts
|
|
508
|
+
* closes the popup without leaving the field.
|
|
509
|
+
* - It prevents `mousedown` on the panel, which keeps focus in the control
|
|
510
|
+
* and still lets the click through (WebKit sends no click after a tap
|
|
511
|
+
* whose `pointerdown` was prevented).
|
|
512
|
+
*
|
|
513
|
+
* It writes `aria-expanded`, `aria-controls` (the listbox's `id`) and
|
|
514
|
+
* `aria-activedescendant` (the active row's `id` while it is mounted) on
|
|
515
|
+
* the control.
|
|
516
|
+
*/
|
|
517
|
+
declare function attachCombobox<V, D extends object>(control: HTMLElement, controller: ComboboxController<V, D>, initialOptions: ComboboxOptions): AttachedCombobox;
|
|
518
|
+
|
|
519
|
+
interface ChoiceAnnouncerOptions {
|
|
520
|
+
/** Where `resultCount`, `noMatches` and `selectedCount` come from. */
|
|
521
|
+
readonly messages: Pick<FormsMessages, "resultCount" | "noMatches" | "selectedCount">;
|
|
522
|
+
/**
|
|
523
|
+
* Milliseconds the results must stay unchanged before they are read,
|
|
524
|
+
* so typing hears one count when it pauses, not one per key. Default 500.
|
|
525
|
+
*/
|
|
526
|
+
readonly settleDelay?: number | undefined;
|
|
527
|
+
/** The live region's class, `"gridkit-forms-sr-only"` by default. */
|
|
528
|
+
readonly className?: string | undefined;
|
|
529
|
+
}
|
|
530
|
+
interface ChoiceAnnouncer {
|
|
531
|
+
/**
|
|
532
|
+
* The list shows `count` options for `query`: read as `resultCount` or
|
|
533
|
+
* `noMatches` once it has stayed so for `settleDelay`, unless it is
|
|
534
|
+
* what was read last for the same query.
|
|
535
|
+
*/
|
|
536
|
+
readonly results: (query: string, count: number) => void;
|
|
537
|
+
/** An option was ticked or unticked: `selectedCount`, read at once. */
|
|
538
|
+
readonly selected: (count: number) => void;
|
|
539
|
+
/** Any other text, read at once. */
|
|
540
|
+
readonly announce: (text: string) => void;
|
|
541
|
+
/**
|
|
542
|
+
* The list closed: drops results still settling, and forgets the last
|
|
543
|
+
* read, so the next open reads its count again.
|
|
544
|
+
*/
|
|
545
|
+
readonly cancel: () => void;
|
|
546
|
+
/** Replaces the options, from the next call on. */
|
|
547
|
+
readonly setOptions: (options: ChoiceAnnouncerOptions) => void;
|
|
548
|
+
/** Drops what is settling and removes the live region. */
|
|
549
|
+
readonly destroy: () => void;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* A polite live region in `container` for what a choice list says that no
|
|
553
|
+
* visual cue carries to a screen reader: how many options a search found,
|
|
554
|
+
* how many are ticked. The active option is not announced: the screen
|
|
555
|
+
* reader reads it from `aria-activedescendant` or focus.
|
|
556
|
+
*/
|
|
557
|
+
declare function createChoiceAnnouncer(container: HTMLElement, initialOptions: ChoiceAnnouncerOptions): ChoiceAnnouncer;
|
|
558
|
+
|
|
194
559
|
/** Which side of its anchor an overlay opens on. */
|
|
195
560
|
type OverlaySide = "top" | "bottom" | "left" | "right";
|
|
196
561
|
/**
|
|
@@ -619,6 +984,12 @@ interface TextInputOptions {
|
|
|
619
984
|
interface AttachedTextInput {
|
|
620
985
|
/** Replaces the options, from the next event on. */
|
|
621
986
|
readonly setOptions: (options: TextInputOptions) => void;
|
|
987
|
+
/**
|
|
988
|
+
* Writes the controller's text into the control again: for text that
|
|
989
|
+
* changed while the field did not, such as a choice's label arriving
|
|
990
|
+
* after its key. Never while an input method composes.
|
|
991
|
+
*/
|
|
992
|
+
readonly refresh: () => void;
|
|
622
993
|
/**
|
|
623
994
|
* Removes every listener and clears the control's custom validity. The
|
|
624
995
|
* controller is left as it is, so another control can be attached to it.
|
|
@@ -808,4 +1179,4 @@ declare function attachSegments<V, D extends object>(group: HTMLElement, control
|
|
|
808
1179
|
*/
|
|
809
1180
|
declare function writingDirection(element: Element): WritingDirection;
|
|
810
1181
|
|
|
811
|
-
export { type AttachedAutoGrow, type AttachedChecklist, type AttachedFitCount, type AttachedFocusGroup, type AttachedHoldRepeat, type AttachedSegments, type AttachedStepKeys, type AttachedTextInput, type AttachedToggle, type AutoGrowOptions, type ChecklistOptions, type FitCountOptions, type FocusGroupOptions, type HoldRepeatOptions, type HoldRepeatState, type LiveAnnouncer, type LiveAnnouncerOptions, type OverlayAlign, type OverlayAnchor, type OverlayDismissReason, type OverlayInitialFocus, type OverlayOptions, type OverlayPlacement, type OverlayPlacementOptions, type OverlayPosition, type OverlayRect, type OverlaySide, type OverlaySize, type RowVirtualizer, type RowVirtualizerOptions, type SegmentsController, type SegmentsOptions, type StepKeysOptions, type TextControl, type TextInputController, type TextInputOptions, type ToggleOptions, attachAutoGrow, attachChecklist, attachEnterNavigation, attachFitCount, attachFocusGroup, attachHoldRepeat, attachOverlay, attachSegments, attachStepKeys, attachTextInput, attachToggle, compareDocumentOrder, createLiveAnnouncer, createRowVirtualizer, findFirstInvalidControl, focusTargetIn, placeOverlay, scheduleTimeout, writingDirection };
|
|
1182
|
+
export { type AttachedAutoGrow, type AttachedChecklist, type AttachedCombobox, type AttachedFitCount, type AttachedFocusGroup, type AttachedHoldRepeat, type AttachedListbox, type AttachedOverflowCount, type AttachedRovingFocus, type AttachedSegments, type AttachedStepKeys, type AttachedTextInput, type AttachedToggle, type AttachedValidityCarrier, type AutoGrowOptions, type ChecklistOptions, type ChoiceAnnouncer, type ChoiceAnnouncerOptions, type ComboboxController, type ComboboxOptions, type FitCountOptions, type FocusGroupOptions, type HoldRepeatOptions, type HoldRepeatState, type ListboxActivation, type ListboxAlign, type ListboxChoice, type ListboxFocus, type ListboxOptions, type ListboxRow, type LiveAnnouncer, type LiveAnnouncerOptions, type OverflowCountOptions, type OverlayAlign, type OverlayAnchor, type OverlayDismissReason, type OverlayInitialFocus, type OverlayOptions, type OverlayPlacement, type OverlayPlacementOptions, type OverlayPosition, type OverlayRect, type OverlaySide, type OverlaySize, type RovingFocusOptions, type RowVirtualizer, type RowVirtualizerOptions, type SegmentsController, type SegmentsOptions, type StepKeysOptions, type TextControl, type TextInputController, type TextInputOptions, type ToggleOptions, type ValidityController, abortSignals, attachAutoGrow, attachChecklist, attachCombobox, attachEnterNavigation, attachFitCount, attachFocusGroup, attachHoldRepeat, attachListbox, attachOverflowCount, attachOverlay, attachRovingFocus, attachSegments, attachStepKeys, attachTextInput, attachToggle, attachValidityCarrier, compareDocumentOrder, createChoiceAnnouncer, createLiveAnnouncer, createRowVirtualizer, findFirstInvalidControl, focusTargetIn, placeOverlay, scheduleTimeout, writingDirection };
|