import { jsxs as S, jsx as t } from "react/jsx-runtime";
import { forwardRef as y } from "react";
import z from "../../foundation/Icon/Generated/IconCalendar.es.js";
import E from "../../foundation/Icon/Generated/IconCaretDown.es.js";
import F from "../../foundation/Icon/Generated/IconCaretUp.es.js";
import { IconSize as f } from "../../foundation/Icon/IconSize.es.js";
import { merge as m } from "../../utilities/merge.es.js";
import { Validation as i } from "../../utilities/validation.es.js";
import { TextInput as I } from "../TextInput/TextInput.es.js";
const O = y(
  ({ value: s, onClick: r, isClearable: a, placeHolder: d, isCalendarOpen: l, validation: e = i.Default, onDateChanged: n }, w) => {
    const g = e === i.Error || e === i.Warning, p = "tw-right-14", u = "tw-right-8", h = "tw-right-4", c = ((o) => {
      switch (o) {
        case 0:
          return h;
        case 1:
          return u;
        case 2:
          return p;
      }
      return "";
    })(
      (s && a ? 1 : 0) + (g ? 1 : 0)
    );
    return /* @__PURE__ */ S("div", { ref: w, children: [
      /* @__PURE__ */ t(
        "div",
        {
          className: m([
            "tw-absolute tw-top-2 tw-text-black-60 tw-z-[1]",
            c
          ]),
          children: l ? /* @__PURE__ */ t(F, { size: f.Size20 }) : /* @__PURE__ */ t(E, { size: f.Size20 })
        }
      ),
      /* @__PURE__ */ t(
        "div",
        {
          className: m([
            "tw-absolute tw-top-0 tw-left-0 tw-bottom-0 tw-z-10",
            c
          ]),
          onClick: r,
          role: "button",
          tabIndex: 0,
          onKeyDown: (o) => {
            (o.key === "Enter" || o.key === " ") && (r == null || r());
          },
          "data-test-id": "open-close-click-zone"
        }
      ),
      /* @__PURE__ */ t(
        I,
        {
          decorator: /* @__PURE__ */ t(z, {}),
          placeholder: d,
          value: s,
          clearable: a,
          onEnterPressed: r,
          onClear: () => {
            n && n(null);
          },
          validation: e
        }
      )
    ] });
  }
);
O.displayName = "FondueDatePickerTrigger";
export {
  O as DatePickerTrigger
};
//# sourceMappingURL=DatePickerTrigger.es.js.map
