'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var Option = require('../common/Option/Option.js');
var Switch = require('../switch/Switch.js');
var jsxRuntime = require('react/jsx-runtime');

const stopPropagation = event => {
  if (event) {
    event.stopPropagation();
    event.preventDefault();
    event.nativeEvent?.stopImmediatePropagation?.();
  }
};
/**
 * @deprecated Please use `<ListItem />` instead.
 * @deprecatedSince 46.104.0
 * @see [Source](../listItem/ListItem.tsx)
 * @see [Storybook](https://storybook.wise.design/?path=/docs/content-listitem--docs)
 * @see [Design docs](https://wise.design/components/list-item)
 * @see [Release notes](https://transferwise.atlassian.net/wiki/spaces/DS/pages/3647251055/List+Item+release+notes)
 */
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__*/jsxRuntime.jsx(Option.default, {
    ...sharedProps,
    className: "np-switch-option",
    button: /*#__PURE__*/jsxRuntime.jsx(Switch.default, {
      id: id,
      checked: checked,
      disabled: disabled,
      "aria-label": ariaLabel,
      onClick: toggle
    }),
    onClick: toggle
  });
};

exports.default = SwitchOption;
//# sourceMappingURL=SwitchOption.js.map
