{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "record-detail",
  "title": "Record Detail",
  "description": "Primitives for a record's page or panel: a layout with a details column beside the main content, the number that leads the record, titled sections under a rule and a list of labelled properties.",
  "registryDependencies": [
    "https://www.dashboardblocks.com/r/radix/block-state.json",
    "https://www.dashboardblocks.com/r/radix/kpi.json",
    "https://www.dashboardblocks.com/r/radix/status-label.json"
  ],
  "files": [
    {
      "path": "registry/components/dashboardblocks/record-detail.tsx",
      "content": "'use client'\n\nimport {\n  BlockStateRows,\n  useBlockState,\n} from '@/registry/components/dashboardblocks/block-state'\nimport {\n  type KPIFormat,\n  type KPIFormatter,\n  KPITitle,\n  KPIValue,\n} from '@/registry/components/dashboardblocks/kpi'\nimport {\n  statusToneClasses,\n  type StatusTone,\n} from '@/registry/components/dashboardblocks/status-label'\nimport type { ComponentProps, ReactNode } from 'react'\n\nimport { cn } from '@/lib/utils'\n\nfunction RecordLayout({\n  aside,\n  children,\n  className,\n}: {\n  aside: ReactNode\n  children: ReactNode\n  className?: string\n}) {\n  return (\n    <div className={cn('@container/record', className)}>\n      <div className='grid gap-8 @4xl/record:grid-cols-[minmax(0,1fr)_18rem] @4xl/record:gap-10'>\n        <div className='flex min-w-0 flex-col gap-8'>{children}</div>\n        <aside className='flex min-w-0 flex-col gap-8'>{aside}</aside>\n      </div>\n    </div>\n  )\n}\n\ninterface RecordSectionProps extends Omit<ComponentProps<'section'>, 'title'> {\n  /** Buttons on the right of the title. */\n  action?: ReactNode\n  description?: ReactNode\n  title: string\n}\n\nfunction RecordSection({\n  action,\n  children,\n  className,\n  description,\n  title,\n  ...props\n}: RecordSectionProps) {\n  return (\n    <section\n      data-slot='record-section'\n      className={cn('flex flex-col gap-3 border-t pt-4', className)}\n      {...props}\n    >\n      <header className='flex items-start justify-between gap-3'>\n        <div className='flex min-w-0 flex-col gap-0.5'>\n          <h2 className='font-semibold tracking-tight'>{title}</h2>\n          {description && <p className='text-muted-foreground text-sm'>{description}</p>}\n        </div>\n        {action}\n      </header>\n      {children}\n    </section>\n  )\n}\n\ninterface RecordHeadlineProps {\n  /** Lines under the number, such as a `KPIChange` or a muted sentence. */\n  children?: ReactNode\n  className?: string\n  format?: KPIFormat | KPIFormatter\n  label: string\n  /** `secondary` for a figure beside the headline, a step smaller. @default 'headline' */\n  size?: 'headline' | 'secondary'\n  /** Draws the number in a status colour, such as `warning` for a figure that needs a look now. */\n  tone?: StatusTone\n  /** Words after the number, such as `a month`. */\n  unit?: string\n  value: number\n}\n\nfunction RecordHeadline({\n  children,\n  className,\n  format,\n  label,\n  size = 'headline',\n  tone,\n  unit,\n  value,\n}: RecordHeadlineProps) {\n  const state = useBlockState()\n  return (\n    <div data-slot='record-headline' className={cn('flex flex-col gap-1', className)}>\n      <KPITitle>{label}</KPITitle>\n      <div className='flex flex-wrap items-baseline'>\n        <KPIValue\n          animated\n          className={cn(\n            size === 'secondary' && 'text-2xl',\n            tone && tone !== 'neutral' && statusToneClasses[tone],\n          )}\n          format={format}\n          value={value}\n        />\n        {unit && !state && (\n          <span className='text-muted-foreground ml-1 text-base'>{unit}</span>\n        )}\n      </div>\n      {children}\n    </div>\n  )\n}\n\nfunction PropertyList({\n  children,\n  className,\n}: {\n  children: ReactNode\n  className?: string\n}) {\n  return <dl className={cn('grid gap-3 text-sm', className)}>{children}</dl>\n}\n\nfunction Property({\n  children,\n  className,\n  label,\n}: {\n  children: ReactNode\n  className?: string\n  label: ReactNode\n}) {\n  return (\n    <div\n      className={cn('grid grid-cols-[7rem_minmax(0,1fr)] items-start gap-3', className)}\n    >\n      <dt className='text-muted-foreground'>{label}</dt>\n      <dd className='min-w-0 break-words'>{children}</dd>\n    </div>\n  )\n}\n\ninterface RecordPlaceholderProps {\n  /** Titles of the sections sketched in the side column while loading. */\n  aside?: string[]\n  /** Titles of the sections sketched in the main column while loading. */\n  sections: string[]\n}\n\nfunction RecordPlaceholder({ aside = [], sections }: RecordPlaceholderProps) {\n  const state = useBlockState()\n  if (state !== 'loading') return null\n\n  return (\n    <RecordLayout\n      aside={aside.map((title) => (\n        <RecordSection key={title} title={title}>\n          <BlockStateRows rows={3} />\n        </RecordSection>\n      ))}\n    >\n      {sections.map((title) => (\n        <RecordSection key={title} title={title}>\n          <BlockStateRows rows={4} />\n        </RecordSection>\n      ))}\n    </RecordLayout>\n  )\n}\n\nexport {\n  Property,\n  PropertyList,\n  RecordHeadline,\n  RecordLayout,\n  RecordPlaceholder,\n  RecordSection,\n}\n\nexport type { RecordHeadlineProps, RecordPlaceholderProps, RecordSectionProps }\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/record-detail.tsx"
    }
  ],
  "type": "registry:component"
}
