react-bootstrap 0.32.0 → 0.32.4
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 +38 -0
- package/README.md +11 -7
- package/dist/react-bootstrap.js +13464 -13723
- package/dist/react-bootstrap.min.js +10 -18464
- package/es/Accordion.js +13 -16
- package/es/Alert.js +26 -31
- package/es/Badge.js +21 -31
- package/es/Breadcrumb.js +17 -20
- package/es/BreadcrumbItem.js +30 -30
- package/es/Button.js +23 -27
- package/es/ButtonGroup.js +20 -22
- package/es/ButtonToolbar.js +16 -18
- package/es/Carousel.js +120 -157
- package/es/CarouselCaption.js +18 -21
- package/es/CarouselItem.js +34 -33
- package/es/Checkbox.js +43 -54
- package/es/Clearfix.js +24 -24
- package/es/CloseButton.js +21 -30
- package/es/Col.js +42 -26
- package/es/Collapse.js +68 -68
- package/es/ControlLabel.js +19 -24
- package/es/Dropdown.js +93 -91
- package/es/DropdownButton.js +25 -35
- package/es/DropdownMenu.js +65 -65
- package/es/DropdownToggle.js +28 -40
- package/es/Fade.js +26 -29
- package/es/Form.js +22 -22
- package/es/FormControl.js +32 -33
- package/es/FormControlFeedback.js +21 -21
- package/es/FormControlStatic.js +18 -21
- package/es/FormGroup.js +27 -34
- package/es/Glyphicon.js +18 -19
- package/es/Grid.js +20 -22
- package/es/HelpBlock.js +17 -17
- package/es/Image.js +19 -24
- package/es/InputGroup.js +17 -18
- package/es/InputGroupAddon.js +17 -17
- package/es/InputGroupButton.js +17 -17
- package/es/Jumbotron.js +18 -21
- package/es/Label.js +21 -27
- package/es/ListGroup.js +24 -29
- package/es/ListGroupItem.js +30 -48
- package/es/Media.js +18 -22
- package/es/MediaBody.js +19 -22
- package/es/MediaHeading.js +18 -21
- package/es/MediaLeft.js +18 -19
- package/es/MediaList.js +17 -17
- package/es/MediaListItem.js +17 -17
- package/es/MediaRight.js +18 -19
- package/es/MenuItem.js +44 -49
- package/es/Modal.js +63 -74
- package/es/ModalBody.js +18 -21
- package/es/ModalDialog.js +31 -39
- package/es/ModalFooter.js +18 -21
- package/es/ModalHeader.js +25 -35
- package/es/ModalTitle.js +18 -21
- package/es/Nav.js +73 -92
- package/es/NavDropdown.js +40 -52
- package/es/NavItem.js +34 -38
- package/es/Navbar.js +62 -73
- package/es/NavbarBrand.js +20 -24
- package/es/NavbarCollapse.js +21 -28
- package/es/NavbarHeader.js +19 -20
- package/es/NavbarToggle.js +30 -38
- package/es/Overlay.js +21 -25
- package/es/OverlayTrigger.js +71 -68
- package/es/PageHeader.js +18 -26
- package/es/PageItem.js +0 -1
- package/es/Pager.js +23 -30
- package/es/PagerItem.js +36 -40
- package/es/Pagination.js +18 -24
- package/es/PaginationItem.js +47 -57
- package/es/Panel.js +51 -54
- package/es/PanelBody.js +18 -29
- package/es/PanelCollapse.js +20 -23
- package/es/PanelFooter.js +16 -23
- package/es/PanelGroup.js +44 -45
- package/es/PanelHeading.js +19 -28
- package/es/PanelTitle.js +22 -34
- package/es/PanelToggle.js +21 -24
- package/es/Popover.js +36 -46
- package/es/ProgressBar.js +59 -62
- package/es/Radio.js +43 -54
- package/es/ResponsiveEmbed.js +27 -32
- package/es/Row.js +18 -21
- package/es/SafeAnchor.js +32 -32
- package/es/SplitButton.js +33 -46
- package/es/SplitToggle.js +14 -13
- package/es/Tab.js +12 -18
- package/es/TabContainer.js +24 -30
- package/es/TabContent.js +36 -43
- package/es/TabPane.js +58 -68
- package/es/Table.js +25 -29
- package/es/Tabs.js +56 -71
- package/es/Thumbnail.js +34 -34
- package/es/ToggleButton.js +32 -37
- package/es/ToggleButtonGroup.js +45 -57
- package/es/Tooltip.js +33 -40
- package/es/Well.js +17 -17
- package/es/index.js +2 -0
- package/es/utils/PropTypes.js +13 -19
- package/es/utils/StyleConfig.js +0 -4
- package/es/utils/ValidComponentChildren.js +11 -20
- package/es/utils/bootstrapUtils.js +17 -31
- package/es/utils/createChainedFunction.js +2 -2
- package/es/utils/deprecationWarning.js +28 -30
- package/es/utils/splitComponentProps.js +1 -2
- package/lib/Accordion.js +23 -36
- package/lib/Alert.js +43 -65
- package/lib/Badge.js +36 -56
- package/lib/Breadcrumb.js +32 -47
- package/lib/BreadcrumbItem.js +48 -63
- package/lib/Button.js +49 -71
- package/lib/ButtonGroup.js +39 -57
- package/lib/ButtonToolbar.js +29 -42
- package/lib/Carousel.js +161 -214
- package/lib/CarouselCaption.js +32 -46
- package/lib/CarouselItem.js +54 -73
- package/lib/Checkbox.js +64 -87
- package/lib/Clearfix.js +45 -58
- package/lib/CloseButton.js +33 -50
- package/lib/Col.js +78 -73
- package/lib/Collapse.js +104 -125
- package/lib/ControlLabel.js +38 -59
- package/lib/Dropdown.js +153 -192
- package/lib/DropdownButton.js +44 -70
- package/lib/DropdownMenu.js +96 -120
- package/lib/DropdownToggle.js +48 -77
- package/lib/Fade.js +49 -68
- package/lib/Form.js +39 -52
- package/lib/FormControl.js +58 -79
- package/lib/FormControlFeedback.js +42 -54
- package/lib/FormControlStatic.js +32 -46
- package/lib/FormGroup.js +47 -67
- package/lib/Glyphicon.js +33 -46
- package/lib/Grid.js +36 -51
- package/lib/HelpBlock.js +29 -40
- package/lib/Image.js +37 -53
- package/lib/InputGroup.js +34 -49
- package/lib/InputGroupAddon.js +29 -40
- package/lib/InputGroupButton.js +29 -40
- package/lib/Jumbotron.js +32 -46
- package/lib/Label.js +35 -53
- package/lib/ListGroup.js +45 -61
- package/lib/ListGroupItem.js +55 -85
- package/lib/Media.js +43 -70
- package/lib/MediaBody.js +37 -55
- package/lib/MediaHeading.js +32 -46
- package/lib/MediaLeft.js +34 -48
- package/lib/MediaList.js +29 -40
- package/lib/MediaListItem.js +29 -40
- package/lib/MediaRight.js +34 -48
- package/lib/MenuItem.js +70 -92
- package/lib/Modal.js +130 -186
- package/lib/ModalBody.js +32 -46
- package/lib/ModalDialog.js +47 -69
- package/lib/ModalFooter.js +32 -46
- package/lib/ModalHeader.js +43 -70
- package/lib/ModalTitle.js +32 -46
- package/lib/Nav.js +122 -160
- package/lib/NavDropdown.js +63 -97
- package/lib/NavItem.js +54 -77
- package/lib/Navbar.js +115 -152
- package/lib/NavbarBrand.js +37 -55
- package/lib/NavbarCollapse.js +36 -57
- package/lib/NavbarHeader.js +33 -48
- package/lib/NavbarToggle.js +52 -77
- package/lib/Overlay.js +50 -75
- package/lib/OverlayTrigger.js +114 -129
- package/lib/PageHeader.js +30 -49
- package/lib/PageItem.js +9 -10
- package/lib/Pager.js +41 -63
- package/lib/PagerItem.js +55 -78
- package/lib/Pagination.js +32 -50
- package/lib/PaginationItem.js +67 -91
- package/lib/Panel.js +93 -127
- package/lib/PanelBody.js +35 -57
- package/lib/PanelCollapse.js +44 -56
- package/lib/PanelFooter.js +31 -48
- package/lib/PanelGroup.js +73 -88
- package/lib/PanelHeading.js +37 -59
- package/lib/PanelTitle.js +41 -68
- package/lib/PanelToggle.js +45 -66
- package/lib/Popover.js +59 -84
- package/lib/ProgressBar.js +86 -103
- package/lib/Radio.js +64 -87
- package/lib/ResponsiveEmbed.js +45 -63
- package/lib/Row.js +32 -46
- package/lib/SafeAnchor.js +53 -69
- package/lib/SplitButton.js +57 -90
- package/lib/SplitToggle.js +25 -34
- package/lib/Tab.js +32 -55
- package/lib/TabContainer.js +45 -61
- package/lib/TabContent.js +67 -87
- package/lib/TabPane.js +103 -131
- package/lib/Table.js +44 -59
- package/lib/Tabs.js +82 -119
- package/lib/Thumbnail.js +55 -67
- package/lib/ToggleButton.js +49 -68
- package/lib/ToggleButtonGroup.js +67 -104
- package/lib/Tooltip.js +55 -77
- package/lib/Well.js +30 -41
- package/lib/index.js +147 -214
- package/lib/utils/PropTypes.js +24 -31
- package/lib/utils/StyleConfig.js +13 -11
- package/lib/utils/ValidComponentChildren.js +34 -29
- package/lib/utils/bootstrapUtils.js +41 -52
- package/lib/utils/capitalize.js +2 -0
- package/lib/utils/createChainedFunction.js +8 -5
- package/lib/utils/deprecationWarning.js +37 -47
- package/lib/utils/index.js +11 -15
- package/lib/utils/splitComponentProps.js +5 -10
- package/package.json +58 -50
package/es/Dropdown.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import _extends from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import _inherits from 'babel-runtime/helpers/inherits';
|
|
1
|
+
import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime-corejs2/helpers/esm/assertThisInitialized";
|
|
6
5
|
import classNames from 'classnames';
|
|
7
6
|
import activeElement from 'dom-helpers/activeElement';
|
|
8
7
|
import contains from 'dom-helpers/query/contains';
|
|
@@ -15,7 +14,6 @@ import elementType from 'prop-types-extra/lib/elementType';
|
|
|
15
14
|
import isRequiredForA11y from 'prop-types-extra/lib/isRequiredForA11y';
|
|
16
15
|
import uncontrollable from 'uncontrollable';
|
|
17
16
|
import warning from 'warning';
|
|
18
|
-
|
|
19
17
|
import ButtonGroup from './ButtonGroup';
|
|
20
18
|
import DropdownMenu from './DropdownMenu';
|
|
21
19
|
import DropdownToggle from './DropdownToggle';
|
|
@@ -23,10 +21,8 @@ import { bsClass as setBsClass, prefix } from './utils/bootstrapUtils';
|
|
|
23
21
|
import createChainedFunction from './utils/createChainedFunction';
|
|
24
22
|
import { exclusiveRoles, requiredRoles } from './utils/PropTypes';
|
|
25
23
|
import ValidComponentChildren from './utils/ValidComponentChildren';
|
|
26
|
-
|
|
27
24
|
var TOGGLE_ROLE = DropdownToggle.defaultProps.bsRole;
|
|
28
25
|
var MENU_ROLE = DropdownMenu.defaultProps.bsRole;
|
|
29
|
-
|
|
30
26
|
var propTypes = {
|
|
31
27
|
/**
|
|
32
28
|
* The menu will open above the dropdown button, instead of below it.
|
|
@@ -39,7 +35,6 @@ var propTypes = {
|
|
|
39
35
|
* @required
|
|
40
36
|
*/
|
|
41
37
|
id: isRequiredForA11y(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
|
|
42
|
-
|
|
43
38
|
componentClass: elementType,
|
|
44
39
|
|
|
45
40
|
/**
|
|
@@ -64,7 +59,6 @@ var propTypes = {
|
|
|
64
59
|
* @controllable onToggle
|
|
65
60
|
*/
|
|
66
61
|
open: PropTypes.bool,
|
|
67
|
-
|
|
68
62
|
defaultOpen: PropTypes.bool,
|
|
69
63
|
|
|
70
64
|
/**
|
|
@@ -106,46 +100,47 @@ var propTypes = {
|
|
|
106
100
|
* @private
|
|
107
101
|
*/
|
|
108
102
|
onMouseEnter: PropTypes.func,
|
|
103
|
+
|
|
109
104
|
/**
|
|
110
105
|
* @private
|
|
111
106
|
*/
|
|
112
107
|
onMouseLeave: PropTypes.func
|
|
113
108
|
};
|
|
114
|
-
|
|
115
109
|
var defaultProps = {
|
|
116
110
|
componentClass: ButtonGroup
|
|
117
111
|
};
|
|
118
112
|
|
|
119
|
-
var Dropdown =
|
|
120
|
-
|
|
113
|
+
var Dropdown =
|
|
114
|
+
/*#__PURE__*/
|
|
115
|
+
function (_React$Component) {
|
|
116
|
+
_inheritsLoose(Dropdown, _React$Component);
|
|
121
117
|
|
|
122
118
|
function Dropdown(props, context) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context));
|
|
126
|
-
|
|
127
|
-
_this.handleClick = _this.handleClick.bind(_this);
|
|
128
|
-
_this.handleKeyDown = _this.handleKeyDown.bind(_this);
|
|
129
|
-
_this.handleClose = _this.handleClose.bind(_this);
|
|
119
|
+
var _this;
|
|
130
120
|
|
|
121
|
+
_this = _React$Component.call(this, props, context) || this;
|
|
122
|
+
_this.handleClick = _this.handleClick.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
123
|
+
_this.handleKeyDown = _this.handleKeyDown.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
124
|
+
_this.handleClose = _this.handleClose.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
131
125
|
_this._focusInDropdown = false;
|
|
132
126
|
_this.lastOpenEventType = null;
|
|
133
127
|
return _this;
|
|
134
128
|
}
|
|
135
129
|
|
|
136
|
-
Dropdown.prototype
|
|
130
|
+
var _proto = Dropdown.prototype;
|
|
131
|
+
|
|
132
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
137
133
|
this.focusNextOnOpen();
|
|
138
134
|
};
|
|
139
135
|
|
|
140
|
-
|
|
136
|
+
_proto.componentWillUpdate = function componentWillUpdate(nextProps) {
|
|
141
137
|
if (!nextProps.open && this.props.open) {
|
|
142
138
|
this._focusInDropdown = contains(ReactDOM.findDOMNode(this.menu), activeElement(document));
|
|
143
139
|
}
|
|
144
140
|
};
|
|
145
141
|
|
|
146
|
-
|
|
142
|
+
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
147
143
|
var open = this.props.open;
|
|
148
|
-
|
|
149
144
|
var prevOpen = prevProps.open;
|
|
150
145
|
|
|
151
146
|
if (open && !prevOpen) {
|
|
@@ -162,7 +157,7 @@ var Dropdown = function (_React$Component) {
|
|
|
162
157
|
}
|
|
163
158
|
};
|
|
164
159
|
|
|
165
|
-
|
|
160
|
+
_proto.focus = function focus() {
|
|
166
161
|
var toggle = ReactDOM.findDOMNode(this.toggle);
|
|
167
162
|
|
|
168
163
|
if (toggle && toggle.focus) {
|
|
@@ -170,10 +165,10 @@ var Dropdown = function (_React$Component) {
|
|
|
170
165
|
}
|
|
171
166
|
};
|
|
172
167
|
|
|
173
|
-
|
|
168
|
+
_proto.focusNextOnOpen = function focusNextOnOpen() {
|
|
174
169
|
var menu = this.menu;
|
|
175
170
|
|
|
176
|
-
if (!menu.focusNext) {
|
|
171
|
+
if (!menu || !menu.focusNext) {
|
|
177
172
|
return;
|
|
178
173
|
}
|
|
179
174
|
|
|
@@ -182,15 +177,17 @@ var Dropdown = function (_React$Component) {
|
|
|
182
177
|
}
|
|
183
178
|
};
|
|
184
179
|
|
|
185
|
-
|
|
180
|
+
_proto.handleClick = function handleClick(event) {
|
|
186
181
|
if (this.props.disabled) {
|
|
187
182
|
return;
|
|
188
183
|
}
|
|
189
184
|
|
|
190
|
-
this.toggleOpen(event, {
|
|
185
|
+
this.toggleOpen(event, {
|
|
186
|
+
source: 'click'
|
|
187
|
+
});
|
|
191
188
|
};
|
|
192
189
|
|
|
193
|
-
|
|
190
|
+
_proto.handleClose = function handleClose(event, eventDetails) {
|
|
194
191
|
if (!this.props.open) {
|
|
195
192
|
return;
|
|
196
193
|
}
|
|
@@ -198,7 +195,7 @@ var Dropdown = function (_React$Component) {
|
|
|
198
195
|
this.toggleOpen(event, eventDetails);
|
|
199
196
|
};
|
|
200
197
|
|
|
201
|
-
|
|
198
|
+
_proto.handleKeyDown = function handleKeyDown(event) {
|
|
202
199
|
if (this.props.disabled) {
|
|
203
200
|
return;
|
|
204
201
|
}
|
|
@@ -206,21 +203,28 @@ var Dropdown = function (_React$Component) {
|
|
|
206
203
|
switch (event.keyCode) {
|
|
207
204
|
case keycode.codes.down:
|
|
208
205
|
if (!this.props.open) {
|
|
209
|
-
this.toggleOpen(event, {
|
|
206
|
+
this.toggleOpen(event, {
|
|
207
|
+
source: 'keydown'
|
|
208
|
+
});
|
|
210
209
|
} else if (this.menu.focusNext) {
|
|
211
210
|
this.menu.focusNext();
|
|
212
211
|
}
|
|
212
|
+
|
|
213
213
|
event.preventDefault();
|
|
214
214
|
break;
|
|
215
|
+
|
|
215
216
|
case keycode.codes.esc:
|
|
216
217
|
case keycode.codes.tab:
|
|
217
|
-
this.handleClose(event, {
|
|
218
|
+
this.handleClose(event, {
|
|
219
|
+
source: 'keydown'
|
|
220
|
+
});
|
|
218
221
|
break;
|
|
222
|
+
|
|
219
223
|
default:
|
|
220
224
|
}
|
|
221
225
|
};
|
|
222
226
|
|
|
223
|
-
|
|
227
|
+
_proto.toggleOpen = function toggleOpen(event, eventDetails) {
|
|
224
228
|
var open = !this.props.open;
|
|
225
229
|
|
|
226
230
|
if (open) {
|
|
@@ -232,20 +236,20 @@ var Dropdown = function (_React$Component) {
|
|
|
232
236
|
}
|
|
233
237
|
};
|
|
234
238
|
|
|
235
|
-
|
|
239
|
+
_proto.renderMenu = function renderMenu(child, _ref) {
|
|
236
240
|
var _this2 = this;
|
|
237
241
|
|
|
238
242
|
var id = _ref.id,
|
|
239
243
|
onSelect = _ref.onSelect,
|
|
240
244
|
rootCloseEvent = _ref.rootCloseEvent,
|
|
241
|
-
props =
|
|
245
|
+
props = _objectWithoutPropertiesLoose(_ref, ["id", "onSelect", "rootCloseEvent"]);
|
|
242
246
|
|
|
243
247
|
var ref = function ref(c) {
|
|
244
248
|
_this2.menu = c;
|
|
245
249
|
};
|
|
246
250
|
|
|
247
251
|
if (typeof child.ref === 'string') {
|
|
248
|
-
process.env.NODE_ENV !==
|
|
252
|
+
process.env.NODE_ENV !== "production" ? warning(false, 'String refs are not supported on `<Dropdown.Menu>` components. ' + 'To apply a ref to the component use the callback signature:\n\n ' + 'https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute') : void 0;
|
|
249
253
|
} else {
|
|
250
254
|
ref = createChainedFunction(child.ref, ref);
|
|
251
255
|
}
|
|
@@ -256,13 +260,15 @@ var Dropdown = function (_React$Component) {
|
|
|
256
260
|
bsClass: prefix(props, 'menu'),
|
|
257
261
|
onClose: createChainedFunction(child.props.onClose, this.handleClose),
|
|
258
262
|
onSelect: createChainedFunction(child.props.onSelect, onSelect, function (key, event) {
|
|
259
|
-
return _this2.handleClose(event, {
|
|
263
|
+
return _this2.handleClose(event, {
|
|
264
|
+
source: 'select'
|
|
265
|
+
});
|
|
260
266
|
}),
|
|
261
267
|
rootCloseEvent: rootCloseEvent
|
|
262
268
|
}));
|
|
263
269
|
};
|
|
264
270
|
|
|
265
|
-
|
|
271
|
+
_proto.renderToggle = function renderToggle(child, props) {
|
|
266
272
|
var _this3 = this;
|
|
267
273
|
|
|
268
274
|
var ref = function ref(c) {
|
|
@@ -270,7 +276,7 @@ var Dropdown = function (_React$Component) {
|
|
|
270
276
|
};
|
|
271
277
|
|
|
272
278
|
if (typeof child.ref === 'string') {
|
|
273
|
-
process.env.NODE_ENV !==
|
|
279
|
+
process.env.NODE_ENV !== "production" ? warning(false, 'String refs are not supported on `<Dropdown.Toggle>` components. ' + 'To apply a ref to the component use the callback signature:\n\n ' + 'https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute') : void 0;
|
|
274
280
|
} else {
|
|
275
281
|
ref = createChainedFunction(child.ref, ref);
|
|
276
282
|
}
|
|
@@ -283,64 +289,62 @@ var Dropdown = function (_React$Component) {
|
|
|
283
289
|
}));
|
|
284
290
|
};
|
|
285
291
|
|
|
286
|
-
|
|
292
|
+
_proto.render = function render() {
|
|
287
293
|
var _classes,
|
|
288
294
|
_this4 = this;
|
|
289
295
|
|
|
290
|
-
var
|
|
291
|
-
Component =
|
|
292
|
-
id =
|
|
293
|
-
dropup =
|
|
294
|
-
disabled =
|
|
295
|
-
pullRight =
|
|
296
|
-
open =
|
|
297
|
-
onSelect =
|
|
298
|
-
role =
|
|
299
|
-
bsClass =
|
|
300
|
-
className =
|
|
301
|
-
rootCloseEvent =
|
|
302
|
-
children =
|
|
303
|
-
props =
|
|
296
|
+
var _this$props = this.props,
|
|
297
|
+
Component = _this$props.componentClass,
|
|
298
|
+
id = _this$props.id,
|
|
299
|
+
dropup = _this$props.dropup,
|
|
300
|
+
disabled = _this$props.disabled,
|
|
301
|
+
pullRight = _this$props.pullRight,
|
|
302
|
+
open = _this$props.open,
|
|
303
|
+
onSelect = _this$props.onSelect,
|
|
304
|
+
role = _this$props.role,
|
|
305
|
+
bsClass = _this$props.bsClass,
|
|
306
|
+
className = _this$props.className,
|
|
307
|
+
rootCloseEvent = _this$props.rootCloseEvent,
|
|
308
|
+
children = _this$props.children,
|
|
309
|
+
props = _objectWithoutPropertiesLoose(_this$props, ["componentClass", "id", "dropup", "disabled", "pullRight", "open", "onSelect", "role", "bsClass", "className", "rootCloseEvent", "children"]);
|
|
304
310
|
|
|
305
311
|
delete props.onToggle;
|
|
306
|
-
|
|
307
312
|
var classes = (_classes = {}, _classes[bsClass] = true, _classes.open = open, _classes.disabled = disabled, _classes);
|
|
308
313
|
|
|
309
314
|
if (dropup) {
|
|
310
315
|
classes[bsClass] = false;
|
|
311
316
|
classes.dropup = true;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// This intentionally forwards bsSize and bsStyle (if set) to the
|
|
317
|
+
} // This intentionally forwards bsSize and bsStyle (if set) to the
|
|
315
318
|
// underlying component, to allow it to render size and style variants.
|
|
316
319
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
320
|
+
|
|
321
|
+
return React.createElement(Component, _extends({}, props, {
|
|
322
|
+
className: classNames(className, classes)
|
|
323
|
+
}), ValidComponentChildren.map(children, function (child) {
|
|
324
|
+
switch (child.props.bsRole) {
|
|
325
|
+
case TOGGLE_ROLE:
|
|
326
|
+
return _this4.renderToggle(child, {
|
|
327
|
+
id: id,
|
|
328
|
+
disabled: disabled,
|
|
329
|
+
open: open,
|
|
330
|
+
role: role,
|
|
331
|
+
bsClass: bsClass
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
case MENU_ROLE:
|
|
335
|
+
return _this4.renderMenu(child, {
|
|
336
|
+
id: id,
|
|
337
|
+
open: open,
|
|
338
|
+
pullRight: pullRight,
|
|
339
|
+
bsClass: bsClass,
|
|
340
|
+
onSelect: onSelect,
|
|
341
|
+
rootCloseEvent: rootCloseEvent
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
default:
|
|
345
|
+
return child;
|
|
346
|
+
}
|
|
347
|
+
}));
|
|
344
348
|
};
|
|
345
349
|
|
|
346
350
|
return Dropdown;
|
|
@@ -348,12 +352,10 @@ var Dropdown = function (_React$Component) {
|
|
|
348
352
|
|
|
349
353
|
Dropdown.propTypes = propTypes;
|
|
350
354
|
Dropdown.defaultProps = defaultProps;
|
|
351
|
-
|
|
352
355
|
setBsClass('dropdown', Dropdown);
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
+
var UncontrolledDropdown = uncontrollable(Dropdown, {
|
|
357
|
+
open: 'onToggle'
|
|
358
|
+
});
|
|
356
359
|
UncontrolledDropdown.Toggle = DropdownToggle;
|
|
357
360
|
UncontrolledDropdown.Menu = DropdownMenu;
|
|
358
|
-
|
|
359
361
|
export default UncontrolledDropdown;
|
package/es/DropdownButton.js
CHANGED
|
@@ -1,69 +1,59 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import _inherits from 'babel-runtime/helpers/inherits';
|
|
5
|
-
import _extends from 'babel-runtime/helpers/extends';
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
|
|
3
|
+
import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
|
|
6
4
|
import React from 'react';
|
|
7
5
|
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
9
6
|
import Dropdown from './Dropdown';
|
|
10
7
|
import splitComponentProps from './utils/splitComponentProps';
|
|
11
8
|
|
|
12
9
|
var propTypes = _extends({}, Dropdown.propTypes, {
|
|
13
|
-
|
|
14
10
|
// Toggle props.
|
|
15
11
|
bsStyle: PropTypes.string,
|
|
16
12
|
bsSize: PropTypes.string,
|
|
17
13
|
title: PropTypes.node.isRequired,
|
|
18
14
|
noCaret: PropTypes.bool,
|
|
19
|
-
|
|
20
15
|
// Override generated docs from <Dropdown>.
|
|
16
|
+
|
|
21
17
|
/**
|
|
22
18
|
* @private
|
|
23
19
|
*/
|
|
24
20
|
children: PropTypes.node
|
|
25
21
|
});
|
|
26
22
|
|
|
27
|
-
var DropdownButton =
|
|
28
|
-
|
|
23
|
+
var DropdownButton =
|
|
24
|
+
/*#__PURE__*/
|
|
25
|
+
function (_React$Component) {
|
|
26
|
+
_inheritsLoose(DropdownButton, _React$Component);
|
|
29
27
|
|
|
30
28
|
function DropdownButton() {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
|
29
|
+
return _React$Component.apply(this, arguments) || this;
|
|
34
30
|
}
|
|
35
31
|
|
|
36
|
-
DropdownButton.prototype
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
var _proto = DropdownButton.prototype;
|
|
33
|
+
|
|
34
|
+
_proto.render = function render() {
|
|
35
|
+
var _this$props = this.props,
|
|
36
|
+
bsSize = _this$props.bsSize,
|
|
37
|
+
bsStyle = _this$props.bsStyle,
|
|
38
|
+
title = _this$props.title,
|
|
39
|
+
children = _this$props.children,
|
|
40
|
+
props = _objectWithoutPropertiesLoose(_this$props, ["bsSize", "bsStyle", "title", "children"]);
|
|
43
41
|
|
|
44
42
|
var _splitComponentProps = splitComponentProps(props, Dropdown.ControlledComponent),
|
|
45
43
|
dropdownProps = _splitComponentProps[0],
|
|
46
44
|
toggleProps = _splitComponentProps[1];
|
|
47
45
|
|
|
48
|
-
return React.createElement(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
),
|
|
56
|
-
React.createElement(
|
|
57
|
-
Dropdown.Menu,
|
|
58
|
-
null,
|
|
59
|
-
children
|
|
60
|
-
)
|
|
61
|
-
);
|
|
46
|
+
return React.createElement(Dropdown, _extends({}, dropdownProps, {
|
|
47
|
+
bsSize: bsSize,
|
|
48
|
+
bsStyle: bsStyle
|
|
49
|
+
}), React.createElement(Dropdown.Toggle, _extends({}, toggleProps, {
|
|
50
|
+
bsSize: bsSize,
|
|
51
|
+
bsStyle: bsStyle
|
|
52
|
+
}), title), React.createElement(Dropdown.Menu, null, children));
|
|
62
53
|
};
|
|
63
54
|
|
|
64
55
|
return DropdownButton;
|
|
65
56
|
}(React.Component);
|
|
66
57
|
|
|
67
58
|
DropdownButton.propTypes = propTypes;
|
|
68
|
-
|
|
69
59
|
export default DropdownButton;
|