import { En as Button, J as DropdownMenuContent, L as Input, Y as DropdownMenuItem, q as DropdownMenu, rt as DropdownMenuTrigger } from "./src-B3W228vu.mjs";
import { jsx, jsxs } from "react/jsx-runtime";
import { ArrowUpDown, Check, Search, X } from "lucide-react";
//#region ../../platform/ui-components/src/components/SearchSort.tsx
function SearchSort({ searchValue, onSearchChange, placeholder = "Search...", sortOptions, sortValue, onSortChange }) {
	const activeSort = sortOptions?.find((o) => o.value === sortValue);
	return /* @__PURE__ */ jsxs("div", {
		className: "flex items-center gap-2",
		children: [/* @__PURE__ */ jsxs("div", {
			className: "relative min-w-0 flex-1",
			children: [
				/* @__PURE__ */ jsx(Search, { className: "text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2" }),
				/* @__PURE__ */ jsx(Input, {
					type: "search",
					value: searchValue,
					onChange: (e) => onSearchChange(e.target.value),
					placeholder,
					className: "pl-9 [&::-webkit-search-cancel-button]:hidden"
				}),
				searchValue.length > 0 && /* @__PURE__ */ jsx(Button, {
					variant: "ghost",
					size: "icon-xs",
					onClick: () => onSearchChange(""),
					"aria-label": "Clear search",
					className: "absolute top-1/2 right-2 -translate-y-1/2",
					children: /* @__PURE__ */ jsx(X, { className: "size-3" })
				})
			]
		}), sortOptions && sortOptions.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
			asChild: true,
			children: /* @__PURE__ */ jsxs(Button, {
				variant: "outline",
				"aria-label": activeSort ? `Sort: ${activeSort.label}` : "Sort options",
				children: [/* @__PURE__ */ jsx(ArrowUpDown, { className: "size-4" }), activeSort && /* @__PURE__ */ jsx("span", {
					className: "hidden sm:inline",
					children: activeSort.label
				})]
			})
		}), /* @__PURE__ */ jsx(DropdownMenuContent, {
			align: "end",
			children: sortOptions.map((option) => {
				const isActive = option.value === sortValue;
				return /* @__PURE__ */ jsxs(DropdownMenuItem, {
					onClick: () => onSortChange(option.value),
					children: [/* @__PURE__ */ jsx("span", {
						className: "flex-1",
						children: option.label
					}), isActive && /* @__PURE__ */ jsx(Check, { className: "text-muted-foreground size-4" })]
				}, option.value);
			})
		})] })]
	});
}
//#endregion
export { SearchSort as t };

//# sourceMappingURL=SearchSort-WObTUK9E.mjs.map