{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ds-card-icon",
  "title": "Card Icon",
  "description": "Feature / navigation card with a tinted icon medallion, title and description. Icon colour and background derive from a single semantic tone token. Supports soft/solid/outline media styles, three sizes, centred or left alignment, badge, link mode with hover lift, and a loading skeleton.",
  "dependencies": [
    "class-variance-authority",
    "lucide-react"
  ],
  "registryDependencies": [
    "@lema-ds/card",
    "@lema-ds/badge",
    "@lema-ds/skeleton",
    "@lema-ds/tokens"
  ],
  "files": [
    {
      "path": "components/ds/ds-card-icon.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { ArrowRightIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Card, CardContent } from \"@/components/ui/card\"\nimport { Badge } from \"@/components/ui/badge\"\nimport { Skeleton } from \"@/components/ui/skeleton\"\n\n// ── Types ──\n\nexport type CardIconTone =\n  | \"primary\"\n  | \"success\"\n  | \"warning\"\n  | \"destructive\"\n  | \"violet\"\n  | \"sky\"\n  | \"neutral\"\n\nexport type CardIconMediaStyle = \"soft\" | \"solid\" | \"outline\"\nexport type CardIconSize = \"sm\" | \"md\" | \"lg\"\nexport type CardIconAlign = \"center\" | \"start\"\n\n// ── Variants ──\n\n// Tone → media style. The icon colour and its background both come from\n// semantic tokens — never raw Tailwind values. `soft` tints the token at 10%,\n// `solid` fills it and flips to the foreground token, `outline` rings it.\nexport const CARD_ICON_TONES: Record<\n  CardIconTone,\n  Record<CardIconMediaStyle, string>\n> = {\n  primary: {\n    soft: \"bg-primary/10 text-primary\",\n    solid: \"bg-primary text-primary-foreground\",\n    outline: \"border border-primary/30 text-primary\",\n  },\n  success: {\n    soft: \"bg-success/10 text-success\",\n    solid: \"bg-success text-success-foreground\",\n    outline: \"border border-success/30 text-success\",\n  },\n  warning: {\n    soft: \"bg-warning/10 text-warning\",\n    solid: \"bg-warning text-warning-foreground\",\n    outline: \"border border-warning/30 text-warning\",\n  },\n  destructive: {\n    soft: \"bg-destructive/10 text-destructive\",\n    solid: \"bg-destructive text-destructive-foreground\",\n    outline: \"border border-destructive/30 text-destructive\",\n  },\n  violet: {\n    soft: \"bg-highlight-violet/10 text-highlight-violet\",\n    solid: \"bg-highlight-violet text-highlight-violet-foreground\",\n    outline: \"border border-highlight-violet/30 text-highlight-violet\",\n  },\n  sky: {\n    soft: \"bg-highlight-sky/10 text-highlight-sky\",\n    solid: \"bg-highlight-sky text-highlight-sky-foreground\",\n    outline: \"border border-highlight-sky/30 text-highlight-sky\",\n  },\n  neutral: {\n    soft: \"bg-muted text-muted-foreground\",\n    solid: \"bg-foreground text-background\",\n    outline: \"border border-border text-muted-foreground\",\n  },\n}\n\n// Tone → standalone text colour (used by the action row).\nexport const CARD_ICON_TEXT: Record<CardIconTone, string> = {\n  primary: \"text-primary\",\n  success: \"text-success\",\n  warning: \"text-warning\",\n  destructive: \"text-destructive\",\n  violet: \"text-highlight-violet\",\n  sky: \"text-highlight-sky\",\n  neutral: \"text-muted-foreground\",\n}\n\nexport const cardIconRootVariants = cva(\n  \"relative flex flex-col has-[a:focus-visible]:ring-2 has-[a:focus-visible]:ring-ring has-[a:focus-visible]:ring-offset-2 data-[interactive=true]:transition-all data-[interactive=true]:duration-200 data-[interactive=true]:hover:-translate-y-0.5 data-[interactive=true]:hover:shadow-lg\",\n  {\n    variants: {\n      align: {\n        center: \"items-center text-center\",\n        start: \"items-start text-left\",\n      },\n    },\n    defaultVariants: { align: \"center\" },\n  }\n)\n\nexport const cardIconMediaVariants = cva(\n  \"flex shrink-0 items-center justify-center rounded-full\",\n  {\n    variants: {\n      size: {\n        sm: \"size-12\",\n        md: \"size-14\",\n        lg: \"size-16\",\n      },\n    },\n    defaultVariants: { size: \"sm\" },\n  }\n)\n\nexport const cardIconGlyphVariants = cva(\"\", {\n  variants: {\n    size: {\n      sm: \"size-5\",\n      md: \"size-6\",\n      lg: \"size-7\",\n    },\n  },\n  defaultVariants: { size: \"sm\" },\n})\n\nexport const cardIconTitleVariants = cva(\"font-semibold text-foreground\", {\n  variants: {\n    size: {\n      sm: \"text-sm\",\n      md: \"text-base\",\n      lg: \"text-lg\",\n    },\n    upper: {\n      true: \"tracking-wide uppercase\",\n      false: \"\",\n    },\n  },\n  defaultVariants: { size: \"md\", upper: false },\n})\n\nexport const cardIconDescriptionVariants = cva(\n  \"leading-relaxed text-muted-foreground\",\n  {\n    variants: {\n      size: {\n        sm: \"text-xs\",\n        md: \"text-sm\",\n        lg: \"text-base\",\n      },\n    },\n    defaultVariants: { size: \"sm\" },\n  }\n)\n\nexport const cardIconActionVariants = cva(\n  \"inline-flex items-center gap-1 font-medium\",\n  {\n    variants: {\n      size: {\n        sm: \"text-xs\",\n        md: \"text-sm\",\n        lg: \"text-base\",\n      },\n    },\n    defaultVariants: { size: \"sm\" },\n  }\n)\n\n// ── Helpers ──\n\nconst SKELETON_MEDIA: Record<CardIconSize, string> = {\n  sm: \"size-12\",\n  md: \"size-14\",\n  lg: \"size-16\",\n}\n\nconst SKELETON_TITLE: Record<CardIconSize, string> = {\n  sm: \"h-4 w-28\",\n  md: \"h-5 w-36\",\n  lg: \"h-6 w-44\",\n}\n\n// ── Component ──\n\nexport interface CardIconProps extends VariantProps<\n  typeof cardIconRootVariants\n> {\n  /** Icon component (e.g. a lucide icon). Rendered inside the media circle. */\n  icon: React.ElementType\n  title: string\n  description?: string\n  /** Semantic colour applied to both the icon and its background. */\n  tone?: CardIconTone\n  /** How the media circle is painted from the tone token. */\n  mediaStyle?: CardIconMediaStyle\n  size?: CardIconSize\n  /** Uppercase + tracked title, matching the dashboard hero style. */\n  titleUpper?: boolean\n  /** Optional badge shown above the title. */\n  badge?: string\n  /** Renders the whole card as a link with a hover lift. */\n  href?: string\n  rel?: string\n  target?: string\n  /** Optional call-to-action row shown at the bottom (interactive cards). */\n  actionLabel?: string\n  className?: string\n  loading?: boolean\n}\n\nexport function CardIcon({\n  icon: Icon,\n  title,\n  description,\n  tone = \"primary\",\n  mediaStyle = \"soft\",\n  size = \"sm\",\n  align = \"center\",\n  titleUpper = false,\n  badge,\n  href,\n  rel,\n  target,\n  actionLabel,\n  className,\n  loading,\n}: CardIconProps) {\n  const interactive = Boolean(href)\n  const toneText = CARD_ICON_TONES[tone][mediaStyle]\n\n  if (loading) {\n    return (\n      <Card\n        className={cn(cardIconRootVariants({ align }), className)}\n        data-slot=\"card-icon\"\n      >\n        <CardContent\n          className={cn(\n            \"flex flex-col gap-3\",\n            align === \"center\" ? \"items-center\" : \"items-start\"\n          )}\n        >\n          <Skeleton className={cn(SKELETON_MEDIA[size], \"rounded-full\")} />\n          <Skeleton className={cn(SKELETON_TITLE[size], \"rounded-md\")} />\n          <div\n            className={cn(\n              \"flex flex-col gap-1.5\",\n              align === \"center\" && \"items-center\"\n            )}\n          >\n            <Skeleton className=\"h-4 w-48 rounded-md\" />\n            <Skeleton className=\"h-4 w-40 rounded-md\" />\n          </div>\n        </CardContent>\n      </Card>\n    )\n  }\n\n  return (\n    <Card\n      className={cn(cardIconRootVariants({ align }), className)}\n      data-slot=\"card-icon\"\n      data-interactive={interactive}\n    >\n      <CardContent\n        className={cn(\n          \"flex flex-1 flex-col gap-4\",\n          align === \"center\" ? \"items-center\" : \"items-start\"\n        )}\n      >\n        <div\n          className={cn(cardIconMediaVariants({ size }), toneText)}\n          aria-hidden=\"true\"\n        >\n          <Icon className={cardIconGlyphVariants({ size })} />\n        </div>\n\n        <div\n          className={cn(\n            \"flex flex-col gap-2\",\n            align === \"center\" && \"items-center\"\n          )}\n        >\n          {badge && (\n            <Badge variant=\"secondary\" className=\"font-medium\">\n              {badge}\n            </Badge>\n          )}\n          <h3 className={cardIconTitleVariants({ size, upper: titleUpper })}>\n            {title}\n          </h3>\n          {description && (\n            <p className={cardIconDescriptionVariants({ size })}>\n              {description}\n            </p>\n          )}\n        </div>\n\n        {actionLabel && (\n          <span\n            className={cn(\n              cardIconActionVariants({ size }),\n              CARD_ICON_TEXT[tone]\n            )}\n          >\n            {actionLabel}\n            <ArrowRightIcon\n              className=\"size-4 shrink-0 transition-transform group-hover/card:translate-x-0.5\"\n              aria-hidden\n            />\n          </span>\n        )}\n      </CardContent>\n\n      {href && (\n        <a\n          href={href}\n          rel={rel}\n          target={target}\n          aria-label={title}\n          className=\"absolute inset-0 rounded-4xl outline-none\"\n        />\n      )}\n    </Card>\n  )\n}\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}
