{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "metric-panel",
  "title": "Metric Panel",
  "description": "Metric Panel from the Get IT Done design system.",
  "dependencies": [],
  "registryDependencies": [
    "https://zero-design.itdone.de/r/utils.json",
    "https://zero-design.itdone.de/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/ui/metric-panel.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\n\nimport { cn } from '@/lib/utils';\n\nexport interface MetricPanelSecondary {\n  label: React.ReactNode;\n  value: React.ReactNode;\n}\n\n// inverse follows the theme (light page: dark panel, dark page: light panel). inverse-fixed scopes the dark theme to the panel, so it stays dark in both modes.\nconst toneStyles = {\n  inverse: { root: 'bg-background-inverse text-text-inverse', muted: 'text-text-inverse-subtle', divider: 'border-border-inverse/20' },\n  'inverse-fixed': {\n    root: 'dark bg-background-subtle text-text-default',\n    // Border of the fixed-dark panel. Dropped with bordered={false}.\n    border: 'border border-solid border-border-subtle',\n    muted: 'text-text-subtle',\n    divider: 'border-border-default',\n  },\n} as const;\n\nconst sizeStyles = {\n  md: { value: 'typography-display', secondaryLabel: 'typography-ui', secondaryValue: 'typography-ui-semibold' },\n  lg: { value: 'typography-digit-lg-semibold', secondaryLabel: 'typography-large', secondaryValue: 'typography-ui-lg-semibold' },\n} as const;\n\nconst labelWeights = { semibold: 'typography-ui-semibold', medium: 'typography-ui-medium', regular: 'typography-ui' } as const;\n\n// Label size above the weight roles. default keeps the 13px label role, md uses the 14px and lg the 16px role (weight comes from labelWeight).\nconst labelSizes = {\n  md: { base: 'typography-text-small', semibold: 'font-semibold', medium: 'font-medium', regular: 'font-regular' },\n  lg: { base: 'typography-p-ui', semibold: 'font-semibold', medium: 'font-medium', regular: 'font-regular' },\n} as const;\n\n// row keeps label and value on one baseline. stacked puts the label above the value, stacked-reverse puts the value above the label.\nconst secondaryLayouts = {\n  row: { item: 'flex items-baseline justify-between gap-4' },\n  stacked: { item: 'flex flex-col gap-1' },\n  'stacked-reverse': { item: 'flex flex-col-reverse gap-1' },\n} as const;\n\nexport interface MetricPanelProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\n  label: React.ReactNode;\n  // The headline result, set in the display role.\n  value: React.ReactNode;\n  description?: React.ReactNode;\n  // Supporting figures below the result, rendered as a definition list.\n  secondary?: MetricPanelSecondary[];\n  // Announces changes of the result politely, for calculators that recompute while typing.\n  live?: boolean;\n  // inverse flips with the theme. inverse-fixed keeps the panel dark in dark mode too.\n  tone?: keyof typeof toneStyles;\n  // lg sets the result in the large digit role and the secondary rows one step larger.\n  size?: keyof typeof sizeStyles;\n  // Weight of the top label. Default semibold.\n  labelWeight?: keyof typeof labelWeights;\n  // Size of the top label. Default keeps the 13px role, `md` is 14px and `lg` 16px.\n  labelSize?: 'default' | keyof typeof labelSizes;\n  // Layout of the secondary rows. row (default), stacked (label above value) or stacked-reverse (value above label).\n  secondaryLayout?: keyof typeof secondaryLayouts;\n  // false drops the hairline border of the inverse-fixed tone. Default true.\n  bordered?: boolean;\n  // Stretches the panel to the height of its container, for equal height cards in a grid.\n  fill?: boolean;\n}\n\n// Large result panel on the inverse surface (calculator results, key figures).\nconst MetricPanel = React.forwardRef<HTMLDivElement, MetricPanelProps>(\n  ({ className, label, value, description, secondary, live = false, tone = 'inverse', size = 'md', labelWeight = 'semibold', labelSize = 'default', secondaryLayout = 'row', bordered = true, fill = false, children, ...props }, ref) => {\n    const id = React.useId();\n    const t = toneStyles[tone];\n    const z = sizeStyles[size];\n    const layout = secondaryLayouts[secondaryLayout];\n    return (\n      <div\n        ref={ref}\n        role=\"group\"\n        aria-labelledby={`${id}-label`}\n        data-fill={fill || undefined}\n        className={cn('flex flex-col gap-4 rounded-surface p-8', t.root, 'border' in t && bordered && t.border, fill && 'h-full', className)}\n        {...props}\n      >\n        <p id={`${id}-label`} className={cn(labelSize === 'default' ? labelWeights[labelWeight] : [labelSizes[labelSize].base, labelSizes[labelSize][labelWeight]], 'm-0', t.muted)}>\n          {label}\n        </p>\n        <p className={cn(z.value, 'm-0 tabular-nums')} {...(live ? { 'aria-live': 'polite' as const, 'aria-atomic': true } : {})}>\n          {value}\n        </p>\n        {description ? <p className={cn('typography-body m-0', t.muted)}>{description}</p> : null}\n        {secondary && secondary.length > 0 ? (\n          <dl className={cn('m-0 flex flex-col gap-2 border-t border-solid pt-4', t.divider)}>\n            {secondary.map((item, index) => (\n              <div key={index} className={layout.item}>\n                <dt className={cn(z.secondaryLabel, t.muted)}>{item.label}</dt>\n                <dd className={cn(z.secondaryValue, 'm-0 tabular-nums')}>{item.value}</dd>\n              </div>\n            ))}\n          </dl>\n        ) : null}\n        {children}\n      </div>\n    );\n  },\n);\nMetricPanel.displayName = 'MetricPanel';\n\nexport { MetricPanel };\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}