import { ComponentDefaultProps } from '@justeattakeaway/pie-webc-core'; import { CSSResult } from 'lit'; import { FormControlInterface } from '@justeattakeaway/pie-webc-core'; import { GenericConstructor } from '@justeattakeaway/pie-webc-core'; import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement'; import * as React_2 from 'react'; import { TemplateResult } from 'lit-html'; export declare interface CheckboxProps { /** * The value of the checkbox (used as a key/value pair in HTML forms with `name`). */ value?: string; /** * The name of the checkbox (used as a key/value pair with `value`). This is required in order to work properly with forms. */ name?: string; /** * Same as the HTML disabled attribute - indicates whether or not the checkbox is disabled. */ disabled?: boolean; /** * The default checked state of the checkbox (not necessarily the same as the current checked state). */ defaultChecked?: boolean; /** * The checked state of the checkbox. */ checked?: boolean; /** * Indicates whether the checkbox visually shows a horizontal line in the box instead of a check/tick. * It has no impact on whether the checkbox's value is used in a form submission. That is decided by the checked state, regardless of the indeterminate state. */ indeterminate?: boolean; /** * If true, the checkbox must be checked for the form to be submittable. */ required?: boolean; /** * An optional assistive text to display below the input element. Must be provided when the status is success or error. */ assistiveText?: string; /** * The status of the checkbox component / assistive text. Can be default, success or error. */ status?: typeof statusTypes[number]; /** * The position of the label relative to the checkbox input. */ labelPosition?: typeof labelPositions[number]; /** * Controls how the label container is sized. `hug` wraps the content, `fill` stretches to fill available width. */ labelFit?: typeof labelFits[number]; } export declare type DefaultProps = ComponentDefaultProps>; export declare const defaultProps: DefaultProps; export declare const labelFits: readonly ["hug", "fill"]; export declare const labelPositions: readonly ["leading", "trailing"]; export declare const PieCheckbox: React_2.ForwardRefExoticComponent, "children">> & React_2.RefAttributes & PieCheckboxEvents & ReactBaseType>; /** * @tagname pie-checkbox * @slot - Default slot * @event {CustomEvent} change - when checked state is changed. */ declare class PieCheckbox_2 extends PieCheckbox_base implements CheckboxProps { private _disabledByParent; private _visuallyHiddenError; private _isAnimationAllowed; private _contextAria?; value: string; name: CheckboxProps['name']; checked: boolean; defaultChecked: boolean; disabled: boolean; required: boolean; indeterminate: boolean; private _checkbox; assistiveText: CheckboxProps['assistiveText']; status: "default" | "success" | "error"; labelPosition: "leading" | "trailing"; labelFit: "hug" | "fill"; private _abortController; connectedCallback(): void; /** * Forwards a click dispatched directly on the host (for example from a `pie-list-item` row) * to the internal input. Clicks on the internal label already toggle the input natively via * its `for` attribute, so only host-level clicks are forwarded, to avoid a double toggle. * @param {MouseEvent} event */ private _handleClick; disconnectedCallback(): void; /** * (Read-only) returns a ValidityState with the validity states that this element is in. * https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/validity */ get validity(): ValidityState; /** * Ensures that the form value is in sync with the component. */ private _handleFormAssociation; /** * Called after the disabled state of the element changes, * either because the disabled attribute of this element was added or removed; * or because the disabled state changed on a
that's an ancestor of this element. * @param disabled - The latest disabled state of the input. */ formDisabledCallback(disabled: boolean): void; protected updated(): void; /** * When an ancestor provides ARIA (for example a `pie-list-item`), applies the fields this * control cares about to the internal input (the element that carries the checkbox semantics). * Does nothing when used standalone, where the name comes from the default slot / label. */ private _applyContextAria; /** * Captures the native change event and wraps it in a custom event. * @param {Event} event - This should be the change event that was listened for on an input element with `type="checkbox"`. */ private _handleChange; /** * Called when the form that contains this component is reset. * If the current checked state is different to the default checked state, * the checked state is reset to the default checked state and a `change` event is emitted. */ formResetCallback(): void; render(): TemplateResult<1>; static styles: CSSResult; } declare const PieCheckbox_base: GenericConstructor & typeof PieElement; declare type PieCheckboxEvents = { onChange?: (event: CustomEvent) => void; }; declare type ReactBaseType = Omit, 'onChange'>; export declare const statusTypes: readonly ["default", "success", "error"]; export { }