import { jsx, jsxs } from "react/jsx-runtime";
import { X } from "lucide-react";
import { cva } from "class-variance-authority";
import { cn } from "@open-mercato/shared/lib/utils";
const tagVariants = cva(
  "inline-flex items-center gap-1.5 border text-xs font-medium",
  {
    variants: {
      variant: {
        default: "border-border bg-background text-muted-foreground",
        success: "border-status-success-border bg-status-success-bg text-status-success-text",
        warning: "border-status-warning-border bg-status-warning-bg text-status-warning-text",
        error: "border-status-error-border bg-status-error-bg text-status-error-text",
        info: "border-status-info-border bg-status-info-bg text-status-info-text",
        neutral: "border-status-neutral-border bg-status-neutral-bg text-status-neutral-text",
        brand: "border-brand-violet/30 bg-brand-violet/10 text-brand-violet",
        pink: "border-status-pink-border bg-status-pink-bg text-status-pink-text"
      },
      shape: {
        pill: "rounded-full px-2.5 py-0.5",
        square: "rounded-md px-2 py-1"
      }
    },
    defaultVariants: { variant: "default", shape: "pill" }
  }
);
const dotColorMap = {
  default: "bg-muted-foreground",
  success: "bg-status-success-icon",
  warning: "bg-status-warning-icon",
  error: "bg-status-error-icon",
  info: "bg-status-info-icon",
  neutral: "bg-status-neutral-icon",
  brand: "bg-brand-violet",
  pink: "bg-status-pink-icon"
};
function Tag({
  className,
  variant = "default",
  shape = "pill",
  dot = false,
  onRemove,
  removeAriaLabel = "Remove",
  disabled = false,
  children,
  ...props
}) {
  return /* @__PURE__ */ jsxs(
    "span",
    {
      className: cn(
        tagVariants({ variant, shape }),
        disabled && "opacity-60",
        className
      ),
      "aria-disabled": disabled || void 0,
      "data-slot": "tag",
      "data-shape": shape,
      ...props,
      children: [
        dot && /* @__PURE__ */ jsx(
          "span",
          {
            className: cn("inline-block size-1.5 rounded-full shrink-0", dotColorMap[variant]),
            "aria-hidden": "true"
          }
        ),
        /* @__PURE__ */ jsx("span", { className: "min-w-0", children }),
        onRemove ? /* @__PURE__ */ jsx(
          "button",
          {
            type: "button",
            disabled,
            onClick: (event) => {
              event.stopPropagation();
              onRemove();
            },
            className: cn(
              "inline-flex shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring/40 disabled:pointer-events-none disabled:opacity-60",
              shape === "pill" ? "size-3" : "size-4"
            ),
            "aria-label": removeAriaLabel,
            "data-slot": "tag-remove",
            children: /* @__PURE__ */ jsx(
              X,
              {
                className: shape === "pill" ? "size-2.5" : "size-3.5",
                "aria-hidden": "true"
              }
            )
          }
        ) : null
      ]
    }
  );
}
export {
  Tag
};
//# sourceMappingURL=tag.js.map
