.
This commit is contained in:
parent
6e83958e30
commit
402b8300b1
@ -75,10 +75,7 @@ export function DataTableToolbar<TData>({
|
|||||||
// Render principal
|
// Render principal
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn("flex items-center justify-between gap-2 px-2 py-2 bg-transparent", className)}
|
||||||
"flex items-center justify-between gap-2 py-4 bg-transparent border-b",
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
>
|
>
|
||||||
{/* IZQUIERDA: acciones + contador */}
|
{/* IZQUIERDA: acciones + contador */}
|
||||||
<div className="flex flex-1 items-center gap-3 flex-wrap">
|
<div className="flex flex-1 items-center gap-3 flex-wrap">
|
||||||
@ -187,7 +184,7 @@ export function DataTableToolbar<TData>({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Contador de selección */}
|
{/* Contador de selección */}
|
||||||
<div aria-live="polite" className="text-sm text-muted-foreground ml-2">
|
<div aria-live="polite" className="text-sm text-muted-foreground">
|
||||||
{hasSelection
|
{hasSelection
|
||||||
? t("components.datatable.selection_summary", {
|
? t("components.datatable.selection_summary", {
|
||||||
count: selectedCount,
|
count: selectedCount,
|
||||||
|
|||||||
@ -258,15 +258,18 @@ export function DataTable<TData, TValue>({
|
|||||||
// Render principal
|
// Render principal
|
||||||
return (
|
return (
|
||||||
<div className="transition-[max-height] duration-300 ease-in-out">
|
<div className="transition-[max-height] duration-300 ease-in-out">
|
||||||
<div className="flex flex-col gap-0">
|
<div className="flex flex-col rounded-lg border overflow-clip">
|
||||||
<DataTableToolbar showViewOptions={!readOnly} table={table} />
|
<DataTableToolbar showViewOptions={!readOnly} table={table} />
|
||||||
|
|
||||||
<div className="overflow-hidden rounded-md border">
|
<div className="overflow-hidden rounded-md border-t">
|
||||||
<TableComp className="min-w-full sm:min-w-[820px] w-full">
|
<TableComp className="min-w-full sm:min-w-[820px] w-full">
|
||||||
{/* CABECERA */}
|
{/* CABECERA */}
|
||||||
<TableHeader>
|
<TableHeader>
|
||||||
{table.getHeaderGroups().map((hg) => (
|
{table.getHeaderGroups().map((hg) => (
|
||||||
<TableRow className="bg-muted/50 hover:bg-muted/50 text-xs sm:text-sm" key={hg.id}>
|
<TableRow
|
||||||
|
className="bg-background hover:bg-muted/50 text-xs sm:text-sm"
|
||||||
|
key={hg.id}
|
||||||
|
>
|
||||||
{hg.headers.map((h) => {
|
{hg.headers.map((h) => {
|
||||||
/*
|
/*
|
||||||
const w = h.getSize();
|
const w = h.getSize();
|
||||||
@ -286,7 +289,7 @@ export function DataTable<TData, TValue>({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<TableHead
|
<TableHead
|
||||||
className={cn("whitespace-nowrap", headerClassName)}
|
className={cn("whitespace-nowrap font-semibold", headerClassName)}
|
||||||
colSpan={h.colSpan}
|
colSpan={h.colSpan}
|
||||||
key={h.id}
|
key={h.id}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -16,9 +16,9 @@ export function SkeletonDataTableFooter({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
role="status"
|
|
||||||
aria-busy="true"
|
aria-busy="true"
|
||||||
className="flex items-center justify-between border-t border-border px-4 py-3 bg-background"
|
className="flex items-center justify-between border-t border-border px-2 py-2 bg-background"
|
||||||
|
role="status"
|
||||||
>
|
>
|
||||||
{/* Izquierda: rango visible */}
|
{/* Izquierda: rango visible */}
|
||||||
<div className="flex flex-col sm:flex-row items-center gap-4 flex-1 text-sm text-muted-foreground">
|
<div className="flex flex-col sm:flex-row items-center gap-4 flex-1 text-sm text-muted-foreground">
|
||||||
@ -31,8 +31,8 @@ export function SkeletonDataTableFooter({
|
|||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<span>Filas por página</span>
|
<span>Filas por página</span>
|
||||||
<div
|
<div
|
||||||
className="h-8 w-20 rounded bg-foreground/10 animate-pulse motion-reduce:animate-none"
|
|
||||||
aria-hidden
|
aria-hidden
|
||||||
|
className="h-8 w-20 rounded bg-foreground/10 animate-pulse motion-reduce:animate-none"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -41,25 +41,25 @@ export function SkeletonDataTableFooter({
|
|||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{/* Primera */}
|
{/* Primera */}
|
||||||
<div
|
<div
|
||||||
className="h-8 w-8 rounded-md bg-foreground/10 animate-pulse motion-reduce:animate-none"
|
|
||||||
aria-hidden
|
aria-hidden
|
||||||
|
className="h-8 w-8 rounded-md bg-foreground/10 animate-pulse motion-reduce:animate-none"
|
||||||
/>
|
/>
|
||||||
{/* Anterior */}
|
{/* Anterior */}
|
||||||
<div
|
<div
|
||||||
className="h-8 w-8 rounded-md bg-foreground/10 animate-pulse motion-reduce:animate-none"
|
|
||||||
aria-hidden
|
aria-hidden
|
||||||
|
className="h-8 w-8 rounded-md bg-foreground/10 animate-pulse motion-reduce:animate-none"
|
||||||
/>
|
/>
|
||||||
{/* Indicador de página */}
|
{/* Indicador de página */}
|
||||||
<div className="h-5 w-28 rounded bg-foreground/10 animate-pulse motion-reduce:animate-none" />
|
<div className="h-5 w-28 rounded bg-foreground/10 animate-pulse motion-reduce:animate-none" />
|
||||||
{/* Siguiente */}
|
{/* Siguiente */}
|
||||||
<div
|
<div
|
||||||
className="h-8 w-8 rounded-md bg-foreground/10 animate-pulse motion-reduce:animate-none"
|
|
||||||
aria-hidden
|
aria-hidden
|
||||||
|
className="h-8 w-8 rounded-md bg-foreground/10 animate-pulse motion-reduce:animate-none"
|
||||||
/>
|
/>
|
||||||
{/* Última */}
|
{/* Última */}
|
||||||
<div
|
<div
|
||||||
className="h-8 w-8 rounded-md bg-foreground/10 animate-pulse motion-reduce:animate-none"
|
|
||||||
aria-hidden
|
aria-hidden
|
||||||
|
className="h-8 w-8 rounded-md bg-foreground/10 animate-pulse motion-reduce:animate-none"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -69,23 +69,6 @@ export const SwitchField = <TFormValues extends FieldValues>({
|
|||||||
data-invalid={hasError}
|
data-invalid={hasError}
|
||||||
orientation={orientation}
|
orientation={orientation}
|
||||||
>
|
>
|
||||||
<Switch
|
|
||||||
aria-describedby={descriptionId}
|
|
||||||
aria-invalid={hasError || undefined}
|
|
||||||
aria-required={required || undefined}
|
|
||||||
checked={field.value === true}
|
|
||||||
className={cn(inputClassName)}
|
|
||||||
disabled={isDisabled}
|
|
||||||
id={inputId}
|
|
||||||
name={field.name}
|
|
||||||
onBlur={field.onBlur}
|
|
||||||
onCheckedChange={(checked) =>
|
|
||||||
onCheckedChange ? onCheckedChange(checked) : field.onChange(checked)
|
|
||||||
}
|
|
||||||
ref={field.ref}
|
|
||||||
required={required}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<FieldContent className="gap-1">
|
<FieldContent className="gap-1">
|
||||||
<FormFieldLabel className="font-normal" htmlFor={inputId} required={required}>
|
<FormFieldLabel className="font-normal" htmlFor={inputId} required={required}>
|
||||||
{label}
|
{label}
|
||||||
@ -99,6 +82,24 @@ export const SwitchField = <TFormValues extends FieldValues>({
|
|||||||
|
|
||||||
<FieldError errors={[fieldState.error]} />
|
<FieldError errors={[fieldState.error]} />
|
||||||
</FieldContent>
|
</FieldContent>
|
||||||
|
|
||||||
|
<Switch
|
||||||
|
aria-describedby={descriptionId}
|
||||||
|
aria-invalid={hasError || undefined}
|
||||||
|
aria-required={required || undefined}
|
||||||
|
checked={field.value === true}
|
||||||
|
className={cn(inputClassName)}
|
||||||
|
disabled={isDisabled}
|
||||||
|
id={inputId}
|
||||||
|
name={field.name}
|
||||||
|
onBlur={field.onBlur}
|
||||||
|
onCheckedChange={(checked) => {
|
||||||
|
field.onChange(checked);
|
||||||
|
onCheckedChange?.(checked);
|
||||||
|
}}
|
||||||
|
ref={field.ref}
|
||||||
|
required={required}
|
||||||
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user