{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "block-communication",
  "type": "registry:block",
  "title": "Communication",
  "description": "A messaging app in three panels: the chat list, the conversation and the contact details.",
  "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/button.json",
    "https://wideset.co/r/chip.json",
    "https://wideset.co/r/divider.json",
    "https://wideset.co/r/dropdown-menu.json",
    "https://wideset.co/r/icon-button.json",
    "https://wideset.co/r/list-item.json",
    "https://wideset.co/r/progress-bar.json",
    "https://wideset.co/r/radio-button.json",
    "https://wideset.co/r/segmented-control.json",
    "https://wideset.co/r/sidebar.json",
    "https://wideset.co/r/slider.json",
    "https://wideset.co/r/split-button.json",
    "https://wideset.co/r/tabs.json",
    "https://wideset.co/r/tag.json",
    "https://wideset.co/r/text-input.json",
    "https://wideset.co/r/textarea.json",
    "https://wideset.co/r/toast.json",
    "https://wideset.co/r/tooltip.json",
    "https://wideset.co/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/communication/brand-mark.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/communication/brand-mark.tsx",
      "content": "'use client';\n\nimport { cn } from '@/lib/wideset/utils';\n\nconst TILE =\n  'M0 16C0 8.45753 0 4.68629 2.34315 2.34315C4.68629 0 8.45753 0 16 0C23.5425 0 27.3137 0 29.6569 2.34315C32 4.68629 32 8.45753 32 16C32 23.5425 32 27.3137 29.6569 29.6569C27.3137 32 23.5425 32 16 32C8.45753 32 4.68629 32 2.34315 29.6569C0 27.3137 0 23.5425 0 16Z';\nconst W =\n  'M21.6907 12C21.6907 12 19.618 17.322 19.5381 17.5183C19.4954 17.4215 17.1775 12 17.1775 12H15.0877C15.0877 12 12.7755 17.5183 12.7413 17.5916C12.7042 17.5157 10.2409 12 10.2409 12H8L11.7434 20H13.8047L16.1483 14.3403H16.1853C16.211 14.3953 18.5802 20 18.5802 20H20.7042C20.7042 20 23.9772 12.0707 24 12.0052L21.6935 12H21.6907Z';\n\n/**\n * The Wideset mark: a W on the inverse tile, Figma's workspace Thumbnail. It takes the size of\n * its place (32px in a sidebar or top bar, 36px in a larger switcher) and inverts in dark mode.\n * Decorative beside the product's name; give it a `label` when it stands alone.\n */\nexport function BrandMark({ className, label }: { className?: string; label?: string }) {\n  return (\n    <svg\n      viewBox=\"0 0 32 32\"\n      role={label ? 'img' : undefined}\n      aria-label={label}\n      aria-hidden={label ? undefined : true}\n      className={cn('size-ws-14 shrink-0', className)}\n    >\n      <path d={TILE} className=\"fill-(--ws-static-fill-inverse-background)\" />\n      <path d={W} className=\"fill-(--ws-static-text-inverse-strong)\" />\n    </svg>\n  );\n}\n"
    },
    {
      "path": "src/blocks/communication/chat-list.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/communication/chat-list.tsx",
      "content": "'use client';\n\nimport { RiCheckLine, RiFunctionFill, RiListUnordered, RiSearchLine } from '@remixicon/react';\nimport { Avatar } from '@/components/ui/wideset/avatar/Avatar';\nimport { Chip } from '@/components/ui/wideset/chip/Chip';\nimport { cn } from '@/lib/wideset/utils';\nimport { SegmentedControl } from '@/components/ui/wideset/segmented-control/SegmentedControl';\nimport { TextInput } from '@/components/ui/wideset/text-input/TextInput';\nimport { useState } from 'react';\n\nimport { type Chat, chats, type Person } from './data';\n\n/** A 3px dot between a name and a time. */\nexport const Dot = () => (\n  <span\n    aria-hidden=\"true\"\n    className=\"bg-ws-static-alpha-strong rounded-ws-control-full size-[3px] shrink-0\"\n  />\n);\n\n/** An avatar for a person; one without initials shows the default user icon. */\nexport function PersonAvatar({\n  person,\n  size,\n  label = person.name,\n}: {\n  person: Person;\n  size: 'xs' | 'sm' | 'md' | 'lg' | '2xl';\n  label?: string;\n}) {\n  const common = { size, status: person.status, 'aria-label': label };\n  return person.initials ? (\n    <Avatar {...common} initials={person.initials} color={person.color} />\n  ) : (\n    <Avatar {...common} />\n  );\n}\n\n/** One avatar, or two overlapping for a group chat. */\nfunction ChatAvatar({ people }: { people: Person[] }) {\n  if (people.length === 1) return <PersonAvatar person={people[0]} size=\"lg\" />;\n  return (\n    <span className=\"size-ws-16 relative flex shrink-0\">\n      <span className=\"top-ws-0 left-ws-0 absolute flex\">\n        <PersonAvatar person={people[0]} size=\"sm\" />\n      </span>\n      <span className=\"right-ws-0 bottom-ws-0 absolute flex\">\n        <PersonAvatar person={people[1]} size=\"sm\" />\n      </span>\n    </span>\n  );\n}\n\nfunction ChatRow({\n  chat,\n  selected,\n  onSelect,\n}: {\n  chat: Chat;\n  selected: boolean;\n  onSelect: () => void;\n}) {\n  const PreviewIcon = chat.previewIcon;\n  return (\n    <button\n      type=\"button\"\n      aria-current={selected || undefined}\n      onClick={onSelect}\n      className=\"gap-ws-7 px-ws-8 py-ws-5 rounded-ws-control-lg hover:bg-ws-dynamic-tertiary-alpha-strong-default aria-[current=true]:bg-ws-dynamic-primary-alpha-strong-default focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default flex w-full items-center text-left\"\n    >\n      <ChatAvatar people={chat.people} />\n      <span className=\"flex min-w-0 flex-1 flex-col\">\n        <span className=\"gap-ws-3 flex items-center\">\n          <span className=\"typography-label-strong-sm text-ws-static-strong truncate\">\n            {chat.title}\n          </span>\n          <Dot />\n          <span className=\"typography-body-sm text-ws-static-subtle shrink-0\">{chat.time}</span>\n        </span>\n        <span className=\"gap-ws-5 flex items-center\">\n          <span\n            className={cn(\n              'typography-body-md gap-ws-3 flex min-w-0 items-center',\n              chat.missed ? 'text-ws-semantic-negative' : 'text-ws-static-subtle',\n            )}\n          >\n            {PreviewIcon && <PreviewIcon aria-hidden=\"true\" className=\"size-ws-9 shrink-0\" />}\n            <span className=\"truncate\">{chat.preview}</span>\n          </span>\n          {chat.unread && (\n            <span className=\"bg-ws-non-semantic-indigo-strong rounded-ws-control-full size-ws-4 mr-ws-3 ml-auto shrink-0\">\n              <span className=\"sr-only\">Unread</span>\n            </span>\n          )}\n          {chat.seenBy && (\n            <span className=\"ml-auto flex shrink-0\">\n              <PersonAvatar person={chat.seenBy} label={`Seen by ${chat.seenBy.name}`} size=\"xs\" />\n            </span>\n          )}\n        </span>\n      </span>\n    </button>\n  );\n}\n\n/** The chat list panel: filter, search, conversations and a list/grid switch. */\nexport function ChatList() {\n  const [filter, setFilter] = useState<'open' | 'archive'>('open');\n  const [selected, setSelected] = useState('business');\n  const [layout, setLayout] = useState('list');\n\n  return (\n    <section\n      aria-labelledby=\"chats-title\"\n      className=\"border-ws-static-subtle flex w-[20.6875rem] shrink-0 flex-col border-r\"\n    >\n      <header className=\"gap-ws-9 px-ws-11 h-ws-19 border-ws-static-base flex shrink-0 items-center border-b\">\n        <h2 id=\"chats-title\" className=\"typography-label-strong-md text-ws-static-strong\">\n          Chats\n        </h2>\n        <div className=\"gap-ws-3 flex\">\n          {(['open', 'archive'] as const).map((value) => (\n            <Chip key={value} variant=\"secondary\" style={filter === value ? 'filled' : 'border'}>\n              <Chip.Action aria-pressed={filter === value} onClick={() => setFilter(value)}>\n                {filter === value && <Chip.Icon icon={RiCheckLine} />}\n                <Chip.Label>{value === 'open' ? 'Open' : 'Archive'}</Chip.Label>\n              </Chip.Action>\n            </Chip>\n          ))}\n        </div>\n      </header>\n\n      <div className=\"gap-ws-5 px-ws-3 pt-ws-8 ws-scrollbar flex min-h-0 flex-1 flex-col overflow-y-auto\">\n        <div className=\"px-ws-8\">\n          <TextInput size=\"sm\">\n            <TextInput.Prefix inner>\n              <TextInput.Icon icon={RiSearchLine} />\n            </TextInput.Prefix>\n            <TextInput.Input type=\"search\" placeholder=\"Search\" aria-label=\"Search chats\" />\n          </TextInput>\n        </div>\n        <ul className=\"flex flex-col\">\n          {chats.map((chat) => (\n            <li key={chat.id}>\n              <ChatRow\n                chat={chat}\n                selected={selected === chat.id}\n                onSelect={() => setSelected(chat.id)}\n              />\n            </li>\n          ))}\n          {/* More chats loading. */}\n          {[1, 2, 3].map((row) => (\n            <li key={row} aria-hidden=\"true\" className=\"gap-ws-7 px-ws-8 py-ws-5 flex items-center\">\n              <span className=\"size-ws-16 bg-ws-static-alpha-base rounded-ws-control-full shrink-0\" />\n              <span className=\"gap-ws-4 flex flex-col\">\n                <span className=\"h-ws-5 bg-ws-static-alpha-base rounded-ws-control-lg w-[4.8125rem]\" />\n                <span className=\"h-ws-5 bg-ws-static-alpha-base rounded-ws-control-lg w-[10.125rem]\" />\n              </span>\n            </li>\n          ))}\n        </ul>\n        <p role=\"status\" className=\"sr-only\">\n          Loading more chats\n        </p>\n      </div>\n\n      <footer className=\"p-ws-5 shrink-0\">\n        <SegmentedControl size=\"sm\" value={layout} onValueChange={setLayout} aria-label=\"Layout\">\n          <SegmentedControl.Item value=\"list\" icon={RiListUnordered} aria-label=\"List\" />\n          <SegmentedControl.Item value=\"grid\" icon={RiFunctionFill} aria-label=\"Grid\" />\n        </SegmentedControl>\n      </footer>\n    </section>\n  );\n}\n"
    },
    {
      "path": "src/blocks/communication/contact-panel.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/communication/contact-panel.tsx",
      "content": "'use client';\n\nimport {\n  type RemixiconComponentType,\n  RiArchive2Line,\n  RiArrowDownSLine,\n  RiArrowGoBackLine,\n  RiArrowRightUpLine,\n  RiBold,\n  RiCloseLargeFill,\n  RiFlagLine,\n  RiFlashlightFill,\n  RiImageLine,\n  RiItalic,\n  RiLinkM,\n  RiListOrdered,\n  RiListUnordered,\n  RiTimeLine,\n  RiUnderline,\n} from '@remixicon/react';\nimport { Avatar } from '@/components/ui/wideset/avatar/Avatar';\nimport { Button } from '@/components/ui/wideset/button/Button';\nimport { Divider } from '@/components/ui/wideset/divider/Divider';\nimport { DropdownMenu } from '@/components/ui/wideset/dropdown/DropdownMenu';\nimport { IconButton } from '@/components/ui/wideset/button/IconButton';\nimport { ListItem } from '@/components/ui/wideset/list-item/ListItem';\nimport { SplitButton } from '@/components/ui/wideset/button/SplitButton';\nimport { Tabs } from '@/components/ui/wideset/tabs/Tabs';\nimport { Tag } from '@/components/ui/wideset/tag/Tag';\nimport { Textarea } from '@/components/ui/wideset/textarea/Textarea';\n\nimport { conversation } from './data';\n\nconst ghost = { variant: 'secondary', preset: 'ghost', size: 'sm' } as const;\n\n/** Figma's Text Area `Formatting Bar=true`, in groups split by a line. */\nconst FORMATTING: { icon: RemixiconComponentType; label: string }[][] = [\n  [\n    { icon: RiBold, label: 'Bold' },\n    { icon: RiItalic, label: 'Italic' },\n    { icon: RiUnderline, label: 'Underline' },\n  ],\n  [\n    { icon: RiListUnordered, label: 'Bulleted list' },\n    { icon: RiListOrdered, label: 'Numbered list' },\n  ],\n  [\n    { icon: RiImageLine, label: 'Insert image' },\n    { icon: RiLinkM, label: 'Insert link' },\n  ],\n];\n\nconst TABS = ['Media', 'Activity', 'Notes', 'More'];\n\n/** The contact beside the chat: who it is, shared media, a note and the chat's actions. */\nexport function ContactPanel({\n  onClose,\n  onArchive,\n  note,\n  onNoteChange,\n}: {\n  onClose: () => void;\n  onArchive: () => void;\n  /** The note lives with the page, so closing the details does not lose it. */\n  note: string;\n  onNoteChange: (note: string) => void;\n}) {\n  const { contact } = conversation;\n\n  return (\n    <aside aria-labelledby=\"contact-name\" className=\"flex w-[20.6875rem] shrink-0 flex-col\">\n      <header className=\"px-ws-11 h-ws-19 border-ws-static-base flex shrink-0 items-center justify-between border-b\">\n        <SplitButton\n          variant=\"secondary\"\n          size=\"sm\"\n          icon={RiArrowDownSLine}\n          iconAriaLabel=\"Save to a list\"\n          menuContent={\n            <>\n              <DropdownMenu.Item>\n                <ListItem.Content>\n                  <ListItem.Label>Favourites</ListItem.Label>\n                </ListItem.Content>\n              </DropdownMenu.Item>\n              <DropdownMenu.Item>\n                <ListItem.Content>\n                  <ListItem.Label>Clients</ListItem.Label>\n                </ListItem.Content>\n              </DropdownMenu.Item>\n            </>\n          }\n        >\n          Save to\n        </SplitButton>\n        <IconButton\n          {...ghost}\n          icon={RiCloseLargeFill}\n          aria-label=\"Close details\"\n          onClick={onClose}\n        />\n      </header>\n\n      <div className=\"gap-ws-14 pt-ws-14 ws-scrollbar flex min-h-0 flex-1 flex-col overflow-y-auto\">\n        <div className=\"gap-ws-9 flex flex-col items-center\">\n          <Avatar size=\"2xl\" initials={contact.initials} color={contact.color} />\n          <div className=\"gap-ws-2 flex flex-col items-center\">\n            <h2 id=\"contact-name\" className=\"typography-subtitle-md text-ws-static-strong\">\n              {contact.name}\n            </h2>\n            <Tag size=\"sm\" color=\"lime\">\n              <Tag.Icon icon={RiFlashlightFill} />\n              Verified\n            </Tag>\n          </div>\n          <div className=\"gap-ws-5 flex\">\n            <IconButton {...ghost} icon={RiArrowGoBackLine} aria-label=\"Reply\" />\n            <IconButton {...ghost} icon={RiTimeLine} aria-label=\"History\" />\n            <IconButton\n              {...ghost}\n              icon={RiArchive2Line}\n              aria-label=\"Archive chat\"\n              onClick={onArchive}\n            />\n          </div>\n        </div>\n\n        <div className=\"gap-ws-13 px-ws-5 flex flex-col\">\n          <Tabs type=\"fullWidth\" defaultValue=\"Media\" className=\"gap-ws-5\">\n            <Tabs.List aria-label=\"Contact details\">\n              {TABS.map((tab) => (\n                <Tabs.Item key={tab} value={tab}>\n                  <Tabs.Label>{tab}</Tabs.Label>\n                </Tabs.Item>\n              ))}\n            </Tabs.List>\n            <Tabs.Content value=\"Media\">\n              {/* Shared photos; grey placeholders until the files load. */}\n              <ul aria-label=\"Shared media\" className=\"gap-ws-3 flex\">\n                {[1, 2, 3].map((item) => (\n                  <li\n                    key={item}\n                    className=\"size-ws-22 bg-ws-static-alpha-base rounded-ws-container-sm\"\n                  >\n                    <span className=\"sr-only\">Photo {item}</span>\n                  </li>\n                ))}\n              </ul>\n            </Tabs.Content>\n            {TABS.slice(1).map((tab) => (\n              <Tabs.Content\n                key={tab}\n                value={tab}\n                className=\"typography-body-md text-ws-static-subtle\"\n              >\n                Nothing in {tab.toLowerCase()} yet.\n              </Tabs.Content>\n            ))}\n          </Tabs>\n\n          <div className=\"gap-ws-5 flex flex-col\">\n            <label\n              htmlFor=\"contact-note\"\n              className=\"typography-label-strong-sm text-ws-static-strong\"\n            >\n              Add a note\n            </label>\n            <div role=\"toolbar\" aria-label=\"Formatting\" className=\"flex items-center\">\n              {FORMATTING.map((group, index) => (\n                <div key={group[0].label} className=\"flex items-center\">\n                  {index > 0 && (\n                    <span\n                      aria-hidden=\"true\"\n                      className=\"mx-ws-5 h-ws-9 border-ws-static-base border-l\"\n                    />\n                  )}\n                  {group.map(({ icon, label }) => (\n                    <IconButton key={label} {...ghost} icon={icon} aria-label={label} />\n                  ))}\n                </div>\n              ))}\n            </div>\n            <Textarea\n              id=\"contact-note\"\n              placeholder=\"Add a note\"\n              rows={3}\n              value={note}\n              onChange={(event) => onNoteChange(event.target.value)}\n            />\n          </div>\n        </div>\n      </div>\n\n      <div className=\"gap-ws-5 pb-ws-5 flex shrink-0 flex-col\">\n        <Divider weight=\"bold\" emphasis=\"subtle\" />\n        <div className=\"px-ws-5 flex flex-col\">\n          <Button {...ghost} className=\"w-full justify-start\" onClick={onArchive}>\n            <Button.Icon icon={RiArchive2Line} />\n            Archive\n          </Button>\n          <Button {...ghost} className=\"w-full justify-start\">\n            <Button.Icon icon={RiFlagLine} />\n            Report\n          </Button>\n          <Button variant=\"danger\" preset=\"ghost\" size=\"sm\" className=\"w-full justify-start\">\n            <Button.Icon icon={RiArrowRightUpLine} />\n            Leave conversation\n          </Button>\n        </div>\n      </div>\n    </aside>\n  );\n}\n"
    },
    {
      "path": "src/blocks/communication/conversation.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/communication/conversation.tsx",
      "content": "'use client';\n\nimport {\n  type RemixiconComponentType,\n  RiArchive2Line,\n  RiArrowGoBackLine,\n  RiAttachment2,\n  RiChat3Line,\n  RiDeleteBin6Line,\n  RiEmotion2Line,\n  RiMoreFill,\n  RiPauseMiniFill,\n  RiPlayMiniFill,\n  RiSendPlaneFill,\n  RiSidebarUnfoldLine,\n  RiTimeLine,\n} from '@remixicon/react';\nimport { Avatar } from '@/components/ui/wideset/avatar/Avatar';\nimport { cn } from '@/lib/wideset/utils';\nimport { IconButton } from '@/components/ui/wideset/button/IconButton';\nimport { RadioButton } from '@/components/ui/wideset/radio-button/RadioButton';\nimport { RadioButtonGroup } from '@/components/ui/wideset/radio-button/RadioButtonGroup';\nimport { Slider } from '@/components/ui/wideset/slider/Slider';\nimport { Textarea } from '@/components/ui/wideset/textarea/Textarea';\nimport { Tooltip } from '@/components/ui/wideset/tooltip/Tooltip';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { Dot, PersonAvatar } from './chat-list';\nimport { conversation, type Message, messages } from './data';\n\nconst MAX_LENGTH = 500;\n\nconst Action = ({\n  icon,\n  label,\n  onClick,\n}: {\n  icon: RemixiconComponentType;\n  label: string;\n  onClick?: () => void;\n}) => (\n  <IconButton\n    icon={icon}\n    variant=\"secondary\"\n    preset=\"ghost\"\n    size=\"sm\"\n    aria-label={label}\n    onClick={onClick}\n  />\n);\n\n/** Figma's audio message: play, a seek bar and the length. */\nfunction AudioMessage({ duration, progress }: { duration: string; progress: number }) {\n  const [playing, setPlaying] = useState(false);\n  return (\n    <div className=\"bg-ws-dynamic-primary-alpha-strong-default rounded-ws-container-sm px-ws-5 py-ws-7 gap-ws-5 flex w-[15.9375rem] items-center\">\n      <IconButton\n        icon={playing ? RiPauseMiniFill : RiPlayMiniFill}\n        size=\"xs\"\n        aria-label={playing ? 'Pause' : 'Play'}\n        onClick={() => setPlaying(!playing)}\n      />\n      <Slider defaultValue={[progress]} aria-label=\"Playback position\" className=\"min-w-0 flex-1\" />\n      <span className=\"typography-body-sm text-ws-static-subtle tabular-nums\">{duration}</span>\n    </div>\n  );\n}\n\nfunction Poll({\n  question,\n  options,\n  votes,\n}: {\n  question: string;\n  options: string[];\n  votes: number;\n}) {\n  return (\n    <div className=\"bg-ws-static-alpha-subtle rounded-ws-container-sm p-ws-5 gap-ws-5 flex w-[16.5625rem] flex-col\">\n      <p className=\"typography-body-md text-ws-static-base\">{question}</p>\n      <RadioButtonGroup aria-label={question} className=\"gap-ws-2\">\n        {options.map((option) => (\n          <div\n            key={option}\n            className=\"bg-ws-static-alpha-subtle rounded-ws-container-sm px-ws-5 py-ws-4\"\n          >\n            <RadioButton size=\"sm\" value={option} label={option} />\n          </div>\n        ))}\n      </RadioButtonGroup>\n      <p className=\"typography-body-sm text-ws-static-subtle gap-ws-3 flex items-center justify-end\">\n        {votes} votes\n        <Dot />\n        Vote to see results\n      </p>\n    </div>\n  );\n}\n\n/** A message: received on the left beside the sender, sent on the right in the brand tint. */\nfunction MessageItem({ message }: { message: Message }) {\n  const { from } = message;\n  const body =\n    message.kind === 'audio' ? (\n      <AudioMessage duration={message.duration} progress={message.progress} />\n    ) : message.kind === 'poll' ? (\n      <Poll question={message.question} options={message.options} votes={message.votes} />\n    ) : (\n      <p\n        className={cn(\n          'rounded-ws-container-sm p-ws-5 typography-body-md max-w-[22.25rem] break-words',\n          from\n            ? 'bg-ws-static-alpha-subtle text-ws-static-base'\n            : 'bg-ws-dynamic-primary-alpha-strong-default text-ws-non-semantic-indigo-on-subtle',\n        )}\n      >\n        {message.text}\n      </p>\n    );\n\n  return (\n    <li className={cn('group flex', !from && 'justify-end')}>\n      <div className=\"gap-ws-3 flex flex-col items-start\">\n        <div className=\"gap-ws-5 relative flex items-end\">\n          {from && <PersonAvatar person={from} size=\"sm\" />}\n          {body}\n          {/* The message's actions, beside the bubble on hover or focus. */}\n          <div\n            className={cn(\n              'gap-ws-5 absolute top-1/2 flex -translate-y-1/2 opacity-0 group-focus-within:opacity-100 group-hover:opacity-100',\n              from ? 'ml-ws-5 left-full' : 'mr-ws-5 right-full',\n            )}\n          >\n            <Action icon={RiDeleteBin6Line} label=\"Delete message\" />\n            <Action icon={RiMoreFill} label=\"More actions\" />\n          </div>\n        </div>\n        {message.kind !== 'poll' && (\n          <p\n            className={cn(\n              'typography-body-sm text-ws-static-subtle gap-ws-3 flex items-center',\n              from && 'pl-ws-14',\n            )}\n          >\n            {message.time}\n            {from && (\n              <>\n                <span aria-hidden=\"true\">•</span>\n                {from.name}\n              </>\n            )}\n          </p>\n        )}\n      </div>\n    </li>\n  );\n}\n\n/** The open chat: header with actions, the messages and the composer. */\nexport function Conversation({\n  onArchive,\n  onShowDetails,\n}: {\n  onArchive: () => void;\n  /** Set while the contact panel is closed: shows a button that opens it again. */\n  onShowDetails?: () => void;\n}) {\n  const [thread, setThread] = useState(messages);\n  const [draft, setDraft] = useState('');\n  const scroller = useRef<HTMLDivElement>(null);\n\n  // Keep the newest message in view.\n  useEffect(() => {\n    if (scroller.current) scroller.current.scrollTop = scroller.current.scrollHeight;\n  }, [thread.length]);\n\n  const send = (event: { preventDefault: () => void }) => {\n    event.preventDefault();\n    const text = draft.trim();\n    if (!text) return;\n    setThread([...thread, { id: String(Date.now()), kind: 'text', time: 'Just now', text }]);\n    setDraft('');\n  };\n\n  return (\n    <section\n      aria-labelledby=\"conversation-title\"\n      className=\"border-ws-static-subtle flex min-w-0 flex-1 flex-col border-r\"\n    >\n      <header className=\"gap-ws-9 px-ws-11 h-ws-19 border-ws-static-base flex shrink-0 items-center border-b\">\n        <div className=\"gap-ws-7 flex min-w-0 items-center\">\n          <Avatar.Group className=\"w-fit\">\n            {conversation.people.map(({ name, initials, color, status }) => (\n              <Avatar\n                key={name}\n                initials={initials}\n                color={color}\n                status={status}\n                aria-label={name}\n              />\n            ))}\n          </Avatar.Group>\n          <h2\n            id=\"conversation-title\"\n            className=\"typography-label-strong-md text-ws-static-strong truncate\"\n          >\n            {conversation.title}\n          </h2>\n        </div>\n        <div className=\"gap-ws-5 ml-auto flex items-center\">\n          <Action icon={RiArrowGoBackLine} label=\"Reply\" />\n          <Tooltip size=\"sm\">\n            <Tooltip.Trigger asChild>\n              <IconButton\n                icon={RiTimeLine}\n                variant=\"secondary\"\n                preset=\"ghost\"\n                size=\"sm\"\n                aria-label=\"History\"\n                aria-keyshortcuts=\"Meta+H\"\n              />\n            </Tooltip.Trigger>\n            <Tooltip.Content className=\"ws-block-utility\" side=\"bottom\">\n              <Tooltip.Label>History ⌘H</Tooltip.Label>\n            </Tooltip.Content>\n          </Tooltip>\n          <Action icon={RiArchive2Line} label=\"Archive chat\" onClick={onArchive} />\n          <Action icon={RiDeleteBin6Line} label=\"Delete\" />\n          <Action icon={RiMoreFill} label=\"More actions\" />\n          {onShowDetails && (\n            <Action icon={RiSidebarUnfoldLine} label=\"Show details\" onClick={onShowDetails} />\n          )}\n        </div>\n      </header>\n\n      <div ref={scroller} className=\"ws-scrollbar min-h-0 flex-1 overflow-y-auto\">\n        <ol\n          aria-label=\"Messages\"\n          className=\"p-ws-9 gap-ws-7 mx-auto flex w-full max-w-[48rem] flex-col\"\n        >\n          {thread.map((message) => (\n            <MessageItem key={message.id} message={message} />\n          ))}\n        </ol>\n      </div>\n\n      <form onSubmit={send} className=\"p-ws-5 mx-auto w-full max-w-[48rem] shrink-0\">\n        <div className=\"bg-ws-static-alpha-subtle rounded-ws-container-lg p-ws-3 gap-ws-3 flex flex-col\">\n          <div className=\"px-ws-4 flex items-center justify-between\">\n            <div className=\"gap-ws-2 flex\">\n              <Action icon={RiAttachment2} label=\"Attach a file\" />\n              <Action icon={RiEmotion2Line} label=\"Add an emoji\" />\n              <Action icon={RiChat3Line} label=\"Reply in a thread\" />\n            </div>\n            <span className=\"typography-label-sm text-ws-static-subtle tabular-nums\">\n              {draft.length}/{MAX_LENGTH}\n            </span>\n          </div>\n          <div className=\"relative\">\n            <Textarea\n              aria-label=\"Message\"\n              placeholder=\"Write a message...\"\n              rows={6}\n              resize=\"none\"\n              maxLength={MAX_LENGTH}\n              value={draft}\n              onChange={(event) => setDraft(event.target.value)}\n              onKeyDown={(event) => {\n                // Shift + Enter keeps the new line; Enter that confirms an IME word is not a send.\n                if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing) {\n                  send(event);\n                }\n              }}\n            />\n            <IconButton\n              type=\"submit\"\n              icon={RiSendPlaneFill}\n              variant=\"secondary\"\n              size=\"sm\"\n              aria-label=\"Send\"\n              className=\"right-ws-4 bottom-ws-4 absolute\"\n            />\n          </div>\n        </div>\n      </form>\n    </section>\n  );\n}\n"
    },
    {
      "path": "src/blocks/communication/data.ts",
      "type": "registry:file",
      "target": "blocks/wideset/communication/data.ts",
      "content": "import {\n  type RemixiconComponentType,\n  RiArrowRightUpLine,\n  RiAttachment2,\n  RiCalendarLine,\n  RiChat1Line,\n  RiContactsBook2Line,\n  RiFirefoxLine,\n  RiInboxFill,\n  RiNotification3Line,\n  RiSettings2Line,\n} from '@remixicon/react';\nimport type { AvatarColor } from '@/components/ui/wideset/avatar/Avatar.colors';\n\nexport type Person = {\n  name: string;\n  /** Left out, the avatar shows the default user icon. */\n  initials?: string;\n  color?: AvatarColor;\n  status?: 'online' | 'offline';\n};\n\nexport const workspace = { name: 'Wideset', initials: 'W' };\n\nconst adam = { name: 'Adam Smith', initials: 'AS', color: 'indigo', status: 'online' } as const;\nconst diana = { name: 'Diana Ross', initials: 'DR', color: 'yellow', status: 'online' } as const;\nconst robert = { name: 'Robert Redford', initials: 'RR', color: 'blue', status: 'online' } as const;\nconst melania = { name: 'Melania Jackson', initials: 'MJ', color: 'orange' } as const;\nconst dana: Person = { name: 'Dana Right' };\n\n/** The signed-in user. */\nexport const account = { ...adam, role: 'Admin', email: 'hello@wideset.co' };\n\nexport const navigation: {\n  id: string;\n  label: string;\n  icon: RemixiconComponentType;\n  count?: number;\n}[] = [\n  { id: 'inbox', label: 'Inbox', icon: RiInboxFill, count: 245 },\n  { id: 'activity', label: 'Activity', icon: RiNotification3Line },\n  { id: 'calendars', label: 'Calendars', icon: RiCalendarLine },\n  { id: 'chats', label: 'Chats', icon: RiChat1Line },\n  { id: 'contacts', label: 'Contacts', icon: RiContactsBook2Line },\n  { id: 'settings', label: 'Settings', icon: RiSettings2Line },\n];\n\nexport const spaces = [{ id: 'firefox', label: 'Firefox', icon: RiFirefoxLine }];\n\nexport type CategoryColor = 'indigo' | 'blue' | 'cyan';\n\nexport const categories: { id: string; label: string; color: CategoryColor; count: number }[] = [\n  { id: 'social', label: 'Social', color: 'indigo', count: 18 },\n  { id: 'advertisement', label: 'Advertisement', color: 'blue', count: 4 },\n  { id: 'private', label: 'Private', color: 'cyan', count: 3 },\n];\n\nexport type Chat = {\n  id: string;\n  title: string;\n  /** One person, or two for a group (drawn overlapping). */\n  people: Person[];\n  time: string;\n  preview: string;\n  previewIcon?: RemixiconComponentType;\n  /** A missed call reads in the negative colour. */\n  missed?: boolean;\n  unread?: boolean;\n  /** Who has read the last message, shown at the row's end. */\n  seenBy?: Person;\n};\n\nexport const chats: Chat[] = [\n  {\n    id: 'adam',\n    title: 'Adam Smith',\n    people: [adam],\n    time: '4:40 PM',\n    preview: 'Thanks for using our services and for the kind words!',\n    unread: true,\n  },\n  {\n    id: 'business',\n    title: 'Diana, Robert',\n    people: [{ name: 'Guest', status: 'online' }, diana],\n    time: '4:38 PM',\n    preview: 'Hello Anna 💪 We’re proud of what the team shipped this week.',\n  },\n  {\n    id: 'melania',\n    title: 'Melania Jackson',\n    people: [melania],\n    time: '4:20 PM',\n    preview: 'You called',\n    previewIcon: RiArrowRightUpLine,\n    seenBy: diana,\n  },\n  {\n    id: 'melania-missed',\n    title: 'Melania Jackson',\n    people: [melania],\n    time: 'Yesterday',\n    preview: 'Missed call',\n    missed: true,\n  },\n  {\n    id: 'robert',\n    title: 'Robert Redford',\n    people: [{ ...robert, status: 'offline' }],\n    time: 'Monday',\n    preview: 'You called',\n  },\n  {\n    id: 'adam-files',\n    title: 'Adam Smith',\n    people: [adam],\n    time: 'Sunday',\n    preview: '3 attachments',\n    previewIcon: RiAttachment2,\n  },\n];\n\n/** The chat open in the middle, and the contact shown on the right. */\nexport const conversation = { title: 'Business Chat', people: [diana, robert], contact: robert };\n\nexport type Message = { id: string; from?: Person; time: string } & (\n  | { kind: 'text'; text: string }\n  | { kind: 'audio'; duration: string; progress: number }\n  | { kind: 'poll'; question: string; options: string[]; votes: number }\n);\n\n/** A message without `from` is one the signed-in user sent. */\nexport const messages: Message[] = [\n  {\n    id: '1',\n    kind: 'text',\n    from: adam,\n    time: '2 min ago',\n    text: 'Hey, did you get a chance to review the latest draft of the proposal? 😅',\n  },\n  {\n    id: '2',\n    kind: 'text',\n    time: '2 min ago',\n    text: 'Yeah, I finished it last night. Just cleaning up a few slides. 😊',\n  },\n  {\n    id: '3',\n    kind: 'text',\n    from: adam,\n    time: '2 min ago',\n    text: 'Nice. I thought the structure worked well — especially the client timeline. 😎',\n  },\n  {\n    id: '4',\n    kind: 'text',\n    from: dana,\n    time: '2 min ago',\n    text: 'Agreed. Maybe break it into two slides or add some visuals? 😏',\n  },\n  { id: '5', kind: 'audio', time: '2 min ago', duration: '2:45', progress: 50 },\n  {\n    id: '6',\n    kind: 'poll',\n    from: dana,\n    time: '1 min ago',\n    question: 'What do you want to eat?',\n    options: ['🍕 Pizza', '🍔 Burger'],\n    votes: 2,\n  },\n];\n\n/** The plan usage shown in the account menu. */\nexport const usage = { label: 'Views', used: 8495, limit: 12000, resets: 'Usage resets: 14 days' };\n"
    },
    {
      "path": "src/blocks/communication/index.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/communication/index.tsx",
      "content": "'use client';\n\nimport '@/styles/wideset-blocks.css';\n\nimport { AppShell } from '@/components/ui/wideset/app-shell/AppShell';\nimport { Toast } from '@/components/ui/wideset/toast/Toast';\nimport { ToastProvider, useToast } from '@/components/ui/wideset/toast/Toast.context';\nimport { useState } from 'react';\n\nimport { ChatList } from './chat-list';\nimport { ContactPanel } from './contact-panel';\nimport { Conversation } from './conversation';\nimport { conversation } from './data';\nimport { CommunicationSidebar } from './sidebar';\n\n/** The page: three panels split by lines, the contact panel closable. */\nfunction Panels() {\n  const { showToast, dismissToast } = useToast();\n  const [details, setDetails] = useState(true);\n  const [note, setNote] = useState('');\n\n  const archive = () => {\n    const id = showToast({\n      status: 'info',\n      content: `${conversation.title} archived`,\n      action: (\n        <Toast.Action preset=\"ghost\" onClick={() => dismissToast(id)}>\n          Undo\n        </Toast.Action>\n      ),\n    });\n  };\n\n  return (\n    <main className=\"flex min-w-0 flex-1\">\n      <ChatList />\n      <Conversation\n        onArchive={archive}\n        onShowDetails={details ? undefined : () => setDetails(true)}\n      />\n      {details && (\n        <ContactPanel\n          onClose={() => setDetails(false)}\n          onArchive={archive}\n          note={note}\n          onNoteChange={setNote}\n        />\n      )}\n    </main>\n  );\n}\n\n/** Communication (Frame direction): chats, the open conversation and the contact's details. */\nexport default function Communication() {\n  return (\n    <ToastProvider position=\"bottom-center\">\n      <AppShell className=\"ws-block-utility\" direction=\"frame\">\n        <CommunicationSidebar />\n        <Panels />\n      </AppShell>\n    </ToastProvider>\n  );\n}\n"
    },
    {
      "path": "src/blocks/communication/sidebar.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/communication/sidebar.tsx",
      "content": "'use client';\n\nimport { type RemixiconComponentType, RiAddLine, RiArrowDownSLine } 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 { Divider } from '@/components/ui/wideset/divider/Divider';\nimport { DropdownMenu } from '@/components/ui/wideset/dropdown/DropdownMenu';\nimport { ListItem } from '@/components/ui/wideset/list-item/ListItem';\nimport { ProgressBar } from '@/components/ui/wideset/progress-bar/ProgressBar';\nimport { Sidebar } from '@/components/ui/wideset/sidebar/Sidebar';\nimport { Tag } from '@/components/ui/wideset/tag/Tag';\nimport { useState } from 'react';\n\nimport { BrandMark } from './brand-mark';\nimport {\n  account,\n  categories,\n  type CategoryColor,\n  navigation,\n  spaces,\n  usage,\n  workspace,\n} from './data';\n\nconst CATEGORY: Record<CategoryColor, { swatch: string; text: string }> = {\n  indigo: {\n    swatch: 'bg-ws-non-semantic-indigo-strong',\n    text: 'text-ws-non-semantic-indigo-on-subtle',\n  },\n  blue: { swatch: 'bg-ws-non-semantic-blue-strong', text: 'text-ws-non-semantic-blue-on-subtle' },\n  cyan: { swatch: 'bg-ws-non-semantic-cyan-strong', text: 'text-ws-non-semantic-cyan-on-subtle' },\n};\n\n/** A category's colour square, passed as the item icon. */\nconst swatch = (color: CategoryColor): RemixiconComponentType => {\n  const Swatch = ({ className }: { className?: string }) => (\n    <span\n      aria-hidden=\"true\"\n      className={cn(className, 'rounded-ws-control-md', CATEGORY[color].swatch)}\n    />\n  );\n  return Swatch;\n};\n\nconst SWATCH_ICON: Record<CategoryColor, RemixiconComponentType> = {\n  indigo: swatch('indigo'),\n  blue: swatch('blue'),\n  cyan: swatch('cyan'),\n};\n\n/** The account menu: who is signed in, settings, plan usage and sign-out. */\nfunction AccountMenu() {\n  return (\n    <DropdownMenu>\n      <DropdownMenu.Trigger asChild>\n        <button\n          type=\"button\"\n          className=\"gap-ws-5 px-ws-5 py-ws-3 rounded-ws-control-lg hover:bg-ws-dynamic-tertiary-alpha-strong-default focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default flex w-full items-center text-left\"\n        >\n          <Avatar initials={account.initials} color={account.color} status=\"online\" />\n          <span className=\"flex min-w-0 flex-1 flex-col\">\n            <span className=\"typography-label-strong-sm text-ws-static-base truncate\">\n              {account.name}\n            </span>\n            <span className=\"typography-label-sm text-ws-static-subtle truncate\">\n              {account.role}\n            </span>\n          </span>\n          <RiArrowDownSLine aria-hidden=\"true\" className=\"size-ws-9 text-ws-static-strong\" />\n        </button>\n      </DropdownMenu.Trigger>\n      <DropdownMenu.Content side=\"top\" align=\"start\" className=\"ws-block-utility w-[13.875rem]\">\n        <DropdownMenu.Item>\n          <ListItem.Prefix>\n            <Avatar initials={account.initials} color={account.color} status=\"online\" />\n          </ListItem.Prefix>\n          <ListItem.Content>\n            <ListItem.Label>{account.name}</ListItem.Label>\n            <ListItem.Description>{account.email}</ListItem.Description>\n          </ListItem.Content>\n        </DropdownMenu.Item>\n        <DropdownMenu.Separator />\n        <DropdownMenu.Item>\n          <ListItem.Content>\n            <ListItem.Label>Account</ListItem.Label>\n          </ListItem.Content>\n        </DropdownMenu.Item>\n        <DropdownMenu.Item>\n          <ListItem.Content>\n            <ListItem.Label>Preferences</ListItem.Label>\n          </ListItem.Content>\n        </DropdownMenu.Item>\n        <DropdownMenu.Item>\n          <ListItem.Content>\n            <ListItem.Label>Subscription</ListItem.Label>\n          </ListItem.Content>\n          <ListItem.Suffix>\n            <Tag color=\"purple\">Pro</Tag>\n          </ListItem.Suffix>\n        </DropdownMenu.Item>\n        <DropdownMenu.Item>\n          <ListItem.Content>\n            <ListItem.Label>Team</ListItem.Label>\n          </ListItem.Content>\n        </DropdownMenu.Item>\n        <DropdownMenu.Separator />\n        <div className=\"p-ws-7 gap-ws-5 flex flex-col\">\n          <div className=\"flex items-center justify-between\">\n            <span className=\"typography-label-strong-sm text-ws-dynamic-secondary-default\">\n              {usage.label}\n            </span>\n            <span className=\"typography-body-sm text-ws-static-subtle tabular-nums\">\n              {usage.used.toLocaleString('en')} / {usage.limit / 1000}K\n            </span>\n          </div>\n          <ProgressBar value={usage.used} max={usage.limit} aria-label={`${usage.label} used`} />\n          <span className=\"typography-body-sm text-ws-static-subtle self-end\">{usage.resets}</span>\n        </div>\n        <DropdownMenu.Separator />\n        <DropdownMenu.Item variant=\"danger\">\n          <ListItem.Content>\n            <ListItem.Label>Log out</ListItem.Label>\n          </ListItem.Content>\n        </DropdownMenu.Item>\n      </DropdownMenu.Content>\n    </DropdownMenu>\n  );\n}\n\n/** The app sidebar (Frame direction: it sits on the grey frame). */\nexport function CommunicationSidebar() {\n  const [active, setActive] = useState('chats');\n\n  const nav = (collapsed?: boolean) => (\n    <nav aria-label=\"Main\" className=\"gap-ws-7 flex flex-col\">\n      <div className=\"flex flex-col\">\n        {navigation.map(({ id, label, icon, count }) => (\n          <Sidebar.Item\n            key={id}\n            href={`#${id}`}\n            icon={icon}\n            label={label}\n            active={active === id}\n            suffix={\n              count ? (\n                <Tag size=\"sm\" shape=\"rounded\" color=\"blue\">\n                  {count}\n                </Tag>\n              ) : undefined\n            }\n            onClick={() => setActive(id)}\n          />\n        ))}\n      </div>\n      <div role=\"group\" aria-labelledby=\"sidebar-spaces\" className=\"gap-ws-2 flex flex-col\">\n        <Sidebar.SectionHeader id=\"sidebar-spaces\">Spaces</Sidebar.SectionHeader>\n        {spaces.map(({ id, label, icon }) => (\n          <Sidebar.Item\n            key={id}\n            href={`#${id}`}\n            icon={icon}\n            label={label}\n            active={active === id}\n            onClick={() => setActive(id)}\n          />\n        ))}\n      </div>\n      {/* The line runs edge to edge, out of the sidebar's own inset. */}\n      {!collapsed && <Divider weight=\"thin\" className=\"-mr-ws-6 -ml-ws-5 w-auto\" />}\n      <div role=\"group\" aria-labelledby=\"sidebar-categories\" className=\"gap-ws-2 flex flex-col\">\n        <Sidebar.SectionHeader id=\"sidebar-categories\">Categories</Sidebar.SectionHeader>\n        {categories.map(({ id, label, color, count }) => (\n          <Sidebar.Item\n            key={id}\n            href={`#${id}`}\n            icon={SWATCH_ICON[color]}\n            label={<span className={CATEGORY[color].text}>{label}</span>}\n            aria-label={collapsed ? label : undefined}\n            active={active === id}\n            suffix={count}\n            onClick={() => setActive(id)}\n          />\n        ))}\n      </div>\n    </nav>\n  );\n\n  return (\n    <Sidebar>\n      <Sidebar.Header>\n        <Sidebar.Expanded>\n          <div className=\"gap-ws-9 flex flex-col\">\n            <div className=\"gap-ws-7 py-ws-3 pl-ws-5 flex items-center\">\n              <BrandMark />\n              <span className=\"typography-label-strong-sm text-ws-dynamic-secondary-default min-w-0 flex-1 truncate\">\n                {workspace.name}\n              </span>\n              <Sidebar.Trigger />\n            </div>\n            <Button variant=\"secondary\" preset=\"border\" size=\"sm\" className=\"w-full\">\n              <Button.Icon icon={RiAddLine} />\n              Add new\n            </Button>\n          </div>\n        </Sidebar.Expanded>\n        <Sidebar.Collapsed>\n          <div className=\"gap-ws-7 flex flex-col items-center\">\n            <BrandMark label={workspace.name} />\n            <Sidebar.Trigger />\n          </div>\n        </Sidebar.Collapsed>\n      </Sidebar.Header>\n\n      <Sidebar.Section scrollable>\n        <Sidebar.Expanded>{nav()}</Sidebar.Expanded>\n        <Sidebar.Collapsed>{nav(true)}</Sidebar.Collapsed>\n      </Sidebar.Section>\n\n      <Sidebar.Footer>\n        <Sidebar.Expanded>\n          <AccountMenu />\n        </Sidebar.Expanded>\n        <Sidebar.Collapsed>\n          <Avatar\n            initials={account.initials}\n            color={account.color}\n            status=\"online\"\n            aria-label={account.name}\n          />\n        </Sidebar.Collapsed>\n      </Sidebar.Footer>\n    </Sidebar>\n  );\n}\n"
    }
  ],
  "meta": {
    "version": "1.1.0",
    "commit": "a734f9f0"
  }
}
