import { ComponentInterface, EventEmitter } from '../../stencil-public-runtime'; import { BaseChoiceControl } from '../_shared/form/base-choice-control'; /** * @component BcmCheckbox * @description * A form-associated checkbox component representing a boolean choice. * Integrates with native HTML forms via ElementInternals while supporting * **three validation strategies** via `validation-mode`: * * - **`native`** * - Participates in native browser constraint validation. * - Sets the underlying input's `required`. * - Browser may show native validation bubbles when submit/reportValidity happens. * * - **`silent`** * - Does **not** set native `required` (prevents browser bubble). * - Computes "missing required" internally and exposes it via `error` + `caption`. * - UI errors are **gated**: shown only after `touched` or a form submit attempt. * * - **`none`** * - Value-only mode: submits value but never becomes invalid. * * ## UI error gating (silent mode) * - `touched` becomes true after first user interaction * - `submitAttempted` becomes true when the parent form emits `submit` * * ## Value behavior * - When checked → submits `value` (default: `"on"`). * - When unchecked → submits no value (`null`). * - When disabled → no submission and no validity participation. * * ## Shadow Parts * - `checkbox` → root container * - `control` → visual checkbox box * - `icon` → icon container (check or minus) * - `label` → label text * - `caption` → helper/error text (silent mode UI) * - `input` → hidden native input * * @example Basic usage * * I agree to the terms and conditions * * * @example Silent validation (no native bubble) *
* * Subscribe to newsletter * * *
* * @example Value-only mode * * Allow analytics * */ export declare class Checkbox extends BaseChoiceControl implements ComponentInterface { /** Host element */ el: HTMLElement; /** Form-associated internals (ElementInternals API) */ internals: ElementInternals; /** * Unique ID for the component. Automatically generated if not specified. * Used to bind the visible label to the internal input. */ _id?: string; /** Visible label text (optional). You can also use the default slot. */ label?: string; /** * Indeterminate (mixed) state. * Useful when a group selection is partially selected. */ indeterminate: boolean; /** Size variant (affects control + typography). */ size: 'small' | 'medium' | 'large'; /** * Visual error state. * - In `silent` mode this can be managed internally. * - In other modes you can set it externally as well. */ error: boolean; /** Helper / error caption (silent mode UI) */ caption?: string; /** Label position relative to the checkbox control. */ labelPosition: 'left' | 'right'; /** Makes checkbox occupy full width (if your styles support it). */ fullWidth: boolean; /** * Mirror state used to keep the native input synced. * `checked` is owned by BaseChoiceControl. */ internalChecked: boolean; /** Gate for silent-mode UI */ private touched; /** Gate for silent-mode UI */ private submitAttempted; /** Fired whenever the checked state changes. */ bcmCheckboxChange: EventEmitter<{ element: HTMLInputElement; checked: boolean; }>; /** Reference to the underlying native input. */ private inputElement; componentWillLoad(): void; componentDidLoad(): void; disconnectedCallback(): void; private onFormSubmit; formResetCallback(): void; protected syncFromBase(newValue: boolean): void; /** Keep native input in sync when indeterminate changes. */ protected onIndeterminateChange(): void; private syncNativeInput; protected updateFormValueAndValidity(opts?: { setUi?: boolean; }): void; private handleChange; private getStyles; private classes; render(): any; }