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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "presets": [
3
- ["es2015", {loose: true}],
3
+ ["es2015", {"loose": true}],
4
4
  "react"
5
5
  ],
6
6
  "plugins": [
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,8 +1,12 @@
1
+ [version]
2
+ 0.55.0
3
+
1
4
  [ignore]
2
5
  .*/node_modules/babel.*
3
6
  .*/node_modules/fbjs/.*
4
7
  .*/node_modules/express/.*
5
8
  .*/node_modules/serve-index/.*
9
+ <PROJECT_ROOT>/build/.*
6
10
 
7
11
  [include]
8
12
 
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.
@@ -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: React.Element<any>,
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, data: ResizeCallbackData) => any,
33
- onResizeStart?: ?(e: SyntheticEvent, data: ResizeCallbackData) => any,
34
- onResize?: ?(e: SyntheticEvent, data: ResizeCallbackData) => any,
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(): React.Element<any> {
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,
@@ -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
- // $FlowIgnore children & defaultProps bug (https://github.com/facebook/flow/issues/1964)
91
- _react2.default.createElement(
92
- _Resizable2.default,
93
- {
94
- handleSize: handleSize,
95
- width: this.state.width,
96
- height: this.state.height,
97
- onResizeStart: onResizeStart,
98
- onResize: this.onResize,
99
- onResizeStop: onResizeStop,
100
- draggableOpts: draggableOpts,
101
- minConstraints: minConstraints,
102
- maxConstraints: maxConstraints,
103
- lockAspectRatio: lockAspectRatio,
104
- axis: axis
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, data: ResizeCallbackData) => {
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(): React.Element<any> {
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: React.Element<any>, props: Object): React.Element<any> {
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,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFu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TCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+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.1",
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": "echo 'Open http://localhost:4003/examples/1.html' && cross-env NODE_ENV=test webpack-dev-server --config webpack-dev-server.config.js --progress --hot --inline",
12
- "prepublish": "npm run build",
13
- "validate": "yarn list",
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.24.1",
35
- "babel-core": "^6.24.1",
36
- "babel-eslint": "^7.2.3",
37
- "babel-loader": "^7.0.0",
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.23.0",
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.0",
43
- "css-loader": "^0.28.0",
44
- "eslint": "^3.19.0",
45
- "eslint-plugin-react": "^7.0.1",
46
- "flow-bin": "^0.46.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": "^15.5.4",
50
- "react-dom": "^15.5.4",
51
- "style-loader": "^0.18.1",
52
- "webpack": "^2.4.1",
53
- "webpack-dev-server": "^2.4.5"
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": "^15.5.8",
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": "^0.14.0 || ^15.0.0",
61
- "react-dom": "^0.14.0 || ^15.0.0"
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"
package/.npmignore DELETED
@@ -1,5 +0,0 @@
1
- examples/
2
- test/
3
- lib/
4
- build.sh
5
- *.config.js