"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RadioGroup = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const FormControl_1 = require("../FormControl");
const Tooltip_1 = require("../Tooltip");
const RadioGroupContext_1 = require("./RadioGroupContext");
const styles_1 = require("./styles");
const useLogic_1 = require("./useLogic");
/**
 * Компонент RadioGroup - fieldset для Radio компонентов
 */
exports.RadioGroup = (0, react_1.forwardRef)((props, ref) => {
    const { errorText, formControlProps, groupLabel, labelId, isError, required, contextValue, className, row, children, disabled, style, inputRef, } = (0, useLogic_1.useLogic)(props);
    return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { arrow: false, title: isError && errorText, placement: "bottom-start", followCursor: true, children: (0, jsx_runtime_1.jsxs)(FormControl_1.FormControl, { ...formControlProps, ref: ref, children: [groupLabel && ((0, jsx_runtime_1.jsx)(styles_1.StyledFormLabel, { id: labelId, htmlFor: labelId, required: required, disabled: disabled, children: groupLabel })), (0, jsx_runtime_1.jsx)(RadioGroupContext_1.RadioGroupContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)(styles_1.Fieldset, { id: labelId, "aria-labelledby": labelId, className: className, role: "radiogroup", "$row": row, style: style, ref: inputRef, tabIndex: -1, children: children }) })] }) }));
});
