{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "bar-list",
  "title": "Bar List",
  "description": "Ranked list of labels with proportional bars and values, e.g. top products.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "@ikas/chart-kit",
    "@ikas/motion",
    "@ikas/utils"
  ],
  "files": [
    {
      "path": "registry/ikas/bar-list.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { motion, useReducedMotion } from \"motion/react\"\n\nimport { SPRING } from \"@/lib/motion\"\nimport { cn } from \"@/lib/utils\"\nimport { defaultNumberFormat } from \"@/components/ikas/chart-kit\"\n\ntype BarListItem = {\n  name: string\n  value: number\n  /** Optional leading icon, 16px. */\n  icon?: React.ReactNode\n  /** Turns the row into a link. */\n  href?: string\n}\n\ntype BarListProps = {\n  data: BarListItem[]\n  /** Bar color. Ink by default; the bar is drawn as a light wash of it. */\n  color?: string\n  /** Formats the value column. */\n  valueFormat?: (value: number) => string\n  /** Sorts rows by value. Ranked lists read top-down. */\n  sortOrder?: \"descending\" | \"ascending\" | \"none\"\n  /** Small column headers above the list. */\n  header?: { name: React.ReactNode; value: React.ReactNode }\n  className?: string\n  /** Accessible summary of what the list shows. */\n  \"aria-label\"?: string\n}\n\n/**\n * Ranked horizontal list: label on a light wash bar, value on the right.\n * Bars slide in once on mount with a short stagger.\n */\nfunction BarList({ data, color = \"var(--chart-ink)\", valueFormat = defaultNumberFormat, sortOrder = \"descending\", header, className, \"aria-label\": ariaLabel }: BarListProps) {\n  const reduce = useReducedMotion()\n  const rows = React.useMemo(() => {\n    if (sortOrder === \"none\") return data\n    return [...data].sort((a, b) => (sortOrder === \"descending\" ? b.value - a.value : a.value - b.value))\n  }, [data, sortOrder])\n  const max = Math.max(...rows.map((r) => r.value), 1)\n\n  return (\n    <div className={cn(\"flex flex-col gap-1.5\", className)}>\n      {header && (\n        <div className=\"flex items-center justify-between px-1 pb-1 text-xs font-medium text-muted-foreground\">\n          <span>{header.name}</span>\n          <span>{header.value}</span>\n        </div>\n      )}\n      <ul aria-label={ariaLabel} className=\"flex flex-col gap-1\">\n        {rows.map((row, i) => {\n          const Row = row.href ? \"a\" : \"div\"\n          return (\n            <li key={row.name}>\n              <Row\n                {...(row.href ? { href: row.href } : {})}\n                className=\"group/row flex items-center gap-4 rounded-md outline-none focus-visible:ring-3 focus-visible:ring-ring/30\"\n              >\n                <div className=\"relative flex h-8 min-w-0 flex-1 items-center\">\n                  <motion.div\n                    aria-hidden\n                    className=\"absolute inset-y-0 left-0 rounded-[5px] transition-[background-color] duration-150 group-hover/row:[--wash:20%]\"\n                    style={{ background: `color-mix(in oklab, ${color} var(--wash, 12%), transparent)` }}\n                    initial={reduce ? false : { width: 0 }}\n                    animate={{ width: `${Math.max((row.value / max) * 100, 2)}%` }}\n                    transition={{ ...SPRING, delay: reduce ? 0 : i * 0.05 }}\n                  />\n                  <span className=\"relative flex min-w-0 items-center gap-2 px-2.5 text-sm text-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-icon\">\n                    {row.icon}\n                    <span className={cn(\"truncate\", row.href && \"underline-offset-4 group-hover/row:underline\")}>{row.name}</span>\n                  </span>\n                </div>\n                <span className=\"shrink-0 text-sm font-medium text-foreground tabular-nums\">{valueFormat(row.value)}</span>\n              </Row>\n            </li>\n          )\n        })}\n      </ul>\n    </div>\n  )\n}\n\nexport { BarList, type BarListItem, type BarListProps }\n",
      "type": "registry:component",
      "target": "@components/ikas/bar-list.tsx"
    }
  ],
  "docs": "https://builders.ikas.com/tr/docs/app-development/ui-kit/components/bar-list",
  "categories": [
    "charts",
    "data-display"
  ],
  "type": "registry:component"
}