igniteui-webcomponents
Version:
Ignite UI for Web Components is a complete library of UI components, giving you the ability to build modern web applications using encapsulation and the concept of reusable components in a dependency-free approach.
34 lines (33 loc) • 1.62 kB
TypeScript
import type { LitElement, ReactiveControllerHost } from 'lit';
/** Configuration for the ElementInternalsController. */
type ElementInternalsConfig<T extends keyof ARIAMixin = keyof ARIAMixin> = {
/** Initial ARIA attributes to set on the element internals. */
initialARIA: Partial<Record<T, ARIAMixin[T]>>;
};
/**
* A Lit ReactiveController to manage `ElementInternals` for a host element.
* Provides methods to interact with custom element states and ARIA attributes..
*/
declare class ElementInternalsController {
private readonly _host;
private readonly _internals;
/**
* Gets the closest ancestor `<form>` element or `null`.
*
* @remarks
* The host element must be form associated, that is should have
* `static formAssociated = true` in order to return the parent form.
*/
get form(): HTMLFormElement | null;
constructor(host: ReactiveControllerHost & LitElement, config?: ElementInternalsConfig);
/** Sets ARIA attributes on the element's internals. */
setARIA<T extends keyof ARIAMixin = keyof ARIAMixin>(state: Partial<Record<T, ARIAMixin[T]>>): void;
/**
* Adds or removes a custom state from the element's internals.
* Custom states can be styled via `:state()` pseudo-class in CSS.
*/
setState(state: string, value: boolean): void;
}
/** Creates and adds a {@link ElementInternalsController} to a LitElement host. */
export declare function addInternalsController(host: ReactiveControllerHost & LitElement, config?: ElementInternalsConfig): ElementInternalsController;
export type { ElementInternalsController };