import { t as e } from "./utils-CHlhTiFC.js";
import { t } from "./createLucideIcon-CC8mnBIB.js";
import { Button as n } from "./Button.js";
import { Input as r } from "./Input.js";
import i from "react";
import { jsx as a, jsxs as o } from "react/jsx-runtime";
var s = t("search", [["path", {
	d: "m21 21-4.34-4.34",
	key: "14j7rj"
}], ["circle", {
	cx: "11",
	cy: "11",
	r: "8",
	key: "4ej97u"
}]]), c = i.forwardRef(({ className: t, inputClassName: c, buttonClassName: l, onSearch: u, searchOnlyOnClick: d, buttonVariant: f, buttonChildren: p, showSearchButton: m, inputVariant: h, inputSize: g, placeholder: _, ...v }, y) => {
	let [b, x] = i.useState(void 0), [S, C] = i.useState(!1);
	return /* @__PURE__ */ o("div", {
		className: e("flex gap-0", t),
		ref: y,
		children: [/* @__PURE__ */ o("div", {
			className: "relative w-full",
			children: [/* @__PURE__ */ a(r, {
				...v,
				variant: h,
				type: "text",
				className: c,
				onChange: (e) => {
					x(e.target.value), d || u?.(e.target.value);
				},
				inputSize: g,
				onKeyDown: (e) => {
					e.key === "Enter" && u?.(b);
				},
				onFocus: () => C(!0),
				onBlur: () => C(!1)
			}), !S && (b === "" || !b) && /* @__PURE__ */ o("div", {
				className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",
				children: [p ? null : /* @__PURE__ */ a(s, { className: "h-4 w-4 text-primary-gray-500 dark:text-primary-gray-400 mr-2" }), /* @__PURE__ */ a("span", {
					className: "text-primary-gray-500 dark:text-primary-gray-400",
					children: _ || "Search..."
				})]
			})]
		}), m === !1 ? null : /* @__PURE__ */ a(n, {
			variant: f || "icon",
			className: l,
			padding: g,
			onClick: () => {
				u?.(b);
			},
			children: p || /* @__PURE__ */ a(s, { className: "stroke-2" })
		})]
	});
});
c.displayName = "Search";
//#endregion
export { c as t };

//# sourceMappingURL=input-search-BXCg2ZxZ.js.map