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 (RC) #526

Merged
merged 12 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
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
2 changes: 1 addition & 1 deletion apps/playground/app/sink/tab-nav-demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const TabNavDemo = React.forwardRef<
React.ComponentPropsWithoutRef<typeof TabNav.Root>
>((props, forwardedRef) => {
const params = useSearchParams();
const tab = params.get('tab');
const tab = params?.get('tab');
return (
<TabNav.Root {...props} ref={forwardedRef}>
<TabNav.Link asChild active={tab === 'account' || tab === null}>
Expand Down
5 changes: 3 additions & 2 deletions apps/playground/app/test-checkbox-card/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ import { NextThemeProvider } from '../next-theme-provider';

export default function Test() {
const [frameworks, setFrameworks] = React.useState(['next']);
const [frameworksForm, setFrameworksForm] = React.useState([]);
const [frameworksForm, setFrameworksForm] = React.useState<FormDataEntryValue[]>([]);

function handleChange(event: React.FormEvent<HTMLFormElement>) {
const formData = new FormData(event.currentTarget);
setFrameworksForm(formData.getAll('frameworks'));
const values = formData.getAll('frameworks');
setFrameworksForm(values);
}

return (
Expand Down
7 changes: 5 additions & 2 deletions apps/playground/app/test-skeleton/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
Skeleton,
} from '@radix-ui/themes';
import { NextThemeProvider } from '../next-theme-provider';
import { MixIcon } from '@radix-ui/react-icons';

export default function Test() {
const [isLoading, setIsLoading] = React.useState(true);
Expand All @@ -28,7 +27,11 @@ export default function Test() {
setIsLoading(false);
}, 2000);

return () => clearTimeout(loadingTimeoutRef.current);
return () => {
if (loadingTimeoutRef.current) {
clearTimeout(loadingTimeoutRef.current);
}
};
}, []);

return (
Expand Down
1 change: 1 addition & 0 deletions apps/playground/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
22 changes: 11 additions & 11 deletions apps/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next"
},
"dependencies": {
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-icons": "1.3.0",
"@radix-ui/themes": "*",
"next": "^14.1.0",
"next-themes": "^0.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-use": "^17.4.0",
"seedrandom": "^3.0.5"
"next": "14.1.0",
"next-themes": "0.2.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-use": "17.4.0",
"seedrandom": "3.0.5"
},
"devDependencies": {
"@types/node": "^17.0.12",
"@types/react": "^18.2.53",
"@types/react-dom": "^18.2.18",
"@types/node": "17.0.12",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"eslint-config-custom": "*",
"typescript": "^5.3.3"
"typescript": "5.4.5"
}
}
3 changes: 2 additions & 1 deletion apps/playground/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"noEmit": true,
"resolveJsonModule": true,
"strict": false,
"target": "es5"
"target": "es5",
"strictNullChecks": true
},
"include": ["src", "next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"name": "monorepo",
"private": true,
"packageManager": "yarn@1.22.18",
"workspaces": [
Expand All @@ -12,8 +13,8 @@
"clean": "turbo run clean && rm -rf node_modules"
},
"devDependencies": {
"eslint": "^8.29.0",
"eslint": "8.29.0",
"eslint-config-custom": "*",
"turbo": "latest"
"turbo": "2.0.3"
}
}
6 changes: 3 additions & 3 deletions packages/eslint-config-custom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"main": "index.js",
"license": "MIT",
"dependencies": {
"eslint-config-next": "^13.4.1",
"eslint-config-prettier": "^8.3.0",
"eslint-config-next": "14.1.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-react": "7.28.0",
"eslint-config-turbo": "^1.9.3"
"eslint-plugin-turbo": "2.0.3"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this package change intentional? If so we should also update the eslint-config-custom to use it as a plugin instead of a config.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had an issue when it requested I'd use the plugin, but rolling it back and just upgrading eslint-config-turbo it's gone now

Probably was a stale lockfile thing

},
"publishConfig": {
"access": "public"
Expand Down
5 changes: 5 additions & 0 deletions packages/radix-ui-themes/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 3.1.0

- Support React 19
- Upgrade Radix Primitives to the newest versions

## 3.0.5

- Add `align`, `height`, `minHeight`, and `maxHeight` props to `AlertDialog.Content` and `Dialog.Content`
Expand Down
108 changes: 54 additions & 54 deletions packages/radix-ui-themes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,47 +84,47 @@
"prepublishOnly": "yarn lint"
},
"dependencies": {
"@radix-ui/colors": "^3.0.0",
"@radix-ui/primitive": "^1.0.1",
"@radix-ui/react-accessible-icon": "^1.0.3",
"@radix-ui/react-alert-dialog": "^1.0.5",
"@radix-ui/react-aspect-ratio": "^1.0.3",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-compose-refs": "^1.0.1",
"@radix-ui/react-context": "^1.0.1",
"@radix-ui/react-context-menu": "^2.1.5",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-direction": "^1.0.1",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-form": "^0.0.3",
"@radix-ui/react-hover-card": "^1.0.7",
"@radix-ui/react-navigation-menu": "^1.1.4",
"@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-portal": "^1.0.4",
"@radix-ui/react-primitive": "^1.0.3",
"@radix-ui/react-progress": "^1.0.3",
"@radix-ui/react-radio-group": "^1.1.3",
"@radix-ui/react-roving-focus": "^1.0.4",
"@radix-ui/react-scroll-area": "^1.0.5",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slider": "^1.1.2",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-switch": "^1.0.3",
"@radix-ui/react-tabs": "^1.0.4",
"@radix-ui/react-toggle-group": "^1.0.4",
"@radix-ui/react-tooltip": "^1.0.7",
"@radix-ui/react-use-callback-ref": "^1.0.1",
"@radix-ui/react-use-controllable-state": "^1.0.1",
"@radix-ui/react-visually-hidden": "^1.0.3",
"classnames": "^2.3.2",
"@radix-ui/colors": "3.0.0",
"@radix-ui/primitive": "1.1.0-rc.5",
"@radix-ui/react-accessible-icon": "1.1.0-rc.5",
"@radix-ui/react-alert-dialog": "1.1.0-rc.6",
"@radix-ui/react-aspect-ratio": "1.1.0-rc.5",
"@radix-ui/react-avatar": "1.1.0-rc.5",
"@radix-ui/react-checkbox": "1.1.0-rc.5",
"@radix-ui/react-compose-refs": "1.1.0-rc.5",
"@radix-ui/react-context": "1.1.0-rc.5",
"@radix-ui/react-context-menu": "2.2.0-rc.5",
"@radix-ui/react-dialog": "1.1.0-rc.7",
"@radix-ui/react-direction": "1.1.0-rc.5",
"@radix-ui/react-dropdown-menu": "2.1.0-rc.5",
"@radix-ui/react-form": "0.1.0-rc.5",
"@radix-ui/react-hover-card": "1.1.0-rc.5",
"@radix-ui/react-navigation-menu": "1.2.0-rc.5",
"@radix-ui/react-popover": "1.1.0-rc.5",
"@radix-ui/react-portal": "1.1.0-rc.5",
"@radix-ui/react-primitive": "2.0.0-rc.2",
"@radix-ui/react-progress": "1.1.0-rc.5",
"@radix-ui/react-radio-group": "1.2.0-rc.5",
"@radix-ui/react-roving-focus": "1.1.0-rc.5",
"@radix-ui/react-scroll-area": "1.1.0-rc.5",
"@radix-ui/react-select": "2.1.0-rc.5",
"@radix-ui/react-slider": "1.2.0-rc.8",
"@radix-ui/react-slot": "1.1.0-rc.5",
"@radix-ui/react-switch": "1.1.0-rc.5",
"@radix-ui/react-tabs": "1.1.0-rc.5",
"@radix-ui/react-toggle-group": "1.1.0-rc.5",
"@radix-ui/react-tooltip": "1.1.0-rc.5",
"@radix-ui/react-use-callback-ref": "1.1.0-rc.5",
"@radix-ui/react-use-controllable-state": "1.1.0-rc.5",
"@radix-ui/react-visually-hidden": "1.1.0-rc.5",
"classnames": "2.3.2",
"react-remove-scroll-bar": "2.3.4"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0",
"react-dom": "^16.8 || ^17.0 || ^18.0"
"react": "16.8 || ^17.0 || ^18.0 || ^19.0",
"react-dom": "16.8 || ^17.0 || ^18.0 || ^19.0"
},
"peerDependenciesMeta": {
"@types/react": {
Expand All @@ -135,25 +135,25 @@
}
},
"devDependencies": {
"@types/react": "^18.2.53",
"@types/react-dom": "^18.2.18",
"autoprefixer": "^10.4.19",
"esbuild": "^0.20.0",
"eslint": "^8.15.0",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"autoprefixer": "10.4.19",
"esbuild": "0.20.0",
"eslint": "8.15.0",
"eslint-config-custom": "*",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-require-extensions": "^0.1.3",
"postcss": "^8.4.33",
"postcss-cli": "^11.0.0",
"postcss-combine-duplicated-selectors": "^10.0.3",
"postcss-custom-media": "^10.0.2",
"postcss-discard-empty": "^6.0.1",
"postcss-import": "^16.0.0",
"postcss-nesting": "^12.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"stylelint": "^16.1.0",
"typescript": "^5.3.3"
"eslint-plugin-import": "2.29.1",
"eslint-plugin-require-extensions": "0.1.3",
"postcss": "8.4.33",
"postcss-cli": "11.0.0",
"postcss-combine-duplicated-selectors": "10.0.3",
"postcss-custom-media": "10.0.2",
"postcss-discard-empty": "6.0.1",
"postcss-import": "16.0.0",
"postcss-nesting": "12.0.2",
"react": "18.3.1",
"react-dom": "18.3.1",
"stylelint": "16.1.0",
"typescript": "5.3.3"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 0 additions & 2 deletions packages/radix-ui-themes/src/components/accessible-icon.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
'use client';

export { AccessibleIcon } from '@radix-ui/react-accessible-icon';
2 changes: 0 additions & 2 deletions packages/radix-ui-themes/src/components/alert-dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import * as React from 'react';
import classNames from 'classnames';
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
Expand Down
2 changes: 0 additions & 2 deletions packages/radix-ui-themes/src/components/aspect-ratio.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
'use client';

export { AspectRatio } from '@radix-ui/react-aspect-ratio';
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import * as React from 'react';
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
import { createCheckboxScope } from '@radix-ui/react-checkbox';
Expand All @@ -9,7 +11,6 @@ import { createRovingFocusGroupScope } from '@radix-ui/react-roving-focus';
import { useControllableState } from '@radix-ui/react-use-controllable-state';
import { useDirection } from '@radix-ui/react-direction';

import type * as Radix from '@radix-ui/react-primitive';
import type { Scope } from '@radix-ui/react-context';

/* -------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -38,12 +39,12 @@ const [CheckboxGroupProvider, useCheckboxGroupContext] =
createCheckboxGroupContext<CheckboxGroupContextValue>(CHECKBOX_GROUP_NAME);

type CheckboxGroupElement = React.ElementRef<typeof Primitive.div>;
type RovingFocusGroupProps = Radix.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;
type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
type RovingFocusGroupProps = React.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
interface CheckboxGroupProps extends PrimitiveDivProps {
name?: CheckboxGroupContextValue['name'];
required?: Radix.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>['required'];
disabled?: Radix.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>['disabled'];
required?: React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>['required'];
disabled?: React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>['disabled'];
dir?: RovingFocusGroupProps['dir'];
orientation?: RovingFocusGroupProps['orientation'];
loop?: RovingFocusGroupProps['loop'];
Expand Down Expand Up @@ -125,7 +126,7 @@ CheckboxGroup.displayName = CHECKBOX_GROUP_NAME;
const ITEM_NAME = 'CheckboxGroupItem';

type CheckboxGroupItemElement = React.ElementRef<typeof CheckboxPrimitive.Root>;
type CheckboxProps = Radix.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>;
type CheckboxProps = React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>;
interface CheckboxGroupItemProps
extends Omit<CheckboxProps, 'checked' | 'defaultChecked' | 'onCheckedChange' | 'name'> {
value: string;
Expand Down Expand Up @@ -179,7 +180,7 @@ CheckboxGroupItem.displayName = ITEM_NAME;
const INDICATOR_NAME = 'CheckboxGroupIndicator';

type CheckboxGroupIndicatorElement = React.ElementRef<typeof CheckboxPrimitive.Indicator>;
type CheckboxIndicatorProps = Radix.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Indicator>;
type CheckboxIndicatorProps = React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Indicator>;
interface CheckboxGroupIndicatorProps extends CheckboxIndicatorProps {}

const CheckboxGroupIndicator = React.forwardRef<
Expand Down
2 changes: 0 additions & 2 deletions packages/radix-ui-themes/src/components/checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import * as React from 'react';
import classNames from 'classnames';
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
Expand Down
2 changes: 0 additions & 2 deletions packages/radix-ui-themes/src/components/dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import * as React from 'react';
import classNames from 'classnames';
import * as DialogPrimitive from '@radix-ui/react-dialog';
Expand Down
2 changes: 0 additions & 2 deletions packages/radix-ui-themes/src/components/hover-card.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import * as React from 'react';
import classNames from 'classnames';
import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
Expand Down
2 changes: 0 additions & 2 deletions packages/radix-ui-themes/src/components/popover.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import * as React from 'react';
import classNames from 'classnames';
import * as PopoverPrimitive from '@radix-ui/react-popover';
Expand Down
2 changes: 0 additions & 2 deletions packages/radix-ui-themes/src/components/portal.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
'use client';

export { Portal } from '@radix-ui/react-portal';
2 changes: 0 additions & 2 deletions packages/radix-ui-themes/src/components/progress.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import * as React from 'react';
import classNames from 'classnames';
import * as ProgressPrimitive from '@radix-ui/react-progress';
Expand Down
2 changes: 0 additions & 2 deletions packages/radix-ui-themes/src/components/radio-cards.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import * as React from 'react';
import classNames from 'classnames';
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
Expand Down
2 changes: 0 additions & 2 deletions packages/radix-ui-themes/src/components/scroll-area.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import * as React from 'react';
import classNames from 'classnames';
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
Expand Down
2 changes: 0 additions & 2 deletions packages/radix-ui-themes/src/components/separator.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import * as React from 'react';
import classNames from 'classnames';

Expand Down
5 changes: 3 additions & 2 deletions packages/radix-ui-themes/src/components/skeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';
import classNames from 'classnames';
import { Slot } from '@radix-ui/react-slot';

import { inert } from '../helpers/inert.js';
import { extractProps } from '../helpers/extract-props.js';
import { marginPropDefs } from '../props/margin.props.js';
import { skeletonPropDefs } from './skeleton.props.js';
Expand Down Expand Up @@ -34,8 +35,8 @@ const Skeleton = React.forwardRef<SkeletonElement, SkeletonProps>((props, forwar
className={classNames('rt-Skeleton', className)}
data-inline-skeleton={React.isValidElement(children) ? undefined : true}
tabIndex={-1}
// Workaround to use `inert` until https://github.com/facebook/react/pull/24730 is merged.
{...{ inert: true ? '' : undefined }}
// @ts-ignore
inert={inert}
{...skeletonProps}
>
{children}
Expand Down
Loading