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/ModalDialog.js
CHANGED
|
@@ -38,21 +38,21 @@ var _bootstrapUtils = require('./utils/bootstrapUtils');
|
|
|
38
38
|
|
|
39
39
|
var _StyleConfig = require('./utils/StyleConfig');
|
|
40
40
|
|
|
41
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
41
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
42
42
|
|
|
43
43
|
var propTypes = {
|
|
44
44
|
/**
|
|
45
45
|
* A css class to apply to the Modal dialog DOM node.
|
|
46
46
|
*/
|
|
47
|
-
dialogClassName: _propTypes2
|
|
47
|
+
dialogClassName: _propTypes2.default.string
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
var ModalDialog = function (_React$Component) {
|
|
51
|
-
(0, _inherits3
|
|
51
|
+
(0, _inherits3.default)(ModalDialog, _React$Component);
|
|
52
52
|
|
|
53
53
|
function ModalDialog() {
|
|
54
|
-
(0, _classCallCheck3
|
|
55
|
-
return (0, _possibleConstructorReturn3
|
|
54
|
+
(0, _classCallCheck3.default)(this, ModalDialog);
|
|
55
|
+
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
ModalDialog.prototype.render = function render() {
|
|
@@ -63,7 +63,7 @@ var ModalDialog = function (_React$Component) {
|
|
|
63
63
|
className = _props.className,
|
|
64
64
|
style = _props.style,
|
|
65
65
|
children = _props.children,
|
|
66
|
-
props = (0, _objectWithoutProperties3
|
|
66
|
+
props = (0, _objectWithoutProperties3.default)(_props, ['dialogClassName', 'className', 'style', 'children']);
|
|
67
67
|
|
|
68
68
|
var _splitBsProps = (0, _bootstrapUtils.splitBsProps)(props),
|
|
69
69
|
bsProps = _splitBsProps[0],
|
|
@@ -71,22 +71,22 @@ var ModalDialog = function (_React$Component) {
|
|
|
71
71
|
|
|
72
72
|
var bsClassName = (0, _bootstrapUtils.prefix)(bsProps);
|
|
73
73
|
|
|
74
|
-
var modalStyle = (0, _extends4
|
|
74
|
+
var modalStyle = (0, _extends4.default)({ display: 'block' }, style);
|
|
75
75
|
|
|
76
|
-
var dialogClasses = (0, _extends4
|
|
76
|
+
var dialogClasses = (0, _extends4.default)({}, (0, _bootstrapUtils.getClassSet)(bsProps), (_extends2 = {}, _extends2[bsClassName] = false, _extends2[(0, _bootstrapUtils.prefix)(bsProps, 'dialog')] = true, _extends2));
|
|
77
77
|
|
|
78
|
-
return _react2
|
|
78
|
+
return _react2.default.createElement(
|
|
79
79
|
'div',
|
|
80
|
-
(0, _extends4
|
|
80
|
+
(0, _extends4.default)({}, elementProps, {
|
|
81
81
|
tabIndex: '-1',
|
|
82
82
|
role: 'dialog',
|
|
83
83
|
style: modalStyle,
|
|
84
|
-
className: (0, _classnames2
|
|
84
|
+
className: (0, _classnames2.default)(className, bsClassName)
|
|
85
85
|
}),
|
|
86
|
-
_react2
|
|
86
|
+
_react2.default.createElement(
|
|
87
87
|
'div',
|
|
88
|
-
{ className: (0, _classnames2
|
|
89
|
-
_react2
|
|
88
|
+
{ className: (0, _classnames2.default)(dialogClassName, dialogClasses) },
|
|
89
|
+
_react2.default.createElement(
|
|
90
90
|
'div',
|
|
91
91
|
{ className: (0, _bootstrapUtils.prefix)(bsProps, 'content'), role: 'document' },
|
|
92
92
|
children
|
|
@@ -96,9 +96,9 @@ var ModalDialog = function (_React$Component) {
|
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
return ModalDialog;
|
|
99
|
-
}(_react2
|
|
99
|
+
}(_react2.default.Component);
|
|
100
100
|
|
|
101
101
|
ModalDialog.propTypes = propTypes;
|
|
102
102
|
|
|
103
|
-
exports
|
|
103
|
+
exports.default = (0, _bootstrapUtils.bsClass)('modal', (0, _bootstrapUtils.bsSizes)([_StyleConfig.Size.LARGE, _StyleConfig.Size.SMALL], ModalDialog));
|
|
104
104
|
module.exports = exports['default'];
|
package/lib/ModalFooter.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 ModalFooter = function (_React$Component) {
|
|
50
|
-
(0, _inherits3
|
|
50
|
+
(0, _inherits3.default)(ModalFooter, _React$Component);
|
|
51
51
|
|
|
52
52
|
function ModalFooter() {
|
|
53
|
-
(0, _classCallCheck3
|
|
54
|
-
return (0, _possibleConstructorReturn3
|
|
53
|
+
(0, _classCallCheck3.default)(this, ModalFooter);
|
|
54
|
+
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
ModalFooter.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 ModalFooter = 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 ModalFooter;
|
|
75
|
-
}(_react2
|
|
75
|
+
}(_react2.default.Component);
|
|
76
76
|
|
|
77
77
|
ModalFooter.propTypes = propTypes;
|
|
78
78
|
ModalFooter.defaultProps = defaultProps;
|
|
79
79
|
|
|
80
|
-
exports
|
|
80
|
+
exports.default = (0, _bootstrapUtils.bsClass)('modal-footer', ModalFooter);
|
|
81
81
|
module.exports = exports['default'];
|
package/lib/ModalHeader.js
CHANGED
|
@@ -44,7 +44,7 @@ var _CloseButton = require('./CloseButton');
|
|
|
44
44
|
|
|
45
45
|
var _CloseButton2 = _interopRequireDefault(_CloseButton);
|
|
46
46
|
|
|
47
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
47
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
48
48
|
|
|
49
49
|
// TODO: `aria-label` should be `closeLabel`.
|
|
50
50
|
|
|
@@ -54,19 +54,19 @@ var propTypes = {
|
|
|
54
54
|
* button. It is used for Assistive Technology when the label text is not
|
|
55
55
|
* readable.
|
|
56
56
|
*/
|
|
57
|
-
closeLabel: _propTypes2
|
|
57
|
+
closeLabel: _propTypes2.default.string,
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Specify whether the Component should contain a close button
|
|
61
61
|
*/
|
|
62
|
-
closeButton: _propTypes2
|
|
62
|
+
closeButton: _propTypes2.default.bool,
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* A Callback fired when the close button is clicked. If used directly inside
|
|
66
66
|
* a Modal component, the onHide will automatically be propagated up to the
|
|
67
67
|
* parent Modal `onHide`.
|
|
68
68
|
*/
|
|
69
|
-
onHide: _propTypes2
|
|
69
|
+
onHide: _propTypes2.default.func
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
var defaultProps = {
|
|
@@ -75,17 +75,17 @@ var defaultProps = {
|
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
var contextTypes = {
|
|
78
|
-
$bs_modal: _propTypes2
|
|
79
|
-
onHide: _propTypes2
|
|
78
|
+
$bs_modal: _propTypes2.default.shape({
|
|
79
|
+
onHide: _propTypes2.default.func
|
|
80
80
|
})
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
var ModalHeader = function (_React$Component) {
|
|
84
|
-
(0, _inherits3
|
|
84
|
+
(0, _inherits3.default)(ModalHeader, _React$Component);
|
|
85
85
|
|
|
86
86
|
function ModalHeader() {
|
|
87
|
-
(0, _classCallCheck3
|
|
88
|
-
return (0, _possibleConstructorReturn3
|
|
87
|
+
(0, _classCallCheck3.default)(this, ModalHeader);
|
|
88
|
+
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
ModalHeader.prototype.render = function render() {
|
|
@@ -95,7 +95,7 @@ var ModalHeader = function (_React$Component) {
|
|
|
95
95
|
onHide = _props.onHide,
|
|
96
96
|
className = _props.className,
|
|
97
97
|
children = _props.children,
|
|
98
|
-
props = (0, _objectWithoutProperties3
|
|
98
|
+
props = (0, _objectWithoutProperties3.default)(_props, ['closeLabel', 'closeButton', 'onHide', 'className', 'children']);
|
|
99
99
|
|
|
100
100
|
|
|
101
101
|
var modal = this.context.$bs_modal;
|
|
@@ -106,25 +106,25 @@ var ModalHeader = function (_React$Component) {
|
|
|
106
106
|
|
|
107
107
|
var classes = (0, _bootstrapUtils.getClassSet)(bsProps);
|
|
108
108
|
|
|
109
|
-
return _react2
|
|
109
|
+
return _react2.default.createElement(
|
|
110
110
|
'div',
|
|
111
|
-
(0, _extends3
|
|
112
|
-
className: (0, _classnames2
|
|
111
|
+
(0, _extends3.default)({}, elementProps, {
|
|
112
|
+
className: (0, _classnames2.default)(className, classes)
|
|
113
113
|
}),
|
|
114
|
-
closeButton && _react2
|
|
114
|
+
closeButton && _react2.default.createElement(_CloseButton2.default, {
|
|
115
115
|
label: closeLabel,
|
|
116
|
-
onClick: (0, _createChainedFunction2
|
|
116
|
+
onClick: (0, _createChainedFunction2.default)(modal && modal.onHide, onHide)
|
|
117
117
|
}),
|
|
118
118
|
children
|
|
119
119
|
);
|
|
120
120
|
};
|
|
121
121
|
|
|
122
122
|
return ModalHeader;
|
|
123
|
-
}(_react2
|
|
123
|
+
}(_react2.default.Component);
|
|
124
124
|
|
|
125
125
|
ModalHeader.propTypes = propTypes;
|
|
126
126
|
ModalHeader.defaultProps = defaultProps;
|
|
127
127
|
ModalHeader.contextTypes = contextTypes;
|
|
128
128
|
|
|
129
|
-
exports
|
|
129
|
+
exports.default = (0, _bootstrapUtils.bsClass)('modal-header', ModalHeader);
|
|
130
130
|
module.exports = exports['default'];
|
package/lib/ModalTitle.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 ModalTitle = function (_React$Component) {
|
|
50
|
-
(0, _inherits3
|
|
50
|
+
(0, _inherits3.default)(ModalTitle, _React$Component);
|
|
51
51
|
|
|
52
52
|
function ModalTitle() {
|
|
53
|
-
(0, _classCallCheck3
|
|
54
|
-
return (0, _possibleConstructorReturn3
|
|
53
|
+
(0, _classCallCheck3.default)(this, ModalTitle);
|
|
54
|
+
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
ModalTitle.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 ModalTitle = 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 ModalTitle;
|
|
75
|
-
}(_react2
|
|
75
|
+
}(_react2.default.Component);
|
|
76
76
|
|
|
77
77
|
ModalTitle.propTypes = propTypes;
|
|
78
78
|
ModalTitle.defaultProps = defaultProps;
|
|
79
79
|
|
|
80
|
-
exports
|
|
80
|
+
exports.default = (0, _bootstrapUtils.bsClass)('modal-title', ModalTitle);
|
|
81
81
|
module.exports = exports['default'];
|
package/lib/Nav.js
CHANGED
|
@@ -60,7 +60,7 @@ var _ValidComponentChildren = require('./utils/ValidComponentChildren');
|
|
|
60
60
|
|
|
61
61
|
var _ValidComponentChildren2 = _interopRequireDefault(_ValidComponentChildren);
|
|
62
62
|
|
|
63
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
63
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
64
64
|
|
|
65
65
|
// TODO: Should we expose `<NavItem>` as `<Nav.Item>`?
|
|
66
66
|
|
|
@@ -74,19 +74,19 @@ var propTypes = {
|
|
|
74
74
|
* Marks the NavItem with a matching `eventKey` as active. Has a
|
|
75
75
|
* higher precedence over `activeHref`.
|
|
76
76
|
*/
|
|
77
|
-
activeKey: _propTypes2
|
|
77
|
+
activeKey: _propTypes2.default.any,
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* Marks the child NavItem with a matching `href` prop as active.
|
|
81
81
|
*/
|
|
82
|
-
activeHref: _propTypes2
|
|
82
|
+
activeHref: _propTypes2.default.string,
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* NavItems are be positioned vertically.
|
|
86
86
|
*/
|
|
87
|
-
stacked: _propTypes2
|
|
87
|
+
stacked: _propTypes2.default.bool,
|
|
88
88
|
|
|
89
|
-
justified: (0, _all2
|
|
89
|
+
justified: (0, _all2.default)(_propTypes2.default.bool, function (_ref) {
|
|
90
90
|
var justified = _ref.justified,
|
|
91
91
|
navbar = _ref.navbar;
|
|
92
92
|
return justified && navbar ? Error('justified navbar `Nav`s are not supported') : null;
|
|
@@ -97,12 +97,12 @@ var propTypes = {
|
|
|
97
97
|
*
|
|
98
98
|
* ```js
|
|
99
99
|
* function (
|
|
100
|
-
*
|
|
101
|
-
*
|
|
100
|
+
* Any eventKey,
|
|
101
|
+
* SyntheticEvent event?
|
|
102
102
|
* )
|
|
103
103
|
* ```
|
|
104
104
|
*/
|
|
105
|
-
onSelect: _propTypes2
|
|
105
|
+
onSelect: _propTypes2.default.func,
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
108
|
* ARIA role for the Nav, in the context of a TabContainer, the default will
|
|
@@ -112,25 +112,25 @@ var propTypes = {
|
|
|
112
112
|
* the ARIA authoring practices for tabs:
|
|
113
113
|
* https://www.w3.org/TR/2013/WD-wai-aria-practices-20130307/#tabpanel
|
|
114
114
|
*/
|
|
115
|
-
role: _propTypes2
|
|
115
|
+
role: _propTypes2.default.string,
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
118
|
* Apply styling an alignment for use in a Navbar. This prop will be set
|
|
119
119
|
* automatically when the Nav is used inside a Navbar.
|
|
120
120
|
*/
|
|
121
|
-
navbar: _propTypes2
|
|
121
|
+
navbar: _propTypes2.default.bool,
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
124
|
* Float the Nav to the right. When `navbar` is `true` the appropriate
|
|
125
125
|
* contextual classes are added as well.
|
|
126
126
|
*/
|
|
127
|
-
pullRight: _propTypes2
|
|
127
|
+
pullRight: _propTypes2.default.bool,
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
130
|
* Float the Nav to the left. When `navbar` is `true` the appropriate
|
|
131
131
|
* contextual classes are added as well.
|
|
132
132
|
*/
|
|
133
|
-
pullLeft: _propTypes2
|
|
133
|
+
pullLeft: _propTypes2.default.bool
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
var defaultProps = {
|
|
@@ -141,25 +141,25 @@ var defaultProps = {
|
|
|
141
141
|
};
|
|
142
142
|
|
|
143
143
|
var contextTypes = {
|
|
144
|
-
$bs_navbar: _propTypes2
|
|
145
|
-
bsClass: _propTypes2
|
|
146
|
-
onSelect: _propTypes2
|
|
144
|
+
$bs_navbar: _propTypes2.default.shape({
|
|
145
|
+
bsClass: _propTypes2.default.string,
|
|
146
|
+
onSelect: _propTypes2.default.func
|
|
147
147
|
}),
|
|
148
148
|
|
|
149
|
-
$bs_tabContainer: _propTypes2
|
|
150
|
-
activeKey: _propTypes2
|
|
151
|
-
onSelect: _propTypes2
|
|
152
|
-
getTabId: _propTypes2
|
|
153
|
-
getPaneId: _propTypes2
|
|
149
|
+
$bs_tabContainer: _propTypes2.default.shape({
|
|
150
|
+
activeKey: _propTypes2.default.any,
|
|
151
|
+
onSelect: _propTypes2.default.func.isRequired,
|
|
152
|
+
getTabId: _propTypes2.default.func.isRequired,
|
|
153
|
+
getPaneId: _propTypes2.default.func.isRequired
|
|
154
154
|
})
|
|
155
155
|
};
|
|
156
156
|
|
|
157
157
|
var Nav = function (_React$Component) {
|
|
158
|
-
(0, _inherits3
|
|
158
|
+
(0, _inherits3.default)(Nav, _React$Component);
|
|
159
159
|
|
|
160
160
|
function Nav() {
|
|
161
|
-
(0, _classCallCheck3
|
|
162
|
-
return (0, _possibleConstructorReturn3
|
|
161
|
+
(0, _classCallCheck3.default)(this, Nav);
|
|
162
|
+
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
Nav.prototype.componentDidUpdate = function componentDidUpdate() {
|
|
@@ -177,14 +177,14 @@ var Nav = function (_React$Component) {
|
|
|
177
177
|
activeKey = _getActiveProps.activeKey,
|
|
178
178
|
activeHref = _getActiveProps.activeHref;
|
|
179
179
|
|
|
180
|
-
var activeChild = _ValidComponentChildren2
|
|
180
|
+
var activeChild = _ValidComponentChildren2.default.find(children, function (child) {
|
|
181
181
|
return _this2.isActive(child, activeKey, activeHref);
|
|
182
182
|
});
|
|
183
183
|
|
|
184
|
-
var childrenArray = _ValidComponentChildren2
|
|
184
|
+
var childrenArray = _ValidComponentChildren2.default.toArray(children);
|
|
185
185
|
var activeChildIndex = childrenArray.indexOf(activeChild);
|
|
186
186
|
|
|
187
|
-
var childNodes = _reactDom2
|
|
187
|
+
var childNodes = _reactDom2.default.findDOMNode(this).children;
|
|
188
188
|
var activeNode = childNodes && childNodes[activeChildIndex];
|
|
189
189
|
|
|
190
190
|
if (!activeNode || !activeNode.firstChild) {
|
|
@@ -194,30 +194,16 @@ var Nav = function (_React$Component) {
|
|
|
194
194
|
activeNode.firstChild.focus();
|
|
195
195
|
};
|
|
196
196
|
|
|
197
|
-
Nav.prototype.
|
|
198
|
-
var
|
|
199
|
-
|
|
200
|
-
switch (event.keyCode) {
|
|
201
|
-
case _keycode2['default'].codes.left:
|
|
202
|
-
case _keycode2['default'].codes.up:
|
|
203
|
-
nextActiveChild = this.getNextActiveChild(-1);
|
|
204
|
-
break;
|
|
205
|
-
case _keycode2['default'].codes.right:
|
|
206
|
-
case _keycode2['default'].codes.down:
|
|
207
|
-
nextActiveChild = this.getNextActiveChild(1);
|
|
208
|
-
break;
|
|
209
|
-
default:
|
|
210
|
-
// It was a different key; don't handle this keypress.
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
197
|
+
Nav.prototype.getActiveProps = function getActiveProps() {
|
|
198
|
+
var tabContainer = this.context.$bs_tabContainer;
|
|
213
199
|
|
|
214
|
-
|
|
200
|
+
if (tabContainer) {
|
|
201
|
+
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(this.props.activeKey == null && !this.props.activeHref, 'Specifying a `<Nav>` `activeKey` or `activeHref` in the context of ' + 'a `<TabContainer>` is not supported. Instead use `<TabContainer ' + ('activeKey={' + this.props.activeKey + '} />`.')) : void 0;
|
|
215
202
|
|
|
216
|
-
|
|
217
|
-
onSelect(nextActiveChild.props.eventKey);
|
|
203
|
+
return tabContainer;
|
|
218
204
|
}
|
|
219
205
|
|
|
220
|
-
this.
|
|
206
|
+
return this.props;
|
|
221
207
|
};
|
|
222
208
|
|
|
223
209
|
Nav.prototype.getNextActiveChild = function getNextActiveChild(offset) {
|
|
@@ -233,7 +219,7 @@ var Nav = function (_React$Component) {
|
|
|
233
219
|
activeKey = _getActiveProps2.activeKey,
|
|
234
220
|
activeHref = _getActiveProps2.activeHref;
|
|
235
221
|
|
|
236
|
-
var activeChild = _ValidComponentChildren2
|
|
222
|
+
var activeChild = _ValidComponentChildren2.default.find(children, function (child) {
|
|
237
223
|
return _this3.isActive(child, activeKey, activeHref);
|
|
238
224
|
});
|
|
239
225
|
|
|
@@ -256,28 +242,6 @@ var Nav = function (_React$Component) {
|
|
|
256
242
|
return validChildren[nextIndex];
|
|
257
243
|
};
|
|
258
244
|
|
|
259
|
-
Nav.prototype.getActiveProps = function getActiveProps() {
|
|
260
|
-
var tabContainer = this.context.$bs_tabContainer;
|
|
261
|
-
|
|
262
|
-
if (tabContainer) {
|
|
263
|
-
process.env.NODE_ENV !== 'production' ? (0, _warning2['default'])(this.props.activeKey == null && !this.props.activeHref, 'Specifying a `<Nav>` `activeKey` or `activeHref` in the context of ' + 'a `<TabContainer>` is not supported. Instead use `<TabContainer ' + ('activeKey={' + this.props.activeKey + '} />`.')) : void 0;
|
|
264
|
-
|
|
265
|
-
return tabContainer;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
return this.props;
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
Nav.prototype.isActive = function isActive(_ref2, activeKey, activeHref) {
|
|
272
|
-
var props = _ref2.props;
|
|
273
|
-
|
|
274
|
-
if (props.active || activeKey != null && props.eventKey === activeKey || activeHref && props.href === activeHref) {
|
|
275
|
-
return true;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
return props.active;
|
|
279
|
-
};
|
|
280
|
-
|
|
281
245
|
Nav.prototype.getTabProps = function getTabProps(child, tabContainer, navRole, active, onSelect) {
|
|
282
246
|
var _this4 = this;
|
|
283
247
|
|
|
@@ -296,7 +260,7 @@ var Nav = function (_React$Component) {
|
|
|
296
260
|
|
|
297
261
|
|
|
298
262
|
if (tabContainer) {
|
|
299
|
-
process.env.NODE_ENV !== 'production' ? (0, _warning2
|
|
263
|
+
process.env.NODE_ENV !== 'production' ? (0, _warning2.default)(!id && !controls, 'In the context of a `<TabContainer>`, `<NavItem>`s are given ' + 'generated `id` and `aria-controls` attributes for the sake of ' + 'proper component accessibility. Any provided ones will be ignored. ' + 'To control these attributes directly, provide a `generateChildId` ' + 'prop to the parent `<TabContainer>`.') : void 0;
|
|
300
264
|
|
|
301
265
|
id = tabContainer.getTabId(eventKey);
|
|
302
266
|
controls = tabContainer.getPaneId(eventKey);
|
|
@@ -304,7 +268,7 @@ var Nav = function (_React$Component) {
|
|
|
304
268
|
|
|
305
269
|
if (navRole === 'tablist') {
|
|
306
270
|
role = role || 'tab';
|
|
307
|
-
onKeyDown = (0, _createChainedFunction2
|
|
271
|
+
onKeyDown = (0, _createChainedFunction2.default)(function (event) {
|
|
308
272
|
return _this4.handleTabKeyDown(onSelect, event);
|
|
309
273
|
}, onKeyDown);
|
|
310
274
|
tabIndex = active ? tabIndex : -1;
|
|
@@ -319,6 +283,42 @@ var Nav = function (_React$Component) {
|
|
|
319
283
|
};
|
|
320
284
|
};
|
|
321
285
|
|
|
286
|
+
Nav.prototype.handleTabKeyDown = function handleTabKeyDown(onSelect, event) {
|
|
287
|
+
var nextActiveChild = void 0;
|
|
288
|
+
|
|
289
|
+
switch (event.keyCode) {
|
|
290
|
+
case _keycode2.default.codes.left:
|
|
291
|
+
case _keycode2.default.codes.up:
|
|
292
|
+
nextActiveChild = this.getNextActiveChild(-1);
|
|
293
|
+
break;
|
|
294
|
+
case _keycode2.default.codes.right:
|
|
295
|
+
case _keycode2.default.codes.down:
|
|
296
|
+
nextActiveChild = this.getNextActiveChild(1);
|
|
297
|
+
break;
|
|
298
|
+
default:
|
|
299
|
+
// It was a different key; don't handle this keypress.
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
event.preventDefault();
|
|
304
|
+
|
|
305
|
+
if (onSelect && nextActiveChild && nextActiveChild.props.eventKey != null) {
|
|
306
|
+
onSelect(nextActiveChild.props.eventKey);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
this._needsRefocus = true;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
Nav.prototype.isActive = function isActive(_ref2, activeKey, activeHref) {
|
|
313
|
+
var props = _ref2.props;
|
|
314
|
+
|
|
315
|
+
if (props.active || activeKey != null && props.eventKey === activeKey || activeHref && props.href === activeHref) {
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return props.active;
|
|
320
|
+
};
|
|
321
|
+
|
|
322
322
|
Nav.prototype.render = function render() {
|
|
323
323
|
var _extends2,
|
|
324
324
|
_this5 = this;
|
|
@@ -333,7 +333,7 @@ var Nav = function (_React$Component) {
|
|
|
333
333
|
pullLeft = _props.pullLeft,
|
|
334
334
|
className = _props.className,
|
|
335
335
|
children = _props.children,
|
|
336
|
-
props = (0, _objectWithoutProperties3
|
|
336
|
+
props = (0, _objectWithoutProperties3.default)(_props, ['stacked', 'justified', 'onSelect', 'role', 'navbar', 'pullRight', 'pullLeft', 'className', 'children']);
|
|
337
337
|
|
|
338
338
|
|
|
339
339
|
var tabContainer = this.context.$bs_tabContainer;
|
|
@@ -350,7 +350,7 @@ var Nav = function (_React$Component) {
|
|
|
350
350
|
bsProps = _splitBsProps[0],
|
|
351
351
|
elementProps = _splitBsProps[1];
|
|
352
352
|
|
|
353
|
-
var classes = (0, _extends4
|
|
353
|
+
var classes = (0, _extends4.default)({}, (0, _bootstrapUtils.getClassSet)(bsProps), (_extends2 = {}, _extends2[(0, _bootstrapUtils.prefix)(bsProps, 'stacked')] = stacked, _extends2[(0, _bootstrapUtils.prefix)(bsProps, 'justified')] = justified, _extends2));
|
|
354
354
|
|
|
355
355
|
var navbar = propsNavbar != null ? propsNavbar : this.context.$bs_navbar;
|
|
356
356
|
var pullLeftClassName = void 0;
|
|
@@ -371,17 +371,17 @@ var Nav = function (_React$Component) {
|
|
|
371
371
|
classes[pullRightClassName] = pullRight;
|
|
372
372
|
classes[pullLeftClassName] = pullLeft;
|
|
373
373
|
|
|
374
|
-
return _react2
|
|
374
|
+
return _react2.default.createElement(
|
|
375
375
|
'ul',
|
|
376
|
-
(0, _extends4
|
|
376
|
+
(0, _extends4.default)({}, elementProps, {
|
|
377
377
|
role: role,
|
|
378
|
-
className: (0, _classnames2
|
|
378
|
+
className: (0, _classnames2.default)(className, classes)
|
|
379
379
|
}),
|
|
380
|
-
_ValidComponentChildren2
|
|
380
|
+
_ValidComponentChildren2.default.map(children, function (child) {
|
|
381
381
|
var active = _this5.isActive(child, activeKey, activeHref);
|
|
382
|
-
var childOnSelect = (0, _createChainedFunction2
|
|
382
|
+
var childOnSelect = (0, _createChainedFunction2.default)(child.props.onSelect, onSelect, navbar && navbar.onSelect, tabContainer && tabContainer.onSelect);
|
|
383
383
|
|
|
384
|
-
return (0, _react.cloneElement)(child, (0, _extends4
|
|
384
|
+
return (0, _react.cloneElement)(child, (0, _extends4.default)({}, _this5.getTabProps(child, tabContainer, role, active, childOnSelect), {
|
|
385
385
|
active: active,
|
|
386
386
|
activeKey: activeKey,
|
|
387
387
|
activeHref: activeHref,
|
|
@@ -392,11 +392,11 @@ var Nav = function (_React$Component) {
|
|
|
392
392
|
};
|
|
393
393
|
|
|
394
394
|
return Nav;
|
|
395
|
-
}(_react2
|
|
395
|
+
}(_react2.default.Component);
|
|
396
396
|
|
|
397
397
|
Nav.propTypes = propTypes;
|
|
398
398
|
Nav.defaultProps = defaultProps;
|
|
399
399
|
Nav.contextTypes = contextTypes;
|
|
400
400
|
|
|
401
|
-
exports
|
|
401
|
+
exports.default = (0, _bootstrapUtils.bsClass)('nav', (0, _bootstrapUtils.bsStyles)(['tabs', 'pills'], Nav));
|
|
402
402
|
module.exports = exports['default'];
|