import { o as N } from "./rolldown-runtime.js";
import { i as R, t as T } from "./vendor/react.js";
import { t as x } from "./utils.js";
import { t as _ } from "./FieldTooltip.js";
import { n as q, t as w } from "./field-props.js";
import { a as y, c as C, i as S, l as B, n as P, o as E, r as z, s as I, t as D } from "./Field.js";
import { n as L } from "./Input2.js";
import { n as M } from "./textarea.js";
var v = /* @__PURE__ */ N(R(), 1), e = T(), O = L, h = v.forwardRef(({ state: t = "default", startIcon: n, endIcon: a, hasOutline: u, className: s, ...d }, m) => {
  const o = !!n, r = !!a, l = o || r, i = x(M, O[t], u && "border-border ring-1 ring-border focus-visible:ring-2 focus-visible:ring-ring", o && "ps-10", r && "pe-10");
  return l ? /* @__PURE__ */ (0, e.jsxs)("div", {
    "data-slot": "textarea-wrapper",
    className: x("group/textarea relative", s),
    children: [
      o && /* @__PURE__ */ (0, e.jsx)("span", {
        "aria-hidden": "true",
        className: "absolute start-3 top-2.5 text-quaternary-foreground pointer-events-none transition-colors duration-200 ease-out motion-reduce:transition-none [&>svg]:size-5 group-focus-within/textarea:text-muted-foreground",
        children: n
      }),
      /* @__PURE__ */ (0, e.jsx)("textarea", {
        ref: m,
        "data-slot": "textarea",
        "data-state": t,
        "aria-invalid": t === "destructive" || void 0,
        className: i,
        ...d
      }),
      r && /* @__PURE__ */ (0, e.jsx)("span", {
        "aria-hidden": "true",
        className: "absolute end-3 top-2.5 text-quaternary-foreground pointer-events-none transition-colors duration-200 ease-out motion-reduce:transition-none [&>svg]:size-5 group-focus-within/textarea:text-muted-foreground",
        children: a
      })
    ]
  }) : /* @__PURE__ */ (0, e.jsx)("textarea", {
    ref: m,
    "data-slot": "textarea",
    "data-state": t,
    "aria-invalid": t === "destructive" || void 0,
    className: x(i, s),
    ...d
  });
});
h.displayName = "TextareaControl";
var $ = v.forwardRef((t, n) => {
  const [a, u] = q(t);
  if (!w(a)) return /* @__PURE__ */ (0, e.jsx)(h, {
    ref: n,
    ...u,
    required: a.required
  });
  const { label: s, required: d, labelIcon: m, tooltip: o, topRight: r, description: l, bottomRight: i, error: c, fieldClassName: j } = a, p = u, f = c ? "destructive" : p.state, g = s || r, b = l || i || c;
  return /* @__PURE__ */ (0, e.jsxs)(D, {
    state: f,
    disabled: p.disabled,
    className: j,
    children: [
      g && /* @__PURE__ */ (0, e.jsxs)(C, { children: [s && /* @__PURE__ */ (0, e.jsxs)(I, {
        required: d,
        labelIcon: m,
        children: [s, o && /* @__PURE__ */ (0, e.jsx)(_, { content: o })]
      }), r && /* @__PURE__ */ (0, e.jsx)(B, { children: r })] }),
      /* @__PURE__ */ (0, e.jsx)(S, { children: (F) => /* @__PURE__ */ (0, e.jsx)(h, {
        ref: n,
        ...p,
        ...F,
        required: d,
        state: f
      }) }),
      b && /* @__PURE__ */ (0, e.jsxs)(P, { children: [
        c && /* @__PURE__ */ (0, e.jsx)(E, { children: c }),
        !c && l && /* @__PURE__ */ (0, e.jsx)(y, { children: l }),
        i && /* @__PURE__ */ (0, e.jsx)(z, {
          className: "ms-auto",
          children: i
        })
      ] })
    ]
  });
});
$.displayName = "Textarea";
export {
  $ as t
};

//# sourceMappingURL=Textarea2.js.map