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

react-draggable-custom

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-draggable-custom - npm Package Compare versions

Comparing version 1.4.5 to 1.4.6

6

dist/react-draggable.js

@@ -1051,8 +1051,2 @@ (function webpackUniversalModuleDefinition(root, factory) {

if (!deltaX && !deltaY) return; // skip useless drag
var parentScale = _this.props.parentScale;
if (parentScale !== 1) {
deltaX = Math.round(deltaX / parentScale);
deltaY = Math.round(deltaY / parentScale);
}
clientX = _this.state.lastX + deltaX, clientY = _this.state.lastY + deltaY;

@@ -1059,0 +1053,0 @@ }

2

dist/react-draggable.min.js

@@ -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 _ref,_temp,_this,_ret;_classCallCheck(this,Draggable);for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return _temp=_this=_possibleConstructorReturn(this,(_ref=Draggable.__proto__||Object.getPrototypeOf(Draggable)).call.apply(_ref,[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){if((0,_log2.default)("Draggable: onDragStart: %j",coreEvent.position),!1===_this.props.onStart(e,(0,_domFns.createUIEvent)(_this,coreEvent)))return!1;_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}if((0,_log2.default)("Draggable: onDrag uiEvent: %j",uiEvent),!1===_this.props.onDrag(e,uiEvent))return!1;_this.setState(newState)},_this.onDragStop=function(e,coreEvent){return!!_this.state.dragging&&(!1!==_this.props.onStop(e,(0,_domFns.createUIEvent)(_this,coreEvent))&&((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:"componentWillReceiveProps",value:function(next){var _state=this.state,clientX=_state.clientX,clientY=_state.clientY;if(next.x!==clientX||next.y!==clientY){var _getBoundPosition3=(0,_positionFns.getBoundPosition)(this,next.x,next.y),_getBoundPosition4=_slicedToArray(_getBoundPosition3,2);clientX=_getBoundPosition4[0],clientY=_getBoundPosition4[1],this.setState({clientX:clientX,clientY:clientY})}}},{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,parentScale:_react.PropTypes.number}),Draggable.defaultProps=_extends({},_DraggableCore2.default.defaultProps,{axis:"both",bounds:!1,start:{x:0,y:0},zIndex:NaN,x:0,y:0,parentScale:1}),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;void 0!==module&&module.exports?module.exports=classNames:(__WEBPACK_AMD_DEFINE_ARRAY__=[],void 0!==(__WEBPACK_AMD_DEFINE_RESULT__=function(){return classNames}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__))&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}()},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,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;return _defineProperty({},(0,_getPrefix.browserPrefixToKey)("transform",_getPrefix2.default),"translate("+x+"px,"+y+"px)")}function createSVGTransform(_ref3){return"translate("+_ref3.x+","+_ref3.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){var _draggable$props$pare=draggable.props.parentScale,parentScale=void 0===_draggable$props$pare?1:_draggable$props$pare;return{node:_reactDom2.default.findDOMNode(draggable),position:{left:draggable.state.clientX+coreEvent.position.deltaX/parentScale,top:draggable.state.clientY+coreEvent.position.deltaY/parentScale},deltaX:coreEvent.position.deltaX/parentScale,deltaY:coreEvent.position.deltaY/parentScale}}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="",userSelectPrefix=(0,_getPrefix.getPrefix)("user-select"),userSelect=(0,_getPrefix.browserPrefixToStyle)("user-select",userSelectPrefix),userSelectStyle=";"+userSelect+": none;"},function(module,exports){"use strict";function findInArray(array,callback){for(var i=0,length=array.length;i<length;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 getPrefix(){var prop=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"transform";if("undefined"==typeof window||void 0===window.document)return"";var style=window.document.documentElement.style;if(prop in style)return"";for(var i=0;i<prefixes.length;i++)if(browserPrefixToStyle(prop,prefixes[i])in style)return prefixes[i];return""}function browserPrefixToKey(prop,prefix){return prefix?""+prefix+kebabToTitleCase(prop):prop}function browserPrefixToStyle(prop,prefix){return prefix?"-"+prefix.toLowerCase()+"-"+prop:prop}function kebabToTitleCase(str){for(var out="",shouldCapitalize=!0,i=0;i<str.length;i++)shouldCapitalize?(out+=str[i].toUpperCase(),shouldCapitalize=!1):"-"===str[i]?shouldCapitalize=!0:out+=str[i];return out}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getPrefix=getPrefix,exports.browserPrefixToKey=browserPrefixToKey,exports.browserPrefixToStyle=browserPrefixToStyle;var prefixes=["Moz","Webkit","O","ms"];exports.default=getPrefix()},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)))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){return[Math.round(pendingX/grid[0])*grid[0],Math.round(pendingY/grid[1])*grid[1]]}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.changedTouches&&e.changedTouches[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 _ref,_temp,_this,_ret;_classCallCheck(this,DraggableCore);for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return _temp=_this=_possibleConstructorReturn(this,(_ref=DraggableCore.__proto__||Object.getPrototypeOf(DraggableCore)).call.apply(_ref,[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);!1!==_this.props.onStart(e,coreEvent)&&(_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||_this.props.disabled)){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;var parentScale=_this.props.parentScale;1!==parentScale&&(deltaX=Math.round(deltaX/parentScale),deltaY=Math.round(deltaY/parentScale)),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);if(!1===_this.props.onDrag(e,coreEvent))return void _this.handleDragStop({});_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,parentScale:_react.PropTypes.number},DraggableCore.defaultProps={allowAnyClick:!1,cancel:null,disabled:!1,enableUserSelectHack:!0,handle:null,grid:null,transform:null,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},parentScale:1},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 _ref,_temp,_this,_ret;_classCallCheck(this,Draggable);for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return _temp=_this=_possibleConstructorReturn(this,(_ref=Draggable.__proto__||Object.getPrototypeOf(Draggable)).call.apply(_ref,[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){if((0,_log2.default)("Draggable: onDragStart: %j",coreEvent.position),!1===_this.props.onStart(e,(0,_domFns.createUIEvent)(_this,coreEvent)))return!1;_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}if((0,_log2.default)("Draggable: onDrag uiEvent: %j",uiEvent),!1===_this.props.onDrag(e,uiEvent))return!1;_this.setState(newState)},_this.onDragStop=function(e,coreEvent){return!!_this.state.dragging&&(!1!==_this.props.onStop(e,(0,_domFns.createUIEvent)(_this,coreEvent))&&((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:"componentWillReceiveProps",value:function(next){var _state=this.state,clientX=_state.clientX,clientY=_state.clientY;if(next.x!==clientX||next.y!==clientY){var _getBoundPosition3=(0,_positionFns.getBoundPosition)(this,next.x,next.y),_getBoundPosition4=_slicedToArray(_getBoundPosition3,2);clientX=_getBoundPosition4[0],clientY=_getBoundPosition4[1],this.setState({clientX:clientX,clientY:clientY})}}},{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,parentScale:_react.PropTypes.number}),Draggable.defaultProps=_extends({},_DraggableCore2.default.defaultProps,{axis:"both",bounds:!1,start:{x:0,y:0},zIndex:NaN,x:0,y:0,parentScale:1}),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;void 0!==module&&module.exports?module.exports=classNames:(__WEBPACK_AMD_DEFINE_ARRAY__=[],void 0!==(__WEBPACK_AMD_DEFINE_RESULT__=function(){return classNames}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__))&&(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}()},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,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;return _defineProperty({},(0,_getPrefix.browserPrefixToKey)("transform",_getPrefix2.default),"translate("+x+"px,"+y+"px)")}function createSVGTransform(_ref3){return"translate("+_ref3.x+","+_ref3.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){var _draggable$props$pare=draggable.props.parentScale,parentScale=void 0===_draggable$props$pare?1:_draggable$props$pare;return{node:_reactDom2.default.findDOMNode(draggable),position:{left:draggable.state.clientX+coreEvent.position.deltaX/parentScale,top:draggable.state.clientY+coreEvent.position.deltaY/parentScale},deltaX:coreEvent.position.deltaX/parentScale,deltaY:coreEvent.position.deltaY/parentScale}}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="",userSelectPrefix=(0,_getPrefix.getPrefix)("user-select"),userSelect=(0,_getPrefix.browserPrefixToStyle)("user-select",userSelectPrefix),userSelectStyle=";"+userSelect+": none;"},function(module,exports){"use strict";function findInArray(array,callback){for(var i=0,length=array.length;i<length;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 getPrefix(){var prop=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"transform";if("undefined"==typeof window||void 0===window.document)return"";var style=window.document.documentElement.style;if(prop in style)return"";for(var i=0;i<prefixes.length;i++)if(browserPrefixToStyle(prop,prefixes[i])in style)return prefixes[i];return""}function browserPrefixToKey(prop,prefix){return prefix?""+prefix+kebabToTitleCase(prop):prop}function browserPrefixToStyle(prop,prefix){return prefix?"-"+prefix.toLowerCase()+"-"+prop:prop}function kebabToTitleCase(str){for(var out="",shouldCapitalize=!0,i=0;i<str.length;i++)shouldCapitalize?(out+=str[i].toUpperCase(),shouldCapitalize=!1):"-"===str[i]?shouldCapitalize=!0:out+=str[i];return out}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getPrefix=getPrefix,exports.browserPrefixToKey=browserPrefixToKey,exports.browserPrefixToStyle=browserPrefixToStyle;var prefixes=["Moz","Webkit","O","ms"];exports.default=getPrefix()},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)))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){return[Math.round(pendingX/grid[0])*grid[0],Math.round(pendingY/grid[1])*grid[1]]}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.changedTouches&&e.changedTouches[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 _ref,_temp,_this,_ret;_classCallCheck(this,DraggableCore);for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return _temp=_this=_possibleConstructorReturn(this,(_ref=DraggableCore.__proto__||Object.getPrototypeOf(DraggableCore)).call.apply(_ref,[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);!1!==_this.props.onStart(e,coreEvent)&&(_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||_this.props.disabled)){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);if(!1===_this.props.onDrag(e,coreEvent))return void _this.handleDragStop({});_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,parentScale:_react.PropTypes.number},DraggableCore.defaultProps={allowAnyClick:!1,cancel:null,disabled:!1,enableUserSelectHack:!0,handle:null,grid:null,transform:null,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},parentScale:1},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-custom",
"version": "1.4.5",
"version": "1.4.6",
"description": "React draggable component",

@@ -5,0 +5,0 @@ "main": "dist/react-draggable.js",

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