'use strict';

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

var clsx = require('clsx');
var Button_resolver = require('../button/Button.resolver.js');
require('../common/theme.js');
require('../common/direction.js');
require('@transferwise/neptune-tokens');
var control = require('../common/propsValues/control.js');
require('../common/propsValues/size.js');
require('../common/propsValues/typography.js');
require('../common/propsValues/width.js');
require('../common/propsValues/type.js');
require('../common/propsValues/dateMode.js');
require('../common/propsValues/monthFormat.js');
require('../common/propsValues/position.js');
require('../common/propsValues/layouts.js');
require('../common/propsValues/status.js');
require('../common/propsValues/sentiment.js');
require('../common/propsValues/profileType.js');
require('../common/propsValues/variant.js');
require('../common/propsValues/scroll.js');
require('../common/propsValues/markdownNodeType.js');
require('../common/fileType.js');
require('@transferwise/formatting');
require('@transferwise/icons');
require('react');
require('react-intl');
require('../common/closeButton/CloseButton.messages.js');
var jsxRuntime = require('react/jsx-runtime');
var Option = require('../common/Option/Option.js');

const ActionOption = ({
  action,
  priority = control.Priority.PRIMARY,
  disabled,
  onClick,
  media,
  title,
  content,
  additionalContent,
  complex,
  className,
  showMediaAtAllSizes,
  showMediaCircle,
  isContainerAligned,
  as,
  'aria-label': ariaLabel
}) => {
  const sharedProps = {
    media,
    title,
    content,
    complex,
    disabled,
    showMediaAtAllSizes,
    showMediaCircle,
    className: clsx.clsx('tw-action-option', className),
    isContainerAligned,
    additionalContent,
    as
  };
  const getAriaLabel = () => {
    if (ariaLabel) {
      return ariaLabel;
    }
    const generatedLabels = [];
    if (typeof title === 'string') {
      generatedLabels.push(title);
    }
    if (typeof action === 'string') {
      generatedLabels.push(action);
    }
    return generatedLabels.join(', ') || undefined;
  };
  const mapPriority = priority => {
    switch (priority) {
      case 'primary':
        return 'primary';
      case 'secondary':
        return 'secondary-neutral';
      case 'tertiary':
        return 'tertiary';
      case 'secondary-send':
        return 'secondary';
      default:
        return 'primary';
    }
  };
  return /*#__PURE__*/jsxRuntime.jsx(Option.default, {
    ...sharedProps,
    button: /*#__PURE__*/jsxRuntime.jsx(Button_resolver.default, {
      v2: true,
      size: "sm",
      priority: mapPriority(priority),
      disabled: disabled,
      "aria-label": getAriaLabel(),
      onClick: onClick,
      children: action
    })
  });
};

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