diff --git a/build/web/react-draggable.min.js b/build/web/react-draggable.min.js new file mode 100644 index 00000000..203d465f --- /dev/null +++ b/build/web/react-draggable.min.js @@ -0,0 +1,3 @@ +/*! For license information please see react-draggable.min.js.LICENSE.txt */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react-dom"),require("react")):"function"==typeof define&&define.amd?define(["react-dom","react"],e):"object"==typeof exports?exports.ReactDraggable=e(require("react-dom"),require("react")):t.ReactDraggable=e(t.ReactDOM,t.React)}(window,(function(t,e){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=4)}([function(t,e,n){t.exports=n(5)()},function(e,n){e.exports=t},function(t,n){t.exports=e},function(t,e,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var t=[],e=0;e0&&void 0!==arguments[0]?arguments[0]:"transform";if("undefined"==typeof window||void 0===window.document)return"";var e=window.document.documentElement.style;if(t in e)return"";for(var n=0;n: Unmounted during event!");return e}function W(t){return(W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function B(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],r=!0,o=!1,a=void 0;try{for(var i,u=t[Symbol.iterator]();!(r=(i=u.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(t){o=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(o)throw a}}return n}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return H(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return H(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function H(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n not mounted on DragStart!");var r=n.ownerDocument;if(!(t.props.disabled||!(e.target instanceof r.defaultView.Node)||t.props.handle&&!x(e.target,t.props.handle,n)||t.props.cancel&&x(e.target,t.props.cancel,n))){"touchstart"===e.type&&e.preventDefault();var o=k(e);t.setState({touchIdentifier:o});var a=L(e,o,F(t));if(null!=a){var i=a.x,u=a.y,c=I(F(t),i,u);t.props.onStart,!1!==t.props.onStart(e,c)&&!1!==t.mounted&&(t.props.enableUserSelectHack&&_(r),t.setState({dragging:!0,lastX:i,lastY:u}),j(r,et.move,t.handleDrag),j(r,et.stop,t.handleDragStop))}}})),Q(F(t),"handleDrag",(function(e){var n=L(e,t.state.touchIdentifier,F(t));if(null!=n){var r=n.x,o=n.y;if(Array.isArray(t.props.grid)){var a=r-t.state.lastX,i=o-t.state.lastY,u=B(X(t.props.grid,a,i),2);if(a=u[0],i=u[1],!a&&!i)return;r=t.state.lastX+a,o=t.state.lastY+i}var s=I(F(t),r,o);if(!1!==t.props.onDrag(e,s)&&!1!==t.mounted)t.setState({lastX:r,lastY:o});else try{t.handleDragStop(new MouseEvent("mouseup"))}catch(e){var c=document.createEvent("MouseEvents");c.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),t.handleDragStop(c)}}})),Q(F(t),"handleDragStop",(function(e){if(t.state.dragging){var n=L(e,t.state.touchIdentifier,F(t));if(null!=n){var r=n.x,o=n.y,a=I(F(t),r,o);if(!1===t.props.onStop(e,a)||!1===t.mounted)return!1;var i=s.a.findDOMNode(F(t));i&&t.props.enableUserSelectHack&&R(i.ownerDocument),t.setState({dragging:!1,lastX:NaN,lastY:NaN}),i&&(P(i.ownerDocument,et.move,t.handleDrag),P(i.ownerDocument,et.stop,t.handleDragStop))}}})),Q(F(t),"onMouseDown",(function(e){return et=tt,t.handleDragStart(e)})),Q(F(t),"onMouseUp",(function(e){return et=tt,t.handleDragStop(e)})),Q(F(t),"onTouchStart",(function(e){return et=Z,t.handleDragStart(e)})),Q(F(t),"onTouchEnd",(function(e){return et=Z,t.handleDragStop(e)})),t}return n=u,(r=[{key:"componentDidMount",value:function(){this.mounted=!0;var t=s.a.findDOMNode(this);t&&j(t,Z.start,this.onTouchStart,{passive:!1})}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var t=s.a.findDOMNode(this);if(t){var e=t.ownerDocument;P(e,tt.move,this.handleDrag),P(e,Z.move,this.handleDrag),P(e,tt.stop,this.handleDragStop),P(e,Z.stop,this.handleDragStop),P(t,Z.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&R(e)}}},{key:"render",value:function(){return o.a.cloneElement(o.a.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}}])&&G(n.prototype,r),a&&G(n,a),u}(o.a.Component);function rt(t){return(rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ot(){return(ot=Object.assign||function(t){for(var e=1;e=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}function it(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],r=!0,o=!1,a=void 0;try{for(var i,u=t[Symbol.iterator]();!(r=(i=u.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(t){o=!0,a=t}finally{try{r||null==u.return||u.return()}finally{if(o)throw a}}return n}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return ut(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ut(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ut(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element."),e}return ft(r,null,[{key:"getDerivedStateFromProps",value:function(t,e){var n=t.position,r=e.prevPropsPosition;return!n||r&&n.x===r.x&&n.y===r.y?null:{x:n.x,y:n.y,prevPropsPosition:ct({},n)}}}]),ft(r,[{key:"componentDidMount",value:function(){void 0!==window.SVGElement&&s.a.findDOMNode(this)instanceof window.SVGElement&&this.setState({isElementSVG:!0})}},{key:"componentWillUnmount",value:function(){this.setState({dragging:!1})}},{key:"render",value:function(){var t,e=this.props,n=(e.axis,e.bounds,e.children),r=e.defaultPosition,a=e.defaultClassName,i=e.defaultClassNameDragging,u=e.defaultClassNameDragged,s=e.position,c=e.positionOffset,f=(e.scale,at(e,["axis","bounds","children","defaultPosition","defaultClassName","defaultClassNameDragging","defaultClassNameDragged","position","positionOffset","scale"])),p={},d=null,y=!Boolean(s)||this.state.dragging,g=s||r,h={x:Y(this)&&y?this.state.x:g.x,y:A(this)&&y?this.state.y:g.y};this.state.isElementSVG?d=function(t,e){return M(t,e,"")}(h,c):p=function(t,e){var n=M(t,e,"px");return O({},b("transform",m),n)}(h,c);var v=l()(n.props.className||"",a,(bt(t={},i,this.state.dragging),bt(t,u,this.state.dragged),t));return o.a.createElement(nt,ot({},f,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),o.a.cloneElement(o.a.Children.only(n),{className:v,style:ct({},n.props.style,{},p),transform:d}))}}]),r}(o.a.Component);bt(mt,"displayName","Draggable"),bt(mt,"propTypes",ct({},nt.propTypes,{axis:i.a.oneOf(["both","x","y","none"]),bounds:i.a.oneOfType([i.a.shape({left:i.a.number,right:i.a.number,top:i.a.number,bottom:i.a.number}),i.a.string,i.a.oneOf([!1])]),defaultClassName:i.a.string,defaultClassNameDragging:i.a.string,defaultClassNameDragged:i.a.string,defaultPosition:i.a.shape({x:i.a.number,y:i.a.number}),positionOffset:i.a.shape({x:i.a.oneOfType([i.a.number,i.a.string]),y:i.a.oneOfType([i.a.number,i.a.string])}),position:i.a.shape({x:i.a.number,y:i.a.number}),className:g,style:g,transform:g})),bt(mt,"defaultProps",ct({},nt.defaultProps,{axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},position:null,scale:1}))}])})); +//# sourceMappingURL=react-draggable.min.js.map \ No newline at end of file diff --git a/dist/react-draggable.js b/dist/react-draggable.js new file mode 100644 index 00000000..97b25373 --- /dev/null +++ b/dist/react-draggable.js @@ -0,0 +1,1608 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(require("react"), require("react-dom")); + else if(typeof define === 'function' && define.amd) + define(["react", "react-dom"], factory); + else if(typeof exports === 'object') + exports["ReactDraggable"] = factory(require("react"), require("react-dom")); + else + root["ReactDraggable"] = factory(root["React"], root["ReactDOM"]); +})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + module.exports = __webpack_require__(1).default; + module.exports.DraggableCore = __webpack_require__(9).default; + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _react = __webpack_require__(2); + + var _react2 = _interopRequireDefault(_react); + + var _reactDom = __webpack_require__(3); + + var _reactDom2 = _interopRequireDefault(_reactDom); + + var _classnames = __webpack_require__(4); + + var _classnames2 = _interopRequireDefault(_classnames); + + var _domFns = __webpack_require__(5); + + var _positionFns = __webpack_require__(8); + + var _shims = __webpack_require__(6); + + var _DraggableCore = __webpack_require__(9); + + var _DraggableCore2 = _interopRequireDefault(_DraggableCore); + + var _log = __webpack_require__(11); + + var _log2 = _interopRequireDefault(_log); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return 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 && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + // $FlowIgnore + + + /*:: import type {DraggableEventHandler} from './utils/types';*/ + /*:: type DraggableState = { + dragging: boolean, + dragged: boolean, + x: number, y: number, + slackX: number, slackY: number, + isElementSVG: boolean + };*/ + + + // + // Define + // + + /*:: type ConstructorProps = { + position: { x: number, y: number }, + defaultPosition: { x: number, y: number } + };*/ + + var Draggable = function (_React$Component) { + _inherits(Draggable, _React$Component); + + function Draggable(props /*: ConstructorProps*/) { + _classCallCheck(this, Draggable); + + var _this = _possibleConstructorReturn(this, (Draggable.__proto__ || Object.getPrototypeOf(Draggable)).call(this, props)); + + _this.onDragStart = function (e, coreData) { + (0, _log2.default)('Draggable: onDragStart: %j', coreData); + + // Short-circuit if user's callback killed it. + var shouldStart = _this.props.onStart(e, (0, _positionFns.createDraggableData)(_this, coreData)); + // Kills start event on core as well, so move handlers are never bound. + if (shouldStart === false) return false; + + _this.setState({ dragging: true, dragged: true }); + }; + + _this.onDrag = function (e, coreData) { + if (!_this.state.dragging) return false; + (0, _log2.default)('Draggable: onDrag: %j', coreData); + + var uiData = (0, _positionFns.createDraggableData)(_this, coreData); + + var newState /*: $Shape*/ = { + x: uiData.x, + y: uiData.y + }; + + // Keep within bounds. + if (_this.props.bounds) { + // Save original x and y. + var _x = newState.x, + _y = newState.y; + + // Add slack to the values used to calculate bound position. This will ensure that if + // we start removing slack, the element won't react to it right away until it's been + // completely removed. + + newState.x += _this.state.slackX; + newState.y += _this.state.slackY; + + // Get bound position. This will ceil/floor the x and y within the boundaries. + // $FlowBug + + // Recalculate slack by noting how much was shaved by the boundPosition handler. + var _getBoundPosition = (0, _positionFns.getBoundPosition)(_this, newState.x, newState.y); + + var _getBoundPosition2 = _slicedToArray(_getBoundPosition, 2); + + newState.x = _getBoundPosition2[0]; + newState.y = _getBoundPosition2[1]; + newState.slackX = _this.state.slackX + (_x - newState.x); + newState.slackY = _this.state.slackY + (_y - newState.y); + + // Update the event we fire to reflect what really happened after bounds took effect. + uiData.x = _x; + uiData.y = _y; + uiData.deltaX = newState.x - _this.state.x; + uiData.deltaY = newState.y - _this.state.y; + } + + // Short-circuit if user's callback killed it. + var shouldUpdate = _this.props.onDrag(e, uiData); + if (shouldUpdate === false) return false; + + _this.setState(newState); + }; + + _this.onDragStop = function (e, coreData) { + if (!_this.state.dragging) return false; + + // Short-circuit if user's callback killed it. + var shouldStop = _this.props.onStop(e, (0, _positionFns.createDraggableData)(_this, coreData)); + if (shouldStop === false) return false; + + (0, _log2.default)('Draggable: onDragStop: %j', coreData); + + var newState /*: $Shape*/ = { + dragging: false, + slackX: 0, + slackY: 0 + }; + + // If this is a controlled component, the result of this operation will be to + // revert back to the old position. We expect a handler on `onDragStop`, at the least. + var controlled = Boolean(_this.props.position); + if (controlled) { + var _this$props$position = _this.props.position, + _x2 = _this$props$position.x, + _y2 = _this$props$position.y; + + newState.x = _x2; + newState.y = _y2; + } + + _this.setState(newState); + }; + + _this.state = { + // Whether or not we are currently dragging. + dragging: false, + + // Whether or not we have been dragged before. + dragged: false, + + // Current transform x and y. + x: props.position ? props.position.x : props.defaultPosition.x, + y: props.position ? props.position.y : props.defaultPosition.y, + + // Used for compensating for out-of-bounds drags + slackX: 0, slackY: 0, + + // Can only determine if SVG after mounting + isElementSVG: false + }; + return _this; + } + + _createClass(Draggable, [{ + key: 'componentWillMount', + value: function componentWillMount() { + if (this.props.position && !(this.props.onDrag || this.props.onStop)) { + // eslint-disable-next-line + console.warn('A `position` was applied to this , without drag handlers. This will make this ' + 'component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the ' + '`position` of this element.'); + } + } + }, { + key: 'componentDidMount', + value: function componentDidMount() { + // Check to see if the element passed is an instanceof SVGElement + if (typeof SVGElement !== 'undefined' && _reactDom2.default.findDOMNode(this) instanceof SVGElement) { + this.setState({ isElementSVG: true }); + } + } + }, { + key: 'componentWillReceiveProps', + value: function componentWillReceiveProps(nextProps /*: Object*/) { + // Set x/y if position has changed + if (nextProps.position && (!this.props.position || nextProps.position.x !== this.props.position.x || nextProps.position.y !== this.props.position.y)) { + this.setState({ x: nextProps.position.x, y: nextProps.position.y }); + } + } + }, { + key: 'componentWillUnmount', + value: function componentWillUnmount() { + this.setState({ dragging: false }); // prevents invariant if unmounted while dragging + } + }, { + key: 'render', + value: function render() /*: React.Element*/ { + var _classNames; + + var style = {}, + svgTransform = null; + + // If this is controlled, we don't want to move it - unless it's dragging. + var controlled = Boolean(this.props.position); + var draggable = !controlled || this.state.dragging; + + var position = this.props.position || this.props.defaultPosition; + var transformOpts = { + // Set left if horizontal drag is enabled + x: (0, _positionFns.canDragX)(this) && draggable ? this.state.x : position.x, + + // Set top if vertical drag is enabled + y: (0, _positionFns.canDragY)(this) && draggable ? this.state.y : position.y + }; + + // If this element was SVG, we use the `transform` attribute. + if (this.state.isElementSVG) { + svgTransform = (0, _domFns.createSVGTransform)(transformOpts); + } else { + // Add a CSS transform to move the element around. This allows us to move the element around + // without worrying about whether or not it is relatively or absolutely positioned. + // If the item you are dragging already has a transform set, wrap it in a so + // has a clean slate. + style = (0, _domFns.createCSSTransform)(transformOpts); + } + + var _props = this.props, + defaultClassName = _props.defaultClassName, + defaultClassNameDragging = _props.defaultClassNameDragging, + defaultClassNameDragged = _props.defaultClassNameDragged; + + // Mark with class while dragging + + var className = (0, _classnames2.default)(this.props.children.props.className || '', defaultClassName, (_classNames = {}, _defineProperty(_classNames, defaultClassNameDragging, this.state.dragging), _defineProperty(_classNames, defaultClassNameDragged, this.state.dragged), _classNames)); + + // Reuse the child provided + // This makes it flexible to use whatever element is wanted (div, ul, etc) + 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 + }) + ); + } + }]); + + return Draggable; + }(_react2.default.Component); + + Draggable.displayName = 'Draggable'; + Draggable.propTypes = _extends({}, _DraggableCore2.default.propTypes, { + + /** + * `axis` determines which axis the draggable can move. + * + * Note that all callbacks will still return data as normal. This only + * controls flushing to the DOM. + * + * 'both' allows movement horizontally and vertically. + * 'x' limits movement to horizontal axis. + * 'y' limits movement to vertical axis. + * 'none' limits all movement. + * + * Defaults to 'both'. + */ + axis: _react.PropTypes.oneOf(['both', 'x', 'y', 'none']), + + /** + * `bounds` determines the range of movement available to the element. + * Available values are: + * + * 'parent' restricts movement within the Draggable's parent node. + * + * Alternatively, pass an object with the following properties, all of which are optional: + * + * {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND} + * + * All values are in px. + * + * Example: + * + * ```jsx + * let App = React.createClass({ + * render: function () { + * return ( + * + *
Content
+ *
+ * ); + * } + * }); + * ``` + */ + 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([false])]), + + defaultClassName: _react.PropTypes.string, + defaultClassNameDragging: _react.PropTypes.string, + defaultClassNameDragged: _react.PropTypes.string, + + /** + * `defaultPosition` specifies the x and y that the dragged item should start at + * + * Example: + * + * ```jsx + * let App = React.createClass({ + * render: function () { + * return ( + * + *
I start with transformX: 25px and transformY: 25px;
+ *
+ * ); + * } + * }); + * ``` + */ + defaultPosition: _react.PropTypes.shape({ + x: _react.PropTypes.number, + y: _react.PropTypes.number + }), + + /** + * `position`, if present, defines the current position of the element. + * + * This is similar to how form elements in React work - if no `position` is supplied, the component + * is uncontrolled. + * + * Example: + * + * ```jsx + * let App = React.createClass({ + * render: function () { + * return ( + * + *
I start with transformX: 25px and transformY: 25px;
+ *
+ * ); + * } + * }); + * ``` + */ + position: _react.PropTypes.shape({ + x: _react.PropTypes.number, + y: _react.PropTypes.number + }), + + /** + * These properties should be defined on the child, not here. + */ + className: _shims.dontSetMe, + style: _shims.dontSetMe, + transform: _shims.dontSetMe + }); + Draggable.defaultProps = _extends({}, _DraggableCore2.default.defaultProps, { + axis: 'both', + bounds: false, + defaultClassName: 'react-draggable', + defaultClassNameDragging: 'react-draggable-dragging', + defaultClassNameDragged: 'react-draggable-dragged', + defaultPosition: { x: 0, y: 0 }, + position: null + }); + exports.default = Draggable; + +/***/ }, +/* 2 */ +/***/ function(module, exports) { + + module.exports = __WEBPACK_EXTERNAL_MODULE_2__; + +/***/ }, +/* 3 */ +/***/ function(module, exports) { + + module.exports = __WEBPACK_EXTERNAL_MODULE_3__; + +/***/ }, +/* 4 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! + Copyright (c) 2016 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames + */ + /* global define */ + + (function () { + 'use strict'; + + var hasOwn = {}.hasOwnProperty; + + function classNames () { + var classes = []; + + for (var i = 0; i < arguments.length; i++) { + var arg = arguments[i]; + if (!arg) continue; + + var argType = typeof arg; + + if (argType === 'string' || argType === 'number') { + classes.push(arg); + } else if (Array.isArray(arg)) { + classes.push(classNames.apply(null, arg)); + } else if (argType === 'object') { + for (var key in arg) { + if (hasOwn.call(arg, key) && arg[key]) { + classes.push(key); + } + } + } + } + + return classes.join(' '); + } + + if (typeof module !== 'undefined' && module.exports) { + module.exports = classNames; + } else if (true) { + // register as 'classnames', consistent with npm package name + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () { + return classNames; + }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else { + window.classNames = classNames; + } + }()); + + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + exports.matchesSelector = matchesSelector; + exports.matchesSelectorAndParentsTo = matchesSelectorAndParentsTo; + exports.addEvent = addEvent; + exports.removeEvent = removeEvent; + exports.outerHeight = outerHeight; + exports.outerWidth = outerWidth; + exports.innerHeight = innerHeight; + exports.innerWidth = innerWidth; + exports.offsetXYFromParent = offsetXYFromParent; + exports.createCSSTransform = createCSSTransform; + exports.createSVGTransform = createSVGTransform; + exports.getTouch = getTouch; + exports.getTouchIdentifier = getTouchIdentifier; + exports.addUserSelectStyles = addUserSelectStyles; + exports.removeUserSelectStyles = removeUserSelectStyles; + exports.styleHacks = styleHacks; + + var _shims = __webpack_require__(6); + + var _getPrefix = __webpack_require__(7); + + var _getPrefix2 = _interopRequireDefault(_getPrefix); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + + /*:: import type {ControlPosition} from './types';*/ + + + var matchesSelectorFunc = ''; + function matchesSelector(el /*: Node*/, selector /*: string*/) /*: boolean*/ { + if (!matchesSelectorFunc) { + matchesSelectorFunc = (0, _shims.findInArray)(['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector', 'oMatchesSelector'], function (method) { + // $FlowIgnore: Doesn't think elements are indexable + return (0, _shims.isFunction)(el[method]); + }); + } + + // $FlowIgnore: Doesn't think elements are indexable + return el[matchesSelectorFunc].call(el, selector); + } + + // Works up the tree to the draggable itself attempting to match selector. + function matchesSelectorAndParentsTo(el /*: Node*/, selector /*: string*/, baseNode /*: Node*/) /*: boolean*/ { + var node = el; + do { + if (matchesSelector(node, selector)) return true; + if (node === baseNode) return false; + node = node.parentNode; + } while (node); + + return false; + } + + function addEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/) /*: void*/ { + if (!el) { + return; + } + if (el.attachEvent) { + el.attachEvent('on' + event, handler); + } else if (el.addEventListener) { + el.addEventListener(event, handler, true); + } else { + // $FlowIgnore: Doesn't think elements are indexable + el['on' + event] = handler; + } + } + + function removeEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/) /*: void*/ { + if (!el) { + return; + } + if (el.detachEvent) { + el.detachEvent('on' + event, handler); + } else if (el.removeEventListener) { + el.removeEventListener(event, handler, true); + } else { + // $FlowIgnore: Doesn't think elements are indexable + el['on' + event] = null; + } + } + + function outerHeight(node /*: HTMLElement*/) /*: number*/ { + // This is deliberately excluding margin for our calculations, since we are using + // offsetTop which is including margin. See getBoundPosition + var height = node.clientHeight; + var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node); + height += (0, _shims.int)(computedStyle.borderTopWidth); + height += (0, _shims.int)(computedStyle.borderBottomWidth); + return height; + } + + function outerWidth(node /*: HTMLElement*/) /*: number*/ { + // This is deliberately excluding margin for our calculations, since we are using + // offsetLeft which is including margin. See getBoundPosition + var width = node.clientWidth; + var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node); + width += (0, _shims.int)(computedStyle.borderLeftWidth); + width += (0, _shims.int)(computedStyle.borderRightWidth); + return width; + } + function innerHeight(node /*: HTMLElement*/) /*: number*/ { + var height = node.clientHeight; + var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node); + height -= (0, _shims.int)(computedStyle.paddingTop); + height -= (0, _shims.int)(computedStyle.paddingBottom); + return height; + } + + function innerWidth(node /*: HTMLElement*/) /*: number*/ { + var width = node.clientWidth; + var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node); + width -= (0, _shims.int)(computedStyle.paddingLeft); + width -= (0, _shims.int)(computedStyle.paddingRight); + return width; + } + + // Get from offsetParent + function offsetXYFromParent(evt /*: {clientX: number, clientY: number}*/, offsetParent /*: HTMLElement*/) /*: ControlPosition*/ { + var isBody = offsetParent === offsetParent.ownerDocument.body; + var offsetParentRect = isBody ? { left: 0, top: 0 } : offsetParent.getBoundingClientRect(); + + var x = evt.clientX + offsetParent.scrollLeft - offsetParentRect.left; + var y = evt.clientY + offsetParent.scrollTop - offsetParentRect.top; + + return { x: x, y: y }; + } + + function createCSSTransform(_ref) /*: Object*/ { + var x = _ref.x, + y = _ref.y; + + // Replace unitless items with px + return _defineProperty({}, (0, _getPrefix.browserPrefixToKey)('transform', _getPrefix2.default), 'translate(' + x + 'px,' + y + 'px)'); + } + + function createSVGTransform(_ref3) /*: string*/ { + var x = _ref3.x, + y = _ref3.y; + + return 'translate(' + x + ',' + y + ')'; + } + + function getTouch(e /*: MouseTouchEvent*/, identifier /*: number*/) /*: ?{clientX: number, clientY: number}*/ { + return e.targetTouches && (0, _shims.findInArray)(e.targetTouches, function (t) { + return identifier === t.identifier; + }) || e.changedTouches && (0, _shims.findInArray)(e.changedTouches, function (t) { + return identifier === t.identifier; + }); + } + + function getTouchIdentifier(e /*: MouseTouchEvent*/) /*: ?number*/ { + if (e.targetTouches && e.targetTouches[0]) return e.targetTouches[0].identifier; + if (e.changedTouches && e.changedTouches[0]) return e.changedTouches[0].identifier; + } + + // User-select Hacks: + // + // Useful for preventing blue highlights all over everything when dragging. + var userSelectPrefix = (0, _getPrefix.getPrefix)('user-select'); + var userSelect = (0, _getPrefix.browserPrefixToStyle)('user-select', userSelectPrefix); + var userSelectStyle = ';' + userSelect + ': none;'; + var userSelectReplaceRegExp = new RegExp(';?' + userSelect + ': none;'); // leading ; not present on IE + + // Note we're passing `document` b/c we could be iframed + function addUserSelectStyles(body /*: HTMLElement*/) { + var style = body.getAttribute('style') || ''; + if (userSelectReplaceRegExp.test(style)) return; // don't add twice + body.setAttribute('style', style + userSelectStyle); + } + + function removeUserSelectStyles(body /*: HTMLElement*/) { + var style = body.getAttribute('style') || ''; + body.setAttribute('style', style.replace(userSelectReplaceRegExp, '')); + } + + function styleHacks() /*: Object*/ { + var childStyle /*: Object*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + // Workaround IE pointer events; see #51 + // https://github.com/mzabriskie/react-draggable/issues/51#issuecomment-103488278 + return _extends({ + touchAction: 'none' + }, childStyle); + } + +/***/ }, +/* 6 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.findInArray = findInArray; + exports.isFunction = isFunction; + exports.isNum = isNum; + exports.int = int; + exports.dontSetMe = dontSetMe; + + // @credits https://gist.github.com/rogozhnikoff/a43cfed27c41e4e68cdc + function findInArray(array /*: Array | TouchList*/, callback /*: Function*/) /*: any*/ { + for (var i = 0, length = array.length; i < length; i++) { + if (callback.apply(callback, [array[i], i, array])) return array[i]; + } + } + + function isFunction(func /*: any*/) /*: boolean*/ { + return typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]'; + } + + function isNum(num /*: any*/) /*: boolean*/ { + return typeof num === 'number' && !isNaN(num); + } + + function int(a /*: string*/) /*: number*/ { + return parseInt(a, 10); + } + + function dontSetMe(props /*: Object*/, propName /*: string*/, componentName /*: string*/) { + if (props[propName]) { + return new Error('Invalid prop ' + propName + ' passed to ' + componentName + ' - do not set this, set it on the child.'); + } + } + +/***/ }, +/* 7 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.getPrefix = getPrefix; + exports.browserPrefixToKey = browserPrefixToKey; + exports.browserPrefixToStyle = browserPrefixToStyle; + var prefixes = ['Moz', 'Webkit', 'O', 'ms']; + function getPrefix() /*: string*/ { + var prop /*: string*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform'; + + // Checking specifically for 'window.document' is for pseudo-browser server-side + // environments that define 'window' as the global context. + // E.g. React-rails (see https://github.com/reactjs/react-rails/pull/84) + if (typeof window === 'undefined' || typeof window.document === 'undefined') return ''; + + var style = window.document.documentElement.style; + + if (prop in style) return ''; + + for (var i = 0; i < prefixes.length; i++) { + if (browserPrefixToKey(prop, prefixes[i]) in style) return prefixes[i]; + } + + return ''; + } + + function browserPrefixToKey(prop /*: string*/, prefix /*: string*/) /*: string*/ { + return prefix ? '' + prefix + kebabToTitleCase(prop) : prop; + } + + function browserPrefixToStyle(prop /*: string*/, prefix /*: string*/) /*: string*/ { + return prefix ? '-' + prefix.toLowerCase() + '-' + prop : prop; + } + + function kebabToTitleCase(str /*: string*/) /*: string*/ { + var out = ''; + var shouldCapitalize = true; + for (var i = 0; i < str.length; i++) { + if (shouldCapitalize) { + out += str[i].toUpperCase(); + shouldCapitalize = false; + } else if (str[i] === '-') { + shouldCapitalize = true; + } else { + out += str[i]; + } + } + return out; + } + + // Default export is the prefix itself, like 'Moz', 'Webkit', etc + // Note that you may have to re-test for certain things; for instance, Chrome 50 + // can handle unprefixed `transform`, but not unprefixed `user-select` + exports.default = getPrefix(); + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.getBoundPosition = getBoundPosition; + exports.snapToGrid = snapToGrid; + exports.canDragX = canDragX; + exports.canDragY = canDragY; + exports.getControlPosition = getControlPosition; + exports.createCoreData = createCoreData; + exports.createDraggableData = createDraggableData; + + var _shims = __webpack_require__(6); + + var _reactDom = __webpack_require__(3); + + var _reactDom2 = _interopRequireDefault(_reactDom); + + var _domFns = __webpack_require__(5); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + /*:: import type Draggable from '../Draggable';*/ + /*:: import type {Bounds, ControlPosition, DraggableData} from './types';*/ + /*:: import type DraggableCore from '../DraggableCore';*/ + function getBoundPosition(draggable /*: Draggable*/, x /*: number*/, y /*: number*/) /*: [number, number]*/ { + // If no bounds, short-circuit and move on + if (!draggable.props.bounds) return [x, y]; + + // Clone new bounds + var bounds = draggable.props.bounds; + + bounds = typeof bounds === 'string' ? bounds : cloneBounds(bounds); + var node = _reactDom2.default.findDOMNode(draggable); + + if (typeof bounds === 'string') { + var ownerDocument = node.ownerDocument; + + var ownerWindow = ownerDocument.defaultView; + var boundNode = void 0; + if (bounds === 'parent') { + boundNode = node.parentNode; + } else { + boundNode = ownerDocument.querySelector(bounds); + if (!boundNode) throw new Error('Bounds selector "' + bounds + '" could not find an element.'); + } + var nodeStyle = ownerWindow.getComputedStyle(node); + var boundNodeStyle = ownerWindow.getComputedStyle(boundNode); + // Compute bounds. This is a pain with padding and offsets but this gets it exactly right. + bounds = { + left: -node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingLeft) + (0, _shims.int)(nodeStyle.marginLeft), + top: -node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingTop) + (0, _shims.int)(nodeStyle.marginTop), + right: (0, _domFns.innerWidth)(boundNode) - (0, _domFns.outerWidth)(node) - node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingRight) - (0, _shims.int)(nodeStyle.marginRight), + bottom: (0, _domFns.innerHeight)(boundNode) - (0, _domFns.outerHeight)(node) - node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingBottom) - (0, _shims.int)(nodeStyle.marginBottom) + }; + } + + // Keep x and y below right and bottom limits... + if ((0, _shims.isNum)(bounds.right)) x = Math.min(x, bounds.right); + if ((0, _shims.isNum)(bounds.bottom)) y = Math.min(y, bounds.bottom); + + // But above left and top limits. + if ((0, _shims.isNum)(bounds.left)) x = Math.max(x, bounds.left); + if ((0, _shims.isNum)(bounds.top)) y = Math.max(y, bounds.top); + + return [x, y]; + } + + function snapToGrid(grid /*: [number, number]*/, pendingX /*: number*/, pendingY /*: number*/) /*: [number, number]*/ { + var x = Math.round(pendingX / grid[0]) * grid[0]; + var y = Math.round(pendingY / grid[1]) * grid[1]; + return [x, y]; + } + + function canDragX(draggable /*: Draggable*/) /*: boolean*/ { + return draggable.props.axis === 'both' || draggable.props.axis === 'x'; + } + + function canDragY(draggable /*: Draggable*/) /*: boolean*/ { + return draggable.props.axis === 'both' || draggable.props.axis === 'y'; + } + + // Get {x, y} positions from event. + function getControlPosition(e /*: MouseTouchEvent*/, touchIdentifier /*: ?number*/, draggableCore /*: DraggableCore*/) /*: ?ControlPosition*/ { + var touchObj = typeof touchIdentifier === 'number' ? (0, _domFns.getTouch)(e, touchIdentifier) : null; + if (typeof touchIdentifier === 'number' && !touchObj) return null; // not the right touch + var node = _reactDom2.default.findDOMNode(draggableCore); + // User can provide an offsetParent if desired. + var offsetParent = draggableCore.props.offsetParent || node.offsetParent || node.ownerDocument.body; + return (0, _domFns.offsetXYFromParent)(touchObj || e, offsetParent); + } + + // Create an data object exposed by 's events + function createCoreData(draggable /*: DraggableCore*/, x /*: number*/, y /*: number*/) /*: DraggableData*/ { + var state = draggable.state; + var isStart = !(0, _shims.isNum)(state.lastX); + + if (isStart) { + // If this is our first move, use the x and y as last coords. + return { + node: _reactDom2.default.findDOMNode(draggable), + deltaX: 0, deltaY: 0, + lastX: x, lastY: y, + x: x, y: y + }; + } else { + // Otherwise calculate proper values. + return { + node: _reactDom2.default.findDOMNode(draggable), + deltaX: x - state.lastX, deltaY: y - state.lastY, + lastX: state.lastX, lastY: state.lastY, + x: x, y: y + }; + } + } + + // Create an data exposed by 's events + function createDraggableData(draggable /*: Draggable*/, coreData /*: DraggableData*/) /*: DraggableData*/ { + return { + node: coreData.node, + x: draggable.state.x + coreData.deltaX, + y: draggable.state.y + coreData.deltaY, + deltaX: coreData.deltaX, + deltaY: coreData.deltaY, + lastX: draggable.state.x, + lastY: draggable.state.y + }; + } + + // A lot faster than stringify/parse + function cloneBounds(bounds /*: Bounds*/) /*: Bounds*/ { + return { + left: bounds.left, + top: bounds.top, + right: bounds.right, + bottom: bounds.bottom + }; + } + +/***/ }, +/* 9 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); + + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + + var _react = __webpack_require__(2); + + var _react2 = _interopRequireDefault(_react); + + var _reactDom = __webpack_require__(3); + + var _reactDom2 = _interopRequireDefault(_reactDom); + + var _domFns = __webpack_require__(5); + + var _positionFns = __webpack_require__(8); + + var _shims = __webpack_require__(6); + + var _log = __webpack_require__(11); + + var _log2 = _interopRequireDefault(_log); + + 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 && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + // Simple abstraction for dragging events names. + /*:: import type {EventHandler} from './utils/types';*/ + var eventsFor = { + touch: { + start: 'touchstart', + move: 'touchmove', + stop: 'touchend' + }, + mouse: { + start: 'mousedown', + move: 'mousemove', + stop: 'mouseup' + } + }; + + // Default to mouse events. + var dragEventFor = eventsFor.mouse; + + // + // Define . + // + // is for advanced usage of . It maintains minimal internal state so it can + // work well with libraries that require more control over the element. + // + + /*:: type CoreState = { + dragging: boolean, + lastX: number, + lastY: number, + touchIdentifier: ?number + };*/ + + var DraggableCore = function (_React$Component) { + _inherits(DraggableCore, _React$Component); + + function DraggableCore() { + var _ref; + + var _temp, _this, _ret; + + _classCallCheck(this, DraggableCore); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = DraggableCore.__proto__ || Object.getPrototypeOf(DraggableCore)).call.apply(_ref, [this].concat(args))), _this), _this.state = { + dragging: false, + // Used while dragging to determine deltas. + lastX: NaN, lastY: NaN, + touchIdentifier: null + }, _this.handleDragStart = function (e) { + // Make it possible to attach event handlers on top of this one. + _this.props.onMouseDown(e); + + // Only accept left-clicks. + if (!_this.props.allowAnyClick && typeof e.button === 'number' && e.button !== 0) return false; + + // Get nodes. Be sure to grab relative document (could be iframed) + var domNode = _reactDom2.default.findDOMNode(_this); + var ownerDocument = domNode.ownerDocument; + + // Short circuit if handle or cancel prop was provided and selector doesn't match. + + if (_this.props.disabled || !(e.target instanceof ownerDocument.defaultView.Node) || _this.props.handle && !(0, _domFns.matchesSelectorAndParentsTo)(e.target, _this.props.handle, domNode) || _this.props.cancel && (0, _domFns.matchesSelectorAndParentsTo)(e.target, _this.props.cancel, domNode)) { + return; + } + + // Set touch identifier in component state if this is a touch event. This allows us to + // distinguish between individual touches on multitouch screens by identifying which + // touchpoint was set to this element. + var touchIdentifier = (0, _domFns.getTouchIdentifier)(e); + _this.setState({ touchIdentifier: touchIdentifier }); + + // Get the current drag point from the event. This is used as the offset. + var position = (0, _positionFns.getControlPosition)(e, touchIdentifier, _this); + if (position == null) return; // not possible but satisfies flow + var x = position.x, + y = position.y; + + // Create an event object with all the data parents need to make a decision here. + + var coreEvent = (0, _positionFns.createCoreData)(_this, x, y); + + (0, _log2.default)('DraggableCore: handleDragStart: %j', coreEvent); + + // Call event handler. If it returns explicit false, cancel. + (0, _log2.default)('calling', _this.props.onStart); + var shouldUpdate = _this.props.onStart(e, coreEvent); + if (shouldUpdate === false) return; + + // Add a style to the body to disable user-select. This prevents text from + // being selected all over the page. + if (_this.props.enableUserSelectHack) (0, _domFns.addUserSelectStyles)(ownerDocument.body); + + // Initiate dragging. Set the current x and y as offsets + // so we know how much we've moved during the drag. This allows us + // to drag elements around even if they have been moved, without issue. + _this.setState({ + dragging: true, + + lastX: x, + lastY: y + }); + + // Add events to the document directly so we catch when the user's mouse/touch moves outside of + // this element. We use different events depending on whether or not we have detected that this + // is a touch-capable device. + (0, _domFns.addEvent)(ownerDocument, dragEventFor.move, _this.handleDrag); + (0, _domFns.addEvent)(ownerDocument, dragEventFor.stop, _this.handleDragStop); + }, _this.handleDrag = function (e) { + + // Prevent scrolling on mobile devices, like ipad/iphone. + if (e.type === 'touchmove') e.preventDefault(); + + // Get the current drag point from the event. This is used as the offset. + var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _this); + if (position == null) return; + var x = position.x, + y = position.y; + + // Snap to grid if prop has been provided + + if (x !== x) debugger; + + if (Array.isArray(_this.props.grid)) { + var deltaX = x - _this.state.lastX, + deltaY = y - _this.state.lastY; + + var _snapToGrid = (0, _positionFns.snapToGrid)(_this.props.grid, deltaX, deltaY); + + var _snapToGrid2 = _slicedToArray(_snapToGrid, 2); + + deltaX = _snapToGrid2[0]; + deltaY = _snapToGrid2[1]; + + if (!deltaX && !deltaY) return; // skip useless drag + x = _this.state.lastX + deltaX, y = _this.state.lastY + deltaY; + } + + var coreEvent = (0, _positionFns.createCoreData)(_this, x, y); + + (0, _log2.default)('DraggableCore: handleDrag: %j', coreEvent); + + // Call event handler. If it returns explicit false, trigger end. + var shouldUpdate = _this.props.onDrag(e, coreEvent); + if (shouldUpdate === false) { + try { + // $FlowIgnore + _this.handleDragStop(new MouseEvent('mouseup')); + } catch (err) { + // Old browsers + var event = ((document.createEvent('MouseEvents') /*: any*/) /*: MouseTouchEvent*/); + // I see why this insanity was deprecated + // $FlowIgnore + event.initMouseEvent('mouseup', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); + _this.handleDragStop(event); + } + return; + } + + _this.setState({ + lastX: x, + lastY: y + }); + }, _this.handleDragStop = function (e) { + if (!_this.state.dragging) return; + + var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _this); + if (position == null) return; + var x = position.x, + y = position.y; + + var coreEvent = (0, _positionFns.createCoreData)(_this, x, y); + + var _ReactDOM$findDOMNode = _reactDom2.default.findDOMNode(_this), + ownerDocument = _ReactDOM$findDOMNode.ownerDocument; + + // Remove user-select hack + + + if (_this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(ownerDocument.body); + + (0, _log2.default)('DraggableCore: handleDragStop: %j', coreEvent); + + // Reset the el. + _this.setState({ + dragging: false, + lastX: NaN, + lastY: NaN + }); + + // Call event handler + _this.props.onStop(e, coreEvent); + + // Remove event handlers + (0, _log2.default)('DraggableCore: Removing handlers'); + (0, _domFns.removeEvent)(ownerDocument, dragEventFor.move, _this.handleDrag); + (0, _domFns.removeEvent)(ownerDocument, dragEventFor.stop, _this.handleDragStop); + }, _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) { + // We're on a touch device now, so change the event handlers + dragEventFor = eventsFor.touch; + + return _this.handleDragStart(e); + }, _this.onTouchEnd = function (e) { + // We're on a touch device now, so change the event handlers + dragEventFor = eventsFor.touch; + + return _this.handleDragStop(e); + }, _temp), _possibleConstructorReturn(_this, _ret); + } + + _createClass(DraggableCore, [{ + key: 'componentWillUnmount', + value: function componentWillUnmount() { + // Remove any leftover event handlers. Remove both touch and mouse handlers in case + // some browser quirk caused a touch event to fire during a mouse move, or vice versa. + var _ReactDOM$findDOMNode2 = _reactDom2.default.findDOMNode(this), + ownerDocument = _ReactDOM$findDOMNode2.ownerDocument; + + (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.move, this.handleDrag); + (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.move, this.handleDrag); + (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.stop, this.handleDragStop); + (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.stop, this.handleDragStop); + if (this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(ownerDocument.body); + } + + // Same as onMouseDown (start drag), but now consider this a touch device. + + }, { + key: 'render', + value: function render() /*: React.Element*/ { + // Reuse the child provided + // This makes it flexible to use whatever element is wanted (div, ul, etc) + return _react2.default.cloneElement(_react2.default.Children.only(this.props.children), { + style: (0, _domFns.styleHacks)(this.props.children.props.style), + + // Note: mouseMove handler is attached to document so it will still function + // when the user drags quickly and leaves the bounds of the element. + onMouseDown: this.onMouseDown, + onTouchStart: this.onTouchStart, + onMouseUp: this.onMouseUp, + onTouchEnd: this.onTouchEnd + }); + } + }]); + + return DraggableCore; + }(_react2.default.Component); + + DraggableCore.displayName = 'DraggableCore'; + DraggableCore.propTypes = { + /** + * `allowAnyClick` allows dragging using any mouse button. + * By default, we only accept the left button. + * + * Defaults to `false`. + */ + allowAnyClick: _react.PropTypes.bool, + + /** + * `disabled`, if true, stops the from dragging. All handlers, + * with the exception of `onMouseDown`, will not fire. + */ + disabled: _react.PropTypes.bool, + + /** + * By default, we add 'user-select:none' attributes to the document body + * to prevent ugly text selection during drag. If this is causing problems + * for your app, set this to `false`. + */ + enableUserSelectHack: _react.PropTypes.bool, + + /** + * `offsetParent`, if set, uses the passed DOM node to compute drag offsets + * instead of using the parent node. + */ + offsetParent: function offsetParent(props, propName) { + if (process.browser && props[propName] && props[propName].nodeType !== 1) { + throw new Error('Draggable\'s offsetParent must be a DOM Node.'); + } + }, + + /** + * `grid` specifies the x and y that dragging should snap to. + */ + grid: _react.PropTypes.arrayOf(_react.PropTypes.number), + + /** + * `handle` specifies a selector to be used as the handle that initiates drag. + * + * Example: + * + * ```jsx + * let App = React.createClass({ + * render: function () { + * return ( + * + *
+ *
Click me to drag
+ *
This is some other content
+ *
+ *
+ * ); + * } + * }); + * ``` + */ + handle: _react.PropTypes.string, + + /** + * `cancel` specifies a selector to be used to prevent drag initialization. + * + * Example: + * + * ```jsx + * let App = React.createClass({ + * render: function () { + * return( + * + *
+ *
You can't drag from here
+ *
Dragging here works fine
+ *
+ *
+ * ); + * } + * }); + * ``` + */ + cancel: _react.PropTypes.string, + + /** + * Called when dragging starts. + * If this function returns the boolean false, dragging will be canceled. + */ + onStart: _react.PropTypes.func, + + /** + * Called while dragging. + * If this function returns the boolean false, dragging will be canceled. + */ + onDrag: _react.PropTypes.func, + + /** + * Called when dragging stops. + * If this function returns the boolean false, the drag will remain active. + */ + onStop: _react.PropTypes.func, + + /** + * A workaround option which can be passed if onMouseDown needs to be accessed, + * since it'll always be blocked (as there is internal use of onMouseDown) + */ + onMouseDown: _react.PropTypes.func, + + /** + * These properties should be defined on the child, not here. + */ + className: _shims.dontSetMe, + style: _shims.dontSetMe, + transform: _shims.dontSetMe + }; + DraggableCore.defaultProps = { + allowAnyClick: false, // by default only accept left click + cancel: null, + disabled: false, + enableUserSelectHack: true, + offsetParent: null, + handle: null, + grid: null, + transform: null, + onStart: function onStart() {}, + onDrag: function onDrag() {}, + onStop: function onStop() {}, + onMouseDown: function onMouseDown() {} + }; + exports.default = DraggableCore; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10))) + +/***/ }, +/* 10 */ +/***/ function(module, exports) { + + // shim for using process in browser + var process = module.exports = {}; + + // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. + + var cachedSetTimeout; + var cachedClearTimeout; + + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); + } + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + } ()) + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + + } + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } + } + + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; + + // v8 likes predictible objects + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + process.versions = {}; + + function noop() {} + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + + process.cwd = function () { return '/' }; + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + process.umask = function() { return 0; }; + + +/***/ }, +/* 11 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = log; + + /*eslint no-console:0*/ + function log() { + var _console; + + if ((undefined)) (_console = console).log.apply(_console, arguments); + } + +/***/ } +/******/ ]) +}); +; +//# sourceMappingURL=react-draggable.js.map \ No newline at end of file diff --git a/dist/react-draggable.js.map b/dist/react-draggable.js.map new file mode 100644 index 00000000..32ea93d7 --- /dev/null +++ b/dist/react-draggable.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../webpack/universalModuleDefinition","../webpack/bootstrap 477221ee8cc9e0efea8a",".././index.js",".././lib/Draggable.es6","../external {\"commonjs\":\"react\",\"commonjs2\":\"react\",\"amd\":\"react\",\"root\":\"React\"}","../external {\"commonjs\":\"react-dom\",\"commonjs2\":\"react-dom\",\"amd\":\"react-dom\",\"root\":\"ReactDOM\"}",".././~/classnames/index.js",".././lib/utils/domFns.es6",".././lib/utils/shims.es6",".././lib/utils/getPrefix.es6",".././lib/utils/positionFns.es6",".././lib/DraggableCore.es6",".././~/process/browser.js",".././lib/utils/log.es6"],"names":["module","exports","require","default","DraggableCore","Draggable","props","onDragStart","e","coreData","shouldStart","onStart","setState","dragging","dragged","onDrag","state","uiData","newState","x","y","bounds","slackX","slackY","deltaX","deltaY","shouldUpdate","onDragStop","shouldStop","onStop","controlled","Boolean","position","defaultPosition","isElementSVG","console","warn","SVGElement","findDOMNode","nextProps","style","svgTransform","draggable","transformOpts","defaultClassName","defaultClassNameDragging","defaultClassNameDragged","className","children","cloneElement","Children","only","transform","Component","displayName","propTypes","axis","oneOf","oneOfType","shape","left","number","right","top","bottom","string","defaultProps","matchesSelector","matchesSelectorAndParentsTo","addEvent","removeEvent","outerHeight","outerWidth","innerHeight","innerWidth","offsetXYFromParent","createCSSTransform","createSVGTransform","getTouch","getTouchIdentifier","addUserSelectStyles","removeUserSelectStyles","styleHacks","matchesSelectorFunc","el","selector","method","call","baseNode","node","parentNode","event","handler","attachEvent","addEventListener","detachEvent","removeEventListener","height","clientHeight","computedStyle","ownerDocument","defaultView","getComputedStyle","borderTopWidth","borderBottomWidth","width","clientWidth","borderLeftWidth","borderRightWidth","paddingTop","paddingBottom","paddingLeft","paddingRight","evt","offsetParent","isBody","body","offsetParentRect","getBoundingClientRect","clientX","scrollLeft","clientY","scrollTop","identifier","targetTouches","t","changedTouches","userSelectPrefix","userSelect","userSelectStyle","userSelectReplaceRegExp","RegExp","getAttribute","test","setAttribute","replace","childStyle","touchAction","findInArray","isFunction","isNum","int","dontSetMe","array","callback","i","length","apply","func","Object","prototype","toString","num","isNaN","a","parseInt","propName","componentName","Error","getPrefix","browserPrefixToKey","browserPrefixToStyle","prefixes","prop","window","document","documentElement","prefix","kebabToTitleCase","toLowerCase","str","out","shouldCapitalize","toUpperCase","getBoundPosition","snapToGrid","canDragX","canDragY","getControlPosition","createCoreData","createDraggableData","cloneBounds","ownerWindow","boundNode","querySelector","nodeStyle","boundNodeStyle","offsetLeft","marginLeft","offsetTop","marginTop","marginRight","marginBottom","Math","min","max","grid","pendingX","pendingY","round","touchIdentifier","draggableCore","touchObj","isStart","lastX","lastY","eventsFor","touch","start","move","stop","mouse","dragEventFor","NaN","handleDragStart","onMouseDown","allowAnyClick","button","domNode","disabled","target","Node","handle","cancel","coreEvent","enableUserSelectHack","handleDrag","handleDragStop","type","preventDefault","Array","isArray","MouseEvent","err","createEvent","initMouseEvent","onMouseUp","onTouchStart","onTouchEnd","bool","process","browser","nodeType","arrayOf","log"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;ACtCAA,QAAOC,OAAP,GAAiB,mBAAAC,CAAQ,CAAR,EAA2BC,OAA5C;AACAH,QAAOC,OAAP,CAAeG,aAAf,GAA+B,mBAAAF,CAAQ,CAAR,EAA+BC,OAA9D,C;;;;;;;;;;;;;;;;;;ACAA;;;;AACA;;;;AAEA;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AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,4BAA2B;AAC3B;AACA;AACA;AACA,6BAA4B,UAAU;;;;;;;;;;;;mBCjLdgP,G;;AADxB;AACe,UAASA,GAAT,GAA2B;AAAA;;AACxC,OAAI,WAAJ,EAAiC,qBAAQA,GAAR;AAClC,E","file":"./dist/react-draggable.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"react\"), require(\"react-dom\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"react\", \"react-dom\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ReactDraggable\"] = factory(require(\"react\"), require(\"react-dom\"));\n\telse\n\t\troot[\"ReactDraggable\"] = factory(root[\"React\"], root[\"ReactDOM\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__) {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 477221ee8cc9e0efea8a","module.exports = require('./lib/Draggable').default;\nmodule.exports.DraggableCore = require('./lib/DraggableCore').default;\n\n\n\n// WEBPACK FOOTER //\n// ./index.js","// @flow\nimport React, {PropTypes} from 'react';\nimport ReactDOM from 'react-dom';\n// $FlowIgnore\nimport classNames from 'classnames';\nimport {createCSSTransform, createSVGTransform} from './utils/domFns';\nimport {canDragX, canDragY, createDraggableData, getBoundPosition} from './utils/positionFns';\nimport {dontSetMe} from './utils/shims';\nimport DraggableCore from './DraggableCore';\nimport log from './utils/log';\nimport type {DraggableEventHandler} from './utils/types';\n\ntype DraggableState = {\n dragging: boolean,\n dragged: boolean,\n x: number, y: number,\n slackX: number, slackY: number,\n isElementSVG: boolean\n};\n\ntype ConstructorProps = {\n position: { x: number, y: number },\n defaultPosition: { x: number, y: number }\n};\n\n//\n// Define \n//\n\nexport default class Draggable extends React.Component {\n\n static displayName = 'Draggable';\n\n static propTypes = {\n // Accepts all props accepts.\n ...DraggableCore.propTypes,\n\n /**\n * `axis` determines which axis the draggable can move.\n *\n * Note that all callbacks will still return data as normal. This only\n * controls flushing to the DOM.\n *\n * 'both' allows movement horizontally and vertically.\n * 'x' limits movement to horizontal axis.\n * 'y' limits movement to vertical axis.\n * 'none' limits all movement.\n *\n * Defaults to 'both'.\n */\n axis: PropTypes.oneOf(['both', 'x', 'y', 'none']),\n\n /**\n * `bounds` determines the range of movement available to the element.\n * Available values are:\n *\n * 'parent' restricts movement within the Draggable's parent node.\n *\n * Alternatively, pass an object with the following properties, all of which are optional:\n *\n * {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND}\n *\n * All values are in px.\n *\n * Example:\n *\n * ```jsx\n * let App = React.createClass({\n * render: function () {\n * return (\n * \n *
Content
\n *
\n * );\n * }\n * });\n * ```\n */\n bounds: PropTypes.oneOfType([\n PropTypes.shape({\n left: PropTypes.number,\n right: PropTypes.number,\n top: PropTypes.number,\n bottom: PropTypes.number\n }),\n PropTypes.string,\n PropTypes.oneOf([false])\n ]),\n\n defaultClassName: PropTypes.string,\n defaultClassNameDragging: PropTypes.string,\n defaultClassNameDragged: PropTypes.string,\n\n /**\n * `defaultPosition` specifies the x and y that the dragged item should start at\n *\n * Example:\n *\n * ```jsx\n * let App = React.createClass({\n * render: function () {\n * return (\n * \n *
I start with transformX: 25px and transformY: 25px;
\n *
\n * );\n * }\n * });\n * ```\n */\n defaultPosition: PropTypes.shape({\n x: PropTypes.number,\n y: PropTypes.number\n }),\n\n /**\n * `position`, if present, defines the current position of the element.\n *\n * This is similar to how form elements in React work - if no `position` is supplied, the component\n * is uncontrolled.\n *\n * Example:\n *\n * ```jsx\n * let App = React.createClass({\n * render: function () {\n * return (\n * \n *
I start with transformX: 25px and transformY: 25px;
\n *
\n * );\n * }\n * });\n * ```\n */\n position: PropTypes.shape({\n x: PropTypes.number,\n y: PropTypes.number\n }),\n\n /**\n * These properties should be defined on the child, not here.\n */\n className: dontSetMe,\n style: dontSetMe,\n transform: dontSetMe\n };\n\n static defaultProps = {\n ...DraggableCore.defaultProps,\n axis: 'both',\n bounds: false,\n defaultClassName: 'react-draggable',\n defaultClassNameDragging: 'react-draggable-dragging',\n defaultClassNameDragged: 'react-draggable-dragged',\n defaultPosition: {x: 0, y: 0},\n position: null\n };\n\n state: DraggableState;\n\n constructor(props: ConstructorProps) {\n super(props);\n\n this.state = {\n // Whether or not we are currently dragging.\n dragging: false,\n\n // Whether or not we have been dragged before.\n dragged: false,\n\n // Current transform x and y.\n x: props.position ? props.position.x : props.defaultPosition.x,\n y: props.position ? props.position.y : props.defaultPosition.y,\n\n // Used for compensating for out-of-bounds drags\n slackX: 0, slackY: 0,\n\n // Can only determine if SVG after mounting\n isElementSVG: false\n };\n };\n\n componentWillMount() {\n if (this.props.position && !(this.props.onDrag || this.props.onStop)) {\n // eslint-disable-next-line\n console.warn('A `position` was applied to this , without drag handlers. This will make this ' +\n 'component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the ' +\n '`position` of this element.');\n }\n }\n\n componentDidMount() {\n // Check to see if the element passed is an instanceof SVGElement\n if(typeof SVGElement !== 'undefined' && ReactDOM.findDOMNode(this) instanceof SVGElement) {\n this.setState({ isElementSVG: true });\n }\n }\n\n componentWillReceiveProps(nextProps: Object) {\n // Set x/y if position has changed\n if (nextProps.position &&\n (!this.props.position ||\n nextProps.position.x !== this.props.position.x ||\n nextProps.position.y !== this.props.position.y\n )\n ) {\n this.setState({ x: nextProps.position.x, y: nextProps.position.y });\n }\n }\n\n componentWillUnmount() {\n this.setState({dragging: false}); // prevents invariant if unmounted while dragging\n }\n\n onDragStart: DraggableEventHandler = (e, coreData) => {\n log('Draggable: onDragStart: %j', coreData);\n\n // Short-circuit if user's callback killed it.\n const shouldStart = this.props.onStart(e, createDraggableData(this, coreData));\n // Kills start event on core as well, so move handlers are never bound.\n if (shouldStart === false) return false;\n\n this.setState({dragging: true, dragged: true});\n };\n\n onDrag: DraggableEventHandler = (e, coreData) => {\n if (!this.state.dragging) return false;\n log('Draggable: onDrag: %j', coreData);\n\n const uiData = createDraggableData(this, coreData);\n\n const newState: $Shape = {\n x: uiData.x,\n y: uiData.y\n };\n\n // Keep within bounds.\n if (this.props.bounds) {\n // Save original x and y.\n const {x, y} = newState;\n\n // Add slack to the values used to calculate bound position. This will ensure that if\n // we start removing slack, the element won't react to it right away until it's been\n // completely removed.\n newState.x += this.state.slackX;\n newState.y += this.state.slackY;\n\n // Get bound position. This will ceil/floor the x and y within the boundaries.\n // $FlowBug\n [newState.x, newState.y] = getBoundPosition(this, newState.x, newState.y);\n\n // Recalculate slack by noting how much was shaved by the boundPosition handler.\n newState.slackX = this.state.slackX + (x - newState.x);\n newState.slackY = this.state.slackY + (y - newState.y);\n\n // Update the event we fire to reflect what really happened after bounds took effect.\n uiData.x = x;\n uiData.y = y;\n uiData.deltaX = newState.x - this.state.x;\n uiData.deltaY = newState.y - this.state.y;\n }\n\n // Short-circuit if user's callback killed it.\n const shouldUpdate = this.props.onDrag(e, uiData);\n if (shouldUpdate === false) return false;\n\n this.setState(newState);\n };\n\n onDragStop: DraggableEventHandler = (e, coreData) => {\n if (!this.state.dragging) return false;\n\n // Short-circuit if user's callback killed it.\n const shouldStop = this.props.onStop(e, createDraggableData(this, coreData));\n if (shouldStop === false) return false;\n\n log('Draggable: onDragStop: %j', coreData);\n\n const newState: $Shape = {\n dragging: false,\n slackX: 0,\n slackY: 0\n };\n\n // If this is a controlled component, the result of this operation will be to\n // revert back to the old position. We expect a handler on `onDragStop`, at the least.\n const controlled = Boolean(this.props.position);\n if (controlled) {\n const {x, y} = this.props.position;\n newState.x = x;\n newState.y = y;\n }\n\n this.setState(newState);\n };\n\n render(): React.Element {\n let style = {}, svgTransform = null;\n\n // If this is controlled, we don't want to move it - unless it's dragging.\n const controlled = Boolean(this.props.position);\n const draggable = !controlled || this.state.dragging;\n\n const position = this.props.position || this.props.defaultPosition;\n const transformOpts = {\n // Set left if horizontal drag is enabled\n x: canDragX(this) && draggable ?\n this.state.x :\n position.x,\n\n // Set top if vertical drag is enabled\n y: canDragY(this) && draggable ?\n this.state.y :\n position.y\n };\n\n // If this element was SVG, we use the `transform` attribute.\n if (this.state.isElementSVG) {\n svgTransform = createSVGTransform(transformOpts);\n } else {\n // Add a CSS transform to move the element around. This allows us to move the element around\n // without worrying about whether or not it is relatively or absolutely positioned.\n // If the item you are dragging already has a transform set, wrap it in a so \n // has a clean slate.\n style = createCSSTransform(transformOpts);\n }\n\n const {\n defaultClassName,\n defaultClassNameDragging,\n defaultClassNameDragged\n } = this.props;\n\n // Mark with class while dragging\n const className = classNames((this.props.children.props.className || ''), defaultClassName, {\n [defaultClassNameDragging]: this.state.dragging,\n [defaultClassNameDragged]: this.state.dragged\n });\n\n // Reuse the child provided\n // This makes it flexible to use whatever element is wanted (div, ul, etc)\n return (\n \n {React.cloneElement(React.Children.only(this.props.children), {\n className: className,\n style: {...this.props.children.props.style, ...style},\n transform: svgTransform\n })}\n \n );\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./lib/Draggable.es6","module.exports = __WEBPACK_EXTERNAL_MODULE_2__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"commonjs\":\"react\",\"commonjs2\":\"react\",\"amd\":\"react\",\"root\":\"React\"}\n// module id = 2\n// module chunks = 0","module.exports = __WEBPACK_EXTERNAL_MODULE_3__;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external {\"commonjs\":\"react-dom\",\"commonjs2\":\"react-dom\",\"amd\":\"react-dom\",\"root\":\"ReactDOM\"}\n// module id = 3\n// module chunks = 0","/*!\n Copyright (c) 2016 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\tclasses.push(classNames.apply(null, arg));\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/classnames/index.js\n// module id = 4\n// module chunks = 0","// @flow\nimport {findInArray, isFunction, int} from './shims';\nimport browserPrefix, {getPrefix, browserPrefixToStyle, browserPrefixToKey} from './getPrefix';\n\nimport type {ControlPosition} from './types';\n\nlet matchesSelectorFunc = '';\nexport function matchesSelector(el: Node, selector: string): boolean {\n if (!matchesSelectorFunc) {\n matchesSelectorFunc = findInArray([\n 'matches',\n 'webkitMatchesSelector',\n 'mozMatchesSelector',\n 'msMatchesSelector',\n 'oMatchesSelector'\n ], function(method){\n // $FlowIgnore: Doesn't think elements are indexable\n return isFunction(el[method]);\n });\n }\n\n // $FlowIgnore: Doesn't think elements are indexable\n return el[matchesSelectorFunc].call(el, selector);\n}\n\n// Works up the tree to the draggable itself attempting to match selector.\nexport function matchesSelectorAndParentsTo(el: Node, selector: string, baseNode: Node): boolean {\n let node = el;\n do {\n if (matchesSelector(node, selector)) return true;\n if (node === baseNode) return false;\n node = node.parentNode;\n } while (node);\n\n return false;\n}\n\nexport function addEvent(el: ?Node, event: string, handler: Function): void {\n if (!el) { return; }\n if (el.attachEvent) {\n el.attachEvent('on' + event, handler);\n } else if (el.addEventListener) {\n el.addEventListener(event, handler, true);\n } else {\n // $FlowIgnore: Doesn't think elements are indexable\n el['on' + event] = handler;\n }\n}\n\nexport function removeEvent(el: ?Node, event: string, handler: Function): void {\n if (!el) { return; }\n if (el.detachEvent) {\n el.detachEvent('on' + event, handler);\n } else if (el.removeEventListener) {\n el.removeEventListener(event, handler, true);\n } else {\n // $FlowIgnore: Doesn't think elements are indexable\n el['on' + event] = null;\n }\n}\n\nexport function outerHeight(node: HTMLElement): number {\n // This is deliberately excluding margin for our calculations, since we are using\n // offsetTop which is including margin. See getBoundPosition\n let height = node.clientHeight;\n const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);\n height += int(computedStyle.borderTopWidth);\n height += int(computedStyle.borderBottomWidth);\n return height;\n}\n\nexport function outerWidth(node: HTMLElement): number {\n // This is deliberately excluding margin for our calculations, since we are using\n // offsetLeft which is including margin. See getBoundPosition\n let width = node.clientWidth;\n const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);\n width += int(computedStyle.borderLeftWidth);\n width += int(computedStyle.borderRightWidth);\n return width;\n}\nexport function innerHeight(node: HTMLElement): number {\n let height = node.clientHeight;\n const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);\n height -= int(computedStyle.paddingTop);\n height -= int(computedStyle.paddingBottom);\n return height;\n}\n\nexport function innerWidth(node: HTMLElement): number {\n let width = node.clientWidth;\n const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);\n width -= int(computedStyle.paddingLeft);\n width -= int(computedStyle.paddingRight);\n return width;\n}\n\n// Get from offsetParent\nexport function offsetXYFromParent(evt: {clientX: number, clientY: number}, offsetParent: HTMLElement): ControlPosition {\n const isBody = offsetParent === offsetParent.ownerDocument.body;\n const offsetParentRect = isBody ? {left: 0, top: 0} : offsetParent.getBoundingClientRect();\n\n const x = evt.clientX + offsetParent.scrollLeft - offsetParentRect.left;\n const y = evt.clientY + offsetParent.scrollTop - offsetParentRect.top;\n\n return {x, y};\n}\n\nexport function createCSSTransform({x, y}: {x: number, y: number}): Object {\n // Replace unitless items with px\n return {[browserPrefixToKey('transform', browserPrefix)]: 'translate(' + x + 'px,' + y + 'px)'};\n}\n\nexport function createSVGTransform({x, y}: {x: number, y: number}): string {\n return 'translate(' + x + ',' + y + ')';\n}\n\nexport function getTouch(e: MouseTouchEvent, identifier: number): ?{clientX: number, clientY: number} {\n return (e.targetTouches && findInArray(e.targetTouches, t => identifier === t.identifier)) ||\n (e.changedTouches && findInArray(e.changedTouches, t => identifier === t.identifier));\n}\n\nexport function getTouchIdentifier(e: MouseTouchEvent): ?number {\n if (e.targetTouches && e.targetTouches[0]) return e.targetTouches[0].identifier;\n if (e.changedTouches && e.changedTouches[0]) return e.changedTouches[0].identifier;\n}\n\n// User-select Hacks:\n//\n// Useful for preventing blue highlights all over everything when dragging.\nconst userSelectPrefix = getPrefix('user-select');\nconst userSelect = browserPrefixToStyle('user-select', userSelectPrefix);\nconst userSelectStyle = `;${userSelect}: none;`;\nconst userSelectReplaceRegExp = new RegExp(`;?${userSelect}: none;`); // leading ; not present on IE\n\n// Note we're passing `document` b/c we could be iframed\nexport function addUserSelectStyles(body: HTMLElement) {\n const style = body.getAttribute('style') || '';\n if (userSelectReplaceRegExp.test(style)) return; // don't add twice\n body.setAttribute('style', style + userSelectStyle);\n}\n\nexport function removeUserSelectStyles(body: HTMLElement) {\n const style = body.getAttribute('style') || '';\n body.setAttribute('style', style.replace(userSelectReplaceRegExp, ''));\n}\n\nexport function styleHacks(childStyle: Object = {}): Object {\n // Workaround IE pointer events; see #51\n // https://github.com/mzabriskie/react-draggable/issues/51#issuecomment-103488278\n return {\n touchAction: 'none',\n ...childStyle\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./lib/utils/domFns.es6","// @flow\n// @credits https://gist.github.com/rogozhnikoff/a43cfed27c41e4e68cdc\nexport function findInArray(array: Array | TouchList, callback: Function): any {\n for (let i = 0, length = array.length; i < length; i++) {\n if (callback.apply(callback, [array[i], i, array])) return array[i];\n }\n}\n\nexport function isFunction(func: any): boolean {\n return typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]';\n}\n\nexport function isNum(num: any): boolean {\n return typeof num === 'number' && !isNaN(num);\n}\n\nexport function int(a: string): number {\n return parseInt(a, 10);\n}\n\nexport function dontSetMe(props: Object, propName: string, componentName: string) {\n if (props[propName]) {\n return new Error(`Invalid prop ${propName} passed to ${componentName} - do not set this, set it on the child.`);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./lib/utils/shims.es6","// @flow\nconst prefixes = ['Moz', 'Webkit', 'O', 'ms'];\nexport function getPrefix(prop: string='transform'): string {\n // Checking specifically for 'window.document' is for pseudo-browser server-side\n // environments that define 'window' as the global context.\n // E.g. React-rails (see https://github.com/reactjs/react-rails/pull/84)\n if (typeof window === 'undefined' || typeof window.document === 'undefined') return '';\n\n const style = window.document.documentElement.style;\n\n if (prop in style) return '';\n\n for (let i = 0; i < prefixes.length; i++) {\n if (browserPrefixToKey(prop, prefixes[i]) in style) return prefixes[i];\n }\n\n return '';\n}\n\nexport function browserPrefixToKey(prop: string, prefix: string): string {\n return prefix ? `${prefix}${kebabToTitleCase(prop)}` : prop;\n}\n\nexport function browserPrefixToStyle(prop: string, prefix: string): string {\n return prefix ? `-${prefix.toLowerCase()}-${prop}` : prop;\n}\n\nfunction kebabToTitleCase(str: string): string {\n let out = '';\n let shouldCapitalize = true;\n for (let i = 0; i < str.length; i++) {\n if (shouldCapitalize) {\n out += str[i].toUpperCase();\n shouldCapitalize = false;\n } else if (str[i] === '-') {\n shouldCapitalize = true;\n } else {\n out += str[i];\n }\n }\n return out;\n}\n\n// Default export is the prefix itself, like 'Moz', 'Webkit', etc\n// Note that you may have to re-test for certain things; for instance, Chrome 50\n// can handle unprefixed `transform`, but not unprefixed `user-select`\nexport default getPrefix();\n\n\n\n// WEBPACK FOOTER //\n// ./lib/utils/getPrefix.es6","// @flow\nimport {isNum, int} from './shims';\nimport ReactDOM from 'react-dom';\nimport {getTouch, innerWidth, innerHeight, offsetXYFromParent, outerWidth, outerHeight} from './domFns';\n\nimport type Draggable from '../Draggable';\nimport type {Bounds, ControlPosition, DraggableData} from './types';\nimport type DraggableCore from '../DraggableCore';\n\nexport function getBoundPosition(draggable: Draggable, x: number, y: number): [number, number] {\n // If no bounds, short-circuit and move on\n if (!draggable.props.bounds) return [x, y];\n\n // Clone new bounds\n let {bounds} = draggable.props;\n bounds = typeof bounds === 'string' ? bounds : cloneBounds(bounds);\n const node = ReactDOM.findDOMNode(draggable);\n\n if (typeof bounds === 'string') {\n const {ownerDocument} = node;\n const ownerWindow = ownerDocument.defaultView;\n let boundNode;\n if (bounds === 'parent') {\n boundNode = node.parentNode;\n } else {\n boundNode = ownerDocument.querySelector(bounds);\n if (!boundNode) throw new Error('Bounds selector \"' + bounds + '\" could not find an element.');\n }\n const nodeStyle = ownerWindow.getComputedStyle(node);\n const boundNodeStyle = ownerWindow.getComputedStyle(boundNode);\n // Compute bounds. This is a pain with padding and offsets but this gets it exactly right.\n bounds = {\n left: -node.offsetLeft + int(boundNodeStyle.paddingLeft) + int(nodeStyle.marginLeft),\n top: -node.offsetTop + int(boundNodeStyle.paddingTop) + int(nodeStyle.marginTop),\n right: innerWidth(boundNode) - outerWidth(node) - node.offsetLeft +\n int(boundNodeStyle.paddingRight) - int(nodeStyle.marginRight),\n bottom: innerHeight(boundNode) - outerHeight(node) - node.offsetTop +\n int(boundNodeStyle.paddingBottom) - int(nodeStyle.marginBottom)\n };\n }\n\n // Keep x and y below right and bottom limits...\n if (isNum(bounds.right)) x = Math.min(x, bounds.right);\n if (isNum(bounds.bottom)) y = Math.min(y, bounds.bottom);\n\n // But above left and top limits.\n if (isNum(bounds.left)) x = Math.max(x, bounds.left);\n if (isNum(bounds.top)) y = Math.max(y, bounds.top);\n\n return [x, y];\n}\n\nexport function snapToGrid(grid: [number, number], pendingX: number, pendingY: number): [number, number] {\n const x = Math.round(pendingX / grid[0]) * grid[0];\n const y = Math.round(pendingY / grid[1]) * grid[1];\n return [x, y];\n}\n\nexport function canDragX(draggable: Draggable): boolean {\n return draggable.props.axis === 'both' || draggable.props.axis === 'x';\n}\n\nexport function canDragY(draggable: Draggable): boolean {\n return draggable.props.axis === 'both' || draggable.props.axis === 'y';\n}\n\n// Get {x, y} positions from event.\nexport function getControlPosition(e: MouseTouchEvent, touchIdentifier: ?number, draggableCore: DraggableCore): ?ControlPosition {\n const touchObj = typeof touchIdentifier === 'number' ? getTouch(e, touchIdentifier) : null;\n if (typeof touchIdentifier === 'number' && !touchObj) return null; // not the right touch\n const node = ReactDOM.findDOMNode(draggableCore);\n // User can provide an offsetParent if desired.\n const offsetParent = draggableCore.props.offsetParent || node.offsetParent || node.ownerDocument.body;\n return offsetXYFromParent(touchObj || e, offsetParent);\n}\n\n// Create an data object exposed by 's events\nexport function createCoreData(draggable: DraggableCore, x: number, y: number): DraggableData {\n const state = draggable.state;\n const isStart = !isNum(state.lastX);\n\n if (isStart) {\n // If this is our first move, use the x and y as last coords.\n return {\n node: ReactDOM.findDOMNode(draggable),\n deltaX: 0, deltaY: 0,\n lastX: x, lastY: y,\n x: x, y: y\n };\n } else {\n // Otherwise calculate proper values.\n return {\n node: ReactDOM.findDOMNode(draggable),\n deltaX: x - state.lastX, deltaY: y - state.lastY,\n lastX: state.lastX, lastY: state.lastY,\n x: x, y: y\n };\n }\n}\n\n// Create an data exposed by 's events\nexport function createDraggableData(draggable: Draggable, coreData: DraggableData): DraggableData {\n return {\n node: coreData.node,\n x: draggable.state.x + coreData.deltaX,\n y: draggable.state.y + coreData.deltaY,\n deltaX: coreData.deltaX,\n deltaY: coreData.deltaY,\n lastX: draggable.state.x,\n lastY: draggable.state.y\n };\n}\n\n// A lot faster than stringify/parse\nfunction cloneBounds(bounds: Bounds): Bounds {\n return {\n left: bounds.left,\n top: bounds.top,\n right: bounds.right,\n bottom: bounds.bottom\n };\n}\n\n\n\n// WEBPACK FOOTER //\n// ./lib/utils/positionFns.es6","// @flow\nimport React, {PropTypes} from 'react';\nimport ReactDOM from 'react-dom';\nimport {matchesSelectorAndParentsTo, addEvent, removeEvent, addUserSelectStyles, getTouchIdentifier,\n removeUserSelectStyles, styleHacks} from './utils/domFns';\nimport {createCoreData, getControlPosition, snapToGrid} from './utils/positionFns';\nimport {dontSetMe} from './utils/shims';\nimport log from './utils/log';\n\nimport type {EventHandler} from './utils/types';\n\n// Simple abstraction for dragging events names.\nconst eventsFor = {\n touch: {\n start: 'touchstart',\n move: 'touchmove',\n stop: 'touchend'\n },\n mouse: {\n start: 'mousedown',\n move: 'mousemove',\n stop: 'mouseup'\n }\n};\n\n// Default to mouse events.\nlet dragEventFor = eventsFor.mouse;\n\ntype CoreState = {\n dragging: boolean,\n lastX: number,\n lastY: number,\n touchIdentifier: ?number\n};\n\n//\n// Define .\n//\n// is for advanced usage of . It maintains minimal internal state so it can\n// work well with libraries that require more control over the element.\n//\n\nexport default class DraggableCore extends React.Component {\n\n static displayName = 'DraggableCore';\n\n static propTypes = {\n /**\n * `allowAnyClick` allows dragging using any mouse button.\n * By default, we only accept the left button.\n *\n * Defaults to `false`.\n */\n allowAnyClick: PropTypes.bool,\n\n /**\n * `disabled`, if true, stops the from dragging. All handlers,\n * with the exception of `onMouseDown`, will not fire.\n */\n disabled: PropTypes.bool,\n\n /**\n * By default, we add 'user-select:none' attributes to the document body\n * to prevent ugly text selection during drag. If this is causing problems\n * for your app, set this to `false`.\n */\n enableUserSelectHack: PropTypes.bool,\n\n /**\n * `offsetParent`, if set, uses the passed DOM node to compute drag offsets\n * instead of using the parent node.\n */\n offsetParent: function(props, propName) {\n if (process.browser && props[propName] && props[propName].nodeType !== 1) {\n throw new Error('Draggable\\'s offsetParent must be a DOM Node.');\n }\n },\n\n /**\n * `grid` specifies the x and y that dragging should snap to.\n */\n grid: PropTypes.arrayOf(PropTypes.number),\n\n /**\n * `handle` specifies a selector to be used as the handle that initiates drag.\n *\n * Example:\n *\n * ```jsx\n * let App = React.createClass({\n * render: function () {\n * return (\n * \n *
\n *
Click me to drag
\n *
This is some other content
\n *
\n *
\n * );\n * }\n * });\n * ```\n */\n handle: PropTypes.string,\n\n /**\n * `cancel` specifies a selector to be used to prevent drag initialization.\n *\n * Example:\n *\n * ```jsx\n * let App = React.createClass({\n * render: function () {\n * return(\n * \n *
\n *
You can't drag from here
\n *
Dragging here works fine
\n *
\n *
\n * );\n * }\n * });\n * ```\n */\n cancel: PropTypes.string,\n\n /**\n * Called when dragging starts.\n * If this function returns the boolean false, dragging will be canceled.\n */\n onStart: PropTypes.func,\n\n /**\n * Called while dragging.\n * If this function returns the boolean false, dragging will be canceled.\n */\n onDrag: PropTypes.func,\n\n /**\n * Called when dragging stops.\n * If this function returns the boolean false, the drag will remain active.\n */\n onStop: PropTypes.func,\n\n /**\n * A workaround option which can be passed if onMouseDown needs to be accessed,\n * since it'll always be blocked (as there is internal use of onMouseDown)\n */\n onMouseDown: PropTypes.func,\n\n /**\n * These properties should be defined on the child, not here.\n */\n className: dontSetMe,\n style: dontSetMe,\n transform: dontSetMe\n };\n\n static defaultProps = {\n allowAnyClick: false, // by default only accept left click\n cancel: null,\n disabled: false,\n enableUserSelectHack: true,\n offsetParent: null,\n handle: null,\n grid: null,\n transform: null,\n onStart: function(){},\n onDrag: function(){},\n onStop: function(){},\n onMouseDown: function(){}\n };\n\n state: CoreState = {\n dragging: false,\n // Used while dragging to determine deltas.\n lastX: NaN, lastY: NaN,\n touchIdentifier: null\n };\n\n componentWillUnmount() {\n // Remove any leftover event handlers. Remove both touch and mouse handlers in case\n // some browser quirk caused a touch event to fire during a mouse move, or vice versa.\n const {ownerDocument} = ReactDOM.findDOMNode(this);\n removeEvent(ownerDocument, eventsFor.mouse.move, this.handleDrag);\n removeEvent(ownerDocument, eventsFor.touch.move, this.handleDrag);\n removeEvent(ownerDocument, eventsFor.mouse.stop, this.handleDragStop);\n removeEvent(ownerDocument, eventsFor.touch.stop, this.handleDragStop);\n if (this.props.enableUserSelectHack) removeUserSelectStyles(ownerDocument.body);\n }\n\n handleDragStart: EventHandler = (e) => {\n // Make it possible to attach event handlers on top of this one.\n this.props.onMouseDown(e);\n\n // Only accept left-clicks.\n if (!this.props.allowAnyClick && typeof e.button === 'number' && e.button !== 0) return false;\n\n // Get nodes. Be sure to grab relative document (could be iframed)\n const domNode = ReactDOM.findDOMNode(this);\n const {ownerDocument} = domNode;\n\n // Short circuit if handle or cancel prop was provided and selector doesn't match.\n if (this.props.disabled ||\n (!(e.target instanceof ownerDocument.defaultView.Node)) ||\n (this.props.handle && !matchesSelectorAndParentsTo(e.target, this.props.handle, domNode)) ||\n (this.props.cancel && matchesSelectorAndParentsTo(e.target, this.props.cancel, domNode))) {\n return;\n }\n\n // Set touch identifier in component state if this is a touch event. This allows us to\n // distinguish between individual touches on multitouch screens by identifying which\n // touchpoint was set to this element.\n const touchIdentifier = getTouchIdentifier(e);\n this.setState({touchIdentifier});\n\n // Get the current drag point from the event. This is used as the offset.\n const position = getControlPosition(e, touchIdentifier, this);\n if (position == null) return; // not possible but satisfies flow\n const {x, y} = position;\n\n // Create an event object with all the data parents need to make a decision here.\n const coreEvent = createCoreData(this, x, y);\n\n log('DraggableCore: handleDragStart: %j', coreEvent);\n\n // Call event handler. If it returns explicit false, cancel.\n log('calling', this.props.onStart);\n const shouldUpdate = this.props.onStart(e, coreEvent);\n if (shouldUpdate === false) return;\n\n // Add a style to the body to disable user-select. This prevents text from\n // being selected all over the page.\n if (this.props.enableUserSelectHack) addUserSelectStyles(ownerDocument.body);\n\n // Initiate dragging. Set the current x and y as offsets\n // so we know how much we've moved during the drag. This allows us\n // to drag elements around even if they have been moved, without issue.\n this.setState({\n dragging: true,\n\n lastX: x,\n lastY: y\n });\n\n // Add events to the document directly so we catch when the user's mouse/touch moves outside of\n // this element. We use different events depending on whether or not we have detected that this\n // is a touch-capable device.\n addEvent(ownerDocument, dragEventFor.move, this.handleDrag);\n addEvent(ownerDocument, dragEventFor.stop, this.handleDragStop);\n };\n\n handleDrag: EventHandler = (e) => {\n\n // Prevent scrolling on mobile devices, like ipad/iphone.\n if (e.type === 'touchmove') e.preventDefault();\n\n // Get the current drag point from the event. This is used as the offset.\n const position = getControlPosition(e, this.state.touchIdentifier, this);\n if (position == null) return;\n let {x, y} = position;\n\n // Snap to grid if prop has been provided\n if (x !== x) debugger;\n\n if (Array.isArray(this.props.grid)) {\n let deltaX = x - this.state.lastX, deltaY = y - this.state.lastY;\n [deltaX, deltaY] = snapToGrid(this.props.grid, deltaX, deltaY);\n if (!deltaX && !deltaY) return; // skip useless drag\n x = this.state.lastX + deltaX, y = this.state.lastY + deltaY;\n }\n\n const coreEvent = createCoreData(this, x, y);\n\n log('DraggableCore: handleDrag: %j', coreEvent);\n\n // Call event handler. If it returns explicit false, trigger end.\n const shouldUpdate = this.props.onDrag(e, coreEvent);\n if (shouldUpdate === false) {\n try {\n // $FlowIgnore\n this.handleDragStop(new MouseEvent('mouseup'));\n } catch (err) {\n // Old browsers\n const event = ((document.createEvent('MouseEvents'): any): MouseTouchEvent);\n // I see why this insanity was deprecated\n // $FlowIgnore\n event.initMouseEvent('mouseup', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);\n this.handleDragStop(event);\n }\n return;\n }\n\n this.setState({\n lastX: x,\n lastY: y\n });\n };\n\n handleDragStop: EventHandler = (e) => {\n if (!this.state.dragging) return;\n\n const position = getControlPosition(e, this.state.touchIdentifier, this);\n if (position == null) return;\n const {x, y} = position;\n const coreEvent = createCoreData(this, x, y);\n const {ownerDocument} = ReactDOM.findDOMNode(this);\n\n // Remove user-select hack\n if (this.props.enableUserSelectHack) removeUserSelectStyles(ownerDocument.body);\n\n log('DraggableCore: handleDragStop: %j', coreEvent);\n\n // Reset the el.\n this.setState({\n dragging: false,\n lastX: NaN,\n lastY: NaN\n });\n\n // Call event handler\n this.props.onStop(e, coreEvent);\n\n // Remove event handlers\n log('DraggableCore: Removing handlers');\n removeEvent(ownerDocument, dragEventFor.move, this.handleDrag);\n removeEvent(ownerDocument, dragEventFor.stop, this.handleDragStop);\n };\n\n onMouseDown: EventHandler = (e) => {\n dragEventFor = eventsFor.mouse; // on touchscreen laptops we could switch back to mouse\n\n return this.handleDragStart(e);\n };\n\n onMouseUp: EventHandler = (e) => {\n dragEventFor = eventsFor.mouse;\n\n return this.handleDragStop(e);\n };\n\n // Same as onMouseDown (start drag), but now consider this a touch device.\n onTouchStart: EventHandler = (e) => {\n // We're on a touch device now, so change the event handlers\n dragEventFor = eventsFor.touch;\n\n return this.handleDragStart(e);\n };\n\n onTouchEnd: EventHandler = (e) => {\n // We're on a touch device now, so change the event handlers\n dragEventFor = eventsFor.touch;\n\n return this.handleDragStop(e);\n };\n\n render(): React.Element {\n // Reuse the child provided\n // This makes it flexible to use whatever element is wanted (div, ul, etc)\n return React.cloneElement(React.Children.only(this.props.children), {\n style: styleHacks(this.props.children.props.style),\n\n // Note: mouseMove handler is attached to document so it will still function\n // when the user drags quickly and leaves the bounds of the element.\n onMouseDown: this.onMouseDown,\n onTouchStart: this.onTouchStart,\n onMouseUp: this.onMouseUp,\n onTouchEnd: this.onTouchEnd\n });\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./lib/DraggableCore.es6","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/process/browser.js\n// module id = 10\n// module chunks = 0","// @flow\n/*eslint no-console:0*/\nexport default function log(...args: any) {\n if (process.env.DRAGGABLE_DEBUG) console.log(...args);\n}\n\n\n\n// WEBPACK FOOTER //\n// ./lib/utils/log.es6"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/react-draggable.min.js b/dist/react-draggable.min.js new file mode 100644 index 00000000..ec963dae --- /dev/null +++ b/dist/react-draggable.min.js @@ -0,0 +1,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 _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 _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, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}},{key:"componentDidMount",value:function(){"undefined"!=typeof SVGElement&&_reactDom2.default.findDOMNode(this)instanceof SVGElement&&this.setState({isElementSVG:!0})}},{key:"componentWillReceiveProps",value:function(nextProps){!nextProps.position||this.props.position&&nextProps.position.x===this.props.position.x&&nextProps.position.y===this.props.position.y||this.setState({x:nextProps.position.x,y:nextProps.position.y})}},{key:"componentWillUnmount",value:function(){this.setState({dragging:!1})}},{key:"render",value:function(){var _classNames,style={},svgTransform=null,controlled=Boolean(this.props.position),draggable=!controlled||this.state.dragging,position=this.props.position||this.props.defaultPosition,transformOpts={x:(0,_positionFns.canDragX)(this)&&draggable?this.state.x:position.x,y:(0,_positionFns.canDragY)(this)&&draggable?this.state.y:position.y};this.state.isElementSVG?svgTransform=(0,_domFns.createSVGTransform)(transformOpts):style=(0,_domFns.createCSSTransform)(transformOpts);var _props=this.props,defaultClassName=_props.defaultClassName,defaultClassNameDragging=_props.defaultClassNameDragging,defaultClassNameDragged=_props.defaultClassNameDragged,className=(0,_classnames2.default)(this.props.children.props.className||"",defaultClassName,(_classNames={},_defineProperty(_classNames,defaultClassNameDragging,this.state.dragging),_defineProperty(_classNames,defaultClassNameDragged,this.state.dragged),_classNames));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])]),defaultClassName:_react.PropTypes.string,defaultClassNameDragging:_react.PropTypes.string,defaultClassNameDragged:_react.PropTypes.string,defaultPosition:_react.PropTypes.shape({x:_react.PropTypes.number,y:_react.PropTypes.number}),position:_react.PropTypes.shape({x:_react.PropTypes.number,y:_react.PropTypes.number}),className:_shims.dontSetMe,style:_shims.dontSetMe,transform:_shims.dontSetMe}),Draggable.defaultProps=_extends({},_DraggableCore2.default.defaultProps,{axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},position:null}),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;i0&&void 0!==arguments[0]?arguments[0]:{};return _extends({touchAction:"none"},childStyle)}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(target){for(var i=1;i0&&void 0!==arguments[0]?arguments[0]:"transform";if("undefined"==typeof window||"undefined"==typeof window.document)return"";var style=window.document.documentElement.style;if(prop in style)return"";for(var i=0;i1)for(var i=1;i