@@ -1,6 +1,6 @@
|
||||
import { Link } from '@inertiajs/react';
|
||||
import { ArrowUpRight, ClipboardList } from 'lucide-react';
|
||||
import type { ReactNode } from 'react';
|
||||
import { useId, type ReactNode } from 'react';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { openJourneyHelp } from '@/components/journey-help';
|
||||
import { recoveryHints } from '@/lib/journey-help';
|
||||
@@ -8,7 +8,74 @@ import { date, money, statusLabels } from '@/types/procurement';
|
||||
import type { Requisition } from '@/types/procurement';
|
||||
|
||||
export const controlClass =
|
||||
'h-10 w-full rounded-lg border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
||||
'h-10 w-full min-w-0 rounded-lg border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20';
|
||||
|
||||
/** Shared layout only: callers retain their actions, permissions and submit behaviour. */
|
||||
export function ActionBar({
|
||||
children,
|
||||
align = 'start',
|
||||
label = 'Acções disponíveis',
|
||||
className = '',
|
||||
}: {
|
||||
children: ReactNode;
|
||||
align?: 'start' | 'end';
|
||||
label?: string;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
role="group"
|
||||
aria-label={label}
|
||||
className={`sgc-action-bar flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center ${align === 'end' ? 'sm:justify-end' : ''} print:hidden ${className}`}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Preserve table semantics and make wide results reachable with a keyboard. */
|
||||
export function TableViewport({
|
||||
children,
|
||||
label = 'Tabela de resultados',
|
||||
}: {
|
||||
children: ReactNode;
|
||||
label?: string;
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
role="region"
|
||||
aria-label={label}
|
||||
tabIndex={0}
|
||||
className="sgc-table-viewport max-w-full min-w-0 overflow-x-auto rounded-lg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Print all already authorised details without changing their on-screen expansion state. */
|
||||
export function PrintableDetails({
|
||||
summary,
|
||||
children,
|
||||
}: {
|
||||
summary: ReactNode;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<details className="print:hidden">
|
||||
<summary className="cursor-pointer underline">
|
||||
{summary}
|
||||
</summary>
|
||||
{children}
|
||||
</details>
|
||||
<div className="hidden print:block">
|
||||
<p className="font-medium">{summary}</p>
|
||||
{children}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
export function PageTitle({
|
||||
eyebrow,
|
||||
title,
|
||||
@@ -21,20 +88,24 @@ export function PageTitle({
|
||||
action?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex flex-wrap items-end justify-between gap-4">
|
||||
<div>
|
||||
<header className="sgc-page-title flex min-w-0 flex-col gap-4 sm:flex-row sm:flex-wrap sm:items-end sm:justify-between">
|
||||
<div className="min-w-0">
|
||||
<p className="mb-2 text-xs font-semibold tracking-widest text-teal-700 uppercase dark:text-teal-400">
|
||||
{eyebrow}
|
||||
</p>
|
||||
<h1 className="text-3xl font-semibold tracking-tight">
|
||||
<h1 className="text-2xl font-semibold tracking-tight [overflow-wrap:anywhere] sm:text-3xl">
|
||||
{title}
|
||||
</h1>
|
||||
<p className="mt-2 max-w-2xl text-sm text-muted-foreground">
|
||||
{description}
|
||||
</p>
|
||||
</div>
|
||||
{action}
|
||||
</div>
|
||||
{action && (
|
||||
<div className="sgc-page-actions min-w-0 print:hidden">
|
||||
{action}
|
||||
</div>
|
||||
)}
|
||||
</header>
|
||||
);
|
||||
}
|
||||
export function Panel({
|
||||
@@ -48,12 +119,19 @@ export function Panel({
|
||||
description?: string;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const headingId = useId();
|
||||
return (
|
||||
<section
|
||||
id={id}
|
||||
className="scroll-mt-24 rounded-xl border bg-card p-5 shadow-xs"
|
||||
aria-labelledby={headingId}
|
||||
className="sgc-panel min-w-0 scroll-mt-24 rounded-xl border bg-card p-4 shadow-xs sm:p-5 print:rounded-none print:shadow-none"
|
||||
>
|
||||
<h2 className="font-semibold">{title}</h2>
|
||||
<h2
|
||||
id={headingId}
|
||||
className="font-semibold [overflow-wrap:anywhere]"
|
||||
>
|
||||
{title}
|
||||
</h2>
|
||||
{description && (
|
||||
<p className="mt-1 text-sm text-muted-foreground">
|
||||
{description}
|
||||
|
||||
Reference in New Issue
Block a user