react-bootstrap 0.31.3 → 0.32.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +1 -0
  3. package/dist/react-bootstrap.js +14493 -17076
  4. package/dist/react-bootstrap.min.js +18479 -16
  5. package/es/Alert.js +1 -4
  6. package/es/Badge.js +1 -3
  7. package/es/ButtonGroup.js +1 -3
  8. package/es/Carousel.js +79 -79
  9. package/es/CarouselCaption.js +1 -3
  10. package/es/CarouselItem.js +3 -9
  11. package/es/Checkbox.js +7 -1
  12. package/es/Clearfix.js +1 -3
  13. package/es/CloseButton.js +1 -5
  14. package/es/Col.js +1 -3
  15. package/es/Collapse.js +58 -65
  16. package/es/Dropdown.js +66 -55
  17. package/es/DropdownButton.js +2 -8
  18. package/es/DropdownMenu.js +28 -28
  19. package/es/Fade.js +25 -10
  20. package/es/Form.js +1 -3
  21. package/es/FormControl.js +1 -2
  22. package/es/FormControlStatic.js +1 -3
  23. package/es/FormGroup.js +1 -3
  24. package/es/Glyphicon.js +1 -3
  25. package/es/Grid.js +1 -3
  26. package/es/HelpBlock.js +1 -3
  27. package/es/InputGroup.js +1 -3
  28. package/es/InputGroupAddon.js +1 -3
  29. package/es/InputGroupButton.js +1 -3
  30. package/es/Jumbotron.js +1 -3
  31. package/es/Label.js +1 -3
  32. package/es/ListGroup.js +1 -3
  33. package/es/Media.js +1 -3
  34. package/es/MediaBody.js +16 -5
  35. package/es/MediaHeading.js +1 -3
  36. package/es/MediaLeft.js +1 -3
  37. package/es/MediaList.js +1 -3
  38. package/es/MediaListItem.js +1 -3
  39. package/es/MediaRight.js +1 -3
  40. package/es/Modal.js +30 -19
  41. package/es/ModalBody.js +1 -3
  42. package/es/ModalFooter.js +1 -3
  43. package/es/ModalHeader.js +2 -4
  44. package/es/ModalTitle.js +1 -3
  45. package/es/Nav.js +44 -44
  46. package/es/NavDropdown.js +2 -0
  47. package/es/NavItem.js +5 -4
  48. package/es/Navbar.js +5 -7
  49. package/es/Overlay.js +1 -3
  50. package/es/OverlayTrigger.js +43 -43
  51. package/es/PageHeader.js +1 -3
  52. package/es/Pager.js +1 -3
  53. package/es/PagerItem.js +1 -4
  54. package/es/Pagination.js +15 -224
  55. package/es/PaginationItem.js +102 -0
  56. package/es/Panel.js +114 -173
  57. package/es/PanelBody.js +84 -0
  58. package/es/PanelCollapse.js +94 -0
  59. package/es/PanelFooter.js +53 -0
  60. package/es/PanelGroup.js +95 -52
  61. package/es/PanelHeading.js +75 -0
  62. package/es/PanelTitle.js +83 -0
  63. package/es/PanelToggle.js +94 -0
  64. package/es/ProgressBar.js +12 -8
  65. package/es/Radio.js +7 -1
  66. package/es/Row.js +1 -3
  67. package/es/SplitButton.js +1 -4
  68. package/es/SplitToggle.js +1 -4
  69. package/es/TabContent.js +7 -7
  70. package/es/TabPane.js +18 -18
  71. package/es/Table.js +1 -3
  72. package/es/Tabs.js +4 -10
  73. package/es/Thumbnail.js +3 -3
  74. package/es/ToggleButton.js +1 -4
  75. package/es/Well.js +1 -3
  76. package/es/index.js +0 -2
  77. package/es/utils/PropTypes.js +26 -4
  78. package/es/utils/ValidComponentChildren.js +1 -1
  79. package/es/utils/bootstrapUtils.js +5 -3
  80. package/lib/Accordion.js +9 -9
  81. package/lib/Alert.js +14 -17
  82. package/lib/Badge.js +12 -14
  83. package/lib/Breadcrumb.js +10 -10
  84. package/lib/BreadcrumbItem.js +14 -14
  85. package/lib/Button.js +20 -20
  86. package/lib/ButtonGroup.js +12 -14
  87. package/lib/ButtonToolbar.js +9 -9
  88. package/lib/Carousel.js +121 -121
  89. package/lib/CarouselCaption.js +9 -11
  90. package/lib/CarouselItem.js +17 -22
  91. package/lib/Checkbox.js +25 -21
  92. package/lib/Clearfix.js +14 -16
  93. package/lib/CloseButton.js +12 -16
  94. package/lib/Col.js +29 -31
  95. package/lib/Collapse.js +84 -92
  96. package/lib/ControlLabel.js +14 -14
  97. package/lib/Dropdown.js +106 -95
  98. package/lib/DropdownButton.js +22 -28
  99. package/lib/DropdownMenu.js +51 -51
  100. package/lib/DropdownToggle.js +16 -16
  101. package/lib/Fade.js +43 -25
  102. package/lib/Form.js +11 -13
  103. package/lib/FormControl.js +17 -17
  104. package/lib/FormControlFeedback.js +13 -13
  105. package/lib/FormControlStatic.js +9 -11
  106. package/lib/FormGroup.js +14 -16
  107. package/lib/Glyphicon.js +10 -12
  108. package/lib/Grid.js +10 -12
  109. package/lib/HelpBlock.js +8 -10
  110. package/lib/Image.js +13 -13
  111. package/lib/InputGroup.js +10 -12
  112. package/lib/InputGroupAddon.js +8 -10
  113. package/lib/InputGroupButton.js +8 -10
  114. package/lib/Jumbotron.js +9 -11
  115. package/lib/Label.js +11 -13
  116. package/lib/ListGroup.js +15 -17
  117. package/lib/ListGroupItem.js +22 -22
  118. package/lib/Media.js +15 -17
  119. package/lib/MediaBody.js +28 -11
  120. package/lib/MediaHeading.js +9 -11
  121. package/lib/MediaLeft.js +10 -12
  122. package/lib/MediaList.js +8 -10
  123. package/lib/MediaListItem.js +8 -10
  124. package/lib/MediaRight.js +10 -12
  125. package/lib/MenuItem.js +23 -23
  126. package/lib/Modal.js +80 -69
  127. package/lib/ModalBody.js +9 -11
  128. package/lib/ModalDialog.js +16 -16
  129. package/lib/ModalFooter.js +9 -11
  130. package/lib/ModalHeader.js +20 -22
  131. package/lib/ModalTitle.js +9 -11
  132. package/lib/Nav.js +81 -81
  133. package/lib/NavDropdown.js +27 -25
  134. package/lib/NavItem.js +23 -22
  135. package/lib/Navbar.js +46 -48
  136. package/lib/NavbarBrand.js +14 -14
  137. package/lib/NavbarCollapse.js +14 -14
  138. package/lib/NavbarHeader.js +10 -10
  139. package/lib/NavbarToggle.js +22 -22
  140. package/lib/Overlay.js +25 -27
  141. package/lib/OverlayTrigger.js +79 -79
  142. package/lib/PageHeader.js +10 -12
  143. package/lib/PageItem.js +2 -2
  144. package/lib/Pager.js +13 -15
  145. package/lib/PagerItem.js +18 -21
  146. package/lib/Pagination.js +25 -240
  147. package/lib/PaginationItem.js +135 -0
  148. package/lib/Panel.js +142 -180
  149. package/lib/PanelBody.js +114 -0
  150. package/lib/PanelCollapse.js +120 -0
  151. package/lib/PanelFooter.js +80 -0
  152. package/lib/PanelGroup.js +111 -70
  153. package/lib/PanelHeading.js +107 -0
  154. package/lib/PanelTitle.js +118 -0
  155. package/lib/PanelToggle.js +130 -0
  156. package/lib/Popover.js +22 -22
  157. package/lib/ProgressBar.js +39 -35
  158. package/lib/Radio.js +25 -21
  159. package/lib/ResponsiveEmbed.js +17 -17
  160. package/lib/Row.js +9 -11
  161. package/lib/SafeAnchor.js +17 -17
  162. package/lib/SplitButton.js +26 -29
  163. package/lib/SplitToggle.js +8 -11
  164. package/lib/Tab.js +15 -15
  165. package/lib/TabContainer.js +17 -17
  166. package/lib/TabContent.js +31 -31
  167. package/lib/TabPane.js +59 -59
  168. package/lib/Table.js +15 -17
  169. package/lib/Tabs.js +29 -35
  170. package/lib/Thumbnail.js +18 -20
  171. package/lib/ToggleButton.js +17 -20
  172. package/lib/ToggleButtonGroup.js +20 -20
  173. package/lib/Tooltip.js +20 -20
  174. package/lib/Well.js +8 -10
  175. package/lib/index.js +74 -79
  176. package/lib/utils/PropTypes.js +35 -9
  177. package/lib/utils/ValidComponentChildren.js +19 -19
  178. package/lib/utils/bootstrapUtils.js +13 -11
  179. package/lib/utils/capitalize.js +1 -1
  180. package/lib/utils/createChainedFunction.js +1 -1
  181. package/lib/utils/deprecationWarning.js +7 -7
  182. package/lib/utils/index.js +4 -4
  183. package/lib/utils/splitComponentProps.js +3 -3
  184. package/package.json +54 -64
  185. package/dist/react-bootstrap.min.js.map +0 -1
  186. package/es/PaginationButton.js +0 -98
  187. package/es/utils/TransitionEvents.js +0 -109
  188. package/lib/PaginationButton.js +0 -137
  189. package/lib/utils/TransitionEvents.js +0 -113
package/es/Panel.js CHANGED
@@ -1,220 +1,148 @@
1
+ import _Object$assign from 'babel-runtime/core-js/object/assign';
1
2
  import _Object$values from 'babel-runtime/core-js/object/values';
2
- import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
3
3
  import _extends from 'babel-runtime/helpers/extends';
4
4
  import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
5
5
  import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
6
6
  import _inherits from 'babel-runtime/helpers/inherits';
7
7
  import classNames from 'classnames';
8
- import React, { cloneElement } from 'react';
9
8
  import PropTypes from 'prop-types';
9
+ import React from 'react';
10
+ import uncontrollable from 'uncontrollable';
11
+ import warning from 'warning';
10
12
 
11
- import Collapse from './Collapse';
12
- import { bsStyles, bsClass, getClassSet, prefix, splitBsPropsAndOmit } from './utils/bootstrapUtils';
13
+ import { bsStyles, bsClass, getClassSet, splitBsPropsAndOmit } from './utils/bootstrapUtils';
13
14
  import { State, Style } from './utils/StyleConfig';
15
+ import Body from './PanelBody';
16
+ import Heading from './PanelHeading';
17
+ import Title from './PanelTitle';
18
+ import Footer from './PanelFooter';
19
+ import Toggle from './PanelToggle';
20
+ import Collapse from './PanelCollapse';
14
21
 
15
- // TODO: Use uncontrollable.
22
+ var has = Object.prototype.hasOwnProperty;
23
+
24
+ var defaultGetId = function defaultGetId(id, type) {
25
+ return id ? id + '--' + type : null;
26
+ };
16
27
 
17
28
  var propTypes = {
18
- collapsible: PropTypes.bool,
19
- onSelect: PropTypes.func,
20
- header: PropTypes.node,
21
- id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
22
- footer: PropTypes.node,
23
- defaultExpanded: PropTypes.bool,
29
+ /**
30
+ * Controls the collapsed/expanded state ofthe Panel. Requires
31
+ * a `Panel.Collapse` or `<Panel.Body collapsible>` child component
32
+ * in order to actually animate out or in.
33
+ *
34
+ * @controllable onToggle
35
+ */
24
36
  expanded: PropTypes.bool,
37
+ /**
38
+ * A callback fired when the collapse state changes.
39
+ *
40
+ * @controllable expanded
41
+ */
42
+ onToggle: PropTypes.func,
25
43
  eventKey: PropTypes.any,
26
- headerRole: PropTypes.string,
27
- panelRole: PropTypes.string,
28
-
29
- // From Collapse.
30
- onEnter: PropTypes.func,
31
- onEntering: PropTypes.func,
32
- onEntered: PropTypes.func,
33
- onExit: PropTypes.func,
34
- onExiting: PropTypes.func,
35
- onExited: PropTypes.func
44
+
45
+ /**
46
+ * An HTML `id` attribute uniquely identifying the Panel component.
47
+ */
48
+ id: PropTypes.string
36
49
  };
37
50
 
38
- var defaultProps = {
39
- defaultExpanded: false
51
+ var contextTypes = {
52
+ $bs_panelGroup: PropTypes.shape({
53
+ getId: PropTypes.func,
54
+ activeKey: PropTypes.any,
55
+ onToggle: PropTypes.func
56
+ })
57
+ };
58
+
59
+ var childContextTypes = {
60
+ $bs_panel: PropTypes.shape({
61
+ headingId: PropTypes.string,
62
+ bodyId: PropTypes.string,
63
+ bsClass: PropTypes.string,
64
+ onToggle: PropTypes.func,
65
+ expanded: PropTypes.bool
66
+ })
40
67
  };
41
68
 
42
69
  var Panel = function (_React$Component) {
43
70
  _inherits(Panel, _React$Component);
44
71
 
45
- function Panel(props, context) {
72
+ function Panel() {
73
+ var _temp, _this, _ret;
74
+
46
75
  _classCallCheck(this, Panel);
47
76
 
48
- var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
77
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
78
+ args[_key] = arguments[_key];
79
+ }
49
80
 
50
- _this.handleClickTitle = _this.handleClickTitle.bind(_this);
81
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleToggle = function (e) {
82
+ var panelGroup = _this.context.$bs_panelGroup;
83
+ var expanded = !_this.getExpanded();
51
84
 
52
- _this.state = {
53
- expanded: _this.props.defaultExpanded
54
- };
55
- return _this;
85
+ if (panelGroup && panelGroup.onToggle) {
86
+ panelGroup.onToggle(_this.props.eventKey, expanded, e);
87
+ } else {
88
+ _this.props.onToggle(expanded, e);
89
+ }
90
+ }, _temp), _possibleConstructorReturn(_this, _ret);
56
91
  }
57
92
 
58
- Panel.prototype.handleClickTitle = function handleClickTitle(e) {
59
- // FIXME: What the heck? This API is horrible. This needs to go away!
60
- e.persist();
61
- e.selected = true;
62
-
63
- if (this.props.onSelect) {
64
- this.props.onSelect(this.props.eventKey, e);
65
- } else {
66
- e.preventDefault();
67
- }
68
-
69
- if (e.selected) {
70
- this.setState({ expanded: !this.state.expanded });
71
- }
72
- };
93
+ Panel.prototype.getChildContext = function getChildContext() {
94
+ var _props = this.props,
95
+ eventKey = _props.eventKey,
96
+ id = _props.id;
73
97
 
74
- Panel.prototype.renderHeader = function renderHeader(collapsible, header, id, role, expanded, bsProps) {
75
- var titleClassName = prefix(bsProps, 'title');
98
+ var idKey = eventKey == null ? id : eventKey;
76
99
 
77
- if (!collapsible) {
78
- if (!React.isValidElement(header)) {
79
- return header;
80
- }
100
+ var ids = void 0;
81
101
 
82
- return cloneElement(header, {
83
- className: classNames(header.props.className, titleClassName)
84
- });
85
- }
102
+ if (idKey !== null) {
103
+ var panelGroup = this.context.$bs_panelGroup;
104
+ var getId = panelGroup && panelGroup.getId || defaultGetId;
86
105
 
87
- if (!React.isValidElement(header)) {
88
- return React.createElement(
89
- 'h4',
90
- { role: 'presentation', className: titleClassName },
91
- this.renderAnchor(header, id, role, expanded)
92
- );
106
+ ids = {
107
+ headingId: getId(idKey, 'heading'),
108
+ bodyId: getId(idKey, 'body')
109
+ };
93
110
  }
94
111
 
95
- return cloneElement(header, {
96
- className: classNames(header.props.className, titleClassName),
97
- children: this.renderAnchor(header.props.children, id, role, expanded)
98
- });
99
- };
100
-
101
- Panel.prototype.renderAnchor = function renderAnchor(header, id, role, expanded) {
102
- return React.createElement(
103
- 'a',
104
- {
105
- role: role,
106
- href: id && '#' + id,
107
- onClick: this.handleClickTitle,
108
- 'aria-controls': id,
109
- 'aria-expanded': expanded,
110
- 'aria-selected': expanded,
111
- className: expanded ? null : 'collapsed'
112
- },
113
- header
114
- );
115
- };
116
-
117
- Panel.prototype.renderCollapsibleBody = function renderCollapsibleBody(id, expanded, role, children, bsProps, animationHooks) {
118
- return React.createElement(
119
- Collapse,
120
- _extends({ 'in': expanded }, animationHooks),
121
- React.createElement(
122
- 'div',
123
- {
124
- id: id,
125
- role: role,
126
- className: prefix(bsProps, 'collapse'),
127
- 'aria-hidden': !expanded
128
- },
129
- this.renderBody(children, bsProps)
130
- )
131
- );
112
+ return {
113
+ $bs_panel: _extends({}, ids, {
114
+ bsClass: this.props.bsClass,
115
+ expanded: this.getExpanded(),
116
+ onToggle: this.handleToggle
117
+ })
118
+ };
132
119
  };
133
120
 
134
- Panel.prototype.renderBody = function renderBody(rawChildren, bsProps) {
135
- var children = [];
136
- var bodyChildren = [];
121
+ Panel.prototype.getExpanded = function getExpanded() {
122
+ var panelGroup = this.context.$bs_panelGroup;
137
123
 
138
- var bodyClassName = prefix(bsProps, 'body');
124
+ if (panelGroup && has.call(panelGroup, 'activeKey')) {
125
+ process.env.NODE_ENV !== 'production' ? warning(this.props.expanded == null, 'Specifying `<Panel>` `expanded` in the context of an accordion ' + '`<PanelGroup>` is not supported. Set `activeKey` on the ' + '`<PanelGroup>` instead.') : void 0;
139
126
 
140
- function maybeAddBody() {
141
- if (!bodyChildren.length) {
142
- return;
143
- }
144
-
145
- // Derive the key from the index here, since we need to make one up.
146
- children.push(React.createElement(
147
- 'div',
148
- { key: children.length, className: bodyClassName },
149
- bodyChildren
150
- ));
151
-
152
- bodyChildren = [];
127
+ return panelGroup.activeKey === this.props.eventKey;
153
128
  }
154
129
 
155
- // Convert to array so we can re-use keys.
156
- React.Children.toArray(rawChildren).forEach(function (child) {
157
- if (React.isValidElement(child) && child.props.fill) {
158
- maybeAddBody();
159
-
160
- // Remove the child's unknown `fill` prop.
161
- children.push(cloneElement(child, { fill: undefined }));
162
-
163
- return;
164
- }
165
-
166
- bodyChildren.push(child);
167
- });
168
-
169
- maybeAddBody();
170
-
171
- return children;
130
+ return !!this.props.expanded;
172
131
  };
173
132
 
174
133
  Panel.prototype.render = function render() {
175
- var _props = this.props,
176
- collapsible = _props.collapsible,
177
- header = _props.header,
178
- id = _props.id,
179
- footer = _props.footer,
180
- propsExpanded = _props.expanded,
181
- headerRole = _props.headerRole,
182
- panelRole = _props.panelRole,
183
- className = _props.className,
184
- children = _props.children,
185
- onEnter = _props.onEnter,
186
- onEntering = _props.onEntering,
187
- onEntered = _props.onEntered,
188
- onExit = _props.onExit,
189
- onExiting = _props.onExiting,
190
- onExited = _props.onExited,
191
- props = _objectWithoutProperties(_props, ['collapsible', 'header', 'id', 'footer', 'expanded', 'headerRole', 'panelRole', 'className', 'children', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited']);
192
-
193
- var _splitBsPropsAndOmit = splitBsPropsAndOmit(props, ['defaultExpanded', 'eventKey', 'onSelect']),
194
- bsProps = _splitBsPropsAndOmit[0],
195
- elementProps = _splitBsPropsAndOmit[1];
134
+ var _props2 = this.props,
135
+ className = _props2.className,
136
+ children = _props2.children;
196
137
 
197
- var expanded = propsExpanded != null ? propsExpanded : this.state.expanded;
198
-
199
- var classes = getClassSet(bsProps);
138
+ var _splitBsPropsAndOmit = splitBsPropsAndOmit(this.props, ['onToggle', 'eventKey', 'expanded']),
139
+ bsProps = _splitBsPropsAndOmit[0],
140
+ props = _splitBsPropsAndOmit[1];
200
141
 
201
142
  return React.createElement(
202
143
  'div',
203
- _extends({}, elementProps, {
204
- className: classNames(className, classes),
205
- id: collapsible ? null : id
206
- }),
207
- header && React.createElement(
208
- 'div',
209
- { className: prefix(bsProps, 'heading') },
210
- this.renderHeader(collapsible, header, id, headerRole, expanded, bsProps)
211
- ),
212
- collapsible ? this.renderCollapsibleBody(id, expanded, panelRole, children, bsProps, { onEnter: onEnter, onEntering: onEntering, onEntered: onEntered, onExit: onExit, onExiting: onExiting, onExited: onExited }) : this.renderBody(children, bsProps),
213
- footer && React.createElement(
214
- 'div',
215
- { className: prefix(bsProps, 'footer') },
216
- footer
217
- )
144
+ _extends({}, props, { className: classNames(className, getClassSet(bsProps)) }),
145
+ children
218
146
  );
219
147
  };
220
148
 
@@ -222,6 +150,19 @@ var Panel = function (_React$Component) {
222
150
  }(React.Component);
223
151
 
224
152
  Panel.propTypes = propTypes;
225
- Panel.defaultProps = defaultProps;
226
153
 
227
- export default bsClass('panel', bsStyles([].concat(_Object$values(State), [Style.DEFAULT, Style.PRIMARY]), Style.DEFAULT, Panel));
154
+ Panel.contextTypes = contextTypes;
155
+ Panel.childContextTypes = childContextTypes;
156
+
157
+ var UncontrolledPanel = uncontrollable(bsClass('panel', bsStyles([].concat(_Object$values(State), [Style.DEFAULT, Style.PRIMARY]), Style.DEFAULT, Panel)), { expanded: 'onToggle' });
158
+
159
+ _Object$assign(UncontrolledPanel, {
160
+ Heading: Heading,
161
+ Title: Title,
162
+ Body: Body,
163
+ Footer: Footer,
164
+ Toggle: Toggle,
165
+ Collapse: Collapse
166
+ });
167
+
168
+ export default UncontrolledPanel;
@@ -0,0 +1,84 @@
1
+ import _extends from 'babel-runtime/helpers/extends';
2
+ import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
3
+ import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
4
+ import _inherits from 'babel-runtime/helpers/inherits';
5
+ import PropTypes from 'prop-types';
6
+ import React from 'react';
7
+ import cn from 'classnames';
8
+ import { prefix, splitBsPropsAndOmit, bsClass } from './utils/bootstrapUtils';
9
+ import PanelCollapse from './PanelCollapse';
10
+
11
+ var propTypes = {
12
+ /**
13
+ * A convenience prop that renders a Collapse component around the Body for
14
+ * situations when the parent Panel only contains a single Panel.Body child.
15
+ *
16
+ * renders:
17
+ * ```jsx
18
+ * <Panel.Collapse>
19
+ * <Panel.Body />
20
+ * </Panel.Collapse>
21
+ * ```
22
+ */
23
+ collapsible: PropTypes.bool.isRequired
24
+ };
25
+
26
+ var defaultProps = {
27
+ collapsible: false
28
+ };
29
+
30
+ var contextTypes = {
31
+ $bs_panel: PropTypes.shape({
32
+ bsClass: PropTypes.string
33
+ })
34
+ };
35
+
36
+ var PanelBody = function (_React$Component) {
37
+ _inherits(PanelBody, _React$Component);
38
+
39
+ function PanelBody() {
40
+ _classCallCheck(this, PanelBody);
41
+
42
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
43
+ }
44
+
45
+ PanelBody.prototype.render = function render() {
46
+ var _props = this.props,
47
+ children = _props.children,
48
+ className = _props.className,
49
+ collapsible = _props.collapsible;
50
+
51
+ var _ref = this.context.$bs_panel || {},
52
+ _bsClass = _ref.bsClass;
53
+
54
+ var _splitBsPropsAndOmit = splitBsPropsAndOmit(this.props, ['collapsible']),
55
+ bsProps = _splitBsPropsAndOmit[0],
56
+ elementProps = _splitBsPropsAndOmit[1];
57
+
58
+ bsProps.bsClass = _bsClass || bsProps.bsClass;
59
+
60
+ var body = React.createElement(
61
+ 'div',
62
+ _extends({}, elementProps, { className: cn(className, prefix(bsProps, 'body')) }),
63
+ children
64
+ );
65
+
66
+ if (collapsible) {
67
+ body = React.createElement(
68
+ PanelCollapse,
69
+ null,
70
+ body
71
+ );
72
+ }
73
+
74
+ return body;
75
+ };
76
+
77
+ return PanelBody;
78
+ }(React.Component);
79
+
80
+ PanelBody.propTypes = propTypes;
81
+ PanelBody.defaultProps = defaultProps;
82
+ PanelBody.contextTypes = contextTypes;
83
+
84
+ export default bsClass('panel', PanelBody);
@@ -0,0 +1,94 @@
1
+ import _extends from 'babel-runtime/helpers/extends';
2
+ import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
3
+ import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
4
+ import _inherits from 'babel-runtime/helpers/inherits';
5
+ import PropTypes from 'prop-types';
6
+ import React from 'react';
7
+
8
+ import { prefix, splitBsProps, bsClass } from './utils/bootstrapUtils';
9
+ import Collapse from './Collapse';
10
+
11
+ var propTypes = {
12
+ /**
13
+ * Callback fired before the component expands
14
+ */
15
+ onEnter: PropTypes.func,
16
+ /**
17
+ * Callback fired after the component starts to expand
18
+ */
19
+ onEntering: PropTypes.func,
20
+ /**
21
+ * Callback fired after the component has expanded
22
+ */
23
+ onEntered: PropTypes.func,
24
+ /**
25
+ * Callback fired before the component collapses
26
+ */
27
+ onExit: PropTypes.func,
28
+ /**
29
+ * Callback fired after the component starts to collapse
30
+ */
31
+ onExiting: PropTypes.func,
32
+ /**
33
+ * Callback fired after the component has collapsed
34
+ */
35
+ onExited: PropTypes.func
36
+ };
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 = function (_React$Component) {
48
+ _inherits(PanelCollapse, _React$Component);
49
+
50
+ function PanelCollapse() {
51
+ _classCallCheck(this, PanelCollapse);
52
+
53
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
54
+ }
55
+
56
+ PanelCollapse.prototype.render = function render() {
57
+ var children = this.props.children;
58
+
59
+ var _ref = this.context.$bs_panel || {},
60
+ headingId = _ref.headingId,
61
+ bodyId = _ref.bodyId,
62
+ _bsClass = _ref.bsClass,
63
+ expanded = _ref.expanded;
64
+
65
+ var _splitBsProps = splitBsProps(this.props),
66
+ bsProps = _splitBsProps[0],
67
+ props = _splitBsProps[1];
68
+
69
+ bsProps.bsClass = _bsClass || bsProps.bsClass;
70
+
71
+ if (headingId && bodyId) {
72
+ props.id = bodyId;
73
+ props.role = props.role || 'tabpanel';
74
+ props['aria-labelledby'] = headingId;
75
+ }
76
+
77
+ return React.createElement(
78
+ Collapse,
79
+ _extends({ 'in': expanded }, props),
80
+ React.createElement(
81
+ 'div',
82
+ { className: prefix(bsProps, 'collapse') },
83
+ children
84
+ )
85
+ );
86
+ };
87
+
88
+ return PanelCollapse;
89
+ }(React.Component);
90
+
91
+ PanelCollapse.propTypes = propTypes;
92
+ PanelCollapse.contextTypes = contextTypes;
93
+
94
+ export default bsClass('panel', PanelCollapse);
@@ -0,0 +1,53 @@
1
+ import _extends from 'babel-runtime/helpers/extends';
2
+ import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
3
+ import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
4
+ import _inherits from 'babel-runtime/helpers/inherits';
5
+ import PropTypes from 'prop-types';
6
+ import React from 'react';
7
+ import cn from 'classnames';
8
+ import { prefix, bsClass, splitBsProps } from './utils/bootstrapUtils';
9
+
10
+ var contextTypes = {
11
+ $bs_panel: PropTypes.shape({
12
+ bsClass: PropTypes.string
13
+ })
14
+ };
15
+
16
+ var PanelFooter = function (_React$Component) {
17
+ _inherits(PanelFooter, _React$Component);
18
+
19
+ function PanelFooter() {
20
+ _classCallCheck(this, PanelFooter);
21
+
22
+ return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
23
+ }
24
+
25
+ PanelFooter.prototype.render = function render() {
26
+ var _props = this.props,
27
+ children = _props.children,
28
+ className = _props.className;
29
+
30
+ var _ref = this.context.$bs_panel || {},
31
+ _bsClass = _ref.bsClass;
32
+
33
+ var _splitBsProps = splitBsProps(this.props),
34
+ bsProps = _splitBsProps[0],
35
+ elementProps = _splitBsProps[1];
36
+
37
+ bsProps.bsClass = _bsClass || bsProps.bsClass;
38
+
39
+ return React.createElement(
40
+ 'div',
41
+ _extends({}, elementProps, {
42
+ className: cn(className, prefix(bsProps, 'footer'))
43
+ }),
44
+ children
45
+ );
46
+ };
47
+
48
+ return PanelFooter;
49
+ }(React.Component);
50
+
51
+ PanelFooter.contextTypes = contextTypes;
52
+
53
+ export default bsClass('panel', PanelFooter);