{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "timeline-02",
  "title": "Dates on the side",
  "description": "Dates sit above each title and move to a column on the left when the piece is wide enough.",
  "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-02.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 Milestone = {\n  day: string;\n  title: string;\n  note: string;\n};\n\nconst RELEASE: Milestone[] = [\n  {\n    day: '2026-10-06',\n    title: 'Feature freeze',\n    note: 'The last changes land on the release branch. From here only fixes go in.',\n  },\n  {\n    day: '2026-10-20',\n    title: 'Beta with design partners',\n    note: 'A handful of teams run the beta on their own projects and report what breaks.',\n  },\n  {\n    day: '2026-11-03',\n    title: 'Release candidate',\n    note: 'Docs, changelog and migration notes are frozen with the build.',\n  },\n  {\n    day: '2026-11-17',\n    title: 'General availability',\n    note: 'The release reaches every workspace over two days, then the old runner is retired.',\n  },\n];\n\nconst DONE_COUNT = 3;\n\n/* From 448px of its own width the piece gives the dates a column: each row moves over and its date hangs to the left of the rail. */\nconst ROW_BESIDE_ITS_DATE =\n  '@md:group-data-[orientation=vertical]/timeline:ms-36';\n\nconst DATE_IN_THE_COLUMN =\n  '@md:absolute @md:end-full @md:me-12 @md:mb-0 @md:w-24 @md:text-end';\n\nexport default function Timeline02() {\n  return (\n    <Timeline\n      defaultValue={DONE_COUNT}\n      role='list'\n      aria-label='Wrenfield autumn release'\n      className='@container w-full'\n    >\n      {RELEASE.map((milestone, index) => {\n        const step = index + 1;\n        const state = stepStateOf(step, DONE_COUNT);\n\n        return (\n          <TimelineItem\n            key={milestone.day}\n            step={step}\n            role='listitem'\n            aria-current={currentStepOf(state)}\n            className={ROW_BESIDE_ITS_DATE}\n          >\n            <TimelineHeader>\n              <TimelineIndicator />\n              <TimelineSeparator />\n              <TimelineDate\n                dateTime={milestone.day}\n                className={DATE_IN_THE_COLUMN}\n              >\n                {dayLabelOf(milestone.day)}\n              </TimelineDate>\n              <TimelineTitle className='@md:-mt-0.5'>\n                {milestone.title}\n                <StepStateNote state={state} />\n              </TimelineTitle>\n            </TimelineHeader>\n            <TimelineContent>{milestone.note}</TimelineContent>\n          </TimelineItem>\n        );\n      })}\n    </Timeline>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/timeline/timeline-02.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"
}