'use strict';

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

var iconsReact = require('@cloudtower/icons-react');
var index$2 = require('../Icon/index.js');
var index$1 = require('../LegacySelect/index.js');
var index = require('../Typo/index.js');
var useParrotTranslation = require('../../hooks/useParrotTranslation.js');
var cs = require('classnames');
var React = require('react');
var select_style = require('./select.style.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var cs__default = /*#__PURE__*/_interopDefault(cs);
var React__default = /*#__PURE__*/_interopDefault(React);

var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
const Select = (props) => {
  const { size = "middle", isLoadingValue } = props;
  const { t } = useParrotTranslation();
  const typo = {
    large: index.Typo.Label.l2_regular,
    middle: index.Typo.Label.l3_regular,
    small: index.Typo.Label.l4_regular
  }[size];
  return /* @__PURE__ */ React__default.default.createElement(
    index$1,
    __spreadProps(__spreadValues({}, props), {
      className: cs__default.default(
        select_style.SelectStyle,
        select_style.SelectIconStyle,
        select_style.SelectSizeStyle,
        isLoadingValue ? "select-loading-value" : "",
        props.className
      ),
      placeholder: /* @__PURE__ */ React__default.default.createElement("span", { className: cs__default.default(typo, select_style.PlaceholderTextStyle) }, isLoadingValue ? t("components.loading") : props.placeholder),
      suffixIcon: props.suffixIcon || (props.loading ? void 0 : /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement(
        index$2,
        {
          className: "select-suffix",
          src: iconsReact.ArrowChevronDown16BoldTertiaryIcon
        }
      ), /* @__PURE__ */ React__default.default.createElement(
        index$2,
        {
          className: "select-hover-suffix",
          src: iconsReact.ArrowChevronDown16BoldBlueIcon
        }
      ), /* @__PURE__ */ React__default.default.createElement(
        index$2,
        {
          className: "select-active-suffix",
          src: iconsReact.ArrowChevronDown16BoldBlueIcon
        }
      ), /* @__PURE__ */ React__default.default.createElement(
        index$2,
        {
          className: "select-expanded-suffix",
          src: iconsReact.ArrowChevronUp16BoldBlueIcon
        }
      ), /* @__PURE__ */ React__default.default.createElement(
        index$2,
        {
          className: "select-expanded-search-suffix",
          src: iconsReact.Search16BlueIcon
        }
      ), /* @__PURE__ */ React__default.default.createElement(
        index$2,
        {
          className: "select-focus-suffix",
          src: iconsReact.ArrowChevronDown16BoldTertiaryIcon
        }
      ), /* @__PURE__ */ React__default.default.createElement(
        index$2,
        {
          className: "select-error-suffix",
          src: iconsReact.ArrowChevronDown16BoldTertiaryIcon
        }
      ), /* @__PURE__ */ React__default.default.createElement(
        index$2,
        {
          className: "select-error-hover-suffix",
          src: iconsReact.ArrowChevronDown16BoldSecondaryIcon
        }
      ), /* @__PURE__ */ React__default.default.createElement(
        index$2,
        {
          className: "select-error-active-suffix",
          src: iconsReact.ArrowChevronDown16BoldSecondaryIcon
        }
      ), /* @__PURE__ */ React__default.default.createElement(
        index$2,
        {
          className: "select-error-expanded-suffix",
          src: iconsReact.ArrowChevronUp16BoldSecondaryIcon
        }
      ), /* @__PURE__ */ React__default.default.createElement(
        index$2,
        {
          className: "select-error-expanded-search-suffix",
          src: iconsReact.Search16SecondaryIcon
        }
      ), /* @__PURE__ */ React__default.default.createElement(
        index$2,
        {
          className: "select-error-focus-suffix",
          src: iconsReact.ArrowChevronDown16BoldTertiaryIcon
        }
      )))
    })
  );
};
var Select$1 = Select;

exports.default = Select$1;
