react-resizable 1.8.0 → 1.11.1

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 (48) hide show
  1. package/.babelrc +10 -4
  2. package/.browserslistrc +3 -0
  3. package/.eslintrc +10 -6
  4. package/.flowconfig +10 -10
  5. package/CHANGELOG.md +61 -32
  6. package/README.md +14 -4
  7. package/__tests__/Resizable.test.js +245 -0
  8. package/__tests__/ResizableBox.test.js +99 -0
  9. package/__tests__/__snapshots__/Resizable.test.js.snap +29 -0
  10. package/__tests__/__snapshots__/ResizableBox.test.js.snap +23 -0
  11. package/build/Resizable.js +172 -208
  12. package/build/Resizable.js.flow +99 -178
  13. package/build/ResizableBox.js +95 -79
  14. package/build/ResizableBox.js.flow +58 -33
  15. package/build/propTypes.js +112 -0
  16. package/build/propTypes.js.flow +135 -0
  17. package/build/utils.js +27 -0
  18. package/build/{cloneElement.js.flow → utils.js.flow} +2 -2
  19. package/coverage/clover.xml +107 -0
  20. package/coverage/coverage-final.json +5 -0
  21. package/coverage/lcov-report/Resizable.js.html +665 -0
  22. package/coverage/lcov-report/ResizableBox.js.html +374 -0
  23. package/coverage/lcov-report/base.css +224 -0
  24. package/coverage/lcov-report/block-navigation.js +79 -0
  25. package/coverage/lcov-report/favicon.png +0 -0
  26. package/coverage/lcov-report/flow-typed/npm/index.html +111 -0
  27. package/coverage/lcov-report/flow-typed/npm/jest_v26.x.x.js.html +3734 -0
  28. package/coverage/lcov-report/index.html +156 -0
  29. package/coverage/lcov-report/prettify.css +1 -0
  30. package/coverage/lcov-report/prettify.js +2 -0
  31. package/coverage/lcov-report/propTypes.js.html +485 -0
  32. package/coverage/lcov-report/react-resizable/dist/bundle.js.html +95 -0
  33. package/coverage/lcov-report/react-resizable/dist/index.html +111 -0
  34. package/coverage/lcov-report/react-resizable/flow-typed/npm/index.html +111 -0
  35. package/coverage/lcov-report/react-resizable/flow-typed/npm/jest_v26.x.x.js.html +3734 -0
  36. package/coverage/lcov-report/react-resizable/index.html +111 -0
  37. package/coverage/lcov-report/react-resizable/index.js.html +101 -0
  38. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  39. package/coverage/lcov-report/sorter.js +170 -0
  40. package/coverage/lcov-report/utils.js.html +122 -0
  41. package/coverage/lcov.info +233 -0
  42. package/dist/bundle.js +6 -0
  43. package/flow-typed/npm/jest_v26.x.x.js +1218 -0
  44. package/package.json +34 -26
  45. package/setupTests/enzyme.js +4 -0
  46. package/.github/ISSUE_TEMPLATE.md +0 -23
  47. package/.github/PULL_REQUEST_TEMPLATE.md +0 -5
  48. package/build/cloneElement.js +0 -20
@@ -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,210 +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, axis) {
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') && ['n', 's'].indexOf(axis) === -1;
135
- var canDragY = (_this2.props.axis === 'both' || _this2.props.axis === 'y') && ['e', 'w'].indexOf(axis) === -1;
138
+ if (!canDragX && !canDragY) return; // Decompose axis for later use
136
139
 
137
- // reverse delta if using top or left drag handles
138
- if (canDragX && axis[axis.length - 1] === 'w') {
139
- deltaX = -deltaX;
140
- }
141
- if (canDragY && axis[0] === 'n') {
142
- deltaY = -deltaY;
143
- }
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.
144
145
 
145
- // Update w/h
146
- var width = _this2.state.width + (canDragX ? deltaX : 0);
147
- var height = _this2.state.height + (canDragY ? deltaY : 0);
148
-
149
- // Early return if no change
150
- var widthChanged = width !== _this2.state.width,
151
- heightChanged = height !== _this2.state.height;
152
- if (handlerName === 'onResize' && !widthChanged && !heightChanged) return;
153
-
154
- // Set the appropriate state for this handler.
155
- var _runConstraints = _this2.runConstraints(width, height);
156
-
157
- width = _runConstraints[0];
158
- height = _runConstraints[1];
159
- var newState = {};
160
- if (handlerName === 'onResizeStart') {
161
- newState.resizing = true;
162
- } else if (handlerName === 'onResizeStop') {
163
- newState.resizing = false;
164
- newState.slackW = newState.slackH = 0;
165
- } else {
166
- // Early return if no change after constraints
167
- if (width === _this2.state.width && height === _this2.state.height) return;
168
- newState.width = width;
169
- newState.height = height;
170
- }
146
+ var handleRect = node.getBoundingClientRect();
147
+
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
+ }
156
+
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);
173
+
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.
171
179
 
172
- var hasCb = typeof _this2.props[handlerName] === 'function';
173
- if (hasCb) {
174
- // $FlowIgnore isn't refining this correctly to SyntheticEvent
180
+ var shouldSkipCb = handlerName === 'onResize' && !dimensionsChanged;
181
+
182
+ if (cb && !shouldSkipCb) {
175
183
  if (typeof e.persist === 'function') e.persist();
176
- _this2.setState(newState, function () {
177
- return _this2.props[handlerName](e, { node: node, size: { width: width, height: height }, handle: axis });
184
+ cb(e, {
185
+ node: node,
186
+ size: {
187
+ width: width,
188
+ height: height
189
+ },
190
+ handle: axis
178
191
  });
179
- } else {
180
- _this2.setState(newState);
181
- }
192
+ } // Reset internal data
193
+
194
+
195
+ if (handlerName === 'onResizeStop') _this2.resetData();
182
196
  };
183
197
  };
184
198
 
185
- Resizable.prototype.renderResizeHandle = function renderResizeHandle(resizeHandle) {
199
+ _proto.renderResizeHandle = function renderResizeHandle(resizeHandleAxis) {
186
200
  var handle = this.props.handle;
187
201
 
188
202
  if (handle) {
189
203
  if (typeof handle === 'function') {
190
- return handle(resizeHandle);
204
+ return handle(resizeHandleAxis);
191
205
  }
206
+
192
207
  return handle;
193
208
  }
194
- return _react2.default.createElement('span', { className: 'react-resizable-handle react-resizable-handle-' + resizeHandle });
209
+
210
+ return /*#__PURE__*/_react.default.createElement("span", {
211
+ className: "react-resizable-handle react-resizable-handle-" + resizeHandleAxis
212
+ });
195
213
  };
196
214
 
197
- Resizable.prototype.render = function render() {
215
+ _proto.render = function render() {
198
216
  var _this3 = this;
199
217
 
218
+ // Pass along only props not meant for the `<Resizable>`.`
200
219
  // eslint-disable-next-line no-unused-vars
201
- var _props = this.props,
202
- children = _props.children,
203
- draggableOpts = _props.draggableOpts,
204
- width = _props.width,
205
- height = _props.height,
206
- handleSize = _props.handleSize,
207
- lockAspectRatio = _props.lockAspectRatio,
208
- axis = _props.axis,
209
- minConstraints = _props.minConstraints,
210
- maxConstraints = _props.maxConstraints,
211
- onResize = _props.onResize,
212
- onResizeStop = _props.onResizeStop,
213
- onResizeStart = _props.onResizeStart,
214
- resizeHandles = _props.resizeHandles,
215
- p = _objectWithoutProperties(_props, ['children', 'draggableOpts', 'width', 'height', 'handleSize', 'lockAspectRatio', 'axis', 'minConstraints', 'maxConstraints', 'onResize', 'onResizeStop', 'onResizeStart', 'resizeHandles']);
216
-
217
- var className = p.className ? p.className + ' react-resizable' : 'react-resizable';
218
-
219
- // 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.
220
238
  // We are then defining its children as:
221
239
  // Its original children (resizable's child's children), and
222
240
  // One or more draggable handles.
223
- return (0, _cloneElement2.default)(children, _extends({}, p, {
224
- className: className,
225
- children: [children.props.children, resizeHandles.map(function (h) {
226
- return _react2.default.createElement(
227
- _reactDraggable.DraggableCore,
228
- _extends({}, draggableOpts, {
229
- key: 'resizableHandle-' + h,
230
- onStop: _this3.resizeHandler('onResizeStop', h),
231
- onStart: _this3.resizeHandler('onResizeStart', h),
232
- onDrag: _this3.resizeHandler('onResize', h)
233
- }),
234
- _this3.renderResizeHandle(h)
235
- );
236
- })]
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
+ }))
237
253
  }));
238
254
  };
239
255
 
240
256
  return Resizable;
241
- }(_react2.default.Component);
242
-
243
- Resizable.propTypes = {
244
- //
245
- // Required Props
246
- //
247
-
248
- // Require that one and only one child be present.
249
- children: _propTypes2.default.element.isRequired,
250
-
251
- // Initial w/h
252
- width: _propTypes2.default.number.isRequired,
253
- height: _propTypes2.default.number.isRequired,
254
-
255
- //
256
- // Optional props
257
- //
258
-
259
- // Custom resize handle
260
- handle: _propTypes2.default.element,
261
-
262
- // If you change this, be sure to update your css
263
- handleSize: _propTypes2.default.array,
264
-
265
- // Defines which resize handles should be rendered (default: 'se')
266
- // Allows for any combination of:
267
- // 's' - South handle (bottom-center)
268
- // 'w' - West handle (left-center)
269
- // 'e' - East handle (right-center)
270
- // 'n' - North handle (top-center)
271
- // 'sw' - Southwest handle (bottom-left)
272
- // 'nw' - Northwest handle (top-left)
273
- // 'se' - Southeast handle (bottom-right)
274
- // 'ne' - Northeast handle (top-center)
275
- resizeHandles: _propTypes2.default.arrayOf(_propTypes2.default.oneOf(['s', 'w', 'e', 'n', 'sw', 'nw', 'se', 'ne'])),
276
-
277
- // If true, will only allow width/height to move in lockstep
278
- lockAspectRatio: _propTypes2.default.bool,
279
-
280
- // Restricts resizing to a particular axis (default: 'both')
281
- // 'both' - allows resizing by width or height
282
- // 'x' - only allows the width to be changed
283
- // 'y' - only allows the height to be changed
284
- // 'none' - disables resizing altogether
285
- axis: _propTypes2.default.oneOf(['both', 'x', 'y', 'none']),
286
-
287
- // Min/max size
288
- minConstraints: _propTypes2.default.arrayOf(_propTypes2.default.number),
289
- maxConstraints: _propTypes2.default.arrayOf(_propTypes2.default.number),
290
-
291
- // Callbacks
292
- onResizeStop: _propTypes2.default.func,
293
- onResizeStart: _propTypes2.default.func,
294
- onResize: _propTypes2.default.func,
295
-
296
- // These will be passed wholesale to react-draggable's DraggableCore
297
- draggableOpts: _propTypes2.default.object
298
- };
299
- Resizable.defaultProps = {
257
+ }(_react.default.Component);
258
+
259
+ exports.default = Resizable;
260
+
261
+ _defineProperty(Resizable, "propTypes", _propTypes.resizableProps);
262
+
263
+ _defineProperty(Resizable, "defaultProps", {
300
264
  handleSize: [20, 20],
301
265
  lockAspectRatio: false,
302
266
  axis: 'both',
303
267
  minConstraints: [20, 20],
304
268
  maxConstraints: [Infinity, Infinity],
305
- resizeHandles: ['se']
306
- };
307
- exports.default = Resizable;
269
+ resizeHandles: ['se'],
270
+ transformScale: 1
271
+ });