import { Input as e } from "../../atoms/input/Input.js";
import { Label as t } from "../../atoms/label/Label.js";
import { ErrorMessage as n } from "../../atoms/error_message/ErrorMessage.js";
import { formField as r } from "./formField.css.js";
import { jsx as i, jsxs as a } from "react/jsx-runtime";
//#region src/atomic/molecules/form_field/FormField.tsx
var o = (o) => {
	let { id: s, label: c, error: l, required: u = !1, variant: d, ...f } = o, p = s;
	if (p == null || p === "") {
		let e = "generic";
		c != null && c !== "" && (e = c.toLowerCase().replace(/\s+/g, "-")), p = `field-${e}`;
	}
	let m = l != null && l !== "", h = m, g;
	m && (g = `${p}-error`);
	let _ = "default";
	m && (_ = "error");
	let v = "default";
	m ? v = "error" : d != null && (v = d);
	let y = null;
	c != null && (y = /* @__PURE__ */ i(t, {
		htmlFor: p,
		required: u,
		variant: _,
		children: c
	}));
	let b = null;
	return m && (b = /* @__PURE__ */ i(n, {
		id: `${p}-error`,
		children: l
	})), /* @__PURE__ */ a("div", {
		className: r,
		children: [
			y,
			/* @__PURE__ */ i(e, {
				id: p,
				variant: v,
				"aria-invalid": h,
				"aria-describedby": g,
				fullWidth: !0,
				...f
			}),
			b
		]
	});
};
//#endregion
export { o as FormField };

//# sourceMappingURL=FormField.js.map