'use strict';

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

var art = require('@wise/art');
var clsx = require('clsx');
var React = require('react');
var Body = require('../../body/Body.js');
require('../../common/theme.js');
require('../../common/direction.js');
require('../../common/propsValues/control.js');
require('../../common/propsValues/breakpoint.js');
require('../../common/propsValues/size.js');
var typography = 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/icons');
require('react-intl');
require('../../common/closeButton/CloseButton.messages.js');
var jsxRuntime = require('react/jsx-runtime');

function Option({
  label,
  currency = '',
  note = '',
  secondary = '',
  icon,
  selected = false,
  testId
}) {
  const iconElement = icon ? /*#__PURE__*/React.cloneElement(icon, {
    size: 24,
    className: 'tw-icon'
  }) : currency && /*#__PURE__*/jsxRuntime.jsx(art.Flag, {
    code: currency.toLowerCase(),
    intrinsicSize: 24
  });
  const titleAndNoteElement = /*#__PURE__*/jsxRuntime.jsxs(Body.default, {
    as: "span",
    type: typography.Typography.BODY_LARGE,
    className: selected ? 'text-ellipsis' : undefined,
    children: [label, note && /*#__PURE__*/jsxRuntime.jsx(Body.default, {
      as: "span",
      className: "m-l-1",
      children: note
    })]
  });
  const secondaryElement = secondary && /*#__PURE__*/jsxRuntime.jsx(Body.default, {
    className: clsx.clsx(selected && 'text-ellipsis'),
    children: secondary
  });
  return iconElement ? /*#__PURE__*/jsxRuntime.jsxs("div", {
    className: "d-flex np-option-content",
    "data-testid": testId,
    children: [/*#__PURE__*/jsxRuntime.jsx("div", {
      className: `d-flex flex-column${selected ? ' justify-content-center' : ''}`,
      children: iconElement
    }), /*#__PURE__*/jsxRuntime.jsxs("div", {
      className: "d-flex flex-column justify-content-center",
      children: [titleAndNoteElement, secondaryElement]
    })]
  }) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
    children: [iconElement, titleAndNoteElement, secondaryElement]
  });
}

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