react-bootstrap 0.29.4 → 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/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.refs.menu), _domHelpersActiveElement2['default'](document));
139
+ this._focusInDropdown = _domHelpersQueryContains2['default'](_reactDom2['default'].findDOMNode(this.menu), _domHelpersActiveElement2['default'](document));
137
140
  }
138
141
  };
139
142
 
@@ -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.refs.menu.focusNext) {
210
- this.refs.menu.focusNext();
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.refs.menu;
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.refs[TOGGLE_REF]);
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: 'menu',
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
 
@@ -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 controll consider
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,
@@ -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: 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
@@ -154,6 +154,17 @@ var TabContent = _react2['default'].createClass({
154
154
 
155
155
  return function () {
156
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.
157
168
  if (eventKey === _this.getActiveKey()) {
158
169
  _this.getContext('$bs_tabcontainer').onSelect();
159
170
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-bootstrap",
3
- "version": "0.29.4",
3
+ "version": "0.29.5",
4
4
  "description": "Bootstrap 3 components built with React",
5
5
  "repository": {
6
6
  "type": "git",