{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "block-gantt",
  "type": "registry:block",
  "title": "Gantt",
  "description": "A plan over the app: a top bar to leave by, people and their tasks beside a timeline of months, and a task open in a side panel.",
  "dependencies": [
    "@remixicon/react@^4.9.0"
  ],
  "registryDependencies": [
    "https://wideset.co/r/app-shell.json",
    "https://wideset.co/r/avatar.json",
    "https://wideset.co/r/block-styles.json",
    "https://wideset.co/r/breadcrumbs.json",
    "https://wideset.co/r/button.json",
    "https://wideset.co/r/checkbox.json",
    "https://wideset.co/r/icon-button.json",
    "https://wideset.co/r/progress-bar.json",
    "https://wideset.co/r/segmented-control.json",
    "https://wideset.co/r/sidepanel.json",
    "https://wideset.co/r/status-badge.json",
    "https://wideset.co/r/switch.json",
    "https://wideset.co/r/tabs.json",
    "https://wideset.co/r/tag.json",
    "https://wideset.co/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/gantt/chart.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/gantt/chart.tsx",
      "content": "'use client';\n\nimport {\n  RiAddLine,\n  RiArrowDownSLine,\n  RiArrowRightSLine,\n  RiCheckboxCircleFill,\n  RiFilter3Line,\n} from '@remixicon/react';\nimport { Avatar } from '@/components/ui/wideset/avatar/Avatar';\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { cn } from '@/lib/wideset/utils';\nimport { ProgressBar } from '@/components/ui/wideset/progress-bar/ProgressBar';\nimport { type CSSProperties, useState } from 'react';\n\nimport {\n  type Mark,\n  type Member,\n  members,\n  MONTHS,\n  type Task,\n  WEEK,\n  WEEK_STARTS,\n  WEEKS_PER_MONTH,\n} from './data';\n\nconst MONTH = WEEK * WEEKS_PER_MONTH;\n\n/** Figma's table beside the timeline: 54px of chevrons, 176px of names, 72px of progress. */\nconst TABLE = 'w-[18.875rem]';\nconst CHEVRONS = 'w-[3.375rem]';\n\n/*\n  Bars and chips are Static/Fill/Alpha/Subtle laid over the page colour, so they are opaque and the\n  month lines stop at them, as Figma's background blur makes them do. Breaks stay see-through.\n*/\nconst GREY =\n  'bg-ws-static-foreground bg-[linear-gradient(var(--ws-static-fill-alpha-subtle),var(--ws-static-fill-alpha-subtle))]';\n/** Figma's break: 4px stripes at 45° every 9.45px, over two layers of Static/Fill/Alpha/Subtle. */\nconst HATCH =\n  'bg-ws-static-alpha-base bg-[repeating-linear-gradient(135deg,var(--ws-static-fill-alpha-subtle)_0_4px,transparent_4px_6.68px)]';\nconst FOCUS =\n  'focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default cursor-pointer';\n/**\n * A row is one target across its whole width, never only its text: the table cell is the button,\n * and the hover tint runs through to the row's track on the timeline. The ring is drawn inset,\n * like a Sidebar item's, so the cells above and below do not cover it.\n */\nconst ROW =\n  'flex w-full cursor-pointer items-center text-left outline-ws-dynamic-primary-strong-default focus-visible:wds-focus-visible focus-visible:-outline-offset-2 active:bg-ws-dynamic-secondary-alpha-pressed';\nconst TINT = 'bg-ws-dynamic-secondary-alpha-hover';\n\nconst place = ({ start, length }: { start: number; length: number }): CSSProperties => ({\n  left: start * WEEK,\n  width: length * WEEK,\n});\n\n/** A point on the timeline as a date a screen reader can say (\"Feb 12\"); the bars show it only by position. */\nconst dateAt = (weeks: number) => {\n  const month = Math.min(Math.floor(weeks / WEEKS_PER_MONTH), MONTHS.length - 1);\n  const inMonth = weeks - month * WEEKS_PER_MONTH;\n  const week = Math.min(Math.floor(inMonth), WEEK_STARTS.length - 1);\n  const day = Math.min(Math.round(WEEK_STARTS[week] + (inMonth - week) * 7), 31);\n  return `${MONTHS[month].slice(0, 3)} ${day}`;\n};\nconst spanLabel = ({ start, length }: { start: number; length: number }) =>\n  `${dateAt(start)} to ${dateAt(start + length)}`;\n\n/** A person's load in words: when they are busy and when they pause. */\nconst loadLabel = (marks: Mark[]) =>\n  marks.map((mark) => `${mark.kind === 'break' ? 'paused' : 'busy'} ${spanLabel(mark)}`).join(', ');\n\ntype Row = { kind: 'member'; member: Member } | { kind: 'task'; task: Task };\n\n/** The people table and their work on a timeline of months; a task opens in the side panel. */\nexport function GanttChart({ onOpenTask }: { onOpenTask: (title: string) => void }) {\n  const [collapsed, setCollapsed] = useState<string[]>([]);\n  const [hovered, setHovered] = useState<string | null>(null);\n  const hover = (id: string) => ({\n    onMouseEnter: () => setHovered(id),\n    onMouseLeave: () => setHovered((current) => (current === id ? null : current)),\n  });\n  const toggle = (id: string) =>\n    setCollapsed((ids) => (ids.includes(id) ? ids.filter((item) => item !== id) : [...ids, id]));\n\n  const rows = members.flatMap((member): Row[] => [\n    { kind: 'member', member },\n    ...(collapsed.includes(member.id)\n      ? []\n      : member.tasks.map((task): Row => ({ kind: 'task', task }))),\n  ]);\n\n  return (\n    <div className=\"ws-scrollbar min-h-0 flex-1 overflow-y-auto\">\n      <div className=\"flex min-h-full\">\n        <div className={cn(TABLE, 'shrink-0')}>\n          <div className=\"border-ws-static-subtle h-ws-18 px-ws-11 typography-label-strong-sm text-ws-static-strong flex items-center border-b\">\n            Person\n          </div>\n          <div className=\"h-ws-18 px-ws-11 flex items-center\">\n            <Button variant=\"secondary\" preset=\"border\" size=\"sm\">\n              <Button.Icon icon={RiFilter3Line} />\n              Filters\n            </Button>\n          </div>\n          {rows.map((row) =>\n            row.kind === 'member' ? (\n              <MemberCells\n                key={row.member.id}\n                member={row.member}\n                expanded={!collapsed.includes(row.member.id)}\n                onToggle={() => toggle(row.member.id)}\n                tinted={hovered === row.member.id}\n                {...hover(row.member.id)}\n              />\n            ) : (\n              <button\n                key={row.task.id}\n                type=\"button\"\n                onClick={() => onOpenTask(row.task.title)}\n                {...hover(row.task.id)}\n                className={cn(\n                  ROW,\n                  'h-ws-15 pr-ws-21 typography-label-sm text-ws-static-subtle pl-[3.375rem]',\n                  hovered === row.task.id && cn(TINT, 'text-ws-static-strong'),\n                )}\n              >\n                <span className=\"truncate\">{row.task.title}</span>\n              </button>\n            ),\n          )}\n          <div className=\"h-ws-18 pl-ws-6 flex items-center\">\n            <Button variant=\"secondary\" preset=\"ghost\" size=\"sm\">\n              <Button.Icon icon={RiAddLine} />\n              New project\n            </Button>\n          </div>\n        </div>\n\n        <div className=\"relative flex min-w-0 flex-1 flex-col\">\n          {/* The timeline is a canvas: it scrolls sideways, without a bar, past what the window shows. */}\n          <div className=\"flex-1 [scrollbar-width:none] overflow-x-auto\">\n            <div className=\"relative min-h-full\" style={{ width: MONTHS.length * MONTH }}>\n              <div aria-hidden=\"true\" className=\"absolute inset-0 flex\">\n                {MONTHS.map((month) => (\n                  <div\n                    key={month}\n                    className=\"border-ws-static-base shrink-0 border-r\"\n                    style={{ width: MONTH }}\n                  />\n                ))}\n              </div>\n              <div className=\"flex\">\n                {MONTHS.map((month) => (\n                  <div\n                    key={month}\n                    className=\"border-ws-static-subtle h-ws-18 px-ws-9 typography-label-strong-sm text-ws-static-strong flex shrink-0 items-center border-b\"\n                    style={{ width: MONTH }}\n                  >\n                    {month}\n                  </div>\n                ))}\n              </div>\n              <div className=\"flex\">\n                {MONTHS.map((month) => (\n                  <div\n                    key={month}\n                    className=\"h-ws-18 pt-ws-7 typography-caption-md text-ws-static-subtle flex shrink-0\"\n                    style={{ width: MONTH }}\n                  >\n                    {WEEK_STARTS.map((day) => (\n                      <span key={day} className=\"flex-1 text-center\">\n                        {day}\n                      </span>\n                    ))}\n                  </div>\n                ))}\n              </div>\n              {rows.map((row) =>\n                row.kind === 'member' ? (\n                  <div\n                    key={row.member.id}\n                    {...hover(row.member.id)}\n                    className={cn('h-ws-18 relative', hovered === row.member.id && TINT)}\n                  >\n                    {row.member.marks.map((mark, index) => (\n                      <TimelineMark key={index} mark={mark} top=\"top-ws-7\" />\n                    ))}\n                  </div>\n                ) : (\n                  <div\n                    key={row.task.id}\n                    {...hover(row.task.id)}\n                    className={cn('h-ws-15 relative', hovered === row.task.id && TINT)}\n                  >\n                    {row.task.marks.map((mark, index) => (\n                      <TimelineMark\n                        key={index}\n                        mark={mark}\n                        top=\"top-ws-3\"\n                        title={row.task.title}\n                        onOpen={() => onOpenTask(row.task.title)}\n                      />\n                    ))}\n                  </div>\n                ),\n              )}\n            </div>\n          </div>\n          {/* Figma's table divider is 2px of #000000 at 8%, unbound: Static/Stroke/Subtle is that value. */}\n          <span\n            aria-hidden=\"true\"\n            className=\"border-ws-static-subtle absolute inset-y-0 left-0 border-l-2\"\n          />\n        </div>\n      </div>\n    </div>\n  );\n}\n\n/** A person's row in the table: the whole row expands or collapses their tasks. */\nfunction MemberCells({\n  member,\n  expanded,\n  onToggle,\n  tinted,\n  onMouseEnter,\n  onMouseLeave,\n}: {\n  member: Member;\n  expanded: boolean;\n  onToggle: () => void;\n  tinted: boolean;\n  onMouseEnter: () => void;\n  onMouseLeave: () => void;\n}) {\n  const Chevron = expanded ? RiArrowDownSLine : RiArrowRightSLine;\n  return (\n    // The row holds a progress ring (a div), which a <button> may not contain, so the button is\n    // stretched under the whole row and the content above it lets clicks through.\n    <div\n      onMouseEnter={onMouseEnter}\n      onMouseLeave={onMouseLeave}\n      className={cn('h-ws-18 relative flex items-center', tinted && TINT)}\n    >\n      <button\n        type=\"button\"\n        aria-expanded={expanded}\n        aria-label={`${member.name}’s tasks, ${loadLabel(member.marks)}`}\n        onClick={onToggle}\n        className={cn(ROW, 'absolute inset-0')}\n      />\n      {/* Figma's XSmall icon button: its 16px arrow centred in a 24px box. */}\n      <span className={cn(CHEVRONS, 'pl-ws-9 pointer-events-none flex shrink-0')}>\n        <span className=\"size-ws-12 flex items-center justify-center\">\n          <Chevron aria-hidden=\"true\" className=\"size-ws-9 text-ws-dynamic-secondary-default\" />\n        </span>\n      </span>\n      <div className=\"gap-ws-7 pointer-events-none flex min-w-0 flex-1 items-center\">\n        {member.initials ? (\n          <Avatar size=\"sm\" initials={member.initials} color={member.color} status=\"online\" />\n        ) : (\n          <Avatar size=\"sm\" status=\"online\" />\n        )}\n        <span className=\"typography-label-strong-sm text-ws-static-strong truncate\">\n          {member.name}\n        </span>\n      </div>\n      <div className=\"w-ws-21 pr-ws-9 pointer-events-none flex shrink-0 justify-end\">\n        <ProgressBar type=\"circle\" value={member.progress} aria-label={`${member.name}, work done`}>\n          <ProgressBar.Value />\n          <ProgressBar.Track />\n        </ProgressBar>\n      </div>\n    </div>\n  );\n}\n\n/**\n * One mark on a row. A person's bars only show their load; a task's marks open it. Figma's done\n * part carries a 1.5px inside stroke of #000000 at 10%, unbound: Static/Stroke/Base (1px) stands in.\n */\nfunction TimelineMark({\n  mark,\n  top,\n  title,\n  onOpen,\n}: {\n  mark: Mark;\n  top: string;\n  title?: string;\n  onOpen?: () => void;\n}) {\n  const box = cn('h-ws-13 rounded-ws-container-sm absolute', top);\n\n  if (mark.kind === 'break') {\n    return <span aria-hidden=\"true\" className={cn(box, HATCH)} style={place(mark)} />;\n  }\n\n  if (mark.kind === 'bar') {\n    const done =\n      mark.progress > 0 ? (\n        <span\n          className=\"bg-ws-non-semantic-brand-strong rounded-ws-container-sm absolute inset-y-0 left-0 inset-ring inset-ring-(--ws-static-stroke-base)\"\n          style={{ width: `${mark.progress * 100}%` }}\n        />\n      ) : null;\n    return title ? (\n      <button\n        type=\"button\"\n        aria-label={`${title}, ${spanLabel(mark)}, ${Math.round(mark.progress * 100)}% done`}\n        onClick={onOpen}\n        className={cn(box, GREY, FOCUS)}\n        style={place(mark)}\n      >\n        {done}\n      </button>\n    ) : (\n      <span aria-hidden=\"true\" className={cn(box, GREY)} style={place(mark)}>\n        {done}\n      </span>\n    );\n  }\n\n  return (\n    <button\n      type=\"button\"\n      onClick={onOpen}\n      className={cn(\n        box,\n        GREY,\n        FOCUS,\n        'gap-ws-5 pl-ws-5 pr-ws-4 typography-label-sm text-ws-static-base flex items-center whitespace-nowrap',\n        // Figma outlines the task in focus inside the chip: 1.5px of #5846f8 at 50%, unbound.\n        mark.highlighted && 'inset-ring inset-ring-(--ws-dynamic-stroke-primary-default)',\n      )}\n      style={place(mark)}\n    >\n      {title}\n      <span className=\"sr-only\">, {spanLabel(mark)}</span>\n      {mark.done ? (\n        <>\n          <RiCheckboxCircleFill\n            aria-hidden=\"true\"\n            className=\"size-ws-11 text-ws-semantic-positive ml-auto shrink-0\"\n          />\n          <span className=\"sr-only\">, done</span>\n        </>\n      ) : null}\n    </button>\n  );\n}\n"
    },
    {
      "path": "src/blocks/gantt/data.ts",
      "type": "registry:file",
      "target": "blocks/wideset/gantt/data.ts",
      "content": "import type { AvatarColor } from '@/components/ui/wideset/avatar/Avatar.colors';\n\nimport type { Person, TaskDetail } from './task-sidepanel';\n\n/** A week on the timeline, in px. Figma's grid gives every month five weeks: 205px. */\nexport const WEEK = 41;\nexport const WEEKS_PER_MONTH = 5;\n/** The day each week column starts on, the same in every month of the grid. */\nexport const WEEK_STARTS = [1, 8, 15, 22, 29];\nexport const MONTHS = [\n  'January ’24',\n  'February ’24',\n  'March ’24',\n  'April ’24',\n  'May ’24',\n  'June ’24',\n  'July ’24',\n  'August ’24',\n  'September ’24',\n  'October ’24',\n  'November ’24',\n  'December ’24',\n];\n\n/** A stretch of the timeline, in weeks from the first day of the first month. */\ntype Span = { start: number; length: number };\n\n/** What a row draws on the timeline. */\nexport type Mark =\n  /** Grey for the whole span, brand for the part done (`progress`, 0–1). */\n  | (Span & { kind: 'bar'; progress: number })\n  /** The task's title on grey; `done` adds a check, `highlighted` outlines the task in focus. */\n  | (Span & { kind: 'chip'; done?: boolean; highlighted?: boolean })\n  /** A pause, hatched. */\n  | (Span & { kind: 'break' });\n\nexport type Task = { id: string; title: string; marks: Mark[] };\n\nexport type Member = {\n  id: string;\n  name: string;\n  /** Without initials the avatar shows the default person icon, as Figma does. */\n  initials?: string;\n  color?: AvatarColor;\n  /** Share of their work done, 0–100. */\n  progress: number;\n  marks: Mark[];\n  tasks: Task[];\n};\n\nexport const members: Member[] = [\n  {\n    id: 'adam',\n    name: 'Adam Smith',\n    initials: 'AS',\n    color: 'blue',\n    progress: 44,\n    marks: [{ kind: 'bar', start: 0.39, length: 17.29, progress: 0.3 }],\n    tasks: [],\n  },\n  {\n    id: 'tom',\n    name: 'Tom Ford',\n    initials: 'TF',\n    color: 'green',\n    progress: 32,\n    marks: [\n      { kind: 'bar', start: 2.49, length: 6.41, progress: 0.28 },\n      { kind: 'break', start: 9, length: 1.59 },\n    ],\n    tasks: [\n      {\n        id: 'market-research',\n        title: 'Market Research',\n        marks: [{ kind: 'chip', start: 2.49, length: 3.9, done: true }],\n      },\n      { id: 'goals', title: 'Goals and KPIs', marks: [] },\n      {\n        id: 'content-strategy',\n        title: 'Content Strategy',\n        marks: [\n          { kind: 'chip', start: 2.44, length: 6.22, highlighted: true },\n          { kind: 'break', start: 8.76, length: 1.59 },\n        ],\n      },\n      {\n        id: 'photo-shoots',\n        title: 'Photo shoots',\n        marks: [{ kind: 'chip', start: 1.8, length: 1 }],\n      },\n      {\n        id: 'optimization',\n        title: 'Optimization',\n        marks: [{ kind: 'chip', start: 4.71, length: 9.78 }],\n      },\n      {\n        id: 'approvals',\n        title: 'Approvals',\n        marks: [{ kind: 'chip', start: 15.34, length: 3.76 }],\n      },\n      {\n        id: 'post-launch',\n        title: 'Post launch posts',\n        marks: [{ kind: 'bar', start: 2.73, length: 5.66, progress: 1 }],\n      },\n    ],\n  },\n  {\n    id: 'cameron',\n    name: 'Cameron Williamson',\n    progress: 0,\n    marks: [\n      { kind: 'bar', start: 0.8, length: 3.12, progress: 1 },\n      { kind: 'bar', start: 10.39, length: 3, progress: 0 },\n    ],\n    tasks: [],\n  },\n  {\n    id: 'albert',\n    name: 'Albert Flores',\n    progress: 30,\n    marks: [{ kind: 'bar', start: 8.1, length: 2.46, progress: 0 }],\n    tasks: [],\n  },\n  { id: 'courtney', name: 'Courtney Henry', progress: 0, marks: [], tasks: [] },\n  {\n    id: 'jacob',\n    name: 'Jacob Jones',\n    progress: 0,\n    marks: [{ kind: 'bar', start: 11.95, length: 3.61, progress: 0 }],\n    tasks: [],\n  },\n  {\n    id: 'guy',\n    name: 'Guy Hawkins',\n    progress: 0,\n    marks: [{ kind: 'bar', start: 15.41, length: 3.32, progress: 0 }],\n    tasks: [],\n  },\n];\n\n/** Who else is on the project, beside the title. */\nexport const viewers = [\n  { name: 'Adam Smith', initials: 'AS', color: 'blue' },\n  { name: 'Tom Ford', initials: 'TF', color: 'green' },\n] satisfies { name: string; initials: string; color: AvatarColor }[];\n\nconst alexandar: Person = { name: 'Alexandar Wright', initials: 'AW', color: 'orange' };\nconst esther: Person = { name: 'Esther Howard', initials: 'EH', color: 'blue' };\nconst kathryn: Person = { name: 'Kathryn Murphy', initials: 'KM', color: 'yellow' };\nconst jenny: Person = { name: 'Jenny Wilson', initials: 'JW', color: 'green' };\nconst robert: Person = { name: 'Robert Fox', initials: 'RF', color: 'pink' };\n\n/** The task the side panel opens on; a task picked on the chart shows its title over the same detail. */\nexport const campaign: TaskDetail = {\n  title: 'Launch social media campaign',\n  due: 'Due date 14/04/2025',\n  private: false,\n  people: [alexandar, esther, kathryn, jenny, robert],\n  status: { label: 'Completed', color: 'lime' },\n  labels: [{ label: 'Discover', color: 'purple' }],\n  assignee: alexandar,\n  dueDate: 'December 5, 2023',\n  subtasks: [\n    { id: 'content-plan', title: 'Create campaign content plan', done: true },\n    { id: 'graphics', title: 'Design promotional graphics', done: false, progress: 44 },\n  ],\n  activity: [\n    {\n      id: 'completed',\n      text: 'Subtask has been completed',\n      date: '15/09/2024',\n      subtask: {\n        title: 'Create campaign content plan',\n        reviewers: 2,\n        doneBy: 'Esther',\n        comments: 3,\n      },\n    },\n    {\n      id: 'subtasks-added',\n      text: 'Subtasks added by',\n      person: { ...esther, name: 'Esther' },\n      date: '13/09/2024',\n    },\n    {\n      id: 'created',\n      text: 'Task created by',\n      person: { ...kathryn, name: 'Kathryn' },\n      date: '13/09/2024',\n    },\n  ],\n};\n"
    },
    {
      "path": "src/blocks/gantt/index.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/gantt/index.tsx",
      "content": "'use client';\n\nimport '@/styles/wideset-blocks.css';\n\nimport { AppShell } from '@/components/ui/wideset/app-shell/AppShell';\nimport { Avatar } from '@/components/ui/wideset/avatar/Avatar';\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { useState } from 'react';\n\nimport { GanttChart } from './chart';\nimport { campaign, viewers } from './data';\nimport { type TaskDetail, TaskSidepanel } from './task-sidepanel';\nimport { TopBar } from './top-bar';\n\n/**\n * Gantt, a takeover in the Flat direction: a window over the app with a top bar to leave by,\n * people's work on a timeline, and the task side panel open beside it.\n */\nexport default function Gantt() {\n  const [open, setOpen] = useState(true);\n  const [task, setTask] = useState<TaskDetail>(campaign);\n\n  const openTask = (title: string) => {\n    setTask({ ...campaign, title });\n    setOpen(true);\n  };\n\n  return (\n    <AppShell className=\"ws-block-utility\" direction=\"flat\">\n      <AppShell.Main className=\"flex flex-col\">\n        <TopBar />\n        <div className=\"px-ws-11 pt-ws-13 pb-ws-11 flex shrink-0 items-center justify-between\">\n          <h1 className=\"typography-title-sm text-ws-static-strong\">Marketing</h1>\n          <div className=\"gap-ws-12 flex items-center\">\n            <Avatar.Group size=\"md\" className=\"w-auto\">\n              {viewers.map((viewer) => (\n                <Avatar key={viewer.name} initials={viewer.initials} color={viewer.color} />\n              ))}\n              <Avatar />\n            </Avatar.Group>\n            <div className=\"gap-ws-5 flex items-center\">\n              <Button variant=\"secondary\" preset=\"border\" size=\"sm\">\n                Today\n              </Button>\n              <Button variant=\"secondary\" size=\"sm\">\n                Publish\n              </Button>\n            </div>\n          </div>\n        </div>\n        <GanttChart onOpenTask={openTask} />\n      </AppShell.Main>\n      <TaskSidepanel task={task} open={open} onOpenChange={setOpen} />\n    </AppShell>\n  );\n}\n"
    },
    {
      "path": "src/blocks/gantt/task-sidepanel.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/gantt/task-sidepanel.tsx",
      "content": "'use client';\n\nimport {\n  type RemixiconComponentType,\n  RiAddLine,\n  RiArrowDownSLine,\n  RiArrowLeftLine,\n  RiArrowUpSLine,\n  RiChat2Line,\n  RiCloseLine,\n  RiMoreFill,\n  RiUserFill,\n} from '@remixicon/react';\nimport { Avatar } from '@/components/ui/wideset/avatar/Avatar';\nimport { type AvatarColor } from '@/components/ui/wideset/avatar/Avatar.colors';\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { Checkbox } from '@/components/ui/wideset/checkbox/Checkbox';\nimport { cn } from '@/lib/wideset/utils';\nimport { IconButton } from '@/components/ui/wideset/button/IconButton';\nimport { ProgressBar } from '@/components/ui/wideset/progress-bar/ProgressBar';\nimport { Sidepanel } from '@/components/ui/wideset/sidepanel/Sidepanel';\nimport { StatusBadge } from '@/components/ui/wideset/status-badge/StatusBadge';\nimport { Switch } from '@/components/ui/wideset/switch/Switch';\nimport { Tabs } from '@/components/ui/wideset/tabs/Tabs';\nimport { Tag } from '@/components/ui/wideset/tag/Tag';\nimport { type TagProps } from '@/components/ui/wideset/tag/Tag.types';\nimport { Fragment, type KeyboardEvent, type ReactNode } from 'react';\n\n/*\n  The task side panel, one file so it can be copied on its own: the Gantt starting point carries a\n  byte-identical copy (src/__tests__/blocks.test.tsx keeps the two the same).\n*/\n\nexport type Person = { name: string; initials: string; color: AvatarColor };\n\n/** One entry in the task's history. */\nexport type Activity = {\n  id: string;\n  /** What happened, e.g. \"Task created by\"; `person` follows it when there is one. */\n  text: string;\n  person?: Person;\n  date: string;\n  /** The subtask the entry is about, drawn as a card under the date. */\n  subtask?: { title: string; reviewers: number; doneBy: string; comments: number };\n};\n\nexport type TaskDetail = {\n  title: string;\n  /** The line under the title. */\n  due: string;\n  private: boolean;\n  /** Who the task is shared with, in the header. */\n  people: Person[];\n  status: { label: string; color: TagProps['color'] };\n  labels: { label: string; color: TagProps['color'] }[];\n  assignee: Person;\n  dueDate: string;\n  /** `progress` (0–100) draws a ring beside a subtask under way. */\n  subtasks: { id: string; title: string; done: boolean; progress?: number }[];\n  activity: Activity[];\n};\n\ntype TaskSidepanelProps = {\n  task: TaskDetail;\n  open: boolean;\n  onOpenChange: (open: boolean) => void;\n  /** Up and Down move to the previous or next record. Its hint shows only when this is passed. */\n  onNavigate?: (direction: 'previous' | 'next') => void;\n  /** Left goes back to the parent record. Its hint shows only when this is passed. */\n  onParent?: () => void;\n};\n\nconst TABS = [\n  { value: 'overview', label: 'Overview' },\n  { value: 'activity', label: 'Activity Log' },\n  { value: 'backlog', label: 'Backlog' },\n  { value: 'label', label: 'Label' },\n];\n\n/**\n * Figma's Side Panel `Size=Small, Type=Task`: a record's detail beside the page. The page stays in\n * use, so there is no scrim: picking another record swaps the panel's content instead of closing\n * it, and focus stays where the user is. The close button and Esc close it.\n */\nexport function TaskSidepanel({\n  task,\n  open,\n  onOpenChange,\n  onNavigate,\n  onParent,\n}: TaskSidepanelProps) {\n  // The footer promises only the keys that work: each hint comes with its handler.\n  const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n    const target = event.target as HTMLElement;\n    if (target.closest('input, textarea, [contenteditable=\"true\"], [role=\"tablist\"]')) return;\n    if (onNavigate && (event.key === 'ArrowUp' || event.key === 'ArrowDown')) {\n      event.preventDefault();\n      // The next record remounts the content, and a focused control in it goes too: focus then\n      // returns to the panel, so the next arrow still reaches it.\n      const panel = event.currentTarget;\n      onNavigate(event.key === 'ArrowUp' ? 'previous' : 'next');\n      requestAnimationFrame(() => {\n        if (!panel.contains(document.activeElement)) panel.focus();\n      });\n    } else if (onParent && event.key === 'ArrowLeft') {\n      event.preventDefault();\n      onParent();\n    }\n  };\n  return (\n    <Sidepanel open={open} onOpenChange={onOpenChange} modal={false}>\n      <Sidepanel.Panel\n        size=\"sm\"\n        // Without the scrim, Figma raises the panel on Elevation/High (an override on the instance).\n        className=\"ws-block-utility shadow-ws-high\"\n        onInteractOutside={(event) => event.preventDefault()}\n        onOpenAutoFocus={(event) => event.preventDefault()}\n        onKeyDown={onKeyDown}\n      >\n        <Fragment key={task.title}>\n          <div className=\"border-ws-static-base h-ws-20 gap-ws-7 px-ws-12 flex shrink-0 items-center justify-between border-b\">\n            <Switch label=\"Private\" defaultChecked={task.private} />\n            <div className=\"gap-ws-5 flex items-center\">\n              {/* One letter each: at 24px, overlapping two-letter initials run into each other. */}\n              <Avatar.Group size=\"sm\" className=\"w-auto\">\n                {task.people.map((person) => (\n                  <Avatar\n                    key={person.name}\n                    initials={person.initials.charAt(0)}\n                    color={person.color}\n                    status=\"online\"\n                  />\n                ))}\n              </Avatar.Group>\n              <IconButton\n                variant=\"secondary\"\n                preset=\"border\"\n                size=\"sm\"\n                icon={RiMoreFill}\n                aria-label=\"More actions\"\n              />\n              <Sidepanel.Close asChild>\n                <IconButton\n                  variant=\"secondary\"\n                  preset=\"border\"\n                  size=\"sm\"\n                  icon={RiCloseLine}\n                  aria-label=\"Close\"\n                />\n              </Sidepanel.Close>\n            </div>\n          </div>\n\n          <div className=\"ws-scrollbar flex min-h-0 flex-1 flex-col overflow-y-auto\">\n            <div className=\"p-ws-12\">\n              <Sidepanel.Title>{task.title}</Sidepanel.Title>\n              <Sidepanel.Description className=\"mt-ws-5\">{task.due}</Sidepanel.Description>\n            </div>\n\n            <dl className=\"gap-ws-7 px-ws-12 pb-ws-12 flex flex-col\">\n              <Property label=\"Status\">\n                <Tag size=\"sm\" color={task.status.color}>\n                  {task.status.label}\n                </Tag>\n              </Property>\n              <Property label=\"Labels\">\n                {task.labels.map((label) => (\n                  <Tag key={label.label} size=\"sm\" color={label.color}>\n                    {label.label}\n                  </Tag>\n                ))}\n              </Property>\n              <Property label=\"Assigned to\">\n                <Avatar size=\"xs\" initials={task.assignee.initials} color={task.assignee.color} />\n                {task.assignee.name}\n              </Property>\n              <Property label=\"Due Date\">{task.dueDate}</Property>\n            </dl>\n\n            <div className=\"px-ws-12 pb-ws-12\">\n              <Button variant=\"primary\" preset=\"border\" size=\"sm\">\n                <Button.Icon icon={RiAddLine} />\n                Complete\n              </Button>\n            </div>\n\n            <div className=\"px-ws-12 pb-ws-12\">\n              {/* Figma's stroke is inside the card: an inset ring keeps its 6px and 4px padding. */}\n              <div className=\"bg-ws-static-container rounded-ws-container-sm pt-ws-4 pb-ws-3 inset-ring inset-ring-(--ws-static-stroke-base)\">\n                <ul aria-label=\"Subtasks\">\n                  {task.subtasks.map((subtask) => (\n                    <li\n                      key={subtask.id}\n                      // Label/Small sets the row's line: ProgressBar's ring then sits in 20px, not the page's 24px.\n                      className=\"gap-ws-9 px-ws-9 py-ws-5 typography-label-sm flex items-center justify-between\"\n                    >\n                      <Checkbox label={subtask.title} defaultChecked={subtask.done} />\n                      {subtask.progress === undefined ? null : (\n                        <ProgressBar\n                          type=\"circle\"\n                          value={subtask.progress}\n                          aria-label={`${subtask.title} progress`}\n                        >\n                          <ProgressBar.Value />\n                          <ProgressBar.Track />\n                        </ProgressBar>\n                      )}\n                    </li>\n                  ))}\n                </ul>\n                <div className=\"h-ws-15 gap-ws-6 px-ws-8 flex items-center\">\n                  <IconButton\n                    variant=\"secondary\"\n                    preset=\"ghost\"\n                    size=\"xs\"\n                    icon={RiAddLine}\n                    aria-label=\"Add subtask\"\n                  />\n                  <span aria-hidden=\"true\" className=\"typography-body-md text-ws-static-subtle\">\n                    Add subtask\n                  </span>\n                </div>\n              </div>\n            </div>\n\n            <Tabs defaultValue=\"overview\" divider={false} className=\"flex-1\">\n              {/* The line under the tabs is the header's own, Static/Stroke/Base, edge to edge. */}\n              <div className=\"border-ws-static-base px-ws-12 border-b\">\n                <Tabs.List aria-label=\"Task sections\">\n                  {TABS.map((tab) => (\n                    <Tabs.Item key={tab.value} value={tab.value}>\n                      <Tabs.Label>{tab.label}</Tabs.Label>\n                    </Tabs.Item>\n                  ))}\n                </Tabs.List>\n              </div>\n              {/* Figma lays the grey (Static/Fill/Alpha/Subtle) over Static/Fill/Foreground. */}\n              <div className=\"bg-ws-static-foreground flex flex-1 flex-col\">\n                <div className=\"bg-ws-static-alpha-subtle px-ws-12 py-ws-12 flex-1\">\n                  {TABS.map((tab) => (\n                    <Tabs.Content key={tab.value} value={tab.value}>\n                      {tab.value === 'overview' || tab.value === 'activity' ? (\n                        <ActivityTimeline items={task.activity} />\n                      ) : (\n                        <p className=\"py-ws-5 typography-body-md text-ws-static-subtle\">\n                          Nothing here yet.\n                        </p>\n                      )}\n                    </Tabs.Content>\n                  ))}\n                </div>\n              </div>\n            </Tabs>\n          </div>\n\n          <div className=\"bg-ws-static-overlay px-ws-12 py-ws-9 flex shrink-0 items-center justify-between\">\n            <div className=\"gap-ws-12 flex items-center\">\n              {onNavigate && (\n                <Hint\n                  keys={\n                    <span className=\"gap-ws-3 flex\">\n                      <Key icon={RiArrowUpSLine} name=\"Up arrow\" />\n                      <Key icon={RiArrowDownSLine} name=\"Down arrow\" />\n                    </span>\n                  }\n                >\n                  Navigate\n                </Hint>\n              )}\n              {onParent && (\n                <Hint keys={<Key icon={RiArrowLeftLine} name=\"Left arrow\" />}>\n                  Return to parent\n                </Hint>\n              )}\n            </div>\n            <Hint keys={<Key>esc</Key>}>Close</Hint>\n          </div>\n        </Fragment>\n      </Sidepanel.Panel>\n    </Sidepanel>\n  );\n}\n\n/** A property row: its name in a 96px column, the value beside it. */\nfunction Property({ label, children }: { label: string; children: ReactNode }) {\n  return (\n    <div className=\"gap-ws-9 flex items-start\">\n      <dt className=\"w-ws-24 typography-body-md text-ws-static-subtle shrink-0\">{label}</dt>\n      <dd className=\"gap-ws-5 typography-body-md text-ws-static-strong flex items-center\">\n        {children}\n      </dd>\n    </div>\n  );\n}\n\n/** The task's history on a line of dots, newest first. */\nfunction ActivityTimeline({ items }: { items: Activity[] }) {\n  return (\n    <ol className=\"gap-ws-12 py-ws-5 flex flex-col\">\n      {items.map((item, index) => (\n        <li key={item.id} className=\"gap-ws-8 relative flex\">\n          {/* Figma's dot (#9a9a9a) and line (#e5e5e5) are unbound: the nearest tokens stand in. */}\n          <span aria-hidden=\"true\" className=\"w-ws-15 pt-ws-6 flex shrink-0 justify-center\">\n            <span className=\"size-ws-5 rounded-ws-control-full relative bg-(--ws-semantic-stroke-neutral)\" />\n          </span>\n          {index < items.length - 1 ? (\n            <span\n              aria-hidden=\"true\"\n              className=\"border-ws-static-subtle left-ws-10 top-ws-11 -bottom-ws-16 absolute border-l\"\n            />\n          ) : null}\n          <div className=\"gap-ws-7 flex min-w-0 flex-1 flex-col\">\n            <div className=\"gap-ws-3 flex flex-col\">\n              <p className=\"gap-ws-3 typography-label-strong-sm text-ws-static-base flex items-center\">\n                {item.text}\n                {item.person ? (\n                  <>\n                    <Avatar size=\"xs\" initials={item.person.initials} color={item.person.color} />\n                    {item.person.name}\n                  </>\n                ) : null}\n              </p>\n              <p className=\"typography-body-md text-ws-static-subtle\">{item.date}</p>\n            </div>\n            {item.subtask ? (\n              <div className=\"bg-ws-static-foreground rounded-ws-container-sm gap-ws-3 px-ws-5 pt-ws-5 pb-ws-7 flex flex-col\">\n                <div className=\"gap-ws-5 p-ws-3 flex items-start\">\n                  <p className=\"typography-label-sm text-ws-static-strong min-w-0 flex-1\">\n                    {item.subtask.title}\n                  </p>\n                  <IconButton\n                    variant=\"secondary\"\n                    preset=\"ghost\"\n                    size=\"xs\"\n                    icon={RiMoreFill}\n                    aria-label={`Actions for ${item.subtask.title}`}\n                  />\n                </div>\n                <div className=\"px-ws-3 flex items-center justify-between\">\n                  <div className=\"gap-ws-3 flex items-center\">\n                    <StatusBadge size=\"sm\">\n                      <StatusBadge.Icon icon={RiUserFill} />\n                      <StatusBadge.Label>{item.subtask.reviewers} reviewers</StatusBadge.Label>\n                    </StatusBadge>\n                    <StatusBadge size=\"sm\">\n                      <StatusBadge.Label>Done by {item.subtask.doneBy}</StatusBadge.Label>\n                    </StatusBadge>\n                  </div>\n                  <StatusBadge size=\"sm\">\n                    <StatusBadge.Icon icon={RiChat2Line} />\n                    <StatusBadge.Label>\n                      {item.subtask.comments}\n                      <span className=\"sr-only\"> comments</span>\n                    </StatusBadge.Label>\n                  </StatusBadge>\n                </div>\n              </div>\n            ) : null}\n          </div>\n        </li>\n      ))}\n    </ol>\n  );\n}\n\n/** A keyboard hint in the footer: the keys, then what they do. */\nfunction Hint({ keys, children }: { keys: ReactNode; children: string }) {\n  return (\n    <span className=\"gap-ws-5 typography-body-md text-ws-static-subtle flex items-center\">\n      {keys}\n      {children}\n    </span>\n  );\n}\n\n/**\n * A key, drawn as Figma draws it here: the box of Button `xs` Border, as a `kbd` (the calendar\n * sidebar's Shortcut is the same idea). An icon key names itself for screen readers.\n */\nfunction Key({\n  icon: Icon,\n  name,\n  children,\n}: {\n  icon?: RemixiconComponentType;\n  name?: string;\n  children?: string;\n}) {\n  return (\n    <kbd\n      className={cn(\n        'font-ws-body border-ws-dynamic-secondary-default bg-ws-static-highlight-subtle shadow-ws-controls-control rounded-ws-control-md h-ws-12 typography-caption-strong-md text-ws-dynamic-secondary-default flex items-center justify-center border',\n        Icon ? 'w-ws-12' : 'px-ws-5',\n      )}\n    >\n      {Icon ? (\n        <>\n          <Icon aria-hidden=\"true\" className=\"size-ws-8 shrink-0\" />\n          <span className=\"sr-only\">{name}</span>\n        </>\n      ) : (\n        children\n      )}\n    </kbd>\n  );\n}\n"
    },
    {
      "path": "src/blocks/gantt/top-bar.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/gantt/top-bar.tsx",
      "content": "'use client';\n\nimport {\n  RiArrowLeftLine,\n  RiBarChartFill,\n  RiBarChartHorizontalFill,\n  RiFolder3Fill,\n  RiInbox2Line,\n  RiNotification3Line,\n  RiSettings4Line,\n} from '@remixicon/react';\nimport { Breadcrumbs } from '@/components/ui/wideset/breadcrumbs/Breadcrumbs';\nimport { IconButton } from '@/components/ui/wideset/button/IconButton';\nimport { SegmentedControl } from '@/components/ui/wideset/segmented-control/SegmentedControl';\n\n/**\n * Figma's Top Navigation for a takeover: back to where the user came from and where this page\n * sits, then the view and the tools. Full-bleed, a line below it.\n */\nexport function TopBar() {\n  return (\n    <header className=\"border-ws-static-base h-ws-19 gap-ws-9 px-ws-11 flex shrink-0 items-center border-b\">\n      <IconButton\n        variant=\"secondary\"\n        preset=\"ghost\"\n        size=\"sm\"\n        icon={RiArrowLeftLine}\n        aria-label=\"Back to projects\"\n      />\n      <Breadcrumbs separator=\"arrow\" className=\"min-w-0 flex-1\">\n        <Breadcrumbs.Item>\n          <RiFolder3Fill aria-hidden=\"true\" className=\"size-ws-9\" />\n          Projects\n        </Breadcrumbs.Item>\n        <Breadcrumbs.Item>Marketing</Breadcrumbs.Item>\n      </Breadcrumbs>\n      <div className=\"gap-ws-9 flex items-center\">\n        <SegmentedControl size=\"sm\" defaultValue=\"timeline\" aria-label=\"View\">\n          <SegmentedControl.Item\n            value=\"timeline\"\n            icon={RiBarChartHorizontalFill}\n            aria-label=\"Timeline\"\n          />\n          <SegmentedControl.Item value=\"chart\" icon={RiBarChartFill} aria-label=\"Chart\" />\n        </SegmentedControl>\n        <div className=\"gap-ws-3 flex items-center\">\n          {[\n            { icon: RiNotification3Line, label: 'Notifications' },\n            { icon: RiInbox2Line, label: 'Inbox' },\n            { icon: RiSettings4Line, label: 'Settings' },\n          ].map(({ icon, label }) => (\n            <IconButton\n              key={label}\n              variant=\"secondary\"\n              preset=\"ghost\"\n              size=\"sm\"\n              icon={icon}\n              aria-label={label}\n            />\n          ))}\n        </div>\n      </div>\n    </header>\n  );\n}\n"
    }
  ],
  "meta": {
    "version": "1.1.0",
    "commit": "a734f9f0"
  }
}
