@instawork/design-system
Version:
The design system for Instawork's web apps
47 lines (46 loc) • 1.5 kB
TypeScript
import { CustomComponent } from '../common';
interface SelectAllHTMLElement extends HTMLInputElement {
controlledSelector: string;
}
declare global {
interface JQuery {
iwSelectAll(): JQuery<SelectAllHTMLElement>;
}
}
/**
* A jQuery plugin component that allows a checkbox input with the iw-select-all attribute to automatically select
* or deselect all the checkbox inputs defined by the selector in the attribute value.
*
* @example
*
* ```html
* <!-- feature.html -->
* <input id="include-all" type="checkbox" iw-select-all="[name$=include]" />
*
* <input type="checkbox" name="form-0-include" />
* <input type="checkbox" name="form-1-include" />
* <input type="checkbox" name="form-2-include" />
* <input type="checkbox" name="form-3-include" />
* ```
*
* ```typescript
* # feature.ts
* $('#include-all').iwSelectAll();
* ```
*/
export declare class SelectAllComponent extends CustomComponent<HTMLInputElement> {
static get COMPONENT_SELECTOR(): string;
static get ID_PREFIX(): string;
static loadPlugin(): void;
get controlledSelector(): string;
set controlledSelector(value: string);
get indeterminate(): boolean;
get selectAllChecked(): boolean;
get allControlledChecked(): boolean;
get someControlledChecked(): boolean;
readonly $controlled: JQuery<HTMLInputElement>;
constructor($el: JQuery<HTMLInputElement>);
protected onSelectAllClick(): void;
protected onControlledClick(): void;
}
export {};