{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "modal-11",
  "title": "Search people",
  "description": "An @ mention search over members, pending invitations and guests, with highlighted matches and arrow-key picking",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/animated-size.json",
    "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/chip.json",
    "https://ui.ndekocode.dev/r/dialog.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/kbd.json",
    "https://ui.ndekocode.dev/r/recipes.json",
    "https://ui.ndekocode.dev/r/selected-mark.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/modal/modal-11.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion, type Transition } from 'motion/react';\nimport { useId, useRef, useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport {\n  AtSignIcon,\n  ChevronDownIcon,\n  ChevronUpIcon,\n  SearchIcon,\n} from '@/registry/ndeko/lib/icons';\nimport { CONTROL_RECIPE } from '@/registry/ndeko/lib/recipes';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Chip } from '@/registry/ndeko/ui/chip';\nimport { Kbd } from '@/registry/ndeko/ui/kbd';\nimport { SelectedMark } from '@/registry/ndeko/ui/selected-mark';\n\nimport {\n  ModalDescription,\n  ModalHeader,\n  ModalPreview,\n  ModalTitle,\n} from './_parts/modal-frame';\nimport { chipVariantsOf } from './_parts/motion';\nimport { PEOPLE, type Person } from './_parts/people';\nimport { PendingAvatar, PersonAvatar } from './_parts/person-avatar';\nimport { Swap } from './_parts/swap';\n\ntype ResultKind = 'member' | 'pending' | 'guest';\n\ntype SearchResult = {\n  id: string;\n  kind: ResultKind;\n  name: string;\n  email: string;\n  person: Person | null;\n};\n\ntype ResultGroup = { kind: ResultKind; label: string; results: SearchResult[] };\n\ntype TextPart = { text: string; isMatch: boolean };\n\nconst GROUP_LABEL: Record<ResultKind, string> = {\n  member: 'Members',\n  pending: 'Pending invitations',\n  guest: 'Guests',\n};\n\nconst GROUP_ORDER: ResultKind[] = ['member', 'pending', 'guest'];\n\nconst GUESTS: Person[] = [\n  {\n    id: 'malia',\n    name: 'Malia Fonoti',\n    email: 'malia@fernwick.example',\n    title: 'Client, Fernwick Studio',\n    presence: 'offline',\n  },\n  {\n    id: 'andres',\n    name: 'Andrés Molina',\n    email: 'andres@fernwick.example',\n    title: 'Client, Fernwick Studio',\n    presence: 'online',\n  },\n];\n\nconst PENDING_EMAILS = [\n  'noor.haddad@lattice.example',\n  'kofi.mensah@lattice.example',\n  'mariam.saleh@northfield.example',\n];\n\nconst EVERYONE: SearchResult[] = [\n  ...PEOPLE.map((person) => ({\n    id: person.id,\n    kind: 'member' as const,\n    name: person.name,\n    email: person.email,\n    person,\n  })),\n  ...PENDING_EMAILS.map((email) => ({\n    id: email,\n    kind: 'pending' as const,\n    name: email,\n    email,\n    person: null,\n  })),\n  ...GUESTS.map((person) => ({\n    id: person.id,\n    kind: 'guest' as const,\n    name: person.name,\n    email: person.email,\n    person,\n  })),\n];\n\nconst HIGHLIGHT_TRAVEL: Transition = {\n  type: 'spring',\n  bounce: 0,\n  duration: 0.18,\n};\n\nconst INSTANT: Transition = { duration: 0 };\n\nfunction travelOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return INSTANT;\n  }\n  return HIGHLIGHT_TRAVEL;\n}\n\nfunction matchesQuery(result: SearchResult, query: string) {\n  const name = result.name.toLowerCase();\n  const email = result.email.toLowerCase();\n  const isNameMatch = name.includes(query);\n  const isEmailMatch = email.includes(query);\n  return isNameMatch || isEmailMatch;\n}\n\nfunction partsOf(text: string, query: string): TextPart[] {\n  const start = text.toLowerCase().indexOf(query);\n  const hasQuery = query.length > 0;\n  const isFound = start >= 0;\n  const hasMatch = hasQuery && isFound;\n  if (!hasMatch) {\n    return [{ text, isMatch: false }];\n  }\n  const end = start + query.length;\n  return [\n    { text: text.slice(0, start), isMatch: false },\n    { text: text.slice(start, end), isMatch: true },\n    { text: text.slice(end), isMatch: false },\n  ];\n}\n\nfunction groupsOf(results: SearchResult[]) {\n  const groups: ResultGroup[] = [];\n  for (const kind of GROUP_ORDER) {\n    const inGroup = results.filter((result) => result.kind === kind);\n    if (inGroup.length === 0) {\n      continue;\n    }\n    groups.push({ kind, label: GROUP_LABEL[kind], results: inGroup });\n  }\n  return groups;\n}\n\nfunction nextIndexOf(current: number, step: number, count: number) {\n  const moved = current + step;\n  return (moved + count) % count;\n}\n\nfunction pickedLineOf(picked: SearchResult | null) {\n  if (!picked) {\n    return 'Pick someone to mention in the comment';\n  }\n  return `${picked.name} is mentioned in the comment`;\n}\n\nfunction Highlighted({ text, query }: { text: string; query: string }) {\n  const parts = partsOf(text, query);\n\n  return (\n    <>\n      {parts.map((part, index) => {\n        if (part.isMatch) {\n          return (\n            <mark\n              key={index}\n              className='bg-primary/15 text-foreground rounded-[3px]'\n            >\n              {part.text}\n            </mark>\n          );\n        }\n        return <span key={index}>{part.text}</span>;\n      })}\n    </>\n  );\n}\n\nfunction ResultAvatar({ result }: { result: SearchResult }) {\n  if (result.person) {\n    return (\n      <PersonAvatar\n        person={result.person}\n        size='sm'\n        presence={result.person.presence}\n      />\n    );\n  }\n  return <PendingAvatar size='sm' />;\n}\n\nfunction ResultRow({\n  result,\n  optionId,\n  query,\n  isActive,\n  isPicked,\n  highlightId,\n  onHover,\n  onPick,\n}: {\n  result: SearchResult;\n  optionId: string;\n  query: string;\n  isActive: boolean;\n  isPicked: boolean;\n  highlightId: string;\n  onHover: (resultId: string) => void;\n  onPick: (resultId: string) => void;\n}) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const travel = travelOf(shouldReduceMotion);\n  const isPending = result.kind === 'pending';\n  const isGuest = result.kind === 'guest';\n  const showsEmail = !isPending;\n\n  function hover() {\n    onHover(result.id);\n  }\n\n  function pick() {\n    onPick(result.id);\n  }\n\n  return (\n    <li\n      id={optionId}\n      role='option'\n      aria-selected={isActive}\n      onPointerMove={hover}\n      onClick={pick}\n      className='relative isolate flex h-10 cursor-pointer items-center gap-2.5 rounded-md px-2'\n    >\n      {isActive && (\n        <motion.span\n          layoutId={highlightId}\n          transition={travel}\n          aria-hidden='true'\n          className='bg-foreground/[0.05] absolute inset-0 -z-10 rounded-md'\n        />\n      )}\n      <ResultAvatar result={result} />\n      <span className='flex min-w-0 flex-1 items-baseline gap-2'>\n        <span className='truncate text-[13px] font-medium'>\n          <Highlighted text={result.name} query={query} />\n        </span>\n        {showsEmail && (\n          <span className='text-muted-foreground truncate text-xs'>\n            <Highlighted text={result.email} query={query} />\n          </span>\n        )}\n      </span>\n      {isGuest && (\n        <Badge\n          variant='secondary'\n          className='text-muted-foreground font-normal'\n        >\n          Guest\n        </Badge>\n      )}\n      {isPicked && <SelectedMark label='Mentioned' />}\n    </li>\n  );\n}\n\nfunction MentionToken() {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const variants = chipVariantsOf(shouldReduceMotion);\n\n  return (\n    <motion.span\n      variants={variants}\n      initial='hidden'\n      animate='shown'\n      exit='hidden'\n      className='flex'\n    >\n      <Chip color='var(--primary)' className='h-6 gap-0.5 px-1.5 text-[13px]'>\n        <AtSignIcon className='size-3.5' />\n        People\n      </Chip>\n    </motion.span>\n  );\n}\n\nfunction SearchPeopleContent() {\n  const [query, setQuery] = useState('ma');\n  const [hasToken, setHasToken] = useState(true);\n  const [activeId, setActiveId] = useState<string | null>(null);\n  const [pickedId, setPickedId] = useState<string | null>('priya');\n  const inputRef = useRef<HTMLInputElement>(null);\n  const baseId = useId();\n  const listboxId = useId();\n  const highlightId = useId();\n  const normalizedQuery = query.trim().toLowerCase();\n  const results = EVERYONE.filter((result) =>\n    matchesQuery(result, normalizedQuery)\n  );\n  const groups = groupsOf(results);\n  const hasResults = results.length > 0;\n  const showsResults = hasToken && hasResults;\n  const showsNoMatch = hasToken && !hasResults;\n  const activeResult = results.find((result) => result.id === activeId);\n  const shownActive = activeResult ?? results[0] ?? null;\n  const shownActiveId = shownActive?.id ?? null;\n  const picked = EVERYONE.find((result) => result.id === pickedId) ?? null;\n  const pickedLine = pickedLineOf(picked);\n\n  function optionIdOf(resultId: string) {\n    return `${baseId}-${resultId}`;\n  }\n\n  const activeOptionId = shownActiveId && optionIdOf(shownActiveId);\n\n  function focusInput() {\n    inputRef.current?.focus();\n  }\n\n  function changeQuery(event: React.ChangeEvent<HTMLInputElement>) {\n    const value = event.target.value;\n    const typesTheToken = !hasToken && value.startsWith('@');\n    if (typesTheToken) {\n      setHasToken(true);\n      setQuery(value.slice(1));\n      return;\n    }\n    setQuery(value);\n  }\n\n  function moveActive(step: number) {\n    if (!hasResults) {\n      return;\n    }\n    const currentIndex = results.findIndex(\n      (result) => result.id === shownActiveId\n    );\n    const nextIndex = nextIndexOf(currentIndex, step, results.length);\n    const next = results[nextIndex];\n    setActiveId(next.id);\n    const option = document.getElementById(optionIdOf(next.id));\n    option?.scrollIntoView({ block: 'nearest' });\n  }\n\n  function handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>) {\n    if (event.key === 'ArrowDown') {\n      event.preventDefault();\n      moveActive(1);\n      return;\n    }\n    if (event.key === 'ArrowUp') {\n      event.preventDefault();\n      moveActive(-1);\n      return;\n    }\n    const isEnter = event.key === 'Enter';\n    if (isEnter && shownActive) {\n      event.preventDefault();\n      setPickedId(shownActive.id);\n      return;\n    }\n    const isBackspace = event.key === 'Backspace';\n    const removesToken = isBackspace && query.length === 0;\n    if (removesToken) {\n      setHasToken(false);\n    }\n  }\n\n  return (\n    <>\n      <ModalHeader>\n        <ModalTitle>Mention someone</ModalTitle>\n        <ModalDescription>\n          Members, people invited and guests of the project\n        </ModalDescription>\n      </ModalHeader>\n      <div\n        role='presentation'\n        onClick={focusInput}\n        className={cn(\n          CONTROL_RECIPE,\n          'flex h-9 cursor-text items-center gap-1.5 px-2',\n          'focus-within:border-foreground/30 focus-within:ring-ring/25 focus-within:ring-[3px]'\n        )}\n      >\n        <SearchIcon className='text-muted-foreground size-4 shrink-0' />\n        <AnimatePresence initial={false} mode='popLayout'>\n          {hasToken && <MentionToken key='token' />}\n        </AnimatePresence>\n        <input\n          ref={inputRef}\n          role='combobox'\n          aria-label='Search people'\n          aria-expanded={showsResults}\n          aria-controls={listboxId}\n          aria-activedescendant={activeOptionId || undefined}\n          autoComplete='off'\n          spellCheck={false}\n          value={query}\n          placeholder='Type @ to search people'\n          onChange={changeQuery}\n          onKeyDown={handleKeyDown}\n          className='placeholder:text-muted-foreground/75 h-7 min-w-0 flex-1 bg-transparent text-base outline-none md:text-[13px]'\n        />\n      </div>\n      <div\n        id={listboxId}\n        role='listbox'\n        aria-label='People'\n        className='-mx-2 flex max-h-72 flex-col gap-3 overflow-y-auto px-2'\n      >\n        {showsResults &&\n          groups.map((group) => {\n            const headingId = `${baseId}-${group.kind}`;\n\n            return (\n              <div\n                key={group.kind}\n                role='group'\n                aria-labelledby={headingId}\n                className='flex flex-col gap-0.5'\n              >\n                <div className='flex items-center gap-2 px-2 pb-1'>\n                  <span\n                    id={headingId}\n                    className='text-muted-foreground text-xs font-medium'\n                  >\n                    {group.label}\n                  </span>\n                  <Kbd>{group.results.length}</Kbd>\n                </div>\n                <ul className='flex flex-col'>\n                  {group.results.map((result) => (\n                    <ResultRow\n                      key={result.id}\n                      result={result}\n                      optionId={optionIdOf(result.id)}\n                      query={normalizedQuery}\n                      isActive={result.id === shownActiveId}\n                      isPicked={result.id === pickedId}\n                      highlightId={highlightId}\n                      onHover={setActiveId}\n                      onPick={setPickedId}\n                    />\n                  ))}\n                </ul>\n              </div>\n            );\n          })}\n        {showsNoMatch && (\n          <div className='flex flex-col items-center gap-1 py-8 text-center'>\n            <p className='text-sm font-medium'>\n              {`No one matches “${query.trim()}”`}\n            </p>\n            <p className='text-muted-foreground text-[13px]'>\n              Search by name or e-mail address\n            </p>\n          </div>\n        )}\n        {!hasToken && (\n          <p className='text-muted-foreground py-8 text-center text-[13px]'>\n            Type @ to search the people of the project\n          </p>\n        )}\n      </div>\n      <div className='text-muted-foreground flex flex-wrap items-center gap-x-4 gap-y-2 text-xs'>\n        <span className='flex items-center gap-1.5'>\n          <Kbd>\n            <ChevronUpIcon />\n            <span className='sr-only'>Up arrow</span>\n          </Kbd>\n          <Kbd>\n            <ChevronDownIcon />\n            <span className='sr-only'>Down arrow</span>\n          </Kbd>\n          to move\n        </span>\n        <span className='flex items-center gap-1.5'>\n          <Kbd>Enter</Kbd>\n          to pick\n        </span>\n        <span className='ml-auto min-w-0'>\n          <Swap swapKey={pickedLine} kind='label'>\n            {pickedLine}\n          </Swap>\n        </span>\n      </div>\n    </>\n  );\n}\n\nexport default function Modal11() {\n  return (\n    <ModalPreview triggerLabel='Open mention search' size='md'>\n      <SearchPeopleContent />\n    </ModalPreview>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/modal/modal-11.tsx"
    },
    {
      "path": "registry/ndeko/components/modal/_parts/modal-frame.tsx",
      "content": "'use client';\n\nimport { createContext, useContext } from 'react';\n\nimport { SquareArrowOutUpRightIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { Button, type ButtonProps } from '@/registry/ndeko/ui/button';\nimport {\n  Dialog,\n  DialogClose,\n  DialogContent,\n  DialogDescription,\n  DialogTitle,\n  DialogTrigger,\n} from '@/registry/ndeko/ui/dialog';\n\n/** Where a modal's content is drawn: open in the page as a preview, or inside the real dialog. */\nexport type ModalHost = 'preview' | 'dialog';\n\nconst ModalHostContext = createContext<ModalHost>('preview');\n\nexport function useModalHost() {\n  return useContext(ModalHostContext);\n}\n\nexport type ModalSize = 'sm' | 'md' | 'lg' | 'xl';\n\nconst SIZE_CLASS: Record<ModalSize, string> = {\n  sm: 'max-w-sm',\n  md: 'max-w-md',\n  lg: 'max-w-lg',\n  xl: 'max-w-[44rem]',\n};\n\nconst TITLE = 'text-lg leading-tight font-semibold text-balance';\n\nconst DESCRIPTION = 'text-muted-foreground text-[13px]';\n\nconst BODY = 'flex flex-col gap-4';\n\ntype ModalTextProps = { className?: string; children: React.ReactNode };\n\nexport function ModalTitle({ className, children }: ModalTextProps) {\n  const host = useModalHost();\n  if (host === 'dialog') {\n    return <DialogTitle className={className}>{children}</DialogTitle>;\n  }\n  return <h2 className={cn(TITLE, className)}>{children}</h2>;\n}\n\nexport function ModalDescription({ className, children }: ModalTextProps) {\n  const host = useModalHost();\n  if (host === 'dialog') {\n    return (\n      <DialogDescription className={className}>{children}</DialogDescription>\n    );\n  }\n  return <p className={cn(DESCRIPTION, className)}>{children}</p>;\n}\n\n/** Leaves room for the dialog's close button, so the preview and the dialog lay out the same. */\nexport function ModalHeader({\n  className,\n  ...props\n}: React.ComponentProps<'div'>) {\n  return (\n    <div className={cn('flex flex-col gap-1.5 pr-8', className)} {...props} />\n  );\n}\n\nexport function ModalFooter({\n  className,\n  ...props\n}: React.ComponentProps<'div'>) {\n  return (\n    <div\n      className={cn(\n        'flex flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-end',\n        className\n      )}\n      {...props}\n    />\n  );\n}\n\n/** Closes the dialog. In the preview it stays a plain button that runs its own action, if any. */\nexport function ModalCloseButton({ children, ...props }: ButtonProps) {\n  const host = useModalHost();\n  if (host === 'dialog') {\n    return <DialogClose render={<Button {...props} />}>{children}</DialogClose>;\n  }\n  return <Button {...props}>{children}</Button>;\n}\n\ntype ModalPreviewProps = {\n  /** The content, drawn twice: open in the page, and inside the dialog the trigger opens. */\n  children: React.ReactNode;\n  triggerLabel: string;\n  size?: ModalSize;\n  className?: string;\n};\n\n/** Shows a modal open and whole on the page, with a small trigger that opens the same content in the real dialog. */\nexport function ModalPreview({\n  children,\n  triggerLabel,\n  size = 'md',\n  className,\n}: ModalPreviewProps) {\n  const sizeClass = SIZE_CLASS[size];\n\n  return (\n    <div className='flex w-full flex-col items-center gap-4'>\n      <ModalHostContext.Provider value='preview'>\n        <div\n          className={cn(\n            'surface-raised w-full rounded-2xl p-6 text-left',\n            sizeClass,\n            className\n          )}\n        >\n          <AnimatedSize contentClassName={BODY}>{children}</AnimatedSize>\n        </div>\n      </ModalHostContext.Provider>\n      <Dialog>\n        <DialogTrigger render={<Button variant='outline' size='sm' />}>\n          <SquareArrowOutUpRightIcon />\n          {triggerLabel}\n        </DialogTrigger>\n        <DialogContent className={cn(sizeClass, className)}>\n          <ModalHostContext.Provider value='dialog'>\n            {children}\n          </ModalHostContext.Provider>\n        </DialogContent>\n      </Dialog>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/modal/_parts/modal-frame.tsx"
    },
    {
      "path": "registry/ndeko/components/modal/_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 MORPH_SPRING: Transition = { type: 'spring', bounce: 0, duration: 0.3 };\n\nconst INSTANT: Transition = { duration: 0 };\n\nconst PRESENCE_IN: Transition = { duration: 0.2, ease: [0.23, 1, 0.32, 1] };\n\nconst PRESENCE_OUT: 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_SWAP: Variants = {\n  enter: { opacity: 0 },\n  visible: { opacity: 1 },\n  exit: { opacity: 0 },\n};\n\nconst ROW_PRESENCE: Variants = {\n  hidden: {\n    height: 0,\n    opacity: 0,\n    overflow: 'hidden',\n    transition: PRESENCE_OUT,\n  },\n  shown: {\n    height: 'auto',\n    opacity: 1,\n    transition: PRESENCE_IN,\n    transitionEnd: { overflow: 'visible' },\n  },\n};\n\nconst ROW_FADE: Variants = {\n  hidden: { opacity: 0, transition: PRESENCE_OUT },\n  shown: { opacity: 1, transition: PRESENCE_IN },\n};\n\nconst CHIP_PRESENCE: Variants = {\n  hidden: { opacity: 0, scale: 0.9, transition: PRESENCE_OUT },\n  shown: { opacity: 1, scale: 1, transition: PRESENCE_IN },\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_SWAP;\n  }\n  if (kind === 'label') {\n    return LABEL_SWAP;\n  }\n  return ICON_SWAP;\n}\n\n/** A row added to or removed from a list: its height opens or collapses, so the rows after it slide. */\nexport function rowVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return ROW_FADE;\n  }\n  return ROW_PRESENCE;\n}\n\nexport function chipVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return ROW_FADE;\n  }\n  return CHIP_PRESENCE;\n}\n\nexport function morphOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return INSTANT;\n  }\n  return MORPH_SPRING;\n}\n",
      "type": "registry:component",
      "target": "components/modal/_parts/motion.ts"
    },
    {
      "path": "registry/ndeko/components/modal/_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 WORKSPACE_NAME = 'Lattice';\n\nexport const TEAM_NAME = 'Product';\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    id: 'theo',\n    name: 'Théo Laurent',\n    email: 'theo@lattice.example',\n    title: 'Data analyst',\n    presence: 'away',\n  },\n  {\n    id: 'sana',\n    name: 'Sana Iqbal',\n    email: 'sana@lattice.example',\n    title: 'Support lead',\n    presence: 'offline',\n  },\n];\n\n/** The person a preview is seen by. */\nexport const CURRENT_USER: Person = PEOPLE[0];\n\nexport function personById(id: string) {\n  return PEOPLE.find((person) => person.id === id);\n}\n\nexport function firstNameOf(person: Person) {\n  const [firstName] = person.name.split(' ');\n  return firstName;\n}\n",
      "type": "registry:component",
      "target": "components/modal/_parts/people.ts"
    },
    {
      "path": "registry/ndeko/components/modal/_parts/person-avatar.tsx",
      "content": "import {\n  CheckIcon,\n  ClockIcon,\n  type Icon,\n  MailIcon,\n  MinusIcon,\n  MoonIcon,\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 = 'sm' | 'md' | 'lg';\n\nconst AVATAR_SIZE: Record<AvatarSize, string> = {\n  sm: 'size-6',\n  md: 'size-8',\n  lg: 'size-10',\n};\n\nconst BADGE_SIZE: Record<AvatarSize, string> = {\n  sm: 'size-3 [&_svg]:size-2',\n  md: 'size-3.5 [&_svg]:size-2',\n  lg: 'size-4 [&_svg]:size-2.5',\n};\n\ntype PersonAvatarProps = {\n  person: Pick<Person, 'name'>;\n  size?: AvatarSize;\n  /** Drawn as a small glyph on the avatar; 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 && <PresenceBadge presence={presence} size={size} />}\n    </span>\n  );\n}\n\nfunction PresenceBadge({\n  presence,\n  size,\n}: {\n  presence: Presence;\n  size: AvatarSize;\n}) {\n  const meta = PRESENCE_META[presence];\n  const PresenceGlyph = meta.icon;\n  const badgeStyle = { '--chip': meta.color } as React.CSSProperties;\n\n  return (\n    <>\n      <span className='bg-popover absolute -right-0.5 -bottom-0.5 flex rounded-full 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          <PresenceGlyph strokeWidth={2.75} />\n        </span>\n      </span>\n      <span className='sr-only'>{meta.label}</span>\n    </>\n  );\n}\n\ntype PendingAvatarProps = {\n  size?: AvatarSize;\n  className?: string;\n};\n\n/** Someone invited who has not joined yet: an empty dashed slot with an envelope and a clock. */\nexport function PendingAvatar({ size = 'md', className }: PendingAvatarProps) {\n  const clockStyle = { '--chip': 'var(--warning)' } as React.CSSProperties;\n\n  return (\n    <span\n      aria-hidden='true'\n      className={cn('relative inline-flex shrink-0', className)}\n    >\n      <span\n        className={cn(\n          'hairline-border border-foreground/25 text-muted-foreground flex items-center justify-center rounded-full border-dashed',\n          AVATAR_SIZE[size]\n        )}\n      >\n        <MailIcon className='size-[45%]' />\n      </span>\n      <span className='bg-popover absolute -right-0.5 -bottom-0.5 flex rounded-full p-px'>\n        <span\n          style={clockStyle}\n          className={cn(\n            'chip-3d flex items-center justify-center rounded-full',\n            BADGE_SIZE[size]\n          )}\n        >\n          <ClockIcon strokeWidth={2.75} />\n        </span>\n      </span>\n    </span>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/modal/_parts/person-avatar.tsx"
    },
    {
      "path": "registry/ndeko/components/modal/_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: the old one leaves while the new one arrives in its place. */\n  swapKey: string;\n  kind?: SwapKind;\n  className?: string;\n  /** Classes of the moving content, for example `min-w-0 max-w-full` so a long text can truncate inside. */\n  contentClassName?: string;\n  children: React.ReactNode;\n};\n\nexport function Swap({\n  swapKey,\n  kind = 'icon',\n  className,\n  contentClassName,\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={cn(\n            'inline-flex items-center gap-[inherit] whitespace-nowrap',\n            contentClassName\n          )}\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/modal/_parts/swap.tsx"
    }
  ],
  "categories": [
    "components",
    "modal"
  ],
  "type": "registry:component"
}