import { FocusMonitor } from '@angular/cdk/a11y'; import type { FocusOrigin } from '@angular/cdk/a11y'; import { ChangeDetectorRef, ElementRef, EventEmitter, InjectionToken } from '@angular/core'; import type { AfterViewInit, OnDestroy, Provider } from '@angular/core'; import { ControlValueAccessor, FormControl } from '@angular/forms'; /** * Checkbox click action when the user clicks on the input element * * noop: Do not toggle checked or indeterminate. * check: Only toggle checked status, ignore indeterminate. * check-indeterminate: Toggle checked status, set indeterminate to false. Default behavior. * undefined: Same as `check-indeterminate`. */ export declare type TsCheckboxClickAction = 'noop' | 'check' | 'check-indeterminate' | undefined; /** * Default `ts-checkbox` options that can be overridden */ export interface TsCheckboxDefaultOptions { clickAction?: TsCheckboxClickAction; } /** * A factory to generate the options for {@link TsCheckboxComponent} * * @internal * * NOTE: Lambdas are not supported so we are disabling the prefer-arrow rule */ export declare function TS_CHECKBOX_DEFAULT_OPTIONS_FACTORY(): TsCheckboxDefaultOptions; /** * Injection token to be used to override the default options for `ts-checkbox` */ export declare const TS_CHECKBOX_DEFAULT_OPTIONS: InjectionToken; /** * The change event output by {@link TsCheckboxComponent} */ export declare class TsCheckboxChange { /** * The source of the TsCheckboxChange event */ source: TsCheckboxComponent; /** * The checked value of the checkbox */ checked: boolean; } /** * Provider Expression that allows ts-checkbox to register as a ControlValueAccessor. * * This allows it to support [(ngModel)]. * * @internal */ export declare const TS_CHECKBOX_CONTROL_VALUE_ACCESSOR: Provider; /** * A standard checkbox input control. * * @example * * * https://release--5f0ca4e61af3790022cad2fe.chromatic.com/?path=/story/components-data-entry-checkbox */ export declare class TsCheckboxComponent implements ControlValueAccessor, AfterViewInit, OnDestroy { elementRef: ElementRef; private changeDetectorRef; private focusMonitor; private options?; /** * Define the default component ID */ protected uid: string; /** * Define the ID for the input element (needed for a11y) */ inputId: string; /** * Determine the correct aria-checked state */ get ariaCheckedState(): 'true' | 'false' | 'mixed'; /** * The native `` element */ inputElement: ElementRef; /** * Attached to the aria-label attribute of the host element. * * In most cases, aria-labelledby will take precedence so this may be omitted. */ ariaLabel: string; /** * Users can specify the `aria-labelledby` attribute which will be forwarded to the input element */ ariaLabelledby: string | null; /** * The 'aria-describedby' attribute is read after the element's label and field type */ ariaDescribedby: string; /** * Define the form control for the checkbox */ formControl: FormControl; /** * Whether the checkbox is checked */ set isChecked(value: boolean); get isChecked(): boolean; private _isChecked; /** * Whether the checkbox is disabled */ set isDisabled(value: boolean); get isDisabled(): boolean; private _isDisabled; /** * Define an ID for the component * * @param value */ set id(value: string); get id(): string; protected _id: string; /** * Whether the checkbox is indeterminate. This is also known as "mixed" mode and can be used to represent a checkbox with three states, * e.g. a checkbox that represents a nested list of check-able items. Note that whenever checkbox is manually clicked, indeterminate is * immediately set to false. */ set isIndeterminate(value: boolean); get isIndeterminate(): boolean; private _isIndeterminate; /** * Define if the checkbox is required */ isRequired: boolean; /** * Name value will be applied to the input element if present */ name: string | null; /** * Define the tabindex */ tabIndex: number; /** * Define the checkbox text content. * * NOTE: This will not display if any content is passed in through */ label: string; /** * The value attribute of the native input element */ value: string; /** * Emit an event on input change */ readonly inputChange: EventEmitter; /** * Emit a change when moving from the indeterminate state */ readonly indeterminateChange: EventEmitter; constructor(elementRef: ElementRef, changeDetectorRef: ChangeDetectorRef, focusMonitor: FocusMonitor, options?: TsCheckboxDefaultOptions); ngAfterViewInit(): void; /** * Tear down the focus monitor */ ngOnDestroy(): void; /** * Toggle the `checked` state of the checkbox */ toggle(): void; /** * Event handler for checkbox input element * * Toggles checked state if element is not disabled. * Do not toggle on (change) event since IE doesn't fire change event when indeterminate checkbox is clicked. * * @param event - The click event */ inputClick(event: Event): void; /** * Focus the checkbox * * @param origin - Where the focus originates * @param options - Optional focus options */ focus(origin?: FocusOrigin, options?: FocusOptions): void; writeValue(value: unknown): void; registerOnChange(fn: (value: unknown) => void): void; registerOnTouched(fn: any): void; setDisabledState(isDisabled: boolean): void; /** * Called when the checkbox is blurred. Needed to properly implement ControlValueAccessor. * * @internal */ onTouched: () => unknown; /** * Stop propagation on interaction events * * @param event - The interaction event */ onInteractionEvent(event: Event): void; /** * Build and emit the checkbox change event */ private emitChangeEvent; /** * Syncs the indeterminate value with the checkbox DOM node. * * We sync `indeterminate` directly on the DOM node, because in Ivy the check for whether a * property is supported on an element boils down to `if (propName in element)`. Domino's * HTMLInputElement doesn't have an `indeterminate` property so Ivy will warn during * server-side rendering. * * @param value - The value to sync */ private syncIndeterminate; /** * Define a placeholder for the CVA change function */ private controlValueAccessorChangeFn; }