react-bootstrap
Advanced tools
Comparing version 0.10.1 to 0.10.2
{ | ||
"name": "react-bootstrap", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"description": "Bootstrap 3 components build with React", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
@@ -31,3 +31,3 @@ "use strict"; | ||
'aria-hidden':"true"}, | ||
"×" | ||
" × " | ||
) | ||
@@ -34,0 +34,0 @@ ); |
@@ -38,3 +38,3 @@ "use strict"; | ||
className:className, | ||
onClick:this.handleOpenClick, | ||
onClick:this.handleDropdownClick, | ||
id:this.props.id, | ||
@@ -86,6 +86,6 @@ key:0, | ||
handleOpenClick: function (e) { | ||
this.setDropdownState(true); | ||
handleDropdownClick: function (e) { | ||
e.preventDefault(); | ||
e.preventDefault(); | ||
this.setDropdownState(!this.state.open); | ||
}, | ||
@@ -92,0 +92,0 @@ |
"use strict"; | ||
var React = require("./react-es6")["default"]; | ||
/** | ||
* Checks whether a node is within | ||
* a root nodes tree | ||
* | ||
* @param {DOMElement} node | ||
* @param {DOMElement} root | ||
* @returns {boolean} | ||
*/ | ||
function isNodeInRoot(node, root) { | ||
while (node) { | ||
if (node === root) { | ||
return true; | ||
} | ||
node = node.parentNode; | ||
} | ||
return false; | ||
} | ||
var DropdownStateMixin = { | ||
@@ -29,3 +48,9 @@ getInitialState: function () { | ||
handleClickOutside: function () { | ||
handleDocumentClick: function (e) { | ||
// If the click originated from within this component | ||
// don't do anything. | ||
if (isNodeInRoot(e.target, this.getDOMNode())) { | ||
return; | ||
} | ||
this.setDropdownState(false); | ||
@@ -35,3 +60,3 @@ }, | ||
bindRootCloseHandlers: function () { | ||
document.addEventListener('click', this.handleClickOutside); | ||
document.addEventListener('click', this.handleDocumentClick); | ||
document.addEventListener('keyup', this.handleKeyUp); | ||
@@ -41,3 +66,3 @@ }, | ||
unbindRootCloseHandlers: function () { | ||
document.removeEventListener('click', this.handleClickOutside); | ||
document.removeEventListener('click', this.handleDocumentClick); | ||
document.removeEventListener('keyup', this.handleKeyUp); | ||
@@ -44,0 +69,0 @@ }, |
@@ -51,2 +51,3 @@ "use strict"; | ||
className:classSet(classes), | ||
onClick:this.props.backdrop === true ? this.handleBackdropClick : null, | ||
ref:"modal"}, | ||
@@ -53,0 +54,0 @@ React.DOM.div( {className:"modal-dialog"}, |
@@ -45,3 +45,3 @@ "use strict"; | ||
bsStyle:this.props.bsStyle, | ||
onClick:this.props.onClick}, | ||
onClick:this.handleButtonClick}, | ||
this.props.title | ||
@@ -54,3 +54,3 @@ ), | ||
className:"dropdown-toggle", | ||
onClick:this.handleOpenClick}, | ||
onClick:this.handleDropdownClick}, | ||
React.DOM.span( {className:"sr-only"}, this.props.dropdownTitle), | ||
@@ -71,6 +71,16 @@ React.DOM.span( {className:"caret"} ) | ||
handleOpenClick: function (e) { | ||
handleButtonClick: function (e) { | ||
if (this.state.open) { | ||
this.setDropdownState(false); | ||
} | ||
if (this.props.onClick) { | ||
this.props.onClick(e); | ||
} | ||
}, | ||
handleDropdownClick: function (e) { | ||
e.preventDefault(); | ||
this.setDropdownState(true); | ||
this.setDropdownState(!this.state.open); | ||
}, | ||
@@ -77,0 +87,0 @@ |
@@ -19,3 +19,3 @@ "use strict"; | ||
title: React.PropTypes.string, | ||
text: React.PropTypes.renderable, | ||
text: React.PropTypes.renderable | ||
}, | ||
@@ -22,0 +22,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
127083
4047