'use strict';

var icons = require('@transferwise/icons');
var clsx = require('clsx');
require('react');
var InputGroup = require('../../InputGroup.js');
var SelectInputClearButton = require('../ClearButton/SelectInputClearButton.js');
var SelectInputTriggerButton = require('../TriggerButton/SelectInputTriggerButton.js');
var SelectInputButtonInput = require('../ButtonInput/SelectInputButtonInput.js');
var jsxRuntime = require('react/jsx-runtime');

function SelectInputDefaultRenderTrigger({
  content,
  placeholderShown,
  clear,
  disabled,
  size,
  className
}) {
  return /*#__PURE__*/jsxRuntime.jsx(InputGroup.InputGroup, {
    addonEnd: {
      content: /*#__PURE__*/jsxRuntime.jsxs("span", {
        className: clsx.clsx('np-select-input-addon-container', disabled && 'disabled'),
        children: [clear != null && !placeholderShown ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
          children: [/*#__PURE__*/jsxRuntime.jsx(SelectInputClearButton.SelectInputClearButton, {
            onClick: event => {
              event.preventDefault();
              clear();
            }
          }), /*#__PURE__*/jsxRuntime.jsx("span", {
            className: "np-select-input-addon-separator"
          })]
        }) : null, /*#__PURE__*/jsxRuntime.jsx("span", {
          className: "np-select-input-addon",
          children: /*#__PURE__*/jsxRuntime.jsx(icons.ChevronDown, {
            size: 16
          })
        })]
      }),
      initialContentWidth: 24 + 4,
      padding: 'sm'
    },
    disabled: disabled,
    className: className,
    children: /*#__PURE__*/jsxRuntime.jsx(SelectInputTriggerButton.SelectInputTriggerButton, {
      as: SelectInputButtonInput.SelectInputButtonInput,
      size: size,
      children: /*#__PURE__*/jsxRuntime.jsx("span", {
        className: clsx.clsx('np-select-input-content', placeholderShown && 'np-select-input-placeholder'),
        children: content
      })
    })
  });
}
const DefaultRenderTrigger = SelectInputDefaultRenderTrigger;

exports.DefaultRenderTrigger = DefaultRenderTrigger;
exports.SelectInputDefaultRenderTrigger = SelectInputDefaultRenderTrigger;
//# sourceMappingURL=SelectInputDefaultRenderTrigger.js.map
