"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Radio = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const useCheckControlled_1 = require("../useCheckControlled");
const constants_1 = require("./constants");
const Icon_1 = require("./Icon");
const styles_1 = require("./styles");
const useLogic_1 = require("./useLogic");
exports.Radio = (0, react_1.forwardRef)((props, ref) => {
    (0, useCheckControlled_1.useCheckControlled)('Radio', props);
    const { onChange, isChecked, isError, disabled, restProps, className, name, style, inputRef, value, id, } = (0, useLogic_1.useLogic)(props);
    return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { "$isDisabled": disabled, "$isError": isError, "$isChecked": isChecked, className: className, style: style, ref: ref, ...restProps, children: [(0, jsx_runtime_1.jsx)(styles_1.Input, { type: "radio", name: name, checked: isChecked, disabled: disabled, onChange: onChange, "aria-checked": isChecked, "aria-disabled": disabled, ref: inputRef, value: value, id: id }), (0, jsx_runtime_1.jsx)(styles_1.IconWrapper, { className: constants_1.radioClassnames.iconWrapper, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { className: constants_1.radioClassnames.icon }) })] }));
});
