{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "teams-09",
  "title": "Team picker with search",
  "description": "A searchable list of teams for moving a task, where the mark travels to the team picked and an empty search offers a way back.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/animated-size.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/command.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/mesh-tile.json",
    "https://ui.ndekocode.dev/r/selected-mark.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/components/teams/teams-09.tsx",
      "content": "'use client';\n\nimport { motion, type Transition } from 'motion/react';\nimport { useId, useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { CircleAlertIcon } from '@/registry/ndeko/lib/icons';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport {\n  Command,\n  CommandEmpty,\n  CommandGroup,\n  CommandInput,\n  CommandItem,\n  CommandList,\n} from '@/registry/ndeko/ui/command';\nimport { SelectedMark } from '@/registry/ndeko/ui/selected-mark';\n\nimport { MorphLabel } from './_parts/morph-label';\nimport { TeamTile } from './_parts/team-tile';\nimport { TEAMS, memberCountLabelOf } from './_parts/teams';\n\nconst TRAVEL: Transition = { type: 'spring', bounce: 0, duration: 0.3 };\nconst INSTANT: Transition = { duration: 0 };\n\nfunction travelOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return INSTANT;\n  }\n  return TRAVEL;\n}\n\nfunction teamById(teamId: string) {\n  const found = TEAMS.find((team) => team.id === teamId);\n  if (found) {\n    return found;\n  }\n  return TEAMS[0];\n}\n\nexport default function Teams09() {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const markId = useId();\n  const [query, setQuery] = useState('');\n  const [teamId, setTeamId] = useState(TEAMS[0].id);\n  const current = teamById(teamId);\n  const travel = travelOf(shouldReduceMotion);\n\n  function clearSearch() {\n    setQuery('');\n  }\n\n  return (\n    <Command\n      label='Move FRN-148 to a team'\n      className='bg-card hairline-ring ring-border h-auto w-full max-w-[22rem] shadow-[0_1px_2px_rgb(0_0_0/0.04)]'\n    >\n      <div className='flex items-center gap-2 px-3 pt-3 pb-2 text-xs'>\n        <span\n          role='img'\n          aria-label='Bug'\n          className='gem-plate inline-flex size-4 shrink-0 items-center justify-center rounded-[5px] [--gem:var(--destructive)]'\n        >\n          <CircleAlertIcon strokeWidth={2.5} className='size-2.5' />\n        </span>\n        <span className='text-muted-foreground tabular-nums'>FRN-148</span>\n        <span className='text-muted-foreground'>in</span>\n        <span aria-live='polite' className='font-medium'>\n          <MorphLabel value={current.id}>{current.name}</MorphLabel>\n        </span>\n      </div>\n      <CommandInput\n        value={query}\n        onValueChange={setQuery}\n        placeholder='Move to a team'\n        aria-label='Find a team'\n      />\n      <AnimatedSize>\n        <CommandList className='max-h-72'>\n          <CommandEmpty className='flex flex-col items-center gap-2 py-6'>\n            <span>No team matches “{query}”</span>\n            <Button size='sm' variant='outline' onClick={clearSearch}>\n              Clear search\n            </Button>\n          </CommandEmpty>\n          <CommandGroup heading='Teams'>\n            {TEAMS.map((team) => {\n              const isCurrent = team.id === teamId;\n              return (\n                <CommandItem\n                  key={team.id}\n                  value={team.name}\n                  onSelect={() => setTeamId(team.id)}\n                  aria-current={isCurrent}\n                  className='h-9'\n                >\n                  <TeamTile name={team.name} color={team.color} />\n                  <span className='min-w-0 flex-1 truncate'>{team.name}</span>\n                  <span className='text-muted-foreground text-xs tabular-nums'>\n                    {memberCountLabelOf(team.memberCount)}\n                  </span>\n                  <span className='flex w-[18px] justify-end'>\n                    {isCurrent && (\n                      <motion.span\n                        layoutId={markId}\n                        transition={travel}\n                        className='flex'\n                      >\n                        <SelectedMark label='Current team' />\n                      </motion.span>\n                    )}\n                  </span>\n                </CommandItem>\n              );\n            })}\n          </CommandGroup>\n        </CommandList>\n      </AnimatedSize>\n    </Command>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/teams/teams-09.tsx"
    },
    {
      "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/team-tile.tsx",
      "content": "import { cn } from '@/registry/ndeko/lib/utils';\nimport { MeshTile } from '@/registry/ndeko/ui/mesh-tile';\n\nconst SIZE_CLASS = {\n  sm: 'size-5 rounded-[5px]',\n  md: 'size-6 rounded-md',\n  lg: 'size-9 rounded-lg',\n} as const;\n\ntype TeamTileProps = {\n  name: string;\n  color: string;\n  size?: keyof typeof SIZE_CLASS;\n  className?: string;\n};\n\n/** A team without a logo: a picture drawn from its name, in its colour. */\nexport function TeamTile({\n  name,\n  color,\n  size = 'md',\n  className,\n}: TeamTileProps) {\n  const sizeClass = SIZE_CLASS[size];\n\n  return (\n    <MeshTile seed={name} color={color} className={cn(sizeClass, className)} />\n  );\n}\n",
      "type": "registry:component",
      "target": "components/teams/_parts/team-tile.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"
}