import { a as D, v as u } from "./vendor-preact-DThS2ZQ_.js";
import { n as cn } from "./loadingIcon-B0ysgiNq.js";
import { t as ErrorIcon } from "./errorIcon-BA4T6iy-.js";
import { o as CloseIcon } from "./icons-CJJbIpBq.js";
import { t as SuccessIcon } from "./successIcon-B5mGvdx1.js";
//#region src/shared/input/input.tsx
var Input = D((props, ref) => {
	const { class: className, type = "text", ...restProps } = props;
	return /* @__PURE__ */ u("input", {
		...restProps,
		ref,
		type,
		class: cn("IncodeInput", className)
	});
});
//#endregion
//#region src/shared/inputComposed/inputComposed.tsx
var InputComposed = D(({ id, label, labelHint, "aria-label": ariaLabel, "aria-describedby": externalDescribedBy, type, error, showErrorIcon, helper, showHelperIcon, closeButton, rightIcon, required, suppressMessages = false, class: className, value, ...restProps }, ref) => {
	const helperId = `${id}-helper`;
	const errorId = `${id}-error`;
	const describedByIds = [
		!suppressMessages && helper ? helperId : null,
		!suppressMessages && error ? errorId : null,
		externalDescribedBy
	].filter(Boolean).join(" ") || void 0;
	return /* @__PURE__ */ u("div", {
		class: cn("IncodeInputComposed", className),
		children: [
			label && /* @__PURE__ */ u("label", {
				class: "IncodeInputComposedLabel",
				htmlFor: id,
				"data-testid": `${id}-label`,
				children: [label, labelHint && /* @__PURE__ */ u("span", {
					class: "IncodeInputComposedLabelHint",
					"data-testid": `${id}-label-hint`,
					children: labelHint
				})]
			}),
			/* @__PURE__ */ u("div", {
				class: "IncodeInputComposedWrapper",
				children: [
					/* @__PURE__ */ u(Input, {
						id,
						type,
						...restProps,
						ref,
						required,
						"data-has-value": !!(value && String(value).length > 0),
						...!label && ariaLabel ? { "aria-label": ariaLabel } : {},
						"aria-describedby": describedByIds,
						"aria-required": required ? "true" : void 0,
						"aria-invalid": error ? "true" : void 0,
						value
					}),
					rightIcon,
					closeButton?.show && /* @__PURE__ */ u("button", {
						type: "button",
						"aria-label": "Clear",
						class: "IncodeInputComposedClearButton",
						onClick: closeButton.onClose,
						"data-testid": `${id}-clear`,
						children: /* @__PURE__ */ u(CloseIcon, {
							width: 24,
							height: 24,
							fillColor: "var(--icon-neutral-500)"
						})
					})
				]
			}),
			!suppressMessages && error && /* @__PURE__ */ u("div", {
				class: "IncodeInputComposedErrorWrapper",
				role: "alert",
				"data-testid": `${id}-error-wrapper`,
				children: [showErrorIcon && /* @__PURE__ */ u("div", {
					class: "IncodeInputComposedIconWrapper",
					children: /* @__PURE__ */ u(ErrorIcon, { size: 17 })
				}), /* @__PURE__ */ u("p", {
					id: errorId,
					class: "IncodeInputComposedError",
					children: error
				})]
			}),
			!suppressMessages && helper && !error && /* @__PURE__ */ u("div", {
				class: "IncodeInputComposedHelperWrapper",
				"data-testid": `${id}-helper-wrapper`,
				children: [showHelperIcon && /* @__PURE__ */ u("div", {
					class: "IncodeInputComposedIconWrapper",
					children: /* @__PURE__ */ u(SuccessIcon, { size: 17 })
				}), /* @__PURE__ */ u("p", {
					id: helperId,
					class: "IncodeInputComposedHelper",
					children: helper
				})]
			})
		]
	});
});
//#endregion
export { Input as n, InputComposed as t };
