import { cx as e } from "../../../theme/tools.js";
import { focusElement as t, resolveFormInitialFocusTarget as n } from "../../../focus/focusable.js";
import { form as r } from "./formStyles.css.js";
import { useEffect as i, useRef as a } from "react";
import { jsx as o } from "react/jsx-runtime";
//#region src/atomic/molecules/form/Form.tsx
var s = (s) => {
	let { onSubmit: c, className: l, children: u, ref: d, initialFocus: f, ...p } = s, m = a(null);
	i(() => {
		if (f == null) return;
		let e = m.current;
		e != null && t(n(e, f));
	}, [f]);
	let h = (e) => {
		m.current = e, typeof d == "function" ? d(e) : d != null && (d.current = e);
	};
	return /* @__PURE__ */ o("form", {
		...p,
		ref: h,
		onSubmit: c,
		className: e(r, l),
		children: u
	});
};
//#endregion
export { s as Form };

//# sourceMappingURL=Form.js.map