import { jsx } from "react/jsx-runtime";
import { cx } from "@emotion/css";
import { forwardRef } from "react";
import { useStyle } from "../../../../../../../runtimes/react/use-style";
import { useResponsiveStyle } from "../../../../../../utils/responsive-style";
import { useFormContext, Sizes } from "../../../../context/FormContext";
import responsiveField from "../../services/responsiveField";
function getSizeHeight(size) {
  switch (size) {
    case Sizes.SMALL:
      return 36;
    case Sizes.MEDIUM:
      return 42;
    case Sizes.LARGE:
      return 48;
    default:
      throw new Error(`Invalid form size "${size}"`);
  }
}
var Input_default = forwardRef(function Input({ error = false, form, className, ...restOfProps }, ref) {
  const { shape, size, contrast, brandColor } = useFormContext();
  return /* @__PURE__ */ jsx(
    "input",
    {
      ...restOfProps,
      ref,
      className: cx(
        useStyle(responsiveField({ shape, size, contrast, brandColor, error })),
        useStyle(
          useResponsiveStyle([size], ([size2 = Sizes.MEDIUM]) => ({
            minHeight: getSizeHeight(size2),
            maxHeight: getSizeHeight(size2)
          }))
        ),
        className
      )
    }
  );
});
export {
  Input_default as default,
  getSizeHeight
};
//# sourceMappingURL=index.js.map