UNPKG

@talend/react-bootstrap

Version:

Bootstrap 3 components built with React

71 lines 1.86 kB
import PropTypes from 'prop-types'; import React from 'react'; import { prefix, splitBsProps, bsClass } from './utils/bootstrapUtils'; import Collapse from './Collapse'; import { jsx as _jsx } from "react/jsx-runtime"; const propTypes = { /** * Callback fired before the component expands */ onEnter: PropTypes.func, /** * Callback fired after the component starts to expand */ onEntering: PropTypes.func, /** * Callback fired after the component has expanded */ onEntered: PropTypes.func, /** * Callback fired before the component collapses */ onExit: PropTypes.func, /** * Callback fired after the component starts to collapse */ onExiting: PropTypes.func, /** * Callback fired after the component has collapsed */ onExited: PropTypes.func }; const contextTypes = { $bs_panel: PropTypes.shape({ headingId: PropTypes.string, bodyId: PropTypes.string, bsClass: PropTypes.string, expanded: PropTypes.bool }) }; class PanelCollapse extends React.Component { render() { const { children } = this.props; const { headingId, bodyId, bsClass: _bsClass, expanded } = this.context.$bs_panel || {}; const [bsProps, props] = splitBsProps(this.props); bsProps.bsClass = _bsClass || bsProps.bsClass; if (headingId && bodyId) { props.id = bodyId; props.role = props.role || 'tabpanel'; props['aria-labelledby'] = headingId; } return /*#__PURE__*/_jsx(Collapse, { in: expanded, ...props, children: /*#__PURE__*/_jsx("div", { className: prefix(bsProps, 'collapse'), children: children }) }); } } PanelCollapse.propTypes = propTypes; PanelCollapse.contextTypes = contextTypes; export default bsClass('panel', PanelCollapse); //# sourceMappingURL=PanelCollapse.js.map