{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "team-01",
  "title": "Member cards on one grid",
  "description": "The column labels and every member card share one grid: presence, current task with its status, time today, estimate and a total that opens the day.",
  "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/dropdown-menu.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/input.json",
    "https://ui.ndekocode.dev/r/motion-number.json",
    "https://ui.ndekocode.dev/r/popover.json",
    "https://ui.ndekocode.dev/r/recipes.json",
    "https://ui.ndekocode.dev/r/select.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/blocks/team/team-01/index.tsx",
      "content": "'use client';\n\nimport {\n  AnimatePresence,\n  motion,\n  type Transition,\n  type Variants,\n} from 'motion/react';\nimport { useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { SearchIcon, XIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Input } from '@/registry/ndeko/ui/input';\n\nimport {\n  INVITATIONS,\n  MEMBERS,\n  OPEN_TASKS,\n  TEAM_NAME,\n  type Invitation,\n  type Member,\n  type MemberTask,\n  type Role,\n  type StatusId,\n} from './data';\nimport { InvitationRow } from './invitation-row';\nimport { InvitePopover } from './invite-popover';\nimport { MemberCard, type MemberActions } from './member-card';\nimport { MEMBER_GRID } from './member-parts';\n\nconst PRESENCE_IN: Transition = { duration: 0.2, ease: [0.23, 1, 0.32, 1] };\n\nconst PRESENCE_OUT: Transition = { duration: 0.12, ease: [0.23, 1, 0.32, 1] };\n\n/**\n * The spring AnimatedSize resizes with. It starts from rest, so the fade leads and the freed space\n * closes after it at the pace the list follows, instead of snapping shut.\n */\nconst SIZE_SPRING: Transition = { type: 'spring', bounce: 0, duration: 0.32 };\n\nconst ITEM_PRESENCE: Variants = {\n  hidden: {\n    height: 0,\n    opacity: 0,\n    overflow: 'hidden',\n    transition: { ...SIZE_SPRING, opacity: PRESENCE_OUT },\n  },\n  shown: {\n    height: 'auto',\n    opacity: 1,\n    transition: { ...SIZE_SPRING, opacity: PRESENCE_IN },\n    transitionEnd: { overflow: 'visible' },\n  },\n};\n\nconst ITEM_FADE: Variants = {\n  hidden: { opacity: 0, transition: PRESENCE_OUT },\n  shown: { opacity: 1, transition: PRESENCE_IN },\n};\n\nconst COLUMN_LABELS = [\n  { id: 'member', label: 'Member', isFigure: false },\n  { id: 'task', label: 'Current task', isFigure: false },\n  { id: 'worked', label: 'Worked today', isFigure: true },\n  { id: 'estimate', label: 'Estimate', isFigure: true },\n  { id: 'total', label: 'Total today', isFigure: true },\n];\n\nfunction itemVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return ITEM_FADE;\n  }\n  return ITEM_PRESENCE;\n}\n\nfunction countLabel(count: number, singular: string, plural: string) {\n  if (count === 1) {\n    return `1 ${singular}`;\n  }\n  return `${count} ${plural}`;\n}\n\nfunction matchesQuery(text: string, query: string) {\n  return text.toLowerCase().includes(query);\n}\n\nfunction updateMember(\n  members: Member[],\n  memberId: string,\n  change: (member: Member) => Member\n) {\n  return members.map((member) => {\n    if (member.id !== memberId) {\n      return member;\n    }\n    return change(member);\n  });\n}\n\nfunction withAddedTime(member: Member, minutes: number): Member {\n  const task = member.task;\n  if (!task) {\n    return member;\n  }\n  const hasEntry = member.activity.some((entry) => entry.taskId === task.id);\n  if (!hasEntry) {\n    const entry = {\n      taskId: task.id,\n      number: task.number,\n      title: task.title,\n      minutes,\n    };\n    return { ...member, activity: [entry, ...member.activity] };\n  }\n  const activity = member.activity.map((entry) => {\n    if (entry.taskId !== task.id) {\n      return entry;\n    }\n    return { ...entry, minutes: entry.minutes + minutes };\n  });\n  return { ...member, activity };\n}\n\nfunction ColumnLabels() {\n  return (\n    <div\n      aria-hidden='true'\n      className={cn(\n        MEMBER_GRID,\n        'text-muted-foreground hidden h-9 text-xs font-medium xl:grid'\n      )}\n    >\n      {COLUMN_LABELS.map((column, index) => {\n        const isFirst = index === 0;\n\n        return (\n          <span\n            key={column.id}\n            className={cn(\n              'border-border flex items-center px-4',\n              !isFirst && 'hairline-l',\n              column.isFigure && 'justify-center'\n            )}\n          >\n            {column.label}\n          </span>\n        );\n      })}\n      <span className='hairline-l border-border' />\n    </div>\n  );\n}\n\nexport default function Team01() {\n  const [members, setMembers] = useState<Member[]>(MEMBERS);\n  const [invitations, setInvitations] = useState<Invitation[]>(INVITATIONS);\n  const [openTasks, setOpenTasks] = useState<MemberTask[]>(OPEN_TASKS);\n  const [query, setQuery] = useState('');\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const itemVariants = itemVariantsOf(shouldReduceMotion);\n\n  const normalizedQuery = query.trim().toLowerCase();\n  const hasQuery = normalizedQuery.length > 0;\n  const visibleMembers = members.filter((member) =>\n    matchesQuery(member.name, normalizedQuery)\n  );\n  const visibleInvitations = invitations.filter((invitation) =>\n    matchesQuery(invitation.email, normalizedQuery)\n  );\n  const visibleCount = visibleMembers.length + visibleInvitations.length;\n  const isEmptySearch = hasQuery && visibleCount === 0;\n  const trackingCount = members.filter(\n    (member) => member.presence === 'tracking'\n  ).length;\n  const memberCountText = countLabel(members.length, 'member', 'members');\n  const trackingText = countLabel(\n    trackingCount,\n    'person tracking time',\n    'people tracking time'\n  );\n  const takenEmails = invitations.map((invitation) => invitation.email);\n\n  function returnTask(task: MemberTask | null) {\n    if (!task) {\n      return;\n    }\n    setOpenTasks((previous) => [task, ...previous]);\n  }\n\n  const actions: MemberActions = {\n    assignTask(memberId, task) {\n      setOpenTasks((previous) =>\n        previous.filter((candidate) => candidate.id !== task.id)\n      );\n      setMembers((previous) =>\n        updateMember(previous, memberId, (member) => ({\n          ...member,\n          task,\n          estimateMinutes: 0,\n        }))\n      );\n    },\n    unassignTask(memberId) {\n      const member = members.find((candidate) => candidate.id === memberId);\n      returnTask(member?.task ?? null);\n      setMembers((previous) =>\n        updateMember(previous, memberId, (current) => ({\n          ...current,\n          task: null,\n          estimateMinutes: 0,\n        }))\n      );\n    },\n    changeStatus(memberId, status: StatusId) {\n      setMembers((previous) =>\n        updateMember(previous, memberId, (member) => {\n          if (!member.task) {\n            return member;\n          }\n          return { ...member, task: { ...member.task, status } };\n        })\n      );\n    },\n    changeEstimate(memberId, minutes) {\n      setMembers((previous) =>\n        updateMember(previous, memberId, (member) => ({\n          ...member,\n          estimateMinutes: minutes,\n        }))\n      );\n    },\n    addTime(memberId, minutes) {\n      setMembers((previous) =>\n        updateMember(previous, memberId, (member) =>\n          withAddedTime(member, minutes)\n        )\n      );\n    },\n    changeRole(memberId, role: Role) {\n      setMembers((previous) =>\n        updateMember(previous, memberId, (member) => ({ ...member, role }))\n      );\n    },\n    removeMember(memberId) {\n      const member = members.find((candidate) => candidate.id === memberId);\n      returnTask(member?.task ?? null);\n      setMembers((previous) =>\n        previous.filter((candidate) => candidate.id !== memberId)\n      );\n    },\n  };\n\n  function changeQuery(event: React.ChangeEvent<HTMLInputElement>) {\n    setQuery(event.target.value);\n  }\n\n  function clearQuery() {\n    setQuery('');\n  }\n\n  function invite(email: string, role: Role) {\n    const invitation: Invitation = {\n      id: `invite-${email}`,\n      email,\n      role,\n      sentLabel: 'Sent just now',\n    };\n    setInvitations((previous) => [...previous, invitation]);\n  }\n\n  function resendInvitation(invitationId: string) {\n    setInvitations((previous) =>\n      previous.map((invitation) => {\n        if (invitation.id !== invitationId) {\n          return invitation;\n        }\n        return { ...invitation, sentLabel: 'Sent again just now' };\n      })\n    );\n  }\n\n  function revokeInvitation(invitationId: string) {\n    setInvitations((previous) =>\n      previous.filter((invitation) => invitation.id !== invitationId)\n    );\n  }\n\n  return (\n    <div className='bg-background text-foreground flex min-h-dvh w-full flex-col'>\n      <div className='hairline-b border-border flex flex-wrap items-center gap-x-3 gap-y-2 px-4 py-3 md:px-6'>\n        <div className='flex min-w-0 items-baseline gap-2'>\n          <h1 className='truncate text-lg font-semibold'>{`${TEAM_NAME} team`}</h1>\n          <span className='text-muted-foreground text-xs tabular-nums'>\n            {`${memberCountText} · ${trackingText}`}\n          </span>\n        </div>\n        <div className='flex w-full items-center gap-2 sm:ml-auto sm:w-auto'>\n          <div className='relative min-w-0 flex-1 sm:w-56 sm:flex-none'>\n            <SearchIcon className='text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2' />\n            <Input\n              type='search'\n              value={query}\n              placeholder='Search people'\n              aria-label='Search members and invitations'\n              onChange={changeQuery}\n              className='pl-8'\n            />\n          </div>\n          <InvitePopover\n            teamName={TEAM_NAME}\n            takenEmails={takenEmails}\n            onInvite={invite}\n          />\n        </div>\n      </div>\n      <div className='flex flex-col gap-3 px-4 pt-3 pb-6 md:px-6'>\n        <ColumnLabels />\n        {isEmptySearch && (\n          <div className='hairline-border border-foreground/20 flex flex-col items-center gap-3 rounded-xl border-dashed px-4 py-12 text-center'>\n            <div className='flex flex-col gap-1'>\n              <p className='text-sm font-medium'>\n                {`No member or invitation matches “${query.trim()}”`}\n              </p>\n              <p className='text-muted-foreground text-[13px]'>\n                Search by first name, last name or e-mail address\n              </p>\n            </div>\n            <Button variant='outline' onClick={clearQuery}>\n              <XIcon />\n              Clear search\n            </Button>\n          </div>\n        )}\n        <ul className='flex flex-col'>\n          <AnimatePresence initial={false}>\n            {visibleMembers.map((member) => (\n              <motion.li\n                key={member.id}\n                variants={itemVariants}\n                initial='hidden'\n                animate='shown'\n                exit='hidden'\n              >\n                <div className='pb-2'>\n                  <MemberCard\n                    member={member}\n                    openTasks={openTasks}\n                    actions={actions}\n                  />\n                </div>\n              </motion.li>\n            ))}\n            {visibleInvitations.map((invitation) => (\n              <motion.li\n                key={invitation.id}\n                variants={itemVariants}\n                initial='hidden'\n                animate='shown'\n                exit='hidden'\n              >\n                <div className='pb-2'>\n                  <InvitationRow\n                    invitation={invitation}\n                    onResend={resendInvitation}\n                    onRevoke={revokeInvitation}\n                  />\n                </div>\n              </motion.li>\n            ))}\n          </AnimatePresence>\n        </ul>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/team-01/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/team/team-01/member-card.tsx",
      "content": "'use client';\n\nimport {\n  AnimatePresence,\n  motion,\n  type Transition,\n  type Variants,\n} from 'motion/react';\nimport { useId, useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport {\n  ChartLineIcon,\n  ChevronDownIcon,\n  EllipsisIcon,\n  PlusIcon,\n  ShieldCheckIcon,\n  TrashIcon,\n  XIcon,\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 {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuItem,\n  DropdownMenuLabel,\n  DropdownMenuRadioGroup,\n  DropdownMenuRadioItem,\n  DropdownMenuSeparator,\n  DropdownMenuSub,\n  DropdownMenuSubContent,\n  DropdownMenuSubTrigger,\n  DropdownMenuTrigger,\n} from '@/registry/ndeko/ui/dropdown-menu';\n\nimport {\n  ROLE_LABEL,\n  type Member,\n  type MemberTask,\n  type Role,\n  type StatusId,\n} from './data';\nimport { EstimateField } from './estimate-field';\nimport {\n  FIGURE_LABEL,\n  IssueTypeGem,\n  MEMBER_CARD_HEIGHT,\n  MEMBER_GRID,\n  PresenceAvatar,\n  DurationFigure,\n  StatusChipMenu,\n  formatDuration,\n  totalTodayOf,\n  workedTodayOf,\n} from './member-parts';\n\nexport type MemberActions = {\n  assignTask: (memberId: string, task: MemberTask) => void;\n  unassignTask: (memberId: string) => void;\n  changeStatus: (memberId: string, status: StatusId) => void;\n  changeEstimate: (memberId: string, minutes: number) => void;\n  addTime: (memberId: string, minutes: number) => void;\n  changeRole: (memberId: string, role: Role) => void;\n  removeMember: (memberId: string) => void;\n};\n\nconst OWN_CARD =\n  'ring-primary/45 shadow-[0_6px_18px_-8px_color-mix(in_oklab,var(--primary)_45%,transparent)]';\n\nconst QUICK_TIME = [15, 30, 60];\n\nconst TASK_SWAP_TRANSITION: Transition = {\n  duration: 0.18,\n  ease: [0.23, 1, 0.32, 1],\n};\n\nconst TASK_SWAP: Variants = {\n  enter: { opacity: 0, y: 6 },\n  visible: { opacity: 1, y: 0 },\n  exit: { opacity: 0, y: -6 },\n};\n\nconst PANEL_IN: Transition = { duration: 0.2, ease: [0.23, 1, 0.32, 1] };\n\nconst PANEL_OUT: Transition = { duration: 0.12, ease: [0.23, 1, 0.32, 1] };\n\n/**\n * The spring AnimatedSize resizes with. It starts from rest, so the fade leads and the freed space\n * closes after it at the pace the list follows, instead of snapping shut.\n */\nconst SIZE_SPRING: Transition = { type: 'spring', bounce: 0, duration: 0.32 };\n\nconst PANEL_PRESENCE: Variants = {\n  hidden: {\n    height: 0,\n    opacity: 0,\n    transition: { ...SIZE_SPRING, opacity: PANEL_OUT },\n  },\n  shown: {\n    height: 'auto',\n    opacity: 1,\n    transition: { ...SIZE_SPRING, opacity: PANEL_IN },\n  },\n};\n\nconst FADE: Variants = {\n  enter: { opacity: 0 },\n  visible: { opacity: 1 },\n  exit: { opacity: 0 },\n  hidden: { opacity: 0, transition: PANEL_OUT },\n  shown: { opacity: 1, transition: PANEL_IN },\n};\n\nconst ROLES: Role[] = ['manager', 'member', 'viewer'];\n\nfunction taskSwapOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE;\n  }\n  return TASK_SWAP;\n}\n\nfunction panelPresenceOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE;\n  }\n  return PANEL_PRESENCE;\n}\n\nfunction controlsOf(isOpen: boolean, panelId: string) {\n  if (isOpen) {\n    return panelId;\n  }\n  return undefined;\n}\n\nfunction isRole(value: unknown): value is Role {\n  return ROLES.some((role) => role === value);\n}\n\nfunction shareOf(minutes: number, total: number) {\n  if (total === 0) {\n    return 0;\n  }\n  return Math.round((minutes / total) * 100);\n}\n\nfunction quickTimeLabelOf(minutes: number) {\n  if (minutes < 60) {\n    return `+${minutes}m`;\n  }\n  return `+${minutes / 60}h`;\n}\n\nfunction AssignTaskMenu({\n  member,\n  openTasks,\n  onAssign,\n}: {\n  member: Member;\n  openTasks: MemberTask[];\n  onAssign: (task: MemberTask) => void;\n}) {\n  const hasOpenTasks = openTasks.length > 0;\n\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger\n        render={\n          <button\n            type='button'\n            aria-label={`Assign a task to ${member.name}`}\n            className='hairline-border border-foreground/20 hover:border-foreground/35 text-muted-foreground hover:text-foreground focus-visible:ring-ring/25 data-popup-open:border-foreground/35 inline-flex h-7 cursor-pointer items-center gap-1.5 rounded-md border-dashed px-2.5 text-[13px] transition-colors duration-150 outline-none focus-visible:ring-[3px]'\n          />\n        }\n      >\n        <PlusIcon className='size-3.5' />\n        Assign task\n      </DropdownMenuTrigger>\n      <DropdownMenuContent className='w-80'>\n        <DropdownMenuLabel>Open tasks</DropdownMenuLabel>\n        {!hasOpenTasks && (\n          <DropdownMenuItem disabled>\n            No open task left to assign\n          </DropdownMenuItem>\n        )}\n        {openTasks.map((task) => {\n          function assign() {\n            onAssign(task);\n          }\n\n          return (\n            <DropdownMenuItem key={task.id} onClick={assign}>\n              <IssueTypeGem type={task.type} />\n              <span className='text-muted-foreground text-xs tabular-nums'>\n                {task.number}\n              </span>\n              <span className='min-w-0 flex-1 truncate'>{task.title}</span>\n            </DropdownMenuItem>\n          );\n        })}\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n\nfunction TaskCell({\n  member,\n  openTasks,\n  actions,\n}: {\n  member: Member;\n  openTasks: MemberTask[];\n  actions: MemberActions;\n}) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const variants = taskSwapOf(shouldReduceMotion);\n  const task = member.task;\n  let swapKey = 'no-task';\n  if (task) {\n    swapKey = task.id;\n  }\n\n  function assign(nextTask: MemberTask) {\n    actions.assignTask(member.id, nextTask);\n  }\n\n  function changeStatus(status: StatusId) {\n    actions.changeStatus(member.id, status);\n  }\n\n  return (\n    <AnimatePresence mode='popLayout' initial={false}>\n      <motion.div\n        key={swapKey}\n        variants={variants}\n        initial='enter'\n        animate='visible'\n        exit='exit'\n        transition={TASK_SWAP_TRANSITION}\n        className='flex min-w-0 flex-col gap-1.5'\n      >\n        {task && (\n          <>\n            <div className='flex min-w-0 items-center gap-2'>\n              <IssueTypeGem type={task.type} />\n              <span className='text-muted-foreground text-xs tabular-nums'>\n                {task.number}\n              </span>\n              <StatusChipMenu\n                status={task.status}\n                taskNumber={task.number}\n                onChange={changeStatus}\n              />\n            </div>\n            <p className='line-clamp-2 text-[13px] leading-snug'>\n              {task.title}\n            </p>\n          </>\n        )}\n        {!task && (\n          <div className='flex items-center gap-3'>\n            <AssignTaskMenu\n              member={member}\n              openTasks={openTasks}\n              onAssign={assign}\n            />\n            <span className='text-muted-foreground hidden text-xs sm:inline'>\n              No task in progress\n            </span>\n          </div>\n        )}\n      </motion.div>\n    </AnimatePresence>\n  );\n}\n\nfunction MemberMenu({\n  member,\n  actions,\n}: {\n  member: Member;\n  actions: MemberActions;\n}) {\n  const task = member.task;\n  const canRemove = !member.isCurrentUser;\n\n  function unassign() {\n    actions.unassignTask(member.id);\n  }\n\n  function changeRole(value: unknown) {\n    if (isRole(value)) {\n      actions.changeRole(member.id, value);\n    }\n  }\n\n  function remove() {\n    actions.removeMember(member.id);\n  }\n\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger\n        render={\n          <Button\n            variant='ghost'\n            size='icon-sm'\n            aria-label={`Actions for ${member.name}`}\n            className='text-muted-foreground'\n          />\n        }\n      >\n        <EllipsisIcon />\n      </DropdownMenuTrigger>\n      <DropdownMenuContent align='end' className='w-56'>\n        {task && (\n          <DropdownMenuItem onClick={unassign}>\n            <XIcon />\n            {`Unassign ${task.number}`}\n          </DropdownMenuItem>\n        )}\n        <DropdownMenuSub>\n          <DropdownMenuSubTrigger>\n            <ShieldCheckIcon />\n            Change role\n          </DropdownMenuSubTrigger>\n          <DropdownMenuSubContent>\n            <DropdownMenuRadioGroup\n              value={member.role}\n              onValueChange={changeRole}\n            >\n              {ROLES.map((role) => (\n                <DropdownMenuRadioItem key={role} value={role} closeOnClick>\n                  {ROLE_LABEL[role]}\n                </DropdownMenuRadioItem>\n              ))}\n            </DropdownMenuRadioGroup>\n          </DropdownMenuSubContent>\n        </DropdownMenuSub>\n        <DropdownMenuSeparator />\n        <DropdownMenuItem\n          variant='destructive'\n          disabled={!canRemove}\n          onClick={remove}\n        >\n          <TrashIcon />\n          Remove from team\n        </DropdownMenuItem>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n\nfunction ActivityPanel({\n  member,\n  panelId,\n  actions,\n}: {\n  member: Member;\n  panelId: string;\n  actions: MemberActions;\n}) {\n  const total = totalTodayOf(member);\n  const task = member.task;\n  const hasActivity = member.activity.length > 0;\n\n  return (\n    <div\n      id={panelId}\n      className='bg-foreground/[0.04] flex flex-col gap-3 rounded-b-xl px-4 py-3'\n    >\n      <p className='text-muted-foreground text-xs font-medium'>Today</p>\n      {!hasActivity && (\n        <p className='text-muted-foreground text-[13px]'>\n          No time tracked today\n        </p>\n      )}\n      {hasActivity && (\n        <ul className='flex flex-col gap-2.5'>\n          {member.activity.map((entry) => {\n            const share = shareOf(entry.minutes, total);\n            const barStyle = { width: `${share}%` } as React.CSSProperties;\n\n            return (\n              <li\n                key={entry.taskId}\n                className='grid grid-cols-[1fr_auto] items-center gap-x-4 gap-y-1.5 sm:grid-cols-[minmax(0,1fr)_8rem_4.5rem_2.5rem]'\n              >\n                <span className='flex min-w-0 items-center gap-2 text-[13px]'>\n                  <span className='text-muted-foreground shrink-0 text-xs tabular-nums'>\n                    {entry.number}\n                  </span>\n                  <span className='truncate'>{entry.title}</span>\n                </span>\n                <span className='bg-foreground/[0.06] col-span-2 h-1 overflow-hidden rounded-full sm:col-span-1'>\n                  <span\n                    style={barStyle}\n                    className='bg-primary block h-full rounded-full transition-[width] duration-300 ease-(--ease-out-strong)'\n                  />\n                </span>\n                <DurationFigure\n                  minutes={entry.minutes}\n                  className='row-start-1 justify-end text-[13px] font-medium sm:row-auto'\n                />\n                <span className='text-muted-foreground hidden text-right text-xs tabular-nums sm:block'>\n                  {`${share}%`}\n                </span>\n              </li>\n            );\n          })}\n        </ul>\n      )}\n      {task && (\n        <div className='flex flex-wrap items-center gap-2'>\n          <span className='text-muted-foreground text-xs'>\n            {`Add time to ${task.number}`}\n          </span>\n          {QUICK_TIME.map((minutes) => {\n            function addTime() {\n              actions.addTime(member.id, minutes);\n            }\n\n            return (\n              <Button\n                key={minutes}\n                variant='secondary'\n                size='sm'\n                onClick={addTime}\n                className='tabular-nums'\n              >\n                {quickTimeLabelOf(minutes)}\n              </Button>\n            );\n          })}\n        </div>\n      )}\n    </div>\n  );\n}\n\ntype MemberCardProps = {\n  member: Member;\n  openTasks: MemberTask[];\n  actions: MemberActions;\n};\n\nexport function MemberCard({ member, openTasks, actions }: MemberCardProps) {\n  const [isActivityOpen, setIsActivityOpen] = useState(false);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const panelVariants = panelPresenceOf(shouldReduceMotion);\n  const panelId = useId();\n  const task = member.task;\n  const worked = workedTodayOf(member);\n  const total = totalTodayOf(member);\n  const isManager = member.role === 'manager';\n  const activityLabel = `Today’s activity of ${member.name}: ${formatDuration(total)}`;\n\n  function toggleActivity() {\n    setIsActivityOpen((isOpen) => !isOpen);\n  }\n\n  function changeEstimate(minutes: number) {\n    actions.changeEstimate(member.id, minutes);\n  }\n\n  return (\n    <div\n      className={cn(\n        MEMBER_GRID,\n        MEMBER_CARD_HEIGHT,\n        'bg-card hairline-ring ring-border relative rounded-xl shadow-[0_1px_2px_rgb(0_0_0/0.04)]',\n        member.isCurrentUser && OWN_CARD\n      )}\n    >\n      <div className='col-span-3 flex min-w-0 items-center gap-3 py-3 pr-12 pl-4 xl:col-span-1 xl:pr-4'>\n        <PresenceAvatar member={member} />\n        <div className='flex min-w-0 flex-col gap-0.5'>\n          <p className='flex min-w-0 items-center gap-2 text-[13px] font-medium'>\n            <span className='truncate'>{member.name}</span>\n            {member.isCurrentUser && (\n              <Badge variant='secondary' className='text-muted-foreground'>\n                You\n              </Badge>\n            )}\n          </p>\n          <p className='text-muted-foreground truncate text-xs'>\n            {member.title}\n            {isManager && ' · Manager'}\n          </p>\n        </div>\n      </div>\n      <div className='xl:hairline-l border-border col-span-3 flex min-w-0 items-center px-4 pb-3 xl:col-span-1 xl:py-3'>\n        <TaskCell member={member} openTasks={openTasks} actions={actions} />\n      </div>\n      <div className='xl:hairline-l border-border flex flex-col justify-center gap-1 px-4 py-3 xl:items-center'>\n        <span className={FIGURE_LABEL}>Worked today</span>\n        <DurationFigure minutes={worked} className='text-[13px] font-medium' />\n      </div>\n      <div className='xl:hairline-l border-border flex flex-col justify-center gap-1 px-4 py-3 xl:items-center'>\n        <span className={FIGURE_LABEL}>Estimate</span>\n        {task && (\n          <EstimateField\n            minutes={member.estimateMinutes}\n            taskNumber={task.number}\n            onChange={changeEstimate}\n          />\n        )}\n        {!task && (\n          <span className='text-muted-foreground text-[13px]'>\n            <span aria-hidden='true'>–</span>\n            <span className='sr-only'>No task</span>\n          </span>\n        )}\n      </div>\n      <div className='xl:hairline-l border-border flex flex-col justify-center gap-1 px-4 py-3 xl:items-center'>\n        <span className={FIGURE_LABEL}>Total today</span>\n        <button\n          type='button'\n          aria-label={activityLabel}\n          aria-expanded={isActivityOpen}\n          aria-controls={controlsOf(isActivityOpen, panelId)}\n          onClick={toggleActivity}\n          className='bg-foreground/[0.04] hairline-ring ring-foreground/10 hover:bg-foreground/[0.07] aria-expanded:bg-foreground/[0.07] focus-visible:ring-ring/25 inline-flex h-7 w-fit cursor-pointer items-center gap-1.5 rounded-full px-2.5 text-[13px] font-medium transition-[background-color,scale] duration-150 ease-(--ease-out-strong) outline-none focus-visible:ring-[3px] active:scale-[0.97]'\n        >\n          <ChartLineIcon className='text-muted-foreground size-3.5' />\n          <DurationFigure minutes={total} />\n          <ChevronDownIcon\n            className={cn(\n              'text-muted-foreground size-3.5 transition-transform duration-200 ease-(--ease-out-strong)',\n              isActivityOpen && 'rotate-180'\n            )}\n          />\n        </button>\n      </div>\n      <div className='xl:hairline-l border-border absolute top-2.5 right-2 flex items-center justify-center xl:static'>\n        <MemberMenu member={member} actions={actions} />\n      </div>\n      <AnimatePresence initial={false}>\n        {isActivityOpen && (\n          <motion.div\n            key='activity'\n            variants={panelVariants}\n            initial='hidden'\n            animate='shown'\n            exit='hidden'\n            className='col-span-full overflow-hidden'\n          >\n            <ActivityPanel\n              member={member}\n              panelId={panelId}\n              actions={actions}\n            />\n          </motion.div>\n        )}\n      </AnimatePresence>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/team-01/member-card.tsx"
    },
    {
      "path": "registry/ndeko/blocks/team/team-01/member-parts.tsx",
      "content": "'use client';\n\nimport {\n  AnimatePresence,\n  motion,\n  type Transition,\n  type Variants,\n} from 'motion/react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuLabel,\n  DropdownMenuRadioGroup,\n  DropdownMenuRadioItem,\n  DropdownMenuTrigger,\n} from '@/registry/ndeko/ui/dropdown-menu';\n\nimport {\n  ISSUE_TYPE_META,\n  PRESENCE_META,\n  STATUS_META,\n  STATUS_ORDER,\n  type IssueType,\n  type Member,\n  type StatusId,\n} from './data';\n\n/** One column template for the labels, every member card and every invitation, so the dividers line up from xl. */\nexport const MEMBER_GRID =\n  'grid grid-cols-3 xl:grid-cols-[minmax(13rem,1fr)_minmax(15rem,1.7fr)_7.5rem_7.5rem_8.5rem_3rem]';\n\nexport const MEMBER_CARD_HEIGHT = 'xl:min-h-[84px]';\n\nexport const FIGURE_LABEL = 'text-muted-foreground text-xs xl:hidden';\n\nconst SWAP_TRANSITION: Transition = { duration: 0.15, ease: [0.2, 0, 0, 1] };\n\nconst SWAP_VARIANTS: 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 FADE_VARIANTS: Variants = {\n  enter: { opacity: 0 },\n  visible: { opacity: 1 },\n  exit: { opacity: 0 },\n};\n\nconst TWO_DIGITS: Intl.NumberFormatOptions = { minimumIntegerDigits: 2 };\n\nexport function swapVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return SWAP_VARIANTS;\n}\n\nfunction durationPartsOf(totalMinutes: number) {\n  const rawHours = totalMinutes / 60;\n  const hours = Math.floor(rawHours);\n  const minutes = totalMinutes % 60;\n  return { hours, minutes };\n}\n\nexport function formatDuration(totalMinutes: number) {\n  const { hours, minutes } = durationPartsOf(totalMinutes);\n  const paddedMinutes = String(minutes).padStart(2, '0');\n  return `${hours}h ${paddedMinutes}m`;\n}\n\nexport function workedTodayOf(member: Member) {\n  const task = member.task;\n  if (!task) {\n    return 0;\n  }\n  const entry = member.activity.find((item) => item.taskId === task.id);\n  if (!entry) {\n    return 0;\n  }\n  return entry.minutes;\n}\n\nexport function totalTodayOf(member: Member) {\n  let total = 0;\n  for (const entry of member.activity) {\n    total += entry.minutes;\n  }\n  return total;\n}\n\n/** Hours and minutes roll as two numbers, but a screen reader hears the duration once. */\nexport function DurationFigure({\n  minutes,\n  className,\n}: {\n  minutes: number;\n  className?: string;\n}) {\n  const parts = durationPartsOf(minutes);\n  const text = formatDuration(minutes);\n\n  return (\n    <span\n      className={cn(\n        'inline-flex items-baseline whitespace-nowrap tabular-nums',\n        className\n      )}\n    >\n      <span className='sr-only'>{text}</span>\n      <span aria-hidden='true'>\n        <MotionNumber value={parts.hours} suffix='h' />{' '}\n        <MotionNumber value={parts.minutes} format={TWO_DIGITS} suffix='m' />\n      </span>\n    </span>\n  );\n}\n\nexport function PresenceAvatar({\n  member,\n  className,\n}: {\n  member: Member;\n  className?: string;\n}) {\n  const presence = PRESENCE_META[member.presence];\n  const PresenceGlyph = presence.icon;\n  const badgeStyle = { '--chip': presence.color } as React.CSSProperties;\n\n  return (\n    <span className={cn('relative inline-flex shrink-0', className)}>\n      <Avatar className='size-9' seed={member.name} />\n      <span className='bg-card absolute -right-0.5 -bottom-0.5 flex rounded-full p-px'>\n        <span\n          style={badgeStyle}\n          className='chip-3d flex size-4 items-center justify-center rounded-full'\n        >\n          <PresenceGlyph className='size-2.5' strokeWidth={2.75} />\n        </span>\n      </span>\n      <span className='sr-only'>{presence.label}</span>\n    </span>\n  );\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\nfunction isStatusId(value: unknown): value is StatusId {\n  return STATUS_ORDER.some((status) => status === value);\n}\n\ntype StatusChipMenuProps = {\n  status: StatusId;\n  taskNumber: string;\n  onChange: (status: StatusId) => void;\n};\n\n/** The status of a task as an assigned label. Picking another one applies it at once. */\nexport function StatusChipMenu({\n  status,\n  taskNumber,\n  onChange,\n}: StatusChipMenuProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const variants = swapVariantsOf(shouldReduceMotion);\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 of ${taskNumber}: ${meta.label}. Change status`}\n            style={chipStyle}\n            className='chip-3d focus-visible:ring-ring/25 inline-flex h-5 shrink-0 cursor-pointer items-center gap-1 overflow-hidden rounded-md px-1.5 text-xs font-medium whitespace-nowrap outline-none focus-visible:ring-[3px]'\n          />\n        }\n      >\n        <AnimatePresence mode='popLayout' initial={false}>\n          <motion.span\n            key={status}\n            variants={variants}\n            initial='enter'\n            animate='visible'\n            exit='exit'\n            transition={SWAP_TRANSITION}\n            className='flex items-center gap-1'\n          >\n            <StatusGlyph className='size-3' strokeWidth={2.25} />\n            {meta.label}\n          </motion.span>\n        </AnimatePresence>\n      </DropdownMenuTrigger>\n      <DropdownMenuContent className='w-48'>\n        <DropdownMenuLabel>Status</DropdownMenuLabel>\n        <DropdownMenuRadioGroup value={status} onValueChange={changeStatus}>\n          {STATUS_ORDER.map((statusId) => {\n            const optionMeta = STATUS_META[statusId];\n            const OptionGlyph = optionMeta.icon;\n            const glyphStyle = {\n              color: optionMeta.color,\n            } as React.CSSProperties;\n\n            return (\n              <DropdownMenuRadioItem\n                key={statusId}\n                value={statusId}\n                closeOnClick\n              >\n                <OptionGlyph style={glyphStyle} />\n                {optionMeta.label}\n              </DropdownMenuRadioItem>\n            );\n          })}\n        </DropdownMenuRadioGroup>\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/team-01/member-parts.tsx"
    },
    {
      "path": "registry/ndeko/blocks/team/team-01/estimate-field.tsx",
      "content": "'use client';\n\nimport { useId, useState } from 'react';\n\nimport { PencilIcon, PlusIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Input } from '@/registry/ndeko/ui/input';\nimport {\n  Popover,\n  PopoverClose,\n  PopoverContent,\n  PopoverTrigger,\n} from '@/registry/ndeko/ui/popover';\n\nimport { DurationFigure, formatDuration } from './member-parts';\n\nconst VALUE_FIELD = [\n  'group/estimate inline-flex h-6 cursor-pointer items-center gap-1.5 rounded-md px-2 text-[13px] font-medium tabular-nums outline-none',\n  'hairline-border border-dashed border-foreground/20 transition-[border-color,background-color] duration-150',\n  'hover:border-foreground/35 active:bg-foreground/5 data-popup-open:border-solid data-popup-open:border-foreground/30',\n  'focus-visible:ring-[3px] focus-visible:ring-ring/25',\n].join(' ');\n\nconst PRESETS = [30, 60, 120, 240, 480];\n\nconst MAX_HOURS = 99;\n\nconst MINUTES_PER_HOUR = 60;\n\ntype Draft = { hours: string; minutes: string };\n\nfunction draftOf(totalMinutes: number): Draft {\n  const hours = Math.floor(totalMinutes / MINUTES_PER_HOUR);\n  const minutes = totalMinutes % MINUTES_PER_HOUR;\n  return { hours: String(hours), minutes: String(minutes) };\n}\n\nfunction clamp(value: number, min: number, max: number) {\n  const atLeastMin = Math.max(min, value);\n  return Math.min(max, atLeastMin);\n}\n\nfunction wholeNumberOf(text: string) {\n  const parsed = Number.parseInt(text, 10);\n  if (Number.isNaN(parsed)) {\n    return 0;\n  }\n  return parsed;\n}\n\nfunction minutesOf(draft: Draft) {\n  const hours = clamp(wholeNumberOf(draft.hours), 0, MAX_HOURS);\n  const minutes = clamp(wholeNumberOf(draft.minutes), 0, MINUTES_PER_HOUR - 1);\n  return hours * MINUTES_PER_HOUR + minutes;\n}\n\nfunction presetLabelOf(minutes: number) {\n  if (minutes < MINUTES_PER_HOUR) {\n    return `${minutes}m`;\n  }\n  return `${minutes / MINUTES_PER_HOUR}h`;\n}\n\ntype EstimateFieldProps = {\n  minutes: number;\n  taskNumber: string;\n  onChange: (minutes: number) => void;\n};\n\n/** A value you can change in place: Enter saves, clicking away keeps what was typed, Escape puts the saved value back. */\nexport function EstimateField({\n  minutes,\n  taskNumber,\n  onChange,\n}: EstimateFieldProps) {\n  const [isOpen, setIsOpen] = useState(false);\n  const [draft, setDraft] = useState<Draft>(() => draftOf(minutes));\n  const hoursId = useId();\n  const minutesId = useId();\n  const hasEstimate = minutes > 0;\n  const triggerLabel = `Estimate of ${taskNumber}: ${formatDuration(minutes)}. Edit`;\n\n  function changeOpen(nextOpen: boolean, details: { reason: string }) {\n    if (nextOpen) {\n      setDraft(draftOf(minutes));\n      setIsOpen(true);\n      return;\n    }\n    const keepsDraft = details.reason === 'outside-press';\n    if (keepsDraft) {\n      onChange(minutesOf(draft));\n    }\n    setIsOpen(false);\n  }\n\n  function changeHours(event: React.ChangeEvent<HTMLInputElement>) {\n    setDraft((previous) => ({ ...previous, hours: event.target.value }));\n  }\n\n  function changeMinutes(event: React.ChangeEvent<HTMLInputElement>) {\n    setDraft((previous) => ({ ...previous, minutes: event.target.value }));\n  }\n\n  function save(event: React.FormEvent<HTMLFormElement>) {\n    event.preventDefault();\n    onChange(minutesOf(draft));\n    setIsOpen(false);\n  }\n\n  function clear() {\n    onChange(0);\n    setIsOpen(false);\n  }\n\n  return (\n    <Popover open={isOpen} onOpenChange={changeOpen}>\n      <PopoverTrigger\n        render={\n          <button\n            type='button'\n            aria-label={triggerLabel}\n            className={cn(VALUE_FIELD, !hasEstimate && 'text-muted-foreground')}\n          />\n        }\n      >\n        {hasEstimate && (\n          <>\n            <DurationFigure minutes={minutes} />\n            <PencilIcon className='text-muted-foreground size-3' />\n          </>\n        )}\n        {!hasEstimate && (\n          <>\n            <PlusIcon className='size-3' />\n            Estimate\n          </>\n        )}\n      </PopoverTrigger>\n      <PopoverContent className='w-64 p-3' align='center'>\n        <form onSubmit={save} className='flex flex-col gap-3'>\n          <p className='text-muted-foreground text-xs font-medium'>\n            {`Estimate of ${taskNumber}`}\n          </p>\n          <div className='flex items-center gap-2'>\n            <label htmlFor={hoursId} className='sr-only'>\n              Hours\n            </label>\n            <Input\n              id={hoursId}\n              autoFocus\n              type='number'\n              inputMode='numeric'\n              min={0}\n              max={MAX_HOURS}\n              size='sm'\n              value={draft.hours}\n              onChange={changeHours}\n              className='w-16 tabular-nums'\n            />\n            <span className='text-muted-foreground text-xs'>h</span>\n            <label htmlFor={minutesId} className='sr-only'>\n              Minutes\n            </label>\n            <Input\n              id={minutesId}\n              type='number'\n              inputMode='numeric'\n              min={0}\n              max={MINUTES_PER_HOUR - 1}\n              step={5}\n              size='sm'\n              value={draft.minutes}\n              onChange={changeMinutes}\n              className='w-16 tabular-nums'\n            />\n            <span className='text-muted-foreground text-xs'>m</span>\n          </div>\n          <div className='flex flex-wrap gap-1'>\n            {PRESETS.map((preset) => {\n              function pickPreset() {\n                setDraft(draftOf(preset));\n              }\n\n              return (\n                <Button\n                  key={preset}\n                  type='button'\n                  variant='secondary'\n                  size='sm'\n                  onClick={pickPreset}\n                  className='tabular-nums'\n                >\n                  {presetLabelOf(preset)}\n                </Button>\n              );\n            })}\n          </div>\n          <div className='flex items-center gap-2'>\n            <Button type='button' variant='ghost' size='sm' onClick={clear}>\n              Clear\n            </Button>\n            <PopoverClose\n              render={\n                <Button\n                  type='button'\n                  variant='ghost'\n                  size='sm'\n                  className='ml-auto'\n                />\n              }\n            >\n              Cancel\n            </PopoverClose>\n            <Button type='submit' size='sm'>\n              Save\n            </Button>\n          </div>\n        </form>\n      </PopoverContent>\n    </Popover>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/team-01/estimate-field.tsx"
    },
    {
      "path": "registry/ndeko/blocks/team/team-01/invitation-row.tsx",
      "content": "'use client';\n\nimport {\n  AnimatePresence,\n  motion,\n  type Transition,\n  type Variants,\n} from 'motion/react';\nimport { useEffect, useEffectEvent, useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport {\n  CheckIcon,\n  ClockIcon,\n  LoaderCircleIcon,\n  MailIcon,\n  SendIcon,\n  TrashIcon,\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 { Chip } from '@/registry/ndeko/ui/chip';\n\nimport { ROLE_LABEL, type Invitation } from './data';\nimport { MEMBER_CARD_HEIGHT, MEMBER_GRID } from './member-parts';\n\ntype ResendState = 'idle' | 'sending' | 'sent';\n\nconst SWAP_TRANSITION: Transition = { duration: 0.15, ease: [0.2, 0, 0, 1] };\n\nconst SENDING_MS = 700;\n\nconst SENT_MS = 1400;\n\nconst REVOKE_ARMED_MS = 4000;\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\nfunction iconSwapOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE;\n  }\n  return ICON_SWAP;\n}\n\nfunction labelSwapOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE;\n  }\n  return LABEL_SWAP;\n}\n\nfunction resendLabelOf(state: ResendState) {\n  if (state === 'sending') {\n    return 'Sending';\n  }\n  if (state === 'sent') {\n    return 'Sent';\n  }\n  return 'Resend';\n}\n\nfunction Swap({\n  swapKey,\n  variants,\n  className,\n  children,\n}: {\n  swapKey: string;\n  variants: Variants;\n  className?: string;\n  children: React.ReactNode;\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 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\n/** Someone invited who has not joined: an empty dashed slot with an envelope and a clock. */\nfunction PendingAvatar() {\n  return (\n    <span aria-hidden='true' className='relative inline-flex shrink-0'>\n      <span className='hairline-border border-foreground/25 text-muted-foreground flex size-9 items-center justify-center rounded-full border-dashed'>\n        <MailIcon className='size-4' />\n      </span>\n      <span className='bg-card absolute -right-0.5 -bottom-0.5 flex rounded-full p-px'>\n        <span className='chip-3d flex size-4 items-center justify-center rounded-full [--chip:var(--warning)]'>\n          <ClockIcon className='size-2.5' strokeWidth={2.75} />\n        </span>\n      </span>\n    </span>\n  );\n}\n\nfunction ResendGlyph({ state }: { state: ResendState }) {\n  if (state === 'sending') {\n    return <LoaderCircleIcon className='animate-spin' />;\n  }\n  if (state === 'sent') {\n    return <CheckIcon className='text-success-foreground' />;\n  }\n  return <SendIcon />;\n}\n\nfunction ResendButton({\n  email,\n  onResend,\n}: {\n  email: string;\n  onResend: () => void;\n}) {\n  const [state, setState] = useState<ResendState>('idle');\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const iconVariants = iconSwapOf(shouldReduceMotion);\n  const labelVariants = labelSwapOf(shouldReduceMotion);\n  const label = resendLabelOf(state);\n  const isSending = state === 'sending';\n  const deliver = useEffectEvent(onResend);\n\n  useEffect(() => {\n    if (state === 'sending') {\n      const timeout = window.setTimeout(() => {\n        deliver();\n        setState('sent');\n      }, SENDING_MS);\n      return () => window.clearTimeout(timeout);\n    }\n    if (state === 'sent') {\n      const timeout = window.setTimeout(() => {\n        setState('idle');\n      }, SENT_MS);\n      return () => window.clearTimeout(timeout);\n    }\n  }, [state]);\n\n  function resend() {\n    if (state !== 'idle') {\n      return;\n    }\n    setState('sending');\n  }\n\n  return (\n    <Button\n      variant='ghost'\n      size='sm'\n      aria-label={`Send the invitation to ${email} again`}\n      aria-busy={isSending}\n      onClick={resend}\n    >\n      <Swap swapKey={state} variants={iconVariants}>\n        <ResendGlyph state={state} />\n      </Swap>\n      <AnimatedSize axis='width' as='span'>\n        <Swap swapKey={label} variants={labelVariants}>\n          {label}\n        </Swap>\n      </AnimatedSize>\n    </Button>\n  );\n}\n\n/** Revoking asks once more in place, in the destructive ink, and forgets the question after a few seconds. */\nfunction RevokeButton({\n  email,\n  onRevoke,\n}: {\n  email: string;\n  onRevoke: () => void;\n}) {\n  const [isArmed, setIsArmed] = useState(false);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const labelVariants = labelSwapOf(shouldReduceMotion);\n\n  useEffect(() => {\n    if (!isArmed) {\n      return;\n    }\n    const timeout = window.setTimeout(() => {\n      setIsArmed(false);\n    }, REVOKE_ARMED_MS);\n    return () => window.clearTimeout(timeout);\n  }, [isArmed]);\n\n  function press() {\n    if (isArmed) {\n      onRevoke();\n      return;\n    }\n    setIsArmed(true);\n  }\n\n  function disarm() {\n    setIsArmed(false);\n  }\n\n  let label = 'Revoke';\n  let accessibleLabel = `Revoke the invitation sent to ${email}`;\n  if (isArmed) {\n    label = 'Revoke now';\n    accessibleLabel = `Confirm: revoke the invitation sent to ${email}`;\n  }\n\n  return (\n    <Button\n      variant='ghost'\n      size='sm'\n      aria-label={accessibleLabel}\n      onClick={press}\n      onBlur={disarm}\n      className={cn(\n        'hover:text-destructive-ink',\n        isArmed && 'bg-destructive/10 text-destructive-ink'\n      )}\n    >\n      <TrashIcon />\n      <AnimatedSize axis='width' as='span'>\n        <Swap swapKey={label} variants={labelVariants}>\n          {label}\n        </Swap>\n      </AnimatedSize>\n    </Button>\n  );\n}\n\ntype InvitationRowProps = {\n  invitation: Invitation;\n  onResend: (invitationId: string) => void;\n  onRevoke: (invitationId: string) => void;\n};\n\n/** A pending invitation: not a member yet, so its outline and its avatar slot are dashed. */\nexport function InvitationRow({\n  invitation,\n  onResend,\n  onRevoke,\n}: InvitationRowProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const labelVariants = labelSwapOf(shouldReduceMotion);\n\n  function resend() {\n    onResend(invitation.id);\n  }\n\n  function revoke() {\n    onRevoke(invitation.id);\n  }\n\n  return (\n    <div\n      className={cn(\n        MEMBER_GRID,\n        MEMBER_CARD_HEIGHT,\n        'hairline-border border-foreground/20 rounded-xl border-dashed'\n      )}\n    >\n      <div className='col-span-3 flex min-w-0 items-center gap-3 px-4 py-3 xl:col-span-1'>\n        <PendingAvatar />\n        <div className='flex min-w-0 flex-col gap-0.5'>\n          <p className='truncate text-[13px] font-medium'>{invitation.email}</p>\n          <p className='text-muted-foreground truncate text-xs'>\n            {`Invited as ${ROLE_LABEL[invitation.role]}`}\n          </p>\n        </div>\n      </div>\n      <div className='xl:hairline-l border-foreground/20 col-span-3 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 border-dashed px-4 pb-3 xl:col-span-5 xl:py-3'>\n        <Chip color='var(--warning)'>\n          <ClockIcon strokeWidth={2.25} />\n          Pending\n        </Chip>\n        <Swap\n          swapKey={invitation.sentLabel}\n          variants={labelVariants}\n          className='text-muted-foreground text-xs'\n        >\n          {invitation.sentLabel}\n        </Swap>\n        <div className='ml-auto flex items-center gap-1'>\n          <ResendButton email={invitation.email} onResend={resend} />\n          <RevokeButton email={invitation.email} onRevoke={revoke} />\n        </div>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/team-01/invitation-row.tsx"
    },
    {
      "path": "registry/ndeko/blocks/team/team-01/invite-popover.tsx",
      "content": "'use client';\n\nimport {\n  AnimatePresence,\n  motion,\n  type Transition,\n  type Variants,\n} from 'motion/react';\nimport { useEffect, useEffectEvent, useId, useRef, useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport {\n  AlertCircleIcon,\n  CheckIcon,\n  ClockIcon,\n  EyeIcon,\n  InfoIcon,\n  LoaderCircleIcon,\n  SendIcon,\n  UserIcon,\n  UserPenIcon,\n  UserRoundPlusIcon,\n  XIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\nimport { CONTROL_RECIPE } from '@/registry/ndeko/lib/recipes';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Chip } from '@/registry/ndeko/ui/chip';\nimport {\n  Popover,\n  PopoverContent,\n  PopoverDescription,\n  PopoverTitle,\n  PopoverTrigger,\n} from '@/registry/ndeko/ui/popover';\nimport {\n  Select,\n  SelectContent,\n  SelectItem,\n  SelectTrigger,\n  SelectValue,\n} from '@/registry/ndeko/ui/select';\n\nimport { ROLE_LABEL, type Role } from './data';\n\ntype AddressState = 'new' | 'pending' | 'invalid';\n\ntype AddressEntry = { email: string; state: AddressState };\n\ntype SendState = 'idle' | 'sending' | 'sent';\n\ntype ChipLook = { color: string; icon: Icon | null; hint: string };\n\ntype RoleOption = {\n  value: Role;\n  label: string;\n  line: string;\n  color: string;\n  icon: Icon;\n};\n\ntype SummaryLine = { id: string; text: string; isError: boolean };\n\nconst EMAIL_PATTERN = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n\nconst TOKEN_SEPARATORS = /[\\s,;<>\"'()]+/;\n\nconst COMMIT_KEYS = new Set(['Enter', ',', ';', ' ', 'Tab']);\n\nconst SENDING_MS = 800;\n\nconst SENT_MS = 900;\n\nconst CHIP_LOOK: Record<AddressState, ChipLook> = {\n  new: { color: 'var(--muted-foreground)', icon: null, hint: '' },\n  pending: {\n    color: 'var(--warning)',\n    icon: ClockIcon,\n    hint: 'Already invited: resend it from the list',\n  },\n  invalid: {\n    color: 'var(--destructive)',\n    icon: AlertCircleIcon,\n    hint: 'Not a valid e-mail address',\n  },\n};\n\nconst ROLE_OPTIONS: RoleOption[] = [\n  {\n    value: 'member',\n    label: ROLE_LABEL.member,\n    line: 'Tracks time and works on tasks',\n    color: 'var(--info)',\n    icon: UserIcon,\n  },\n  {\n    value: 'manager',\n    label: ROLE_LABEL.manager,\n    line: 'Also invites people and changes the team',\n    color: 'var(--success)',\n    icon: UserPenIcon,\n  },\n  {\n    value: 'viewer',\n    label: ROLE_LABEL.viewer,\n    line: 'Reads tasks and reports without editing them',\n    color: 'var(--muted-foreground)',\n    icon: EyeIcon,\n  },\n];\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 SWAP_TRANSITION: Transition = { duration: 0.15, ease: [0.2, 0, 0, 1] };\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\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  hidden: { opacity: 0 },\n  shown: { opacity: 1 },\n  enter: { opacity: 0 },\n  visible: { opacity: 1 },\n  exit: { opacity: 0 },\n};\n\nfunction chipVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE;\n  }\n  return CHIP_PRESENCE;\n}\n\nfunction iconSwapOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE;\n  }\n  return ICON_SWAP;\n}\n\nfunction labelSwapOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE;\n  }\n  return LABEL_SWAP;\n}\n\n/** The addresses in what was typed or pasted; words around an address, such as names copied from a mail, are left out. */\nfunction splitAddresses(text: string) {\n  const tokens = text.split(TOKEN_SEPARATORS);\n  const holdsAnAddress = text.includes('@');\n  const addresses: string[] = [];\n  for (const token of tokens) {\n    const trimmed = token.trim();\n    const address = trimmed.toLowerCase();\n    const isEmpty = address.length === 0;\n    const isNameAround = holdsAnAddress && !address.includes('@');\n    const isRepeat = addresses.includes(address);\n    if (isEmpty || isNameAround || isRepeat) {\n      continue;\n    }\n    addresses.push(address);\n  }\n  return addresses;\n}\n\nfunction mergeAddresses(current: string[], added: string[]) {\n  const merged = [...current];\n  for (const address of added) {\n    if (!merged.includes(address)) {\n      merged.push(address);\n    }\n  }\n  return merged;\n}\n\nfunction stateOf(email: string, takenEmails: string[]): AddressState {\n  if (!EMAIL_PATTERN.test(email)) {\n    return 'invalid';\n  }\n  if (takenEmails.includes(email)) {\n    return 'pending';\n  }\n  return 'new';\n}\n\nfunction entriesOf(addresses: string[], takenEmails: string[]) {\n  return addresses.map((email) => ({\n    email,\n    state: stateOf(email, takenEmails),\n  }));\n}\n\nfunction newEmailsOf(entries: AddressEntry[]) {\n  const newEntries = entries.filter((entry) => entry.state === 'new');\n  return newEntries.map((entry) => entry.email);\n}\n\nfunction isRole(value: unknown): value is Role {\n  return ROLE_OPTIONS.some((option) => option.value === value);\n}\n\nfunction sendLabelOf(state: SendState, count: number) {\n  if (state === 'sending') {\n    return 'Sending';\n  }\n  if (state === 'sent') {\n    return 'Sent';\n  }\n  if (count > 1) {\n    return `Send ${count} invitations`;\n  }\n  return 'Send invitation';\n}\n\nfunction invalidLineOf(count: number): SummaryLine | null {\n  if (count === 0) {\n    return null;\n  }\n  if (count === 1) {\n    return {\n      id: 'invalid',\n      text: '1 address is not valid. Fix or remove it',\n      isError: true,\n    };\n  }\n  return {\n    id: 'invalid',\n    text: `${count} addresses are not valid. Fix or remove them`,\n    isError: true,\n  };\n}\n\nfunction pendingLineOf(count: number): SummaryLine | null {\n  if (count === 0) {\n    return null;\n  }\n  if (count === 1) {\n    return {\n      id: 'pending',\n      text: '1 address already has an invitation and is skipped',\n      isError: false,\n    };\n  }\n  return {\n    id: 'pending',\n    text: `${count} addresses already have an invitation and are skipped`,\n    isError: false,\n  };\n}\n\nfunction isSummaryLine(line: SummaryLine | null): line is SummaryLine {\n  return line !== null;\n}\n\nfunction summaryOf(entries: AddressEntry[]) {\n  const invalidCount = entries.filter(\n    (entry) => entry.state === 'invalid'\n  ).length;\n  const pendingCount = entries.filter(\n    (entry) => entry.state === 'pending'\n  ).length;\n  const lines = [invalidLineOf(invalidCount), pendingLineOf(pendingCount)];\n  return lines.filter(isSummaryLine);\n}\n\nfunction SendGlyph({ state }: { state: SendState }) {\n  if (state === 'sending') {\n    return <LoaderCircleIcon className='animate-spin' />;\n  }\n  if (state === 'sent') {\n    return <CheckIcon />;\n  }\n  return <SendIcon />;\n}\n\n/** The send button becomes its next state: its icon swaps, its label crossfades and its width follows. */\nfunction SendButton({\n  state,\n  count,\n  isDisabled,\n}: {\n  state: SendState;\n  count: number;\n  isDisabled: boolean;\n}) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const iconVariants = iconSwapOf(shouldReduceMotion);\n  const labelVariants = labelSwapOf(shouldReduceMotion);\n  const label = sendLabelOf(state, count);\n  const isSending = state === 'sending';\n\n  return (\n    <Button type='submit' disabled={isDisabled} aria-busy={isSending}>\n      <span className='relative flex'>\n        <AnimatePresence mode='popLayout' initial={false}>\n          <motion.span\n            key={state}\n            className='flex'\n            variants={iconVariants}\n            initial='enter'\n            animate='visible'\n            exit='exit'\n            transition={SWAP_TRANSITION}\n          >\n            <SendGlyph state={state} />\n          </motion.span>\n        </AnimatePresence>\n      </span>\n      <AnimatedSize axis='width' as='span'>\n        <span className='relative flex'>\n          <AnimatePresence mode='popLayout' initial={false}>\n            <motion.span\n              key={label}\n              className='whitespace-nowrap'\n              variants={labelVariants}\n              initial='enter'\n              animate='visible'\n              exit='exit'\n              transition={SWAP_TRANSITION}\n            >\n              {label}\n            </motion.span>\n          </AnimatePresence>\n        </span>\n      </AnimatedSize>\n    </Button>\n  );\n}\n\nfunction RoleSelect({\n  value,\n  onValueChange,\n}: {\n  value: Role;\n  onValueChange: (role: Role) => void;\n}) {\n  function changeValue(nextValue: unknown) {\n    if (isRole(nextValue)) {\n      onValueChange(nextValue);\n    }\n  }\n\n  return (\n    <Select items={ROLE_OPTIONS} value={value} onValueChange={changeValue}>\n      <SelectTrigger\n        size='sm'\n        aria-label='Role of the people invited'\n        className='text-muted-foreground hover:bg-foreground/5 hover:text-foreground data-popup-open:bg-foreground/5 w-auto shrink-0 gap-1 border-transparent bg-transparent px-2 shadow-none ring-0 dark:bg-transparent'\n      >\n        <SelectValue />\n      </SelectTrigger>\n      <SelectContent align='end' className='w-72'>\n        {ROLE_OPTIONS.map((option) => {\n          const RoleGlyph = option.icon;\n          const tileStyle = { '--chip': option.color } as React.CSSProperties;\n\n          return (\n            <SelectItem\n              key={option.value}\n              value={option.value}\n              className='h-auto py-1.5'\n            >\n              <span\n                style={tileStyle}\n                className='chip-3d flex size-7 shrink-0 items-center justify-center rounded-md'\n              >\n                <RoleGlyph className='size-3.5 text-current' />\n              </span>\n              <span className='flex min-w-0 flex-col'>\n                <span className='text-foreground text-[13px] font-medium'>\n                  {option.label}\n                </span>\n                <span className='text-muted-foreground truncate text-xs leading-snug'>\n                  {option.line}\n                </span>\n              </span>\n            </SelectItem>\n          );\n        })}\n      </SelectContent>\n    </Select>\n  );\n}\n\nfunction AddressChip({\n  entry,\n  allowsLayout,\n  onRemove,\n}: {\n  entry: AddressEntry;\n  allowsLayout: boolean;\n  onRemove: (email: string) => void;\n}) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const variants = chipVariantsOf(shouldReduceMotion);\n  const look = CHIP_LOOK[entry.state];\n  const ChipGlyph = look.icon;\n  const hasHint = look.hint.length > 0;\n\n  function remove() {\n    onRemove(entry.email);\n  }\n\n  return (\n    <motion.li\n      layout={allowsLayout}\n      variants={variants}\n      initial='hidden'\n      animate='shown'\n      exit='hidden'\n      title={look.hint}\n      className='flex max-w-full'\n    >\n      <Chip\n        color={look.color}\n        className='h-6 max-w-full gap-1 pr-0.5 pl-1.5 text-xs'\n      >\n        {ChipGlyph && <ChipGlyph strokeWidth={2.25} />}\n        <span className='truncate'>{entry.email}</span>\n        {hasHint && <span className='sr-only'>{look.hint}</span>}\n        <button\n          type='button'\n          aria-label={`Remove ${entry.email}`}\n          onClick={remove}\n          className='hover:bg-foreground/10 focus-visible:ring-ring/25 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-[5px] opacity-70 outline-none hover:opacity-100 focus-visible:opacity-100 focus-visible:ring-[3px]'\n        >\n          <XIcon className='size-3' />\n        </button>\n      </Chip>\n    </motion.li>\n  );\n}\n\ntype InvitePopoverProps = {\n  teamName: string;\n  takenEmails: string[];\n  onInvite: (email: string, role: Role) => void;\n};\n\n/**\n * Several addresses at once, each a chip tinted by what sending does to it, and the role of the batch inside the\n * field. Sending morphs the button to Sent, then the popover closes and the invitations join the list.\n */\nexport function InvitePopover({\n  teamName,\n  takenEmails,\n  onInvite,\n}: InvitePopoverProps) {\n  const [isOpen, setIsOpen] = useState(false);\n  const [addresses, setAddresses] = useState<string[]>([]);\n  const [queued, setQueued] = useState<string[]>([]);\n  const [draft, setDraft] = useState('');\n  const [role, setRole] = useState<Role>('member');\n  const [sendState, setSendState] = useState<SendState>('idle');\n  const inputRef = useRef<HTMLInputElement>(null);\n  const inputId = useId();\n  const summaryId = useId();\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const allowsLayout = !shouldReduceMotion;\n  const entries = entriesOf(addresses, takenEmails);\n  const draftAddresses = splitAddresses(draft);\n  const withDraft = mergeAddresses(addresses, draftAddresses);\n  const withDraftEntries = entriesOf(withDraft, takenEmails);\n  const sendCount = newEmailsOf(withDraftEntries).length;\n  const isIdle = sendState === 'idle';\n  const isSendDisabled = sendCount === 0;\n  const summary = summaryOf(entries);\n  const hasSummary = summary.length > 0;\n  const hasEntries = entries.length > 0;\n  const hasInvalid = summary.some((line) => line.isError);\n  const lastEntry = entries.at(-1);\n\n  const deliverQueued = useEffectEvent(() => {\n    for (const email of queued) {\n      onInvite(email, role);\n    }\n    const sentEmails = queued;\n    setAddresses((previous) =>\n      previous.filter((email) => !sentEmails.includes(email))\n    );\n    setQueued([]);\n  });\n\n  useEffect(() => {\n    if (sendState === 'sending') {\n      const timeout = window.setTimeout(() => {\n        deliverQueued();\n        setSendState('sent');\n      }, SENDING_MS);\n      return () => window.clearTimeout(timeout);\n    }\n    if (sendState === 'sent') {\n      const timeout = window.setTimeout(() => {\n        setIsOpen(false);\n      }, SENT_MS);\n      return () => window.clearTimeout(timeout);\n    }\n  }, [sendState]);\n\n  function reset() {\n    setAddresses([]);\n    setQueued([]);\n    setDraft('');\n    setSendState('idle');\n  }\n\n  function changeOpen(nextOpen: boolean) {\n    if (nextOpen) {\n      reset();\n    }\n    setIsOpen(nextOpen);\n  }\n\n  function focusInput() {\n    inputRef.current?.focus();\n  }\n\n  function addFromText(text: string) {\n    const added = splitAddresses(text);\n    setAddresses((previous) => mergeAddresses(previous, added));\n  }\n\n  function commitDraft() {\n    const typed = draft.trim();\n    if (typed.length === 0) {\n      return false;\n    }\n    addFromText(typed);\n    setDraft('');\n    return true;\n  }\n\n  function removeAddress(email: string) {\n    setAddresses((previous) => previous.filter((item) => item !== email));\n    focusInput();\n  }\n\n  function changeDraft(event: React.ChangeEvent<HTMLInputElement>) {\n    setDraft(event.target.value);\n  }\n\n  function handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>) {\n    const isEnter = event.key === 'Enter';\n    const isDraftEmpty = draft.trim().length === 0;\n    const sendsFromEmptyLine = isEnter && isDraftEmpty;\n    if (sendsFromEmptyLine) {\n      return;\n    }\n    if (COMMIT_KEYS.has(event.key)) {\n      const hasCommitted = commitDraft();\n      const isTab = event.key === 'Tab';\n      const keepsTabMoving = isTab && !hasCommitted;\n      if (!keepsTabMoving) {\n        event.preventDefault();\n      }\n      return;\n    }\n    const isBackspace = event.key === 'Backspace';\n    const takesLastChip = isBackspace && draft.length === 0;\n    if (takesLastChip && lastEntry) {\n      removeAddress(lastEntry.email);\n    }\n  }\n\n  function handlePaste(event: React.ClipboardEvent<HTMLInputElement>) {\n    const pasted = event.clipboardData.getData('text');\n    event.preventDefault();\n    addFromText(`${draft} ${pasted}`);\n    setDraft('');\n  }\n\n  function send(event: React.FormEvent<HTMLFormElement>) {\n    event.preventDefault();\n    if (!isIdle) {\n      return;\n    }\n    const newEmails = newEmailsOf(withDraftEntries);\n    setAddresses(withDraft);\n    setDraft('');\n    if (newEmails.length === 0) {\n      return;\n    }\n    setQueued(newEmails);\n    setSendState('sending');\n  }\n\n  return (\n    <Popover open={isOpen} onOpenChange={changeOpen}>\n      <PopoverTrigger render={<Button variant='outline' />}>\n        <UserRoundPlusIcon />\n        Invite\n      </PopoverTrigger>\n      <PopoverContent align='end' className='w-[min(24rem,calc(100vw-2rem))]'>\n        <form\n          onSubmit={send}\n          autoComplete='off'\n          className='flex flex-col gap-3'\n        >\n          <div className='flex flex-col gap-1'>\n            <PopoverTitle>{`Invite to ${teamName}`}</PopoverTitle>\n            <PopoverDescription>\n              They get an e-mail with a link to join the team\n            </PopoverDescription>\n          </div>\n          <div className='flex flex-col gap-1.5'>\n            <div\n              role='presentation'\n              onClick={focusInput}\n              data-invalid={hasInvalid || undefined}\n              className={cn(\n                CONTROL_RECIPE,\n                'flex min-h-9 cursor-text items-start gap-1 p-1',\n                'focus-within:border-foreground/30 focus-within:ring-ring/25 focus-within:ring-[3px]'\n              )}\n            >\n              <div className='relative flex max-h-[5.5rem] min-w-0 flex-1 flex-wrap items-center gap-1 overflow-y-auto overscroll-contain'>\n                {hasEntries && (\n                  <ul aria-label='Addresses to invite' className='contents'>\n                    <AnimatePresence initial={false} mode='popLayout'>\n                      {entries.map((entry) => (\n                        <AddressChip\n                          key={entry.email}\n                          entry={entry}\n                          allowsLayout={allowsLayout}\n                          onRemove={removeAddress}\n                        />\n                      ))}\n                    </AnimatePresence>\n                  </ul>\n                )}\n                <label htmlFor={inputId} className='sr-only'>\n                  E-mail addresses\n                </label>\n                <input\n                  ref={inputRef}\n                  id={inputId}\n                  autoFocus\n                  type='text'\n                  inputMode='email'\n                  autoComplete='off'\n                  spellCheck={false}\n                  value={draft}\n                  aria-describedby={summaryId}\n                  aria-invalid={hasInvalid || undefined}\n                  placeholder='name@company.com, another@company.com'\n                  onChange={changeDraft}\n                  onKeyDown={handleKeyDown}\n                  onPaste={handlePaste}\n                  onBlur={commitDraft}\n                  className='placeholder:text-muted-foreground/75 h-7 min-w-32 flex-1 bg-transparent px-1.5 text-base outline-none md:text-[13px]'\n                />\n              </div>\n              <div className='flex h-7 shrink-0 items-center'>\n                <RoleSelect value={role} onValueChange={setRole} />\n              </div>\n            </div>\n            <AnimatedSize>\n              <div id={summaryId} className='flex flex-col gap-0.5 text-xs'>\n                <p className='text-muted-foreground flex items-center gap-1.5'>\n                  <InfoIcon className='size-3.5 shrink-0' />\n                  Press Enter or a comma after each address\n                </p>\n                {hasSummary && (\n                  <ul className='flex flex-col gap-0.5 pl-5'>\n                    {summary.map((line) => (\n                      <li\n                        key={line.id}\n                        className={cn(\n                          line.isError && 'text-destructive-ink',\n                          !line.isError && 'text-muted-foreground'\n                        )}\n                      >\n                        {line.text}\n                      </li>\n                    ))}\n                  </ul>\n                )}\n              </div>\n            </AnimatedSize>\n          </div>\n          <div className='flex justify-end'>\n            <SendButton\n              state={sendState}\n              count={sendCount}\n              isDisabled={isSendDisabled}\n            />\n          </div>\n        </form>\n      </PopoverContent>\n    </Popover>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/team-01/invite-popover.tsx"
    },
    {
      "path": "registry/ndeko/blocks/team/team-01/data.ts",
      "content": "import {\n  BookmarkIcon,\n  CheckIcon,\n  CircleAlertIcon,\n  CircleCheckIcon,\n  CircleDashedIcon,\n  CircleIcon,\n  ClockIcon,\n  EclipseIcon,\n  EyeIcon,\n  MinusIcon,\n  MoonIcon,\n  ZapIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\n\nexport type Presence = 'tracking' | 'online' | 'away' | 'offline';\n\nexport type IssueType = 'task' | 'bug' | 'story' | 'epic';\n\nexport type StatusId =\n  'backlog' | 'todo' | 'in-progress' | 'in-review' | 'done';\n\nexport type Role = 'manager' | 'member' | 'viewer';\n\nexport type MemberTask = {\n  id: string;\n  number: string;\n  title: string;\n  type: IssueType;\n  status: StatusId;\n};\n\nexport type ActivityEntry = {\n  taskId: string;\n  number: string;\n  title: string;\n  minutes: number;\n};\n\nexport type Member = {\n  id: string;\n  name: string;\n  title: string;\n  role: Role;\n  presence: Presence;\n  isCurrentUser: boolean;\n  task: MemberTask | null;\n  estimateMinutes: number;\n  activity: ActivityEntry[];\n};\n\nexport type Invitation = {\n  id: string;\n  email: string;\n  role: Role;\n  sentLabel: string;\n};\n\ntype Meta = { label: string; color: string; icon: Icon };\n\nexport const PRESENCE_META: Record<Presence, Meta> = {\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\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 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 ROLE_LABEL: Record<Role, string> = {\n  manager: 'Manager',\n  member: 'Member',\n  viewer: 'Viewer',\n};\n\nexport const TEAM_NAME = 'Product';\n\nexport const MEMBERS: Member[] = [\n  {\n    id: 'amara',\n    name: 'Amara Okafor',\n    title: 'Product designer',\n    role: 'manager',\n    presence: 'tracking',\n    isCurrentUser: true,\n    task: {\n      id: 'task-142',\n      number: 'LAT-142',\n      title: 'Redraw the onboarding checklist for small screens',\n      type: 'story',\n      status: 'in-progress',\n    },\n    estimateMinutes: 240,\n    activity: [\n      {\n        taskId: 'task-142',\n        number: 'LAT-142',\n        title: 'Redraw the onboarding checklist for small screens',\n        minutes: 135,\n      },\n      {\n        taskId: 'task-138',\n        number: 'LAT-138',\n        title: 'Review the empty states of the reports page',\n        minutes: 50,\n      },\n      {\n        taskId: 'task-119',\n        number: 'LAT-119',\n        title: 'Audit the contrast of the status chips',\n        minutes: 25,\n      },\n    ],\n  },\n  {\n    id: 'lucas',\n    name: 'Lucas Moreau',\n    title: 'Engineering lead',\n    role: 'manager',\n    presence: 'tracking',\n    isCurrentUser: false,\n    task: {\n      id: 'task-141',\n      number: 'LAT-141',\n      title: 'Paginate the invoices endpoint',\n      type: 'task',\n      status: 'in-progress',\n    },\n    estimateMinutes: 180,\n    activity: [\n      {\n        taskId: 'task-141',\n        number: 'LAT-141',\n        title: 'Paginate the invoices endpoint',\n        minutes: 95,\n      },\n      {\n        taskId: 'task-130',\n        number: 'LAT-130',\n        title: 'Review the pull requests of the week',\n        minutes: 70,\n      },\n    ],\n  },\n  {\n    id: 'priya',\n    name: 'Priya Raman',\n    title: 'Frontend engineer',\n    role: 'member',\n    presence: 'online',\n    isCurrentUser: false,\n    task: {\n      id: 'task-136',\n      number: 'LAT-136',\n      title: 'Chart the hours of the week as day bars',\n      type: 'story',\n      status: 'in-review',\n    },\n    estimateMinutes: 300,\n    activity: [\n      {\n        taskId: 'task-136',\n        number: 'LAT-136',\n        title: 'Chart the hours of the week as day bars',\n        minutes: 210,\n      },\n      {\n        taskId: 'task-133',\n        number: 'LAT-133',\n        title: 'Fix the focus ring of the date picker',\n        minutes: 40,\n      },\n    ],\n  },\n  {\n    id: 'mateo',\n    name: 'Mateo Silva',\n    title: 'Backend engineer',\n    role: 'member',\n    presence: 'away',\n    isCurrentUser: false,\n    task: {\n      id: 'task-144',\n      number: 'LAT-144',\n      title: 'Invoices total rounds to the wrong cent',\n      type: 'bug',\n      status: 'todo',\n    },\n    estimateMinutes: 0,\n    activity: [\n      {\n        taskId: 'task-144',\n        number: 'LAT-144',\n        title: 'Invoices total rounds to the wrong cent',\n        minutes: 20,\n      },\n    ],\n  },\n  {\n    id: 'hana',\n    name: 'Hana Kobayashi',\n    title: 'Product manager',\n    role: 'member',\n    presence: 'tracking',\n    isCurrentUser: false,\n    task: {\n      id: 'task-120',\n      number: 'LAT-120',\n      title: 'Reports beta with two pilot customers',\n      type: 'epic',\n      status: 'in-progress',\n    },\n    estimateMinutes: 480,\n    activity: [\n      {\n        taskId: 'task-120',\n        number: 'LAT-120',\n        title: 'Reports beta with two pilot customers',\n        minutes: 160,\n      },\n    ],\n  },\n  {\n    id: 'jonas',\n    name: 'Jonas Weber',\n    title: 'QA engineer',\n    role: 'member',\n    presence: 'offline',\n    isCurrentUser: false,\n    task: null,\n    estimateMinutes: 0,\n    activity: [],\n  },\n  {\n    id: 'zola',\n    name: 'Zola Mbeki',\n    title: 'Content designer',\n    role: 'viewer',\n    presence: 'online',\n    isCurrentUser: false,\n    task: null,\n    estimateMinutes: 0,\n    activity: [\n      {\n        taskId: 'task-127',\n        number: 'LAT-127',\n        title: 'Write the copy for the invitation e-mail',\n        minutes: 45,\n      },\n    ],\n  },\n];\n\nexport const OPEN_TASKS: MemberTask[] = [\n  {\n    id: 'task-129',\n    number: 'LAT-129',\n    title: 'Test the invitation flow on a slow network',\n    type: 'task',\n    status: 'todo',\n  },\n  {\n    id: 'task-146',\n    number: 'LAT-146',\n    title: 'Timesheet export drops the last day of the month',\n    type: 'bug',\n    status: 'todo',\n  },\n  {\n    id: 'task-127',\n    number: 'LAT-127',\n    title: 'Write the copy for the invitation e-mail',\n    type: 'task',\n    status: 'backlog',\n  },\n];\n\nexport const INVITATIONS: Invitation[] = [\n  {\n    id: 'invite-noor',\n    email: 'noor.haddad@lattice.example',\n    role: 'member',\n    sentLabel: 'Sent 2 days ago',\n  },\n  {\n    id: 'invite-kofi',\n    email: 'kofi.mensah@lattice.example',\n    role: 'viewer',\n    sentLabel: 'Sent this morning',\n  },\n];\n",
      "type": "registry:component",
      "target": "components/blocks/team-01/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "team"
  ],
  "type": "registry:block"
}