import {
  __objRest,
  __spreadValues
} from "./chunk-N552FDTV.js";

// src/atoms/text-field.tsx
import { TextField as RTextField } from "@radix-ui/themes";
import { forwardRef, useMemo } from "react";
import { jsx } from "react/jsx-runtime";
var Root = forwardRef((props, ref) => {
  const _a = props, { error, style, className } = _a, rest = __objRest(_a, ["error", "style", "className"]);
  const fieldStyle = useMemo(() => {
    if (!error)
      return style;
    const errorStyle = {
      boxShadow: "inset 0 0 0 var(--text-field-border-width) var(--error-11)"
    };
    return __spreadValues(__spreadValues({}, style || {}), errorStyle);
  }, [error, style]);
  const classNameStr = error ? `error ${className}` : className;
  return /* @__PURE__ */ jsx(
    RTextField.Root,
    __spreadValues({
      className: classNameStr,
      ref,
      style: fieldStyle
    }, rest)
  );
});
Root.displayName = "TextField.Root";
var TextField = { Root, Slot: RTextField.Slot };

export {
  TextField
};
//# sourceMappingURL=chunk-VOQU7ZOV.js.map