{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "avatars-stack",
  "title": "Stack avatars",
  "description": "Styled avatars: the Stack set. 5 decorative avatars variations (AvatarStack, AvatarStackMore, AvatarRowGap, FannedStack, GridAvatars) on the ai2 token system, driven by CSS token transitions and sized sm to xl. Part of the free styled layer.",
  "dependencies": [],
  "registryDependencies": [
    "@ai2/tokens"
  ],
  "files": [
    {
      "path": "registry/ai2/styled/avatars-stack.tsx",
      "content": "\"use client\"\n\nimport type * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n/* Stack avatar family: 5 decorative layouts showing a GROUP of avatars together. Initials-based (no external image) - a consumer can put an <img> in place of the initials for each child. `count` says how many avatars are drawn and `initials` gives an optional array of initials (otherwise A/B/C... is generated deterministically). Colour comes ONLY from tokens, size = each child's box scale (box[size]). Static - no motion. */\n\nexport type StyledSize = \"sm\" | \"md\" | \"lg\" | \"xl\"\n\nconst box: Record<StyledSize, string> = {\n  sm: \"size-8 text-xs\",\n  md: \"size-10 text-sm\",\n  lg: \"size-12 text-base\",\n  xl: \"size-16 text-lg\",\n}\n\nconst face =\n  \"flex size-full items-center justify-center rounded-full bg-secondary font-medium text-secondary-foreground select-none\"\n\ntype Props = React.ComponentProps<\"div\"> & {\n  size?: StyledSize\n  count?: number\n  initials?: string[]\n}\n\n/* Initials for a given index: from the supplied array, otherwise A, B, C ... (deterministic). */\nfunction initialAt(initials: string[] | undefined, i: number) {\n  if (initials && initials[i]) return initials[i]\n  return String.fromCharCode(65 + (i % 26))\n}\n\n/* AvatarStack: avatars overlapping with -ml and separated by a ring. */\nexport function AvatarStack({ className, size = \"md\", count = 3, initials, ...props }: Props) {\n  return (\n    <div data-slot=\"styled-avatar\" className={cn(\"flex items-center\", className)} {...props}>\n      {Array.from({ length: count }).map((_, i) => (\n        <span\n          key={i}\n          className={cn(\n            face,\n            box[size],\n            \"shrink-0 ring-2 ring-background\",\n            i > 0 && \"-ml-3\"\n          )}\n        >\n          {initialAt(initials, i)}\n        </span>\n      ))}\n    </div>\n  )\n}\n\n/* AvatarStackMore: ust uste binen yigin + sonda \"+N\" token cipi. */\nexport function AvatarStackMore({ className, size = \"md\", count = 3, initials, ...props }: Props) {\n  const shown = Math.max(0, count)\n  const extra = 5\n  return (\n    <div data-slot=\"styled-avatar\" className={cn(\"flex items-center\", className)} {...props}>\n      {Array.from({ length: shown }).map((_, i) => (\n        <span\n          key={i}\n          className={cn(face, box[size], \"shrink-0 ring-2 ring-background\", i > 0 && \"-ml-3\")}\n        >\n          {initialAt(initials, i)}\n        </span>\n      ))}\n      <span\n        className={cn(\n          \"flex shrink-0 items-center justify-center rounded-full bg-brand font-medium text-brand-foreground ring-2 ring-background select-none -ml-3\",\n          box[size]\n        )}\n      >\n        +{extra}\n      </span>\n    </div>\n  )\n}\n\n/* AvatarRowGap: a spaced row with no overlap. */\nexport function AvatarRowGap({ className, size = \"md\", count = 3, initials, ...props }: Props) {\n  return (\n    <div data-slot=\"styled-avatar\" className={cn(\"flex items-center gap-2\", className)} {...props}>\n      {Array.from({ length: count }).map((_, i) => (\n        <span key={i} className={cn(face, box[size], \"shrink-0\")}>\n          {initialAt(initials, i)}\n        </span>\n      ))}\n    </div>\n  )\n}\n\n/* FannedStack: hafifce dondurulmus yelpaze dizilimi. */\nexport function FannedStack({ className, size = \"md\", count = 3, initials, ...props }: Props) {\n  const mid = (count - 1) / 2\n  return (\n    <div data-slot=\"styled-avatar\" className={cn(\"flex items-center\", className)} {...props}>\n      {Array.from({ length: count }).map((_, i) => (\n        <span\n          key={i}\n          className={cn(face, box[size], \"shrink-0 origin-bottom ring-2 ring-background\", i > 0 && \"-ml-4\")}\n          style={{ rotate: `${(i - mid) * 10}deg` }}\n        >\n          {initialAt(initials, i)}\n        </span>\n      ))}\n    </div>\n  )\n}\n\n/* GridAvatars: 2x2 mini izgara (ilk 4 avatar). */\nexport function GridAvatars({ className, size = \"md\", count = 4, initials, ...props }: Props) {\n  const cells = Math.min(count, 4)\n  return (\n    <div\n      data-slot=\"styled-avatar\"\n      className={cn(\"grid w-fit grid-cols-2 gap-1\", className)}\n      {...props}\n    >\n      {Array.from({ length: cells }).map((_, i) => (\n        <span key={i} className={cn(face, box[size], \"shrink-0\")}>\n          {initialAt(initials, i)}\n        </span>\n      ))}\n    </div>\n  )\n}\n",
      "type": "registry:component",
      "target": "components/ui/avatars-stack.tsx"
    }
  ],
  "categories": [
    "styled",
    "avatars"
  ],
  "type": "registry:component"
}