require("./chunk-9hOWP6kD.cjs");
const require_src = require("./src-BFJg9F_s.cjs");
let react_jsx_runtime = require("react/jsx-runtime");
let lucide_react = require("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__ */ (0, react_jsx_runtime.jsxs)("div", {
		className: "flex items-center gap-2",
		children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
			className: "relative min-w-0 flex-1",
			children: [
				/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Search, { className: "text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2" }),
				/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Input, {
					type: "search",
					value: searchValue,
					onChange: (e) => onSearchChange(e.target.value),
					placeholder,
					className: "pl-9 [&::-webkit-search-cancel-button]:hidden"
				}),
				searchValue.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.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__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, { className: "size-3" })
				})
			]
		}), sortOptions && sortOptions.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.DropdownMenu, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.DropdownMenuTrigger, {
			asChild: true,
			children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Button, {
				variant: "outline",
				"aria-label": activeSort ? `Sort: ${activeSort.label}` : "Sort options",
				children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ArrowUpDown, { className: "size-4" }), activeSort && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
					className: "hidden sm:inline",
					children: activeSort.label
				})]
			})
		}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.DropdownMenuContent, {
			align: "end",
			children: sortOptions.map((option) => {
				const isActive = option.value === sortValue;
				return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.DropdownMenuItem, {
					onClick: () => onSortChange(option.value),
					children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
						className: "flex-1",
						children: option.label
					}), isActive && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "text-muted-foreground size-4" })]
				}, option.value);
			})
		})] })]
	});
}
//#endregion
Object.defineProperty(exports, "SearchSort", {
	enumerable: true,
	get: function() {
		return SearchSort;
	}
});

//# sourceMappingURL=SearchSort-CqkeoWG8.cjs.map