# Add the "Registration Form" block to this P1 project

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/registration-form) to this Pantheon Content Publisher (P1) Next.js project. Multi-section program sign-up with numbered participant, address, emergency contact and preference sections plus a waiver.

## Steps

1. Create `components/puck/registration-form-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 { registrationFormBlock } from "./components/puck/registration-form-block";`
3. Register it under `components` as `RegistrationFormBlock: registrationFormBlock`.
4. Add `"RegistrationFormBlock"` 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/registration-form-block.tsx`

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

/**
 * Registration Form — a multi-section sign-up for a class or recreation program: participant,
 * address, emergency contact, preferences and a waiver, in numbered sections. Posts to any form endpoint.
 * Register: `RegistrationFormBlock: registrationFormBlock` in puck.config.tsx.
 */

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

type Session = { label: string; detail: string };

export type RegistrationFormProps = {
  eyebrow: string;
  heading: string;
  headingLevel: Heading;
  intro: string;
  formAction: string;
  sessions: Session[];
  showShirtSize: boolean;
  referralOptions: { label: string }[];
  waiverText: string;
  waiverHref: 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 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 SHIRT_SIZES = ["XS", "S", "M", "L", "XL", "2XL", "3XL"];

export const registrationFormBlock: ComponentConfig<RegistrationFormProps> = {
  label: "Registration Form",
  fields: {
    eyebrow: { type: "text", label: "Eyebrow", metadata: { help: "Small line above the heading, such as the program name. Leave blank to hide it." } },
    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: first_name, last_name, birth_date, email, phone, address_line1, address_line2, city, state, postal_code, emergency_name, emergency_relationship, emergency_phone, session, shirt_size, referral, notes, waiver.",
      },
    },
    sessions: {
      type: "array",
      label: "Sessions",
      min: 1,
      max: 12,
      getItemSummary: (item) => item?.label || "Session",
      defaultItemProps: { label: "New session", detail: "" },
      arrayFields: {
        label: { type: "text", label: "Session", metadata: { help: "Sent as the session value, so keep it unique." } },
        detail: { type: "text", label: "Detail", metadata: { help: "Days, times or place, shown after the name in the menu." } },
      },
      metadata: { help: "Choices in the session menu." },
    },
    showShirtSize: {
      type: "radio",
      label: "Ask for T-shirt size",
      options: [
        { label: "Yes", value: true },
        { label: "No", value: false },
      ],
    },
    referralOptions: {
      type: "array",
      label: "How did you hear",
      min: 0,
      max: 10,
      getItemSummary: (item) => item?.label || "Option",
      defaultItemProps: { label: "New option" },
      arrayFields: { label: { type: "text", label: "Option" } },
      metadata: { help: "Optional question for your outreach reports. Remove every option to hide it." },
    },
    waiverText: { type: "textarea", label: "Waiver statement", metadata: { help: "What the registrant agrees to by checking the box. Leave blank to hide the waiver." } },
    waiverHref: { type: "text", label: "Full waiver link", metadata: { help: "Link to the complete waiver or policy. Leave blank to hide the link." } },
    submitLabel: { type: "text", label: "Button text" },
    footnote: { type: "textarea", label: "Footnote", metadata: { help: "Small print under the button, such as payment or refund notes. Leave blank to hide it." } },
  },
  defaultProps: {
    eyebrow: "Fall 2026 · Adult programs",
    heading: "Register for Wheel-Thrown Pottery",
    headingLevel: "h2",
    intro: "Eight Tuesday evenings at the Shawnee Arts Center, clay and firing included. Registration takes about five minutes. You'll pay on the next screen.",
    formAction: "/programs/register",
    sessions: [
      { label: "Session A — Beginners", detail: "Tue 6–8 p.m., Sep 15 – Nov 3" },
      { label: "Session B — Returning potters", detail: "Thu 6–8 p.m., Sep 17 – Nov 5" },
      { label: "Session C — Weekend intensive", detail: "Sat 10 a.m.–2 p.m., Oct 3 – Oct 24" },
    ],
    showShirtSize: false,
    referralOptions: [{ label: "Program guide in the mail" }, { label: "Our website" }, { label: "Social media" }, { label: "A friend or neighbor" }, { label: "Somewhere else" }],
    waiverText: "I understand that pottery involves sharp tools and hot kilns, and I release the Parks and Recreation Department from liability for injuries that aren't caused by its negligence.",
    waiverHref: "/programs/waiver",
    submitLabel: "Continue to payment",
    footnote: "Full refunds until seven days before the first class. Fee assistance is available — ask at any community center.",
  },
  render: ({ id, eyebrow, heading, headingLevel, intro, formAction, sessions, showShirtSize, referralOptions, waiverText, waiverHref, submitLabel, footnote }) => {
    const H = headingLevel || "h2";
    const uid = `rf-${id || "form"}`;
    const sessionList = (sessions ?? []).filter((s) => s?.label?.trim());
    const referrals = (referralOptions ?? []).map((r) => r?.label?.trim()).filter(Boolean) as string[];
    const hasPrefs = sessionList.length > 0 || Boolean(showShirtSize) || referrals.length > 0;

    const sections = [
      { key: "participant", title: "Participant" },
      { key: "address", title: "Address" },
      { key: "emergency", title: "Emergency contact" },
      ...(hasPrefs ? [{ key: "prefs", title: "Preferences" }] : []),
    ];
    const num = (key: string) => sections.findIndex((s) => s.key === key) + 1;

    const SectionHead = ({ k, title, note }: { k: string; title: string; note?: string }) => (
      <legend className="float-left flex w-full items-baseline gap-4 border-b border-neutral-200 pb-4">
        <span aria-hidden="true" className="text-sm font-semibold text-indigo-700 tabular-nums">
          {String(num(k)).padStart(2, "0")}
        </span>
        <span className="text-lg leading-7 font-semibold text-neutral-950">{title}</span>
        {note ? <span className="ml-auto hidden text-sm text-neutral-600 sm:inline">{note}</span> : null}
      </legend>
    );

    return (
      <section className="bg-neutral-50 px-4 py-16 sm:px-6 sm:py-20 lg:px-8 lg:py-24">
        <div className="mx-auto grid max-w-6xl grid-cols-1 gap-10 lg:grid-cols-12 lg:gap-16">
          <div className="lg:col-span-4">
            <div className="lg:sticky lg:top-8">
              {eyebrow ? <p className="text-sm font-semibold tracking-wide text-indigo-700 uppercase">{eyebrow}</p> : null}
              {heading ? <H className={`text-3xl font-semibold tracking-tight text-balance text-neutral-950 sm:text-4xl ${eyebrow ? "mt-3" : ""}`}>{heading}</H> : null}
              {intro ? <p className="mt-4 text-lg leading-8 text-pretty text-neutral-600">{intro}</p> : null}
              <nav aria-label="Form sections" className="mt-10 hidden lg:block">
                <ol role="list" className="space-y-1 border-l border-neutral-300">
                  {sections.map((s, i) => (
                    <li key={s.key}>
                      <a
                        href={`#${uid}-${s.key}`}
                        className="-ml-px flex min-h-11 items-center gap-3 border-l-2 border-transparent pl-4 text-sm font-medium text-neutral-700 hover:border-indigo-600 hover:text-neutral-950 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
                      >
                        <span className="text-neutral-600 tabular-nums">{String(i + 1).padStart(2, "0")}</span>
                        {s.title}
                      </a>
                    </li>
                  ))}
                </ol>
              </nav>
            </div>
          </div>

          <form action={formAction || undefined} method="post" className="rounded-2xl bg-white p-6 shadow-sm ring-1 ring-neutral-200 sm:p-10 lg:col-span-8">
            <p className="text-sm leading-6 text-neutral-600">All fields are required unless marked optional.</p>

            <fieldset id={`${uid}-participant`} className="mt-8 scroll-mt-8">
              <SectionHead k="participant" title="Participant" note="The person taking the class" />
              <div className="clear-both grid grid-cols-1 gap-6 pt-6 sm:grid-cols-2">
                <div>
                  <label htmlFor={`${uid}-first`} className={labelClass}>First name</label>
                  <input id={`${uid}-first`} name="first_name" type="text" required autoComplete="given-name" className={`mt-2 ${inputClass}`} />
                </div>
                <div>
                  <label htmlFor={`${uid}-last`} className={labelClass}>Last name</label>
                  <input id={`${uid}-last`} name="last_name" type="text" required autoComplete="family-name" className={`mt-2 ${inputClass}`} />
                </div>
                <div>
                  <label htmlFor={`${uid}-bday`} className={labelClass}>Date of birth</label>
                  <input
                    id={`${uid}-bday`}
                    name="birth_date"
                    type="date"
                    required
                    autoComplete="bday"
                    aria-describedby={`${uid}-bday-hint`}
                    className={`mt-2 ${inputClass}`}
                  />
                  <p id={`${uid}-bday-hint`} className="mt-2 text-sm leading-6 text-neutral-600">
                    Used to confirm age requirements and senior rates.
                  </p>
                </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}-email`} className={labelClass}>Email</label>
                  <input
                    id={`${uid}-email`}
                    name="email"
                    type="email"
                    required
                    autoComplete="email"
                    inputMode="email"
                    aria-describedby={`${uid}-email-hint`}
                    className={`mt-2 ${inputClass}`}
                  />
                  <p id={`${uid}-email-hint`} className="mt-2 text-sm leading-6 text-neutral-600">
                    We&rsquo;ll send your receipt and any class cancellations here.
                  </p>
                </div>
              </div>
            </fieldset>

            <fieldset id={`${uid}-address`} className="mt-12 scroll-mt-8">
              <SectionHead k="address" title="Address" note="Sets resident or non-resident rates" />
              <div className="clear-both grid grid-cols-1 gap-6 pt-6 sm:grid-cols-6">
                <div className="sm:col-span-6">
                  <label htmlFor={`${uid}-addr1`} className={labelClass}>Street address</label>
                  <input id={`${uid}-addr1`} name="address_line1" type="text" required autoComplete="address-line1" className={`mt-2 ${inputClass}`} />
                </div>
                <div className="sm:col-span-6">
                  <label htmlFor={`${uid}-addr2`} className={labelClass}>Apartment, unit or suite {optional}</label>
                  <input id={`${uid}-addr2`} name="address_line2" type="text" autoComplete="address-line2" className={`mt-2 ${inputClass}`} />
                </div>
                <div className="sm:col-span-3">
                  <label htmlFor={`${uid}-city`} className={labelClass}>City</label>
                  <input id={`${uid}-city`} name="city" type="text" required autoComplete="address-level2" className={`mt-2 ${inputClass}`} />
                </div>
                <div className="sm:col-span-1">
                  <label htmlFor={`${uid}-state`} className={labelClass}>State</label>
                  <input id={`${uid}-state`} name="state" type="text" required autoComplete="address-level1" className={`mt-2 ${inputClass}`} />
                </div>
                <div className="sm:col-span-2">
                  <label htmlFor={`${uid}-zip`} className={labelClass}>ZIP code</label>
                  <input id={`${uid}-zip`} name="postal_code" type="text" required autoComplete="postal-code" inputMode="numeric" className={`mt-2 ${inputClass}`} />
                </div>
              </div>
            </fieldset>

            <fieldset id={`${uid}-emergency`} className="mt-12 scroll-mt-8">
              <SectionHead k="emergency" title="Emergency contact" note="Someone not attending with you" />
              <div className="clear-both grid grid-cols-1 gap-6 pt-6 sm:grid-cols-2">
                <div className="sm:col-span-2">
                  <label htmlFor={`${uid}-ec-name`} className={labelClass}>Full name</label>
                  <input id={`${uid}-ec-name`} name="emergency_name" type="text" required autoComplete="off" className={`mt-2 ${inputClass}`} />
                </div>
                <div>
                  <label htmlFor={`${uid}-ec-rel`} className={labelClass}>Relationship</label>
                  <input id={`${uid}-ec-rel`} name="emergency_relationship" type="text" required autoComplete="off" placeholder="Spouse, sibling, friend…" className={`mt-2 ${inputClass}`} />
                </div>
                <div>
                  <label htmlFor={`${uid}-ec-phone`} className={labelClass}>Phone</label>
                  <input id={`${uid}-ec-phone`} name="emergency_phone" type="tel" required autoComplete="off" inputMode="tel" className={`mt-2 ${inputClass}`} />
                </div>
              </div>
            </fieldset>

            {hasPrefs ? (
              <fieldset id={`${uid}-prefs`} className="mt-12 scroll-mt-8">
                <SectionHead k="prefs" title="Preferences" />
                <div className="clear-both grid grid-cols-1 gap-6 pt-6 sm:grid-cols-2">
                  {sessionList.length ? (
                    <div className="sm:col-span-2">
                      <label htmlFor={`${uid}-session`} className={labelClass}>Session</label>
                      <div className="relative mt-2">
                        <select id={`${uid}-session`} name="session" required defaultValue="" className={`appearance-none pr-10 ${inputClass}`}>
                          <option value="" disabled>
                            Choose a session
                          </option>
                          {sessionList.map((s, i) => (
                            <option key={`${s.label}-${i}`} value={s.label}>
                              {s.detail ? `${s.label} (${s.detail})` : s.label}
                            </option>
                          ))}
                        </select>
                        <Chevron />
                      </div>
                    </div>
                  ) : null}
                  {showShirtSize ? (
                    <div>
                      <label htmlFor={`${uid}-shirt`} className={labelClass}>T-shirt size</label>
                      <div className="relative mt-2">
                        <select id={`${uid}-shirt`} name="shirt_size" required defaultValue="" className={`appearance-none pr-10 ${inputClass}`}>
                          <option value="" disabled>
                            Choose a size
                          </option>
                          {SHIRT_SIZES.map((s) => (
                            <option key={s} value={s}>
                              Adult {s}
                            </option>
                          ))}
                        </select>
                        <Chevron />
                      </div>
                    </div>
                  ) : null}
                  {referrals.length ? (
                    <div>
                      <label htmlFor={`${uid}-referral`} className={labelClass}>How did you hear about us? {optional}</label>
                      <div className="relative mt-2">
                        <select id={`${uid}-referral`} name="referral" defaultValue="" className={`appearance-none pr-10 ${inputClass}`}>
                          <option value="">Prefer not to say</option>
                          {referrals.map((r, i) => (
                            <option key={`${r}-${i}`} value={r}>
                              {r}
                            </option>
                          ))}
                        </select>
                        <Chevron />
                      </div>
                    </div>
                  ) : null}
                  <div className="sm:col-span-2">
                    <label htmlFor={`${uid}-notes`} className={labelClass}>Accessibility needs or anything we should know {optional}</label>
                    <textarea id={`${uid}-notes`} name="notes" rows={3} className={`mt-2 ${inputClass}`} />
                  </div>
                </div>
              </fieldset>
            ) : null}

            {waiverText ? (
              <div className="mt-10 rounded-xl bg-neutral-50 p-4 ring-1 ring-neutral-200 sm:p-5">
                <div className="flex gap-3">
                  <div className="flex h-11 shrink-0 items-center">
                    <input
                      id={`${uid}-waiver`}
                      name="waiver"
                      type="checkbox"
                      value="agreed"
                      required
                      className="size-5 rounded border-neutral-400 accent-indigo-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
                    />
                  </div>
                  <div className="text-sm leading-6">
                    <label htmlFor={`${uid}-waiver`} className="flex min-h-11 cursor-pointer items-center font-medium text-neutral-900">
                      I agree to the participant waiver
                    </label>
                    <p className="text-pretty text-neutral-600">{waiverText}</p>
                    {waiverHref ? (
                      <a
                        href={waiverHref}
                        className="mt-1 inline-flex min-h-11 items-center font-semibold text-indigo-700 underline underline-offset-4 hover:text-indigo-900 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
                      >
                        Read the full waiver
                      </a>
                    ) : null}
                  </div>
                </div>
              </div>
            ) : null}

            <div className="mt-10 flex flex-col gap-4 border-t border-neutral-200 pt-8 sm:flex-row sm:items-center sm:gap-6">
              <button
                type="submit"
                className="inline-flex min-h-12 shrink-0 items-center justify-center gap-2 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 || "Register"}
                <svg aria-hidden="true" viewBox="0 0 20 20" fill="currentColor" className="size-5">
                  <path fillRule="evenodd" d="M3 10a.75.75 0 0 1 .75-.75h10.64l-3.22-3.22a.75.75 0 1 1 1.06-1.06l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 1 1-1.06-1.06l3.22-3.22H3.75A.75.75 0 0 1 3 10Z" clipRule="evenodd" />
                </svg>
              </button>
              {footnote ? <p className="text-sm leading-6 text-pretty text-neutral-600">{footnote}</p> : null}
            </div>
          </form>
        </div>
      </section>
    );
  },
};
```
