{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "holiday-calendar-markers",
  "title": "Holiday Calendar Markers",
  "description": "A calendar with dots under public holidays and a list of the holidays in the visible month, read from the day you focus or pick. Use this when planners need to see which days are public holidays before choosing dates.",
  "registryDependencies": [
    "@tealmac/calendar-grid",
    "@tealmac/date-time-core"
  ],
  "files": [
    {
      "path": "registry/patterns/holiday-calendar-markers/holiday-calendar-markers.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { CalendarGrid } from \"@/components/ui/calendar-grid\"\nimport {\n  formatDate,\n  resolveLocale,\n  today as todayISO,\n} from \"@/components/ui/date-time-core\"\n\nexport interface HolidayCalendarMarkersProps {\n  holidays: Record<string, string>\n  value?: string | null\n  defaultValue?: string | null\n  onValueChange?: (value: string | null) => void\n  today?: string\n  locale?: string\n}\n\nexport function holidaysInMonth(\n  holidays: Record<string, string>,\n  month: string\n) {\n  const prefix = month.slice(0, 7)\n  return Object.entries(holidays)\n    .filter(([d]) => d.startsWith(prefix))\n    .sort(([a], [b]) => a.localeCompare(b))\n    .map(([date, name]) => ({ date, name }))\n}\n\nexport function HolidayCalendarMarkers({\n  holidays,\n  value,\n  defaultValue = null,\n  onValueChange,\n  today,\n  locale,\n}: HolidayCalendarMarkersProps) {\n  const loc = resolveLocale(locale)\n  const now = today ?? todayISO()\n  const [inner, setInner] = React.useState<string | null>(defaultValue)\n  const [month, setMonth] = React.useState(defaultValue ?? now)\n  const date = value === undefined ? inner : value\n  const list = holidaysInMonth(holidays, month)\n\n  return (\n    <div className=\"flex flex-col gap-3 sm:flex-row\">\n      <CalendarGrid\n        label=\"Holidays\"\n        locale={loc}\n        today={now}\n        month={month}\n        onMonthChange={setMonth}\n        markers={holidays}\n        value={date}\n        onValueChange={(d) => {\n          if (value === undefined) setInner(d as string | null)\n          onValueChange?.(d as string | null)\n        }}\n        className=\"border\"\n      />\n      <div className=\"min-w-48 text-sm\">\n        <h3 className=\"font-medium\">This month</h3>\n        {list.length ? (\n          <ul aria-label=\"Holidays this month\" className=\"mt-1\">\n            {list.map((h) => (\n              <li key={h.date} className=\"py-0.5\">\n                <span className=\"text-muted-foreground tabular-nums\">\n                  {formatDate(h.date, loc, {\n                    weekday: \"short\",\n                    day: \"numeric\",\n                    month: \"short\",\n                  })}\n                </span>{\" \"}\n                {h.name}\n              </li>\n            ))}\n          </ul>\n        ) : (\n          <p className=\"text-muted-foreground mt-1\">No holidays.</p>\n        )}\n      </div>\n    </div>\n  )\n}\n",
      "type": "registry:block"
    }
  ],
  "type": "registry:block"
}