2026-10-09 18:30:41 +00:00
|
|
|
import type { ReactNode } from "react";
|
|
|
|
|
import { useId } from "react";
|
|
|
|
|
|
|
|
|
|
/** 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"}
|
|
|
|
|
>
|
|
|
|
|
<h3
|
|
|
|
|
className={
|
|
|
|
|
variant === "plain"
|
|
|
|
|
? "text-xs font-medium uppercase tracking-wide text-muted-foreground"
|
|
|
|
|
: "text-sm font-semibold"
|
|
|
|
|
}
|
|
|
|
|
id={id}
|
|
|
|
|
>
|
2026-10-09 18:30:41 +00:00
|
|
|
{title}
|
|
|
|
|
</h3>
|
|
|
|
|
{children}
|
|
|
|
|
</section>
|
|
|
|
|
);
|
|
|
|
|
}
|