react-resizable 3.1.0 → 3.1.2
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/.claude/commands/fix-issue.md +110 -0
- package/.claude/settings.local.json +7 -1
- package/CHANGELOG.md +11 -0
- package/README.md +90 -47
- package/build/Resizable.js +1 -1
- package/build/Resizable.js.flow +1 -1
- package/build/propTypes.js +3 -1
- package/build/propTypes.js.flow +3 -1
- package/dist/bundle.js +488 -0
- package/index.html +11 -0
- package/package.json +2 -2
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Fix GitHub Issue
|
|
2
|
+
|
|
3
|
+
Analyze and fix GitHub issue #$ARGUMENTS for react-grid-layout.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
Follow these steps precisely:
|
|
8
|
+
|
|
9
|
+
### 1. Understand the Issue
|
|
10
|
+
|
|
11
|
+
Fetch and analyze the issue:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
gh issue view $ARGUMENTS
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Determine:
|
|
18
|
+
|
|
19
|
+
- What is the bug? (not feature requests or questions)
|
|
20
|
+
- Is there a CodeSandbox reproduction?
|
|
21
|
+
- Which component/hook is affected?
|
|
22
|
+
- Is this fixable? (has clear reproduction, is actually a bug)
|
|
23
|
+
|
|
24
|
+
If not actionable, explain why and stop.
|
|
25
|
+
|
|
26
|
+
### 2. Investigate
|
|
27
|
+
|
|
28
|
+
- Search for relevant code using Grep/Glob
|
|
29
|
+
- Read the affected files
|
|
30
|
+
- Identify the root cause
|
|
31
|
+
- Check existing tests in `test/spec/`
|
|
32
|
+
|
|
33
|
+
### 3. Write a Failing Test FIRST
|
|
34
|
+
|
|
35
|
+
**CRITICAL: The test must fail before implementing the fix.**
|
|
36
|
+
|
|
37
|
+
Add a test to the appropriate file in `test/spec/` that:
|
|
38
|
+
|
|
39
|
+
- Reproduces the exact bug behavior
|
|
40
|
+
- Includes comment `// #$ARGUMENTS`
|
|
41
|
+
- Actually FAILS when run
|
|
42
|
+
|
|
43
|
+
Verify it fails:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
NODE_ENV=test npx jest --testPathPatterns="<test-file>"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
If test passes, it's invalid - revise until it fails.
|
|
50
|
+
|
|
51
|
+
### 4. Implement the Fix
|
|
52
|
+
|
|
53
|
+
- Make minimal changes to fix the bug
|
|
54
|
+
- Add comments explaining non-obvious fixes
|
|
55
|
+
- Reference the issue number
|
|
56
|
+
|
|
57
|
+
Verify test now passes:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
NODE_ENV=test npx jest --testPathPatterns="<test-file>"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 5. Validate
|
|
64
|
+
|
|
65
|
+
Run in order:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
yarn test
|
|
69
|
+
yarn lint
|
|
70
|
+
yarn fmt
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Fix any failures before proceeding.
|
|
74
|
+
|
|
75
|
+
### 6. Commit and PR
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
git checkout -b fix/issue-$ARGUMENTS-<short-desc>
|
|
79
|
+
git add <files>
|
|
80
|
+
git commit -m "fix: <description> (#$ARGUMENTS)"
|
|
81
|
+
git push -u origin fix/issue-$ARGUMENTS-<short-desc>
|
|
82
|
+
gh pr create --title "fix: <description> (#$ARGUMENTS)" --body "Fixes #$ARGUMENTS
|
|
83
|
+
|
|
84
|
+
## Summary
|
|
85
|
+
<root cause>
|
|
86
|
+
|
|
87
|
+
## Fix
|
|
88
|
+
<what changed>
|
|
89
|
+
|
|
90
|
+
## Test plan
|
|
91
|
+
- [x] Test fails without fix
|
|
92
|
+
- [x] Test passes with fix
|
|
93
|
+
- [x] All tests pass"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 7. Wait and Merge
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
gh pr checks <pr-number> --watch
|
|
100
|
+
gh pr merge <pr-number> --squash --delete-branch
|
|
101
|
+
git checkout master && git pull
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Key Files
|
|
105
|
+
|
|
106
|
+
- `src/core/` - Pure algorithms
|
|
107
|
+
- `src/react/components/` - React components
|
|
108
|
+
- `src/react/hooks/` - React hooks
|
|
109
|
+
- `src/legacy/` - v1 compatibility
|
|
110
|
+
- `test/spec/` - Tests
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
"permissions": {
|
|
3
3
|
"allow": [
|
|
4
4
|
"WebFetch(domain:github.com)",
|
|
5
|
-
"Bash(npx jest:*)"
|
|
5
|
+
"Bash(npx jest:*)",
|
|
6
|
+
"Bash(git tag:*)",
|
|
7
|
+
"Bash(gh release create:*)",
|
|
8
|
+
"Bash(gh issue close:*)",
|
|
9
|
+
"Bash(gh search:*)",
|
|
10
|
+
"WebFetch(domain:raw.githubusercontent.com)",
|
|
11
|
+
"Bash(curl:*)"
|
|
6
12
|
]
|
|
7
13
|
},
|
|
8
14
|
"enableAllProjectMcpServers": true,
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
### 3.1.2 (Jan 1, 2026)
|
|
4
|
+
|
|
5
|
+
- 🐛 Bugfix: Fix SSR crash where `Element` is not defined in Node.js environments. [#251](https://github.com/react-grid-layout/react-resizable/issues/251)
|
|
6
|
+
|
|
7
|
+
### 3.1.1 (Dec 30, 2025)
|
|
8
|
+
|
|
9
|
+
- 🐛 Bugfix: Fix crash when `Resizable` child has a single child element (was not iterable). [#219](https://github.com/react-grid-layout/react-resizable/issues/219)
|
|
10
|
+
- 🐛 Bugfix: Fix `offsetParent` propType from `PropTypes.node` to `PropTypes.instanceOf(Element)`. [#220](https://github.com/react-grid-layout/react-resizable/pull/220)
|
|
11
|
+
- ✏ Chore: Update GitHub Actions workflows to latest versions.
|
|
12
|
+
- ✏ Chore: Add version display to demo page.
|
|
13
|
+
|
|
3
14
|
### 3.1.0 (Dec 30, 2025)
|
|
4
15
|
|
|
5
16
|
- 🐛 Bugfix: Fix `onResizeStop` reporting stale size data due to React's batched state updates. The callback now uses the stored size from the last `onResize` call. [#250](https://github.com/react-grid-layout/react-resizable/pull/250)
|
package/README.md
CHANGED
|
@@ -1,84 +1,118 @@
|
|
|
1
|
-
|
|
1
|
+
# React-Resizable
|
|
2
2
|
|
|
3
|
-
[
|
|
3
|
+
[](https://www.npmjs.com/package/react-resizable)
|
|
4
|
+
[](https://www.npmjs.com/package/react-resizable)
|
|
5
|
+
[](https://github.com/react-grid-layout/react-resizable/actions/workflows/test.yml)
|
|
6
|
+
|
|
7
|
+
[**View the Demo**](https://react-grid-layout.github.io/react-resizable/examples/)
|
|
4
8
|
|
|
5
9
|
A simple widget that can be resized via one or more handles.
|
|
6
10
|
|
|
7
11
|
You can either use the `<Resizable>` element directly, or use the much simpler `<ResizableBox>` element.
|
|
8
12
|
|
|
9
|
-
See the example and associated code in [ExampleLayout](/examples/ExampleLayout.js) and
|
|
10
|
-
[ResizableBox](/lib/ResizableBox.js) for more details.
|
|
13
|
+
See the example and associated code in [ExampleLayout](https://github.com/react-grid-layout/react-resizable/blob/master/examples/ExampleLayout.js) and
|
|
14
|
+
[ResizableBox](https://github.com/react-grid-layout/react-resizable/blob/master/lib/ResizableBox.js) for more details.
|
|
15
|
+
|
|
16
|
+
## Table of Contents
|
|
17
|
+
|
|
18
|
+
- [Installation](#installation)
|
|
19
|
+
- [Compatibility](#compatibility)
|
|
20
|
+
- [Usage](#usage)
|
|
21
|
+
- [Resizable](#resizable)
|
|
22
|
+
- [ResizableBox](#resizablebox)
|
|
23
|
+
- [Props](#props)
|
|
24
|
+
- [Extracting Styles](#extracting-styles)
|
|
25
|
+
- [Custom Resize Handles](#resize-handle)
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
$ npm install --save react-resizable
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Extracting Styles
|
|
34
|
+
|
|
35
|
+
You **must** include the associated styles in your application, otherwise the resize handles will not be visible and will not work properly.
|
|
11
36
|
|
|
12
|
-
|
|
13
|
-
|
|
37
|
+
```js
|
|
38
|
+
// In your JS/TS entry point:
|
|
39
|
+
import 'react-resizable/css/styles.css';
|
|
40
|
+
```
|
|
14
41
|
|
|
15
|
-
|
|
16
|
-
See the [demo](/examples/TestLayout.js) for more on this.
|
|
42
|
+
Or import it in your CSS:
|
|
17
43
|
|
|
18
|
-
|
|
44
|
+
```css
|
|
45
|
+
@import 'react-resizable/css/styles.css';
|
|
46
|
+
```
|
|
19
47
|
|
|
20
|
-
|
|
48
|
+
If you're using a bundler that doesn't support CSS imports, you can find the styles at `node_modules/react-resizable/css/styles.css` and include them manually.
|
|
21
49
|
|
|
22
|
-
|
|
50
|
+
## Compatibility
|
|
23
51
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
[
|
|
52
|
+
| Version | React Version |
|
|
53
|
+
|---------|---------------|
|
|
54
|
+
| [3.x](https://github.com/react-grid-layout/react-resizable/blob/master/CHANGELOG.md#300-may-10-2021) | `>= 16.3` |
|
|
55
|
+
| 2.x | Skipped |
|
|
56
|
+
| [1.x](https://github.com/react-grid-layout/react-resizable/blob/master/CHANGELOG.md#1111-mar-5-2021) | `14 - 17` |
|
|
27
57
|
|
|
28
|
-
|
|
58
|
+
## Usage
|
|
29
59
|
|
|
30
60
|
This package has two major exports:
|
|
31
61
|
|
|
32
|
-
* [`<Resizable>`](/lib/Resizable.js): A raw component that does not have state. Use as a building block for larger components, by listening to its
|
|
33
|
-
|
|
34
|
-
* [`<ResizableBox>`](/lib/ResizableBox.js): A simple `<div {...props} />` element that manages basic state. Convenient for simple use-cases.
|
|
62
|
+
* [`<Resizable>`](https://github.com/react-grid-layout/react-resizable/blob/master/lib/Resizable.js): A raw component that does not have state. Use as a building block for larger components, by listening to its callbacks and setting its props.
|
|
63
|
+
* [`<ResizableBox>`](https://github.com/react-grid-layout/react-resizable/blob/master/lib/ResizableBox.js): A simple `<div {...props} />` element that manages basic state. Convenient for simple use-cases.
|
|
35
64
|
|
|
65
|
+
### `<Resizable>`
|
|
36
66
|
|
|
37
|
-
#### `<Resizable>`
|
|
38
67
|
```js
|
|
39
|
-
const {Resizable} = require('react-resizable');
|
|
40
|
-
|
|
41
|
-
// ES6
|
|
42
68
|
import { Resizable } from 'react-resizable';
|
|
69
|
+
import 'react-resizable/css/styles.css';
|
|
43
70
|
|
|
44
|
-
// ...
|
|
45
71
|
class Example extends React.Component {
|
|
46
72
|
state = {
|
|
47
73
|
width: 200,
|
|
48
74
|
height: 200,
|
|
49
75
|
};
|
|
50
76
|
|
|
51
|
-
// On top layout
|
|
52
77
|
onResize = (event, {node, size, handle}) => {
|
|
53
78
|
this.setState({width: size.width, height: size.height});
|
|
54
79
|
};
|
|
55
80
|
|
|
56
81
|
render() {
|
|
57
82
|
return (
|
|
58
|
-
<Resizable
|
|
59
|
-
|
|
83
|
+
<Resizable
|
|
84
|
+
height={this.state.height}
|
|
85
|
+
width={this.state.width}
|
|
86
|
+
onResize={this.onResize}
|
|
87
|
+
>
|
|
88
|
+
<div
|
|
89
|
+
className="box"
|
|
90
|
+
style={{width: this.state.width + 'px', height: this.state.height + 'px'}}
|
|
91
|
+
>
|
|
60
92
|
<span>Contents</span>
|
|
61
93
|
</div>
|
|
62
94
|
</Resizable>
|
|
63
95
|
);
|
|
64
96
|
}
|
|
65
97
|
}
|
|
66
|
-
|
|
67
98
|
```
|
|
68
99
|
|
|
100
|
+
### `<ResizableBox>`
|
|
69
101
|
|
|
70
|
-
#### `<ResizableBox>`
|
|
71
102
|
```js
|
|
72
|
-
const {ResizableBox} = require('react-resizable');
|
|
73
|
-
|
|
74
|
-
// ES6
|
|
75
103
|
import { ResizableBox } from 'react-resizable';
|
|
104
|
+
import 'react-resizable/css/styles.css';
|
|
76
105
|
|
|
77
106
|
class Example extends React.Component {
|
|
78
107
|
render() {
|
|
79
108
|
return (
|
|
80
|
-
<ResizableBox
|
|
81
|
-
|
|
109
|
+
<ResizableBox
|
|
110
|
+
width={200}
|
|
111
|
+
height={200}
|
|
112
|
+
draggableOpts={{grid: [25, 25]}}
|
|
113
|
+
minConstraints={[100, 100]}
|
|
114
|
+
maxConstraints={[300, 300]}
|
|
115
|
+
>
|
|
82
116
|
<span>Contents</span>
|
|
83
117
|
</ResizableBox>
|
|
84
118
|
);
|
|
@@ -86,7 +120,7 @@ class Example extends React.Component {
|
|
|
86
120
|
}
|
|
87
121
|
```
|
|
88
122
|
|
|
89
|
-
|
|
123
|
+
## Props
|
|
90
124
|
|
|
91
125
|
These props apply to both `<Resizable>` and `<ResizableBox>`. Unknown props that are not in the list below will be passed to the child component.
|
|
92
126
|
|
|
@@ -96,14 +130,15 @@ type ResizeCallbackData = {
|
|
|
96
130
|
size: {width: number, height: number},
|
|
97
131
|
handle: ResizeHandleAxis
|
|
98
132
|
};
|
|
133
|
+
|
|
99
134
|
type ResizeHandleAxis = 's' | 'w' | 'e' | 'n' | 'sw' | 'nw' | 'se' | 'ne';
|
|
100
135
|
|
|
101
|
-
type ResizableProps =
|
|
102
|
-
{
|
|
136
|
+
type ResizableProps = {
|
|
103
137
|
children: React.Element<any>,
|
|
104
138
|
width: number,
|
|
105
139
|
height: number,
|
|
106
|
-
// Either a ReactElement to be used as handle, or a function
|
|
140
|
+
// Either a ReactElement to be used as handle, or a function
|
|
141
|
+
// returning an element that is fed the handle's location as its first argument.
|
|
107
142
|
handle: ReactElement<any> | (resizeHandle: ResizeHandleAxis, ref: ReactRef<HTMLElement>) => ReactElement<any>,
|
|
108
143
|
// If you change this, be sure to update your css
|
|
109
144
|
handleSize: [number, number] = [10, 10],
|
|
@@ -115,7 +150,9 @@ type ResizableProps =
|
|
|
115
150
|
onResizeStart?: ?(e: SyntheticEvent, data: ResizeCallbackData) => any,
|
|
116
151
|
onResize?: ?(e: SyntheticEvent, data: ResizeCallbackData) => any,
|
|
117
152
|
draggableOpts?: ?Object,
|
|
118
|
-
resizeHandles?: ?Array<ResizeHandleAxis> = ['se']
|
|
153
|
+
resizeHandles?: ?Array<ResizeHandleAxis> = ['se'],
|
|
154
|
+
// If `transform: scale(n)` is set on the parent, this should be set to `n`.
|
|
155
|
+
transformScale?: number = 1
|
|
119
156
|
};
|
|
120
157
|
```
|
|
121
158
|
|
|
@@ -129,15 +166,17 @@ The following props can also be used on `<ResizableBox>`:
|
|
|
129
166
|
|
|
130
167
|
If a `width` or `height` is passed to `<ResizableBox>`'s `style` prop, it will be ignored as it is required for internal function.
|
|
131
168
|
|
|
132
|
-
|
|
169
|
+
You can pass options directly to the underlying `DraggableCore` instance by using the prop `draggableOpts`. See the [demo](https://react-grid-layout.github.io/react-resizable/examples/) for more on this.
|
|
170
|
+
|
|
171
|
+
## Resize Handle
|
|
133
172
|
|
|
134
|
-
If you override the resize handle, we expect that any `ref` passed to your new handle
|
|
173
|
+
If you override the resize handle, we expect that any `ref` passed to your new handle will represent the underlying DOM element.
|
|
135
174
|
|
|
136
175
|
This is required, as `react-resizable` must be able to access the underlying DOM node to attach handlers and measure position deltas.
|
|
137
176
|
|
|
138
177
|
There are a few ways to do this:
|
|
139
178
|
|
|
140
|
-
|
|
179
|
+
### Native DOM Element
|
|
141
180
|
|
|
142
181
|
This requires no special treatment.
|
|
143
182
|
|
|
@@ -145,11 +184,11 @@ This requires no special treatment.
|
|
|
145
184
|
<Resizable handle={<div className="foo" />} />
|
|
146
185
|
```
|
|
147
186
|
|
|
148
|
-
|
|
187
|
+
### Custom React Component
|
|
149
188
|
|
|
150
189
|
You must [forward the ref](https://reactjs.org/docs/forwarding-refs.html) and props to the underlying DOM element.
|
|
151
190
|
|
|
152
|
-
|
|
191
|
+
#### Class Components
|
|
153
192
|
|
|
154
193
|
```js
|
|
155
194
|
class MyHandleComponent extends React.Component {
|
|
@@ -163,7 +202,7 @@ const MyHandle = React.forwardRef((props, ref) => <MyHandleComponent innerRef={r
|
|
|
163
202
|
<Resizable handle={<MyHandle />} />
|
|
164
203
|
```
|
|
165
204
|
|
|
166
|
-
|
|
205
|
+
#### Functional Components
|
|
167
206
|
|
|
168
207
|
```js
|
|
169
208
|
const MyHandle = React.forwardRef((props, ref) => {
|
|
@@ -174,7 +213,7 @@ const MyHandle = React.forwardRef((props, ref) => {
|
|
|
174
213
|
<Resizable handle={<MyHandle />} />
|
|
175
214
|
```
|
|
176
215
|
|
|
177
|
-
|
|
216
|
+
### Custom Function
|
|
178
217
|
|
|
179
218
|
You can define a function as a handle, which will simply receive an axis (see above `ResizeHandleAxis` type) and ref. This may be more clear to read, depending on your coding style.
|
|
180
219
|
|
|
@@ -183,5 +222,9 @@ const MyHandle = (props) => {
|
|
|
183
222
|
return <div ref={props.innerRef} className="foo" {...props} />;
|
|
184
223
|
};
|
|
185
224
|
|
|
186
|
-
<Resizable handle={(handleAxis, ref) => <MyHandle innerRef={ref} className={`foo handle-${handleAxis}`}
|
|
187
|
-
```
|
|
225
|
+
<Resizable handle={(handleAxis, ref) => <MyHandle innerRef={ref} className={`foo handle-${handleAxis}`} />} />
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## License
|
|
229
|
+
|
|
230
|
+
MIT
|
package/build/Resizable.js
CHANGED
|
@@ -235,7 +235,7 @@ class Resizable extends React.Component {
|
|
|
235
235
|
// 2. One or more draggable handles.
|
|
236
236
|
return (0, _utils.cloneElement)(children, _objectSpread(_objectSpread({}, p), {}, {
|
|
237
237
|
className: `${className ? `${className} ` : ''}react-resizable`,
|
|
238
|
-
children: [...children.props.children, ...resizeHandles.map(handleAxis => {
|
|
238
|
+
children: [...React.Children.toArray(children.props.children), ...resizeHandles.map(handleAxis => {
|
|
239
239
|
// Create a ref to the handle so that `<DraggableCore>` doesn't have to use ReactDOM.findDOMNode().
|
|
240
240
|
const ref = this.handleRefs[handleAxis] ?? (this.handleRefs[handleAxis] = /*#__PURE__*/React.createRef());
|
|
241
241
|
return /*#__PURE__*/React.createElement(_reactDraggable.DraggableCore, _extends({}, draggableOpts, {
|
package/build/Resizable.js.flow
CHANGED
|
@@ -201,7 +201,7 @@ export default class Resizable extends React.Component<Props, void> {
|
|
|
201
201
|
...p,
|
|
202
202
|
className: `${className ? `${className} ` : ''}react-resizable`,
|
|
203
203
|
children: [
|
|
204
|
-
...children.props.children,
|
|
204
|
+
...React.Children.toArray(children.props.children),
|
|
205
205
|
...resizeHandles.map((handleAxis) => {
|
|
206
206
|
// Create a ref to the handle so that `<DraggableCore>` doesn't have to use ReactDOM.findDOMNode().
|
|
207
207
|
const ref = (this.handleRefs[handleAxis]) ?? (this.handleRefs[handleAxis] = React.createRef());
|
package/build/propTypes.js
CHANGED
|
@@ -5,6 +5,7 @@ exports.resizableProps = void 0;
|
|
|
5
5
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
6
6
|
var _reactDraggable = require("react-draggable");
|
|
7
7
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
+
/* global Element */
|
|
8
9
|
// <Resizable>
|
|
9
10
|
const resizableProps = exports.resizableProps = {
|
|
10
11
|
/*
|
|
@@ -29,7 +30,8 @@ const resizableProps = exports.resizableProps = {
|
|
|
29
30
|
children: _propTypes.default.node,
|
|
30
31
|
disabled: _propTypes.default.bool,
|
|
31
32
|
enableUserSelectHack: _propTypes.default.bool,
|
|
32
|
-
|
|
33
|
+
// #251: Check for Element to support SSR environments where DOM globals don't exist
|
|
34
|
+
offsetParent: typeof Element !== 'undefined' ? _propTypes.default.instanceOf(Element) : _propTypes.default.any,
|
|
33
35
|
grid: _propTypes.default.arrayOf(_propTypes.default.number),
|
|
34
36
|
handle: _propTypes.default.string,
|
|
35
37
|
nodeRef: _propTypes.default.object,
|
package/build/propTypes.js.flow
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// @flow
|
|
2
|
+
/* global Element */
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import {DraggableCore} from "react-draggable";
|
|
4
5
|
import type {Element as ReactElement, ElementConfig} from 'react';
|
|
@@ -75,7 +76,8 @@ export const resizableProps: Object = {
|
|
|
75
76
|
children: PropTypes.node,
|
|
76
77
|
disabled: PropTypes.bool,
|
|
77
78
|
enableUserSelectHack: PropTypes.bool,
|
|
78
|
-
|
|
79
|
+
// #251: Check for Element to support SSR environments where DOM globals don't exist
|
|
80
|
+
offsetParent: typeof Element !== 'undefined' ? PropTypes.instanceOf(Element) : PropTypes.any,
|
|
79
81
|
grid: PropTypes.arrayOf(PropTypes.number),
|
|
80
82
|
handle: PropTypes.string,
|
|
81
83
|
nodeRef: PropTypes.object,
|