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

Upgrade to Emotion 11 #32930

Merged
merged 21 commits into from
Jun 24, 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
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module.exports = ( api ) => {

return {
presets: [ '@wordpress/babel-preset-default' ],
plugins: [ 'babel-plugin-emotion', 'babel-plugin-inline-json-import' ],
plugins: [ '@emotion/babel-plugin', 'babel-plugin-inline-json-import' ],
};
};
491 changes: 396 additions & 95 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@
"@babel/plugin-syntax-jsx": "7.12.13",
"@babel/runtime-corejs3": "7.13.10",
"@babel/traverse": "7.13.0",
"@emotion/native": "10.0.27",
"@emotion/babel-plugin": "11.3.0",
"@emotion/jest": "11.3.0",
"@emotion/native": "^11.0.0",
"@octokit/rest": "16.26.0",
"@octokit/webhooks": "7.1.0",
"@storybook/addon-a11y": "6.2.5",
Expand Down Expand Up @@ -147,7 +149,6 @@
"appium": "1.20.2",
"babel-jest": "26.6.3",
"babel-loader": "8.2.2",
"babel-plugin-emotion": "10.2.2",
"babel-plugin-inline-json-import": "0.3.2",
"babel-plugin-react-native-classname-to-style": "1.2.2",
"babel-plugin-react-native-platform-specific-extensions": "1.1.1",
Expand All @@ -174,7 +175,6 @@
"husky": "6.0.0",
"inquirer": "7.1.0",
"jest": "26.6.3",
"jest-emotion": "10.0.32",
"jest-junit": "11.0.0",
"jest-serializer-enzyme": "1.0.0",
"jest-watch-typeahead": "0.6.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ColorPaletteControl matches the snapshot 1`] = `
.emotion-2 {
.emotion-0 {
font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;
font-size: 13px;
}

.emotion-0 {
.emotion-2 {
margin-bottom: calc(4px * 2);
}

.components-panel__row .emotion-0 {
.components-panel__row .emotion-2 {
margin-bottom: inherit;
}

<div
className="components-base-control block-editor-color-gradient-control emotion-2 emotion-3"
className="components-base-control block-editor-color-gradient-control emotion-0 emotion-1"
>
<div
className="components-base-control__field emotion-0 emotion-1"
className="components-base-control__field emotion-2 emotion-3"
>
<fieldset>
<legend>
Expand Down
9 changes: 4 additions & 5 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
],
"dependencies": {
"@babel/runtime": "^7.13.10",
"@emotion/cache": "^10.0.27",
"@emotion/core": "^10.1.1",
"@emotion/css": "^10.0.22",
"@emotion/styled": "^10.0.23",
"@emotion/cache": "^11.1.3",
"@emotion/css": "^11.1.3",
"@emotion/react": "^11.1.5",
"@emotion/styled": "^11.3.0",
"@wordpress/a11y": "file:../a11y",
"@wordpress/compose": "file:../compose",
"@wordpress/date": "file:../date",
Expand All @@ -51,7 +51,6 @@
"classnames": "^2.2.5",
"dom-scroll-into-view": "^1.2.1",
"downshift": "^6.0.15",
"emotion": "^10.0.23",
"gradient-parser": "^0.1.5",
"highlight-words-core": "^1.2.2",
"lodash": "^4.17.21",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import styled from '@emotion/styled';
import { css } from '@emotion/core';
import { css } from '@emotion/react';

/**
* Internal dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import styled from '@emotion/styled';
import { css } from '@emotion/core';
import { css } from '@emotion/react';

/**
* Internal dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/base-field/hook.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { cx } from 'emotion';
import { cx } from '@emotion/css';

/**
* WordPress dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/base-field/styles.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { css } from 'emotion';
import { css } from '@emotion/css';

/**
* Internal dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Snapshot Diff:
- Received styles
+ Base styles

@@ -12,11 +12,11 @@
@@ -11,11 +11,11 @@
"-webkit-justify-content": "space-between",
"-webkit-transition": "border-color 100ms ease",
"align-items": "center",
Expand All @@ -25,7 +25,7 @@ Snapshot Diff:
- Received styles
+ Base styles

@@ -15,18 +15,17 @@
@@ -14,19 +14,18 @@
"background": "#fff",
"border": "1px solid",
"border-color": "#757575",
Expand All @@ -45,6 +45,7 @@ Snapshot Diff:
- "width": "auto",
+ "width": "100%",
},
Object {},
]
`;

Expand All @@ -53,7 +54,7 @@ Snapshot Diff:
- Received styles
+ Base styles

@@ -11,11 +11,10 @@
@@ -10,11 +10,10 @@
"-webkit-flex-direction": "row",
"-webkit-justify-content": "space-between",
"-webkit-transition": "border-color 100ms ease",
Expand Down Expand Up @@ -82,7 +83,6 @@ exports[`base field should render correctly 1`] = `
flex-direction: row;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
justify-content: space-between;
width: 100%;
background: #fff;
Expand All @@ -106,17 +106,16 @@ exports[`base field should render correctly 1`] = `
width: 100%;
}

.emotion-0 > * + *:not(marquee) {
.emotion-0>*+*:not(marquee) {
margin-left: calc(4px * 2);
}

.emotion-0 > * {
.emotion-0>* {
min-width: 0;
}

@media ( prefers-reduced-motion:reduce ) {
@media ( prefers-reduced-motion: reduce ) {
.emotion-0 {
-webkit-transition-duration: 0ms;
transition-duration: 0ms;
}
}
Expand All @@ -131,7 +130,7 @@ exports[`base field should render correctly 1`] = `

.emotion-0:focus,
.emotion-0[data-focused='true'] {
border-color: var( --wp-admin-theme-color,#00669b);
border-color: var( --wp-admin-theme-color, #00669b);
box-shadow: 0 0 0,0.5px,[object Object];
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { css } from '@emotion/core';
import { css } from '@emotion/react';
import styled from '@emotion/styled';

export const Root = styled.span`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { css } from '@emotion/core';
import { css } from '@emotion/react';
import styled from '@emotion/styled';
/**
* Internal dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { css } from '@emotion/core';
import { css } from '@emotion/react';
import styled from '@emotion/styled';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/card/card-body/hook.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { cx } from 'emotion';
import { cx } from '@emotion/css';

/**
* WordPress dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/card/card-divider/hook.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { cx } from 'emotion';
import { cx } from '@emotion/css';

/**
* WordPress dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/card/card-footer/hook.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { cx } from 'emotion';
import { cx } from '@emotion/css';

/**
* WordPress dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/card/card-header/hook.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { cx } from 'emotion';
import { cx } from '@emotion/css';

/**
* WordPress dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/card/card-media/hook.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { cx } from 'emotion';
import { cx } from '@emotion/css';

/**
* WordPress dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/card/card/component.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { css } from 'emotion';
import { css } from '@emotion/css';

/**
* WordPress dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/card/card/hook.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { cx } from 'emotion';
import { cx } from '@emotion/css';

/**
* WordPress dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/card/styles.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { css } from 'emotion';
import { css } from '@emotion/css';

/**
* Internal dependencies
Expand Down
Loading