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

feat: support React 19 [BREAKING CHANGE] #1

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
70cf106
chore: Include README.md in the package.json files array
sbolel Dec 11, 2024
c9b5355
chore: Update package.json for React v19 migration
sbolel Dec 11, 2024
ea7b857
fix: Update peerDependencies to include React 19.x support
sbolel Dec 11, 2024
b697ff9
fix: Add 'react' to the types array in tsconfig.json for JSX support
sbolel Dec 11, 2024
fe9f5f1
fix: Remove trailing comma from "include" array in tsconfig.json
sbolel Dec 11, 2024
3cff42c
fix: Remove trailing comma in tsconfig.json include array
sbolel Dec 11, 2024
c8aeb31
fix: Update tsconfig.json to resolve JSX namespace error
sbolel Dec 11, 2024
d9470fb
chore: Remove unused React imports from component files
sbolel Dec 11, 2024
a9cd45f
fix: Add import statement for JSX from 'react' in multiple files
sbolel Dec 11, 2024
dc69b32
chore: Remove unused React imports from component files
sbolel Dec 11, 2024
ac3925e
fix: Add import { JSX } from 'react' to multiple component files
sbolel Dec 11, 2024
335f958
build: upgrade yarn
sbolel Dec 11, 2024
974f453
chore: remove react import
sbolel Dec 11, 2024
e993d58
feat: Add JSX import to React components for TypeScript support
sbolel Dec 11, 2024
ca0ad22
feat: Add JSX import from 'react' to multiple component files
sbolel Dec 11, 2024
fa34a66
feat: Add JSX import from 'react' to all relevant component files
sbolel Dec 11, 2024
e37e116
chore: Add JSX import from 'react' to multiple components
sbolel Dec 11, 2024
97a8d41
fix: Add JSX import to components using React in multiple files
sbolel Dec 11, 2024
c17de93
fix: Add JSX import to multiple component files for TypeScript compat…
sbolel Dec 11, 2024
cf82a1b
fix: correct lint errors
sbolel Dec 11, 2024
1c08c0d
refactor: Remove unnecessary React prefixes and update imports in sto…
sbolel Dec 11, 2024
c2956f2
fix: Import React correctly to resolve TypeScript UMD global error
sbolel Dec 11, 2024
427fafc
fix: correct lint errors
sbolel Dec 11, 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
  •  
  •  
  •  
Binary file added .yarn/install-state.gz
Binary file not shown.
148,049 changes: 0 additions & 148,049 deletions .yarn/releases/yarn-1.22.22.cjs

This file was deleted.

934 changes: 934 additions & 0 deletions .yarn/releases/yarn-4.5.3.cjs

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
yarnPath: .yarn/releases/yarn-1.22.22.cjs
enableTelemetry: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.5.3.cjs
27 changes: 14 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"./lib/uswds.css": "./lib/uswds.css"
},
"files": [
"lib"
"lib",
"README.md"
],
"engines": {
"node": ">= 18"
Expand Down Expand Up @@ -71,11 +72,11 @@
"peerDependencies": {
"@uswds/uswds": "^3.7.1",
"focus-trap-react": "^10.2.3",
"react": "^16.x || ^17.x || ^18.x",
"react-dom": "^16.x || ^17.x || ^18.x"
"react": "^16.x || ^17.x || ^18.x || ^19.x",
"react-dom": "^16.x || ^17.x || ^18.x || ^19.x"
},
"devDependencies": {
"@babel/core": "^7.23.9",
"@babel/core": "^7.26.0",
"@laynezh/vite-plugin-lib-assets": "^0.5.14",
"@storybook/addon-a11y": "^8.0.4",
"@storybook/addon-essentials": "^8.0.4",
Expand All @@ -93,9 +94,9 @@
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.0.4",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"@types/react-test-renderer": "^18.0.7",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
"@types/react-test-renderer": "^19.0.0",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.1.1",
"@uswds/uswds": "3.7.1",
Expand All @@ -121,9 +122,9 @@
"husky": "^9.0.10",
"jsdom": "^24.0.0",
"prettier": "^3.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-test-renderer": "^18.2.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-test-renderer": "^19.0.0",
"sass": "^1.26.0",
"storybook": "^8.0.4",
"stylelint": "^16.2.1",
Expand All @@ -150,8 +151,8 @@
"glob-parent": "5.1.2",
"trim": "0.0.3",
"trim-newlines": "3.0.1",
"@types/react": "18.2.48",
"@types/react-dom": "18.2.18"
"@types/react": "19.0.0",
"@types/react-dom": "19.0.0"
},
"packageManager": "yarn@1.22.22"
"packageManager": "yarn@4.5.3"
}
1 change: 0 additions & 1 deletion src/components/Accordion/Accordion.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { Accordion, AccordionItemProps } from './Accordion'

export default {
Expand Down
1 change: 0 additions & 1 deletion src/components/Accordion/Accordion.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { render, fireEvent } from '@testing-library/react'

import { Accordion, AccordionItemProps } from './Accordion'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Accordion/Accordion.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react'
import { JSX, useState } from 'react'
import classnames from 'classnames'

import { HeadingLevel } from '../../types/headingLevel'
Expand Down
1 change: 0 additions & 1 deletion src/components/Alert/Alert.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { Alert } from './Alert'

import { Button } from '../Button/Button'
Expand Down
1 change: 0 additions & 1 deletion src/components/Alert/Alert.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { render } from '@testing-library/react'

import { Alert } from './Alert'
Expand Down
1 change: 0 additions & 1 deletion src/components/Alert/Alert.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import classnames from 'classnames'

import { HeadingLevel } from '../../types/headingLevel'
Expand Down
1 change: 0 additions & 1 deletion src/components/Button/Button.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { Button } from './Button'

export default {
Expand Down
1 change: 0 additions & 1 deletion src/components/Button/Button.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { render, fireEvent } from '@testing-library/react'

vi.mock('../../deprecation')
Expand Down
2 changes: 1 addition & 1 deletion src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import { JSX } from 'react'
import classnames from 'classnames'

export type ButtonProps = {
Expand Down
1 change: 0 additions & 1 deletion src/components/ButtonGroup/ButtonGroup.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { ButtonGroup } from './ButtonGroup'
import { Button } from '../Button/Button'
import { Link } from '../Link/Link'
Expand Down
1 change: 0 additions & 1 deletion src/components/ButtonGroup/ButtonGroup.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { render } from '@testing-library/react'

import { ButtonGroup } from './ButtonGroup'
Expand Down
4 changes: 2 additions & 2 deletions src/components/ButtonGroup/ButtonGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import { Children, JSX } from 'react'
import classnames from 'classnames'

type ButtonGroupProps = {
Expand All @@ -23,7 +23,7 @@ export const ButtonGroup = ({

return (
<ul className={classes} {...restProps}>
{React.Children.map(children, (child: React.ReactNode) => {
{Children.map(children, (child: React.ReactNode) => {
return <li className="usa-button-group__item">{child}</li>
})}
</ul>
Expand Down
1 change: 0 additions & 1 deletion src/components/Collection/Collection.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { Link } from './../Link/Link'
import { Collection } from './Collection'
import { CollectionItem } from './CollectionItem'
Expand Down
1 change: 0 additions & 1 deletion src/components/Collection/Collection.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { render } from '@testing-library/react'

import { Collection } from './Collection'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Collection/Collection.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import classnames from 'classnames'
import { JSX } from 'react'

type CollectionProps = {
condensed?: boolean
Expand Down
1 change: 0 additions & 1 deletion src/components/Collection/CollectionCalendarDate.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { render } from '@testing-library/react'
import { CollectionCalendarDate } from './CollectionCalendarDate'

Expand Down
1 change: 0 additions & 1 deletion src/components/Collection/CollectionCalendarDate.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'

interface CollectionCalendarDateProps {
datetime: string
Expand Down
1 change: 0 additions & 1 deletion src/components/Collection/CollectionDescription.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { render } from '@testing-library/react'
import { CollectionDescription } from './CollectionDescription'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Collection/CollectionDescription.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import { JSX } from 'react'
import classname from 'classnames'

export const CollectionDescription = ({
Expand Down
1 change: 0 additions & 1 deletion src/components/Collection/CollectionHeading.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { render } from '@testing-library/react'
import { CollectionHeading } from './CollectionHeading'
import { HeadingLevel } from '../../types/headingLevel'
Expand Down
1 change: 0 additions & 1 deletion src/components/Collection/CollectionHeading.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import classnames from 'classnames'
import { HeadingLevel } from '../../types/headingLevel'
interface CollectionHeadingProps {
Expand Down
1 change: 0 additions & 1 deletion src/components/Collection/CollectionItem.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { render } from '@testing-library/react'
import { CollectionItem } from './CollectionItem'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Collection/CollectionItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import { JSX } from 'react'
import classnames from 'classnames'

interface CollectionItemProps {
Expand Down
1 change: 0 additions & 1 deletion src/components/Collection/CollectionMeta.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { render } from '@testing-library/react'
import { CollectionMeta } from './CollectionMeta'
import { CollectionMetaItem } from './CollectionMetaItem'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Collection/CollectionMeta.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import { JSX } from 'react'
import classnames from 'classnames'

export const CollectionMeta = ({
Expand Down
1 change: 0 additions & 1 deletion src/components/Collection/CollectionMetaItem.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { render } from '@testing-library/react'
import { CollectionMetaItem } from './CollectionMetaItem'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Collection/CollectionMetaItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import { JSX } from 'react'
import classnames from 'classnames'

export const CollectionMetaItem = ({
Expand Down
1 change: 0 additions & 1 deletion src/components/Collection/CollectionMetaItemTag.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { render } from '@testing-library/react'
import { CollectionMetaItemTag } from './CollectionMetaItemTag'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Collection/CollectionMetaItemTag.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import { JSX } from 'react'
import classnames from 'classnames'

interface CollectionMetaItemTagProps {
Expand Down
1 change: 0 additions & 1 deletion src/components/Collection/CollectionThumbnail.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { render } from '@testing-library/react'
import { CollectionThumbnail } from './CollectionThumbnail'

Expand Down
2 changes: 1 addition & 1 deletion src/components/Collection/CollectionThumbnail.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import { JSX } from 'react'
import classnames from 'classnames'

export const CollectionThumbnail = ({
Expand Down
1 change: 0 additions & 1 deletion src/components/Footer/Address/Address.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { Address } from './Address'

export default {
Expand Down
1 change: 0 additions & 1 deletion src/components/Footer/Address/Address.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { render } from '@testing-library/react'
import { Address } from './Address'

Expand Down
1 change: 0 additions & 1 deletion src/components/Footer/Address/Address.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import classnames from 'classnames'

type AddressProps = {
Expand Down
1 change: 0 additions & 1 deletion src/components/Footer/Footer/Footer.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable jsx-a11y/anchor-is-valid */
import React from 'react'

import { Address } from '../Address/Address'
import { Button } from '../../Button/Button'
Expand Down
1 change: 0 additions & 1 deletion src/components/Footer/Footer/Footer.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { render } from '@testing-library/react'
import { Footer } from './Footer'

Expand Down
1 change: 0 additions & 1 deletion src/components/Footer/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import classnames from 'classnames'

type FooterProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable jsx-a11y/anchor-is-valid, react/jsx-key */

import React from 'react'
import { render } from '@testing-library/react'
import { userEvent } from '@testing-library/user-event'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { useState, useEffect } from 'react'
import { useState, useEffect } from 'react'
import classnames from 'classnames'
import { NavList } from '../../header/NavList/NavList'

export type ExtendedNavLinksType = React.ReactNode[][]

type FooterExtendedNavListProps = {
isMobile?: boolean
/*
/*
Turn on mobile styles via prop. If undefined, a fallback is used based on the client window width.
*/
/*
/*
Multidimensional array of grouped nav links. Sub-arrays are column sections, first element is used as a heading.
*/
nestedLinks: ExtendedNavLinksType
Expand All @@ -24,7 +24,7 @@ export const FooterExtendedNavList = ({
const classes = classnames('grid-row grid-gap-4', className)
const isClient = window && typeof window === 'object'

const [isMobileFallback, setIsMobileFallback] = React.useState<boolean>(
const [isMobileFallback, setIsMobileFallback] = useState<boolean>(
isClient && window.innerWidth < 480
)
const [sectionsOpenState, setSectionsOpenState] = useState<boolean[]>(
Expand Down
1 change: 0 additions & 1 deletion src/components/Footer/FooterNav/FooterNav.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable jsx-a11y/anchor-is-valid */
import React from 'react'

import { Footer } from '../Footer/Footer'
import { FooterNav } from './FooterNav'
Expand Down
1 change: 0 additions & 1 deletion src/components/Footer/FooterNav/FooterNav.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable jsx-a11y/anchor-is-valid, react/jsx-key */

import React from 'react'
import { render } from '@testing-library/react'
import { FooterNav } from './FooterNav'

Expand Down
1 change: 0 additions & 1 deletion src/components/Footer/FooterNav/FooterNav.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import {
FooterExtendedNavList,
ExtendedNavLinksType,
Expand Down
1 change: 0 additions & 1 deletion src/components/Footer/Logo/Logo.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'

import { Logo } from './Logo'

Expand Down
1 change: 0 additions & 1 deletion src/components/Footer/Logo/Logo.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { render } from '@testing-library/react'
import { Logo } from './Logo'

Expand Down
1 change: 0 additions & 1 deletion src/components/Footer/Logo/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import classnames from 'classnames'

type LogoProps = {
Expand Down
1 change: 0 additions & 1 deletion src/components/Footer/SocialLinks/SocialLinks.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable jsx-a11y/anchor-is-valid */
import React from 'react'
import { SocialLinks, SocialLink } from './SocialLinks'

export default {
Expand Down
1 change: 0 additions & 1 deletion src/components/Footer/SocialLinks/SocialLinks.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable jsx-a11y/anchor-is-valid */
import React from 'react'
import { render } from '@testing-library/react'

import { SocialLinks, SocialLink } from './SocialLinks'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Footer/SocialLinks/SocialLinks.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable jsx-a11y/anchor-is-valid */
import React from 'react'
import { JSX } from 'react'
import classnames from 'classnames'
import { Icon } from '../../Icon/Icons'
import { IconProps } from '../../Icon/Icon'
Expand Down
1 change: 0 additions & 1 deletion src/components/Icon/Icon.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'

import { Icon } from './Icons'

Expand Down
1 change: 0 additions & 1 deletion src/components/Icon/Icon.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { render, screen } from '@testing-library/react'

import { Icon } from './Icons'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import { JSX } from 'react'
import classnames from 'classnames'

interface USWDSIconProps {
Expand Down
1 change: 0 additions & 1 deletion src/components/Icon/Icons.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'

import { Icon } from './Icons'

Expand Down
1 change: 0 additions & 1 deletion src/components/Icon/Icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ import ZoomOutMapSvg from '@uswds/uswds/img/usa-icons/zoom_out_map.svg?svgr'
import ZoomOutSvg from '@uswds/uswds/img/usa-icons/zoom_out.svg?svgr'

import { makeUSWDSIcon, IconProps } from './Icon'
import React from 'react'

export class Icon {
public static AccessibilityNew: React.ComponentType<IconProps> =
Expand Down
2 changes: 1 addition & 1 deletion src/components/IconList/IconList.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactElement } from 'react'
import { ReactElement } from 'react'
import { Icon } from '../Icon/Icons'
import { IconList } from './IconList'
import { IconListItem } from './IconListItem/IconListItem'
Expand Down
Loading