import v from "../../foundation/Icon/Generated/IconCaretDown.es.es.js";
import { IconSize as l } from "../../foundation/Icon/IconSize.es.es.js";
import { useFocusRing as w } from "../../../../../@react-aria/focus/dist/module.es.js";
import { FOCUS_STYLE as c } from "../../utilities/focusStyle.es.es.js";
import { merge as r } from "../../utilities/merge.es.es.js";
import { Validation as b, validationClassMap as h } from "../../utilities/validation.es.es.js";
import t from "react";
import z from "../../foundation/Icon/Generated/IconTrashBin.es.es.js";
import S from "../../foundation/Icon/Generated/IconCross.es.es.js";
import C from "../../foundation/Icon/Generated/IconExclamationMarkTriangle.es.es.js";
var D = /* @__PURE__ */ ((e) => (e.Small = "Small", e.Large = "Large", e))(D || {}), N = /* @__PURE__ */ ((e) => (e.Default = "Default", e.Weak = "Weak", e))(N || {});
const $ = (e, o, i, n, a) => r([
  "tw-group tw-relative tw-flex tw-w-full tw-items-center tw-justify-between tw-border tw-rounded tw-transition-colors tw-min-h-[36px]",
  e && c,
  o ? "tw-border-black-5 tw-bg-black-5 tw-pointer-events-none" : r([
    "hover:tw-border-line-xx-strong",
    n === "Weak" ? "" : "tw-bg-base",
    i ? "tw-border-line-xx-strong" : "tw-border-line",
    n === "Weak" ? "tw-border-transparent" : h[a]
  ])
]), M = ({
  buttonProps: e,
  onClear: o,
  onDelete: i,
  children: n,
  disabled: a = !1,
  isOpen: s = !1,
  isFocusVisible: d = !1,
  size: p = "Small",
  showClear: u = !1,
  validation: m = b.Default,
  emphasis: f = "Default"
}) => {
  const { focusProps: g, isFocusVisible: x } = w(), { focusProps: k, isFocusVisible: E } = w();
  return /* @__PURE__ */ t.createElement("div", {
    "data-test-id": "trigger",
    className: $(d, a, s, f, m)
  }, n, /* @__PURE__ */ t.createElement("div", {
    className: r([
      "tw-flex-none tw-flex tw-items-center tw-absolute",
      p === "Large" ? "tw-right-5 tw-gap-1.5" : "tw-right-3 tw-gap-1"
    ])
  }, u && /* @__PURE__ */ t.createElement("button", {
    ...g,
    "data-test-id": "dropdown-clear-button",
    "aria-label": "Clear selection",
    type: "button",
    className: r([
      x && c,
      a ? "tw-pointer-events-none tw-text-black-40" : "tw-text-black-80"
    ]),
    onClick: () => !!o && o()
  }, /* @__PURE__ */ t.createElement(S, {
    size: l.Size12
  })), !!i && /* @__PURE__ */ t.createElement("button", {
    ...k,
    "data-test-id": "dropdown-delete-button",
    "aria-label": "Delete selection",
    type: "button",
    className: r([
      E && c,
      a ? "tw-pointer-events-none tw-text-black-40" : "tw-text-black-80"
    ]),
    onClick: i
  }, /* @__PURE__ */ t.createElement(z, {
    size: l.Size12
  })), /* @__PURE__ */ t.createElement("button", {
    ...e,
    "aria-hidden": "true",
    type: "button",
    className: r([
      a ? "tw-pointer-events-none tw-text-black-40" : r(["group-hover:tw-text-black", s ? "tw-text-black-100" : "tw-text-black-80"])
    ])
  }, /* @__PURE__ */ t.createElement("div", {
    className: r(["tw-transition-transform", s && "tw-rotate-180"])
  }, /* @__PURE__ */ t.createElement(v, {
    size: l.Size16
  }))), m === b.Error && /* @__PURE__ */ t.createElement("span", {
    className: "tw-flex tw-items-center tw-justify-center tw-text-red-60",
    "data-test-id": "error-state-exclamation-mark-icon"
  }, /* @__PURE__ */ t.createElement(C, null))));
};
export {
  N as InputEmphasis,
  M as Trigger,
  D as TriggerSize
};
//# sourceMappingURL=Trigger.es.es.js.map
