{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "block-calendar",
  "type": "registry:block",
  "title": "Calendar",
  "description": "A month calendar on a raised page: views and filters in the header, events in the grid.",
  "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/divider.json",
    "https://wideset.co/r/dropdown-menu.json",
    "https://wideset.co/r/icon-button.json",
    "https://wideset.co/r/illustration.json",
    "https://wideset.co/r/list-item.json",
    "https://wideset.co/r/sidebar.json",
    "https://wideset.co/r/tabs.json",
    "https://wideset.co/r/text-input.json",
    "https://wideset.co/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/calendar/brand-mark.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/calendar/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/calendar/data.ts",
      "type": "registry:file",
      "target": "blocks/wideset/calendar/data.ts",
      "content": "import {\n  type RemixiconComponentType,\n  RiBardLine,\n  RiCalendarEventLine,\n  RiCalendarLine,\n  RiDashboardLine,\n  RiFile3Fill,\n  RiFile3Line,\n  RiInbox2Line,\n  RiListUnordered,\n  RiNotification3Line,\n  RiSettingsLine,\n  RiSupabaseLine,\n  RiTableView,\n  RiTimelineView,\n} from '@remixicon/react';\nimport type { AvatarColor } from '@/components/ui/wideset/avatar/Avatar.colors';\n\nexport const workspace = { name: 'Wideset', plan: 'Team Plan', initials: 'W' };\n\n/** The page open in the calendar. */\nexport const page = { title: 'Product Design' };\n\n/** The card over the calendar's corner until it is dismissed. */\nexport const announcement = {\n  title: 'There are 3 new features!',\n  description:\n    'You can review and try them for free right now. This will be available for 2 weeks.',\n  action: 'Take me there',\n};\n\nexport const account = { name: 'Adam Smith', email: 'hello@wideset.co', initials: 'AS' };\n\nexport type NavLink = {\n  id: string;\n  label: string;\n  icon: RemixiconComponentType;\n  /** The icon while the page is open (Figma swaps a line icon for its fill). */\n  activeIcon?: RemixiconComponentType;\n  /** The digit after ⌘ in the keyboard shortcut. */\n  shortcut?: string;\n};\n\nexport const inboxLinks: NavLink[] = [\n  { id: 'inbox', label: 'Inbox', icon: RiInbox2Line, shortcut: '1' },\n  { id: 'activity', label: 'Activity', icon: RiNotification3Line, shortcut: '2' },\n  { id: 'schedule', label: 'Schedule', icon: RiCalendarLine, shortcut: '3' },\n];\n\nexport const sharedLinks: NavLink[] = [\n  { id: 'boosts', label: 'Boosts', icon: RiSupabaseLine },\n  { id: 'documents', label: 'Documents', icon: RiFile3Line, activeIcon: RiFile3Fill },\n];\n\nexport const footerLinks: NavLink[] = [\n  { id: 'settings', label: 'Settings', icon: RiSettingsLine },\n  { id: 'help', label: 'Help', icon: RiBardLine },\n];\n\nexport type ProjectColor = 'blue' | 'purple' | 'teal';\n\nexport const projects: { id: string; label: string; color: ProjectColor }[] = [\n  { id: 'design', label: 'Design', color: 'blue' },\n  { id: 'handoff', label: 'Development Handoff', color: 'purple' },\n  { id: 'feedback', label: 'Feedback & Iteration', color: 'teal' },\n];\n\nexport const views = [\n  { id: 'list', label: 'List', icon: RiListUnordered },\n  { id: 'calendar', label: 'Calendar', icon: RiCalendarEventLine },\n  { id: 'board', label: 'Board', icon: RiDashboardLine },\n  { id: 'timeline', label: 'Timeline', icon: RiTimelineView },\n  { id: 'table', label: 'Table', icon: RiTableView },\n];\n\n/** Who the page is shared with; a person without initials shows the default user icon. */\nexport const members: { name: string; initials?: string; color?: AvatarColor }[] = [\n  { name: 'Robert Redford', initials: 'RR', color: 'orange' },\n  { name: 'Diana Ross', initials: 'DR', color: 'yellow' },\n  { name: 'Guest' },\n];\n\n/** The calendar opens on this month (0-based) and marks this day as today. */\nexport const today = '2024-05-01';\nexport const openMonth = { year: 2024, month: 4 };\n/** The day selected when the page opens. */\nexport const selectedDay = '2024-04-30';\n\nexport type EventColor = 'purple' | 'cyan' | 'teal' | 'green';\n\nexport type CalendarEvent = {\n  id: string;\n  title: string;\n  /** ISO date of the first day. */\n  start: string;\n  /** ISO date of the last day, for an event that runs over several days. */\n  end?: string;\n  time?: string;\n  /** A meeting's colour, or `busy` for time blocked off (drawn hatched). */\n  color: EventColor | 'busy';\n};\n\nexport const events: CalendarEvent[] = [\n  { id: 'q1', title: 'Q1 UKR', start: '2024-04-29', color: 'purple' },\n  { id: 'standup', title: 'Standup', start: '2024-05-02', color: 'busy' },\n  {\n    id: 'critique-7',\n    title: 'Design Critique',\n    start: '2024-05-07',\n    time: '10am - 11am',\n    color: 'cyan',\n  },\n  { id: 'time-off', title: 'Time off', start: '2024-05-08', color: 'busy' },\n  { id: 'jam-9', title: 'Design Jam', start: '2024-05-09', time: '8pm - 9pm', color: 'teal' },\n  { id: 'sync-9', title: 'Maciej & Michał', start: '2024-05-09', color: 'green' },\n  { id: 'jam-14', title: 'Design Jam', start: '2024-05-14', end: '2024-05-16', color: 'teal' },\n  {\n    id: 'critique-20',\n    title: 'Design Critique',\n    start: '2024-05-20',\n    time: '10am - 11am',\n    color: 'cyan',\n  },\n  { id: 'sync-23', title: 'Maciej & Michał', start: '2024-05-23', color: 'green' },\n  {\n    id: 'sprint',\n    title: 'Sprint Planning',\n    start: '2024-05-28',\n    time: '8pm - 9pm',\n    color: 'purple',\n  },\n];\n"
    },
    {
      "path": "src/blocks/calendar/index.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/calendar/index.tsx",
      "content": "'use client';\n\nimport '@/styles/wideset-blocks.css';\n\nimport {\n  RiAddLine,\n  RiArrowLeftSLine,\n  RiArrowRightSLine,\n  RiCalendarScheduleLine,\n  RiCloseLargeFill,\n  RiFilter3Line,\n  RiMoreFill,\n  RiSearchLine,\n  RiSortDesc,\n} from '@remixicon/react';\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 { IconButton } from '@/components/ui/wideset/button/IconButton';\nimport { Illustration } from '@/components/ui/wideset/illustration/Illustration';\nimport { Tabs } from '@/components/ui/wideset/tabs/Tabs';\nimport { useState } from 'react';\n\nimport { announcement, events, members, openMonth, page, selectedDay, today, views } from './data';\nimport { MonthGrid, monthWeeks } from './month-grid';\nimport { CalendarSidebar } from './sidebar';\n\nconst monthTitle = new Intl.DateTimeFormat('en', {\n  month: 'long',\n  year: 'numeric',\n  timeZone: 'UTC',\n});\n\nconst ghost = { variant: 'secondary', preset: 'ghost', size: 'sm' } as const;\n\nconst TOOLS = [\n  { label: '1 filter', icon: RiFilter3Line },\n  { label: 'Sort', icon: RiSortDesc },\n  { label: 'Week', icon: RiCalendarScheduleLine },\n  { label: 'Search', icon: RiSearchLine },\n];\n\n/** Figma's \"There are 3 new features\" card: it stays until dismissed. */\nfunction AnnouncementCard({ onDismiss }: { onDismiss: () => void }) {\n  return (\n    <section\n      aria-labelledby=\"calendar-announcement-title\"\n      className=\"bg-ws-static-overlay rounded-ws-container-lg shadow-ws-high p-ws-12 gap-ws-12 right-ws-11 bottom-ws-11 absolute flex w-[20.625rem] flex-col\"\n    >\n      {/* Figma's Illustration=Computer, Size=Small, centred in the card's 140px art row. */}\n      <div className=\"flex items-center justify-center\">\n        <Illustration illustration=\"computer\" size=\"sm\" />\n      </div>\n      <IconButton\n        {...ghost}\n        icon={RiCloseLargeFill}\n        aria-label=\"Dismiss\"\n        onClick={onDismiss}\n        className=\"top-ws-9 right-ws-9 absolute\"\n      />\n      <div className=\"gap-ws-12 flex flex-col items-start\">\n        <div className=\"gap-ws-5 flex flex-col\">\n          <h2\n            id=\"calendar-announcement-title\"\n            className=\"typography-subtitle-sm text-ws-static-base\"\n          >\n            {announcement.title}\n          </h2>\n          <p className=\"typography-body-md text-ws-static-subtle\">{announcement.description}</p>\n        </div>\n        <Button variant=\"secondary\" preset=\"border\" size=\"sm\" onClick={onDismiss}>\n          {announcement.action}\n        </Button>\n      </div>\n    </section>\n  );\n}\n\n/** Calendar (Inset direction): the month on a raised page beside the workspace sidebar. */\nexport default function Calendar() {\n  const [month, setMonth] = useState(openMonth.year * 12 + openMonth.month);\n  const [selected, setSelected] = useState(selectedDay);\n  const [showAnnouncement, setShowAnnouncement] = useState(true);\n  const year = Math.floor(month / 12);\n\n  return (\n    <AppShell className=\"ws-block-utility\" direction=\"inset\">\n      <CalendarSidebar />\n      <AppShell.Main>\n        <Tabs type=\"ghost\" defaultValue=\"calendar\" className=\"min-h-0 flex-1\">\n          <header className=\"gap-ws-7 px-ws-11 h-ws-20 border-ws-static-base flex shrink-0 items-center border-b\">\n            <div className=\"gap-ws-9 flex min-w-0 items-center\">\n              <h1 className=\"typography-subtitle-xs text-ws-dynamic-secondary-default truncate\">\n                {page.title}\n              </h1>\n              <span aria-hidden=\"true\" className=\"border-ws-static-base h-ws-11 border-l\" />\n              <div className=\"gap-ws-2 flex items-center\">\n                <Tabs.List aria-label=\"Views\">\n                  {views.map(({ id, label, icon }) => (\n                    <Tabs.Item key={id} value={id}>\n                      <Tabs.Icon icon={icon} />\n                      <Tabs.Label>{label}</Tabs.Label>\n                    </Tabs.Item>\n                  ))}\n                </Tabs.List>\n                <Button {...ghost}>\n                  <Button.Icon icon={RiAddLine} />\n                  View\n                </Button>\n              </div>\n            </div>\n            <div className=\"gap-ws-9 ml-auto flex items-center\">\n              <Avatar.Group size=\"sm\" className=\"w-fit\">\n                {members.map(({ name, initials, color }) =>\n                  initials ? (\n                    <Avatar key={name} initials={initials} color={color} aria-label={name} />\n                  ) : (\n                    <Avatar key={name} aria-label={name} />\n                  ),\n                )}\n              </Avatar.Group>\n              <Button variant=\"secondary\" preset=\"border\" size=\"sm\">\n                Share\n              </Button>\n            </div>\n          </header>\n\n          <Tabs.Content value=\"calendar\" className=\"flex min-h-0 flex-1 flex-col\">\n            <div className=\"px-ws-11 h-ws-18 border-ws-static-base flex shrink-0 items-center justify-between border-b\">\n              <div className=\"gap-ws-5 flex items-center\">\n                <div className=\"gap-ws-3 flex\">\n                  <IconButton\n                    {...ghost}\n                    icon={RiArrowLeftSLine}\n                    aria-label=\"Previous month\"\n                    onClick={() => setMonth(month - 1)}\n                  />\n                  <IconButton\n                    {...ghost}\n                    icon={RiArrowRightSLine}\n                    aria-label=\"Next month\"\n                    onClick={() => setMonth(month + 1)}\n                  />\n                </div>\n                <h2 className=\"typography-subtitle-xs text-ws-dynamic-secondary-default\">\n                  {monthTitle.format(Date.UTC(year, month % 12, 1))}\n                </h2>\n              </div>\n              <div className=\"gap-ws-2 flex items-center\">\n                {TOOLS.map(({ label, icon }) => (\n                  <Button key={label} {...ghost}>\n                    <Button.Icon icon={icon} />\n                    {label}\n                  </Button>\n                ))}\n                <IconButton {...ghost} icon={RiMoreFill} aria-label=\"More options\" />\n              </div>\n            </div>\n            <MonthGrid\n              weeks={monthWeeks(year, month % 12)}\n              events={events}\n              today={today}\n              selected={selected}\n              onSelect={setSelected}\n            />\n          </Tabs.Content>\n          {views\n            .filter(({ id }) => id !== 'calendar')\n            .map(({ id, label }) => (\n              <Tabs.Content\n                key={id}\n                value={id}\n                className=\"typography-body-md text-ws-static-subtle flex flex-1 items-center justify-center\"\n              >\n                The {label.toLowerCase()} view of {page.title} goes here.\n              </Tabs.Content>\n            ))}\n        </Tabs>\n        {showAnnouncement && <AnnouncementCard onDismiss={() => setShowAnnouncement(false)} />}\n      </AppShell.Main>\n    </AppShell>\n  );\n}\n"
    },
    {
      "path": "src/blocks/calendar/month-grid.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/calendar/month-grid.tsx",
      "content": "'use client';\n\nimport { cn } from '@/lib/wideset/utils';\n\nimport type { CalendarEvent, EventColor } from './data';\n\nconst DAY = 86_400_000;\nconst isoDay = (time: number) => new Date(time).toISOString().slice(0, 10);\nconst daysBetween = (from: string, to: string) =>\n  Math.round((Date.parse(to) - Date.parse(from)) / DAY);\n\n/** The weeks, Monday first, that cover a month (0-based), as ISO dates. */\nexport function monthWeeks(year: number, month: number): string[][] {\n  const first = Date.UTC(year, month, 1);\n  const start = first - ((new Date(first).getUTCDay() + 6) % 7) * DAY;\n  const last = Date.UTC(year, month + 1, 0);\n  const weeks: string[][] = [];\n  for (let monday = start; monday <= last; monday += 7 * DAY) {\n    weeks.push(Array.from({ length: 7 }, (_, day) => isoDay(monday + day * DAY)));\n  }\n  return weeks;\n}\n\nconst weekday = new Intl.DateTimeFormat('en', { weekday: 'long', timeZone: 'UTC' });\nconst fullDate = new Intl.DateTimeFormat('en', {\n  weekday: 'long',\n  month: 'long',\n  day: 'numeric',\n  timeZone: 'UTC',\n});\n\n/** Five weekdays and a narrower weekend, as in Figma (184px and 120px at 1440). */\nconst COLUMNS = 'grid grid-cols-[repeat(5,minmax(0,1fr))_repeat(2,7.5rem)]';\nconst COL_START = [\n  'col-start-1',\n  'col-start-2',\n  'col-start-3',\n  'col-start-4',\n  'col-start-5',\n  'col-start-6',\n  'col-start-7',\n];\nconst COL_SPAN = [\n  'col-span-1',\n  'col-span-2',\n  'col-span-3',\n  'col-span-4',\n  'col-span-5',\n  'col-span-6',\n  'col-span-7',\n];\n\nconst TONE: Record<EventColor, string> = {\n  purple: 'bg-ws-non-semantic-purple-subtle text-ws-non-semantic-purple-on-subtle',\n  cyan: 'bg-ws-non-semantic-cyan-subtle text-ws-non-semantic-cyan-on-subtle',\n  teal: 'bg-ws-non-semantic-teal-subtle text-ws-non-semantic-teal-on-subtle',\n  green: 'bg-ws-non-semantic-green-subtle text-ws-non-semantic-green-on-subtle',\n};\n\nconst STRIPES = Array.from({ length: 24 }, (_, index) => index);\n\n/** Time blocked off: Figma's hatched \"Shift\", 8px stripes at 45°. */\nfunction Busy({ title, className }: { title: string; className?: string }) {\n  return (\n    <div\n      className={cn(\n        'bg-ws-static-alpha-subtle rounded-ws-control-sm px-ws-5 py-ws-4 h-ws-18 relative overflow-hidden',\n        className,\n      )}\n    >\n      <span\n        aria-hidden=\"true\"\n        className=\"gap-ws-4 absolute top-1/2 left-1/2 flex h-[24rem] -translate-x-1/2 -translate-y-1/2 rotate-45\"\n      >\n        {STRIPES.map((stripe) => (\n          <span key={stripe} className=\"w-ws-5 bg-ws-static-alpha-subtle\" />\n        ))}\n      </span>\n      <span className=\"typography-label-strong-sm text-ws-static-subtle relative block truncate\">\n        {title}\n      </span>\n    </div>\n  );\n}\n\nfunction Event({ event, className }: { event: CalendarEvent; className: string }) {\n  if (event.color === 'busy') return <Busy title={event.title} className={className} />;\n  return (\n    <div\n      className={cn(\n        'rounded-l-ws-control-md rounded-r-ws-container-sm gap-ws-3 px-ws-5 py-ws-4 flex min-w-0 flex-col',\n        TONE[event.color],\n        className,\n      )}\n    >\n      <span className=\"typography-body-strong-sm truncate\">{event.title}</span>\n      {event.time && <span className=\"typography-body-sm truncate\">{event.time}</span>}\n    </div>\n  );\n}\n\ntype MonthGridProps = {\n  weeks: string[][];\n  events: CalendarEvent[];\n  today: string;\n  selected: string;\n  onSelect: (day: string) => void;\n};\n\n/**\n * A month: one row per week, a cell per day (selectable), events laid over the cells. An event\n * spans its days; the grid stacks events that share a day into rows by itself.\n */\nexport function MonthGrid({ weeks, events, today, selected, onSelect }: MonthGridProps) {\n  return (\n    <div className=\"flex min-h-0 flex-1 flex-col\">\n      {weeks.map((days, row) => {\n        const placed = events.flatMap((event) => {\n          const from = Math.max(0, daysBetween(days[0], event.start));\n          const to = Math.min(6, daysBetween(days[0], event.end ?? event.start));\n          return from <= to ? [{ event, from, to }] : [];\n        });\n        return (\n          <div key={days[0]} className=\"relative min-h-0 flex-1 overflow-hidden\">\n            <div className={cn(COLUMNS, 'h-full')}>\n              {days.map((day) => (\n                <button\n                  key={day}\n                  type=\"button\"\n                  aria-pressed={day === selected}\n                  aria-label={fullDate.format(Date.parse(day))}\n                  onClick={() => onSelect(day)}\n                  className=\"border-ws-static-subtle p-ws-4 hover:bg-ws-static-alpha-subtle aria-pressed:bg-ws-static-alpha-subtle focus-visible:wds-focus-visible outline-ws-dynamic-primary-strong-default flex flex-col items-end justify-between border-r border-b focus-visible:-outline-offset-2\"\n                >\n                  <span className=\"typography-label-strong-sm text-ws-static-strong px-ws-2 pt-ws-2 self-start\">\n                    {row === 0 ? weekday.format(Date.parse(day)) : null}\n                  </span>\n                  <span\n                    className={cn(\n                      'typography-label-sm min-w-ws-11 h-ws-11 flex items-center justify-end',\n                      day === today\n                        ? 'bg-ws-dynamic-secondary-default text-ws-dynamic-on-secondary-default rounded-ws-container-sm justify-center'\n                        : 'text-ws-static-subtle',\n                    )}\n                  >\n                    {Number(day.slice(8))}\n                  </span>\n                </button>\n              ))}\n            </div>\n            <div\n              className={cn(\n                COLUMNS,\n                'gap-y-ws-3 inset-x-ws-0 pointer-events-none absolute grid-flow-row-dense items-start',\n                row === 0 ? 'top-ws-14' : 'top-ws-4',\n              )}\n            >\n              {placed.map(({ event, from, to }) => (\n                <Event\n                  key={event.id}\n                  event={event}\n                  className={cn('mx-ws-4', COL_START[from], COL_SPAN[to - from])}\n                />\n              ))}\n            </div>\n          </div>\n        );\n      })}\n    </div>\n  );\n}\n"
    },
    {
      "path": "src/blocks/calendar/sidebar.tsx",
      "type": "registry:file",
      "target": "blocks/wideset/calendar/sidebar.tsx",
      "content": "'use client';\n\nimport {\n  type RemixiconComponentType,\n  RiAddFill,\n  RiAddLine,\n  RiArrowDownSLine,\n  RiLogoutBoxRLine,\n  RiSearchLine,\n  RiSettingsLine,\n} from '@remixicon/react';\nimport { Avatar } from '@/components/ui/wideset/avatar/Avatar';\nimport { cn } from '@/lib/wideset/utils';\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 { Sidebar } from '@/components/ui/wideset/sidebar/Sidebar';\nimport { TextInput } from '@/components/ui/wideset/text-input/TextInput';\nimport { useState } from 'react';\n\nimport { BrandMark } from './brand-mark';\nimport {\n  account,\n  footerLinks,\n  inboxLinks,\n  type NavLink,\n  type ProjectColor,\n  projects,\n  sharedLinks,\n  workspace,\n} from './data';\n\nconst SWATCH: Record<ProjectColor, string> = {\n  blue: 'bg-ws-non-semantic-blue-subtle',\n  purple: 'bg-ws-non-semantic-purple-subtle',\n  teal: 'bg-ws-non-semantic-teal-subtle',\n};\n\n/** Figma's Sidebar Item `Type=Thumbnail`: a project's colour square, passed as the item icon. */\nconst swatch = (color: ProjectColor): RemixiconComponentType => {\n  const Swatch = ({ className }: { className?: string }) => (\n    <span\n      aria-hidden=\"true\"\n      className={cn(\n        className,\n        'rounded-ws-control-md border-ws-static-strong border',\n        SWATCH[color],\n      )}\n    />\n  );\n  return Swatch;\n};\n\nconst SWATCH_ICON: Record<ProjectColor, RemixiconComponentType> = {\n  blue: swatch('blue'),\n  purple: swatch('purple'),\n  teal: swatch('teal'),\n};\n\n/** Figma's Shortcut chip: ⌘ and a digit. */\nfunction Shortcut({ digit }: { digit: string }) {\n  return (\n    <kbd className=\"font-ws-body border-ws-static-base rounded-ws-control-md px-ws-4 py-ws-2 flex items-center border\">\n      <span className=\"w-ws-9 text-center\">⌘</span>\n      {digit}\n    </kbd>\n  );\n}\n\n/** The workspace sidebar: switcher, search, pages, projects and the signed-in account. */\nexport function CalendarSidebar() {\n  const [active, setActive] = useState('documents');\n\n  const link = ({ id, label, icon, activeIcon, shortcut }: NavLink) => (\n    <Sidebar.Item\n      key={id}\n      href={`#${id}`}\n      icon={active === id ? (activeIcon ?? icon) : icon}\n      label={label}\n      active={active === id}\n      suffix={shortcut ? <Shortcut digit={shortcut} /> : undefined}\n      suffixOnHover\n      onClick={() => setActive(id)}\n    />\n  );\n\n  return (\n    <Sidebar>\n      <Sidebar.Header>\n        <div className=\"gap-ws-9 flex flex-col\">\n          <div className=\"gap-ws-7 pt-ws-3 pb-ws-7 flex items-center\">\n            <BrandMark className=\"size-ws-15\" />\n            <div className=\"flex min-w-0 flex-1 flex-col\">\n              <span className=\"typography-label-strong-sm text-ws-dynamic-secondary-default truncate\">\n                {workspace.name}\n              </span>\n              <span className=\"typography-caption-md text-ws-static-subtle truncate\">\n                {workspace.plan}\n              </span>\n            </div>\n            <DropdownMenu>\n              <DropdownMenu.Trigger asChild>\n                {/* The same button as the groups' \"+\": xs, 4px in, its icon on the suffixes' edge. */}\n                <IconButton\n                  icon={RiArrowDownSLine}\n                  variant=\"secondary\"\n                  preset=\"ghost\"\n                  size=\"xs\"\n                  aria-label=\"Switch workspace\"\n                  className=\"mr-ws-3\"\n                />\n              </DropdownMenu.Trigger>\n              <DropdownMenu.Content className=\"ws-block-utility\" align=\"end\">\n                <DropdownMenu.Item data-state=\"checked\">\n                  <ListItem.Content>\n                    <ListItem.Label>{workspace.name}</ListItem.Label>\n                  </ListItem.Content>\n                </DropdownMenu.Item>\n                <DropdownMenu.Separator />\n                <DropdownMenu.Item>\n                  <ListItem.Prefix>\n                    <RiAddLine className=\"size-ws-9\" />\n                  </ListItem.Prefix>\n                  <ListItem.Content>\n                    <ListItem.Label>New workspace</ListItem.Label>\n                  </ListItem.Content>\n                </DropdownMenu.Item>\n              </DropdownMenu.Content>\n            </DropdownMenu>\n          </div>\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\" />\n          </TextInput>\n        </div>\n      </Sidebar.Header>\n\n      <Sidebar.Section scrollable>\n        <Sidebar.Expanded>\n          <nav aria-label=\"Workspace\" className=\"gap-ws-9 flex flex-col\">\n            <div className=\"flex flex-col\">{inboxLinks.map(link)}</div>\n            <Divider weight=\"thin\" />\n            <div role=\"group\" aria-labelledby=\"sidebar-shared\" className=\"gap-ws-2 flex flex-col\">\n              {/* The header's one action ends the row 4px in, its icon on the suffixes' edge. */}\n              <div className=\"flex items-end\">\n                <Sidebar.SectionHeader id=\"sidebar-shared\" className=\"flex-1\">\n                  Shared\n                </Sidebar.SectionHeader>\n                <IconButton\n                  icon={RiAddLine}\n                  variant=\"secondary\"\n                  preset=\"ghost\"\n                  size=\"xs\"\n                  aria-label=\"Add a shared page\"\n                  className=\"mr-ws-3\"\n                />\n              </div>\n              {sharedLinks.map(link)}\n            </div>\n            <div role=\"group\" aria-labelledby=\"sidebar-projects\" className=\"gap-ws-2 flex flex-col\">\n              <Sidebar.SectionHeader id=\"sidebar-projects\">Projects</Sidebar.SectionHeader>\n              {projects.map(({ id, label, color }) => (\n                <Sidebar.Item\n                  key={id}\n                  href={`#${id}`}\n                  icon={SWATCH_ICON[color]}\n                  label={label}\n                  active={active === id}\n                  onClick={() => setActive(id)}\n                />\n              ))}\n              <Sidebar.Item\n                asChild\n                icon={RiAddFill}\n                label={<span className=\"text-ws-static-subtle\">Add new project</span>}\n              >\n                <button type=\"button\" />\n              </Sidebar.Item>\n            </div>\n          </nav>\n        </Sidebar.Expanded>\n      </Sidebar.Section>\n\n      <Sidebar.Footer>\n        <div className=\"gap-ws-9 flex flex-col\">\n          <div className=\"gap-ws-3 flex flex-col\">{footerLinks.map(link)}</div>\n          {/* On the grey ground the line keeps the nav's inset: run edge to edge, it would stop\n              short of the page and read as broken. */}\n          <div className=\"border-ws-static-base pt-ws-5 border-t\">\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=\"teal\" 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-caption-md text-ws-static-subtle truncate\">\n                      {account.email}\n                    </span>\n                  </span>\n                  <RiArrowDownSLine\n                    aria-hidden=\"true\"\n                    className=\"size-ws-9 text-ws-static-strong\"\n                  />\n                </button>\n              </DropdownMenu.Trigger>\n              <DropdownMenu.Content side=\"top\" align=\"start\" className=\"ws-block-utility w-[14rem]\">\n                <DropdownMenu.Item>\n                  <ListItem.Prefix>\n                    <RiSettingsLine className=\"size-ws-9\" />\n                  </ListItem.Prefix>\n                  <ListItem.Content>\n                    <ListItem.Label>Account settings</ListItem.Label>\n                  </ListItem.Content>\n                </DropdownMenu.Item>\n                <DropdownMenu.Separator />\n                <DropdownMenu.Item variant=\"danger\">\n                  <ListItem.Prefix>\n                    <RiLogoutBoxRLine className=\"size-ws-9\" />\n                  </ListItem.Prefix>\n                  <ListItem.Content>\n                    <ListItem.Label>Log out</ListItem.Label>\n                  </ListItem.Content>\n                </DropdownMenu.Item>\n              </DropdownMenu.Content>\n            </DropdownMenu>\n          </div>\n        </div>\n      </Sidebar.Footer>\n    </Sidebar>\n  );\n}\n"
    }
  ],
  "meta": {
    "version": "1.1.0",
    "commit": "a734f9f0"
  }
}
