{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "teams-04",
  "title": "Members with roles",
  "description": "The members of a team with a role menu on each row, a last manager who cannot step down, and a pending invite to revoke.",
  "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/dropdown-menu.json",
    "https://ui.ndekocode.dev/r/icons.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/teams/teams-04.tsx",
      "content": "'use client';\n\nimport { AnimatePresence, motion } from 'motion/react';\nimport { useId, useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { MailIcon, XIcon } from '@/registry/ndeko/lib/icons';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Button } from '@/registry/ndeko/ui/button';\n\nimport { rowCollapseOf } from './_parts/collapse';\nimport { MEMBERS, type Member, type Role } from './_parts/people';\nimport { PresenceAvatar } from './_parts/presence-avatar';\nimport { RoleMenu } from './_parts/role-menu';\nimport { SlidingCount } from './_parts/sliding-count';\nimport { memberCountLabelOf } from './_parts/teams';\n\ntype Invitation = { id: string; email: string; sentLabel: string };\n\nconst INITIAL_MEMBERS = MEMBERS.slice(0, 5);\n\nconst INITIAL_INVITATIONS: Invitation[] = [\n  { id: 'priya', email: 'priya@example.com', sentLabel: 'Invited 2 days ago' },\n];\n\nfunction invitedLabelOf(count: number) {\n  if (count === 0) {\n    return 'no pending invite';\n  }\n  if (count === 1) {\n    return '1 invited';\n  }\n  return `${count} invited`;\n}\n\nfunction withRole(members: Member[], memberId: string, role: Role) {\n  return members.map((member) => {\n    if (member.id !== memberId) {\n      return member;\n    }\n    return { ...member, role };\n  });\n}\n\n/** You leave a team from its settings, never by removing yourself from the list. */\nfunction removalOf(member: Member, remove: () => void) {\n  if (member.isYou) {\n    return undefined;\n  }\n  return remove;\n}\n\nfunction managerCountOf(members: Member[]) {\n  return members.filter((member) => member.role === 'manager').length;\n}\n\ntype MemberRowProps = {\n  member: Member;\n  isLastManager: boolean;\n  onRoleChange: (memberId: string, role: Role) => void;\n  onRemove: (memberId: string) => void;\n};\n\nfunction MemberRow({\n  member,\n  isLastManager,\n  onRoleChange,\n  onRemove,\n}: MemberRowProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n\n  function changeRole(role: Role) {\n    onRoleChange(member.id, role);\n  }\n\n  function remove() {\n    onRemove(member.id);\n  }\n\n  return (\n    <motion.li\n      variants={rowCollapseOf(shouldReduceMotion)}\n      initial='hidden'\n      animate='shown'\n      exit='hidden'\n      className='overflow-hidden'\n    >\n      <div className='flex items-center gap-3 py-2'>\n        <PresenceAvatar member={member} size='sm' />\n        <div className='min-w-0 flex-1'>\n          <p className='flex items-center gap-1.5 text-[13px] leading-5 font-medium'>\n            <span className='truncate'>{member.name}</span>\n            {member.isYou && <Badge variant='secondary'>You</Badge>}\n          </p>\n          <p className='text-muted-foreground truncate text-xs'>\n            {member.email}\n          </p>\n        </div>\n        <RoleMenu\n          role={member.role}\n          memberName={member.name}\n          isLastManager={isLastManager}\n          onChange={changeRole}\n          onRemove={removalOf(member, remove)}\n          trigger='text'\n        />\n      </div>\n    </motion.li>\n  );\n}\n\nfunction InvitationRow({\n  invitation,\n  onRevoke,\n}: {\n  invitation: Invitation;\n  onRevoke: (invitationId: string) => void;\n}) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n\n  return (\n    <motion.li\n      variants={rowCollapseOf(shouldReduceMotion)}\n      initial='hidden'\n      animate='shown'\n      exit='hidden'\n      className='overflow-hidden'\n    >\n      <div className='flex items-center gap-3 py-2'>\n        <span className='hairline-border text-muted-foreground border-foreground/25 flex size-7 shrink-0 items-center justify-center rounded-full border-dashed'>\n          <MailIcon className='size-3.5' />\n        </span>\n        <div className='min-w-0 flex-1'>\n          <p className='truncate text-[13px] leading-5 font-medium'>\n            {invitation.email}\n          </p>\n          <p className='text-muted-foreground truncate text-xs'>\n            {invitation.sentLabel}\n          </p>\n        </div>\n        <Button\n          variant='ghost'\n          size='sm'\n          aria-label={`Revoke the invite to ${invitation.email}`}\n          onClick={() => onRevoke(invitation.id)}\n          className='text-muted-foreground'\n        >\n          <XIcon />\n          Revoke\n        </Button>\n      </div>\n    </motion.li>\n  );\n}\n\nexport default function Teams04() {\n  const titleId = useId();\n  const [members, setMembers] = useState(INITIAL_MEMBERS);\n  const [invitations, setInvitations] = useState(INITIAL_INVITATIONS);\n  const managerCount = managerCountOf(members);\n  const hasOneManager = managerCount === 1;\n\n  function changeRole(memberId: string, role: Role) {\n    setMembers((current) => withRole(current, memberId, role));\n  }\n\n  function remove(memberId: string) {\n    setMembers((current) => current.filter((member) => member.id !== memberId));\n  }\n\n  function revoke(invitationId: string) {\n    setInvitations((current) =>\n      current.filter((invitation) => invitation.id !== invitationId)\n    );\n  }\n\n  return (\n    <section\n      aria-labelledby={titleId}\n      className='bg-card hairline-ring ring-border w-full max-w-[30rem] rounded-xl px-4 pt-3.5 pb-2 shadow-[0_1px_2px_rgb(0_0_0/0.04)]'\n    >\n      <header className='flex items-baseline justify-between gap-3 pb-1'>\n        <h3 id={titleId} className='text-sm font-medium'>\n          Members of Atlas Redesign\n        </h3>\n        <p className='text-muted-foreground flex gap-1 text-xs'>\n          <SlidingCount value={members.length} format={memberCountLabelOf} />\n          <span aria-hidden='true'>·</span>\n          <SlidingCount value={invitations.length} format={invitedLabelOf} />\n        </p>\n      </header>\n      <ul aria-label='Members'>\n        <AnimatePresence initial={false}>\n          {members.map((member) => {\n            const isManager = member.role === 'manager';\n            const isLastManager = isManager && hasOneManager;\n            return (\n              <MemberRow\n                key={member.id}\n                member={member}\n                isLastManager={isLastManager}\n                onRoleChange={changeRole}\n                onRemove={remove}\n              />\n            );\n          })}\n          {invitations.map((invitation) => (\n            <InvitationRow\n              key={invitation.id}\n              invitation={invitation}\n              onRevoke={revoke}\n            />\n          ))}\n        </AnimatePresence>\n      </ul>\n    </section>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/teams/teams-04.tsx"
    },
    {
      "path": "registry/ndeko/components/teams/_parts/collapse.ts",
      "content": "import type { Transition, Variants } from 'motion/react';\n\nconst EASE_OUT_STRONG: [number, number, number, number] = [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 surrounding container follows, instead of snapping shut.\n */\nconst SIZE_SPRING: Transition = { type: 'spring', bounce: 0, duration: 0.32 };\n\nconst ARRIVE: Transition = {\n  ...SIZE_SPRING,\n  opacity: { duration: 0.2, ease: EASE_OUT_STRONG },\n};\n\nconst LEAVE: Transition = {\n  ...SIZE_SPRING,\n  opacity: { duration: 0.12, ease: EASE_OUT_STRONG },\n};\n\nconst ARRIVE_FADE: Transition = { duration: 0.2, ease: EASE_OUT_STRONG };\n\nconst LEAVE_FADE: Transition = { duration: 0.12, ease: EASE_OUT_STRONG };\n\n/** A row whose spacing sits inside it: only its height and opacity change. */\nconst ROW_VARIANTS: Variants = {\n  shown: { height: 'auto', opacity: 1, transition: ARRIVE },\n  hidden: { height: 0, opacity: 0, transition: LEAVE },\n};\n\n/** A padded surface dismissed for good: its padding closes with its height. */\nconst SURFACE_VARIANTS: Variants = {\n  shown: { height: 'auto', opacity: 1, transition: ARRIVE },\n  hidden: {\n    height: 0,\n    opacity: 0,\n    paddingTop: 0,\n    paddingBottom: 0,\n    transition: LEAVE,\n  },\n};\n\nconst FADE_VARIANTS: Variants = {\n  shown: { opacity: 1, transition: ARRIVE_FADE },\n  hidden: { opacity: 0, transition: LEAVE_FADE },\n};\n\nexport function rowCollapseOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return ROW_VARIANTS;\n}\n\nexport function surfaceCollapseOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return SURFACE_VARIANTS;\n}\n",
      "type": "registry:component",
      "target": "components/teams/_parts/collapse.ts"
    },
    {
      "path": "registry/ndeko/components/teams/_parts/morph-label.tsx",
      "content": "'use client';\n\nimport {\n  AnimatePresence,\n  motion,\n  type Transition,\n  type Variants,\n} from 'motion/react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\n\nconst ARRIVE: Transition = { duration: 0.15, ease: [0.2, 0, 0, 1] };\n\nconst LEAVE: Transition = { duration: 0.1, ease: [0.2, 0, 0, 1] };\n\nconst BLUR_VARIANTS: Variants = {\n  enter: { opacity: 0, filter: 'blur(2px)' },\n  visible: { opacity: 1, filter: 'blur(0px)', transition: ARRIVE },\n  exit: { opacity: 0, filter: 'blur(2px)', transition: LEAVE },\n};\n\nconst FADE_VARIANTS: Variants = {\n  enter: { opacity: 0 },\n  visible: { opacity: 1, transition: ARRIVE },\n  exit: { opacity: 0, transition: LEAVE },\n};\n\nfunction variantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return BLUR_VARIANTS;\n}\n\ntype MorphLabelProps = {\n  /** Changes when the label becomes another one. */\n  value: string;\n  className?: string;\n  children: React.ReactNode;\n};\n\n/** A label that becomes another: the text crossfades through a light blur while its width follows. */\nexport function MorphLabel({ value, className, children }: MorphLabelProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n\n  return (\n    <AnimatedSize as='span' axis='width' contentClassName='relative flex'>\n      <AnimatePresence mode='popLayout' initial={false}>\n        <motion.span\n          key={value}\n          variants={variantsOf(shouldReduceMotion)}\n          initial='enter'\n          animate='visible'\n          exit='exit'\n          className={cn('flex whitespace-nowrap', className)}\n        >\n          {children}\n        </motion.span>\n      </AnimatePresence>\n    </AnimatedSize>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/teams/_parts/morph-label.tsx"
    },
    {
      "path": "registry/ndeko/components/teams/_parts/people.ts",
      "content": "import {\n  CheckIcon,\n  ClockIcon,\n  MinusIcon,\n  MoonIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\n\nexport type Presence = 'tracking' | 'online' | 'away' | 'offline';\n\nexport type Role = 'manager' | 'member' | 'viewer';\n\nexport type Member = {\n  id: string;\n  name: string;\n  email: string;\n  title: string;\n  role: Role;\n  presence: Presence;\n  isYou: boolean;\n};\n\ntype PresenceMeta = { label: string; color: string; glyph: Icon };\n\nexport const PRESENCE_META: Record<Presence, PresenceMeta> = {\n  tracking: {\n    label: 'Tracking time',\n    color: 'var(--primary)',\n    glyph: ClockIcon,\n  },\n  online: { label: 'Online', color: 'var(--success)', glyph: CheckIcon },\n  away: { label: 'Away', color: 'var(--warning)', glyph: MoonIcon },\n  offline: {\n    label: 'Offline',\n    color: 'var(--muted-foreground)',\n    glyph: MinusIcon,\n  },\n};\n\ntype RoleMeta = { label: string; description: string; color: string };\n\nexport const ROLE_META: Record<Role, RoleMeta> = {\n  manager: {\n    label: 'Manager',\n    description: 'Edits the team, its members and their plans',\n    color: 'var(--primary)',\n  },\n  member: {\n    label: 'Member',\n    description: 'Works on tasks and tracks time',\n    color: 'var(--info)',\n  },\n  viewer: {\n    label: 'Viewer',\n    description: 'Sees tasks and reports, changes nothing',\n    color: 'var(--muted-foreground)',\n  },\n};\n\nexport const ROLE_ORDER: Role[] = ['manager', 'member', 'viewer'];\n\nexport function isRole(value: unknown): value is Role {\n  return ROLE_ORDER.some((role) => role === value);\n}\n\nexport const MEMBERS: Member[] = [\n  {\n    id: 'amara',\n    name: 'Amara Okafor',\n    email: 'amara@example.com',\n    title: 'Product designer',\n    role: 'manager',\n    presence: 'tracking',\n    isYou: true,\n  },\n  {\n    id: 'leo',\n    name: 'Léo Martin',\n    email: 'leo@example.com',\n    title: 'Frontend engineer',\n    role: 'member',\n    presence: 'online',\n    isYou: false,\n  },\n  {\n    id: 'sana',\n    name: 'Sana Iqbal',\n    email: 'sana@example.com',\n    title: 'Backend engineer',\n    role: 'member',\n    presence: 'tracking',\n    isYou: false,\n  },\n  {\n    id: 'tomas',\n    name: 'Tomás Rivera',\n    email: 'tomas@example.com',\n    title: 'QA engineer',\n    role: 'member',\n    presence: 'away',\n    isYou: false,\n  },\n  {\n    id: 'mei',\n    name: 'Mei Lin',\n    email: 'mei@example.com',\n    title: 'Content designer',\n    role: 'viewer',\n    presence: 'offline',\n    isYou: false,\n  },\n  {\n    id: 'jonas',\n    name: 'Jonas Weber',\n    email: 'jonas@example.com',\n    title: 'Data analyst',\n    role: 'member',\n    presence: 'online',\n    isYou: false,\n  },\n];\n\nexport function memberById(memberId: string) {\n  const found = MEMBERS.find((member) => member.id === memberId);\n  if (found) {\n    return found;\n  }\n  return MEMBERS[0];\n}\n",
      "type": "registry:component",
      "target": "components/teams/_parts/people.ts"
    },
    {
      "path": "registry/ndeko/components/teams/_parts/presence-avatar.tsx",
      "content": "import { cn } from '@/registry/ndeko/lib/utils';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\n\nimport { PRESENCE_META, type Member } from './people';\n\nconst SIZE_CLASS = {\n  sm: { avatar: 'size-7', badge: 'size-3.5', glyph: 'size-2' },\n  md: { avatar: 'size-9', badge: 'size-4', glyph: 'size-2.5' },\n  lg: { avatar: 'size-12', badge: 'size-5', glyph: 'size-3' },\n} as const;\n\ntype PresenceAvatarProps = {\n  member: Member;\n  size?: keyof typeof SIZE_CLASS;\n  /** The colour behind the badge's cut-out: the surface the avatar sits on. */\n  surfaceClassName?: string;\n  className?: string;\n};\n\n/** A person's face with their presence as a small glyph on its corner, read out after the name. */\nexport function PresenceAvatar({\n  member,\n  size = 'md',\n  surfaceClassName = 'bg-card',\n  className,\n}: PresenceAvatarProps) {\n  const presence = PRESENCE_META[member.presence];\n  const Glyph = presence.glyph;\n  const badgeStyle = { '--chip': presence.color } as React.CSSProperties;\n  const sizes = SIZE_CLASS[size];\n\n  return (\n    <span className={cn('relative inline-flex shrink-0', className)}>\n      <Avatar className={sizes.avatar} seed={member.name} />\n      <span\n        aria-hidden='true'\n        className={cn(\n          'absolute -end-0.5 -bottom-0.5 flex rounded-full p-px',\n          surfaceClassName\n        )}\n      >\n        <span\n          style={badgeStyle}\n          className={cn(\n            'chip-3d flex items-center justify-center rounded-full',\n            sizes.badge\n          )}\n        >\n          <Glyph className={sizes.glyph} strokeWidth={2.75} />\n        </span>\n      </span>\n      <span className='sr-only'>{presence.label}</span>\n    </span>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/teams/_parts/presence-avatar.tsx"
    },
    {
      "path": "registry/ndeko/components/teams/_parts/role-menu.tsx",
      "content": "'use client';\n\nimport { ChevronDownIcon, UserMinusIcon } from '@/registry/ndeko/lib/icons';\nimport {\n  DropdownMenu,\n  DropdownMenuContent,\n  DropdownMenuGroup,\n  DropdownMenuGroupLabel,\n  DropdownMenuItem,\n  DropdownMenuRadioGroup,\n  DropdownMenuRadioItem,\n  DropdownMenuSeparator,\n  DropdownMenuTrigger,\n} from '@/registry/ndeko/ui/dropdown-menu';\n\nimport { MorphLabel } from './morph-label';\nimport { ROLE_META, ROLE_ORDER, isRole, type Role } from './people';\n\ntype RoleTrigger = 'chip' | 'text';\n\nconst CHIP_TRIGGER =\n  'chip-3d inline-flex h-6 shrink-0 cursor-pointer items-center gap-1 rounded-md px-2 text-xs font-medium whitespace-nowrap outline-none focus-visible:ring-[3px] focus-visible:ring-ring/25';\n\nconst TEXT_TRIGGER =\n  'inline-flex h-7 shrink-0 cursor-pointer items-center gap-1 rounded-md px-2 text-[13px] whitespace-nowrap text-muted-foreground outline-none transition-colors duration-150 hover:bg-foreground/5 hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/25 data-popup-open:bg-foreground/5 data-popup-open:text-foreground';\n\nfunction triggerClassOf(trigger: RoleTrigger) {\n  if (trigger === 'chip') {\n    return CHIP_TRIGGER;\n  }\n  return TEXT_TRIGGER;\n}\n\nfunction triggerStyleOf(trigger: RoleTrigger, role: Role) {\n  if (trigger === 'chip') {\n    return { '--chip': ROLE_META[role].color } as React.CSSProperties;\n  }\n  return undefined;\n}\n\nfunction isLockedOption(option: Role, isLastManager: boolean) {\n  const leavesManagerRole = option !== 'manager';\n  return isLastManager && leavesManagerRole;\n}\n\ntype RoleMenuProps = {\n  role: Role;\n  memberName: string;\n  onChange: (role: Role) => void;\n  /** The only manager of the team cannot step down: a team keeps one. */\n  isLastManager?: boolean;\n  /** Adds Remove from team at the end of the menu. */\n  onRemove?: () => void;\n  trigger?: RoleTrigger;\n};\n\n/** The role of a member as a menu: the trigger shows it, the rows explain each one. */\nexport function RoleMenu({\n  role,\n  memberName,\n  onChange,\n  isLastManager = false,\n  onRemove,\n  trigger = 'chip',\n}: RoleMenuProps) {\n  const meta = ROLE_META[role];\n  const canRemove = onRemove !== undefined;\n  const triggerLabel = `Role of ${memberName}: ${meta.label}. Change role`;\n\n  function changeRole(value: unknown) {\n    if (isRole(value)) {\n      onChange(value);\n    }\n  }\n\n  return (\n    <DropdownMenu>\n      <DropdownMenuTrigger\n        aria-label={triggerLabel}\n        style={triggerStyleOf(trigger, role)}\n        className={triggerClassOf(trigger)}\n      >\n        <MorphLabel value={role}>{meta.label}</MorphLabel>\n        <ChevronDownIcon className='size-3.5 opacity-70' />\n      </DropdownMenuTrigger>\n      <DropdownMenuContent align='end' className='w-72'>\n        <DropdownMenuGroup>\n          <DropdownMenuGroupLabel>Role of {memberName}</DropdownMenuGroupLabel>\n          <DropdownMenuRadioGroup value={role} onValueChange={changeRole}>\n            {ROLE_ORDER.map((option) => {\n              const optionMeta = ROLE_META[option];\n              const isLocked = isLockedOption(option, isLastManager);\n              return (\n                <DropdownMenuRadioItem\n                  key={option}\n                  value={option}\n                  disabled={isLocked}\n                  closeOnClick\n                  className='h-auto items-start py-2'\n                >\n                  <span className='flex flex-col gap-0.5'>\n                    <span>{optionMeta.label}</span>\n                    <span className='text-muted-foreground text-xs'>\n                      {optionMeta.description}\n                    </span>\n                  </span>\n                </DropdownMenuRadioItem>\n              );\n            })}\n          </DropdownMenuRadioGroup>\n        </DropdownMenuGroup>\n        {isLastManager && (\n          <p className='text-muted-foreground px-2 pt-1 pb-1.5 text-xs'>\n            A team keeps at least one manager. Make someone else a manager first\n          </p>\n        )}\n        {canRemove && (\n          <>\n            <DropdownMenuSeparator />\n            <DropdownMenuItem variant='destructive' onClick={onRemove}>\n              <UserMinusIcon />\n              Remove from team\n            </DropdownMenuItem>\n          </>\n        )}\n      </DropdownMenuContent>\n    </DropdownMenu>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/teams/_parts/role-menu.tsx"
    },
    {
      "path": "registry/ndeko/components/teams/_parts/sliding-count.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 { cn } from '@/registry/ndeko/lib/utils';\n\nconst SHIFT_PX = 8;\n\nconst SLIDE_TRANSITION: Transition = { duration: 0.18, ease: [0.2, 0, 0, 1] };\n\nconst SLIDE_VARIANTS: Variants = {\n  enter: (direction: number) => {\n    const offset = direction * SHIFT_PX;\n    return { opacity: 0, y: offset };\n  },\n  visible: { opacity: 1, y: 0 },\n  exit: (direction: number) => {\n    const offset = direction * SHIFT_PX;\n    return { opacity: 0, y: -offset };\n  },\n};\n\nconst FADE_VARIANTS: Variants = {\n  enter: { opacity: 0 },\n  visible: { opacity: 1 },\n  exit: { opacity: 0 },\n};\n\nfunction variantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return SLIDE_VARIANTS;\n}\n\nfunction directionOf(previous: number, next: number) {\n  if (next > previous) {\n    return 1;\n  }\n  return -1;\n}\n\ntype Shown = { value: number; direction: number };\n\ntype SlidingCountProps = {\n  value: number;\n  /** Writes the figure in words, with its singular branch. */\n  format: (value: number) => string;\n  className?: string;\n};\n\n/** A figure the person just changed: it slides in the direction of the change. */\nexport function SlidingCount({ value, format, className }: SlidingCountProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const [shown, setShown] = useState<Shown>({ value, direction: 1 });\n  const text = format(value);\n\n  if (shown.value !== value) {\n    const direction = directionOf(shown.value, value);\n    setShown({ value, direction });\n  }\n\n  return (\n    <span\n      className={cn(\n        'relative inline-flex overflow-hidden tabular-nums',\n        className\n      )}\n    >\n      <AnimatePresence\n        mode='popLayout'\n        initial={false}\n        custom={shown.direction}\n      >\n        <motion.span\n          key={text}\n          custom={shown.direction}\n          variants={variantsOf(shouldReduceMotion)}\n          initial='enter'\n          animate='visible'\n          exit='exit'\n          transition={SLIDE_TRANSITION}\n          className='whitespace-nowrap'\n        >\n          {text}\n        </motion.span>\n      </AnimatePresence>\n    </span>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/teams/_parts/sliding-count.tsx"
    },
    {
      "path": "registry/ndeko/components/teams/_parts/teams.ts",
      "content": "export type Team = {\n  id: string;\n  name: string;\n  /** The colour the team picked for its tile. */\n  color: string;\n  memberIds: string[];\n  memberCount: number;\n};\n\nexport const TEAMS: Team[] = [\n  {\n    id: 'atlas',\n    name: 'Atlas Redesign',\n    color: 'var(--info)',\n    memberIds: ['amara', 'leo', 'sana', 'tomas', 'mei', 'jonas'],\n    memberCount: 6,\n  },\n  {\n    id: 'field',\n    name: 'Field App',\n    color: 'var(--success)',\n    memberIds: ['leo', 'sana', 'jonas'],\n    memberCount: 5,\n  },\n  {\n    id: 'growth',\n    name: 'Growth',\n    color: 'var(--warning)',\n    memberIds: ['mei', 'amara'],\n    memberCount: 4,\n  },\n  {\n    id: 'platform',\n    name: 'Platform',\n    color: 'var(--primary)',\n    memberIds: ['sana', 'tomas', 'jonas'],\n    memberCount: 7,\n  },\n  {\n    id: 'research',\n    name: 'Research',\n    color: 'var(--muted-foreground)',\n    memberIds: ['mei'],\n    memberCount: 1,\n  },\n];\n\nexport function memberCountLabelOf(count: number) {\n  if (count === 1) {\n    return '1 member';\n  }\n  return `${count} members`;\n}\n",
      "type": "registry:component",
      "target": "components/teams/_parts/teams.ts"
    }
  ],
  "categories": [
    "components",
    "teams"
  ],
  "type": "registry:component"
}