You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- CHANGELOG.md: add 4.0.0 entry covering the Flow->TS migration. Mark the
types-delivery change as breaking and point Flow users at the last
Flow-annotated source by SHA (db2e37e, the 3.2.0 tag). Backfill the
missing 3.2.0 entry (PR #255 fix + ESLint pin).
- README.md: new TypeScript section (bundled types ship from build/*.d.ts,
remove @types/react-resizable). Flow-removal note with the same SHA link.
Refresh lib/*.js references to *.tsx. Rewrite the Flow-flavored Props
block in TypeScript. Compatibility table gains a Types column.
- CI (.github/workflows/test.yml): now runs lint, typecheck, test, build,
and a build-artifact smoke test on every push and PR. Bump checkout/
setup-node to v4 and add yarn caching.
- __tests__/integration/smoke.cjs: plain CJS smoke test for the published
shape — root entry resolves, named exports are constructible, defaultProps
and propTypes preserved, bundled .d.ts files exist with expected symbols,
legacy require()() guard throws, files whitelist correct.
- __tests__/integration/end-to-end.test.tsx: 32 Jest integration tests
driving real DOM events through DraggableCore. Same suite runs twice —
against the TS source and against the built CJS root entry (gated on
build/ existing). Covers drag-driven size changes, controlled-mode
callbacks, the #255 regression (mid-drag prop staleness), zero-delta
suppression, min/max constraints, lockAspectRatio, axis restrictions,
transformScale, all 8 handle axes, and custom-function handles.
Coverage on Resizable.tsx is now 98.76% lines, ResizableBox.tsx 100%.
Copy file name to clipboardExpand all lines: README.md
+73-30Lines changed: 73 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,11 +11,12 @@ A simple widget that can be resized via one or more handles.
11
11
You can either use the `<Resizable>` element directly, or use the much simpler `<ResizableBox>` element.
12
12
13
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.
14
+
[ResizableBox](https://github.com/react-grid-layout/react-resizable/blob/master/lib/ResizableBox.tsx) for more details.
15
15
16
16
## Table of Contents
17
17
18
18
-[Installation](#installation)
19
+
-[TypeScript](#typescript)
19
20
-[Compatibility](#compatibility)
20
21
-[Usage](#usage)
21
22
-[Resizable](#resizable)
@@ -47,20 +48,59 @@ Or import it in your CSS:
47
48
48
49
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.
49
50
51
+
## TypeScript
52
+
53
+
As of `4.0.0`, the library is authored in TypeScript and ships bundled type
54
+
declarations in `build/*.d.ts`. You **do not** need to install
55
+
`@types/react-resizable`; if you previously installed it, remove it so the
56
+
bundled types take precedence:
57
+
58
+
```bash
59
+
npm uninstall @types/react-resizable
60
+
# or
61
+
yarn remove @types/react-resizable
62
+
```
63
+
64
+
Public types are re-exported from the package root:
65
+
66
+
```ts
67
+
import {
68
+
Resizable,
69
+
ResizableBox,
70
+
// types
71
+
typeResizeCallbackData,
72
+
typeResizeHandleAxis,
73
+
typeAxis,
74
+
typePropsasResizableProps,
75
+
} from'react-resizable';
76
+
```
77
+
78
+
### Flow
79
+
80
+
Flow is no longer supported as of `4.0.0`. Earlier versions shipped
81
+
`*.js.flow` sidecar files generated from the Flow-annotated source; those
82
+
have been removed.
83
+
84
+
If you still need Flow types, you can vendor the last Flow-annotated source
85
+
locally from the [`3.2.0` tag](https://github.com/react-grid-layout/react-resizable/tree/db2e37eda85fb21b1864e36b01c4922452f28418/lib).
86
+
They will not be updated to reflect changes landing after `4.0.0`. The
87
+
official recommendation is to migrate to TypeScript.
*[`<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.
102
+
*[`<Resizable>`](https://github.com/react-grid-layout/react-resizable/blob/master/lib/Resizable.tsx): 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.
103
+
*[`<ResizableBox>`](https://github.com/react-grid-layout/react-resizable/blob/master/lib/ResizableBox.tsx): A simple `<div {...props} />` element that manages basic state. Convenient for simple use-cases.
64
104
65
105
### `<Resizable>`
66
106
@@ -124,43 +164,46 @@ class Example extends React.Component {
124
164
125
165
These props apply to both `<Resizable>` and `<ResizableBox>`. Unknown props that are not in the list below will be passed to the child component.
0 commit comments