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

function RadioButton({
  id,
  value = '',
  name,
  checked,
  onChange,
  disabled,
  readOnly
}) {
  return /*#__PURE__*/jsxs(Fragment, {
    children: [/*#__PURE__*/jsx("input", {
      type: "radio",
      className: "sr-only",
      id: id,
      value: value,
      name: name,
      checked: checked,
      disabled: disabled || readOnly,
      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
