[nwd] Pushing the build folder with the trusted types patched built files
We are pushing the patched trusted types built to ensure that is is consumed by Appsheet when pulling from our third_party/react-draggable folder
Change-Id: Iabe0793c37bd2febc6efb52cfc101865b63bc33c
diff --git a/.gitignore b/.gitignore
index 466f326..26f9afb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
.idea
*.iml
node_modules/
-build/
+# build/
diff --git a/build/cjs/Draggable.js b/build/cjs/Draggable.js
new file mode 100644
index 0000000..13ee5c7
--- /dev/null
+++ b/build/cjs/Draggable.js
@@ -0,0 +1,457 @@
+"use strict";
+
+function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+Object.defineProperty(exports, "DraggableCore", {
+ enumerable: true,
+ get: function get() {
+ return _DraggableCore.default;
+ }
+});
+exports.default = void 0;
+
+var React = _interopRequireWildcard(require("react"));
+
+var _propTypes = _interopRequireDefault(require("prop-types"));
+
+var _reactDom = _interopRequireDefault(require("react-dom"));
+
+var _clsx2 = _interopRequireDefault(require("clsx"));
+
+var _domFns = require("./utils/domFns");
+
+var _positionFns = require("./utils/positionFns");
+
+var _shims = require("./utils/shims");
+
+var _DraggableCore = _interopRequireDefault(require("./DraggableCore"));
+
+var _log = _interopRequireDefault(require("./utils/log"));
+
+var _excluded = ["axis", "bounds", "children", "defaultPosition", "defaultClassName", "defaultClassNameDragging", "defaultClassNameDragged", "position", "positionOffset", "scale"];
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
+
+function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function _extends() { _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; }; return _extends.apply(this, arguments); }
+
+function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
+
+function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
+
+function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
+
+function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
+
+function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
+
+function _nonIterableRest() { 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 _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
+
+function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
+
+function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
+
+function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
+
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
+
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
+
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
+
+function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
+
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
+
+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; }
+
+//
+// Define <Draggable>
+//
+var Draggable = /*#__PURE__*/function (_React$Component) {
+ _inherits(Draggable, _React$Component);
+
+ var _super = _createSuper(Draggable);
+
+ function Draggable(props
+ /*: DraggableProps*/
+ ) {
+ var _this;
+
+ _classCallCheck(this, Draggable);
+
+ _this = _super.call(this, props);
+
+ _defineProperty(_assertThisInitialized(_this), "onDragStart", function (e, coreData) {
+ (0, _log.default)('Draggable: onDragStart: %j', coreData); // Short-circuit if user's callback killed it.
+
+ var shouldStart = _this.props.onStart(e, (0, _positionFns.createDraggableData)(_assertThisInitialized(_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
+ });
+ });
+
+ _defineProperty(_assertThisInitialized(_this), "onDrag", function (e, coreData) {
+ if (!_this.state.dragging) return false;
+ (0, _log.default)('Draggable: onDrag: %j', coreData);
+ var uiData = (0, _positionFns.createDraggableData)(_assertThisInitialized(_this), coreData);
+ var newState
+ /*: $Shape<DraggableState>*/
+ = {
+ 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.
+
+ var _getBoundPosition = (0, _positionFns.getBoundPosition)(_assertThisInitialized(_this), newState.x, newState.y),
+ _getBoundPosition2 = _slicedToArray(_getBoundPosition, 2),
+ newStateX = _getBoundPosition2[0],
+ newStateY = _getBoundPosition2[1];
+
+ newState.x = newStateX;
+ newState.y = newStateY; // Recalculate slack by noting how much was shaved by the boundPosition handler.
+
+ 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 = newState.x;
+ uiData.y = newState.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);
+ });
+
+ _defineProperty(_assertThisInitialized(_this), "onDragStop", function (e, coreData) {
+ if (!_this.state.dragging) return false; // Short-circuit if user's callback killed it.
+
+ var shouldContinue = _this.props.onStop(e, (0, _positionFns.createDraggableData)(_assertThisInitialized(_this), coreData));
+
+ if (shouldContinue === false) return false;
+ (0, _log.default)('Draggable: onDragStop: %j', coreData);
+ var newState
+ /*: $Shape<DraggableState>*/
+ = {
+ 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,
+ x = _this$props$position.x,
+ y = _this$props$position.y;
+ newState.x = x;
+ newState.y = y;
+ }
+
+ _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,
+ prevPropsPosition: _objectSpread({}, props.position),
+ // Used for compensating for out-of-bounds drags
+ slackX: 0,
+ slackY: 0,
+ // Can only determine if SVG after mounting
+ isElementSVG: false
+ };
+
+ if (props.position && !(props.onDrag || props.onStop)) {
+ // eslint-disable-next-line no-console
+ console.warn('A `position` was applied to this <Draggable>, 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.');
+ }
+
+ return _this;
+ }
+
+ _createClass(Draggable, [{
+ key: "componentDidMount",
+ value: function componentDidMount() {
+ // Check to see if the element passed is an instanceof SVGElement
+ if (typeof window.SVGElement !== 'undefined' && this.findDOMNode() instanceof window.SVGElement) {
+ this.setState({
+ isElementSVG: true
+ });
+ }
+ }
+ }, {
+ key: "componentWillUnmount",
+ value: function componentWillUnmount() {
+ this.setState({
+ dragging: false
+ }); // prevents invariant if unmounted while dragging
+ } // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
+ // the underlying DOM node ourselves. See the README for more information.
+
+ }, {
+ key: "findDOMNode",
+ value: function findDOMNode()
+ /*: ?HTMLElement*/
+ {
+ var _this$props$nodeRef$c, _this$props, _this$props$nodeRef;
+
+ return (_this$props$nodeRef$c = (_this$props = this.props) === null || _this$props === void 0 ? void 0 : (_this$props$nodeRef = _this$props.nodeRef) === null || _this$props$nodeRef === void 0 ? void 0 : _this$props$nodeRef.current) !== null && _this$props$nodeRef$c !== void 0 ? _this$props$nodeRef$c : _reactDom.default.findDOMNode(this);
+ }
+ }, {
+ key: "render",
+ value: function render()
+ /*: ReactElement<any>*/
+ {
+ var _clsx;
+
+ var _this$props2 = this.props,
+ axis = _this$props2.axis,
+ bounds = _this$props2.bounds,
+ children = _this$props2.children,
+ defaultPosition = _this$props2.defaultPosition,
+ defaultClassName = _this$props2.defaultClassName,
+ defaultClassNameDragging = _this$props2.defaultClassNameDragging,
+ defaultClassNameDragged = _this$props2.defaultClassNameDragged,
+ position = _this$props2.position,
+ positionOffset = _this$props2.positionOffset,
+ scale = _this$props2.scale,
+ draggableCoreProps = _objectWithoutProperties(_this$props2, _excluded);
+
+ var style = {};
+ var svgTransform = null; // If this is controlled, we don't want to move it - unless it's dragging.
+
+ var controlled = Boolean(position);
+ var draggable = !controlled || this.state.dragging;
+ var validPosition = position || defaultPosition;
+ var transformOpts = {
+ // Set left if horizontal drag is enabled
+ x: (0, _positionFns.canDragX)(this) && draggable ? this.state.x : validPosition.x,
+ // Set top if vertical drag is enabled
+ y: (0, _positionFns.canDragY)(this) && draggable ? this.state.y : validPosition.y
+ }; // If this element was SVG, we use the `transform` attribute.
+
+ if (this.state.isElementSVG) {
+ svgTransform = (0, _domFns.createSVGTransform)(transformOpts, positionOffset);
+ } 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 <span> so <Draggable>
+ // has a clean slate.
+ style = (0, _domFns.createCSSTransform)(transformOpts, positionOffset);
+ } // Mark with class while dragging
+
+
+ var className = (0, _clsx2.default)(children.props.className || '', defaultClassName, (_clsx = {}, _defineProperty(_clsx, defaultClassNameDragging, this.state.dragging), _defineProperty(_clsx, defaultClassNameDragged, this.state.dragged), _clsx)); // Reuse the child provided
+ // This makes it flexible to use whatever element is wanted (div, ul, etc)
+
+ return /*#__PURE__*/React.createElement(_DraggableCore.default, _extends({}, draggableCoreProps, {
+ onStart: this.onDragStart,
+ onDrag: this.onDrag,
+ onStop: this.onDragStop
+ }), /*#__PURE__*/React.cloneElement(React.Children.only(children), {
+ className: className,
+ style: _objectSpread(_objectSpread({}, children.props.style), style),
+ transform: svgTransform
+ }));
+ }
+ }], [{
+ key: "getDerivedStateFromProps",
+ value: // React 16.3+
+ // Arity (props, state)
+ function getDerivedStateFromProps(_ref, _ref2)
+ /*: ?$Shape<DraggableState>*/
+ {
+ var position = _ref.position;
+ var prevPropsPosition = _ref2.prevPropsPosition;
+
+ // Set x/y if a new position is provided in props that is different than the previous.
+ if (position && (!prevPropsPosition || position.x !== prevPropsPosition.x || position.y !== prevPropsPosition.y)) {
+ (0, _log.default)('Draggable: getDerivedStateFromProps %j', {
+ position: position,
+ prevPropsPosition: prevPropsPosition
+ });
+ return {
+ x: position.x,
+ y: position.y,
+ prevPropsPosition: _objectSpread({}, position)
+ };
+ }
+
+ return null;
+ }
+ }]);
+
+ return Draggable;
+}(React.Component);
+
+exports.default = Draggable;
+
+_defineProperty(Draggable, "displayName", 'Draggable');
+
+_defineProperty(Draggable, "propTypes", _objectSpread(_objectSpread({}, _DraggableCore.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: _propTypes.default.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 (
+ * <Draggable bounds={{right: 300, bottom: 300}}>
+ * <div>Content</div>
+ * </Draggable>
+ * );
+ * }
+ * });
+ * ```
+ */
+ bounds: _propTypes.default.oneOfType([_propTypes.default.shape({
+ left: _propTypes.default.number,
+ right: _propTypes.default.number,
+ top: _propTypes.default.number,
+ bottom: _propTypes.default.number
+ }), _propTypes.default.string, _propTypes.default.oneOf([false])]),
+ defaultClassName: _propTypes.default.string,
+ defaultClassNameDragging: _propTypes.default.string,
+ defaultClassNameDragged: _propTypes.default.string,
+
+ /**
+ * `defaultPosition` specifies the x and y that the dragged item should start at
+ *
+ * Example:
+ *
+ * ```jsx
+ * let App = React.createClass({
+ * render: function () {
+ * return (
+ * <Draggable defaultPosition={{x: 25, y: 25}}>
+ * <div>I start with transformX: 25px and transformY: 25px;</div>
+ * </Draggable>
+ * );
+ * }
+ * });
+ * ```
+ */
+ defaultPosition: _propTypes.default.shape({
+ x: _propTypes.default.number,
+ y: _propTypes.default.number
+ }),
+ positionOffset: _propTypes.default.shape({
+ x: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
+ y: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
+ }),
+
+ /**
+ * `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 (
+ * <Draggable position={{x: 25, y: 25}}>
+ * <div>I start with transformX: 25px and transformY: 25px;</div>
+ * </Draggable>
+ * );
+ * }
+ * });
+ * ```
+ */
+ position: _propTypes.default.shape({
+ x: _propTypes.default.number,
+ y: _propTypes.default.number
+ }),
+
+ /**
+ * These properties should be defined on the child, not here.
+ */
+ className: _shims.dontSetMe,
+ style: _shims.dontSetMe,
+ transform: _shims.dontSetMe
+}));
+
+_defineProperty(Draggable, "defaultProps", _objectSpread(_objectSpread({}, _DraggableCore.default.defaultProps), {}, {
+ axis: 'both',
+ bounds: false,
+ defaultClassName: 'react-draggable',
+ defaultClassNameDragging: 'react-draggable-dragging',
+ defaultClassNameDragged: 'react-draggable-dragged',
+ defaultPosition: {
+ x: 0,
+ y: 0
+ },
+ scale: 1
+}));
\ No newline at end of file
diff --git a/build/cjs/DraggableCore.js b/build/cjs/DraggableCore.js
new file mode 100644
index 0000000..07b05f1
--- /dev/null
+++ b/build/cjs/DraggableCore.js
@@ -0,0 +1,569 @@
+"use strict";
+
+function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var React = _interopRequireWildcard(require("react"));
+
+var _propTypes = _interopRequireDefault(require("prop-types"));
+
+var _reactDom = _interopRequireDefault(require("react-dom"));
+
+var _domFns = require("./utils/domFns");
+
+var _positionFns = require("./utils/positionFns");
+
+var _shims = require("./utils/shims");
+
+var _log = _interopRequireDefault(require("./utils/log"));
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
+
+function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
+
+function _nonIterableRest() { 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 _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
+
+function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
+
+function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
+
+function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
+
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
+
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
+
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
+
+function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
+
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
+
+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; }
+
+// Simple abstraction for dragging events names.
+var eventsFor = {
+ touch: {
+ start: 'touchstart',
+ move: 'touchmove',
+ stop: 'touchend'
+ },
+ mouse: {
+ start: 'mousedown',
+ move: 'mousemove',
+ stop: 'mouseup'
+ }
+}; // Default to mouse events.
+
+var dragEventFor = eventsFor.mouse;
+/*:: type DraggableCoreState = {
+ dragging: boolean,
+ lastX: number,
+ lastY: number,
+ touchIdentifier: ?number
+};*/
+
+/*:: export type DraggableData = {
+ node: HTMLElement,
+ x: number, y: number,
+ deltaX: number, deltaY: number,
+ lastX: number, lastY: number,
+};*/
+
+/*:: export type DraggableEventHandler = (e: MouseEvent, data: DraggableData) => void | false;*/
+
+/*:: export type ControlPosition = {x: number, y: number};*/
+
+/*:: export type PositionOffsetControlPosition = {x: number|string, y: number|string};*/
+
+/*:: export type DraggableCoreDefaultProps = {
+ allowAnyClick: boolean,
+ disabled: boolean,
+ enableUserSelectHack: boolean,
+ onStart: DraggableEventHandler,
+ onDrag: DraggableEventHandler,
+ onStop: DraggableEventHandler,
+ onMouseDown: (e: MouseEvent) => void,
+ scale: number,
+};*/
+
+/*:: export type DraggableCoreProps = {
+ ...DraggableCoreDefaultProps,
+ cancel: string,
+ children: ReactElement<any>,
+ offsetParent: HTMLElement,
+ grid: [number, number],
+ handle: string,
+ nodeRef?: ?React.ElementRef<any>,
+};*/
+
+//
+// Define <DraggableCore>.
+//
+// <DraggableCore> is for advanced usage of <Draggable>. It maintains minimal internal state so it can
+// work well with libraries that require more control over the element.
+//
+var DraggableCore = /*#__PURE__*/function (_React$Component) {
+ _inherits(DraggableCore, _React$Component);
+
+ var _super = _createSuper(DraggableCore);
+
+ function DraggableCore() {
+ var _this;
+
+ _classCallCheck(this, DraggableCore);
+
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
+ _this = _super.call.apply(_super, [this].concat(args));
+
+ _defineProperty(_assertThisInitialized(_this), "state", {
+ dragging: false,
+ // Used while dragging to determine deltas.
+ lastX: NaN,
+ lastY: NaN,
+ touchIdentifier: null
+ });
+
+ _defineProperty(_assertThisInitialized(_this), "mounted", false);
+
+ _defineProperty(_assertThisInitialized(_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 thisNode = _this.findDOMNode();
+
+ if (!thisNode || !thisNode.ownerDocument || !thisNode.ownerDocument.body) {
+ throw new Error('<DraggableCore> not mounted on DragStart!');
+ }
+
+ var ownerDocument = thisNode.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, thisNode) || _this.props.cancel && (0, _domFns.matchesSelectorAndParentsTo)(e.target, _this.props.cancel, thisNode)) {
+ return;
+ } // Prevent scrolling on mobile devices, like ipad/iphone.
+ // Important that this is after handle/cancel.
+
+
+ if (e.type === 'touchstart') e.preventDefault(); // 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, _assertThisInitialized(_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)(_assertThisInitialized(_this), x, y);
+ (0, _log.default)('DraggableCore: handleDragStart: %j', coreEvent); // Call event handler. If it returns explicit false, cancel.
+
+ (0, _log.default)('calling', _this.props.onStart);
+
+ var shouldUpdate = _this.props.onStart(e, coreEvent);
+
+ if (shouldUpdate === false || _this.mounted === 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); // 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);
+ });
+
+ _defineProperty(_assertThisInitialized(_this), "handleDrag", function (e) {
+ // Get the current drag point from the event. This is used as the offset.
+ var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _assertThisInitialized(_this));
+ if (position == null) return;
+ var x = position.x,
+ y = position.y; // Snap to grid if prop has been provided
+
+ 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)(_assertThisInitialized(_this), x, y);
+ (0, _log.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 || _this.mounted === 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
+ });
+ });
+
+ _defineProperty(_assertThisInitialized(_this), "handleDragStop", function (e) {
+ if (!_this.state.dragging) return;
+ var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _assertThisInitialized(_this));
+ if (position == null) return;
+ var x = position.x,
+ y = position.y; // Snap to grid if prop has been provided
+
+ if (Array.isArray(_this.props.grid)) {
+ var deltaX = x - _this.state.lastX || 0;
+ var deltaY = y - _this.state.lastY || 0;
+
+ var _snapToGrid3 = (0, _positionFns.snapToGrid)(_this.props.grid, deltaX, deltaY);
+
+ var _snapToGrid4 = _slicedToArray(_snapToGrid3, 2);
+
+ deltaX = _snapToGrid4[0];
+ deltaY = _snapToGrid4[1];
+ x = _this.state.lastX + deltaX, y = _this.state.lastY + deltaY;
+ }
+
+ var coreEvent = (0, _positionFns.createCoreData)(_assertThisInitialized(_this), x, y); // Call event handler
+
+ var shouldContinue = _this.props.onStop(e, coreEvent);
+
+ if (shouldContinue === false || _this.mounted === false) return false;
+
+ var thisNode = _this.findDOMNode();
+
+ if (thisNode) {
+ // Remove user-select hack
+ if (_this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(thisNode.ownerDocument);
+ }
+
+ (0, _log.default)('DraggableCore: handleDragStop: %j', coreEvent); // Reset the el.
+
+ _this.setState({
+ dragging: false,
+ lastX: NaN,
+ lastY: NaN
+ });
+
+ if (thisNode) {
+ // Remove event handlers
+ (0, _log.default)('DraggableCore: Removing handlers');
+ (0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.move, _this.handleDrag);
+ (0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.stop, _this.handleDragStop);
+ }
+ });
+
+ _defineProperty(_assertThisInitialized(_this), "onMouseDown", function (e) {
+ dragEventFor = eventsFor.mouse; // on touchscreen laptops we could switch back to mouse
+
+ return _this.handleDragStart(e);
+ });
+
+ _defineProperty(_assertThisInitialized(_this), "onMouseUp", function (e) {
+ dragEventFor = eventsFor.mouse;
+ return _this.handleDragStop(e);
+ });
+
+ _defineProperty(_assertThisInitialized(_this), "onTouchStart", function (e) {
+ // We're on a touch device now, so change the event handlers
+ dragEventFor = eventsFor.touch;
+ return _this.handleDragStart(e);
+ });
+
+ _defineProperty(_assertThisInitialized(_this), "onTouchEnd", function (e) {
+ // We're on a touch device now, so change the event handlers
+ dragEventFor = eventsFor.touch;
+ return _this.handleDragStop(e);
+ });
+
+ return _this;
+ }
+
+ _createClass(DraggableCore, [{
+ key: "componentDidMount",
+ value: function componentDidMount() {
+ this.mounted = true; // Touch handlers must be added with {passive: false} to be cancelable.
+ // https://developers.google.com/web/updates/2017/01/scrolling-intervention
+
+ var thisNode = this.findDOMNode();
+
+ if (thisNode) {
+ (0, _domFns.addEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, {
+ passive: false
+ });
+ }
+ }
+ }, {
+ key: "componentWillUnmount",
+ value: function componentWillUnmount() {
+ this.mounted = false; // 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 thisNode = this.findDOMNode();
+
+ if (thisNode) {
+ var ownerDocument = thisNode.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);
+ (0, _domFns.removeEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, {
+ passive: false
+ });
+ if (this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(ownerDocument);
+ }
+ } // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
+ // the underlying DOM node ourselves. See the README for more information.
+
+ }, {
+ key: "findDOMNode",
+ value: function findDOMNode()
+ /*: ?HTMLElement*/
+ {
+ var _this$props, _this$props2, _this$props2$nodeRef;
+
+ return (_this$props = this.props) !== null && _this$props !== void 0 && _this$props.nodeRef ? (_this$props2 = this.props) === null || _this$props2 === void 0 ? void 0 : (_this$props2$nodeRef = _this$props2.nodeRef) === null || _this$props2$nodeRef === void 0 ? void 0 : _this$props2$nodeRef.current : _reactDom.default.findDOMNode(this);
+ }
+ }, {
+ key: "render",
+ value: function render()
+ /*: React.Element<any>*/
+ {
+ // Reuse the child provided
+ // This makes it flexible to use whatever element is wanted (div, ul, etc)
+ return /*#__PURE__*/React.cloneElement(React.Children.only(this.props.children), {
+ // 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,
+ onMouseUp: this.onMouseUp,
+ // onTouchStart is added on `componentDidMount` so they can be added with
+ // {passive: false}, which allows it to cancel. See
+ // https://developers.google.com/web/updates/2017/01/scrolling-intervention
+ onTouchEnd: this.onTouchEnd
+ });
+ }
+ }]);
+
+ return DraggableCore;
+}(React.Component);
+
+exports.default = DraggableCore;
+
+_defineProperty(DraggableCore, "displayName", 'DraggableCore');
+
+_defineProperty(DraggableCore, "propTypes", {
+ /**
+ * `allowAnyClick` allows dragging using any mouse button.
+ * By default, we only accept the left button.
+ *
+ * Defaults to `false`.
+ */
+ allowAnyClick: _propTypes.default.bool,
+
+ /**
+ * `disabled`, if true, stops the <Draggable> from dragging. All handlers,
+ * with the exception of `onMouseDown`, will not fire.
+ */
+ disabled: _propTypes.default.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: _propTypes.default.bool,
+
+ /**
+ * `offsetParent`, if set, uses the passed DOM node to compute drag offsets
+ * instead of using the parent node.
+ */
+ offsetParent: function offsetParent(props
+ /*: DraggableCoreProps*/
+ , propName
+ /*: $Keys<DraggableCoreProps>*/
+ ) {
+ if (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: _propTypes.default.arrayOf(_propTypes.default.number),
+
+ /**
+ * `handle` specifies a selector to be used as the handle that initiates drag.
+ *
+ * Example:
+ *
+ * ```jsx
+ * let App = React.createClass({
+ * render: function () {
+ * return (
+ * <Draggable handle=".handle">
+ * <div>
+ * <div className="handle">Click me to drag</div>
+ * <div>This is some other content</div>
+ * </div>
+ * </Draggable>
+ * );
+ * }
+ * });
+ * ```
+ */
+ handle: _propTypes.default.string,
+
+ /**
+ * `cancel` specifies a selector to be used to prevent drag initialization.
+ *
+ * Example:
+ *
+ * ```jsx
+ * let App = React.createClass({
+ * render: function () {
+ * return(
+ * <Draggable cancel=".cancel">
+ * <div>
+ * <div className="cancel">You can't drag from here</div>
+ * <div>Dragging here works fine</div>
+ * </div>
+ * </Draggable>
+ * );
+ * }
+ * });
+ * ```
+ */
+ cancel: _propTypes.default.string,
+
+ /* If running in React Strict mode, ReactDOM.findDOMNode() is deprecated.
+ * Unfortunately, in order for <Draggable> to work properly, we need raw access
+ * to the underlying DOM node. If you want to avoid the warning, pass a `nodeRef`
+ * as in this example:
+ *
+ * function MyComponent() {
+ * const nodeRef = React.useRef(null);
+ * return (
+ * <Draggable nodeRef={nodeRef}>
+ * <div ref={nodeRef}>Example Target</div>
+ * </Draggable>
+ * );
+ * }
+ *
+ * This can be used for arbitrarily nested components, so long as the ref ends up
+ * pointing to the actual child DOM node and not a custom component.
+ */
+ nodeRef: _propTypes.default.object,
+
+ /**
+ * Called when dragging starts.
+ * If this function returns the boolean false, dragging will be canceled.
+ */
+ onStart: _propTypes.default.func,
+
+ /**
+ * Called while dragging.
+ * If this function returns the boolean false, dragging will be canceled.
+ */
+ onDrag: _propTypes.default.func,
+
+ /**
+ * Called when dragging stops.
+ * If this function returns the boolean false, the drag will remain active.
+ */
+ onStop: _propTypes.default.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: _propTypes.default.func,
+
+ /**
+ * `scale`, if set, applies scaling while dragging an element
+ */
+ scale: _propTypes.default.number,
+
+ /**
+ * These properties should be defined on the child, not here.
+ */
+ className: _shims.dontSetMe,
+ style: _shims.dontSetMe,
+ transform: _shims.dontSetMe
+});
+
+_defineProperty(DraggableCore, "defaultProps", {
+ allowAnyClick: false,
+ // by default only accept left click
+ disabled: false,
+ enableUserSelectHack: true,
+ onStart: function onStart() {},
+ onDrag: function onDrag() {},
+ onStop: function onStop() {},
+ onMouseDown: function onMouseDown() {},
+ scale: 1
+});
\ No newline at end of file
diff --git a/build/cjs/cjs.js b/build/cjs/cjs.js
new file mode 100644
index 0000000..35f194d
--- /dev/null
+++ b/build/cjs/cjs.js
@@ -0,0 +1,12 @@
+"use strict";
+
+var _require = require('./Draggable'),
+ Draggable = _require.default,
+ DraggableCore = _require.DraggableCore; // Previous versions of this lib exported <Draggable> as the root export. As to no-// them, or TypeScript, we export *both* as the root and as 'default'.
+// See https://github.com/mzabriskie/react-draggable/pull/254
+// and https://github.com/mzabriskie/react-draggable/issues/266
+
+
+module.exports = Draggable;
+module.exports.default = Draggable;
+module.exports.DraggableCore = DraggableCore;
\ No newline at end of file
diff --git a/build/cjs/utils/domFns.js b/build/cjs/utils/domFns.js
new file mode 100644
index 0000000..ad2fa73
--- /dev/null
+++ b/build/cjs/utils/domFns.js
@@ -0,0 +1,355 @@
+"use strict";
+
+function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.addClassName = addClassName;
+exports.addEvent = addEvent;
+exports.addUserSelectStyles = addUserSelectStyles;
+exports.createCSSTransform = createCSSTransform;
+exports.createSVGTransform = createSVGTransform;
+exports.getTouch = getTouch;
+exports.getTouchIdentifier = getTouchIdentifier;
+exports.getTranslation = getTranslation;
+exports.innerHeight = innerHeight;
+exports.innerWidth = innerWidth;
+exports.matchesSelector = matchesSelector;
+exports.matchesSelectorAndParentsTo = matchesSelectorAndParentsTo;
+exports.offsetXYFromParent = offsetXYFromParent;
+exports.outerHeight = outerHeight;
+exports.outerWidth = outerWidth;
+exports.removeClassName = removeClassName;
+exports.removeEvent = removeEvent;
+exports.removeUserSelectStyles = removeUserSelectStyles;
+
+var _shims = require("./shims");
+
+var _getPrefix = _interopRequireWildcard(require("./getPrefix"));
+
+function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
+
+function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
+
+function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
+
+function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
+
+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; }
+
+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]);
+ });
+ } // Might not be found entirely (not an Element?) - in that case, bail
+ // $FlowIgnore: Doesn't think elements are indexable
+
+
+ if (!(0, _shims.isFunction)(el[matchesSelectorFunc])) return false; // $FlowIgnore: Doesn't think elements are indexable
+
+ return el[matchesSelectorFunc](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*/
+, inputOptions
+/*: Object*/
+)
+/*: void*/
+{
+ if (!el) return;
+
+ var options = _objectSpread({
+ capture: true
+ }, inputOptions); // $FlowIgnore[method-unbinding]
+
+
+ if (el.addEventListener) {
+ el.addEventListener(event, handler, options);
+ } else if (el.attachEvent) {
+ el.attachEvent('on' + event, handler);
+ } else {
+ // $FlowIgnore: Doesn't think elements are indexable
+ el['on' + event] = handler;
+ }
+}
+
+function removeEvent(el
+/*: ?Node*/
+, event
+/*: string*/
+, handler
+/*: Function*/
+, inputOptions
+/*: Object*/
+)
+/*: void*/
+{
+ if (!el) return;
+
+ var options = _objectSpread({
+ capture: true
+ }, inputOptions); // $FlowIgnore[method-unbinding]
+
+
+ if (el.removeEventListener) {
+ el.removeEventListener(event, handler, options);
+ } else if (el.detachEvent) {
+ el.detachEvent('on' + event, handler);
+ } 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;
+}
+/*:: interface EventWithOffset {
+ clientX: number, clientY: number
+}*/
+
+
+// Get from offsetParent
+function offsetXYFromParent(evt
+/*: EventWithOffset*/
+, offsetParent
+/*: HTMLElement*/
+, scale
+/*: number*/
+)
+/*: ControlPosition*/
+{
+ var isBody = offsetParent === offsetParent.ownerDocument.body;
+ var offsetParentRect = isBody ? {
+ left: 0,
+ top: 0
+ } : offsetParent.getBoundingClientRect();
+ var x = (evt.clientX + offsetParent.scrollLeft - offsetParentRect.left) / scale;
+ var y = (evt.clientY + offsetParent.scrollTop - offsetParentRect.top) / scale;
+ return {
+ x: x,
+ y: y
+ };
+}
+
+function createCSSTransform(controlPos
+/*: ControlPosition*/
+, positionOffset
+/*: PositionOffsetControlPosition*/
+)
+/*: Object*/
+{
+ var translation = getTranslation(controlPos, positionOffset, 'px');
+ return _defineProperty({}, (0, _getPrefix.browserPrefixToKey)('transform', _getPrefix.default), translation);
+}
+
+function createSVGTransform(controlPos
+/*: ControlPosition*/
+, positionOffset
+/*: PositionOffsetControlPosition*/
+)
+/*: string*/
+{
+ var translation = getTranslation(controlPos, positionOffset, '');
+ return translation;
+}
+
+function getTranslation(_ref2, positionOffset
+/*: PositionOffsetControlPosition*/
+, unitSuffix
+/*: string*/
+)
+/*: string*/
+{
+ var x = _ref2.x,
+ y = _ref2.y;
+ var translation = "translate(".concat(x).concat(unitSuffix, ",").concat(y).concat(unitSuffix, ")");
+
+ if (positionOffset) {
+ var defaultX = "".concat(typeof positionOffset.x === 'string' ? positionOffset.x : positionOffset.x + unitSuffix);
+ var defaultY = "".concat(typeof positionOffset.y === 'string' ? positionOffset.y : positionOffset.y + unitSuffix);
+ translation = "translate(".concat(defaultX, ", ").concat(defaultY, ")") + translation;
+ }
+
+ return translation;
+}
+
+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.
+// Note we're passing `document` b/c we could be iframed
+
+
+function addUserSelectStyles(doc
+/*: ?Document*/
+) {
+ if (!doc) return;
+ var styleEl = doc.getElementById('react-draggable-style-el');
+
+ if (!styleEl) {
+ styleEl = doc.createElement('style');
+ styleEl.type = 'text/css';
+ styleEl.id = 'react-draggable-style-el';
+ styleEl.textContent = '.react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n';
+ styleEl.textContent += '.react-draggable-transparent-selection *::selection {all: inherit;}\n';
+ doc.getElementsByTagName('head')[0].appendChild(styleEl);
+ }
+
+ if (doc.body) addClassName(doc.body, 'react-draggable-transparent-selection');
+}
+
+function removeUserSelectStyles(doc
+/*: ?Document*/
+) {
+ if (!doc) return;
+
+ try {
+ if (doc.body) removeClassName(doc.body, 'react-draggable-transparent-selection'); // $FlowIgnore: IE
+
+ if (doc.selection) {
+ // $FlowIgnore: IE
+ doc.selection.empty();
+ } else {
+ // Remove selection caused by scroll, unless it's a focused input
+ // (we use doc.defaultView in case we're in an iframe)
+ var selection = (doc.defaultView || window).getSelection();
+
+ if (selection && selection.type !== 'Caret') {
+ selection.removeAllRanges();
+ }
+ }
+ } catch (e) {// probably IE
+ }
+}
+
+function addClassName(el
+/*: HTMLElement*/
+, className
+/*: string*/
+) {
+ if (el.classList) {
+ el.classList.add(className);
+ } else {
+ if (!el.className.match(new RegExp("(?:^|\\s)".concat(className, "(?!\\S)")))) {
+ el.className += " ".concat(className);
+ }
+ }
+}
+
+function removeClassName(el
+/*: HTMLElement*/
+, className
+/*: string*/
+) {
+ if (el.classList) {
+ el.classList.remove(className);
+ } else {
+ el.className = el.className.replace(new RegExp("(?:^|\\s)".concat(className, "(?!\\S)"), 'g'), '');
+ }
+}
\ No newline at end of file
diff --git a/build/cjs/utils/getPrefix.js b/build/cjs/utils/getPrefix.js
new file mode 100644
index 0000000..077bcbb
--- /dev/null
+++ b/build/cjs/utils/getPrefix.js
@@ -0,0 +1,85 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.browserPrefixToKey = browserPrefixToKey;
+exports.browserPrefixToStyle = browserPrefixToStyle;
+exports.default = void 0;
+exports.getPrefix = getPrefix;
+var prefixes = ['Moz', 'Webkit', 'O', 'ms'];
+
+function getPrefix()
+/*: string*/
+{
+ var _window$document, _window$document$docu;
+
+ var prop
+ /*: string*/
+ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform';
+ // Ensure we're running in an environment where there is actually a global
+ // `window` obj
+ if (typeof window === 'undefined') return ''; // If we're in a pseudo-browser server-side environment, this access
+ // path may not exist, so bail out if it doesn't.
+
+ var style = (_window$document = window.document) === null || _window$document === void 0 ? void 0 : (_window$document$docu = _window$document.documentElement) === null || _window$document$docu === void 0 ? void 0 : _window$document$docu.style;
+ if (!style) return '';
+ 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 ? "".concat(prefix).concat(kebabToTitleCase(prop)) : prop;
+}
+
+function browserPrefixToStyle(prop
+/*: string*/
+, prefix
+/*: string*/
+)
+/*: string*/
+{
+ return prefix ? "-".concat(prefix.toLowerCase(), "-").concat(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`
+
+
+var _default = (getPrefix()
+/*: string*/
+);
+
+exports.default = _default;
\ No newline at end of file
diff --git a/build/cjs/utils/log.js b/build/cjs/utils/log.js
new file mode 100644
index 0000000..6ffd5fe
--- /dev/null
+++ b/build/cjs/utils/log.js
@@ -0,0 +1,13 @@
+"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);
+}
\ No newline at end of file
diff --git a/build/cjs/utils/positionFns.js b/build/cjs/utils/positionFns.js
new file mode 100644
index 0000000..5599362
--- /dev/null
+++ b/build/cjs/utils/positionFns.js
@@ -0,0 +1,208 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.canDragX = canDragX;
+exports.canDragY = canDragY;
+exports.createCoreData = createCoreData;
+exports.createDraggableData = createDraggableData;
+exports.getBoundPosition = getBoundPosition;
+exports.getControlPosition = getControlPosition;
+exports.snapToGrid = snapToGrid;
+
+var _shims = require("./shims");
+
+var _domFns = require("./domFns");
+
+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 = findDOMNode(draggable);
+
+ if (typeof bounds === 'string') {
+ var ownerDocument = node.ownerDocument;
+ var ownerWindow = ownerDocument.defaultView;
+ var boundNode;
+
+ if (bounds === 'parent') {
+ boundNode = node.parentNode;
+ } else {
+ boundNode = ownerDocument.querySelector(bounds);
+ }
+
+ if (!(boundNode instanceof ownerWindow.HTMLElement)) {
+ throw new Error('Bounds selector "' + bounds + '" could not find an element.');
+ }
+
+ var boundNodeEl
+ /*: HTMLElement*/
+ = boundNode; // for Flow, can't seem to refine correctly
+
+ var nodeStyle = ownerWindow.getComputedStyle(node);
+ var boundNodeStyle = ownerWindow.getComputedStyle(boundNodeEl); // 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)(boundNodeEl) - (0, _domFns.outerWidth)(node) - node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingRight) - (0, _shims.int)(nodeStyle.marginRight),
+ bottom: (0, _domFns.innerHeight)(boundNodeEl) - (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 = 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, draggableCore.props.scale);
+} // Create an data object exposed by <DraggableCore>'s events
+
+
+function createCoreData(draggable
+/*: DraggableCore*/
+, x
+/*: number*/
+, y
+/*: number*/
+)
+/*: DraggableData*/
+{
+ var state = draggable.state;
+ var isStart = !(0, _shims.isNum)(state.lastX);
+ var node = findDOMNode(draggable);
+
+ if (isStart) {
+ // If this is our first move, use the x and y as last coords.
+ return {
+ node: node,
+ deltaX: 0,
+ deltaY: 0,
+ lastX: x,
+ lastY: y,
+ x: x,
+ y: y
+ };
+ } else {
+ // Otherwise calculate proper values.
+ return {
+ node: node,
+ deltaX: x - state.lastX,
+ deltaY: y - state.lastY,
+ lastX: state.lastX,
+ lastY: state.lastY,
+ x: x,
+ y: y
+ };
+ }
+} // Create an data exposed by <Draggable>'s events
+
+
+function createDraggableData(draggable
+/*: Draggable*/
+, coreData
+/*: DraggableData*/
+)
+/*: DraggableData*/
+{
+ var scale = draggable.props.scale;
+ return {
+ node: coreData.node,
+ x: draggable.state.x + coreData.deltaX / scale,
+ y: draggable.state.y + coreData.deltaY / scale,
+ deltaX: coreData.deltaX / scale,
+ deltaY: coreData.deltaY / scale,
+ 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
+ };
+}
+
+function findDOMNode(draggable
+/*: Draggable | DraggableCore*/
+)
+/*: HTMLElement*/
+{
+ var node = draggable.findDOMNode();
+
+ if (!node) {
+ throw new Error('<DraggableCore>: Unmounted during event!');
+ } // $FlowIgnore we can't assert on HTMLElement due to tests... FIXME
+
+
+ return node;
+}
\ No newline at end of file
diff --git a/build/cjs/utils/shims.js b/build/cjs/utils/shims.js
new file mode 100644
index 0000000..b9d7c12
--- /dev/null
+++ b/build/cjs/utils/shims.js
@@ -0,0 +1,62 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.dontSetMe = dontSetMe;
+exports.findInArray = findInArray;
+exports.int = int;
+exports.isFunction = isFunction;
+exports.isNum = isNum;
+
+// @credits https://gist.github.com/rogozhnikoff/a43cfed27c41e4e68cdc
+function findInArray(array
+/*: Array<any> | 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 %checks*/
+{
+ // $FlowIgnore[method-unbinding]
+ return typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]';
+}
+
+function isNum(num
+/*: any*/
+)
+/*: boolean %checks*/
+{
+ return typeof num === 'number' && !isNaN(num);
+}
+
+function int(a
+/*: string*/
+)
+/*: number*/
+{
+ return parseInt(a, 10);
+}
+
+function dontSetMe(props
+/*: Object*/
+, propName
+/*: string*/
+, componentName
+/*: string*/
+)
+/*: ?Error*/
+{
+ if (props[propName]) {
+ return new Error("Invalid prop ".concat(propName, " passed to ").concat(componentName, " - do not set this, set it on the child."));
+ }
+}
\ No newline at end of file
diff --git a/build/cjs/utils/types.js b/build/cjs/utils/types.js
new file mode 100644
index 0000000..b1831c1
--- /dev/null
+++ b/build/cjs/utils/types.js
@@ -0,0 +1,104 @@
+"use strict";
+
+function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.TouchEvent2 = exports.SVGElement = void 0;
+
+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 _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); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
+
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
+
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
+
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
+
+function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
+
+function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
+
+function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
+
+function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
+
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
+
+// eslint-disable-next-line no-use-before-define
+
+/*:: export type DraggableEventHandler = (e: MouseEvent, data: DraggableData) => void | false;*/
+
+/*:: export type DraggableData = {
+ node: HTMLElement,
+ x: number, y: number,
+ deltaX: number, deltaY: number,
+ lastX: number, lastY: number
+};*/
+
+/*:: export type Bounds = {
+ left?: number, top?: number, right?: number, bottom?: number
+};*/
+
+/*:: export type ControlPosition = {x: number, y: number};*/
+
+/*:: export type PositionOffsetControlPosition = {x: number|string, y: number|string};*/
+
+/*:: export type EventHandler<T> = (e: T) => void | false;*/
+// Missing in Flow
+var SVGElement = /*#__PURE__*/function (_HTMLElement) {
+ _inherits(SVGElement, _HTMLElement);
+
+ var _super = _createSuper(SVGElement);
+
+ function SVGElement() {
+ _classCallCheck(this, SVGElement);
+
+ return _super.apply(this, arguments);
+ }
+
+ return _createClass(SVGElement);
+}( /*#__PURE__*/_wrapNativeSuper(HTMLElement)); // Missing targetTouches
+
+
+exports.SVGElement = SVGElement;
+
+var TouchEvent2 = /*#__PURE__*/function (_TouchEvent) {
+ _inherits(TouchEvent2, _TouchEvent);
+
+ var _super2 = _createSuper(TouchEvent2);
+
+ function TouchEvent2() {
+ var _this;
+
+ _classCallCheck(this, TouchEvent2);
+
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
+ _this = _super2.call.apply(_super2, [this].concat(args));
+
+ _defineProperty(_assertThisInitialized(_this), "changedTouches", void 0);
+
+ _defineProperty(_assertThisInitialized(_this), "targetTouches", void 0);
+
+ return _this;
+ }
+
+ return _createClass(TouchEvent2);
+}( /*#__PURE__*/_wrapNativeSuper(TouchEvent));
+/*:: export type MouseTouchEvent = MouseEvent & TouchEvent2;*/
+
+
+exports.TouchEvent2 = TouchEvent2;
\ No newline at end of file
diff --git a/build/web/react-draggable.min.js b/build/web/react-draggable.min.js
new file mode 100644
index 0000000..ad7f76f
--- /dev/null
+++ b/build/web/react-draggable.min.js
@@ -0,0 +1,1945 @@
+(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"]);
+})(self, function(__WEBPACK_EXTERNAL_MODULE__359__, __WEBPACK_EXTERNAL_MODULE__318__) {
+return /******/ (function() { // webpackBootstrap
+/******/ var __webpack_modules__ = ({
+
+/***/ 404:
+/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+// ESM COMPAT FLAG
+__webpack_require__.r(__webpack_exports__);
+
+// EXPORTS
+__webpack_require__.d(__webpack_exports__, {
+ "DraggableCore": function() { return /* reexport */ DraggableCore; },
+ "default": function() { return /* binding */ Draggable; }
+});
+
+// EXTERNAL MODULE: external {"commonjs":"react","commonjs2":"react","amd":"react","root":"React"}
+var external_commonjs_react_commonjs2_react_amd_react_root_React_ = __webpack_require__(359);
+// EXTERNAL MODULE: ./node_modules/prop-types/index.js
+var prop_types = __webpack_require__(697);
+var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types);
+// EXTERNAL MODULE: external {"commonjs":"react-dom","commonjs2":"react-dom","amd":"react-dom","root":"ReactDOM"}
+var external_commonjs_react_dom_commonjs2_react_dom_amd_react_dom_root_ReactDOM_ = __webpack_require__(318);
+var external_commonjs_react_dom_commonjs2_react_dom_amd_react_dom_root_ReactDOM_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_react_dom_commonjs2_react_dom_amd_react_dom_root_ReactDOM_);
+;// CONCATENATED MODULE: ./node_modules/clsx/dist/clsx.m.js
+function toVal(mix) {
+ var k, y, str='';
+
+ if (typeof mix === 'string' || typeof mix === 'number') {
+ str += mix;
+ } else if (typeof mix === 'object') {
+ if (Array.isArray(mix)) {
+ for (k=0; k < mix.length; k++) {
+ if (mix[k]) {
+ if (y = toVal(mix[k])) {
+ str && (str += ' ');
+ str += y;
+ }
+ }
+ }
+ } else {
+ for (k in mix) {
+ if (mix[k]) {
+ str && (str += ' ');
+ str += k;
+ }
+ }
+ }
+ }
+
+ return str;
+}
+
+/* harmony default export */ function clsx_m() {
+ var i=0, tmp, x, str='';
+ while (i < arguments.length) {
+ if (tmp = arguments[i++]) {
+ if (x = toVal(tmp)) {
+ str && (str += ' ');
+ str += x
+ }
+ }
+ }
+ return str;
+}
+
+;// CONCATENATED MODULE: ./lib/utils/shims.js
+// @credits https://gist.github.com/rogozhnikoff/a43cfed27c41e4e68cdc
+function findInArray(array
+/*: Array<any> | 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 %checks*/
+{
+ // $FlowIgnore[method-unbinding]
+ return typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]';
+}
+function isNum(num
+/*: any*/
+)
+/*: boolean %checks*/
+{
+ return typeof num === 'number' && !isNaN(num);
+}
+function shims_int(a
+/*: string*/
+)
+/*: number*/
+{
+ return parseInt(a, 10);
+}
+function dontSetMe(props
+/*: Object*/
+, propName
+/*: string*/
+, componentName
+/*: string*/
+)
+/*: ?Error*/
+{
+ if (props[propName]) {
+ return new Error("Invalid prop ".concat(propName, " passed to ").concat(componentName, " - do not set this, set it on the child."));
+ }
+}
+;// CONCATENATED MODULE: ./lib/utils/getPrefix.js
+var prefixes = ['Moz', 'Webkit', 'O', 'ms'];
+function getPrefix()
+/*: string*/
+{
+ var _window$document, _window$document$docu;
+
+ var prop
+ /*: string*/
+ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform';
+ // Ensure we're running in an environment where there is actually a global
+ // `window` obj
+ if (typeof window === 'undefined') return ''; // If we're in a pseudo-browser server-side environment, this access
+ // path may not exist, so bail out if it doesn't.
+
+ var style = (_window$document = window.document) === null || _window$document === void 0 ? void 0 : (_window$document$docu = _window$document.documentElement) === null || _window$document$docu === void 0 ? void 0 : _window$document$docu.style;
+ if (!style) return '';
+ 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 ? "".concat(prefix).concat(kebabToTitleCase(prop)) : prop;
+}
+function browserPrefixToStyle(prop
+/*: string*/
+, prefix
+/*: string*/
+)
+/*: string*/
+{
+ return prefix ? "-".concat(prefix.toLowerCase(), "-").concat(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`
+
+
+/* harmony default export */ var utils_getPrefix = (getPrefix());
+;// CONCATENATED MODULE: ./lib/utils/domFns.js
+function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
+
+function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
+
+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, PositionOffsetControlPosition, MouseTouchEvent} from './types';*/
+
+var matchesSelectorFunc = '';
+function matchesSelector(el
+/*: Node*/
+, selector
+/*: string*/
+)
+/*: boolean*/
+{
+ if (!matchesSelectorFunc) {
+ matchesSelectorFunc = findInArray(['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector', 'oMatchesSelector'], function (method) {
+ // $FlowIgnore: Doesn't think elements are indexable
+ return isFunction(el[method]);
+ });
+ } // Might not be found entirely (not an Element?) - in that case, bail
+ // $FlowIgnore: Doesn't think elements are indexable
+
+
+ if (!isFunction(el[matchesSelectorFunc])) return false; // $FlowIgnore: Doesn't think elements are indexable
+
+ return el[matchesSelectorFunc](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*/
+, inputOptions
+/*: Object*/
+)
+/*: void*/
+{
+ if (!el) return;
+
+ var options = _objectSpread({
+ capture: true
+ }, inputOptions); // $FlowIgnore[method-unbinding]
+
+
+ if (el.addEventListener) {
+ el.addEventListener(event, handler, options);
+ } else if (el.attachEvent) {
+ el.attachEvent('on' + event, handler);
+ } else {
+ // $FlowIgnore: Doesn't think elements are indexable
+ el['on' + event] = handler;
+ }
+}
+function removeEvent(el
+/*: ?Node*/
+, event
+/*: string*/
+, handler
+/*: Function*/
+, inputOptions
+/*: Object*/
+)
+/*: void*/
+{
+ if (!el) return;
+
+ var options = _objectSpread({
+ capture: true
+ }, inputOptions); // $FlowIgnore[method-unbinding]
+
+
+ if (el.removeEventListener) {
+ el.removeEventListener(event, handler, options);
+ } else if (el.detachEvent) {
+ el.detachEvent('on' + event, handler);
+ } else {
+ // $FlowIgnore: Doesn't think elements are indexable
+ el['on' + event] = null;
+ }
+}
+function domFns_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 += shims_int(computedStyle.borderTopWidth);
+ height += shims_int(computedStyle.borderBottomWidth);
+ return height;
+}
+function domFns_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 += shims_int(computedStyle.borderLeftWidth);
+ width += shims_int(computedStyle.borderRightWidth);
+ return width;
+}
+function domFns_innerHeight(node
+/*: HTMLElement*/
+)
+/*: number*/
+{
+ var height = node.clientHeight;
+ var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
+ height -= shims_int(computedStyle.paddingTop);
+ height -= shims_int(computedStyle.paddingBottom);
+ return height;
+}
+function domFns_innerWidth(node
+/*: HTMLElement*/
+)
+/*: number*/
+{
+ var width = node.clientWidth;
+ var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
+ width -= shims_int(computedStyle.paddingLeft);
+ width -= shims_int(computedStyle.paddingRight);
+ return width;
+}
+/*:: interface EventWithOffset {
+ clientX: number, clientY: number
+}*/
+
+// Get from offsetParent
+function offsetXYFromParent(evt
+/*: EventWithOffset*/
+, offsetParent
+/*: HTMLElement*/
+, scale
+/*: number*/
+)
+/*: ControlPosition*/
+{
+ var isBody = offsetParent === offsetParent.ownerDocument.body;
+ var offsetParentRect = isBody ? {
+ left: 0,
+ top: 0
+ } : offsetParent.getBoundingClientRect();
+ var x = (evt.clientX + offsetParent.scrollLeft - offsetParentRect.left) / scale;
+ var y = (evt.clientY + offsetParent.scrollTop - offsetParentRect.top) / scale;
+ return {
+ x: x,
+ y: y
+ };
+}
+function createCSSTransform(controlPos
+/*: ControlPosition*/
+, positionOffset
+/*: PositionOffsetControlPosition*/
+)
+/*: Object*/
+{
+ var translation = getTranslation(controlPos, positionOffset, 'px');
+ return _defineProperty({}, browserPrefixToKey('transform', utils_getPrefix), translation);
+}
+function createSVGTransform(controlPos
+/*: ControlPosition*/
+, positionOffset
+/*: PositionOffsetControlPosition*/
+)
+/*: string*/
+{
+ var translation = getTranslation(controlPos, positionOffset, '');
+ return translation;
+}
+function getTranslation(_ref2, positionOffset
+/*: PositionOffsetControlPosition*/
+, unitSuffix
+/*: string*/
+)
+/*: string*/
+{
+ var x = _ref2.x,
+ y = _ref2.y;
+ var translation = "translate(".concat(x).concat(unitSuffix, ",").concat(y).concat(unitSuffix, ")");
+
+ if (positionOffset) {
+ var defaultX = "".concat(typeof positionOffset.x === 'string' ? positionOffset.x : positionOffset.x + unitSuffix);
+ var defaultY = "".concat(typeof positionOffset.y === 'string' ? positionOffset.y : positionOffset.y + unitSuffix);
+ translation = "translate(".concat(defaultX, ", ").concat(defaultY, ")") + translation;
+ }
+
+ return translation;
+}
+function getTouch(e
+/*: MouseTouchEvent*/
+, identifier
+/*: number*/
+)
+/*: ?{clientX: number, clientY: number}*/
+{
+ return e.targetTouches && findInArray(e.targetTouches, function (t) {
+ return identifier === t.identifier;
+ }) || e.changedTouches && 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.
+// Note we're passing `document` b/c we could be iframed
+
+function addUserSelectStyles(doc
+/*: ?Document*/
+) {
+ if (!doc) return;
+ var styleEl = doc.getElementById('react-draggable-style-el');
+
+ if (!styleEl) {
+ styleEl = doc.createElement('style');
+ styleEl.type = 'text/css';
+ styleEl.id = 'react-draggable-style-el';
+ styleEl.textContent = '.react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n';
+ styleEl.textContent += '.react-draggable-transparent-selection *::selection {all: inherit;}\n';
+ doc.getElementsByTagName('head')[0].appendChild(styleEl);
+ }
+
+ if (doc.body) addClassName(doc.body, 'react-draggable-transparent-selection');
+}
+function removeUserSelectStyles(doc
+/*: ?Document*/
+) {
+ if (!doc) return;
+
+ try {
+ if (doc.body) removeClassName(doc.body, 'react-draggable-transparent-selection'); // $FlowIgnore: IE
+
+ if (doc.selection) {
+ // $FlowIgnore: IE
+ doc.selection.empty();
+ } else {
+ // Remove selection caused by scroll, unless it's a focused input
+ // (we use doc.defaultView in case we're in an iframe)
+ var selection = (doc.defaultView || window).getSelection();
+
+ if (selection && selection.type !== 'Caret') {
+ selection.removeAllRanges();
+ }
+ }
+ } catch (e) {// probably IE
+ }
+}
+function addClassName(el
+/*: HTMLElement*/
+, className
+/*: string*/
+) {
+ if (el.classList) {
+ el.classList.add(className);
+ } else {
+ if (!el.className.match(new RegExp("(?:^|\\s)".concat(className, "(?!\\S)")))) {
+ el.className += " ".concat(className);
+ }
+ }
+}
+function removeClassName(el
+/*: HTMLElement*/
+, className
+/*: string*/
+) {
+ if (el.classList) {
+ el.classList.remove(className);
+ } else {
+ el.className = el.className.replace(new RegExp("(?:^|\\s)".concat(className, "(?!\\S)"), 'g'), '');
+ }
+}
+;// CONCATENATED MODULE: ./lib/utils/positionFns.js
+
+
+/*:: import type Draggable from '../Draggable';*/
+
+/*:: import type {Bounds, ControlPosition, DraggableData, MouseTouchEvent} 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 = findDOMNode(draggable);
+
+ if (typeof bounds === 'string') {
+ var ownerDocument = node.ownerDocument;
+ var ownerWindow = ownerDocument.defaultView;
+ var boundNode;
+
+ if (bounds === 'parent') {
+ boundNode = node.parentNode;
+ } else {
+ boundNode = ownerDocument.querySelector(bounds);
+ }
+
+ if (!(boundNode instanceof ownerWindow.HTMLElement)) {
+ throw new Error('Bounds selector "' + bounds + '" could not find an element.');
+ }
+
+ var boundNodeEl
+ /*: HTMLElement*/
+ = boundNode; // for Flow, can't seem to refine correctly
+
+ var nodeStyle = ownerWindow.getComputedStyle(node);
+ var boundNodeStyle = ownerWindow.getComputedStyle(boundNodeEl); // Compute bounds. This is a pain with padding and offsets but this gets it exactly right.
+
+ bounds = {
+ left: -node.offsetLeft + shims_int(boundNodeStyle.paddingLeft) + shims_int(nodeStyle.marginLeft),
+ top: -node.offsetTop + shims_int(boundNodeStyle.paddingTop) + shims_int(nodeStyle.marginTop),
+ right: domFns_innerWidth(boundNodeEl) - domFns_outerWidth(node) - node.offsetLeft + shims_int(boundNodeStyle.paddingRight) - shims_int(nodeStyle.marginRight),
+ bottom: domFns_innerHeight(boundNodeEl) - domFns_outerHeight(node) - node.offsetTop + shims_int(boundNodeStyle.paddingBottom) - shims_int(nodeStyle.marginBottom)
+ };
+ } // Keep x and y below right and bottom limits...
+
+
+ if (isNum(bounds.right)) x = Math.min(x, bounds.right);
+ if (isNum(bounds.bottom)) y = Math.min(y, bounds.bottom); // But above left and top limits.
+
+ if (isNum(bounds.left)) x = Math.max(x, bounds.left);
+ if (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' ? getTouch(e, touchIdentifier) : null;
+ if (typeof touchIdentifier === 'number' && !touchObj) return null; // not the right touch
+
+ var node = findDOMNode(draggableCore); // User can provide an offsetParent if desired.
+
+ var offsetParent = draggableCore.props.offsetParent || node.offsetParent || node.ownerDocument.body;
+ return offsetXYFromParent(touchObj || e, offsetParent, draggableCore.props.scale);
+} // Create an data object exposed by <DraggableCore>'s events
+
+function createCoreData(draggable
+/*: DraggableCore*/
+, x
+/*: number*/
+, y
+/*: number*/
+)
+/*: DraggableData*/
+{
+ var state = draggable.state;
+ var isStart = !isNum(state.lastX);
+ var node = findDOMNode(draggable);
+
+ if (isStart) {
+ // If this is our first move, use the x and y as last coords.
+ return {
+ node: node,
+ deltaX: 0,
+ deltaY: 0,
+ lastX: x,
+ lastY: y,
+ x: x,
+ y: y
+ };
+ } else {
+ // Otherwise calculate proper values.
+ return {
+ node: node,
+ deltaX: x - state.lastX,
+ deltaY: y - state.lastY,
+ lastX: state.lastX,
+ lastY: state.lastY,
+ x: x,
+ y: y
+ };
+ }
+} // Create an data exposed by <Draggable>'s events
+
+function createDraggableData(draggable
+/*: Draggable*/
+, coreData
+/*: DraggableData*/
+)
+/*: DraggableData*/
+{
+ var scale = draggable.props.scale;
+ return {
+ node: coreData.node,
+ x: draggable.state.x + coreData.deltaX / scale,
+ y: draggable.state.y + coreData.deltaY / scale,
+ deltaX: coreData.deltaX / scale,
+ deltaY: coreData.deltaY / scale,
+ 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
+ };
+}
+
+function findDOMNode(draggable
+/*: Draggable | DraggableCore*/
+)
+/*: HTMLElement*/
+{
+ var node = draggable.findDOMNode();
+
+ if (!node) {
+ throw new Error('<DraggableCore>: Unmounted during event!');
+ } // $FlowIgnore we can't assert on HTMLElement due to tests... FIXME
+
+
+ return node;
+}
+;// CONCATENATED MODULE: ./lib/utils/log.js
+/*eslint no-console:0*/
+function log() {
+ var _console;
+
+ if (false) {}
+}
+;// CONCATENATED MODULE: ./lib/DraggableCore.js
+function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
+
+function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
+
+function _nonIterableRest() { 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 _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
+
+function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
+
+function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
+
+function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
+
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
+
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
+
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
+
+function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
+
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
+
+function DraggableCore_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 {EventHandler, MouseTouchEvent} from './utils/types';*/
+
+/*:: import type {Element as ReactElement} from 'react';*/
+
+// Simple abstraction for dragging events names.
+var eventsFor = {
+ touch: {
+ start: 'touchstart',
+ move: 'touchmove',
+ stop: 'touchend'
+ },
+ mouse: {
+ start: 'mousedown',
+ move: 'mousemove',
+ stop: 'mouseup'
+ }
+}; // Default to mouse events.
+
+var dragEventFor = eventsFor.mouse;
+/*:: type DraggableCoreState = {
+ dragging: boolean,
+ lastX: number,
+ lastY: number,
+ touchIdentifier: ?number
+};*/
+
+/*:: export type DraggableData = {
+ node: HTMLElement,
+ x: number, y: number,
+ deltaX: number, deltaY: number,
+ lastX: number, lastY: number,
+};*/
+
+/*:: export type DraggableEventHandler = (e: MouseEvent, data: DraggableData) => void | false;*/
+
+/*:: export type ControlPosition = {x: number, y: number};*/
+
+/*:: export type PositionOffsetControlPosition = {x: number|string, y: number|string};*/
+
+/*:: export type DraggableCoreDefaultProps = {
+ allowAnyClick: boolean,
+ disabled: boolean,
+ enableUserSelectHack: boolean,
+ onStart: DraggableEventHandler,
+ onDrag: DraggableEventHandler,
+ onStop: DraggableEventHandler,
+ onMouseDown: (e: MouseEvent) => void,
+ scale: number,
+};*/
+
+/*:: export type DraggableCoreProps = {
+ ...DraggableCoreDefaultProps,
+ cancel: string,
+ children: ReactElement<any>,
+ offsetParent: HTMLElement,
+ grid: [number, number],
+ handle: string,
+ nodeRef?: ?React.ElementRef<any>,
+};*/
+
+//
+// Define <DraggableCore>.
+//
+// <DraggableCore> is for advanced usage of <Draggable>. It maintains minimal internal state so it can
+// work well with libraries that require more control over the element.
+//
+var DraggableCore = /*#__PURE__*/function (_React$Component) {
+ _inherits(DraggableCore, _React$Component);
+
+ var _super = _createSuper(DraggableCore);
+
+ function DraggableCore() {
+ var _this;
+
+ _classCallCheck(this, DraggableCore);
+
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
+ _this = _super.call.apply(_super, [this].concat(args));
+
+ DraggableCore_defineProperty(_assertThisInitialized(_this), "state", {
+ dragging: false,
+ // Used while dragging to determine deltas.
+ lastX: NaN,
+ lastY: NaN,
+ touchIdentifier: null
+ });
+
+ DraggableCore_defineProperty(_assertThisInitialized(_this), "mounted", false);
+
+ DraggableCore_defineProperty(_assertThisInitialized(_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 thisNode = _this.findDOMNode();
+
+ if (!thisNode || !thisNode.ownerDocument || !thisNode.ownerDocument.body) {
+ throw new Error('<DraggableCore> not mounted on DragStart!');
+ }
+
+ var ownerDocument = thisNode.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 && !matchesSelectorAndParentsTo(e.target, _this.props.handle, thisNode) || _this.props.cancel && matchesSelectorAndParentsTo(e.target, _this.props.cancel, thisNode)) {
+ return;
+ } // Prevent scrolling on mobile devices, like ipad/iphone.
+ // Important that this is after handle/cancel.
+
+
+ if (e.type === 'touchstart') e.preventDefault(); // 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 = getTouchIdentifier(e);
+
+ _this.setState({
+ touchIdentifier: touchIdentifier
+ }); // Get the current drag point from the event. This is used as the offset.
+
+
+ var position = getControlPosition(e, touchIdentifier, _assertThisInitialized(_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 = createCoreData(_assertThisInitialized(_this), x, y);
+ log('DraggableCore: handleDragStart: %j', coreEvent); // Call event handler. If it returns explicit false, cancel.
+
+ log('calling', _this.props.onStart);
+
+ var shouldUpdate = _this.props.onStart(e, coreEvent);
+
+ if (shouldUpdate === false || _this.mounted === 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) addUserSelectStyles(ownerDocument); // 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.
+
+
+ addEvent(ownerDocument, dragEventFor.move, _this.handleDrag);
+ addEvent(ownerDocument, dragEventFor.stop, _this.handleDragStop);
+ });
+
+ DraggableCore_defineProperty(_assertThisInitialized(_this), "handleDrag", function (e) {
+ // Get the current drag point from the event. This is used as the offset.
+ var position = getControlPosition(e, _this.state.touchIdentifier, _assertThisInitialized(_this));
+ if (position == null) return;
+ var x = position.x,
+ y = position.y; // Snap to grid if prop has been provided
+
+ if (Array.isArray(_this.props.grid)) {
+ var deltaX = x - _this.state.lastX,
+ deltaY = y - _this.state.lastY;
+
+ var _snapToGrid = 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 = createCoreData(_assertThisInitialized(_this), x, y);
+ log('DraggableCore: handleDrag: %j', coreEvent); // Call event handler. If it returns explicit false, trigger end.
+
+ var shouldUpdate = _this.props.onDrag(e, coreEvent);
+
+ if (shouldUpdate === false || _this.mounted === 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
+ });
+ });
+
+ DraggableCore_defineProperty(_assertThisInitialized(_this), "handleDragStop", function (e) {
+ if (!_this.state.dragging) return;
+ var position = getControlPosition(e, _this.state.touchIdentifier, _assertThisInitialized(_this));
+ if (position == null) return;
+ var x = position.x,
+ y = position.y; // Snap to grid if prop has been provided
+
+ if (Array.isArray(_this.props.grid)) {
+ var deltaX = x - _this.state.lastX || 0;
+ var deltaY = y - _this.state.lastY || 0;
+
+ var _snapToGrid3 = snapToGrid(_this.props.grid, deltaX, deltaY);
+
+ var _snapToGrid4 = _slicedToArray(_snapToGrid3, 2);
+
+ deltaX = _snapToGrid4[0];
+ deltaY = _snapToGrid4[1];
+ x = _this.state.lastX + deltaX, y = _this.state.lastY + deltaY;
+ }
+
+ var coreEvent = createCoreData(_assertThisInitialized(_this), x, y); // Call event handler
+
+ var shouldContinue = _this.props.onStop(e, coreEvent);
+
+ if (shouldContinue === false || _this.mounted === false) return false;
+
+ var thisNode = _this.findDOMNode();
+
+ if (thisNode) {
+ // Remove user-select hack
+ if (_this.props.enableUserSelectHack) removeUserSelectStyles(thisNode.ownerDocument);
+ }
+
+ log('DraggableCore: handleDragStop: %j', coreEvent); // Reset the el.
+
+ _this.setState({
+ dragging: false,
+ lastX: NaN,
+ lastY: NaN
+ });
+
+ if (thisNode) {
+ // Remove event handlers
+ log('DraggableCore: Removing handlers');
+ removeEvent(thisNode.ownerDocument, dragEventFor.move, _this.handleDrag);
+ removeEvent(thisNode.ownerDocument, dragEventFor.stop, _this.handleDragStop);
+ }
+ });
+
+ DraggableCore_defineProperty(_assertThisInitialized(_this), "onMouseDown", function (e) {
+ dragEventFor = eventsFor.mouse; // on touchscreen laptops we could switch back to mouse
+
+ return _this.handleDragStart(e);
+ });
+
+ DraggableCore_defineProperty(_assertThisInitialized(_this), "onMouseUp", function (e) {
+ dragEventFor = eventsFor.mouse;
+ return _this.handleDragStop(e);
+ });
+
+ DraggableCore_defineProperty(_assertThisInitialized(_this), "onTouchStart", function (e) {
+ // We're on a touch device now, so change the event handlers
+ dragEventFor = eventsFor.touch;
+ return _this.handleDragStart(e);
+ });
+
+ DraggableCore_defineProperty(_assertThisInitialized(_this), "onTouchEnd", function (e) {
+ // We're on a touch device now, so change the event handlers
+ dragEventFor = eventsFor.touch;
+ return _this.handleDragStop(e);
+ });
+
+ return _this;
+ }
+
+ _createClass(DraggableCore, [{
+ key: "componentDidMount",
+ value: function componentDidMount() {
+ this.mounted = true; // Touch handlers must be added with {passive: false} to be cancelable.
+ // https://developers.google.com/web/updates/2017/01/scrolling-intervention
+
+ var thisNode = this.findDOMNode();
+
+ if (thisNode) {
+ addEvent(thisNode, eventsFor.touch.start, this.onTouchStart, {
+ passive: false
+ });
+ }
+ }
+ }, {
+ key: "componentWillUnmount",
+ value: function componentWillUnmount() {
+ this.mounted = false; // 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 thisNode = this.findDOMNode();
+
+ if (thisNode) {
+ var ownerDocument = thisNode.ownerDocument;
+ removeEvent(ownerDocument, eventsFor.mouse.move, this.handleDrag);
+ removeEvent(ownerDocument, eventsFor.touch.move, this.handleDrag);
+ removeEvent(ownerDocument, eventsFor.mouse.stop, this.handleDragStop);
+ removeEvent(ownerDocument, eventsFor.touch.stop, this.handleDragStop);
+ removeEvent(thisNode, eventsFor.touch.start, this.onTouchStart, {
+ passive: false
+ });
+ if (this.props.enableUserSelectHack) removeUserSelectStyles(ownerDocument);
+ }
+ } // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
+ // the underlying DOM node ourselves. See the README for more information.
+
+ }, {
+ key: "findDOMNode",
+ value: function findDOMNode()
+ /*: ?HTMLElement*/
+ {
+ var _this$props, _this$props2, _this$props2$nodeRef;
+
+ return (_this$props = this.props) !== null && _this$props !== void 0 && _this$props.nodeRef ? (_this$props2 = this.props) === null || _this$props2 === void 0 ? void 0 : (_this$props2$nodeRef = _this$props2.nodeRef) === null || _this$props2$nodeRef === void 0 ? void 0 : _this$props2$nodeRef.current : external_commonjs_react_dom_commonjs2_react_dom_amd_react_dom_root_ReactDOM_default().findDOMNode(this);
+ }
+ }, {
+ key: "render",
+ value: function render()
+ /*: React.Element<any>*/
+ {
+ // Reuse the child provided
+ // This makes it flexible to use whatever element is wanted (div, ul, etc)
+ return /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.cloneElement(external_commonjs_react_commonjs2_react_amd_react_root_React_.Children.only(this.props.children), {
+ // 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,
+ onMouseUp: this.onMouseUp,
+ // onTouchStart is added on `componentDidMount` so they can be added with
+ // {passive: false}, which allows it to cancel. See
+ // https://developers.google.com/web/updates/2017/01/scrolling-intervention
+ onTouchEnd: this.onTouchEnd
+ });
+ }
+ }]);
+
+ return DraggableCore;
+}(external_commonjs_react_commonjs2_react_amd_react_root_React_.Component);
+
+DraggableCore_defineProperty(DraggableCore, "displayName", 'DraggableCore');
+
+DraggableCore_defineProperty(DraggableCore, "propTypes", {
+ /**
+ * `allowAnyClick` allows dragging using any mouse button.
+ * By default, we only accept the left button.
+ *
+ * Defaults to `false`.
+ */
+ allowAnyClick: (prop_types_default()).bool,
+
+ /**
+ * `disabled`, if true, stops the <Draggable> from dragging. All handlers,
+ * with the exception of `onMouseDown`, will not fire.
+ */
+ disabled: (prop_types_default()).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: (prop_types_default()).bool,
+
+ /**
+ * `offsetParent`, if set, uses the passed DOM node to compute drag offsets
+ * instead of using the parent node.
+ */
+ offsetParent: function offsetParent(props
+ /*: DraggableCoreProps*/
+ , propName
+ /*: $Keys<DraggableCoreProps>*/
+ ) {
+ if (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: prop_types_default().arrayOf((prop_types_default()).number),
+
+ /**
+ * `handle` specifies a selector to be used as the handle that initiates drag.
+ *
+ * Example:
+ *
+ * ```jsx
+ * let App = React.createClass({
+ * render: function () {
+ * return (
+ * <Draggable handle=".handle">
+ * <div>
+ * <div className="handle">Click me to drag</div>
+ * <div>This is some other content</div>
+ * </div>
+ * </Draggable>
+ * );
+ * }
+ * });
+ * ```
+ */
+ handle: (prop_types_default()).string,
+
+ /**
+ * `cancel` specifies a selector to be used to prevent drag initialization.
+ *
+ * Example:
+ *
+ * ```jsx
+ * let App = React.createClass({
+ * render: function () {
+ * return(
+ * <Draggable cancel=".cancel">
+ * <div>
+ * <div className="cancel">You can't drag from here</div>
+ * <div>Dragging here works fine</div>
+ * </div>
+ * </Draggable>
+ * );
+ * }
+ * });
+ * ```
+ */
+ cancel: (prop_types_default()).string,
+
+ /* If running in React Strict mode, ReactDOM.findDOMNode() is deprecated.
+ * Unfortunately, in order for <Draggable> to work properly, we need raw access
+ * to the underlying DOM node. If you want to avoid the warning, pass a `nodeRef`
+ * as in this example:
+ *
+ * function MyComponent() {
+ * const nodeRef = React.useRef(null);
+ * return (
+ * <Draggable nodeRef={nodeRef}>
+ * <div ref={nodeRef}>Example Target</div>
+ * </Draggable>
+ * );
+ * }
+ *
+ * This can be used for arbitrarily nested components, so long as the ref ends up
+ * pointing to the actual child DOM node and not a custom component.
+ */
+ nodeRef: (prop_types_default()).object,
+
+ /**
+ * Called when dragging starts.
+ * If this function returns the boolean false, dragging will be canceled.
+ */
+ onStart: (prop_types_default()).func,
+
+ /**
+ * Called while dragging.
+ * If this function returns the boolean false, dragging will be canceled.
+ */
+ onDrag: (prop_types_default()).func,
+
+ /**
+ * Called when dragging stops.
+ * If this function returns the boolean false, the drag will remain active.
+ */
+ onStop: (prop_types_default()).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: (prop_types_default()).func,
+
+ /**
+ * `scale`, if set, applies scaling while dragging an element
+ */
+ scale: (prop_types_default()).number,
+
+ /**
+ * These properties should be defined on the child, not here.
+ */
+ className: dontSetMe,
+ style: dontSetMe,
+ transform: dontSetMe
+});
+
+DraggableCore_defineProperty(DraggableCore, "defaultProps", {
+ allowAnyClick: false,
+ // by default only accept left click
+ disabled: false,
+ enableUserSelectHack: true,
+ onStart: function onStart() {},
+ onDrag: function onDrag() {},
+ onStop: function onStop() {},
+ onMouseDown: function onMouseDown() {},
+ scale: 1
+});
+
+
+;// CONCATENATED MODULE: ./lib/Draggable.js
+function Draggable_typeof(obj) { "@babel/helpers - typeof"; return Draggable_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, Draggable_typeof(obj); }
+
+var _excluded = ["axis", "bounds", "children", "defaultPosition", "defaultClassName", "defaultClassNameDragging", "defaultClassNameDragged", "position", "positionOffset", "scale"];
+
+function _extends() { _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; }; return _extends.apply(this, arguments); }
+
+function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
+
+function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
+
+function Draggable_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
+
+function Draggable_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? Draggable_ownKeys(Object(source), !0).forEach(function (key) { Draggable_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : Draggable_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
+
+function Draggable_slicedToArray(arr, i) { return Draggable_arrayWithHoles(arr) || Draggable_iterableToArrayLimit(arr, i) || Draggable_unsupportedIterableToArray(arr, i) || Draggable_nonIterableRest(); }
+
+function Draggable_nonIterableRest() { 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 Draggable_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Draggable_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Draggable_arrayLikeToArray(o, minLen); }
+
+function Draggable_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
+
+function Draggable_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
+
+function Draggable_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
+
+function Draggable_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function Draggable_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); } }
+
+function Draggable_createClass(Constructor, protoProps, staticProps) { if (protoProps) Draggable_defineProperties(Constructor.prototype, protoProps); if (staticProps) Draggable_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
+
+function Draggable_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) Draggable_setPrototypeOf(subClass, superClass); }
+
+function Draggable_setPrototypeOf(o, p) { Draggable_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Draggable_setPrototypeOf(o, p); }
+
+function Draggable_createSuper(Derived) { var hasNativeReflectConstruct = Draggable_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Draggable_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Draggable_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Draggable_possibleConstructorReturn(this, result); }; }
+
+function Draggable_possibleConstructorReturn(self, call) { if (call && (Draggable_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Draggable_assertThisInitialized(self); }
+
+function Draggable_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
+
+function Draggable_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
+
+function Draggable_getPrototypeOf(o) { Draggable_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Draggable_getPrototypeOf(o); }
+
+function Draggable_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, PositionOffsetControlPosition, DraggableCoreProps, DraggableCoreDefaultProps} from './DraggableCore';*/
+
+
+/*:: import type {Bounds, DraggableEventHandler} from './utils/types';*/
+
+/*:: import type {Element as ReactElement} from 'react';*/
+
+/*:: type DraggableState = {
+ dragging: boolean,
+ dragged: boolean,
+ x: number, y: number,
+ slackX: number, slackY: number,
+ isElementSVG: boolean,
+ prevPropsPosition: ?ControlPosition,
+};*/
+
+/*:: export type DraggableDefaultProps = {
+ ...DraggableCoreDefaultProps,
+ axis: 'both' | 'x' | 'y' | 'none',
+ bounds: Bounds | string | false,
+ defaultClassName: string,
+ defaultClassNameDragging: string,
+ defaultClassNameDragged: string,
+ defaultPosition: ControlPosition,
+ scale: number,
+};*/
+
+/*:: export type DraggableProps = {
+ ...DraggableCoreProps,
+ ...DraggableDefaultProps,
+ positionOffset: PositionOffsetControlPosition,
+ position: ControlPosition,
+};*/
+
+//
+// Define <Draggable>
+//
+var Draggable = /*#__PURE__*/function (_React$Component) {
+ Draggable_inherits(Draggable, _React$Component);
+
+ var _super = Draggable_createSuper(Draggable);
+
+ function Draggable(props
+ /*: DraggableProps*/
+ ) {
+ var _this;
+
+ Draggable_classCallCheck(this, Draggable);
+
+ _this = _super.call(this, props);
+
+ Draggable_defineProperty(Draggable_assertThisInitialized(_this), "onDragStart", function (e, coreData) {
+ log('Draggable: onDragStart: %j', coreData); // Short-circuit if user's callback killed it.
+
+ var shouldStart = _this.props.onStart(e, createDraggableData(Draggable_assertThisInitialized(_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
+ });
+ });
+
+ Draggable_defineProperty(Draggable_assertThisInitialized(_this), "onDrag", function (e, coreData) {
+ if (!_this.state.dragging) return false;
+ log('Draggable: onDrag: %j', coreData);
+ var uiData = createDraggableData(Draggable_assertThisInitialized(_this), coreData);
+ var newState
+ /*: $Shape<DraggableState>*/
+ = {
+ 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.
+
+ var _getBoundPosition = getBoundPosition(Draggable_assertThisInitialized(_this), newState.x, newState.y),
+ _getBoundPosition2 = Draggable_slicedToArray(_getBoundPosition, 2),
+ newStateX = _getBoundPosition2[0],
+ newStateY = _getBoundPosition2[1];
+
+ newState.x = newStateX;
+ newState.y = newStateY; // Recalculate slack by noting how much was shaved by the boundPosition handler.
+
+ 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 = newState.x;
+ uiData.y = newState.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);
+ });
+
+ Draggable_defineProperty(Draggable_assertThisInitialized(_this), "onDragStop", function (e, coreData) {
+ if (!_this.state.dragging) return false; // Short-circuit if user's callback killed it.
+
+ var shouldContinue = _this.props.onStop(e, createDraggableData(Draggable_assertThisInitialized(_this), coreData));
+
+ if (shouldContinue === false) return false;
+ log('Draggable: onDragStop: %j', coreData);
+ var newState
+ /*: $Shape<DraggableState>*/
+ = {
+ 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,
+ x = _this$props$position.x,
+ y = _this$props$position.y;
+ newState.x = x;
+ newState.y = y;
+ }
+
+ _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,
+ prevPropsPosition: Draggable_objectSpread({}, props.position),
+ // Used for compensating for out-of-bounds drags
+ slackX: 0,
+ slackY: 0,
+ // Can only determine if SVG after mounting
+ isElementSVG: false
+ };
+
+ if (props.position && !(props.onDrag || props.onStop)) {
+ // eslint-disable-next-line no-console
+ console.warn('A `position` was applied to this <Draggable>, 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.');
+ }
+
+ return _this;
+ }
+
+ Draggable_createClass(Draggable, [{
+ key: "componentDidMount",
+ value: function componentDidMount() {
+ // Check to see if the element passed is an instanceof SVGElement
+ if (typeof window.SVGElement !== 'undefined' && this.findDOMNode() instanceof window.SVGElement) {
+ this.setState({
+ isElementSVG: true
+ });
+ }
+ }
+ }, {
+ key: "componentWillUnmount",
+ value: function componentWillUnmount() {
+ this.setState({
+ dragging: false
+ }); // prevents invariant if unmounted while dragging
+ } // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
+ // the underlying DOM node ourselves. See the README for more information.
+
+ }, {
+ key: "findDOMNode",
+ value: function findDOMNode()
+ /*: ?HTMLElement*/
+ {
+ var _this$props$nodeRef$c, _this$props, _this$props$nodeRef;
+
+ return (_this$props$nodeRef$c = (_this$props = this.props) === null || _this$props === void 0 ? void 0 : (_this$props$nodeRef = _this$props.nodeRef) === null || _this$props$nodeRef === void 0 ? void 0 : _this$props$nodeRef.current) !== null && _this$props$nodeRef$c !== void 0 ? _this$props$nodeRef$c : external_commonjs_react_dom_commonjs2_react_dom_amd_react_dom_root_ReactDOM_default().findDOMNode(this);
+ }
+ }, {
+ key: "render",
+ value: function render()
+ /*: ReactElement<any>*/
+ {
+ var _clsx;
+
+ var _this$props2 = this.props,
+ axis = _this$props2.axis,
+ bounds = _this$props2.bounds,
+ children = _this$props2.children,
+ defaultPosition = _this$props2.defaultPosition,
+ defaultClassName = _this$props2.defaultClassName,
+ defaultClassNameDragging = _this$props2.defaultClassNameDragging,
+ defaultClassNameDragged = _this$props2.defaultClassNameDragged,
+ position = _this$props2.position,
+ positionOffset = _this$props2.positionOffset,
+ scale = _this$props2.scale,
+ draggableCoreProps = _objectWithoutProperties(_this$props2, _excluded);
+
+ var style = {};
+ var svgTransform = null; // If this is controlled, we don't want to move it - unless it's dragging.
+
+ var controlled = Boolean(position);
+ var draggable = !controlled || this.state.dragging;
+ var validPosition = position || defaultPosition;
+ var transformOpts = {
+ // Set left if horizontal drag is enabled
+ x: canDragX(this) && draggable ? this.state.x : validPosition.x,
+ // Set top if vertical drag is enabled
+ y: canDragY(this) && draggable ? this.state.y : validPosition.y
+ }; // If this element was SVG, we use the `transform` attribute.
+
+ if (this.state.isElementSVG) {
+ svgTransform = createSVGTransform(transformOpts, positionOffset);
+ } 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 <span> so <Draggable>
+ // has a clean slate.
+ style = createCSSTransform(transformOpts, positionOffset);
+ } // Mark with class while dragging
+
+
+ var className = clsx_m(children.props.className || '', defaultClassName, (_clsx = {}, Draggable_defineProperty(_clsx, defaultClassNameDragging, this.state.dragging), Draggable_defineProperty(_clsx, defaultClassNameDragged, this.state.dragged), _clsx)); // Reuse the child provided
+ // This makes it flexible to use whatever element is wanted (div, ul, etc)
+
+ return /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.createElement(DraggableCore, _extends({}, draggableCoreProps, {
+ onStart: this.onDragStart,
+ onDrag: this.onDrag,
+ onStop: this.onDragStop
+ }), /*#__PURE__*/external_commonjs_react_commonjs2_react_amd_react_root_React_.cloneElement(external_commonjs_react_commonjs2_react_amd_react_root_React_.Children.only(children), {
+ className: className,
+ style: Draggable_objectSpread(Draggable_objectSpread({}, children.props.style), style),
+ transform: svgTransform
+ }));
+ }
+ }], [{
+ key: "getDerivedStateFromProps",
+ value: // React 16.3+
+ // Arity (props, state)
+ function getDerivedStateFromProps(_ref, _ref2)
+ /*: ?$Shape<DraggableState>*/
+ {
+ var position = _ref.position;
+ var prevPropsPosition = _ref2.prevPropsPosition;
+
+ // Set x/y if a new position is provided in props that is different than the previous.
+ if (position && (!prevPropsPosition || position.x !== prevPropsPosition.x || position.y !== prevPropsPosition.y)) {
+ log('Draggable: getDerivedStateFromProps %j', {
+ position: position,
+ prevPropsPosition: prevPropsPosition
+ });
+ return {
+ x: position.x,
+ y: position.y,
+ prevPropsPosition: Draggable_objectSpread({}, position)
+ };
+ }
+
+ return null;
+ }
+ }]);
+
+ return Draggable;
+}(external_commonjs_react_commonjs2_react_amd_react_root_React_.Component);
+
+Draggable_defineProperty(Draggable, "displayName", 'Draggable');
+
+Draggable_defineProperty(Draggable, "propTypes", Draggable_objectSpread(Draggable_objectSpread({}, DraggableCore.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: prop_types_default().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 (
+ * <Draggable bounds={{right: 300, bottom: 300}}>
+ * <div>Content</div>
+ * </Draggable>
+ * );
+ * }
+ * });
+ * ```
+ */
+ bounds: prop_types_default().oneOfType([prop_types_default().shape({
+ left: (prop_types_default()).number,
+ right: (prop_types_default()).number,
+ top: (prop_types_default()).number,
+ bottom: (prop_types_default()).number
+ }), (prop_types_default()).string, prop_types_default().oneOf([false])]),
+ defaultClassName: (prop_types_default()).string,
+ defaultClassNameDragging: (prop_types_default()).string,
+ defaultClassNameDragged: (prop_types_default()).string,
+
+ /**
+ * `defaultPosition` specifies the x and y that the dragged item should start at
+ *
+ * Example:
+ *
+ * ```jsx
+ * let App = React.createClass({
+ * render: function () {
+ * return (
+ * <Draggable defaultPosition={{x: 25, y: 25}}>
+ * <div>I start with transformX: 25px and transformY: 25px;</div>
+ * </Draggable>
+ * );
+ * }
+ * });
+ * ```
+ */
+ defaultPosition: prop_types_default().shape({
+ x: (prop_types_default()).number,
+ y: (prop_types_default()).number
+ }),
+ positionOffset: prop_types_default().shape({
+ x: prop_types_default().oneOfType([(prop_types_default()).number, (prop_types_default()).string]),
+ y: prop_types_default().oneOfType([(prop_types_default()).number, (prop_types_default()).string])
+ }),
+
+ /**
+ * `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 (
+ * <Draggable position={{x: 25, y: 25}}>
+ * <div>I start with transformX: 25px and transformY: 25px;</div>
+ * </Draggable>
+ * );
+ * }
+ * });
+ * ```
+ */
+ position: prop_types_default().shape({
+ x: (prop_types_default()).number,
+ y: (prop_types_default()).number
+ }),
+
+ /**
+ * These properties should be defined on the child, not here.
+ */
+ className: dontSetMe,
+ style: dontSetMe,
+ transform: dontSetMe
+}));
+
+Draggable_defineProperty(Draggable, "defaultProps", Draggable_objectSpread(Draggable_objectSpread({}, DraggableCore.defaultProps), {}, {
+ axis: 'both',
+ bounds: false,
+ defaultClassName: 'react-draggable',
+ defaultClassNameDragging: 'react-draggable-dragging',
+ defaultClassNameDragged: 'react-draggable-dragged',
+ defaultPosition: {
+ x: 0,
+ y: 0
+ },
+ scale: 1
+}));
+
+
+
+/***/ }),
+
+/***/ 16:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+var _require = __webpack_require__(404),
+ Draggable = _require.default,
+ DraggableCore = _require.DraggableCore; // Previous versions of this lib exported <Draggable> as the root export. As to no-// them, or TypeScript, we export *both* as the root and as 'default'.
+// See https://github.com/mzabriskie/react-draggable/pull/254
+// and https://github.com/mzabriskie/react-draggable/issues/266
+
+
+module.exports = Draggable;
+module.exports["default"] = Draggable;
+module.exports.DraggableCore = DraggableCore;
+
+/***/ }),
+
+/***/ 703:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+"use strict";
+/**
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+
+
+var ReactPropTypesSecret = __webpack_require__(414);
+
+function emptyFunction() {}
+function emptyFunctionWithReset() {}
+emptyFunctionWithReset.resetWarningCache = emptyFunction;
+
+module.exports = function() {
+ function shim(props, propName, componentName, location, propFullName, secret) {
+ if (secret === ReactPropTypesSecret) {
+ // It is still safe when called from React.
+ return;
+ }
+ var err = new Error(
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
+ 'Use PropTypes.checkPropTypes() to call them. ' +
+ 'Read more at http://fb.me/use-check-prop-types'
+ );
+ err.name = 'Invariant Violation';
+ throw err;
+ };
+ shim.isRequired = shim;
+ function getShim() {
+ return shim;
+ };
+ // Important!
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
+ var ReactPropTypes = {
+ array: shim,
+ bigint: shim,
+ bool: shim,
+ func: shim,
+ number: shim,
+ object: shim,
+ string: shim,
+ symbol: shim,
+
+ any: shim,
+ arrayOf: getShim,
+ element: shim,
+ elementType: shim,
+ instanceOf: getShim,
+ node: shim,
+ objectOf: getShim,
+ oneOf: getShim,
+ oneOfType: getShim,
+ shape: getShim,
+ exact: getShim,
+
+ checkPropTypes: emptyFunctionWithReset,
+ resetWarningCache: emptyFunction
+ };
+
+ ReactPropTypes.PropTypes = ReactPropTypes;
+
+ return ReactPropTypes;
+};
+
+
+/***/ }),
+
+/***/ 697:
+/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
+
+/**
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+if (false) { var throwOnDirectAccess, ReactIs; } else {
+ // By explicitly using `prop-types` you are opting into new production behavior.
+ // http://fb.me/prop-types-in-prod
+ module.exports = __webpack_require__(703)();
+}
+
+
+/***/ }),
+
+/***/ 414:
+/***/ (function(module) {
+
+"use strict";
+/**
+ * Copyright (c) 2013-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+
+
+var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
+
+module.exports = ReactPropTypesSecret;
+
+
+/***/ }),
+
+/***/ 359:
+/***/ (function(module) {
+
+"use strict";
+module.exports = __WEBPACK_EXTERNAL_MODULE__359__;
+
+/***/ }),
+
+/***/ 318:
+/***/ (function(module) {
+
+"use strict";
+module.exports = __WEBPACK_EXTERNAL_MODULE__318__;
+
+/***/ })
+
+/******/ });
+/************************************************************************/
+/******/ // The module cache
+/******/ var __webpack_module_cache__ = {};
+/******/
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+/******/ // Check if module is in cache
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
+/******/ }
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = __webpack_module_cache__[moduleId] = {
+/******/ // no module.id needed
+/******/ // no module.loaded needed
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/************************************************************************/
+/******/ /* webpack/runtime/compat get default export */
+/******/ !function() {
+/******/ // getDefaultExport function for compatibility with non-harmony modules
+/******/ __webpack_require__.n = function(module) {
+/******/ var getter = module && module.__esModule ?
+/******/ function() { return module['default']; } :
+/******/ function() { return module; };
+/******/ __webpack_require__.d(getter, { a: getter });
+/******/ return getter;
+/******/ };
+/******/ }();
+/******/
+/******/ /* webpack/runtime/define property getters */
+/******/ !function() {
+/******/ // define getter functions for harmony exports
+/******/ __webpack_require__.d = function(exports, definition) {
+/******/ for(var key in definition) {
+/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
+/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
+/******/ }
+/******/ }
+/******/ };
+/******/ }();
+/******/
+/******/ /* webpack/runtime/hasOwnProperty shorthand */
+/******/ !function() {
+/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
+/******/ }();
+/******/
+/******/ /* webpack/runtime/make namespace object */
+/******/ !function() {
+/******/ // define __esModule on exports
+/******/ __webpack_require__.r = function(exports) {
+/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
+/******/ }
+/******/ Object.defineProperty(exports, '__esModule', { value: true });
+/******/ };
+/******/ }();
+/******/
+/************************************************************************/
+/******/
+/******/ // startup
+/******/ // Load entry module and return exports
+/******/ // This entry module is referenced by other modules so it can't be inlined
+/******/ var __webpack_exports__ = __webpack_require__(16);
+/******/
+/******/ return __webpack_exports__;
+/******/ })()
+;
+});
+//# sourceMappingURL=react-draggable.min.js.map
\ No newline at end of file
diff --git a/build/web/react-draggable.min.js.map b/build/web/react-draggable.min.js.map
new file mode 100644
index 0000000..e9bf80e
--- /dev/null
+++ b/build/web/react-draggable.min.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"react-draggable.min.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;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AAAOG,IAAAA,CAAC,EAAE;AAAV;AACjBV,EAAAA,KAAK,EAAE;;;;;;;;;;AChLX,eAA4C+L,mBAAO,CAAC,GAAD,CAAnD;AAAA,IAAgB/B,SAAhB,YAAO8B,OAAP;AAAA,IAA2BjF,aAA3B,YAA2BA,aAA3B,EAEA;AACA;AACA;;;AACAmF,MAAM,CAACC,OAAP,GAAiBjC,SAAjB;AACAgC,yBAAA,GAAyBhC,SAAzB;AACAgC,4BAAA,GAA+BnF,aAA/B;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb,2BAA2B,mBAAO,CAAC,GAA4B;;AAE/D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;;;;;;;AChEA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAI,KAAqC,EAAE,qCAO1C,CAAC;AACF;AACA;AACA,mBAAmB,mBAAO,CAAC,GAA4B;AACvD;;;;;;;;;AClBA;AACA;AACA;AACA;AACA;AACA;;AAEa;;AAEb;;AAEA;;;;;;;;;ACXA;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;UENA;UACA;UACA;UACA","sources":["../webpack/universalModuleDefinition",".././node_modules/clsx/dist/clsx.m.js",".././lib/utils/shims.js",".././lib/utils/getPrefix.js",".././lib/utils/domFns.js",".././lib/utils/positionFns.js",".././lib/utils/log.js",".././lib/DraggableCore.js",".././lib/Draggable.js",".././lib/cjs.js",".././node_modules/prop-types/factoryWithThrowingShims.js",".././node_modules/prop-types/index.js",".././node_modules/prop-types/lib/ReactPropTypesSecret.js","../external umd {\"commonjs\":\"react\",\"commonjs2\":\"react\",\"amd\":\"react\",\"root\":\"React\"}","../external umd {\"commonjs\":\"react-dom\",\"commonjs2\":\"react-dom\",\"amd\":\"react-dom\",\"root\":\"ReactDOM\"}","../webpack/bootstrap","../webpack/runtime/compat get default export","../webpack/runtime/define property getters","../webpack/runtime/hasOwnProperty shorthand","../webpack/runtime/make namespace object","../webpack/before-startup","../webpack/startup","../webpack/after-startup"],"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})(self, function(__WEBPACK_EXTERNAL_MODULE__359__, __WEBPACK_EXTERNAL_MODULE__318__) {\nreturn ","function toVal(mix) {\n\tvar k, y, str='';\n\n\tif (typeof mix === 'string' || typeof mix === 'number') {\n\t\tstr += mix;\n\t} else if (typeof mix === 'object') {\n\t\tif (Array.isArray(mix)) {\n\t\t\tfor (k=0; k < mix.length; k++) {\n\t\t\t\tif (mix[k]) {\n\t\t\t\t\tif (y = toVal(mix[k])) {\n\t\t\t\t\t\tstr && (str += ' ');\n\t\t\t\t\t\tstr += y;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor (k in mix) {\n\t\t\t\tif (mix[k]) {\n\t\t\t\t\tstr && (str += ' ');\n\t\t\t\t\tstr += k;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn str;\n}\n\nexport default function () {\n\tvar i=0, tmp, x, str='';\n\twhile (i < arguments.length) {\n\t\tif (tmp = arguments[i++]) {\n\t\t\tif (x = toVal(tmp)) {\n\t\t\t\tstr && (str += ' ');\n\t\t\t\tstr += x\n\t\t\t}\n\t\t}\n\t}\n\treturn str;\n}\n","// @flow\n// @credits https://gist.github.com/rogozhnikoff/a43cfed27c41e4e68cdc\nexport function findInArray(array: Array<any> | 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 %checks {\n // $FlowIgnore[method-unbinding]\n return typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]';\n}\n\nexport function isNum(num: any): boolean %checks {\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): ?Error {\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","// @flow\nconst prefixes = ['Moz', 'Webkit', 'O', 'ms'];\nexport function getPrefix(prop: string='transform'): string {\n // Ensure we're running in an environment where there is actually a global\n // `window` obj\n if (typeof window === 'undefined') return '';\n\n // If we're in a pseudo-browser server-side environment, this access\n // path may not exist, so bail out if it doesn't.\n const style = window.document?.documentElement?.style;\n if (!style) return '';\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(): string);\n","// @flow\nimport {findInArray, isFunction, int} from './shims';\nimport browserPrefix, {browserPrefixToKey} from './getPrefix';\n\nimport type {ControlPosition, PositionOffsetControlPosition, MouseTouchEvent} 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 // Might not be found entirely (not an Element?) - in that case, bail\n // $FlowIgnore: Doesn't think elements are indexable\n if (!isFunction(el[matchesSelectorFunc])) return false;\n\n // $FlowIgnore: Doesn't think elements are indexable\n return el[matchesSelectorFunc](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, inputOptions?: Object): void {\n if (!el) return;\n const options = {capture: true, ...inputOptions};\n // $FlowIgnore[method-unbinding]\n if (el.addEventListener) {\n el.addEventListener(event, handler, options);\n } else if (el.attachEvent) {\n el.attachEvent('on' + event, handler);\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, inputOptions?: Object): void {\n if (!el) return;\n const options = {capture: true, ...inputOptions};\n // $FlowIgnore[method-unbinding]\n if (el.removeEventListener) {\n el.removeEventListener(event, handler, options);\n } else if (el.detachEvent) {\n el.detachEvent('on' + event, handler);\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\ninterface EventWithOffset {\n clientX: number, clientY: number\n}\n\n// Get from offsetParent\nexport function offsetXYFromParent(evt: EventWithOffset, offsetParent: HTMLElement, scale: number): 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) / scale;\n const y = (evt.clientY + offsetParent.scrollTop - offsetParentRect.top) / scale;\n\n return {x, y};\n}\n\nexport function createCSSTransform(controlPos: ControlPosition, positionOffset: PositionOffsetControlPosition): Object {\n const translation = getTranslation(controlPos, positionOffset, 'px');\n return {[browserPrefixToKey('transform', browserPrefix)]: translation };\n}\n\nexport function createSVGTransform(controlPos: ControlPosition, positionOffset: PositionOffsetControlPosition): string {\n const translation = getTranslation(controlPos, positionOffset, '');\n return translation;\n}\nexport function getTranslation({x, y}: ControlPosition, positionOffset: PositionOffsetControlPosition, unitSuffix: string): string {\n let translation = `translate(${x}${unitSuffix},${y}${unitSuffix})`;\n if (positionOffset) {\n const defaultX = `${(typeof positionOffset.x === 'string') ? positionOffset.x : positionOffset.x + unitSuffix}`;\n const defaultY = `${(typeof positionOffset.y === 'string') ? positionOffset.y : positionOffset.y + unitSuffix}`;\n translation = `translate(${defaultX}, ${defaultY})` + translation;\n }\n return translation;\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.\n\n// Note we're passing `document` b/c we could be iframed\nexport function addUserSelectStyles(doc: ?Document) {\n if (!doc) return;\n let styleEl = doc.getElementById('react-draggable-style-el');\n if (!styleEl) {\n styleEl = doc.createElement('style');\n styleEl.type = 'text/css';\n styleEl.id = 'react-draggable-style-el';\n styleEl.textContent = '.react-draggable-transparent-selection *::-moz-selection {all: inherit;}\\n';\n styleEl.textContent += '.react-draggable-transparent-selection *::selection {all: inherit;}\\n';\n doc.getElementsByTagName('head')[0].appendChild(styleEl);\n }\n if (doc.body) addClassName(doc.body, 'react-draggable-transparent-selection');\n}\n\nexport function removeUserSelectStyles(doc: ?Document) {\n if (!doc) return;\n try {\n if (doc.body) removeClassName(doc.body, 'react-draggable-transparent-selection');\n // $FlowIgnore: IE\n if (doc.selection) {\n // $FlowIgnore: IE\n doc.selection.empty();\n } else {\n // Remove selection caused by scroll, unless it's a focused input\n // (we use doc.defaultView in case we're in an iframe)\n const selection = (doc.defaultView || window).getSelection();\n if (selection && selection.type !== 'Caret') {\n selection.removeAllRanges();\n }\n }\n } catch (e) {\n // probably IE\n }\n}\n\nexport function addClassName(el: HTMLElement, className: string) {\n if (el.classList) {\n el.classList.add(className);\n } else {\n if (!el.className.match(new RegExp(`(?:^|\\\\s)${className}(?!\\\\S)`))) {\n el.className += ` ${className}`;\n }\n }\n}\n\nexport function removeClassName(el: HTMLElement, className: string) {\n if (el.classList) {\n el.classList.remove(className);\n } else {\n el.className = el.className.replace(new RegExp(`(?:^|\\\\s)${className}(?!\\\\S)`, 'g'), '');\n }\n}\n","// @flow\nimport {isNum, int} from './shims';\nimport {getTouch, innerWidth, innerHeight, offsetXYFromParent, outerWidth, outerHeight} from './domFns';\n\nimport type Draggable from '../Draggable';\nimport type {Bounds, ControlPosition, DraggableData, MouseTouchEvent} 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 = 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 }\n if (!(boundNode instanceof ownerWindow.HTMLElement)) {\n throw new Error('Bounds selector \"' + bounds + '\" could not find an element.');\n }\n const boundNodeEl: HTMLElement = boundNode; // for Flow, can't seem to refine correctly\n const nodeStyle = ownerWindow.getComputedStyle(node);\n const boundNodeStyle = ownerWindow.getComputedStyle(boundNodeEl);\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(boundNodeEl) - outerWidth(node) - node.offsetLeft +\n int(boundNodeStyle.paddingRight) - int(nodeStyle.marginRight),\n bottom: innerHeight(boundNodeEl) - 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 = 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, draggableCore.props.scale);\n}\n\n// Create an data object exposed by <DraggableCore>'s events\nexport function createCoreData(draggable: DraggableCore, x: number, y: number): DraggableData {\n const state = draggable.state;\n const isStart = !isNum(state.lastX);\n const node = findDOMNode(draggable);\n\n if (isStart) {\n // If this is our first move, use the x and y as last coords.\n return {\n node,\n deltaX: 0, deltaY: 0,\n lastX: x, lastY: y,\n x, y,\n };\n } else {\n // Otherwise calculate proper values.\n return {\n node,\n deltaX: x - state.lastX, deltaY: y - state.lastY,\n lastX: state.lastX, lastY: state.lastY,\n x, y,\n };\n }\n}\n\n// Create an data exposed by <Draggable>'s events\nexport function createDraggableData(draggable: Draggable, coreData: DraggableData): DraggableData {\n const scale = draggable.props.scale;\n return {\n node: coreData.node,\n x: draggable.state.x + (coreData.deltaX / scale),\n y: draggable.state.y + (coreData.deltaY / scale),\n deltaX: (coreData.deltaX / scale),\n deltaY: (coreData.deltaY / scale),\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\nfunction findDOMNode(draggable: Draggable | DraggableCore): HTMLElement {\n const node = draggable.findDOMNode();\n if (!node) {\n throw new Error('<DraggableCore>: Unmounted during event!');\n }\n // $FlowIgnore we can't assert on HTMLElement due to tests... FIXME\n return node;\n}\n","// @flow\n/*eslint no-console:0*/\nexport default function log(...args: any) {\n if (process.env.DRAGGABLE_DEBUG) console.log(...args);\n}\n","// @flow\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport ReactDOM from 'react-dom';\nimport {matchesSelectorAndParentsTo, addEvent, removeEvent, addUserSelectStyles, getTouchIdentifier,\n removeUserSelectStyles} from './utils/domFns';\nimport {createCoreData, getControlPosition, snapToGrid} from './utils/positionFns';\nimport {dontSetMe} from './utils/shims';\nimport log from './utils/log';\n\nimport type {EventHandler, MouseTouchEvent} from './utils/types';\nimport type {Element as ReactElement} from 'react';\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 DraggableCoreState = {\n dragging: boolean,\n lastX: number,\n lastY: number,\n touchIdentifier: ?number\n};\n\nexport type DraggableData = {\n node: HTMLElement,\n x: number, y: number,\n deltaX: number, deltaY: number,\n lastX: number, lastY: number,\n};\n\nexport type DraggableEventHandler = (e: MouseEvent, data: DraggableData) => void | false;\n\nexport type ControlPosition = {x: number, y: number};\nexport type PositionOffsetControlPosition = {x: number|string, y: number|string};\n\nexport type DraggableCoreDefaultProps = {\n allowAnyClick: boolean,\n disabled: boolean,\n enableUserSelectHack: boolean,\n onStart: DraggableEventHandler,\n onDrag: DraggableEventHandler,\n onStop: DraggableEventHandler,\n onMouseDown: (e: MouseEvent) => void,\n scale: number,\n};\n\nexport type DraggableCoreProps = {\n ...DraggableCoreDefaultProps,\n cancel: string,\n children: ReactElement<any>,\n offsetParent: HTMLElement,\n grid: [number, number],\n handle: string,\n nodeRef?: ?React.ElementRef<any>,\n};\n\n//\n// Define <DraggableCore>.\n//\n// <DraggableCore> is for advanced usage of <Draggable>. 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<DraggableCoreProps, DraggableCoreState> {\n\n static displayName: ?string = '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 <Draggable> 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: DraggableCoreProps, propName: $Keys<DraggableCoreProps>) {\n if (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 * <Draggable handle=\".handle\">\n * <div>\n * <div className=\"handle\">Click me to drag</div>\n * <div>This is some other content</div>\n * </div>\n * </Draggable>\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 * <Draggable cancel=\".cancel\">\n * <div>\n * <div className=\"cancel\">You can't drag from here</div>\n * <div>Dragging here works fine</div>\n * </div>\n * </Draggable>\n * );\n * }\n * });\n * ```\n */\n cancel: PropTypes.string,\n\n /* If running in React Strict mode, ReactDOM.findDOMNode() is deprecated.\n * Unfortunately, in order for <Draggable> to work properly, we need raw access\n * to the underlying DOM node. If you want to avoid the warning, pass a `nodeRef`\n * as in this example:\n *\n * function MyComponent() {\n * const nodeRef = React.useRef(null);\n * return (\n * <Draggable nodeRef={nodeRef}>\n * <div ref={nodeRef}>Example Target</div>\n * </Draggable>\n * );\n * }\n *\n * This can be used for arbitrarily nested components, so long as the ref ends up\n * pointing to the actual child DOM node and not a custom component.\n */\n nodeRef: PropTypes.object,\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 * `scale`, if set, applies scaling while dragging an element\n */\n scale: PropTypes.number,\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: DraggableCoreDefaultProps = {\n allowAnyClick: false, // by default only accept left click\n disabled: false,\n enableUserSelectHack: true,\n onStart: function(){},\n onDrag: function(){},\n onStop: function(){},\n onMouseDown: function(){},\n scale: 1,\n };\n\n state: DraggableCoreState = {\n dragging: false,\n // Used while dragging to determine deltas.\n lastX: NaN, lastY: NaN,\n touchIdentifier: null\n };\n\n mounted: boolean = false;\n\n componentDidMount() {\n this.mounted = true;\n // Touch handlers must be added with {passive: false} to be cancelable.\n // https://developers.google.com/web/updates/2017/01/scrolling-intervention\n const thisNode = this.findDOMNode();\n if (thisNode) {\n addEvent(thisNode, eventsFor.touch.start, this.onTouchStart, {passive: false});\n }\n }\n\n componentWillUnmount() {\n this.mounted = false;\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 thisNode = this.findDOMNode();\n if (thisNode) {\n const {ownerDocument} = thisNode;\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 removeEvent(thisNode, eventsFor.touch.start, this.onTouchStart, {passive: false});\n if (this.props.enableUserSelectHack) removeUserSelectStyles(ownerDocument);\n }\n }\n\n // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find\n // the underlying DOM node ourselves. See the README for more information.\n findDOMNode(): ?HTMLElement {\n return this.props?.nodeRef ? this.props?.nodeRef?.current : ReactDOM.findDOMNode(this);\n }\n\n handleDragStart: EventHandler<MouseTouchEvent> = (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 thisNode = this.findDOMNode();\n if (!thisNode || !thisNode.ownerDocument || !thisNode.ownerDocument.body) {\n throw new Error('<DraggableCore> not mounted on DragStart!');\n }\n const {ownerDocument} = thisNode;\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, thisNode)) ||\n (this.props.cancel && matchesSelectorAndParentsTo(e.target, this.props.cancel, thisNode))) {\n return;\n }\n\n // Prevent scrolling on mobile devices, like ipad/iphone.\n // Important that this is after handle/cancel.\n if (e.type === 'touchstart') e.preventDefault();\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 || this.mounted === 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);\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<MouseTouchEvent> = (e) => {\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 (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 || this.mounted === 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<MouseTouchEvent> = (e) => {\n if (!this.state.dragging) return;\n\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 (Array.isArray(this.props.grid)) {\n let deltaX = x - this.state.lastX || 0;\n let deltaY = y - this.state.lastY || 0;\n [deltaX, deltaY] = snapToGrid(this.props.grid, deltaX, deltaY);\n x = this.state.lastX + deltaX, y = this.state.lastY + deltaY;\n }\n\n const coreEvent = createCoreData(this, x, y);\n\n // Call event handler\n const shouldContinue = this.props.onStop(e, coreEvent);\n if (shouldContinue === false || this.mounted === false) return false;\n\n const thisNode = this.findDOMNode();\n if (thisNode) {\n // Remove user-select hack\n if (this.props.enableUserSelectHack) removeUserSelectStyles(thisNode.ownerDocument);\n }\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 if (thisNode) {\n // Remove event handlers\n log('DraggableCore: Removing handlers');\n removeEvent(thisNode.ownerDocument, dragEventFor.move, this.handleDrag);\n removeEvent(thisNode.ownerDocument, dragEventFor.stop, this.handleDragStop);\n }\n };\n\n onMouseDown: EventHandler<MouseTouchEvent> = (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<MouseTouchEvent> = (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<MouseTouchEvent> = (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<MouseTouchEvent> = (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<any> {\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 // 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 onMouseUp: this.onMouseUp,\n // onTouchStart is added on `componentDidMount` so they can be added with\n // {passive: false}, which allows it to cancel. See\n // https://developers.google.com/web/updates/2017/01/scrolling-intervention\n onTouchEnd: this.onTouchEnd\n });\n }\n}\n","// @flow\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport ReactDOM from 'react-dom';\nimport clsx from 'clsx';\nimport {createCSSTransform, createSVGTransform} from './utils/domFns';\nimport {canDragX, canDragY, createDraggableData, getBoundPosition} from './utils/positionFns';\nimport {dontSetMe} from './utils/shims';\nimport DraggableCore from './DraggableCore';\nimport type {ControlPosition, PositionOffsetControlPosition, DraggableCoreProps, DraggableCoreDefaultProps} from './DraggableCore';\nimport log from './utils/log';\nimport type {Bounds, DraggableEventHandler} from './utils/types';\nimport type {Element as ReactElement} from 'react';\n\ntype DraggableState = {\n dragging: boolean,\n dragged: boolean,\n x: number, y: number,\n slackX: number, slackY: number,\n isElementSVG: boolean,\n prevPropsPosition: ?ControlPosition,\n};\n\nexport type DraggableDefaultProps = {\n ...DraggableCoreDefaultProps,\n axis: 'both' | 'x' | 'y' | 'none',\n bounds: Bounds | string | false,\n defaultClassName: string,\n defaultClassNameDragging: string,\n defaultClassNameDragged: string,\n defaultPosition: ControlPosition,\n scale: number,\n};\n\nexport type DraggableProps = {\n ...DraggableCoreProps,\n ...DraggableDefaultProps,\n positionOffset: PositionOffsetControlPosition,\n position: ControlPosition,\n};\n\n//\n// Define <Draggable>\n//\n\nclass Draggable extends React.Component<DraggableProps, DraggableState> {\n\n static displayName: ?string = 'Draggable';\n\n static propTypes = {\n // Accepts all props <DraggableCore> 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 * <Draggable bounds={{right: 300, bottom: 300}}>\n * <div>Content</div>\n * </Draggable>\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 * <Draggable defaultPosition={{x: 25, y: 25}}>\n * <div>I start with transformX: 25px and transformY: 25px;</div>\n * </Draggable>\n * );\n * }\n * });\n * ```\n */\n defaultPosition: PropTypes.shape({\n x: PropTypes.number,\n y: PropTypes.number\n }),\n positionOffset: PropTypes.shape({\n x: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n y: PropTypes.oneOfType([PropTypes.number, PropTypes.string])\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 * <Draggable position={{x: 25, y: 25}}>\n * <div>I start with transformX: 25px and transformY: 25px;</div>\n * </Draggable>\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: DraggableDefaultProps = {\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 scale: 1\n };\n\n // React 16.3+\n // Arity (props, state)\n static getDerivedStateFromProps({position}: DraggableProps, {prevPropsPosition}: DraggableState): ?$Shape<DraggableState> {\n // Set x/y if a new position is provided in props that is different than the previous.\n if (\n position &&\n (!prevPropsPosition ||\n position.x !== prevPropsPosition.x || position.y !== prevPropsPosition.y\n )\n ) {\n log('Draggable: getDerivedStateFromProps %j', {position, prevPropsPosition});\n return {\n x: position.x,\n y: position.y,\n prevPropsPosition: {...position}\n };\n }\n return null;\n }\n\n constructor(props: DraggableProps) {\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 prevPropsPosition: {...props.position},\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 if (props.position && !(props.onDrag || props.onStop)) {\n // eslint-disable-next-line no-console\n console.warn('A `position` was applied to this <Draggable>, 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 window.SVGElement !== 'undefined' && this.findDOMNode() instanceof window.SVGElement) {\n this.setState({isElementSVG: true});\n }\n }\n\n componentWillUnmount() {\n this.setState({dragging: false}); // prevents invariant if unmounted while dragging\n }\n\n // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find\n // the underlying DOM node ourselves. See the README for more information.\n findDOMNode(): ?HTMLElement {\n return this.props?.nodeRef?.current ?? ReactDOM.findDOMNode(this);\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<DraggableState> = {\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 const [newStateX, newStateY] = getBoundPosition(this, newState.x, newState.y);\n newState.x = newStateX;\n newState.y = newStateY;\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 = newState.x;\n uiData.y = newState.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 shouldContinue = this.props.onStop(e, createDraggableData(this, coreData));\n if (shouldContinue === false) return false;\n\n log('Draggable: onDragStop: %j', coreData);\n\n const newState: $Shape<DraggableState> = {\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(): ReactElement<any> {\n const {\n axis,\n bounds,\n children,\n defaultPosition,\n defaultClassName,\n defaultClassNameDragging,\n defaultClassNameDragged,\n position,\n positionOffset,\n scale,\n ...draggableCoreProps\n } = this.props;\n\n let style = {};\n let svgTransform = null;\n\n // If this is controlled, we don't want to move it - unless it's dragging.\n const controlled = Boolean(position);\n const draggable = !controlled || this.state.dragging;\n\n const validPosition = position || defaultPosition;\n const transformOpts = {\n // Set left if horizontal drag is enabled\n x: canDragX(this) && draggable ?\n this.state.x :\n validPosition.x,\n\n // Set top if vertical drag is enabled\n y: canDragY(this) && draggable ?\n this.state.y :\n validPosition.y\n };\n\n // If this element was SVG, we use the `transform` attribute.\n if (this.state.isElementSVG) {\n svgTransform = createSVGTransform(transformOpts, positionOffset);\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 <span> so <Draggable>\n // has a clean slate.\n style = createCSSTransform(transformOpts, positionOffset);\n }\n\n // Mark with class while dragging\n const className = clsx((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 <DraggableCore {...draggableCoreProps} onStart={this.onDragStart} onDrag={this.onDrag} onStop={this.onDragStop}>\n {React.cloneElement(React.Children.only(children), {\n className: className,\n style: {...children.props.style, ...style},\n transform: svgTransform\n })}\n </DraggableCore>\n );\n }\n}\n\nexport {Draggable as default, DraggableCore};\n","const {default: Draggable, DraggableCore} = require('./Draggable');\n\n// Previous versions of this lib exported <Draggable> as the root export. As to no-// them, or TypeScript, we export *both* as the root and as 'default'.\n// See https://github.com/mzabriskie/react-draggable/pull/254\n// and https://github.com/mzabriskie/react-draggable/issues/266\nmodule.exports = Draggable;\nmodule.exports.default = Draggable;\nmodule.exports.DraggableCore = DraggableCore;\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bigint: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","module.exports = __WEBPACK_EXTERNAL_MODULE__359__;","module.exports = __WEBPACK_EXTERNAL_MODULE__318__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(16);\n",""],"names":["findInArray","array","callback","i","length","apply","isFunction","func","Object","prototype","toString","call","isNum","num","isNaN","int","a","parseInt","dontSetMe","props","propName","componentName","Error","prefixes","getPrefix","prop","window","style","document","documentElement","browserPrefixToKey","prefix","kebabToTitleCase","browserPrefixToStyle","toLowerCase","str","out","shouldCapitalize","toUpperCase","browserPrefix","matchesSelectorFunc","matchesSelector","el","selector","method","matchesSelectorAndParentsTo","baseNode","node","parentNode","addEvent","event","handler","inputOptions","options","capture","addEventListener","attachEvent","removeEvent","removeEventListener","detachEvent","outerHeight","height","clientHeight","computedStyle","ownerDocument","defaultView","getComputedStyle","borderTopWidth","borderBottomWidth","outerWidth","width","clientWidth","borderLeftWidth","borderRightWidth","innerHeight","paddingTop","paddingBottom","innerWidth","paddingLeft","paddingRight","offsetXYFromParent","evt","offsetParent","scale","isBody","body","offsetParentRect","left","top","getBoundingClientRect","x","clientX","scrollLeft","y","clientY","scrollTop","createCSSTransform","controlPos","positionOffset","translation","getTranslation","createSVGTransform","unitSuffix","defaultX","defaultY","getTouch","e","identifier","targetTouches","t","changedTouches","getTouchIdentifier","addUserSelectStyles","doc","styleEl","getElementById","createElement","type","id","textContent","getElementsByTagName","appendChild","addClassName","removeUserSelectStyles","removeClassName","selection","empty","getSelection","removeAllRanges","className","classList","add","match","RegExp","remove","replace","getBoundPosition","draggable","bounds","cloneBounds","findDOMNode","ownerWindow","boundNode","querySelector","HTMLElement","boundNodeEl","nodeStyle","boundNodeStyle","offsetLeft","marginLeft","offsetTop","marginTop","right","marginRight","bottom","marginBottom","Math","min","max","snapToGrid","grid","pendingX","pendingY","round","canDragX","axis","canDragY","getControlPosition","touchIdentifier","draggableCore","touchObj","createCoreData","state","isStart","lastX","deltaX","deltaY","lastY","createDraggableData","coreData","log","console","React","PropTypes","ReactDOM","eventsFor","touch","start","move","stop","mouse","dragEventFor","DraggableCore","dragging","NaN","onMouseDown","allowAnyClick","button","thisNode","disabled","target","Node","handle","cancel","preventDefault","setState","position","coreEvent","onStart","shouldUpdate","mounted","enableUserSelectHack","handleDrag","handleDragStop","Array","isArray","onDrag","MouseEvent","err","createEvent","initMouseEvent","shouldContinue","onStop","handleDragStart","onTouchStart","passive","nodeRef","current","cloneElement","Children","only","children","onMouseUp","onTouchEnd","Component","bool","nodeType","arrayOf","number","string","object","transform","clsx","Draggable","shouldStart","dragged","uiData","newState","slackX","slackY","newStateX","newStateY","controlled","Boolean","defaultPosition","prevPropsPosition","isElementSVG","warn","SVGElement","defaultClassName","defaultClassNameDragging","defaultClassNameDragged","draggableCoreProps","svgTransform","validPosition","transformOpts","onDragStart","onDragStop","propTypes","oneOf","oneOfType","shape","defaultProps","default","require","module","exports"],"sourceRoot":""}
\ No newline at end of file