import { type ReadableBoxedValues, type WritableBoxedValues } from "svelte-toolbelt"; import type { BitsEvent, BitsMouseEvent, RefAttachment, WithRefOpts } from "../internal/types.js"; import type { AnswerControlRegistration, ItemRegistration, PendingFocus, QuestionnaireChoiceState as QuestionnaireChoiceViewState, QuestionnaireInputState as QuestionnaireInputViewState, QuestionnaireInputType, QuestionnaireItemDefinition, QuestionnaireItemState as QuestionnaireItemViewState, QuestionnaireItemStatus, QuestionnaireNavigationState, QuestionnaireNextProps, QuestionnaireRootState as QuestionnaireRootViewState, QuestionnaireShortcutMode } from "./types.js"; import type { EventHandler, FormEventHandler } from "svelte/elements"; type QuestionnaireRootStateOpts = WithRefOpts & ReadableBoxedValues<{ defaultItem: string | undefined; items: readonly QuestionnaireItemDefinition[] | undefined; noValidate: boolean; onItemChange: ((item: string) => void) | undefined; onReset: FormEventHandler | undefined; onSubmit: EventHandler | undefined; shortcuts: QuestionnaireShortcutMode | undefined; }> & WritableBoxedValues<{ item: string | undefined; }>; export declare class QuestionnaireRootState { static create(opts: QuestionnaireRootStateOpts): QuestionnaireRootState; static get(): QuestionnaireRootState; readonly opts: QuestionnaireRootStateOpts; readonly attachment: RefAttachment; registrations: ItemRegistration[]; uncontrolledItem: string | null; readonly rootElement: HTMLFormElement | null; domVersion: number; pendingFocus: PendingFocus | null; previousActiveItemName: string | null | undefined; activeWarnings: Set; constructor(opts: QuestionnaireRootStateOpts); readonly collection: import("./collection.js").QuestionnaireCollection | null; readonly controlled: boolean; readonly activeItemName: string | null; readonly nativeValidation: boolean; readonly shortcuts: QuestionnaireShortcutMode | null; readonly runtimeItems: ItemRegistration[]; readonly runtimeItemByName: Map; readonly logicalItems: readonly QuestionnaireItemDefinition[]; readonly currentIndex: number; readonly activeItem: ItemRegistration | null; readonly activeItemRequired: boolean | null; readonly activeItemStatus: QuestionnaireItemStatus | null; readonly orderedRegistrations: ItemRegistration[]; readonly total: number; readonly current: number; readonly first: boolean; readonly last: boolean; readonly viewState: QuestionnaireRootViewState; setItem(nextItem: string, focusTarget?: PendingFocus["target"]): void; registerItem(registration: ItemRegistration): () => void; goPrevious(): void; goNext(): void; confirmCurrent(): void; skipCurrent(): void; handleReset(event: BitsEvent): void; handleSubmit(event: BitsEvent): void; handleKeyDown(event: KeyboardEvent): void; readonly props: { readonly id: string; readonly novalidate: boolean; readonly "data-current": string | undefined; readonly "data-first": "" | undefined; readonly "data-last": "" | undefined; readonly "data-total": string | undefined; readonly "data-shortcuts": QuestionnaireShortcutMode | undefined; readonly onkeydown: (event: KeyboardEvent) => void; readonly onreset: (event: BitsEvent) => void; readonly onsubmit: (event: BitsEvent) => void; }; } type QuestionnaireItemStateOpts = WithRefOpts & ReadableBoxedValues<{ ariaDescribedBy: string | undefined; ariaKeyShortcuts: string | undefined; disabled: boolean; invalid: boolean; multiple: boolean; name: string; onStatusChange: ((status: QuestionnaireItemStatus) => void) | undefined; required: boolean; }>; export declare class QuestionnaireItemState { static create(opts: QuestionnaireItemStateOpts): QuestionnaireItemState; static get(): QuestionnaireItemState; readonly opts: QuestionnaireItemStateOpts; readonly root: QuestionnaireRootState; readonly attachment: RefAttachment; readonly element: HTMLFieldSetElement | null; answerControlRegistrations: AnswerControlRegistration[]; validationAttempted: boolean; selectedAnswerIds: string[]; skipped: boolean; resetVersion: number; descriptionIds: string[]; errorIds: string[]; defaultSelectedAnswerIds: string[]; previousStatus: QuestionnaireItemStatus | null; previousMultiple: boolean; constructor(opts: QuestionnaireItemStateOpts, root: QuestionnaireRootState); readonly active: boolean; readonly answerControls: AnswerControlRegistration[]; readonly answers: AnswerControlRegistration[]; readonly answered: boolean; readonly status: QuestionnaireItemStatus; readonly intentionallySkipped: boolean; readonly valid: boolean; readonly invalid: boolean; readonly hasInputAnswer: boolean; readonly itemDefinition: QuestionnaireItemDefinition | undefined; readonly shortcutByChoiceValue: Map | null; readonly shortcutByAnswerId: Map; registerAnswerControl(registration: AnswerControlRegistration): () => void; updateAnswerSelected(answerId: string, selected: boolean): void; setAnswerSelectionFromInteraction(answerId: string, selected: boolean): void; syncControlledAnswerSelection(answerId: string, selected: boolean): void; registerAnswerSelection(answerId: string, defaultSelected: boolean): () => void; setAnswerDefault(answerId: string, defaultSelected: boolean): void; registerDescription(registeredDescriptionId: string): () => void; registerError(registeredErrorId: string): () => void; validate(): boolean; focus(): void; focusInvalid(): void; reset(): void; skip(): void; emitStatusChange(): void; getAnswerByElement(answerElement: Element): AnswerControlRegistration | null; getAnswerByShortcut(shortcut: string): AnswerControlRegistration | null; moveAnswerFocus(currentElement: Element, direction: "next" | "previous"): boolean; readonly viewState: QuestionnaireItemViewState; readonly describedBy: string | undefined; readonly keyShortcuts: string | undefined; readonly props: { readonly id: string; readonly "aria-describedby": string | undefined; readonly "aria-invalid": true | undefined; readonly "aria-keyshortcuts": string | undefined; readonly disabled: boolean; readonly hidden: boolean; readonly inert: true | undefined; readonly tabindex: -1; readonly "data-active": "" | undefined; readonly "data-disabled": "" | undefined; readonly "data-invalid": "" | undefined; readonly "data-multiple": "" | undefined; readonly "data-required": "" | undefined; readonly "data-status": QuestionnaireItemStatus; }; } type QuestionnaireChoiceStateOpts = WritableBoxedValues<{ ref: HTMLElement | null; }> & ReadableBoxedValues<{ checked: boolean | undefined; defaultChecked: boolean; disabled: boolean; onChange: ((event: Event) => void) | undefined; value: string; answerId: string; }>; export declare class QuestionnaireChoiceState { static create(opts: QuestionnaireChoiceStateOpts): QuestionnaireChoiceState; static get(): QuestionnaireChoiceState; readonly opts: QuestionnaireChoiceStateOpts; readonly item: QuestionnaireItemState; readonly attachment: RefAttachment; inputElement: HTMLInputElement | null; readonly initialDefaultChecked: boolean; constructor(opts: QuestionnaireChoiceStateOpts, item: QuestionnaireItemState); readonly controlled: boolean; readonly disabled: boolean; readonly selected: boolean; readonly checked: boolean; readonly type: "checkbox" | "radio"; readonly shortcut: string | null; handleChange(event: Event): void; readonly viewState: QuestionnaireChoiceViewState; readonly inputProps: { readonly "aria-invalid": true | undefined; readonly "aria-keyshortcuts": string | undefined; readonly checked: boolean; readonly disabled: boolean; readonly id: string; readonly name: string | undefined; readonly onchange: (event: Event) => void; readonly required: boolean; readonly type: "checkbox" | "radio"; readonly value: string; readonly "data-checked": "" | undefined; readonly "data-unchecked": "" | undefined; readonly "data-disabled": "" | undefined; readonly "data-invalid": "" | undefined; readonly "data-shortcut": string | undefined; readonly "data-type": "checkbox" | "radio"; }; readonly props: { readonly "data-checked": "" | undefined; readonly "data-unchecked": "" | undefined; readonly "data-disabled": "" | undefined; readonly "data-invalid": "" | undefined; readonly "data-shortcut": string | undefined; readonly "data-type": "checkbox" | "radio"; }; } type QuestionnaireInputStateOpts = WithRefOpts & ReadableBoxedValues<{ defaultValue: string | undefined; disabled: boolean; onChange: ((event: Event) => void) | undefined; type: QuestionnaireInputType; value: string | undefined; answerId: string; }>; export declare class QuestionnaireInputState { static create(opts: QuestionnaireInputStateOpts): QuestionnaireInputState; readonly opts: QuestionnaireInputStateOpts; readonly item: QuestionnaireItemState; readonly attachment: RefAttachment; readonly inputElement: HTMLInputElement | null; uncontrolledFilled: boolean; readonly initialDefaultFilled: boolean; constructor(opts: QuestionnaireInputStateOpts, item: QuestionnaireItemState); readonly controlled: boolean; readonly defaultFilled: boolean; readonly controlledFilled: boolean; readonly disabled: boolean; readonly filled: boolean; readonly selected: boolean; handleInput(event: Event): void; readonly viewState: QuestionnaireInputViewState; readonly props: { readonly "data-empty": "" | undefined; readonly "data-filled": "" | undefined; readonly "data-disabled": "" | undefined; readonly "data-invalid": "" | undefined; readonly value: string | undefined; readonly defaultValue?: undefined; readonly id: string; readonly "aria-invalid": true | undefined; readonly "aria-keyshortcuts": string | undefined; readonly disabled: boolean; readonly form: "" | undefined; readonly name: string | undefined; readonly oninput: (event: Event) => void; readonly type: QuestionnaireInputType; } | { readonly "data-empty": "" | undefined; readonly "data-filled": "" | undefined; readonly "data-disabled": "" | undefined; readonly "data-invalid": "" | undefined; readonly defaultValue: string | undefined; readonly value?: undefined; readonly id: string; readonly "aria-invalid": true | undefined; readonly "aria-keyshortcuts": string | undefined; readonly disabled: boolean; readonly form: "" | undefined; readonly name: string | undefined; readonly oninput: (event: Event) => void; readonly type: QuestionnaireInputType; }; } type QuestionnaireProgressStateOpts = WritableBoxedValues<{ ref: HTMLElement | null; }>; export declare class QuestionnaireProgressState { static create(opts: QuestionnaireProgressStateOpts): QuestionnaireProgressState; readonly opts: QuestionnaireProgressStateOpts; readonly root: QuestionnaireRootState; readonly attachment: RefAttachment; constructor(opts: QuestionnaireProgressStateOpts, root: QuestionnaireRootState); readonly label: string | undefined; readonly viewState: QuestionnaireRootViewState; readonly props: { readonly "aria-label": "Questionnaire progress"; readonly "aria-live": "polite"; readonly "aria-valuemax": number | undefined; readonly "aria-valuemin": 1 | undefined; readonly "aria-valuenow": number | undefined; readonly "aria-valuetext": string | undefined; readonly role: "progressbar"; readonly "data-current": string | undefined; readonly "data-first": "" | undefined; readonly "data-last": "" | undefined; readonly "data-total": string | undefined; }; } type QuestionnaireChoicesStateOpts = WritableBoxedValues<{ ref: HTMLElement | null; }>; export declare class QuestionnaireChoicesState { static create(opts: QuestionnaireChoicesStateOpts): QuestionnaireChoicesState; readonly opts: QuestionnaireChoicesStateOpts; readonly item: QuestionnaireItemState; readonly attachment: RefAttachment; constructor(opts: QuestionnaireChoicesStateOpts, item: QuestionnaireItemState); readonly snippetProps: { shortcuts: QuestionnaireShortcutMode | null; }; readonly props: { "data-shortcuts": QuestionnaireShortcutMode | undefined; }; } type QuestionnaireDescriptionStateOpts = WritableBoxedValues<{ ref: HTMLElement | null; }> & ReadableBoxedValues<{ id: string; }>; export declare class QuestionnaireDescriptionState { static create(opts: QuestionnaireDescriptionStateOpts): QuestionnaireDescriptionState; readonly opts: QuestionnaireDescriptionStateOpts; readonly item: QuestionnaireItemState; readonly attachment: RefAttachment; constructor(opts: QuestionnaireDescriptionStateOpts, item: QuestionnaireItemState); readonly props: { id: string; }; } type QuestionnaireErrorStateOpts = WritableBoxedValues<{ ref: HTMLElement | null; }> & ReadableBoxedValues<{ id: string; }>; export declare class QuestionnaireErrorState { static create(opts: QuestionnaireErrorStateOpts): QuestionnaireErrorState; readonly opts: QuestionnaireErrorStateOpts; readonly item: QuestionnaireItemState; readonly attachment: RefAttachment; constructor(opts: QuestionnaireErrorStateOpts, item: QuestionnaireItemState); readonly defaultMessage: string; readonly snippetProps: { invalid: boolean; }; readonly props: { hidden: boolean; id: string; role: "alert" | undefined; "data-invalid": "" | undefined; }; } type QuestionnaireChoiceShortcutStateOpts = WritableBoxedValues<{ ref: HTMLElement | null; }>; export declare class QuestionnaireChoiceShortcutState { static create(opts: QuestionnaireChoiceShortcutStateOpts): QuestionnaireChoiceShortcutState; readonly opts: QuestionnaireChoiceShortcutStateOpts; readonly choice: QuestionnaireChoiceState; readonly attachment: RefAttachment; constructor(opts: QuestionnaireChoiceShortcutStateOpts, choice: QuestionnaireChoiceState); readonly shortcut: string | null; readonly snippetProps: { shortcut: string | null; }; readonly props: { "aria-hidden": true; hidden: boolean; "data-shortcut": string | undefined; }; } type QuestionnaireTitleStateOpts = WritableBoxedValues<{ ref: HTMLElement | null; }>; export declare class QuestionnaireTitleState { static create(opts: QuestionnaireTitleStateOpts): QuestionnaireTitleState; readonly opts: QuestionnaireTitleStateOpts; readonly attachment: RefAttachment; constructor(opts: QuestionnaireTitleStateOpts); readonly props: { [x: symbol]: (node: HTMLElement) => () => void; }; } type QuestionnaireChoiceLabelStateOpts = WritableBoxedValues<{ ref: HTMLElement | null; }>; export declare class QuestionnaireChoiceLabelState { static create(opts: QuestionnaireChoiceLabelStateOpts): QuestionnaireChoiceLabelState; readonly opts: QuestionnaireChoiceLabelStateOpts; readonly attachment: RefAttachment; constructor(opts: QuestionnaireChoiceLabelStateOpts); readonly props: { [x: symbol]: (node: HTMLElement) => () => void; }; } type QuestionnaireChoiceInputStateOpts = WritableBoxedValues<{ ref: HTMLElement | null; }> & ReadableBoxedValues<{ id: string | undefined; }>; export declare class QuestionnaireChoiceInputState { static create(opts: QuestionnaireChoiceInputStateOpts): QuestionnaireChoiceInputState; readonly opts: QuestionnaireChoiceInputStateOpts; readonly choice: QuestionnaireChoiceState; readonly attachment: RefAttachment; constructor(opts: QuestionnaireChoiceInputStateOpts, choice: QuestionnaireChoiceState); readonly checked: boolean; readonly snippetProps: QuestionnaireChoiceViewState; readonly props: { id: string; "aria-invalid": true | undefined; "aria-keyshortcuts": string | undefined; checked: boolean; disabled: boolean; name: string | undefined; onchange: (event: Event) => void; required: boolean; type: "checkbox" | "radio"; value: string; "data-checked": "" | undefined; "data-unchecked": "" | undefined; "data-disabled": "" | undefined; "data-invalid": "" | undefined; "data-shortcut": string | undefined; "data-type": "checkbox" | "radio"; }; } type QuestionnaireAction = "next" | "previous" | "skip" | "submit"; type QuestionnaireActionStateOpts = WritableBoxedValues<{ ref: HTMLElement | null; }> & ReadableBoxedValues<{ disabled: boolean; onclick: QuestionnaireNextProps["onclick"]; tabindex: QuestionnaireNextProps["tabindex"]; type: QuestionnaireNextProps["type"]; }>; export declare class QuestionnaireActionState { static create(action: QuestionnaireAction, opts: QuestionnaireActionStateOpts): QuestionnaireActionState; readonly action: QuestionnaireAction; readonly opts: QuestionnaireActionStateOpts; readonly root: QuestionnaireRootState; readonly attachment: RefAttachment; constructor(action: QuestionnaireAction, opts: QuestionnaireActionStateOpts, root: QuestionnaireRootState); readonly visible: boolean; handleClick(event: BitsMouseEvent): void; readonly navigation: { state: QuestionnaireNavigationState; props: { "aria-hidden": boolean | undefined; "aria-keyshortcuts": "Enter" | undefined; disabled: boolean; hidden: boolean; inert: boolean | undefined; onclick: import("svelte/elements").MouseEventHandler | null | undefined; tabindex: number | undefined; type: "reset" | "submit" | "button"; "data-disabled": "" | undefined; "data-hidden": "" | undefined; "data-visible": "" | undefined; "data-shortcut": "Enter" | undefined; "data-status": QuestionnaireItemStatus | undefined; }; }; readonly props: { "aria-hidden": boolean | undefined; "aria-keyshortcuts": "Enter" | undefined; disabled: boolean; hidden: boolean; inert: boolean | undefined; onclick: import("svelte/elements").MouseEventHandler | null | undefined; tabindex: number | undefined; type: "reset" | "submit" | "button"; "data-disabled": "" | undefined; "data-hidden": "" | undefined; "data-visible": "" | undefined; "data-shortcut": "Enter" | undefined; "data-status": QuestionnaireItemStatus | undefined; }; readonly state: QuestionnaireNavigationState; } export declare function getNavigationState(opts: { disabled: boolean; shortcut?: "Enter"; status: QuestionnaireItemStatus | null; visible: boolean; }): QuestionnaireNavigationState; export declare function getNavigationProps(opts: { disabled: boolean; onClick?: QuestionnaireNextProps["onclick"]; shortcut?: "Enter"; status: QuestionnaireItemStatus | null; tabIndex: number | undefined; type: "button" | "reset" | "submit"; visible: boolean; }): { state: QuestionnaireNavigationState; props: { "aria-hidden": boolean | undefined; "aria-keyshortcuts": "Enter" | undefined; disabled: boolean; hidden: boolean; inert: boolean | undefined; onclick: import("svelte/elements").MouseEventHandler | null | undefined; tabindex: number | undefined; type: "reset" | "submit" | "button"; "data-disabled": "" | undefined; "data-hidden": "" | undefined; "data-visible": "" | undefined; "data-shortcut": "Enter" | undefined; "data-status": QuestionnaireItemStatus | undefined; }; }; export {};