2026-10-16 18:09:02 +00:00
|
|
|
import {
|
|
|
|
|
AccordionContent,
|
|
|
|
|
AccordionItem,
|
|
|
|
|
AccordionTrigger,
|
|
|
|
|
} from "@repo/shadcn-ui/components/accordion";
|
2026-10-09 19:18:40 +00:00
|
|
|
import type { ReactNode } from "react";
|
|
|
|
|
|
2026-10-11 11:49:28 +00:00
|
|
|
import { ChevronRightIcon } from "../lib/icons";
|
|
|
|
|
|
2026-10-15 14:14:26 +00:00
|
|
|
import { FormSectionTitle } from "./form-section-title";
|
|
|
|
|
|
2026-10-11 11:49:28 +00:00
|
|
|
/** Grupo de consulta compartido por fichas y plantillas; abierto inicialmente. */
|
2026-10-16 18:09:02 +00:00
|
|
|
export function DetailSection({
|
|
|
|
|
title,
|
|
|
|
|
children,
|
|
|
|
|
accordionValue,
|
|
|
|
|
}: {
|
|
|
|
|
title: string;
|
|
|
|
|
children: ReactNode;
|
|
|
|
|
accordionValue?: string | undefined;
|
|
|
|
|
}) {
|
|
|
|
|
const content = (
|
|
|
|
|
<div className="space-y-3 border-t border-border/60 border-b-0 px-5 pb-2 [&>dl>div:first-child]:pt-2.5 [&>dl>div:last-child]:pb-2.5">
|
|
|
|
|
{children}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (accordionValue !== undefined) {
|
|
|
|
|
return (
|
|
|
|
|
<AccordionItem className="@container" value={accordionValue}>
|
|
|
|
|
<AccordionTrigger className="items-center py-2 hover:no-underline">
|
|
|
|
|
<FormSectionTitle as="span">{title}</FormSectionTitle>
|
|
|
|
|
</AccordionTrigger>
|
|
|
|
|
<AccordionContent className="pb-0">{content}</AccordionContent>
|
|
|
|
|
</AccordionItem>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-09 19:18:40 +00:00
|
|
|
return (
|
2026-10-11 11:49:28 +00:00
|
|
|
<details className="@container group/detail-section" open>
|
2026-10-15 14:14:26 +00:00
|
|
|
<summary className="flex cursor-pointer list-none items-center gap-2 py-2 focus-visible:outline-2 focus-visible:outline-ring [&::-webkit-details-marker]:hidden">
|
2026-10-11 11:49:28 +00:00
|
|
|
<ChevronRightIcon
|
|
|
|
|
aria-hidden="true"
|
2026-10-15 14:14:26 +00:00
|
|
|
className="size-3 shrink-0 text-muted-foreground transition-transform group-open/detail-section:rotate-90 motion-reduce:transition-none"
|
2026-10-11 11:49:28 +00:00
|
|
|
/>
|
2026-10-15 14:14:26 +00:00
|
|
|
<FormSectionTitle as="span">{title}</FormSectionTitle>
|
2026-10-09 19:18:40 +00:00
|
|
|
</summary>
|
2026-10-16 18:09:02 +00:00
|
|
|
{content}
|
2026-10-09 19:18:40 +00:00
|
|
|
</details>
|
|
|
|
|
);
|
|
|
|
|
}
|