Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-resizable

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-resizable - npm Package Compare versions

Comparing version 1.8.0 to 1.9.0

.browserslistrc

285

build/Resizable.js

@@ -1,94 +0,90 @@

'use strict';
"use strict";
exports.__esModule = true;
exports.default = void 0;
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; };
var _react = _interopRequireDefault(require("react"));
var _react = require('react');
var _propTypes = _interopRequireDefault(require("prop-types"));
var _react2 = _interopRequireDefault(_react);
var _reactDraggable = require("react-draggable");
var _propTypes = require('prop-types');
var _utils = require("./utils");
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _reactDraggable = require('react-draggable');
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); }
var _cloneElement = require('./cloneElement');
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; }
var _cloneElement2 = _interopRequireDefault(_cloneElement);
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; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _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; }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
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; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _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; }
var Resizable =
/*#__PURE__*/
function (_React$Component) {
_inheritsLoose(Resizable, _React$Component);
var Resizable = function (_React$Component) {
_inherits(Resizable, _React$Component);
function Resizable() {
var _temp, _this, _ret;
var _this;
_classCallCheck(this, Resizable);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
resizing: false,
width: _this.props.width, height: _this.props.height,
slackW: 0, slackH: 0
}, _temp), _possibleConstructorReturn(_this, _ret);
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_defineProperty(_assertThisInitialized(_this), "state", {
slackW: 0,
slackH: 0
});
return _this;
}
Resizable.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
// If parent changes height/width, set that in our state.
if (!this.state.resizing && (nextProps.width !== this.props.width || nextProps.height !== this.props.height)) {
this.setState({
width: nextProps.width,
height: nextProps.height
});
}
};
var _proto = Resizable.prototype;
Resizable.prototype.lockAspectRatio = function lockAspectRatio(width, height, aspectRatio) {
_proto.lockAspectRatio = function lockAspectRatio(width, height, aspectRatio) {
height = width / aspectRatio;
width = height * aspectRatio;
return [width, height];
};
} // If you do this, be careful of constraints
;
// If you do this, be careful of constraints
Resizable.prototype.runConstraints = function runConstraints(width, height) {
_proto.runConstraints = function runConstraints(width, height) {
var _ref = [this.props.minConstraints, this.props.maxConstraints],
min = _ref[0],
max = _ref[1];
if (!min && !max) return [width, height]; // Fit width & height to aspect ratio
if (this.props.lockAspectRatio) {
if (height === this.props.height) {
var ratio = this.props.width / this.props.height;
height = width / ratio;
width = height * ratio;
} else {
// Take into account vertical resize with N/S handles on locked aspect
// ratio. Calculate the change height-first, instead of width-first
var _ratio = this.props.height / this.props.width;
if (this.props.lockAspectRatio) {
var ratio = this.state.width / this.state.height;
height = width / ratio;
width = height * ratio;
width = height / _ratio;
height = width * _ratio;
}
}
if (!min && !max) return [width, height];
var oldW = width,
oldH = height;
// Add slack to the values used to calculate bound position. This will ensure that if
oldH = height; // Add slack to the values used to calculate bound position. This will ensure that if
// we start removing slack, the element won't react to it right away until it's been
// completely removed.
var _state = this.state,
slackW = _state.slackW,
slackH = _state.slackH;
var _this$state = this.state,
slackW = _this$state.slackW,
slackH = _this$state.slackH;
width += slackW;

@@ -101,17 +97,21 @@ height += slackH;

}
if (max) {
width = Math.min(max[0], width);
height = Math.min(max[1], height);
}
} // If the numbers changed, we must have introduced some slack. Record it for the next iteration.
// If the numbers changed, we must have introduced some slack. Record it for the next iteration.
slackW += oldW - width;
slackH += oldH - height;
if (slackW !== this.state.slackW || slackH !== this.state.slackH) {
this.setState({ slackW: slackW, slackH: slackH });
this.setState({
slackW: slackW,
slackH: slackH
});
}
return [width, height];
};
}
/**

@@ -123,5 +123,5 @@ * Wrapper around drag events to provide more useful data.

*/
;
Resizable.prototype.resizeHandler = function resizeHandler(handlerName, axis) {
_proto.resizeHandler = function resizeHandler(handlerName, axis) {
var _this2 = this;

@@ -133,49 +133,52 @@

deltaY = _ref2.deltaY;
// Axis restrictions
var canDragX = (_this2.props.axis === 'both' || _this2.props.axis === 'x') && ['n', 's'].indexOf(axis) === -1;
var canDragY = (_this2.props.axis === 'both' || _this2.props.axis === 'y') && ['e', 'w'].indexOf(axis) === -1;
var canDragY = (_this2.props.axis === 'both' || _this2.props.axis === 'y') && ['e', 'w'].indexOf(axis) === -1; // reverse delta if using top or left drag handles
// reverse delta if using top or left drag handles
if (canDragX && axis[axis.length - 1] === 'w') {
deltaX = -deltaX;
}
if (canDragY && axis[0] === 'n') {
deltaY = -deltaY;
}
} // Update w/h
// Update w/h
var width = _this2.state.width + (canDragX ? deltaX : 0);
var height = _this2.state.height + (canDragY ? deltaY : 0);
// Early return if no change
var widthChanged = width !== _this2.state.width,
heightChanged = height !== _this2.state.height;
var width = _this2.props.width + (canDragX ? deltaX : 0);
var height = _this2.props.height + (canDragY ? deltaY : 0); // Early return if no change
var widthChanged = width !== _this2.props.width,
heightChanged = height !== _this2.props.height;
if (handlerName === 'onResize' && !widthChanged && !heightChanged) return;
var _this2$runConstraints = _this2.runConstraints(width, height);
width = _this2$runConstraints[0];
height = _this2$runConstraints[1];
// Set the appropriate state for this handler.
var _runConstraints = _this2.runConstraints(width, height);
var newState = {};
width = _runConstraints[0];
height = _runConstraints[1];
var newState = {};
if (handlerName === 'onResizeStart') {
newState.resizing = true;
if (handlerName === 'onResizeStart') {// nothing
} else if (handlerName === 'onResizeStop') {
newState.resizing = false;
newState.slackW = newState.slackH = 0;
} else {
// Early return if no change after constraints
if (width === _this2.state.width && height === _this2.state.height) return;
newState.width = width;
newState.height = height;
if (width === _this2.props.width && height === _this2.props.height) return;
}
var hasCb = typeof _this2.props[handlerName] === 'function';
if (hasCb) {
// $FlowIgnore isn't refining this correctly to SyntheticEvent
if (typeof e.persist === 'function') e.persist();
_this2.setState(newState, function () {
return _this2.props[handlerName](e, { node: node, size: { width: width, height: height }, handle: axis });
return _this2.props[handlerName](e, {
node: node,
size: {
width: width,
height: height
},
handle: axis
});
});

@@ -188,3 +191,3 @@ } else {

Resizable.prototype.renderResizeHandle = function renderResizeHandle(resizeHandle) {
_proto.renderResizeHandle = function renderResizeHandle(resizeHandle) {
var handle = this.props.handle;

@@ -196,46 +199,45 @@

}
return handle;
}
return _react2.default.createElement('span', { className: 'react-resizable-handle react-resizable-handle-' + resizeHandle });
return _react.default.createElement("span", {
className: "react-resizable-handle react-resizable-handle-" + resizeHandle
});
};
Resizable.prototype.render = function render() {
_proto.render = function render() {
var _this3 = this;
// eslint-disable-next-line no-unused-vars
var _props = this.props,
children = _props.children,
draggableOpts = _props.draggableOpts,
width = _props.width,
height = _props.height,
handleSize = _props.handleSize,
lockAspectRatio = _props.lockAspectRatio,
axis = _props.axis,
minConstraints = _props.minConstraints,
maxConstraints = _props.maxConstraints,
onResize = _props.onResize,
onResizeStop = _props.onResizeStop,
onResizeStart = _props.onResizeStart,
resizeHandles = _props.resizeHandles,
p = _objectWithoutProperties(_props, ['children', 'draggableOpts', 'width', 'height', 'handleSize', 'lockAspectRatio', 'axis', 'minConstraints', 'maxConstraints', 'onResize', 'onResizeStop', 'onResizeStart', 'resizeHandles']);
var _this$props = this.props,
children = _this$props.children,
draggableOpts = _this$props.draggableOpts,
width = _this$props.width,
height = _this$props.height,
handleSize = _this$props.handleSize,
lockAspectRatio = _this$props.lockAspectRatio,
axis = _this$props.axis,
minConstraints = _this$props.minConstraints,
maxConstraints = _this$props.maxConstraints,
onResize = _this$props.onResize,
onResizeStop = _this$props.onResizeStop,
onResizeStart = _this$props.onResizeStart,
resizeHandles = _this$props.resizeHandles,
p = _objectWithoutPropertiesLoose(_this$props, ["children", "draggableOpts", "width", "height", "handleSize", "lockAspectRatio", "axis", "minConstraints", "maxConstraints", "onResize", "onResizeStop", "onResizeStart", "resizeHandles"]);
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.
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.
// We are then defining its children as:
// Its original children (resizable's child's children), and
// One or more draggable handles.
return (0, _cloneElement2.default)(children, _extends({}, p, {
return (0, _utils.cloneElement)(children, _objectSpread({}, p, {
className: className,
children: [children.props.children, resizeHandles.map(function (h) {
return _react2.default.createElement(
_reactDraggable.DraggableCore,
_extends({}, draggableOpts, {
key: 'resizableHandle-' + h,
onStop: _this3.resizeHandler('onResizeStop', h),
onStart: _this3.resizeHandler('onResizeStart', h),
onDrag: _this3.resizeHandler('onResize', h)
}),
_this3.renderResizeHandle(h)
);
return _react.default.createElement(_reactDraggable.DraggableCore, _extends({}, draggableOpts, {
key: "resizableHandle-" + h,
onStop: _this3.resizeHandler('onResizeStop', h),
onStart: _this3.resizeHandler('onResizeStart', h),
onDrag: _this3.resizeHandler('onResize', h)
}), _this3.renderResizeHandle(h));
})]

@@ -246,26 +248,22 @@ }));

return Resizable;
}(_react2.default.Component);
}(_react.default.Component);
Resizable.propTypes = {
exports.default = Resizable;
_defineProperty(Resizable, "propTypes", {
//
// Required Props
//
// Require that one and only one child be present.
children: _propTypes2.default.element.isRequired,
children: _propTypes.default.element.isRequired,
// Initial w/h
width: _propTypes2.default.number.isRequired,
height: _propTypes2.default.number.isRequired,
width: _propTypes.default.number.isRequired,
height: _propTypes.default.number.isRequired,
//
// Optional props
//
// Custom resize handle
handle: _propTypes2.default.element,
handle: _propTypes.default.element,
// If you change this, be sure to update your css
handleSize: _propTypes2.default.array,
handleSize: _propTypes.default.array,
// Defines which resize handles should be rendered (default: 'se')

@@ -281,7 +279,5 @@ // Allows for any combination of:

// 'ne' - Northeast handle (top-center)
resizeHandles: _propTypes2.default.arrayOf(_propTypes2.default.oneOf(['s', 'w', 'e', 'n', 'sw', 'nw', 'se', 'ne'])),
resizeHandles: _propTypes.default.arrayOf(_propTypes.default.oneOf(['s', 'w', 'e', 'n', 'sw', 'nw', 'se', 'ne'])),
// If true, will only allow width/height to move in lockstep
lockAspectRatio: _propTypes2.default.bool,
lockAspectRatio: _propTypes.default.bool,
// Restricts resizing to a particular axis (default: 'both')

@@ -292,17 +288,15 @@ // 'both' - allows resizing by width or height

// 'none' - disables resizing altogether
axis: _propTypes2.default.oneOf(['both', 'x', 'y', 'none']),
axis: _propTypes.default.oneOf(['both', 'x', 'y', 'none']),
// Min/max size
minConstraints: _propTypes2.default.arrayOf(_propTypes2.default.number),
maxConstraints: _propTypes2.default.arrayOf(_propTypes2.default.number),
minConstraints: _propTypes.default.arrayOf(_propTypes.default.number),
maxConstraints: _propTypes.default.arrayOf(_propTypes.default.number),
// Callbacks
onResizeStop: _propTypes2.default.func,
onResizeStart: _propTypes2.default.func,
onResize: _propTypes2.default.func,
onResizeStop: _propTypes.default.func,
onResizeStart: _propTypes.default.func,
onResize: _propTypes.default.func,
// These will be passed wholesale to react-draggable's DraggableCore
draggableOpts: _propTypes.default.object
});
// These will be passed wholesale to react-draggable's DraggableCore
draggableOpts: _propTypes2.default.object
};
Resizable.defaultProps = {
_defineProperty(Resizable, "defaultProps", {
handleSize: [20, 20],

@@ -314,3 +308,2 @@ lockAspectRatio: false,

resizeHandles: ['se']
};
exports.default = Resizable;
});

@@ -1,46 +0,47 @@

'use strict';
"use strict";
exports.__esModule = true;
exports.default = void 0;
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; };
var _react = _interopRequireDefault(require("react"));
var _react = require('react');
var _propTypes = _interopRequireDefault(require("prop-types"));
var _react2 = _interopRequireDefault(_react);
var _Resizable = _interopRequireDefault(require("./Resizable"));
var _propTypes = require('prop-types');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _propTypes2 = _interopRequireDefault(_propTypes);
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); }
var _Resizable = require('./Resizable');
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; }
var _Resizable2 = _interopRequireDefault(_Resizable);
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
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; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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; }
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; }
// An example use of Resizable.
var ResizableBox = function (_React$Component) {
_inherits(ResizableBox, _React$Component);
var ResizableBox =
/*#__PURE__*/
function (_React$Component) {
_inheritsLoose(ResizableBox, _React$Component);
function ResizableBox() {
var _temp, _this, _ret;
var _this;
_classCallCheck(this, ResizableBox);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
_defineProperty(_assertThisInitialized(_this), "state", {
width: _this.props.width,
height: _this.props.height
}, _this.onResize = function (e, data) {
height: _this.props.height,
propsWidth: _this.props.width,
propsHeight: _this.props.height
});
_defineProperty(_assertThisInitialized(_this), "onResize", function (e, data) {
var size = data.size;

@@ -50,5 +51,5 @@ var width = size.width,

if (_this.props.onResize) {
e.persist && e.persist();
_this.setState(size, function () {

@@ -60,65 +61,75 @@ return _this.props.onResize && _this.props.onResize(e, data);

}
}, _temp), _possibleConstructorReturn(_this, _ret);
});
return _this;
}
ResizableBox.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (nextProps.width !== this.props.width || nextProps.height !== this.props.height) {
this.setState({
width: nextProps.width,
height: nextProps.height
});
ResizableBox.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
// If parent changes height/width, set that in our state.
if (state.propsWidth !== props.width || state.propsHeight !== props.height) {
return {
width: props.width,
height: props.height,
propsWidth: props.width,
propsHeight: props.height
};
}
};
ResizableBox.prototype.render = function render() {
var _proto = ResizableBox.prototype;
_proto.render = function render() {
// Basic wrapper around a Resizable instance.
// If you use Resizable directly, you are responsible for updating the child component
// with a new width and height.
var _props = this.props,
handle = _props.handle,
handleSize = _props.handleSize,
onResize = _props.onResize,
onResizeStart = _props.onResizeStart,
onResizeStop = _props.onResizeStop,
draggableOpts = _props.draggableOpts,
minConstraints = _props.minConstraints,
maxConstraints = _props.maxConstraints,
lockAspectRatio = _props.lockAspectRatio,
axis = _props.axis,
width = _props.width,
height = _props.height,
resizeHandles = _props.resizeHandles,
props = _objectWithoutProperties(_props, ['handle', 'handleSize', 'onResize', 'onResizeStart', 'onResizeStop', 'draggableOpts', 'minConstraints', 'maxConstraints', 'lockAspectRatio', 'axis', 'width', 'height', 'resizeHandles']);
var _this$props = this.props,
handle = _this$props.handle,
handleSize = _this$props.handleSize,
onResize = _this$props.onResize,
onResizeStart = _this$props.onResizeStart,
onResizeStop = _this$props.onResizeStop,
draggableOpts = _this$props.draggableOpts,
minConstraints = _this$props.minConstraints,
maxConstraints = _this$props.maxConstraints,
lockAspectRatio = _this$props.lockAspectRatio,
axis = _this$props.axis,
width = _this$props.width,
height = _this$props.height,
resizeHandles = _this$props.resizeHandles,
props = _objectWithoutPropertiesLoose(_this$props, ["handle", "handleSize", "onResize", "onResizeStart", "onResizeStop", "draggableOpts", "minConstraints", "maxConstraints", "lockAspectRatio", "axis", "width", "height", "resizeHandles"]);
return _react2.default.createElement(
_Resizable2.default,
{
handle: handle,
handleSize: handleSize,
width: this.state.width,
height: this.state.height,
onResizeStart: onResizeStart,
onResize: this.onResize,
onResizeStop: onResizeStop,
draggableOpts: draggableOpts,
minConstraints: minConstraints,
maxConstraints: maxConstraints,
lockAspectRatio: lockAspectRatio,
axis: axis,
resizeHandles: resizeHandles
},
_react2.default.createElement('div', _extends({ style: { width: this.state.width + 'px', height: this.state.height + 'px' } }, props))
);
return _react.default.createElement(_Resizable.default, {
handle: handle,
handleSize: handleSize,
width: this.state.width,
height: this.state.height,
onResizeStart: onResizeStart,
onResize: this.onResize,
onResizeStop: onResizeStop,
draggableOpts: draggableOpts,
minConstraints: minConstraints,
maxConstraints: maxConstraints,
lockAspectRatio: lockAspectRatio,
axis: axis,
resizeHandles: resizeHandles
}, _react.default.createElement("div", _extends({
style: {
width: this.state.width + 'px',
height: this.state.height + 'px'
}
}, props)));
};
return ResizableBox;
}(_react2.default.Component);
}(_react.default.Component);
ResizableBox.propTypes = {
height: _propTypes2.default.number,
width: _propTypes2.default.number
};
ResizableBox.defaultProps = {
exports.default = ResizableBox;
_defineProperty(ResizableBox, "propTypes", {
height: _propTypes.default.number,
width: _propTypes.default.number
});
_defineProperty(ResizableBox, "defaultProps", {
handleSize: [20, 20]
};
exports.default = ResizableBox;
});
# Changelog
### 1.8.0 (May 15 2019)
### 1.9.0 (Oct 24, 2019)
- Added support for custom resize handles (https://github.com/STRML/react-resizable/pull/79)
- Added support for resize handles on all corners (https://github.com/STRML/react-resizable/pull/191)
- Fix resize with north/south handles when `lockAspectRatio=true` [#106](https://github.com/STRML/react-resizable/pull/106)
- Remove deprecated React 16.9 lifecycle methods (`componentWillReceiveProps`) (https://github.com/STRML/react-resizable/pull/112/commits/541dee69b8e45d91a533855609472b481634edee)
- Upgrade to babel 7
- [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.
### 1.8.0 (May 15, 2019)
- Added support for custom resize handles [#79](https://github.com/STRML/react-resizable/pull/79)
- Added support for resize handles on all corners [#191](https://github.com/STRML/react-resizable/pull/191)
### 1.7.5 (Sep 26, 2017)

@@ -9,0 +16,0 @@

{
"name": "react-resizable",
"version": "1.8.0",
"version": "1.9.0",
"description": "A component that is resizable with handles.",

@@ -36,26 +36,28 @@ "main": "index.js",

"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^10.0.1",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"cross-env": "^5.0.5",
"css-loader": "^2.1.1",
"eslint": "^5.16.0",
"eslint-plugin-react": "^7.4.0",
"flow-bin": "^0.98.1",
"lodash": "^4.3.0",
"cross-env": "^6.0.3",
"css-loader": "^3.2.0",
"eslint": "^6.5.1",
"eslint-plugin-react": "^7.16.0",
"flow-bin": "^0.110.0",
"lodash": "^4.17.15",
"pre-commit": "^1.1.2",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"style-loader": "^0.23.1",
"webpack": "^4.31.0",
"webpack-dev-server": "^3.3.1"
"react": "^16.10.2",
"react-dom": "^16.10.2",
"style-loader": "^1.0.0",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.9",
"webpack-dev-server": "^3.8.2"
},
"dependencies": {
"prop-types": "15.x",
"react-draggable": "^3.0.3"
"react-draggable": "^4.0.3"
},

@@ -62,0 +64,0 @@ "peerDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc