1 | import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
|
2 | import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
|
3 | import PropTypes from 'prop-types';
|
4 | import React from 'react';
|
5 | import { prefix, splitBsProps, bsClass } from './utils/bootstrapUtils';
|
6 | import Collapse from './Collapse';
|
7 | var propTypes = {
|
8 | |
9 |
|
10 |
|
11 | onEnter: PropTypes.func,
|
12 |
|
13 | |
14 |
|
15 |
|
16 | onEntering: PropTypes.func,
|
17 |
|
18 | |
19 |
|
20 |
|
21 | onEntered: PropTypes.func,
|
22 |
|
23 | |
24 |
|
25 |
|
26 | onExit: PropTypes.func,
|
27 |
|
28 | |
29 |
|
30 |
|
31 | onExiting: PropTypes.func,
|
32 |
|
33 | |
34 |
|
35 |
|
36 | onExited: PropTypes.func
|
37 | };
|
38 | var contextTypes = {
|
39 | $bs_panel: PropTypes.shape({
|
40 | headingId: PropTypes.string,
|
41 | bodyId: PropTypes.string,
|
42 | bsClass: PropTypes.string,
|
43 | expanded: PropTypes.bool
|
44 | })
|
45 | };
|
46 |
|
47 | var PanelCollapse =
|
48 |
|
49 | function (_React$Component) {
|
50 | _inheritsLoose(PanelCollapse, _React$Component);
|
51 |
|
52 | function PanelCollapse() {
|
53 | return _React$Component.apply(this, arguments) || this;
|
54 | }
|
55 |
|
56 | var _proto = PanelCollapse.prototype;
|
57 |
|
58 | _proto.render = function render() {
|
59 | var children = this.props.children;
|
60 |
|
61 | var _ref = this.context.$bs_panel || {},
|
62 | headingId = _ref.headingId,
|
63 | bodyId = _ref.bodyId,
|
64 | _bsClass = _ref.bsClass,
|
65 | expanded = _ref.expanded;
|
66 |
|
67 | var _splitBsProps = splitBsProps(this.props),
|
68 | bsProps = _splitBsProps[0],
|
69 | props = _splitBsProps[1];
|
70 |
|
71 | bsProps.bsClass = _bsClass || bsProps.bsClass;
|
72 |
|
73 | if (headingId && bodyId) {
|
74 | props.id = bodyId;
|
75 | props.role = props.role || 'tabpanel';
|
76 | props['aria-labelledby'] = headingId;
|
77 | }
|
78 |
|
79 | return React.createElement(Collapse, _extends({
|
80 | in: expanded
|
81 | }, props), React.createElement("div", {
|
82 | className: prefix(bsProps, 'collapse')
|
83 | }, children));
|
84 | };
|
85 |
|
86 | return PanelCollapse;
|
87 | }(React.Component);
|
88 |
|
89 | PanelCollapse.propTypes = propTypes;
|
90 | PanelCollapse.contextTypes = contextTypes;
|
91 | export default bsClass('panel', PanelCollapse); |
\ | No newline at end of file |