"use client"; /* * Documentation: * Table — https://app.subframe.com/f023064a5ca0/library?component=Table_142dfde7-d0cc-48a1-a04c-a08ab2252633 */ import React from "react"; import * as SubframeCore from "@subframe/core"; import * as SubframeUtils from "../../utils"; export interface CellProps extends React.TdHTMLAttributes { children?: React.ReactNode; variant?: "align-left" | "align-center" | "align-right"; className?: string; } const Cell = React.forwardRef( function Cell( { children, variant = "align-left", className, ...otherProps }: CellProps, ref ) { return (
{children}
); } ); export interface HeaderCellProps extends React.ThHTMLAttributes { children?: React.ReactNode; icon?: React.ReactNode; className?: string; } const HeaderCell = React.forwardRef< HTMLTableHeaderCellElement, HeaderCellProps >(function HeaderCell( { children, icon = null, className, ...otherProps }: HeaderCellProps, ref ) { return (
{children ? ( {children} ) : null} {icon ? ( {icon} ) : null}
); }); export interface HeaderRowProps extends React.HTMLAttributes { children?: React.ReactNode; className?: string; } const HeaderRow = React.forwardRef( function HeaderRow( { children, className, ...otherProps }: HeaderRowProps, ref ) { return ( {children} ); } ); export interface RowProps extends React.HTMLAttributes { children?: React.ReactNode; clickable?: boolean; className?: string; } const Row = React.forwardRef(function Row( { children, clickable = false, className, ...otherProps }: RowProps, ref ) { return ( {children} ); }); export interface TableRootProps extends React.TableHTMLAttributes { header?: React.ReactNode; children?: React.ReactNode; emptyText?: React.ReactNode; variant?: "default" | "disabled"; className?: string; } const TableRoot = React.forwardRef( function TableRoot( { header, children, emptyText, variant = "default", className, ...otherProps }: TableRootProps, ref ) { return ( {header} {children}
); } ); export const Table = Object.assign(TableRoot, { Cell, HeaderCell, HeaderRow, Row, });