react-resizable 1.7.1 → 1.7.5
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 +1 -1
- package/.eslintrc +0 -3
- package/.flowconfig +4 -0
- package/CHANGELOG.md +19 -0
- package/build/Resizable.js.flow +9 -9
- package/build/ResizableBox.js +16 -19
- package/build/ResizableBox.js.flow +4 -5
- package/build/cloneElement.js.flow +2 -1
- package/css/styles.css +1 -1
- package/package.json +26 -24
- package/.npmignore +0 -5
- package/yarn.lock +0 -4355
package/.babelrc
CHANGED
package/.eslintrc
CHANGED
package/.flowconfig
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
### 1.7.5 (Sep 26, 2017)
|
|
4
|
+
|
|
5
|
+
- Support for React 16 (no changes required, updated `peerDependencies`)
|
|
6
|
+
- Minor dep updates.
|
|
7
|
+
|
|
8
|
+
### 1.7.4 (Sep 5, 2017)
|
|
9
|
+
|
|
10
|
+
- Minor Flow & dependency updates.
|
|
11
|
+
|
|
12
|
+
### 1.7.3 (Aug 31, 2017)
|
|
13
|
+
|
|
14
|
+
- Fix React deprecation warnings from `import *`
|
|
15
|
+
- https://github.com/facebook/react/issues/10583
|
|
16
|
+
|
|
17
|
+
### 1.7.2 (Aug 21, 2017)
|
|
18
|
+
|
|
19
|
+
- Pkg: Add `react-draggable@3.0.0` to version range.
|
|
20
|
+
- This package is compatible with both `@2` and `@3` versions.
|
|
21
|
+
|
|
3
22
|
### 1.7.1 (May 23, 2017)
|
|
4
23
|
|
|
5
24
|
- Bugfix: Some flow types were improperly specified.
|
package/build/Resizable.js.flow
CHANGED
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import {DraggableCore} from 'react-draggable';
|
|
5
5
|
import cloneElement from './cloneElement';
|
|
6
|
+
import type {Element as ReactElement, Node as ReactNode} from 'react';
|
|
6
7
|
|
|
7
8
|
type Axis = 'both' | 'x' | 'y' | 'none';
|
|
8
9
|
type State = {
|
|
@@ -21,7 +22,8 @@ export type ResizeCallbackData = {
|
|
|
21
22
|
size: {width: number, height: number}
|
|
22
23
|
};
|
|
23
24
|
export type Props = {
|
|
24
|
-
children:
|
|
25
|
+
children: ReactElement<any>,
|
|
26
|
+
className?: ?string,
|
|
25
27
|
width: number,
|
|
26
28
|
height: number,
|
|
27
29
|
handleSize: [number, number],
|
|
@@ -29,14 +31,13 @@ export type Props = {
|
|
|
29
31
|
axis: Axis,
|
|
30
32
|
minConstraints: [number, number],
|
|
31
33
|
maxConstraints: [number, number],
|
|
32
|
-
onResizeStop?: ?(e: SyntheticEvent
|
|
33
|
-
onResizeStart?: ?(e: SyntheticEvent
|
|
34
|
-
onResize?: ?(e: SyntheticEvent
|
|
34
|
+
onResizeStop?: ?(e: SyntheticEvent<>, data: ResizeCallbackData) => any,
|
|
35
|
+
onResizeStart?: ?(e: SyntheticEvent<>, data: ResizeCallbackData) => any,
|
|
36
|
+
onResize?: ?(e: SyntheticEvent<>, data: ResizeCallbackData) => any,
|
|
35
37
|
draggableOpts?: ?Object
|
|
36
38
|
};
|
|
37
39
|
|
|
38
|
-
export default class Resizable extends React.Component {
|
|
39
|
-
|
|
40
|
+
export default class Resizable extends React.Component<Props, State> {
|
|
40
41
|
static propTypes = {
|
|
41
42
|
//
|
|
42
43
|
// Required Props
|
|
@@ -78,7 +79,6 @@ export default class Resizable extends React.Component {
|
|
|
78
79
|
// These will be passed wholesale to react-draggable's DraggableCore
|
|
79
80
|
draggableOpts: PropTypes.object
|
|
80
81
|
};
|
|
81
|
-
props: Props;
|
|
82
82
|
|
|
83
83
|
static defaultProps = {
|
|
84
84
|
handleSize: [20, 20],
|
|
@@ -158,7 +158,7 @@ export default class Resizable extends React.Component {
|
|
|
158
158
|
* @return {Function} Handler function.
|
|
159
159
|
*/
|
|
160
160
|
resizeHandler(handlerName: string): Function {
|
|
161
|
-
return (e: SyntheticEvent | MouseEvent, {node, deltaX, deltaY}: DragCallbackData) => {
|
|
161
|
+
return (e: SyntheticEvent<> | MouseEvent, {node, deltaX, deltaY}: DragCallbackData) => {
|
|
162
162
|
|
|
163
163
|
// Axis restrictions
|
|
164
164
|
const canDragX = this.props.axis === 'both' || this.props.axis === 'x';
|
|
@@ -198,7 +198,7 @@ export default class Resizable extends React.Component {
|
|
|
198
198
|
};
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
render():
|
|
201
|
+
render(): ReactNode {
|
|
202
202
|
// eslint-disable-next-line no-unused-vars
|
|
203
203
|
const {children, draggableOpts, width, height, handleSize,
|
|
204
204
|
lockAspectRatio, axis, minConstraints, maxConstraints, onResize,
|
package/build/ResizableBox.js
CHANGED
|
@@ -86,25 +86,22 @@ var ResizableBox = function (_React$Component) {
|
|
|
86
86
|
height = _props.height,
|
|
87
87
|
props = _objectWithoutProperties(_props, ['handleSize', 'onResize', 'onResizeStart', 'onResizeStop', 'draggableOpts', 'minConstraints', 'maxConstraints', 'lockAspectRatio', 'axis', 'width', 'height']);
|
|
88
88
|
|
|
89
|
-
return (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
_react2.default.createElement('div', _extends({ style: { width: this.state.width + 'px', height: this.state.height + 'px' } }, props))
|
|
107
|
-
)
|
|
89
|
+
return _react2.default.createElement(
|
|
90
|
+
_Resizable2.default,
|
|
91
|
+
{
|
|
92
|
+
handleSize: handleSize,
|
|
93
|
+
width: this.state.width,
|
|
94
|
+
height: this.state.height,
|
|
95
|
+
onResizeStart: onResizeStart,
|
|
96
|
+
onResize: this.onResize,
|
|
97
|
+
onResizeStop: onResizeStop,
|
|
98
|
+
draggableOpts: draggableOpts,
|
|
99
|
+
minConstraints: minConstraints,
|
|
100
|
+
maxConstraints: maxConstraints,
|
|
101
|
+
lockAspectRatio: lockAspectRatio,
|
|
102
|
+
axis: axis
|
|
103
|
+
},
|
|
104
|
+
_react2.default.createElement('div', _extends({ style: { width: this.state.width + 'px', height: this.state.height + 'px' } }, props))
|
|
108
105
|
);
|
|
109
106
|
};
|
|
110
107
|
|
|
@@ -3,16 +3,16 @@ import React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import Resizable from './Resizable';
|
|
5
5
|
import type {Props as ResizableProps, ResizeCallbackData} from './Resizable';
|
|
6
|
+
import type {Node as ReactNode} from 'react';
|
|
6
7
|
|
|
7
8
|
type State = {width: number, height: number};
|
|
8
9
|
|
|
9
10
|
// An example use of Resizable.
|
|
10
|
-
export default class ResizableBox extends React.Component {
|
|
11
|
+
export default class ResizableBox extends React.Component<ResizableProps, State> {
|
|
11
12
|
static propTypes = {
|
|
12
13
|
height: PropTypes.number,
|
|
13
14
|
width: PropTypes.number
|
|
14
15
|
};
|
|
15
|
-
props: ResizableProps;
|
|
16
16
|
|
|
17
17
|
static defaultProps = {
|
|
18
18
|
handleSize: [20,20]
|
|
@@ -23,7 +23,7 @@ export default class ResizableBox extends React.Component {
|
|
|
23
23
|
height: this.props.height,
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
onResize = (e: SyntheticEvent
|
|
26
|
+
onResize = (e: SyntheticEvent<>, data: ResizeCallbackData) => {
|
|
27
27
|
const {size} = data;
|
|
28
28
|
const {width, height} = size;
|
|
29
29
|
|
|
@@ -44,14 +44,13 @@ export default class ResizableBox extends React.Component {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
render():
|
|
47
|
+
render(): ReactNode {
|
|
48
48
|
// Basic wrapper around a Resizable instance.
|
|
49
49
|
// If you use Resizable directly, you are responsible for updating the child component
|
|
50
50
|
// with a new width and height.
|
|
51
51
|
const {handleSize, onResize, onResizeStart, onResizeStop, draggableOpts,
|
|
52
52
|
minConstraints, maxConstraints, lockAspectRatio, axis, width, height, ...props} = this.props;
|
|
53
53
|
return (
|
|
54
|
-
// $FlowIgnore children & defaultProps bug (https://github.com/facebook/flow/issues/1964)
|
|
55
54
|
<Resizable
|
|
56
55
|
handleSize={handleSize}
|
|
57
56
|
width={this.state.width}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import type {Element as ReactElement} from 'react';
|
|
3
4
|
|
|
4
5
|
// React.addons.cloneWithProps look-alike that merges style & className.
|
|
5
|
-
module.exports = function cloneElement(element:
|
|
6
|
+
module.exports = function cloneElement(element: ReactElement<any>, props: Object): ReactElement<any> {
|
|
6
7
|
if (props.style && element.props.style) {
|
|
7
8
|
props.style = {...element.props.style, ...props.style};
|
|
8
9
|
}
|
package/css/styles.css
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
height: 20px;
|
|
8
8
|
bottom: 0;
|
|
9
9
|
right: 0;
|
|
10
|
-
background: url('data:image/svg+xml;base64,
|
|
10
|
+
background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+');
|
|
11
11
|
background-position: bottom right;
|
|
12
12
|
padding: 0 3px 3px 0;
|
|
13
13
|
background-repeat: no-repeat;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-resizable",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5",
|
|
4
4
|
"description": "A component that is resizable with handles.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,12 +8,14 @@
|
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
9
|
"build": "bash build.sh",
|
|
10
10
|
"build-example": "webpack",
|
|
11
|
-
"dev": "
|
|
12
|
-
"
|
|
13
|
-
"
|
|
11
|
+
"dev": "webpack-dev-server --open --open-page=examples/1.html",
|
|
12
|
+
"watch": "webpack --progress --watch",
|
|
13
|
+
"prepare": "npm run build",
|
|
14
|
+
"validate": "yarn check",
|
|
14
15
|
"preversion": "npm run lint",
|
|
15
16
|
"version": "git add CHANGELOG.md",
|
|
16
|
-
"postversion": "git push && git push --tags"
|
|
17
|
+
"postversion": "git push && git push --tags",
|
|
18
|
+
"flow": "flow"
|
|
17
19
|
},
|
|
18
20
|
"repository": {
|
|
19
21
|
"type": "git",
|
|
@@ -31,34 +33,34 @@
|
|
|
31
33
|
},
|
|
32
34
|
"homepage": "https://github.com/STRML/react-resizable",
|
|
33
35
|
"devDependencies": {
|
|
34
|
-
"babel-cli": "^6.
|
|
35
|
-
"babel-core": "^6.
|
|
36
|
-
"babel-eslint": "^
|
|
37
|
-
"babel-loader": "^7.
|
|
36
|
+
"babel-cli": "^6.26.0",
|
|
37
|
+
"babel-core": "^6.26.0",
|
|
38
|
+
"babel-eslint": "^8.0.1",
|
|
39
|
+
"babel-loader": "^7.1.2",
|
|
38
40
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
39
|
-
"babel-plugin-transform-object-rest-spread": "^6.
|
|
41
|
+
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
|
40
42
|
"babel-preset-es2015": "^6.24.1",
|
|
41
43
|
"babel-preset-react": "^6.24.1",
|
|
42
|
-
"cross-env": "^5.0.
|
|
43
|
-
"css-loader": "^0.28.
|
|
44
|
-
"eslint": "^
|
|
45
|
-
"eslint-plugin-react": "^7.0
|
|
46
|
-
"flow-bin": "^0.
|
|
44
|
+
"cross-env": "^5.0.5",
|
|
45
|
+
"css-loader": "^0.28.7",
|
|
46
|
+
"eslint": "^4.7.2",
|
|
47
|
+
"eslint-plugin-react": "^7.4.0",
|
|
48
|
+
"flow-bin": "^0.55.0",
|
|
47
49
|
"lodash": "^4.3.0",
|
|
48
50
|
"pre-commit": "^1.1.2",
|
|
49
|
-
"react": "^
|
|
50
|
-
"react-dom": "^
|
|
51
|
-
"style-loader": "^0.18.
|
|
52
|
-
"webpack": "^
|
|
53
|
-
"webpack-dev-server": "^2.
|
|
51
|
+
"react": "^16.0.0",
|
|
52
|
+
"react-dom": "^16.0.0",
|
|
53
|
+
"style-loader": "^0.18.2",
|
|
54
|
+
"webpack": "^3.6.0",
|
|
55
|
+
"webpack-dev-server": "^2.8.2"
|
|
54
56
|
},
|
|
55
57
|
"dependencies": {
|
|
56
|
-
"prop-types": "
|
|
57
|
-
"react-draggable": "^2.2.6"
|
|
58
|
+
"prop-types": "15.x",
|
|
59
|
+
"react-draggable": "^2.2.6 || ^3.0.3"
|
|
58
60
|
},
|
|
59
61
|
"peerDependencies": {
|
|
60
|
-
"react": "
|
|
61
|
-
"react-dom": "
|
|
62
|
+
"react": "0.14.x || 15.x || 16.x",
|
|
63
|
+
"react-dom": "0.14.x || 15.x || 16.x"
|
|
62
64
|
},
|
|
63
65
|
"publishConfig": {
|
|
64
66
|
"registry": "https://registry.npmjs.org"
|