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

Add a Puck component from P1 Blocks (https://p1-blocks.prolificdigital.io/blocks/records-request) to this Pantheon Content Publisher (P1) Next.js project. Public records request with requester, records description, date range, format and delivery, and a fee acknowledgement.

## Steps

1. Create `components/puck/records-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 { recordsRequestBlock } from "./components/puck/records-request-block";`
3. Register it under `components` as `RecordsRequestBlock: recordsRequestBlock`.
4. Add `"RecordsRequestBlock"` 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/records-request-block.tsx`

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

/**
 * Records Request — a public records (open records / FOIA) request form: requester, a description
 * of the records, date range, format and delivery, and a fee acknowledgement, beside a timeline and fees summary.
 * Register: `RecordsRequestBlock: recordsRequestBlock` in puck.config.tsx.
 */

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

type Fact = { term: string; detail: string };

export type RecordsRequestProps = {
  heading: string;
  headingLevel: Heading;
  intro: string;
  formAction: string;
  departments: { label: string }[];
  feeAcknowledgement: string;
  submitLabel: string;
  summaryHeading: string;
  facts: Fact[];
  summaryNote: string;
  officerName: string;
  officerContact: string;
};

const childHeading: Record<Heading, "h2" | "h3" | "h4" | "h5"> = { h1: "h2", h2: "h3", h3: "h4", h4: "h5" };

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-base leading-7 font-semibold text-neutral-950";
const radioClass = "size-5 shrink-0 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 FORMATS = [
  { value: "electronic", label: "Electronic copies", detail: "PDF or original file format, usually free" },
  { value: "paper", label: "Paper copies", detail: "Per-page copying fees apply" },
  { value: "inspect", label: "Inspect in person", detail: "View the records at our office, no charge" },
];

const DELIVERY = [
  { value: "email", label: "Email" },
  { value: "mail", label: "U.S. mail" },
  { value: "pickup", label: "Pick up at the office" },
];

export const recordsRequestBlock: ComponentConfig<RecordsRequestProps> = {
  label: "Records 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: name, organization, email, phone, address, department, records_description, date_from, date_to, format, delivery, fee_acknowledged.",
      },
    },
    departments: {
      type: "array",
      label: "Departments",
      min: 0,
      max: 20,
      getItemSummary: (item) => item?.label || "Department",
      defaultItemProps: { label: "New department" },
      arrayFields: { label: { type: "text", label: "Department" } },
      metadata: { help: "Optional menu so requests reach the right records custodian. Remove every department to hide it." },
    },
    feeAcknowledgement: {
      type: "textarea",
      label: "Fee acknowledgement",
      metadata: { help: "What requesters agree to about copying fees. Leave blank to hide the checkbox." },
    },
    submitLabel: { type: "text", label: "Button text" },
    summaryHeading: { type: "text", label: "Sidebar heading", metadata: { help: "Leave the heading, facts and note blank to hide the sidebar." } },
    facts: {
      type: "array",
      label: "Timeline and fees",
      min: 0,
      max: 8,
      getItemSummary: (item) => item?.term || "Fact",
      defaultItemProps: { term: "New item", detail: "" },
      arrayFields: {
        term: { type: "text", label: "Label", metadata: { help: "Such as \"Response time\" or \"Paper copies\"." } },
        detail: { type: "textarea", label: "Detail" },
      },
      metadata: { help: "Use the deadlines and fees from your state's open-records law and your own fee schedule." },
    },
    summaryNote: { type: "textarea", label: "Sidebar note", metadata: { help: "Small print, such as a sample-data or legal note. Leave blank to hide it." } },
    officerName: { type: "text", label: "Records officer", metadata: { help: "Name and title of the person who handles requests. Leave blank to hide it." } },
    officerContact: { type: "text", label: "Officer email", metadata: { help: "Linked for email. Leave blank to hide it." } },
  },
  defaultProps: {
    heading: "Request public records",
    headingLevel: "h2",
    intro: "Anyone can ask to see records kept by the city. You don't have to say why you want them. The more specific you are, the faster we can find them.",
    formAction: "/open-records/request",
    departments: [{ label: "Not sure — route it for me" }, { label: "City Clerk" }, { label: "Police Department" }, { label: "Planning and Zoning" }, { label: "Public Works" }, { label: "Finance" }],
    feeAcknowledgement: "I understand there may be a charge for paper copies or for requests that take significant staff time, and that I'll get an estimate before any work over $25 begins.",
    submitLabel: "Submit request",
    summaryHeading: "What to expect",
    facts: [
      { term: "Response time", detail: "We respond within 5 business days, either with the records or a date when they'll be ready." },
      { term: "Electronic copies", detail: "Free for most requests." },
      { term: "Paper copies", detail: "$0.10 per page, plus postage if mailed." },
      { term: "Withheld records", detail: "If we deny any part of a request, we'll tell you which exemption applies and how to appeal." },
    ],
    summaryNote: "Sample timelines and fees. Replace them with the rules in your state's open-records law and your adopted fee schedule.",
    officerName: "Maria Okafor, Official Records Custodian",
    officerContact: "records@cityofriverton.gov",
  },
  render: ({ id, heading, headingLevel, intro, formAction, departments, feeAcknowledgement, submitLabel, summaryHeading, facts, summaryNote, officerName, officerContact }) => {
    const H = headingLevel || "h2";
    const Sub = childHeading[H] || "h3";
    const uid = `rr-${id || "form"}`;
    const depts = (departments ?? []).map((d) => d?.label?.trim()).filter(Boolean) as string[];
    const factList = (facts ?? []).filter((f) => f?.term?.trim());
    const hasAside = Boolean(summaryHeading || factList.length || summaryNote || officerName || officerContact);

    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-6xl">
          {heading || intro ? (
            <div className="max-w-3xl border-b border-neutral-200 pb-10">
              {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}

          <div className={`grid grid-cols-1 gap-12 lg:gap-16 ${hasAside ? "lg:grid-cols-12" : ""} ${heading || intro ? "mt-10" : ""}`}>
            <form action={formAction || undefined} method="post" className={`space-y-10 ${hasAside ? "lg:col-span-7" : "max-w-3xl"}`}>
              <p className="text-sm leading-6 text-neutral-600">All fields are required unless marked optional.</p>

              <fieldset>
                <legend className={legendClass}>Requester</legend>
                <div className="mt-4 grid grid-cols-1 gap-6 sm:grid-cols-2">
                  <div>
                    <label htmlFor={`${uid}-name`} className={labelClass}>Full name</label>
                    <input id={`${uid}-name`} name="name" type="text" required autoComplete="name" className={`mt-2 ${inputClass}`} />
                  </div>
                  <div>
                    <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>
                    <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 {optional}</label>
                    <input id={`${uid}-phone`} name="phone" type="tel" autoComplete="tel" inputMode="tel" className={`mt-2 ${inputClass}`} />
                  </div>
                  <div className="sm:col-span-2">
                    <label htmlFor={`${uid}-address`} className={labelClass}>Mailing address {optional}</label>
                    <textarea
                      id={`${uid}-address`}
                      name="address"
                      rows={2}
                      autoComplete="street-address"
                      aria-describedby={`${uid}-address-hint`}
                      className={`mt-2 ${inputClass}`}
                    />
                    <p id={`${uid}-address-hint`} className="mt-2 text-sm leading-6 text-neutral-600">
                      Only needed if you want copies mailed to you.
                    </p>
                  </div>
                </div>
              </fieldset>

              <fieldset>
                <legend className={legendClass}>Records you&rsquo;re requesting</legend>
                <div className="mt-4 grid grid-cols-1 gap-6 sm:grid-cols-2">
                  {depts.length ? (
                    <div className="sm:col-span-2">
                      <label htmlFor={`${uid}-dept`} className={labelClass}>Department {optional}</label>
                      <div className="relative mt-2">
                        <select id={`${uid}-dept`} name="department" defaultValue={depts[0]} className={`appearance-none pr-10 ${inputClass}`}>
                          {depts.map((d, i) => (
                            <option key={`${d}-${i}`} value={d}>
                              {d}
                            </option>
                          ))}
                        </select>
                        <Chevron />
                      </div>
                    </div>
                  ) : null}
                  <div className="sm:col-span-2">
                    <label htmlFor={`${uid}-desc`} className={labelClass}>Describe the records</label>
                    <textarea
                      id={`${uid}-desc`}
                      name="records_description"
                      rows={5}
                      required
                      minLength={15}
                      aria-describedby={`${uid}-desc-hint`}
                      className={`mt-2 ${inputClass}`}
                    />
                    <p id={`${uid}-desc-hint`} className="mt-2 text-sm leading-6 text-neutral-600">
                      Name the document type, people, addresses, case or permit numbers — for example, &ldquo;building permits issued for 412 Elm Street.&rdquo;
                    </p>
                  </div>
                  <div>
                    <label htmlFor={`${uid}-from`} className={labelClass}>From date {optional}</label>
                    <input id={`${uid}-from`} name="date_from" type="date" aria-describedby={`${uid}-range-hint`} className={`mt-2 ${inputClass}`} />
                  </div>
                  <div>
                    <label htmlFor={`${uid}-to`} className={labelClass}>To date {optional}</label>
                    <input id={`${uid}-to`} name="date_to" type="date" aria-describedby={`${uid}-range-hint`} className={`mt-2 ${inputClass}`} />
                  </div>
                  <p id={`${uid}-range-hint`} className="-mt-3 text-sm leading-6 text-neutral-600 sm:col-span-2">
                    A narrow date range is the quickest way to a fast response.
                  </p>
                </div>
              </fieldset>

              <fieldset>
                <legend className={legendClass}>Format</legend>
                <div className="mt-4 space-y-3">
                  {FORMATS.map((f, i) => (
                    <label
                      key={f.value}
                      className="flex min-h-11 cursor-pointer gap-3 rounded-xl p-4 ring-1 ring-neutral-300 transition ring-inset hover:ring-indigo-400 has-checked:bg-indigo-50 has-checked:ring-2 has-checked:ring-indigo-600"
                    >
                      <input type="radio" name="format" value={f.value} defaultChecked={i === 0} required className={`mt-0.5 ${radioClass}`} />
                      <span className="text-sm leading-6">
                        <span className="block font-semibold text-neutral-950">{f.label}</span>
                        <span className="block text-neutral-600">{f.detail}</span>
                      </span>
                    </label>
                  ))}
                </div>
              </fieldset>

              <fieldset>
                <legend className={legendClass}>Delivery</legend>
                <div className="mt-2 flex flex-col sm:flex-row sm:flex-wrap sm:gap-x-8">
                  {DELIVERY.map((d, i) => (
                    <div key={d.value} className="flex items-center gap-3">
                      <input id={`${uid}-delivery-${d.value}`} type="radio" name="delivery" value={d.value} defaultChecked={i === 0} required className={radioClass} />
                      <label htmlFor={`${uid}-delivery-${d.value}`} className="flex min-h-11 cursor-pointer items-center text-sm font-medium text-neutral-900">
                        {d.label}
                      </label>
                    </div>
                  ))}
                </div>
              </fieldset>

              {feeAcknowledgement ? (
                <div className="flex gap-3 rounded-xl bg-neutral-50 p-4 ring-1 ring-neutral-200 sm:p-5">
                  <div className="flex h-11 shrink-0 items-center">
                    <input
                      id={`${uid}-fees`}
                      name="fee_acknowledged"
                      type="checkbox"
                      value="yes"
                      required
                      aria-describedby={`${uid}-fees-hint`}
                      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}-fees`} className="flex min-h-11 cursor-pointer items-center font-medium text-neutral-900">
                      I understand fees may apply
                    </label>
                    <p id={`${uid}-fees-hint`} className="text-pretty text-neutral-600">
                      {feeAcknowledgement}
                    </p>
                  </div>
                </div>
              ) : null}

              <button
                type="submit"
                className="inline-flex min-h-12 w-full 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 sm:w-auto"
              >
                {submitLabel || "Submit request"}
              </button>
            </form>

            {hasAside ? (
              <aside aria-labelledby={summaryHeading ? `${uid}-aside` : undefined} aria-label={summaryHeading ? undefined : "What to expect"} className="lg:col-span-5">
                <div className="border-t-4 border-indigo-600 bg-neutral-50 p-6 sm:p-8 lg:sticky lg:top-8">
                  {summaryHeading ? (
                    <Sub id={`${uid}-aside`} className="text-lg leading-7 font-semibold text-neutral-950">
                      {summaryHeading}
                    </Sub>
                  ) : null}
                  {factList.length ? (
                    <dl className={`divide-y divide-neutral-200 ${summaryHeading ? "mt-4" : ""}`}>
                      {factList.map((f, i) => (
                        <div key={`${f.term}-${i}`} className="py-4">
                          <dt className="text-xs font-semibold tracking-widest text-neutral-600 uppercase">{f.term}</dt>
                          {f.detail ? <dd className="mt-1 text-sm leading-6 text-pretty text-neutral-800">{f.detail}</dd> : null}
                        </div>
                      ))}
                    </dl>
                  ) : null}
                  {officerName || officerContact ? (
                    <div className="mt-2 border-t border-neutral-200 pt-6 text-sm leading-6">
                      {officerName ? <p className="font-semibold text-neutral-950">{officerName}</p> : null}
                      {officerContact ? (
                        <a
                          href={`mailto:${officerContact}`}
                          className="inline-flex min-h-11 items-center font-medium break-all 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"
                        >
                          {officerContact}
                        </a>
                      ) : null}
                    </div>
                  ) : null}
                  {summaryNote ? <p className="mt-6 text-xs leading-5 text-pretty text-neutral-600">{summaryNote}</p> : null}
                </div>
              </aside>
            ) : null}
          </div>
        </div>
      </section>
    );
  },
};
```
