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

chore(deps): Migrate to react 19 #15358

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
908d9af
fix(deps): update react monorepo to v19
renovate[bot] Jan 3, 2025
c597643
update Combobox
0xTxbi Jan 3, 2025
9dfc172
update Button
0xTxbi Jan 3, 2025
f35b475
update ui package.json
0xTxbi Jan 3, 2025
5839d6f
update ui vite config
0xTxbi Jan 3, 2025
c60d2ef
update ui react entry file
0xTxbi Jan 3, 2025
4f051d4
update yarn.lock
0xTxbi Jan 3, 2025
1514e02
update static site
0xTxbi Jan 6, 2025
a08f4e4
Merge branch 'master' into react-19-upgrade
julien51 Jan 6, 2025
cfe7145
fix return
0xTxbi Jan 6, 2025
cfd0592
update combobox
0xTxbi Jan 6, 2025
21d4400
Merge branch 'master' into react-19-upgrade
0xTxbi Jan 6, 2025
5d9762d
Merge branch 'master' into react-19-upgrade
0xTxbi Jan 9, 2025
3440d12
Merge branch 'master' into react-19-upgrade
0xTxbi Jan 9, 2025
de8d760
update ui package.json
0xTxbi Jan 9, 2025
aa75f0e
remove redundant tests
0xTxbi Jan 20, 2025
ab24e80
remove redundant components
0xTxbi Jan 20, 2025
c3f4876
update test
0xTxbi Jan 20, 2025
e0f4952
update yarn.lock
0xTxbi Jan 20, 2025
62dfef7
Merge branch 'master' into react-19-upgrade
0xTxbi Jan 20, 2025
8a16735
update package.json
0xTxbi Jan 20, 2025
b04d0d4
update yarn.lock
0xTxbi Jan 20, 2025
cb888bd
fix unused directives
0xTxbi Jan 20, 2025
9cc6d43
update recaptcha usage
0xTxbi Jan 20, 2025
e88937d
update useref usage
0xTxbi Jan 20, 2025
dd37f71
Revert "fix unused directives"
0xTxbi Jan 31, 2025
da635ea
Revert "update recaptcha usage"
0xTxbi Jan 31, 2025
e4509e2
Revert "update useref usage"
0xTxbi Jan 31, 2025
4f9218a
unpin deps
0xTxbi Jan 31, 2025
ad2422c
Merge branch 'master' into react-19-upgrade
0xTxbi Jan 31, 2025
fcf131e
update ui components wip
0xTxbi Jan 31, 2025
92103b0
Merge branch 'master' into react-19-upgrade
0xTxbi Feb 27, 2025
dccf93a
update yarn.lock
0xTxbi Feb 27, 2025
44d9ccd
update package.json
0xTxbi Feb 27, 2025
fcde6f9
fix headless ui type errors
0xTxbi Feb 27, 2025
8c6185c
Merge branch 'master' into react-19-upgrade
0xTxbi Feb 27, 2025
c1812e2
update Placeholder
0xTxbi Feb 27, 2025
8c50e67
update Placeholder
0xTxbi Feb 27, 2025
4fd51a8
improve cryptoicon package build
0xTxbi Feb 28, 2025
6fb1ae7
update cryptoicon package build
0xTxbi Feb 28, 2025
9f74c67
update cryptoicon
0xTxbi Feb 28, 2025
3c996a7
update ui package build
0xTxbi Feb 28, 2025
b6556af
update ui package components
0xTxbi Feb 28, 2025
bdd8661
unlock-app type fixes
0xTxbi Feb 28, 2025
6be3ca6
update unlock-app package.json
0xTxbi Feb 28, 2025
0baa5fe
update yarn.lock
0xTxbi Feb 28, 2025
89c21ae
ui package build update
0xTxbi Feb 28, 2025
30c0d49
ui package build update
0xTxbi Feb 28, 2025
34cd426
unlock-app react types update
0xTxbi Feb 28, 2025
483338a
more unlock-app typescript fixes
0xTxbi Feb 28, 2025
79f3e82
update yarn.lock
0xTxbi Feb 28, 2025
5a1920d
update crypto-icon package
0xTxbi Feb 28, 2025
13bcd81
update yarn.lock
0xTxbi Feb 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"docusaurus-theme-openapi-docs": "4.3.3",
"ethers": "6.13.5",
"prism-react-renderer": "2.4.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-icons": "5.4.0"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion locksmith/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"pdfmake": "0.2.18",
"pg": "8.13.1",
"rate-limiter-flexible": "5.0.5",
"react": "18.3.1",
"react": "19.0.0",
"remark-html": "16.0.1",
"remark-parse": "11.0.0",
"satori": "0.12.1",
Expand Down
1 change: 1 addition & 0 deletions packages/crypto-icon/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"jsxImportSource": "react",
"baseUrl": ".",
"paths": {
"~/*": ["./lib/*"]
Expand Down
1 change: 1 addition & 0 deletions packages/ui/lib/components/Card/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { JSX } from 'react'
import { classed } from '@tw-classed/react'

const CardBase = classed.div('w-full rounded-2xl', {
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/lib/components/Drawer/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ export const Drawer = ({
description,
}: DrawerProps) => {
return (
<Transition show={isOpen} as={React.Fragment}>
<Transition show={isOpen} as="div">
<Dialog as="div" className="relative z-10" onClose={setIsOpen}>
<TransitionChild
as={React.Fragment}
as="div"
enter="ease-in-out duration-500"
enterFrom="opacity-0"
enterTo="opacity-100"
Expand All @@ -47,7 +47,7 @@ export const Drawer = ({
<div className="absolute inset-0 overflow-hidden">
<div className="pointer-events-none fixed inset-y-0 right-0 flex max-w-full pl-10">
<TransitionChild
as={React.Fragment}
as="div"
enter="transform transition ease-in-out duration-500 sm:duration-700"
enterFrom="translate-x-full"
enterTo="translate-x-0"
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/lib/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactNode } from 'react'
import { ReactNode, type JSX } from 'react';
import { SOCIAL_LINKS } from '../constants'
import LogoUrl from './../../assets/unlock-footer-logo.svg?url'

Expand Down
12 changes: 7 additions & 5 deletions packages/ui/lib/components/Form/Combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,9 @@ export function Combobox({
{displayedOptions.map((option, index) => (
<li
key={`${option.value}-${index}`}
ref={(el) => (optionsRef.current[index] = el)}
ref={(el) => {
optionsRef.current[index] = el
}}
className={clsx(
'flex cursor-pointer mx-2 rounded-sm items-center gap-2 py-2 px-3 text-base min-w-0',
'hover:bg-ui-main-50',
Expand Down Expand Up @@ -402,10 +404,10 @@ export function Combobox({
query === '' &&
moreOptions.length > 0 && (
<li
ref={(el) =>
(optionsRef.current[displayedOptions.length] =
el)
}
ref={(el) => {
optionsRef.current[displayedOptions.length] =
el
}}
className={clsx(
'flex cursor-pointer mx-2 rounded-sm items-center justify-center gap-2 py-3 px-3 text-base font-semibold min-w-0',
'hover:bg-ui-main-50 text-brand-ui-primary',
Expand Down
48 changes: 34 additions & 14 deletions packages/ui/lib/components/HeaderNav/HeaderNav.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Popover, Transition } from '@headlessui/react'
import { Fragment, ReactNode, useEffect, useState } from 'react'
import { Popover, Transition, Dialog, TransitionChild } from '@headlessui/react'
import { ReactNode, useEffect, useState, type JSX } from 'react';
import { Button } from '../Button/Button'
import { SOCIAL_LINKS } from '../constants'
import { Icon } from '../Icon/Icon'
Expand Down Expand Up @@ -272,7 +272,7 @@ const NavSectionDesktop = (section: MenuSectionProps) => {
<Title title={title} open={open} />
</Popover.Button>
<Transition
as={Fragment}
as="div"
enter="transition ease-out duration-200"
enterFrom="opacity-0 translate-y-1"
enterTo="opacity-100 translate-y-0"
Expand Down Expand Up @@ -512,19 +512,39 @@ export const HeaderNav = ({
</div>
</div>

{/* mobile menu */}
{menuExpanded && (
<div
className={`fixed bottom-0 left-0 right-0 z-10 block overflow-scroll pb-20 top-24 lg:hidden ${
extraClass?.mobile ?? ''
}`}
{/* Mobile menu */}
<Transition show={menuExpanded} as="div">
<Dialog
as="div"
className="fixed inset-0 z-10 overflow-y-auto"
onClose={setMenuExpanded}
>
<div className="flex flex-col gap-10">
<NavSectionMobile menuSections={menuSections} />
{showSocialIcons && <SocialIcons />}
<div className="min-h-screen px-4 text-center">
<TransitionChild
as="div"
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-black bg-opacity-75" />
</TransitionChild>

<div className="fixed inset-0 overflow-y-auto">
<div className="flex items-center justify-center min-h-full p-4">
<div className="w-full max-w-md transform overflow-hidden rounded-2xl bg-white p-6 text-left align-middle shadow-xl transition-all">
<div className="flex flex-col gap-10">
<NavSectionMobile menuSections={menuSections} />
{showSocialIcons && <SocialIcons />}
</div>
</div>
</div>
</div>
</div>
</div>
)}
</Dialog>
</Transition>
</div>
)
}
Expand Down
8 changes: 7 additions & 1 deletion packages/ui/lib/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ const ICON_SIZE: Record<Size, number> = {
tiny: 14,
}

export function Icon({ className, size = 'small', icon, ...rest }: Props) {
// Regular implementation
function IconComponent({ className, size = 'small', icon, ...rest }: Props) {
const IconComponent = icon
const iconSize: number = typeof size === 'string' ? ICON_SIZE[size] : size
return <IconComponent className={className} size={iconSize} {...rest} />
}

// For React 19, we need to use a more direct approach with "any" casting
// Using "any" is necessary here to make components usable as JSX elements in React 19
// This also solves the IconType incompatibility between different package installations
export const Icon = IconComponent as any
8 changes: 7 additions & 1 deletion packages/ui/lib/components/IconButton/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const SIZE_STYLES: SizeStyleProp = {
large: 'p-3',
}

export const IconButton = forwardRef(
const IconButtonComponent = forwardRef(
(props: Props, ref: ForwardedRef<HTMLButtonElement>) => {
const buttonClass = twMerge(
'rounded hover:fill-brand-ui-primary',
Expand All @@ -39,3 +39,9 @@ export const IconButton = forwardRef(
)
}
)

IconButtonComponent.displayName = 'IconButton'

// For React 19, we need to use a more direct approach with "any" casting
// Using "any" is necessary here to make components usable as JSX elements in React 19
export const IconButton = IconButtonComponent as any
6 changes: 3 additions & 3 deletions packages/ui/lib/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactNode } from 'react'
import { ReactNode } from 'react'
import {
Dialog,
DialogBackdrop,
Expand Down Expand Up @@ -81,7 +81,7 @@ export function Modal({
}

return (
<Transition show={isOpen} as={React.Fragment}>
<Transition show={isOpen} as="div">
<Dialog
as="div"
className="fixed inset-0 z-10 overflow-y-auto"
Expand All @@ -94,7 +94,7 @@ export function Modal({
} justify-center`}
>
<TransitionChild
as={React.Fragment}
as="div"
enter="ease-out duration-300"
enterFrom={`opacity-0 ${disableBottomSheet ? 'translate-y-4 sm:translate-y-4' : 'translate-y-[100%] sm:translate-y-4'} sm:scale-95`}
enterTo="opacity-100 translate-y-0 sm:scale-100"
Expand Down
36 changes: 21 additions & 15 deletions packages/ui/lib/components/Placeholder/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import { classed } from '@tw-classed/react'
import React, { forwardRef } from 'react'

export const Card = classed.div(
'w-full rounded-2xl animate-pulse bg-gray-200',
{
variants: {
size: {
sm: 'h-24',
md: 'h-32',
lg: 'h-64',
xl: 'h-96',
},
const BaseCard = classed.div('w-full rounded-2xl animate-pulse bg-gray-200', {
variants: {
size: {
sm: 'h-24',
md: 'h-32',
lg: 'h-64',
xl: 'h-96',
},
defaultVariants: {
size: 'sm',
},
}
)
},
defaultVariants: {
size: 'sm',
},
})

export type CardProps = React.ComponentProps<typeof BaseCard>

export const Card = forwardRef<HTMLDivElement, CardProps>((props, ref) => {
return <BaseCard ref={ref} {...props} />
})

Card.displayName = 'Card'
9 changes: 8 additions & 1 deletion packages/ui/lib/components/Placeholder/Image.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { classed } from '@tw-classed/react'
import React, { forwardRef } from 'react'

export const Image = classed.div('bg-gray-200 animate-pulse', {
const BaseImage = classed.div('bg-gray-200 animate-pulse', {
variants: {
size: {
sm: 'h-24 w-24',
Expand All @@ -22,4 +23,10 @@ export const Image = classed.div('bg-gray-200 animate-pulse', {
},
})

export type ImageProps = React.ComponentProps<typeof BaseImage>

export const Image = forwardRef<HTMLDivElement, ImageProps>((props, ref) => {
return <BaseImage ref={ref} {...props} />
})

Image.displayName = 'Image'
9 changes: 8 additions & 1 deletion packages/ui/lib/components/Placeholder/Line.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { classed } from '@tw-classed/react'
import React, { forwardRef } from 'react'

export const Line = classed.div('bg-gray-200 rounded-xl animate-pulse', {
const BaseLine = classed.div('bg-gray-200 rounded-xl animate-pulse', {
variants: {
size: {
sm: 'h-4',
Expand All @@ -22,4 +23,10 @@ export const Line = classed.div('bg-gray-200 rounded-xl animate-pulse', {
},
})

export type LineProps = React.ComponentProps<typeof BaseLine>

export const Line = forwardRef<HTMLDivElement, LineProps>((props, ref) => {
return <BaseLine ref={ref} {...props} />
})

Line.displayName = 'Line'
52 changes: 41 additions & 11 deletions packages/ui/lib/components/Placeholder/Placeholder.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,48 @@
import React from 'react'
import { Placeholder } from '.'
import { StoryFn } from '@storybook/react'
import type { Meta, StoryObj } from '@storybook/react'

const PlaceholderRoot = Placeholder.Root as React.FC<any>

// Define the meta with the explicit component type
const meta = {
component: Placeholder,
title: 'Placeholder',
}
component: PlaceholderRoot,
} as Meta<typeof PlaceholderRoot>

export default meta

export const Template: StoryFn<typeof meta> = (args) => (
<Placeholder.Root>
<Placeholder.Image rounded="full" size="sm" />
<Placeholder.Line />
<Placeholder.Line />
<Placeholder.Line />
</Placeholder.Root>
)
type Story = StoryObj<typeof meta>

// Create a basic template story
export const Default: Story = {
render: () => (
<Placeholder.Root>
<Placeholder.Image rounded="full" size="sm" />
<Placeholder.Line />
<Placeholder.Line />
<Placeholder.Line />
</Placeholder.Root>
),
}

// Create a story with inline placeholder
export const Inline: Story = {
render: () => (
<Placeholder.Root inline={true}>
<Placeholder.Image rounded="full" size="sm" />
<Placeholder.Line />
<Placeholder.Line />
</Placeholder.Root>
),
}

// Card placeholder example
export const Cards: Story = {
render: () => (
<Placeholder.Root>
<Placeholder.Card size="sm" />
<Placeholder.Card size="md" />
</Placeholder.Root>
),
}
19 changes: 14 additions & 5 deletions packages/ui/lib/components/Placeholder/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { Line } from './Line'
import { Image } from './Image'
import { Card } from './Card'
import { classed } from '@tw-classed/react'
import React, { forwardRef } from 'react'

export const Root = classed.div('flex', {
const BaseRoot = classed.div('flex', {
variants: {
spaced: {
sm: 'gap-2',
Expand All @@ -21,11 +22,19 @@ export const Root = classed.div('flex', {
},
})

export type RootProps = React.ComponentProps<typeof BaseRoot>

const Root = forwardRef<HTMLDivElement, RootProps>((props, ref) => {
return <BaseRoot ref={ref} {...props} />
})

Root.displayName = 'Root'

// For React 19, we need to use a more direct approach with "any" casting
export const Placeholder = {
Line,
Image,
Root,
Card,
// Using "any" is necessary here to make components usable as JSX elements in React 19
Line: Line as any,
Image: Image as any,
Root: Root as any,
Card: Card as any,
}
3 changes: 2 additions & 1 deletion packages/ui/lib/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,9 @@ export const Select = <T extends unknown>({
}
>
<Listbox
as="div"
disabled={fieldDisabled}
value={selected?.value || ''}
value={selected?.value ?? ''}
onChange={onChangeOption}
>
<div className="relative">
Expand Down
Loading
Loading