import { n as useTranslation } from "./i18n-DoP1NB7u.js";
import { v as u } from "./vendor-preact-DThS2ZQ_.js";
import "./extensibility-DesSYynI.js";
import { t as InputComposed } from "./inputComposed-C1R2LAa3.js";
//#region src/modules/email/emailInput.tsx
var EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/;
var EmailInput = ({ value, emailError, label, labelHint, disabled = false, required = false, onEmailChange, onBlur }) => {
	const { t } = useTranslation();
	const handleEmailChange = (e) => {
		const trimmed = e.target.value.trim();
		onEmailChange(trimmed, trimmed.length > 0 && EMAIL_REGEX.test(trimmed));
	};
	return /* @__PURE__ */ u("div", {
		class: "IncodeEmailInput",
		children: /* @__PURE__ */ u("div", {
			class: "IncodeEmailInputContainer",
			onFocusOut: onBlur,
			children: /* @__PURE__ */ u(InputComposed, {
				id: "email-input",
				type: "email",
				value,
				onInput: handleEmailChange,
				placeholder: t("email.placeholder"),
				disabled,
				required,
				label,
				labelHint,
				"data-testid": "email-input",
				"aria-label": !label ? "Email address" : void 0,
				"aria-invalid": emailError ? "true" : void 0,
				autocomplete: "email",
				error: emailError,
				showErrorIcon: true
			})
		})
	});
};
//#endregion
export { EmailInput as t };
