react-resizable 1.7.4 → 1.10.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.
package/.babelrc CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "presets": [
3
- ["es2015", {"loose": true}],
4
- "react"
3
+ [
4
+ "@babel/preset-env",
5
+ {
6
+ "loose": true
7
+ }
8
+ ],
9
+ "@babel/preset-react",
10
+ "@babel/preset-flow"
5
11
  ],
6
12
  "plugins": [
7
- "transform-class-properties",
8
- "transform-object-rest-spread",
13
+ "@babel/plugin-proposal-class-properties",
14
+ "@babel/plugin-proposal-object-rest-spread"
9
15
  ]
10
16
  }
@@ -0,0 +1,3 @@
1
+ > 0.25%
2
+ ie 11
3
+ not dead
package/.eslintrc CHANGED
@@ -24,9 +24,6 @@
24
24
  "browser": true,
25
25
  "node": true
26
26
  },
27
- "ecmaFeatures": {
28
- "jsx": true
29
- },
30
27
  "globals": {
31
28
  // For Flow
32
29
  "ReactElement",
package/.flowconfig CHANGED
@@ -1,9 +1,8 @@
1
1
  [version]
2
- 0.54.0
2
+ ^0.110.0
3
3
 
4
4
  [ignore]
5
- .*/node_modules/babel.*
6
- .*/node_modules/fbjs/.*
5
+ .*/node_modules/@babel.*
7
6
  .*/node_modules/express/.*
8
7
  .*/node_modules/serve-index/.*
9
8
  <PROJECT_ROOT>/build/.*
@@ -28,4 +27,3 @@ module.system.node.resolve_dirname=node_modules
28
27
  module.system.node.resolve_dirname=.
29
28
  module.use_strict=true
30
29
  server.max_workers=6
31
- unsafe.enable_getters_and_setters=true
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.10.1 (Nov 25, 2019)
4
+
5
+ > Note: 1.10.0 was a mis-publish.
6
+
7
+ - Feat: Add `transformScale` prop [#115](https://github.com/STRML/react-resizable/pull/115)
8
+ - Bugfix: Resolve `getDerivedStateFromProps` dev warning [#117](https://github.com/STRML/react-resizable/pull/117)
9
+
10
+ ### 1.9.0 (Oct 24, 2019)
11
+
12
+ - Fix resize with north/south handles when `lockAspectRatio=true` [#106](https://github.com/STRML/react-resizable/pull/106)
13
+ - Remove deprecated React 16.9 lifecycle methods (`componentWillReceiveProps`) (https://github.com/STRML/react-resizable/pull/112/commits/541dee69b8e45d91a533855609472b481634edee)
14
+ - Upgrade to babel 7
15
+ - [Remove unused state inside `<Draggable>`](https://github.com/STRML/react-resizable/pull/112/commits/05693f63d6d221ad652f0f28af024cfb46a5f2df). This has not been needed for quite some time, fixes [some bugs](https://github.com/STRML/react-resizable/issues/99) and improves performance.
16
+
17
+ ### 1.8.0 (May 15, 2019)
18
+
19
+ - Added support for custom resize handles [#79](https://github.com/STRML/react-resizable/pull/79)
20
+ - Added support for resize handles on all corners [#191](https://github.com/STRML/react-resizable/pull/191)
21
+
22
+ ### 1.7.5 (Sep 26, 2017)
23
+
24
+ - Support for React 16 (no changes required, updated `peerDependencies`)
25
+ - Minor dep updates.
26
+
3
27
  ### 1.7.4 (Sep 5, 2017)
4
28
 
5
29
  - Minor Flow & dependency updates.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016-2018 Samuel Reed
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [View the Demo](https://strml.github.io/react-resizable/examples/1.html)
4
4
 
5
- A simple widget that can be resized via a handle.
5
+ A simple widget that can be resized via one or more handles.
6
6
 
7
7
  You can either use the `<Resizable>` element directly, or use the much simpler `<ResizableBox>` element.
8
8
 
@@ -50,6 +50,8 @@ These props apply to both `<Resizable>` and `<ResizableBox>`.
50
50
  children: React.Element<any>,
51
51
  width: number,
52
52
  height: number,
53
+ // Either a ReactElement to be used as handle, or a function returning an element that is fed the handle's location as its first argument.
54
+ handle: ReactElement<any> | (resizeHandle: 's' | 'w' | 'e' | 'n' | 'sw' | 'nw' | 'se' | 'ne') => ReactElement<any>,
53
55
  // If you change this, be sure to update your css
54
56
  handleSize: [number, number] = [10, 10],
55
57
  lockAspectRatio: boolean = false,
@@ -59,6 +61,7 @@ These props apply to both `<Resizable>` and `<ResizableBox>`.
59
61
  onResizeStop?: ?(e: SyntheticEvent, data: ResizeCallbackData) => any,
60
62
  onResizeStart?: ?(e: SyntheticEvent, data: ResizeCallbackData) => any,
61
63
  onResize?: ?(e: SyntheticEvent, data: ResizeCallbackData) => any,
62
- draggableOpts?: ?Object
64
+ draggableOpts?: ?Object,
65
+ resizeHandles?: ?Array<'s' | 'w' | 'e' | 'n' | 'sw' | 'nw' | 'se' | 'ne'> = ['se']
63
66
  };
64
67
  ```
@@ -1,96 +1,92 @@
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 _propTypes = _interopRequireDefault(require("prop-types"));
8
9
 
9
- var _react2 = _interopRequireDefault(_react);
10
+ var _reactDraggable = require("react-draggable");
10
11
 
11
- var _propTypes = require('prop-types');
12
+ var _utils = require("./utils");
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(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(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 =
31
+ /*#__PURE__*/
32
+ function (_React$Component) {
33
+ _inheritsLoose(Resizable, _React$Component);
33
34
 
34
35
  function Resizable() {
35
- var _temp, _this, _ret;
36
-
37
- _classCallCheck(this, Resizable);
36
+ var _this;
38
37
 
39
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
38
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
40
39
  args[_key] = arguments[_key];
41
40
  }
42
41
 
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);
42
+ _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
43
+
44
+ _defineProperty(_assertThisInitialized(_this), "state", {
45
+ slackW: 0,
46
+ slackH: 0
47
+ });
48
+
49
+ return _this;
48
50
  }
49
51
 
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
- }
58
- };
52
+ var _proto = Resizable.prototype;
59
53
 
60
- Resizable.prototype.lockAspectRatio = function lockAspectRatio(width, height, aspectRatio) {
54
+ _proto.lockAspectRatio = function lockAspectRatio(width, height, aspectRatio) {
61
55
  height = width / aspectRatio;
62
56
  width = height * aspectRatio;
63
57
  return [width, height];
64
- };
65
-
66
- // If you do this, be careful of constraints
58
+ } // If you do this, be careful of constraints
59
+ ;
67
60
 
68
-
69
- Resizable.prototype.runConstraints = function runConstraints(width, height) {
61
+ _proto.runConstraints = function runConstraints(width, height) {
70
62
  var _ref = [this.props.minConstraints, this.props.maxConstraints],
71
63
  min = _ref[0],
72
64
  max = _ref[1];
73
-
65
+ if (!min && !max) return [width, height]; // Fit width & height to aspect ratio
74
66
 
75
67
  if (this.props.lockAspectRatio) {
76
- var ratio = this.state.width / this.state.height;
77
- height = width / ratio;
78
- width = height * ratio;
79
- }
68
+ if (height === this.props.height) {
69
+ var ratio = this.props.width / this.props.height;
70
+ height = width / ratio;
71
+ width = height * ratio;
72
+ } else {
73
+ // Take into account vertical resize with N/S handles on locked aspect
74
+ // ratio. Calculate the change height-first, instead of width-first
75
+ var _ratio = this.props.height / this.props.width;
80
76
 
81
- if (!min && !max) return [width, height];
77
+ width = height / _ratio;
78
+ height = width * _ratio;
79
+ }
80
+ }
82
81
 
83
82
  var oldW = width,
84
- oldH = height;
85
-
86
- // Add slack to the values used to calculate bound position. This will ensure that if
83
+ oldH = height; // Add slack to the values used to calculate bound position. This will ensure that if
87
84
  // we start removing slack, the element won't react to it right away until it's been
88
85
  // completely removed.
89
86
 
90
- var _state = this.state,
91
- slackW = _state.slackW,
92
- slackH = _state.slackH;
93
-
87
+ var _this$state = this.state,
88
+ slackW = _this$state.slackW,
89
+ slackH = _this$state.slackH;
94
90
  width += slackW;
95
91
  height += slackH;
96
92
 
@@ -98,74 +94,92 @@ var Resizable = function (_React$Component) {
98
94
  width = Math.max(min[0], width);
99
95
  height = Math.max(min[1], height);
100
96
  }
97
+
101
98
  if (max) {
102
99
  width = Math.min(max[0], width);
103
100
  height = Math.min(max[1], height);
104
- }
101
+ } // If the numbers changed, we must have introduced some slack. Record it for the next iteration.
102
+
105
103
 
106
- // If the numbers changed, we must have introduced some slack. Record it for the next iteration.
107
104
  slackW += oldW - width;
108
105
  slackH += oldH - height;
106
+
109
107
  if (slackW !== this.state.slackW || slackH !== this.state.slackH) {
110
- this.setState({ slackW: slackW, slackH: slackH });
108
+ this.setState({
109
+ slackW: slackW,
110
+ slackH: slackH
111
+ });
111
112
  }
112
113
 
113
114
  return [width, height];
114
- };
115
-
115
+ }
116
116
  /**
117
117
  * Wrapper around drag events to provide more useful data.
118
118
  *
119
119
  * @param {String} handlerName Handler name to wrap.
120
120
  * @return {Function} Handler function.
121
121
  */
122
+ ;
122
123
 
123
-
124
- Resizable.prototype.resizeHandler = function resizeHandler(handlerName) {
124
+ _proto.resizeHandler = function resizeHandler(handlerName, axis) {
125
125
  var _this2 = this;
126
126
 
127
127
  return function (e, _ref2) {
128
128
  var node = _ref2.node,
129
129
  deltaX = _ref2.deltaX,
130
130
  deltaY = _ref2.deltaY;
131
+ deltaX /= _this2.props.transformScale;
132
+ deltaY /= _this2.props.transformScale; // Axis restrictions
133
+
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; // reverse delta if using top or left drag handles
136
+
137
+ if (canDragX && axis[axis.length - 1] === 'w') {
138
+ deltaX = -deltaX;
139
+ }
131
140
 
141
+ if (canDragY && axis[0] === 'n') {
142
+ deltaY = -deltaY;
143
+ } // Update w/h
132
144
 
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';
136
145
 
137
- // Update w/h
138
- var width = _this2.state.width + (canDragX ? deltaX : 0);
139
- var height = _this2.state.height + (canDragY ? deltaY : 0);
146
+ var width = _this2.props.width + (canDragX ? deltaX : 0);
147
+ var height = _this2.props.height + (canDragY ? deltaY : 0); // Early return if no change
140
148
 
141
- // Early return if no change
142
- var widthChanged = width !== _this2.state.width,
143
- heightChanged = height !== _this2.state.height;
149
+ var widthChanged = width !== _this2.props.width,
150
+ heightChanged = height !== _this2.props.height;
144
151
  if (handlerName === 'onResize' && !widthChanged && !heightChanged) return;
145
152
 
146
- // Set the appropriate state for this handler.
147
- var _runConstraints = _this2.runConstraints(width, height);
153
+ var _this2$runConstraints = _this2.runConstraints(width, height);
148
154
 
149
- width = _runConstraints[0];
150
- height = _runConstraints[1];
155
+ width = _this2$runConstraints[0];
156
+ height = _this2$runConstraints[1];
157
+ // Set the appropriate state for this handler.
151
158
  var newState = {};
152
- if (handlerName === 'onResizeStart') {
153
- newState.resizing = true;
159
+
160
+ if (handlerName === 'onResizeStart') {// nothing
154
161
  } else if (handlerName === 'onResizeStop') {
155
- newState.resizing = false;
156
162
  newState.slackW = newState.slackH = 0;
157
163
  } else {
158
164
  // 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;
165
+ if (width === _this2.props.width && height === _this2.props.height) return;
162
166
  }
163
167
 
164
168
  var hasCb = typeof _this2.props[handlerName] === 'function';
169
+
165
170
  if (hasCb) {
171
+ // $FlowIgnore isn't refining this correctly to SyntheticEvent
166
172
  if (typeof e.persist === 'function') e.persist();
173
+
167
174
  _this2.setState(newState, function () {
168
- return _this2.props[handlerName](e, { node: node, size: { width: width, height: height } });
175
+ return _this2.props[handlerName](e, {
176
+ node: node,
177
+ size: {
178
+ width: width,
179
+ height: height
180
+ },
181
+ handle: axis
182
+ });
169
183
  });
170
184
  } else {
171
185
  _this2.setState(newState);
@@ -173,93 +187,119 @@ var Resizable = function (_React$Component) {
173
187
  };
174
188
  };
175
189
 
176
- Resizable.prototype.render = function render() {
190
+ _proto.renderResizeHandle = function renderResizeHandle(resizeHandle) {
191
+ var handle = this.props.handle;
192
+
193
+ if (handle) {
194
+ if (typeof handle === 'function') {
195
+ return handle(resizeHandle);
196
+ }
197
+
198
+ return handle;
199
+ }
200
+
201
+ return _react.default.createElement("span", {
202
+ className: "react-resizable-handle react-resizable-handle-" + resizeHandle
203
+ });
204
+ };
205
+
206
+ _proto.render = function render() {
207
+ var _this3 = this;
208
+
177
209
  // 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.
210
+ var _this$props = this.props,
211
+ children = _this$props.children,
212
+ draggableOpts = _this$props.draggableOpts,
213
+ width = _this$props.width,
214
+ height = _this$props.height,
215
+ handleSize = _this$props.handleSize,
216
+ lockAspectRatio = _this$props.lockAspectRatio,
217
+ axis = _this$props.axis,
218
+ minConstraints = _this$props.minConstraints,
219
+ maxConstraints = _this$props.maxConstraints,
220
+ onResize = _this$props.onResize,
221
+ onResizeStop = _this$props.onResizeStop,
222
+ onResizeStart = _this$props.onResizeStart,
223
+ resizeHandles = _this$props.resizeHandles,
224
+ transformScale = _this$props.transformScale,
225
+ p = _objectWithoutPropertiesLoose(_this$props, ["children", "draggableOpts", "width", "height", "handleSize", "lockAspectRatio", "axis", "minConstraints", "maxConstraints", "onResize", "onResizeStop", "onResizeStart", "resizeHandles", "transformScale"]);
226
+
227
+ var className = p.className ? p.className + " react-resizable" : 'react-resizable'; // What we're doing here is getting the child of this element, and cloning it with this element's props.
196
228
  // We are then defining its children as:
197
229
  // Its original children (resizable's child's children), and
198
- // A draggable handle.
199
- return (0, _cloneElement2.default)(children, _extends({}, p, {
230
+ // One or more draggable handles.
231
+
232
+ return (0, _utils.cloneElement)(children, _objectSpread({}, p, {
200
233
  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
- )]
234
+ children: [children.props.children, resizeHandles.map(function (h) {
235
+ return _react.default.createElement(_reactDraggable.DraggableCore, _extends({}, draggableOpts, {
236
+ key: "resizableHandle-" + h,
237
+ onStop: _this3.resizeHandler('onResizeStop', h),
238
+ onStart: _this3.resizeHandler('onResizeStart', h),
239
+ onDrag: _this3.resizeHandler('onResize', h)
240
+ }), _this3.renderResizeHandle(h));
241
+ })]
211
242
  }));
212
243
  };
213
244
 
214
245
  return Resizable;
215
- }(_react2.default.Component);
246
+ }(_react.default.Component);
247
+
248
+ exports.default = Resizable;
216
249
 
217
- Resizable.propTypes = {
250
+ _defineProperty(Resizable, "propTypes", {
218
251
  //
219
252
  // Required Props
220
253
  //
221
-
222
254
  // Require that one and only one child be present.
223
- children: _propTypes2.default.element.isRequired,
224
-
255
+ children: _propTypes.default.element.isRequired,
225
256
  // Initial w/h
226
- width: _propTypes2.default.number.isRequired,
227
- height: _propTypes2.default.number.isRequired,
228
-
257
+ width: _propTypes.default.number.isRequired,
258
+ height: _propTypes.default.number.isRequired,
229
259
  //
230
260
  // Optional props
231
261
  //
232
-
262
+ // Custom resize handle
263
+ handle: _propTypes.default.element,
233
264
  // If you change this, be sure to update your css
234
- handleSize: _propTypes2.default.array,
235
-
265
+ handleSize: _propTypes.default.array,
266
+ // Defines which resize handles should be rendered (default: 'se')
267
+ // Allows for any combination of:
268
+ // 's' - South handle (bottom-center)
269
+ // 'w' - West handle (left-center)
270
+ // 'e' - East handle (right-center)
271
+ // 'n' - North handle (top-center)
272
+ // 'sw' - Southwest handle (bottom-left)
273
+ // 'nw' - Northwest handle (top-left)
274
+ // 'se' - Southeast handle (bottom-right)
275
+ // 'ne' - Northeast handle (top-center)
276
+ resizeHandles: _propTypes.default.arrayOf(_propTypes.default.oneOf(['s', 'w', 'e', 'n', 'sw', 'nw', 'se', 'ne'])),
277
+ transformScale: _propTypes.default.number,
236
278
  // If true, will only allow width/height to move in lockstep
237
- lockAspectRatio: _propTypes2.default.bool,
238
-
279
+ lockAspectRatio: _propTypes.default.bool,
239
280
  // Restricts resizing to a particular axis (default: 'both')
240
281
  // 'both' - allows resizing by width or height
241
282
  // 'x' - only allows the width to be changed
242
283
  // 'y' - only allows the height to be changed
243
284
  // 'none' - disables resizing altogether
244
- axis: _propTypes2.default.oneOf(['both', 'x', 'y', 'none']),
245
-
285
+ axis: _propTypes.default.oneOf(['both', 'x', 'y', 'none']),
246
286
  // Min/max size
247
- minConstraints: _propTypes2.default.arrayOf(_propTypes2.default.number),
248
- maxConstraints: _propTypes2.default.arrayOf(_propTypes2.default.number),
249
-
287
+ minConstraints: _propTypes.default.arrayOf(_propTypes.default.number),
288
+ maxConstraints: _propTypes.default.arrayOf(_propTypes.default.number),
250
289
  // Callbacks
251
- onResizeStop: _propTypes2.default.func,
252
- onResizeStart: _propTypes2.default.func,
253
- onResize: _propTypes2.default.func,
254
-
290
+ onResizeStop: _propTypes.default.func,
291
+ onResizeStart: _propTypes.default.func,
292
+ onResize: _propTypes.default.func,
255
293
  // These will be passed wholesale to react-draggable's DraggableCore
256
- draggableOpts: _propTypes2.default.object
257
- };
258
- Resizable.defaultProps = {
294
+ draggableOpts: _propTypes.default.object
295
+ });
296
+
297
+ _defineProperty(Resizable, "defaultProps", {
259
298
  handleSize: [20, 20],
260
299
  lockAspectRatio: false,
261
300
  axis: 'both',
262
301
  minConstraints: [20, 20],
263
- maxConstraints: [Infinity, Infinity]
264
- };
265
- exports.default = Resizable;
302
+ maxConstraints: [Infinity, Infinity],
303
+ resizeHandles: ['se'],
304
+ transformScale: 1
305
+ });