2026-10-09 18:30:41 +00:00
|
|
|
import type { ReactNode } from "react";
|
|
|
|
|
import { useId } from "react";
|
|
|
|
|
|
2026-10-15 13:58:01 +00:00
|
|
|
import { FormSectionTitle } from "./form-section-title";
|
|
|
|
|
|
2026-10-09 18:30:41 +00:00
|
|
|
/** Bloque visual reutilizable con título accesible; no altera validación ni datos. */
|
2026-10-10 20:00:45 +00:00
|
|
|
export function FormSection({
|
|
|
|
|
title,
|
|
|
|
|
children,
|
|
|
|
|
variant = "card",
|
|
|
|
|
}: {
|
|
|
|
|
title: string;
|
|
|
|
|
children: ReactNode;
|
|
|
|
|
variant?: "card" | "plain";
|
|
|
|
|
}) {
|
2026-10-09 18:30:41 +00:00
|
|
|
const id = useId();
|
2026-10-10 10:01:58 +00:00
|
|
|
|
2026-10-09 18:30:41 +00:00
|
|
|
return (
|
2026-10-10 20:00:45 +00:00
|
|
|
<section
|
|
|
|
|
aria-labelledby={id}
|
|
|
|
|
className={variant === "plain" ? "@container space-y-3" : "space-y-4 rounded-lg border p-4"}
|
|
|
|
|
>
|
2026-10-15 13:58:01 +00:00
|
|
|
<FormSectionTitle id={id}>{title}</FormSectionTitle>
|
2026-10-09 18:30:41 +00:00
|
|
|
{children}
|
|
|
|
|
</section>
|
|
|
|
|
);
|
|
|
|
|
}
|