import type { ControlBehaviorBase, ControlBehaviorReturn } from '../../Controls/Behaviors/Abstracts/Behavior'; import type { CustomElement } from '../../Controls/Components/Abstracts/CustomElement'; import type { FormAssociatedConstructor } from '../../Types/Constructor'; import type { FormRestoreReason } from '../FormRestoreReason'; import type { FormRestoreState } from '../FormRestoreState'; import type { FormValue } from '../FormValue'; /** * Represents the `IFormAssociated` interface. * * @public */ export interface IFormAssociated { /** * The internals object of the element. */ readonly internals: ElementInternals; /** * The associated form element with which this element's value will submit. */ readonly form: HTMLFormElement | null; /** * The labels this element is associated with. */ readonly labels: NodeList; /** * The HTML name to use in form submission. */ name: string; /** * Whether or not the element is disabled. */ disabled: boolean; /** * Gets the current form value of a component. * * @return The current form value. */ getFormValue(): FormValue | null; /** * Gets the current form state of a component. Defaults to the component's `[formValue]`. * * Use this when the state of an element is different from its value, such as * checkboxes (internal boolean state and a user string value). * * @return The current form state, defaults to the form value. */ getFormState(): FormValue | null; /** * An optional callback for when the associated form changes. * * @param form - The new associated form, or `null` if there is none. */ formAssociatedCallback?(form: HTMLFormElement | null): void; /** * A callback for when a form component should be disabled or enabled. This * can be called in a variety of situations, such as disabled `
`s. * * @param disabled - Whether or not the form control should be disabled. */ formDisabledCallback?(disabled: boolean): void; /** * A callback for when the form requests to reset its value. Typically, the * default value that is reset is represented in the attribute of an element. * * This means the attribute used for the value should not update as the value * changes. For example, a checkbox should not change its default `checked` * attribute when selected. Ensure form values do not reflect. */ formResetCallback?(): void; /** * A callback for when the form restores the state of a component. For * example, when a page is reloaded or forms are autofilled. * * @param state - The state to restore, or null to reset the form control's value. * @param reason - The reason state was restored, either `'restore'` or `'autocomplete'`. */ formStateRestoreCallback?(state: FormRestoreState | null, reason: FormRestoreReason): void; } /** * @public */ export declare const FormAssociated: >(base: T) => ControlBehaviorReturn; //# sourceMappingURL=FormAssociated.d.ts.map