import { jsx as m } from "react/jsx-runtime";
import { useCallback as D } from "react";
import { InputContainer as E, BaseInput as O } from "../input/InputPrimitive.js";
import q from "../input/hooks/useInputMask.js";
import { c } from "../../index-BtlgVD4m.js";
const w = ({
  ref: d,
  id: o,
  type: s = "text",
  value: u,
  inputMode: p = "text",
  disabled: t = !1,
  readOnly: i = !1,
  name: x,
  placeholder: I,
  onChange: e,
  onFocus: b,
  onBlur: k,
  maxLength: v,
  autoComplete: n,
  size: N = "default",
  isError: S,
  mask: M,
  ...R
}) => {
  const l = i && !t, r = t || i, j = D(
    (f) => {
      s === "file" ? e == null || e(f.target.files) : e == null || e(f.target.value);
    },
    [e, s]
  ), { mergedRef: B, isMasked: a } = q({
    mask: s !== "file" ? M : void 0,
    ref: d,
    onChange: e
  });
  return /* @__PURE__ */ m(
    E,
    {
      error: S,
      readOnly: l,
      className: c("flex items-center", s === "file" && "p-0", r && "pointer-events-none"),
      size: N,
      children: /* @__PURE__ */ m(
        O,
        {
          ref: B,
          id: o,
          type: s,
          name: x,
          inputMode: p,
          disabled: r,
          className: c(l && "disabled:cursor-default disabled:opacity-100"),
          placeholder: I,
          autoComplete: n,
          onFocus: b,
          onBlur: k,
          ...!a && { onChange: j, maxLength: v },
          ...s !== "file" && !a && { value: u },
          ...R
        }
      )
    }
  );
};
w.displayName = "SimpleInput";
export {
  w as default
};
//# sourceMappingURL=SimpleInput.js.map
