{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "aside-06",
  "title": "Workspace sidebar",
  "description": "A workspace switcher, navigation with one travelling highlight, a folding projects group and the account menu",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/animated-size.json",
    "https://ui.ndekocode.dev/r/avatar.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/company-mark.json",
    "https://ui.ndekocode.dev/r/dropdown-menu.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/kbd.json",
    "https://ui.ndekocode.dev/r/mesh-tile.json",
    "https://ui.ndekocode.dev/r/sheet.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/components/aside/aside-06.tsx",
      "content": "'use client';\n\nimport { motion } from 'motion/react';\nimport { useId, useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport {\n  ArchiveIcon,\n  ChartLineIcon,\n  ChevronDownIcon,\n  ChevronsUpDownIcon,\n  CircleCheckIcon,\n  ClockIcon,\n  FoldersIcon,\n  InboxIcon,\n  LogOutIcon,\n  PlusIcon,\n  SettingsIcon,\n  UserIcon,\n  UsersIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { CompanyMark } from '@/registry/ndeko/ui/company-mark';\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuLabel,\n  DropdownMenuRadioGroup,\n  DropdownMenuRadioItem,\n  DropdownMenuSeparator,\n  DropdownMenuTrigger,\n} from '@/registry/ndeko/ui/dropdown-menu';\nimport { Kbd } from '@/registry/ndeko/ui/kbd';\nimport { MeshTile } from '@/registry/ndeko/ui/mesh-tile';\n\nimport {\n  AsideCloseButton,\n  AsidePreview,\n  AsideTitle,\n} from './_parts/aside-frame';\nimport { travelOf } from './_parts/motion';\nimport { PEOPLE } from './_parts/people';\nimport { PersonAvatar } from './_parts/person-avatar';\nimport { Swap } from './_parts/swap';\n\ntype Workspace = { id: string; name: string; plan: string; color: string };\n\ntype NavItem = { id: string; label: string; icon: Icon; count?: number };\n\ntype Project = {\n  id: string;\n  name: string;\n  color: string;\n  openTasks: number;\n  isTracked: boolean;\n};\n\nconst WORKSPACES: Workspace[] = [\n  {\n    id: 'lattice',\n    name: 'Lattice',\n    plan: 'Team plan',\n    color: 'var(--primary)',\n  },\n  {\n    id: 'northfield',\n    name: 'Northfield',\n    plan: 'Free plan',\n    color: 'var(--info)',\n  },\n];\n\nconst NAV_ITEMS: NavItem[] = [\n  { id: 'inbox', label: 'Inbox', icon: InboxIcon, count: 3 },\n  { id: 'tasks', label: 'My tasks', icon: CircleCheckIcon },\n  { id: 'timesheets', label: 'Timesheets', icon: ClockIcon },\n  { id: 'reports', label: 'Reports', icon: ChartLineIcon },\n  { id: 'team', label: 'Team', icon: UsersIcon },\n];\n\nconst PROJECTS: Project[] = [\n  {\n    id: 'atlas',\n    name: 'Atlas redesign',\n    color: 'var(--primary)',\n    openTasks: 21,\n    isTracked: true,\n  },\n  {\n    id: 'billing',\n    name: 'Billing API',\n    color: 'var(--info)',\n    openTasks: 9,\n    isTracked: false,\n  },\n  {\n    id: 'mobile',\n    name: 'Mobile timer',\n    color: 'var(--success)',\n    openTasks: 14,\n    isTracked: false,\n  },\n];\n\nconst ALL_PROJECTS_COUNT = 12;\n\nconst ARCHIVED_COUNT = 3;\n\nconst ACCOUNT = PEOPLE[0];\n\nconst ROW =\n  'relative flex h-8 w-full cursor-pointer items-center gap-2.5 rounded-md px-2 text-left text-[13px] outline-none transition-colors duration-150 hover:bg-foreground/[0.04] focus-visible:ring-[3px] focus-visible:ring-ring/25';\n\nfunction isWorkspaceId(value: unknown): value is string {\n  return WORKSPACES.some((workspace) => workspace.id === value);\n}\n\nfunction WorkspaceTile({ workspace }: { workspace: Workspace }) {\n  return <CompanyMark seed={workspace.name} size='lg' />;\n}\n\nfunction ActiveIndicator({ layoutId }: { layoutId: string }) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const transition = travelOf(shouldReduceMotion);\n\n  return (\n    <motion.span\n      layoutId={layoutId}\n      transition={transition}\n      aria-hidden='true'\n      className='bg-foreground/[0.07] absolute inset-0 -z-10 rounded-md'\n    />\n  );\n}\n\nfunction SidebarRow({\n  isActive,\n  indicatorId,\n  onSelect,\n  children,\n}: {\n  isActive: boolean;\n  indicatorId: string;\n  onSelect: () => void;\n  children: React.ReactNode;\n}) {\n  let current: 'page' | undefined;\n  if (isActive) {\n    current = 'page';\n  }\n\n  return (\n    <button\n      type='button'\n      aria-current={current}\n      onClick={onSelect}\n      className={cn(ROW, isActive && 'font-medium')}\n    >\n      {isActive && <ActiveIndicator layoutId={indicatorId} />}\n      {children}\n    </button>\n  );\n}\n\nfunction CountCap({ count, label }: { count: number; label: string }) {\n  return (\n    <span className='ml-auto flex'>\n      <Kbd aria-hidden='true'>{count}</Kbd>\n      <span className='sr-only'>{label}</span>\n    </span>\n  );\n}\n\nfunction WorkspaceSwitcher() {\n  const [workspaceId, setWorkspaceId] = useState('lattice');\n  const workspace =\n    WORKSPACES.find((candidate) => candidate.id === workspaceId) ??\n    WORKSPACES[0];\n\n  function changeWorkspace(value: unknown) {\n    if (isWorkspaceId(value)) {\n      setWorkspaceId(value);\n    }\n  }\n\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger\n        render={\n          <button\n            type='button'\n            className='hover:bg-foreground/[0.04] focus-visible:ring-ring/25 data-popup-open:bg-foreground/[0.05] flex min-w-0 flex-1 cursor-pointer items-center gap-2.5 rounded-lg p-1.5 text-left outline-none focus-visible:ring-[3px]'\n          />\n        }\n      >\n        <Swap swapKey={workspace.id}>\n          <WorkspaceTile workspace={workspace} />\n        </Swap>\n        <span className='flex min-w-0 flex-1 flex-col'>\n          <span className='truncate text-[13px] leading-tight font-semibold'>\n            {workspace.name}\n          </span>\n          <span className='text-muted-foreground truncate text-xs'>\n            {workspace.plan}\n          </span>\n        </span>\n        <ChevronsUpDownIcon className='text-muted-foreground size-3.5 shrink-0' />\n      </DropdownMenuTrigger>\n      <DropdownMenuContent className='w-56'>\n        <DropdownMenuLabel>Workspaces</DropdownMenuLabel>\n        <DropdownMenuRadioGroup\n          value={workspaceId}\n          onValueChange={changeWorkspace}\n        >\n          {WORKSPACES.map((item) => (\n            <DropdownMenuRadioItem key={item.id} value={item.id} closeOnClick>\n              <WorkspaceTile workspace={item} />\n              {item.name}\n            </DropdownMenuRadioItem>\n          ))}\n        </DropdownMenuRadioGroup>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n\nfunction AccountMenu() {\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger\n        render={\n          <button\n            type='button'\n            className='hover:bg-foreground/[0.04] focus-visible:ring-ring/25 data-popup-open:bg-foreground/[0.05] flex w-full cursor-pointer items-center gap-2.5 rounded-lg p-1.5 text-left outline-none focus-visible:ring-[3px]'\n          />\n        }\n      >\n        <PersonAvatar person={ACCOUNT} presence={ACCOUNT.presence} />\n        <span className='flex min-w-0 flex-1 flex-col'>\n          <span className='truncate text-[13px] font-medium'>\n            {ACCOUNT.name}\n          </span>\n          <span className='text-muted-foreground truncate text-xs'>\n            {ACCOUNT.email}\n          </span>\n        </span>\n        <ChevronsUpDownIcon className='text-muted-foreground size-3.5 shrink-0' />\n      </DropdownMenuTrigger>\n      <DropdownMenuContent side='top' className='w-56'>\n        <DropdownMenuItem>\n          <UserIcon />\n          Profile\n        </DropdownMenuItem>\n        <DropdownMenuItem>\n          <SettingsIcon />\n          Settings\n        </DropdownMenuItem>\n        <DropdownMenuSeparator />\n        <DropdownMenuItem variant='destructive'>\n          <LogOutIcon />\n          Log out\n        </DropdownMenuItem>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n\nfunction WorkspaceSidebar() {\n  const [activeId, setActiveId] = useState('tasks');\n  const [areProjectsOpen, setAreProjectsOpen] = useState(true);\n  const indicatorId = useId();\n  const projectsListId = useId();\n\n  function toggleProjects() {\n    setAreProjectsOpen((previous) => !previous);\n  }\n\n  return (\n    <nav aria-label='Workspace' className='flex min-h-full flex-col gap-4 p-3'>\n      <AsideTitle className='sr-only'>Navigation</AsideTitle>\n      <div className='flex items-center gap-1'>\n        <WorkspaceSwitcher />\n        <AsideCloseButton label='Close navigation' />\n      </div>\n      <ul className='isolate flex flex-col gap-px'>\n        {NAV_ITEMS.map((item) => {\n          const ItemGlyph = item.icon;\n          const isActive = activeId === item.id;\n\n          function select() {\n            setActiveId(item.id);\n          }\n\n          return (\n            <li key={item.id}>\n              <SidebarRow\n                isActive={isActive}\n                indicatorId={indicatorId}\n                onSelect={select}\n              >\n                <ItemGlyph className='text-muted-foreground size-4 shrink-0' />\n                {item.label}\n                {item.count !== undefined && (\n                  <CountCap count={item.count} label={`${item.count} unread`} />\n                )}\n              </SidebarRow>\n            </li>\n          );\n        })}\n      </ul>\n      <section aria-label='Projects' className='flex flex-col gap-px'>\n        <div className='flex items-center gap-0.5'>\n          <button\n            type='button'\n            aria-expanded={areProjectsOpen}\n            aria-controls={projectsListId}\n            onClick={toggleProjects}\n            className='text-muted-foreground hover:text-foreground focus-visible:ring-ring/25 flex h-7 flex-1 cursor-pointer items-center gap-1 rounded-md px-2 text-left text-xs font-medium outline-none focus-visible:ring-[3px]'\n          >\n            Projects\n            <ChevronDownIcon\n              className={cn(\n                'size-3 transition-transform duration-200 ease-(--ease-out-strong)',\n                !areProjectsOpen && '-rotate-90'\n              )}\n            />\n          </button>\n          <Button\n            variant='ghost'\n            size='icon-sm'\n            aria-label='Create project'\n            className='text-muted-foreground'\n          >\n            <PlusIcon />\n          </Button>\n        </div>\n        <AnimatedSize>\n          {areProjectsOpen && (\n            <ul id={projectsListId} className='isolate flex flex-col gap-px'>\n              {PROJECTS.map((project) => {\n                const isActive = activeId === project.id;\n\n                function select() {\n                  setActiveId(project.id);\n                }\n\n                return (\n                  <li key={project.id}>\n                    <SidebarRow\n                      isActive={isActive}\n                      indicatorId={indicatorId}\n                      onSelect={select}\n                    >\n                      <MeshTile\n                        seed={project.name}\n                        color={project.color}\n                        size='sm'\n                      />\n                      <span className='min-w-0 flex-1 truncate'>\n                        {project.name}\n                      </span>\n                      {project.isTracked && (\n                        <span className='text-primary-ink flex items-center'>\n                          <ClockIcon className='size-3.5' strokeWidth={2.25} />\n                          <span className='sr-only'>Timer running</span>\n                        </span>\n                      )}\n                      <CountCap\n                        count={project.openTasks}\n                        label={`${project.openTasks} open tasks`}\n                      />\n                    </SidebarRow>\n                  </li>\n                );\n              })}\n              <li>\n                <SidebarRow\n                  isActive={activeId === 'all-projects'}\n                  indicatorId={indicatorId}\n                  onSelect={() => setActiveId('all-projects')}\n                >\n                  <FoldersIcon className='text-muted-foreground size-4 shrink-0' />\n                  All projects\n                  <CountCap\n                    count={ALL_PROJECTS_COUNT}\n                    label={`${ALL_PROJECTS_COUNT} projects`}\n                  />\n                </SidebarRow>\n              </li>\n              <li>\n                <SidebarRow\n                  isActive={activeId === 'archived'}\n                  indicatorId={indicatorId}\n                  onSelect={() => setActiveId('archived')}\n                >\n                  <ArchiveIcon className='text-muted-foreground size-4 shrink-0' />\n                  Archived\n                  <CountCap\n                    count={ARCHIVED_COUNT}\n                    label={`${ARCHIVED_COUNT} archived projects`}\n                  />\n                </SidebarRow>\n              </li>\n            </ul>\n          )}\n        </AnimatedSize>\n      </section>\n      <div className='mt-auto pt-6'>\n        <AccountMenu />\n      </div>\n    </nav>\n  );\n}\n\nexport default function Aside06() {\n  return (\n    <AsidePreview\n      triggerLabel='Open navigation'\n      side='left'\n      className='max-w-72'\n    >\n      <WorkspaceSidebar />\n    </AsidePreview>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/aside/aside-06.tsx"
    },
    {
      "path": "registry/ndeko/components/aside/_parts/aside-frame.tsx",
      "content": "'use client';\n\nimport { createContext, useContext } from 'react';\n\nimport { PanelsTopLeftIcon, XIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport {\n  Sheet,\n  SheetClose,\n  SheetContent,\n  SheetDescription,\n  SheetTitle,\n  SheetTrigger,\n} from '@/registry/ndeko/ui/sheet';\n\n/** Where an aside's content is drawn: open in the page as a preview, or inside the real sheet. */\nexport type AsideHost = 'preview' | 'sheet';\n\nconst AsideHostContext = createContext<AsideHost>('preview');\n\nexport function useAsideHost() {\n  return useContext(AsideHostContext);\n}\n\nexport type AsideSide = 'left' | 'right';\n\nconst TITLE = 'text-lg leading-tight font-semibold';\n\nconst DESCRIPTION = 'text-muted-foreground text-[13px]';\n\n/** The background of the surface the aside sits on, for parts that must cover what scrolls under them. */\nexport const ASIDE_SURFACE = 'bg-[var(--aside-surface)]';\n\ntype AsideTextProps = { className?: string; children: React.ReactNode };\n\nexport function AsideTitle({ className, children }: AsideTextProps) {\n  const host = useAsideHost();\n  if (host === 'sheet') {\n    return <SheetTitle className={className}>{children}</SheetTitle>;\n  }\n  return <h2 className={cn(TITLE, className)}>{children}</h2>;\n}\n\nexport function AsideDescription({ className, children }: AsideTextProps) {\n  const host = useAsideHost();\n  if (host === 'sheet') {\n    return (\n      <SheetDescription className={className}>{children}</SheetDescription>\n    );\n  }\n  return <p className={cn(DESCRIPTION, className)}>{children}</p>;\n}\n\n/** The close button of the sheet's header. The preview has nothing to close, so it draws nothing. */\nexport function AsideCloseButton({\n  label = 'Close panel',\n  className,\n}: {\n  label?: string;\n  className?: string;\n}) {\n  const host = useAsideHost();\n  if (host === 'preview') {\n    return null;\n  }\n  return (\n    <SheetClose\n      render={\n        <Button\n          variant='ghost'\n          size='icon-sm'\n          aria-label={label}\n          className={cn('text-muted-foreground', className)}\n        />\n      }\n    >\n      <XIcon />\n    </SheetClose>\n  );\n}\n\ntype AsidePreviewProps = {\n  /** The content, drawn twice: open in the page, and inside the sheet the trigger opens. */\n  children: React.ReactNode;\n  triggerLabel: string;\n  side?: AsideSide;\n  className?: string;\n};\n\n/** Shows an aside open and whole on the page, with a small trigger that slides the same content in as a real sheet. */\nexport function AsidePreview({\n  children,\n  triggerLabel,\n  side = 'right',\n  className,\n}: AsidePreviewProps) {\n  return (\n    <div className='flex w-full flex-col items-center gap-4'>\n      <AsideHostContext.Provider value='preview'>\n        <div\n          className={cn(\n            'surface-raised flex w-full max-w-sm flex-col overflow-hidden rounded-2xl text-left [--aside-surface:var(--popover)]',\n            className\n          )}\n        >\n          {children}\n        </div>\n      </AsideHostContext.Provider>\n      <Sheet>\n        <SheetTrigger render={<Button variant='outline' size='sm' />}>\n          <PanelsTopLeftIcon />\n          {triggerLabel}\n        </SheetTrigger>\n        <SheetContent\n          side={side}\n          showCloseButton={false}\n          className={cn('gap-0 p-0 [--aside-surface:var(--card)]', className)}\n        >\n          <AsideHostContext.Provider value='sheet'>\n            {children}\n          </AsideHostContext.Provider>\n        </SheetContent>\n      </Sheet>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/aside/_parts/aside-frame.tsx"
    },
    {
      "path": "registry/ndeko/components/aside/_parts/motion.ts",
      "content": "import type { Transition, Variants } from 'motion/react';\n\nexport const SWAP_TRANSITION: Transition = {\n  duration: 0.15,\n  ease: [0.2, 0, 0, 1],\n};\n\nconst TRAVEL_SPRING: Transition = { type: 'spring', bounce: 0, duration: 0.3 };\n\nconst INSTANT: Transition = { duration: 0 };\n\nconst ENTER: Transition = { duration: 0.2, ease: [0.23, 1, 0.32, 1] };\n\nconst LEAVE: Transition = { duration: 0.14, ease: [0.23, 1, 0.32, 1] };\n\nconst ICON_SWAP: Variants = {\n  enter: { opacity: 0, scale: 0.6, filter: 'blur(2px)' },\n  visible: { opacity: 1, scale: 1, filter: 'blur(0px)' },\n  exit: { opacity: 0, scale: 0.6, filter: 'blur(2px)' },\n};\n\nconst LABEL_SWAP: Variants = {\n  enter: { opacity: 0, filter: 'blur(2px)' },\n  visible: { opacity: 1, filter: 'blur(0px)' },\n  exit: { opacity: 0, filter: 'blur(2px)' },\n};\n\nconst FADE: Variants = {\n  enter: { opacity: 0 },\n  visible: { opacity: 1 },\n  exit: { opacity: 0 },\n};\n\nconst HEIGHT_PRESENCE: Variants = {\n  hidden: { height: 0, opacity: 0, overflow: 'hidden', transition: LEAVE },\n  shown: {\n    height: 'auto',\n    opacity: 1,\n    transition: ENTER,\n    transitionEnd: { overflow: 'visible' },\n  },\n};\n\nconst FADE_PRESENCE: Variants = {\n  hidden: { opacity: 0, transition: LEAVE },\n  shown: { opacity: 1, transition: ENTER },\n};\n\nconst CHIP_PRESENCE: Variants = {\n  hidden: { opacity: 0, scale: 0.9, transition: LEAVE },\n  shown: { opacity: 1, scale: 1, transition: ENTER },\n};\n\nexport type SwapKind = 'icon' | 'label';\n\nexport function swapVariantsOf(\n  shouldReduceMotion: boolean | null,\n  kind: SwapKind = 'icon'\n) {\n  if (shouldReduceMotion) {\n    return FADE;\n  }\n  if (kind === 'label') {\n    return LABEL_SWAP;\n  }\n  return ICON_SWAP;\n}\n\n/** A row that joins or leaves a list: its height opens or collapses, so what follows slides instead of jumping. */\nexport function rowVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_PRESENCE;\n  }\n  return HEIGHT_PRESENCE;\n}\n\nexport function chipVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_PRESENCE;\n  }\n  return CHIP_PRESENCE;\n}\n\nexport function travelOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return INSTANT;\n  }\n  return TRAVEL_SPRING;\n}\n",
      "type": "registry:component",
      "target": "components/aside/_parts/motion.ts"
    },
    {
      "path": "registry/ndeko/components/aside/_parts/people.ts",
      "content": "export type Presence = 'tracking' | 'online' | 'away' | 'offline';\n\nexport type Person = {\n  id: string;\n  name: string;\n  email: string;\n  title: string;\n  presence: Presence;\n};\n\nexport const PEOPLE: Person[] = [\n  {\n    id: 'amara',\n    name: 'Amara Okafor',\n    email: 'amara@lattice.example',\n    title: 'Product designer',\n    presence: 'tracking',\n  },\n  {\n    id: 'lucas',\n    name: 'Lucas Moreau',\n    email: 'lucas@lattice.example',\n    title: 'Engineering lead',\n    presence: 'online',\n  },\n  {\n    id: 'priya',\n    name: 'Priya Raman',\n    email: 'priya@lattice.example',\n    title: 'Frontend engineer',\n    presence: 'online',\n  },\n  {\n    id: 'mateo',\n    name: 'Mateo Silva',\n    email: 'mateo@lattice.example',\n    title: 'Backend engineer',\n    presence: 'away',\n  },\n  {\n    id: 'hana',\n    name: 'Hana Kobayashi',\n    email: 'hana@lattice.example',\n    title: 'Product manager',\n    presence: 'tracking',\n  },\n  {\n    id: 'jonas',\n    name: 'Jonas Weber',\n    email: 'jonas@lattice.example',\n    title: 'QA engineer',\n    presence: 'offline',\n  },\n  {\n    id: 'zola',\n    name: 'Zola Mbeki',\n    email: 'zola@lattice.example',\n    title: 'Content designer',\n    presence: 'online',\n  },\n];\n\nfunction isKnownPerson(person: Person | undefined): person is Person {\n  return person !== undefined;\n}\n\nexport function peopleByIds(ids: string[]) {\n  const found = ids.map((id) => PEOPLE.find((person) => person.id === id));\n  return found.filter(isKnownPerson);\n}\n\nexport function firstNameOf(person: Person) {\n  const [firstName] = person.name.split(' ');\n  return firstName;\n}\n",
      "type": "registry:component",
      "target": "components/aside/_parts/people.ts"
    },
    {
      "path": "registry/ndeko/components/aside/_parts/person-avatar.tsx",
      "content": "import {\n  CheckIcon,\n  ClockIcon,\n  MinusIcon,\n  MoonIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\n\nimport type { Person, Presence } from './people';\n\ntype PresenceMeta = { label: string; color: string; icon: Icon };\n\nexport const PRESENCE_META: Record<Presence, PresenceMeta> = {\n  tracking: {\n    label: 'Tracking time',\n    color: 'var(--primary)',\n    icon: ClockIcon,\n  },\n  online: { label: 'Online', color: 'var(--success)', icon: CheckIcon },\n  away: { label: 'Away', color: 'var(--warning)', icon: MoonIcon },\n  offline: {\n    label: 'Offline',\n    color: 'var(--muted-foreground)',\n    icon: MinusIcon,\n  },\n};\n\ntype AvatarSize = 'xs' | 'sm' | 'md' | 'lg';\n\nconst AVATAR_SIZE: Record<AvatarSize, string> = {\n  xs: 'size-5',\n  sm: 'size-6',\n  md: 'size-8',\n  lg: 'size-12',\n};\n\nconst BADGE_SIZE: Record<AvatarSize, string> = {\n  xs: 'size-2.5 [&_svg]:size-1.5',\n  sm: 'size-3 [&_svg]:size-2',\n  md: 'size-3.5 [&_svg]:size-2',\n  lg: 'size-4.5 [&_svg]:size-3',\n};\n\ntype PersonAvatarProps = {\n  person: Pick<Person, 'name'>;\n  size?: AvatarSize;\n  /** Drawn as a small glyph on the avatar, never as a plain dot; its label is read by screen readers. */\n  presence?: Presence;\n  className?: string;\n};\n\nexport function PersonAvatar({\n  person,\n  size = 'md',\n  presence,\n  className,\n}: PersonAvatarProps) {\n  return (\n    <span className={cn('relative inline-flex shrink-0', className)}>\n      <Avatar className={AVATAR_SIZE[size]} seed={person.name} />\n      {presence && <PresenceGlyph presence={presence} size={size} />}\n    </span>\n  );\n}\n\nfunction PresenceGlyph({\n  presence,\n  size,\n}: {\n  presence: Presence;\n  size: AvatarSize;\n}) {\n  const meta = PRESENCE_META[presence];\n  const Glyph = meta.icon;\n  const badgeStyle = { '--chip': meta.color } as React.CSSProperties;\n\n  return (\n    <>\n      <span className='absolute -right-0.5 -bottom-0.5 flex rounded-full bg-[var(--aside-surface,var(--popover))] p-px'>\n        <span\n          style={badgeStyle}\n          className={cn(\n            'chip-3d flex items-center justify-center rounded-full',\n            BADGE_SIZE[size]\n          )}\n        >\n          <Glyph strokeWidth={2.75} />\n        </span>\n      </span>\n      <span className='sr-only'>{meta.label}</span>\n    </>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/aside/_parts/person-avatar.tsx"
    },
    {
      "path": "registry/ndeko/components/aside/_parts/swap.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion } from 'motion/react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { cn } from '@/registry/ndeko/lib/utils';\n\nimport { SWAP_TRANSITION, swapVariantsOf, type SwapKind } from './motion';\n\ntype SwapProps = {\n  /** Changes when the content becomes another one: the old leaves while the new arrives in its place. */\n  swapKey: string;\n  kind?: SwapKind;\n  className?: string;\n  children: React.ReactNode;\n};\n\nexport function Swap({\n  swapKey,\n  kind = 'icon',\n  className,\n  children,\n}: SwapProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const variants = swapVariantsOf(shouldReduceMotion, kind);\n\n  return (\n    <span className={cn('relative inline-flex items-center', className)}>\n      <AnimatePresence mode='popLayout' initial={false}>\n        <motion.span\n          key={swapKey}\n          className='inline-flex items-center gap-[inherit] whitespace-nowrap'\n          variants={variants}\n          initial='enter'\n          animate='visible'\n          exit='exit'\n          transition={SWAP_TRANSITION}\n        >\n          {children}\n        </motion.span>\n      </AnimatePresence>\n    </span>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/aside/_parts/swap.tsx"
    }
  ],
  "categories": [
    "components",
    "aside"
  ],
  "type": "registry:component"
}