react-resizable 1.7.5 → 1.11.0

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.
Files changed (50) hide show
  1. package/.babelrc +10 -4
  2. package/.browserslistrc +3 -0
  3. package/.eslintrc +10 -6
  4. package/.flowconfig +9 -11
  5. package/CHANGELOG.md +59 -29
  6. package/LICENSE +21 -0
  7. package/README.md +18 -5
  8. package/__tests__/Resizable.test.js +245 -0
  9. package/__tests__/ResizableBox.test.js +99 -0
  10. package/__tests__/__snapshots__/Resizable.test.js.snap +29 -0
  11. package/__tests__/__snapshots__/ResizableBox.test.js.snap +23 -0
  12. package/build/Resizable.js +183 -177
  13. package/build/Resizable.js.flow +115 -152
  14. package/build/ResizableBox.js +95 -75
  15. package/build/ResizableBox.js.flow +61 -34
  16. package/build/propTypes.js +112 -0
  17. package/build/propTypes.js.flow +135 -0
  18. package/build/utils.js +27 -0
  19. package/build/{cloneElement.js.flow → utils.js.flow} +2 -2
  20. package/coverage/clover.xml +107 -0
  21. package/coverage/coverage-final.json +5 -0
  22. package/coverage/lcov-report/Resizable.js.html +665 -0
  23. package/coverage/lcov-report/ResizableBox.js.html +374 -0
  24. package/coverage/lcov-report/base.css +224 -0
  25. package/coverage/lcov-report/block-navigation.js +79 -0
  26. package/coverage/lcov-report/favicon.png +0 -0
  27. package/coverage/lcov-report/flow-typed/npm/index.html +111 -0
  28. package/coverage/lcov-report/flow-typed/npm/jest_v26.x.x.js.html +3734 -0
  29. package/coverage/lcov-report/index.html +156 -0
  30. package/coverage/lcov-report/prettify.css +1 -0
  31. package/coverage/lcov-report/prettify.js +2 -0
  32. package/coverage/lcov-report/propTypes.js.html +485 -0
  33. package/coverage/lcov-report/react-resizable/dist/bundle.js.html +95 -0
  34. package/coverage/lcov-report/react-resizable/dist/index.html +111 -0
  35. package/coverage/lcov-report/react-resizable/flow-typed/npm/index.html +111 -0
  36. package/coverage/lcov-report/react-resizable/flow-typed/npm/jest_v26.x.x.js.html +3734 -0
  37. package/coverage/lcov-report/react-resizable/index.html +111 -0
  38. package/coverage/lcov-report/react-resizable/index.js.html +101 -0
  39. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  40. package/coverage/lcov-report/sorter.js +170 -0
  41. package/coverage/lcov-report/utils.js.html +122 -0
  42. package/coverage/lcov.info +233 -0
  43. package/css/styles.css +53 -5
  44. package/dist/bundle.js +6 -0
  45. package/flow-typed/npm/jest_v26.x.x.js +1218 -0
  46. package/package.json +33 -25
  47. package/setupTests/enzyme.js +4 -0
  48. package/.github/ISSUE_TEMPLATE.md +0 -23
  49. package/.github/PULL_REQUEST_TEMPLATE.md +0 -6
  50. package/build/cloneElement.js +0 -20
@@ -0,0 +1,29 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`render Resizable snapshot default props 1`] = `
4
+ <div
5
+ className="test-classname react-resizable"
6
+ style={
7
+ Object {
8
+ "height": "50px",
9
+ "width": "50px",
10
+ }
11
+ }
12
+ >
13
+ <span
14
+ className="children"
15
+ />
16
+ <span
17
+ className="react-resizable-handle react-resizable-handle-se"
18
+ onMouseDown={[Function]}
19
+ onMouseUp={[Function]}
20
+ onTouchEnd={[Function]}
21
+ />
22
+ <span
23
+ className="react-resizable-handle react-resizable-handle-e"
24
+ onMouseDown={[Function]}
25
+ onMouseUp={[Function]}
26
+ onTouchEnd={[Function]}
27
+ />
28
+ </div>
29
+ `;
@@ -0,0 +1,23 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`render ResizableBox snapshot default props 1`] = `
4
+ <div
5
+ className="react-resizable"
6
+ style={
7
+ Object {
8
+ "height": "50px",
9
+ "width": "50px",
10
+ }
11
+ }
12
+ >
13
+ <span
14
+ className="children"
15
+ />
16
+ <span
17
+ className="test-class-w"
18
+ onMouseDown={[Function]}
19
+ onMouseUp={[Function]}
20
+ onTouchEnd={[Function]}
21
+ />
22
+ </div>
23
+ `;
@@ -1,95 +1,101 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
+ exports.default = void 0;
4
5
 
5
- 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; };
6
+ var _react = _interopRequireDefault(require("react"));
6
7
 
7
- var _react = require('react');
8
+ var _reactDraggable = require("react-draggable");
8
9
 
9
- var _react2 = _interopRequireDefault(_react);
10
+ var _utils = require("./utils");
10
11
 
11
- var _propTypes = require('prop-types');
12
+ var _propTypes = require("./propTypes");
12
13
 
13
- var _propTypes2 = _interopRequireDefault(_propTypes);
14
-
15
- var _reactDraggable = require('react-draggable');
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
15
 
17
- var _cloneElement = require('./cloneElement');
16
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
18
17
 
19
- var _cloneElement2 = _interopRequireDefault(_cloneElement);
18
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
20
19
 
21
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
22
21
 
23
- function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
22
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
24
23
 
25
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
26
25
 
27
- 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; }
26
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
28
27
 
29
- 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; }
28
+ 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; }
30
29
 
31
- var Resizable = function (_React$Component) {
32
- _inherits(Resizable, _React$Component);
30
+ var Resizable = /*#__PURE__*/function (_React$Component) {
31
+ _inheritsLoose(Resizable, _React$Component);
33
32
 
34
33
  function Resizable() {
35
- var _temp, _this, _ret;
36
-
37
- _classCallCheck(this, Resizable);
34
+ var _this;
38
35
 
39
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
36
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
40
37
  args[_key] = arguments[_key];
41
38
  }
42
39
 
43
- return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
44
- resizing: false,
45
- width: _this.props.width, height: _this.props.height,
46
- slackW: 0, slackH: 0
47
- }, _temp), _possibleConstructorReturn(_this, _ret);
40
+ _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
41
+
42
+ _defineProperty(_assertThisInitialized(_this), "state", undefined);
43
+
44
+ _defineProperty(_assertThisInitialized(_this), "lastHandleRect", null);
45
+
46
+ _defineProperty(_assertThisInitialized(_this), "slack", null);
47
+
48
+ return _this;
48
49
  }
49
50
 
50
- Resizable.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
51
- // If parent changes height/width, set that in our state.
52
- if (!this.state.resizing && (nextProps.width !== this.props.width || nextProps.height !== this.props.height)) {
53
- this.setState({
54
- width: nextProps.width,
55
- height: nextProps.height
56
- });
57
- }
51
+ var _proto = Resizable.prototype;
52
+
53
+ _proto.componentWillUnmount = function componentWillUnmount() {
54
+ this.resetData();
58
55
  };
59
56
 
60
- Resizable.prototype.lockAspectRatio = function lockAspectRatio(width, height, aspectRatio) {
57
+ _proto.lockAspectRatio = function lockAspectRatio(width, height, aspectRatio) {
61
58
  height = width / aspectRatio;
62
59
  width = height * aspectRatio;
63
60
  return [width, height];
64
61
  };
65
62
 
66
- // If you do this, be careful of constraints
63
+ _proto.resetData = function resetData() {
64
+ this.lastHandleRect = this.slack = null;
65
+ } // Clamp width and height within provided constraints
66
+ ;
67
67
 
68
-
69
- Resizable.prototype.runConstraints = function runConstraints(width, height) {
68
+ _proto.runConstraints = function runConstraints(width, height) {
70
69
  var _ref = [this.props.minConstraints, this.props.maxConstraints],
71
70
  min = _ref[0],
72
71
  max = _ref[1];
73
-
72
+ if (!min && !max) return [width, height]; // If constraining to min and max, we need to also fit width and height to aspect ratio.
74
73
 
75
74
  if (this.props.lockAspectRatio) {
76
- var ratio = this.state.width / this.state.height;
77
- height = width / ratio;
78
- width = height * ratio;
79
- }
75
+ var resizingHorizontally = height === this.props.height;
80
76
 
81
- if (!min && !max) return [width, height];
77
+ if (resizingHorizontally) {
78
+ var ratio = this.props.width / this.props.height;
79
+ height = width / ratio;
80
+ width = height * ratio;
81
+ } else {
82
+ // Take into account vertical resize with N/S handles on locked aspect
83
+ // ratio. Calculate the change height-first, instead of width-first
84
+ var _ratio = this.props.height / this.props.width;
82
85
 
83
- var oldW = width,
84
- oldH = height;
86
+ width = height / _ratio;
87
+ height = width * _ratio;
88
+ }
89
+ }
85
90
 
86
- // Add slack to the values used to calculate bound position. This will ensure that if
91
+ var oldW = width,
92
+ oldH = height; // Add slack to the values used to calculate bound position. This will ensure that if
87
93
  // we start removing slack, the element won't react to it right away until it's been
88
94
  // completely removed.
89
95
 
90
- var _state = this.state,
91
- slackW = _state.slackW,
92
- slackH = _state.slackH;
96
+ var _ref2 = this.slack || [0, 0],
97
+ slackW = _ref2[0],
98
+ slackH = _ref2[1];
93
99
 
94
100
  width += slackW;
95
101
  height += slackH;
@@ -98,168 +104,168 @@ var Resizable = function (_React$Component) {
98
104
  width = Math.max(min[0], width);
99
105
  height = Math.max(min[1], height);
100
106
  }
107
+
101
108
  if (max) {
102
109
  width = Math.min(max[0], width);
103
110
  height = Math.min(max[1], height);
104
- }
111
+ } // If the width or height changed, we must have introduced some slack. Record it for the next iteration.
105
112
 
106
- // If the numbers changed, we must have introduced some slack. Record it for the next iteration.
107
- slackW += oldW - width;
108
- slackH += oldH - height;
109
- if (slackW !== this.state.slackW || slackH !== this.state.slackH) {
110
- this.setState({ slackW: slackW, slackH: slackH });
111
- }
112
113
 
114
+ this.slack = [slackW + (oldW - width), slackH + (oldH - height)];
113
115
  return [width, height];
114
- };
115
-
116
+ }
116
117
  /**
117
118
  * Wrapper around drag events to provide more useful data.
118
119
  *
119
120
  * @param {String} handlerName Handler name to wrap.
120
121
  * @return {Function} Handler function.
121
122
  */
123
+ ;
122
124
 
123
-
124
- Resizable.prototype.resizeHandler = function resizeHandler(handlerName) {
125
+ _proto.resizeHandler = function resizeHandler(handlerName, axis) {
125
126
  var _this2 = this;
126
127
 
127
- return function (e, _ref2) {
128
- var node = _ref2.node,
129
- deltaX = _ref2.deltaX,
130
- deltaY = _ref2.deltaY;
128
+ return function (e, _ref3) {
129
+ var node = _ref3.node,
130
+ deltaX = _ref3.deltaX,
131
+ deltaY = _ref3.deltaY;
132
+ // Reset data in case it was left over somehow (should not be possible)
133
+ if (handlerName === 'onResizeStart') _this2.resetData(); // Axis restrictions
131
134
 
135
+ var canDragX = (_this2.props.axis === 'both' || _this2.props.axis === 'x') && axis !== 'n' && axis !== 's';
136
+ var canDragY = (_this2.props.axis === 'both' || _this2.props.axis === 'y') && axis !== 'e' && axis !== 'w'; // No dragging possible.
132
137
 
133
- // Axis restrictions
134
- var canDragX = _this2.props.axis === 'both' || _this2.props.axis === 'x';
135
- var canDragY = _this2.props.axis === 'both' || _this2.props.axis === 'y';
138
+ if (!canDragX && !canDragY) return; // Decompose axis for later use
136
139
 
137
- // Update w/h
138
- var width = _this2.state.width + (canDragX ? deltaX : 0);
139
- var height = _this2.state.height + (canDragY ? deltaY : 0);
140
+ var axisV = axis[0];
141
+ var axisH = axis[axis.length - 1]; // intentionally not axis[1], so that this catches axis === 'w' for example
142
+ // Track the element being dragged to account for changes in position.
143
+ // If a handle's position is changed between callbacks, we need to factor this in to the next callback.
144
+ // Failure to do so will cause the element to "skip" when resized upwards or leftwards.
140
145
 
141
- // Early return if no change
142
- var widthChanged = width !== _this2.state.width,
143
- heightChanged = height !== _this2.state.height;
144
- if (handlerName === 'onResize' && !widthChanged && !heightChanged) return;
146
+ var handleRect = node.getBoundingClientRect();
145
147
 
146
- // Set the appropriate state for this handler.
147
- var _runConstraints = _this2.runConstraints(width, height);
148
+ if (_this2.lastHandleRect != null) {
149
+ // If the handle has repositioned on either axis since last render,
150
+ // we need to increase our callback values by this much.
151
+ // Only checking 'n', 'w' since resizing by 's', 'w' won't affect the overall position on page,
152
+ if (axisH === 'w') {
153
+ var deltaLeftSinceLast = handleRect.left - _this2.lastHandleRect.left;
154
+ deltaX += deltaLeftSinceLast;
155
+ }
148
156
 
149
- width = _runConstraints[0];
150
- height = _runConstraints[1];
151
- var newState = {};
152
- if (handlerName === 'onResizeStart') {
153
- newState.resizing = true;
154
- } else if (handlerName === 'onResizeStop') {
155
- newState.resizing = false;
156
- newState.slackW = newState.slackH = 0;
157
- } else {
158
- // Early return if no change after constraints
159
- if (width === _this2.state.width && height === _this2.state.height) return;
160
- newState.width = width;
161
- newState.height = height;
162
- }
157
+ if (axisV === 'n') {
158
+ var deltaTopSinceLast = handleRect.top - _this2.lastHandleRect.top;
159
+ deltaY += deltaTopSinceLast;
160
+ }
161
+ } // Storage of last rect so we know how much it has really moved.
162
+
163
+
164
+ _this2.lastHandleRect = handleRect; // Reverse delta if using top or left drag handles.
165
+
166
+ if (axisH === 'w') deltaX = -deltaX;
167
+ if (axisV === 'n') deltaY = -deltaY; // Update w/h by the deltas. Also factor in transformScale.
168
+
169
+ var width = _this2.props.width + (canDragX ? deltaX / _this2.props.transformScale : 0);
170
+ var height = _this2.props.height + (canDragY ? deltaY / _this2.props.transformScale : 0); // Run user-provided constraints.
171
+
172
+ var _this2$runConstraints = _this2.runConstraints(width, height);
163
173
 
164
- var hasCb = typeof _this2.props[handlerName] === 'function';
165
- if (hasCb) {
174
+ width = _this2$runConstraints[0];
175
+ height = _this2$runConstraints[1];
176
+ var dimensionsChanged = width !== _this2.props.width || height !== _this2.props.height; // Call user-supplied callback if present.
177
+
178
+ var cb = typeof _this2.props[handlerName] === 'function' ? _this2.props[handlerName] : null; // Don't call 'onResize' if dimensions haven't changed.
179
+
180
+ var shouldSkipCb = handlerName === 'onResize' && !dimensionsChanged;
181
+
182
+ if (cb && !shouldSkipCb) {
166
183
  if (typeof e.persist === 'function') e.persist();
167
- _this2.setState(newState, function () {
168
- return _this2.props[handlerName](e, { node: node, size: { width: width, height: height } });
184
+ cb(e, {
185
+ node: node,
186
+ size: {
187
+ width: width,
188
+ height: height
189
+ },
190
+ handle: axis
169
191
  });
170
- } else {
171
- _this2.setState(newState);
172
- }
192
+ } // Reset internal data
193
+
194
+
195
+ if (handlerName === 'onResizeStop') _this2.resetData();
173
196
  };
174
197
  };
175
198
 
176
- Resizable.prototype.render = function render() {
199
+ _proto.renderResizeHandle = function renderResizeHandle(resizeHandleAxis) {
200
+ var handle = this.props.handle;
201
+
202
+ if (handle) {
203
+ if (typeof handle === 'function') {
204
+ return handle(resizeHandleAxis);
205
+ }
206
+
207
+ return handle;
208
+ }
209
+
210
+ return /*#__PURE__*/_react.default.createElement("span", {
211
+ className: "react-resizable-handle react-resizable-handle-" + resizeHandleAxis
212
+ });
213
+ };
214
+
215
+ _proto.render = function render() {
216
+ var _this3 = this;
217
+
218
+ // Pass along only props not meant for the `<Resizable>`.`
177
219
  // eslint-disable-next-line no-unused-vars
178
- var _props = this.props,
179
- children = _props.children,
180
- draggableOpts = _props.draggableOpts,
181
- width = _props.width,
182
- height = _props.height,
183
- handleSize = _props.handleSize,
184
- lockAspectRatio = _props.lockAspectRatio,
185
- axis = _props.axis,
186
- minConstraints = _props.minConstraints,
187
- maxConstraints = _props.maxConstraints,
188
- onResize = _props.onResize,
189
- onResizeStop = _props.onResizeStop,
190
- onResizeStart = _props.onResizeStart,
191
- p = _objectWithoutProperties(_props, ['children', 'draggableOpts', 'width', 'height', 'handleSize', 'lockAspectRatio', 'axis', 'minConstraints', 'maxConstraints', 'onResize', 'onResizeStop', 'onResizeStart']);
192
-
193
- var className = p.className ? p.className + ' react-resizable' : 'react-resizable';
194
-
195
- // What we're doing here is getting the child of this element, and cloning it with this element's props.
220
+ var _this$props = this.props,
221
+ children = _this$props.children,
222
+ className = _this$props.className,
223
+ draggableOpts = _this$props.draggableOpts,
224
+ width = _this$props.width,
225
+ height = _this$props.height,
226
+ handle = _this$props.handle,
227
+ handleSize = _this$props.handleSize,
228
+ lockAspectRatio = _this$props.lockAspectRatio,
229
+ axis = _this$props.axis,
230
+ minConstraints = _this$props.minConstraints,
231
+ maxConstraints = _this$props.maxConstraints,
232
+ onResize = _this$props.onResize,
233
+ onResizeStop = _this$props.onResizeStop,
234
+ onResizeStart = _this$props.onResizeStart,
235
+ resizeHandles = _this$props.resizeHandles,
236
+ transformScale = _this$props.transformScale,
237
+ p = _objectWithoutPropertiesLoose(_this$props, ["children", "className", "draggableOpts", "width", "height", "handle", "handleSize", "lockAspectRatio", "axis", "minConstraints", "maxConstraints", "onResize", "onResizeStop", "onResizeStart", "resizeHandles", "transformScale"]); // What we're doing here is getting the child of this element, and cloning it with this element's props.
196
238
  // We are then defining its children as:
197
239
  // Its original children (resizable's child's children), and
198
- // A draggable handle.
199
- return (0, _cloneElement2.default)(children, _extends({}, p, {
200
- className: className,
201
- children: [children.props.children, _react2.default.createElement(
202
- _reactDraggable.DraggableCore,
203
- _extends({}, draggableOpts, {
204
- key: 'resizableHandle',
205
- onStop: this.resizeHandler('onResizeStop'),
206
- onStart: this.resizeHandler('onResizeStart'),
207
- onDrag: this.resizeHandler('onResize')
208
- }),
209
- _react2.default.createElement('span', { className: 'react-resizable-handle' })
210
- )]
240
+ // One or more draggable handles.
241
+
242
+
243
+ return (0, _utils.cloneElement)(children, _objectSpread(_objectSpread({}, p), {}, {
244
+ className: (className ? className + " " : '') + "react-resizable",
245
+ children: [].concat(children.props.children, resizeHandles.map(function (handleAxis) {
246
+ return /*#__PURE__*/_react.default.createElement(_reactDraggable.DraggableCore, _extends({}, draggableOpts, {
247
+ key: "resizableHandle-" + handleAxis,
248
+ onStop: _this3.resizeHandler('onResizeStop', handleAxis),
249
+ onStart: _this3.resizeHandler('onResizeStart', handleAxis),
250
+ onDrag: _this3.resizeHandler('onResize', handleAxis)
251
+ }), _this3.renderResizeHandle(handleAxis));
252
+ }))
211
253
  }));
212
254
  };
213
255
 
214
256
  return Resizable;
215
- }(_react2.default.Component);
216
-
217
- Resizable.propTypes = {
218
- //
219
- // Required Props
220
- //
221
-
222
- // Require that one and only one child be present.
223
- children: _propTypes2.default.element.isRequired,
224
-
225
- // Initial w/h
226
- width: _propTypes2.default.number.isRequired,
227
- height: _propTypes2.default.number.isRequired,
228
-
229
- //
230
- // Optional props
231
- //
232
-
233
- // If you change this, be sure to update your css
234
- handleSize: _propTypes2.default.array,
235
-
236
- // If true, will only allow width/height to move in lockstep
237
- lockAspectRatio: _propTypes2.default.bool,
238
-
239
- // Restricts resizing to a particular axis (default: 'both')
240
- // 'both' - allows resizing by width or height
241
- // 'x' - only allows the width to be changed
242
- // 'y' - only allows the height to be changed
243
- // 'none' - disables resizing altogether
244
- axis: _propTypes2.default.oneOf(['both', 'x', 'y', 'none']),
245
-
246
- // Min/max size
247
- minConstraints: _propTypes2.default.arrayOf(_propTypes2.default.number),
248
- maxConstraints: _propTypes2.default.arrayOf(_propTypes2.default.number),
249
-
250
- // Callbacks
251
- onResizeStop: _propTypes2.default.func,
252
- onResizeStart: _propTypes2.default.func,
253
- onResize: _propTypes2.default.func,
254
-
255
- // These will be passed wholesale to react-draggable's DraggableCore
256
- draggableOpts: _propTypes2.default.object
257
- };
258
- Resizable.defaultProps = {
257
+ }(_react.default.Component);
258
+
259
+ exports.default = Resizable;
260
+
261
+ _defineProperty(Resizable, "propTypes", _propTypes.resizableProps);
262
+
263
+ _defineProperty(Resizable, "defaultProps", {
259
264
  handleSize: [20, 20],
260
265
  lockAspectRatio: false,
261
266
  axis: 'both',
262
267
  minConstraints: [20, 20],
263
- maxConstraints: [Infinity, Infinity]
264
- };
265
- exports.default = Resizable;
268
+ maxConstraints: [Infinity, Infinity],
269
+ resizeHandles: ['se'],
270
+ transformScale: 1
271
+ });