{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "block-task-sidepanel",
  "type": "registry:block",
  "title": "Task side panel",
  "description": "A record’s detail beside the page: its properties, subtasks, tabs over an activity timeline, and keyboard hints.",
  "dependencies": [
    "@remixicon/react@^4.9.0"
  ],
  "registryDependencies": [
    "https://wideset.co/r/avatar.json",
    "https://wideset.co/r/block-styles.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/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/task-sidepanel/data.ts",
      "type": "registry:file",
      "target": "blocks/wideset/task-sidepanel/data.ts",
      "content": "import type { Person, TaskDetail } from './task-sidepanel';\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 panel opens on. */\nexport const task: 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/task-sidepanel/index.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/task-sidepanel/index.tsx",
      "content": "'use client';\n\nimport '@/styles/wideset-blocks.css';\n\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { useState } from 'react';\n\nimport { task } from './data';\nimport { TaskSidepanel } from './task-sidepanel';\n\n/** Task side panel: a record's detail beside the page, here over an empty page that reopens it. */\nexport default function TaskSidepanelBlock() {\n  const [open, setOpen] = useState(true);\n\n  return (\n    <div className=\"ws-block-utility bg-ws-static-foreground flex h-dvh items-center justify-center\">\n      <Button variant=\"secondary\" preset=\"border\" onClick={() => setOpen(true)}>\n        Open task\n      </Button>\n      <TaskSidepanel task={task} open={open} onOpenChange={setOpen} />\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/task-sidepanel/task-sidepanel.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/task-sidepanel/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"
    }
  ],
  "meta": {
    "version": "1.1.0",
    "commit": "a734f9f0"
  }
}
