@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
84 lines (83 loc) • 3.26 kB
TypeScript
/**
* MSKCC DSM 2021, 2023
*/
import PropTypes from 'prop-types';
import React from 'react';
import { ReactAttr } from '../../types/common';
type TableExpandHeaderPropsBase = {
/**
* Specify the string read by a voice reader when the expand trigger is
* focused
*/
ariaLabel?: string;
/**
* @deprecated The enableExpando prop is being replaced by `enableToggle`
*/
enableExpando?: false | undefined;
/**
* Specify whether an expand all button should be displayed
*/
enableToggle?: false | undefined;
/**
* The description of the chevron right icon, to be put in its SVG `<title>` element.
*/
expandIconDescription?: string;
/**
* Specify whether this row is expanded or not. This helps coordinate data
* attributes so that `TableExpandRow` and `TableExpandedRow` work together
*/
isExpanded?: boolean;
/**
* Hook for when a listener initiates a request to expand the given row
*/
onExpand?(event: React.MouseEvent<HTMLButtonElement>): void;
} & ReactAttr<HTMLTableCellElement>;
type TableExpandHeaderPropsWithToggle = Omit<TableExpandHeaderPropsBase, 'ariaLabel' | 'enableToggle' | 'onExpand'> & {
enableToggle: true;
ariaLabel: string;
onExpand(event: React.MouseEvent<HTMLButtonElement>): void;
};
type TableExpandHeaderPropsWithExpando = Omit<TableExpandHeaderPropsBase, 'ariaLabel' | 'enableExpando' | 'onExpand'> & {
enableExpando: true;
ariaLabel: string;
onExpand(event: React.MouseEvent<HTMLButtonElement>): void;
};
export type TableExpandHeaderProps = TableExpandHeaderPropsWithToggle | TableExpandHeaderPropsWithExpando | TableExpandHeaderPropsBase;
declare const TableExpandHeader: {
({ ariaLabel, className: headerClassName, enableExpando, enableToggle, id, isExpanded, onExpand, expandIconDescription, children, ...rest }: TableExpandHeaderProps): JSX.Element;
propTypes: {
/**
* Specify the string read by a voice reader when the expand trigger is
* focused
*/
ariaLabel: PropTypes.Requireable<any>;
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
className: PropTypes.Requireable<string>;
/**
* The enableExpando prop is being replaced by enableToggle
*/
enableExpando: (props: any, propName: any, componentName: any, ...rest: any[]) => any;
/**
* Specify whether an expand all button should be displayed
*/
enableToggle: PropTypes.Requireable<boolean>;
/**
* The description of the chevron right icon, to be put in its SVG `<title>` element.
*/
expandIconDescription: PropTypes.Requireable<string>;
/**
* Supply an id to the th element.
*/
id: PropTypes.Requireable<string>;
/**
* Specify whether this row is expanded or not. This helps coordinate data
* attributes so that `TableExpandRow` and `TableExpandedRow` work together
*/
isExpanded: Function;
/**
* Hook for when a listener initiates a request to expand the given row
*/
onExpand: PropTypes.Requireable<any>;
};
};
export default TableExpandHeader;