import Option from '../common/Option/Option.mjs';
import Switch from '../switch/Switch.mjs';
import { jsx } from 'react/jsx-runtime';

const stopPropagation = event => {
  if (event) {
    event.stopPropagation();
    event.preventDefault();
    event.nativeEvent?.stopImmediatePropagation?.();
  }
};
const SwitchOption = ({
  checked,
  complex,
  content,
  disabled,
  id,
  media,
  onChange,
  title,
  showMediaCircle,
  showMediaAtAllSizes,
  isContainerAligned,
  'aria-label': ariaLabel
}) => {
  const sharedProps = {
    media,
    title,
    content,
    complex,
    disabled,
    showMediaCircle,
    showMediaAtAllSizes,
    isContainerAligned
  };
  const toggle = event => {
    stopPropagation(event);
    if (disabled) {
      return;
    }
    onChange(!checked);
  };
  return /*#__PURE__*/jsx(Option, {
    ...sharedProps,
    button: /*#__PURE__*/jsx(Switch, {
      id: id,
      checked: checked,
      disabled: disabled,
      "aria-label": ariaLabel,
      onClick: toggle
    }),
    onClick: toggle
  });
};

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