import * as React from 'react'; import { cn } from '@/lib/utils'; /** * Table - Composant de tableau avec design system Kodo * * Composant de tableau pour afficher des données structurées. * Utilise le design system Kodo avec des styles cohérents et support pour le scroll. * * @example * ```tsx * * * * Nom * Email * * * * * John Doe * john@example.com * * *
* ``` * * @component * @param {React.HTMLAttributes} props - Propriétés HTML standard de table * @returns {JSX.Element} Élément div contenant un tableau stylisé avec scroll */ // CRITIQUE FIX #40: Interface étendue pour supporter aria-label et caption export interface TableProps extends React.HTMLAttributes { /** * Label accessible pour le tableau (aria-label) * Si non fourni, aria-label sera undefined et il faudra utiliser TableCaption */ 'aria-label'?: string; /** * ID d'un élément qui décrit le tableau (aria-labelledby) */ 'aria-labelledby'?: string; } const Table = React.forwardRef( ( { className, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, ...props }, ref, ) => (
), ); Table.displayName = 'Table'; /** * TableHeader - En-tête du tableau * * Conteneur pour les lignes d'en-tête du tableau. * * @component */ const TableHeader = React.forwardRef< HTMLTableSectionElement, React.HTMLAttributes >(({ className, ...props }, ref) => ( )); TableHeader.displayName = 'TableHeader'; /** * TableBody - Corps du tableau * * Conteneur pour les lignes de données du tableau. * * @component */ const TableBody = React.forwardRef< HTMLTableSectionElement, React.HTMLAttributes >(({ className, ...props }, ref) => ( )); TableBody.displayName = 'TableBody'; /** * TableFooter - Pied du tableau * * Conteneur pour les lignes de pied du tableau (totaux, etc.). * * @component */ const TableFooter = React.forwardRef< HTMLTableSectionElement, React.HTMLAttributes >(({ className, ...props }, ref) => ( tr]:last:border-b-0', className, )} {...props} /> )); TableFooter.displayName = 'TableFooter'; /** * TableRow - Ligne du tableau * * Ligne individuelle du tableau avec effet hover et support pour l'état sélectionné. * * @component */ const TableRow = React.forwardRef< HTMLTableRowElement, React.HTMLAttributes >(({ className, ...props }, ref) => ( )); TableRow.displayName = 'TableRow'; /** * TableHead - Cellule d'en-tête * * Cellule d'en-tête du tableau avec style en gras et uppercase. * * @component */ const TableHead = React.forwardRef< HTMLTableCellElement, React.ThHTMLAttributes >(({ className, ...props }, ref) => (
)); TableHead.displayName = 'TableHead'; /** * TableCell - Cellule de données * * Cellule de données du tableau avec padding et alignement. * * @component */ const TableCell = React.forwardRef< HTMLTableCellElement, React.TdHTMLAttributes >(({ className, ...props }, ref) => ( )); TableCell.displayName = 'TableCell'; /** * TableCaption - Légende du tableau * * Légende optionnelle affichée sous le tableau. * * @component */ const TableCaption = React.forwardRef< HTMLTableCaptionElement, React.HTMLAttributes >(({ className, ...props }, ref) => (
)); TableCaption.displayName = 'TableCaption'; export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };