{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "p-select-13",
  "description": "Timezone select",
  "registryDependencies": [
    "@coss/select"
  ],
  "files": [
    {
      "path": "registry/default/particles/p-select-13.tsx",
      "content": "\"use client\";\n\nimport { useMemo } from \"react\";\nimport {\n  Select,\n  SelectItem,\n  SelectPopup,\n  SelectTrigger,\n  SelectValue,\n} 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  return (\n    <Select\n      aria-label=\"Select timezone\"\n      defaultValue={formattedTimezones.find(\n        (tz) => tz.value === \"Europe/London\",\n      )}\n      itemToStringValue={(item) => item.value}\n    >\n      <SelectTrigger>\n        <SelectValue>\n          {(item) => <span className=\"truncate\">{item.label}</span>}\n        </SelectValue>\n      </SelectTrigger>\n      <SelectPopup>\n        {formattedTimezones.map((item) => (\n          <SelectItem key={item.value} value={item}>\n            {item.label}\n          </SelectItem>\n        ))}\n      </SelectPopup>\n    </Select>\n  );\n}\n",
      "type": "registry:block"
    }
  ],
  "meta": {
    "className": "**:data-[slot=preview]:w-full **:data-[slot=preview]:max-w-64"
  },
  "categories": [
    "select",
    "time",
    "timezone"
  ],
  "type": "registry:block"
}