"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var SelectInput_exports = {};
__export(SelectInput_exports, {
  default: () => SelectInput_default
});
module.exports = __toCommonJS(SelectInput_exports);
var import_react = __toESM(require("react"));
var import_react_select = __toESM(require("react-select"));
var import_styled_components = require("styled-components");
var DropdownIndicatorModule = __toESM(require("./DropdownIndicator"));
var ValueContainerModule = __toESM(require("./ValueContainer"));
var ControlModule = __toESM(require("./Control"));
var MenuListModule = __toESM(require("./MenuList"));
var OptionModule = __toESM(require("./Option"));
var import_IndicatorsContainer = require("./IndicatorsContainer");
var import_BaseInput = require("../BaseInput");
const stylesFn = (theme) => ({
  control: ControlModule.getStyles(theme),
  valueContainer: ValueContainerModule.getStyles(),
  dropdownIndicator: DropdownIndicatorModule.getStyles(),
  menuList: MenuListModule.getStyles(theme),
  option: OptionModule.getStyles(),
  input: (provided) => ({
    ...provided,
    color: theme.colors.neutral.c100
  }),
  placeholder: (provided) => ({
    ...provided,
    color: theme.colors.neutral.c60
  }),
  singleValue: (provided) => ({
    ...provided,
    color: "inherit"
  }),
  multiValue: (provided) => ({
    ...provided,
    backgroundColor: theme.colors.primary.c20,
    borderRadius: theme.radii[1]
  }),
  multiValueLabel: (provided) => ({
    ...provided,
    color: theme.colors.neutral.c100
  }),
  multiValueRemove: (provided) => ({
    ...provided,
    cursor: "pointer",
    ":hover": {
      color: theme.colors.error.c50,
      backgroundColor: theme.colors.error.c30
    }
  }),
  menu: (provided) => ({
    ...provided,
    border: 0,
    boxShadow: "none",
    background: "none"
  })
});
function SelectInput({
  error,
  rowHeight = 48,
  unwrapped,
  extendStyles,
  ...props
}) {
  const theme = (0, import_styled_components.useTheme)();
  const styles = (0, import_react.useMemo)(
    () => extendStyles ? extendStyles(stylesFn(theme)) : stylesFn(theme),
    [theme, extendStyles]
  );
  const { isDisabled, components = {} } = props;
  const innerContent = /* @__PURE__ */ import_react.default.createElement(
    import_react_select.default,
    {
      ...props,
      styles: {
        ...styles,
        ...props.styles
      },
      classNamePrefix: "react-select",
      components: {
        Control: ControlModule.Control,
        ValueContainer: ValueContainerModule.ValueContainer,
        IndicatorsContainer: import_IndicatorsContainer.IndicatorsContainer,
        DropdownIndicator: DropdownIndicatorModule.DropdownIndicator,
        MenuList: MenuListModule.MenuList,
        Option: OptionModule.Option,
        IndicatorSeparator: null,
        ...components
      },
      rowHeight
    }
  );
  if (unwrapped)
    return innerContent;
  return /* @__PURE__ */ import_react.default.createElement("div", null, innerContent, error && !isDisabled && /* @__PURE__ */ import_react.default.createElement(import_BaseInput.InputErrorContainer, { variant: "paragraph" }, error));
}
var SelectInput_default = (0, import_react.memo)(SelectInput);
//# sourceMappingURL=index.js.map
