# Add the "Booking Request" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/booking-request) to this Pantheon Content Publisher (P1) Next.js project. Room or shelter reservation request with space, date and times, headcount, event type, setup needs and food and alcohol questions.

## Steps

1. Create `components/puck/booking-request-block.tsx` with the exact file contents below. If `components/puck/` doesn't exist, find the folder where this project keeps its Puck components (look at the imports in `puck.config.tsx`) and put it there.
2. In `puck.config.tsx`, import it: `import { bookingRequestBlock } from "./components/puck/booking-request-block";`
3. Register it under `components` as `BookingRequestBlock: bookingRequestBlock`.
4. Add `"BookingRequestBlock"` to the best-fitting entry in `categories` (this block's library category is "Forms"). Create a category only if none fits.
5. Run the project's type check (usually `pnpm typecheck`) and resolve anything project-specific.
6. If `package.json` has a `sync:registry` script, tell the user it must run (or that CI will run it) before the new component appears in the P1 editor.

## Rules

- Do not add dependencies. The block is self-contained by design: one type-only import from `@puckeditor/core`, Tailwind v4 classes, no client JavaScript.
- Keep the files as-is unless the user asks for changes. The accent color is `indigo-*`; if the project has brand colors, offer to swap them with a find-and-replace on `indigo-`.
- Images are plain `imageUrl` + `imageAlt` text fields. If this project defines a P1 media-library field (search for `"p1-media"`), offer to switch to it.
- Don't change prop names in `defaultProps`. Content editors' saved pages depend on them.

## File: `components/puck/booking-request-block.tsx`

```tsx
import type { ComponentConfig } from "@puckeditor/core";

/**
 * Booking Request — a facility or room reservation request: space, date and times, headcount,
 * event type, setup needs, food and alcohol questions, and the organizer's details. Posts to any form endpoint.
 * Register: `BookingRequestBlock: bookingRequestBlock` in puck.config.tsx.
 */

type Heading = "h1" | "h2" | "h3" | "h4";

type Space = { name: string; capacity: string };

export type BookingRequestProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  formAction: string;
  spaces: Space[];
  eventTypes: { label: string }[];
  setupOptions: { label: string }[];
  askAlcohol: boolean;
  noticeHeading: string;
  notice: string;
  submitLabel: string;
  footnote: string;
};

const inputClass =
  "block min-h-11 w-full rounded-lg border-0 bg-white px-3.5 py-2.5 text-base text-neutral-950 shadow-xs ring-1 ring-neutral-300 ring-inset placeholder:text-neutral-500 focus:ring-2 focus:ring-indigo-600 focus:outline-none";
const labelClass = "block text-sm leading-6 font-medium text-neutral-900";
const legendClass = "text-sm leading-6 font-semibold text-neutral-950";
const groupTitle = "text-xs font-semibold tracking-widest text-neutral-600 uppercase";
const checkClass = "size-5 rounded border-neutral-400 accent-indigo-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600";
const optional = <span className="font-normal text-neutral-600">(optional)</span>;

const Chevron = () => (
  <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="pointer-events-none absolute top-1/2 right-3 size-5 -translate-y-1/2 text-neutral-500">
    <path fillRule="evenodd" d="M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z" clipRule="evenodd" />
  </svg>
);

const YesNo = ({ uid, name, legend, hint }: { uid: string; name: string; legend: string; hint?: string }) => (
  <fieldset aria-describedby={hint ? `${uid}-${name}-hint` : undefined}>
    <legend className={legendClass}>{legend}</legend>
    {hint ? (
      <p id={`${uid}-${name}-hint`} className="text-sm leading-6 text-neutral-600">
        {hint}
      </p>
    ) : null}
    <div className="mt-2 flex gap-6">
      {["No", "Yes"].map((v) => (
        <div key={v} className="flex items-center gap-3">
          <input id={`${uid}-${name}-${v}`} name={name} type="radio" value={v.toLowerCase()} required defaultChecked={v === "No"} className={checkClass} />
          <label htmlFor={`${uid}-${name}-${v}`} className="flex min-h-11 cursor-pointer items-center text-sm font-medium text-neutral-900">
            {v}
          </label>
        </div>
      ))}
    </div>
  </fieldset>
);

export const bookingRequestBlock: ComponentConfig<BookingRequestProps> = {
  label: "Booking Request",
  fields: {
    heading: { type: "text", label: "Heading" },
    headingLevel: {
      type: "select",
      label: "Heading level",
      options: [
        { label: "H1", value: "h1" },
        { label: "H2", value: "h2" },
        { label: "H3", value: "h3" },
        { label: "H4", value: "h4" },
      ],
      metadata: { help: "Sets the page outline for screen readers and search. The look doesn't change." },
    },
    intro: { type: "textarea", label: "Intro" },
    formAction: {
      type: "text",
      label: "Form action URL",
      metadata: {
        help: "Where the form is sent with POST. Field names: space, date, start_time, end_time, attendance, event_type, setup (one per checked box), food, alcohol, av_needs, organization, contact_name, email, phone, details.",
      },
    },
    spaces: {
      type: "array",
      label: "Spaces",
      min: 1,
      max: 16,
      getItemSummary: (item) => item?.name || "Space",
      defaultItemProps: { name: "New room", capacity: "" },
      arrayFields: {
        name: { type: "text", label: "Name" },
        capacity: { type: "text", label: "Capacity", metadata: { help: "Shown in the menu, such as \"seats 40\". Leave blank to hide it." } },
      },
      metadata: { help: "Rooms, shelters or fields people can request." },
    },
    eventTypes: {
      type: "array",
      label: "Event types",
      min: 0,
      max: 8,
      getItemSummary: (item) => item?.label || "Type",
      defaultItemProps: { label: "New type" },
      arrayFields: { label: { type: "text", label: "Type" } },
      metadata: { help: "Radio choices, used to set rates and staffing. Remove every type to hide the question." },
    },
    setupOptions: {
      type: "array",
      label: "Setup needs",
      min: 0,
      max: 10,
      getItemSummary: (item) => item?.label || "Need",
      defaultItemProps: { label: "New need" },
      arrayFields: { label: { type: "text", label: "Need" } },
      metadata: { help: "Checkboxes for tables, chairs, AV and so on. Remove every option to hide the question." },
    },
    askAlcohol: {
      type: "radio",
      label: "Ask about alcohol",
      options: [
        { label: "Yes", value: true },
        { label: "No", value: false },
      ],
      metadata: { help: "Turn off where alcohol is never allowed." },
    },
    noticeHeading: { type: "text", label: "Notice heading", metadata: { help: "Short callout above the form. Leave the heading and text blank to hide it." } },
    notice: { type: "textarea", label: "Notice text" },
    submitLabel: { type: "text", label: "Button text" },
    footnote: { type: "textarea", label: "Footnote", metadata: { help: "Small print beside the button. Leave blank to hide it." } },
  },
  defaultProps: {
    heading: "Request a room or shelter",
    headingLevel: "h2",
    intro: "Tell us what you're planning and we'll check the calendar. Community groups and nonprofits based in the county qualify for the resident rate.",
    formAction: "/rentals/request",
    spaces: [
      { name: "Oak Room, Lakeside Community Center", capacity: "seats 60" },
      { name: "Maple Classroom, Lakeside Community Center", capacity: "seats 24" },
      { name: "Gymnasium, Eastwood Recreation Center", capacity: "up to 200" },
      { name: "Pavilion 3, Riverfront Park", capacity: "picnic tables for 80" },
    ],
    eventTypes: [{ label: "Meeting or class" }, { label: "Private party" }, { label: "Fundraiser" }, { label: "Wedding or reception" }, { label: "Other" }],
    setupOptions: [{ label: "Round tables" }, { label: "Rectangular tables" }, { label: "Chairs in rows" }, { label: "Projector and screen" }, { label: "Microphone and speaker" }, { label: "Kitchen access" }],
    askAlcohol: true,
    noticeHeading: "This is a request, not a confirmed booking",
    notice: "We reply within three business days. Your date is held only after you sign the rental agreement and pay the deposit.",
    submitLabel: "Send request",
    footnote: "Requests need at least 14 days' notice. For dates sooner than that, call (502) 555-0137.",
  },
  render: ({ id, heading, headingLevel, intro, formAction, spaces, eventTypes, setupOptions, askAlcohol, noticeHeading, notice, submitLabel, footnote }) => {
    const H = headingLevel || "h2";
    const uid = `br-${id || "form"}`;
    const spaceList = (spaces ?? []).filter((s) => s?.name?.trim());
    const types = (eventTypes ?? []).map((t) => t?.label?.trim()).filter(Boolean) as string[];
    const setups = (setupOptions ?? []).map((t) => t?.label?.trim()).filter(Boolean) as string[];

    return (
      <section className="bg-white px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-24">
        <div className="mx-auto max-w-4xl">
          {heading || intro ? (
            <div className="max-w-2xl">
              {heading ? <H className="text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl">{heading}</H> : null}
              {intro ? <p className="mt-4 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
            </div>
          ) : null}

          {noticeHeading || notice ? (
            <div className={`flex gap-4 rounded-xl bg-indigo-50 p-4 ring-1 ring-indigo-200 sm:p-5 ${heading || intro ? "mt-8" : ""}`}>
              <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="mt-0.5 size-5 shrink-0 text-indigo-700">
                <path fillRule="evenodd" d="M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-7-4a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM9 9a.75.75 0 0 0 0 1.5h.253a.25.25 0 0 1 .244.304l-.459 2.066A1.75 1.75 0 0 0 10.747 15H11a.75.75 0 0 0 0-1.5h-.253a.25.25 0 0 1-.244-.304l.459-2.066A1.75 1.75 0 0 0 9.253 9H9Z" clipRule="evenodd" />
              </svg>
              <div className="text-sm leading-6">
                {noticeHeading ? <p className="font-semibold text-indigo-950">{noticeHeading}</p> : null}
                {notice ? <p className="text-pretty text-indigo-900">{notice}</p> : null}
              </div>
            </div>
          ) : null}

          <form action={formAction || undefined} method="post" className={`divide-y divide-neutral-200 ${heading || intro || noticeHeading || notice ? "mt-10" : ""}`}>
            <p className="pb-6 text-sm leading-6 text-neutral-600">All fields are required unless marked optional.</p>

            <fieldset className="py-10">
              <legend className="sr-only">When and where</legend>
              <div className="grid grid-cols-1 gap-6 md:grid-cols-3 md:gap-10">
                <p aria-hidden="true" className={groupTitle}>When and where</p>
              <div className="grid grid-cols-1 gap-6 sm:grid-cols-2 md:col-span-2">
                {spaceList.length ? (
                  <div className="sm:col-span-2">
                    <label htmlFor={`${uid}-space`} className={labelClass}>Space</label>
                    <div className="relative mt-2">
                      <select id={`${uid}-space`} name="space" required defaultValue="" className={`appearance-none pr-10 ${inputClass}`}>
                        <option value="" disabled>
                          Choose a space
                        </option>
                        {spaceList.map((s, i) => (
                          <option key={`${s.name}-${i}`} value={s.name}>
                            {s.capacity ? `${s.name} (${s.capacity})` : s.name}
                          </option>
                        ))}
                      </select>
                      <Chevron />
                    </div>
                  </div>
                ) : null}
                <div className="sm:col-span-2">
                  <label htmlFor={`${uid}-date`} className={labelClass}>Date</label>
                  <input id={`${uid}-date`} name="date" type="date" required aria-describedby={`${uid}-date-hint`} className={`mt-2 ${inputClass}`} />
                  <p id={`${uid}-date-hint`} className="mt-2 text-sm leading-6 text-neutral-600">
                    For a recurring booking, give the first date and describe the pattern in the details box.
                  </p>
                </div>
                <div>
                  <label htmlFor={`${uid}-start`} className={labelClass}>Start time</label>
                  <input id={`${uid}-start`} name="start_time" type="time" required step={900} className={`mt-2 ${inputClass}`} />
                </div>
                <div>
                  <label htmlFor={`${uid}-end`} className={labelClass}>End time</label>
                  <input id={`${uid}-end`} name="end_time" type="time" required step={900} aria-describedby={`${uid}-time-hint`} className={`mt-2 ${inputClass}`} />
                </div>
                <p id={`${uid}-time-hint`} className="-mt-3 text-sm leading-6 text-neutral-600 sm:col-span-2">
                  Include time for setup and cleanup.
                </p>
                <div>
                  <label htmlFor={`${uid}-count`} className={labelClass}>Expected attendance</label>
                  <input id={`${uid}-count`} name="attendance" type="number" required min={1} max={1000} inputMode="numeric" className={`mt-2 ${inputClass}`} />
                </div>
              </div>
              </div>
            </fieldset>

            <fieldset className="py-10">
              <legend className="sr-only">Your event</legend>
              <div className="grid grid-cols-1 gap-6 md:grid-cols-3 md:gap-10">
                <p aria-hidden="true" className={groupTitle}>Your event</p>
                <div className="space-y-8 md:col-span-2">
                  {types.length ? (
                    <fieldset>
                      <legend className={legendClass}>Type of event</legend>
                      <div className="mt-3 flex flex-wrap gap-2">
                        {types.map((t, i) => (
                          <label
                            key={`${t}-${i}`}
                            className="relative flex min-h-11 cursor-pointer items-center rounded-full bg-white px-4 text-sm font-medium text-neutral-800 ring-1 ring-neutral-300 transition select-none ring-inset hover:ring-indigo-400 has-checked:bg-indigo-600 has-checked:text-white has-checked:ring-indigo-600 has-focus-visible:outline-2 has-focus-visible:outline-offset-2 has-focus-visible:outline-indigo-600"
                          >
                            <input type="radio" name="event_type" value={t} required className="sr-only" />
                            {t}
                          </label>
                        ))}
                      </div>
                    </fieldset>
                  ) : null}
                  {setups.length ? (
                    <fieldset>
                      <legend className={legendClass}>
                        Setup and equipment {optional}
                      </legend>
                      <div className="mt-2 grid grid-cols-1 gap-x-6 sm:grid-cols-2">
                        {setups.map((t, i) => (
                          <div key={`${t}-${i}`} className="flex gap-3">
                            <div className="flex h-11 shrink-0 items-center">
                              <input id={`${uid}-setup-${i}`} name="setup" type="checkbox" value={t} className={checkClass} />
                            </div>
                            <label htmlFor={`${uid}-setup-${i}`} className="flex min-h-11 cursor-pointer items-center text-sm text-neutral-900">
                              {t}
                            </label>
                          </div>
                        ))}
                      </div>
                    </fieldset>
                  ) : null}
                  <div className="grid grid-cols-1 gap-8 sm:grid-cols-2">
                    <YesNo uid={uid} name="food" legend="Will food be served?" hint="Outside caterers must be licensed." />
                    {askAlcohol !== false ? <YesNo uid={uid} name="alcohol" legend="Will alcohol be served?" hint="Requires a permit and event insurance." /> : null}
                  </div>
                </div>
              </div>
              </fieldset>

            <fieldset className="py-10">
              <legend className="sr-only">Who&rsquo;s booking</legend>
              <div className="grid grid-cols-1 gap-6 md:grid-cols-3 md:gap-10">
                <p aria-hidden="true" className={groupTitle}>Who&rsquo;s booking</p>
              <div className="grid grid-cols-1 gap-6 sm:grid-cols-2 md:col-span-2">
                <div className="sm:col-span-2">
                  <label htmlFor={`${uid}-org`} className={labelClass}>Organization {optional}</label>
                  <input id={`${uid}-org`} name="organization" type="text" autoComplete="organization" className={`mt-2 ${inputClass}`} />
                </div>
                <div className="sm:col-span-2">
                  <label htmlFor={`${uid}-name`} className={labelClass}>Contact name</label>
                  <input id={`${uid}-name`} name="contact_name" type="text" required autoComplete="name" className={`mt-2 ${inputClass}`} />
                </div>
                <div>
                  <label htmlFor={`${uid}-email`} className={labelClass}>Email</label>
                  <input id={`${uid}-email`} name="email" type="email" required autoComplete="email" inputMode="email" className={`mt-2 ${inputClass}`} />
                </div>
                <div>
                  <label htmlFor={`${uid}-phone`} className={labelClass}>Phone</label>
                  <input id={`${uid}-phone`} name="phone" type="tel" required autoComplete="tel" inputMode="tel" className={`mt-2 ${inputClass}`} />
                </div>
                <div className="sm:col-span-2">
                  <label htmlFor={`${uid}-details`} className={labelClass}>Anything else we should know? {optional}</label>
                  <textarea id={`${uid}-details`} name="details" rows={4} className={`mt-2 ${inputClass}`} />
                </div>
              </div>
              </div>
            </fieldset>

            <div className="flex flex-col gap-4 pt-8 sm:flex-row sm:items-center sm:justify-end sm:gap-6">
              {footnote ? <p className="text-sm leading-6 text-pretty text-neutral-600 sm:text-right">{footnote}</p> : null}
              <button
                type="submit"
                className="inline-flex min-h-12 shrink-0 items-center justify-center rounded-lg bg-indigo-600 px-6 py-3 text-base font-semibold text-white shadow-xs transition hover:bg-indigo-700 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
              >
                {submitLabel || "Send request"}
              </button>
            </div>
          </form>
        </div>
      </section>
    );
  },
};
```
