Skip to content

Commit a0abe54

Browse files
committed
chore(pkg): update deps
1 parent eeefa1a commit a0abe54

File tree

8 files changed

+2158
-2006
lines changed

8 files changed

+2158
-2006
lines changed

.babelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@babel/preset-flow"
1111
],
1212
"plugins": [
13-
"@babel/plugin-proposal-class-properties",
13+
["@babel/plugin-proposal-class-properties", {"loose": true}],
1414
"@babel/plugin-proposal-object-rest-spread"
1515
]
1616
}

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"root": true,
3-
"parser": "babel-eslint",
3+
"parser": "@babel/eslint-parser",
44
"plugins": [
55
"react"
66
],

.flowconfig

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[version]
2-
^0.133.0
2+
^0.150.1
33

44
[ignore]
55
.*/node_modules/@babel.*
@@ -18,10 +18,6 @@ implicit-inexact-object=error
1818

1919
[options]
2020
suppress_type=$FlowFixMe
21-
esproposal.class_static_fields=enable
22-
esproposal.class_instance_fields=enable
23-
esproposal.decorators=ignore
24-
esproposal.export_star_as=enable
2521
experimental.strict_call_arity=true
2622
module.system.node.allow_root_relative=true
2723
module.use_strict=true

lib/Resizable.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import type {Node as ReactNode} from 'react';
44
import {DraggableCore} from 'react-draggable';
55
import {cloneElement} from './utils';
66
import {resizableProps} from "./propTypes";
7-
import type {ResizeHandleAxis, Props, ResizableState, DragCallbackData} from './propTypes';
7+
import type {ResizeHandleAxis, DefaultProps, Props, ReactRef, ResizableState, DragCallbackData} from './propTypes';
88

99
export default class Resizable extends React.Component<Props, ResizableState> {
1010
static propTypes = resizableProps;
1111

12-
static defaultProps = {
12+
static defaultProps: DefaultProps = {
13+
axis: 'both',
1314
handleSize: [20, 20],
1415
lockAspectRatio: false,
15-
axis: 'both',
1616
minConstraints: [20, 20],
1717
maxConstraints: [Infinity, Infinity],
1818
resizeHandles: ['se'],

lib/ResizableBox.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default class ResizableBox extends React.Component<ResizableBoxProps, Res
2828
propsHeight: this.props.height,
2929
};
3030

31-
static getDerivedStateFromProps(props: ResizableBoxProps, state: ResizableBoxState) {
31+
static getDerivedStateFromProps(props: ResizableBoxProps, state: ResizableBoxState): ?ResizableBoxState {
3232
// If parent changes height/width, set that in our state.
3333
if (state.propsWidth !== props.width || state.propsHeight !== props.height) {
3434
return {
@@ -41,7 +41,7 @@ export default class ResizableBox extends React.Component<ResizableBoxProps, Res
4141
return null;
4242
}
4343

44-
onResize = (e: SyntheticEvent<>, data: ResizeCallbackData) => {
44+
onResize: (e: SyntheticEvent<>, data: ResizeCallbackData) => void = (e, data) => {
4545
const {size} = data;
4646
if (this.props.onResize) {
4747
e.persist && e.persist();

lib/propTypes.js

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,56 @@ import PropTypes from 'prop-types';
33
import {DraggableCore} from "react-draggable";
44
import type {Element as ReactElement, ElementConfig} from 'react';
55

6+
export type ReactRef<T: HTMLElement> = {
7+
current: T | null
8+
};
9+
610
export type Axis = 'both' | 'x' | 'y' | 'none';
711
export type ResizeHandleAxis = 's' | 'w' | 'e' | 'n' | 'sw' | 'nw' | 'se' | 'ne';
812
export type ResizableState = void;
9-
export type ResizableBoxState = {|
13+
export type ResizableBoxState = {
1014
width: number, height: number,
1115
propsWidth: number, propsHeight: number
12-
|};
13-
export type DragCallbackData = {|
16+
};
17+
export type DragCallbackData = {
1418
node: HTMLElement,
1519
x: number, y: number,
1620
deltaX: number, deltaY: number,
1721
lastX: number, lastY: number
18-
|};
19-
export type ResizeCallbackData = {|
22+
};
23+
export type ResizeCallbackData = {
2024
node: HTMLElement,
21-
size: {|width: number, height: number|},
25+
size: {width: number, height: number},
2226
handle: ResizeHandleAxis
23-
|};
27+
};
2428

2529
// <Resizable>
26-
export type Props = {|
30+
export type DefaultProps = {
2731
axis: Axis,
32+
handleSize: [number, number],
33+
lockAspectRatio: boolean,
34+
minConstraints: [number, number],
35+
maxConstraints: [number, number],
36+
resizeHandles: ResizeHandleAxis[],
37+
transformScale: number,
38+
};
39+
40+
export type Props = {
41+
...DefaultProps,
2842
children: ReactElement<any>,
2943
className?: ?string,
3044
draggableOpts?: ?ElementConfig<typeof DraggableCore>,
3145
height: number,
3246
handle?: ReactElement<any> | (resizeHandleAxis: ResizeHandleAxis) => ReactElement<any>,
33-
handleSize: [number, number],
34-
lockAspectRatio: boolean,
35-
minConstraints: [number, number],
36-
maxConstraints: [number, number],
3747
onResizeStop?: ?(e: SyntheticEvent<>, data: ResizeCallbackData) => any,
3848
onResizeStart?: ?(e: SyntheticEvent<>, data: ResizeCallbackData) => any,
3949
onResize?: ?(e: SyntheticEvent<>, data: ResizeCallbackData) => any,
40-
resizeHandles: ResizeHandleAxis[],
41-
transformScale: number,
4250
width: number,
43-
|};
51+
};
52+
53+
4454

45-
export const resizableProps = {
55+
export const resizableProps: Object = {
4656
/*
4757
* Restricts resizing to a particular axis (default: 'both')
4858
* 'both' - allows resizing by width or height

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,20 @@
3636
"devDependencies": {
3737
"@babel/cli": "^7.11.6",
3838
"@babel/core": "^7.11.6",
39+
"@babel/eslint-parser": "^7.13.14",
3940
"@babel/plugin-proposal-class-properties": "^7.10.4",
4041
"@babel/plugin-proposal-object-rest-spread": "^7.11.0",
4142
"@babel/preset-env": "^7.11.5",
4243
"@babel/preset-flow": "^7.10.4",
4344
"@babel/preset-react": "^7.10.4",
44-
"babel-eslint": "^10.0.3",
4545
"babel-loader": "^8.0.6",
4646
"cross-env": "^7.0.2",
4747
"css-loader": "^4.2.2",
4848
"enzyme": "^3.11.0",
4949
"enzyme-adapter-react-16": "^1.15.4",
5050
"eslint": "^7.8.1",
5151
"eslint-plugin-react": "^7.20.6",
52-
"flow-bin": "^0.133.0",
52+
"flow-bin": "^0.150.1",
5353
"jest": "^26.4.2",
5454
"lodash": "^4.17.20",
5555
"pre-commit": "^1.1.2",

0 commit comments

Comments
 (0)