import { jsxs as u, jsx as t } from "react/jsx-runtime";
import { forwardRef as N } from "react";
import { F as y } from "./field-error-text-CBSX8dGx.mjs";
import { F as O } from "./field-helper-text-C5ee4SFV.mjs";
import { L as A } from "./label-7sJe5-pX.mjs";
import "./ThemeProvider-mOHIAi2k.mjs";
import "change-case";
import { u as C } from "./useColorScheme-CgjazeGp.mjs";
import { c as F } from "./bind-CU-R61T-.mjs";
const p = {
  "purpur-text-area": "_purpur-text-area_1qqf0_1",
  "purpur-text-area__label": "_purpur-text-area__label_1qqf0_8",
  "purpur-text-area__label-text": "_purpur-text-area__label-text_1qqf0_13",
  "purpur-text-area__frame": "_purpur-text-area__frame_1qqf0_16",
  "purpur-text-area__textarea-container": "_purpur-text-area__textarea-container_1qqf0_23",
  "purpur-text-area__textarea-container--disabled": "_purpur-text-area__textarea-container--disabled_1qqf0_33",
  "purpur-text-area__textarea-container--readonly": "_purpur-text-area__textarea-container--readonly_1qqf0_36",
  "purpur-text-area__textarea": "_purpur-text-area__textarea_1qqf0_23",
  "purpur-text-area__textarea--light": "_purpur-text-area__textarea--light_1qqf0_52",
  "purpur-text-area__textarea--dark": "_purpur-text-area__textarea--dark_1qqf0_60",
  "purpur-text-area__textarea--valid": "_purpur-text-area__textarea--valid_1qqf0_91",
  "purpur-text-area__textarea--error": "_purpur-text-area__textarea--error_1qqf0_91"
}, R = {
  NONE: "none",
  BOTH: "both",
  HORIZONTAL: "horizontal",
  VERTICAL: "vertical"
}, l = F.bind(p), e = "purpur-text-area", T = N(
  ({
    id: i,
    ["data-testid"]: x,
    className: s,
    errorText: r,
    helperText: n,
    label: o,
    rows: c = 3,
    cols: m = 90,
    resize: q = R.BOTH,
    style: f,
    ...a
  }, b) => {
    const [h] = C(), _ = (v) => x ? `${x}-${v}` : void 0, d = n ? `${i}-helper-text` : void 0, $ = l(`${e}__textarea-container`, {
      [`${e}__textarea-container--disabled`]: a.disabled,
      [`${e}__textarea-container--readonly`]: a.readOnly && !a.disabled
    });
    return /* @__PURE__ */ u("div", { className: l(s, e), "data-testid": x, children: [
      o && /* @__PURE__ */ u(
        A,
        {
          htmlFor: i,
          disabled: a.disabled,
          className: p[`${e}__label`],
          "data-testid": _("label"),
          children: [
            a.required && /* @__PURE__ */ t("span", { "aria-hidden": !0, children: "*" }),
            o
          ]
        }
      ),
      /* @__PURE__ */ u("div", { className: $, children: [
        /* @__PURE__ */ t(
          "textarea",
          {
            ...a,
            ref: b,
            id: i,
            "data-testid": _("textarea"),
            "aria-describedby": a["aria-describedby"] || d,
            "aria-invalid": a["aria-invalid"] || !!r,
            className: l(
              `${e}__textarea`,
              `${e}__textarea--${h}`,
              {
                [`${e}__textarea--error`]: !!r
              }
            ),
            rows: c,
            cols: m,
            style: { resize: q, ...f }
          }
        ),
        /* @__PURE__ */ t("div", { className: p[`${e}__frame`] })
      ] }),
      d && /* @__PURE__ */ t(O, { "data-testid": _("helper-text"), id: d, children: n }),
      r && /* @__PURE__ */ t(y, { "data-testid": _("error-text"), children: r })
    ] });
  }
);
T.displayName = "TextArea";
export {
  R,
  T
};
//# sourceMappingURL=text-area-CJD8ksqm.mjs.map
