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.
- package/CHANGELOG.md +57 -0
- package/README.md +1 -0
- package/dist/react-bootstrap.js +14493 -17076
- package/dist/react-bootstrap.min.js +18479 -16
- package/es/Alert.js +1 -4
- package/es/Badge.js +1 -3
- package/es/ButtonGroup.js +1 -3
- package/es/Carousel.js +79 -79
- package/es/CarouselCaption.js +1 -3
- package/es/CarouselItem.js +3 -9
- package/es/Checkbox.js +7 -1
- package/es/Clearfix.js +1 -3
- package/es/CloseButton.js +1 -5
- package/es/Col.js +1 -3
- package/es/Collapse.js +58 -65
- package/es/Dropdown.js +66 -55
- package/es/DropdownButton.js +2 -8
- package/es/DropdownMenu.js +28 -28
- package/es/Fade.js +25 -10
- package/es/Form.js +1 -3
- package/es/FormControl.js +1 -2
- package/es/FormControlStatic.js +1 -3
- package/es/FormGroup.js +1 -3
- package/es/Glyphicon.js +1 -3
- package/es/Grid.js +1 -3
- package/es/HelpBlock.js +1 -3
- package/es/InputGroup.js +1 -3
- package/es/InputGroupAddon.js +1 -3
- package/es/InputGroupButton.js +1 -3
- package/es/Jumbotron.js +1 -3
- package/es/Label.js +1 -3
- package/es/ListGroup.js +1 -3
- package/es/Media.js +1 -3
- package/es/MediaBody.js +16 -5
- package/es/MediaHeading.js +1 -3
- package/es/MediaLeft.js +1 -3
- package/es/MediaList.js +1 -3
- package/es/MediaListItem.js +1 -3
- package/es/MediaRight.js +1 -3
- package/es/Modal.js +30 -19
- package/es/ModalBody.js +1 -3
- package/es/ModalFooter.js +1 -3
- package/es/ModalHeader.js +2 -4
- package/es/ModalTitle.js +1 -3
- package/es/Nav.js +44 -44
- package/es/NavDropdown.js +2 -0
- package/es/NavItem.js +5 -4
- package/es/Navbar.js +5 -7
- package/es/Overlay.js +1 -3
- package/es/OverlayTrigger.js +43 -43
- package/es/PageHeader.js +1 -3
- package/es/Pager.js +1 -3
- package/es/PagerItem.js +1 -4
- package/es/Pagination.js +15 -224
- package/es/PaginationItem.js +102 -0
- package/es/Panel.js +114 -173
- package/es/PanelBody.js +84 -0
- package/es/PanelCollapse.js +94 -0
- package/es/PanelFooter.js +53 -0
- package/es/PanelGroup.js +95 -52
- package/es/PanelHeading.js +75 -0
- package/es/PanelTitle.js +83 -0
- package/es/PanelToggle.js +94 -0
- package/es/ProgressBar.js +12 -8
- package/es/Radio.js +7 -1
- package/es/Row.js +1 -3
- package/es/SplitButton.js +1 -4
- package/es/SplitToggle.js +1 -4
- package/es/TabContent.js +7 -7
- package/es/TabPane.js +18 -18
- package/es/Table.js +1 -3
- package/es/Tabs.js +4 -10
- package/es/Thumbnail.js +3 -3
- package/es/ToggleButton.js +1 -4
- package/es/Well.js +1 -3
- package/es/index.js +0 -2
- package/es/utils/PropTypes.js +26 -4
- package/es/utils/ValidComponentChildren.js +1 -1
- package/es/utils/bootstrapUtils.js +5 -3
- package/lib/Accordion.js +9 -9
- package/lib/Alert.js +14 -17
- package/lib/Badge.js +12 -14
- package/lib/Breadcrumb.js +10 -10
- package/lib/BreadcrumbItem.js +14 -14
- package/lib/Button.js +20 -20
- package/lib/ButtonGroup.js +12 -14
- package/lib/ButtonToolbar.js +9 -9
- package/lib/Carousel.js +121 -121
- package/lib/CarouselCaption.js +9 -11
- package/lib/CarouselItem.js +17 -22
- package/lib/Checkbox.js +25 -21
- package/lib/Clearfix.js +14 -16
- package/lib/CloseButton.js +12 -16
- package/lib/Col.js +29 -31
- package/lib/Collapse.js +84 -92
- package/lib/ControlLabel.js +14 -14
- package/lib/Dropdown.js +106 -95
- package/lib/DropdownButton.js +22 -28
- package/lib/DropdownMenu.js +51 -51
- package/lib/DropdownToggle.js +16 -16
- package/lib/Fade.js +43 -25
- package/lib/Form.js +11 -13
- package/lib/FormControl.js +17 -17
- package/lib/FormControlFeedback.js +13 -13
- package/lib/FormControlStatic.js +9 -11
- package/lib/FormGroup.js +14 -16
- package/lib/Glyphicon.js +10 -12
- package/lib/Grid.js +10 -12
- package/lib/HelpBlock.js +8 -10
- package/lib/Image.js +13 -13
- package/lib/InputGroup.js +10 -12
- package/lib/InputGroupAddon.js +8 -10
- package/lib/InputGroupButton.js +8 -10
- package/lib/Jumbotron.js +9 -11
- package/lib/Label.js +11 -13
- package/lib/ListGroup.js +15 -17
- package/lib/ListGroupItem.js +22 -22
- package/lib/Media.js +15 -17
- package/lib/MediaBody.js +28 -11
- package/lib/MediaHeading.js +9 -11
- package/lib/MediaLeft.js +10 -12
- package/lib/MediaList.js +8 -10
- package/lib/MediaListItem.js +8 -10
- package/lib/MediaRight.js +10 -12
- package/lib/MenuItem.js +23 -23
- package/lib/Modal.js +80 -69
- package/lib/ModalBody.js +9 -11
- package/lib/ModalDialog.js +16 -16
- package/lib/ModalFooter.js +9 -11
- package/lib/ModalHeader.js +20 -22
- package/lib/ModalTitle.js +9 -11
- package/lib/Nav.js +81 -81
- package/lib/NavDropdown.js +27 -25
- package/lib/NavItem.js +23 -22
- package/lib/Navbar.js +46 -48
- package/lib/NavbarBrand.js +14 -14
- package/lib/NavbarCollapse.js +14 -14
- package/lib/NavbarHeader.js +10 -10
- package/lib/NavbarToggle.js +22 -22
- package/lib/Overlay.js +25 -27
- package/lib/OverlayTrigger.js +79 -79
- package/lib/PageHeader.js +10 -12
- package/lib/PageItem.js +2 -2
- package/lib/Pager.js +13 -15
- package/lib/PagerItem.js +18 -21
- package/lib/Pagination.js +25 -240
- package/lib/PaginationItem.js +135 -0
- package/lib/Panel.js +142 -180
- package/lib/PanelBody.js +114 -0
- package/lib/PanelCollapse.js +120 -0
- package/lib/PanelFooter.js +80 -0
- package/lib/PanelGroup.js +111 -70
- package/lib/PanelHeading.js +107 -0
- package/lib/PanelTitle.js +118 -0
- package/lib/PanelToggle.js +130 -0
- package/lib/Popover.js +22 -22
- package/lib/ProgressBar.js +39 -35
- package/lib/Radio.js +25 -21
- package/lib/ResponsiveEmbed.js +17 -17
- package/lib/Row.js +9 -11
- package/lib/SafeAnchor.js +17 -17
- package/lib/SplitButton.js +26 -29
- package/lib/SplitToggle.js +8 -11
- package/lib/Tab.js +15 -15
- package/lib/TabContainer.js +17 -17
- package/lib/TabContent.js +31 -31
- package/lib/TabPane.js +59 -59
- package/lib/Table.js +15 -17
- package/lib/Tabs.js +29 -35
- package/lib/Thumbnail.js +18 -20
- package/lib/ToggleButton.js +17 -20
- package/lib/ToggleButtonGroup.js +20 -20
- package/lib/Tooltip.js +20 -20
- package/lib/Well.js +8 -10
- package/lib/index.js +74 -79
- package/lib/utils/PropTypes.js +35 -9
- package/lib/utils/ValidComponentChildren.js +19 -19
- package/lib/utils/bootstrapUtils.js +13 -11
- package/lib/utils/capitalize.js +1 -1
- package/lib/utils/createChainedFunction.js +1 -1
- package/lib/utils/deprecationWarning.js +7 -7
- package/lib/utils/index.js +4 -4
- package/lib/utils/splitComponentProps.js +3 -3
- package/package.json +54 -64
- package/dist/react-bootstrap.min.js.map +0 -1
- package/es/PaginationButton.js +0 -98
- package/es/utils/TransitionEvents.js +0 -109
- package/lib/PaginationButton.js +0 -137
- 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
|
|
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
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
|
39
|
-
|
|
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(
|
|
72
|
+
function Panel() {
|
|
73
|
+
var _temp, _this, _ret;
|
|
74
|
+
|
|
46
75
|
_classCallCheck(this, Panel);
|
|
47
76
|
|
|
48
|
-
var
|
|
77
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
78
|
+
args[_key] = arguments[_key];
|
|
79
|
+
}
|
|
49
80
|
|
|
50
|
-
_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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
75
|
-
var titleClassName = prefix(bsProps, 'title');
|
|
98
|
+
var idKey = eventKey == null ? id : eventKey;
|
|
76
99
|
|
|
77
|
-
|
|
78
|
-
if (!React.isValidElement(header)) {
|
|
79
|
-
return header;
|
|
80
|
-
}
|
|
100
|
+
var ids = void 0;
|
|
81
101
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
102
|
+
if (idKey !== null) {
|
|
103
|
+
var panelGroup = this.context.$bs_panelGroup;
|
|
104
|
+
var getId = panelGroup && panelGroup.getId || defaultGetId;
|
|
86
105
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
'
|
|
90
|
-
|
|
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
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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.
|
|
135
|
-
var
|
|
136
|
-
var bodyChildren = [];
|
|
121
|
+
Panel.prototype.getExpanded = function getExpanded() {
|
|
122
|
+
var panelGroup = this.context.$bs_panelGroup;
|
|
137
123
|
|
|
138
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
176
|
-
|
|
177
|
-
|
|
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
|
|
198
|
-
|
|
199
|
-
|
|
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({},
|
|
204
|
-
|
|
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
|
-
|
|
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;
|
package/es/PanelBody.js
ADDED
|
@@ -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);
|