react-bootstrap 0.31.1 → 0.31.5
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 +53 -0
- package/dist/react-bootstrap.js +4811 -4179
- package/dist/react-bootstrap.min.js +9 -9
- package/dist/react-bootstrap.min.js.map +1 -1
- package/es/ButtonToolbar.js +2 -3
- package/es/Carousel.js +85 -77
- package/es/Checkbox.js +2 -0
- package/es/CloseButton.js +1 -1
- package/es/Collapse.js +18 -18
- package/es/Dropdown.js +50 -50
- package/es/DropdownMenu.js +28 -28
- package/es/Fade.js +2 -2
- package/es/FormControl.js +1 -2
- package/es/MediaBody.js +15 -2
- package/es/Modal.js +23 -15
- package/es/Nav.js +44 -44
- package/es/Navbar.js +4 -4
- package/es/OverlayTrigger.js +39 -39
- package/es/Panel.js +44 -44
- package/es/Radio.js +2 -0
- package/es/SafeAnchor.js +15 -2
- package/es/TabContent.js +5 -5
- package/es/TabPane.js +16 -16
- package/es/Tabs.js +2 -2
- package/es/Thumbnail.js +2 -0
- package/es/ToggleButton.js +8 -0
- package/es/ToggleButtonGroup.js +11 -6
- package/es/index.js +4 -0
- package/es/utils/TransitionEvents.js +11 -10
- package/es/utils/ValidComponentChildren.js +1 -1
- package/es/utils/bootstrapUtils.js +2 -1
- package/lib/Accordion.js +9 -9
- package/lib/Alert.js +14 -14
- package/lib/Badge.js +13 -13
- package/lib/Breadcrumb.js +10 -10
- package/lib/BreadcrumbItem.js +14 -14
- package/lib/Button.js +20 -20
- package/lib/ButtonGroup.js +13 -13
- package/lib/ButtonToolbar.js +9 -13
- package/lib/Carousel.js +127 -119
- package/lib/CarouselCaption.js +10 -10
- package/lib/CarouselItem.js +16 -16
- package/lib/Checkbox.js +21 -21
- package/lib/Clearfix.js +15 -15
- package/lib/CloseButton.js +12 -14
- package/lib/Col.js +30 -30
- package/lib/Collapse.js +47 -47
- package/lib/ControlLabel.js +14 -14
- package/lib/Dropdown.js +92 -92
- package/lib/DropdownButton.js +22 -22
- package/lib/DropdownMenu.js +51 -51
- package/lib/DropdownToggle.js +16 -16
- package/lib/Fade.js +20 -20
- package/lib/Form.js +12 -12
- package/lib/FormControl.js +17 -17
- package/lib/FormControlFeedback.js +13 -13
- package/lib/FormControlStatic.js +10 -10
- package/lib/FormGroup.js +15 -15
- package/lib/Glyphicon.js +11 -11
- package/lib/Grid.js +11 -11
- package/lib/HelpBlock.js +9 -9
- package/lib/Image.js +13 -13
- package/lib/InputGroup.js +11 -11
- package/lib/InputGroupAddon.js +9 -9
- package/lib/InputGroupButton.js +9 -9
- package/lib/Jumbotron.js +10 -10
- package/lib/Label.js +12 -12
- package/lib/ListGroup.js +16 -16
- package/lib/ListGroupItem.js +22 -22
- package/lib/Media.js +16 -16
- package/lib/MediaBody.js +29 -10
- package/lib/MediaHeading.js +10 -10
- package/lib/MediaLeft.js +11 -11
- package/lib/MediaList.js +9 -9
- package/lib/MediaListItem.js +9 -9
- package/lib/MediaRight.js +11 -11
- package/lib/MenuItem.js +23 -23
- package/lib/Modal.js +73 -65
- package/lib/ModalBody.js +10 -10
- package/lib/ModalDialog.js +16 -16
- package/lib/ModalFooter.js +10 -10
- package/lib/ModalHeader.js +17 -17
- package/lib/ModalTitle.js +10 -10
- package/lib/Nav.js +81 -81
- package/lib/NavDropdown.js +25 -25
- package/lib/NavItem.js +18 -18
- package/lib/Navbar.js +47 -47
- 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 -25
- package/lib/OverlayTrigger.js +75 -75
- package/lib/PageHeader.js +11 -11
- package/lib/PageItem.js +2 -2
- package/lib/Pager.js +14 -14
- package/lib/PagerItem.js +17 -17
- package/lib/Pagination.js +52 -52
- package/lib/PaginationButton.js +20 -20
- package/lib/Panel.js +76 -76
- package/lib/PanelGroup.js +18 -18
- package/lib/Popover.js +22 -22
- package/lib/ProgressBar.js +29 -29
- package/lib/Radio.js +21 -21
- package/lib/ResponsiveEmbed.js +17 -17
- package/lib/Row.js +10 -10
- package/lib/SafeAnchor.js +31 -16
- package/lib/SplitButton.js +26 -26
- package/lib/SplitToggle.js +8 -8
- package/lib/Tab.js +15 -15
- package/lib/TabContainer.js +17 -17
- package/lib/TabContent.js +29 -29
- package/lib/TabPane.js +57 -57
- package/lib/Table.js +16 -16
- package/lib/Tabs.js +28 -28
- package/lib/Thumbnail.js +19 -19
- package/lib/ToggleButton.js +23 -16
- package/lib/ToggleButtonGroup.js +38 -26
- package/lib/Tooltip.js +20 -20
- package/lib/Well.js +9 -9
- package/lib/index.js +83 -73
- package/lib/utils/PropTypes.js +5 -5
- package/lib/utils/TransitionEvents.js +12 -11
- package/lib/utils/ValidComponentChildren.js +19 -19
- package/lib/utils/bootstrapUtils.js +11 -10
- 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 +20 -18
package/lib/MediaListItem.js
CHANGED
|
@@ -32,20 +32,20 @@ var _react2 = _interopRequireDefault(_react);
|
|
|
32
32
|
|
|
33
33
|
var _bootstrapUtils = require('./utils/bootstrapUtils');
|
|
34
34
|
|
|
35
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
35
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
36
36
|
|
|
37
37
|
var MediaListItem = function (_React$Component) {
|
|
38
|
-
(0, _inherits3
|
|
38
|
+
(0, _inherits3.default)(MediaListItem, _React$Component);
|
|
39
39
|
|
|
40
40
|
function MediaListItem() {
|
|
41
|
-
(0, _classCallCheck3
|
|
42
|
-
return (0, _possibleConstructorReturn3
|
|
41
|
+
(0, _classCallCheck3.default)(this, MediaListItem);
|
|
42
|
+
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
MediaListItem.prototype.render = function render() {
|
|
46
46
|
var _props = this.props,
|
|
47
47
|
className = _props.className,
|
|
48
|
-
props = (0, _objectWithoutProperties3
|
|
48
|
+
props = (0, _objectWithoutProperties3.default)(_props, ['className']);
|
|
49
49
|
|
|
50
50
|
var _splitBsProps = (0, _bootstrapUtils.splitBsProps)(props),
|
|
51
51
|
bsProps = _splitBsProps[0],
|
|
@@ -53,13 +53,13 @@ var MediaListItem = function (_React$Component) {
|
|
|
53
53
|
|
|
54
54
|
var classes = (0, _bootstrapUtils.getClassSet)(bsProps);
|
|
55
55
|
|
|
56
|
-
return _react2
|
|
57
|
-
className: (0, _classnames2
|
|
56
|
+
return _react2.default.createElement('li', (0, _extends3.default)({}, elementProps, {
|
|
57
|
+
className: (0, _classnames2.default)(className, classes)
|
|
58
58
|
}));
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
return MediaListItem;
|
|
62
|
-
}(_react2
|
|
62
|
+
}(_react2.default.Component);
|
|
63
63
|
|
|
64
|
-
exports
|
|
64
|
+
exports.default = (0, _bootstrapUtils.bsClass)('media', MediaListItem);
|
|
65
65
|
module.exports = exports['default'];
|
package/lib/MediaRight.js
CHANGED
|
@@ -40,28 +40,28 @@ var _Media2 = _interopRequireDefault(_Media);
|
|
|
40
40
|
|
|
41
41
|
var _bootstrapUtils = require('./utils/bootstrapUtils');
|
|
42
42
|
|
|
43
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
43
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
44
44
|
|
|
45
45
|
var propTypes = {
|
|
46
46
|
/**
|
|
47
47
|
* Align the media to the top, middle, or bottom of the media object.
|
|
48
48
|
*/
|
|
49
|
-
align: _propTypes2
|
|
49
|
+
align: _propTypes2.default.oneOf(['top', 'middle', 'bottom'])
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
var MediaRight = function (_React$Component) {
|
|
53
|
-
(0, _inherits3
|
|
53
|
+
(0, _inherits3.default)(MediaRight, _React$Component);
|
|
54
54
|
|
|
55
55
|
function MediaRight() {
|
|
56
|
-
(0, _classCallCheck3
|
|
57
|
-
return (0, _possibleConstructorReturn3
|
|
56
|
+
(0, _classCallCheck3.default)(this, MediaRight);
|
|
57
|
+
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
MediaRight.prototype.render = function render() {
|
|
61
61
|
var _props = this.props,
|
|
62
62
|
align = _props.align,
|
|
63
63
|
className = _props.className,
|
|
64
|
-
props = (0, _objectWithoutProperties3
|
|
64
|
+
props = (0, _objectWithoutProperties3.default)(_props, ['align', 'className']);
|
|
65
65
|
|
|
66
66
|
var _splitBsProps = (0, _bootstrapUtils.splitBsProps)(props),
|
|
67
67
|
bsProps = _splitBsProps[0],
|
|
@@ -71,18 +71,18 @@ var MediaRight = function (_React$Component) {
|
|
|
71
71
|
|
|
72
72
|
if (align) {
|
|
73
73
|
// The class is e.g. `media-top`, not `media-right-top`.
|
|
74
|
-
classes[(0, _bootstrapUtils.prefix)(_Media2
|
|
74
|
+
classes[(0, _bootstrapUtils.prefix)(_Media2.default.defaultProps, align)] = true;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
return _react2
|
|
78
|
-
className: (0, _classnames2
|
|
77
|
+
return _react2.default.createElement('div', (0, _extends3.default)({}, elementProps, {
|
|
78
|
+
className: (0, _classnames2.default)(className, classes)
|
|
79
79
|
}));
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
return MediaRight;
|
|
83
|
-
}(_react2
|
|
83
|
+
}(_react2.default.Component);
|
|
84
84
|
|
|
85
85
|
MediaRight.propTypes = propTypes;
|
|
86
86
|
|
|
87
|
-
exports
|
|
87
|
+
exports.default = (0, _bootstrapUtils.bsClass)('media-right', MediaRight);
|
|
88
88
|
module.exports = exports['default'];
|
package/lib/MenuItem.js
CHANGED
|
@@ -48,24 +48,24 @@ var _createChainedFunction = require('./utils/createChainedFunction');
|
|
|
48
48
|
|
|
49
49
|
var _createChainedFunction2 = _interopRequireDefault(_createChainedFunction);
|
|
50
50
|
|
|
51
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
51
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
52
52
|
|
|
53
53
|
var propTypes = {
|
|
54
54
|
/**
|
|
55
55
|
* Highlight the menu item as active.
|
|
56
56
|
*/
|
|
57
|
-
active: _propTypes2
|
|
57
|
+
active: _propTypes2.default.bool,
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Disable the menu item, making it unselectable.
|
|
61
61
|
*/
|
|
62
|
-
disabled: _propTypes2
|
|
62
|
+
disabled: _propTypes2.default.bool,
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* Styles the menu item as a horizontal rule, providing visual separation between
|
|
66
66
|
* groups of menu items.
|
|
67
67
|
*/
|
|
68
|
-
divider: (0, _all2
|
|
68
|
+
divider: (0, _all2.default)(_propTypes2.default.bool, function (_ref) {
|
|
69
69
|
var divider = _ref.divider,
|
|
70
70
|
children = _ref.children;
|
|
71
71
|
return divider && children ? new Error('Children will not be rendered for dividers') : null;
|
|
@@ -74,22 +74,22 @@ var propTypes = {
|
|
|
74
74
|
/**
|
|
75
75
|
* Value passed to the `onSelect` handler, useful for identifying the selected menu item.
|
|
76
76
|
*/
|
|
77
|
-
eventKey: _propTypes2
|
|
77
|
+
eventKey: _propTypes2.default.any,
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* Styles the menu item as a header label, useful for describing a group of menu items.
|
|
81
81
|
*/
|
|
82
|
-
header: _propTypes2
|
|
82
|
+
header: _propTypes2.default.bool,
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* HTML `href` attribute corresponding to `a.href`.
|
|
86
86
|
*/
|
|
87
|
-
href: _propTypes2
|
|
87
|
+
href: _propTypes2.default.string,
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
90
|
* Callback fired when the menu item is clicked.
|
|
91
91
|
*/
|
|
92
|
-
onClick: _propTypes2
|
|
92
|
+
onClick: _propTypes2.default.func,
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
95
|
* Callback fired when the menu item is selected.
|
|
@@ -98,7 +98,7 @@ var propTypes = {
|
|
|
98
98
|
* (eventKey: any, event: Object) => any
|
|
99
99
|
* ```
|
|
100
100
|
*/
|
|
101
|
-
onSelect: _propTypes2
|
|
101
|
+
onSelect: _propTypes2.default.func
|
|
102
102
|
};
|
|
103
103
|
|
|
104
104
|
var defaultProps = {
|
|
@@ -108,12 +108,12 @@ var defaultProps = {
|
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
var MenuItem = function (_React$Component) {
|
|
111
|
-
(0, _inherits3
|
|
111
|
+
(0, _inherits3.default)(MenuItem, _React$Component);
|
|
112
112
|
|
|
113
113
|
function MenuItem(props, context) {
|
|
114
|
-
(0, _classCallCheck3
|
|
114
|
+
(0, _classCallCheck3.default)(this, MenuItem);
|
|
115
115
|
|
|
116
|
-
var _this = (0, _possibleConstructorReturn3
|
|
116
|
+
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call(this, props, context));
|
|
117
117
|
|
|
118
118
|
_this.handleClick = _this.handleClick.bind(_this);
|
|
119
119
|
return _this;
|
|
@@ -149,7 +149,7 @@ var MenuItem = function (_React$Component) {
|
|
|
149
149
|
onClick = _props2.onClick,
|
|
150
150
|
className = _props2.className,
|
|
151
151
|
style = _props2.style,
|
|
152
|
-
props = (0, _objectWithoutProperties3
|
|
152
|
+
props = (0, _objectWithoutProperties3.default)(_props2, ['active', 'disabled', 'divider', 'header', 'onClick', 'className', 'style']);
|
|
153
153
|
|
|
154
154
|
var _splitBsPropsAndOmit = (0, _bootstrapUtils.splitBsPropsAndOmit)(props, ['eventKey', 'onSelect']),
|
|
155
155
|
bsProps = _splitBsPropsAndOmit[0],
|
|
@@ -159,41 +159,41 @@ var MenuItem = function (_React$Component) {
|
|
|
159
159
|
// Forcibly blank out the children; separators shouldn't render any.
|
|
160
160
|
elementProps.children = undefined;
|
|
161
161
|
|
|
162
|
-
return _react2
|
|
162
|
+
return _react2.default.createElement('li', (0, _extends3.default)({}, elementProps, {
|
|
163
163
|
role: 'separator',
|
|
164
|
-
className: (0, _classnames2
|
|
164
|
+
className: (0, _classnames2.default)(className, 'divider'),
|
|
165
165
|
style: style
|
|
166
166
|
}));
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
if (header) {
|
|
170
|
-
return _react2
|
|
170
|
+
return _react2.default.createElement('li', (0, _extends3.default)({}, elementProps, {
|
|
171
171
|
role: 'heading',
|
|
172
|
-
className: (0, _classnames2
|
|
172
|
+
className: (0, _classnames2.default)(className, (0, _bootstrapUtils.prefix)(bsProps, 'header')),
|
|
173
173
|
style: style
|
|
174
174
|
}));
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
return _react2
|
|
177
|
+
return _react2.default.createElement(
|
|
178
178
|
'li',
|
|
179
179
|
{
|
|
180
180
|
role: 'presentation',
|
|
181
|
-
className: (0, _classnames2
|
|
181
|
+
className: (0, _classnames2.default)(className, { active: active, disabled: disabled }),
|
|
182
182
|
style: style
|
|
183
183
|
},
|
|
184
|
-
_react2
|
|
184
|
+
_react2.default.createElement(_SafeAnchor2.default, (0, _extends3.default)({}, elementProps, {
|
|
185
185
|
role: 'menuitem',
|
|
186
186
|
tabIndex: '-1',
|
|
187
|
-
onClick: (0, _createChainedFunction2
|
|
187
|
+
onClick: (0, _createChainedFunction2.default)(onClick, this.handleClick)
|
|
188
188
|
}))
|
|
189
189
|
);
|
|
190
190
|
};
|
|
191
191
|
|
|
192
192
|
return MenuItem;
|
|
193
|
-
}(_react2
|
|
193
|
+
}(_react2.default.Component);
|
|
194
194
|
|
|
195
195
|
MenuItem.propTypes = propTypes;
|
|
196
196
|
MenuItem.defaultProps = defaultProps;
|
|
197
197
|
|
|
198
|
-
exports
|
|
198
|
+
exports.default = (0, _bootstrapUtils.bsClass)('dropdown', MenuItem);
|
|
199
199
|
module.exports = exports['default'];
|
package/lib/Modal.js
CHANGED
|
@@ -102,32 +102,38 @@ var _splitComponentProps3 = _interopRequireDefault(_splitComponentProps2);
|
|
|
102
102
|
|
|
103
103
|
var _StyleConfig = require('./utils/StyleConfig');
|
|
104
104
|
|
|
105
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
105
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
106
106
|
|
|
107
|
-
var propTypes = (0, _extends3
|
|
107
|
+
var propTypes = (0, _extends3.default)({}, _Modal2.default.propTypes, _ModalDialog2.default.propTypes, {
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
* Include a backdrop component. Specify 'static' for a backdrop that doesn't
|
|
111
111
|
* trigger an "onHide" when clicked.
|
|
112
112
|
*/
|
|
113
|
-
backdrop: _propTypes2
|
|
113
|
+
backdrop: _propTypes2.default.oneOf(['static', true, false]),
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Add an optional extra class name to .modal-backdrop
|
|
117
|
+
* It could end up looking like class="modal-backdrop foo-modal-backdrop in".
|
|
118
|
+
*/
|
|
119
|
+
backdropClassName: _propTypes2.default.string,
|
|
114
120
|
|
|
115
121
|
/**
|
|
116
122
|
* Close the modal when escape key is pressed
|
|
117
123
|
*/
|
|
118
|
-
keyboard: _propTypes2
|
|
124
|
+
keyboard: _propTypes2.default.bool,
|
|
119
125
|
|
|
120
126
|
/**
|
|
121
127
|
* Open and close the Modal with a slide and fade animation.
|
|
122
128
|
*/
|
|
123
|
-
animation: _propTypes2
|
|
129
|
+
animation: _propTypes2.default.bool,
|
|
124
130
|
|
|
125
131
|
/**
|
|
126
132
|
* A Component type that provides the modal content Markup. This is a useful
|
|
127
133
|
* prop when you want to use your own styles and markup to create a custom
|
|
128
134
|
* modal component.
|
|
129
135
|
*/
|
|
130
|
-
dialogComponentClass: _elementType2
|
|
136
|
+
dialogComponentClass: _elementType2.default,
|
|
131
137
|
|
|
132
138
|
/**
|
|
133
139
|
* When `true` The modal will automatically shift focus to itself when it
|
|
@@ -135,91 +141,92 @@ var propTypes = (0, _extends3['default'])({}, _Modal2['default'].propTypes, _Mod
|
|
|
135
141
|
* Generally this should never be set to false as it makes the Modal less
|
|
136
142
|
* accessible to assistive technologies, like screen-readers.
|
|
137
143
|
*/
|
|
138
|
-
autoFocus: _propTypes2
|
|
144
|
+
autoFocus: _propTypes2.default.bool,
|
|
139
145
|
|
|
140
146
|
/**
|
|
141
147
|
* When `true` The modal will prevent focus from leaving the Modal while
|
|
142
148
|
* open. Consider leaving the default value here, as it is necessary to make
|
|
143
149
|
* the Modal work well with assistive technologies, such as screen readers.
|
|
144
150
|
*/
|
|
145
|
-
enforceFocus: _propTypes2
|
|
151
|
+
enforceFocus: _propTypes2.default.bool,
|
|
146
152
|
|
|
147
153
|
/**
|
|
148
154
|
* When `true` The modal will restore focus to previously focused element once
|
|
149
155
|
* modal is hidden
|
|
150
156
|
*/
|
|
151
|
-
restoreFocus: _propTypes2
|
|
157
|
+
restoreFocus: _propTypes2.default.bool,
|
|
152
158
|
|
|
153
159
|
/**
|
|
154
160
|
* When `true` The modal will show itself.
|
|
155
161
|
*/
|
|
156
|
-
show: _propTypes2
|
|
162
|
+
show: _propTypes2.default.bool,
|
|
157
163
|
|
|
158
164
|
/**
|
|
159
165
|
* A callback fired when the header closeButton or non-static backdrop is
|
|
160
166
|
* clicked. Required if either are specified.
|
|
161
167
|
*/
|
|
162
|
-
onHide: _propTypes2
|
|
168
|
+
onHide: _propTypes2.default.func,
|
|
163
169
|
|
|
164
170
|
/**
|
|
165
171
|
* Callback fired before the Modal transitions in
|
|
166
172
|
*/
|
|
167
|
-
onEnter: _propTypes2
|
|
173
|
+
onEnter: _propTypes2.default.func,
|
|
168
174
|
|
|
169
175
|
/**
|
|
170
176
|
* Callback fired as the Modal begins to transition in
|
|
171
177
|
*/
|
|
172
|
-
onEntering: _propTypes2
|
|
178
|
+
onEntering: _propTypes2.default.func,
|
|
173
179
|
|
|
174
180
|
/**
|
|
175
181
|
* Callback fired after the Modal finishes transitioning in
|
|
176
182
|
*/
|
|
177
|
-
onEntered: _propTypes2
|
|
183
|
+
onEntered: _propTypes2.default.func,
|
|
178
184
|
|
|
179
185
|
/**
|
|
180
186
|
* Callback fired right before the Modal transitions out
|
|
181
187
|
*/
|
|
182
|
-
onExit: _propTypes2
|
|
188
|
+
onExit: _propTypes2.default.func,
|
|
183
189
|
|
|
184
190
|
/**
|
|
185
191
|
* Callback fired as the Modal begins to transition out
|
|
186
192
|
*/
|
|
187
|
-
onExiting: _propTypes2
|
|
193
|
+
onExiting: _propTypes2.default.func,
|
|
188
194
|
|
|
189
195
|
/**
|
|
190
196
|
* Callback fired after the Modal finishes transitioning out
|
|
191
197
|
*/
|
|
192
|
-
onExited: _propTypes2
|
|
198
|
+
onExited: _propTypes2.default.func,
|
|
193
199
|
|
|
194
200
|
/**
|
|
195
201
|
* @private
|
|
196
202
|
*/
|
|
197
|
-
container: _Modal2
|
|
203
|
+
container: _Modal2.default.propTypes.container
|
|
198
204
|
});
|
|
199
205
|
|
|
200
|
-
var defaultProps = (0, _extends3
|
|
206
|
+
var defaultProps = (0, _extends3.default)({}, _Modal2.default.defaultProps, {
|
|
201
207
|
animation: true,
|
|
202
|
-
dialogComponentClass: _ModalDialog2
|
|
208
|
+
dialogComponentClass: _ModalDialog2.default
|
|
203
209
|
});
|
|
204
210
|
|
|
205
211
|
var childContextTypes = {
|
|
206
|
-
$bs_modal: _propTypes2
|
|
207
|
-
onHide: _propTypes2
|
|
212
|
+
$bs_modal: _propTypes2.default.shape({
|
|
213
|
+
onHide: _propTypes2.default.func
|
|
208
214
|
})
|
|
209
215
|
};
|
|
210
216
|
|
|
211
217
|
var Modal = function (_React$Component) {
|
|
212
|
-
(0, _inherits3
|
|
218
|
+
(0, _inherits3.default)(Modal, _React$Component);
|
|
213
219
|
|
|
214
220
|
function Modal(props, context) {
|
|
215
|
-
(0, _classCallCheck3
|
|
221
|
+
(0, _classCallCheck3.default)(this, Modal);
|
|
216
222
|
|
|
217
|
-
var _this = (0, _possibleConstructorReturn3
|
|
223
|
+
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call(this, props, context));
|
|
218
224
|
|
|
219
225
|
_this.handleEntering = _this.handleEntering.bind(_this);
|
|
220
226
|
_this.handleExited = _this.handleExited.bind(_this);
|
|
221
227
|
_this.handleWindowResize = _this.handleWindowResize.bind(_this);
|
|
222
228
|
_this.handleDialogClick = _this.handleDialogClick.bind(_this);
|
|
229
|
+
_this.setModalRef = _this.setModalRef.bind(_this);
|
|
223
230
|
|
|
224
231
|
_this.state = {
|
|
225
232
|
style: {}
|
|
@@ -240,54 +247,57 @@ var Modal = function (_React$Component) {
|
|
|
240
247
|
this.handleExited();
|
|
241
248
|
};
|
|
242
249
|
|
|
250
|
+
Modal.prototype.setModalRef = function setModalRef(ref) {
|
|
251
|
+
this._modal = ref;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
Modal.prototype.handleDialogClick = function handleDialogClick(e) {
|
|
255
|
+
if (e.target !== e.currentTarget) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
this.props.onHide();
|
|
260
|
+
};
|
|
261
|
+
|
|
243
262
|
Modal.prototype.handleEntering = function handleEntering() {
|
|
244
263
|
// FIXME: This should work even when animation is disabled.
|
|
245
|
-
_events2
|
|
264
|
+
_events2.default.on(window, 'resize', this.handleWindowResize);
|
|
246
265
|
this.updateStyle();
|
|
247
266
|
};
|
|
248
267
|
|
|
249
268
|
Modal.prototype.handleExited = function handleExited() {
|
|
250
269
|
// FIXME: This should work even when animation is disabled.
|
|
251
|
-
_events2
|
|
270
|
+
_events2.default.off(window, 'resize', this.handleWindowResize);
|
|
252
271
|
};
|
|
253
272
|
|
|
254
273
|
Modal.prototype.handleWindowResize = function handleWindowResize() {
|
|
255
274
|
this.updateStyle();
|
|
256
275
|
};
|
|
257
276
|
|
|
258
|
-
Modal.prototype.handleDialogClick = function handleDialogClick(e) {
|
|
259
|
-
if (e.target !== e.currentTarget) {
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
this.props.onHide();
|
|
264
|
-
};
|
|
265
|
-
|
|
266
277
|
Modal.prototype.updateStyle = function updateStyle() {
|
|
267
|
-
if (!_inDOM2
|
|
278
|
+
if (!_inDOM2.default) {
|
|
268
279
|
return;
|
|
269
280
|
}
|
|
270
281
|
|
|
271
282
|
var dialogNode = this._modal.getDialogElement();
|
|
272
283
|
var dialogHeight = dialogNode.scrollHeight;
|
|
273
284
|
|
|
274
|
-
var document = (0, _ownerDocument2
|
|
275
|
-
var bodyIsOverflowing = (0, _isOverflowing2
|
|
285
|
+
var document = (0, _ownerDocument2.default)(dialogNode);
|
|
286
|
+
var bodyIsOverflowing = (0, _isOverflowing2.default)(_reactDom2.default.findDOMNode(this.props.container || document.body));
|
|
276
287
|
var modalIsOverflowing = dialogHeight > document.documentElement.clientHeight;
|
|
277
288
|
|
|
278
289
|
this.setState({
|
|
279
290
|
style: {
|
|
280
|
-
paddingRight: bodyIsOverflowing && !modalIsOverflowing ? (0, _scrollbarSize2
|
|
281
|
-
paddingLeft: !bodyIsOverflowing && modalIsOverflowing ? (0, _scrollbarSize2
|
|
291
|
+
paddingRight: bodyIsOverflowing && !modalIsOverflowing ? (0, _scrollbarSize2.default)() : undefined,
|
|
292
|
+
paddingLeft: !bodyIsOverflowing && modalIsOverflowing ? (0, _scrollbarSize2.default)() : undefined
|
|
282
293
|
}
|
|
283
294
|
});
|
|
284
295
|
};
|
|
285
296
|
|
|
286
297
|
Modal.prototype.render = function render() {
|
|
287
|
-
var _this2 = this;
|
|
288
|
-
|
|
289
298
|
var _props = this.props,
|
|
290
299
|
backdrop = _props.backdrop,
|
|
300
|
+
backdropClassName = _props.backdropClassName,
|
|
291
301
|
animation = _props.animation,
|
|
292
302
|
show = _props.show,
|
|
293
303
|
Dialog = _props.dialogComponentClass,
|
|
@@ -296,35 +306,33 @@ var Modal = function (_React$Component) {
|
|
|
296
306
|
children = _props.children,
|
|
297
307
|
onEntering = _props.onEntering,
|
|
298
308
|
onExited = _props.onExited,
|
|
299
|
-
props = (0, _objectWithoutProperties3
|
|
309
|
+
props = (0, _objectWithoutProperties3.default)(_props, ['backdrop', 'backdropClassName', 'animation', 'show', 'dialogComponentClass', 'className', 'style', 'children', 'onEntering', 'onExited']);
|
|
300
310
|
|
|
301
|
-
var _splitComponentProps = (0, _splitComponentProps3
|
|
311
|
+
var _splitComponentProps = (0, _splitComponentProps3.default)(props, _Modal2.default),
|
|
302
312
|
baseModalProps = _splitComponentProps[0],
|
|
303
313
|
dialogProps = _splitComponentProps[1];
|
|
304
314
|
|
|
305
315
|
var inClassName = show && !animation && 'in';
|
|
306
316
|
|
|
307
|
-
return _react2
|
|
308
|
-
_Modal2
|
|
309
|
-
(0, _extends3
|
|
310
|
-
ref:
|
|
311
|
-
_this2._modal = c;
|
|
312
|
-
},
|
|
317
|
+
return _react2.default.createElement(
|
|
318
|
+
_Modal2.default,
|
|
319
|
+
(0, _extends3.default)({}, baseModalProps, {
|
|
320
|
+
ref: this.setModalRef,
|
|
313
321
|
show: show,
|
|
314
|
-
onEntering: (0, _createChainedFunction2
|
|
315
|
-
onExited: (0, _createChainedFunction2
|
|
322
|
+
onEntering: (0, _createChainedFunction2.default)(onEntering, this.handleEntering),
|
|
323
|
+
onExited: (0, _createChainedFunction2.default)(onExited, this.handleExited),
|
|
316
324
|
backdrop: backdrop,
|
|
317
|
-
backdropClassName: (0, _classnames2
|
|
325
|
+
backdropClassName: (0, _classnames2.default)((0, _bootstrapUtils.prefix)(props, 'backdrop'), backdropClassName, inClassName),
|
|
318
326
|
containerClassName: (0, _bootstrapUtils.prefix)(props, 'open'),
|
|
319
|
-
transition: animation ? _Fade2
|
|
327
|
+
transition: animation ? _Fade2.default : undefined,
|
|
320
328
|
dialogTransitionTimeout: Modal.TRANSITION_DURATION,
|
|
321
329
|
backdropTransitionTimeout: Modal.BACKDROP_TRANSITION_DURATION
|
|
322
330
|
}),
|
|
323
|
-
_react2
|
|
331
|
+
_react2.default.createElement(
|
|
324
332
|
Dialog,
|
|
325
|
-
(0, _extends3
|
|
326
|
-
style: (0, _extends3
|
|
327
|
-
className: (0, _classnames2
|
|
333
|
+
(0, _extends3.default)({}, dialogProps, {
|
|
334
|
+
style: (0, _extends3.default)({}, this.state.style, style),
|
|
335
|
+
className: (0, _classnames2.default)(className, inClassName),
|
|
328
336
|
onClick: backdrop === true ? this.handleDialogClick : null
|
|
329
337
|
}),
|
|
330
338
|
children
|
|
@@ -333,21 +341,21 @@ var Modal = function (_React$Component) {
|
|
|
333
341
|
};
|
|
334
342
|
|
|
335
343
|
return Modal;
|
|
336
|
-
}(_react2
|
|
344
|
+
}(_react2.default.Component);
|
|
337
345
|
|
|
338
346
|
Modal.propTypes = propTypes;
|
|
339
347
|
Modal.defaultProps = defaultProps;
|
|
340
348
|
Modal.childContextTypes = childContextTypes;
|
|
341
349
|
|
|
342
|
-
Modal.Body = _ModalBody2
|
|
343
|
-
Modal.Header = _ModalHeader2
|
|
344
|
-
Modal.Title = _ModalTitle2
|
|
345
|
-
Modal.Footer = _ModalFooter2
|
|
350
|
+
Modal.Body = _ModalBody2.default;
|
|
351
|
+
Modal.Header = _ModalHeader2.default;
|
|
352
|
+
Modal.Title = _ModalTitle2.default;
|
|
353
|
+
Modal.Footer = _ModalFooter2.default;
|
|
346
354
|
|
|
347
|
-
Modal.Dialog = _ModalDialog2
|
|
355
|
+
Modal.Dialog = _ModalDialog2.default;
|
|
348
356
|
|
|
349
357
|
Modal.TRANSITION_DURATION = 300;
|
|
350
358
|
Modal.BACKDROP_TRANSITION_DURATION = 150;
|
|
351
359
|
|
|
352
|
-
exports
|
|
360
|
+
exports.default = (0, _bootstrapUtils.bsClass)('modal', (0, _bootstrapUtils.bsSizes)([_StyleConfig.Size.LARGE, _StyleConfig.Size.SMALL], Modal));
|
|
353
361
|
module.exports = exports['default'];
|
package/lib/ModalBody.js
CHANGED
|
@@ -36,10 +36,10 @@ var _elementType2 = _interopRequireDefault(_elementType);
|
|
|
36
36
|
|
|
37
37
|
var _bootstrapUtils = require('./utils/bootstrapUtils');
|
|
38
38
|
|
|
39
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
39
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
40
40
|
|
|
41
41
|
var propTypes = {
|
|
42
|
-
componentClass: _elementType2
|
|
42
|
+
componentClass: _elementType2.default
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
var defaultProps = {
|
|
@@ -47,18 +47,18 @@ var defaultProps = {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
var ModalBody = function (_React$Component) {
|
|
50
|
-
(0, _inherits3
|
|
50
|
+
(0, _inherits3.default)(ModalBody, _React$Component);
|
|
51
51
|
|
|
52
52
|
function ModalBody() {
|
|
53
|
-
(0, _classCallCheck3
|
|
54
|
-
return (0, _possibleConstructorReturn3
|
|
53
|
+
(0, _classCallCheck3.default)(this, ModalBody);
|
|
54
|
+
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
ModalBody.prototype.render = function render() {
|
|
58
58
|
var _props = this.props,
|
|
59
59
|
Component = _props.componentClass,
|
|
60
60
|
className = _props.className,
|
|
61
|
-
props = (0, _objectWithoutProperties3
|
|
61
|
+
props = (0, _objectWithoutProperties3.default)(_props, ['componentClass', 'className']);
|
|
62
62
|
|
|
63
63
|
var _splitBsProps = (0, _bootstrapUtils.splitBsProps)(props),
|
|
64
64
|
bsProps = _splitBsProps[0],
|
|
@@ -66,16 +66,16 @@ var ModalBody = function (_React$Component) {
|
|
|
66
66
|
|
|
67
67
|
var classes = (0, _bootstrapUtils.getClassSet)(bsProps);
|
|
68
68
|
|
|
69
|
-
return _react2
|
|
70
|
-
className: (0, _classnames2
|
|
69
|
+
return _react2.default.createElement(Component, (0, _extends3.default)({}, elementProps, {
|
|
70
|
+
className: (0, _classnames2.default)(className, classes)
|
|
71
71
|
}));
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
return ModalBody;
|
|
75
|
-
}(_react2
|
|
75
|
+
}(_react2.default.Component);
|
|
76
76
|
|
|
77
77
|
ModalBody.propTypes = propTypes;
|
|
78
78
|
ModalBody.defaultProps = defaultProps;
|
|
79
79
|
|
|
80
|
-
exports
|
|
80
|
+
exports.default = (0, _bootstrapUtils.bsClass)('modal-body', ModalBody);
|
|
81
81
|
module.exports = exports['default'];
|