import { Cre8FormElement } from '../cre8-form-element'; import '../field-note/field-note'; /** * A Radio Field Item adds a radio button to a Radio Field. Radio buttons let a user choose only one of several * options. Do not use a single radio button, because once selected, it cannot be de-selected. If the user can only * choose one, none or many options, use Checkbox instead. */ export declare class Cre8RadioFieldItem extends Cre8FormElement { type: string; static styles: import("lit").CSSResult[]; /** * Identifies the element that provides a detailed, extended description for the object. * * @attr{string} */ ariaDescribedBy?: string; /** * A Boolean attribute which, if present, sets the radio button as selected. * * @attr {boolean} */ checked?: boolean; /** * The Boolean disabled attribute, when present, makes the element not mutable, focusable, or even submitted with * the form. The user can neither edit nor focus on the control, nor its form control descendants. * * @attr {boolean} */ disabled?: boolean; /** * Get the radio field item input */ field: HTMLInputElement; /** * The fieldId attribute is assigned to the HTML input element of the radio button and the for attribute of the * corresponding label. */ fieldId?: string; /** * A FieldNote can be placed to provide guidance. It's frequently used to in the context of form fields for extra * information or validation messages. */ fieldNote?: string; /** * Sets the item fieldnote icon. * * - **check** renders a badge with success state treatment * - **error** renders a badge with error state treatment */ fieldNoteIconName?: string; /** * Radio item fieldnote knockout * * @attr {boolean} */ fieldNoteKnockout?: boolean; /** * Sets the error state of the fieldnote. * * @attr {boolean} */ fieldNoteIsError?: boolean; /** * The isError attribute is used to indicate an error state related to the radio button. * * @attr {boolean} */ isError?: boolean; /** * The isSuccess attribute is used to indicate a success state related to the radio button. * * @attr {boolean} */ isSuccess?: boolean; /** * The label attribute is used to assign a value to the label element corresponding to this radio button. */ label?: string; /** * Required attribute * * @attr {boolean} */ required?: boolean; /** * Initial checked for initial checked state */ private initialChecked?; /** * Connected callback lifecycle * 1) Set the initial checked value to the checked property * 2) Auto-generate the fieldId if a user doesn't provided so that the form field is accessible * 3) If a field note exists, set the aria-describedby attribute to make sure the field note is read out */ connectedCallback(): void; /** * Reset the radio field */ resetField(): void; /** * Reset the radio field items tab indeces */ resetTabIndeces(radioFieldItems: Cre8RadioFieldItem[]): void; /** * Remove checked * 1) Remove checked property from all items and set tabindex to -1 * 2) Reset the form field to not checked */ removeChecked(): void; /** * Reset form callback * 1) Remove the checked state from all radio elements * 2) Set the checked state to the initial checked state * 3) Set the radio field input checked attribute to the initial checked state */ formResetCallback(): void; /** * access role when radio-field-item embedded in radio-field */ private _getRole; /** * Toggle active state of primary nav item * 1) Remove isActive state from all sibling elements * 2) Toggle active state of element selected */ private _clickHandler; /** * Handle sibling element updates during handleKeyDown function * 1) Prevent default keyboard functionality to disable scroll with up/down keys * 2) Trigger removeChecked * 3) Focus sibling shadowRoot element * 4) Click sibling shadowRoot element * 5) Set sibling element `tabindex` to `0` * 6) Set sibling element `checked` value */ private _updateSibling; /** * Handle keydown * 1) If left or up arrow key is struck and radio field item exists before current item, * remove checked from all items and add it to the next item * 2) If right or down arrow key is struck and radio field item exists after current item, * remove checked from all items and add checked to the next item. Focus on this item * and set tabindex for when focusing out of radio field and back onto checked item. * 3) If the element is in focused, then for event emission the current * focues element should be clicked to emit event. * 4) If the Tab key is pressed, and none of the items are checked * then jump away from field set to the next tabbable item */ handleKeyDown(e: KeyboardEvent): void; render(): import("lit-html").TemplateResult<1>; } declare global { interface HTMLElementTagNameMap { 'cre8-radio-field-item': Cre8RadioFieldItem; } } export default Cre8RadioFieldItem; //# sourceMappingURL=radio-field-item.d.ts.map