{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "bitcoin-motion", "title": "Bitcoin motion", "description": "Accessible confirmation, mempool, proof-of-work, UTXO, and Merkle motion primitives.", "registryDependencies": [ "dennisonbertram/bitcoin-ui/bitcoin-core", "dennisonbertram/bitcoin-ui/bitcoin-theme" ], "files": [ { "path": "components/bitcoin/bitcoin-motion.tsx", "content": "\"use client\";\n\nimport {\n useId,\n useState,\n type ComponentProps,\n type CSSProperties,\n} from \"react\";\n\nimport {\n clampPercent,\n formatFeeRate,\n formatSats,\n formatWeight,\n truncateMiddle,\n type SatoshiValue,\n} from \"@/lib/bitcoin\";\nimport { componentClasses } from \"@/lib/utils\";\n\nimport styles from \"./bitcoin-motion.module.css\";\nimport type { BitcoinVisualProps } from \"./shared\";\n\ntype MotionProps = BitcoinVisualProps & {\n /** Pauses motion without changing the represented state. @default false */\n paused?: boolean;\n};\n\ntype MotionStyle = CSSProperties & {\n \"--motion-column\"?: number;\n \"--motion-index\"?: number;\n \"--motion-lane\"?: number;\n};\n\nexport type AnimatedConfirmationsProps = Omit<\n ComponentProps<\"div\">,\n \"children\"\n> &\n MotionProps & {\n confirmations: number;\n /** Confirmation target represented by the relay. @default 6 */\n target?: number;\n };\n\nexport function AnimatedConfirmations({\n confirmations,\n target = 6,\n paused,\n unstyled,\n className,\n ...props\n}: AnimatedConfirmationsProps) {\n const safeTarget = Math.max(1, Math.floor(target));\n const safeConfirmations = Math.max(0, Math.floor(confirmations));\n const boundedConfirmations = Math.min(safeConfirmations, safeTarget);\n const remaining = Math.max(0, safeTarget - boundedConfirmations);\n const complete = boundedConfirmations >= safeTarget;\n const valueText = complete\n ? `${safeConfirmations} confirmations, finality target reached`\n : `${boundedConfirmations} of ${safeTarget} confirmations`;\n\n return (\n
\n {complete\n ? \"Finality target reached.\"\n : `${remaining} ${remaining === 1 ? \"block\" : \"blocks\"} until the display target.`}\n
\n{rootLabel}\n {txLabel}\n {txLabel}\n {truncateMiddle(input.id, 5, 4)}\n {formatSats(input.value)} sat\n {txLabel}\n \n {inputs.length} in · {outputs.length} out\n \n {truncateMiddle(output.id, 5, 4)}\n {formatSats(output.value)} sat\n \n UTXO set\n Spendable state derived from transaction outputs.\n
\n\n Merkle root\n Inclusion commitment to transactions in one block.\n
\n