'use strict';

var clsx = require('clsx');
var jsxRuntime = require('react/jsx-runtime');

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

module.exports = RadioButton;
//# sourceMappingURL=RadioButton.js.map
