@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
89 lines (88 loc) • 2.97 kB
TypeScript
import type { ReactNode, SyntheticEvent, TableHTMLAttributes } from 'react';
import { TableAccordionContentRow } from './table-accordion/TableAccordionContent';
export type TableTrClickInfo = {
trElement: HTMLTableRowElement | null;
};
export type TableTrProps = {
/**
* Override the automatic variant of the current row. The next row one will continue with the opposite.
* Default: `undefined`
*/
variant?: 'even' | 'odd';
/**
* If set to `true`, the inherited header text will not wrap to new lines.
* Default: `false`
*/
noWrap?: boolean;
/**
* Vertical alignment of all cell content in the row.
* Default: `undefined`
*/
verticalAlign?: 'top' | 'middle' | 'bottom';
/**
* If set to `true`, all `<Td>` and `<Th>` cells in the row receive a highlighted background.
* Default: `false`
*/
highlight?: boolean;
/**
* Use `true` to render the `<Tr>` initially as expanded.
* Default: `false`
*/
expanded?: boolean;
/**
* Use `true` to disable the `<Tr>` to be accessible as an interactive element.
* Default: `false`
*/
disabled?: boolean;
/**
* Use `true` to disable the expand/collapse animation.
* Default: `false`
*/
noAnimation?: boolean;
/**
* When `true`, keeps the accordion content in the DOM when closed. Defaults to `false`.
* Default: `false`
*/
keepInDOM?: boolean;
/**
* Will emit when user clicks/expands or on keydown space/enter (in `mode="accordion"` and `mode="navigation"`) in the table row. The second argument is an object with `trElement` (the `HTMLTableRowElement`).
* Default: `undefined`
*/
onClick?: (event: SyntheticEvent, info: TableTrClickInfo) => void;
/**
* Will emit when table row is expanded. Returns an object with the table row as the target: `{ target }`.
* Default: `undefined`
*/
onOpen?: ({ target }: {
target: HTMLTableRowElement;
}) => void;
/**
* Will emit when table row is closed (after it was open). Returns an object with the table row as the target: `{ target }`.
* Default: `undefined`
*/
onClose?: ({ target }: {
target: HTMLTableRowElement;
}) => void;
/**
* The content of the component.
*/
children: ReactNode;
};
declare function Tr(componentProps: TableTrProps & Omit<TableHTMLAttributes<HTMLTableRowElement>, 'onClick'>): import("react/jsx-runtime").JSX.Element;
declare namespace Tr {
var AccordionContent: typeof TableAccordionContentRow;
}
export default Tr;
/**
* Handle odd/even on re-render and StrictMode
*/
export declare function useHandleOddEven({ children }: {
children: any;
}): {
trCountRef: import("react").RefObject<{
count: number;
}>;
rerenderAlias: {};
totalCount: number;
setRerenderAlias: import("react").Dispatch<import("react").SetStateAction<{}>>;
};