{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "page-headers-01",
  "title": "Page header that condenses",
  "description": "A project header with breadcrumbs, a status, people, progress and tabs whose indicator travels, where Watch, Share and Edit fold into More as the width shrinks: scroll the page under it and the header condenses into a slim bar that keeps the title, the status, Edit and the progress as its lower edge.",
  "dependencies": [],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/avatar.json",
    "https://ui.ndekocode.dev/r/breadcrumb.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/chat-motion.json",
    "https://ui.ndekocode.dev/r/chip.json",
    "https://ui.ndekocode.dev/r/company-mark.json",
    "https://ui.ndekocode.dev/r/demonstration.json",
    "https://ui.ndekocode.dev/r/dropdown-menu.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/input.json",
    "https://ui.ndekocode.dev/r/live-duration.json",
    "https://ui.ndekocode.dev/r/live-region.json",
    "https://ui.ndekocode.dev/r/motion-word-roll.json",
    "https://ui.ndekocode.dev/r/replay-button.json",
    "https://ui.ndekocode.dev/r/tabs.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/use-session.json",
    "https://ui.ndekocode.dev/r/use-timeouts.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/page-headers/page-headers-01/index.tsx",
      "content": "'use client';\n\nimport { useEffect, useRef, useState } from 'react';\n\nimport { WordRoll } from '@/components/core/word-roll';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { useSession } from '@/registry/ndeko/hooks/use-session';\nimport { useTimeouts } from '@/registry/ndeko/hooks/use-timeouts';\nimport {\n  pressedQuietOf,\n  spokenUnless,\n} from '@/registry/ndeko/lib/demonstration';\nimport { CalendarIcon, ListChecksIcon } from '@/registry/ndeko/lib/icons';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\nimport {\n  Breadcrumb,\n  BreadcrumbItem,\n  BreadcrumbLink,\n  BreadcrumbList,\n  BreadcrumbPage,\n  BreadcrumbSeparator,\n} from '@/registry/ndeko/ui/breadcrumb';\nimport { Chip } from '@/registry/ndeko/ui/chip';\nimport { CompanyMark } from '@/registry/ndeko/ui/company-mark';\nimport { ClockGate } from '@/registry/ndeko/ui/live-duration';\nimport { LiveRegion } from '@/registry/ndeko/ui/live-region';\nimport { ReplayButton } from '@/registry/ndeko/ui/replay-button';\nimport { Tabs, TabsList, TabsPanel, TabsTab } from '@/registry/ndeko/ui/tabs';\n\nimport { CondensedBar } from './condensed-bar';\nimport { MEMBERS, PROJECT, TABS, WORKSPACE, type TabId } from './data';\nimport { HeaderActions } from './header-actions';\nimport { ActivityPanel, FilesPanel, OverviewPanel, TasksPanel } from './panels';\nimport { INITIAL, LOOP_AFTER_MS, reducer, RESTING, SCRIPT } from './session';\nimport { TitleEditor } from './title-editor';\n\nconst SESSION = {\n  reducer,\n  initial: INITIAL,\n  resting: RESTING,\n  script: SCRIPT,\n  loopAfter: LOOP_AFTER_MS,\n};\n\n/** The height of the bar: the title counts as gone once it has passed under it. */\nconst BAR_HEIGHT_PX = 48;\n\nconst COPIED_FOR_MS = 1600;\n\nconst PROJECT_LINK = 'https://morrow.example/projects/harbour-street';\n\nconst SHOWN_MEMBERS = 4;\n\nconst STATUS_LABELS = [PROJECT.status, 'Archived'];\n\nconst PANELS: Record<TabId, React.ReactNode> = {\n  overview: <OverviewPanel />,\n  tasks: <TasksPanel />,\n  files: <FilesPanel />,\n  activity: <ActivityPanel />,\n};\n\nfunction tabOf(value: unknown) {\n  const tab = TABS.find((candidate) => candidate.id === value);\n  return tab?.id;\n}\n\nfunction statusLabelOf(isArchived: boolean) {\n  if (isArchived) {\n    return 'Archived';\n  }\n  return PROJECT.status;\n}\n\nfunction statusColorOf(isArchived: boolean) {\n  if (isArchived) {\n    return 'var(--muted-foreground)';\n  }\n  return 'var(--success)';\n}\n\nfunction watchLineOf(isWatching: boolean) {\n  if (isWatching) {\n    return 'You are watching this project';\n  }\n  return 'You stopped watching this project';\n}\n\nfunction scrollBehaviorOf(shouldReduceMotion: boolean): ScrollBehavior {\n  if (shouldReduceMotion) {\n    return 'auto';\n  }\n  return 'smooth';\n}\n\nfunction archiveLineOf(isArchived: boolean) {\n  if (isArchived) {\n    return 'Project archived';\n  }\n  return 'Project restored';\n}\n\nexport default function PageHeaders01() {\n  const {\n    ref,\n    isInView,\n    isAutoplaying,\n    state,\n    act,\n    pressed,\n    isFinished,\n    restart,\n    takeOver,\n  } = useSession(SESSION);\n  const { schedule } = useTimeouts();\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const frameRef = useRef<HTMLDivElement>(null);\n  const rowRef = useRef<HTMLDivElement>(null);\n  const [isCondensed, setIsCondensed] = useState(false);\n  const [title, setTitle] = useState(PROJECT.title);\n  const [isEditing, setIsEditing] = useState(false);\n  const [isWatching, setIsWatching] = useState(false);\n  const [isLinkCopied, setIsLinkCopied] = useState(false);\n  const [isArchived, setIsArchived] = useState(false);\n  const [spoken, setSpoken] = useState('');\n  const progress = PROJECT.tasksDone / PROJECT.tasksTotal;\n  const percent = Math.round(progress * 100);\n  const progressStyle = { transform: `scaleX(${progress})` };\n  const statusLabel = statusLabelOf(isArchived);\n  const statusColor = statusColorOf(isArchived);\n  const otherMembers = MEMBERS.length - SHOWN_MEMBERS;\n  const shownMembers = MEMBERS.slice(0, SHOWN_MEMBERS);\n  const message = spokenUnless(isAutoplaying, spoken);\n  const canReplay = isFinished && !isAutoplaying;\n\n  useEffect(() => {\n    if (state.scrollRequest === 0) {\n      return;\n    }\n    frameRef.current?.scrollTo({ top: state.scrollTop, behavior: 'smooth' });\n  }, [state.scrollRequest, state.scrollTop]);\n\n  useEffect(() => {\n    const frame = frameRef.current;\n    const row = rowRef.current;\n    if (!frame || !row) {\n      return;\n    }\n    const observer = new IntersectionObserver(\n      (entries) => {\n        const entry = entries.at(-1);\n        if (!entry) {\n          return;\n        }\n        const rootTop = entry.rootBounds?.top ?? 0;\n        const isAbove = entry.boundingClientRect.top < rootTop;\n        setIsCondensed(!entry.isIntersecting && isAbove);\n      },\n      {\n        root: frame,\n        rootMargin: `-${BAR_HEIGHT_PX}px 0px 0px 0px`,\n        threshold: 0,\n      }\n    );\n    observer.observe(row);\n    return () => observer.disconnect();\n  }, []);\n\n  function focusLater(selector: string) {\n    requestAnimationFrame(() => {\n      const target = ref.current?.querySelector<HTMLElement>(selector);\n      target?.focus();\n    });\n  }\n\n  /** A wheel or a trackpad scrolling the frame is a person reading: the demonstration stops for good. */\n  function yieldToWheel() {\n    if (isAutoplaying) {\n      takeOver();\n    }\n  }\n\n  function pickTab(value: unknown) {\n    const tab = tabOf(value);\n    if (tab) {\n      act({ type: 'tabPicked', tab });\n    }\n  }\n\n  function startEditing() {\n    const behavior = scrollBehaviorOf(shouldReduceMotion);\n    frameRef.current?.scrollTo({ top: 0, behavior });\n    setIsEditing(true);\n  }\n\n  function leaveEditing() {\n    setIsEditing(false);\n    focusLater('[data-action=\"edit\"], [data-action=\"more\"]');\n  }\n\n  function saveTitle(next: string) {\n    setTitle(next);\n    setSpoken(`Project renamed to ${next}`);\n    leaveEditing();\n  }\n\n  async function share() {\n    try {\n      await navigator.clipboard.writeText(PROJECT_LINK);\n    } catch {\n      setSpoken('The link could not be copied');\n      return;\n    }\n    setIsLinkCopied(true);\n    setSpoken('Link to the project copied');\n    schedule(() => setIsLinkCopied(false), COPIED_FOR_MS);\n  }\n\n  function toggleWatching() {\n    const next = !isWatching;\n    setIsWatching(next);\n    const line = watchLineOf(next);\n    setSpoken(line);\n  }\n\n  function toggleArchived() {\n    const next = !isArchived;\n    setIsArchived(next);\n    const line = archiveLineOf(next);\n    setSpoken(line);\n  }\n\n  function replay() {\n    frameRef.current?.scrollTo({ top: 0 });\n    restart();\n  }\n\n  return (\n    <ClockGate isActive={isInView}>\n      <div\n        ref={ref}\n        className='bg-background text-foreground @container relative flex h-dvh min-h-[36rem] w-full flex-col overflow-hidden'\n      >\n        <div\n          ref={frameRef}\n          onWheel={yieldToWheel}\n          className='relative min-h-0 flex-1 overflow-y-auto overscroll-contain'\n        >\n          <div className='sticky top-0 z-20 h-0'>\n            <CondensedBar\n              isShown={isCondensed}\n              title={title}\n              statusLabel={statusLabel}\n              statusColor={statusColor}\n              progress={progress}\n              onEdit={startEditing}\n            />\n          </div>\n\n          <div className='mx-auto flex max-w-5xl flex-col gap-6 px-4 pt-5 pb-16 @2xl:px-8 @2xl:pt-8'>\n            <header className='flex flex-col gap-4'>\n              <div className='flex min-h-7 items-center gap-3'>\n                <Breadcrumb className='min-w-0 flex-1'>\n                  <BreadcrumbList>\n                    <BreadcrumbItem>\n                      <BreadcrumbLink\n                        href={WORKSPACE.href}\n                        className='flex items-center gap-1.5'\n                      >\n                        <CompanyMark seed={WORKSPACE.name} size='sm' />\n                        {WORKSPACE.name}\n                      </BreadcrumbLink>\n                    </BreadcrumbItem>\n                    <BreadcrumbSeparator />\n                    <BreadcrumbItem>\n                      <BreadcrumbLink href={WORKSPACE.projectsHref}>\n                        Projects\n                      </BreadcrumbLink>\n                    </BreadcrumbItem>\n                    <BreadcrumbSeparator />\n                    <BreadcrumbItem className='min-w-0'>\n                      <BreadcrumbPage className='truncate'>\n                        {title}\n                      </BreadcrumbPage>\n                    </BreadcrumbItem>\n                  </BreadcrumbList>\n                </Breadcrumb>\n                <ReplayButton\n                  isShown={canReplay}\n                  onReplay={replay}\n                  label='Replay'\n                />\n              </div>\n\n              <div ref={rowRef} className='relative flex items-start gap-3'>\n                {isEditing && (\n                  <TitleEditor\n                    title={title}\n                    onSave={saveTitle}\n                    onCancel={leaveEditing}\n                  />\n                )}\n                {!isEditing && (\n                  <div className='flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-2'>\n                    <h1 className='text-2xl font-semibold text-balance @sm:text-3xl'>\n                      {title}\n                    </h1>\n                    <Chip color={statusColor}>\n                      <WordRoll text={statusLabel} labels={STATUS_LABELS} />\n                    </Chip>\n                  </div>\n                )}\n                {!isEditing && (\n                  <HeaderActions\n                    rowRef={rowRef}\n                    isWatching={isWatching}\n                    isLinkCopied={isLinkCopied}\n                    isArchived={isArchived}\n                    onEdit={startEditing}\n                    onShare={share}\n                    onWatch={toggleWatching}\n                    onArchive={toggleArchived}\n                  />\n                )}\n              </div>\n\n              <ul className='text-muted-foreground flex flex-wrap items-center gap-x-5 gap-y-2 text-[13px]'>\n                <li className='flex items-center gap-2'>\n                  <Avatar seed={PROJECT.lead} className='size-5' />\n                  <span>\n                    <span className='text-foreground'>{PROJECT.lead}</span>{' '}\n                    leads\n                  </span>\n                </li>\n                <li className='flex items-center gap-1.5'>\n                  <CalendarIcon className='size-4' />\n                  {PROJECT.due}\n                </li>\n                <li className='flex items-center gap-1.5 tabular-nums'>\n                  <ListChecksIcon className='size-4' />\n                  {PROJECT.tasksDone} of {PROJECT.tasksTotal} tasks done\n                </li>\n                <li className='flex items-center gap-2'>\n                  <span className='flex -space-x-1.5' aria-hidden='true'>\n                    {shownMembers.map((member) => (\n                      <Avatar\n                        key={member.name}\n                        seed={member.name}\n                        className='ring-background size-5 ring-2'\n                      />\n                    ))}\n                  </span>\n                  <span className='tabular-nums'>\n                    {MEMBERS.length} members\n                    <span className='sr-only'>, {otherMembers} not shown</span>\n                  </span>\n                </li>\n              </ul>\n\n              <div className='flex items-center gap-3'>\n                <div\n                  role='progressbar'\n                  aria-label='Tasks done'\n                  aria-valuemin={0}\n                  aria-valuemax={PROJECT.tasksTotal}\n                  aria-valuenow={PROJECT.tasksDone}\n                  className='bg-foreground/10 h-1.5 flex-1 overflow-hidden rounded-full'\n                >\n                  <div\n                    style={progressStyle}\n                    className='bg-primary h-full w-full origin-left rounded-full'\n                  />\n                </div>\n                <span className='text-muted-foreground w-9 text-end text-xs tabular-nums'>\n                  {percent}%\n                </span>\n              </div>\n            </header>\n\n            <Tabs value={state.tab} onValueChange={pickTab} className='gap-6'>\n              <div className='relative -mx-4 overflow-x-auto px-4 @2xl:mx-0 @2xl:px-0'>\n                <TabsList>\n                  {TABS.map((tab) => (\n                    <TabsTab\n                      key={tab.id}\n                      value={tab.id}\n                      className={pressedQuietOf(pressed === `tab-${tab.id}`)}\n                    >\n                      {tab.label}\n                      {tab.count !== undefined && (\n                        <span className='text-muted-foreground text-xs tabular-nums'>\n                          {tab.count}\n                        </span>\n                      )}\n                    </TabsTab>\n                  ))}\n                </TabsList>\n              </div>\n              {TABS.map((tab) => (\n                <TabsPanel key={tab.id} value={tab.id}>\n                  {PANELS[tab.id]}\n                </TabsPanel>\n              ))}\n            </Tabs>\n          </div>\n        </div>\n        <LiveRegion message={message} />\n      </div>\n    </ClockGate>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/page-headers-01/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/page-headers/page-headers-01/condensed-bar.tsx",
      "content": "import { PencilIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Chip } from '@/registry/ndeko/ui/chip';\n\nconst SHOWN = 'translate-y-0 opacity-100';\n\nconst HIDDEN = '-translate-y-full opacity-0';\n\nfunction placeOf(isShown: boolean) {\n  if (isShown) {\n    return SHOWN;\n  }\n  return HIDDEN;\n}\n\nfunction hiddenOf(isShown: boolean) {\n  if (isShown) {\n    return undefined;\n  }\n  return true;\n}\n\ntype CondensedBarProps = {\n  isShown: boolean;\n  title: string;\n  statusLabel: string;\n  statusColor: string;\n  progress: number;\n  onEdit: () => void;\n};\n\nexport function CondensedBar({\n  isShown,\n  title,\n  statusLabel,\n  statusColor,\n  progress,\n  onEdit,\n}: CondensedBarProps) {\n  const progressStyle = { transform: `scaleX(${progress})` };\n\n  return (\n    <div\n      inert={!isShown}\n      aria-hidden={hiddenOf(isShown)}\n      className={cn(\n        'bg-background hairline-b border-border absolute inset-x-0 top-0 transition-[translate,opacity] duration-200 ease-(--ease-out-strong)',\n        placeOf(isShown)\n      )}\n    >\n      <div className='mx-auto flex h-12 max-w-5xl items-center gap-3 px-4 @2xl:px-8'>\n        <p className='min-w-0 truncate text-sm font-semibold'>{title}</p>\n        <Chip color={statusColor}>{statusLabel}</Chip>\n        <span className='flex-1' />\n        <Button type='button' size='sm' onClick={onEdit}>\n          <PencilIcon />\n          Edit\n        </Button>\n      </div>\n      <span\n        aria-hidden='true'\n        style={progressStyle}\n        className='bg-primary absolute inset-x-0 bottom-0 h-0.5 origin-left'\n      />\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/page-headers-01/condensed-bar.tsx"
    },
    {
      "path": "registry/ndeko/blocks/page-headers/page-headers-01/header-actions.tsx",
      "content": "'use client';\n\nimport { useLayoutEffect, useRef, useState, type RefObject } from 'react';\n\nimport {\n  ArchiveIcon,\n  ArchiveRestoreIcon,\n  CheckIcon,\n  EllipsisIcon,\n  EyeIcon,\n  PencilIcon,\n  Share2Icon,\n} from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Swap } from '@/registry/ndeko/ui/chat-motion';\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuSeparator,\n  DropdownMenuTrigger,\n} from '@/registry/ndeko/ui/dropdown-menu';\n\ntype ActionId = 'edit' | 'share' | 'watch';\n\n/** Edit stays in the row the longest, Watch folds first. */\nconst BY_PRIORITY: ActionId[] = ['edit', 'share', 'watch'];\n\n/** In the row the primary action sits at the end, next to More. */\nconst ROW_ORDER: ActionId[] = ['watch', 'share', 'edit'];\n\n/** The title keeps at least this much of the row before an action gives way. */\nconst TITLE_MIN_PX = 160;\n\nconst ROW_GAP_PX = 12;\n\nconst ACTION_GAP_PX = 8;\n\nfunction widthOf(measure: HTMLElement, key: string) {\n  const element = measure.querySelector<HTMLElement>(`[data-measure=\"${key}\"]`);\n  return element?.offsetWidth ?? 0;\n}\n\nfunction countThatFits(measure: HTMLElement, budget: number) {\n  let used = widthOf(measure, 'more');\n  let count = 0;\n  for (const id of BY_PRIORITY) {\n    const next = used + ACTION_GAP_PX + widthOf(measure, id);\n    if (next > budget) {\n      break;\n    }\n    used = next;\n    count += 1;\n  }\n  return count;\n}\n\nfunction watchLabelOf(isWatching: boolean) {\n  if (isWatching) {\n    return 'Watching';\n  }\n  return 'Watch';\n}\n\nexport type HeaderActionsProps = {\n  /** The row the title shares with the actions: its width decides how many actions stay out. */\n  rowRef: RefObject<HTMLDivElement | null>;\n  isWatching: boolean;\n  isLinkCopied: boolean;\n  isArchived: boolean;\n  onEdit: () => void;\n  onShare: () => void;\n  onWatch: () => void;\n  onArchive: () => void;\n};\n\nexport function HeaderActions({\n  rowRef,\n  isWatching,\n  isLinkCopied,\n  isArchived,\n  onEdit,\n  onShare,\n  onWatch,\n  onArchive,\n}: HeaderActionsProps) {\n  const measureRef = useRef<HTMLDivElement>(null);\n  const [visibleCount, setVisibleCount] = useState(BY_PRIORITY.length);\n  const [isMeasured, setIsMeasured] = useState(false);\n  const shown = BY_PRIORITY.slice(0, visibleCount);\n  const folded = BY_PRIORITY.slice(visibleCount);\n  const inRow = ROW_ORDER.filter((id) => shown.includes(id));\n  const watchLabel = watchLabelOf(isWatching);\n\n  useLayoutEffect(() => {\n    const row = rowRef.current;\n    const measure = measureRef.current;\n    if (!row || !measure) {\n      return;\n    }\n    function fit() {\n      if (!row || !measure) {\n        return;\n      }\n      const budget = row.clientWidth - TITLE_MIN_PX - ROW_GAP_PX;\n      const count = countThatFits(measure, budget);\n      setVisibleCount(count);\n      setIsMeasured(true);\n    }\n    const observer = new ResizeObserver(fit);\n    observer.observe(row);\n    observer.observe(measure);\n    return () => observer.disconnect();\n  }, [rowRef]);\n\n  const glyphs: Record<ActionId, React.ReactNode> = {\n    edit: <PencilIcon />,\n    share: (\n      <Swap swapKey={String(isLinkCopied)}>\n        {isLinkCopied && <CheckIcon />}\n        {!isLinkCopied && <Share2Icon />}\n      </Swap>\n    ),\n    watch: (\n      <Swap swapKey={String(isWatching)}>\n        {isWatching && <CheckIcon />}\n        {!isWatching && <EyeIcon />}\n      </Swap>\n    ),\n  };\n\n  const labels: Record<ActionId, string> = {\n    edit: 'Edit',\n    share: 'Share',\n    watch: watchLabel,\n  };\n\n  const handlers: Record<ActionId, () => void> = {\n    edit: onEdit,\n    share: onShare,\n    watch: onWatch,\n  };\n\n  return (\n    <>\n      <div\n        className={cn(\n          'flex shrink-0 items-center gap-2 transition-opacity duration-150',\n          !isMeasured && 'opacity-0'\n        )}\n      >\n        {inRow.map((id) => {\n          const isPrimary = id === 'edit';\n          let variant: 'default' | 'outline' = 'outline';\n          if (isPrimary) {\n            variant = 'default';\n          }\n          return (\n            <Button\n              key={id}\n              type='button'\n              variant={variant}\n              data-action={id}\n              onClick={handlers[id]}\n            >\n              {glyphs[id]}\n              {labels[id]}\n            </Button>\n          );\n        })}\n        <DropdownMenu>\n          <DropdownMenuTrigger\n            render={\n              <Button\n                type='button'\n                variant='outline'\n                size='icon'\n                data-action='more'\n                aria-label='More actions'\n              />\n            }\n          >\n            <EllipsisIcon />\n          </DropdownMenuTrigger>\n          <DropdownMenuContent align='end' className='min-w-48'>\n            {folded.map((id) => (\n              <DropdownMenuItem key={id} onClick={handlers[id]}>\n                {glyphs[id]}\n                {labels[id]}\n              </DropdownMenuItem>\n            ))}\n            {folded.length > 0 && <DropdownMenuSeparator />}\n            {!isArchived && (\n              <DropdownMenuItem variant='destructive' onClick={onArchive}>\n                <ArchiveIcon />\n                Archive project\n              </DropdownMenuItem>\n            )}\n            {isArchived && (\n              <DropdownMenuItem onClick={onArchive}>\n                <ArchiveRestoreIcon />\n                Restore project\n              </DropdownMenuItem>\n            )}\n          </DropdownMenuContent>\n        </DropdownMenu>\n      </div>\n      <div\n        aria-hidden='true'\n        className='pointer-events-none absolute top-0 left-0 h-0 w-0 overflow-hidden'\n      >\n        <div ref={measureRef} inert className='invisible flex w-max gap-2'>\n          <Button type='button' tabIndex={-1} data-measure='edit'>\n            <PencilIcon />\n            Edit\n          </Button>\n          <Button\n            type='button'\n            variant='outline'\n            tabIndex={-1}\n            data-measure='share'\n          >\n            <Share2Icon />\n            Share\n          </Button>\n          <Button\n            type='button'\n            variant='outline'\n            tabIndex={-1}\n            data-measure='watch'\n          >\n            <EyeIcon />\n            Watching\n          </Button>\n          <Button\n            type='button'\n            variant='outline'\n            size='icon'\n            tabIndex={-1}\n            data-measure='more'\n            aria-label='More actions'\n          >\n            <EllipsisIcon />\n          </Button>\n        </div>\n      </div>\n    </>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/page-headers-01/header-actions.tsx"
    },
    {
      "path": "registry/ndeko/blocks/page-headers/page-headers-01/title-editor.tsx",
      "content": "'use client';\n\nimport { useEffect, useId, useRef, useState } from 'react';\n\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Input } from '@/registry/ndeko/ui/input';\n\ntype TitleEditorProps = {\n  title: string;\n  onSave: (title: string) => void;\n  onCancel: () => void;\n};\n\nexport function TitleEditor({ title, onSave, onCancel }: TitleEditorProps) {\n  const [draft, setDraft] = useState(title);\n  const inputRef = useRef<HTMLInputElement>(null);\n  const fieldId = useId();\n  const trimmed = draft.trim();\n  const canSave = trimmed !== '';\n\n  useEffect(() => {\n    const input = inputRef.current;\n    input?.focus({ preventScroll: true });\n    input?.select();\n  }, []);\n\n  function save(event: React.FormEvent<HTMLFormElement>) {\n    event.preventDefault();\n    if (!canSave) {\n      return;\n    }\n    onSave(trimmed);\n  }\n\n  function cancelOnEscape(event: React.KeyboardEvent<HTMLInputElement>) {\n    if (event.key !== 'Escape') {\n      return;\n    }\n    event.preventDefault();\n    onCancel();\n  }\n\n  return (\n    <form\n      onSubmit={save}\n      className='flex min-w-0 flex-1 flex-wrap items-center gap-2 transition-opacity duration-150 starting:opacity-0'\n    >\n      <label htmlFor={fieldId} className='sr-only'>\n        Project name\n      </label>\n      <Input\n        ref={inputRef}\n        id={fieldId}\n        size='lg'\n        autoComplete='off'\n        value={draft}\n        onChange={(event) => setDraft(event.target.value)}\n        onKeyDown={cancelOnEscape}\n        className='min-w-[12rem] flex-1 font-semibold'\n      />\n      <div className='flex items-center gap-2'>\n        <Button type='submit' disabled={!canSave}>\n          Save\n        </Button>\n        <Button type='button' variant='ghost' onClick={onCancel}>\n          Cancel\n        </Button>\n      </div>\n    </form>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/page-headers-01/title-editor.tsx"
    },
    {
      "path": "registry/ndeko/blocks/page-headers/page-headers-01/panels.tsx",
      "content": "import {\n  CheckIcon,\n  CircleDashedIcon,\n  CircleIcon,\n  FileSpreadsheetIcon,\n  FileTextIcon,\n  LayersIcon,\n  LoaderCircleIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\nimport { Chip } from '@/registry/ndeko/ui/chip';\n\nimport {\n  ACTIVITY,\n  FILES,\n  MEMBERS,\n  MILESTONES,\n  PROJECT,\n  TASKS,\n  type ActivityItem,\n  type MilestoneState,\n  type ProjectFile,\n  type TaskState,\n} from './data';\n\nconst SECTION_TITLE = 'text-[13px] font-medium';\n\nconst SURFACE =\n  'bg-card hairline-ring ring-border dark:bg-foreground/[0.03] rounded-xl shadow-[0_1px_2px_rgb(0_0_0/0.04)]';\n\nconst MILESTONE_GLYPH: Record<MilestoneState, React.ReactNode> = {\n  done: <CheckIcon className='text-success-foreground size-3.5' />,\n  current: <span className='bg-primary size-2 rounded-full' />,\n  upcoming: <CircleDashedIcon className='text-muted-foreground size-3.5' />,\n};\n\nconst MILESTONE_TRAY: Record<MilestoneState, string> = {\n  done: 'bg-success/10',\n  current: 'bg-primary/10',\n  upcoming: 'bg-foreground/[0.05]',\n};\n\nconst TASK_LABEL: Record<TaskState, string> = {\n  todo: 'To do',\n  doing: 'In progress',\n  done: 'Done',\n};\n\nconst TASK_COLOR: Record<TaskState, string> = {\n  todo: 'var(--muted-foreground)',\n  doing: 'var(--info)',\n  done: 'var(--success)',\n};\n\nconst TASK_GLYPH: Record<TaskState, Icon> = {\n  todo: CircleIcon,\n  doing: LoaderCircleIcon,\n  done: CheckIcon,\n};\n\nconst FILE_GLYPH: Record<ProjectFile['kind'], Icon> = {\n  drawing: LayersIcon,\n  sheet: FileSpreadsheetIcon,\n  document: FileTextIcon,\n};\n\nfunction ActivityRow({ item }: { item: ActivityItem }) {\n  return (\n    <li className='flex items-start gap-3 px-3 py-2.5'>\n      <Avatar seed={item.person} className='size-6' />\n      <p className='min-w-0 flex-1 text-[13px] text-pretty'>\n        <span className='font-medium'>{item.person}</span>{' '}\n        <span className='text-muted-foreground'>{item.action}</span>{' '}\n        {item.target}\n      </p>\n      <span className='text-muted-foreground shrink-0 text-xs'>\n        {item.when}\n      </span>\n    </li>\n  );\n}\n\nexport function OverviewPanel() {\n  const recent = ACTIVITY.slice(0, 4);\n\n  return (\n    <div className='flex flex-col gap-8'>\n      <section className='flex flex-col gap-2'>\n        <h2 className={SECTION_TITLE}>About this project</h2>\n        <p className='text-muted-foreground max-w-2xl text-sm leading-relaxed text-pretty'>\n          {PROJECT.summary}\n        </p>\n      </section>\n\n      <section className='flex flex-col gap-2'>\n        <h2 className={SECTION_TITLE}>Milestones</h2>\n        <ol className={cn(SURFACE, 'flex flex-col p-1')}>\n          {MILESTONES.map((milestone) => (\n            <li\n              key={milestone.id}\n              className='flex items-center gap-3 rounded-lg px-3 py-2.5'\n            >\n              <span\n                className={cn(\n                  'flex size-6 shrink-0 items-center justify-center rounded-full',\n                  MILESTONE_TRAY[milestone.state]\n                )}\n              >\n                {MILESTONE_GLYPH[milestone.state]}\n              </span>\n              <span className='min-w-0 flex-1 truncate text-[13px] font-medium'>\n                {milestone.title}\n              </span>\n              <span className='text-muted-foreground shrink-0 text-xs tabular-nums'>\n                {milestone.date}\n              </span>\n            </li>\n          ))}\n        </ol>\n      </section>\n\n      <section className='flex flex-col gap-2'>\n        <h2 className={SECTION_TITLE}>Recent activity</h2>\n        <ul className={cn(SURFACE, 'flex flex-col p-1')}>\n          {recent.map((item) => (\n            <ActivityRow key={item.id} item={item} />\n          ))}\n        </ul>\n      </section>\n\n      <section className='flex flex-col gap-2'>\n        <h2 className={SECTION_TITLE}>Team</h2>\n        <ul className='grid gap-2 @md:grid-cols-2 @3xl:grid-cols-3'>\n          {MEMBERS.map((member) => (\n            <li\n              key={member.name}\n              className='bg-foreground/[0.025] flex items-center gap-2.5 rounded-xl px-3 py-2'\n            >\n              <Avatar seed={member.name} className='size-6' />\n              <span className='truncate text-[13px]'>{member.name}</span>\n            </li>\n          ))}\n        </ul>\n      </section>\n    </div>\n  );\n}\n\nexport function TasksPanel() {\n  return (\n    <section className='flex flex-col gap-2'>\n      <p className='text-muted-foreground text-xs tabular-nums'>\n        Showing {TASKS.length} of {PROJECT.tasksTotal} tasks, open ones first\n      </p>\n      <ul className={cn(SURFACE, 'flex flex-col p-1')}>\n        {TASKS.map((task) => {\n          const Glyph = TASK_GLYPH[task.state];\n          return (\n            <li\n              key={task.id}\n              className='flex items-center gap-3 rounded-lg px-3 py-2.5'\n            >\n              <Glyph className='text-muted-foreground size-4 shrink-0' />\n              <span className='min-w-0 flex-1 truncate text-[13px]'>\n                {task.title}\n              </span>\n              <Chip color={TASK_COLOR[task.state]} className='@max-md:sr-only'>\n                {TASK_LABEL[task.state]}\n              </Chip>\n              <span className='text-muted-foreground hidden w-12 shrink-0 text-end text-xs tabular-nums @sm:inline'>\n                {task.due}\n              </span>\n              <Avatar\n                seed={task.owner}\n                role='img'\n                aria-label={task.owner}\n                className='size-5'\n              />\n            </li>\n          );\n        })}\n      </ul>\n    </section>\n  );\n}\n\nexport function FilesPanel() {\n  return (\n    <ul className={cn(SURFACE, 'flex flex-col p-1')}>\n      {FILES.map((file) => {\n        const Glyph = FILE_GLYPH[file.kind];\n        return (\n          <li\n            key={file.id}\n            className='flex items-center gap-3 rounded-lg px-3 py-2.5'\n          >\n            <span className='keycap-3d flex size-7 shrink-0 items-center justify-center rounded-md'>\n              <Glyph className='text-muted-foreground size-3.5' />\n            </span>\n            <div className='flex min-w-0 flex-1 flex-col'>\n              <span className='truncate text-[13px] font-medium'>\n                {file.name}\n              </span>\n              <span className='text-muted-foreground truncate text-xs'>\n                {file.updatedBy}, {file.updated}\n              </span>\n            </div>\n            <span className='text-muted-foreground shrink-0 text-xs tabular-nums'>\n              {file.size}\n            </span>\n          </li>\n        );\n      })}\n    </ul>\n  );\n}\n\nexport function ActivityPanel() {\n  return (\n    <ul className={cn(SURFACE, 'flex flex-col p-1')}>\n      {ACTIVITY.map((item) => (\n        <ActivityRow key={item.id} item={item} />\n      ))}\n    </ul>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/page-headers-01/panels.tsx"
    },
    {
      "path": "registry/ndeko/blocks/page-headers/page-headers-01/session.ts",
      "content": "import type { SessionStep } from '@/registry/ndeko/hooks/use-session';\n\nimport type { TabId } from './data';\n\nexport type HeaderState = {\n  tab: TabId;\n  /** Where the demonstration asks the frame to scroll. A person scrolls the frame directly. */\n  scrollTop: number;\n  /** Counts the requests, so asking twice for the same place still scrolls. */\n  scrollRequest: number;\n};\n\nexport type HeaderAction =\n  { type: 'tabPicked'; tab: TabId } | { type: 'scrolledTo'; top: number };\n\ntype Step = SessionStep<HeaderState, HeaderAction>;\n\nexport const INITIAL: HeaderState = {\n  tab: 'overview',\n  scrollTop: 0,\n  scrollRequest: 0,\n};\n\nexport function reducer(state: HeaderState, action: HeaderAction): HeaderState {\n  switch (action.type) {\n    case 'tabPicked':\n      return { ...state, tab: action.tab };\n    case 'scrolledTo':\n      return {\n        ...state,\n        scrollTop: action.top,\n        scrollRequest: state.scrollRequest + 1,\n      };\n  }\n}\n\n/** Far enough for the title to pass under the bar, short enough to stay inside the shortest tab. */\nconst READ_DOWN_TO = 320;\n\n/**\n * A person reads down the overview until the header folds into its bar, comes back up, glances at\n * the tasks and returns to the overview: the round ends where it began.\n */\nexport const SCRIPT: Step[] = [\n  {\n    after: 1600,\n    by: 'demo',\n    action: { type: 'scrolledTo', top: READ_DOWN_TO },\n  },\n  { after: 2800, by: 'demo', action: { type: 'scrolledTo', top: 0 } },\n  {\n    after: 1500,\n    by: 'demo',\n    press: 'tab-tasks',\n    action: { type: 'tabPicked', tab: 'tasks' },\n  },\n  {\n    after: 1900,\n    by: 'demo',\n    press: 'tab-overview',\n    action: { type: 'tabPicked', tab: 'overview' },\n  },\n];\n\nexport const RESTING: HeaderState = INITIAL;\n\nexport const LOOP_AFTER_MS = 2200;\n",
      "type": "registry:component",
      "target": "components/blocks/page-headers-01/session.ts"
    },
    {
      "path": "registry/ndeko/blocks/page-headers/page-headers-01/data.ts",
      "content": "export type TabId = 'overview' | 'tasks' | 'files' | 'activity';\n\nexport type MilestoneState = 'done' | 'current' | 'upcoming';\n\nexport type TaskState = 'todo' | 'doing' | 'done';\n\nexport type Person = {\n  name: string;\n};\n\nexport type Milestone = {\n  id: string;\n  title: string;\n  date: string;\n  state: MilestoneState;\n};\n\nexport type Task = {\n  id: string;\n  title: string;\n  owner: string;\n  due: string;\n  state: TaskState;\n};\n\nexport type ProjectFile = {\n  id: string;\n  name: string;\n  kind: 'drawing' | 'sheet' | 'document';\n  size: string;\n  updatedBy: string;\n  updated: string;\n};\n\nexport type ActivityItem = {\n  id: string;\n  person: string;\n  action: string;\n  target: string;\n  when: string;\n};\n\nexport const WORKSPACE = {\n  name: 'Morrow Studio',\n  href: '#',\n  projectsHref: '#projects',\n};\n\nexport const PROJECT = {\n  title: 'Harbour Street clinic fit-out',\n  status: 'On track',\n  lead: 'Noor Haddad',\n  due: 'Due 18 Dec',\n  tasksDone: 24,\n  tasksTotal: 36,\n  summary:\n    'A ground-floor clinic in a former bank: four treatment rooms, a reception that keeps the old counter, and a step-free entrance on Harbour Street. The landlord signs off the drawings before the builder starts on 6 January.',\n};\n\nexport const MEMBERS: Person[] = [\n  { name: 'Noor Haddad' },\n  { name: 'Tomasz Wilk' },\n  { name: 'Ama Owusu' },\n  { name: 'Lise Berg' },\n  { name: 'Jonah Reyes' },\n  { name: 'Priya Natarajan' },\n];\n\nexport const TABS: { id: TabId; label: string; count?: number }[] = [\n  { id: 'overview', label: 'Overview' },\n  { id: 'tasks', label: 'Tasks', count: 36 },\n  { id: 'files', label: 'Files', count: 8 },\n  { id: 'activity', label: 'Activity' },\n];\n\nexport const MILESTONES: Milestone[] = [\n  {\n    id: 'survey',\n    title: 'Measured survey',\n    date: '2 Sep',\n    state: 'done',\n  },\n  {\n    id: 'concept',\n    title: 'Concept layout agreed',\n    date: '27 Sep',\n    state: 'done',\n  },\n  {\n    id: 'planning',\n    title: 'Change of use approved',\n    date: '14 Nov',\n    state: 'done',\n  },\n  {\n    id: 'drawings',\n    title: 'Construction drawings',\n    date: '18 Dec',\n    state: 'current',\n  },\n  {\n    id: 'tender',\n    title: 'Builder starts on site',\n    date: '6 Jan',\n    state: 'upcoming',\n  },\n];\n\nexport const TASKS: Task[] = [\n  {\n    id: 'ramp',\n    title: 'Detail the entrance ramp at 1:12',\n    owner: 'Tomasz Wilk',\n    due: '9 Dec',\n    state: 'doing',\n  },\n  {\n    id: 'counter',\n    title: 'Survey the old banking counter for reuse',\n    owner: 'Ama Owusu',\n    due: '10 Dec',\n    state: 'doing',\n  },\n  {\n    id: 'acoustic',\n    title: 'Acoustic walls between treatment rooms',\n    owner: 'Lise Berg',\n    due: '11 Dec',\n    state: 'todo',\n  },\n  {\n    id: 'lighting',\n    title: 'Lighting layout for rooms 1 to 4',\n    owner: 'Jonah Reyes',\n    due: '12 Dec',\n    state: 'todo',\n  },\n  {\n    id: 'finishes',\n    title: 'Finishes schedule for the reception',\n    owner: 'Noor Haddad',\n    due: '13 Dec',\n    state: 'todo',\n  },\n  {\n    id: 'drainage',\n    title: 'Confirm drainage under the new sinks',\n    owner: 'Priya Natarajan',\n    due: '15 Dec',\n    state: 'todo',\n  },\n  {\n    id: 'fire',\n    title: 'Fire strategy sign-off',\n    owner: 'Tomasz Wilk',\n    due: '16 Dec',\n    state: 'todo',\n  },\n  {\n    id: 'landlord',\n    title: 'Send drawings to the landlord',\n    owner: 'Noor Haddad',\n    due: '18 Dec',\n    state: 'todo',\n  },\n  {\n    id: 'demolition',\n    title: 'Mark the walls to demolish',\n    owner: 'Ama Owusu',\n    due: '28 Nov',\n    state: 'done',\n  },\n  {\n    id: 'asbestos',\n    title: 'Asbestos survey of the ceiling void',\n    owner: 'Lise Berg',\n    due: '21 Nov',\n    state: 'done',\n  },\n];\n\nexport const FILES: ProjectFile[] = [\n  {\n    id: 'ground-floor',\n    name: 'Ground floor plan, rev F.pdf',\n    kind: 'drawing',\n    size: '4.2 MB',\n    updatedBy: 'Tomasz Wilk',\n    updated: 'Today',\n  },\n  {\n    id: 'sections',\n    name: 'Sections A to D, rev C.pdf',\n    kind: 'drawing',\n    size: '3.1 MB',\n    updatedBy: 'Tomasz Wilk',\n    updated: 'Yesterday',\n  },\n  {\n    id: 'door-schedule',\n    name: 'Door schedule.xlsx',\n    kind: 'sheet',\n    size: '96 KB',\n    updatedBy: 'Ama Owusu',\n    updated: '3 Dec',\n  },\n  {\n    id: 'finishes',\n    name: 'Finishes schedule.xlsx',\n    kind: 'sheet',\n    size: '120 KB',\n    updatedBy: 'Noor Haddad',\n    updated: '2 Dec',\n  },\n  {\n    id: 'brief',\n    name: 'Client brief, signed.pdf',\n    kind: 'document',\n    size: '880 KB',\n    updatedBy: 'Noor Haddad',\n    updated: '12 Sep',\n  },\n  {\n    id: 'survey',\n    name: 'Measured survey.pdf',\n    kind: 'drawing',\n    size: '6.8 MB',\n    updatedBy: 'Lise Berg',\n    updated: '2 Sep',\n  },\n  {\n    id: 'planning',\n    name: 'Change of use decision.pdf',\n    kind: 'document',\n    size: '410 KB',\n    updatedBy: 'Priya Natarajan',\n    updated: '14 Nov',\n  },\n  {\n    id: 'budget',\n    name: 'Cost plan, stage 4.xlsx',\n    kind: 'sheet',\n    size: '64 KB',\n    updatedBy: 'Jonah Reyes',\n    updated: '29 Nov',\n  },\n];\n\nexport const ACTIVITY: ActivityItem[] = [\n  {\n    id: 'a1',\n    person: 'Tomasz Wilk',\n    action: 'uploaded',\n    target: 'Ground floor plan, rev F',\n    when: '2 h ago',\n  },\n  {\n    id: 'a2',\n    person: 'Ama Owusu',\n    action: 'started',\n    target: 'Survey the old banking counter',\n    when: '4 h ago',\n  },\n  {\n    id: 'a3',\n    person: 'Noor Haddad',\n    action: 'moved the due date of',\n    target: 'Send drawings to the landlord',\n    when: 'Yesterday',\n  },\n  {\n    id: 'a4',\n    person: 'Lise Berg',\n    action: 'finished',\n    target: 'Asbestos survey of the ceiling void',\n    when: '21 Nov',\n  },\n  {\n    id: 'a5',\n    person: 'Priya Natarajan',\n    action: 'attached',\n    target: 'Change of use decision',\n    when: '14 Nov',\n  },\n  {\n    id: 'a6',\n    person: 'Jonah Reyes',\n    action: 'updated',\n    target: 'Cost plan, stage 4',\n    when: '29 Nov',\n  },\n];\n",
      "type": "registry:component",
      "target": "components/blocks/page-headers-01/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "page-headers"
  ],
  "type": "registry:block"
}