Skip to content

Commit e1efa9e

Browse files
committed
Merge branch 'master' into gh-pages
2 parents b1f2e03 + d14b7fa commit e1efa9e

17 files changed

Lines changed: 4928 additions & 196 deletions

.babelrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
22
"presets": [
3-
"es2015-loose",
3+
["es2015", {loose: true}],
44
"stage-1",
55
"react"
6+
],
7+
"plugins": [
8+
"transform-flow-comments"
69
]
710
}

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"globals": {
3131
// For Flow
3232
"ReactElement",
33-
"ReactClass"
33+
"ReactClass",
34+
"SyntheticEvent"
3435
}
3536
}

.github/ISSUE_TEMPLATE.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
### Thanks for opening an issue!
2+
3+
Please select the type of issue you're reporting. For questions.
4+
5+
- [ ] Bug
6+
- [ ] Feature Request
7+
- [ ] Question
8+
9+
### Problem Report
10+
11+
> Please describe the problem here.
12+
13+
#### System Info
14+
15+
Node Version:
16+
Browser:
17+
OS:
18+
19+
#### Reproduction
20+
21+
If this is a bug report, please provide a reproduction of the issue by going to
22+
http://www.webpackbin.com/41YFBvekG.
23+
Paste a link here to your working reproduction.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Thanks for submitting a pull request to React-Resizable!
2+
3+
Please reference an open issue. If one has not been created, please create one along with a failing
4+
example or test case.
5+
6+
Please do not commit built files (`/dist`) to pull requests. They are built only at release.

CHANGELOG.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,53 @@
11
# Changelog
22

3+
### 1.6.0 (Jan 23, 2017)
4+
5+
- Feature: Allow restricting by axis. (#40, thanks @dnissley-al)
6+
7+
### 1.5.0 (Jan 23, 2017)
8+
9+
- Bugfix: Persist SyntheticEvents when needed (#45, #46)
10+
- Feature: Add componentWillReceiveProps to `<ResizableBox>` (#44, thanks @JoaoMosmann)
11+
12+
### 1.4.6 (Dec 30, 2016)
13+
14+
- Removed unused ref from `<Resizable>`.
15+
- Added development lockfile.
16+
17+
### 1.4.5 (Sep 30, 2016)
18+
19+
- Fix bad publish
20+
21+
### 1.4.4 (Sep 30, 2016)
22+
23+
- Bugfix: Minor flow errors
24+
25+
### 1.4.3 (Sep 27, 2016)
26+
27+
- Bugfix: Don't pass `onResize` in `<ResizableBox>`.
28+
- Bugfix: Fix new Flow errors (type parameters no longer optional).
29+
30+
### 1.4.2 (July 1, 2016)
31+
32+
- Bugfix: Don't pass unknown props to underlying DOM element. Fixes React 15.2.0 warnings.
33+
34+
### 1.4.1 (May 23, 2016)
35+
36+
- Bugfix: Resizable handle should have a `key` when injected. Fixes React warnings on custom components.
37+
38+
### 1.4.0 (May 20, 2016)
39+
40+
- Update to React-Draggable v2, which changed callback data structure.
41+
42+
### 1.3.4 (May 17, 2016)
43+
44+
- Bugfix: Slack was not being reset on resizeStop. Fixes #34, #36.
45+
- Added `flow-bin` to devDeps.
46+
47+
### 1.3.3 (Apr 19, 2016)
48+
49+
- Enhancement: Add Flow comments.
50+
351
### 1.3.2 (Apr 8, 2016)
452

553
- Bugfix: Prevent `width` and `height` from leaking to the underlying DOM element and being written.

README.md

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,26 @@ See the example and associated code in [TestLayout](/test/TestLayout.jsx) and
1212
Make sure you use the associated styles in [/css/styles.css](/css/styles.css), as without them, you will have
1313
problems with handle placement and visibility.
1414

15-
You can pass options directly to the underlying `Draggable` instance by using the prop `draggableOpts`.
15+
You can pass options directly to the underlying `DraggableCore` instance by using the prop `draggableOpts`.
1616
See the [demo](/test/TestLayout.jsx) for more on this.
1717

18+
### Installation
19+
20+
Using [npm](https://www.npmjs.com/):
21+
22+
$ npm install --save react-resizable
1823

1924
### Usage
2025

21-
```javascript
22-
var Resizable = require('react-resizable').Resizable; // or,
23-
var ResizableBox = require('react-resizable').ResizableBox;
26+
```js
27+
const Resizable = require('react-resizable').Resizable; // or,
28+
const ResizableBox = require('react-resizable').ResizableBox;
29+
30+
// ES6
31+
import { Resizable, ResizableBox } from 'react-resizable';
2432

25-
...
26-
render: function() {
33+
// ...
34+
render() {
2735
return (
2836
<ResizableBox width={200} height={200} draggableOpts={{...}}
2937
minConstraints={[100, 100]} maxConstraints={[300, 300]}>
@@ -33,37 +41,24 @@ render: function() {
3341
}
3442
```
3543

36-
### `<Resizable>` Options
44+
### Props
3745

38-
```js
39-
{
40-
// Functions
41-
onResizeStop: React.PropTypes.func,
42-
onResizeStart: React.PropTypes.func,
43-
onResize: React.PropTypes.func,
44-
45-
width: React.PropTypes.number.isRequired,
46-
height: React.PropTypes.number.isRequired,
47-
// If you change this, be sure to update your css
48-
handleSize: React.PropTypes.array,
49-
// These will be passed wholesale to react-draggable
50-
draggableOpts: React.PropTypes.object
51-
}
52-
```
53-
54-
### `<ResizableBox>` Options
46+
These props apply to both `<Resizable>` and `<ResizableBox>`.
5547

5648
```js
5749
{
58-
lockAspectRatio: React.PropTypes.bool, // Preserves aspect
59-
60-
// Constaints coords, pass [x,y]
61-
minConstraints: React.PropTypes.arrayOf(React.PropTypes.number),
62-
maxConstraints: React.PropTypes.arrayOf(React.PropTypes.number),
63-
64-
// Initial width/height - otherwise use CSS
65-
height: React.PropTypes.number,
66-
width: React.PropTypes.number
67-
}
68-
```
50+
children: React.Element<any>,
51+
width: number,
52+
height: number,
53+
// If you change this, be sure to update your css
54+
handleSize: [number, number] = [10, 10],
55+
lockAspectRatio: boolean = false,
56+
axis: 'both' | 'x' | 'y' | 'none' = 'both',
57+
minConstraints: [number, number] = [10, 10],
58+
maxConstraints: [number, number] = [Infinity, Infinity],
59+
onResizeStop?: ?(e: SyntheticEvent, data: ResizeCallbackData) => any,
60+
onResizeStart?: ?(e: SyntheticEvent, data: ResizeCallbackData) => any,
61+
onResize?: ?(e: SyntheticEvent, data: ResizeCallbackData) => any,
62+
draggableOpts?: ?Object
63+
};
6964
```

build.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
#!/bin/bash
1+
#!/bin/bash -ex
22
rm -rf ./build
3+
4+
# Simple babel run
35
./node_modules/.bin/babel --out-dir ./build ./lib
4-
# More cross-platform compatible than `rename`
5-
find ./build -type f -name '*.jsx' -exec sh -c 'mv -f $0 ${0%.jsx}.js' {} \;
6+
7+
# Gen flow configs
8+
# When https://github.com/facebook/flow/issues/2830 et al are fixed we can use this, but not until then
9+
# find ./lib -type f -name '*.js' -exec sh -c "$BIN/flow gen-flow-files \$0 --out-dir build" {} \;
10+
11+
# Copy original source as js.flow; flow will pick them up
12+
find ./lib -type f -name '*.js' -exec sh -c 'cp $0 build/$(basename $0).flow' {} \;

examples/1.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@
88
#content {
99
width: 100%;
1010
background: #eee;
11+
padding-bottom: 200px;
12+
}
13+
.layoutRoot {
14+
display: flex;
15+
flex-wrap: wrap;
1116
}
1217
.box {
18+
display: inline-block;
1319
background: #ccc;
1420
border: 1px solid black;
1521
text-align: center;
@@ -18,6 +24,7 @@
1824
margin-bottom: 10px;
1925
overflow: hidden;
2026
position: relative;
27+
margin: 20px;
2128
}
2229
.box .text {
2330
text-align: center;

0 commit comments

Comments
 (0)