{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "select-44",
  "title": "Searchable country select",
  "description": "Countries grouped by continent, narrowed by a search field.",
  "dependencies": [
    "@base-ui/react"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/combobox.json",
    "https://ui.ndekocode.dev/r/field.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/components/select/select-44.tsx",
      "content": "'use client';\n\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react/combobox';\n\nimport { SearchIcon } from '@/registry/ndeko/lib/icons';\nimport {\n  Combobox,\n  ComboboxContent,\n  ComboboxEmpty,\n  ComboboxGroup,\n  ComboboxGroupLabel,\n  ComboboxInput,\n  ComboboxItem,\n  ComboboxList,\n  ComboboxSelectTrigger,\n  ComboboxValue,\n} from '@/registry/ndeko/ui/combobox';\nimport { Field, FieldLabel } from '@/registry/ndeko/ui/field';\n\ntype Country = {\n  value: string;\n  label: string;\n};\n\ntype Continent = {\n  continent: string;\n  items: Country[];\n};\n\nconst CONTINENTS: Continent[] = [\n  {\n    continent: 'America',\n    items: [\n      { value: 'US', label: 'United States' },\n      { value: 'CA', label: 'Canada' },\n      { value: 'MX', label: 'Mexico' },\n    ],\n  },\n  {\n    continent: 'Africa',\n    items: [\n      { value: 'CD', label: 'DR Congo' },\n      { value: 'ZA', label: 'South Africa' },\n      { value: 'NG', label: 'Nigeria' },\n      { value: 'MA', label: 'Morocco' },\n    ],\n  },\n  {\n    continent: 'Asia',\n    items: [\n      { value: 'CN', label: 'China' },\n      { value: 'JP', label: 'Japan' },\n      { value: 'IN', label: 'India' },\n    ],\n  },\n  {\n    continent: 'Europe',\n    items: [\n      { value: 'GB', label: 'United Kingdom' },\n      { value: 'FR', label: 'France' },\n      { value: 'DE', label: 'Germany' },\n    ],\n  },\n  {\n    continent: 'Oceania',\n    items: [\n      { value: 'AU', label: 'Australia' },\n      { value: 'NZ', label: 'New Zealand' },\n    ],\n  },\n];\n\nfunction CountryName({ country }: { country: Country }) {\n  return (\n    <span className='flex min-w-0 items-center gap-2'>\n      <span\n        aria-hidden='true'\n        className='bg-foreground/[0.06] text-muted-foreground inline-flex h-4 w-6 shrink-0 items-center justify-center rounded-sm text-[10px] font-medium'\n      >\n        {country.value}\n      </span>\n      <span className='truncate'>{country.label}</span>\n    </span>\n  );\n}\n\nfunction selectedCountryOf(country: Country | null) {\n  if (!country) {\n    return 'Pick a country';\n  }\n  return <CountryName country={country} />;\n}\n\nexport default function Select44() {\n  return (\n    <Field className='w-full max-w-xs'>\n      <FieldLabel>Country</FieldLabel>\n      <Combobox items={CONTINENTS}>\n        <ComboboxSelectTrigger>\n          <ComboboxValue>{selectedCountryOf}</ComboboxValue>\n        </ComboboxSelectTrigger>\n        <ComboboxContent className='flex flex-col p-0'>\n          <div className='hairline-b border-border flex h-10 shrink-0 items-center gap-2 px-3'>\n            <SearchIcon className='text-muted-foreground size-4 shrink-0' />\n            <ComboboxInput\n              aria-label='Search countries'\n              placeholder='Search countries'\n              className='h-full px-0'\n            />\n          </div>\n          <ComboboxEmpty>No country matches your search.</ComboboxEmpty>\n          <ComboboxList className='max-h-72 overflow-y-auto p-1 empty:hidden'>\n            {(group: Continent) => (\n              <ComboboxGroup key={group.continent} items={group.items}>\n                <ComboboxGroupLabel>{group.continent}</ComboboxGroupLabel>\n                <ComboboxPrimitive.Collection>\n                  {(country: Country) => (\n                    <ComboboxItem key={country.value} value={country}>\n                      <CountryName country={country} />\n                    </ComboboxItem>\n                  )}\n                </ComboboxPrimitive.Collection>\n              </ComboboxGroup>\n            )}\n          </ComboboxList>\n        </ComboboxContent>\n      </Combobox>\n    </Field>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "categories": [
    "components",
    "select"
  ],
  "type": "registry:component"
}