@veracity/vui
Version:
Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.
47 lines (45 loc) • 2.04 kB
TypeScript
import { Sort } from "../utils/types.js";
import { ThemingProps } from "../theme/types.js";
import { SystemProps } from "../system/system.js";
import { IconProps } from "../icon/icon.types.js";
import { UseTableProps } from "./useTable.types.js";
import { UseTableReturnType } from "./useTable.js";
import { ReactNode } from "react";
//#region src/table/table.types.d.ts
type TableColumn<T = string> = SystemProps & {
/** Unique identifier of a column. */field: T; /** Adds content and styling related to sort. */
isSortable?: boolean; /** Displays given text inside the element. */
title?: string;
minW?: string | number;
w?: string | number;
};
type TableContext = Pick<TableProps, 'columns' | 'rows' | 'size' | 'stickyColumn' | 'stickyHeader' | 'variant'> & UseTableReturnType;
type TableProps = SystemProps & UseTableProps & ThemingProps<'Table'> & {
/** Data structure describing the columns. */columns?: TableColumn[] | readonly TableColumn[]; /** Data structure describing the rows and their cells. */
rows?: any[]; /** First column will be sticky when scrolling horizontally. */
stickyColumn?: boolean; /** Table head will be sticky when scrolling vertically. */
stickyHeader?: boolean;
};
type TbodyProps = SystemProps;
type TdProps = SystemProps & {
level?: number;
};
type TfootProps = SystemProps;
type ThProps = SystemProps & Partial<TableColumn> & {
/** Adds disabled styling. */disabled?: boolean; /** Adds interactive styling. */
isInteractive?: boolean;
};
type TheadProps = SystemProps & {};
type TrProps = SystemProps & {
/** Adds selected styling. */isExpanded?: boolean;
isSelected?: boolean;
nested?: ReactNode;
onCollapsed?: () => void;
onExpanded?: () => void;
};
type TableSortIconProps = Omit<IconProps, 'order'> & {
/** Sort order which controls the icon. */order?: Sort['order'];
};
//#endregion
export { TableColumn, TableContext, TableProps, TableSortIconProps, TbodyProps, TdProps, TfootProps, ThProps, TheadProps, TrProps };
//# sourceMappingURL=table.types.d.ts.map