import { cx as e } from "../../../theme/tools.js";
import { useUiTranslation as t } from "../../../i18n/useUiTranslation.js";
import { Button as n } from "../../atoms/button/Button.js";
import { FormError as r } from "../../molecules/form_error/FormError.js";
import { FormField as i } from "../../molecules/form_field/FormField.js";
import { Form as a } from "../../molecules/form/Form.js";
import { useLoginForm as o } from "./useLoginForm.js";
import { form as s } from "./loginForm.css.js";
import { jsx as c, jsxs as l } from "react/jsx-runtime";
//#region src/atomic/organisms/login_form/LoginForm.tsx
var u = (u) => {
	let { t: d } = t(), { auth: f, onSuccess: p, defaultEmail: m, submitButtonClassName: h, className: g } = u, { formData: _, errors: v, isSubmitting: y, handleChange: b, handleSubmit: x } = o(f, p, m), S = null;
	v.form != null && (S = /* @__PURE__ */ c(r, { children: v.form }));
	let C = m != null && m.trim() !== "";
	return /* @__PURE__ */ l(a, {
		className: e(s, g),
		onSubmit: x,
		noValidate: !0,
		initialFocus: "first-form-control",
		children: [
			S,
			/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c(i, {
				label: d("auth.loginForm.labels.email"),
				name: "email",
				type: "text",
				value: _.email,
				onChange: b,
				error: v.email,
				placeholder: d("auth.loginForm.placeholders.email"),
				autoComplete: "email",
				required: !0
			}), /* @__PURE__ */ c(i, {
				label: d("auth.loginForm.labels.password"),
				name: "password",
				type: "password",
				value: _.password,
				onChange: b,
				error: v.password,
				placeholder: d("auth.loginForm.placeholders.password"),
				autoComplete: "current-password",
				"data-initial-focus": C || void 0,
				required: !0
			})] }),
			/* @__PURE__ */ c(n, {
				type: "submit",
				width: "full",
				size: "large",
				className: e(h),
				isLoading: y,
				children: d("auth.loginForm.actions.submit")
			})
		]
	});
};
//#endregion
export { u as LoginForm };

//# sourceMappingURL=LoginForm.js.map