{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "opentui/digits",
  "title": "Digits",
  "description": "Box-drawing character numerals",
  "dependencies": [
    "@opentui/react"
  ],
  "registryDependencies": [
    "https://termcn.dev/r/opentui/use-theme.json"
  ],
  "files": [
    {
      "path": "registry/opentui/ui/digits.tsx",
      "content": "/* @jsxImportSource @opentui/react */\n\nimport { useTheme } from \"@/hooks/use-theme\";\n\nexport type DigitSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface DigitsProps {\n  value: string | number;\n  color?: string;\n  size?: DigitSize;\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 = ({ value, color, size = \"md\" }: DigitsProps) => {\n  const theme = useTheme();\n  const resolvedColor = color ?? theme.colors.primary;\n  const str = String(value);\n\n  if (size === \"sm\") {\n    return (\n      <text fg={resolvedColor}>\n        <b>{str}</b>\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 flexDirection=\"column\">\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 <text key={charIdx} fg={resolvedColor}>{`${rowStr} `}</text>;\n          })}\n        </box>\n      ))}\n    </box>\n  );\n};\n",
      "type": "registry:ui",
      "target": "components/ui/digits.tsx"
    }
  ],
  "categories": [
    "typography"
  ],
  "type": "registry:ui"
}