{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "p-combobox-16",
  "description": "Timezone combobox",
  "registryDependencies": [
    "@coss/combobox"
  ],
  "files": [
    {
      "path": "registry/default/particles/p-combobox-16.tsx",
      "content": "\"use client\";\n\nimport { useMemo } from \"react\";\nimport {\n  Combobox,\n  ComboboxEmpty,\n  ComboboxInput,\n  ComboboxItem,\n  ComboboxList,\n  ComboboxPopup,\n} from \"@/registry/default/ui/combobox\";\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\n      autoHighlight\n      defaultValue={defaultTimezone}\n      items={formattedTimezones}\n    >\n      <ComboboxInput\n        aria-label=\"Select timezone\"\n        placeholder=\"Select timezone...\"\n      />\n      <ComboboxPopup>\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"
}