Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-draggable

Package Overview
Dependencies
Maintainers
2
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-draggable - npm Package Compare versions

Comparing version 1.3.4 to 1.3.6

2

bower.json
{
"name": "react-draggable",
"version": "1.3.4",
"version": "1.3.6",
"homepage": "https://github.com/mzabriskie/react-draggable",

@@ -5,0 +5,0 @@ "authors": [

# Changelog
### 1.3.4 (Mar 5, 2015)
### 1.3.6 (Apr 8, 2016)
- Republish after 1.3.5 contained a bundling error.
### 1.3.5 (Apr 8, 2016)
- Add React v15 to devDeps. `<Draggable>` supports both `v0.14` and `v15`.
- Enhancement: Clean up usage of browser prefixes; modern browsers will no longer use them.
- This also removes the duplicated `user-select` style that is created on the `<body>` while dragging.
- Internal: Test fixes.
### 1.3.4 (Mar 5, 2016)
- Bugfix: Scrolling while dragging caused items to move unpredictably.
### 1.3.3 (Feb 11, 2015)
### 1.3.3 (Feb 11, 2016)
- Bugfix: #116: Android/Chrome are finicky; give up on canceling ghost clicks entirely.
### 1.3.2 (Feb 11, 2015)
### 1.3.2 (Feb 11, 2016)
- Bugfix: #116: Child inputs not focusing on touch events.
### 1.3.1 (Feb 10, 2015)
### 1.3.1 (Feb 10, 2016)

@@ -21,3 +32,3 @@ - Internal: Babel 6 and Flow definitions

### 1.3.0 (Feb 10, 2015)
### 1.3.0 (Feb 10, 2016)

@@ -29,3 +40,3 @@ - Possibly breaking change: bounds are calculated before `<Draggable>` fires `drag` events, as they should have been.

### 1.2.0 (Feb 5, 2015)
### 1.2.0 (Feb 5, 2016)

@@ -32,0 +43,0 @@ - Added arbitrary boundary selector. Now you don't have to just use `'parent'`, you can select any element

@@ -412,4 +412,4 @@ (function webpackUniversalModuleDefinition(root, factory) {

var __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2015 Jed Watson.
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see

@@ -426,3 +426,3 @@ http://jedwatson.github.io/classnames

function classNames () {
var classes = '';
var classes = [];

@@ -436,9 +436,9 @@ for (var i = 0; i < arguments.length; i++) {

if (argType === 'string' || argType === 'number') {
classes += ' ' + arg;
classes.push(arg);
} else if (Array.isArray(arg)) {
classes += ' ' + classNames.apply(null, arg);
classes.push(classNames.apply(null, arg));
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes += ' ' + key;
classes.push(key);
}

@@ -449,3 +449,3 @@ }

return classes.substr(1);
return classes.join(' ');
}

@@ -457,5 +457,5 @@

// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_RESULT__ = function () {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
return classNames;
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {

@@ -605,6 +605,3 @@ window.classNames = classNames;

// Useful for preventing blue highlights all over everything when dragging.
var userSelectStyle = ';user-select: none;';
if (_getPrefix2.default) {
userSelectStyle += '-' + _getPrefix2.default.toLowerCase() + '-user-select: none;';
}
var userSelectStyle = ';' + (_getPrefix2.default ? '-' + _getPrefix2.default.toLowerCase() + '-' : '') + 'user-select: none;';

@@ -724,10 +721,15 @@ function addUserSelectStyles() {

// Thanks David Walsh
var styles = window.getComputedStyle(document.documentElement, ''),
pre = (Array.prototype.slice.call(styles).join('').match(/-(moz|webkit|ms)-/) || (styles.OLink === '' ? ['', 'o'] : []))[1];
// 'ms' is not titlecased
if (pre === undefined || pre === null) return '';
if (pre === 'ms') return pre;
if (pre === undefined || pre === null) return '';
return pre.slice(0, 1).toUpperCase() + pre.slice(1);
var prefixes = ['Moz', 'Webkit', 'O', 'ms'];
var style = window.document.documentElement.style;
if ('transform' in style) {
return '';
}
for (var i = 0; i < prefixes.length; ++i) {
if (prefixes[i] + 'Transform' in style) {
return prefixes[i];
}
}
return '';
}

@@ -777,3 +779,3 @@

if (typeof bounds === 'string') {
var boundNode = undefined;
var boundNode = void 0;
if (bounds === 'parent') {

@@ -1072,2 +1074,10 @@ boundNode = node.parentNode;

_this.props.onDrag(e, coreEvent);
}, _this.onMouseDown = function (e) {
dragEventFor = eventsFor.mouse; // on touchscreen laptops we could switch back to mouse
return _this.handleDragStart(e);
}, _this.onMouseUp = function (e) {
dragEventFor = eventsFor.mouse;
return _this.handleDragStop(e);
}, _this.onTouchStart = function (e) {

@@ -1115,5 +1125,5 @@ // We're on a touch device now, so change the event handlers

// when the user drags quickly and leaves the bounds of the element.
onMouseDown: this.handleDragStart,
onMouseDown: this.onMouseDown,
onTouchStart: this.onTouchStart,
onMouseUp: this.handleDragStop,
onMouseUp: this.onMouseUp,
onTouchEnd: this.onTouchEnd

@@ -1120,0 +1130,0 @@ });

@@ -1,2 +0,2 @@

!function(root,factory){"object"==typeof exports&&"object"==typeof module?module.exports=factory(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],factory):"object"==typeof exports?exports.ReactDraggable=factory(require("react"),require("react-dom")):root.ReactDraggable=factory(root.React,root.ReactDOM)}(this,function(__WEBPACK_EXTERNAL_MODULE_2__,__WEBPACK_EXTERNAL_MODULE_3__){return function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([function(module,exports,__webpack_require__){"use strict";module.exports=__webpack_require__(1)["default"],module.exports.DraggableCore=__webpack_require__(9)["default"]},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)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:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target},_slicedToArray=function(){function sliceIterator(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _s,_i=arr[Symbol.iterator]();!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{!_n&&_i["return"]&&_i["return"]()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr))return arr;if(Symbol.iterator in Object(arr))return sliceIterator(arr,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_react=__webpack_require__(2),_react2=_interopRequireDefault(_react),_reactDom=__webpack_require__(3),_reactDom2=_interopRequireDefault(_reactDom),_classnames=__webpack_require__(4),_classnames2=_interopRequireDefault(_classnames),_domFns=__webpack_require__(5),_positionFns=__webpack_require__(8),_shims=__webpack_require__(6),_DraggableCore=__webpack_require__(9),_DraggableCore2=_interopRequireDefault(_DraggableCore),_log=__webpack_require__(10),_log2=_interopRequireDefault(_log),Draggable=function(_React$Component){function Draggable(){var _Object$getPrototypeO,_temp,_this,_ret;_classCallCheck(this,Draggable);for(var _len=arguments.length,args=Array(_len),_key=0;_len>_key;_key++)args[_key]=arguments[_key];return _temp=_this=_possibleConstructorReturn(this,(_Object$getPrototypeO=Object.getPrototypeOf(Draggable)).call.apply(_Object$getPrototypeO,[this].concat(args))),_this.state={dragging:!1,dragged:!1,clientX:_this.props.start.x,clientY:_this.props.start.y,slackX:0,slackY:0,isElementSVG:!1},_this.onDragStart=function(e,coreEvent){(0,_log2["default"])("Draggable: onDragStart: %j",coreEvent.position);var shouldStart=_this.props.onStart(e,(0,_domFns.createUIEvent)(_this,coreEvent));return shouldStart===!1?!1:void _this.setState({dragging:!0,dragged:!0})},_this.onDrag=function(e,coreEvent){if(!_this.state.dragging)return!1;(0,_log2["default"])("Draggable: onDrag: %j",coreEvent.position);var uiEvent=(0,_domFns.createUIEvent)(_this,coreEvent),newState={clientX:uiEvent.position.left,clientY:uiEvent.position.top};if(_this.props.bounds){var _clientX=newState.clientX,_clientY=newState.clientY;newState.clientX+=_this.state.slackX,newState.clientY+=_this.state.slackY;var _getBoundPosition=(0,_positionFns.getBoundPosition)(_this,newState.clientX,newState.clientY),_getBoundPosition2=_slicedToArray(_getBoundPosition,2);newState.clientX=_getBoundPosition2[0],newState.clientY=_getBoundPosition2[1],newState.slackX=_this.state.slackX+(_clientX-newState.clientX),newState.slackY=_this.state.slackY+(_clientY-newState.clientY),uiEvent.position.left=_clientX,uiEvent.position.top=_clientY,uiEvent.deltaX=newState.clientX-_this.state.clientX,uiEvent.deltaY=newState.clientY-_this.state.clientY}var shouldUpdate=_this.props.onDrag(e,uiEvent);return shouldUpdate===!1?!1:void _this.setState(newState)},_this.onDragStop=function(e,coreEvent){if(!_this.state.dragging)return!1;var shouldStop=_this.props.onStop(e,(0,_domFns.createUIEvent)(_this,coreEvent));return shouldStop===!1?!1:((0,_log2["default"])("Draggable: onDragStop: %j",coreEvent.position),void _this.setState({dragging:!1,slackX:0,slackY:0}))},_ret=_temp,_possibleConstructorReturn(_this,_ret)}return _inherits(Draggable,_React$Component),_createClass(Draggable,[{key:"componentDidMount",value:function(){_reactDom2["default"].findDOMNode(this)instanceof SVGElement&&this.setState({isElementSVG:!0})}},{key:"componentWillUnmount",value:function(){this.setState({dragging:!1})}},{key:"render",value:function(){var style={},svgTransform=null,transformOpts={x:(0,_positionFns.canDragX)(this)?this.state.clientX:this.props.start.x,y:(0,_positionFns.canDragY)(this)?this.state.clientY:this.props.start.y};this.state.isElementSVG?svgTransform=(0,_domFns.createSVGTransform)(transformOpts):style=(0,_domFns.createCSSTransform)(transformOpts),this.state.dragging&&!isNaN(this.props.zIndex)&&(style.zIndex=this.props.zIndex);var className=(0,_classnames2["default"])(this.props.children.props.className||"","react-draggable",{"react-draggable-dragging":this.state.dragging,"react-draggable-dragged":this.state.dragged});return _react2["default"].createElement(_DraggableCore2["default"],_extends({},this.props,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),_react2["default"].cloneElement(_react2["default"].Children.only(this.props.children),{className:className,style:_extends({},this.props.children.props.style,style),transform:svgTransform}))}}]),Draggable}(_react2["default"].Component);Draggable.displayName="Draggable",Draggable.propTypes=_extends({},_DraggableCore2["default"].propTypes,{axis:_react.PropTypes.oneOf(["both","x","y","none"]),bounds:_react.PropTypes.oneOfType([_react.PropTypes.shape({left:_react.PropTypes.Number,right:_react.PropTypes.Number,top:_react.PropTypes.Number,bottom:_react.PropTypes.Number}),_react.PropTypes.string,_react.PropTypes.oneOf([!1])]),start:_react.PropTypes.shape({x:_react.PropTypes.number,y:_react.PropTypes.number}),zIndex:_react.PropTypes.number,className:_shims.dontSetMe,style:_shims.dontSetMe,transform:_shims.dontSetMe}),Draggable.defaultProps=_extends({},_DraggableCore2["default"].defaultProps,{axis:"both",bounds:!1,start:{x:0,y:0},zIndex:NaN}),exports["default"]=Draggable},function(module,exports){module.exports=__WEBPACK_EXTERNAL_MODULE_2__},function(module,exports){module.exports=__WEBPACK_EXTERNAL_MODULE_3__},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;!function(){"use strict";function classNames(){for(var classes="",i=0;i<arguments.length;i++){var arg=arguments[i];if(arg){var argType=typeof arg;if("string"===argType||"number"===argType)classes+=" "+arg;else if(Array.isArray(arg))classes+=" "+classNames.apply(null,arg);else if("object"===argType)for(var key in arg)hasOwn.call(arg,key)&&arg[key]&&(classes+=" "+key)}}return classes.substr(1)}var hasOwn={}.hasOwnProperty;"undefined"!=typeof module&&module.exports?module.exports=classNames:(__WEBPACK_AMD_DEFINE_RESULT__=function(){return classNames}.call(exports,__webpack_require__,exports,module),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))}()},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function matchesSelector(el,selector){return matchesSelectorFunc||(matchesSelectorFunc=(0,_shims.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(method){return(0,_shims.isFunction)(el[method])})),el[matchesSelectorFunc].call(el,selector)}function addEvent(el,event,handler){el&&(el.attachEvent?el.attachEvent("on"+event,handler):el.addEventListener?el.addEventListener(event,handler,!0):el["on"+event]=handler)}function removeEvent(el,event,handler){el&&(el.detachEvent?el.detachEvent("on"+event,handler):el.removeEventListener?el.removeEventListener(event,handler,!0):el["on"+event]=null)}function outerHeight(node){var height=node.clientHeight,computedStyle=window.getComputedStyle(node);return height+=(0,_shims["int"])(computedStyle.borderTopWidth),height+=(0,_shims["int"])(computedStyle.borderBottomWidth)}function outerWidth(node){var width=node.clientWidth,computedStyle=window.getComputedStyle(node);return width+=(0,_shims["int"])(computedStyle.borderLeftWidth),width+=(0,_shims["int"])(computedStyle.borderRightWidth)}function innerHeight(node){var height=node.clientHeight,computedStyle=window.getComputedStyle(node);return height-=(0,_shims["int"])(computedStyle.paddingTop),height-=(0,_shims["int"])(computedStyle.paddingBottom)}function innerWidth(node){var width=node.clientWidth,computedStyle=window.getComputedStyle(node);return width-=(0,_shims["int"])(computedStyle.paddingLeft),width-=(0,_shims["int"])(computedStyle.paddingRight)}function createCSSTransform(_ref){var x=_ref.x,y=_ref.y,out={transform:"translate("+x+"px,"+y+"px)"};return _getPrefix2["default"]&&(out[_getPrefix2["default"]+"Transform"]=out.transform),out}function createSVGTransform(_ref2){var x=_ref2.x,y=_ref2.y;return"translate("+x+","+y+")"}function addUserSelectStyles(){var style=document.body.getAttribute("style")||"";document.body.setAttribute("style",style+userSelectStyle)}function removeUserSelectStyles(){var style=document.body.getAttribute("style")||"";document.body.setAttribute("style",style.replace(userSelectStyle,""))}function styleHacks(){var childStyle=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return _extends({touchAction:"none"},childStyle)}function createCoreEvent(draggable,clientX,clientY){var state=draggable._pendingState||draggable.state,isStart=!(0,_shims.isNum)(state.lastX);return{node:_reactDom2["default"].findDOMNode(draggable),position:isStart?{deltaX:0,deltaY:0,lastX:clientX,lastY:clientY,clientX:clientX,clientY:clientY}:{deltaX:clientX-state.lastX,deltaY:clientY-state.lastY,lastX:state.lastX,lastY:state.lastY,clientX:clientX,clientY:clientY}}}function createUIEvent(draggable,coreEvent){return{node:_reactDom2["default"].findDOMNode(draggable),position:{left:draggable.state.clientX+coreEvent.position.deltaX,top:draggable.state.clientY+coreEvent.position.deltaY},deltaX:coreEvent.position.deltaX,deltaY:coreEvent.position.deltaY}}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target};exports.matchesSelector=matchesSelector,exports.addEvent=addEvent,exports.removeEvent=removeEvent,exports.outerHeight=outerHeight,exports.outerWidth=outerWidth,exports.innerHeight=innerHeight,exports.innerWidth=innerWidth,exports.createCSSTransform=createCSSTransform,exports.createSVGTransform=createSVGTransform,exports.addUserSelectStyles=addUserSelectStyles,exports.removeUserSelectStyles=removeUserSelectStyles,exports.styleHacks=styleHacks,exports.createCoreEvent=createCoreEvent,exports.createUIEvent=createUIEvent;var _shims=__webpack_require__(6),_getPrefix=__webpack_require__(7),_getPrefix2=_interopRequireDefault(_getPrefix),_reactDom=__webpack_require__(3),_reactDom2=_interopRequireDefault(_reactDom),matchesSelectorFunc="",userSelectStyle=";user-select: none;";_getPrefix2["default"]&&(userSelectStyle+="-"+_getPrefix2["default"].toLowerCase()+"-user-select: none;")},function(module,exports){"use strict";function findInArray(array,callback){for(var i=0,length=array.length;length>i;i++)if(callback.apply(callback,[array[i],i,array]))return array[i]}function isFunction(func){return"function"==typeof func||"[object Function]"===Object.prototype.toString.call(func)}function isNum(num){return"number"==typeof num&&!isNaN(num)}function int(a){return parseInt(a,10)}function dontSetMe(props,propName,componentName){if(props[propName])throw new Error("Invalid prop "+propName+" passed to "+componentName+" - do not set this, set it on the child.")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.findInArray=findInArray,exports.isFunction=isFunction,exports.isNum=isNum,exports["int"]=int,exports.dontSetMe=dontSetMe},function(module,exports){"use strict";function generatePrefix(){if("undefined"==typeof window||"undefined"==typeof window.document)return"";var styles=window.getComputedStyle(document.documentElement,""),pre=(Array.prototype.slice.call(styles).join("").match(/-(moz|webkit|ms)-/)||(""===styles.OLink?["","o"]:[]))[1];return void 0===pre||null===pre?"":"ms"===pre?pre:void 0===pre||null===pre?"":pre.slice(0,1).toUpperCase()+pre.slice(1)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.generatePrefix=generatePrefix,exports["default"]=generatePrefix()},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function getBoundPosition(draggable,clientX,clientY){if(!draggable.props.bounds)return[clientX,clientY];var bounds=draggable.props.bounds;bounds="string"==typeof bounds?bounds:cloneBounds(bounds);var node=_reactDom2["default"].findDOMNode(draggable);if("string"==typeof bounds){var boundNode=void 0;if("parent"===bounds)boundNode=node.parentNode;else if(boundNode=document.querySelector(bounds),!boundNode)throw new Error('Bounds selector "'+bounds+'" could not find an element.');var nodeStyle=window.getComputedStyle(node),boundNodeStyle=window.getComputedStyle(boundNode);bounds={left:-node.offsetLeft+(0,_shims["int"])(boundNodeStyle.paddingLeft)+(0,_shims["int"])(nodeStyle.borderLeftWidth)+(0,_shims["int"])(nodeStyle.marginLeft),top:-node.offsetTop+(0,_shims["int"])(boundNodeStyle.paddingTop)+(0,_shims["int"])(nodeStyle.borderTopWidth)+(0,_shims["int"])(nodeStyle.marginTop),right:(0,_domFns.innerWidth)(boundNode)-(0,_domFns.outerWidth)(node)-node.offsetLeft,bottom:(0,_domFns.innerHeight)(boundNode)-(0,_domFns.outerHeight)(node)-node.offsetTop}}return(0,_shims.isNum)(bounds.right)&&(clientX=Math.min(clientX,bounds.right)),(0,_shims.isNum)(bounds.bottom)&&(clientY=Math.min(clientY,bounds.bottom)),(0,_shims.isNum)(bounds.left)&&(clientX=Math.max(clientX,bounds.left)),(0,_shims.isNum)(bounds.top)&&(clientY=Math.max(clientY,bounds.top)),[clientX,clientY]}function snapToGrid(grid,pendingX,pendingY){var x=Math.round(pendingX/grid[0])*grid[0],y=Math.round(pendingY/grid[1])*grid[1];return[x,y]}function canDragX(draggable){return"both"===draggable.props.axis||"x"===draggable.props.axis}function canDragY(draggable){return"both"===draggable.props.axis||"y"===draggable.props.axis}function getControlPosition(e){var position=e.targetTouches&&e.targetTouches[0]||e;return{clientX:position.clientX,clientY:position.clientY}}function cloneBounds(bounds){return{left:bounds.left,top:bounds.top,right:bounds.right,bottom:bounds.bottom}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getBoundPosition=getBoundPosition,exports.snapToGrid=snapToGrid,exports.canDragX=canDragX,exports.canDragY=canDragY,exports.getControlPosition=getControlPosition;var _react=__webpack_require__(2),_shims=(_interopRequireDefault(_react),__webpack_require__(6)),_reactDom=__webpack_require__(3),_reactDom2=_interopRequireDefault(_reactDom),_domFns=__webpack_require__(5)},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)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:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0});var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _s,_i=arr[Symbol.iterator]();!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{!_n&&_i["return"]&&_i["return"]()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr))return arr;if(Symbol.iterator in Object(arr))return sliceIterator(arr,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_react=__webpack_require__(2),_react2=_interopRequireDefault(_react),_domFns=__webpack_require__(5),_positionFns=__webpack_require__(8),_shims=__webpack_require__(6),_log=__webpack_require__(10),_log2=_interopRequireDefault(_log),eventsFor={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}},dragEventFor=eventsFor.mouse,DraggableCore=function(_React$Component){function DraggableCore(){var _Object$getPrototypeO,_temp,_this,_ret;_classCallCheck(this,DraggableCore);for(var _len=arguments.length,args=Array(_len),_key=0;_len>_key;_key++)args[_key]=arguments[_key];return _temp=_this=_possibleConstructorReturn(this,(_Object$getPrototypeO=Object.getPrototypeOf(DraggableCore)).call.apply(_Object$getPrototypeO,[this].concat(args))),_this.state={dragging:!1,lastX:null,lastY:null},_this.handleDragStart=function(e){if(_this.props.onMouseDown(e),!_this.props.allowAnyClick&&"number"==typeof e.button&&0!==e.button)return!1;if(!(_this.props.disabled||_this.props.handle&&!(0,_domFns.matchesSelector)(e.target,_this.props.handle)||_this.props.cancel&&(0,_domFns.matchesSelector)(e.target,_this.props.cancel))){e.targetTouches&&_this.setState({touchIdentifier:e.targetTouches[0].identifier}),_this.props.enableUserSelectHack&&(0,_domFns.addUserSelectStyles)();var _getControlPosition=(0,_positionFns.getControlPosition)(e),clientX=_getControlPosition.clientX,clientY=_getControlPosition.clientY,coreEvent=(0,_domFns.createCoreEvent)(_this,clientX,clientY);(0,_log2["default"])("DraggableCore: handleDragStart: %j",coreEvent.position),(0,_log2["default"])("calling",_this.props.onStart);var shouldUpdate=_this.props.onStart(e,coreEvent);shouldUpdate!==!1&&(_this.setState({dragging:!0,lastX:clientX,lastY:clientY,scrollX:document.body.scrollLeft,scrollY:document.body.scrollTop}),(0,_domFns.addEvent)(document,"scroll",_this.handleScroll),(0,_domFns.addEvent)(document,dragEventFor.move,_this.handleDrag),(0,_domFns.addEvent)(document,dragEventFor.stop,_this.handleDragStop))}},_this.handleDrag=function(e){if(!e.targetTouches||e.targetTouches[0].identifier===_this.state.touchIdentifier){var _getControlPosition2=(0,_positionFns.getControlPosition)(e),clientX=_getControlPosition2.clientX,clientY=_getControlPosition2.clientY;if(Array.isArray(_this.props.grid)){var deltaX=clientX-_this.state.lastX,deltaY=clientY-_this.state.lastY,_snapToGrid=(0,_positionFns.snapToGrid)(_this.props.grid,deltaX,deltaY),_snapToGrid2=_slicedToArray(_snapToGrid,2);if(deltaX=_snapToGrid2[0],deltaY=_snapToGrid2[1],!deltaX&&!deltaY)return;clientX=_this.state.lastX+deltaX,clientY=_this.state.lastY+deltaY}var coreEvent=(0,_domFns.createCoreEvent)(_this,clientX,clientY);(0,_log2["default"])("DraggableCore: handleDrag: %j",coreEvent.position);var shouldUpdate=_this.props.onDrag(e,coreEvent);return shouldUpdate===!1?void _this.handleDragStop({}):void _this.setState({lastX:clientX,lastY:clientY})}},_this.handleDragStop=function(e){if(_this.state.dragging&&(!e.changedTouches||e.changedTouches[0].identifier===_this.state.touchIdentifier)){_this.props.enableUserSelectHack&&(0,_domFns.removeUserSelectStyles)();var _getControlPosition3=(0,_positionFns.getControlPosition)(e),clientX=_getControlPosition3.clientX,clientY=_getControlPosition3.clientY,coreEvent=(0,_domFns.createCoreEvent)(_this,clientX,clientY);(0,_log2["default"])("DraggableCore: handleDragStop: %j",coreEvent.position),_this.setState({dragging:!1,lastX:null,lastY:null}),_this.props.onStop(e,coreEvent),(0,_log2["default"])("DraggableCore: Removing handlers"),(0,_domFns.removeEvent)(document,"scroll",_this.handleScroll),(0,_domFns.removeEvent)(document,dragEventFor.move,_this.handleDrag),(0,_domFns.removeEvent)(document,dragEventFor.stop,_this.handleDragStop)}},_this.handleScroll=function(e){var s=_this.state,x=document.body.scrollLeft,y=document.body.scrollTop,coreEvent=(0,_domFns.createCoreEvent)(_this);coreEvent.position.deltaX=x-s.scrollX,coreEvent.position.deltaY=y-s.scrollY,_this.setState({lastX:s.lastX+coreEvent.position.deltaX,lastY:s.lastY+coreEvent.position.deltaY,scrollX:x,scrollY:y}),_this.props.onDrag(e,coreEvent)},_this.onTouchStart=function(e){return dragEventFor=eventsFor.touch,_this.handleDragStart(e)},_this.onTouchEnd=function(e){return dragEventFor=eventsFor.touch,_this.handleDragStop(e)},_ret=_temp,_possibleConstructorReturn(_this,_ret)}return _inherits(DraggableCore,_React$Component),_createClass(DraggableCore,[{key:"componentWillUnmount",value:function(){(0,_domFns.removeEvent)(document,eventsFor.mouse.move,this.handleDrag),(0,_domFns.removeEvent)(document,eventsFor.touch.move,this.handleDrag),(0,_domFns.removeEvent)(document,eventsFor.mouse.stop,this.handleDragStop),(0,_domFns.removeEvent)(document,eventsFor.touch.stop,this.handleDragStop),(0,_domFns.removeEvent)(document,"scroll",this.handleScroll),this.props.enableUserSelectHack&&(0,_domFns.removeUserSelectStyles)()}},{key:"render",value:function(){return _react2["default"].cloneElement(_react2["default"].Children.only(this.props.children),{style:(0,_domFns.styleHacks)(this.props.children.props.style),onMouseDown:this.handleDragStart,onTouchStart:this.onTouchStart,onMouseUp:this.handleDragStop,onTouchEnd:this.onTouchEnd})}}]),DraggableCore}(_react2["default"].Component);DraggableCore.displayName="DraggableCore",DraggableCore.propTypes={allowAnyClick:_react.PropTypes.bool,disabled:_react.PropTypes.bool,enableUserSelectHack:_react.PropTypes.bool,grid:_react.PropTypes.arrayOf(_react.PropTypes.number),handle:_react.PropTypes.string,cancel:_react.PropTypes.string,onStart:_react.PropTypes.func,onDrag:_react.PropTypes.func,onStop:_react.PropTypes.func,onMouseDown:_react.PropTypes.func,className:_shims.dontSetMe,style:_shims.dontSetMe,transform:_shims.dontSetMe},DraggableCore.defaultProps={allowAnyClick:!1,cancel:null,disabled:!1,enableUserSelectHack:!0,handle:null,grid:null,transform:null,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){}},exports["default"]=DraggableCore},function(module,exports,__webpack_require__){"use strict";function log(){}Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=log}])});
!function(root,factory){"object"==typeof exports&&"object"==typeof module?module.exports=factory(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],factory):"object"==typeof exports?exports.ReactDraggable=factory(require("react"),require("react-dom")):root.ReactDraggable=factory(root.React,root.ReactDOM)}(this,function(__WEBPACK_EXTERNAL_MODULE_2__,__WEBPACK_EXTERNAL_MODULE_3__){return function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([function(module,exports,__webpack_require__){"use strict";module.exports=__webpack_require__(1)["default"],module.exports.DraggableCore=__webpack_require__(9)["default"]},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)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:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target},_slicedToArray=function(){function sliceIterator(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _s,_i=arr[Symbol.iterator]();!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{!_n&&_i["return"]&&_i["return"]()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr))return arr;if(Symbol.iterator in Object(arr))return sliceIterator(arr,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_react=__webpack_require__(2),_react2=_interopRequireDefault(_react),_reactDom=__webpack_require__(3),_reactDom2=_interopRequireDefault(_reactDom),_classnames=__webpack_require__(4),_classnames2=_interopRequireDefault(_classnames),_domFns=__webpack_require__(5),_positionFns=__webpack_require__(8),_shims=__webpack_require__(6),_DraggableCore=__webpack_require__(9),_DraggableCore2=_interopRequireDefault(_DraggableCore),_log=__webpack_require__(10),_log2=_interopRequireDefault(_log),Draggable=function(_React$Component){function Draggable(){var _Object$getPrototypeO,_temp,_this,_ret;_classCallCheck(this,Draggable);for(var _len=arguments.length,args=Array(_len),_key=0;_len>_key;_key++)args[_key]=arguments[_key];return _temp=_this=_possibleConstructorReturn(this,(_Object$getPrototypeO=Object.getPrototypeOf(Draggable)).call.apply(_Object$getPrototypeO,[this].concat(args))),_this.state={dragging:!1,dragged:!1,clientX:_this.props.start.x,clientY:_this.props.start.y,slackX:0,slackY:0,isElementSVG:!1},_this.onDragStart=function(e,coreEvent){(0,_log2["default"])("Draggable: onDragStart: %j",coreEvent.position);var shouldStart=_this.props.onStart(e,(0,_domFns.createUIEvent)(_this,coreEvent));return shouldStart===!1?!1:void _this.setState({dragging:!0,dragged:!0})},_this.onDrag=function(e,coreEvent){if(!_this.state.dragging)return!1;(0,_log2["default"])("Draggable: onDrag: %j",coreEvent.position);var uiEvent=(0,_domFns.createUIEvent)(_this,coreEvent),newState={clientX:uiEvent.position.left,clientY:uiEvent.position.top};if(_this.props.bounds){var _clientX=newState.clientX,_clientY=newState.clientY;newState.clientX+=_this.state.slackX,newState.clientY+=_this.state.slackY;var _getBoundPosition=(0,_positionFns.getBoundPosition)(_this,newState.clientX,newState.clientY),_getBoundPosition2=_slicedToArray(_getBoundPosition,2);newState.clientX=_getBoundPosition2[0],newState.clientY=_getBoundPosition2[1],newState.slackX=_this.state.slackX+(_clientX-newState.clientX),newState.slackY=_this.state.slackY+(_clientY-newState.clientY),uiEvent.position.left=_clientX,uiEvent.position.top=_clientY,uiEvent.deltaX=newState.clientX-_this.state.clientX,uiEvent.deltaY=newState.clientY-_this.state.clientY}var shouldUpdate=_this.props.onDrag(e,uiEvent);return shouldUpdate===!1?!1:void _this.setState(newState)},_this.onDragStop=function(e,coreEvent){if(!_this.state.dragging)return!1;var shouldStop=_this.props.onStop(e,(0,_domFns.createUIEvent)(_this,coreEvent));return shouldStop===!1?!1:((0,_log2["default"])("Draggable: onDragStop: %j",coreEvent.position),void _this.setState({dragging:!1,slackX:0,slackY:0}))},_ret=_temp,_possibleConstructorReturn(_this,_ret)}return _inherits(Draggable,_React$Component),_createClass(Draggable,[{key:"componentDidMount",value:function(){_reactDom2["default"].findDOMNode(this)instanceof SVGElement&&this.setState({isElementSVG:!0})}},{key:"componentWillUnmount",value:function(){this.setState({dragging:!1})}},{key:"render",value:function(){var style={},svgTransform=null,transformOpts={x:(0,_positionFns.canDragX)(this)?this.state.clientX:this.props.start.x,y:(0,_positionFns.canDragY)(this)?this.state.clientY:this.props.start.y};this.state.isElementSVG?svgTransform=(0,_domFns.createSVGTransform)(transformOpts):style=(0,_domFns.createCSSTransform)(transformOpts),this.state.dragging&&!isNaN(this.props.zIndex)&&(style.zIndex=this.props.zIndex);var className=(0,_classnames2["default"])(this.props.children.props.className||"","react-draggable",{"react-draggable-dragging":this.state.dragging,"react-draggable-dragged":this.state.dragged});return _react2["default"].createElement(_DraggableCore2["default"],_extends({},this.props,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),_react2["default"].cloneElement(_react2["default"].Children.only(this.props.children),{className:className,style:_extends({},this.props.children.props.style,style),transform:svgTransform}))}}]),Draggable}(_react2["default"].Component);Draggable.displayName="Draggable",Draggable.propTypes=_extends({},_DraggableCore2["default"].propTypes,{axis:_react.PropTypes.oneOf(["both","x","y","none"]),bounds:_react.PropTypes.oneOfType([_react.PropTypes.shape({left:_react.PropTypes.Number,right:_react.PropTypes.Number,top:_react.PropTypes.Number,bottom:_react.PropTypes.Number}),_react.PropTypes.string,_react.PropTypes.oneOf([!1])]),start:_react.PropTypes.shape({x:_react.PropTypes.number,y:_react.PropTypes.number}),zIndex:_react.PropTypes.number,className:_shims.dontSetMe,style:_shims.dontSetMe,transform:_shims.dontSetMe}),Draggable.defaultProps=_extends({},_DraggableCore2["default"].defaultProps,{axis:"both",bounds:!1,start:{x:0,y:0},zIndex:NaN}),exports["default"]=Draggable},function(module,exports){module.exports=__WEBPACK_EXTERNAL_MODULE_2__},function(module,exports){module.exports=__WEBPACK_EXTERNAL_MODULE_3__},function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;!function(){"use strict";function classNames(){for(var classes=[],i=0;i<arguments.length;i++){var arg=arguments[i];if(arg){var argType=typeof arg;if("string"===argType||"number"===argType)classes.push(arg);else if(Array.isArray(arg))classes.push(classNames.apply(null,arg));else if("object"===argType)for(var key in arg)hasOwn.call(arg,key)&&arg[key]&&classes.push(key)}}return classes.join(" ")}var hasOwn={}.hasOwnProperty;"undefined"!=typeof module&&module.exports?module.exports=classNames:(__WEBPACK_AMD_DEFINE_ARRAY__=[],__WEBPACK_AMD_DEFINE_RESULT__=function(){return classNames}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__),!(void 0!==__WEBPACK_AMD_DEFINE_RESULT__&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))}()},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function matchesSelector(el,selector){return matchesSelectorFunc||(matchesSelectorFunc=(0,_shims.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(method){return(0,_shims.isFunction)(el[method])})),el[matchesSelectorFunc].call(el,selector)}function addEvent(el,event,handler){el&&(el.attachEvent?el.attachEvent("on"+event,handler):el.addEventListener?el.addEventListener(event,handler,!0):el["on"+event]=handler)}function removeEvent(el,event,handler){el&&(el.detachEvent?el.detachEvent("on"+event,handler):el.removeEventListener?el.removeEventListener(event,handler,!0):el["on"+event]=null)}function outerHeight(node){var height=node.clientHeight,computedStyle=window.getComputedStyle(node);return height+=(0,_shims["int"])(computedStyle.borderTopWidth),height+=(0,_shims["int"])(computedStyle.borderBottomWidth)}function outerWidth(node){var width=node.clientWidth,computedStyle=window.getComputedStyle(node);return width+=(0,_shims["int"])(computedStyle.borderLeftWidth),width+=(0,_shims["int"])(computedStyle.borderRightWidth)}function innerHeight(node){var height=node.clientHeight,computedStyle=window.getComputedStyle(node);return height-=(0,_shims["int"])(computedStyle.paddingTop),height-=(0,_shims["int"])(computedStyle.paddingBottom)}function innerWidth(node){var width=node.clientWidth,computedStyle=window.getComputedStyle(node);return width-=(0,_shims["int"])(computedStyle.paddingLeft),width-=(0,_shims["int"])(computedStyle.paddingRight)}function createCSSTransform(_ref){var x=_ref.x,y=_ref.y,out={transform:"translate("+x+"px,"+y+"px)"};return _getPrefix2["default"]&&(out[_getPrefix2["default"]+"Transform"]=out.transform),out}function createSVGTransform(_ref2){var x=_ref2.x,y=_ref2.y;return"translate("+x+","+y+")"}function addUserSelectStyles(){var style=document.body.getAttribute("style")||"";document.body.setAttribute("style",style+userSelectStyle)}function removeUserSelectStyles(){var style=document.body.getAttribute("style")||"";document.body.setAttribute("style",style.replace(userSelectStyle,""))}function styleHacks(){var childStyle=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];return _extends({touchAction:"none"},childStyle)}function createCoreEvent(draggable,clientX,clientY){var state=draggable._pendingState||draggable.state,isStart=!(0,_shims.isNum)(state.lastX);return{node:_reactDom2["default"].findDOMNode(draggable),position:isStart?{deltaX:0,deltaY:0,lastX:clientX,lastY:clientY,clientX:clientX,clientY:clientY}:{deltaX:clientX-state.lastX,deltaY:clientY-state.lastY,lastX:state.lastX,lastY:state.lastY,clientX:clientX,clientY:clientY}}}function createUIEvent(draggable,coreEvent){return{node:_reactDom2["default"].findDOMNode(draggable),position:{left:draggable.state.clientX+coreEvent.position.deltaX,top:draggable.state.clientY+coreEvent.position.deltaY},deltaX:coreEvent.position.deltaX,deltaY:coreEvent.position.deltaY}}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target};exports.matchesSelector=matchesSelector,exports.addEvent=addEvent,exports.removeEvent=removeEvent,exports.outerHeight=outerHeight,exports.outerWidth=outerWidth,exports.innerHeight=innerHeight,exports.innerWidth=innerWidth,exports.createCSSTransform=createCSSTransform,exports.createSVGTransform=createSVGTransform,exports.addUserSelectStyles=addUserSelectStyles,exports.removeUserSelectStyles=removeUserSelectStyles,exports.styleHacks=styleHacks,exports.createCoreEvent=createCoreEvent,exports.createUIEvent=createUIEvent;var _shims=__webpack_require__(6),_getPrefix=__webpack_require__(7),_getPrefix2=_interopRequireDefault(_getPrefix),_reactDom=__webpack_require__(3),_reactDom2=_interopRequireDefault(_reactDom),matchesSelectorFunc="",userSelectStyle=";"+(_getPrefix2["default"]?"-"+_getPrefix2["default"].toLowerCase()+"-":"")+"user-select: none;"},function(module,exports){"use strict";function findInArray(array,callback){for(var i=0,length=array.length;length>i;i++)if(callback.apply(callback,[array[i],i,array]))return array[i]}function isFunction(func){return"function"==typeof func||"[object Function]"===Object.prototype.toString.call(func)}function isNum(num){return"number"==typeof num&&!isNaN(num)}function int(a){return parseInt(a,10)}function dontSetMe(props,propName,componentName){if(props[propName])throw new Error("Invalid prop "+propName+" passed to "+componentName+" - do not set this, set it on the child.")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.findInArray=findInArray,exports.isFunction=isFunction,exports.isNum=isNum,exports["int"]=int,exports.dontSetMe=dontSetMe},function(module,exports){"use strict";function generatePrefix(){if("undefined"==typeof window||"undefined"==typeof window.document)return"";var prefixes=["Moz","Webkit","O","ms"],style=window.document.documentElement.style;if("transform"in style)return"";for(var i=0;i<prefixes.length;++i)if(prefixes[i]+"Transform"in style)return prefixes[i];return""}Object.defineProperty(exports,"__esModule",{value:!0}),exports.generatePrefix=generatePrefix,exports["default"]=generatePrefix()},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function getBoundPosition(draggable,clientX,clientY){if(!draggable.props.bounds)return[clientX,clientY];var bounds=draggable.props.bounds;bounds="string"==typeof bounds?bounds:cloneBounds(bounds);var node=_reactDom2["default"].findDOMNode(draggable);if("string"==typeof bounds){var boundNode=void 0;if("parent"===bounds)boundNode=node.parentNode;else if(boundNode=document.querySelector(bounds),!boundNode)throw new Error('Bounds selector "'+bounds+'" could not find an element.');var nodeStyle=window.getComputedStyle(node),boundNodeStyle=window.getComputedStyle(boundNode);bounds={left:-node.offsetLeft+(0,_shims["int"])(boundNodeStyle.paddingLeft)+(0,_shims["int"])(nodeStyle.borderLeftWidth)+(0,_shims["int"])(nodeStyle.marginLeft),top:-node.offsetTop+(0,_shims["int"])(boundNodeStyle.paddingTop)+(0,_shims["int"])(nodeStyle.borderTopWidth)+(0,_shims["int"])(nodeStyle.marginTop),right:(0,_domFns.innerWidth)(boundNode)-(0,_domFns.outerWidth)(node)-node.offsetLeft,bottom:(0,_domFns.innerHeight)(boundNode)-(0,_domFns.outerHeight)(node)-node.offsetTop}}return(0,_shims.isNum)(bounds.right)&&(clientX=Math.min(clientX,bounds.right)),(0,_shims.isNum)(bounds.bottom)&&(clientY=Math.min(clientY,bounds.bottom)),(0,_shims.isNum)(bounds.left)&&(clientX=Math.max(clientX,bounds.left)),(0,_shims.isNum)(bounds.top)&&(clientY=Math.max(clientY,bounds.top)),[clientX,clientY]}function snapToGrid(grid,pendingX,pendingY){var x=Math.round(pendingX/grid[0])*grid[0],y=Math.round(pendingY/grid[1])*grid[1];return[x,y]}function canDragX(draggable){return"both"===draggable.props.axis||"x"===draggable.props.axis}function canDragY(draggable){return"both"===draggable.props.axis||"y"===draggable.props.axis}function getControlPosition(e){var position=e.targetTouches&&e.targetTouches[0]||e;return{clientX:position.clientX,clientY:position.clientY}}function cloneBounds(bounds){return{left:bounds.left,top:bounds.top,right:bounds.right,bottom:bounds.bottom}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getBoundPosition=getBoundPosition,exports.snapToGrid=snapToGrid,exports.canDragX=canDragX,exports.canDragY=canDragY,exports.getControlPosition=getControlPosition;var _react=__webpack_require__(2),_shims=(_interopRequireDefault(_react),__webpack_require__(6)),_reactDom=__webpack_require__(3),_reactDom2=_interopRequireDefault(_reactDom),_domFns=__webpack_require__(5)},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)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:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}Object.defineProperty(exports,"__esModule",{value:!0});var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _s,_i=arr[Symbol.iterator]();!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{!_n&&_i["return"]&&_i["return"]()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr))return arr;if(Symbol.iterator in Object(arr))return sliceIterator(arr,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_react=__webpack_require__(2),_react2=_interopRequireDefault(_react),_domFns=__webpack_require__(5),_positionFns=__webpack_require__(8),_shims=__webpack_require__(6),_log=__webpack_require__(10),_log2=_interopRequireDefault(_log),eventsFor={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}},dragEventFor=eventsFor.mouse,DraggableCore=function(_React$Component){function DraggableCore(){var _Object$getPrototypeO,_temp,_this,_ret;_classCallCheck(this,DraggableCore);for(var _len=arguments.length,args=Array(_len),_key=0;_len>_key;_key++)args[_key]=arguments[_key];return _temp=_this=_possibleConstructorReturn(this,(_Object$getPrototypeO=Object.getPrototypeOf(DraggableCore)).call.apply(_Object$getPrototypeO,[this].concat(args))),_this.state={dragging:!1,lastX:null,lastY:null},_this.handleDragStart=function(e){if(_this.props.onMouseDown(e),!_this.props.allowAnyClick&&"number"==typeof e.button&&0!==e.button)return!1;if(!(_this.props.disabled||_this.props.handle&&!(0,_domFns.matchesSelector)(e.target,_this.props.handle)||_this.props.cancel&&(0,_domFns.matchesSelector)(e.target,_this.props.cancel))){e.targetTouches&&_this.setState({touchIdentifier:e.targetTouches[0].identifier}),_this.props.enableUserSelectHack&&(0,_domFns.addUserSelectStyles)();var _getControlPosition=(0,_positionFns.getControlPosition)(e),clientX=_getControlPosition.clientX,clientY=_getControlPosition.clientY,coreEvent=(0,_domFns.createCoreEvent)(_this,clientX,clientY);(0,_log2["default"])("DraggableCore: handleDragStart: %j",coreEvent.position),(0,_log2["default"])("calling",_this.props.onStart);var shouldUpdate=_this.props.onStart(e,coreEvent);shouldUpdate!==!1&&(_this.setState({dragging:!0,lastX:clientX,lastY:clientY,scrollX:document.body.scrollLeft,scrollY:document.body.scrollTop}),(0,_domFns.addEvent)(document,"scroll",_this.handleScroll),(0,_domFns.addEvent)(document,dragEventFor.move,_this.handleDrag),(0,_domFns.addEvent)(document,dragEventFor.stop,_this.handleDragStop))}},_this.handleDrag=function(e){if(!e.targetTouches||e.targetTouches[0].identifier===_this.state.touchIdentifier){var _getControlPosition2=(0,_positionFns.getControlPosition)(e),clientX=_getControlPosition2.clientX,clientY=_getControlPosition2.clientY;if(Array.isArray(_this.props.grid)){var deltaX=clientX-_this.state.lastX,deltaY=clientY-_this.state.lastY,_snapToGrid=(0,_positionFns.snapToGrid)(_this.props.grid,deltaX,deltaY),_snapToGrid2=_slicedToArray(_snapToGrid,2);if(deltaX=_snapToGrid2[0],deltaY=_snapToGrid2[1],!deltaX&&!deltaY)return;clientX=_this.state.lastX+deltaX,clientY=_this.state.lastY+deltaY}var coreEvent=(0,_domFns.createCoreEvent)(_this,clientX,clientY);(0,_log2["default"])("DraggableCore: handleDrag: %j",coreEvent.position);var shouldUpdate=_this.props.onDrag(e,coreEvent);return shouldUpdate===!1?void _this.handleDragStop({}):void _this.setState({lastX:clientX,lastY:clientY})}},_this.handleDragStop=function(e){if(_this.state.dragging&&(!e.changedTouches||e.changedTouches[0].identifier===_this.state.touchIdentifier)){_this.props.enableUserSelectHack&&(0,_domFns.removeUserSelectStyles)();var _getControlPosition3=(0,_positionFns.getControlPosition)(e),clientX=_getControlPosition3.clientX,clientY=_getControlPosition3.clientY,coreEvent=(0,_domFns.createCoreEvent)(_this,clientX,clientY);(0,_log2["default"])("DraggableCore: handleDragStop: %j",coreEvent.position),_this.setState({dragging:!1,lastX:null,lastY:null}),_this.props.onStop(e,coreEvent),(0,_log2["default"])("DraggableCore: Removing handlers"),(0,_domFns.removeEvent)(document,"scroll",_this.handleScroll),(0,_domFns.removeEvent)(document,dragEventFor.move,_this.handleDrag),(0,_domFns.removeEvent)(document,dragEventFor.stop,_this.handleDragStop)}},_this.handleScroll=function(e){var s=_this.state,x=document.body.scrollLeft,y=document.body.scrollTop,coreEvent=(0,_domFns.createCoreEvent)(_this);coreEvent.position.deltaX=x-s.scrollX,coreEvent.position.deltaY=y-s.scrollY,_this.setState({lastX:s.lastX+coreEvent.position.deltaX,lastY:s.lastY+coreEvent.position.deltaY,scrollX:x,scrollY:y}),_this.props.onDrag(e,coreEvent)},_this.onMouseDown=function(e){return dragEventFor=eventsFor.mouse,_this.handleDragStart(e)},_this.onMouseUp=function(e){return dragEventFor=eventsFor.mouse,_this.handleDragStop(e)},_this.onTouchStart=function(e){return dragEventFor=eventsFor.touch,_this.handleDragStart(e)},_this.onTouchEnd=function(e){return dragEventFor=eventsFor.touch,_this.handleDragStop(e)},_ret=_temp,_possibleConstructorReturn(_this,_ret)}return _inherits(DraggableCore,_React$Component),_createClass(DraggableCore,[{key:"componentWillUnmount",value:function(){(0,_domFns.removeEvent)(document,eventsFor.mouse.move,this.handleDrag),(0,_domFns.removeEvent)(document,eventsFor.touch.move,this.handleDrag),(0,_domFns.removeEvent)(document,eventsFor.mouse.stop,this.handleDragStop),(0,_domFns.removeEvent)(document,eventsFor.touch.stop,this.handleDragStop),(0,_domFns.removeEvent)(document,"scroll",this.handleScroll),this.props.enableUserSelectHack&&(0,_domFns.removeUserSelectStyles)()}},{key:"render",value:function(){return _react2["default"].cloneElement(_react2["default"].Children.only(this.props.children),{style:(0,_domFns.styleHacks)(this.props.children.props.style),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}]),DraggableCore}(_react2["default"].Component);DraggableCore.displayName="DraggableCore",DraggableCore.propTypes={allowAnyClick:_react.PropTypes.bool,disabled:_react.PropTypes.bool,enableUserSelectHack:_react.PropTypes.bool,grid:_react.PropTypes.arrayOf(_react.PropTypes.number),handle:_react.PropTypes.string,cancel:_react.PropTypes.string,onStart:_react.PropTypes.func,onDrag:_react.PropTypes.func,onStop:_react.PropTypes.func,onMouseDown:_react.PropTypes.func,className:_shims.dontSetMe,style:_shims.dontSetMe,transform:_shims.dontSetMe},DraggableCore.defaultProps={allowAnyClick:!1,cancel:null,disabled:!1,enableUserSelectHack:!0,handle:null,grid:null,transform:null,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){}},exports["default"]=DraggableCore},function(module,exports,__webpack_require__){"use strict";function log(){}Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]=log}])});
//# sourceMappingURL=dist/react-draggable.min.js
{
"name": "react-draggable",
"version": "1.3.4",
"version": "1.3.6",
"description": "React draggable component",

@@ -51,4 +51,4 @@ "main": "dist/react-draggable.js",

"pre-commit": "^1.1.2",
"react": "^0.14.0",
"react-dom": "^0.14.0",
"react": "^15.0.0",
"react-dom": "^15.0.0",
"semver": "^5.0.3",

@@ -55,0 +55,0 @@ "static-server": "^2.0.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc