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: Support v19 betas in peer dependencies #26960

Merged
merged 14 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -768,30 +768,30 @@ workflows:
requires:
- build
- create-sandboxes:
parallelism: 35
parallelism: 37
requires:
- build
# - smoke-test-sandboxes: # disabled for now
# requires:
# - create-sandboxes
- build-sandboxes:
parallelism: 35
parallelism: 37
requires:
- create-sandboxes
- chromatic-sandboxes:
parallelism: 32
parallelism: 34
requires:
- build-sandboxes
- e2e-production:
parallelism: 30
parallelism: 32
requires:
- build-sandboxes
- e2e-dev:
parallelism: 2
requires:
- create-sandboxes
- test-runner-production:
parallelism: 30
parallelism: 32
requires:
- build-sandboxes
- test-portable-stories:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export default {
docs: {
name: 'ResolvedReact',
},
// the version string changes with every release of React/Next.js/Preact, not worth snapshotting
chromatic: { disable: true },
},
};

Expand Down
2 changes: 1 addition & 1 deletion code/addons/links/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"typescript": "^5.3.2"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta"
},
"peerDependenciesMeta": {
"react": {
Expand Down
5 changes: 5 additions & 0 deletions code/e2e-tests/addon-docs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ test.describe('addon-docs', () => {
expectedReactVersionRange = /^17/;
} else if (templateName.includes('react16')) {
expectedReactVersionRange = /^16/;
} else if (
templateName.includes('react-vite/prerelease') ||
templateName.includes('react-webpack/prerelease')
) {
expectedReactVersionRange = /^19/;
}

// Arrange - Get the actual versions
Expand Down
4 changes: 2 additions & 2 deletions code/frameworks/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@
},
"peerDependencies": {
"next": "^13.5.0 || ^14.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
"webpack": "^5.0.0"
},
"peerDependenciesMeta": {
Expand Down
4 changes: 2 additions & 2 deletions code/frameworks/react-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
"vite": "^4.0.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
"vite": "^4.0.0 || ^5.0.0"
},
"engines": {
Expand Down
4 changes: 2 additions & 2 deletions code/frameworks/react-webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
"@types/node": "^18.0.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
"typescript": ">= 4.2.x"
},
"peerDependenciesMeta": {
Expand Down
44 changes: 44 additions & 0 deletions code/lib/cli/src/sandbox-templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,28 @@ const baseTemplates = {
},
skipTasks: ['bench'],
},
'react-vite/prerelease-ts': {
name: 'React Prerelease (Vite | TypeScript)',
/**
* 1. Create a Vite project with the React template
* 2. Add React beta versions
* 3. Add resolutions for @types/react and @types/react-dom, see https://react.dev/blog/2024/04/25/react-19-upgrade-guide#installing
* 4. Add @types/react and @types/react-dom pointing to the beta packages
*/
script: `
npm create vite --yes {{beforeDir}} -- --template react-ts && \
cd {{beforeDir}} && \
yarn add react@beta react-dom@beta && \
jq '.resolutions += {"@types/react": "npm:types-react@beta", "@types/react-dom": "npm:types-react-dom@beta"}' package.json > tmp.json && mv tmp.json package.json && \
yarn add --dev @types/react@npm:types-react@beta @types/react-dom@npm:types-react-dom@beta
`,
expected: {
framework: '@storybook/react-vite',
renderer: '@storybook/react',
builder: '@storybook/builder-vite',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'react-webpack/18-ts': {
name: 'React Latest (Webpack | TypeScript)',
script: 'yarn create webpack5-react {{beforeDir}}',
Expand All @@ -222,6 +244,26 @@ const baseTemplates = {
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'react-webpack/prerelease-ts': {
name: 'React Prerelease (Webpack | TypeScript)',
/**
* 1. Create a Webpack project with React beta versions
* 3. Add resolutions for @types/react and @types/react-dom, see https://react.dev/blog/2024/04/25/react-19-upgrade-guide#installing
* 4. Add @types/react and @types/react-dom pointing to the beta packages
*/
script: `
yarn create webpack5-react {{beforeDir}} --version-react="beta" --version-react-dom="beta" && \
cd {{beforeDir}} && \
jq '.resolutions += {"@types/react": "npm:types-react@beta", "@types/react-dom": "npm:types-react-dom@beta"}' package.json > tmp.json && mv tmp.json package.json && \
yarn add --dev @types/react@npm:types-react@beta @types/react-dom@npm:types-react-dom@beta
`,
expected: {
framework: '@storybook/react-webpack5',
renderer: '@storybook/react',
builder: '@storybook/builder-webpack5',
},
skipTasks: ['e2e-tests-dev', 'bench'],
},
'solid-vite/default-js': {
name: 'SolidJS Latest (Vite | JavaScript)',
script: 'npx degit solidjs/templates/js {{beforeDir}}',
Expand Down Expand Up @@ -628,6 +670,8 @@ export const daily: TemplateKey[] = [
'angular-cli/prerelease',
'cra/default-js',
'react-vite/default-js',
'react-vite/prerelease-ts',
'react-webpack/prerelease-ts',
'vue3-vite/default-js',
'vue-cli/default-js',
'lit-vite/default-js',
Expand Down
4 changes: 2 additions & 2 deletions code/lib/react-dom-shim/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"typescript": "^5.3.2"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions code/lib/theming/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
"typescript": "^5.3.2"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta"
},
"peerDependenciesMeta": {
"react": {
Expand Down
4 changes: 2 additions & 2 deletions code/presets/react-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
"typescript": "^5.3.2"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta"
},
"peerDependenciesMeta": {
"typescript": {
Expand Down
4 changes: 2 additions & 2 deletions code/renderers/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
"require-from-string": "^2.0.2"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
"typescript": ">= 4.2.x"
},
"peerDependenciesMeta": {
Expand Down
4 changes: 2 additions & 2 deletions code/ui/blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
"@types/color-convert": "^2.0.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta"
},
"peerDependenciesMeta": {
"react": {
Expand Down
5 changes: 1 addition & 4 deletions code/ui/blocks/src/components/Source.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const Source: FunctionComponent<SourceProps> = ({
language,
code,
dark,
format,
format = false,
...rest
}) => {
const { typography } = useTheme();
Expand Down Expand Up @@ -138,7 +138,4 @@ const Source: FunctionComponent<SourceProps> = ({
);
};

Source.defaultProps = {
format: false,
};
export { Source, StyledSyntaxHighlighter };
4 changes: 2 additions & 2 deletions code/ui/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
"use-resize-observer": "^9.1.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 0 additions & 4 deletions code/ui/components/src/components/form/field/field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,3 @@ export const Field = ({ label, children, ...props }: FieldProps) => (
{children}
</Wrapper>
);

Field.defaultProps = {
label: undefined,
};
21 changes: 6 additions & 15 deletions code/ui/components/src/components/tabs/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@ export interface TabsProps {
export const Tabs: FC<TabsProps> = memo(
({
children,
selected,
selected = null,
actions,
absolute,
bordered,
tools,
absolute = false,
bordered = false,
tools = null,
backgroundColor,
id: htmlId,
menuName,
id: htmlId = null,
menuName = 'Tabs',
emptyState,
showToolsWhenEmpty,
}) => {
Expand Down Expand Up @@ -206,15 +206,6 @@ export const Tabs: FC<TabsProps> = memo(
}
);
Tabs.displayName = 'Tabs';
Tabs.defaultProps = {
id: null,
children: null,
tools: null,
selected: null,
absolute: false,
bordered: false,
menuName: 'Tabs',
};

export interface TabsStateProps {
children: TabsProps['children'];
Expand Down
33 changes: 11 additions & 22 deletions code/ui/components/src/components/tooltip/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,18 @@ export interface ListItemProps extends Omit<ComponentProps<typeof Item>, 'href'
}

const ListItem = ({
loading,
title,
center,
right,
icon,
active,
disabled,
loading = false,
title = <span>Loading state</span>,
center = null,
right = null,

active = false,
disabled = false,
isIndented,
href,
onClick,
LinkWrapper,
href = null,
onClick = null,
icon,
LinkWrapper = null,
...rest
}: ListItemProps) => {
const itemProps = getItemProps(onClick, href, LinkWrapper);
Expand All @@ -220,16 +221,4 @@ const ListItem = ({
);
};

ListItem.defaultProps = {
loading: false,
title: <span>Loading state</span>,
center: null,
right: null,
active: false,
disabled: false,
href: null,
LinkWrapper: null,
onClick: null,
};

export default ListItem;
18 changes: 10 additions & 8 deletions code/ui/components/src/components/tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,16 @@ export interface TooltipProps {

export const Tooltip = React.forwardRef<HTMLDivElement, TooltipProps>(
(
{ placement, hasChrome, children, arrowProps, tooltipRef, color, withArrows, ...props },
{
placement = 'top',
hasChrome = true,
children,
arrowProps = {},
tooltipRef,
color,
withArrows,
...props
},
ref
) => {
return (
Expand All @@ -139,10 +148,3 @@ export const Tooltip = React.forwardRef<HTMLDivElement, TooltipProps>(
);

Tooltip.displayName = 'Tooltip';
Tooltip.defaultProps = {
color: undefined,
tooltipRef: undefined,
hasChrome: true,
placement: 'top',
arrowProps: {},
};
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export interface TooltipLinkListProps {
LinkWrapper?: LinkWrapperType;
}

export const TooltipLinkList = ({ links, LinkWrapper }: TooltipLinkListProps) => {
export const TooltipLinkList = ({ links, LinkWrapper = null }: TooltipLinkListProps) => {
const hasIcon = links.some((link) => link.icon);
return (
<List>
Expand All @@ -68,7 +68,3 @@ export const TooltipLinkList = ({ links, LinkWrapper }: TooltipLinkListProps) =>
</List>
);
};

TooltipLinkList.defaultProps = {
LinkWrapper: ListItem.defaultProps.LinkWrapper,
};
6 changes: 0 additions & 6 deletions code/ui/components/src/components/tooltip/TooltipMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,3 @@ export const TooltipMessage = ({ title, desc, links }: TooltipMessageProps) => {
</MessageWrapper>
);
};

TooltipMessage.defaultProps = {
title: null,
desc: null,
links: null,
};
Loading
Loading