react-resizable 3.1.2 → 3.1.3

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/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "react-resizable",
3
- "version": "3.1.2",
3
+ "version": "3.1.3",
4
4
  "description": "A component that is resizable with handles.",
5
5
  "main": "index.js",
6
+ "files": [
7
+ "build/",
8
+ "css/",
9
+ "index.js"
10
+ ],
6
11
  "scripts": {
7
12
  "lint": "eslint lib/ __tests__/ setupTests/; flow",
8
13
  "test": "jest --coverage",
package/.babelrc DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "presets": [
3
- [
4
- "@babel/preset-env",
5
- {
6
- "loose": true
7
- }
8
- ],
9
- "@babel/preset-react",
10
- "@babel/preset-flow"
11
- ],
12
- "plugins": [
13
- ["@babel/plugin-proposal-class-properties", {"loose": true}],
14
- "@babel/plugin-proposal-object-rest-spread"
15
- ]
16
- }
package/.browserslistrc DELETED
@@ -1,3 +0,0 @@
1
- > 0.25%
2
- ie 11
3
- not dead
@@ -1,110 +0,0 @@
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
@@ -1,18 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "WebFetch(domain:github.com)",
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:*)"
12
- ]
13
- },
14
- "enableAllProjectMcpServers": true,
15
- "enabledMcpjsonServers": [
16
- "messenger"
17
- ]
18
- }
package/.flowconfig DELETED
@@ -1,25 +0,0 @@
1
- [version]
2
- ^0.153.0
3
-
4
- [ignore]
5
- .*/node_modules/@babel.*
6
- .*/node_modules/.*/malformed_package_json/.*
7
- <PROJECT_ROOT>/build/.*
8
-
9
- [include]
10
-
11
- [libs]
12
- flow-typed
13
-
14
- [lints]
15
- all=warn
16
- implicit-inexact-object=error
17
-
18
- [options]
19
- suppress_type=$FlowFixMe
20
- experimental.strict_call_arity=true
21
- module.system.node.allow_root_relative=true
22
- module.use_strict=true
23
- server.max_workers=6
24
- exact_by_default=true
25
- sharedmemory.heap_size=3221225472
package/.packj.yaml DELETED
@@ -1,153 +0,0 @@
1
- #
2
- # Audit policies
3
- #
4
- audit:
5
- alerts:
6
- #
7
- # category: malicious packages (publicly known and unknown)
8
- #
9
- malicious:
10
- contains known malware:
11
- - reason: package is known to contain a dangerous malware
12
- - enabled: true
13
- typo-squatting or repo-jacking package:
14
- - reason: package impersonates another popular package to propagate malware
15
- - enabled: true
16
-
17
- #
18
- # alert category: suspicious packages (potentially malicious)
19
- #
20
- suspicious:
21
- inconsistent with repo source:
22
- - reason: package code inconsistent with the public repo source code
23
- - enabled: false # WIP
24
- overwrites system binaries:
25
- - reason: package code inconsistent with the public repo source code
26
- - enabled: false # WIP
27
-
28
- #
29
- # alert category: packages vulnerable to code exploits
30
- #
31
- vulnerable:
32
- contains known vulnerabilities:
33
- - reason: known vulnerabilities (CVEs) in package code could be exploited
34
- - enabled: true
35
- insecure network communication:
36
- - reason: package code uses insecure network communication (not https)
37
- - enabled: false # WIP
38
-
39
- #
40
- # packages with undesirable or "risky" attributes
41
- #
42
- undesirable:
43
- package is old or abandoned:
44
- - reason: old or abandoned packages receive no security updates and are risky
45
- - enabled: true
46
-
47
- invalid or no author email:
48
- - reason: a package with lack of or invalid author email suggests 2FA not enabled
49
- - enabled: true
50
-
51
- invalid or no homepage:
52
- - reason: a package with no or invalid homepage may not be preferable
53
- - enabled: false
54
-
55
- no source repo:
56
- - reason: lack of public source repo may suggest malicious intention
57
- - enabled: true
58
-
59
- fewer downloads:
60
- - reason: a package with few downloads may not be preferable
61
- - enabled: true
62
-
63
- no or insufficient readme:
64
- - reason: a package with lack of documentation may not be preferable
65
- - enabled: false
66
-
67
- fewer versions or releases:
68
- - reason: few versions suggest unstable or inactive project
69
- - enabled: true
70
-
71
- too many dependencies:
72
- - reason: too many dependencies increase attack surface
73
- - enabled: false
74
-
75
- version release after a long gap:
76
- - reason: a release after a long time may indicate account hijacking
77
- - enabled: false
78
-
79
- contains custom installation hooks:
80
- - reason: custom installation hooks may download or execute malicious code
81
- - enabled: false # WIP
82
-
83
- #
84
- # type: repo stats
85
- #
86
- few source repo stars:
87
- - reason: a package with few repo stars may not be preferable
88
- - enabled: false
89
-
90
- few source repo forks:
91
- - reason: a package with few repo forks may not be preferable
92
- - enabled: false
93
-
94
- forked source repo:
95
- - reason: a forked copy of a popular package may contain malicious code
96
- - enabled: true
97
-
98
- #
99
- # type: APIs and permissions
100
- #
101
- generates new code:
102
- - reason: package generates new code at runtime, which could be malicious
103
- - enabled: false
104
- forks or exits OS processes:
105
- - reason: package spawns new operating system processes, which could be malicious
106
- - enabled: false
107
- accesses obfuscated (hidden) code:
108
- - enabled: true
109
- accesses environment variables:
110
- - enabled: false
111
- changes system/environment variables:
112
- - enabled: false
113
- accesses files and dirs:
114
- - enabled: false
115
- communicates with external network:
116
- - enabled: false
117
- reads user input:
118
- - enabled: false
119
-
120
- #
121
- # Sandboxing policies
122
- #
123
- sandbox:
124
- rules:
125
- #
126
- # File system (allow or block accesses to file/dirs)
127
- #
128
- # ~/ represents home dir
129
- # . represents cwd dir
130
- #
131
- # NOTE: only ONE 'allow' and 'block' lines are allowed
132
- #
133
- fs:
134
- # TODO: customize as per your threat model
135
-
136
- # block access to home dir and all other locations (except the ones below)
137
- block: ~/, /
138
- allow: ., ~/.cache, ~/.npm, ~/.local, ~/.ruby, /tmp, /proc, /etc, /var, /bin, /usr/include, /usr/local, /usr/bin, /usr/lib, /usr/share, /lib
139
-
140
- #
141
- # Network (allow or block domains/ports)
142
- #
143
- # NOTE: only ONE 'allow' and 'block' lines are allowed
144
- #
145
- network:
146
-
147
- # TODO: customize as per your threat model
148
-
149
- # block all external network communication (except the ones below)
150
- block: 0.0.0.0
151
-
152
- # For NPM packages
153
- allow: registry.yarnpkg.com:0, npmjs.org:0, npmjs.com:0
package/CHANGELOG.md DELETED
@@ -1,181 +0,0 @@
1
- # Changelog
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
-
14
- ### 3.1.0 (Dec 30, 2025)
15
-
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)
17
- - ➕ Feature: React 18 support.
18
- - ✏ Chore: Migrate test suite from Enzyme to React Testing Library. [#249](https://github.com/react-grid-layout/react-resizable/pull/249)
19
- - ✏ Chore: Update `react-draggable` to ^4.5.0.
20
- - ✏ Chore: Update `react-test-renderer` to ^18.
21
-
22
- ### 3.0.5 (Mar 21, 2023)
23
-
24
- - 🐛 Bugfix: Make `width` and `height` conditionally required if an `axis` is set. See [#196](https://github.com/react-grid-layout/react-resizable/issues/196)
25
- - ✏ Chore: Minor dependency upgrades.
26
- - ✏ Chore: Fix documentation of `onResize` callback arity.
27
-
28
- ### 3.0.4 (Jun 15, 2021)
29
-
30
- - 🐛 Bugfix: Fix incorrect fix for `handleAxis` on DOM elements. [#175](https://github.com/react-grid-layout/react-resizable/issues/175)
31
- - ✏ Chore:Upgrade dependencies.
32
-
33
- ### 3.0.3 (Jun 14, 2021)
34
-
35
- - 🐛 Bugfix: Remove unknown prop `handleAxis` making it to DOM elements, causing a warning in dev.
36
- - ✏ Chore: Rewrote `lockAspectRatio` logic to be more accurate and shorter.
37
-
38
- ### 3.0.2 (Jun 8, 2021)
39
-
40
- - ✏ Chore: Add documentation for resize handles and fix a mistake where the `handleAxis` prop was not being passed to custom components.
41
- - See [Resize Handles](README.md#resize-handle)
42
-
43
- ### 3.0.1 (May 10, 2021)
44
-
45
- - ✏ Chore: Reduce package size through `.npmignore`.
46
-
47
- ### 3.0.0 (May 10, 2021)
48
-
49
- #### Breaking
50
-
51
- - 🐛 Bugfix: Fixed handling of the `nodeRef` that needs to be passed to `<DraggableCore>` to avoid use of ReactDOM. This means that vanilla usage of `react-resizable` no longer requires ReactDOM. No code changes are needed in the usual case, except:
52
- * React `>= 16.3` is required due to use of `React.createRef()`, and
53
- * The `handle` prop now sends a `ReactRef<HTMLElement>` as its second argument and expects it to be used on your returned component.
54
- * If you do not attach the `ref`, you will receive the following error: `"<DraggableCore> not mounted on DragStart!"` This is due to the ref being present but not attached to any node.
55
-
56
- ### 1.11.1 (Mar 5, 2021)
57
-
58
- - ✏ Chore: Added React 17 to peerDependencies.
59
-
60
- ### 1.11.0 (Sep 3, 2020)
61
-
62
- - ⚠ Important Notice!
63
- - React-Resizable 2.0.0 was published due to a breaking change in `props` handling. This change ended up actually completely breaking certain workflows, for the dubious benefit of making the code slightly simpler to add to. The breaking change has been reverted, 2.0.0 is now deprecated, and we will continue on the 1.x branch. Future breaking changes to `react-resizable` will upgrade the major version to `3`.
64
- - ➕ Feature: `<ResizableBox>` now takes a `style` prop which will be applied on the wrapping `<div>`. `width` and `height` in this prop are ignored.
65
- - 🐛 Bugfix: remove unknown Prop `handle` from div children in Resizable `React.cloneElement`. [#124](https://github.com/STRML/react-resizable/issues/124)
66
- - 🐛 Bugfix: Fix top and left resizing jerkiness. Thanks @conor-kelleher. [#136](https://github.com/STRML/react-resizable/pull/136)
67
- - ✏ Chore: Improved test suite. Please contribute tests for your use cases if you have the time, I would really appreciate it! Thanks very much, @Danielecina
68
- - ✏ Chore: Minor internal refactors and additional tests.
69
- - ✏ Chore: Additional examples.
70
-
71
- ### 1.10.1 (Nov 25, 2019)
72
-
73
- > Note: 1.10.0 was a mis-publish.
74
-
75
- - ➕ Feature: Add `transformScale` prop [#115](https://github.com/STRML/react-resizable/pull/115)
76
- - 🐛 Bugfix: Resolve `getDerivedStateFromProps` dev warning [#117](https://github.com/STRML/react-resizable/pull/117)
77
-
78
- ### 1.9.0 (Oct 24, 2019)
79
-
80
- - 🐛 Bugfix: Fix resize with north/south handles when `lockAspectRatio=true` [#106](https://github.com/STRML/react-resizable/pull/106)
81
- - ✏ Chore: Remove deprecated React 16.9 lifecycle methods (`componentWillReceiveProps`) (https://github.com/STRML/react-resizable/pull/112/commits/541dee69b8e45d91a533855609472b481634edee)
82
- - ✏ Chore: Upgrade to babel 7
83
- - ✏ Chore: [Remove unused state inside `<Draggable>`](https://github.com/STRML/react-resizable/pull/112/commits/05693f63d6d221ad652f0f28af024cfb46a5f2df). This has not been needed for quite some time, fixes [some bugs](https://github.com/STRML/react-resizable/issues/99) and improves performance.
84
-
85
- ### 1.8.0 (May 15, 2019)
86
-
87
- - ➕ Feature: Added support for custom resize handles [#79](https://github.com/STRML/react-resizable/pull/79)
88
- - ➕ Feature: Added support for resize handles on all corners [#191](https://github.com/STRML/react-resizable/pull/191)
89
-
90
- ### 1.7.5 (Sep 26, 2017)
91
-
92
- - ✏ Chore: Support for React 16 (no changes required, updated `peerDependencies`)
93
- - ✏ Chore: Minor dep updates.
94
-
95
- ### 1.7.4 (Sep 5, 2017)
96
-
97
- - ✏ Chore: Minor Flow & dependency updates.
98
-
99
- ### 1.7.3 (Aug 31, 2017)
100
-
101
- - 🐛 Bugfix: React deprecation warnings from `import *`
102
- - https://github.com/facebook/react/issues/10583
103
-
104
- ### 1.7.2 (Aug 21, 2017)
105
-
106
- - ✏ Chore: Pkg: Add `react-draggable@3.0.0` to version range.
107
- - This package is compatible with both `@2` and `@3` versions.
108
-
109
- ### 1.7.1 (May 23, 2017)
110
-
111
- - 🐛 Bugfix: Some flow types were improperly specified.
112
-
113
- ### 1.7.0 (May 1, 2017)
114
-
115
- - ⚠ Deprecation: `React.PropTypes` now deprecated in React 15.5, moved to `prop-types` package
116
- - ✏ Chore: Update devDeps, upgrade to webpack 2
117
- - ✏ Chore: Remove babel `stage-1` and `transform-flow-comments`, bring in only selected plugins, makes for leaner dev/build.
118
-
119
- ### 1.6.0 (Jan 23, 2017)
120
-
121
- - ➕ Feature: Allow restricting by axis. (#40, thanks @dnissley-al)
122
-
123
- ### 1.5.0 (Jan 23, 2017)
124
-
125
- - 🐛 Bugfix: Persist SyntheticEvents when needed (#45, #46)
126
- - ➕ Feature: Add componentWillReceiveProps to `<ResizableBox>` (#44, thanks @JoaoMosmann)
127
-
128
- ### 1.4.6 (Dec 30, 2016)
129
-
130
- - ✏ Chore: Removed unused ref from `<Resizable>`.
131
- - ✏ Chore: Added development lockfile.
132
-
133
- ### 1.4.5 (Sep 30, 2016)
134
-
135
- - 🐛 Bugfix: Fix bad publish
136
-
137
- ### 1.4.4 (Sep 30, 2016)
138
-
139
- - 🐛 Bugfix: Minor flow errors
140
-
141
- ### 1.4.3 (Sep 27, 2016)
142
-
143
- - 🐛 Bugfix: Don't pass `onResize` in `<ResizableBox>`.
144
- - 🐛 Bugfix: Fix new Flow errors (type parameters no longer optional).
145
-
146
- ### 1.4.2 (July 1, 2016)
147
-
148
- - 🐛 Bugfix: Don't pass unknown props to underlying DOM element. Fixes React 15.2.0 warnings.
149
-
150
- ### 1.4.1 (May 23, 2016)
151
-
152
- - 🐛 Bugfix: Resizable handle should have a `key` when injected. Fixes React warnings on custom components.
153
-
154
- ### 1.4.0 (May 20, 2016)
155
-
156
- - ✏ Chore: Update to React-Draggable v2, which changed callback data structure.
157
-
158
- ### 1.3.4 (May 17, 2016)
159
-
160
- - 🐛 Bugfix: Slack was not being reset on resizeStop. Fixes #34, #36.
161
- - ✏ Chore: Added `flow-bin` to devDeps.
162
-
163
- ### 1.3.3 (Apr 19, 2016)
164
-
165
- - ➕ Feature: Add Flow comments.
166
-
167
- ### 1.3.2 (Apr 8, 2016)
168
-
169
- - 🐛 Bugfix: Prevent `width` and `height` from leaking to the underlying DOM element and being written.
170
-
171
- ### 1.3.1 (Apr 8, 2016)
172
-
173
- - ✏ Chore: Allow React v15 in peerdeps.
174
-
175
- ### 1.3.0 (Mar 11, 2016)
176
-
177
- - 🐛 Bugfix: Switch to ES2015 Loose Mode to fix IE9/10 issues.
178
- - 🐛 Bugfix: Flow typing fixes.
179
- - 🐛 Bugfix: Styling fixes to the demo page.
180
-
181
- > Changes before 1.3.0 were not logged. Please see the git commit history.
package/CLAUDE.md DELETED
@@ -1,71 +0,0 @@
1
- # CLAUDE.md
2
-
3
- This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
-
5
- ## Commands
6
-
7
- ```bash
8
- # Install dependencies
9
- yarn
10
-
11
- # Run tests with coverage
12
- yarn test
13
-
14
- # Run tests in watch mode
15
- yarn unit
16
-
17
- # Lint (ESLint + Flow)
18
- yarn lint
19
-
20
- # Type check only
21
- yarn flow
22
-
23
- # Build (transpile lib/ to build/)
24
- yarn build
25
-
26
- # Run dev server with examples
27
- yarn dev
28
-
29
- # Build examples for production
30
- yarn build-example
31
- ```
32
-
33
- Run a single test file:
34
- ```bash
35
- npx jest __tests__/Resizable.test.js
36
- ```
37
-
38
- Run tests matching a pattern:
39
- ```bash
40
- npx jest --testNamePattern="snapshot"
41
- ```
42
-
43
- ## Architecture
44
-
45
- This is a React component library providing resizable functionality via two main components:
46
-
47
- ### Core Components (`lib/`)
48
-
49
- - **Resizable.js** - Stateless base component. Wraps a child element with draggable resize handles using `react-draggable`'s `DraggableCore`. Computes size changes from drag deltas, applies constraints, and invokes callbacks. Does not manage state - parent must set `width`/`height` props from callback data.
50
-
51
- - **ResizableBox.js** - Stateful wrapper around `<Resizable>`. Manages width/height state internally and renders a `<div>` with those dimensions. Simpler API for common use cases.
52
-
53
- - **propTypes.js** - Shared Flow types and PropTypes definitions. Exports `resizableProps` object and types like `ResizeHandleAxis`, `ResizeCallbackData`, etc.
54
-
55
- - **utils.js** - Helper `cloneElement()` that merges `style` and `className` when cloning React elements.
56
-
57
- ### Key Implementation Details
58
-
59
- - Resize handles are rendered as `<DraggableCore>` wrappers around handle elements
60
- - Handle positions: `'s'`, `'w'`, `'e'`, `'n'`, `'sw'`, `'nw'`, `'se'`, `'ne'`
61
- - The `runConstraints()` method applies min/max constraints and aspect ratio locking with slack tracking
62
- - Position tracking via `lastHandleRect` compensates for element repositioning during north/west drags
63
- - `transformScale` prop adjusts deltas when parent has CSS transform scaling
64
-
65
- ### Build Output
66
-
67
- `yarn build` transpiles `lib/*.js` to `build/` and copies source files as `*.js.flow` for Flow consumers.
68
-
69
- ## Testing
70
-
71
- Tests use Jest with Enzyme for shallow/mount rendering. Test files in `__tests__/` mirror the lib structure. Snapshot tests verify render output; unit tests verify resize behavior, constraint handling, and callback data.