{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "timeline-03",
  "title": "Timeline with dates",
  "description": "A date above each title and description, and each step says whether it is done, in progress or to come.",
  "dependencies": [
    "date-fns"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/timeline.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/components/timeline/timeline-03.tsx",
      "content": "import {\n  Timeline,\n  TimelineContent,\n  TimelineDate,\n  TimelineHeader,\n  TimelineIndicator,\n  TimelineItem,\n  TimelineSeparator,\n  TimelineTitle,\n} from '@/registry/ndeko/ui/timeline';\n\nimport { dayLabelOf } from './_parts/dates';\nimport { currentStepOf, stepStateOf, StepStateNote } from './_parts/step-state';\n\ntype ClaimStep = {\n  day: string;\n  title: string;\n  detail: string;\n};\n\nconst CLAIM: ClaimStep[] = [\n  {\n    day: '2026-10-28',\n    title: 'Claim opened',\n    detail:\n      'Pinecrest reported two crushed cartons on delivery CF-48213 and sent six photos.',\n  },\n  {\n    day: '2026-10-30',\n    title: 'Carrier statement',\n    detail:\n      'The driver and the depot scan both show the pallet leaving Leeds intact.',\n  },\n  {\n    day: '2026-11-04',\n    title: 'Damage assessed',\n    detail:\n      'An assessor valued the loss at 412.60 EUR, inside the cover of the shipment.',\n  },\n  {\n    day: '2026-11-13',\n    title: 'Payout',\n    detail:\n      'The amount is paid to the account on file once Pinecrest signs the settlement.',\n  },\n];\n\nconst DONE_COUNT = 3;\n\nexport default function Timeline03() {\n  return (\n    <Timeline\n      defaultValue={DONE_COUNT}\n      role='list'\n      aria-label='Calder Freight claim CF-48213'\n    >\n      {CLAIM.map((claimStep, index) => {\n        const step = index + 1;\n        const state = stepStateOf(step, DONE_COUNT);\n\n        return (\n          <TimelineItem\n            key={claimStep.day}\n            step={step}\n            role='listitem'\n            aria-current={currentStepOf(state)}\n          >\n            <TimelineHeader>\n              <TimelineIndicator />\n              <TimelineSeparator />\n              <TimelineDate dateTime={claimStep.day}>\n                {dayLabelOf(claimStep.day)}\n              </TimelineDate>\n              <TimelineTitle>\n                {claimStep.title}\n                <StepStateNote state={state} />\n              </TimelineTitle>\n            </TimelineHeader>\n            <TimelineContent>{claimStep.detail}</TimelineContent>\n          </TimelineItem>\n        );\n      })}\n    </Timeline>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/timeline/timeline-03.tsx"
    },
    {
      "path": "registry/ndeko/components/timeline/_parts/dates.ts",
      "content": "import { differenceInMinutes, format, parseISO } from 'date-fns';\n\n/* Every time is read against one fixed moment and written without a time zone, so the server and the browser print the same labels. */\nconst NOW = '2026-11-12T15:00:00';\n\nconst MINUTES_PER_HOUR = 60;\n\nconst MINUTES_PER_DAY = 1440;\n\nexport function dayLabelOf(isoDay: string) {\n  const day = parseISO(isoDay);\n  return format(day, 'MMM d, yyyy');\n}\n\nexport function stampLabelOf(isoTime: string) {\n  const time = parseISO(isoTime);\n  return format(time, \"MMMM d, yyyy 'at' HH:mm\");\n}\n\nfunction agoOf(count: number, unit: string) {\n  if (count === 1) {\n    return `1 ${unit} ago`;\n  }\n  return `${count} ${unit}s ago`;\n}\n\nexport function agoLabelOf(isoTime: string) {\n  const now = parseISO(NOW);\n  const time = parseISO(isoTime);\n  const minutes = differenceInMinutes(now, time);\n  if (minutes < 1) {\n    return 'Just now';\n  }\n  if (minutes < MINUTES_PER_HOUR) {\n    return agoOf(minutes, 'minute');\n  }\n  if (minutes < MINUTES_PER_DAY) {\n    const hours = Math.floor(minutes / MINUTES_PER_HOUR);\n    return agoOf(hours, 'hour');\n  }\n  const days = Math.floor(minutes / MINUTES_PER_DAY);\n  return agoOf(days, 'day');\n}\n",
      "type": "registry:component",
      "target": "components/timeline/_parts/dates.ts"
    },
    {
      "path": "registry/ndeko/components/timeline/_parts/step-state.tsx",
      "content": "type StepState = 'done' | 'current' | 'ahead';\n\nconst STATE_WORD: Record<StepState, string> = {\n  done: 'done',\n  current: 'in progress',\n  ahead: 'to come',\n};\n\nexport function stepStateOf(step: number, doneCount: number): StepState {\n  if (step <= doneCount) {\n    return 'done';\n  }\n  if (step === doneCount + 1) {\n    return 'current';\n  }\n  return 'ahead';\n}\n\nexport function currentStepOf(state: StepState) {\n  if (state === 'current') {\n    return 'step' as const;\n  }\n  return undefined;\n}\n\ntype StepStateNoteProps = {\n  state: StepState;\n};\n\n/* The colour of the marker says where a step stands: this says it in words for a screen reader. */\nexport function StepStateNote({ state }: StepStateNoteProps) {\n  return <span className='sr-only'>, {STATE_WORD[state]}</span>;\n}\n",
      "type": "registry:component",
      "target": "components/timeline/_parts/step-state.tsx"
    }
  ],
  "categories": [
    "components",
    "timeline"
  ],
  "type": "registry:component"
}