{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "skeleton",
  "title": "Skeleton",
  "description": "Placeholders made of the three shapes under one shared sweep; when data arrives each one morphs into its content, numbers count up, and empty or failed loads resolve in place.",
  "dependencies": [
    "motion"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "utils",
    "https://reactmotionkit.com/r/beats.json",
    "https://reactmotionkit.com/r/compose-refs.json",
    "https://reactmotionkit.com/r/motion-kit.json",
    "https://reactmotionkit.com/r/motion-presets.json",
    "https://reactmotionkit.com/r/use-should-animate.json"
  ],
  "files": [
    {
      "path": "ui/skeleton.tsx",
      "content": "\"use client\"\n\nimport { AnimatePresence, motion, PresenceContext, useIsPresent } from \"motion/react\"\nimport {\n  Children,\n  cloneElement,\n  type ComponentProps,\n  createContext,\n  type CSSProperties,\n  isValidElement,\n  type ReactNode,\n  type RefObject,\n  useContext,\n  useEffect,\n  useLayoutEffect,\n  useMemo,\n  useRef,\n  useState,\n  useSyncExternalStore,\n} from \"react\"\n\nimport { useShouldAnimate } from \"@/hooks/use-should-animate\"\nimport { cascade, reflow } from \"@/lib/beats\"\nimport { composeRefs } from \"@/lib/compose-refs\"\nimport { durations, easings, type MotionTokens, type Temperament } from \"@/lib/motion\"\nimport { useMotionKit, useMotionKitSettings } from \"@/lib/motion-kit\"\nimport { cn } from \"@/lib/utils\"\n\n/* -------------------------------------------------------------------------------------------------\n * Named numbers\n * -----------------------------------------------------------------------------------------------*/\n\n/*\n * One sweep of light every 2.2 s: slow enough to stay in the background of a page that waits.\n * The band crosses the field at an even speed in the first 85% of the cycle and rests for the\n * last 15%: an eased crossing spends most of its time outside the placeholders and is rarely\n * seen at all.\n */\nconst SWEEP_CYCLE = 2.2\n/* The band is 40% of the field it crosses, kept between 128 and 352 px so it reads as one light. */\nconst BAND_SHARE = 0.4\nconst BAND_MIN = 128\nconst BAND_MAX = 352\n/*\n * A refetch shorter than this keeps the old content on screen: a fast response never\n * flashes placeholders. A first load shows them at once (the space is empty anyway).\n */\nconst MIN_VISIBLE = 0.3\n/*\n * The put-down: each slot lands with a sink of `squash × PUT_DOWN` (1% at lively, 2% at\n * playful) and springs back, the beat of something set on a table. Skipped at calm, where\n * 1.5% × 0.2 would be invisible.\n */\nconst PUT_DOWN = 0.2\n/* Unmatched placeholders leave in the first 40% of the morph, as every one-side part does. */\nconst EXIT_SHARE = 0.4\n/*\n * The hand-over, one timeline per slot in fractions of the temperament's duration. The pill\n * stretches to the width of the text it stands for (0 to 55%), dissolves there (55% to 75%),\n * and only then the text fades in (75% to 100%): no frame shows a line on top of a pill.\n */\nconst STRETCH = 0.55\nconst DISSOLVE = 0.2\n/*\n * A number that arrives counts up from 0 for 1.6 morph durations from the moment it starts to\n * fade in (0.64 s at lively): long enough for the eye to catch the digits landing, short enough\n * to be over before the next row of the cascade has settled.\n */\nconst ROLL = 1.6\n\n/* Glyph height of each text size: the pill sits centered in the line box it reserves. */\nconst TEXT = {\n  xs: { line: 16, pill: 8 },\n  sm: { line: 20, pill: 10 },\n  base: { line: 24, pill: 12 },\n} as const\nexport type SkeletonTextSize = keyof typeof TEXT\n\nconst AVATAR = { sm: 24, md: 32, lg: 40 } as const\nexport type SkeletonAvatarSize = keyof typeof AVATAR\n\n/* Widths of consecutive text lines: full, nearly full, and a short last line. */\nconst LINE_PATTERN = [\"100%\", \"92%\", \"60%\"] as const\n/* Pill widths of table cells, column by column, so rows do not read as a grid of equal bars. */\nconst CELL_PATTERN = [\"70%\", \"55%\", \"45%\", \"60%\", \"40%\"] as const\n\n/*\n * Placeholder look: `muted-foreground` laid over whatever surface the block sits on (an alpha\n * mix, so it follows the page, a card or a muted panel in any theme), a 1px ink rim at 6% and\n * an inner top highlight. The share is the smallest that keeps the shape at 3:1 against its\n * surface (WCAG 1.4.11, the placeholders carry the layout) with margin, also under the light\n * sweep: 82% in light themes (4.1:1 on the background, 3.8:1 on `muted`), 62% in dark ones\n * (3.5:1, 3.4:1), measured on the default shadcn-like tokens. No outer shadow: placeholders sit in the page, they do not float.\n */\nconst LOOK =\n  \"bg-[color-mix(in_srgb,var(--muted-foreground)_82%,transparent)] dark:bg-[color-mix(in_srgb,var(--muted-foreground)_62%,transparent)] [--skeleton-rim:color-mix(in_oklch,var(--foreground)_6%,transparent)] [--skeleton-highlight:rgb(255_255_255/0.3)] dark:[--skeleton-highlight:rgb(255_255_255/0.06)]\"\nconst RIM_CLASS = \"shadow-[0_0_0_1px_var(--skeleton-rim),inset_0_1px_0_0_var(--skeleton-highlight)]\"\n\n/*\n * The sweep crosses the whole field (the outermost `Skeleton.Root`, else the viewport):\n * each band is offset by its block's left edge in the field (`--skeleton-x`) and every\n * animation is pinned to the document's time origin, so one band of light crosses all\n * the placeholders together. Before hydration the OS reduced-motion setting hides it.\n */\nconst CSS = `@keyframes mk-skeleton-sweep{0%{transform:translateX(calc(-1*var(--skeleton-band,12rem) - var(--skeleton-x,0px)))}85%,100%{transform:translateX(calc(var(--skeleton-travel,100vw) - var(--skeleton-x,0px)))}}\n@media (prefers-reduced-motion:reduce){[data-skeleton-motion=user][data-slot=skeleton-shine]{display:none}}`\n\nconst px = (value: number | string) => (typeof value === \"number\" ? `${String(value)}px` : value)\n\nconst subscribeNothing = () => () => undefined\nconst isClient = () => true\nconst isServer = () => false\n\n/* -------------------------------------------------------------------------------------------------\n * Root context\n * -----------------------------------------------------------------------------------------------*/\n\nexport interface SkeletonColumn {\n  /** Track width: px number or any CSS grid track (`\"1fr\"`, `\"minmax(6rem,1fr)\"`). */\n  width: number | string\n  /** `end` for numbers: the pill and the value sit on the right edge. */\n  align?: \"start\" | \"end\"\n  /** Column header text; the header shows a short pill when omitted. */\n  header?: ReactNode\n}\n\ninterface RootValue {\n  /** Placeholders are showing (loading has lasted `MIN_VISIBLE`, or was there at mount). */\n  shown: boolean\n  sweep: boolean\n  motion: MotionTokens\n  field: RefObject<HTMLDivElement | null>\n  columns?: SkeletonColumn[]\n  roll: boolean\n}\n\nconst RootContext = createContext<RootValue | null>(null)\n\n/* What a slot tells the content it is handing over to: whether and when numbers roll. */\ninterface SlotValue {\n  roll: boolean\n  delay: number\n  duration: number\n}\n\nconst SlotContext = createContext<SlotValue | null>(null)\n\n/* The outermost root around a block: the one field a sweep crosses. */\nfunction outermostField(node: Element) {\n  let field = node.parentElement?.closest(\"[data-skeleton-field]\") ?? null\n  let next = field?.parentElement?.closest(\"[data-skeleton-field]\") ?? null\n  while (next) {\n    field = next\n    next = field.parentElement?.closest(\"[data-skeleton-field]\") ?? null\n  }\n  return field\n}\n\n/* The cascade units of a root in reading order: every `Skeleton.Item`, and slots outside one. */\nfunction cascadeUnits(field: Element) {\n  const units: Element[] = []\n  for (const slot of field.querySelectorAll(\"[data-skeleton-slot]\")) {\n    const item = slot.closest(\"[data-skeleton-item]\")\n    const unit = item && field.contains(item) ? item : slot\n    if (!units.includes(unit)) units.push(unit)\n  }\n  return units\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Shine: the shared sweep\n * -----------------------------------------------------------------------------------------------*/\n\n/*\n * The band's light. Light themes: white at 12% lifts the dense fill by a clear step (1.24:1\n * against the fill) while the block stays at 3:1 or more on its surface at the band's centre\n * (3.3:1 on the background, 3.1:1 on `muted`): lightening lowers contrast in light themes.\n * Dark themes: the brand at 26%, a tinted light of about the same step on the dark fill (the\n * brand's dark value is lighter than the fill, so the band still lifts and adds contrast): the\n * waiting page carries the product's colour instead of a grey shimmer.\n * The band only crosses placeholders: it is removed before the content fades in, so it\n * never sits over real text.\n */\nconst BAND_LIGHT =\n  \"bg-linear-to-r from-transparent via-white/[0.12] to-transparent dark:via-[color-mix(in_oklch,var(--brand)_26%,transparent)]\"\n\nfunction Shine({ temperament }: { temperament?: Temperament }) {\n  const root = useContext(RootContext)\n  const m = useMotionKit(temperament ?? root?.motion.temperament)\n  const { reducedMotion: policy } = useMotionKitSettings()\n  // The still frame over the block is what is watched: the band itself spends most of the\n  // cycle outside the block, clipped, and would read as off screen and pause for good.\n  const frameRef = useRef<HTMLSpanElement>(null)\n  const bandRef = useRef<HTMLSpanElement>(null)\n  const { inView, pageVisible } = useShouldAnimate(frameRef)\n  // Server HTML keeps moving (it may be a loading.tsx fallback); pausing starts once mounted.\n  const mounted = useSyncExternalStore(subscribeNothing, isClient, isServer)\n  const running = !mounted || (inView && pageVisible)\n  const cycle = m.seconds(SWEEP_CYCLE)\n  const off = m.reduced || root?.sweep === false\n\n  useLayoutEffect(() => {\n    const frame = frameRef.current\n    const band = bandRef.current\n    const block = frame?.parentElement\n    if (!frame || !band || !block) return\n    const field = outermostField(block)\n    const place = () => {\n      const box = block.getBoundingClientRect()\n      const area = field?.getBoundingClientRect()\n      const width = area?.width ?? window.innerWidth\n      const size = Math.min(BAND_MAX, Math.max(BAND_MIN, width * BAND_SHARE))\n      frame.style.setProperty(\n        \"--skeleton-x\",\n        `${String(Math.round(box.left - (area?.left ?? 0)))}px`,\n      )\n      frame.style.setProperty(\"--skeleton-travel\", `${String(Math.round(width))}px`)\n      frame.style.setProperty(\"--skeleton-band\", `${String(Math.round(size))}px`)\n    }\n    place()\n    if (typeof band.getAnimations === \"function\") {\n      for (const animation of band.getAnimations()) {\n        // Time origin of the document: every band on the page is in the same phase.\n        if (running) animation.startTime = 0\n        else animation.pause()\n      }\n    }\n    const observer = new ResizeObserver(place)\n    observer.observe(block)\n    if (field) observer.observe(field)\n    return () => {\n      observer.disconnect()\n    }\n  }, [running, cycle, off])\n\n  if (off) return null\n  return (\n    <>\n      <style href=\"mk-skeleton\" precedence=\"default\">\n        {CSS}\n      </style>\n      <span\n        ref={frameRef}\n        aria-hidden\n        data-slot=\"skeleton-shine\"\n        data-skeleton-motion={policy}\n        className=\"pointer-events-none absolute inset-0 overflow-hidden rounded-[inherit]\"\n      >\n        <span\n          ref={bandRef}\n          className={cn(\"absolute inset-y-0 left-0 w-(--skeleton-band,12rem)\", BAND_LIGHT)}\n          style={{\n            animationName: \"mk-skeleton-sweep\",\n            animationDuration: `${String(cycle)}s`,\n            animationTimingFunction: \"linear\",\n            animationIterationCount: \"infinite\",\n          }}\n        />\n      </span>\n    </>\n  )\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Skeleton: one placeholder block (shadcn-compatible)\n * -----------------------------------------------------------------------------------------------*/\n\nconst BLOCK = {\n  tile: \"rounded-[12px]\",\n  pill: \"h-2.5 w-full rounded-full\",\n  ball: \"aspect-square shrink-0 rounded-full\",\n} as const\n\n/**\n * `tile` (rounded rectangle), `pill` (a text line) or `ball` (an avatar or icon; size it\n * with `size-*`). `line` is the earlier name of `pill`, kept for existing call sites.\n */\nexport type SkeletonShape = keyof typeof BLOCK | \"line\"\n\nexport interface SkeletonProps extends ComponentProps<\"div\"> {\n  /** Shape of the block. Size it with classes. */\n  shape?: SkeletonShape\n  /** Motion intensity of the sweep's time scale only; wins over `MotionKitProvider`. */\n  temperament?: Temperament\n}\n\n/**\n * A single placeholder block in the theme's own tones, crossed by the page's shared sweep.\n * Hidden from assistive tech. For placeholders that become their content, use\n * `Skeleton.Root` with `Skeleton.Slot` (or a preset).\n */\nfunction SkeletonBlock({\n  shape = \"tile\",\n  temperament,\n  className,\n  children,\n  ...props\n}: SkeletonProps) {\n  const kind = shape === \"line\" ? \"pill\" : shape\n  return (\n    <div\n      aria-hidden\n      data-slot=\"skeleton\"\n      data-shape={kind}\n      className={cn(\n        \"pointer-events-none relative isolate overflow-hidden\",\n        LOOK,\n        RIM_CLASS,\n        BLOCK[kind],\n        className,\n      )}\n      {...props}\n    >\n      <Shine temperament={temperament} />\n      {children}\n    </div>\n  )\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Root\n * -----------------------------------------------------------------------------------------------*/\n\nexport type SkeletonPreset = \"list\" | \"card\" | \"table\"\n\nexport interface SkeletonRootProps extends ComponentProps<\"div\"> {\n  /** While `true` the placeholders show; when it turns `false` each slot morphs into its content. */\n  loading: boolean\n  /**\n   * Generates the placeholders of a layout: `list` (avatar + two lines + amount per row),\n   * `card` (media, title, lines, footer) or `table` (rows aligned to `columns`). The\n   * children must then be `Skeleton.ListItem`, `Skeleton.CardItem` or `Skeleton.TableRow`\n   * elements: row `i` of the content morphs out of placeholder row `i`.\n   */\n  preset?: SkeletonPreset\n  /** Rows of `list` (default 5) or cards of `card` (default 3). */\n  count?: number\n  /** Rows of `table`. */\n  rows?: number\n  /** Column layout of `table` (and of every `Skeleton.TableRow` inside). */\n  columns?: SkeletonColumn[]\n  /** The shared band of light. Turn it off on pages with several loading regions. */\n  sweep?: boolean\n  /** Announced once while loading. */\n  label?: string\n  /** Announced once when loaded; silent when omitted. */\n  doneLabel?: string\n  /** Fires once the last slot has landed (move focus, start a second load). */\n  onSettled?: () => void\n  /**\n   * Shown when loading ends with no rows (preset) or no children. A string gets the built-in\n   * look and is announced; any other node renders as is. The placeholders leave and their space\n   * closes onto it.\n   */\n  empty?: ReactNode\n  /**\n   * A failed load: while set (and not loading) the content is replaced by it. A string gets the\n   * built-in alert, with a Retry button when `onRetry` is set.\n   */\n  error?: ReactNode\n  /** Called by the built-in Retry button; set `loading` again there. Focus moves to the root. */\n  onRetry?: () => void\n  /** Label of the built-in Retry button. */\n  retryLabel?: string\n  /** Numbers in `Skeleton.Count` (and preset amounts) count up from 0 as they arrive. */\n  roll?: boolean\n  /** Motion intensity only: morph speed, cascade step, put-down. Wins over `MotionKitProvider`. */\n  temperament?: Temperament\n}\n\n/* `false`, `null`, `undefined` and \"\" mean \"no such outcome\". */\nconst isSet = (node: ReactNode) => node != null && node !== false && node !== \"\"\n\nconst RETRY =\n  \"inline-flex h-8 shrink-0 items-center rounded-[8px] bg-background px-3 text-sm font-medium text-foreground shadow-[0_0_0_1px_var(--border),0_1px_2px_0_rgb(0_0_0/0.05)] transition-colors hover:bg-accent active:bg-muted focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none\"\n\n/* The built-in empty look: the three shapes drawn hollow, the placeholders that found nothing. */\nfunction EmptyNote({ children }: { children: ReactNode }) {\n  const ink =\n    \"shadow-[inset_0_0_0_1.5px_color-mix(in_oklch,var(--muted-foreground)_45%,transparent)]\"\n  return (\n    <div className=\"flex flex-col items-center gap-3 px-4 py-8 text-center\">\n      <span aria-hidden className=\"flex items-center gap-1.5\">\n        <span className={cn(\"size-3.5 rounded-full\", ink)} />\n        <span className={cn(\"h-2.5 w-9 rounded-full\", ink)} />\n        <span className={cn(\"size-3.5 rounded-[4px]\", ink)} />\n      </span>\n      <p className=\"text-sm text-muted-foreground\">{children}</p>\n    </div>\n  )\n}\n\n/**\n * The field the sweep crosses and the order of the cascade. Every `Skeleton.Slot` inside\n * shows its placeholder while `loading`, then becomes its content, one reading-order step\n * after the other.\n */\nexport function SkeletonRoot({\n  loading,\n  preset,\n  count,\n  rows = 8,\n  columns,\n  sweep = true,\n  label = \"Loading\",\n  doneLabel,\n  onSettled,\n  empty,\n  error,\n  onRetry,\n  retryLabel = \"Retry\",\n  roll = true,\n  temperament,\n  className,\n  children,\n  ref,\n  ...props\n}: SkeletonRootProps) {\n  const m = useMotionKit(temperament)\n  const field = useRef<HTMLDivElement>(null)\n\n  // `late`: loading has lasted MIN_VISIBLE (or was already on at mount).\n  const [late, setLate] = useState(loading)\n  if (!loading && late) setLate(false)\n  useEffect(() => {\n    if (!loading || late) return\n    const timer = window.setTimeout(() => {\n      setLate(true)\n    }, MIN_VISIBLE * 1000)\n    return () => {\n      window.clearTimeout(timer)\n    }\n  }, [loading, late])\n  const shown = loading && late\n\n  const [previous, setPrevious] = useState(shown)\n  const [resolved, setResolved] = useState(false)\n  if (previous !== shown) {\n    setPrevious(shown)\n    setResolved(!shown)\n  }\n\n  const settled = useRef(onSettled)\n  useEffect(() => {\n    settled.current = onSettled\n  })\n  useEffect(() => {\n    if (!resolved) return\n    const node = field.current\n    const units = node ? cascadeUnits(node).length : 1\n    const last = m.staggerDelay(Math.max(0, units - 1))\n    const end = last + m.seconds(m.values.settle) + m.seconds(m.values.anticipation)\n    const timer = window.setTimeout(() => settled.current?.(), end * 1000)\n    return () => {\n      window.clearTimeout(timer)\n    }\n  }, [resolved, m])\n\n  const value = useMemo<RootValue>(\n    () => ({ shown, sweep, motion: m, field, columns, roll }),\n    [shown, sweep, m, columns, roll],\n  )\n  const failed = !loading && isSet(error)\n  const blank = !loading && !failed && isSet(empty) && Children.count(children) === 0\n  const outcome = failed ? \"error\" : blank ? \"empty\" : null\n  let body: ReactNode = failed ? null : children\n  if (preset) {\n    const total = preset === \"table\" ? rows : (count ?? (preset === \"card\" ? 3 : 5))\n    const Generated =\n      preset === \"list\" ? SkeletonListItem : preset === \"card\" ? SkeletonCardItem : SkeletonTableRow\n    // Re-keyed by position: content row `i` reconciles with placeholder row `i`, so its\n    // slots stay mounted and morph instead of remounting.\n    const items = shown\n      ? Array.from({ length: total }, (_, i) => <Generated key={i} index={i} />)\n      : Children.toArray(failed ? null : children).map((child, i) =>\n          isValidElement<{ index?: number }>(child)\n            ? cloneElement(child, { key: i, index: i })\n            : child,\n        )\n    const list = <AnimatePresence initial={false}>{items}</AnimatePresence>\n    body =\n      preset === \"list\" ? (\n        <div role=\"list\" data-slot=\"skeleton-list\" className=\"@container flex flex-col\">\n          {list}\n        </div>\n      ) : preset === \"card\" ? (\n        <div\n          role=\"list\"\n          data-slot=\"skeleton-cards\"\n          className=\"grid grid-cols-[repeat(auto-fill,minmax(min(100%,15rem),1fr))] gap-4\"\n        >\n          {list}\n        </div>\n      ) : (\n        <SkeletonTableFrame columns={columns}>{list}</SkeletonTableFrame>\n      )\n  }\n\n  const spoken = blank && typeof empty === \"string\" ? empty : doneLabel\n  const announcement = shown ? label : resolved && spoken ? spoken : \"\"\n\n  return (\n    <RootContext value={value}>\n      <div\n        ref={composeRefs(field, ref)}\n        data-slot=\"skeleton-root\"\n        data-skeleton-field=\"\"\n        data-preset={preset}\n        data-state={shown ? \"loading\" : \"loaded\"}\n        aria-busy={loading}\n        // The Retry button leaves with the alert: focus waits on the region for the new rows.\n        tabIndex={onRetry ? -1 : undefined}\n        className={cn(\"relative outline-none\", className)}\n        {...props}\n      >\n        {body}\n        {/* The answer takes the space the leaving rows give back, on the calm spring. */}\n        <AnimatePresence initial={false}>\n          {outcome && (\n            <motion.div\n              key={outcome}\n              data-slot=\"skeleton-outcome\"\n              data-outcome={outcome}\n              initial={{ height: 0, opacity: 0 }}\n              animate={{ height: \"auto\", opacity: 1 }}\n              exit={{ height: 0, opacity: 0 }}\n              transition={reflow(m, { calm: true })}\n              className=\"overflow-hidden\"\n            >\n              {outcome === \"empty\" ? (\n                typeof empty === \"string\" ? (\n                  <EmptyNote>{empty}</EmptyNote>\n                ) : (\n                  empty\n                )\n              ) : typeof error === \"string\" ? (\n                <div className=\"p-2\">\n                  <div\n                    role=\"alert\"\n                    className=\"flex flex-wrap items-center gap-x-3 gap-y-2 rounded-[12px] bg-[color-mix(in_oklch,var(--destructive)_7%,transparent)] py-2.5 ps-4 pe-2.5 shadow-[inset_0_0_0_1px_color-mix(in_oklch,var(--destructive)_28%,transparent)]\"\n                  >\n                    <span\n                      aria-hidden\n                      className=\"size-2 shrink-0 rounded-full bg-destructive shadow-[0_0_0_3px_color-mix(in_oklch,var(--destructive)_18%,transparent)]\"\n                    />\n                    <p className=\"min-w-0 flex-1 text-sm text-foreground\">{error}</p>\n                    {onRetry && (\n                      <button\n                        type=\"button\"\n                        data-action=\"retry\"\n                        onClick={() => {\n                          field.current?.focus({ preventScroll: true })\n                          onRetry()\n                        }}\n                        className={RETRY}\n                      >\n                        {retryLabel}\n                      </button>\n                    )}\n                  </div>\n                </div>\n              ) : (\n                error\n              )}\n            </motion.div>\n          )}\n        </AnimatePresence>\n        <span role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n          {announcement}\n        </span>\n      </div>\n    </RootContext>\n  )\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Item: one cascade unit\n * -----------------------------------------------------------------------------------------------*/\n\nexport type SkeletonItemProps = ComponentProps<\"div\">\n\n/** Groups slots that land together (a row, a card); the cascade steps item by item. */\nexport function SkeletonItem({ className, ...props }: SkeletonItemProps) {\n  return (\n    <div data-slot=\"skeleton-item\" data-skeleton-item=\"\" className={cn(className)} {...props} />\n  )\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Slot: the placeholder that becomes its content\n * -----------------------------------------------------------------------------------------------*/\n\ntype Kind =\n  | { kind: \"ball\"; diameter: number }\n  | { kind: \"pill\"; text: SkeletonTextSize; width: number | string }\n  | { kind: \"tile\"; width?: number | string; height?: number | string; aspectRatio?: number }\n  | { kind: \"text\"; text: SkeletonTextSize; widths: readonly string[] }\n\ninterface SlotBaseProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n  /** Wins over the root's `loading`; a slot outside a root is loading unless set to `false`. */\n  loading?: boolean\n  /** Real radius in px for the morph. Defaults to the shape's own (half a ball or pill). */\n  radius?: number\n  /** `end`: the placeholder and the content sit on the right edge (numbers). */\n  align?: \"start\" | \"end\"\n  /** A custom placeholder instead of the shape. */\n  fallback?: ReactNode\n  /** The real element. Rendered once loading is over. */\n  children?: ReactNode\n  /** Motion intensity only; defaults to the root's. */\n  temperament?: Temperament\n}\n\n/* The box a placeholder flies to: the content's own, in the slot's coordinates. */\ninterface Landing {\n  /** Distance from the slot's start edge, or from its end edge for `align=\"end\"`. */\n  inset: number\n  top: number\n  width: number\n  height: number\n}\n\nfunction useSlotState(loadingProp: boolean | undefined, temperament?: Temperament) {\n  const root = useContext(RootContext)\n  const m = useMotionKit(temperament ?? root?.motion.temperament)\n  const pace = root?.motion ?? m\n  const wanted = loadingProp ?? root?.shown ?? true\n  // A slot inside a leaving row (an empty result, an error) keeps the look it had: its row\n  // fades out as one piece instead of handing over to nothing.\n  const present = useIsPresent()\n  const [kept, setKept] = useState(wanted)\n  if (present && kept !== wanted) setKept(wanted)\n  const target = present ? wanted : kept\n  const node = useRef<HTMLDivElement>(null)\n  // Placeholders come back at once; content arrives one cascade step after the other.\n  const [arrived, setArrived] = useState(!target)\n  // The hand-over is running: the placeholder is still mounted, on its way out.\n  const [handing, setHanding] = useState(false)\n  const [landing, setLanding] = useState(false)\n  const [pressed, setPressed] = useState(false)\n  if (target && arrived) {\n    setArrived(false)\n    setHanding(false)\n    setLanding(false)\n    setPressed(false)\n  }\n\n  useEffect(() => {\n    if (target || arrived) return\n    const field = root?.field.current\n    const own = node.current\n    const units = field && own ? cascadeUnits(field) : []\n    const item = own?.closest(\"[data-skeleton-item]\")\n    const unit = item && field?.contains(item) ? item : own\n    const index = Math.max(0, unit ? units.indexOf(unit) : 0)\n    const timer = window.setTimeout(\n      () => {\n        setArrived(true)\n        setHanding(true)\n        setLanding(true)\n      },\n      pace.staggerDelay(index) * 1000,\n    )\n    return () => {\n      window.clearTimeout(timer)\n    }\n  }, [target, arrived, root, pace])\n\n  // The placeholder leaves the DOM once it has dissolved, at every temperament.\n  const fade = m.seconds(durations.fade)\n  const gone = m.reduced ? fade : m.seconds(m.values.duration * (STRETCH + DISSOLVE))\n  useEffect(() => {\n    if (!handing) return\n    const timer = window.setTimeout(() => {\n      setHanding(false)\n    }, gone * 1000)\n    return () => {\n      window.clearTimeout(timer)\n    }\n  }, [handing, gone])\n\n  // The put-down: once the content is in, sink a hair and spring back.\n  const putDown = m.temperament !== \"calm\" && !m.reduced\n  useEffect(() => {\n    if (!landing) return\n    if (!putDown) {\n      const done = window.setTimeout(() => {\n        setLanding(false)\n      }, 0)\n      return () => {\n        window.clearTimeout(done)\n      }\n    }\n    const land = m.seconds(m.values.duration) * 1000\n    const sink = window.setTimeout(() => {\n      setPressed(true)\n    }, land)\n    const lift = window.setTimeout(\n      () => {\n        setPressed(false)\n        setLanding(false)\n      },\n      land + m.seconds(m.values.anticipation) * 1000,\n    )\n    return () => {\n      window.clearTimeout(sink)\n      window.clearTimeout(lift)\n    }\n  }, [landing, putDown, m])\n\n  return { m, node, arrived, handing, pressed }\n}\n\nfunction SlotBody({\n  shape,\n  loading,\n  radius,\n  align = \"start\",\n  fallback,\n  children,\n  temperament,\n  className,\n  style,\n  ref,\n  ...props\n}: SlotBaseProps & { shape: Kind }) {\n  const { m, node, arrived, handing, pressed } = useSlotState(loading, temperament)\n  const end = align === \"end\"\n  const contentRef = useRef<HTMLDivElement>(null)\n\n  let r = radius ?? 12\n  let box: CSSProperties = {}\n  let minHeight: number | undefined\n  let glyph: number | undefined\n  if (shape.kind === \"ball\") {\n    r = radius ?? shape.diameter / 2\n    box = { width: shape.diameter, height: shape.diameter }\n  } else if (shape.kind === \"pill\") {\n    const t = TEXT[shape.text]\n    r = radius ?? t.pill / 2\n    box = { width: px(shape.width), height: t.pill }\n    minHeight = t.line\n    glyph = t.pill\n  } else if (shape.kind === \"tile\") {\n    box = {\n      width: shape.width === undefined ? \"100%\" : px(shape.width),\n      height: shape.height === undefined ? undefined : px(shape.height),\n      aspectRatio: shape.aspectRatio,\n    }\n  } else {\n    r = radius ?? 0\n  }\n\n  /*\n   * A shape flies to the box of what it stands for: the ball to the avatar, the tile to the\n   * image, the pill to the width of its text at glyph height (it stretches, it never grows\n   * into a slab). A paragraph or a custom placeholder dissolves in place.\n   */\n  const flies = fallback === undefined && shape.kind !== \"text\" && !m.reduced\n  const [flight, setFlight] = useState<Landing | null>(null)\n  if (!handing && flight) setFlight(null)\n  useLayoutEffect(() => {\n    const content = contentRef.current\n    if (!handing || !flies || flight || !content) return\n    const height = glyph ?? content.offsetHeight\n    // Measured from the edge the content is aligned to: a slot that shrinks to its content\n    // once the placeholder leaves the flow keeps that edge where it was.\n    const parent = content.offsetParent instanceof HTMLElement ? content.offsetParent : null\n    const right = (parent?.clientWidth ?? 0) - content.offsetLeft - content.offsetWidth\n    setFlight({\n      inset: end ? right : content.offsetLeft,\n      top: content.offsetTop + (content.offsetHeight - height) / 2,\n      width: content.offsetWidth,\n      height,\n    })\n  }, [handing, flies, flight, glyph, end])\n\n  const D = m.seconds(m.values.duration)\n  const fade = m.seconds(durations.fade)\n  // One timeline: stretch, dissolve, then the content. Reduced motion: out, then in.\n  const stretch = { duration: D * STRETCH, ease: easings.outQuart }\n  const dissolve = m.reduced\n    ? { duration: fade, ease: \"easeOut\" as const }\n    : { duration: D * DISSOLVE, delay: D * STRETCH, ease: \"easeIn\" as const }\n  const reveal = m.reduced\n    ? { duration: fade, delay: fade, ease: \"easeOut\" as const }\n    : {\n        duration: D * (1 - STRETCH - DISSOLVE),\n        delay: D * (STRETCH + DISSOLVE),\n        ease: easings.outQuart,\n      }\n\n  const showPlaceholder = !arrived || handing\n  const rollValue = useMemo<SlotValue>(\n    () => ({\n      roll: handing && !m.reduced,\n      delay: D * (STRETCH + DISSOLVE),\n      duration: D * ROLL,\n    }),\n    [handing, m.reduced, D],\n  )\n  const leaving = { opacity: handing ? 0 : 1 }\n  const shared = {\n    \"aria-hidden\": true,\n    \"data-slot\": \"skeleton-placeholder\",\n    initial: false as const,\n    animate: leaving,\n    transition: { opacity: dissolve },\n  }\n\n  let look: ReactNode = null\n  if (!showPlaceholder) {\n    look = null\n  } else if (fallback !== undefined) {\n    look = (\n      <motion.div\n        {...shared}\n        data-shape=\"custom\"\n        className=\"pointer-events-none [grid-area:1/1]\"\n        style={{ borderRadius: r }}\n      >\n        {fallback}\n      </motion.div>\n    )\n  } else if (shape.kind === \"text\") {\n    const t = TEXT[shape.text]\n    look = (\n      <motion.div\n        {...shared}\n        data-shape=\"text\"\n        className=\"pointer-events-none flex w-full flex-col [grid-area:1/1]\"\n      >\n        {shape.widths.map((width, i) => (\n          <span key={i} className=\"flex items-center\" style={{ height: t.line }}>\n            <span\n              className={cn(\"relative isolate overflow-hidden\", LOOK, RIM_CLASS, end && \"ms-auto\")}\n              style={{ width, height: t.pill, borderRadius: t.pill / 2 }}\n            >\n              {!handing && <Shine temperament={temperament} />}\n            </span>\n          </span>\n        ))}\n      </motion.div>\n    )\n  } else {\n    look = (\n      <motion.div\n        {...shared}\n        data-shape={shape.kind}\n        layout\n        // Only the hand-over is a flight: a resize while loading just reflows.\n        layoutDependency={flight}\n        transition={{ layout: stretch, opacity: dissolve }}\n        className={cn(\n          \"pointer-events-none relative isolate self-center overflow-hidden [grid-area:1/1]\",\n          LOOK,\n          RIM_CLASS,\n          end && \"justify-self-end\",\n        )}\n        style={\n          flight\n            ? {\n                position: \"absolute\",\n                left: end ? undefined : flight.inset,\n                right: end ? flight.inset : undefined,\n                top: flight.top,\n                width: flight.width,\n                height: flight.height,\n                borderRadius: r,\n              }\n            : { ...box, borderRadius: r }\n        }\n      >\n        {!handing && <Shine temperament={temperament} />}\n      </motion.div>\n    )\n  }\n\n  return (\n    <div\n      ref={composeRefs(node, ref)}\n      data-slot=\"skeleton-slot\"\n      data-skeleton-slot=\"\"\n      data-shape={shape.kind}\n      data-state={arrived ? \"loaded\" : \"loading\"}\n      className={cn(\"min-w-0\", shape.kind === \"ball\" && \"shrink-0\", className)}\n      style={style}\n      {...props}\n    >\n      <motion.div\n        className=\"relative grid items-center\"\n        // The put-down presses toward the line the element rests on, from its own edge.\n        style={{ minHeight, originX: shape.kind === \"ball\" ? 0.5 : end ? 1 : 0, originY: 1 }}\n        initial={false}\n        animate={{ scale: pressed ? 1 - m.values.squash * PUT_DOWN : 1 }}\n        transition={\n          pressed\n            ? { duration: m.seconds(m.values.anticipation), ease: easings.outQuart }\n            : m.springSmall\n        }\n      >\n        {/*\n          Out of the row's presence scope: a preset row was present when the root's list first\n          rendered, and that \"no entrance\" would otherwise reach content arriving later. It also\n          leaves at once on a refetch, the frame the placeholder comes back.\n        */}\n        <PresenceContext value={null}>\n          {arrived && (\n            <motion.div\n              key=\"content\"\n              ref={contentRef}\n              data-slot=\"skeleton-content\"\n              className={cn(\n                \"min-w-0 [grid-area:1/1]\",\n                shape.kind === \"pill\" || shape.kind === \"ball\"\n                  ? cn(\"w-fit max-w-full\", end ? \"justify-self-end text-end\" : \"justify-self-start\")\n                  : cn(\"w-full\", end && \"text-end\"),\n              )}\n              initial={handing ? { opacity: 0 } : false}\n              animate={{ opacity: 1 }}\n              transition={reveal}\n            >\n              <SlotContext value={rollValue}>{children}</SlotContext>\n            </motion.div>\n          )}\n        </PresenceContext>\n        {look}\n      </motion.div>\n    </div>\n  )\n}\n\nexport interface SkeletonSlotProps extends SlotBaseProps {\n  /** Placeholder shape: `ball` (avatar, icon), `pill` (one text line) or `tile` (media, card). */\n  shape?: \"ball\" | \"pill\" | \"tile\"\n  /** Text size of a `pill`: its height is the glyph height, centered in the line box. */\n  size?: SkeletonTextSize\n  /** Width of a `pill` or `tile` placeholder (px or CSS length); the ball's diameter for `ball`. */\n  width?: number | string\n  /** Height of a `tile` placeholder (px or CSS length). */\n  height?: number | string\n  /** Aspect ratio of a `tile` placeholder, e.g. `16 / 9`. */\n  aspectRatio?: number\n}\n\n/**\n * Wraps a real element: while loading it shows a placeholder of the element's shape at its\n * place, then the placeholder morphs into it (the ball becomes the avatar, the pill becomes\n * the line of text, the tile becomes the image) and lands with a small put-down.\n */\nexport function SkeletonSlot({\n  shape = \"pill\",\n  size = \"sm\",\n  width,\n  height,\n  aspectRatio,\n  ...props\n}: SkeletonSlotProps) {\n  const kind: Kind =\n    shape === \"ball\"\n      ? { kind: \"ball\", diameter: typeof width === \"number\" ? width : AVATAR.md }\n      : shape === \"pill\"\n        ? { kind: \"pill\", text: size, width: width ?? \"100%\" }\n        : { kind: \"tile\", width, height, aspectRatio }\n  return <SlotBody shape={kind} {...props} />\n}\n\nexport interface SkeletonTextProps extends SlotBaseProps {\n  /** Number of lines; the last one is shorter, like the end of a paragraph. */\n  lines?: number\n  /** Text size: sets the line box and the pill height. */\n  size?: SkeletonTextSize\n  /** Width of each line, e.g. `[\"100%\", \"80%\"]`; defaults to the paragraph pattern. */\n  widths?: string[]\n}\n\n/** A paragraph of pills that becomes the paragraph: one surface, the lines fade as the text arrives. */\nexport function SkeletonText({ lines = 3, size = \"sm\", widths, ...props }: SkeletonTextProps) {\n  const pattern =\n    widths ??\n    Array.from({ length: lines }, (_, i) =>\n      i === lines - 1 && lines > 1 ? LINE_PATTERN[2] : (LINE_PATTERN[i % 2] ?? LINE_PATTERN[0]),\n    )\n  return <SlotBody shape={{ kind: \"text\", text: size, widths: pattern }} {...props} />\n}\n\nexport interface SkeletonAvatarProps extends SlotBaseProps {\n  /** `sm` 24, `md` 32, `lg` 40 px. */\n  size?: SkeletonAvatarSize\n}\n\n/** A ball that becomes the avatar (same box, radius kept). */\nexport function SkeletonAvatar({ size = \"md\", ...props }: SkeletonAvatarProps) {\n  return <SlotBody shape={{ kind: \"ball\", diameter: AVATAR[size] }} {...props} />\n}\n\nexport interface SkeletonMediaProps extends SlotBaseProps {\n  /** Width over height of the tile. */\n  aspectRatio?: number\n}\n\n/** A tile that becomes the image or chart, at its aspect ratio. */\nexport function SkeletonMedia({ aspectRatio = 16 / 9, radius = 12, ...props }: SkeletonMediaProps) {\n  return <SlotBody shape={{ kind: \"tile\", aspectRatio }} radius={radius} {...props} />\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Count: a number that rolls up as it arrives\n * -----------------------------------------------------------------------------------------------*/\n\nconst NUMBER = /\\d(?:[\\d.,\\u00a0\\u202f ]*\\d)?/\nconst isDigit = (c: string | undefined) => c !== undefined && c >= \"0\" && c <= \"9\"\n\n/*\n * `text` with its first number at `p` (0 to 1) of its value, in the same format: \"€1,240.00\" at\n * 0.5 is \"€620.00\", at 0 \"€0.00\". The last separator is the decimal one when 1 or 2 digits follow.\n */\nfunction rollFrame(text: string, p: number) {\n  const match = NUMBER.exec(text)\n  if (!match) return text\n  const span = match[0]\n  const digits = span.replace(/\\D/g, \"\")\n  if (digits.length > 15) return text\n  const value = String(Math.round(Number(digits) * p)).padStart(digits.length, \"0\")\n  let d = 0\n  const chars = Array.from(span, (c) => (isDigit(c) ? (value[d++] ?? c) : c))\n  let sep = -1\n  for (let i = span.length - 1; i >= 0; i--) {\n    if (!isDigit(span[i])) {\n      sep = i\n      break\n    }\n  }\n  const point = sep >= 0 && span.length - 1 - sep <= 2 ? sep : span.length\n  let cut = 0\n  while (cut < point - 1 && (chars[cut] === \"0\" || !isDigit(chars[cut]))) cut++\n  return (\n    text.slice(0, match.index) + chars.slice(cut).join(\"\") + text.slice(match.index + span.length)\n  )\n}\n\nexport interface SkeletonCountProps extends Omit<ComponentProps<\"span\">, \"children\"> {\n  /** The formatted value, e.g. `\"€1,240.00\"` or `42`. */\n  children: string | number\n}\n\n/**\n * A formatted number inside a slot: when the slot hands over, its digits count up from 0 to the\n * value in the value's own format, in a box already as wide as the final text (no shift).\n * Static when it renders without a hand-over, with reduced motion, or with `roll={false}`.\n */\nexport function SkeletonCount({ children, className, ...props }: SkeletonCountProps) {\n  const text = String(children)\n  const root = useContext(RootContext)\n  const slot = useContext(SlotContext)\n  // Decided once, at mount: only content that arrives through a hand-over rolls.\n  const [timing] = useState(() =>\n    slot?.roll && root?.roll !== false && rollFrame(text, 0) !== text ? slot : null,\n  )\n  const [rolling, setRolling] = useState(timing !== null)\n  const live = useRef<HTMLSpanElement>(null)\n\n  useEffect(() => {\n    if (!rolling || !timing) return\n    const start = performance.now() + timing.delay * 1000\n    const total = timing.duration * 1000\n    let raf = 0\n    const tick = (now: number) => {\n      const p = Math.min(1, Math.max(0, (now - start) / total))\n      // easings.outQuart as a function: fast at first, the last digits settle slowly.\n      if (live.current) live.current.textContent = rollFrame(text, 1 - (1 - p) ** 4)\n      if (p < 1) raf = requestAnimationFrame(tick)\n    }\n    raf = requestAnimationFrame(tick)\n    const end = window.setTimeout(\n      () => {\n        setRolling(false)\n      },\n      (timing.delay + timing.duration) * 1000,\n    )\n    return () => {\n      cancelAnimationFrame(raf)\n      window.clearTimeout(end)\n    }\n  }, [rolling, timing, text])\n\n  return (\n    <span\n      data-slot=\"skeleton-count\"\n      data-state={rolling ? \"rolling\" : \"idle\"}\n      className={cn(\"inline-grid tabular-nums\", className)}\n      {...props}\n    >\n      {/* The real value reserves the width and stays readable by assistive tech. */}\n      <span className={cn(\"[grid-area:1/1]\", rolling && \"opacity-0\")}>{text}</span>\n      {rolling && (\n        <span ref={live} aria-hidden className=\"justify-self-end [grid-area:1/1]\">\n          {rollFrame(text, 0)}\n        </span>\n      )}\n    </span>\n  )\n}\n\n/* Plain values roll; elements render as given. */\nconst counted = (node: ReactNode) =>\n  typeof node === \"string\" || typeof node === \"number\" ? (\n    <SkeletonCount>{node}</SkeletonCount>\n  ) : (\n    node\n  )\n\n/* -------------------------------------------------------------------------------------------------\n * Preset rows\n * -----------------------------------------------------------------------------------------------*/\n\ninterface PresetRowProps {\n  /** Position in the root, set by the root (cascade of rows that arrive without a placeholder). */\n  index?: number\n}\n\n/* Rows of a preset: rise in when new, fade and collapse when no content takes their place. */\nfunction useRowMotion(index: number, collapse: boolean) {\n  const root = useContext(RootContext)\n  const own = useMotionKit()\n  const m = root?.motion ?? own\n  const present = useIsPresent()\n  const enter = cascade(m, index, { after: 0 })\n  const leave = m.seconds(m.values.duration * EXIT_SHARE)\n  return {\n    shown: root?.shown ?? false,\n    motion: {\n      initial: enter.initial,\n      animate: { ...enter.animate, ...(collapse ? { height: \"auto\" } : {}) },\n      exit: {\n        opacity: 0,\n        ...(collapse ? { height: 0 } : {}),\n        transition: {\n          opacity: m.reduced ? m.fade : { duration: leave, ease: \"easeIn\" as const },\n          height: reflow(m, { calm: true }),\n        },\n      },\n      transition: enter.transition,\n      style: { overflow: present ? undefined : (\"hidden\" as const) },\n    },\n  }\n}\n\nexport interface SkeletonListItemProps\n  extends PresetRowProps, Omit<ComponentProps<\"div\">, \"title\" | \"children\" | keyof PresetRowProps> {\n  /** The avatar: an element, or initials drawn in the suite's avatar ball. */\n  avatar?: ReactNode\n  /** First line, e.g. the order. */\n  title?: ReactNode\n  /** Second line, e.g. the status and time. */\n  meta?: ReactNode\n  /** Right-aligned value, e.g. the amount (tabular figures). */\n  trailing?: ReactNode\n}\n\n/** One row of the `list` preset: a ball and two pills, plus a short right-aligned pill. */\nexport function SkeletonListItem({\n  index = 0,\n  avatar,\n  title,\n  meta,\n  trailing,\n  className,\n  ref,\n  ...props\n}: SkeletonListItemProps) {\n  const row = useRowMotion(index, true)\n  return (\n    <motion.div\n      ref={ref}\n      role=\"listitem\"\n      aria-hidden={row.shown || undefined}\n      data-slot=\"skeleton-list-item\"\n      data-skeleton-item=\"\"\n      className={cn(\n        \"grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 py-3 shadow-[inset_0_-1px_0_var(--border)] last:shadow-none\",\n        className,\n      )}\n      {...row.motion}\n      {...(props as Record<string, unknown>)}\n    >\n      <SkeletonAvatar className=\"row-span-2 @max-[22rem]:row-span-3\">\n        {typeof avatar === \"string\" ? (\n          <span className=\"flex size-8 items-center justify-center rounded-[16px] bg-[color-mix(in_oklch,var(--muted-foreground)_16%,var(--card))] text-xs font-medium text-foreground\">\n            {avatar}\n          </span>\n        ) : (\n          avatar\n        )}\n      </SkeletonAvatar>\n      <SkeletonSlot width=\"60%\" className=\"col-start-2\">\n        <span className=\"block truncate text-sm leading-5 font-medium text-foreground\">\n          {title}\n        </span>\n      </SkeletonSlot>\n      <SkeletonSlot\n        width=\"4.5rem\"\n        align=\"end\"\n        className=\"col-start-3 row-start-1 @max-[22rem]:col-start-2 @max-[22rem]:row-start-3 @max-[22rem]:[&_[data-slot=skeleton-content]]:justify-self-start @max-[22rem]:[&_[data-slot=skeleton-placeholder]]:justify-self-start\"\n      >\n        <span className=\"block text-sm leading-5 font-medium text-foreground tabular-nums\">\n          {counted(trailing)}\n        </span>\n      </SkeletonSlot>\n      <SkeletonSlot width=\"35%\" size=\"xs\" className=\"col-start-2 row-start-2\">\n        <span className=\"block truncate text-xs leading-4 text-muted-foreground\">{meta}</span>\n      </SkeletonSlot>\n    </motion.div>\n  )\n}\n\nexport interface SkeletonCardItemProps\n  extends PresetRowProps, Omit<ComponentProps<\"div\">, \"title\" | \"children\" | keyof PresetRowProps> {\n  /** The 16:9 media: an image or a cover. */\n  media?: ReactNode\n  /** Card title. */\n  title?: ReactNode\n  /** Two lines of description. */\n  description?: ReactNode\n  /** A small avatar or icon in the footer (24 px). */\n  footer?: ReactNode\n  /** The footer's text, e.g. the owner or the date. */\n  footerLabel?: ReactNode\n}\n\n/** One card of the `card` preset: a media tile, a title, two lines and a footer. */\nexport function SkeletonCardItem({\n  index = 0,\n  media,\n  title,\n  description,\n  footer,\n  footerLabel,\n  className,\n  ref,\n  ...props\n}: SkeletonCardItemProps) {\n  const row = useRowMotion(index, false)\n  return (\n    <motion.div\n      ref={ref}\n      role=\"listitem\"\n      aria-hidden={row.shown || undefined}\n      data-slot=\"skeleton-card-item\"\n      data-skeleton-item=\"\"\n      className={cn(\n        \"flex flex-col gap-3 rounded-[16px] bg-card p-2 pb-3 text-card-foreground shadow-[0_0_0_1px_var(--border),0_1px_2px_0_rgb(0_0_0/0.05)]\",\n        className,\n      )}\n      {...row.motion}\n      {...(props as Record<string, unknown>)}\n    >\n      <SkeletonMedia radius={8}>{media}</SkeletonMedia>\n      <div className=\"flex flex-col gap-1 px-2\">\n        <SkeletonSlot width=\"70%\">\n          <span className=\"block truncate text-sm leading-5 font-medium\">{title}</span>\n        </SkeletonSlot>\n        <SkeletonText lines={2} size=\"xs\">\n          <p className=\"line-clamp-2 text-xs leading-4 text-muted-foreground\">{description}</p>\n        </SkeletonText>\n      </div>\n      <div className=\"flex items-center gap-2 px-2\">\n        <SkeletonAvatar size=\"sm\">{footer}</SkeletonAvatar>\n        <SkeletonSlot width=\"40%\" size=\"xs\" className=\"flex-1\">\n          <span className=\"block truncate text-xs leading-4 text-muted-foreground\">\n            {footerLabel}\n          </span>\n        </SkeletonSlot>\n      </div>\n    </motion.div>\n  )\n}\n\nconst DEFAULT_COLUMNS: SkeletonColumn[] = [\n  { width: \"minmax(0,1.2fr)\" },\n  { width: \"minmax(0,1fr)\" },\n  { width: \"minmax(0,1fr)\" },\n  { width: \"minmax(0,1fr)\", align: \"end\" },\n]\n\nfunction tracks(columns: SkeletonColumn[]) {\n  return columns.map((column) => px(column.width)).join(\" \")\n}\n\nfunction SkeletonTableFrame({\n  columns = DEFAULT_COLUMNS,\n  children,\n}: {\n  columns?: SkeletonColumn[]\n  children: ReactNode\n}) {\n  return (\n    <div role=\"table\" data-slot=\"skeleton-table\" className=\"flex flex-col text-sm\">\n      <div role=\"rowgroup\">\n        <div\n          role=\"row\"\n          className=\"grid items-center gap-x-4 px-3 py-2.5 shadow-[inset_0_-1px_0_var(--border)]\"\n          style={{ gridTemplateColumns: tracks(columns) }}\n        >\n          {columns.map((column, i) => (\n            <div\n              key={i}\n              role=\"columnheader\"\n              className={cn(\n                \"min-w-0 truncate text-xs leading-4 font-medium text-muted-foreground\",\n                column.align === \"end\" && \"text-end\",\n              )}\n            >\n              {column.header ?? (\n                <SkeletonBlock\n                  shape=\"pill\"\n                  className={cn(\"h-2 w-12\", column.align === \"end\" && \"ms-auto\")}\n                />\n              )}\n            </div>\n          ))}\n        </div>\n      </div>\n      <div role=\"rowgroup\">{children}</div>\n    </div>\n  )\n}\n\nexport interface SkeletonTableRowProps\n  extends PresetRowProps, Omit<ComponentProps<\"div\">, \"children\" | keyof PresetRowProps> {\n  /** One node per column, in the root's `columns` order. */\n  cells?: ReactNode[]\n}\n\n/** One row of the `table` preset: a pill per cell, aligned to the column, morphing into the value. */\nexport function SkeletonTableRow({\n  index = 0,\n  cells,\n  className,\n  ref,\n  ...props\n}: SkeletonTableRowProps) {\n  const root = useContext(RootContext)\n  const columns = root?.columns ?? DEFAULT_COLUMNS\n  const row = useRowMotion(index, true)\n  return (\n    <motion.div\n      ref={ref}\n      role=\"row\"\n      aria-hidden={row.shown || undefined}\n      data-slot=\"skeleton-table-row\"\n      data-skeleton-item=\"\"\n      className={cn(\n        \"grid items-center gap-x-4 px-3 py-2.5 shadow-[inset_0_-1px_0_var(--border)] last:shadow-none\",\n        className,\n      )}\n      style={{ gridTemplateColumns: tracks(columns), ...row.motion.style }}\n      initial={row.motion.initial}\n      animate={row.motion.animate}\n      exit={row.motion.exit}\n      transition={row.motion.transition}\n      {...(props as Record<string, unknown>)}\n    >\n      {columns.map((column, i) => (\n        <div key={i} role=\"cell\" className=\"min-w-0\">\n          <SkeletonSlot width={CELL_PATTERN[i % CELL_PATTERN.length] ?? \"60%\"} align={column.align}>\n            <span\n              className={cn(\n                \"block truncate leading-5\",\n                column.align === \"end\" && \"text-end tabular-nums\",\n              )}\n            >\n              {column.align === \"end\" ? counted(cells?.[i]) : cells?.[i]}\n            </span>\n          </SkeletonSlot>\n        </div>\n      ))}\n    </motion.div>\n  )\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Namespace\n * -----------------------------------------------------------------------------------------------*/\n\n/**\n * Loading placeholders made of the three shapes (a ball for an avatar, pills for text, a\n * tile for media) that become the content at its place. `<Skeleton className=\"h-4 w-32\" />`\n * renders one block; `Skeleton.Root`, `Skeleton.Slot` and the presets do the hand-over.\n */\nexport const Skeleton = Object.assign(SkeletonBlock, {\n  Root: SkeletonRoot,\n  Slot: SkeletonSlot,\n  Item: SkeletonItem,\n  Text: SkeletonText,\n  Avatar: SkeletonAvatar,\n  Media: SkeletonMedia,\n  ListItem: SkeletonListItem,\n  CardItem: SkeletonCardItem,\n  TableRow: SkeletonTableRow,\n  Count: SkeletonCount,\n})\n",
      "type": "registry:ui"
    }
  ],
  "cssVars": {
    "theme": {
      "color-brand": "var(--brand)"
    },
    "light": {
      "brand": "oklch(0.55 0.2 278)"
    },
    "dark": {
      "brand": "oklch(0.7 0.16 278)"
    }
  },
  "meta": {
    "tier": "free",
    "collection": "interface",
    "needsImage": false,
    "addedAt": "2026-10-14",
    "tags": [
      "skeleton",
      "placeholder",
      "loading",
      "morph",
      "list",
      "table",
      "feedback",
      "empty-state",
      "error",
      "count-up"
    ],
    "triggers": [
      "loading"
    ],
    "wave": "3",
    "tech": [],
    "presets": [
      "list",
      "card",
      "table"
    ],
    "keyboard": [],
    "reducedMotion": "Placeholders are static shapes with no sweep; each one fades out in place and its content fades in right after, all at once, and numbers appear at their value.",
    "heavy": false,
    "ai": {
      "summary": "Loading placeholders that turn into the real content",
      "useCases": [
        "Show a list of orders while they load, each row becoming its content",
        "Show a grid of project cards with image tiles that become covers",
        "Show table rows that become cells, with amounts counting up",
        "Resolve an empty or failed load into a note or an error with Retry"
      ],
      "whenToUse": "Use it when you know the shape of what is loading: a list, a card grid or a table. Placeholders match the layout, share one sweep and turn into the content in place.",
      "whenNotToUse": "When you do not know the layout use `loader`. When you know the progress use `progress`.",
      "pairsWith": [
        "data-table",
        "status-badge",
        "avatar-group"
      ],
      "contexts": [
        "dashboard",
        "saas-app",
        "data",
        "ecommerce"
      ],
      "keywords": [
        "skeleton",
        "placeholder",
        "loading",
        "shimmer",
        "list",
        "table",
        "empty state",
        "error state",
        "count up",
        "suspense"
      ],
      "triggers": [
        "ambient",
        "value"
      ]
    }
  },
  "categories": [
    "overlays"
  ],
  "type": "registry:ui"
}