@teamsnap/teamsnap-ui
Version:
a CSS component library for TeamSnap
48 lines (47 loc) • 1.96 kB
TypeScript
/**
* @name PanelRowExpandable
*
* @description
* An expandable panel row is used to show/hide nested table data. See the teamsnap patterns
* library for more information https://teamsnap-ui-patterns.netlify.com/patterns/components/panel.html
*
* This component accepts an array of objects as `parentColumns` and `childColumns`. These columns will spread the
* object out on the <PanelCell /> by default, unless a `renderColumn` function is passed.
*
* @example
* <PanelRowExpandable
* parentColumns={[{ children: 'Homer Simpson', mods: 'u-size1of2' }, { children: 'Marge Simpson', mods: 'u-size1of2' }]}
* childColumns={[{ children: 'Bart Simpson', mods: u-size1of2' }, { children: 'Lisa Simpson', mods: 'u-size1of2' }]}
* renderColumn={ column => <div style={{ outline: '1px dashed red' }} { ...column }></div> } />
*
*/
import * as React from "react";
import * as PropTypes from "prop-types";
declare class PanelRowExpandable extends React.PureComponent<PropTypes.InferProps<typeof PanelRowExpandable.propTypes>, any> {
static propTypes: {
parentColumns: PropTypes.Validator<object[]>;
childColumns: PropTypes.Requireable<object[]>;
renderColumn: PropTypes.Requireable<(...args: any[]) => any>;
className: PropTypes.Requireable<string>;
mods: PropTypes.Requireable<string>;
style: PropTypes.Requireable<object>;
otherProps: PropTypes.Requireable<object>;
};
static defaultProps: {
childColumns: any;
renderColumn: any;
className: string;
mods: any;
style: {};
otherProps: {};
};
state: {
isExpanded: boolean;
};
handleRowClick: (e: any) => void;
renderChildLink: (children: any) => JSX.Element;
renderColumns: (columns: any, includeLink?: boolean) => any;
renderChildColumns: (childColumns: any) => JSX.Element;
render(): JSX.Element;
}
export default PanelRowExpandable;