import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2026 GoodData Corporation
import { useId } from "react";
import { bem } from "../@utils/bem.js";
import { UiRadio } from "../UiRadio/UiRadio.js";
const { b, e } = bem("gd-ui-kit-radio-row");
/**
 * Selectable row composed of a radio + title + optional description + optional
 * trailing slot. Mirror of `UiLabelChecklistRow` for the radio case.
 *
 * @internal
 */
export function UiRadioRow({ checked, onChange, name, value, title, description, trailing, disabled, dataTestId, }) {
    const inputId = useId();
    const descriptionId = useId();
    return (_jsxs("div", { className: b({ disabled: disabled ?? false }), "data-testid": dataTestId, children: [
            _jsx(UiRadio, { id: inputId, checked: checked, onChange: onChange ? () => onChange() : undefined, name: name, value: value, disabled: disabled, accessibilityConfig: description ? { ariaDescribedBy: descriptionId } : undefined }), _jsxs("span", { className: e("text"), children: [
                    _jsx("label", { className: e("title"), htmlFor: inputId, children: title }), description ? (_jsx("span", { id: descriptionId, className: e("description"), children: description })) : null] }), trailing ? _jsx("span", { className: e("trailing"), children: trailing }) : null] }));
}
