Skip to content

Upgrades Emotion to v11 #4283

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

Merged
merged 11 commits into from
Jan 22, 2021
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
8 changes: 8 additions & 0 deletions .changeset/olive-toys-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@react-select/docs': major
'react-select': major
---

Upgrades Emotion dependency to v11.0.0

BREAKING CHANGE: The NonceProvider component now requires a `cacheKey` prop that corresponds to the `key` for the Emotion cache.
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
plugins: [
'emotion',
'@emotion/babel-plugin',
['@babel/plugin-proposal-class-properties', { loose: true }],
'@babel/plugin-transform-runtime',
],
Expand Down
2 changes: 1 addition & 1 deletion docs/App/Footer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
/** @jsx jsx */
import { type Node } from 'react';
import { jsx } from '@emotion/core';
import { jsx } from '@emotion/react';

// const smallDevice = '@media (max-width: 769px)';
const largeDevice = '@media (min-width: 770px)';
Expand Down
2 changes: 1 addition & 1 deletion docs/App/GitHubButton.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
/** @jsx jsx */
import { jsx } from '@emotion/core';
import { jsx } from '@emotion/react';

type Props = { count: number, repo: string };

Expand Down
2 changes: 1 addition & 1 deletion docs/App/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/** @jsx jsx */
import fetch from 'unfetch';
import { Component, type Node } from 'react';
import { jsx } from '@emotion/core';
import { jsx } from '@emotion/react';
import { withRouter } from 'react-router-dom';

import Select from 'react-select';
Expand Down
2 changes: 1 addition & 1 deletion docs/App/PageNav.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
/** @jsx jsx */
import { Component, type ElementRef } from 'react';
import { jsx } from '@emotion/core';
import { jsx } from '@emotion/react';
import { Route, Switch } from 'react-router-dom';

import type { RouterProps } from '../types';
Expand Down
2 changes: 1 addition & 1 deletion docs/App/TwitterButton.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
/** @jsx jsx */
import { jsx } from '@emotion/core';
import { jsx } from '@emotion/react';

const TwitterButton = () => (
<div css={{ alignItems: 'center', display: 'inline-flex' }}>
Expand Down
2 changes: 1 addition & 1 deletion docs/App/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/** @jsx jsx */
import { Component, type ElementConfig } from 'react';
import { Link, withRouter } from 'react-router-dom';
import { jsx } from '@emotion/core';
import { jsx } from '@emotion/react';

const navWidth = 180;
const appWidth = 800;
Expand Down
2 changes: 1 addition & 1 deletion docs/ExampleWrapper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @jsx jsx */
import { jsx } from '@emotion/core'; // eslint-disable-line no-unused-vars
import { jsx } from '@emotion/react'; // eslint-disable-line no-unused-vars
import { Component } from 'react';
import CodeSandboxer from 'react-codesandboxer';
import { CodeBlock } from './markdown/renderer';
Expand Down
2 changes: 1 addition & 1 deletion docs/Svg.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
/** @jsx jsx */
import { jsx } from '@emotion/core';
import { jsx } from '@emotion/react';

const Svg = ({ size, ...props }: { size: number }) => (
<svg
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/Experimental.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
/** @jsx jsx */
import { Component } from 'react';
import { jsx } from '@emotion/core';
import { jsx } from '@emotion/react';
import moment from 'moment';
import chrono from 'chrono-node';

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/Popout.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @jsx jsx */
import { Component } from 'react';
import { jsx } from '@emotion/core';
import { jsx } from '@emotion/react';
import Button from '@atlaskit/button';

import Select from 'react-select';
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/StyleCompositionExample.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @jsx jsx */
import { jsx } from '@emotion/core';
import { jsx } from '@emotion/react';
import Select from 'react-select';
import { colourOptions } from '../data';

Expand Down
2 changes: 1 addition & 1 deletion docs/markdown/renderer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow
/** @jsx emotionJSX */
import md from 'react-markings';
import { jsx as emotionJSX } from '@emotion/core'; // eslint-disable-line no-unused-vars
import { jsx as emotionJSX } from '@emotion/react'; // eslint-disable-line no-unused-vars
import { Link as RRLink } from 'react-router-dom';

import Svg from '../Svg';
Expand Down
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/runtime": "^7.4.4",
"@emotion/core": "^10.0.9",
"@emotion/babel-plugin": "^11.0.0",
"@emotion/react": "^11.1.1",
"babel-loader": "^8.0.0",
"babel-plugin-emotion": "^10.0.9",
"chroma-js": "^1.3.6",
"chrono-node": "^1.3.5",
"codesandboxer": "^0.1.1",
Expand Down
2 changes: 1 addition & 1 deletion docs/styled-components.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
/** @jsx emotionJSX */
import { jsx as emotionJSX } from '@emotion/core';
import { jsx as emotionJSX } from '@emotion/react';

import SyntaxHighlighter, {
registerLanguage,
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
"@babel/runtime": "^7.4.4",
"@changesets/cli": "^2.0.3",
"@changesets/get-github-info": "^0.2.1",
"@emotion/cache": "^10.0.9",
"@emotion/core": "^10.0.9",
"@emotion/css": "^10.0.9",
"@emotion/babel-plugin": "^11.0.0",
"@emotion/cache": "^11.0.0",
"@emotion/css": "^11.0.0",
"@emotion/jest": "^11.1.0",
"@emotion/react": "^11.1.1",
"@preconstruct/cli": "^1.0.0",
"@testing-library/dom": "7.0.4",
"@testing-library/jest-dom": "5.1.1",
Expand All @@ -37,7 +39,6 @@
"babel-eslint": "^9.0.0",
"babel-jest": "^23.6.0",
"babel-loader": "^8.0.0",
"babel-plugin-emotion": "^10.0.9",
"bolt-check": "^0.3.0",
"chroma-js": "^1.3.6",
"chrono-node": "^1.3.5",
Expand All @@ -60,7 +61,6 @@
"gh-pages": "^1.1.0",
"html-webpack-plugin": "^3.2.0",
"jest": "^25.1.0",
"jest-emotion": "^10.0.11",
"jest-in-case": "^1.0.2",
"memoize-one": "^5.0.0",
"moment": "^2.20.1",
Expand Down Expand Up @@ -133,7 +133,7 @@
"./test-setup.js"
],
"snapshotSerializers": [
"jest-emotion"
"@emotion/jest/serializer"
]
},
"workspaces": [
Expand Down
6 changes: 3 additions & 3 deletions packages/react-select/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"repository": "https://github.com/JedWatson/react-select/tree/master/packages/react-select",
"dependencies": {
"@babel/runtime": "^7.4.4",
"@emotion/cache": "^10.0.9",
"@emotion/core": "^10.0.9",
"@emotion/css": "^10.0.9",
"@emotion/cache": "^11.0.0",
"@emotion/css": "^11.0.0",
"@emotion/react": "^11.1.1",
"memoize-one": "^5.0.0",
"prop-types": "^15.6.0",
"react-input-autosize": "^3.0.0",
Expand Down
12 changes: 8 additions & 4 deletions packages/react-select/src/NonceProvider.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
// @flow
import React, { Component, type Node } from 'react';
import { CacheProvider } from '@emotion/core';
import { CacheProvider } from '@emotion/react';
import createCache from '@emotion/cache';
import memoizeOne from 'memoize-one';

type NonceProviderProps = {
nonce: string,
children: Node,
cacheKey: string,
};

export default class NonceProvider extends Component<NonceProviderProps> {
constructor(props: NonceProviderProps) {
super(props);
this.createEmotionCache = memoizeOne(this.createEmotionCache);
}
createEmotionCache = (nonce: string) => {
return createCache({ nonce });
createEmotionCache = (nonce: string, key: string) => {
return createCache({ nonce, key });
};
render() {
const emotionCache = this.createEmotionCache(this.props.nonce);
const emotionCache = this.createEmotionCache(
this.props.nonce,
this.props.cacheKey
);
return (
<CacheProvider value={emotionCache}>{this.props.children}</CacheProvider>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-select/src/__tests__/Select.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from './constants';
import Select from '../Select';

import { matchers } from 'jest-emotion';
import { matchers } from '@emotion/jest';

expect.extend(matchers);

Expand Down
Loading