import type { CSSResultGroup } from 'lit'; import DSAErrorText from '../error-text/error-text'; import DSAVisuallyHidden from '../visually-hidden/visually-hidden'; import { FormControlController } from '../../internal/form'; import { ShoelaceElement } from '../../internal/shoelace-element'; import type { ShoelaceFormControl } from '../../internal/shoelace-element'; /** * @summary Radio groups are used to group multiple [radios](/components/radio), [radio buttons](/components/radio-button) or [radio cards](/components/radio-card) so they function as a single form control. * @documentation https://dsa.service-public-autonomie.fr/latest/librairie-webcomponents/radio/groupe-de-radios-radio-group/web-cfij4VEK * * @dependency dsa-error-text * @dependency dsa-visually-hidden * * @slot - The default slot where ``, ``, or `` elements are placed. * @slot label - The radio group's label. Required for proper accessibility. Alternatively, you can use the `label` * attribute. * @slot help-text - Text that describes how to use the input. Alternatively, you can use the `help-text` attribute. * @slot tooltip - The tooltip slot allows additional information to be passed along the label * * @event dsa-change - Emitted when the radio group's selected value changes. * @event dsa-input - Emitted when the radio group receives user input. * @event dsa-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied. */ export default class DSARadioGroup extends ShoelaceElement implements ShoelaceFormControl { static styles: CSSResultGroup; static dependencies: { 'dsa-error-text': typeof DSAErrorText; 'dsa-visually-hidden': typeof DSAVisuallyHidden; }; protected readonly formControlController: FormControlController; private readonly hasSlotController; private customValidityMessage; private customValidityError; private validationTimeout; defaultSlot: HTMLSlotElement; validationInput: HTMLInputElement; private hasRadioButtons; private hasRadioCards; private readonlyRadioButtonValue; defaultValue: string; /** * The radio group's label. Required for proper accessibility. If you need to display HTML, use the `label` slot * instead. */ label: string; /** The radio groups's help text. If you need to display HTML, use the `help-text` slot instead. */ helpText: string; /** Provides an accessible description for the element */ description: string; /** The name of the radio group, submitted as a name/value pair with form data. */ name: string; /** The current value of the radio group, submitted as a name/value pair with form data. */ value: string; /** Deselect a radio value if it has been clicked again */ deselectable: boolean; /** * By default, form controls are associated with the nearest containing `
` element. This attribute allows you * to place the form control outside of a form and associate it with the form that has this `id`. The form must be in * the same document or shadow root for this to work. */ form: string; /** Ensures a child radio is checked before allowing the containing form to submit. */ required: boolean; /** Disables children radios. */ disabled: boolean; /** Sets children radios to readonly. */ readonly: boolean; /** Sets the orientation of the radio options */ horizontal: boolean; /** Indicates whether the input should be in error state */ error: boolean; /** The error message or messages that are shown when “error” is set to “true”. To display several messages, * they must be separated by a pipe character, e.g. "Error 1|Error 2|Error 3” * */ errorMessage: string | string[]; /** Hides the label to avoid duplication. Please make sure there is another visible label for the group. You still need to provide a `label` via attribute or slot. */ hideLabel: boolean; /** Gets the validity state object */ get validity(): ValidityState; /** Gets the validation message */ get validationMessage(): string; connectedCallback(): void; firstUpdated(): void; private getAllRadios; private handleRadioClick; private handleKeyDown; private handleLabelClick; private handleSlotChange; private handleInvalid; private updateCheckedRadio; private getDescriptionIds; updateTabIndexes(): void; handleValueChange(): void; handleErrorChange(): void; handleDisabledChange(): void; handleReadonlyChange(): void; /** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */ checkValidity(): boolean; /** Gets the associated form, if one exists. */ getForm(): HTMLFormElement | null; /** Checks for validity and shows the browser's validation message if the control is invalid. */ reportValidity(): boolean; /** Sets a custom validation message. Pass an empty string to restore validity. */ setCustomValidity(message?: string): void; /** Sets focus on the radio-group. */ focus(options?: FocusOptions): void; render(): import("lit").TemplateResult<1>; } declare global { interface HTMLElementTagNameMap { 'dsa-radio-group': DSARadioGroup; } }