Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React 19 support #6437

Merged
merged 35 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
df2b082
React 19 prep
snowystinger May 23, 2024
8762eb5
Fix tests and lint, need to investigate the isReact 19 tests
snowystinger May 23, 2024
484c66d
turn 19 tests back on
snowystinger May 23, 2024
e32b0c2
Check react version to avoid warning
snowystinger May 23, 2024
15382bf
bump node version because 18.17 has a bug with pkg.json dependencies …
snowystinger May 30, 2024
97c221e
Install 19 types
snowystinger May 30, 2024
8e552d1
apply codemod
snowystinger May 30, 2024
da2b6eb
Apply fixes from TS and eps1lon PR
snowystinger May 30, 2024
f981fb3
Reset package json
snowystinger May 30, 2024
4eba72a
Merge branch 'main' into react-19-prep
snowystinger Jun 11, 2024
533533d
Merge branch 'main' into react-19-prep
snowystinger Jun 13, 2024
489fdaa
Fix React 18 on 19's types
snowystinger Jun 13, 2024
9f669fe
default to react 19 development to avoid duplicate packages being ins…
snowystinger Jun 13, 2024
af56ac7
fix a couple failures
snowystinger Jun 13, 2024
d9f8a2b
fix test
snowystinger Jun 13, 2024
885bb0c
fix storybook 18
snowystinger Jun 13, 2024
bd3d13b
Fix extract examples
snowystinger Jun 13, 2024
bc0d291
install process
snowystinger Jun 13, 2024
10457a1
actually fix test
snowystinger Jun 13, 2024
0c65ce3
Revert using React 19 as the default
snowystinger Jun 14, 2024
5489fe0
fix the listbox test once more
snowystinger Jun 14, 2024
642fcfa
Workaround 19 install issue
snowystinger Jun 14, 2024
e26bae6
fix extract examples to work with 19 types
snowystinger Jun 14, 2024
a3f69f5
fix react dom import
snowystinger Jun 14, 2024
221eea7
Fix types for all docs
snowystinger Jun 14, 2024
49430f6
Merge branch 'main' into react-19-prep
snowystinger Jun 14, 2024
e9d4cb8
work around react 19 giving us an unintentional undefined
snowystinger Jun 14, 2024
f64e2ed
Merge branch 'react-19-prep' of github.com:adobe/react-spectrum into …
snowystinger Jun 14, 2024
3710e8e
fix typescript
snowystinger Jun 14, 2024
fc11d33
disable branch verdaccio now that it's all passing
snowystinger Jun 14, 2024
8db6f7d
Merge branch 'main' into react-19-prep
LFDanLu Jun 17, 2024
7b4cc72
Review updates
snowystinger Jun 18, 2024
7fd4732
Merge branch 'main' into react-19-prep
snowystinger Jun 18, 2024
9284d9f
fix lint
snowystinger Jun 18, 2024
14dd64d
Merge branch 'main' into react-19-prep
snowystinger Jun 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .circleci/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async function run() {
body: `Build successful! 🎉

* [View the storybook](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/storybook/index.html)
* [View the storybook-canary](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/storybook-canary/index.html)
* [View the storybook-19](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/storybook-19/index.html)
* [View the storybook-17](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/storybook-17/index.html)
* [View the storybook-16](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/storybook-16/index.html)
* [View the documentation](https://reactspectrum.blob.core.windows.net/reactspectrum/${process.env.CIRCLE_SHA1}/docs/index.html)`
Expand Down
50 changes: 28 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@ orbs:
executors:
rsp:
docker:
- image: cimg/node:18.17.1
- image: cimg/node:18.20.3
environment:
CACHE_VERSION: v1
working_directory: ~/react-spectrum

rsp-large:
docker:
- image: cimg/node:18.17.1
- image: cimg/node:18.20.3
resource_class: large
environment:
CACHE_VERSION: v1
working_directory: ~/react-spectrum

rsp-xlarge:
docker:
- image: cimg/node:18.17.1
- image: cimg/node:18.20.3
resource_class: xlarge
environment:
CACHE_VERSION: v1
working_directory: ~/react-spectrum

rsp-xlarge-nodeupdate:
docker:
- image: cimg/node:18.17.1
- image: cimg/node:18.20.3
resource_class: xlarge
environment:
CACHE_VERSION: v1
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
- ~/react-spectrum
key: react-spectrum17-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}

install-canary:
install-19:
executor: rsp-large
steps:
- checkout
Expand All @@ -134,12 +134,12 @@ jobs:
- run:
name: build
command: |
yarn install --pure-lockfile --cache-folder ~/.cache/yarn && yarn install-canary --cache-folder ~/.cache/yarn
yarn install --pure-lockfile --cache-folder ~/.cache/yarn && yarn install-19 --cache-folder ~/.cache/yarn

- save_cache:
paths:
- ~/react-spectrum
key: react-spectrum-canary-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
key: react-spectrum-19-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}

test-ssr:
executor: rsp-xlarge
Expand Down Expand Up @@ -199,11 +199,11 @@ jobs:
command: |
yarn test:ssr

test-ssr-canary:
test-ssr-19:
executor: rsp-xlarge
steps:
- restore_cache:
key: react-spectrum-canary-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
key: react-spectrum-19-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}

- run:
name: test ssr
Expand Down Expand Up @@ -258,12 +258,12 @@ jobs:
- store_artifacts:
path: ~/junit

test-canary:
test-19:
parallelism: 3
executor: rsp-xlarge
steps:
- restore_cache:
key: react-spectrum-canary-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
key: react-spectrum-19-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}

- run: mkdir ~/junit

Expand All @@ -272,10 +272,10 @@ jobs:
command: |
shopt -s globstar
TESTFILES=$(circleci tests glob "packages/**/*.test.[tj]{s,sx}" | circleci tests split --split-by=timings)
JEST_JUNIT_OUTPUT_NAME="junit-canary.xml" yarn test ${TESTFILES}
JEST_JUNIT_OUTPUT_NAME="junit-19.xml" yarn test ${TESTFILES}

- run:
command: cp junit-canary.xml ~/junit/
command: cp junit-19.xml ~/junit/
when: always
- store_test_results:
path: ~/junit
Expand Down Expand Up @@ -412,20 +412,20 @@ jobs:
paths:
- '*/storybook-17/'

storybook-canary:
storybook-19:
executor: rsp-large
steps:
- restore_cache:
key: react-spectrum-canary-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}
key: react-spectrum-19-{{ .Environment.CACHE_VERSION }}-{{ .Environment.CIRCLE_SHA1 }}

- run:
name: build storybook-canary
command: make storybook-canary
name: build storybook-19
command: make storybook-19

- persist_to_workspace:
root: dist
paths:
- '*/storybook-canary/'
- '*/storybook-19/'

docs:
executor: rsp-xlarge
Expand Down Expand Up @@ -547,7 +547,7 @@ workflows:
- install
- install-16
- install-17
- install-canary
- install-19
- test-ssr:
requires:
- install
Expand All @@ -566,6 +566,12 @@ workflows:
- test-17:
requires:
- install-17
- test-19:
requires:
- install-19
- test-ssr-19:
requires:
- install-19
- test-esm:
requires:
- install
Expand Down Expand Up @@ -603,9 +609,9 @@ workflows:
- storybook-17:
requires:
- install-17
- storybook-canary:
- storybook-19:
requires:
- install-canary
- install-19
- docs:
requires:
- install
Expand All @@ -628,7 +634,7 @@ workflows:
- storybook
- storybook-16
- storybook-17
- storybook-canary
- storybook-19
- docs
- deploy-verdaccio:
requires:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ storybook-16:
storybook-17:
yarn build:storybook-17

storybook-canary:
yarn build:storybook-canary
storybook-19:
yarn build:storybook-19

# for now doesn't have deploy since v3 doesn't have a place for docs and stuff yet
ci:
Expand Down
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
"check-types": "tsc && tsc-strict",
"install-16": "yarn add -W react@^16.8.0 react-dom@^16.8.0 @testing-library/react@^12 @testing-library/react-hooks@^8 @testing-library/dom@^8 && node scripts/oldReactSupport.mjs",
"install-17": "yarn add -W react@^17 react-dom@^17 @testing-library/react@^12 @testing-library/react-hooks@^8 @testing-library/dom@^8 && node scripts/oldReactSupport.mjs",
"install-canary": "yarn add -W react@canary react-dom@canary",
"install-19": "node ./scripts/install-react-19.mjs && yarn add -W react@next react-dom@next",
"start": "cross-env NODE_ENV=storybook storybook dev -p 9003 --ci -c '.storybook'",
"build:storybook": "storybook build -c .storybook -o dist/$(git rev-parse HEAD)/storybook",
"build:storybook-16": "storybook build -c .storybook -o dist/$(git rev-parse HEAD)/storybook-16",
"build:storybook-17": "storybook build -c .storybook -o dist/$(git rev-parse HEAD)/storybook-17",
"build:storybook-canary": "storybook build -c .storybook -o dist/$(git rev-parse HEAD)/storybook-canary",
"build:storybook-19": "storybook build -c .storybook -o dist/$(git rev-parse HEAD)/storybook-19",
"start:chromatic": "CHROMATIC=1 NODE_ENV=storybook storybook dev -p 9004 --ci -c '.chromatic'",
"build:chromatic": "CHROMATIC=1 storybook build -c .chromatic -o dist/$(git rev-parse HEAD)/chromatic",
"start:chromatic-fc": "CHROMATIC=1 NODE_ENV=storybook storybook dev -p 9005 --ci -c '.chromatic-fc'",
Expand Down Expand Up @@ -105,8 +105,8 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^15.0.0",
"@testing-library/user-event": "^14.5.2",
"@types/react": "^18.3.0",
"@types/react-dom": "^18.3.0",
"@types/react": "npm:[email protected].0",
"@types/react-dom": "npm:[email protected].0",
"@types/storybook__react": "^4.0.2",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
Expand Down Expand Up @@ -140,7 +140,7 @@
"eslint-plugin-rulesdir": "^0.2.2",
"fast-check": "^2.19.0",
"fast-glob": "^3.1.0",
"framer-motion": "^10.16.4",
"framer-motion": "^11.3.0-alpha.0",
"fs-extra": "^10.0.0",
"full-icu": "^1.3.0",
"glob-promise": "^6.0.5",
Expand Down Expand Up @@ -221,7 +221,9 @@
"@parcel/rust": "2.12.1-dev.3224",
"@parcel/types": "2.0.0-dev.1601",
"@parcel/utils": "2.0.0-dev.1601",
"@parcel/workers": "2.0.0-dev.1601"
"@parcel/workers": "2.0.0-dev.1601",
"@types/react": "npm:[email protected]",
"@types/react-dom": "npm:[email protected]"
},
"@parcel/transformer-css": {
"cssModules": {
Expand Down
4 changes: 2 additions & 2 deletions packages/@adobe/react-spectrum/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"access": "public"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
}
}
4 changes: 2 additions & 2 deletions packages/@react-aria/accordion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"@swc/helpers": "^0.5.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/@react-aria/accordion/src/useAccordion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface AccordionItemAria {
regionProps: DOMAttributes
}

export function useAccordionItem<T>(props: AccordionItemAriaProps<T>, state: TreeState<T>, ref: RefObject<HTMLButtonElement>): AccordionItemAria {
export function useAccordionItem<T>(props: AccordionItemAriaProps<T>, state: TreeState<T>, ref: RefObject<HTMLButtonElement | null>): AccordionItemAria {
let {item} = props;
let buttonId = useId();
let regionId = useId();
Expand Down Expand Up @@ -65,7 +65,7 @@ export function useAccordionItem<T>(props: AccordionItemAriaProps<T>, state: Tre
};
}

export function useAccordion<T>(props: AriaAccordionProps<T>, state: TreeState<T>, ref: RefObject<HTMLDivElement>): AccordionAria {
export function useAccordion<T>(props: AriaAccordionProps<T>, state: TreeState<T>, ref: RefObject<HTMLDivElement | null>): AccordionAria {
let {listProps} = useSelectableList({
...props,
...state,
Expand Down
4 changes: 2 additions & 2 deletions packages/@react-aria/actiongroup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"@swc/helpers": "^0.5.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/actiongroup/src/useActionGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface ActionGroupAria {
actionGroupProps: DOMAttributes
}

export function useActionGroup<T>(props: AriaActionGroupProps<T>, state: ListState<T>, ref: RefObject<FocusableElement>): ActionGroupAria {
export function useActionGroup<T>(props: AriaActionGroupProps<T>, state: ListState<T>, ref: RefObject<FocusableElement | null>): ActionGroupAria {
let {
isDisabled,
orientation = 'horizontal' as Orientation
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/actiongroup/src/useActionGroupItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const BUTTON_ROLES = {
};

// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function useActionGroupItem<T>(props: AriaActionGroupItemProps, state: ListState<T>, ref?: RefObject<FocusableElement>): ActionGroupItemAria {
export function useActionGroupItem<T>(props: AriaActionGroupItemProps, state: ListState<T>, ref?: RefObject<FocusableElement | null>): ActionGroupItemAria {
let selectionMode = state.selectionManager.selectionMode;
let buttonProps = {
role: BUTTON_ROLES[selectionMode]
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/aria-modal-polyfill/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"aria-hidden": "^1.2.3"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/@react-aria/autocomplete/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"@swc/helpers": "^0.5.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ export interface SearchAutocompleteAria<T> extends ValidationResult {

export interface AriaSearchAutocompleteOptions<T> extends AriaSearchAutocompleteProps<T> {
/** The ref for the input element. */
inputRef: RefObject<HTMLInputElement>,
inputRef: RefObject<HTMLInputElement | null>,
/** The ref for the list box popover. */
popoverRef: RefObject<HTMLDivElement>,
popoverRef: RefObject<HTMLDivElement | null>,
/** The ref for the list box. */
listBoxRef: RefObject<HTMLElement>,
listBoxRef: RefObject<HTMLElement | null>,
/** An optional keyboard delegate implementation, to override the default. */
keyboardDelegate?: KeyboardDelegate
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/breadcrumbs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@swc/helpers": "^0.5.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/breadcrumbs/src/useBreadcrumbItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface BreadcrumbItemAria {
* Provides the behavior and accessibility implementation for an in a breadcrumbs component.
* See `useBreadcrumbs` for details about breadcrumbs.
*/
export function useBreadcrumbItem(props: AriaBreadcrumbItemProps, ref: RefObject<FocusableElement>): BreadcrumbItemAria {
export function useBreadcrumbItem(props: AriaBreadcrumbItemProps, ref: RefObject<FocusableElement | null>): BreadcrumbItemAria {
let {
isCurrent,
isDisabled,
Expand Down
4 changes: 2 additions & 2 deletions packages/@react-aria/button/docs/useButton.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ import {useButton} from '@react-aria/button';
import {useRef} from 'react';

function Button(props) {
let ref = useRef();
let ref = useRef<HTMLButtonElement | null>(null);
let {buttonProps} = useButton(props, ref);
let {children} = props;

Expand Down Expand Up @@ -97,7 +97,7 @@ touch screen support.
```tsx example
function Button(props) {
let {children} = props;
let ref = useRef();
let ref = useRef<HTMLButtonElement | null>(null);
let {buttonProps, isPressed} = useButton({
...props,
elementType: 'span'
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/button/docs/useToggleButton.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ import {useToggleButton} from '@react-aria/button';
import {useToggleState} from '@react-stately/toggle';

function ToggleButton(props) {
let ref = useRef();
let ref = useRef<HTMLButtonElement | null>(null);
let state = useToggleState(props);
let {buttonProps, isPressed} = useToggleButton(props, state, ref);

Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@swc/helpers": "^0.5.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
Loading