{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"shadcn-studio/calendar-24","type":"registry:component","title":"Calendar 24","description":"Appointment booking calendar with time slot selection and availability indicators","dependencies":["lucide-react"],"registryDependencies":["button","calendar","card","scroll-area"],"files":[{"path":"src/registry/new-york/components/calendar/calendar-24.tsx","content":"'use client'\n\nimport { useState } from 'react'\n\nimport { CircleCheckIcon } from 'lucide-react'\n\nimport { Button } from '@/registry/new-york/ui/button'\nimport { Calendar } from '@/registry/new-york/ui/calendar'\nimport { Card, CardContent, CardFooter, CardHeader, CardTitle } from '@/registry/new-york/ui/card'\nimport { ScrollArea } from '@/registry/new-york/ui/scroll-area'\n\nconst CalendarAppointmentBookingDemo = () => {\n  const [date, setDate] = useState<Date | undefined>(new Date(2025, 5, 20))\n  const [selectedTime, setSelectedTime] = useState<string | null>('10:00')\n\n  const timeSlots = Array.from({ length: 37 }, (_, i) => {\n    const totalMinutes = i * 15\n    const hour = Math.floor(totalMinutes / 60) + 9\n    const minute = totalMinutes % 60\n\n    return `${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}`\n  })\n\n  const bookedDates = Array.from({ length: 3 }, (_, i) => new Date(2025, 5, 17 + i))\n\n  return (\n    <div>\n      <Card className='gap-0 p-0'>\n        <CardHeader className='flex h-max justify-center border-b p-4!'>\n          <CardTitle>Book your appointment</CardTitle>\n        </CardHeader>\n        <CardContent className='relative p-0 md:pr-48'>\n          <div className='p-6 max-sm:flex max-sm:justify-center'>\n            <Calendar\n              mode='single'\n              selected={date}\n              onSelect={setDate}\n              defaultMonth={date}\n              disabled={bookedDates}\n              showOutsideDays={false}\n              modifiers={{\n                booked: bookedDates\n              }}\n              modifiersClassNames={{\n                booked: '[&>button]:line-through opacity-100'\n              }}\n              className='bg-transparent p-0 [--cell-size:--spacing(10)]'\n              formatters={{\n                formatWeekdayName: date => {\n                  return date.toLocaleString('en-US', { weekday: 'short' })\n                }\n              }}\n            />\n          </div>\n          <div className='inset-y-0 right-0 flex w-full flex-col gap-4 border-t max-md:h-60 md:absolute md:w-48 md:border-t-0 md:border-l'>\n            <ScrollArea className='h-full'>\n              <div className='flex flex-col gap-2 p-6'>\n                {timeSlots.map(time => (\n                  <Button\n                    key={time}\n                    variant={selectedTime === time ? 'default' : 'outline'}\n                    onClick={() => setSelectedTime(time)}\n                    className='w-full shadow-none'\n                  >\n                    {time}\n                  </Button>\n                ))}\n              </div>\n            </ScrollArea>\n          </div>\n        </CardContent>\n        <CardFooter className='flex flex-col gap-4 border-t px-6 py-5! md:flex-row'>\n          <div className='flex items-center gap-2 text-sm'>\n            {date && selectedTime ? (\n              <>\n                <CircleCheckIcon className='size-5 stroke-green-600 dark:stroke-green-400' />\n                <span>\n                  Your meeting is booked for{' '}\n                  <span className='font-medium'>\n                    {' '}\n                    {date?.toLocaleDateString('en-US', {\n                      weekday: 'long',\n                      day: 'numeric',\n                      month: 'long'\n                    })}{' '}\n                  </span>\n                  at <span className='font-medium'>{selectedTime}</span>.\n                </span>\n              </>\n            ) : (\n              <>Select a date and time for your meeting.</>\n            )}\n          </div>\n          <Button disabled={!date || !selectedTime} className='w-full md:ml-auto md:w-auto' variant='outline'>\n            Continue\n          </Button>\n        </CardFooter>\n      </Card>\n      <p className='text-muted-foreground mt-4 text-center text-xs' role='region'>\n        Appointment calendar\n      </p>\n    </div>\n  )\n}\n\nexport default CalendarAppointmentBookingDemo\n","type":"registry:component","target":"components/shadcn-studio/calendar/calendar-24.tsx"}]}