{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "skeleton",
  "type": "registry:ui",
  "title": "Skeleton",
  "description": "Reserve stable geometry while content loads.",
  "dependencies": [],
  "registryDependencies": [
    "https://ghost-ui.com/r/ghost-tokens.json",
    "https://ghost-ui.com/r/foundation.json"
  ],
  "files": [
    {
      "path": "src/components/ui/skeleton.tsx",
      "type": "registry:component",
      "target": "@ui/skeleton.tsx",
      "content": "import \"./foundation.css\";\nimport * as React from \"react\";\nimport \"./skeleton.css\";\n\nexport type SkeletonVariant = \"text\" | \"square\" | \"circle\" | \"rectangle\" | \"pill\";\nexport type SkeletonAnimation = \"pulse\" | \"none\";\nexport type SkeletonArrow = \"start\" | \"end\";\nexport type SkeletonCell = \"line\" | \"square\" | \"circle\" | \"pill\";\nexport type SkeletonTipShape = \"tooltip\" | \"popover\" | \"badge\";\nexport type SkeletonTipPlacement = \"top\" | \"bottom\" | \"left\" | \"right\";\nexport type SkeletonBarsShape = \"row\" | \"circle\";\n\nexport type SkeletonProps = React.ComponentPropsWithoutRef<\"div\"> & {\n  variant?: SkeletonVariant;\n  animation?: SkeletonAnimation;\n  arrow?: SkeletonArrow;\n};\n\nconst LINE_WIDTHS = [72, 56, 64, 80] as const;\nconst CELL_VARIANTS: Record<SkeletonCell, SkeletonVariant> = {\n  line: \"text\",\n  square: \"square\",\n  circle: \"circle\",\n  pill: \"pill\",\n};\nconst BAR_HEIGHTS = [40, 65, 30, 80, 50, 95, 35, 70, 55, 85, 45, 60] as const;\n\nconst SkeletonBase = React.forwardRef<HTMLDivElement, SkeletonProps>(function Skeleton(\n  { variant = \"text\", animation = \"pulse\", arrow, className, ...props },\n  ref,\n) {\n  return (\n    <div\n      {...props}\n      ref={ref}\n      aria-hidden=\"true\"\n      data-variant={variant}\n      data-animation={animation}\n      data-arrow={arrow}\n      className={`ui-skeleton${className ? ` ${className}` : \"\"}`}\n    />\n  );\n});\n\nexport type SkeletonGridProps = Omit<SkeletonProps, \"variant\" | \"arrow\" | \"children\"> & {\n  rows: number;\n  columns: number;\n  cell?: SkeletonCell;\n  header?: boolean;\n  frame?: boolean;\n};\n\nconst SkeletonGrid = React.forwardRef<HTMLDivElement, SkeletonGridProps>(function SkeletonGrid(\n  { rows, columns, cell = \"line\", header = false, frame = false, animation = \"pulse\", className, style, ...props },\n  ref,\n) {\n  const cells: React.ReactNode[] = [];\n  for (let row = 0; row < rows; row += 1) {\n    for (let column = 0; column < columns; column += 1) {\n      const variant: SkeletonVariant = header && row === 0 ? \"text\" : CELL_VARIANTS[cell];\n      const width = variant === \"text\"\n        ? `${LINE_WIDTHS[(row * columns + column) % LINE_WIDTHS.length]}%`\n        : variant === \"pill\"\n          ? \"72%\"\n          : variant === \"square\"\n            ? \"min(100%, 32px)\"\n            : undefined;\n      cells.push(\n        <span className=\"ui-skeleton__cell\" key={`${row}-${column}`}>\n          <SkeletonBase variant={variant} animation={animation} style={width ? { width } : undefined} />\n        </span>,\n      );\n    }\n  }\n  return (\n    <div\n      {...props}\n      ref={ref}\n      aria-hidden=\"true\"\n      data-animation={animation}\n      data-header={header || undefined}\n      data-frame={frame || undefined}\n      className={`ui-skeleton__grid${className ? ` ${className}` : \"\"}`}\n      style={{ ...style, \"--ui-skeleton-columns\": columns, \"--ui-skeleton-rows\": rows } as React.CSSProperties}\n    >\n      {cells}\n    </div>\n  );\n});\n\nexport type SkeletonTipProps = Omit<SkeletonProps, \"variant\" | \"arrow\" | \"children\"> & {\n  shape?: SkeletonTipShape;\n  placement?: SkeletonTipPlacement;\n};\n\nconst SkeletonTip = React.forwardRef<HTMLDivElement, SkeletonTipProps>(function SkeletonTip(\n  { shape = \"tooltip\", placement = \"bottom\", animation = \"pulse\", className, ...props },\n  ref,\n) {\n  return (\n    <div\n      {...props}\n      ref={ref}\n      aria-hidden=\"true\"\n      data-shape={shape}\n      data-placement={placement}\n      data-animation={animation}\n      className={`ui-skeleton ui-skeleton__tip${className ? ` ${className}` : \"\"}`}\n    />\n  );\n});\n\nexport type SkeletonBarsProps = Omit<SkeletonProps, \"variant\" | \"arrow\" | \"children\"> & {\n  shape?: SkeletonBarsShape;\n  count?: number;\n  heights?: readonly number[];\n};\n\nconst SkeletonBars = React.forwardRef<HTMLDivElement, SkeletonBarsProps>(function SkeletonBars(\n  { shape = \"row\", count, heights, animation = \"pulse\", className, style, ...props },\n  ref,\n) {\n  const total = count ?? heights?.length ?? BAR_HEIGHTS.length;\n  const values = heights ?? Array.from({ length: total }, (_, index) => BAR_HEIGHTS[index % BAR_HEIGHTS.length]);\n  return (\n    <div\n      {...props}\n      ref={ref}\n      aria-hidden=\"true\"\n      data-shape={shape}\n      data-animation={animation}\n      className={`ui-skeleton__bars${className ? ` ${className}` : \"\"}`}\n      style={{ ...style, \"--ui-skeleton-count\": values.length } as React.CSSProperties}\n    >\n      {values.map((height, index) => {\n        const bar = (\n          <SkeletonBase\n            variant=\"pill\"\n            animation={animation}\n            className=\"ui-skeleton__bar\"\n            style={{ \"--ui-skeleton-height\": `${height}%` } as React.CSSProperties}\n          />\n        );\n        return shape === \"circle\" ? (\n          <span className=\"ui-skeleton__bar-slot\" key={index} style={{ \"--ui-skeleton-index\": index } as React.CSSProperties}>{bar}</span>\n        ) : (\n          <React.Fragment key={index}>{bar}</React.Fragment>\n        );\n      })}\n    </div>\n  );\n});\n\nexport const Skeleton = Object.assign(SkeletonBase, {\n  Grid: SkeletonGrid,\n  Tip: SkeletonTip,\n  Bars: SkeletonBars,\n});\n\nexport default Skeleton;\n"
    },
    {
      "path": "src/components/ui/skeleton.css",
      "type": "registry:file",
      "target": "@ui/skeleton.css",
      "content": ".ui-skeleton{box-sizing:border-box;display:block;flex:0 0 auto;min-width:0;background:var(--border);border-radius:var(--radius-sm);animation:ui-skeleton-pulse 1.6s ease-in-out infinite}\n.ui-skeleton[data-variant=text]{height:12px}\n.ui-skeleton[data-variant=square]{aspect-ratio:1;width:100%}\n.ui-skeleton[data-variant=circle]{width:28px;height:28px;border-radius:50%}\n.ui-skeleton[data-variant=pill]{width:var(--space-8);height:var(--space-3);border-radius:var(--radius-pill)}\n.ui-skeleton[data-variant=rectangle]{height:120px;border-radius:var(--radius-lg)}\n.ui-skeleton[data-animation=none]{animation:none}\n.ui-skeleton[data-arrow]{position:relative}\n.ui-skeleton[data-arrow]::after{content:\"\";position:absolute;top:50%;width:var(--ui-skeleton-arrow-size,var(--space-2));height:var(--ui-skeleton-arrow-size,var(--space-2));background:var(--border)}\n.ui-skeleton[data-arrow=start]::after{left:calc(var(--ui-skeleton-arrow-size,var(--space-2)) * -1 + 1px);clip-path:polygon(0 0,100% 50%,0 100%);transform:translateY(-50%)}\n.ui-skeleton[data-arrow=end]::after{right:calc(var(--ui-skeleton-arrow-size,var(--space-2)) * -1 + 1px);clip-path:polygon(100% 0,100% 100%,0 50%);transform:translateY(-50%)}\n.ui-skeleton__grid{box-sizing:border-box;display:grid;grid-template-columns:repeat(var(--ui-skeleton-columns),minmax(0,1fr));grid-template-rows:repeat(var(--ui-skeleton-rows),minmax(0,1fr));width:100%;height:100%}\n.ui-skeleton__cell{display:flex;align-items:center;justify-content:center;min-width:0;min-height:0;padding:var(--space-1)}\n.ui-skeleton__grid[data-frame]{border:1px solid var(--border);border-radius:var(--radius-sm);overflow:hidden}\n.ui-skeleton__grid[data-frame] .ui-skeleton__cell{border-inline-end:1px solid color-mix(in oklab,var(--border) 45%,transparent);border-block-end:1px solid color-mix(in oklab,var(--border) 45%,transparent)}\n.ui-skeleton__tip{position:relative}\n.ui-skeleton__tip[data-shape=tooltip]{width:var(--space-16);height:var(--space-6)}\n.ui-skeleton__tip[data-shape=popover]{width:var(--space-16);height:var(--space-8)}\n.ui-skeleton__tip[data-shape=badge]{width:var(--space-12);height:var(--space-6);border-radius:var(--radius-pill)}\n.ui-skeleton__tip::after{content:\"\";position:absolute;width:var(--space-2);height:var(--space-2);background:var(--border)}\n.ui-skeleton__tip[data-placement=bottom]::after{top:100%;left:50%;transform:translateX(-50%);clip-path:polygon(0 0,100% 0,50% 100%)}\n.ui-skeleton__tip[data-placement=top]::after{bottom:100%;left:50%;transform:translateX(-50%);clip-path:polygon(50% 0,0 100%,100% 100%)}\n.ui-skeleton__tip[data-placement=left]::after{left:calc(var(--space-2) * -1);top:50%;transform:translateY(-50%);clip-path:polygon(100% 0,100% 100%,0 50%)}\n.ui-skeleton__tip[data-placement=right]::after{right:calc(var(--space-2) * -1);top:50%;transform:translateY(-50%);clip-path:polygon(0 0,100% 50%,0 100%)}\n.ui-skeleton__bars{display:flex;align-items:center;justify-content:space-between;width:100%;height:100%}\n.ui-skeleton__bars .ui-skeleton__bar{width:var(--space-1);height:var(--ui-skeleton-height);border-radius:var(--radius-pill)}\n.ui-skeleton__bars[data-shape=circle]{position:relative;display:block;aspect-ratio:1;height:auto}\n.ui-skeleton__bars[data-shape=circle] .ui-skeleton__bar-slot{position:absolute;inset:0;transform:rotate(calc(var(--ui-skeleton-index) * 360deg / var(--ui-skeleton-count)))}\n.ui-skeleton__bars[data-shape=circle] .ui-skeleton__bar{position:absolute;left:50%;top:var(--space-3);transform:translateX(-50%);height:var(--ui-skeleton-height)}\n@keyframes ui-skeleton-pulse{50%{opacity:.45}}\n@media(prefers-reduced-motion:reduce){.ui-skeleton{animation:none}}\n"
    }
  ]
}
