"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { Filter } from "lucide-react";
import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue
} from "../../ui/select.js";
import { cn } from "../../../lib/utils/index.js";
function FilterDropdown({
  value,
  onChange,
  options,
  placeholder = "Filter",
  label,
  allLabel = "All",
  showIcon = true,
  className,
  "data-cy": dataCy
}) {
  const allOptions = [
    { value: "", label: allLabel },
    ...options
  ];
  return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", className), children: [
    label && /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground whitespace-nowrap", children: [
      label,
      ":"
    ] }),
    /* @__PURE__ */ jsxs(Select, { value, onValueChange: onChange, children: [
      /* @__PURE__ */ jsxs(
        SelectTrigger,
        {
          className: "h-9 w-[150px]",
          "data-cy": dataCy,
          children: [
            showIcon && /* @__PURE__ */ jsx(Filter, { className: "h-4 w-4 mr-2 text-muted-foreground" }),
            /* @__PURE__ */ jsx(SelectValue, { placeholder })
          ]
        }
      ),
      /* @__PURE__ */ jsx(SelectContent, { children: allOptions.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value || "__all__", children: option.label }, option.value || "__all__")) })
    ] })
  ] });
}
export {
  FilterDropdown
};
