"use client";

// src/components/data-views/list-page-board-card.tsx
import * as React from "react";

// src/components/ui/avatar.tsx
import { Check, Plus } from "lucide-react";
import { Avatar as AvatarPrimitive } from "radix-ui";
import { cva } from "class-variance-authority";

// src/lib/utils.ts
import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";
function cn(...inputs) {
  return twMerge(clsx(inputs));
}

// src/components/ui/avatar.tsx
import { jsx, jsxs } from "react/jsx-runtime";
var avatarRootVariants = cva(
  "group/avatar relative flex shrink-0 overflow-hidden select-none",
  {
    variants: {
      size: {
        sm: "size-6",
        default: "size-8",
        lg: "size-10"
      },
      shape: {
        circle: "rounded-full",
        square: "rounded-none",
        "rounded-sm": "rounded-sm",
        "rounded-md": "rounded-md",
        "rounded-lg": "rounded-lg",
        "rounded-xl": "rounded-xl"
      },
      variant: {
        default: "",
        ring: "ring-2 ring-ring",
        "ring-offset": "ring-2 ring-ring ring-offset-2 ring-offset-background",
        group: "ring-2 ring-background"
      }
    },
    defaultVariants: {
      size: "default",
      shape: "circle",
      variant: "default"
    }
  }
);
var AVATAR_INSET_AFTER = {
  circle: "after:rounded-full",
  square: "after:rounded-none",
  "rounded-sm": "after:rounded-sm",
  "rounded-md": "after:rounded-md",
  "rounded-lg": "after:rounded-lg",
  "rounded-xl": "after:rounded-xl"
};
var avatarImageShape = cn(
  "aspect-square size-full object-cover",
  "group-data-[shape=circle]/avatar:rounded-full",
  "group-data-[shape=square]/avatar:rounded-none",
  "group-data-[shape=rounded-sm]/avatar:rounded-sm",
  "group-data-[shape=rounded-md]/avatar:rounded-md",
  "group-data-[shape=rounded-lg]/avatar:rounded-lg",
  "group-data-[shape=rounded-xl]/avatar:rounded-xl"
);
var avatarFallbackShape = cn(
  "flex size-full items-center justify-center bg-muted text-sm text-muted-foreground",
  "group-data-[shape=circle]/avatar:rounded-full",
  "group-data-[shape=square]/avatar:rounded-none",
  "group-data-[shape=rounded-sm]/avatar:rounded-sm",
  "group-data-[shape=rounded-md]/avatar:rounded-md",
  "group-data-[shape=rounded-lg]/avatar:rounded-lg",
  "group-data-[shape=rounded-xl]/avatar:rounded-xl",
  "group-data-[size=sm]/avatar:text-xs"
);
function Avatar({
  className,
  size = "default",
  shape = "circle",
  variant = "default",
  insetBorder = false,
  ...props
}) {
  const shapeKey = shape ?? "circle";
  const insetClass = insetBorder && cn(
    "after:pointer-events-none after:absolute after:inset-0 after:border after:border-border after:mix-blend-darken dark:after:mix-blend-lighten",
    AVATAR_INSET_AFTER[shapeKey]
  );
  return /* @__PURE__ */ jsx(
    AvatarPrimitive.Root,
    {
      "data-slot": "avatar",
      "data-size": size,
      "data-shape": shape,
      className: cn(avatarRootVariants({ size, shape, variant }), insetClass, className),
      ...props
    }
  );
}
function AvatarFallback({
  className,
  ...props
}) {
  return /* @__PURE__ */ jsx(
    AvatarPrimitive.Fallback,
    {
      "data-slot": "avatar-fallback",
      className: cn(avatarFallbackShape, className),
      ...props
    }
  );
}
function AvatarInitials({
  initials,
  decorative = true,
  fallbackClassName,
  className,
  ...avatarProps
}) {
  return /* @__PURE__ */ jsx(Avatar, { className, ...avatarProps, children: /* @__PURE__ */ jsx(
    AvatarFallback,
    {
      "aria-hidden": decorative ? true : void 0,
      className: cn(
        "border-0 bg-[var(--avatar-initials-bg)] font-semibold text-[var(--avatar-initials-fg)]",
        fallbackClassName
      ),
      children: initials
    }
  ) });
}

// src/components/ui/card.tsx
import { jsx as jsx2 } from "react/jsx-runtime";
function Card({
  className,
  size = "default",
  ...props
}) {
  return /* @__PURE__ */ jsx2(
    "div",
    {
      "data-slot": "card",
      "data-size": size,
      className: cn(
        "group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
        className
      ),
      ...props
    }
  );
}
function CardHeader({ className, ...props }) {
  return /* @__PURE__ */ jsx2(
    "div",
    {
      "data-slot": "card-header",
      className: cn(
        "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",
        className
      ),
      ...props
    }
  );
}
function CardTitle({ className, ...props }) {
  return /* @__PURE__ */ jsx2(
    "div",
    {
      "data-slot": "card-title",
      className: cn(
        "font-sans text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",
        className
      ),
      ...props
    }
  );
}
function CardContent({ className, ...props }) {
  return /* @__PURE__ */ jsx2(
    "div",
    {
      "data-slot": "card-content",
      className: cn("px-4 group-data-[size=sm]/card:px-3", className),
      ...props
    }
  );
}

// src/components/data-views/list-page-board-card.tsx
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
function ListPageBoardCard({
  layout = "stack",
  leading,
  rowEnd,
  rowContainerClassName,
  onClick,
  interactive = false,
  className,
  style,
  isNew,
  children
}) {
  const isRow = layout === "row";
  const isInteractive = Boolean(onClick) || interactive;
  const rowShell = rowContainerClassName ?? "flex flex-row items-start gap-3";
  const devWarnedRef = React.useRef(false);
  if (process.env.NODE_ENV !== "production" && !isRow && !devWarnedRef.current) {
    const childArray = React.Children.toArray(children);
    const validPrimitives = [
      ListPageBoardCardHeader,
      ListPageBoardCardBody,
      ListPageBoardCardTitleRow,
      ListPageBoardCardBadgeRow,
      ListPageBoardCardSecondary,
      CardHeader,
      CardContent
    ];
    const hasDsPrimitive = childArray.some(
      (child) => React.isValidElement(child) && validPrimitives.includes(child.type)
    );
    if (childArray.length > 0 && !hasDsPrimitive) {
      devWarnedRef.current = true;
      console.warn(
        '[Exxat DS][ListPageBoardCard] layout="stack" children are not composed with DS primitives. Wrap content in <ListPageBoardCardHeader>/<ListPageBoardCardBody>/<ListPageBoardCardTitleRow>/etc. Raw children render without horizontal padding because Card only carries py-*. See `apps/web/components/library-board-view.tsx` (canonical) and `.cursor/rules/exxat-board-cards.mdc`.'
      );
    }
  }
  return /* @__PURE__ */ jsx3(
    Card,
    {
      size: "sm",
      className: cn(
        "w-full min-w-0 transition-shadow",
        !isRow && "gap-1",
        isRow && cn("!gap-0", rowShell, "px-4 py-3"),
        isInteractive && "cursor-pointer hover:shadow-md",
        isNew && "ring-brand/30",
        className
      ),
      style,
      onClick,
      children: isRow ? /* @__PURE__ */ jsxs2(Fragment, { children: [
        leading,
        /* @__PURE__ */ jsx3("div", { className: "min-w-0 flex-1", children }),
        rowEnd
      ] }) : children
    }
  );
}
var HubRecordCard = ListPageBoardCard;
function ListPageBoardCardHeader({
  className,
  children
}) {
  return /* @__PURE__ */ jsx3(CardHeader, { className: cn("gap-2 pb-2", className), children });
}
function ListPageBoardCardTitleRow({
  title,
  titleClassName,
  trailing
}) {
  return /* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 items-start justify-between gap-2", children: [
    /* @__PURE__ */ jsx3("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx3(
      CardTitle,
      {
        className: cn(
          "break-words text-sm font-semibold leading-snug text-foreground",
          titleClassName
        ),
        children: title
      }
    ) }),
    trailing
  ] });
}
function ListPageBoardCardAvatar({
  initials,
  className
}) {
  return /* @__PURE__ */ jsx3(
    AvatarInitials,
    {
      initials,
      className: cn("size-7 shrink-0 text-xs", className),
      fallbackClassName: "text-xs"
    }
  );
}
function ListPageBoardCardBadgeRow({ children }) {
  return /* @__PURE__ */ jsx3("div", { className: "flex min-w-0 flex-wrap items-center gap-1.5", children });
}
function ListPageBoardCardBody({
  className,
  children
}) {
  return /* @__PURE__ */ jsx3("div", { className: cn("flex flex-col gap-2", className), children });
}
function ListPageBoardCardSecondary({
  className,
  children
}) {
  return /* @__PURE__ */ jsx3("p", { className: cn("text-xs text-muted-foreground leading-snug", className), children });
}
export {
  HubRecordCard,
  ListPageBoardCard,
  ListPageBoardCardAvatar,
  ListPageBoardCardBadgeRow,
  ListPageBoardCardBody,
  ListPageBoardCardHeader,
  ListPageBoardCardSecondary,
  ListPageBoardCardTitleRow
};
//# sourceMappingURL=list-page-board-card.js.map