{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tw-big-number",
  "type": "registry:ui",
  "title": "react-tw/big-number.tsx",
  "description": "Carbon for IBM Products `BigNumberSkeleton` as React + Tailwind, the look of `<ui-big-number-skeleton>`: 64px wide Copied from @purpurabog/ui 2.3.0; the package is the maintained source, this copy is yours to change. Icons from the Carbon Design System (Apache-2.0, © IBM Corp.; see THIRD-PARTY-NOTICES.md in the package).",
  "dependencies": [],
  "registryDependencies": [
    "@kanok-ui/core-big-number",
    "@kanok-ui/tw-i18n",
    "@kanok-ui/tw-theme",
    "@kanok-ui/tw-tooltip",
    "@kanok-ui/tw-utils"
  ],
  "files": [
    {
      "path": "src/react-tw/big-number.tsx",
      "type": "registry:ui",
      "target": "components/ui/react-tw/big-number.tsx",
      "content": "import type { ComponentProps, ReactNode, Ref } from 'react';\nimport { bigNumberParts, type BigNumberSize } from '../core/big-number.ts';\nimport { Tooltip } from './tooltip.tsx';\nimport { useTranslation } from './lib/i18n.ts';\nimport { cn } from './lib/utils.ts';\n\nexport interface BigNumberProps extends Omit<ComponentProps<'figure'>, 'children' | 'ref'> {\n    /** The figure, or the skeleton's box while `loading`. */\n    ref?: Ref<HTMLElement>;\n    /** The label above the value (or your own node, e.g. with a toggletip). */\n    label: ReactNode;\n    /** The value (the numerator of a fraction). */\n    value?: number;\n    /** The total after the slash; shown only when larger than `value` and different once abbreviated. */\n    total?: number;\n    /** How the numbers are written (Intl locale); en-US when missing or invalid (Carbon). */\n    locale?: string;\n    /** Fraction digits of an abbreviated number. */\n    fractionDigits?: number;\n    /** Abbreviate the numbers (12,345 → 12.3K). */\n    truncate?: boolean;\n    /** Add \"%\" after the value; the total never shows. */\n    percentage?: boolean;\n    /** `true`: an up arrow before the value (Carbon `trending`); or your own icon there. */\n    trending?: ReactNode;\n    /** Show the total even when it would be hidden (\"Unknown\" without one). */\n    forceShowTotal?: boolean;\n    /** Text of an info button after the label, shown in a tooltip. */\n    tooltipDescription?: string;\n    /** An icon button after the value. */\n    iconButton?: ReactNode;\n    size?: BigNumberSize;\n    /** Show the skeleton instead. */\n    loading?: boolean;\n    lang?: string;\n}\n\nconst VALUE: Record<BigNumberSize, string> = { default: 'type-heading-04', lg: 'type-heading-06', xl: 'type-heading-07' };\nconst TOTAL: Record<BigNumberSize, string> = { default: 'type-body-sm', lg: 'type-heading-03 tracking-normal', xl: 'type-heading-04 tracking-normal' };\nconst TREND_PX: Record<BigNumberSize, number> = { default: 16, lg: 20, xl: 24 };\n\nfunction ArrowUp({ size }: Readonly<{ size: BigNumberSize }>) {\n    const px = TREND_PX[size] ?? 16;\n    return (\n        <svg width={px} height={px} viewBox={px === 16 ? '0 0 16 16' : '0 0 32 32'} aria-hidden=\"true\" className={cn('flex-none fill-current', size === 'xl' ? 'mt-3' : 'mt-2')}>\n            {px === 16 ? <path d=\"M3.7 6.7 7.5 2.9 7.5 15 8.5 15 8.5 2.9 12.3 6.7 13 6 8 1 3 6z\" /> : <path d=\"M16 4 6 14 7.41 15.41 15 7.83 15 28 17 28 17 7.83 24.59 15.41 26 14 16 4z\" />}\n        </svg>\n    );\n}\n\nfunction InfoIcon() {\n    return (\n        <svg viewBox=\"0 0 16 16\" aria-hidden=\"true\" className=\"size-4 fill-current\">\n            <path d=\"M8.5 11 8.5 6.5 6.5 6.5 6.5 7.5 7.5 7.5 7.5 11 6 11 6 12 10 12 10 11z\" />\n            <path d=\"M8,3.5c-0.4,0-0.8,0.3-0.8,0.8S7.6,5,8,5c0.4,0,0.8-0.3,0.8-0.8S8.4,3.5,8,3.5z\" />\n            <path d=\"M8,15c-3.9,0-7-3.1-7-7s3.1-7,7-7s7,3.1,7,7S11.9,15,8,15z M8,2C4.7,2,2,4.7,2,8s2.7,6,6,6s6-2.7,6-6S11.3,2,8,2z\" />\n        </svg>\n    );\n}\n\nexport interface BigNumberSkeletonProps extends ComponentProps<'div'> {\n    size?: BigNumberSize;\n}\n\n/**\n * Carbon for IBM Products `BigNumberSkeleton` as React + Tailwind, the look of `<ui-big-number-skeleton>`: 64px wide\n * (lg 80, xl 96), a 70% × 16px label bar, then a 40px value bar (lg 48, xl 64) 4px under it (lg 8, xl 12).\n */\nexport function BigNumberSkeleton({ size = 'default', className, ...rest }: Readonly<BigNumberSkeletonProps>) {\n    return (\n        <div {...rest} aria-hidden=\"true\" className={cn('block', { default: 'w-16', lg: 'w-20', xl: 'w-24' }[size], className)}>\n            <span className={cn('skeleton block h-4 w-[70%]', { default: 'mb-1', lg: 'mb-2', xl: 'mb-3' }[size])} />\n            <span className={cn('skeleton block', { default: 'h-10', lg: 'h-12', xl: 'h-16' }[size])} />\n        </div>\n    );\n}\n\n/**\n * Carbon for IBM Products `BigNumber` as React + Tailwind, the look of `<ui-big-number>`: a large value under a small\n * label — \"12.3K\", or \"12.3K/50.0K\" with a larger `total` (never with `percentage`, which adds \"%\", unless\n * `forceShowTotal`), abbreviated by Intl compact notation in `locale` (en-US by default, as Carbon).\n */\nexport function BigNumber({ label, value, total, locale, fractionDigits = 1, truncate = true, percentage = false, trending = false, forceShowTotal = false, tooltipDescription, iconButton, size = 'default', loading = false, lang, className, ref, ...rest }: Readonly<BigNumberProps>) {\n    const t = useTranslation(lang).common;\n    if (loading) return <BigNumberSkeleton {...rest} ref={ref as Ref<HTMLDivElement>} size={size} className={className} />;\n    const parts = bigNumberParts({ value, total, percentage, forceShowTotal, locale, fractionDigits, truncate, unknown: t.unknown });\n    const small = cn('mt-auto mb-1', TOTAL[size] ?? TOTAL.default);\n    let trend: ReactNode = null;\n    if (trending === true) trend = <ArrowUp size={size} />;\n    else if (trending) trend = trending;\n    return (\n        <figure {...rest} ref={ref} className={cn('m-0 block text-ink', className)}>\n            <figcaption className=\"flex\">\n                <span className={cn('m-0 block text-ink-muted', size === 'xl' ? 'type-body-sm' : 'type-caption')}>{label}</span>\n                {tooltipDescription ? (\n                    <Tooltip text={tooltipDescription} placement=\"right\" className=\"flex ps-2\">\n                        <button type=\"button\" aria-label={t.moreInfo} className=\"flex cursor-pointer self-start border-0 bg-transparent p-0 text-ink focus-visible:rounded-[var(--ui-icon-control-radius,0px)] focus-visible:outline-1 focus-visible:outline-focus focus-visible:outline-solid\">\n                            <InfoIcon />\n                        </button>\n                    </Tooltip>\n                ) : null}\n            </figcaption>\n            <span className=\"flex\">\n                {trend}\n                <span className={cn('mb-0', VALUE[size] ?? VALUE.default)}>\n                    {parts.value}\n                    {percentage ? <span className={small}>%</span> : null}\n                </span>\n                {parts.total ? <span className={small}>{parts.total}</span> : null}\n                <span className=\"ms-1\">{iconButton}</span>\n            </span>\n        </figure>\n    );\n}\n"
    }
  ]
}
