"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { cva } from "class-variance-authority";
import { Plus } from "lucide-react";
import { cn } from "@open-mercato/shared/lib/utils";
import { Button } from "./button.js";
const emptyStateVariants = cva(
  "flex flex-col items-center justify-center text-center",
  {
    variants: {
      size: {
        sm: "gap-2 px-4 py-6",
        default: "gap-3 px-6 py-10",
        lg: "gap-4 px-8 py-16"
      },
      variant: {
        default: "rounded-lg border border-dashed border-muted-foreground/40 bg-muted/30",
        subtle: "rounded-lg"
      }
    },
    defaultVariants: {
      size: "default",
      variant: "default"
    }
  }
);
const titleVariants = cva("font-medium text-foreground", {
  variants: {
    size: {
      sm: "text-sm",
      default: "text-sm",
      lg: "text-base"
    }
  },
  defaultVariants: { size: "default" }
});
function EmptyState({
  size = "default",
  variant = "default",
  title,
  description,
  actions,
  illustration,
  icon,
  className,
  children,
  action,
  actionLabel,
  onAction,
  actionLabelClassName
}) {
  const legacyAction = action ?? (actionLabel ? { label: actionLabel, onClick: onAction } : void 0);
  const renderLegacyButton = !actions && legacyAction;
  const iconBoxSize = size === "sm" ? "size-10" : size === "lg" ? "size-16" : "size-12";
  return /* @__PURE__ */ jsxs("div", { className: cn(emptyStateVariants({ size, variant }), className), "data-slot": "empty-state", children: [
    illustration ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", "aria-hidden": "true", children: illustration }) : icon ? variant === "subtle" ? /* @__PURE__ */ jsx(
      "div",
      {
        className: cn(
          "flex items-center justify-center rounded-full bg-muted text-muted-foreground",
          iconBoxSize
        ),
        "aria-hidden": "true",
        children: icon
      }
    ) : /* @__PURE__ */ jsx("div", { className: "text-muted-foreground", "aria-hidden": "true", children: icon }) : null,
    /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
      /* @__PURE__ */ jsx("p", { className: cn(titleVariants({ size })), children: title }),
      description ? /* @__PURE__ */ jsx("p", { className: "mx-auto max-w-sm text-sm text-muted-foreground", children: description }) : null
    ] }),
    children,
    actions ?? (renderLegacyButton ? /* @__PURE__ */ jsxs(
      Button,
      {
        type: "button",
        variant: "outline",
        size: "sm",
        onClick: legacyAction.onClick,
        className: cn("inline-flex items-center gap-2 text-foreground", actionLabelClassName),
        disabled: legacyAction.disabled,
        children: [
          legacyAction.icon ?? /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4", "aria-hidden": "true" }),
          /* @__PURE__ */ jsx("span", { children: legacyAction.label })
        ]
      }
    ) : null)
  ] });
}
export {
  EmptyState,
  emptyStateVariants
};
//# sourceMappingURL=empty-state.js.map
