{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "aside-01",
  "title": "Task details",
  "description": "Properties as rows with a status menu and assignee chips, sub-issues you check off and a comment box pinned at the foot",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/avatar.json",
    "https://ui.ndekocode.dev/r/badge.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/checkbox.json",
    "https://ui.ndekocode.dev/r/chip.json",
    "https://ui.ndekocode.dev/r/dropdown-menu.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/motion-number.json",
    "https://ui.ndekocode.dev/r/sheet.json",
    "https://ui.ndekocode.dev/r/textarea.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-01.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion } from 'motion/react';\nimport { useId, useState } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport {\n  CalendarIcon,\n  CircleDashedIcon,\n  ClockIcon,\n  HashIcon,\n  MessageCircleIcon,\n  PlusIcon,\n  SendIcon,\n  StarIcon,\n  UsersIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Checkbox } from '@/registry/ndeko/ui/checkbox';\nimport { Chip } from '@/registry/ndeko/ui/chip';\nimport {\n  DropdownMenu,\n  DropdownMenuCheckboxItem,\n  DropdownMenuContent,\n  DropdownMenuLabel,\n  DropdownMenuRadioGroup,\n  DropdownMenuRadioItem,\n  DropdownMenuTrigger,\n} from '@/registry/ndeko/ui/dropdown-menu';\nimport { Textarea } from '@/registry/ndeko/ui/textarea';\n\nimport {\n  ASIDE_SURFACE,\n  AsideCloseButton,\n  AsidePreview,\n  AsideTitle,\n} from './_parts/aside-frame';\nimport { CopyIconButton } from './_parts/copy-icon-button';\nimport { chipVariantsOf, rowVariantsOf } from './_parts/motion';\nimport { PEOPLE, firstNameOf, peopleByIds } from './_parts/people';\nimport { PersonAvatar } from './_parts/person-avatar';\nimport { Swap } from './_parts/swap';\nimport {\n  IssueTypeGem,\n  MetaGlyph,\n  PRIORITY_META,\n  STATUS_META,\n  STATUS_ORDER,\n  isStatusId,\n  type StatusId,\n} from './_parts/task-meta';\n\ntype SubIssue = { id: string; number: string; title: string; isDone: boolean };\n\ntype Comment = { id: string; authorId: string; text: string; time: string };\n\nconst TASK_NUMBER = 'LAT-142';\n\nconst TASK_LINK = 'https://lattice.example/tasks/LAT-142';\n\nconst AUTHOR_ID = 'amara';\n\nconst SUB_ISSUES: SubIssue[] = [\n  {\n    id: 'sub-1',\n    number: 'LAT-143',\n    title: 'List the steps people skip today',\n    isDone: true,\n  },\n  {\n    id: 'sub-2',\n    number: 'LAT-144',\n    title: 'Draw the checklist at 375 px',\n    isDone: true,\n  },\n  {\n    id: 'sub-3',\n    number: 'LAT-145',\n    title: 'Write the empty state of each step',\n    isDone: false,\n  },\n  {\n    id: 'sub-4',\n    number: 'LAT-146',\n    title: 'Review the flow with support',\n    isDone: false,\n  },\n];\n\nconst COMMENTS: Comment[] = [\n  {\n    id: 'comment-1',\n    authorId: 'lucas',\n    text: 'The second step can merge with the first on small screens.',\n    time: '2 h ago',\n  },\n  {\n    id: 'comment-2',\n    authorId: 'priya',\n    text: 'I can take the empty states once the copy is in.',\n    time: '40 min ago',\n  },\n];\n\nconst RING_RADIUS = 6;\n\nconst RING_LENGTH = 2 * Math.PI * RING_RADIUS;\n\nfunction favouriteLabelOf(isFavourite: boolean) {\n  if (isFavourite) {\n    return 'Remove from favourites';\n  }\n  return 'Add to favourites';\n}\n\nfunction starClassOf(isFavourite: boolean) {\n  if (isFavourite) {\n    return 'text-warning-foreground';\n  }\n  return 'text-muted-foreground';\n}\n\nfunction PropertyRow({\n  icon: RowIcon,\n  label,\n  children,\n}: {\n  icon: Icon;\n  label: string;\n  children: React.ReactNode;\n}) {\n  return (\n    <div className='grid min-h-8 grid-cols-[6.5rem_1fr] items-center gap-2'>\n      <span className='text-muted-foreground flex items-center gap-2 text-[13px]'>\n        <RowIcon className='size-3.5 shrink-0' />\n        {label}\n      </span>\n      <div className='flex min-w-0 flex-wrap items-center gap-1'>\n        {children}\n      </div>\n    </div>\n  );\n}\n\nfunction StatusMenu({\n  status,\n  onChange,\n}: {\n  status: StatusId;\n  onChange: (status: StatusId) => void;\n}) {\n  const meta = STATUS_META[status];\n  const StatusGlyph = meta.icon;\n  const chipStyle = { '--chip': meta.color } as React.CSSProperties;\n\n  function changeStatus(value: unknown) {\n    if (isStatusId(value)) {\n      onChange(value);\n    }\n  }\n\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger\n        render={\n          <button\n            type='button'\n            aria-label={`Status: ${meta.label}. Change status`}\n            style={chipStyle}\n            className='chip-3d focus-visible:ring-ring/25 inline-flex h-6 cursor-pointer items-center overflow-hidden rounded-md px-1.5 text-xs font-medium outline-none focus-visible:ring-[3px]'\n          />\n        }\n      >\n        <Swap swapKey={status} className='gap-1'>\n          <StatusGlyph className='size-3' strokeWidth={2.25} />\n          {meta.label}\n        </Swap>\n      </DropdownMenuTrigger>\n      <DropdownMenuContent className='w-44'>\n        <DropdownMenuLabel>Status</DropdownMenuLabel>\n        <DropdownMenuRadioGroup value={status} onValueChange={changeStatus}>\n          {STATUS_ORDER.map((statusId) => (\n            <DropdownMenuRadioItem key={statusId} value={statusId} closeOnClick>\n              <MetaGlyph meta={STATUS_META[statusId]} className='size-4' />\n              {STATUS_META[statusId].label}\n            </DropdownMenuRadioItem>\n          ))}\n        </DropdownMenuRadioGroup>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n\nfunction Assignees({\n  assigneeIds,\n  onToggle,\n}: {\n  assigneeIds: string[];\n  onToggle: (personId: string) => void;\n}) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const variants = chipVariantsOf(shouldReduceMotion);\n  const allowsLayout = !shouldReduceMotion;\n  const assignees = peopleByIds(assigneeIds);\n\n  return (\n    <>\n      <AnimatePresence initial={false} mode='popLayout'>\n        {assignees.map((person) => (\n          <motion.span\n            key={person.id}\n            layout={allowsLayout}\n            variants={variants}\n            initial='hidden'\n            animate='shown'\n            exit='hidden'\n            className='flex'\n          >\n            <Badge\n              variant='secondary'\n              className='text-muted-foreground h-6 gap-1.5 pr-2 pl-0.5'\n            >\n              <PersonAvatar person={person} size='xs' />\n              {firstNameOf(person)}\n            </Badge>\n          </motion.span>\n        ))}\n      </AnimatePresence>\n      <motion.span layout={allowsLayout} className='flex'>\n        <DropdownMenu>\n          <DropdownMenuTrigger\n            render={\n              <button\n                type='button'\n                aria-label='Add or remove assignees'\n                className='hairline-border border-foreground/25 text-muted-foreground hover:bg-foreground/5 hover:text-foreground focus-visible:ring-ring/25 flex size-6 cursor-pointer items-center justify-center rounded-full border-dashed outline-none focus-visible:ring-[3px]'\n              />\n            }\n          >\n            <PlusIcon className='size-3.5' />\n          </DropdownMenuTrigger>\n          <DropdownMenuContent className='w-52'>\n            <DropdownMenuLabel>Assignees</DropdownMenuLabel>\n            {PEOPLE.map((person) => {\n              const isAssigned = assigneeIds.includes(person.id);\n\n              function toggle() {\n                onToggle(person.id);\n              }\n\n              return (\n                <DropdownMenuCheckboxItem\n                  key={person.id}\n                  checked={isAssigned}\n                  onCheckedChange={toggle}\n                >\n                  <PersonAvatar person={person} size='xs' />\n                  {person.name}\n                </DropdownMenuCheckboxItem>\n              );\n            })}\n          </DropdownMenuContent>\n        </DropdownMenu>\n      </motion.span>\n    </>\n  );\n}\n\nfunction ProgressRing({ done, total }: { done: number; total: number }) {\n  const share = done / total;\n  const remaining = RING_LENGTH * (1 - share);\n\n  return (\n    <svg viewBox='0 0 16 16' aria-hidden='true' className='size-4 -rotate-90'>\n      <circle\n        cx='8'\n        cy='8'\n        r={RING_RADIUS}\n        fill='none'\n        strokeWidth='2'\n        className='stroke-foreground/10'\n      />\n      <circle\n        cx='8'\n        cy='8'\n        r={RING_RADIUS}\n        fill='none'\n        strokeWidth='2'\n        strokeLinecap='round'\n        strokeDasharray={RING_LENGTH}\n        strokeDashoffset={remaining}\n        className='stroke-success transition-[stroke-dashoffset] duration-300 ease-(--ease-out-strong)'\n      />\n    </svg>\n  );\n}\n\nfunction SubIssueRow({\n  issue,\n  onToggle,\n}: {\n  issue: SubIssue;\n  onToggle: (issueId: string) => void;\n}) {\n  const checkboxId = useId();\n\n  function toggle() {\n    onToggle(issue.id);\n  }\n\n  return (\n    <li className='flex min-h-8 items-center gap-2.5'>\n      <Checkbox\n        id={checkboxId}\n        checked={issue.isDone}\n        onCheckedChange={toggle}\n      />\n      <label\n        htmlFor={checkboxId}\n        className='flex min-w-0 flex-1 cursor-pointer items-baseline gap-2 text-[13px]'\n      >\n        <span className='text-muted-foreground shrink-0 text-xs tabular-nums'>\n          {issue.number}\n        </span>\n        <span\n          className={cn(\n            'truncate decoration-transparent transition-[color,text-decoration-color] duration-200',\n            issue.isDone &&\n              'text-muted-foreground decoration-muted-foreground/60 line-through'\n          )}\n        >\n          {issue.title}\n        </span>\n      </label>\n    </li>\n  );\n}\n\nfunction CommentRow({ comment }: { comment: Comment }) {\n  const [author] = peopleByIds([comment.authorId]);\n  if (!author) {\n    return null;\n  }\n\n  return (\n    <div className='flex gap-2.5 pb-3'>\n      <PersonAvatar person={author} size='sm' />\n      <div className='flex min-w-0 flex-col gap-0.5'>\n        <p className='text-xs'>\n          <span className='font-medium'>{author.name}</span>\n          <span className='text-muted-foreground'>{` · ${comment.time}`}</span>\n        </p>\n        <p className='text-[13px] leading-5'>{comment.text}</p>\n      </div>\n    </div>\n  );\n}\n\nfunction TaskDetails() {\n  const [status, setStatus] = useState<StatusId>('in-progress');\n  const [isFavourite, setIsFavourite] = useState(false);\n  const [assigneeIds, setAssigneeIds] = useState(['amara', 'priya']);\n  const [subIssues, setSubIssues] = useState(SUB_ISSUES);\n  const [comments, setComments] = useState(COMMENTS);\n  const [draft, setDraft] = useState('');\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const rowVariants = rowVariantsOf(shouldReduceMotion);\n  const commentFieldId = useId();\n  const doneCount = subIssues.filter((issue) => issue.isDone).length;\n  const canPost = draft.trim().length > 0;\n  const favouriteLabel = favouriteLabelOf(isFavourite);\n  const starKey = String(isFavourite);\n  const priority = PRIORITY_META.high;\n  const PriorityGlyph = priority.icon;\n\n  function toggleFavourite() {\n    setIsFavourite((previous) => !previous);\n  }\n\n  function toggleAssignee(personId: string) {\n    setAssigneeIds((previous) => {\n      const isAssigned = previous.includes(personId);\n      if (isAssigned) {\n        return previous.filter((id) => id !== personId);\n      }\n      return [...previous, personId];\n    });\n  }\n\n  function toggleSubIssue(issueId: string) {\n    setSubIssues((previous) =>\n      previous.map((issue) => {\n        if (issue.id !== issueId) {\n          return issue;\n        }\n        return { ...issue, isDone: !issue.isDone };\n      })\n    );\n  }\n\n  function changeDraft(event: React.ChangeEvent<HTMLTextAreaElement>) {\n    setDraft(event.target.value);\n  }\n\n  function post() {\n    const text = draft.trim();\n    if (text.length === 0) {\n      return;\n    }\n    const comment: Comment = {\n      id: `comment-${comments.length + 1}`,\n      authorId: AUTHOR_ID,\n      text,\n      time: 'just now',\n    };\n    setComments((previous) => [...previous, comment]);\n    setDraft('');\n  }\n\n  function submit(event: React.FormEvent<HTMLFormElement>) {\n    event.preventDefault();\n    post();\n  }\n\n  function postOnShortcut(event: React.KeyboardEvent<HTMLTextAreaElement>) {\n    const isEnter = event.key === 'Enter';\n    const hasModifier = event.metaKey || event.ctrlKey;\n    const isShortcut = isEnter && hasModifier;\n    if (isShortcut) {\n      event.preventDefault();\n      post();\n    }\n  }\n\n  return (\n    <div className='flex min-h-full flex-col'>\n      <div\n        className={cn(\n          'sticky top-0 z-10 flex h-12 shrink-0 items-center gap-1 px-3',\n          ASIDE_SURFACE\n        )}\n      >\n        <span className='text-muted-foreground flex min-w-0 flex-1 items-center gap-1.5 px-2 text-xs'>\n          <span className='truncate'>Product</span>\n          <span aria-hidden='true'>/</span>\n          <span className='text-foreground tabular-nums'>{TASK_NUMBER}</span>\n        </span>\n        <Button\n          variant='ghost'\n          size='icon-sm'\n          aria-label={favouriteLabel}\n          aria-pressed={isFavourite}\n          onClick={toggleFavourite}\n        >\n          <Swap swapKey={starKey}>\n            <StarIcon className={starClassOf(isFavourite)} />\n          </Swap>\n        </Button>\n        <CopyIconButton\n          text={TASK_LINK}\n          glyph='link'\n          label={`Copy the link to ${TASK_NUMBER}`}\n          announcement='Link copied'\n        />\n        <AsideCloseButton label='Close task' />\n      </div>\n      <div className='flex flex-1 flex-col gap-6 px-5 pt-1 pb-5'>\n        <div className='flex flex-col gap-2'>\n          <p className='text-muted-foreground flex items-center gap-1.5 text-xs'>\n            <IssueTypeGem type='story' />\n            <span className='tabular-nums'>{TASK_NUMBER}</span>\n            <span aria-hidden='true'>·</span>\n            <span>Created Nov 3</span>\n          </p>\n          <AsideTitle className='text-balance'>\n            Redraw the onboarding checklist for small screens\n          </AsideTitle>\n        </div>\n        <div className='flex flex-col gap-0.5'>\n          <PropertyRow icon={CircleDashedIcon} label='Status'>\n            <StatusMenu status={status} onChange={setStatus} />\n          </PropertyRow>\n          <PropertyRow icon={priority.icon} label='Priority'>\n            <Chip color={priority.color} className='h-6 px-1.5'>\n              <PriorityGlyph className='size-3' strokeWidth={2.25} />\n              {priority.label}\n            </Chip>\n          </PropertyRow>\n          <PropertyRow icon={UsersIcon} label='Assignees'>\n            <Assignees assigneeIds={assigneeIds} onToggle={toggleAssignee} />\n          </PropertyRow>\n          <PropertyRow icon={HashIcon} label='Labels'>\n            <Badge variant='secondary' className='text-muted-foreground h-6'>\n              Design\n            </Badge>\n            <Badge variant='secondary' className='text-muted-foreground h-6'>\n              Onboarding\n            </Badge>\n          </PropertyRow>\n          <PropertyRow icon={CalendarIcon} label='Due date'>\n            <span className='text-[13px]'>Nov 8</span>\n            <span className='text-muted-foreground text-xs'>in 3 days</span>\n          </PropertyRow>\n          <PropertyRow icon={ClockIcon} label='Estimate'>\n            <span className='text-[13px] tabular-nums'>4h</span>\n            <span className='text-muted-foreground text-xs tabular-nums'>\n              2h 15m logged\n            </span>\n          </PropertyRow>\n        </div>\n        <p className='bg-foreground/[0.03] rounded-xl px-3.5 py-3 text-[13px] leading-5'>\n          New people skip two of the five steps on a phone. Redraw the list so\n          every step fits one screen and says what is left.\n        </p>\n        <section aria-label='Sub-issues' className='flex flex-col gap-2'>\n          <div className='flex items-center gap-2'>\n            <h3 className='text-sm font-medium'>Sub-issues</h3>\n            <span className='text-muted-foreground ml-auto flex items-center gap-1.5 text-xs'>\n              <ProgressRing done={doneCount} total={subIssues.length} />\n              <span className='flex tabular-nums'>\n                <MotionNumber value={doneCount} />\n                {`/${subIssues.length} done`}\n              </span>\n            </span>\n          </div>\n          <ul className='flex flex-col'>\n            {subIssues.map((issue) => (\n              <SubIssueRow\n                key={issue.id}\n                issue={issue}\n                onToggle={toggleSubIssue}\n              />\n            ))}\n          </ul>\n        </section>\n        <section aria-label='Comments' className='flex flex-col gap-3'>\n          <h3 className='flex items-center gap-2 text-sm font-medium'>\n            <MessageCircleIcon className='text-muted-foreground size-4' />\n            Comments\n          </h3>\n          <ul className='flex flex-col'>\n            <AnimatePresence initial={false}>\n              {comments.map((comment) => (\n                <motion.li\n                  key={comment.id}\n                  variants={rowVariants}\n                  initial='hidden'\n                  animate='shown'\n                  exit='hidden'\n                >\n                  <CommentRow comment={comment} />\n                </motion.li>\n              ))}\n            </AnimatePresence>\n          </ul>\n        </section>\n      </div>\n      <form\n        onSubmit={submit}\n        className={cn(\n          'sticky bottom-0 flex items-end gap-2 px-5 pt-2 pb-4',\n          ASIDE_SURFACE\n        )}\n      >\n        <label htmlFor={commentFieldId} className='sr-only'>\n          Comment\n        </label>\n        <Textarea\n          id={commentFieldId}\n          rows={1}\n          value={draft}\n          placeholder='Leave a comment'\n          onChange={changeDraft}\n          onKeyDown={postOnShortcut}\n          className='min-h-9 py-1.5'\n        />\n        <Button\n          type='submit'\n          size='icon'\n          aria-label='Post comment'\n          disabled={!canPost}\n          className='shrink-0'\n        >\n          <SendIcon />\n        </Button>\n      </form>\n    </div>\n  );\n}\n\nexport default function Aside01() {\n  return (\n    <AsidePreview triggerLabel='Open task details'>\n      <TaskDetails />\n    </AsidePreview>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/aside/aside-01.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/copy-icon-button.tsx",
      "content": "'use client';\n\nimport { useEffect, useState } from 'react';\n\nimport { CheckIcon, CopyIcon, LinkIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Button } from '@/registry/ndeko/ui/button';\n\nimport { Swap } from './swap';\n\nconst COPIED_RESET_MS = 1600;\n\ntype CopyGlyph = 'copy' | 'link';\n\nfunction glyphOf(isCopied: boolean, glyph: CopyGlyph) {\n  if (isCopied) {\n    return <CheckIcon className='text-success-foreground' />;\n  }\n  if (glyph === 'link') {\n    return <LinkIcon />;\n  }\n  return <CopyIcon />;\n}\n\ntype CopyIconButtonProps = {\n  text: string;\n  label: string;\n  /** Announced once the text is on the clipboard. */\n  announcement: string;\n  glyph?: CopyGlyph;\n  className?: string;\n};\n\nexport function CopyIconButton({\n  text,\n  label,\n  announcement,\n  glyph = 'copy',\n  className,\n}: CopyIconButtonProps) {\n  const [isCopied, setIsCopied] = useState(false);\n  const icon = glyphOf(isCopied, glyph);\n  const iconKey = String(isCopied);\n\n  useEffect(() => {\n    if (!isCopied) {\n      return;\n    }\n    const timeout = window.setTimeout(() => {\n      setIsCopied(false);\n    }, COPIED_RESET_MS);\n    return () => window.clearTimeout(timeout);\n  }, [isCopied]);\n\n  async function copy() {\n    try {\n      await navigator.clipboard.writeText(text);\n      setIsCopied(true);\n    } catch {\n      setIsCopied(false);\n    }\n  }\n\n  return (\n    <>\n      <Button\n        variant='ghost'\n        size='icon-sm'\n        aria-label={label}\n        onClick={copy}\n        className={cn('text-muted-foreground', className)}\n      >\n        <Swap swapKey={iconKey}>{icon}</Swap>\n      </Button>\n      <span className='sr-only' role='status'>\n        {isCopied && announcement}\n      </span>\n    </>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/aside/_parts/copy-icon-button.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"
    },
    {
      "path": "registry/ndeko/components/aside/_parts/task-meta.tsx",
      "content": "import {\n  BookmarkIcon,\n  CheckIcon,\n  ChevronDownIcon,\n  ChevronUpIcon,\n  CircleAlertIcon,\n  CircleCheckIcon,\n  CircleDashedIcon,\n  CircleIcon,\n  EclipseIcon,\n  EyeIcon,\n  MinusIcon,\n  TriangleAlertIcon,\n  ZapIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\n\nexport type Meta = { label: string; color: string; icon: Icon };\n\nexport type StatusId =\n  'backlog' | 'todo' | 'in-progress' | 'in-review' | 'done';\n\nexport type PriorityId = 'urgent' | 'high' | 'medium' | 'low';\n\nexport type IssueType = 'task' | 'bug' | 'story' | 'epic';\n\nexport const STATUS_ORDER: StatusId[] = [\n  'backlog',\n  'todo',\n  'in-progress',\n  'in-review',\n  'done',\n];\n\nexport const STATUS_META: Record<StatusId, Meta> = {\n  backlog: {\n    label: 'Backlog',\n    color: 'var(--muted-foreground)',\n    icon: CircleDashedIcon,\n  },\n  todo: { label: 'Todo', color: 'var(--info)', icon: CircleIcon },\n  'in-progress': {\n    label: 'In progress',\n    color: 'var(--warning)',\n    icon: EclipseIcon,\n  },\n  'in-review': { label: 'In review', color: 'var(--primary)', icon: EyeIcon },\n  done: { label: 'Done', color: 'var(--success)', icon: CircleCheckIcon },\n};\n\nexport const PRIORITY_ORDER: PriorityId[] = ['urgent', 'high', 'medium', 'low'];\n\nexport const PRIORITY_META: Record<PriorityId, Meta> = {\n  urgent: {\n    label: 'Urgent',\n    color: 'var(--destructive)',\n    icon: TriangleAlertIcon,\n  },\n  high: { label: 'High', color: 'var(--warning)', icon: ChevronUpIcon },\n  medium: { label: 'Medium', color: 'var(--info)', icon: MinusIcon },\n  low: {\n    label: 'Low',\n    color: 'var(--muted-foreground)',\n    icon: ChevronDownIcon,\n  },\n};\n\nexport const ISSUE_TYPE_META: Record<IssueType, Meta> = {\n  task: { label: 'Task', color: 'var(--info)', icon: CheckIcon },\n  bug: { label: 'Bug', color: 'var(--destructive)', icon: CircleAlertIcon },\n  story: { label: 'Story', color: 'var(--success)', icon: BookmarkIcon },\n  epic: { label: 'Epic', color: 'var(--primary)', icon: ZapIcon },\n};\n\nexport function isStatusId(value: unknown): value is StatusId {\n  return STATUS_ORDER.some((status) => status === value);\n}\n\nexport function IssueTypeGem({\n  type,\n  className,\n}: {\n  type: IssueType;\n  className?: string;\n}) {\n  const meta = ISSUE_TYPE_META[type];\n  const TypeGlyph = meta.icon;\n  const gemStyle = { '--gem': meta.color } as React.CSSProperties;\n\n  return (\n    <span\n      style={gemStyle}\n      className={cn(\n        'gem-plate inline-flex size-4 shrink-0 items-center justify-center rounded-[4px]',\n        className\n      )}\n    >\n      <TypeGlyph className='size-2.5' strokeWidth={2.75} />\n      <span className='sr-only'>{meta.label}</span>\n    </span>\n  );\n}\n\nexport function MetaGlyph({\n  meta,\n  className,\n}: {\n  meta: Meta;\n  className?: string;\n}) {\n  const Glyph = meta.icon;\n  const glyphStyle = { color: meta.color } as React.CSSProperties;\n\n  return (\n    <Glyph\n      style={glyphStyle}\n      strokeWidth={2.25}\n      className={cn('size-3.5 shrink-0', className)}\n    />\n  );\n}\n",
      "type": "registry:component",
      "target": "components/aside/_parts/task-meta.tsx"
    }
  ],
  "categories": [
    "components",
    "aside"
  ],
  "type": "registry:component"
}