"use client";
import { j as e } from "../../../node_modules/.pnpm/react@19.1.0/node_modules/react/jsx-runtime.mjs";
import g, { useState as j } from "react";
import { TextInput as w } from "@mantine/core";
import r from "../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.mjs";
import o from "./TextInput.module.scss.mjs";
const T = g.forwardRef(
  ({
    classNames: t,
    rightSection: d,
    maxCharacters: i,
    onChange: u,
    size: x = "medium",
    ...h
  }, v) => {
    const [f, I] = j(0);
    let p = d;
    return p === void 0 && i !== void 0 && (p = /* @__PURE__ */ e.jsx(
      "div",
      {
        className: r(o.charCounter, t == null ? void 0 : t.charCounter),
        children: `${f}/${i}`
      }
    )), /* @__PURE__ */ e.jsx(
      w,
      {
        ...h,
        classNames: {
          ...t,
          root: r(o.root, t == null ? void 0 : t.root),
          input: r(o.input, t == null ? void 0 : t.input, o[x]),
          wrapper: r(o.wrapper, t == null ? void 0 : t.wrapper),
          label: r(o.label, t == null ? void 0 : t.label),
          section: r(o.section, t == null ? void 0 : t.section)
        },
        ref: v,
        onChange: (n) => {
          I(n.target.value.length), u && u(n);
        },
        onBeforeInput: (n) => {
          i !== void 0 && f === i && n.preventDefault();
        },
        rightSection: p
      }
    );
  }
);
T.displayName = "TexInput";
export {
  T as default
};
//# sourceMappingURL=index.mjs.map
