{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "combobox-4",
  "type": "registry:component",
  "title": "Combobox 4",
  "description": "Combobox 4. A combobox component for selecting from a list of options.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "command",
    "label",
    "popover"
  ],
  "files": [
    {
      "path": "components/watermelon/combobox-4.tsx",
      "type": "registry:component",
      "content": "'use client'\n\nimport { useId, useState, type ComponentType, type SVGProps } from 'react'\n\nimport {\n  BriefcaseIcon,\n  ChevronsUpDownIcon,\n  CodeIcon,\n  FolderKanbanIcon,\n  LayoutGridIcon,\n  ShieldCheckIcon,\n  UsersIcon\n} from 'lucide-react'\n\nimport {\n  Command,\n  CommandEmpty,\n  CommandGroup,\n  CommandInput,\n  CommandItem,\n  CommandList\n} from '@/components/base-ui/command'\nimport { Label } from '@/components/base-ui/label'\nimport { Popover, PopoverContent, PopoverTrigger } from '@/components/base-ui/popover'\ntype IndustryOption = {\n  icon: ComponentType<SVGProps<SVGSVGElement>>\n  label: string\n  value: string\n}\n\nconst industries = [\n  {\n    value: 'product',\n    label: 'Product',\n    icon: FolderKanbanIcon\n  },\n  {\n    value: 'design',\n    label: 'Design',\n    icon: CodeIcon\n  },\n  {\n    value: 'marketing',\n    label: 'Marketing',\n    icon: UsersIcon\n  },\n  {\n    value: 'operations',\n    label: 'Operations',\n    icon: LayoutGridIcon\n  },\n  {\n    value: 'support',\n    label: 'Support',\n    icon: BriefcaseIcon\n  },\n  {\n    value: 'legal',\n    label: 'Legal',\n    icon: ShieldCheckIcon\n  },\n  {\n    value: 'people',\n    label: 'People',\n    icon: BriefcaseIcon\n  }\n] as const satisfies readonly IndustryOption[]\n\ntype IndustryValue = (typeof industries)[number]['value']\ntype IndustryOptionMap = Record<IndustryValue, (typeof industries)[number]>\n\nconst industryByValue: IndustryOptionMap = {\n  product: industries[0],\n  design: industries[1],\n  marketing: industries[2],\n  operations: industries[3],\n  support: industries[4],\n  legal: industries[5],\n  people: industries[6]\n}\n\nconst isIndustryValue = (value: string): value is IndustryValue =>\n  industries.some((industry) => industry.value === value)\n\nconst Combobox4 = () => {\n  const id = useId()\n  const [open, setOpen] = useState<boolean>(false)\n  const [selectedIndustry, setSelectedIndustry] = useState<IndustryValue | ''>(\n    ''\n  )\n\n  const selectedIndustryOption = selectedIndustry\n    ? industryByValue[selectedIndustry]\n    : undefined\n  const SelectedIcon = selectedIndustryOption?.icon\n\n  return (\n    <div className='w-full max-w-xs space-y-2'>\n      <Label htmlFor={id} className='text-sm font-medium'>\n        Choose a team area\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          {selectedIndustryOption ? (\n            <span className='flex min-w-0 items-center gap-2'>\n              {SelectedIcon && (\n                <SelectedIcon className='text-muted-foreground size-4' />\n              )}\n              <span className='truncate'>{selectedIndustryOption.label}</span>\n            </span>\n          ) : (\n            <span className='text-muted-foreground'>Select team area</span>\n          )}\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='Search team areas...' className='h-9 px-1' />\n            <CommandList>\n              <CommandEmpty>No team area found.</CommandEmpty>\n              <CommandGroup>\n                {industries.map((industry) => {\n                  const Icon = industry.icon\n\n                  return (\n                    <CommandItem\n                      key={industry.value}\n                      value={industry.value}\n                      data-checked={selectedIndustry === industry.value}\n                      onSelect={currentValue => {\n                        if (currentValue === selectedIndustry) {\n                          setSelectedIndustry('')\n                          setOpen(false)\n                          return\n                        }\n\n                        if (!isIndustryValue(currentValue)) {\n                          return\n                        }\n\n                        setSelectedIndustry(currentValue)\n                        setOpen(false)\n                      }}\n                      className='mt-1 rounded-md pr-2'\n                    >\n                      <div className='flex items-center gap-2'>\n                        <Icon className='text-muted-foreground size-4' />\n                        {industry.label}\n                      </div>\n                    </CommandItem>\n                  )\n                })}\n              </CommandGroup>\n            </CommandList>\n          </Command>\n        </PopoverContent>\n      </Popover>\n    </div>\n  )\n}\n\nexport default Combobox4\n"
    }
  ]
}
