{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "combobox-6",
  "type": "registry:component",
  "title": "Combobox 6",
  "description": "Combobox 6. A combobox component for selecting from a list of options.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "command",
    "label",
    "popover"
  ],
  "files": [
    {
      "path": "components/watermelon/combobox-6.tsx",
      "type": "registry:component",
      "content": "'use client'\n\nimport { useId, useState } from 'react'\n\nimport { ChevronsUpDownIcon, PlusIcon } from 'lucide-react'\n\nimport {\n  Command,\n  CommandEmpty,\n  CommandGroup,\n  CommandInput,\n  CommandItem,\n  CommandList,\n  CommandSeparator\n} from '@/components/base-ui/command'\nimport { Label } from '@/components/base-ui/label'\nimport { Popover, PopoverContent, PopoverTrigger } from '@/components/base-ui/popover'\n\nimport { cn } from '@/lib/utils'\n\nconst universities = [\n  {\n    value: 'atlas',\n    label: 'Atlas Workspace'\n  },\n  {\n    value: 'notion-lab',\n    label: 'Notion Lab'\n  },\n  {\n    value: 'north-star',\n    label: 'North Star'\n  },\n  {\n    value: 'field-note',\n    label: 'Field Note'\n  }\n] as const\n\ntype UniversityOption = (typeof universities)[number]\ntype UniversityValue = UniversityOption['value']\n\nconst universityLabelByValue: Record<UniversityValue, UniversityOption['label']> =\n  {\n    atlas: 'Atlas Workspace',\n    'notion-lab': 'Notion Lab',\n    'north-star': 'North Star',\n    'field-note': 'Field Note'\n  }\n\nconst isUniversityValue = (value: string): value is UniversityValue =>\n  universities.some((university) => university.value === value)\n\nconst Combobox6 = () => {\n  const id = useId()\n  const [open, setOpen] = useState<boolean>(false)\n  const [selectedUniversity, setSelectedUniversity] =\n    useState<UniversityValue>('atlas')\n\n  return (\n    <div className='w-full max-w-xs space-y-2'>\n      <Label htmlFor={id} className='text-sm font-medium'>\n        Workspace picker\n      </Label>\n      <Popover open={open} onOpenChange={setOpen}>\n        <PopoverTrigger\n          id={id}\n          role='combobox'\n          aria-expanded={open}\n          className='flex h-10 w-full items-center justify-between rounded-3xl border border-border/60 bg-background px-3.5 text-sm font-normal shadow-xs outline-offset-0 outline-none transition-colors hover:bg-accent/20 focus-visible:ring-[3px] focus-visible:ring-ring/50'\n        >\n          <span\n            className={cn(\n              'truncate',\n              !selectedUniversity && 'text-muted-foreground'\n            )}\n          >\n            {selectedUniversity ? (\n              universityLabelByValue[selectedUniversity]\n            ) : (\n              <span className='text-muted-foreground'>Select workspace</span>\n            )}\n          </span>\n          <ChevronsUpDownIcon\n            className='text-muted-foreground/80 size-4 shrink-0'\n            aria-hidden='true'\n          />\n        </PopoverTrigger>\n        <PopoverContent\n          className='w-full min-w-(--radix-popper-anchor-width) overflow-hidden rounded-2xl border border-border/60 p-0 shadow-sm'\n          align='start'\n        >\n          <Command className='rounded-3xl!'>\n            <CommandInput placeholder='Find workspace' className='h-9 px-1' />\n            <CommandList>\n              <CommandEmpty>No workspace found.</CommandEmpty>\n              <CommandGroup>\n                {universities.map(university => (\n                  <CommandItem\n                    key={university.value}\n                    value={university.value}\n                    data-checked={selectedUniversity === university.value}\n                    onSelect={currentValue => {\n                      if (!isUniversityValue(currentValue)) {\n                        return\n                      }\n\n                      setSelectedUniversity(currentValue)\n                      setOpen(false)\n                    }}\n                    className='flex items-center rounded-md pr-2'\n                  >\n                    <span className='min-w-0 flex-1 truncate'>\n                      {university.label}\n                    </span>\n                  </CommandItem>\n                ))}\n              </CommandGroup>\n              <CommandSeparator />\n              <CommandGroup>\n                <button\n                  type='button'\n                  className='hover:bg-accent/30 flex h-9 w-full items-center justify-start gap-2 rounded-md px-3 text-sm font-normal'\n                >\n                  <PlusIcon className='-ms-2 size-4 opacity-60' aria-hidden='true' />\n                  New workspace\n                </button>\n              </CommandGroup>\n            </CommandList>\n          </Command>\n        </PopoverContent>\n      </Popover>\n    </div>\n  )\n}\n\nexport default Combobox6\n"
    }
  ]
}
