import * as i0 from '@angular/core'; import { OnInit, AfterViewInit, EventEmitter, ChangeDetectorRef } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; import { OnOffControlBaseComponent } from '@talenra/ngx-base/shared'; /** * Event emitted when the checkbox's `checked` value changes. * * ### Import * * ```typescript * import { CheckboxChange } from '@talenra/ngx-base/checkbox'; * ``` * * @see {@link CheckboxComponent} */ interface CheckboxChange { /** Reference to the emitting checkbox component */ source: CheckboxComponent; /** Current value of the checked property */ checked: boolean; } /** * Values accepted by the `CheckboxComponent`'s `size` input. * * ```html * * ``` * * ### Import * * ```typescript * import { CheckboxSize } from '@talenra/ngx-base/checkbox'; * ``` * * @see {@link CheckboxComponent} * @see {@link TCheckboxComponent} */ declare const CheckboxSize: { readonly S: "s"; readonly M: "m"; }; /** * Type of values accepted by the `CheckboxComponent`'s `size` input. * * ### Import * * ```typescript * import { TCheckboxSize } from '@talenra/ngx-base/checkbox'; * ``` * * @see {@link CheckboxComponent} * @see {@link CheckboxSize} */ type TCheckboxSize = (typeof CheckboxSize)[keyof typeof CheckboxSize]; /** * Values accepted by the `CheckboxComponent`'s `labelPosition` input. Determines * whether the label is displayed before or after the checkbox. * * ```html * * ``` * * ### Import * * ```typescript * import { CheckboxLabelPosition } from '@talenra/ngx-base/checkbox'; * ``` * * @see {@link CheckboxComponent} * @see {@link TCheckboxLabelPosition} */ declare const CheckboxLabelPosition: { readonly Before: "before"; readonly After: "after"; }; /** * Type of values accepted by the `CheckboxComponent`'s `labelPosition` input. * * ### Import * * ```typescript * import { TCheckboxLabelPosition } from '@talenra/ngx-base/checkbox'; * ``` * * @see {@link CheckboxComponent} * @see {@link CheckboxLabelPosition} */ type TCheckboxLabelPosition = (typeof CheckboxLabelPosition)[keyof typeof CheckboxLabelPosition]; /** * `` is an on/off control. * * Other than a native checkbox element, `` keeps `value` and `checked` * properties in sync (both are either `true` or `false`). * * If property `indeterminate` is set true, the checkbox is presented in "mixed" state, * regardless of its value or checked state. * * #### Reactive form * * ```typescript * // Component class * sampleForm: FormGroup = new FormGroup({ * rememberMe: new FormControl(true), * disabledCheckbox: new FormControl({ value: false, disabled: true }), * }); * ``` * * ```html * *
* * *
* ``` * * #### Template driven form * * ```typescript * // Import `FormsModule` in the declaring module * import { FormsModule } from '@angular/forms'; * @NgModule({ * // ... * imports: [FormsModule], *}) * ``` * * ```typescript * // Component class * sampleValue = true; * ``` * * ```html * *
* *
* ``` * * #### Formless * * ```typescript * // Component class * sampleValue = true; * ``` * * ```html * * * ``` * * ### Import * * ```typescript * import { CheckboxModule } from '@talenra/ngx-base/checkbox'; * ``` * * ../../#/on-off-controls */ declare class CheckboxComponent extends OnOffControlBaseComponent implements ControlValueAccessor, OnInit, AfterViewInit { /** * Determines the size of the rendered checkbox. * * ```html * * ``` */ size: TCheckboxSize; /** * Determines whether the label is displayed before or after the checkbox. * * ```html * * ``` */ labelPosition: TCheckboxLabelPosition; private useTransition; private hostClass; /** * The control's indeterminate state. * * "Indeterminate" means it is not possible to say whether the control is checked or unchecked. * Check the MDN docs for more information and a use-case. * * The checkbox is presented in "mixed" state while `indeterminate` is `true`, regardless of * its `checked` state or `value`. * * ```html * * * ``` * * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input/checkbox#indeterminate_state_checkboxes|MDN: Indeterminate state checkboxes} */ get indeterminate(): boolean; /** Set the control's indeterminate state. */ set indeterminate(value: boolean); /** @internal */ _indeterminate: boolean; /** * Disables handling of click events while the visual appearance of Checkbox is not modified (other than `disable` * would). Disabling pointer events is useful when the checkbox is used as a state indicator only and logic is handled * elsewhere. * * ```html * * ``` */ pointerDisabled: boolean; /** * Event emitted when the checkbox's `indeterminate` value changes. * * ```typescript * // Component class * indeterminateChange(indeterminate: boolean): void => { * console.log(`Checkbox is ${indeterminate ? '' : 'not '}indeterminate`); * } * ``` * * ```html * * * ``` */ indeterminateChange: EventEmitter; protected changeDetector: ChangeDetectorRef; /** @internal */ ngOnInit(): void; /** @internal */ ngAfterViewInit(): void; /** * Event emitted when the checkbox's `checked` value changes. * * ```typescript * // Component class * import { CheckboxChange } from '@talenra/ngx-base/checkbox'; * checkboxChange: (change: CheckboxChange) => { * console.log(`Checkbox (id: ${change.source.id}) is ${change.checked ? '' : 'not '}checked`); * } * ``` * * ```html * * ; static ngAcceptInputType_indeterminate: unknown; static ngAcceptInputType_pointerDisabled: unknown; } export { CheckboxComponent, CheckboxLabelPosition, CheckboxSize }; export type { CheckboxChange, TCheckboxLabelPosition, TCheckboxSize };