Skip to content

Commit

Permalink
Flex: Remove flex gap polyfill (#43995)
Browse files Browse the repository at this point in the history
* Flex: Use native flex gap

* Fix style hacks in InputControl

- Fixes regression in CustomSelectControl
- Fixes styles for labelPosition='bottom'

* InputControl: Remove redundant styles

* Update snapshots

* Add changelog
  • Loading branch information
mirka authored Sep 12, 2022
1 parent 6918aea commit 77b940d
Show file tree
Hide file tree
Showing 18 changed files with 144 additions and 392 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,12 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
gap: calc(4px * 1);
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
justify-content: space-between;
}
.emotion-4>*+*:not( marquee ) {
margin-top: calc(4px * 1);
}
.emotion-4>* {
min-height: 0;
}
Expand All @@ -64,15 +61,12 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
gap: calc(4px * 3);
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
justify-content: space-between;
}
.emotion-8>*+*:not( marquee ) {
margin-top: calc(4px * 3);
}
.emotion-8>* {
min-height: 0;
}
Expand All @@ -89,16 +83,13 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
gap: calc(4px * 2);
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
justify-content: space-between;
width: 100%;
}
.emotion-10>*+*:not( marquee ) {
margin-left: calc(4px * 2);
}
.emotion-10>* {
min-width: 0;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
### Bug Fix

- `Button`, `Icon`: Fix `iconSize` prop doesn't work with some icons ([#43821](https://github.com/WordPress/gutenberg/pull/43821)).
- `InputControl`, `NumberControl`, `UnitControl`: Fix margin when `labelPosition` is `bottom` ([#43995](https://github.com/WordPress/gutenberg/pull/43995)).
- `Popover`: enable auto-updating every animation frame ([#43617](https://github.com/WordPress/gutenberg/pull/43617)).
- `Popover`: improve the component's performance and reactivity to prop changes by reworking its internals ([#43335](https://github.com/WordPress/gutenberg/pull/43335)).
- `NavigatorScreen`: updated to satisfy `react/exhaustive-deps` eslint rule ([#43876](https://github.com/WordPress/gutenberg/pull/43876))
Expand All @@ -20,6 +21,7 @@
- `ToggleControl`: Add `__nextHasNoMargin` prop for opting into the new margin-free styles ([#43717](https://github.com/WordPress/gutenberg/pull/43717)).
- `CheckboxControl`: Add `__nextHasNoMargin` prop for opting into the new margin-free styles ([#43720](https://github.com/WordPress/gutenberg/pull/43720)).
- `TextControl`, `TextareaControl`: Add `__nextHasNoMargin` prop for opting into the new margin-free styles ([#43782](https://github.com/WordPress/gutenberg/pull/43782)).
- `Flex`: Remove margin-based polyfill implementation of flex `gap` ([#43995](https://github.com/WordPress/gutenberg/pull/43995)).
- `RangeControl`: Tweak dark gray marking color to be consistent with the grays in `@wordpress/base-styles` ([#43773](https://github.com/WordPress/gutenberg/pull/43773)).
- `UnitControl`: Tweak unit dropdown color to be consistent with the grays in `@wordpress/base-styles` ([#43773](https://github.com/WordPress/gutenberg/pull/43773)).
- `SearchControl`: Add `__nextHasNoMargin` prop for opting into the new margin-free styles ([#43871](https://github.com/WordPress/gutenberg/pull/43871)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Snapshot Diff:
- Received styles
+ Base styles
@@ -14,18 +14,17 @@
@@ -14,19 +14,18 @@
"background": "#fff",
"border": "1px solid",
"border-color": "#757575",
Expand All @@ -36,6 +36,7 @@ Snapshot Diff:
"flex": "1",
"flex-direction": "row",
"font-size": "13px",
"gap": "calc(4px * 2)",
"justify-content": "space-between",
"outline": "none",
"padding": "0 8px",
Expand Down Expand Up @@ -80,6 +81,7 @@ exports[`base field should render correctly 1`] = `
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
gap: calc(4px * 2);
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
justify-content: space-between;
Expand All @@ -105,10 +107,6 @@ exports[`base field should render correctly 1`] = `
width: 100%;
}
.emotion-0>*+*:not( marquee ) {
margin-left: calc(4px * 2);
}
.emotion-0>* {
min-width: 0;
}
Expand Down
52 changes: 20 additions & 32 deletions packages/components/src/card/test/__snapshots__/index.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ Snapshot Diff:
@@ -1,8 +1,8 @@
<div>
<div
- class="components-flex components-card__footer components-card-footer css-p1v47q-View-Flex-sx-Base-sx-Items-ItemsRow-Footer-borderRadius-borderColor-medium e19lxcc00"
+ class="components-flex components-card__footer components-card-footer css-skr34d-View-Flex-sx-Base-sx-Items-ItemsRow-Footer-borderRadius-borderColor-medium-shady e19lxcc00"
- class="components-flex components-card__footer components-card-footer css-120suhd-View-Flex-base-ItemsRow-Footer-borderRadius-borderColor-medium e19lxcc00"
+ class="components-flex components-card__footer components-card-footer css-19jxwll-View-Flex-base-ItemsRow-Footer-borderRadius-borderColor-medium-shady e19lxcc00"
data-wp-c16t="true"
data-wp-component="CardFooter"
>
Expand All @@ -59,8 +59,8 @@ Snapshot Diff:
@@ -1,8 +1,8 @@
<div>
<div
- class="components-flex components-card__footer components-card-footer css-p1v47q-View-Flex-sx-Base-sx-Items-ItemsRow-Footer-borderRadius-borderColor-medium e19lxcc00"
+ class="components-flex components-card__footer components-card-footer css-gg08fg-View-Flex-sx-Base-sx-Items-ItemsRow-Footer-borderRadius-borderColor-medium e19lxcc00"
- class="components-flex components-card__footer components-card-footer css-120suhd-View-Flex-base-ItemsRow-Footer-borderRadius-borderColor-medium e19lxcc00"
+ class="components-flex components-card__footer components-card-footer css-ys33kb-View-Flex-base-ItemsRow-Footer-borderRadius-borderColor-medium e19lxcc00"
data-wp-c16t="true"
data-wp-component="CardFooter"
>
Expand All @@ -76,8 +76,8 @@ Snapshot Diff:
@@ -1,8 +1,8 @@
<div>
<div
- class="components-flex components-card__header components-card-header css-1g5oj2q-View-Flex-sx-Base-sx-Items-ItemsRow-Header-borderRadius-borderColor-medium e19lxcc00"
+ class="components-flex components-card__header components-card-header css-1gv9wvv-View-Flex-sx-Base-sx-Items-ItemsRow-Header-borderRadius-borderColor-medium-shady e19lxcc00"
- class="components-flex components-card__header components-card-header css-3fkkv8-View-Flex-base-ItemsRow-Header-borderRadius-borderColor-medium e19lxcc00"
+ class="components-flex components-card__header components-card-header css-1qktnah-View-Flex-base-ItemsRow-Header-borderRadius-borderColor-medium-shady e19lxcc00"
data-wp-c16t="true"
data-wp-component="CardHeader"
>
Expand All @@ -96,8 +96,8 @@ Snapshot Diff:
class="css-mgwsf4-View-Content e19lxcc00"
>
<div
- class="components-flex components-card__header components-card-header css-1g5oj2q-View-Flex-sx-Base-sx-Items-ItemsRow-Header-borderRadius-borderColor-medium e19lxcc00"
+ class="components-flex components-card__header components-card-header css-1e8ifbz-View-Flex-sx-Base-sx-Items-ItemsRow-Header-borderRadius-borderColor-large e19lxcc00"
- class="components-flex components-card__header components-card-header css-3fkkv8-View-Flex-base-ItemsRow-Header-borderRadius-borderColor-medium e19lxcc00"
+ class="components-flex components-card__header components-card-header css-2feznw-View-Flex-base-ItemsRow-Header-borderRadius-borderColor-large e19lxcc00"
data-wp-c16t="true"
data-wp-component="CardHeader"
>
Expand Down Expand Up @@ -141,8 +141,8 @@ Snapshot Diff:
class="css-mgwsf4-View-Content e19lxcc00"
>
<div
- class="components-flex components-card__header components-card-header css-1uuauve-View-Flex-sx-Base-sx-Items-ItemsRow-Header-borderRadius-borderColor-large-borderless e19lxcc00"
+ class="components-flex components-card__header components-card-header css-yf9nll-View-Flex-sx-Base-sx-Items-ItemsRow-Header-borderRadius-borderColor-small e19lxcc00"
- class="components-flex components-card__header components-card-header css-ed5e1x-View-Flex-base-ItemsRow-Header-borderRadius-borderColor-large-borderless e19lxcc00"
+ class="components-flex components-card__header components-card-header css-1f9ii60-View-Flex-base-ItemsRow-Header-borderRadius-borderColor-small e19lxcc00"
data-wp-c16t="true"
data-wp-component="CardHeader"
>
Expand All @@ -157,8 +157,8 @@ Snapshot Diff:
Body
</div>
<div
- class="components-flex components-card__footer components-card-footer css-s0icc3-View-Flex-sx-Base-sx-Items-ItemsRow-Footer-borderRadius-borderColor-large-borderless e19lxcc00"
+ class="components-flex components-card__footer components-card-footer css-cwhos2-View-Flex-sx-Base-sx-Items-ItemsRow-Footer-borderRadius-borderColor-xSmallCardPadding e19lxcc00"
- class="components-flex components-card__footer components-card-footer css-ide17g-View-Flex-base-ItemsRow-Footer-borderRadius-borderColor-large-borderless e19lxcc00"
+ class="components-flex components-card__footer components-card-footer css-jsws2e-View-Flex-base-ItemsRow-Footer-borderRadius-borderColor-xSmallCardPadding e19lxcc00"
data-wp-c16t="true"
data-wp-component="CardFooter"
>
Expand All @@ -183,8 +183,8 @@ Snapshot Diff:
class="css-mgwsf4-View-Content e19lxcc00"
>
<div
- class="components-flex components-card__header components-card-header css-1uuauve-View-Flex-sx-Base-sx-Items-ItemsRow-Header-borderRadius-borderColor-large-borderless e19lxcc00"
+ class="components-flex components-card__header components-card-header css-yf9nll-View-Flex-sx-Base-sx-Items-ItemsRow-Header-borderRadius-borderColor-small e19lxcc00"
- class="components-flex components-card__header components-card-header css-ed5e1x-View-Flex-base-ItemsRow-Header-borderRadius-borderColor-large-borderless e19lxcc00"
+ class="components-flex components-card__header components-card-header css-1f9ii60-View-Flex-base-ItemsRow-Header-borderRadius-borderColor-small e19lxcc00"
data-wp-c16t="true"
data-wp-component="CardHeader"
>
Expand All @@ -199,8 +199,8 @@ Snapshot Diff:
Body
</div>
<div
- class="components-flex components-card__footer components-card-footer css-s0icc3-View-Flex-sx-Base-sx-Items-ItemsRow-Footer-borderRadius-borderColor-large-borderless e19lxcc00"
+ class="components-flex components-card__footer components-card-footer css-oc4v7j-View-Flex-sx-Base-sx-Items-ItemsRow-Footer-borderRadius-borderColor-small e19lxcc00"
- class="components-flex components-card__footer components-card-footer css-ide17g-View-Flex-base-ItemsRow-Footer-borderRadius-borderColor-large-borderless e19lxcc00"
+ class="components-flex components-card__footer components-card-footer css-1ih54yp-View-Flex-base-ItemsRow-Footer-borderRadius-borderColor-small e19lxcc00"
data-wp-c16t="true"
data-wp-component="CardFooter"
>
Expand Down Expand Up @@ -236,6 +236,7 @@ Object {
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
gap: calc(4px * 2);
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
justify-content: space-between;
Expand All @@ -246,10 +247,6 @@ Object {
padding: calc(4px * 4) calc(4px * 6);
}
.emotion-4>*+*:not( marquee ) {
margin-left: calc(4px * 2);
}
.emotion-4>* {
min-width: 0;
}
Expand Down Expand Up @@ -332,6 +329,7 @@ Object {
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
gap: calc(4px * 2);
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
justify-content: space-between;
Expand All @@ -342,10 +340,6 @@ Object {
padding: calc(4px * 4) calc(4px * 6);
}
.emotion-16>*+*:not( marquee ) {
margin-left: calc(4px * 2);
}
.emotion-16>* {
min-width: 0;
}
Expand Down Expand Up @@ -492,6 +486,7 @@ Object {
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
gap: calc(4px * 2);
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
justify-content: space-between;
Expand All @@ -502,10 +497,6 @@ Object {
padding: calc(4px * 4) calc(4px * 6);
}
.emotion-4>*+*:not( marquee ) {
margin-left: calc(4px * 2);
}
.emotion-4>* {
min-width: 0;
}
Expand Down Expand Up @@ -588,6 +579,7 @@ Object {
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
gap: calc(4px * 2);
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
justify-content: space-between;
Expand All @@ -598,10 +590,6 @@ Object {
padding: calc(4px * 4) calc(4px * 6);
}
.emotion-16>*+*:not( marquee ) {
margin-left: calc(4px * 2);
}
.emotion-16>* {
min-width: 0;
}
Expand Down
Loading

0 comments on commit 77b940d

Please sign in to comment.