'use client'; import { Button, Collection, Column as AriaColumn, type ColumnProps as AriaColumnProps, Row as AriaRow, type RowProps, Table as AriaTable, TableHeader as AriaTableHeader, type TableHeaderProps, type TableProps, useTableOptions, type TableBodyProps, TableBody as AriaTableBody, type CellProps, Cell as AriaCell, ColumnResizer, TableLoadMoreItem as AriaTableLoadMoreItem, type TableLoadMoreItemProps, TableFooter as AriaTableFooter, type TableFooterProps } from 'react-aria-components/Table'; import {Group} from 'react-aria-components/Group'; import {composeRenderProps} from 'react-aria-components/composeRenderProps'; import {Checkbox} from './Checkbox'; import {ProgressCircle} from './ProgressCircle'; import {ChevronUp, ChevronDown, GripVertical, ChevronRight} from 'lucide-react'; import './Table.css'; export function Table(props: TableProps) { return ; } interface ColumnProps extends AriaColumnProps { allowsResizing?: boolean; } export function Column(props: Omit & {children?: React.ReactNode}) { return ( {({allowsSorting, sortDirection}) => (
{props.children} {allowsSorting && ( )} {props.allowsResizing && }
)}
); } export function TableHeader({columns, children, ...otherProps}: TableHeaderProps) { let {selectionBehavior, selectionMode, allowsDragging} = useTableOptions(); return ( {/* Add extra columns for drag and drop and selection. */} {allowsDragging && ( )} {selectionBehavior === 'toggle' && ( {selectionMode === 'multiple' && } )} {children} ); } export function Row({id, columns, children, ...otherProps}: RowProps) { let {selectionBehavior, allowsDragging} = useTableOptions(); return ( {allowsDragging && ( )} {selectionBehavior === 'toggle' && ( )} {children} ); } export function TableBody(props: TableBodyProps) { return ; } export function TableFooter(props: TableFooterProps) { return ; } export function Cell(props: CellProps) { return ( {composeRenderProps(props.children, (children, {hasChildItems, isTreeColumn}) => ( <> {isTreeColumn && hasChildItems && ( )} {children} ))} ); } export function TableLoadMoreItem(props: TableLoadMoreItemProps) { return (
); }