{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ink/digits",
  "title": "Digits",
  "description": "Box-drawing character numerals",
  "dependencies": [
    "ink"
  ],
  "registryDependencies": [
    "https://termcn.dev/r/ink/terminal-symbols.json",
    "https://termcn.dev/r/ink/use-theme.json",
    "https://termcn.dev/r/ink/use-unicode.json"
  ],
  "files": [
    {
      "path": "registry/ui/digits.tsx",
      "content": "import { Box, Text } from \"ink\";\n\nimport { useTheme } from \"@/hooks/use-theme\";\nimport { useUnicode } from \"@/hooks/use-unicode\";\nimport { toAsciiComponentText } from \"@/lib/terminal-symbols\";\n\nexport type DigitSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface DigitsProps {\n  value: string | number;\n  color?: string;\n  size?: DigitSize;\n  \"aria-label\"?: string;\n  \"aria-hidden\"?: boolean;\n}\n\nconst SEGMENTS_MD: Record<string, string[]> = {\n  \" \": [\"   \", \"   \", \"   \", \"   \", \"   \"],\n  \"-\": [\"   \", \"   \", \" ─ \", \"   \", \"   \"],\n  \".\": [\"   \", \"   \", \"   \", \"   \", \" ● \"],\n  \"0\": [\"╭─╮\", \"│ │\", \"│ │\", \"│ │\", \"╰─╯\"],\n  \"1\": [\"  │\", \"  │\", \"  │\", \"  │\", \"  │\"],\n  \"2\": [\"╭─╮\", \"  │\", \"╭─╯\", \"│  \", \"╰─╴\"],\n  \"3\": [\"╭─╮\", \"  │\", \" ─┤\", \"  │\", \"╰─╯\"],\n  \"4\": [\"╷ ╷\", \"│ │\", \"╰─┤\", \"  │\", \"  ╵\"],\n  \"5\": [\"╭─╴\", \"│  \", \"╰─╮\", \"  │\", \"╰─╯\"],\n  \"6\": [\"╭─╴\", \"│  \", \"├─╮\", \"│ │\", \"╰─╯\"],\n  \"7\": [\"╭─╮\", \"  │\", \"  │\", \"  │\", \"  ╵\"],\n  \"8\": [\"╭─╮\", \"│ │\", \"├─┤\", \"│ │\", \"╰─╯\"],\n  \"9\": [\"╭─╮\", \"│ │\", \"╰─┤\", \"  │\", \"╰─╯\"],\n  \":\": [\"   \", \" ● \", \"   \", \" ● \", \"   \"],\n};\n\nconst SEGMENTS_LG: Record<string, string[]> = {\n  \" \": [\"     \", \"     \", \"     \", \"     \", \"     \"],\n  \"-\": [\"     \", \"     \", \" ─── \", \"     \", \"     \"],\n  \".\": [\"     \", \"     \", \"     \", \"     \", \"  ●  \"],\n  \"0\": [\"╭───╮\", \"│   │\", \"│   │\", \"│   │\", \"╰───╯\"],\n  \"1\": [\"   ╷ \", \"   │ \", \"   │ \", \"   │ \", \"   ╵ \"],\n  \"2\": [\"╭───╮\", \"    │\", \" ───╯\", \"│    \", \"╰───╴\"],\n  \"3\": [\"╭───╮\", \"    │\", \" ───┤\", \"    │\", \"╰───╯\"],\n  \"4\": [\"╷   ╷\", \"│   │\", \"╰───┤\", \"    │\", \"    ╵\"],\n  \"5\": [\"╭───╴\", \"│    \", \"╰───╮\", \"    │\", \"╰───╯\"],\n  \"6\": [\"╭───╴\", \"│    \", \"├───╮\", \"│   │\", \"╰───╯\"],\n  \"7\": [\"╭───╮\", \"    │\", \"    │\", \"    │\", \"    ╵\"],\n  \"8\": [\"╭───╮\", \"│   │\", \"├───┤\", \"│   │\", \"╰───╯\"],\n  \"9\": [\"╭───╮\", \"│   │\", \"╰───┤\", \"    │\", \"╰───╯\"],\n  \":\": [\"     \", \"  ●  \", \"     \", \"  ●  \", \"     \"],\n};\n\nconst getSegmentMap = (size: DigitSize): Record<string, string[]> =>\n  size === \"lg\" ? SEGMENTS_LG : SEGMENTS_MD;\n\nconst getFallback = (size: DigitSize): string[] => {\n  const w = size === \"lg\" ? 5 : 3;\n  const bar = \"─\".repeat(w - 2);\n  const side = `│${\" \".repeat(w - 2)}│`;\n  return [`╭${bar}╮`, side, side, side, `╰${bar}╯`];\n};\n\nexport const Digits = ({\n  value,\n  color,\n  size = \"md\",\n  \"aria-label\": ariaLabel,\n  \"aria-hidden\": ariaHidden,\n}: DigitsProps) => {\n  const theme = useTheme();\n  const unicode = useUnicode();\n  const resolvedColor = color ?? theme.colors.primary;\n  const str = String(value);\n\n  if (size === \"sm\") {\n    return (\n      <Text\n        aria-label={ariaHidden ? undefined : (ariaLabel ?? str)}\n        aria-hidden={ariaHidden}\n        color={resolvedColor}\n        bold\n      >\n        {str}\n      </Text>\n    );\n  }\n\n  const segMap = getSegmentMap(size);\n  const fallback = getFallback(size);\n  const chars = [...str];\n  const rows = 5;\n\n  return (\n    <Box\n      flexDirection=\"column\"\n      aria-label={ariaHidden ? undefined : (ariaLabel ?? str)}\n      aria-hidden={ariaHidden}\n    >\n      {Array.from({ length: rows }, (_, rowIdx) => (\n        <Box key={rowIdx} flexDirection=\"row\">\n          {chars.map((ch, charIdx) => {\n            const segments = segMap[ch] ?? fallback;\n            const rowStr =\n              segments[rowIdx] ?? \" \".repeat(size === \"lg\" ? 5 : 3);\n            return (\n              <Text key={charIdx} color={resolvedColor}>\n                {unicode ? rowStr : toAsciiComponentText(rowStr)}{\" \"}\n              </Text>\n            );\n          })}\n        </Box>\n      ))}\n    </Box>\n  );\n};\n",
      "type": "registry:ui"
    }
  ],
  "categories": [
    "typography"
  ],
  "type": "registry:ui"
}