import { clsx } from 'clsx';
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';

function RadioButton({
  id,
  value = '',
  name,
  checked,
  onChange,
  disabled,
  readOnly,
  className,
  'aria-describedby': ariaDescribedBy
}) {
  return /*#__PURE__*/jsxs(Fragment, {
    children: [/*#__PURE__*/jsx("input", {
      type: "radio",
      className: clsx('sr-only', className),
      id: id,
      value: value,
      name: name,
      checked: checked,
      disabled: disabled || readOnly,
      "aria-describedby": ariaDescribedBy,
      onChange: () => {
        if (!checked) {
          onChange?.(value);
        }
      }
    }), /*#__PURE__*/jsx("span", {
      className: clsx('tw-radio-button', {
        checked,
        disabled: disabled || readOnly
      }),
      children: /*#__PURE__*/jsx("span", {
        className: "tw-radio-check"
      })
    })]
  });
}

export { RadioButton as default };
//# sourceMappingURL=RadioButton.mjs.map
