import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { forwardRef } from 'react';
import { useCheckControlled } from '../useCheckControlled';
import { radioClassnames } from './constants';
import { Icon } from './Icon';
import { IconWrapper, Input, Wrapper } from './styles';
import { useLogic } from './useLogic';
export const Radio = forwardRef((props, ref) => {
    useCheckControlled('Radio', props);
    const { onChange, isChecked, isError, disabled, restProps, className, name, style, inputRef, value, id, } = useLogic(props);
    return (_jsxs(Wrapper, { "$isDisabled": disabled, "$isError": isError, "$isChecked": isChecked, className: className, style: style, ref: ref, ...restProps, children: [_jsx(Input, { type: "radio", name: name, checked: isChecked, disabled: disabled, onChange: onChange, "aria-checked": isChecked, "aria-disabled": disabled, ref: inputRef, value: value, id: id }), _jsx(IconWrapper, { className: radioClassnames.iconWrapper, children: _jsx(Icon, { className: radioClassnames.icon }) })] }));
});
