import type { JSX } from "react"; import { type BaseButtonProps } from "../ButtonV2/ButtonProps.type"; type TableFieldConfigBase = { key: string; headerText?: string; onlyShowContentOnHovering?: boolean; }; type TableFieldConfigWithContent = TableFieldConfigBase & { content: (item: Item) => TableFieldContent; render?: never; }; type TableFieldConfigWithComponent = TableFieldConfigBase & { render: (item: Item) => JSX.Element; content?: never; }; /** * By adding the `content` property, it will use an opinionated layout with the and optionally the component. * By adding the `render` property, it will render any component returned in the function, based on the item (with type) passed. */ export type TableFieldConfig = TableFieldConfigWithComponent | TableFieldConfigWithContent; export type TableFieldContent = TableFieldText | [TableFieldAction?, TableFieldAction?]; export interface TableFieldText { text?: string; description?: { content: string; breakAllWord?: boolean; }; breakAllWord?: boolean; tag?: { text: string; color: "red" | "amber" | "green" | "gray" | "blue"; }; } export type TableFieldAction = Pick & { key: string; /** * @param item - the data in the row when this clicked * @returns void */ handleClick: (item: Item) => void; }; export {};