import * as React from 'react'; import * as PropTypes from 'prop-types'; import { BoxProps as ReakitBoxProps } from 'reakit/ts/Box/Box'; import { Caption as _Caption } from './styled'; export type LocalTableCaptionProps = { children: React.ReactNode; /** Positioning of the caption */ position?: 'top' | 'bottom'; }; export type TableCaptionProps = ReakitBoxProps & LocalTableCaptionProps; export const TableCaption: React.FunctionComponent = ({ children, position, ...props }) => ( <_Caption use="caption" position={position} {...props}> {children} ); export const tableCaptionPropTypes = { children: PropTypes.node.isRequired, position: PropTypes.oneOf(['top', 'bottom']) as PropTypes.Validator }; TableCaption.propTypes = tableCaptionPropTypes; export const tableCaptionDefaultProps: Partial = { position: 'top' }; TableCaption.defaultProps = tableCaptionDefaultProps; const C: React.FunctionComponent = TableCaption; export default C;