@@ -16,9 +16,13 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
1616
1717function _inherits ( subClass , superClass ) { if ( typeof superClass !== 'function' && superClass !== null ) { throw new TypeError ( 'Super expression must either be null or a function, not ' + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . __proto__ = superClass ; }
1818
19- var _react = require ( 'react' ) ;
19+ var _reactLibReactWithAddons = require ( 'react/lib/ReactWithAddons ' ) ;
2020
21- var _react2 = _interopRequireDefault ( _react ) ;
21+ var _reactLibReactWithAddons2 = _interopRequireDefault ( _reactLibReactWithAddons ) ;
22+
23+ var _reactDom = require ( 'react-dom' ) ;
24+
25+ var _reactDom2 = _interopRequireDefault ( _reactDom ) ;
2226
2327var _reactBootstrap = require ( 'react-bootstrap' ) ;
2428
@@ -34,6 +38,8 @@ var _lodashFunctionDebounce = require('lodash/function/debounce');
3438
3539var _lodashFunctionDebounce2 = _interopRequireDefault ( _lodashFunctionDebounce ) ;
3640
41+ var caret = _reactLibReactWithAddons2 [ 'default' ] . createElement ( 'span' , { className : 'caret' } ) ;
42+
3743var uid = 0 ;
3844
3945/**
@@ -44,7 +50,7 @@ var uid = 0;
4450 * @example
4551 * import {Combo} from 'react-bootstrap-combobox';
4652 *
47- * React .render(<Combo items={{
53+ * ReactDOM .render(<Combo items={{
4854 * // keys must be unique
4955 * a: {label: 'first item', header: true}, // any combination of props supported by MenuItem
5056 * b: 'second item', // same as {label: 'second item'}
@@ -116,7 +122,7 @@ var Combo = (function (_React$Component) {
116122 _createClass ( Combo , [ {
117123 key : 'shouldComponentUpdate' ,
118124 value : function shouldComponentUpdate ( props , state ) {
119- return props . onChange !== this . props . onChange || props . items !== this . props . items || props . value !== this . props . value || state . maxHeight !== this . state . maxHeight ;
125+ return _reactLibReactWithAddons2 [ 'default' ] . addons . shallowCompare ( this , props , state ) ;
120126 }
121127
122128 /**
@@ -166,7 +172,7 @@ var Combo = (function (_React$Component) {
166172 }
167173 this . viewportHeight = height ;
168174
169- this . setState ( { maxHeight : height - _react2 [ 'default' ] . findDOMNode ( this ) . getBoundingClientRect ( ) . bottom - 5 } ) ;
175+ this . setState ( { maxHeight : height - _reactDom2 [ 'default' ] . findDOMNode ( this ) . getBoundingClientRect ( ) . bottom - 5 } ) ;
170176 }
171177
172178 /**
@@ -213,14 +219,14 @@ var Combo = (function (_React$Component) {
213219 } , {
214220 key : 'renderButton' ,
215221 value : function renderButton ( ) {
216- return _react2 [ 'default' ] . createElement (
222+ return _reactLibReactWithAddons2 [ 'default' ] . createElement (
217223 _reactBootstrap . Button ,
218224 { block : true , bsRole : 'toggle' , className : 'dropdown-toggle' } ,
219- _react2 [ 'default' ] . createElement (
225+ _reactLibReactWithAddons2 [ 'default' ] . createElement (
220226 'div' ,
221227 null ,
222228 this . getLabel ( ) ,
223- _react2 [ 'default' ] . createElement ( 'span' , { className : ' caret' } )
229+ caret
224230 )
225231 ) ;
226232 }
@@ -241,12 +247,12 @@ var Combo = (function (_React$Component) {
241247 value : function renderMenuItem ( item , i ) {
242248 item = this . normalize ( item ) ;
243249 if ( item . divider ) {
244- return _react2 [ 'default' ] . createElement ( _reactBootstrap . MenuItem , { key : i , divider : true } ) ;
250+ return _reactLibReactWithAddons2 [ 'default' ] . createElement ( _reactBootstrap . MenuItem , { key : i , divider : true } ) ;
245251 }
246- return _react2 [ 'default' ] . createElement (
252+ return _reactLibReactWithAddons2 [ 'default' ] . createElement (
247253 _reactBootstrap . MenuItem ,
248254 _extends ( { key : i , eventKey : i , active : i === this . props . value } , item ) ,
249- _react2 [ 'default' ] . createElement (
255+ _reactLibReactWithAddons2 [ 'default' ] . createElement (
250256 'div' ,
251257 null ,
252258 item . label
@@ -266,7 +272,7 @@ var Combo = (function (_React$Component) {
266272 } , {
267273 key : 'renderMenu' ,
268274 value : function renderMenu ( ) {
269- return _react2 [ 'default' ] . createElement (
275+ return _reactLibReactWithAddons2 [ 'default' ] . createElement (
270276 _reactBootstrap . Dropdown . Menu ,
271277 { style : this . state } ,
272278 ( 0 , _lodashCollectionMap2 [ 'default' ] ) ( this . props . items , this . renderMenuItem , this )
@@ -285,7 +291,7 @@ var Combo = (function (_React$Component) {
285291 } , {
286292 key : 'render' ,
287293 value : function render ( ) {
288- return _react2 [ 'default' ] . createElement (
294+ return _reactLibReactWithAddons2 [ 'default' ] . createElement (
289295 _reactBootstrap . Dropdown ,
290296 { className : 'al-combo' , id : this . id , onSelect : this . props . onChange } ,
291297 this . renderButton ( ) ,
@@ -295,14 +301,14 @@ var Combo = (function (_React$Component) {
295301 } ] ) ;
296302
297303 return Combo ;
298- } ) ( _react2 [ 'default' ] . Component ) ;
304+ } ) ( _reactLibReactWithAddons2 [ 'default' ] . Component ) ;
299305
300306exports [ 'default' ] = Combo ;
301307
302308Combo . propTypes = {
303- onChange : _react2 [ 'default' ] . PropTypes . func ,
304- items : _react2 [ 'default' ] . PropTypes . object . isRequired ,
305- value : _react2 [ 'default' ] . PropTypes . string . isRequired
309+ onChange : _reactLibReactWithAddons2 [ 'default' ] . PropTypes . func ,
310+ items : _reactLibReactWithAddons2 [ 'default' ] . PropTypes . object . isRequired ,
311+ value : _reactLibReactWithAddons2 [ 'default' ] . PropTypes . string . isRequired
306312} ;
307313Combo . defaultProps = { onChange : Function . prototype } ;
308314module . exports = exports [ 'default' ] ;
0 commit comments