react-bootstrap 0.29.1 → 0.29.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 +47 -0
- package/dist/react-bootstrap.js +229 -78
- package/dist/react-bootstrap.min.js +9 -9
- package/dist/react-bootstrap.min.js.map +1 -1
- package/lib/Checkbox.js +19 -4
- package/lib/Dropdown.js +36 -10
- package/lib/MenuItem.js +2 -0
- package/lib/Nav.js +4 -4
- package/lib/OverlayTrigger.js +1 -1
- package/lib/PaginationButton.js +0 -1
- package/lib/Panel.js +1 -0
- package/lib/Radio.js +19 -4
- package/lib/SafeAnchor.js +1 -2
- package/lib/TabContainer.js +12 -2
- package/lib/TabContent.js +28 -5
- package/lib/TabPane.js +21 -4
- package/lib/Tabs.js +10 -2
- package/package.json +1 -1
- package/README.md +0 -80
package/lib/Checkbox.js
CHANGED
|
@@ -32,7 +32,15 @@ var propTypes = {
|
|
|
32
32
|
/**
|
|
33
33
|
* Only valid if `inline` is not set.
|
|
34
34
|
*/
|
|
35
|
-
validationState: _react2['default'].PropTypes.oneOf(['success', 'warning', 'error'])
|
|
35
|
+
validationState: _react2['default'].PropTypes.oneOf(['success', 'warning', 'error']),
|
|
36
|
+
/**
|
|
37
|
+
* Attaches a ref to the `<input>` element. Only functions can be used here.
|
|
38
|
+
*
|
|
39
|
+
* ```js
|
|
40
|
+
* <Checkbox inputRef={ref => { this.input = ref; }} />
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
inputRef: _react2['default'].PropTypes.func
|
|
36
44
|
};
|
|
37
45
|
|
|
38
46
|
var defaultProps = {
|
|
@@ -54,14 +62,21 @@ var Checkbox = (function (_React$Component) {
|
|
|
54
62
|
var inline = _props.inline;
|
|
55
63
|
var disabled = _props.disabled;
|
|
56
64
|
var validationState = _props.validationState;
|
|
65
|
+
var inputRef = _props.inputRef;
|
|
57
66
|
var className = _props.className;
|
|
58
67
|
var style = _props.style;
|
|
59
68
|
var children = _props.children;
|
|
60
69
|
|
|
61
|
-
var props = _objectWithoutProperties(_props, ['inline', 'disabled', 'validationState', 'className', 'style', 'children']);
|
|
70
|
+
var props = _objectWithoutProperties(_props, ['inline', 'disabled', 'validationState', 'inputRef', 'className', 'style', 'children']);
|
|
62
71
|
|
|
63
72
|
delete props.bsClass;
|
|
64
73
|
|
|
74
|
+
var input = _react2['default'].createElement('input', _extends({}, props, {
|
|
75
|
+
ref: inputRef,
|
|
76
|
+
type: 'checkbox',
|
|
77
|
+
disabled: disabled
|
|
78
|
+
}));
|
|
79
|
+
|
|
65
80
|
if (inline) {
|
|
66
81
|
var _classes;
|
|
67
82
|
|
|
@@ -74,7 +89,7 @@ var Checkbox = (function (_React$Component) {
|
|
|
74
89
|
return _react2['default'].createElement(
|
|
75
90
|
'label',
|
|
76
91
|
{ className: _classnames2['default'](className, _classes2), style: style },
|
|
77
|
-
|
|
92
|
+
input,
|
|
78
93
|
children
|
|
79
94
|
);
|
|
80
95
|
}
|
|
@@ -92,7 +107,7 @@ var Checkbox = (function (_React$Component) {
|
|
|
92
107
|
_react2['default'].createElement(
|
|
93
108
|
'label',
|
|
94
109
|
null,
|
|
95
|
-
|
|
110
|
+
input,
|
|
96
111
|
children
|
|
97
112
|
)
|
|
98
113
|
);
|
package/lib/Dropdown.js
CHANGED
|
@@ -58,6 +58,10 @@ var _uncontrollable = require('uncontrollable');
|
|
|
58
58
|
|
|
59
59
|
var _uncontrollable2 = _interopRequireDefault(_uncontrollable);
|
|
60
60
|
|
|
61
|
+
var _warning = require('warning');
|
|
62
|
+
|
|
63
|
+
var _warning2 = _interopRequireDefault(_warning);
|
|
64
|
+
|
|
61
65
|
var _utilsBootstrapUtils = require('./utils/bootstrapUtils');
|
|
62
66
|
|
|
63
67
|
var _utilsCreateChainedFunction = require('./utils/createChainedFunction');
|
|
@@ -84,7 +88,6 @@ var _DropdownToggle = require('./DropdownToggle');
|
|
|
84
88
|
|
|
85
89
|
var _DropdownToggle2 = _interopRequireDefault(_DropdownToggle);
|
|
86
90
|
|
|
87
|
-
var TOGGLE_REF = 'toggle-btn';
|
|
88
91
|
var TOGGLE_ROLE = _DropdownToggle2['default'].defaultProps.bsRole;
|
|
89
92
|
var MENU_ROLE = _DropdownMenu2['default'].defaultProps.bsRole;
|
|
90
93
|
|
|
@@ -133,7 +136,7 @@ var Dropdown = (function (_React$Component) {
|
|
|
133
136
|
|
|
134
137
|
Dropdown.prototype.componentWillUpdate = function componentWillUpdate(nextProps) {
|
|
135
138
|
if (!nextProps.open && this.props.open) {
|
|
136
|
-
this._focusInDropdown = _domHelpersQueryContains2['default'](_reactDom2['default'].findDOMNode(this.
|
|
139
|
+
this._focusInDropdown = _domHelpersQueryContains2['default'](_reactDom2['default'].findDOMNode(this.menu), _domHelpersActiveElement2['default'](document));
|
|
137
140
|
}
|
|
138
141
|
};
|
|
139
142
|
|
|
@@ -158,7 +161,7 @@ var Dropdown = (function (_React$Component) {
|
|
|
158
161
|
var children = this.extractChildren();
|
|
159
162
|
var Component = this.props.componentClass;
|
|
160
163
|
|
|
161
|
-
var props = _lodashCompatObjectOmit2['default'](this.props, ['id', 'bsClass', 'role']);
|
|
164
|
+
var props = _lodashCompatObjectOmit2['default'](this.props, ['id', 'bsClass', 'role', 'onSelect']);
|
|
162
165
|
var className = _utilsBootstrapUtils.prefix(this.props);
|
|
163
166
|
|
|
164
167
|
var rootClasses = (_rootClasses = {
|
|
@@ -206,8 +209,8 @@ var Dropdown = (function (_React$Component) {
|
|
|
206
209
|
case _keycode2['default'].codes.down:
|
|
207
210
|
if (!this.props.open) {
|
|
208
211
|
this.toggleOpen('keydown');
|
|
209
|
-
} else if (this.
|
|
210
|
-
this.
|
|
212
|
+
} else if (this.menu.focusNext) {
|
|
213
|
+
this.menu.focusNext();
|
|
211
214
|
}
|
|
212
215
|
event.preventDefault();
|
|
213
216
|
break;
|
|
@@ -228,7 +231,7 @@ var Dropdown = (function (_React$Component) {
|
|
|
228
231
|
};
|
|
229
232
|
|
|
230
233
|
Dropdown.prototype.focusNextOnOpen = function focusNextOnOpen() {
|
|
231
|
-
var menu = this.
|
|
234
|
+
var menu = this.menu;
|
|
232
235
|
|
|
233
236
|
if (!menu.focusNext) {
|
|
234
237
|
return;
|
|
@@ -240,7 +243,7 @@ var Dropdown = (function (_React$Component) {
|
|
|
240
243
|
};
|
|
241
244
|
|
|
242
245
|
Dropdown.prototype.focus = function focus() {
|
|
243
|
-
var toggle = _reactDom2['default'].findDOMNode(this.
|
|
246
|
+
var toggle = _reactDom2['default'].findDOMNode(this.toggle);
|
|
244
247
|
|
|
245
248
|
if (toggle && toggle.focus) {
|
|
246
249
|
toggle.focus();
|
|
@@ -272,8 +275,20 @@ var Dropdown = (function (_React$Component) {
|
|
|
272
275
|
};
|
|
273
276
|
|
|
274
277
|
Dropdown.prototype.refineMenu = function refineMenu(menu, open) {
|
|
278
|
+
var _this2 = this;
|
|
279
|
+
|
|
280
|
+
var ref = function ref(r) {
|
|
281
|
+
return _this2.menu = r;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
if (typeof menu.ref === 'string') {
|
|
285
|
+
process.env.NODE_ENV !== 'production' ? _warning2['default'](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') : undefined;
|
|
286
|
+
} else {
|
|
287
|
+
ref = _utilsCreateChainedFunction2['default'](menu.ref, ref);
|
|
288
|
+
}
|
|
289
|
+
|
|
275
290
|
var menuProps = {
|
|
276
|
-
ref:
|
|
291
|
+
ref: ref,
|
|
277
292
|
open: open,
|
|
278
293
|
labelledBy: this.props.id,
|
|
279
294
|
pullRight: this.props.pullRight,
|
|
@@ -288,10 +303,22 @@ var Dropdown = (function (_React$Component) {
|
|
|
288
303
|
};
|
|
289
304
|
|
|
290
305
|
Dropdown.prototype.refineToggle = function refineToggle(toggle, open) {
|
|
306
|
+
var _this3 = this;
|
|
307
|
+
|
|
308
|
+
var ref = function ref(r) {
|
|
309
|
+
return _this3.toggle = r;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
if (typeof toggle.ref === 'string') {
|
|
313
|
+
process.env.NODE_ENV !== 'production' ? _warning2['default'](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') : undefined;
|
|
314
|
+
} else {
|
|
315
|
+
ref = _utilsCreateChainedFunction2['default'](toggle.ref, ref);
|
|
316
|
+
}
|
|
317
|
+
|
|
291
318
|
var toggleProps = {
|
|
319
|
+
ref: ref,
|
|
292
320
|
open: open,
|
|
293
321
|
id: this.props.id,
|
|
294
|
-
ref: TOGGLE_REF,
|
|
295
322
|
role: this.props.role
|
|
296
323
|
};
|
|
297
324
|
|
|
@@ -307,7 +334,6 @@ var Dropdown = (function (_React$Component) {
|
|
|
307
334
|
|
|
308
335
|
Dropdown.Toggle = _DropdownToggle2['default'];
|
|
309
336
|
|
|
310
|
-
Dropdown.TOGGLE_REF = TOGGLE_REF;
|
|
311
337
|
Dropdown.TOGGLE_ROLE = TOGGLE_ROLE;
|
|
312
338
|
Dropdown.MENU_ROLE = MENU_ROLE;
|
|
313
339
|
|
package/lib/MenuItem.js
CHANGED
package/lib/Nav.js
CHANGED
|
@@ -169,7 +169,7 @@ var Nav = (function (_React$Component) {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
var _child$props = child.props;
|
|
172
|
-
var
|
|
172
|
+
var id = _child$props.id;
|
|
173
173
|
var controls = _child$props['aria-controls'];
|
|
174
174
|
var eventKey = _child$props.eventKey;
|
|
175
175
|
var role = _child$props.role;
|
|
@@ -178,9 +178,9 @@ var Nav = (function (_React$Component) {
|
|
|
178
178
|
var tabIndex = _child$props$tabIndex === undefined ? 0 : _child$props$tabIndex;
|
|
179
179
|
|
|
180
180
|
if (context && context.getId) {
|
|
181
|
-
process.env.NODE_ENV !== 'production' ? _warning2['default'](!(
|
|
181
|
+
process.env.NODE_ENV !== 'production' ? _warning2['default'](!(id || controls), 'In the context of a TabContainer, NavItems 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.') : undefined;
|
|
182
182
|
|
|
183
|
-
|
|
183
|
+
id = context.getId(eventKey, _utilsTabUtils.TAB) || null;
|
|
184
184
|
controls = context.getId(eventKey, _utilsTabUtils.PANE) || null;
|
|
185
185
|
onSelect = _utilsCreateChainedFunction2['default'](onSelect, context.onSelect);
|
|
186
186
|
}
|
|
@@ -193,7 +193,7 @@ var Nav = (function (_React$Component) {
|
|
|
193
193
|
|
|
194
194
|
return {
|
|
195
195
|
onSelect: onSelect,
|
|
196
|
-
|
|
196
|
+
id: id,
|
|
197
197
|
role: role,
|
|
198
198
|
onKeyDown: onKeyDown,
|
|
199
199
|
'aria-controls': controls,
|
package/lib/OverlayTrigger.js
CHANGED
|
@@ -76,7 +76,7 @@ var OverlayTrigger = _react2['default'].createClass({
|
|
|
76
76
|
delayHide: _react2['default'].PropTypes.number,
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
|
-
* The initial visibility state of the Overlay, for more nuanced visibility
|
|
79
|
+
* The initial visibility state of the Overlay, for more nuanced visibility control consider
|
|
80
80
|
* using the Overlay component directly.
|
|
81
81
|
*/
|
|
82
82
|
defaultOverlayShown: _react2['default'].PropTypes.bool,
|
package/lib/PaginationButton.js
CHANGED
|
@@ -69,7 +69,6 @@ var PaginationButton = _react2['default'].createClass({
|
|
|
69
69
|
var props = _objectWithoutProperties(_props, ['active', 'disabled', 'onClick', 'buttonComponentClass', 'className', 'style']);
|
|
70
70
|
|
|
71
71
|
delete props.onSelect;
|
|
72
|
-
delete props.eventKey;
|
|
73
72
|
|
|
74
73
|
return _react2['default'].createElement(
|
|
75
74
|
'li',
|
package/lib/Panel.js
CHANGED
package/lib/Radio.js
CHANGED
|
@@ -32,7 +32,15 @@ var propTypes = {
|
|
|
32
32
|
/**
|
|
33
33
|
* Only valid if `inline` is not set.
|
|
34
34
|
*/
|
|
35
|
-
validationState: _react2['default'].PropTypes.oneOf(['success', 'warning', 'error'])
|
|
35
|
+
validationState: _react2['default'].PropTypes.oneOf(['success', 'warning', 'error']),
|
|
36
|
+
/**
|
|
37
|
+
* Attaches a ref to the `<input>` element. Only functions can be used here.
|
|
38
|
+
*
|
|
39
|
+
* ```js
|
|
40
|
+
* <Radio inputRef={ref => { this.input = ref; }} />
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
inputRef: _react2['default'].PropTypes.func
|
|
36
44
|
};
|
|
37
45
|
|
|
38
46
|
var defaultProps = {
|
|
@@ -54,14 +62,21 @@ var Radio = (function (_React$Component) {
|
|
|
54
62
|
var inline = _props.inline;
|
|
55
63
|
var disabled = _props.disabled;
|
|
56
64
|
var validationState = _props.validationState;
|
|
65
|
+
var inputRef = _props.inputRef;
|
|
57
66
|
var className = _props.className;
|
|
58
67
|
var style = _props.style;
|
|
59
68
|
var children = _props.children;
|
|
60
69
|
|
|
61
|
-
var props = _objectWithoutProperties(_props, ['inline', 'disabled', 'validationState', 'className', 'style', 'children']);
|
|
70
|
+
var props = _objectWithoutProperties(_props, ['inline', 'disabled', 'validationState', 'inputRef', 'className', 'style', 'children']);
|
|
62
71
|
|
|
63
72
|
delete props.bsClass;
|
|
64
73
|
|
|
74
|
+
var input = _react2['default'].createElement('input', _extends({}, props, {
|
|
75
|
+
ref: inputRef,
|
|
76
|
+
type: 'radio',
|
|
77
|
+
disabled: disabled
|
|
78
|
+
}));
|
|
79
|
+
|
|
65
80
|
if (inline) {
|
|
66
81
|
var _classes;
|
|
67
82
|
|
|
@@ -74,7 +89,7 @@ var Radio = (function (_React$Component) {
|
|
|
74
89
|
return _react2['default'].createElement(
|
|
75
90
|
'label',
|
|
76
91
|
{ className: _classnames2['default'](className, _classes2), style: style },
|
|
77
|
-
|
|
92
|
+
input,
|
|
78
93
|
children
|
|
79
94
|
);
|
|
80
95
|
}
|
|
@@ -92,7 +107,7 @@ var Radio = (function (_React$Component) {
|
|
|
92
107
|
_react2['default'].createElement(
|
|
93
108
|
'label',
|
|
94
109
|
null,
|
|
95
|
-
|
|
110
|
+
input,
|
|
96
111
|
children
|
|
97
112
|
)
|
|
98
113
|
);
|
package/lib/SafeAnchor.js
CHANGED
package/lib/TabContainer.js
CHANGED
|
@@ -79,14 +79,13 @@ var TabContainer = _react2['default'].createClass({
|
|
|
79
79
|
getChildContext: function getChildContext() {
|
|
80
80
|
var _props = this.props;
|
|
81
81
|
var activeKey = _props.activeKey;
|
|
82
|
-
var onSelect = _props.onSelect;
|
|
83
82
|
var generateChildId = _props.generateChildId;
|
|
84
83
|
var id = _props.id;
|
|
85
84
|
|
|
86
85
|
return {
|
|
87
86
|
$bs_tabcontainer: {
|
|
88
87
|
activeKey: activeKey,
|
|
89
|
-
onSelect:
|
|
88
|
+
onSelect: this.handleSelect,
|
|
90
89
|
getId: generateChildId || function (key, type) {
|
|
91
90
|
return id ? id + '-' + type + '-' + key : null;
|
|
92
91
|
}
|
|
@@ -94,6 +93,17 @@ var TabContainer = _react2['default'].createClass({
|
|
|
94
93
|
};
|
|
95
94
|
},
|
|
96
95
|
|
|
96
|
+
componentWillUnmount: function componentWillUnmount() {
|
|
97
|
+
// isMounted() isn't `true` at this point;
|
|
98
|
+
this.unmounting = true;
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
handleSelect: function handleSelect(key) {
|
|
102
|
+
if (!this.unmounting) {
|
|
103
|
+
this.props.onSelect(key);
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
|
|
97
107
|
render: function render() {
|
|
98
108
|
var _props2 = this.props;
|
|
99
109
|
var children = _props2.children;
|
package/lib/TabContent.js
CHANGED
|
@@ -39,7 +39,12 @@ var TabContent = _react2['default'].createClass({
|
|
|
39
39
|
* Use `false` to disable, `true` to enable the default "Fade"
|
|
40
40
|
* animation or any `<Transition>` component.
|
|
41
41
|
*/
|
|
42
|
-
animation: _react.PropTypes.oneOfType([_react.PropTypes.bool, _reactPropTypesLibElementType2['default']])
|
|
42
|
+
animation: _react.PropTypes.oneOfType([_react.PropTypes.bool, _reactPropTypesLibElementType2['default']]),
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Unmount the tab (remove it from the DOM) when it is no longer visible
|
|
46
|
+
*/
|
|
47
|
+
unmountOnExit: _react.PropTypes.bool
|
|
43
48
|
},
|
|
44
49
|
|
|
45
50
|
contextTypes: {
|
|
@@ -55,14 +60,16 @@ var TabContent = _react2['default'].createClass({
|
|
|
55
60
|
animation: animationPropType,
|
|
56
61
|
activeKey: _react.PropTypes.any,
|
|
57
62
|
onExited: _react.PropTypes.func,
|
|
58
|
-
register: _react.PropTypes.func
|
|
63
|
+
register: _react.PropTypes.func,
|
|
64
|
+
unmountOnExit: _react.PropTypes.bool
|
|
59
65
|
})
|
|
60
66
|
},
|
|
61
67
|
|
|
62
68
|
getDefaultProps: function getDefaultProps() {
|
|
63
69
|
return {
|
|
64
70
|
componentClass: 'div',
|
|
65
|
-
animation: true
|
|
71
|
+
animation: true,
|
|
72
|
+
unmountOnExit: false
|
|
66
73
|
};
|
|
67
74
|
},
|
|
68
75
|
|
|
@@ -81,11 +88,16 @@ var TabContent = _react2['default'].createClass({
|
|
|
81
88
|
animation: this.props.animation,
|
|
82
89
|
activeKey: exitingPane ? undefined : this.getActiveKey(),
|
|
83
90
|
onExited: this.handlePaneExited,
|
|
84
|
-
register: this.registerPane
|
|
91
|
+
register: this.registerPane,
|
|
92
|
+
unmountOnExit: this.props.unmountOnExit
|
|
85
93
|
}
|
|
86
94
|
};
|
|
87
95
|
},
|
|
88
96
|
|
|
97
|
+
componentWillMount: function componentWillMount() {
|
|
98
|
+
this.panes = [];
|
|
99
|
+
},
|
|
100
|
+
|
|
89
101
|
/**
|
|
90
102
|
* This belongs in `componentWillReceiveProps()` but
|
|
91
103
|
* 0.14.x contains a bug where cwrp isn't called when only context changes.
|
|
@@ -134,7 +146,7 @@ var TabContent = _react2['default'].createClass({
|
|
|
134
146
|
registerPane: function registerPane(eventKey) {
|
|
135
147
|
var _this = this;
|
|
136
148
|
|
|
137
|
-
var panes = this.panes
|
|
149
|
+
var panes = this.panes;
|
|
138
150
|
|
|
139
151
|
!(panes.indexOf(eventKey) === -1) ? process.env.NODE_ENV !== 'production' ? _invariant2['default'](false, 'You cannot have multiple TabPanes of with the same `eventKey` in the same ' + 'TabContent component. Duplicate eventKey: ' + eventKey) : _invariant2['default'](false) : undefined;
|
|
140
152
|
|
|
@@ -142,6 +154,17 @@ var TabContent = _react2['default'].createClass({
|
|
|
142
154
|
|
|
143
155
|
return function () {
|
|
144
156
|
panes.splice(panes.indexOf(eventKey), 1);
|
|
157
|
+
|
|
158
|
+
// #1892
|
|
159
|
+
// new active state can propagate down _before_
|
|
160
|
+
// the tab actually unmounts, so it will map be exiting.
|
|
161
|
+
// since an exiting tab won't complete, clear the bad state
|
|
162
|
+
if (eventKey === _this._exitingPane) {
|
|
163
|
+
_this.handlePaneExited();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// If the tab was active, we need to tell the container
|
|
167
|
+
// that it no longer exists and as such is not active.
|
|
145
168
|
if (eventKey === _this.getActiveKey()) {
|
|
146
169
|
_this.getContext('$bs_tabcontainer').onSelect();
|
|
147
170
|
}
|
package/lib/TabPane.js
CHANGED
|
@@ -89,19 +89,26 @@ var TabPane = _react2['default'].createClass({
|
|
|
89
89
|
/**
|
|
90
90
|
* Transition onExited callback when animation is not `false`
|
|
91
91
|
*/
|
|
92
|
-
onExited: _react.PropTypes.func
|
|
92
|
+
onExited: _react.PropTypes.func,
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Unmount the tab (remove it from the DOM) when it is no longer visible
|
|
96
|
+
*/
|
|
97
|
+
unmountOnExit: _react.PropTypes.bool
|
|
93
98
|
},
|
|
94
99
|
|
|
95
100
|
contextTypes: {
|
|
96
101
|
$bs_tabcontainer: _react.PropTypes.shape({
|
|
97
|
-
getId: _react.PropTypes.func
|
|
102
|
+
getId: _react.PropTypes.func,
|
|
103
|
+
unmountOnExit: _react.PropTypes.bool
|
|
98
104
|
}),
|
|
99
105
|
$bs_tabcontent: _react.PropTypes.shape({
|
|
100
106
|
bsClass: _react.PropTypes.string,
|
|
101
107
|
animation: _react.PropTypes.oneOfType([_react.PropTypes.bool, _reactPropTypesLibElementType2['default']]),
|
|
102
108
|
activeKey: _react.PropTypes.any,
|
|
103
109
|
onExited: _react.PropTypes.func,
|
|
104
|
-
register: _react.PropTypes.func
|
|
110
|
+
register: _react.PropTypes.func,
|
|
111
|
+
unmountOnExit: _react.PropTypes.bool
|
|
105
112
|
})
|
|
106
113
|
},
|
|
107
114
|
|
|
@@ -158,6 +165,11 @@ var TabPane = _react2['default'].createClass({
|
|
|
158
165
|
return props.animation != null ? props.animation : context.animation;
|
|
159
166
|
},
|
|
160
167
|
|
|
168
|
+
getUnmountOnExit: function getUnmountOnExit() {
|
|
169
|
+
var context = this.getContext('$bs_tabcontent', this.context);
|
|
170
|
+
return this.props.unmountOnExit != null ? this.props.unmountOnExit : context.unmountOnExit;
|
|
171
|
+
},
|
|
172
|
+
|
|
161
173
|
isActive: function isActive() {
|
|
162
174
|
var props = arguments.length <= 0 || arguments[0] === undefined ? this.props : arguments[0];
|
|
163
175
|
var context = arguments.length <= 1 || arguments[1] === undefined ? this.context : arguments[1];
|
|
@@ -175,6 +187,10 @@ var TabPane = _react2['default'].createClass({
|
|
|
175
187
|
|
|
176
188
|
var Transition = this.getTransition();
|
|
177
189
|
|
|
190
|
+
if (!visible && !Transition && this.getUnmountOnExit()) {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
|
|
178
194
|
var classes = (_classes = {
|
|
179
195
|
active: visible
|
|
180
196
|
}, _classes[_utilsBootstrapUtils.prefix({ bsClass: bsClass }, 'pane')] = true, _classes);
|
|
@@ -222,7 +238,8 @@ var TabPane = _react2['default'].createClass({
|
|
|
222
238
|
onExited: _utilsCreateChainedFunction2['default'](this.handleExited, onExited),
|
|
223
239
|
onEnter: _utilsCreateChainedFunction2['default'](this.handleEnter, onEnter),
|
|
224
240
|
onEntering: onEntering,
|
|
225
|
-
onEntered: onEntered
|
|
241
|
+
onEntered: onEntered,
|
|
242
|
+
unmountOnExit: this.getUnmountOnExit()
|
|
226
243
|
},
|
|
227
244
|
tabPane
|
|
228
245
|
);
|
package/lib/Tabs.js
CHANGED
|
@@ -108,6 +108,11 @@ var Tabs = _react2['default'].createClass({
|
|
|
108
108
|
*/
|
|
109
109
|
onSelect: _react2['default'].PropTypes.func,
|
|
110
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Unmount tabs (remove it from the DOM) when it is no longer visible
|
|
113
|
+
*/
|
|
114
|
+
unmountOnExit: _react2['default'].PropTypes.bool,
|
|
115
|
+
|
|
111
116
|
/**
|
|
112
117
|
* @deprecated Use TabContainer to create differently shaped tab layouts.
|
|
113
118
|
*/
|
|
@@ -145,7 +150,8 @@ var Tabs = _react2['default'].createClass({
|
|
|
145
150
|
animation: true,
|
|
146
151
|
tabWidth: 2,
|
|
147
152
|
position: 'top',
|
|
148
|
-
standalone: false
|
|
153
|
+
standalone: false,
|
|
154
|
+
unmountOnExit: false
|
|
149
155
|
};
|
|
150
156
|
},
|
|
151
157
|
|
|
@@ -182,11 +188,13 @@ var Tabs = _react2['default'].createClass({
|
|
|
182
188
|
ref: 'tabs',
|
|
183
189
|
role: 'tablist'
|
|
184
190
|
});
|
|
191
|
+
|
|
185
192
|
var childTabs = _utilsValidComponentChildren2['default'].map(children, this.renderTab);
|
|
186
193
|
|
|
187
194
|
var panesProps = {
|
|
188
195
|
ref: 'panes',
|
|
189
|
-
animation: props.animation
|
|
196
|
+
animation: props.animation,
|
|
197
|
+
unmountOnExit: props.unmountOnExit
|
|
190
198
|
};
|
|
191
199
|
|
|
192
200
|
var childPanes = children;
|
package/package.json
CHANGED
package/README.md
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# react-bootstrap
|
|
2
|
-
|
|
3
|
-
[Bootstrap 3][bootstrap] components built with [React][react].
|
|
4
|
-
|
|
5
|
-
[![Travis Build Status][build-badge]][build]
|
|
6
|
-
[![Build status][appveyor-badge]][appveyor]
|
|
7
|
-
[![Coverage Status][coveralls-badge]][coveralls]
|
|
8
|
-
[![Discord][discord-badge]][discord]
|
|
9
|
-
[![Thinkful][thinkful-badge]][thinkful]
|
|
10
|
-
[![NPM version][npm-badge]][npm]
|
|
11
|
-
[![Bower version][bower-badge]][bower]
|
|
12
|
-
[![Dependency Status][deps-badge]][deps]
|
|
13
|
-
[![devDependency Status][dev-deps-badge]][dev-deps]
|
|
14
|
-
[![peerDependency Status][peer-deps-badge]][peer-deps]
|
|
15
|
-
|
|
16
|
-
__Under active development - APIs will change.__ Check out the [1.0.0 Roadmap](https://github.com/react-bootstrap/react-bootstrap/wiki#100-roadmap) and [Contributing Guidelines][contributing] to see where you can help out. Prior to the 1.0.0 release, deprecations or breaking changes should result in a Minor version bump.
|
|
17
|
-
|
|
18
|
-
## Docs
|
|
19
|
-
|
|
20
|
-
See the [documentation][documentation] with live editable examples.
|
|
21
|
-
|
|
22
|
-
## Related modules
|
|
23
|
-
|
|
24
|
-
- [react-router-bootstrap][react-router-bootstrap] - Integration with [react-router][react-router].
|
|
25
|
-
- [Complementary Tools][complementary-tools] - List of complementary tools that
|
|
26
|
-
can be used with React.
|
|
27
|
-
|
|
28
|
-
## Local Setup
|
|
29
|
-
|
|
30
|
-
- Install the dependencies with `npm install`
|
|
31
|
-
- Run tests `npm test`
|
|
32
|
-
- Run tests in watch mode `npm run test-watch`
|
|
33
|
-
- Run the docs site in development mode with `npm run docs`. This will watch
|
|
34
|
-
for file changes as you work. Simply refresh the page to see the updates.
|
|
35
|
-
- Build with `npm run build`
|
|
36
|
-
|
|
37
|
-
## Contributions
|
|
38
|
-
|
|
39
|
-
Yes please! See the [contributing guidelines][contributing] for details.
|
|
40
|
-
|
|
41
|
-
[bootstrap]: http://getbootstrap.com
|
|
42
|
-
[react]: http://facebook.github.io/react/
|
|
43
|
-
|
|
44
|
-
[documentation]: http://react-bootstrap.github.io
|
|
45
|
-
[contributing]: https://github.com/react-bootstrap/react-bootstrap/blob/master/CONTRIBUTING.md
|
|
46
|
-
|
|
47
|
-
[build-badge]: https://travis-ci.org/react-bootstrap/react-bootstrap.svg?branch=master
|
|
48
|
-
[build]: https://travis-ci.org/react-bootstrap/react-bootstrap
|
|
49
|
-
|
|
50
|
-
[npm-badge]: https://badge.fury.io/js/react-bootstrap.svg
|
|
51
|
-
[npm]: http://badge.fury.io/js/react-bootstrap
|
|
52
|
-
|
|
53
|
-
[bower-badge]: https://badge.fury.io/bo/react-bootstrap.svg
|
|
54
|
-
[bower]: http://badge.fury.io/bo/react-bootstrap
|
|
55
|
-
|
|
56
|
-
[deps-badge]: https://david-dm.org/react-bootstrap/react-bootstrap.svg
|
|
57
|
-
[deps]: https://david-dm.org/react-bootstrap/react-bootstrap
|
|
58
|
-
|
|
59
|
-
[dev-deps-badge]: https://david-dm.org/react-bootstrap/react-bootstrap/dev-status.svg
|
|
60
|
-
[dev-deps]: https://david-dm.org/react-bootstrap/react-bootstrap#info=devDependencies
|
|
61
|
-
|
|
62
|
-
[peer-deps-badge]: https://david-dm.org/react-bootstrap/react-bootstrap/peer-status.svg
|
|
63
|
-
[peer-deps]: https://david-dm.org/react-bootstrap/react-bootstrap#info=peerDependencies
|
|
64
|
-
|
|
65
|
-
[react-router-bootstrap]: https://github.com/react-bootstrap/react-router-bootstrap
|
|
66
|
-
[react-router]: https://github.com/rackt/react-router
|
|
67
|
-
|
|
68
|
-
[complementary-tools]: https://github.com/facebook/react/wiki/Complementary-Tools
|
|
69
|
-
|
|
70
|
-
[thinkful-badge]: https://tf-assets-staging.s3.amazonaws.com/badges/thinkful_repo_badge.svg
|
|
71
|
-
[thinkful]: http://start.thinkful.com/react/?utm_source=github&utm_medium=badge&utm_campaign=react-bootstrap
|
|
72
|
-
|
|
73
|
-
[appveyor-badge]: https://ci.appveyor.com/api/projects/status/ylitpyo6n5yq1s6i/branch/master?svg=true
|
|
74
|
-
[appveyor]: https://ci.appveyor.com/project/react-bootstrap/react-bootstrap/branch/master
|
|
75
|
-
|
|
76
|
-
[coveralls-badge]: https://coveralls.io/repos/react-bootstrap/react-bootstrap/badge.svg?branch=master&service=github
|
|
77
|
-
[coveralls]: https://coveralls.io/github/react-bootstrap/react-bootstrap?branch=master
|
|
78
|
-
|
|
79
|
-
[discord-badge]: https://img.shields.io/badge/Discord-Join%20chat%20%E2%86%92-738bd7.svg
|
|
80
|
-
[discord]: https://discord.gg/0ZcbPKXt5bXLs9XK
|