"use client";
import { cva } from 'class-variance-authority';
import { Filter, ChevronDown } from 'lucide-react';
import { clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';

var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
  var target = {};
  for (var prop in source)
    if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source[prop];
  if (source != null && __getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(source)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
        target[prop] = source[prop];
    }
  return target;
};
function cn(...inputs) {
  return twMerge(clsx(inputs));
}
var filterButtonVariants = cva(
  "inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-[var(--radius-sm)] border border-border bg-background font-medium shadow-none transition-colors outline-none select-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0",
  {
    variants: {
      selected: {
        false: "text-muted-foreground hover:bg-muted/50",
        true: "text-muted-foreground hover:bg-muted/50"
      },
      size: {
        xs: "px-1.5 py-1 text-xs leading-4 gap-1",
        md: "px-2 py-1 text-sm leading-5",
        lg: "px-2.5 py-1.5 text-sm leading-5"
      }
    },
    defaultVariants: {
      selected: false,
      size: "md"
    }
  }
);
function FilterButton(_a) {
  var _b = _a, {
    className,
    label = "Filter",
    valueLabel,
    selected = false,
    size = "md",
    leadIcon,
    showChevron
  } = _b, props = __objRest(_b, [
    "className",
    "label",
    "valueLabel",
    "selected",
    "size",
    "leadIcon",
    "showChevron"
  ]);
  const shouldShowChevron = showChevron !== void 0 ? showChevron : selected && (valueLabel !== void 0 && valueLabel !== "");
  return /* @__PURE__ */ jsxs(
    "button",
    __spreadProps(__spreadValues({
      type: "button",
      "data-slot": "filter-button",
      "aria-pressed": selected != null ? selected : void 0,
      className: cn(filterButtonVariants({ selected, size }), className)
    }, props), {
      children: [
        /* @__PURE__ */ jsx("span", { className: "shrink-0", "aria-hidden": true, children: leadIcon != null ? leadIcon : /* @__PURE__ */ jsx(Filter, { className: "size-4" }) }),
        /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 px-0.5", children: [
          /* @__PURE__ */ jsx("span", { children: label }),
          selected && valueLabel ? /* @__PURE__ */ jsxs(Fragment, { children: [
            /* @__PURE__ */ jsx(
              "span",
              {
                className: "h-4 w-px shrink-0 bg-border",
                "aria-hidden": true,
                role: "presentation"
              }
            ),
            /* @__PURE__ */ jsx("span", { className: "text-primary whitespace-nowrap", children: valueLabel })
          ] }) : null
        ] }),
        shouldShowChevron ? /* @__PURE__ */ jsx("span", { className: "shrink-0", "aria-hidden": true, children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-4" }) }) : null
      ]
    })
  );
}

export { FilterButton, filterButtonVariants };
//# sourceMappingURL=filter-button.js.map
//# sourceMappingURL=filter-button.js.map