{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "p-combobox-17",
  "description": "Timezone combobox with search input",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "@coss/combobox",
    "@coss/select"
  ],
  "files": [
    {
      "path": "registry/default/particles/p-combobox-17.tsx",
      "content": "\"use client\";\n\nimport { SearchIcon } from \"lucide-react\";\nimport { useMemo } from \"react\";\nimport {\n  Combobox,\n  ComboboxEmpty,\n  ComboboxInput,\n  ComboboxItem,\n  ComboboxList,\n  ComboboxPopup,\n  ComboboxTrigger,\n  ComboboxValue,\n} from \"@/registry/default/ui/combobox\";\nimport { SelectButton } from \"@/registry/default/ui/select\";\n\nexport default function Particle() {\n  const timezones = Intl.supportedValuesOf(\"timeZone\");\n\n  const formattedTimezones = useMemo(() => {\n    return timezones\n      .map((timezone) => {\n        const formatter = new Intl.DateTimeFormat(\"en\", {\n          timeZone: timezone,\n          timeZoneName: \"shortOffset\",\n        });\n        const parts = formatter.formatToParts(new Date());\n        const offset =\n          parts.find((part) => part.type === \"timeZoneName\")?.value || \"\";\n        const modifiedOffset = offset === \"GMT\" ? \"GMT+0\" : offset;\n\n        const offsetMatch = offset.match(/GMT([+-]?)(\\d+)(?::(\\d+))?/);\n        const sign = offsetMatch?.[1] === \"-\" ? -1 : 1;\n        const hours = Number.parseInt(offsetMatch?.[2] || \"0\", 10);\n        const minutes = Number.parseInt(offsetMatch?.[3] || \"0\", 10);\n        const totalMinutes = sign * (hours * 60 + minutes);\n\n        return {\n          label: `(${modifiedOffset}) ${timezone.replace(/_/g, \" \")}`,\n          numericOffset: totalMinutes,\n          value: timezone,\n        };\n      })\n      .sort((a, b) => a.numericOffset - b.numericOffset);\n  }, [timezones]);\n\n  const _defaultTimezone = formattedTimezones.find(\n    (tz) => tz.value === \"Europe/London\",\n  );\n\n  return (\n    <Combobox autoHighlight items={formattedTimezones}>\n      <ComboboxTrigger render={<SelectButton />}>\n        <ComboboxValue placeholder=\"Select timezone\" />\n      </ComboboxTrigger>\n      <ComboboxPopup aria-label=\"Select timezone\">\n        <div className=\"border-b p-2\">\n          <ComboboxInput\n            className=\"rounded-md before:rounded-[calc(var(--radius-md)-1px)]\"\n            placeholder=\"e.g. Europe/London\"\n            showTrigger={false}\n            startAddon={<SearchIcon />}\n          />\n        </div>\n        <ComboboxEmpty>No timezones found.</ComboboxEmpty>\n        <ComboboxList>\n          {(item) => (\n            <ComboboxItem key={item.value} value={item}>\n              {item.label}\n            </ComboboxItem>\n          )}\n        </ComboboxList>\n      </ComboboxPopup>\n    </Combobox>\n  );\n}\n",
      "type": "registry:block"
    }
  ],
  "meta": {
    "className": "**:data-[slot=preview]:w-full **:data-[slot=preview]:max-w-64"
  },
  "categories": [
    "combobox",
    "input",
    "timezone"
  ],
  "type": "registry:block"
}