diff --git a/.changeset/olive-toys-try.md b/.changeset/olive-toys-try.md new file mode 100644 index 0000000000..2c3875c402 --- /dev/null +++ b/.changeset/olive-toys-try.md @@ -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. diff --git a/babel.config.js b/babel.config.js index 629bd0c472..be16f9c219 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,6 +1,6 @@ module.exports = { plugins: [ - 'emotion', + '@emotion/babel-plugin', ['@babel/plugin-proposal-class-properties', { loose: true }], '@babel/plugin-transform-runtime', ], diff --git a/docs/App/Footer.js b/docs/App/Footer.js index e991fcad58..037bd524cb 100644 --- a/docs/App/Footer.js +++ b/docs/App/Footer.js @@ -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)'; diff --git a/docs/App/GitHubButton.js b/docs/App/GitHubButton.js index 01ffae7ac4..250778a2af 100644 --- a/docs/App/GitHubButton.js +++ b/docs/App/GitHubButton.js @@ -1,6 +1,6 @@ // @flow /** @jsx jsx */ -import { jsx } from '@emotion/core'; +import { jsx } from '@emotion/react'; type Props = { count: number, repo: string }; diff --git a/docs/App/Header.js b/docs/App/Header.js index 303710ed16..c5ac2bc791 100644 --- a/docs/App/Header.js +++ b/docs/App/Header.js @@ -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'; diff --git a/docs/App/PageNav.js b/docs/App/PageNav.js index 03caa781ec..b5e8751ac2 100644 --- a/docs/App/PageNav.js +++ b/docs/App/PageNav.js @@ -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'; diff --git a/docs/App/TwitterButton.js b/docs/App/TwitterButton.js index 1721ca0b9e..76d2eac0f7 100644 --- a/docs/App/TwitterButton.js +++ b/docs/App/TwitterButton.js @@ -1,6 +1,6 @@ // @flow /** @jsx jsx */ -import { jsx } from '@emotion/core'; +import { jsx } from '@emotion/react'; const TwitterButton = () => (
diff --git a/docs/App/components.js b/docs/App/components.js index 25fc7fb8fe..91569c684b 100644 --- a/docs/App/components.js +++ b/docs/App/components.js @@ -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; diff --git a/docs/ExampleWrapper.js b/docs/ExampleWrapper.js index 17869ff5d7..361dd9b02c 100644 --- a/docs/ExampleWrapper.js +++ b/docs/ExampleWrapper.js @@ -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'; diff --git a/docs/Svg.js b/docs/Svg.js index f447953555..59aa15e10e 100644 --- a/docs/Svg.js +++ b/docs/Svg.js @@ -1,6 +1,6 @@ // @flow /** @jsx jsx */ -import { jsx } from '@emotion/core'; +import { jsx } from '@emotion/react'; const Svg = ({ size, ...props }: { size: number }) => ( { @@ -14,11 +15,14 @@ export default class NonceProvider extends Component { 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 ( {this.props.children} ); diff --git a/packages/react-select/src/__tests__/Select.test.js b/packages/react-select/src/__tests__/Select.test.js index abc098c6b5..38fba15734 100644 --- a/packages/react-select/src/__tests__/Select.test.js +++ b/packages/react-select/src/__tests__/Select.test.js @@ -12,7 +12,7 @@ import { } from './constants'; import Select from '../Select'; -import { matchers } from 'jest-emotion'; +import { matchers } from '@emotion/jest'; expect.extend(matchers); diff --git a/packages/react-select/src/__tests__/__snapshots__/Async.test.js.snap b/packages/react-select/src/__tests__/__snapshots__/Async.test.js.snap index 23814a323b..f49adead6e 100644 --- a/packages/react-select/src/__tests__/__snapshots__/Async.test.js.snap +++ b/packages/react-select/src/__tests__/__snapshots__/Async.test.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`defaults - snapshot 1`] = ` -.emotion-8 { +.emotion-0 { position: relative; box-sizing: border-box; } -.emotion-7 { +.emotion-1 { -webkit-align-items: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; - background-color: hsl(0,0%,100%); - border-color: hsl(0,0%,80%); + background-color: hsl(0, 0%, 100%); + border-color: hsl(0, 0%, 80%); border-radius: 4px; border-style: solid; border-width: 1px; @@ -21,23 +21,23 @@ exports[`defaults - snapshot 1`] = ` display: -webkit-flex; display: -ms-flexbox; display: flex; + -webkit-box-flex-wrap: wrap; -webkit-flex-wrap: wrap; -ms-flex-wrap: wrap; flex-wrap: wrap; -webkit-box-pack: justify; -webkit-justify-content: space-between; - -ms-flex-pack: justify; justify-content: space-between; min-height: 38px; - outline: 0 !important; + outline: 0!important; position: relative; -webkit-transition: all 100ms; transition: all 100ms; box-sizing: border-box; } -.emotion-7:hover { - border-color: hsl(0,0%,70%); +.emotion-1:hover { + border-color: hsl(0, 0%, 70%); } .emotion-2 { @@ -52,6 +52,7 @@ exports[`defaults - snapshot 1`] = ` -webkit-flex: 1; -ms-flex: 1; flex: 1; + -webkit-box-flex-wrap: wrap; -webkit-flex-wrap: wrap; -ms-flex-wrap: wrap; flex-wrap: wrap; @@ -62,28 +63,29 @@ exports[`defaults - snapshot 1`] = ` box-sizing: border-box; } -.emotion-0 { - color: hsl(0,0%,50%); +.emotion-3 { + color: hsl(0, 0%, 50%); margin-left: 2px; margin-right: 2px; position: absolute; top: 50%; -webkit-transform: translateY(-50%); + -moz-transform: translateY(-50%); -ms-transform: translateY(-50%); transform: translateY(-50%); box-sizing: border-box; } -.emotion-1 { +.emotion-4 { margin: 2px; padding-bottom: 2px; padding-top: 2px; visibility: visible; - color: hsl(0,0%,20%); + color: hsl(0, 0%, 20%); box-sizing: border-box; } -.emotion-6 { +.emotion-5 { -webkit-align-items: center; -webkit-box-align: center; -ms-flex-align: center; @@ -101,19 +103,19 @@ exports[`defaults - snapshot 1`] = ` box-sizing: border-box; } -.emotion-3 { +.emotion-6 { -webkit-align-self: stretch; -ms-flex-item-align: stretch; align-self: stretch; - background-color: hsl(0,0%,80%); + background-color: hsl(0, 0%, 80%); margin-bottom: 8px; margin-top: 8px; width: 1px; box-sizing: border-box; } -.emotion-5 { - color: hsl(0,0%,80%); +.emotion-7 { + color: hsl(0, 0%, 80%); display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -124,11 +126,11 @@ exports[`defaults - snapshot 1`] = ` box-sizing: border-box; } -.emotion-5:hover { - color: hsl(0,0%,60%); +.emotion-7:hover { + color: hsl(0, 0%, 60%); } -.emotion-4 { +.emotion-8 { display: inline-block; fill: currentColor; line-height: 1; @@ -138,21 +140,21 @@ exports[`defaults - snapshot 1`] = `
Select...