@lingk/sync 1.1.62 → 1.1.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/main.js CHANGED
@@ -50357,540 +50357,313 @@ module.exports =
50357
50357
  /* 124 */
50358
50358
  /***/ function(module, exports, __webpack_require__) {
50359
50359
 
50360
- (function webpackUniversalModuleDefinition(root, factory) {
50361
- if(true)
50362
- module.exports = factory(__webpack_require__(1), __webpack_require__(18));
50363
- else if(typeof define === 'function' && define.amd)
50364
- define(["react", "react-dom"], factory);
50365
- else if(typeof exports === 'object')
50366
- exports["ReactDraggable"] = factory(require("react"), require("react-dom"));
50367
- else
50368
- root["ReactDraggable"] = factory(root["React"], root["ReactDOM"]);
50369
- })(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_11__) {
50370
- return /******/ (function(modules) { // webpackBootstrap
50371
- /******/ // The module cache
50372
- /******/ var installedModules = {};
50373
- /******/
50374
- /******/ // The require function
50375
- /******/ function __webpack_require__(moduleId) {
50376
- /******/
50377
- /******/ // Check if module is in cache
50378
- /******/ if(installedModules[moduleId])
50379
- /******/ return installedModules[moduleId].exports;
50380
- /******/
50381
- /******/ // Create a new module (and put it into the cache)
50382
- /******/ var module = installedModules[moduleId] = {
50383
- /******/ exports: {},
50384
- /******/ id: moduleId,
50385
- /******/ loaded: false
50386
- /******/ };
50387
- /******/
50388
- /******/ // Execute the module function
50389
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
50390
- /******/
50391
- /******/ // Flag the module as loaded
50392
- /******/ module.loaded = true;
50393
- /******/
50394
- /******/ // Return the exports of the module
50395
- /******/ return module.exports;
50396
- /******/ }
50397
- /******/
50398
- /******/
50399
- /******/ // expose the modules object (__webpack_modules__)
50400
- /******/ __webpack_require__.m = modules;
50401
- /******/
50402
- /******/ // expose the module cache
50403
- /******/ __webpack_require__.c = installedModules;
50404
- /******/
50405
- /******/ // __webpack_public_path__
50406
- /******/ __webpack_require__.p = "";
50407
- /******/
50408
- /******/ // Load entry module and return exports
50409
- /******/ return __webpack_require__(0);
50410
- /******/ })
50411
- /************************************************************************/
50412
- /******/ ([
50413
- /* 0 */
50414
- /***/ function(module, exports, __webpack_require__) {
50360
+ (function (global, factory) {
50361
+ true ? module.exports = factory(__webpack_require__(18), __webpack_require__(1)) :
50362
+ typeof define === 'function' && define.amd ? define(['react-dom', 'react'], factory) :
50363
+ (global.ReactDraggable = factory(global.ReactDOM,global.React));
50364
+ }(this, (function (ReactDOM,React) { 'use strict';
50415
50365
 
50416
- 'use strict';
50417
-
50418
- module.exports = __webpack_require__(1).default;
50419
- module.exports.DraggableCore = __webpack_require__(17).default;
50366
+ ReactDOM = ReactDOM && ReactDOM.hasOwnProperty('default') ? ReactDOM['default'] : ReactDOM;
50367
+ React = React && React.hasOwnProperty('default') ? React['default'] : React;
50420
50368
 
50421
- /***/ },
50422
- /* 1 */
50423
- /***/ function(module, exports, __webpack_require__) {
50369
+ function createCommonjsModule(fn, module) {
50370
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
50371
+ }
50424
50372
 
50425
- 'use strict';
50426
-
50427
- Object.defineProperty(exports, "__esModule", {
50428
- value: true
50429
- });
50430
-
50431
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
50432
-
50433
- var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
50434
-
50435
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
50436
-
50437
- var _react = __webpack_require__(2);
50438
-
50439
- var _react2 = _interopRequireDefault(_react);
50440
-
50441
- var _propTypes = __webpack_require__(3);
50442
-
50443
- var _propTypes2 = _interopRequireDefault(_propTypes);
50444
-
50445
- var _reactDom = __webpack_require__(11);
50446
-
50447
- var _reactDom2 = _interopRequireDefault(_reactDom);
50448
-
50449
- var _classnames = __webpack_require__(12);
50450
-
50451
- var _classnames2 = _interopRequireDefault(_classnames);
50452
-
50453
- var _domFns = __webpack_require__(13);
50454
-
50455
- var _positionFns = __webpack_require__(16);
50456
-
50457
- var _shims = __webpack_require__(14);
50458
-
50459
- var _DraggableCore = __webpack_require__(17);
50460
-
50461
- var _DraggableCore2 = _interopRequireDefault(_DraggableCore);
50462
-
50463
- var _log = __webpack_require__(19);
50464
-
50465
- var _log2 = _interopRequireDefault(_log);
50466
-
50467
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
50468
-
50469
- 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; }
50470
-
50471
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
50472
-
50473
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
50474
-
50475
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
50476
- // $FlowIgnore
50477
-
50478
-
50479
- /*:: import type {DraggableEventHandler} from './utils/types';*/
50480
- /*:: type DraggableState = {
50481
- dragging: boolean,
50482
- dragged: boolean,
50483
- x: number, y: number,
50484
- slackX: number, slackY: number,
50485
- isElementSVG: boolean
50486
- };*/
50487
-
50488
-
50489
- //
50490
- // Define <Draggable>
50491
- //
50492
-
50493
- /*:: type ConstructorProps = {
50494
- position: { x: number, y: number },
50495
- defaultPosition: { x: number, y: number }
50496
- };*/
50497
-
50498
- var Draggable = function (_React$Component) {
50499
- _inherits(Draggable, _React$Component);
50500
-
50501
- function Draggable(props /*: ConstructorProps*/) {
50502
- _classCallCheck(this, Draggable);
50503
-
50504
- var _this = _possibleConstructorReturn(this, (Draggable.__proto__ || Object.getPrototypeOf(Draggable)).call(this, props));
50505
-
50506
- _this.onDragStart = function (e, coreData) {
50507
- (0, _log2.default)('Draggable: onDragStart: %j', coreData);
50508
-
50509
- // Short-circuit if user's callback killed it.
50510
- var shouldStart = _this.props.onStart(e, (0, _positionFns.createDraggableData)(_this, coreData));
50511
- // Kills start event on core as well, so move handlers are never bound.
50512
- if (shouldStart === false) return false;
50513
-
50514
- _this.setState({ dragging: true, dragged: true });
50515
- };
50516
-
50517
- _this.onDrag = function (e, coreData) {
50518
- if (!_this.state.dragging) return false;
50519
- (0, _log2.default)('Draggable: onDrag: %j', coreData);
50520
-
50521
- var uiData = (0, _positionFns.createDraggableData)(_this, coreData);
50522
-
50523
- var newState /*: $Shape<DraggableState>*/ = {
50524
- x: uiData.x,
50525
- y: uiData.y
50526
- };
50527
-
50528
- // Keep within bounds.
50529
- if (_this.props.bounds) {
50530
- // Save original x and y.
50531
- var _x = newState.x,
50532
- _y = newState.y;
50533
-
50534
- // Add slack to the values used to calculate bound position. This will ensure that if
50535
- // we start removing slack, the element won't react to it right away until it's been
50536
- // completely removed.
50537
-
50538
- newState.x += _this.state.slackX;
50539
- newState.y += _this.state.slackY;
50540
-
50541
- // Get bound position. This will ceil/floor the x and y within the boundaries.
50542
- // $FlowBug
50543
-
50544
- // Recalculate slack by noting how much was shaved by the boundPosition handler.
50545
- var _getBoundPosition = (0, _positionFns.getBoundPosition)(_this, newState.x, newState.y);
50546
-
50547
- var _getBoundPosition2 = _slicedToArray(_getBoundPosition, 2);
50548
-
50549
- newState.x = _getBoundPosition2[0];
50550
- newState.y = _getBoundPosition2[1];
50551
- newState.slackX = _this.state.slackX + (_x - newState.x);
50552
- newState.slackY = _this.state.slackY + (_y - newState.y);
50553
-
50554
- // Update the event we fire to reflect what really happened after bounds took effect.
50555
- uiData.x = _x;
50556
- uiData.y = _y;
50557
- uiData.deltaX = newState.x - _this.state.x;
50558
- uiData.deltaY = newState.y - _this.state.y;
50559
- }
50560
-
50561
- // Short-circuit if user's callback killed it.
50562
- var shouldUpdate = _this.props.onDrag(e, uiData);
50563
- if (shouldUpdate === false) return false;
50564
-
50565
- _this.setState(newState);
50566
- };
50567
-
50568
- _this.onDragStop = function (e, coreData) {
50569
- if (!_this.state.dragging) return false;
50570
-
50571
- // Short-circuit if user's callback killed it.
50572
- var shouldStop = _this.props.onStop(e, (0, _positionFns.createDraggableData)(_this, coreData));
50573
- if (shouldStop === false) return false;
50574
-
50575
- (0, _log2.default)('Draggable: onDragStop: %j', coreData);
50576
-
50577
- var newState /*: $Shape<DraggableState>*/ = {
50578
- dragging: false,
50579
- slackX: 0,
50580
- slackY: 0
50581
- };
50582
-
50583
- // If this is a controlled component, the result of this operation will be to
50584
- // revert back to the old position. We expect a handler on `onDragStop`, at the least.
50585
- var controlled = Boolean(_this.props.position);
50586
- if (controlled) {
50587
- var _this$props$position = _this.props.position,
50588
- _x2 = _this$props$position.x,
50589
- _y2 = _this$props$position.y;
50590
-
50591
- newState.x = _x2;
50592
- newState.y = _y2;
50593
- }
50594
-
50595
- _this.setState(newState);
50596
- };
50597
-
50598
- _this.state = {
50599
- // Whether or not we are currently dragging.
50600
- dragging: false,
50601
-
50602
- // Whether or not we have been dragged before.
50603
- dragged: false,
50604
-
50605
- // Current transform x and y.
50606
- x: props.position ? props.position.x : props.defaultPosition.x,
50607
- y: props.position ? props.position.y : props.defaultPosition.y,
50608
-
50609
- // Used for compensating for out-of-bounds drags
50610
- slackX: 0, slackY: 0,
50611
-
50612
- // Can only determine if SVG after mounting
50613
- isElementSVG: false
50614
- };
50615
- return _this;
50373
+ /**
50374
+ * Copyright (c) 2013-present, Facebook, Inc.
50375
+ *
50376
+ * This source code is licensed under the MIT license found in the
50377
+ * LICENSE file in the root directory of this source tree.
50378
+ *
50379
+ *
50380
+ */
50381
+
50382
+ function makeEmptyFunction(arg) {
50383
+ return function () {
50384
+ return arg;
50385
+ };
50386
+ }
50387
+
50388
+ /**
50389
+ * This function accepts and discards inputs; it has no side effects. This is
50390
+ * primarily useful idiomatically for overridable function endpoints which
50391
+ * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
50392
+ */
50393
+ var emptyFunction = function emptyFunction() {};
50394
+
50395
+ emptyFunction.thatReturns = makeEmptyFunction;
50396
+ emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
50397
+ emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
50398
+ emptyFunction.thatReturnsNull = makeEmptyFunction(null);
50399
+ emptyFunction.thatReturnsThis = function () {
50400
+ return this;
50401
+ };
50402
+ emptyFunction.thatReturnsArgument = function (arg) {
50403
+ return arg;
50404
+ };
50405
+
50406
+ var emptyFunction_1 = emptyFunction;
50407
+
50408
+ /**
50409
+ * Copyright (c) 2013-present, Facebook, Inc.
50410
+ *
50411
+ * This source code is licensed under the MIT license found in the
50412
+ * LICENSE file in the root directory of this source tree.
50413
+ *
50414
+ */
50415
+
50416
+ /**
50417
+ * Use invariant() to assert state which your program assumes to be true.
50418
+ *
50419
+ * Provide sprintf-style format (only %s is supported) and arguments
50420
+ * to provide information about what broke and what you were
50421
+ * expecting.
50422
+ *
50423
+ * The invariant message will be stripped in production, but the invariant
50424
+ * will remain to ensure logic does not differ in production.
50425
+ */
50426
+
50427
+ var validateFormat = function validateFormat(format) {};
50428
+
50429
+ {
50430
+ validateFormat = function validateFormat(format) {
50431
+ if (format === undefined) {
50432
+ throw new Error('invariant requires an error message argument');
50433
+ }
50434
+ };
50435
+ }
50436
+
50437
+ function invariant(condition, format, a, b, c, d, e, f) {
50438
+ validateFormat(format);
50439
+
50440
+ if (!condition) {
50441
+ var error;
50442
+ if (format === undefined) {
50443
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
50444
+ } else {
50445
+ var args = [a, b, c, d, e, f];
50446
+ var argIndex = 0;
50447
+ error = new Error(format.replace(/%s/g, function () {
50448
+ return args[argIndex++];
50449
+ }));
50450
+ error.name = 'Invariant Violation';
50451
+ }
50452
+
50453
+ error.framesToPop = 1; // we don't care about invariant's own frame
50454
+ throw error;
50616
50455
  }
50617
-
50618
- _createClass(Draggable, [{
50619
- key: 'componentWillMount',
50620
- value: function componentWillMount() {
50621
- if (this.props.position && !(this.props.onDrag || this.props.onStop)) {
50622
- // eslint-disable-next-line
50623
- 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.');
50624
- }
50456
+ }
50457
+
50458
+ var invariant_1 = invariant;
50459
+
50460
+ /**
50461
+ * Similar to invariant but only logs a warning if the condition is not met.
50462
+ * This can be used to log issues in development environments in critical
50463
+ * paths. Removing the logging code for production environments will keep the
50464
+ * same logic and follow the same code paths.
50465
+ */
50466
+
50467
+ var warning = emptyFunction_1;
50468
+
50469
+ {
50470
+ var printWarning = function printWarning(format) {
50471
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
50472
+ args[_key - 1] = arguments[_key];
50625
50473
  }
50626
- }, {
50627
- key: 'componentDidMount',
50628
- value: function componentDidMount() {
50629
- // Check to see if the element passed is an instanceof SVGElement
50630
- if (typeof SVGElement !== 'undefined' && _reactDom2.default.findDOMNode(this) instanceof SVGElement) {
50631
- this.setState({ isElementSVG: true });
50632
- }
50474
+
50475
+ var argIndex = 0;
50476
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
50477
+ return args[argIndex++];
50478
+ });
50479
+ if (typeof console !== 'undefined') {
50480
+ console.error(message);
50633
50481
  }
50634
- }, {
50635
- key: 'componentWillReceiveProps',
50636
- value: function componentWillReceiveProps(nextProps /*: Object*/) {
50637
- // Set x/y if position has changed
50638
- if (nextProps.position && (!this.props.position || nextProps.position.x !== this.props.position.x || nextProps.position.y !== this.props.position.y)) {
50639
- this.setState({ x: nextProps.position.x, y: nextProps.position.y });
50640
- }
50482
+ try {
50483
+ // --- Welcome to debugging React ---
50484
+ // This error was thrown as a convenience so that you can use this stack
50485
+ // to find the callsite that caused this warning to fire.
50486
+ throw new Error(message);
50487
+ } catch (x) {}
50488
+ };
50489
+
50490
+ warning = function warning(condition, format) {
50491
+ if (format === undefined) {
50492
+ throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
50641
50493
  }
50642
- }, {
50643
- key: 'componentWillUnmount',
50644
- value: function componentWillUnmount() {
50645
- this.setState({ dragging: false }); // prevents invariant if unmounted while dragging
50494
+
50495
+ if (format.indexOf('Failed Composite propType: ') === 0) {
50496
+ return; // Ignore CompositeComponent proptype check.
50646
50497
  }
50647
- }, {
50648
- key: 'render',
50649
- value: function render() /*: React.Element<any>*/ {
50650
- var _classNames;
50651
-
50652
- var style = {},
50653
- svgTransform = null;
50654
-
50655
- // If this is controlled, we don't want to move it - unless it's dragging.
50656
- var controlled = Boolean(this.props.position);
50657
- var draggable = !controlled || this.state.dragging;
50658
-
50659
- var position = this.props.position || this.props.defaultPosition;
50660
- var transformOpts = {
50661
- // Set left if horizontal drag is enabled
50662
- x: (0, _positionFns.canDragX)(this) && draggable ? this.state.x : position.x,
50663
-
50664
- // Set top if vertical drag is enabled
50665
- y: (0, _positionFns.canDragY)(this) && draggable ? this.state.y : position.y
50666
- };
50667
-
50668
- // If this element was SVG, we use the `transform` attribute.
50669
- if (this.state.isElementSVG) {
50670
- svgTransform = (0, _domFns.createSVGTransform)(transformOpts);
50671
- } else {
50672
- // Add a CSS transform to move the element around. This allows us to move the element around
50673
- // without worrying about whether or not it is relatively or absolutely positioned.
50674
- // If the item you are dragging already has a transform set, wrap it in a <span> so <Draggable>
50675
- // has a clean slate.
50676
- style = (0, _domFns.createCSSTransform)(transformOpts);
50498
+
50499
+ if (!condition) {
50500
+ for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
50501
+ args[_key2 - 2] = arguments[_key2];
50677
50502
  }
50678
-
50679
- var _props = this.props,
50680
- defaultClassName = _props.defaultClassName,
50681
- defaultClassNameDragging = _props.defaultClassNameDragging,
50682
- defaultClassNameDragged = _props.defaultClassNameDragged;
50683
-
50684
- // Mark with class while dragging
50685
-
50686
- var className = (0, _classnames2.default)(this.props.children.props.className || '', defaultClassName, (_classNames = {}, _defineProperty(_classNames, defaultClassNameDragging, this.state.dragging), _defineProperty(_classNames, defaultClassNameDragged, this.state.dragged), _classNames));
50687
-
50688
- // Reuse the child provided
50689
- // This makes it flexible to use whatever element is wanted (div, ul, etc)
50690
- return _react2.default.createElement(
50691
- _DraggableCore2.default,
50692
- _extends({}, this.props, { onStart: this.onDragStart, onDrag: this.onDrag, onStop: this.onDragStop }),
50693
- _react2.default.cloneElement(_react2.default.Children.only(this.props.children), {
50694
- className: className,
50695
- style: _extends({}, this.props.children.props.style, style),
50696
- transform: svgTransform
50697
- })
50698
- );
50503
+
50504
+ printWarning.apply(undefined, [format].concat(args));
50699
50505
  }
50700
- }]);
50701
-
50702
- return Draggable;
50703
- }(_react2.default.Component);
50704
-
50705
- Draggable.displayName = 'Draggable';
50706
- Draggable.propTypes = _extends({}, _DraggableCore2.default.propTypes, {
50707
-
50708
- /**
50709
- * `axis` determines which axis the draggable can move.
50710
- *
50711
- * Note that all callbacks will still return data as normal. This only
50712
- * controls flushing to the DOM.
50713
- *
50714
- * 'both' allows movement horizontally and vertically.
50715
- * 'x' limits movement to horizontal axis.
50716
- * 'y' limits movement to vertical axis.
50717
- * 'none' limits all movement.
50718
- *
50719
- * Defaults to 'both'.
50720
- */
50721
- axis: _propTypes2.default.oneOf(['both', 'x', 'y', 'none']),
50722
-
50723
- /**
50724
- * `bounds` determines the range of movement available to the element.
50725
- * Available values are:
50726
- *
50727
- * 'parent' restricts movement within the Draggable's parent node.
50728
- *
50729
- * Alternatively, pass an object with the following properties, all of which are optional:
50730
- *
50731
- * {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND}
50732
- *
50733
- * All values are in px.
50734
- *
50735
- * Example:
50736
- *
50737
- * ```jsx
50738
- * let App = React.createClass({
50739
- * render: function () {
50740
- * return (
50741
- * <Draggable bounds={{right: 300, bottom: 300}}>
50742
- * <div>Content</div>
50743
- * </Draggable>
50744
- * );
50745
- * }
50746
- * });
50747
- * ```
50748
- */
50749
- bounds: _propTypes2.default.oneOfType([_propTypes2.default.shape({
50750
- left: _propTypes2.default.number,
50751
- right: _propTypes2.default.number,
50752
- top: _propTypes2.default.number,
50753
- bottom: _propTypes2.default.number
50754
- }), _propTypes2.default.string, _propTypes2.default.oneOf([false])]),
50755
-
50756
- defaultClassName: _propTypes2.default.string,
50757
- defaultClassNameDragging: _propTypes2.default.string,
50758
- defaultClassNameDragged: _propTypes2.default.string,
50759
-
50760
- /**
50761
- * `defaultPosition` specifies the x and y that the dragged item should start at
50762
- *
50763
- * Example:
50764
- *
50765
- * ```jsx
50766
- * let App = React.createClass({
50767
- * render: function () {
50768
- * return (
50769
- * <Draggable defaultPosition={{x: 25, y: 25}}>
50770
- * <div>I start with transformX: 25px and transformY: 25px;</div>
50771
- * </Draggable>
50772
- * );
50773
- * }
50774
- * });
50775
- * ```
50776
- */
50777
- defaultPosition: _propTypes2.default.shape({
50778
- x: _propTypes2.default.number,
50779
- y: _propTypes2.default.number
50780
- }),
50781
-
50782
- /**
50783
- * `position`, if present, defines the current position of the element.
50784
- *
50785
- * This is similar to how form elements in React work - if no `position` is supplied, the component
50786
- * is uncontrolled.
50787
- *
50788
- * Example:
50789
- *
50790
- * ```jsx
50791
- * let App = React.createClass({
50792
- * render: function () {
50793
- * return (
50794
- * <Draggable position={{x: 25, y: 25}}>
50795
- * <div>I start with transformX: 25px and transformY: 25px;</div>
50796
- * </Draggable>
50797
- * );
50798
- * }
50799
- * });
50800
- * ```
50801
- */
50802
- position: _propTypes2.default.shape({
50803
- x: _propTypes2.default.number,
50804
- y: _propTypes2.default.number
50805
- }),
50806
-
50807
- /**
50808
- * These properties should be defined on the child, not here.
50809
- */
50810
- className: _shims.dontSetMe,
50811
- style: _shims.dontSetMe,
50812
- transform: _shims.dontSetMe
50813
- });
50814
- Draggable.defaultProps = _extends({}, _DraggableCore2.default.defaultProps, {
50815
- axis: 'both',
50816
- bounds: false,
50817
- defaultClassName: 'react-draggable',
50818
- defaultClassNameDragging: 'react-draggable-dragging',
50819
- defaultClassNameDragged: 'react-draggable-dragged',
50820
- defaultPosition: { x: 0, y: 0 },
50821
- position: null
50822
- });
50823
- exports.default = Draggable;
50506
+ };
50507
+ }
50508
+
50509
+ var warning_1 = warning;
50510
+
50511
+ /*
50512
+ object-assign
50513
+ (c) Sindre Sorhus
50514
+ @license MIT
50515
+ */
50516
+ /* eslint-disable no-unused-vars */
50517
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
50518
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
50519
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
50520
+
50521
+ function toObject(val) {
50522
+ if (val === null || val === undefined) {
50523
+ throw new TypeError('Object.assign cannot be called with null or undefined');
50524
+ }
50525
+
50526
+ return Object(val);
50527
+ }
50528
+
50529
+ function shouldUseNative() {
50530
+ try {
50531
+ if (!Object.assign) {
50532
+ return false;
50533
+ }
50534
+
50535
+ // Detect buggy property enumeration order in older V8 versions.
50536
+
50537
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
50538
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
50539
+ test1[5] = 'de';
50540
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
50541
+ return false;
50542
+ }
50543
+
50544
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
50545
+ var test2 = {};
50546
+ for (var i = 0; i < 10; i++) {
50547
+ test2['_' + String.fromCharCode(i)] = i;
50548
+ }
50549
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
50550
+ return test2[n];
50551
+ });
50552
+ if (order2.join('') !== '0123456789') {
50553
+ return false;
50554
+ }
50555
+
50556
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
50557
+ var test3 = {};
50558
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
50559
+ test3[letter] = letter;
50560
+ });
50561
+ if (Object.keys(Object.assign({}, test3)).join('') !==
50562
+ 'abcdefghijklmnopqrst') {
50563
+ return false;
50564
+ }
50565
+
50566
+ return true;
50567
+ } catch (err) {
50568
+ // We don't expect any of the above to throw, but better to be safe.
50569
+ return false;
50570
+ }
50571
+ }
50572
+
50573
+ var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
50574
+ var from;
50575
+ var to = toObject(target);
50576
+ var symbols;
50824
50577
 
50825
- /***/ },
50826
- /* 2 */
50827
- /***/ function(module, exports) {
50578
+ for (var s = 1; s < arguments.length; s++) {
50579
+ from = Object(arguments[s]);
50828
50580
 
50829
- module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
50581
+ for (var key in from) {
50582
+ if (hasOwnProperty.call(from, key)) {
50583
+ to[key] = from[key];
50584
+ }
50585
+ }
50586
+
50587
+ if (getOwnPropertySymbols) {
50588
+ symbols = getOwnPropertySymbols(from);
50589
+ for (var i = 0; i < symbols.length; i++) {
50590
+ if (propIsEnumerable.call(from, symbols[i])) {
50591
+ to[symbols[i]] = from[symbols[i]];
50592
+ }
50593
+ }
50594
+ }
50595
+ }
50830
50596
 
50831
- /***/ },
50832
- /* 3 */
50833
- /***/ function(module, exports, __webpack_require__) {
50597
+ return to;
50598
+ };
50834
50599
 
50835
50600
  /**
50836
- * Copyright 2013-present, Facebook, Inc.
50837
- * All rights reserved.
50601
+ * Copyright (c) 2013-present, Facebook, Inc.
50838
50602
  *
50839
- * This source code is licensed under the BSD-style license found in the
50840
- * LICENSE file in the root directory of this source tree. An additional grant
50841
- * of patent rights can be found in the PATENTS file in the same directory.
50603
+ * This source code is licensed under the MIT license found in the
50604
+ * LICENSE file in the root directory of this source tree.
50842
50605
  */
50843
-
50844
- if (({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
50845
- var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
50846
- Symbol.for &&
50847
- Symbol.for('react.element')) ||
50848
- 0xeac7;
50849
-
50850
- var isValidElement = function(object) {
50851
- return typeof object === 'object' &&
50852
- object !== null &&
50853
- object.$$typeof === REACT_ELEMENT_TYPE;
50854
- };
50855
-
50856
- // By explicitly using `prop-types` you are opting into new development behavior.
50857
- // http://fb.me/prop-types-in-prod
50858
- var throwOnDirectAccess = true;
50859
- module.exports = __webpack_require__(4)(isValidElement, throwOnDirectAccess);
50860
- } else {
50861
- // By explicitly using `prop-types` you are opting into new production behavior.
50862
- // http://fb.me/prop-types-in-prod
50863
- module.exports = __webpack_require__(10)();
50864
- }
50865
50606
 
50607
+ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
50608
+
50609
+ var ReactPropTypesSecret_1 = ReactPropTypesSecret;
50866
50610
 
50867
- /***/ },
50868
- /* 4 */
50869
- /***/ function(module, exports, __webpack_require__) {
50611
+ {
50612
+ var invariant$1 = invariant_1;
50613
+ var warning$1 = warning_1;
50614
+ var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
50615
+ var loggedTypeFailures = {};
50616
+ }
50870
50617
 
50871
50618
  /**
50872
- * Copyright 2013-present, Facebook, Inc.
50873
- * All rights reserved.
50619
+ * Assert that the values match with the type specs.
50620
+ * Error messages are memorized and will only be shown once.
50874
50621
  *
50875
- * This source code is licensed under the BSD-style license found in the
50876
- * LICENSE file in the root directory of this source tree. An additional grant
50877
- * of patent rights can be found in the PATENTS file in the same directory.
50622
+ * @param {object} typeSpecs Map of name to a ReactPropType
50623
+ * @param {object} values Runtime values that need to be type-checked
50624
+ * @param {string} location e.g. "prop", "context", "child context"
50625
+ * @param {string} componentName Name of the component for error messages.
50626
+ * @param {?Function} getStack Returns the component stack.
50627
+ * @private
50878
50628
  */
50879
-
50880
- 'use strict';
50881
-
50882
- var emptyFunction = __webpack_require__(5);
50883
- var invariant = __webpack_require__(6);
50884
- var warning = __webpack_require__(7);
50885
-
50886
- var ReactPropTypesSecret = __webpack_require__(8);
50887
- var checkPropTypes = __webpack_require__(9);
50888
-
50889
- module.exports = function(isValidElement, throwOnDirectAccess) {
50629
+ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
50630
+ {
50631
+ for (var typeSpecName in typeSpecs) {
50632
+ if (typeSpecs.hasOwnProperty(typeSpecName)) {
50633
+ var error;
50634
+ // Prop type validation may throw. In case they do, we don't want to
50635
+ // fail the render phase where it didn't fail before. So we log it.
50636
+ // After these have been cleaned up, we'll let them throw.
50637
+ try {
50638
+ // This is intentionally an invariant that gets caught. It's the same
50639
+ // behavior as without this statement except with a better message.
50640
+ invariant$1(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]);
50641
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
50642
+ } catch (ex) {
50643
+ error = ex;
50644
+ }
50645
+ warning$1(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
50646
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
50647
+ // Only monitor this failure once because there tends to be a lot of the
50648
+ // same error.
50649
+ loggedTypeFailures[error.message] = true;
50650
+
50651
+ var stack = getStack ? getStack() : '';
50652
+
50653
+ warning$1(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
50654
+ }
50655
+ }
50656
+ }
50657
+ }
50658
+ }
50659
+
50660
+ var checkPropTypes_1 = checkPropTypes;
50661
+
50662
+ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
50890
50663
  /* global Symbol */
50891
50664
  var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
50892
50665
  var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
50893
-
50666
+
50894
50667
  /**
50895
50668
  * Returns the iterator method function contained on the iterable object.
50896
50669
  *
@@ -50911,7 +50684,7 @@ module.exports =
50911
50684
  return iteratorFn;
50912
50685
  }
50913
50686
  }
50914
-
50687
+
50915
50688
  /**
50916
50689
  * Collection of methods that allow declaration and validation of props that are
50917
50690
  * supplied to React components. Example usage:
@@ -50958,9 +50731,9 @@ module.exports =
50958
50731
  *
50959
50732
  * @internal
50960
50733
  */
50961
-
50734
+
50962
50735
  var ANONYMOUS = '<<anonymous>>';
50963
-
50736
+
50964
50737
  // Important!
50965
50738
  // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
50966
50739
  var ReactPropTypes = {
@@ -50971,7 +50744,7 @@ module.exports =
50971
50744
  object: createPrimitiveTypeChecker('object'),
50972
50745
  string: createPrimitiveTypeChecker('string'),
50973
50746
  symbol: createPrimitiveTypeChecker('symbol'),
50974
-
50747
+
50975
50748
  any: createAnyTypeChecker(),
50976
50749
  arrayOf: createArrayOfTypeChecker,
50977
50750
  element: createElementTypeChecker(),
@@ -50980,9 +50753,10 @@ module.exports =
50980
50753
  objectOf: createObjectOfTypeChecker,
50981
50754
  oneOf: createEnumTypeChecker,
50982
50755
  oneOfType: createUnionTypeChecker,
50983
- shape: createShapeTypeChecker
50756
+ shape: createShapeTypeChecker,
50757
+ exact: createStrictShapeTypeChecker,
50984
50758
  };
50985
-
50759
+
50986
50760
  /**
50987
50761
  * inlined Object.is polyfill to avoid requiring consumers ship their own
50988
50762
  * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
@@ -51000,7 +50774,7 @@ module.exports =
51000
50774
  }
51001
50775
  }
51002
50776
  /*eslint-enable no-self-compare*/
51003
-
50777
+
51004
50778
  /**
51005
50779
  * We use an Error-like object for backward compatibility as people may call
51006
50780
  * PropTypes directly and inspect their output. However, we don't use real
@@ -51014,26 +50788,26 @@ module.exports =
51014
50788
  }
51015
50789
  // Make `instanceof Error` still work for returned errors.
51016
50790
  PropTypeError.prototype = Error.prototype;
51017
-
50791
+
51018
50792
  function createChainableTypeChecker(validate) {
51019
- if (({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
50793
+ {
51020
50794
  var manualPropTypeCallCache = {};
51021
50795
  var manualPropTypeWarningCount = 0;
51022
50796
  }
51023
50797
  function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
51024
50798
  componentName = componentName || ANONYMOUS;
51025
50799
  propFullName = propFullName || propName;
51026
-
51027
- if (secret !== ReactPropTypesSecret) {
50800
+
50801
+ if (secret !== ReactPropTypesSecret_1) {
51028
50802
  if (throwOnDirectAccess) {
51029
50803
  // New behavior only for users of `prop-types` package
51030
- invariant(
50804
+ invariant_1(
51031
50805
  false,
51032
50806
  'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
51033
50807
  'Use `PropTypes.checkPropTypes()` to call them. ' +
51034
50808
  'Read more at http://fb.me/use-check-prop-types'
51035
50809
  );
51036
- } else if (({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production' && typeof console !== 'undefined') {
50810
+ } else if ("development" !== 'production' && typeof console !== 'undefined') {
51037
50811
  // Old behavior for people using React.PropTypes
51038
50812
  var cacheKey = componentName + ':' + propName;
51039
50813
  if (
@@ -51041,7 +50815,7 @@ module.exports =
51041
50815
  // Avoid spamming the console because they are often not actionable except for lib authors
51042
50816
  manualPropTypeWarningCount < 3
51043
50817
  ) {
51044
- warning(
50818
+ warning_1(
51045
50819
  false,
51046
50820
  'You are manually calling a React.PropTypes validation ' +
51047
50821
  'function for the `%s` prop on `%s`. This is deprecated ' +
@@ -51068,13 +50842,13 @@ module.exports =
51068
50842
  return validate(props, propName, componentName, location, propFullName);
51069
50843
  }
51070
50844
  }
51071
-
50845
+
51072
50846
  var chainedCheckType = checkType.bind(null, false);
51073
50847
  chainedCheckType.isRequired = checkType.bind(null, true);
51074
-
50848
+
51075
50849
  return chainedCheckType;
51076
50850
  }
51077
-
50851
+
51078
50852
  function createPrimitiveTypeChecker(expectedType) {
51079
50853
  function validate(props, propName, componentName, location, propFullName, secret) {
51080
50854
  var propValue = props[propName];
@@ -51084,18 +50858,18 @@ module.exports =
51084
50858
  // check, but we can offer a more precise error message here rather than
51085
50859
  // 'of type `object`'.
51086
50860
  var preciseType = getPreciseType(propValue);
51087
-
50861
+
51088
50862
  return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
51089
50863
  }
51090
50864
  return null;
51091
50865
  }
51092
50866
  return createChainableTypeChecker(validate);
51093
50867
  }
51094
-
50868
+
51095
50869
  function createAnyTypeChecker() {
51096
- return createChainableTypeChecker(emptyFunction.thatReturnsNull);
50870
+ return createChainableTypeChecker(emptyFunction_1.thatReturnsNull);
51097
50871
  }
51098
-
50872
+
51099
50873
  function createArrayOfTypeChecker(typeChecker) {
51100
50874
  function validate(props, propName, componentName, location, propFullName) {
51101
50875
  if (typeof typeChecker !== 'function') {
@@ -51107,7 +50881,7 @@ module.exports =
51107
50881
  return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
51108
50882
  }
51109
50883
  for (var i = 0; i < propValue.length; i++) {
51110
- var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
50884
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
51111
50885
  if (error instanceof Error) {
51112
50886
  return error;
51113
50887
  }
@@ -51116,7 +50890,7 @@ module.exports =
51116
50890
  }
51117
50891
  return createChainableTypeChecker(validate);
51118
50892
  }
51119
-
50893
+
51120
50894
  function createElementTypeChecker() {
51121
50895
  function validate(props, propName, componentName, location, propFullName) {
51122
50896
  var propValue = props[propName];
@@ -51128,7 +50902,7 @@ module.exports =
51128
50902
  }
51129
50903
  return createChainableTypeChecker(validate);
51130
50904
  }
51131
-
50905
+
51132
50906
  function createInstanceTypeChecker(expectedClass) {
51133
50907
  function validate(props, propName, componentName, location, propFullName) {
51134
50908
  if (!(props[propName] instanceof expectedClass)) {
@@ -51140,13 +50914,13 @@ module.exports =
51140
50914
  }
51141
50915
  return createChainableTypeChecker(validate);
51142
50916
  }
51143
-
50917
+
51144
50918
  function createEnumTypeChecker(expectedValues) {
51145
50919
  if (!Array.isArray(expectedValues)) {
51146
- ({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
51147
- return emptyFunction.thatReturnsNull;
50920
+ warning_1(false, 'Invalid argument supplied to oneOf, expected an instance of array.');
50921
+ return emptyFunction_1.thatReturnsNull;
51148
50922
  }
51149
-
50923
+
51150
50924
  function validate(props, propName, componentName, location, propFullName) {
51151
50925
  var propValue = props[propName];
51152
50926
  for (var i = 0; i < expectedValues.length; i++) {
@@ -51154,13 +50928,13 @@ module.exports =
51154
50928
  return null;
51155
50929
  }
51156
50930
  }
51157
-
50931
+
51158
50932
  var valuesString = JSON.stringify(expectedValues);
51159
50933
  return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
51160
50934
  }
51161
50935
  return createChainableTypeChecker(validate);
51162
50936
  }
51163
-
50937
+
51164
50938
  function createObjectOfTypeChecker(typeChecker) {
51165
50939
  function validate(props, propName, componentName, location, propFullName) {
51166
50940
  if (typeof typeChecker !== 'function') {
@@ -51173,7 +50947,7 @@ module.exports =
51173
50947
  }
51174
50948
  for (var key in propValue) {
51175
50949
  if (propValue.hasOwnProperty(key)) {
51176
- var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
50950
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
51177
50951
  if (error instanceof Error) {
51178
50952
  return error;
51179
50953
  }
@@ -51183,26 +50957,40 @@ module.exports =
51183
50957
  }
51184
50958
  return createChainableTypeChecker(validate);
51185
50959
  }
51186
-
50960
+
51187
50961
  function createUnionTypeChecker(arrayOfTypeCheckers) {
51188
50962
  if (!Array.isArray(arrayOfTypeCheckers)) {
51189
- ({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
51190
- return emptyFunction.thatReturnsNull;
50963
+ warning_1(false, 'Invalid argument supplied to oneOfType, expected an instance of array.');
50964
+ return emptyFunction_1.thatReturnsNull;
50965
+ }
50966
+
50967
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
50968
+ var checker = arrayOfTypeCheckers[i];
50969
+ if (typeof checker !== 'function') {
50970
+ warning_1(
50971
+ false,
50972
+ 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
50973
+ 'received %s at index %s.',
50974
+ getPostfixForTypeWarning(checker),
50975
+ i
50976
+ );
50977
+ return emptyFunction_1.thatReturnsNull;
50978
+ }
51191
50979
  }
51192
-
50980
+
51193
50981
  function validate(props, propName, componentName, location, propFullName) {
51194
50982
  for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
51195
50983
  var checker = arrayOfTypeCheckers[i];
51196
- if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
50984
+ if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
51197
50985
  return null;
51198
50986
  }
51199
50987
  }
51200
-
50988
+
51201
50989
  return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
51202
50990
  }
51203
50991
  return createChainableTypeChecker(validate);
51204
50992
  }
51205
-
50993
+
51206
50994
  function createNodeChecker() {
51207
50995
  function validate(props, propName, componentName, location, propFullName) {
51208
50996
  if (!isNode(props[propName])) {
@@ -51212,7 +51000,7 @@ module.exports =
51212
51000
  }
51213
51001
  return createChainableTypeChecker(validate);
51214
51002
  }
51215
-
51003
+
51216
51004
  function createShapeTypeChecker(shapeTypes) {
51217
51005
  function validate(props, propName, componentName, location, propFullName) {
51218
51006
  var propValue = props[propName];
@@ -51225,16 +51013,46 @@ module.exports =
51225
51013
  if (!checker) {
51226
51014
  continue;
51227
51015
  }
51228
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
51016
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
51017
+ if (error) {
51018
+ return error;
51019
+ }
51020
+ }
51021
+ return null;
51022
+ }
51023
+ return createChainableTypeChecker(validate);
51024
+ }
51025
+
51026
+ function createStrictShapeTypeChecker(shapeTypes) {
51027
+ function validate(props, propName, componentName, location, propFullName) {
51028
+ var propValue = props[propName];
51029
+ var propType = getPropType(propValue);
51030
+ if (propType !== 'object') {
51031
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
51032
+ }
51033
+ // We need to check all keys in case some are required but missing from
51034
+ // props.
51035
+ var allKeys = objectAssign({}, props[propName], shapeTypes);
51036
+ for (var key in allKeys) {
51037
+ var checker = shapeTypes[key];
51038
+ if (!checker) {
51039
+ return new PropTypeError(
51040
+ 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
51041
+ '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
51042
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
51043
+ );
51044
+ }
51045
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
51229
51046
  if (error) {
51230
51047
  return error;
51231
51048
  }
51232
51049
  }
51233
51050
  return null;
51234
51051
  }
51052
+
51235
51053
  return createChainableTypeChecker(validate);
51236
51054
  }
51237
-
51055
+
51238
51056
  function isNode(propValue) {
51239
51057
  switch (typeof propValue) {
51240
51058
  case 'number':
@@ -51250,7 +51068,7 @@ module.exports =
51250
51068
  if (propValue === null || isValidElement(propValue)) {
51251
51069
  return true;
51252
51070
  }
51253
-
51071
+
51254
51072
  var iteratorFn = getIteratorFn(propValue);
51255
51073
  if (iteratorFn) {
51256
51074
  var iterator = iteratorFn.call(propValue);
@@ -51275,32 +51093,32 @@ module.exports =
51275
51093
  } else {
51276
51094
  return false;
51277
51095
  }
51278
-
51096
+
51279
51097
  return true;
51280
51098
  default:
51281
51099
  return false;
51282
51100
  }
51283
51101
  }
51284
-
51102
+
51285
51103
  function isSymbol(propType, propValue) {
51286
51104
  // Native Symbol.
51287
51105
  if (propType === 'symbol') {
51288
51106
  return true;
51289
51107
  }
51290
-
51108
+
51291
51109
  // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
51292
51110
  if (propValue['@@toStringTag'] === 'Symbol') {
51293
51111
  return true;
51294
51112
  }
51295
-
51113
+
51296
51114
  // Fallback for non-spec compliant Symbols which are polyfilled.
51297
51115
  if (typeof Symbol === 'function' && propValue instanceof Symbol) {
51298
51116
  return true;
51299
51117
  }
51300
-
51118
+
51301
51119
  return false;
51302
51120
  }
51303
-
51121
+
51304
51122
  // Equivalent of `typeof` but with special handling for array and regexp.
51305
51123
  function getPropType(propValue) {
51306
51124
  var propType = typeof propValue;
@@ -51318,10 +51136,13 @@ module.exports =
51318
51136
  }
51319
51137
  return propType;
51320
51138
  }
51321
-
51139
+
51322
51140
  // This handles more types than `getPropType`. Only used for error messages.
51323
51141
  // See `createPrimitiveTypeChecker`.
51324
51142
  function getPreciseType(propValue) {
51143
+ if (typeof propValue === 'undefined' || propValue === null) {
51144
+ return '' + propValue;
51145
+ }
51325
51146
  var propType = getPropType(propValue);
51326
51147
  if (propType === 'object') {
51327
51148
  if (propValue instanceof Date) {
@@ -51332,7 +51153,24 @@ module.exports =
51332
51153
  }
51333
51154
  return propType;
51334
51155
  }
51335
-
51156
+
51157
+ // Returns a string that is postfixed to a warning about an invalid type.
51158
+ // For example, "undefined" or "of type array"
51159
+ function getPostfixForTypeWarning(value) {
51160
+ var type = getPreciseType(value);
51161
+ switch (type) {
51162
+ case 'array':
51163
+ case 'object':
51164
+ return 'an ' + type;
51165
+ case 'boolean':
51166
+ case 'date':
51167
+ case 'regexp':
51168
+ return 'a ' + type;
51169
+ default:
51170
+ return type;
51171
+ }
51172
+ }
51173
+
51336
51174
  // Returns class name of the object, if any.
51337
51175
  function getClassName(propValue) {
51338
51176
  if (!propValue.constructor || !propValue.constructor.name) {
@@ -51340,366 +51178,61 @@ module.exports =
51340
51178
  }
51341
51179
  return propValue.constructor.name;
51342
51180
  }
51343
-
51344
- ReactPropTypes.checkPropTypes = checkPropTypes;
51181
+
51182
+ ReactPropTypes.checkPropTypes = checkPropTypes_1;
51345
51183
  ReactPropTypes.PropTypes = ReactPropTypes;
51346
-
51184
+
51347
51185
  return ReactPropTypes;
51348
51186
  };
51349
51187
 
51350
-
51351
- /***/ },
51352
- /* 5 */
51353
- /***/ function(module, exports) {
51354
-
51355
- "use strict";
51356
-
51188
+ var propTypes = createCommonjsModule(function (module) {
51357
51189
  /**
51358
51190
  * Copyright (c) 2013-present, Facebook, Inc.
51359
- * All rights reserved.
51360
- *
51361
- * This source code is licensed under the BSD-style license found in the
51362
- * LICENSE file in the root directory of this source tree. An additional grant
51363
- * of patent rights can be found in the PATENTS file in the same directory.
51364
51191
  *
51365
- *
51192
+ * This source code is licensed under the MIT license found in the
51193
+ * LICENSE file in the root directory of this source tree.
51366
51194
  */
51367
-
51368
- function makeEmptyFunction(arg) {
51369
- return function () {
51370
- return arg;
51195
+
51196
+ {
51197
+ var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
51198
+ Symbol.for &&
51199
+ Symbol.for('react.element')) ||
51200
+ 0xeac7;
51201
+
51202
+ var isValidElement = function(object) {
51203
+ return typeof object === 'object' &&
51204
+ object !== null &&
51205
+ object.$$typeof === REACT_ELEMENT_TYPE;
51371
51206
  };
51207
+
51208
+ // By explicitly using `prop-types` you are opting into new development behavior.
51209
+ // http://fb.me/prop-types-in-prod
51210
+ var throwOnDirectAccess = true;
51211
+ module.exports = factoryWithTypeCheckers(isValidElement, throwOnDirectAccess);
51372
51212
  }
51373
-
51374
- /**
51375
- * This function accepts and discards inputs; it has no side effects. This is
51376
- * primarily useful idiomatically for overridable function endpoints which
51377
- * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
51378
- */
51379
- var emptyFunction = function emptyFunction() {};
51380
-
51381
- emptyFunction.thatReturns = makeEmptyFunction;
51382
- emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
51383
- emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
51384
- emptyFunction.thatReturnsNull = makeEmptyFunction(null);
51385
- emptyFunction.thatReturnsThis = function () {
51386
- return this;
51387
- };
51388
- emptyFunction.thatReturnsArgument = function (arg) {
51389
- return arg;
51390
- };
51391
-
51392
- module.exports = emptyFunction;
51393
-
51394
- /***/ },
51395
- /* 6 */
51396
- /***/ function(module, exports, __webpack_require__) {
51397
-
51398
- /**
51399
- * Copyright (c) 2013-present, Facebook, Inc.
51400
- * All rights reserved.
51401
- *
51402
- * This source code is licensed under the BSD-style license found in the
51403
- * LICENSE file in the root directory of this source tree. An additional grant
51404
- * of patent rights can be found in the PATENTS file in the same directory.
51405
- *
51406
- */
51407
-
51408
- 'use strict';
51409
-
51410
- /**
51411
- * Use invariant() to assert state which your program assumes to be true.
51412
- *
51413
- * Provide sprintf-style format (only %s is supported) and arguments
51414
- * to provide information about what broke and what you were
51415
- * expecting.
51416
- *
51417
- * The invariant message will be stripped in production, but the invariant
51418
- * will remain to ensure logic does not differ in production.
51419
- */
51420
-
51421
- var validateFormat = function validateFormat(format) {};
51422
-
51423
- if (({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
51424
- validateFormat = function validateFormat(format) {
51425
- if (format === undefined) {
51426
- throw new Error('invariant requires an error message argument');
51427
- }
51428
- };
51429
- }
51430
-
51431
- function invariant(condition, format, a, b, c, d, e, f) {
51432
- validateFormat(format);
51433
-
51434
- if (!condition) {
51435
- var error;
51436
- if (format === undefined) {
51437
- error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
51438
- } else {
51439
- var args = [a, b, c, d, e, f];
51440
- var argIndex = 0;
51441
- error = new Error(format.replace(/%s/g, function () {
51442
- return args[argIndex++];
51443
- }));
51444
- error.name = 'Invariant Violation';
51445
- }
51446
-
51447
- error.framesToPop = 1; // we don't care about invariant's own frame
51448
- throw error;
51449
- }
51450
- }
51451
-
51452
- module.exports = invariant;
51453
-
51454
- /***/ },
51455
- /* 7 */
51456
- /***/ function(module, exports, __webpack_require__) {
51457
-
51458
- /**
51459
- * Copyright 2014-2015, Facebook, Inc.
51460
- * All rights reserved.
51461
- *
51462
- * This source code is licensed under the BSD-style license found in the
51463
- * LICENSE file in the root directory of this source tree. An additional grant
51464
- * of patent rights can be found in the PATENTS file in the same directory.
51465
- *
51466
- */
51467
-
51468
- 'use strict';
51469
-
51470
- var emptyFunction = __webpack_require__(5);
51471
-
51472
- /**
51473
- * Similar to invariant but only logs a warning if the condition is not met.
51474
- * This can be used to log issues in development environments in critical
51475
- * paths. Removing the logging code for production environments will keep the
51476
- * same logic and follow the same code paths.
51477
- */
51478
-
51479
- var warning = emptyFunction;
51480
-
51481
- if (({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
51482
- (function () {
51483
- var printWarning = function printWarning(format) {
51484
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
51485
- args[_key - 1] = arguments[_key];
51486
- }
51487
-
51488
- var argIndex = 0;
51489
- var message = 'Warning: ' + format.replace(/%s/g, function () {
51490
- return args[argIndex++];
51491
- });
51492
- if (typeof console !== 'undefined') {
51493
- console.error(message);
51494
- }
51495
- try {
51496
- // --- Welcome to debugging React ---
51497
- // This error was thrown as a convenience so that you can use this stack
51498
- // to find the callsite that caused this warning to fire.
51499
- throw new Error(message);
51500
- } catch (x) {}
51501
- };
51502
-
51503
- warning = function warning(condition, format) {
51504
- if (format === undefined) {
51505
- throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
51506
- }
51507
-
51508
- if (format.indexOf('Failed Composite propType: ') === 0) {
51509
- return; // Ignore CompositeComponent proptype check.
51510
- }
51511
-
51512
- if (!condition) {
51513
- for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
51514
- args[_key2 - 2] = arguments[_key2];
51515
- }
51516
-
51517
- printWarning.apply(undefined, [format].concat(args));
51518
- }
51519
- };
51520
- })();
51521
- }
51522
-
51523
- module.exports = warning;
51524
-
51525
- /***/ },
51526
- /* 8 */
51527
- /***/ function(module, exports) {
51528
-
51529
- /**
51530
- * Copyright 2013-present, Facebook, Inc.
51531
- * All rights reserved.
51532
- *
51533
- * This source code is licensed under the BSD-style license found in the
51534
- * LICENSE file in the root directory of this source tree. An additional grant
51535
- * of patent rights can be found in the PATENTS file in the same directory.
51536
- */
51537
-
51538
- 'use strict';
51539
-
51540
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
51541
-
51542
- module.exports = ReactPropTypesSecret;
51543
-
51544
-
51545
- /***/ },
51546
- /* 9 */
51547
- /***/ function(module, exports, __webpack_require__) {
51548
-
51549
- /**
51550
- * Copyright 2013-present, Facebook, Inc.
51551
- * All rights reserved.
51552
- *
51553
- * This source code is licensed under the BSD-style license found in the
51554
- * LICENSE file in the root directory of this source tree. An additional grant
51555
- * of patent rights can be found in the PATENTS file in the same directory.
51556
- */
51557
-
51558
- 'use strict';
51559
-
51560
- if (({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
51561
- var invariant = __webpack_require__(6);
51562
- var warning = __webpack_require__(7);
51563
- var ReactPropTypesSecret = __webpack_require__(8);
51564
- var loggedTypeFailures = {};
51565
- }
51566
-
51567
- /**
51568
- * Assert that the values match with the type specs.
51569
- * Error messages are memorized and will only be shown once.
51570
- *
51571
- * @param {object} typeSpecs Map of name to a ReactPropType
51572
- * @param {object} values Runtime values that need to be type-checked
51573
- * @param {string} location e.g. "prop", "context", "child context"
51574
- * @param {string} componentName Name of the component for error messages.
51575
- * @param {?Function} getStack Returns the component stack.
51576
- * @private
51577
- */
51578
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
51579
- if (({"DRAGGABLE_DEBUG":undefined}).NODE_ENV !== 'production') {
51580
- for (var typeSpecName in typeSpecs) {
51581
- if (typeSpecs.hasOwnProperty(typeSpecName)) {
51582
- var error;
51583
- // Prop type validation may throw. In case they do, we don't want to
51584
- // fail the render phase where it didn't fail before. So we log it.
51585
- // After these have been cleaned up, we'll let them throw.
51586
- try {
51587
- // This is intentionally an invariant that gets caught. It's the same
51588
- // behavior as without this statement except with a better message.
51589
- invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', location, typeSpecName);
51590
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
51591
- } catch (ex) {
51592
- error = ex;
51593
- }
51594
- warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
51595
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
51596
- // Only monitor this failure once because there tends to be a lot of the
51597
- // same error.
51598
- loggedTypeFailures[error.message] = true;
51599
-
51600
- var stack = getStack ? getStack() : '';
51601
-
51602
- warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
51603
- }
51604
- }
51605
- }
51606
- }
51607
- }
51608
-
51609
- module.exports = checkPropTypes;
51610
-
51611
-
51612
- /***/ },
51613
- /* 10 */
51614
- /***/ function(module, exports, __webpack_require__) {
51615
-
51616
- /**
51617
- * Copyright 2013-present, Facebook, Inc.
51618
- * All rights reserved.
51619
- *
51620
- * This source code is licensed under the BSD-style license found in the
51621
- * LICENSE file in the root directory of this source tree. An additional grant
51622
- * of patent rights can be found in the PATENTS file in the same directory.
51623
- */
51624
-
51625
- 'use strict';
51626
-
51627
- var emptyFunction = __webpack_require__(5);
51628
- var invariant = __webpack_require__(6);
51629
-
51630
- module.exports = function() {
51631
- // Important!
51632
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
51633
- function shim() {
51634
- invariant(
51635
- false,
51636
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
51637
- 'Use PropTypes.checkPropTypes() to call them. ' +
51638
- 'Read more at http://fb.me/use-check-prop-types'
51639
- );
51640
- };
51641
- shim.isRequired = shim;
51642
- function getShim() {
51643
- return shim;
51644
- };
51645
- var ReactPropTypes = {
51646
- array: shim,
51647
- bool: shim,
51648
- func: shim,
51649
- number: shim,
51650
- object: shim,
51651
- string: shim,
51652
- symbol: shim,
51653
-
51654
- any: shim,
51655
- arrayOf: getShim,
51656
- element: shim,
51657
- instanceOf: getShim,
51658
- node: shim,
51659
- objectOf: getShim,
51660
- oneOf: getShim,
51661
- oneOfType: getShim,
51662
- shape: getShim
51663
- };
51664
-
51665
- ReactPropTypes.checkPropTypes = emptyFunction;
51666
- ReactPropTypes.PropTypes = ReactPropTypes;
51667
-
51668
- return ReactPropTypes;
51669
- };
51670
-
51671
-
51672
- /***/ },
51673
- /* 11 */
51674
- /***/ function(module, exports) {
51675
-
51676
- module.exports = __WEBPACK_EXTERNAL_MODULE_11__;
51677
-
51678
- /***/ },
51679
- /* 12 */
51680
- /***/ function(module, exports, __webpack_require__) {
51213
+ });
51681
51214
 
51682
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
51215
+ var classnames = createCommonjsModule(function (module) {
51216
+ /*!
51683
51217
  Copyright (c) 2016 Jed Watson.
51684
51218
  Licensed under the MIT License (MIT), see
51685
51219
  http://jedwatson.github.io/classnames
51686
51220
  */
51687
51221
  /* global define */
51688
-
51222
+
51689
51223
  (function () {
51690
- 'use strict';
51691
-
51224
+
51692
51225
  var hasOwn = {}.hasOwnProperty;
51693
-
51226
+
51694
51227
  function classNames () {
51695
51228
  var classes = [];
51696
-
51229
+
51697
51230
  for (var i = 0; i < arguments.length; i++) {
51698
51231
  var arg = arguments[i];
51699
51232
  if (!arg) continue;
51700
-
51233
+
51701
51234
  var argType = typeof arg;
51702
-
51235
+
51703
51236
  if (argType === 'string' || argType === 'number') {
51704
51237
  classes.push(arg);
51705
51238
  } else if (Array.isArray(arg)) {
@@ -51712,215 +51245,386 @@ module.exports =
51712
51245
  }
51713
51246
  }
51714
51247
  }
51715
-
51248
+
51716
51249
  return classes.join(' ');
51717
51250
  }
51718
-
51719
- if (typeof module !== 'undefined' && module.exports) {
51251
+
51252
+ if ('object' !== 'undefined' && module.exports) {
51720
51253
  module.exports = classNames;
51721
- } else if (true) {
51254
+ } else if (false) {
51722
51255
  // register as 'classnames', consistent with npm package name
51723
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
51256
+ undefined('classnames', [], function () {
51724
51257
  return classNames;
51725
- }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
51258
+ });
51726
51259
  } else {
51727
51260
  window.classNames = classNames;
51728
51261
  }
51729
51262
  }());
51263
+ });
51730
51264
 
51265
+ // @credits https://gist.github.com/rogozhnikoff/a43cfed27c41e4e68cdc
51266
+ function findInArray(array /*: Array<any> | TouchList*/, callback /*: Function*/) /*: any*/ {
51267
+ for (var i = 0, length = array.length; i < length; i++) {
51268
+ if (callback.apply(callback, [array[i], i, array])) return array[i];
51269
+ }
51270
+ }
51731
51271
 
51732
- /***/ },
51733
- /* 13 */
51734
- /***/ function(module, exports, __webpack_require__) {
51272
+ function isFunction(func /*: any*/) /*: boolean*/ {
51273
+ return typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]';
51274
+ }
51735
51275
 
51736
- 'use strict';
51737
-
51738
- Object.defineProperty(exports, "__esModule", {
51739
- value: true
51740
- });
51741
-
51742
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
51743
-
51744
- exports.matchesSelector = matchesSelector;
51745
- exports.matchesSelectorAndParentsTo = matchesSelectorAndParentsTo;
51746
- exports.addEvent = addEvent;
51747
- exports.removeEvent = removeEvent;
51748
- exports.outerHeight = outerHeight;
51749
- exports.outerWidth = outerWidth;
51750
- exports.innerHeight = innerHeight;
51751
- exports.innerWidth = innerWidth;
51752
- exports.offsetXYFromParent = offsetXYFromParent;
51753
- exports.createCSSTransform = createCSSTransform;
51754
- exports.createSVGTransform = createSVGTransform;
51755
- exports.getTouch = getTouch;
51756
- exports.getTouchIdentifier = getTouchIdentifier;
51757
- exports.addUserSelectStyles = addUserSelectStyles;
51758
- exports.removeUserSelectStyles = removeUserSelectStyles;
51759
- exports.styleHacks = styleHacks;
51760
-
51761
- var _shims = __webpack_require__(14);
51762
-
51763
- var _getPrefix = __webpack_require__(15);
51764
-
51765
- var _getPrefix2 = _interopRequireDefault(_getPrefix);
51766
-
51767
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
51768
-
51769
- 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; }
51770
-
51771
- /*:: import type {ControlPosition} from './types';*/
51772
-
51773
-
51774
- var matchesSelectorFunc = '';
51775
- function matchesSelector(el /*: Node*/, selector /*: string*/) /*: boolean*/ {
51776
- if (!matchesSelectorFunc) {
51777
- matchesSelectorFunc = (0, _shims.findInArray)(['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector', 'oMatchesSelector'], function (method) {
51778
- // $FlowIgnore: Doesn't think elements are indexable
51779
- return (0, _shims.isFunction)(el[method]);
51780
- });
51781
- }
51782
-
51783
- // $FlowIgnore: Doesn't think elements are indexable
51784
- return el[matchesSelectorFunc].call(el, selector);
51276
+ function isNum(num /*: any*/) /*: boolean*/ {
51277
+ return typeof num === 'number' && !isNaN(num);
51785
51278
  }
51786
-
51787
- // Works up the tree to the draggable itself attempting to match selector.
51788
- function matchesSelectorAndParentsTo(el /*: Node*/, selector /*: string*/, baseNode /*: Node*/) /*: boolean*/ {
51789
- var node = el;
51790
- do {
51791
- if (matchesSelector(node, selector)) return true;
51792
- if (node === baseNode) return false;
51793
- node = node.parentNode;
51794
- } while (node);
51795
-
51796
- return false;
51279
+
51280
+ function int(a /*: string*/) /*: number*/ {
51281
+ return parseInt(a, 10);
51797
51282
  }
51798
-
51799
- function addEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/) /*: void*/ {
51800
- if (!el) {
51801
- return;
51802
- }
51803
- if (el.attachEvent) {
51804
- el.attachEvent('on' + event, handler);
51805
- } else if (el.addEventListener) {
51806
- el.addEventListener(event, handler, true);
51807
- } else {
51808
- // $FlowIgnore: Doesn't think elements are indexable
51809
- el['on' + event] = handler;
51283
+
51284
+ function dontSetMe(props /*: Object*/, propName /*: string*/, componentName /*: string*/) {
51285
+ if (props[propName]) {
51286
+ return new Error('Invalid prop ' + propName + ' passed to ' + componentName + ' - do not set this, set it on the child.');
51810
51287
  }
51811
51288
  }
51812
-
51813
- function removeEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/) /*: void*/ {
51814
- if (!el) {
51815
- return;
51816
- }
51817
- if (el.detachEvent) {
51818
- el.detachEvent('on' + event, handler);
51819
- } else if (el.removeEventListener) {
51820
- el.removeEventListener(event, handler, true);
51821
- } else {
51822
- // $FlowIgnore: Doesn't think elements are indexable
51823
- el['on' + event] = null;
51289
+
51290
+ var prefixes = ['Moz', 'Webkit', 'O', 'ms'];
51291
+ function getPrefix() /*: string*/ {
51292
+ var prop /*: string*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform';
51293
+
51294
+ // Checking specifically for 'window.document' is for pseudo-browser server-side
51295
+ // environments that define 'window' as the global context.
51296
+ // E.g. React-rails (see https://github.com/reactjs/react-rails/pull/84)
51297
+ if (typeof window === 'undefined' || typeof window.document === 'undefined') return '';
51298
+
51299
+ var style = window.document.documentElement.style;
51300
+
51301
+ if (prop in style) return '';
51302
+
51303
+ for (var i = 0; i < prefixes.length; i++) {
51304
+ if (browserPrefixToKey(prop, prefixes[i]) in style) return prefixes[i];
51824
51305
  }
51306
+
51307
+ return '';
51825
51308
  }
51826
-
51827
- function outerHeight(node /*: HTMLElement*/) /*: number*/ {
51828
- // This is deliberately excluding margin for our calculations, since we are using
51829
- // offsetTop which is including margin. See getBoundPosition
51830
- var height = node.clientHeight;
51831
- var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
51832
- height += (0, _shims.int)(computedStyle.borderTopWidth);
51833
- height += (0, _shims.int)(computedStyle.borderBottomWidth);
51834
- return height;
51835
- }
51836
-
51837
- function outerWidth(node /*: HTMLElement*/) /*: number*/ {
51838
- // This is deliberately excluding margin for our calculations, since we are using
51839
- // offsetLeft which is including margin. See getBoundPosition
51840
- var width = node.clientWidth;
51841
- var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
51842
- width += (0, _shims.int)(computedStyle.borderLeftWidth);
51843
- width += (0, _shims.int)(computedStyle.borderRightWidth);
51844
- return width;
51309
+
51310
+ function browserPrefixToKey(prop /*: string*/, prefix /*: string*/) /*: string*/ {
51311
+ return prefix ? '' + prefix + kebabToTitleCase(prop) : prop;
51312
+ }
51313
+
51314
+ function kebabToTitleCase(str /*: string*/) /*: string*/ {
51315
+ var out = '';
51316
+ var shouldCapitalize = true;
51317
+ for (var i = 0; i < str.length; i++) {
51318
+ if (shouldCapitalize) {
51319
+ out += str[i].toUpperCase();
51320
+ shouldCapitalize = false;
51321
+ } else if (str[i] === '-') {
51322
+ shouldCapitalize = true;
51323
+ } else {
51324
+ out += str[i];
51325
+ }
51326
+ }
51327
+ return out;
51328
+ }
51329
+
51330
+ // Default export is the prefix itself, like 'Moz', 'Webkit', etc
51331
+ // Note that you may have to re-test for certain things; for instance, Chrome 50
51332
+ // can handle unprefixed `transform`, but not unprefixed `user-select`
51333
+ var browserPrefix = getPrefix();
51334
+
51335
+ var classCallCheck = function (instance, Constructor) {
51336
+ if (!(instance instanceof Constructor)) {
51337
+ throw new TypeError("Cannot call a class as a function");
51338
+ }
51339
+ };
51340
+
51341
+ var createClass = function () {
51342
+ function defineProperties(target, props) {
51343
+ for (var i = 0; i < props.length; i++) {
51344
+ var descriptor = props[i];
51345
+ descriptor.enumerable = descriptor.enumerable || false;
51346
+ descriptor.configurable = true;
51347
+ if ("value" in descriptor) descriptor.writable = true;
51348
+ Object.defineProperty(target, descriptor.key, descriptor);
51349
+ }
51350
+ }
51351
+
51352
+ return function (Constructor, protoProps, staticProps) {
51353
+ if (protoProps) defineProperties(Constructor.prototype, protoProps);
51354
+ if (staticProps) defineProperties(Constructor, staticProps);
51355
+ return Constructor;
51356
+ };
51357
+ }();
51358
+
51359
+ var defineProperty = function (obj, key, value) {
51360
+ if (key in obj) {
51361
+ Object.defineProperty(obj, key, {
51362
+ value: value,
51363
+ enumerable: true,
51364
+ configurable: true,
51365
+ writable: true
51366
+ });
51367
+ } else {
51368
+ obj[key] = value;
51369
+ }
51370
+
51371
+ return obj;
51372
+ };
51373
+
51374
+ var _extends = Object.assign || function (target) {
51375
+ for (var i = 1; i < arguments.length; i++) {
51376
+ var source = arguments[i];
51377
+
51378
+ for (var key in source) {
51379
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
51380
+ target[key] = source[key];
51381
+ }
51382
+ }
51383
+ }
51384
+
51385
+ return target;
51386
+ };
51387
+
51388
+ var inherits = function (subClass, superClass) {
51389
+ if (typeof superClass !== "function" && superClass !== null) {
51390
+ throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
51391
+ }
51392
+
51393
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
51394
+ constructor: {
51395
+ value: subClass,
51396
+ enumerable: false,
51397
+ writable: true,
51398
+ configurable: true
51399
+ }
51400
+ });
51401
+ if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
51402
+ };
51403
+
51404
+ var possibleConstructorReturn = function (self, call) {
51405
+ if (!self) {
51406
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
51407
+ }
51408
+
51409
+ return call && (typeof call === "object" || typeof call === "function") ? call : self;
51410
+ };
51411
+
51412
+ var slicedToArray = function () {
51413
+ function sliceIterator(arr, i) {
51414
+ var _arr = [];
51415
+ var _n = true;
51416
+ var _d = false;
51417
+ var _e = undefined;
51418
+
51419
+ try {
51420
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
51421
+ _arr.push(_s.value);
51422
+
51423
+ if (i && _arr.length === i) break;
51424
+ }
51425
+ } catch (err) {
51426
+ _d = true;
51427
+ _e = err;
51428
+ } finally {
51429
+ try {
51430
+ if (!_n && _i["return"]) _i["return"]();
51431
+ } finally {
51432
+ if (_d) throw _e;
51433
+ }
51434
+ }
51435
+
51436
+ return _arr;
51437
+ }
51438
+
51439
+ return function (arr, i) {
51440
+ if (Array.isArray(arr)) {
51441
+ return arr;
51442
+ } else if (Symbol.iterator in Object(arr)) {
51443
+ return sliceIterator(arr, i);
51444
+ } else {
51445
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
51446
+ }
51447
+ };
51448
+ }();
51449
+
51450
+ /*:: import type {ControlPosition, PositionOffsetControlPosition, MouseTouchEvent} from './types';*/
51451
+
51452
+
51453
+ var matchesSelectorFunc = '';
51454
+ function matchesSelector(el /*: Node*/, selector /*: string*/) /*: boolean*/ {
51455
+ if (!matchesSelectorFunc) {
51456
+ matchesSelectorFunc = findInArray(['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector', 'oMatchesSelector'], function (method) {
51457
+ // $FlowIgnore: Doesn't think elements are indexable
51458
+ return isFunction(el[method]);
51459
+ });
51460
+ }
51461
+
51462
+ // Might not be found entirely (not an Element?) - in that case, bail
51463
+ // $FlowIgnore: Doesn't think elements are indexable
51464
+ if (!isFunction(el[matchesSelectorFunc])) return false;
51465
+
51466
+ // $FlowIgnore: Doesn't think elements are indexable
51467
+ return el[matchesSelectorFunc](selector);
51468
+ }
51469
+
51470
+ // Works up the tree to the draggable itself attempting to match selector.
51471
+ function matchesSelectorAndParentsTo(el /*: Node*/, selector /*: string*/, baseNode /*: Node*/) /*: boolean*/ {
51472
+ var node = el;
51473
+ do {
51474
+ if (matchesSelector(node, selector)) return true;
51475
+ if (node === baseNode) return false;
51476
+ node = node.parentNode;
51477
+ } while (node);
51478
+
51479
+ return false;
51480
+ }
51481
+
51482
+ function addEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/) /*: void*/ {
51483
+ if (!el) {
51484
+ return;
51485
+ }
51486
+ if (el.attachEvent) {
51487
+ el.attachEvent('on' + event, handler);
51488
+ } else if (el.addEventListener) {
51489
+ el.addEventListener(event, handler, true);
51490
+ } else {
51491
+ // $FlowIgnore: Doesn't think elements are indexable
51492
+ el['on' + event] = handler;
51493
+ }
51494
+ }
51495
+
51496
+ function removeEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/) /*: void*/ {
51497
+ if (!el) {
51498
+ return;
51499
+ }
51500
+ if (el.detachEvent) {
51501
+ el.detachEvent('on' + event, handler);
51502
+ } else if (el.removeEventListener) {
51503
+ el.removeEventListener(event, handler, true);
51504
+ } else {
51505
+ // $FlowIgnore: Doesn't think elements are indexable
51506
+ el['on' + event] = null;
51507
+ }
51508
+ }
51509
+
51510
+ function outerHeight(node /*: HTMLElement*/) /*: number*/ {
51511
+ // This is deliberately excluding margin for our calculations, since we are using
51512
+ // offsetTop which is including margin. See getBoundPosition
51513
+ var height = node.clientHeight;
51514
+ var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
51515
+ height += int(computedStyle.borderTopWidth);
51516
+ height += int(computedStyle.borderBottomWidth);
51517
+ return height;
51518
+ }
51519
+
51520
+ function outerWidth(node /*: HTMLElement*/) /*: number*/ {
51521
+ // This is deliberately excluding margin for our calculations, since we are using
51522
+ // offsetLeft which is including margin. See getBoundPosition
51523
+ var width = node.clientWidth;
51524
+ var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
51525
+ width += int(computedStyle.borderLeftWidth);
51526
+ width += int(computedStyle.borderRightWidth);
51527
+ return width;
51845
51528
  }
51846
51529
  function innerHeight(node /*: HTMLElement*/) /*: number*/ {
51847
51530
  var height = node.clientHeight;
51848
51531
  var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
51849
- height -= (0, _shims.int)(computedStyle.paddingTop);
51850
- height -= (0, _shims.int)(computedStyle.paddingBottom);
51532
+ height -= int(computedStyle.paddingTop);
51533
+ height -= int(computedStyle.paddingBottom);
51851
51534
  return height;
51852
51535
  }
51853
-
51536
+
51854
51537
  function innerWidth(node /*: HTMLElement*/) /*: number*/ {
51855
51538
  var width = node.clientWidth;
51856
51539
  var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
51857
- width -= (0, _shims.int)(computedStyle.paddingLeft);
51858
- width -= (0, _shims.int)(computedStyle.paddingRight);
51540
+ width -= int(computedStyle.paddingLeft);
51541
+ width -= int(computedStyle.paddingRight);
51859
51542
  return width;
51860
51543
  }
51861
-
51544
+
51862
51545
  // Get from offsetParent
51863
51546
  function offsetXYFromParent(evt /*: {clientX: number, clientY: number}*/, offsetParent /*: HTMLElement*/) /*: ControlPosition*/ {
51864
51547
  var isBody = offsetParent === offsetParent.ownerDocument.body;
51865
51548
  var offsetParentRect = isBody ? { left: 0, top: 0 } : offsetParent.getBoundingClientRect();
51866
-
51549
+
51867
51550
  var x = evt.clientX + offsetParent.scrollLeft - offsetParentRect.left;
51868
51551
  var y = evt.clientY + offsetParent.scrollTop - offsetParentRect.top;
51869
-
51552
+
51870
51553
  return { x: x, y: y };
51871
51554
  }
51872
-
51873
- function createCSSTransform(_ref) /*: Object*/ {
51874
- var x = _ref.x,
51875
- y = _ref.y;
51876
-
51877
- // Replace unitless items with px
51878
- return _defineProperty({}, (0, _getPrefix.browserPrefixToKey)('transform', _getPrefix2.default), 'translate(' + x + 'px,' + y + 'px)');
51555
+
51556
+ function createCSSTransform(controlPos /*: ControlPosition*/, positionOffset /*: PositionOffsetControlPosition*/) /*: Object*/ {
51557
+ var translation = getTranslation(controlPos, positionOffset, 'px');
51558
+ return defineProperty({}, browserPrefixToKey('transform', browserPrefix), translation);
51559
+ }
51560
+
51561
+ function createSVGTransform(controlPos /*: ControlPosition*/, positionOffset /*: PositionOffsetControlPosition*/) /*: string*/ {
51562
+ var translation = getTranslation(controlPos, positionOffset, '');
51563
+ return translation;
51879
51564
  }
51880
-
51881
- function createSVGTransform(_ref3) /*: string*/ {
51882
- var x = _ref3.x,
51883
- y = _ref3.y;
51884
-
51885
- return 'translate(' + x + ',' + y + ')';
51565
+ function getTranslation(_ref2, positionOffset /*: PositionOffsetControlPosition*/, unitSuffix /*: string*/) /*: string*/ {
51566
+ var x = _ref2.x,
51567
+ y = _ref2.y;
51568
+
51569
+ var translation = 'translate(' + x + unitSuffix + ',' + y + unitSuffix + ')';
51570
+ if (positionOffset) {
51571
+ var defaultX = '' + (typeof positionOffset.x === 'string' ? positionOffset.x : positionOffset.x + unitSuffix);
51572
+ var defaultY = '' + (typeof positionOffset.y === 'string' ? positionOffset.y : positionOffset.y + unitSuffix);
51573
+ translation = 'translate(' + defaultX + ', ' + defaultY + ')' + translation;
51574
+ }
51575
+ return translation;
51886
51576
  }
51887
-
51577
+
51888
51578
  function getTouch(e /*: MouseTouchEvent*/, identifier /*: number*/) /*: ?{clientX: number, clientY: number}*/ {
51889
- return e.targetTouches && (0, _shims.findInArray)(e.targetTouches, function (t) {
51579
+ return e.targetTouches && findInArray(e.targetTouches, function (t) {
51890
51580
  return identifier === t.identifier;
51891
- }) || e.changedTouches && (0, _shims.findInArray)(e.changedTouches, function (t) {
51581
+ }) || e.changedTouches && findInArray(e.changedTouches, function (t) {
51892
51582
  return identifier === t.identifier;
51893
51583
  });
51894
51584
  }
51895
-
51585
+
51896
51586
  function getTouchIdentifier(e /*: MouseTouchEvent*/) /*: ?number*/ {
51897
51587
  if (e.targetTouches && e.targetTouches[0]) return e.targetTouches[0].identifier;
51898
51588
  if (e.changedTouches && e.changedTouches[0]) return e.changedTouches[0].identifier;
51899
51589
  }
51900
-
51590
+
51901
51591
  // User-select Hacks:
51902
51592
  //
51903
51593
  // Useful for preventing blue highlights all over everything when dragging.
51904
- var userSelectPrefix = (0, _getPrefix.getPrefix)('user-select');
51905
- var userSelect = (0, _getPrefix.browserPrefixToStyle)('user-select', userSelectPrefix);
51906
- var userSelectStyle = ';' + userSelect + ': none;';
51907
- var userSelectReplaceRegExp = new RegExp(';?' + userSelect + ': none;'); // leading ; not present on IE
51908
-
51594
+
51909
51595
  // Note we're passing `document` b/c we could be iframed
51910
- function addUserSelectStyles(body /*: HTMLElement*/) {
51911
- var style = body.getAttribute('style') || '';
51912
- if (userSelectReplaceRegExp.test(style)) return; // don't add twice
51913
- body.setAttribute('style', style + userSelectStyle);
51596
+ function addUserSelectStyles(doc /*: ?Document*/) {
51597
+ if (!doc) return;
51598
+ var styleEl = doc.getElementById('react-draggable-style-el');
51599
+ if (!styleEl) {
51600
+ styleEl = doc.createElement('style');
51601
+ styleEl.type = 'text/css';
51602
+ styleEl.id = 'react-draggable-style-el';
51603
+ styleEl.innerHTML = '.react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n';
51604
+ styleEl.innerHTML += '.react-draggable-transparent-selection *::selection {all: inherit;}\n';
51605
+ doc.getElementsByTagName('head')[0].appendChild(styleEl);
51606
+ }
51607
+ if (doc.body) addClassName(doc.body, 'react-draggable-transparent-selection');
51914
51608
  }
51915
-
51916
- function removeUserSelectStyles(body /*: HTMLElement*/) {
51917
- var style = body.getAttribute('style') || '';
51918
- body.setAttribute('style', style.replace(userSelectReplaceRegExp, ''));
51609
+
51610
+ function removeUserSelectStyles(doc /*: ?Document*/) {
51611
+ try {
51612
+ if (doc && doc.body) removeClassName(doc.body, 'react-draggable-transparent-selection');
51613
+ // $FlowIgnore: IE
51614
+ if (doc.selection) {
51615
+ // $FlowIgnore: IE
51616
+ doc.selection.empty();
51617
+ } else {
51618
+ window.getSelection().removeAllRanges(); // remove selection caused by scroll
51619
+ }
51620
+ } catch (e) {
51621
+ // probably IE
51622
+ }
51919
51623
  }
51920
-
51624
+
51921
51625
  function styleHacks() /*: Object*/ {
51922
51626
  var childStyle /*: Object*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
51923
-
51627
+
51924
51628
  // Workaround IE pointer events; see #51
51925
51629
  // https://github.com/mzabriskie/react-draggable/issues/51#issuecomment-103488278
51926
51630
  return _extends({
@@ -51928,213 +51632,108 @@ module.exports =
51928
51632
  }, childStyle);
51929
51633
  }
51930
51634
 
51931
- /***/ },
51932
- /* 14 */
51933
- /***/ function(module, exports) {
51934
-
51935
- 'use strict';
51936
-
51937
- Object.defineProperty(exports, "__esModule", {
51938
- value: true
51939
- });
51940
- exports.findInArray = findInArray;
51941
- exports.isFunction = isFunction;
51942
- exports.isNum = isNum;
51943
- exports.int = int;
51944
- exports.dontSetMe = dontSetMe;
51945
-
51946
- // @credits https://gist.github.com/rogozhnikoff/a43cfed27c41e4e68cdc
51947
- function findInArray(array /*: Array<any> | TouchList*/, callback /*: Function*/) /*: any*/ {
51948
- for (var i = 0, length = array.length; i < length; i++) {
51949
- if (callback.apply(callback, [array[i], i, array])) return array[i];
51950
- }
51951
- }
51952
-
51953
- function isFunction(func /*: any*/) /*: boolean*/ {
51954
- return typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]';
51955
- }
51956
-
51957
- function isNum(num /*: any*/) /*: boolean*/ {
51958
- return typeof num === 'number' && !isNaN(num);
51959
- }
51960
-
51961
- function int(a /*: string*/) /*: number*/ {
51962
- return parseInt(a, 10);
51963
- }
51964
-
51965
- function dontSetMe(props /*: Object*/, propName /*: string*/, componentName /*: string*/) {
51966
- if (props[propName]) {
51967
- return new Error('Invalid prop ' + propName + ' passed to ' + componentName + ' - do not set this, set it on the child.');
51635
+ function addClassName(el /*: HTMLElement*/, className /*: string*/) {
51636
+ if (el.classList) {
51637
+ el.classList.add(className);
51638
+ } else {
51639
+ if (!el.className.match(new RegExp('(?:^|\\s)' + className + '(?!\\S)'))) {
51640
+ el.className += ' ' + className;
51641
+ }
51968
51642
  }
51969
51643
  }
51970
51644
 
51971
- /***/ },
51972
- /* 15 */
51973
- /***/ function(module, exports) {
51974
-
51975
- 'use strict';
51976
-
51977
- Object.defineProperty(exports, "__esModule", {
51978
- value: true
51979
- });
51980
- exports.getPrefix = getPrefix;
51981
- exports.browserPrefixToKey = browserPrefixToKey;
51982
- exports.browserPrefixToStyle = browserPrefixToStyle;
51983
- var prefixes = ['Moz', 'Webkit', 'O', 'ms'];
51984
- function getPrefix() /*: string*/ {
51985
- var prop /*: string*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform';
51986
-
51987
- // Checking specifically for 'window.document' is for pseudo-browser server-side
51988
- // environments that define 'window' as the global context.
51989
- // E.g. React-rails (see https://github.com/reactjs/react-rails/pull/84)
51990
- if (typeof window === 'undefined' || typeof window.document === 'undefined') return '';
51991
-
51992
- var style = window.document.documentElement.style;
51993
-
51994
- if (prop in style) return '';
51995
-
51996
- for (var i = 0; i < prefixes.length; i++) {
51997
- if (browserPrefixToKey(prop, prefixes[i]) in style) return prefixes[i];
51998
- }
51999
-
52000
- return '';
52001
- }
52002
-
52003
- function browserPrefixToKey(prop /*: string*/, prefix /*: string*/) /*: string*/ {
52004
- return prefix ? '' + prefix + kebabToTitleCase(prop) : prop;
52005
- }
52006
-
52007
- function browserPrefixToStyle(prop /*: string*/, prefix /*: string*/) /*: string*/ {
52008
- return prefix ? '-' + prefix.toLowerCase() + '-' + prop : prop;
52009
- }
52010
-
52011
- function kebabToTitleCase(str /*: string*/) /*: string*/ {
52012
- var out = '';
52013
- var shouldCapitalize = true;
52014
- for (var i = 0; i < str.length; i++) {
52015
- if (shouldCapitalize) {
52016
- out += str[i].toUpperCase();
52017
- shouldCapitalize = false;
52018
- } else if (str[i] === '-') {
52019
- shouldCapitalize = true;
52020
- } else {
52021
- out += str[i];
52022
- }
51645
+ function removeClassName(el /*: HTMLElement*/, className /*: string*/) {
51646
+ if (el.classList) {
51647
+ el.classList.remove(className);
51648
+ } else {
51649
+ el.className = el.className.replace(new RegExp('(?:^|\\s)' + className + '(?!\\S)', 'g'), '');
52023
51650
  }
52024
- return out;
52025
51651
  }
52026
-
52027
- // Default export is the prefix itself, like 'Moz', 'Webkit', etc
52028
- // Note that you may have to re-test for certain things; for instance, Chrome 50
52029
- // can handle unprefixed `transform`, but not unprefixed `user-select`
52030
- exports.default = getPrefix();
52031
51652
 
52032
- /***/ },
52033
- /* 16 */
52034
- /***/ function(module, exports, __webpack_require__) {
52035
-
52036
- 'use strict';
52037
-
52038
- Object.defineProperty(exports, "__esModule", {
52039
- value: true
52040
- });
52041
- exports.getBoundPosition = getBoundPosition;
52042
- exports.snapToGrid = snapToGrid;
52043
- exports.canDragX = canDragX;
52044
- exports.canDragY = canDragY;
52045
- exports.getControlPosition = getControlPosition;
52046
- exports.createCoreData = createCoreData;
52047
- exports.createDraggableData = createDraggableData;
52048
-
52049
- var _shims = __webpack_require__(14);
52050
-
52051
- var _reactDom = __webpack_require__(11);
52052
-
52053
- var _reactDom2 = _interopRequireDefault(_reactDom);
52054
-
52055
- var _domFns = __webpack_require__(13);
52056
-
52057
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
52058
-
52059
51653
  /*:: import type Draggable from '../Draggable';*/
52060
- /*:: import type {Bounds, ControlPosition, DraggableData} from './types';*/
51654
+ /*:: import type {Bounds, ControlPosition, DraggableData, MouseTouchEvent} from './types';*/
52061
51655
  /*:: import type DraggableCore from '../DraggableCore';*/
51656
+
51657
+
52062
51658
  function getBoundPosition(draggable /*: Draggable*/, x /*: number*/, y /*: number*/) /*: [number, number]*/ {
52063
51659
  // If no bounds, short-circuit and move on
52064
51660
  if (!draggable.props.bounds) return [x, y];
52065
-
51661
+
52066
51662
  // Clone new bounds
52067
51663
  var bounds = draggable.props.bounds;
52068
-
51664
+
52069
51665
  bounds = typeof bounds === 'string' ? bounds : cloneBounds(bounds);
52070
- var node = _reactDom2.default.findDOMNode(draggable);
52071
-
51666
+ var node = findDOMNode(draggable);
51667
+
52072
51668
  if (typeof bounds === 'string') {
52073
51669
  var ownerDocument = node.ownerDocument;
52074
-
51670
+
52075
51671
  var ownerWindow = ownerDocument.defaultView;
52076
51672
  var boundNode = void 0;
52077
51673
  if (bounds === 'parent') {
52078
51674
  boundNode = node.parentNode;
52079
51675
  } else {
52080
51676
  boundNode = ownerDocument.querySelector(bounds);
52081
- if (!boundNode) throw new Error('Bounds selector "' + bounds + '" could not find an element.');
51677
+ }
51678
+ if (!(boundNode instanceof ownerWindow.HTMLElement)) {
51679
+ throw new Error('Bounds selector "' + bounds + '" could not find an element.');
52082
51680
  }
52083
51681
  var nodeStyle = ownerWindow.getComputedStyle(node);
52084
51682
  var boundNodeStyle = ownerWindow.getComputedStyle(boundNode);
52085
51683
  // Compute bounds. This is a pain with padding and offsets but this gets it exactly right.
52086
51684
  bounds = {
52087
- left: -node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingLeft) + (0, _shims.int)(nodeStyle.marginLeft),
52088
- top: -node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingTop) + (0, _shims.int)(nodeStyle.marginTop),
52089
- right: (0, _domFns.innerWidth)(boundNode) - (0, _domFns.outerWidth)(node) - node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingRight) - (0, _shims.int)(nodeStyle.marginRight),
52090
- bottom: (0, _domFns.innerHeight)(boundNode) - (0, _domFns.outerHeight)(node) - node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingBottom) - (0, _shims.int)(nodeStyle.marginBottom)
51685
+ left: -node.offsetLeft + int(boundNodeStyle.paddingLeft) + int(nodeStyle.marginLeft),
51686
+ top: -node.offsetTop + int(boundNodeStyle.paddingTop) + int(nodeStyle.marginTop),
51687
+ right: innerWidth(boundNode) - outerWidth(node) - node.offsetLeft + int(boundNodeStyle.paddingRight) - int(nodeStyle.marginRight),
51688
+ bottom: innerHeight(boundNode) - outerHeight(node) - node.offsetTop + int(boundNodeStyle.paddingBottom) - int(nodeStyle.marginBottom)
52091
51689
  };
52092
51690
  }
52093
-
51691
+
52094
51692
  // Keep x and y below right and bottom limits...
52095
- if ((0, _shims.isNum)(bounds.right)) x = Math.min(x, bounds.right);
52096
- if ((0, _shims.isNum)(bounds.bottom)) y = Math.min(y, bounds.bottom);
52097
-
51693
+ if (isNum(bounds.right)) x = Math.min(x, bounds.right);
51694
+ if (isNum(bounds.bottom)) y = Math.min(y, bounds.bottom);
51695
+
52098
51696
  // But above left and top limits.
52099
- if ((0, _shims.isNum)(bounds.left)) x = Math.max(x, bounds.left);
52100
- if ((0, _shims.isNum)(bounds.top)) y = Math.max(y, bounds.top);
52101
-
51697
+ if (isNum(bounds.left)) x = Math.max(x, bounds.left);
51698
+ if (isNum(bounds.top)) y = Math.max(y, bounds.top);
51699
+
52102
51700
  return [x, y];
52103
51701
  }
52104
-
51702
+
52105
51703
  function snapToGrid(grid /*: [number, number]*/, pendingX /*: number*/, pendingY /*: number*/) /*: [number, number]*/ {
52106
51704
  var x = Math.round(pendingX / grid[0]) * grid[0];
52107
51705
  var y = Math.round(pendingY / grid[1]) * grid[1];
52108
51706
  return [x, y];
52109
51707
  }
52110
-
51708
+
52111
51709
  function canDragX(draggable /*: Draggable*/) /*: boolean*/ {
52112
51710
  return draggable.props.axis === 'both' || draggable.props.axis === 'x';
52113
51711
  }
52114
-
51712
+
52115
51713
  function canDragY(draggable /*: Draggable*/) /*: boolean*/ {
52116
51714
  return draggable.props.axis === 'both' || draggable.props.axis === 'y';
52117
51715
  }
52118
-
51716
+
52119
51717
  // Get {x, y} positions from event.
52120
51718
  function getControlPosition(e /*: MouseTouchEvent*/, touchIdentifier /*: ?number*/, draggableCore /*: DraggableCore*/) /*: ?ControlPosition*/ {
52121
- var touchObj = typeof touchIdentifier === 'number' ? (0, _domFns.getTouch)(e, touchIdentifier) : null;
51719
+ var touchObj = typeof touchIdentifier === 'number' ? getTouch(e, touchIdentifier) : null;
52122
51720
  if (typeof touchIdentifier === 'number' && !touchObj) return null; // not the right touch
52123
- var node = _reactDom2.default.findDOMNode(draggableCore);
51721
+ var node = findDOMNode(draggableCore);
52124
51722
  // User can provide an offsetParent if desired.
52125
51723
  var offsetParent = draggableCore.props.offsetParent || node.offsetParent || node.ownerDocument.body;
52126
- return (0, _domFns.offsetXYFromParent)(touchObj || e, offsetParent);
51724
+ return offsetXYFromParent(touchObj || e, offsetParent);
52127
51725
  }
52128
-
51726
+
52129
51727
  // Create an data object exposed by <DraggableCore>'s events
52130
51728
  function createCoreData(draggable /*: DraggableCore*/, x /*: number*/, y /*: number*/) /*: DraggableData*/ {
52131
51729
  var state = draggable.state;
52132
- var isStart = !(0, _shims.isNum)(state.lastX);
52133
-
51730
+ var isStart = !isNum(state.lastX);
51731
+ var node = findDOMNode(draggable);
51732
+
52134
51733
  if (isStart) {
52135
51734
  // If this is our first move, use the x and y as last coords.
52136
51735
  return {
52137
- node: _reactDom2.default.findDOMNode(draggable),
51736
+ node: node,
52138
51737
  deltaX: 0, deltaY: 0,
52139
51738
  lastX: x, lastY: y,
52140
51739
  x: x, y: y
@@ -52142,27 +51741,28 @@ module.exports =
52142
51741
  } else {
52143
51742
  // Otherwise calculate proper values.
52144
51743
  return {
52145
- node: _reactDom2.default.findDOMNode(draggable),
51744
+ node: node,
52146
51745
  deltaX: x - state.lastX, deltaY: y - state.lastY,
52147
51746
  lastX: state.lastX, lastY: state.lastY,
52148
51747
  x: x, y: y
52149
51748
  };
52150
51749
  }
52151
51750
  }
52152
-
51751
+
52153
51752
  // Create an data exposed by <Draggable>'s events
52154
51753
  function createDraggableData(draggable /*: Draggable*/, coreData /*: DraggableData*/) /*: DraggableData*/ {
51754
+ var scale = draggable.props.scale;
52155
51755
  return {
52156
51756
  node: coreData.node,
52157
- x: draggable.state.x + coreData.deltaX,
52158
- y: draggable.state.y + coreData.deltaY,
52159
- deltaX: coreData.deltaX,
52160
- deltaY: coreData.deltaY,
51757
+ x: draggable.state.x + coreData.deltaX / scale,
51758
+ y: draggable.state.y + coreData.deltaY / scale,
51759
+ deltaX: coreData.deltaX / scale,
51760
+ deltaY: coreData.deltaY / scale,
52161
51761
  lastX: draggable.state.x,
52162
51762
  lastY: draggable.state.y
52163
51763
  };
52164
51764
  }
52165
-
51765
+
52166
51766
  // A lot faster than stringify/parse
52167
51767
  function cloneBounds(bounds /*: Bounds*/) /*: Bounds*/ {
52168
51768
  return {
@@ -52173,52 +51773,24 @@ module.exports =
52173
51773
  };
52174
51774
  }
52175
51775
 
52176
- /***/ },
52177
- /* 17 */
52178
- /***/ function(module, exports, __webpack_require__) {
51776
+ function findDOMNode(draggable /*: Draggable | DraggableCore*/) /*: HTMLElement*/ {
51777
+ var node = ReactDOM.findDOMNode(draggable);
51778
+ if (!node) {
51779
+ throw new Error('<DraggableCore>: Unmounted during event!');
51780
+ }
51781
+ // $FlowIgnore we can't assert on HTMLElement due to tests... FIXME
51782
+ return node;
51783
+ }
51784
+
51785
+ /*eslint no-console:0*/
51786
+ function log() {
51787
+ }
51788
+
51789
+ /*:: import type {EventHandler, MouseTouchEvent} from './utils/types';*/
51790
+
52179
51791
 
52180
- /* WEBPACK VAR INJECTION */(function(process) {'use strict';
52181
-
52182
- Object.defineProperty(exports, "__esModule", {
52183
- value: true
52184
- });
52185
-
52186
- var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
52187
-
52188
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
52189
-
52190
- var _react = __webpack_require__(2);
52191
-
52192
- var _react2 = _interopRequireDefault(_react);
52193
-
52194
- var _propTypes = __webpack_require__(3);
52195
-
52196
- var _propTypes2 = _interopRequireDefault(_propTypes);
52197
-
52198
- var _reactDom = __webpack_require__(11);
52199
-
52200
- var _reactDom2 = _interopRequireDefault(_reactDom);
52201
-
52202
- var _domFns = __webpack_require__(13);
52203
-
52204
- var _positionFns = __webpack_require__(16);
52205
-
52206
- var _shims = __webpack_require__(14);
52207
-
52208
- var _log = __webpack_require__(19);
52209
-
52210
- var _log2 = _interopRequireDefault(_log);
52211
-
52212
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
52213
-
52214
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
52215
-
52216
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
52217
-
52218
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
52219
-
52220
51792
  // Simple abstraction for dragging events names.
52221
- /*:: import type {EventHandler} from './utils/types';*/
51793
+ /*:: import type {Element as ReactElement} from 'react';*/
52222
51794
  var eventsFor = {
52223
51795
  touch: {
52224
51796
  start: 'touchstart',
@@ -52231,39 +51803,70 @@ module.exports =
52231
51803
  stop: 'mouseup'
52232
51804
  }
52233
51805
  };
52234
-
51806
+
52235
51807
  // Default to mouse events.
52236
51808
  var dragEventFor = eventsFor.mouse;
52237
-
51809
+
51810
+ /*:: type DraggableCoreState = {
51811
+ dragging: boolean,
51812
+ lastX: number,
51813
+ lastY: number,
51814
+ touchIdentifier: ?number
51815
+ };*/
51816
+ /*:: export type DraggableBounds = {
51817
+ left: number,
51818
+ right: number,
51819
+ top: number,
51820
+ bottom: number,
51821
+ };*/
51822
+ /*:: export type DraggableData = {
51823
+ node: HTMLElement,
51824
+ x: number, y: number,
51825
+ deltaX: number, deltaY: number,
51826
+ lastX: number, lastY: number,
51827
+ };*/
51828
+ /*:: export type DraggableEventHandler = (e: MouseEvent, data: DraggableData) => void;*/
51829
+ /*:: export type ControlPosition = {x: number, y: number};*/
51830
+ /*:: export type PositionOffsetControlPosition = {x: number|string, y: number|string};*/
51831
+
51832
+
52238
51833
  //
52239
51834
  // Define <DraggableCore>.
52240
51835
  //
52241
51836
  // <DraggableCore> is for advanced usage of <Draggable>. It maintains minimal internal state so it can
52242
51837
  // work well with libraries that require more control over the element.
52243
51838
  //
52244
-
52245
- /*:: type CoreState = {
52246
- dragging: boolean,
52247
- lastX: number,
52248
- lastY: number,
52249
- touchIdentifier: ?number
51839
+
51840
+ /*:: export type DraggableCoreProps = {
51841
+ allowAnyClick: boolean,
51842
+ cancel: string,
51843
+ children: ReactElement<any>,
51844
+ disabled: boolean,
51845
+ enableUserSelectHack: boolean,
51846
+ offsetParent: HTMLElement,
51847
+ grid: [number, number],
51848
+ handle: string,
51849
+ onStart: DraggableEventHandler,
51850
+ onDrag: DraggableEventHandler,
51851
+ onStop: DraggableEventHandler,
51852
+ onMouseDown: (e: MouseEvent) => void,
52250
51853
  };*/
52251
-
51854
+
52252
51855
  var DraggableCore = function (_React$Component) {
52253
- _inherits(DraggableCore, _React$Component);
52254
-
51856
+ inherits(DraggableCore, _React$Component);
51857
+
52255
51858
  function DraggableCore() {
52256
51859
  var _ref;
52257
-
51860
+
52258
51861
  var _temp, _this, _ret;
52259
-
52260
- _classCallCheck(this, DraggableCore);
52261
-
51862
+
51863
+ classCallCheck(this, DraggableCore);
51864
+
52262
51865
  for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
52263
51866
  args[_key] = arguments[_key];
52264
51867
  }
52265
-
52266
- return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = DraggableCore.__proto__ || Object.getPrototypeOf(DraggableCore)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
51868
+
51869
+ return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref = DraggableCore.__proto__ || Object.getPrototypeOf(DraggableCore)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
52267
51870
  dragging: false,
52268
51871
  // Used while dragging to determine deltas.
52269
51872
  lastX: NaN, lastY: NaN,
@@ -52271,94 +51874,93 @@ module.exports =
52271
51874
  }, _this.handleDragStart = function (e) {
52272
51875
  // Make it possible to attach event handlers on top of this one.
52273
51876
  _this.props.onMouseDown(e);
52274
-
51877
+
52275
51878
  // Only accept left-clicks.
52276
51879
  if (!_this.props.allowAnyClick && typeof e.button === 'number' && e.button !== 0) return false;
52277
-
51880
+
52278
51881
  // Get nodes. Be sure to grab relative document (could be iframed)
52279
- var domNode = _reactDom2.default.findDOMNode(_this);
52280
- var ownerDocument = domNode.ownerDocument;
52281
-
51882
+ var thisNode = ReactDOM.findDOMNode(_this);
51883
+ if (!thisNode || !thisNode.ownerDocument || !thisNode.ownerDocument.body) {
51884
+ throw new Error('<DraggableCore> not mounted on DragStart!');
51885
+ }
51886
+ var ownerDocument = thisNode.ownerDocument;
51887
+
52282
51888
  // Short circuit if handle or cancel prop was provided and selector doesn't match.
52283
-
52284
- if (_this.props.disabled || !(e.target instanceof ownerDocument.defaultView.Node) || _this.props.handle && !(0, _domFns.matchesSelectorAndParentsTo)(e.target, _this.props.handle, domNode) || _this.props.cancel && (0, _domFns.matchesSelectorAndParentsTo)(e.target, _this.props.cancel, domNode)) {
51889
+
51890
+ 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)) {
52285
51891
  return;
52286
51892
  }
52287
-
51893
+
52288
51894
  // Set touch identifier in component state if this is a touch event. This allows us to
52289
51895
  // distinguish between individual touches on multitouch screens by identifying which
52290
51896
  // touchpoint was set to this element.
52291
- var touchIdentifier = (0, _domFns.getTouchIdentifier)(e);
51897
+ var touchIdentifier = getTouchIdentifier(e);
52292
51898
  _this.setState({ touchIdentifier: touchIdentifier });
52293
-
51899
+
52294
51900
  // Get the current drag point from the event. This is used as the offset.
52295
- var position = (0, _positionFns.getControlPosition)(e, touchIdentifier, _this);
51901
+ var position = getControlPosition(e, touchIdentifier, _this);
52296
51902
  if (position == null) return; // not possible but satisfies flow
52297
51903
  var x = position.x,
52298
51904
  y = position.y;
52299
-
51905
+
52300
51906
  // Create an event object with all the data parents need to make a decision here.
52301
-
52302
- var coreEvent = (0, _positionFns.createCoreData)(_this, x, y);
52303
-
52304
- (0, _log2.default)('DraggableCore: handleDragStart: %j', coreEvent);
52305
-
51907
+
51908
+ var coreEvent = createCoreData(_this, x, y);
51909
+
52306
51910
  // Call event handler. If it returns explicit false, cancel.
52307
- (0, _log2.default)('calling', _this.props.onStart);
51911
+ log('calling', _this.props.onStart);
52308
51912
  var shouldUpdate = _this.props.onStart(e, coreEvent);
52309
51913
  if (shouldUpdate === false) return;
52310
-
51914
+
52311
51915
  // Add a style to the body to disable user-select. This prevents text from
52312
51916
  // being selected all over the page.
52313
- if (_this.props.enableUserSelectHack) (0, _domFns.addUserSelectStyles)(ownerDocument.body);
52314
-
51917
+ if (_this.props.enableUserSelectHack) addUserSelectStyles(ownerDocument);
51918
+
52315
51919
  // Initiate dragging. Set the current x and y as offsets
52316
51920
  // so we know how much we've moved during the drag. This allows us
52317
51921
  // to drag elements around even if they have been moved, without issue.
52318
51922
  _this.setState({
52319
51923
  dragging: true,
52320
-
51924
+
52321
51925
  lastX: x,
52322
51926
  lastY: y
52323
51927
  });
52324
-
51928
+
52325
51929
  // Add events to the document directly so we catch when the user's mouse/touch moves outside of
52326
51930
  // this element. We use different events depending on whether or not we have detected that this
52327
51931
  // is a touch-capable device.
52328
- (0, _domFns.addEvent)(ownerDocument, dragEventFor.move, _this.handleDrag);
52329
- (0, _domFns.addEvent)(ownerDocument, dragEventFor.stop, _this.handleDragStop);
51932
+ addEvent(ownerDocument, dragEventFor.move, _this.handleDrag);
51933
+ addEvent(ownerDocument, dragEventFor.stop, _this.handleDragStop);
52330
51934
  }, _this.handleDrag = function (e) {
52331
-
51935
+
52332
51936
  // Prevent scrolling on mobile devices, like ipad/iphone.
52333
51937
  if (e.type === 'touchmove') e.preventDefault();
52334
-
51938
+
52335
51939
  // Get the current drag point from the event. This is used as the offset.
52336
- var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _this);
51940
+ var position = getControlPosition(e, _this.state.touchIdentifier, _this);
52337
51941
  if (position == null) return;
52338
51942
  var x = position.x,
52339
51943
  y = position.y;
52340
-
51944
+
52341
51945
  // Snap to grid if prop has been provided
52342
-
51946
+
52343
51947
  if (Array.isArray(_this.props.grid)) {
52344
- var deltaX = x - _this.state.lastX,
52345
- deltaY = y - _this.state.lastY;
52346
-
52347
- var _snapToGrid = (0, _positionFns.snapToGrid)(_this.props.grid, deltaX, deltaY);
52348
-
52349
- var _snapToGrid2 = _slicedToArray(_snapToGrid, 2);
52350
-
52351
- deltaX = _snapToGrid2[0];
52352
- deltaY = _snapToGrid2[1];
52353
-
52354
- if (!deltaX && !deltaY) return; // skip useless drag
52355
- x = _this.state.lastX + deltaX, y = _this.state.lastY + deltaY;
51948
+ var _deltaX = x - _this.state.lastX,
51949
+ _deltaY = y - _this.state.lastY;
51950
+
51951
+ var _snapToGrid = snapToGrid(_this.props.grid, _deltaX, _deltaY);
51952
+
51953
+ var _snapToGrid2 = slicedToArray(_snapToGrid, 2);
51954
+
51955
+ _deltaX = _snapToGrid2[0];
51956
+ _deltaY = _snapToGrid2[1];
51957
+
51958
+ if (!_deltaX && !_deltaY) return; // skip useless drag
51959
+ x = _this.state.lastX + _deltaX, y = _this.state.lastY + _deltaY;
52356
51960
  }
52357
-
52358
- var coreEvent = (0, _positionFns.createCoreData)(_this, x, y);
52359
-
52360
- (0, _log2.default)('DraggableCore: handleDrag: %j', coreEvent);
52361
-
51961
+
51962
+ var coreEvent = createCoreData(_this, x, y);
51963
+
52362
51964
  // Call event handler. If it returns explicit false, trigger end.
52363
51965
  var shouldUpdate = _this.props.onDrag(e, coreEvent);
52364
51966
  if (shouldUpdate === false) {
@@ -52375,144 +51977,494 @@ module.exports =
52375
51977
  }
52376
51978
  return;
52377
51979
  }
52378
-
51980
+
52379
51981
  _this.setState({
52380
51982
  lastX: x,
52381
51983
  lastY: y
52382
51984
  });
52383
51985
  }, _this.handleDragStop = function (e) {
52384
51986
  if (!_this.state.dragging) return;
52385
-
52386
- var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _this);
51987
+
51988
+ var position = getControlPosition(e, _this.state.touchIdentifier, _this);
52387
51989
  if (position == null) return;
52388
51990
  var x = position.x,
52389
51991
  y = position.y;
52390
-
52391
- var coreEvent = (0, _positionFns.createCoreData)(_this, x, y);
52392
-
52393
- var _ReactDOM$findDOMNode = _reactDom2.default.findDOMNode(_this),
52394
- ownerDocument = _ReactDOM$findDOMNode.ownerDocument;
52395
-
52396
- // Remove user-select hack
52397
-
52398
-
52399
- if (_this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(ownerDocument.body);
52400
-
52401
- (0, _log2.default)('DraggableCore: handleDragStop: %j', coreEvent);
52402
-
51992
+
51993
+ var coreEvent = createCoreData(_this, x, y);
51994
+
51995
+ var thisNode = ReactDOM.findDOMNode(_this);
51996
+ if (thisNode) {
51997
+ // Remove user-select hack
51998
+ if (_this.props.enableUserSelectHack) removeUserSelectStyles(thisNode.ownerDocument);
51999
+ }
52000
+
52403
52001
  // Reset the el.
52404
52002
  _this.setState({
52405
52003
  dragging: false,
52406
52004
  lastX: NaN,
52407
52005
  lastY: NaN
52408
52006
  });
52409
-
52007
+
52410
52008
  // Call event handler
52411
52009
  _this.props.onStop(e, coreEvent);
52412
-
52413
- // Remove event handlers
52414
- (0, _log2.default)('DraggableCore: Removing handlers');
52415
- (0, _domFns.removeEvent)(ownerDocument, dragEventFor.move, _this.handleDrag);
52416
- (0, _domFns.removeEvent)(ownerDocument, dragEventFor.stop, _this.handleDragStop);
52010
+
52011
+ if (thisNode) {
52012
+ removeEvent(thisNode.ownerDocument, dragEventFor.move, _this.handleDrag);
52013
+ removeEvent(thisNode.ownerDocument, dragEventFor.stop, _this.handleDragStop);
52014
+ }
52417
52015
  }, _this.onMouseDown = function (e) {
52418
52016
  dragEventFor = eventsFor.mouse; // on touchscreen laptops we could switch back to mouse
52419
-
52017
+
52420
52018
  return _this.handleDragStart(e);
52421
52019
  }, _this.onMouseUp = function (e) {
52422
52020
  dragEventFor = eventsFor.mouse;
52423
-
52021
+
52424
52022
  return _this.handleDragStop(e);
52425
52023
  }, _this.onTouchStart = function (e) {
52426
52024
  // We're on a touch device now, so change the event handlers
52427
52025
  dragEventFor = eventsFor.touch;
52428
-
52026
+
52429
52027
  return _this.handleDragStart(e);
52430
52028
  }, _this.onTouchEnd = function (e) {
52431
52029
  // We're on a touch device now, so change the event handlers
52432
52030
  dragEventFor = eventsFor.touch;
52433
-
52031
+
52434
52032
  return _this.handleDragStop(e);
52435
- }, _temp), _possibleConstructorReturn(_this, _ret);
52033
+ }, _temp), possibleConstructorReturn(_this, _ret);
52436
52034
  }
52437
-
52438
- _createClass(DraggableCore, [{
52035
+
52036
+ createClass(DraggableCore, [{
52037
+ key: 'componentWillUnmount',
52038
+ value: function componentWillUnmount() {
52039
+ // Remove any leftover event handlers. Remove both touch and mouse handlers in case
52040
+ // some browser quirk caused a touch event to fire during a mouse move, or vice versa.
52041
+ var thisNode = ReactDOM.findDOMNode(this);
52042
+ if (thisNode) {
52043
+ var ownerDocument = thisNode.ownerDocument;
52044
+
52045
+ removeEvent(ownerDocument, eventsFor.mouse.move, this.handleDrag);
52046
+ removeEvent(ownerDocument, eventsFor.touch.move, this.handleDrag);
52047
+ removeEvent(ownerDocument, eventsFor.mouse.stop, this.handleDragStop);
52048
+ removeEvent(ownerDocument, eventsFor.touch.stop, this.handleDragStop);
52049
+ if (this.props.enableUserSelectHack) removeUserSelectStyles(ownerDocument);
52050
+ }
52051
+ }
52052
+
52053
+ // Same as onMouseDown (start drag), but now consider this a touch device.
52054
+
52055
+ }, {
52056
+ key: 'render',
52057
+ value: function render() {
52058
+ // Reuse the child provided
52059
+ // This makes it flexible to use whatever element is wanted (div, ul, etc)
52060
+ return React.cloneElement(React.Children.only(this.props.children), {
52061
+ style: styleHacks(this.props.children.props.style),
52062
+
52063
+ // Note: mouseMove handler is attached to document so it will still function
52064
+ // when the user drags quickly and leaves the bounds of the element.
52065
+ onMouseDown: this.onMouseDown,
52066
+ onTouchStart: this.onTouchStart,
52067
+ onMouseUp: this.onMouseUp,
52068
+ onTouchEnd: this.onTouchEnd
52069
+ });
52070
+ }
52071
+ }]);
52072
+ return DraggableCore;
52073
+ }(React.Component);
52074
+
52075
+ DraggableCore.displayName = 'DraggableCore';
52076
+ DraggableCore.propTypes = {
52077
+ /**
52078
+ * `allowAnyClick` allows dragging using any mouse button.
52079
+ * By default, we only accept the left button.
52080
+ *
52081
+ * Defaults to `false`.
52082
+ */
52083
+ allowAnyClick: propTypes.bool,
52084
+
52085
+ /**
52086
+ * `disabled`, if true, stops the <Draggable> from dragging. All handlers,
52087
+ * with the exception of `onMouseDown`, will not fire.
52088
+ */
52089
+ disabled: propTypes.bool,
52090
+
52091
+ /**
52092
+ * By default, we add 'user-select:none' attributes to the document body
52093
+ * to prevent ugly text selection during drag. If this is causing problems
52094
+ * for your app, set this to `false`.
52095
+ */
52096
+ enableUserSelectHack: propTypes.bool,
52097
+
52098
+ /**
52099
+ * `offsetParent`, if set, uses the passed DOM node to compute drag offsets
52100
+ * instead of using the parent node.
52101
+ */
52102
+ offsetParent: function offsetParent(props /*: DraggableCoreProps*/, propName /*: $Keys<DraggableCoreProps>*/) {
52103
+ if (props[propName] && props[propName].nodeType !== 1) {
52104
+ throw new Error('Draggable\'s offsetParent must be a DOM Node.');
52105
+ }
52106
+ },
52107
+
52108
+ /**
52109
+ * `grid` specifies the x and y that dragging should snap to.
52110
+ */
52111
+ grid: propTypes.arrayOf(propTypes.number),
52112
+
52113
+ /**
52114
+ * `scale` specifies the scale of the area you are dragging inside of. It allows
52115
+ * the drag deltas to scale correctly with how far zoomed in/out you are.
52116
+ */
52117
+ scale: propTypes.number,
52118
+
52119
+ /**
52120
+ * `handle` specifies a selector to be used as the handle that initiates drag.
52121
+ *
52122
+ * Example:
52123
+ *
52124
+ * ```jsx
52125
+ * let App = React.createClass({
52126
+ * render: function () {
52127
+ * return (
52128
+ * <Draggable handle=".handle">
52129
+ * <div>
52130
+ * <div className="handle">Click me to drag</div>
52131
+ * <div>This is some other content</div>
52132
+ * </div>
52133
+ * </Draggable>
52134
+ * );
52135
+ * }
52136
+ * });
52137
+ * ```
52138
+ */
52139
+ handle: propTypes.string,
52140
+
52141
+ /**
52142
+ * `cancel` specifies a selector to be used to prevent drag initialization.
52143
+ *
52144
+ * Example:
52145
+ *
52146
+ * ```jsx
52147
+ * let App = React.createClass({
52148
+ * render: function () {
52149
+ * return(
52150
+ * <Draggable cancel=".cancel">
52151
+ * <div>
52152
+ * <div className="cancel">You can't drag from here</div>
52153
+ * <div>Dragging here works fine</div>
52154
+ * </div>
52155
+ * </Draggable>
52156
+ * );
52157
+ * }
52158
+ * });
52159
+ * ```
52160
+ */
52161
+ cancel: propTypes.string,
52162
+
52163
+ /**
52164
+ * Called when dragging starts.
52165
+ * If this function returns the boolean false, dragging will be canceled.
52166
+ */
52167
+ onStart: propTypes.func,
52168
+
52169
+ /**
52170
+ * Called while dragging.
52171
+ * If this function returns the boolean false, dragging will be canceled.
52172
+ */
52173
+ onDrag: propTypes.func,
52174
+
52175
+ /**
52176
+ * Called when dragging stops.
52177
+ * If this function returns the boolean false, the drag will remain active.
52178
+ */
52179
+ onStop: propTypes.func,
52180
+
52181
+ /**
52182
+ * A workaround option which can be passed if onMouseDown needs to be accessed,
52183
+ * since it'll always be blocked (as there is internal use of onMouseDown)
52184
+ */
52185
+ onMouseDown: propTypes.func,
52186
+
52187
+ /**
52188
+ * These properties should be defined on the child, not here.
52189
+ */
52190
+ className: dontSetMe,
52191
+ style: dontSetMe,
52192
+ transform: dontSetMe
52193
+ };
52194
+ DraggableCore.defaultProps = {
52195
+ allowAnyClick: false, // by default only accept left click
52196
+ cancel: null,
52197
+ disabled: false,
52198
+ enableUserSelectHack: true,
52199
+ offsetParent: null,
52200
+ handle: null,
52201
+ grid: null,
52202
+ transform: null,
52203
+ onStart: function onStart() {},
52204
+ onDrag: function onDrag() {},
52205
+ onStop: function onStop() {},
52206
+ onMouseDown: function onMouseDown() {}
52207
+ };
52208
+
52209
+ /*:: import type {DraggableEventHandler} from './utils/types';*/
52210
+ /*:: import type {Element as ReactElement} from 'react';*/
52211
+ /*:: type DraggableState = {
52212
+ dragging: boolean,
52213
+ dragged: boolean,
52214
+ x: number, y: number,
52215
+ slackX: number, slackY: number,
52216
+ isElementSVG: boolean
52217
+ };*/
52218
+
52219
+
52220
+ //
52221
+ // Define <Draggable>
52222
+ //
52223
+
52224
+ /*:: export type DraggableProps = {
52225
+ ...$Exact<DraggableCoreProps>,
52226
+ axis: 'both' | 'x' | 'y' | 'none',
52227
+ bounds: DraggableBounds | string | false,
52228
+ defaultClassName: string,
52229
+ defaultClassNameDragging: string,
52230
+ defaultClassNameDragged: string,
52231
+ defaultPosition: ControlPosition,
52232
+ positionOffset: PositionOffsetControlPosition,
52233
+ position: ControlPosition,
52234
+ scale: number
52235
+ };*/
52236
+
52237
+ var Draggable = function (_React$Component) {
52238
+ inherits(Draggable, _React$Component);
52239
+
52240
+ function Draggable(props /*: DraggableProps*/) {
52241
+ classCallCheck(this, Draggable);
52242
+
52243
+ var _this = possibleConstructorReturn(this, (Draggable.__proto__ || Object.getPrototypeOf(Draggable)).call(this, props));
52244
+
52245
+ _this.onDragStart = function (e, coreData) {
52246
+
52247
+ // Short-circuit if user's callback killed it.
52248
+ var shouldStart = _this.props.onStart(e, createDraggableData(_this, coreData));
52249
+ // Kills start event on core as well, so move handlers are never bound.
52250
+ if (shouldStart === false) return false;
52251
+
52252
+ _this.setState({ dragging: true, dragged: true });
52253
+ };
52254
+
52255
+ _this.onDrag = function (e, coreData) {
52256
+ if (!_this.state.dragging) return false;
52257
+
52258
+ var uiData = createDraggableData(_this, coreData);
52259
+
52260
+ var newState /*: $Shape<DraggableState>*/ = {
52261
+ x: uiData.x,
52262
+ y: uiData.y
52263
+ };
52264
+
52265
+ // Keep within bounds.
52266
+ if (_this.props.bounds) {
52267
+ // Save original x and y.
52268
+ var _x = newState.x,
52269
+ _y = newState.y;
52270
+
52271
+ // Add slack to the values used to calculate bound position. This will ensure that if
52272
+ // we start removing slack, the element won't react to it right away until it's been
52273
+ // completely removed.
52274
+
52275
+ newState.x += _this.state.slackX;
52276
+ newState.y += _this.state.slackY;
52277
+
52278
+ // Get bound position. This will ceil/floor the x and y within the boundaries.
52279
+
52280
+ var _getBoundPosition = getBoundPosition(_this, newState.x, newState.y),
52281
+ _getBoundPosition2 = slicedToArray(_getBoundPosition, 2),
52282
+ newStateX = _getBoundPosition2[0],
52283
+ newStateY = _getBoundPosition2[1];
52284
+
52285
+ newState.x = newStateX;
52286
+ newState.y = newStateY;
52287
+
52288
+ // Recalculate slack by noting how much was shaved by the boundPosition handler.
52289
+ newState.slackX = _this.state.slackX + (_x - newState.x);
52290
+ newState.slackY = _this.state.slackY + (_y - newState.y);
52291
+
52292
+ // Update the event we fire to reflect what really happened after bounds took effect.
52293
+ uiData.x = newState.x;
52294
+ uiData.y = newState.y;
52295
+ uiData.deltaX = newState.x - _this.state.x;
52296
+ uiData.deltaY = newState.y - _this.state.y;
52297
+ }
52298
+
52299
+ // Short-circuit if user's callback killed it.
52300
+ var shouldUpdate = _this.props.onDrag(e, uiData);
52301
+ if (shouldUpdate === false) return false;
52302
+
52303
+ _this.setState(newState);
52304
+ };
52305
+
52306
+ _this.onDragStop = function (e, coreData) {
52307
+ if (!_this.state.dragging) return false;
52308
+
52309
+ // Short-circuit if user's callback killed it.
52310
+ var shouldStop = _this.props.onStop(e, createDraggableData(_this, coreData));
52311
+ if (shouldStop === false) return false;
52312
+
52313
+ var newState /*: $Shape<DraggableState>*/ = {
52314
+ dragging: false,
52315
+ slackX: 0,
52316
+ slackY: 0
52317
+ };
52318
+
52319
+ // If this is a controlled component, the result of this operation will be to
52320
+ // revert back to the old position. We expect a handler on `onDragStop`, at the least.
52321
+ var controlled = Boolean(_this.props.position);
52322
+ if (controlled) {
52323
+ var _this$props$position = _this.props.position,
52324
+ _x2 = _this$props$position.x,
52325
+ _y2 = _this$props$position.y;
52326
+
52327
+ newState.x = _x2;
52328
+ newState.y = _y2;
52329
+ }
52330
+
52331
+ _this.setState(newState);
52332
+ };
52333
+
52334
+ _this.state = {
52335
+ // Whether or not we are currently dragging.
52336
+ dragging: false,
52337
+
52338
+ // Whether or not we have been dragged before.
52339
+ dragged: false,
52340
+
52341
+ // Current transform x and y.
52342
+ x: props.position ? props.position.x : props.defaultPosition.x,
52343
+ y: props.position ? props.position.y : props.defaultPosition.y,
52344
+
52345
+ // Used for compensating for out-of-bounds drags
52346
+ slackX: 0, slackY: 0,
52347
+
52348
+ // Can only determine if SVG after mounting
52349
+ isElementSVG: false
52350
+ };
52351
+
52352
+ if (props.position && !(props.onDrag || props.onStop)) {
52353
+ // eslint-disable-next-line no-console
52354
+ 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.');
52355
+ }
52356
+ return _this;
52357
+ }
52358
+
52359
+ createClass(Draggable, [{
52360
+ key: 'componentDidMount',
52361
+ value: function componentDidMount() {
52362
+ // Check to see if the element passed is an instanceof SVGElement
52363
+ if (typeof window.SVGElement !== 'undefined' && ReactDOM.findDOMNode(this) instanceof window.SVGElement) {
52364
+ this.setState({ isElementSVG: true });
52365
+ }
52366
+ }
52367
+ }, {
52368
+ key: 'componentWillReceiveProps',
52369
+ value: function componentWillReceiveProps(nextProps /*: Object*/) {
52370
+ // Set x/y if position has changed
52371
+ if (nextProps.position && (!this.props.position || nextProps.position.x !== this.props.position.x || nextProps.position.y !== this.props.position.y)) {
52372
+ this.setState({ x: nextProps.position.x, y: nextProps.position.y });
52373
+ }
52374
+ }
52375
+ }, {
52439
52376
  key: 'componentWillUnmount',
52440
52377
  value: function componentWillUnmount() {
52441
- // Remove any leftover event handlers. Remove both touch and mouse handlers in case
52442
- // some browser quirk caused a touch event to fire during a mouse move, or vice versa.
52443
- var _ReactDOM$findDOMNode2 = _reactDom2.default.findDOMNode(this),
52444
- ownerDocument = _ReactDOM$findDOMNode2.ownerDocument;
52445
-
52446
- (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.move, this.handleDrag);
52447
- (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.move, this.handleDrag);
52448
- (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.stop, this.handleDragStop);
52449
- (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.stop, this.handleDragStop);
52450
- if (this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(ownerDocument.body);
52378
+ this.setState({ dragging: false }); // prevents invariant if unmounted while dragging
52451
52379
  }
52452
-
52453
- // Same as onMouseDown (start drag), but now consider this a touch device.
52454
-
52455
52380
  }, {
52456
52381
  key: 'render',
52457
- value: function render() /*: React.Element<any>*/ {
52382
+ value: function render() /*: ReactElement<any>*/ {
52383
+ var _classNames;
52384
+
52385
+ var style = {},
52386
+ svgTransform = null;
52387
+
52388
+ // If this is controlled, we don't want to move it - unless it's dragging.
52389
+ var controlled = Boolean(this.props.position);
52390
+ var draggable = !controlled || this.state.dragging;
52391
+
52392
+ var position = this.props.position || this.props.defaultPosition;
52393
+ var transformOpts = {
52394
+ // Set left if horizontal drag is enabled
52395
+ x: canDragX(this) && draggable ? this.state.x : position.x,
52396
+
52397
+ // Set top if vertical drag is enabled
52398
+ y: canDragY(this) && draggable ? this.state.y : position.y
52399
+ };
52400
+
52401
+ // If this element was SVG, we use the `transform` attribute.
52402
+ if (this.state.isElementSVG) {
52403
+ svgTransform = createSVGTransform(transformOpts, this.props.positionOffset);
52404
+ } else {
52405
+ // Add a CSS transform to move the element around. This allows us to move the element around
52406
+ // without worrying about whether or not it is relatively or absolutely positioned.
52407
+ // If the item you are dragging already has a transform set, wrap it in a <span> so <Draggable>
52408
+ // has a clean slate.
52409
+ style = createCSSTransform(transformOpts, this.props.positionOffset);
52410
+ }
52411
+
52412
+ var _props = this.props,
52413
+ defaultClassName = _props.defaultClassName,
52414
+ defaultClassNameDragging = _props.defaultClassNameDragging,
52415
+ defaultClassNameDragged = _props.defaultClassNameDragged;
52416
+
52417
+
52418
+ var children = React.Children.only(this.props.children);
52419
+
52420
+ // Mark with class while dragging
52421
+ var className = classnames(children.props.className || '', defaultClassName, (_classNames = {}, defineProperty(_classNames, defaultClassNameDragging, this.state.dragging), defineProperty(_classNames, defaultClassNameDragged, this.state.dragged), _classNames));
52422
+
52458
52423
  // Reuse the child provided
52459
52424
  // This makes it flexible to use whatever element is wanted (div, ul, etc)
52460
- return _react2.default.cloneElement(_react2.default.Children.only(this.props.children), {
52461
- style: (0, _domFns.styleHacks)(this.props.children.props.style),
52462
-
52463
- // Note: mouseMove handler is attached to document so it will still function
52464
- // when the user drags quickly and leaves the bounds of the element.
52465
- onMouseDown: this.onMouseDown,
52466
- onTouchStart: this.onTouchStart,
52467
- onMouseUp: this.onMouseUp,
52468
- onTouchEnd: this.onTouchEnd
52469
- });
52425
+ return React.createElement(
52426
+ DraggableCore,
52427
+ _extends({}, this.props, { onStart: this.onDragStart, onDrag: this.onDrag, onStop: this.onDragStop }),
52428
+ React.cloneElement(children, {
52429
+ className: className,
52430
+ style: _extends({}, children.props.style, style),
52431
+ transform: svgTransform
52432
+ })
52433
+ );
52470
52434
  }
52471
52435
  }]);
52472
-
52473
- return DraggableCore;
52474
- }(_react2.default.Component);
52475
-
52476
- DraggableCore.displayName = 'DraggableCore';
52477
- DraggableCore.propTypes = {
52436
+ return Draggable;
52437
+ }(React.Component);
52438
+
52439
+ Draggable.displayName = 'Draggable';
52440
+ Draggable.propTypes = _extends({}, DraggableCore.propTypes, {
52441
+
52478
52442
  /**
52479
- * `allowAnyClick` allows dragging using any mouse button.
52480
- * By default, we only accept the left button.
52443
+ * `axis` determines which axis the draggable can move.
52481
52444
  *
52482
- * Defaults to `false`.
52483
- */
52484
- allowAnyClick: _propTypes2.default.bool,
52485
-
52486
- /**
52487
- * `disabled`, if true, stops the <Draggable> from dragging. All handlers,
52488
- * with the exception of `onMouseDown`, will not fire.
52489
- */
52490
- disabled: _propTypes2.default.bool,
52491
-
52492
- /**
52493
- * By default, we add 'user-select:none' attributes to the document body
52494
- * to prevent ugly text selection during drag. If this is causing problems
52495
- * for your app, set this to `false`.
52496
- */
52497
- enableUserSelectHack: _propTypes2.default.bool,
52498
-
52499
- /**
52500
- * `offsetParent`, if set, uses the passed DOM node to compute drag offsets
52501
- * instead of using the parent node.
52502
- */
52503
- offsetParent: function offsetParent(props, propName) {
52504
- if (process.browser && props[propName] && props[propName].nodeType !== 1) {
52505
- throw new Error('Draggable\'s offsetParent must be a DOM Node.');
52506
- }
52507
- },
52508
-
52509
- /**
52510
- * `grid` specifies the x and y that dragging should snap to.
52445
+ * Note that all callbacks will still return data as normal. This only
52446
+ * controls flushing to the DOM.
52447
+ *
52448
+ * 'both' allows movement horizontally and vertically.
52449
+ * 'x' limits movement to horizontal axis.
52450
+ * 'y' limits movement to vertical axis.
52451
+ * 'none' limits all movement.
52452
+ *
52453
+ * Defaults to 'both'.
52511
52454
  */
52512
- grid: _propTypes2.default.arrayOf(_propTypes2.default.number),
52513
-
52455
+ axis: propTypes.oneOf(['both', 'x', 'y', 'none']),
52456
+
52514
52457
  /**
52515
- * `handle` specifies a selector to be used as the handle that initiates drag.
52458
+ * `bounds` determines the range of movement available to the element.
52459
+ * Available values are:
52460
+ *
52461
+ * 'parent' restricts movement within the Draggable's parent node.
52462
+ *
52463
+ * Alternatively, pass an object with the following properties, all of which are optional:
52464
+ *
52465
+ * {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND}
52466
+ *
52467
+ * All values are in px.
52516
52468
  *
52517
52469
  * Example:
52518
52470
  *
@@ -52520,299 +52472,107 @@ module.exports =
52520
52472
  * let App = React.createClass({
52521
52473
  * render: function () {
52522
52474
  * return (
52523
- * <Draggable handle=".handle">
52524
- * <div>
52525
- * <div className="handle">Click me to drag</div>
52526
- * <div>This is some other content</div>
52527
- * </div>
52475
+ * <Draggable bounds={{right: 300, bottom: 300}}>
52476
+ * <div>Content</div>
52528
52477
  * </Draggable>
52529
52478
  * );
52530
52479
  * }
52531
52480
  * });
52532
52481
  * ```
52533
52482
  */
52534
- handle: _propTypes2.default.string,
52535
-
52483
+ bounds: propTypes.oneOfType([propTypes.shape({
52484
+ left: propTypes.number,
52485
+ right: propTypes.number,
52486
+ top: propTypes.number,
52487
+ bottom: propTypes.number
52488
+ }), propTypes.string, propTypes.oneOf([false])]),
52489
+
52490
+ defaultClassName: propTypes.string,
52491
+ defaultClassNameDragging: propTypes.string,
52492
+ defaultClassNameDragged: propTypes.string,
52493
+
52536
52494
  /**
52537
- * `cancel` specifies a selector to be used to prevent drag initialization.
52495
+ * `defaultPosition` specifies the x and y that the dragged item should start at
52538
52496
  *
52539
52497
  * Example:
52540
52498
  *
52541
52499
  * ```jsx
52542
- * let App = React.createClass({
52543
- * render: function () {
52544
- * return(
52545
- * <Draggable cancel=".cancel">
52546
- * <div>
52547
- * <div className="cancel">You can't drag from here</div>
52548
- * <div>Dragging here works fine</div>
52549
- * </div>
52550
- * </Draggable>
52551
- * );
52552
- * }
52553
- * });
52500
+ * let App = React.createClass({
52501
+ * render: function () {
52502
+ * return (
52503
+ * <Draggable defaultPosition={{x: 25, y: 25}}>
52504
+ * <div>I start with transformX: 25px and transformY: 25px;</div>
52505
+ * </Draggable>
52506
+ * );
52507
+ * }
52508
+ * });
52554
52509
  * ```
52555
52510
  */
52556
- cancel: _propTypes2.default.string,
52557
-
52558
- /**
52559
- * Called when dragging starts.
52560
- * If this function returns the boolean false, dragging will be canceled.
52561
- */
52562
- onStart: _propTypes2.default.func,
52563
-
52564
- /**
52565
- * Called while dragging.
52566
- * If this function returns the boolean false, dragging will be canceled.
52567
- */
52568
- onDrag: _propTypes2.default.func,
52569
-
52570
- /**
52571
- * Called when dragging stops.
52572
- * If this function returns the boolean false, the drag will remain active.
52573
- */
52574
- onStop: _propTypes2.default.func,
52575
-
52511
+ defaultPosition: propTypes.shape({
52512
+ x: propTypes.number,
52513
+ y: propTypes.number
52514
+ }),
52515
+ positionOffset: propTypes.shape({
52516
+ x: propTypes.oneOfType([propTypes.number, propTypes.string]),
52517
+ y: propTypes.oneOfType([propTypes.number, propTypes.string])
52518
+ }),
52519
+
52576
52520
  /**
52577
- * A workaround option which can be passed if onMouseDown needs to be accessed,
52578
- * since it'll always be blocked (as there is internal use of onMouseDown)
52521
+ * `position`, if present, defines the current position of the element.
52522
+ *
52523
+ * This is similar to how form elements in React work - if no `position` is supplied, the component
52524
+ * is uncontrolled.
52525
+ *
52526
+ * Example:
52527
+ *
52528
+ * ```jsx
52529
+ * let App = React.createClass({
52530
+ * render: function () {
52531
+ * return (
52532
+ * <Draggable position={{x: 25, y: 25}}>
52533
+ * <div>I start with transformX: 25px and transformY: 25px;</div>
52534
+ * </Draggable>
52535
+ * );
52536
+ * }
52537
+ * });
52538
+ * ```
52579
52539
  */
52580
- onMouseDown: _propTypes2.default.func,
52581
-
52540
+ position: propTypes.shape({
52541
+ x: propTypes.number,
52542
+ y: propTypes.number
52543
+ }),
52544
+
52582
52545
  /**
52583
52546
  * These properties should be defined on the child, not here.
52584
52547
  */
52585
- className: _shims.dontSetMe,
52586
- style: _shims.dontSetMe,
52587
- transform: _shims.dontSetMe
52588
- };
52589
- DraggableCore.defaultProps = {
52590
- allowAnyClick: false, // by default only accept left click
52591
- cancel: null,
52592
- disabled: false,
52593
- enableUserSelectHack: true,
52594
- offsetParent: null,
52595
- handle: null,
52596
- grid: null,
52597
- transform: null,
52598
- onStart: function onStart() {},
52599
- onDrag: function onDrag() {},
52600
- onStop: function onStop() {},
52601
- onMouseDown: function onMouseDown() {}
52602
- };
52603
- exports.default = DraggableCore;
52604
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(18)))
52605
-
52606
- /***/ },
52607
- /* 18 */
52608
- /***/ function(module, exports) {
52609
-
52610
- // shim for using process in browser
52611
- var process = module.exports = {};
52612
-
52613
- // cached from whatever global is present so that test runners that stub it
52614
- // don't break things. But we need to wrap it in a try catch in case it is
52615
- // wrapped in strict mode code which doesn't define any globals. It's inside a
52616
- // function because try/catches deoptimize in certain engines.
52617
-
52618
- var cachedSetTimeout;
52619
- var cachedClearTimeout;
52620
-
52621
- function defaultSetTimout() {
52622
- throw new Error('setTimeout has not been defined');
52623
- }
52624
- function defaultClearTimeout () {
52625
- throw new Error('clearTimeout has not been defined');
52626
- }
52627
- (function () {
52628
- try {
52629
- if (typeof setTimeout === 'function') {
52630
- cachedSetTimeout = setTimeout;
52631
- } else {
52632
- cachedSetTimeout = defaultSetTimout;
52633
- }
52634
- } catch (e) {
52635
- cachedSetTimeout = defaultSetTimout;
52636
- }
52637
- try {
52638
- if (typeof clearTimeout === 'function') {
52639
- cachedClearTimeout = clearTimeout;
52640
- } else {
52641
- cachedClearTimeout = defaultClearTimeout;
52642
- }
52643
- } catch (e) {
52644
- cachedClearTimeout = defaultClearTimeout;
52645
- }
52646
- } ())
52647
- function runTimeout(fun) {
52648
- if (cachedSetTimeout === setTimeout) {
52649
- //normal enviroments in sane situations
52650
- return setTimeout(fun, 0);
52651
- }
52652
- // if setTimeout wasn't available but was latter defined
52653
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
52654
- cachedSetTimeout = setTimeout;
52655
- return setTimeout(fun, 0);
52656
- }
52657
- try {
52658
- // when when somebody has screwed with setTimeout but no I.E. maddness
52659
- return cachedSetTimeout(fun, 0);
52660
- } catch(e){
52661
- try {
52662
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
52663
- return cachedSetTimeout.call(null, fun, 0);
52664
- } catch(e){
52665
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
52666
- return cachedSetTimeout.call(this, fun, 0);
52667
- }
52668
- }
52669
-
52670
-
52671
- }
52672
- function runClearTimeout(marker) {
52673
- if (cachedClearTimeout === clearTimeout) {
52674
- //normal enviroments in sane situations
52675
- return clearTimeout(marker);
52676
- }
52677
- // if clearTimeout wasn't available but was latter defined
52678
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
52679
- cachedClearTimeout = clearTimeout;
52680
- return clearTimeout(marker);
52681
- }
52682
- try {
52683
- // when when somebody has screwed with setTimeout but no I.E. maddness
52684
- return cachedClearTimeout(marker);
52685
- } catch (e){
52686
- try {
52687
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
52688
- return cachedClearTimeout.call(null, marker);
52689
- } catch (e){
52690
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
52691
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
52692
- return cachedClearTimeout.call(this, marker);
52693
- }
52694
- }
52695
-
52696
-
52697
-
52698
- }
52699
- var queue = [];
52700
- var draining = false;
52701
- var currentQueue;
52702
- var queueIndex = -1;
52703
-
52704
- function cleanUpNextTick() {
52705
- if (!draining || !currentQueue) {
52706
- return;
52707
- }
52708
- draining = false;
52709
- if (currentQueue.length) {
52710
- queue = currentQueue.concat(queue);
52711
- } else {
52712
- queueIndex = -1;
52713
- }
52714
- if (queue.length) {
52715
- drainQueue();
52716
- }
52717
- }
52718
-
52719
- function drainQueue() {
52720
- if (draining) {
52721
- return;
52722
- }
52723
- var timeout = runTimeout(cleanUpNextTick);
52724
- draining = true;
52725
-
52726
- var len = queue.length;
52727
- while(len) {
52728
- currentQueue = queue;
52729
- queue = [];
52730
- while (++queueIndex < len) {
52731
- if (currentQueue) {
52732
- currentQueue[queueIndex].run();
52733
- }
52734
- }
52735
- queueIndex = -1;
52736
- len = queue.length;
52737
- }
52738
- currentQueue = null;
52739
- draining = false;
52740
- runClearTimeout(timeout);
52741
- }
52742
-
52743
- process.nextTick = function (fun) {
52744
- var args = new Array(arguments.length - 1);
52745
- if (arguments.length > 1) {
52746
- for (var i = 1; i < arguments.length; i++) {
52747
- args[i - 1] = arguments[i];
52748
- }
52749
- }
52750
- queue.push(new Item(fun, args));
52751
- if (queue.length === 1 && !draining) {
52752
- runTimeout(drainQueue);
52753
- }
52754
- };
52755
-
52756
- // v8 likes predictible objects
52757
- function Item(fun, array) {
52758
- this.fun = fun;
52759
- this.array = array;
52760
- }
52761
- Item.prototype.run = function () {
52762
- this.fun.apply(null, this.array);
52763
- };
52764
- process.title = 'browser';
52765
- process.browser = true;
52766
- process.env = {};
52767
- process.argv = [];
52768
- process.version = ''; // empty string to avoid regexp issues
52769
- process.versions = {};
52770
-
52771
- function noop() {}
52772
-
52773
- process.on = noop;
52774
- process.addListener = noop;
52775
- process.once = noop;
52776
- process.off = noop;
52777
- process.removeListener = noop;
52778
- process.removeAllListeners = noop;
52779
- process.emit = noop;
52780
-
52781
- process.binding = function (name) {
52782
- throw new Error('process.binding is not supported');
52783
- };
52784
-
52785
- process.cwd = function () { return '/' };
52786
- process.chdir = function (dir) {
52787
- throw new Error('process.chdir is not supported');
52788
- };
52789
- process.umask = function() { return 0; };
52790
-
52548
+ className: dontSetMe,
52549
+ style: dontSetMe,
52550
+ transform: dontSetMe
52551
+ });
52552
+ Draggable.defaultProps = _extends({}, DraggableCore.defaultProps, {
52553
+ axis: 'both',
52554
+ bounds: false,
52555
+ defaultClassName: 'react-draggable',
52556
+ defaultClassNameDragging: 'react-draggable-dragging',
52557
+ defaultClassNameDragged: 'react-draggable-dragged',
52558
+ defaultPosition: { x: 0, y: 0 },
52559
+ position: null,
52560
+ scale: 1
52561
+ });
52791
52562
 
52792
- /***/ },
52793
- /* 19 */
52794
- /***/ function(module, exports, __webpack_require__) {
52563
+ // Previous versions of this lib exported <Draggable> as the root export. As to not break
52564
+ // them, or TypeScript, we export *both* as the root and as 'default'.
52565
+ // See https://github.com/mzabriskie/react-draggable/pull/254
52566
+ // and https://github.com/mzabriskie/react-draggable/issues/266
52567
+ Draggable.default = Draggable;
52568
+ Draggable.DraggableCore = DraggableCore;
52795
52569
 
52796
- "use strict";
52797
-
52798
- Object.defineProperty(exports, "__esModule", {
52799
- value: true
52800
- });
52801
- exports.default = log;
52802
-
52803
- /*eslint no-console:0*/
52804
- function log() {
52805
- var _console;
52806
-
52807
- if ((undefined)) (_console = console).log.apply(_console, arguments);
52808
- }
52570
+ return Draggable;
52809
52571
 
52810
- /***/ }
52811
- /******/ ])
52812
- });
52813
- ;
52572
+ })));
52814
52573
  //# sourceMappingURL=react-draggable.js.map
52815
52574
 
52575
+
52816
52576
  /***/ },
52817
52577
  /* 125 */
52818
52578
  /***/ function(module, exports, __webpack_require__) {