Commit 0637971
feat: support React 19 (#1074)
* refactor: drop findDOMNode and dead defaultProps
Replace ReactDOM.findDOMNode(this) in the deprecated ColorPicker dropdown
Box with a typed root ref (removed in React 19), and delete the redundant
Button.defaultProps block (ignored for forwardRef in React 19; already
shadowed by the destructuring defaults). Both fixes are version-safe under
React 18.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat: support React 19
Bump dev react/react-dom/@types/react/@types/react-dom/react-is to 19.x and
widen the peer ranges to >=18 <20 (additive for existing React 18 consumers).
Run types-react-codemod preset-19 for the React.JSX scoping and useRef initial
argument, then hand-fix the React 19 type and runtime breakages:
- tooltip: read the child ref from props.ref under React 19 (falls back to
element.ref on 18) instead of the removed element.ref.
- polymorphism: cast the forwardRef render fn to React 19's PropsWithoutRef
render signature.
- stack: widen react-keyed-flatten-children's React 19-removed ReactChild[]
return to ReactNode[].
- revert the codemod's ReactElement<any> additions (the repo bans explicit any;
bare ReactElement now defaults to unknown).
- add @types/prop-types, previously pulled in transitively by @types/react 18.
Also drive the hover-opened submenu test selection via keyboard: jsdom has no
layout, so ariakit closes the submenu when the pointer moves onto an item, and
React 19's synchronous flushing unmounts it before the click lands. Real-browser
hover + click works (verified in Storybook); keyboard selection is layout-
independent and version-stable.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test: add React 18 jest run
Add aliased react-18 / react-dom-18 dev dependencies and a second Jest config
that remaps react/react-dom to them, so the suite runs against React 18 from a
single install. Wire test:react18 into validate (and therefore the pre-push
hook), sharing the same committed snapshots.
react-dom-18 peers on react ^18 while the top-level react is 19; an overrides
entry points its react peer at the top-level version so npm resolves the tree
(Jest remaps everything to the 18 aliases at run time regardless).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* ci: run tests against React 18 and 19
Add a second unit-testing step running npm run test:react18 off the same
install, so CI exercises the suite under both React versions. Two sequential
steps on the single runner; a strategy matrix is unnecessary.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* chore: remove prop-types usage
React 19 ignores propTypes, so drop the only two uses: the import + propTypes
block in ThreeDotsIcon and the propTypes member in the deprecated polymorphism
types. Remove prop-types from peerDependencies and the @types/prop-types dev
dependency (added in the React 19 bump only to type the now-deleted usage).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* refactor: drop the ref-masking cast in polymorphicComponent
PolymorphicComponentProps is built on React.ComponentProps, which includes
ref under React 19. A forwardRef render never receives ref in props, so move
the strip into the ForwardRefFunction contract via PropsWithoutRef and
ForwardedRef, dropping the cast and the now-unused PolymorphicRenderFunction.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* refactor: type ThreeDotsIcon's color prop
Extract a named ThreeDotsIconProps type and switch to a function declaration
so the color prop is explicitly typed.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test: document the keyboard-driven submenu selection
Explain why the submenu test drives selection via keyboard: jsdom can't give
Ariakit the DOMRects it needs to keep the hovercard open, and React 19 flushes
the close render before a click can land.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* chore: type-check against React 18 typings
Add a tsconfig.react18.json that remaps react/react-dom to aliased @types/react@18
and @types/react-dom@18, wired into a type-check:react18 script, the validate
chain, and CI. This catches typings regressions against the older React the
library still supports.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix: reject string refs in Tooltip
Throw on string refs instead of silently forwarding them, so React 18 consumers get a clear unsupported-usage error.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 53777ff commit 0637971
26 files changed
Lines changed: 224 additions & 87 deletions
File tree
- .github/workflows
- src
- checkbox-field
- components
- color-picker
- deprecated-button
- deprecated-dropdown
- icons
- icons
- modal
- select-field
- stack
- text-area
- toast
- tooltip
- utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
| |||
129 | 133 | | |
130 | 134 | | |
131 | 135 | | |
132 | | - | |
| 136 | + | |
133 | 137 | | |
134 | 138 | | |
135 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
136 | 144 | | |
137 | 145 | | |
138 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
52 | 54 | | |
53 | 55 | | |
| 56 | + | |
54 | 57 | | |
55 | 58 | | |
56 | 59 | | |
| |||
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
62 | | - | |
63 | | - | |
| 65 | + | |
64 | 66 | | |
65 | | - | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| |||
95 | 97 | | |
96 | 98 | | |
97 | 99 | | |
98 | | - | |
99 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
100 | 104 | | |
101 | 105 | | |
102 | 106 | | |
| |||
125 | 129 | | |
126 | 130 | | |
127 | 131 | | |
128 | | - | |
| 132 | + | |
| 133 | + | |
129 | 134 | | |
130 | | - | |
131 | 135 | | |
132 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
| |||
154 | 160 | | |
155 | 161 | | |
156 | 162 | | |
157 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
158 | 170 | | |
159 | 171 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
Lines changed: 0 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | 86 | | |
Lines changed: 9 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
51 | | - | |
| 54 | + | |
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
| |||
93 | 96 | | |
94 | 97 | | |
95 | 98 | | |
96 | | - | |
| 99 | + | |
97 | 100 | | |
98 | 101 | | |
99 | 102 | | |
100 | | - | |
101 | | - | |
102 | | - | |
| 103 | + | |
| 104 | + | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
| |||
160 | 162 | | |
161 | 163 | | |
162 | 164 | | |
| 165 | + | |
163 | 166 | | |
164 | 167 | | |
165 | 168 | | |
| |||
0 commit comments