"use strict";
const jsxRuntime = require("react/jsx-runtime");
const React = require("react");
const styles_lib_components_Box_Box_cjs = require("../Box/Box.cjs");
const styles_lib_components_private_Field_Field_cjs = require("../private/Field/Field.cjs");
const styles_lib_components_Dropdown_Dropdown_css_cjs = require("./Dropdown.css.cjs");
const styles_lib_components_Accordion_AccordionItem_cjs = require("../Accordion/AccordionItem.cjs");
const styles_lib_components_icons_IconChevron_IconChevron_cjs = require("../icons/IconChevron/IconChevron.cjs");
const Dropdown = React.forwardRef(
  (props, ref) => {
    const {
      children,
      value,
      onChange,
      onBlur,
      onFocus,
      placeholder,
      disabled,
      ...restProps
    } = props;
    return /* @__PURE__ */ jsxRuntime.jsx(
      styles_lib_components_private_Field_Field_cjs.Field,
      {
        ...restProps,
        disabled,
        prefix: void 0,
        secondaryMessage: null,
        value,
        children: (overlays, { className, paddingRight, ...fieldProps }, icon) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
          icon,
          /* @__PURE__ */ jsxRuntime.jsx(
            styles_lib_components_Box_Box_cjs.Box,
            {
              component: "select",
              value,
              defaultValue: typeof value === "undefined" ? "" : void 0,
              onChange,
              onBlur,
              onFocus,
              placeholder,
              className: [styles_lib_components_Dropdown_Dropdown_css_cjs.field, className],
              ...fieldProps,
              ref,
              children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
                !value || placeholder ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: true, children: disabled ? "" : placeholder }) : null,
                children
              ] })
            }
          ),
          overlays,
          /* @__PURE__ */ jsxRuntime.jsx(
            styles_lib_components_Box_Box_cjs.Box,
            {
              position: "absolute",
              display: "flex",
              alignItems: "center",
              justifyContent: "center",
              pointerEvents: "none",
              height: "touchable",
              width: "touchable",
              top: 0,
              right: 0,
              children: /* @__PURE__ */ jsxRuntime.jsx(styles_lib_components_Accordion_AccordionItem_cjs.Text, { baseline: false, children: /* @__PURE__ */ jsxRuntime.jsx(styles_lib_components_icons_IconChevron_IconChevron_cjs.IconChevron, { tone: disabled ? "secondary" : void 0 }) })
            }
          )
        ] })
      }
    );
  }
);
Dropdown.displayName = "Dropdown";
exports.Dropdown = Dropdown;
