@esri/calcite-components
Version:
Web Components for Esri's Calcite Design System.
54 lines (53 loc) • 2.13 kB
TypeScript
export interface InteractiveComponent {
/**
* The host element.
*/
readonly el: HTMLElement;
/**
* When true, prevents user interaction.
*
* Notes:
*
* This prop should use the @Prop decorator and reflect.
* The `disabled` Sass mixin must be added to the component's stylesheet.
*/
disabled: boolean;
}
type HostIsTabbablePredicate = () => boolean;
/**
* Exported for testing purposes only.
*
* @internal
*/
export type InteractiveHTMLElement = HTMLElement & Pick<InteractiveComponent, "disabled">;
/**
* This helper updates the host element to prevent keyboard interaction on its subtree and sets the appropriate aria attribute for accessibility.
*
* This should be used in the `componentDidRender` lifecycle hook.
*
* **Notes**
*
* this util is not needed for simple components whose root element or elements are an interactive component (custom element or native control). For those cases, set the `disabled` props on the root components instead.
* technically, users can override `tabindex` and restore keyboard navigation, but this will be considered user error
*
* @param component
* @param hostIsTabbable
*/
export declare function updateHostInteraction(component: InteractiveComponent, hostIsTabbable?: boolean | HostIsTabbablePredicate | "managed"): void;
/**
* This utility helps disable components consistently in Firefox.
*
* It needs to be called in `connectedCallback` and is only needed for Firefox as it does not call capture event listeners before non-capture ones (see https://bugzilla.mozilla.org/show_bug.cgi?id=1731504).
*
* @param component
*/
export declare function connectInteractive(component: InteractiveComponent): void;
/**
* This utility restores interactivity to disabled components consistently in Firefox.
*
* It needs to be called in `disconnectedCallback` and is only needed for Firefox as it does not call capture event listeners before non-capture ones (see https://bugzilla.mozilla.org/show_bug.cgi?id=1731504).
*
* @param component
*/
export declare function disconnectInteractive(component: InteractiveComponent): void;
export {};