{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "booking-form", "type": "registry:block", "title": "Booking Form", "description": "A booking form with location, check-in, and check-out fields.", "dependencies": [ "date-fns" ], "files": [ { "path": "registry/alpine/forms/booking-form.tsx", "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Button } from \"@/registry/alpine/ui/button\"\nimport { Input } from \"@/registry/alpine/ui/input\"\nimport { Label } from \"@/registry/alpine/ui/label\"\nimport { cn } from \"@/lib/utils\"\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@/registry/alpine/ui/popover\"\nimport { Calendar } from \"@/registry/alpine/ui/calendar\"\nimport { CalendarIcon } from \"lucide-react\"\nimport { format } from \"date-fns\"\nimport { DateRange } from \"react-day-picker\"\n\nexport function ListingBookingForm({\n heading,\n subheading,\n className,\n ...props\n}: {\n heading: string\n subheading: string\n className?: string\n} & React.ComponentProps<\"form\">) {\n const [open, setOpen] = React.useState(false)\n const [date, setDate] = React.useState()\n\n const dateDisplay = React.useMemo(() => {\n if (!date?.from) {\n return \"Select date\"\n }\n\n if (date.from === date.to) {\n return format(date.from, \"MMM d, yyyy\")\n }\n\n if (!date.to) {\n return format(date.from, \"MMM d, yyyy\")\n }\n\n return `${format(date.from, \"MMM d, yyyy\")} - ${format(date.to, \"MMM d, yyyy\")}`\n }, [date])\n\n return (\n \n
\n

{heading}

\n

{subheading}

\n
\n
\n \n \n
\n
\n \n \n \n \n \n {dateDisplay}\n \n \n \n \n \n \n
\n
\n \n \n
\n
\n \n
\n \n )\n}\n", "type": "registry:component" } ] }