{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "weekly-hours-demo",
  "title": "Weekly Hours Demo",
  "description": "A worked example of Weekly Hours: Weekly availability, the settings screen of every booking tool. Each day is on or off and holds one or more time ranges, and mistakes are flagged where they are made.",
  "registryDependencies": [
    "https://ui.tinkererslabs.com/r/weekly-hours.json"
  ],
  "files": [
    {
      "path": "components/demos/weekly-hours-demo.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport {\n  getWeeklyHoursIssues,\n  WeeklyHours,\n  type WeeklyHoursValue,\n} from \"@/registry/default/weekly-hours/weekly-hours\"\n\nconst initial: WeeklyHoursValue = {\n  sunday: [],\n  monday: [{ start: \"09:00\", end: \"17:00\" }],\n  tuesday: [\n    { start: \"09:00\", end: \"12:00\" },\n    { start: \"13:00\", end: \"17:00\" },\n  ],\n  wednesday: [{ start: \"09:00\", end: \"17:00\" }],\n  thursday: [{ start: \"09:00\", end: \"17:00\" }],\n  friday: [{ start: \"09:00\", end: \"13:00\" }],\n  saturday: [],\n}\n\nexport function WeeklyHoursDemo() {\n  const [week, setWeek] = React.useState(initial)\n  const [clock, setClock] = React.useState<\"h12\" | \"h23\">(\"h12\")\n  const problems = getWeeklyHoursIssues(week).length\n\n  return (\n    <div className=\"bg-background border-border w-full max-w-[30rem] rounded-[1.25rem] border p-5 shadow-sm\">\n      <div className=\"flex flex-wrap items-start justify-between gap-3\">\n        <div>\n          <h3 className=\"text-base font-semibold\">Office hours</h3>\n          <p className=\"text-muted-foreground mt-1 text-sm\">\n            When students can book a call with you.\n          </p>\n        </div>\n        <label className=\"text-muted-foreground flex items-center gap-2 text-xs\">\n          <input\n            checked={clock === \"h23\"}\n            className=\"accent-primary size-3.5\"\n            onChange={(event) => setClock(event.target.checked ? \"h23\" : \"h12\")}\n            type=\"checkbox\"\n          />\n          24 hour clock\n        </label>\n      </div>\n\n      <WeeklyHours\n        className=\"mt-4\"\n        hourCycle={clock}\n        label=\"Office hours\"\n        locale=\"en-US\"\n        firstDay=\"monday\"\n        onValueChange={setWeek}\n        value={week}\n      />\n\n      <p\n        className={\n          problems\n            ? \"text-destructive mt-3 text-sm\"\n            : \"text-muted-foreground mt-3 text-sm\"\n        }\n      >\n        {problems\n          ? `Fix ${problems === 1 ? \"1 range\" : `${problems} ranges`} before saving.`\n          : \"Ready to save.\"}\n      </p>\n    </div>\n  )\n}\n",
      "type": "registry:example"
    }
  ],
  "type": "registry:example"
}