Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d7dae8a
Site Editor: Disable the revision button if there is no clickable men…
t-hamano Jun 25, 2023
362d148
Improve LinkControl Edit UI (#51712)
richtabor Jun 26, 2023
132f8b9
Update colors (#51856)
jameskoster Jun 26, 2023
844a804
Library: Fix misalignment of description in custom template parts (#5…
t-hamano Jun 26, 2023
9ee0bfd
Backport adding the distraction free mode to the site editor (#51173)…
priethor Jun 27, 2023
ac3de89
Fix toolbar overlap in site editor (#51810)
draganescu Jun 23, 2023
fb8efb9
Page Content Focus: Switch to Page panel when deselecting a block (#5…
noisysocks Jun 26, 2023
553fbed
Don't show 'Back to page' notification when navigating away from page…
noisysocks Jun 27, 2023
bef847d
Add top margin to page details (#51858)
jameskoster Jun 26, 2023
d1a6d07
Keep framer-motion from updating minor version (#51894)
tellthemachines Jun 27, 2023
e58fb9d
useBlockSync(): Reset inner blocks when component unmounts (#51783)
noisysocks Jun 27, 2023
1472d94
BlockLockModal: restore focus on fallback toolbar button when origina…
ciampo Jun 26, 2023
ce38b89
Fix missing MenuGroup in header more menu (#51860)
richtabor Jun 26, 2023
b734da6
Add `manage all custom patterns` command (#51845)
ntsekouras Jun 26, 2023
340833e
Command center: Add another batch of commands to the site editor (#51…
youknowriad Jun 25, 2023
64ed918
Fix delete shortcut incorrectly bound to non-user patterns (#51830)
talldan Jun 23, 2023
60e8c8e
`ConfirmDialog`: Fix affirmative action being triggered an extra time…
talldan Jun 23, 2023
3ead31a
Ensure there is always a Navigation available in the browse mode side…
getdave Jun 23, 2023
d04f19f
Add image block aspect ratio control (#51545)
ajlende Jun 23, 2023
0a92405
Site Editor: Make string to add Template parts & Patterns consistent …
t-hamano Jun 23, 2023
d5014db
Site Editor Sidebar: improvements to buttons (#51762)
ciampo Jun 23, 2023
f315a17
Fix more icons for high resolution devices (#51768)
richtabor Jun 23, 2023
8e544a4
Hide block toolbar using CSS when it is empty (#51779)
noisysocks Jun 23, 2023
62bdc0a
Update the add template modal design (#51806)
jameskoster Jun 23, 2023
bd97387
Buttons Block: Fix for orientation-based block movers (#51831)
t-hamano Jun 23, 2023
a7c4b8f
Button: Introduce `size` prop (#51842)
mirka Jun 23, 2023
000fc8b
Color (#51847)
jameskoster Jun 23, 2023
b64aabb
Only show Page Content Focus commands when in edit mode (#51888)
noisysocks Jun 26, 2023
da17fa8
Add UI commands to the post editor (#51900)
youknowriad Jun 26, 2023
4f0d57f
ZStack: fix component bounding box to match children (#51836)
ciampo Jun 26, 2023
9292d09
Add view patterns plural label. (#51850)
afercia Jun 25, 2023
c3283d6
Fix css styles in block.jsons. (#51866)
spacedmonkey Jun 24, 2023
1a140db
Update active item appearance in Library (#51848)
jameskoster Jun 23, 2023
bd853d5
Fix Rename in Navigation on Browse Mode (#51791)
getdave Jun 23, 2023
be4546d
Fix ability to click through to Template Parts in Library (#51838)
getdave Jun 23, 2023
b909d90
ItemGroup: Update button focus styles to use `:focus-visible` (#51787)
mikachan Jun 23, 2023
a1477d0
Merge branch 'release/16.1' into add/latest-bugfixes-16-1-rc2
tellthemachines Jun 27, 2023
c65eced
Update package-lock
tellthemachines Jun 27, 2023
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
Prev Previous commit
Next Next commit
ZStack: fix component bounding box to match children (#51836)
* ZStack: rewrite using CSS grid

* Use first-of-type instead of fist-child

* CHANGELOG

* Improve comment

* Apply styles once in the parent wrapper

* Avoid each child view from expanding to all available space

* Remove unnecessary wrapeprs in storybook exmaple
  • Loading branch information
ciampo authored and tellthemachines committed Jun 27, 2023
commit 4f0d57f129162b141902866a28a2d12dcf05a345
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- `Button`: Remove unnecessary margin from dashicon ([#51395](https://github.com/WordPress/gutenberg/pull/51395)).
- `Autocomplete`: Announce how many results are available to screen readers when suggestions list first renders ([#51018](https://github.com/WordPress/gutenberg/pull/51018)).
- `ConfirmDialog`: Ensure onConfirm isn't called an extra time when submitting one of the buttons using the keyboard ([#51730](https://github.com/WordPress/gutenberg/pull/51730)).
- `ZStack`: ZStack: fix component bounding box to match children ([#51836](https://github.com/WordPress/gutenberg/pull/51836)).

### Internal

Expand Down
6 changes: 4 additions & 2 deletions packages/components/src/z-stack/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ function UnconnectedZStack(

const clonedChildren = validChildren.map( ( child, index ) => {
const zIndex = isReversed ? childrenLastIndex - index : index;
const offsetAmount = offset * index;
// Only when the component is layered, the offset needs to be multiplied by
// the item's index, so that items can correctly stack at the right distance
const offsetAmount = isLayered ? offset * index : offset;

const key = isValidElement( child ) ? child.key : index;

return (
<ZStackChildView
isLayered={ isLayered }
offsetAmount={ offsetAmount }
zIndex={ zIndex }
key={ key }
Expand All @@ -55,6 +56,7 @@ function UnconnectedZStack(
<ZStackView
{ ...otherProps }
className={ className }
isLayered={ isLayered }
ref={ forwardedRef }
>
{ clonedChildren }
Expand Down
19 changes: 6 additions & 13 deletions packages/components/src/z-stack/stories/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type { ComponentMeta, ComponentStory } from '@storybook/react';
* Internal dependencies
*/
import { Elevation } from '../../elevation';
import { HStack } from '../../h-stack';
import { View } from '../../view';
import { ZStack } from '..';

Expand Down Expand Up @@ -55,18 +54,12 @@ const Avatar = ( {

const Template: ComponentStory< typeof ZStack > = ( args ) => {
return (
<View>
<HStack>
<View>
<ZStack { ...args }>
<Avatar backgroundColor="#444" />
<Avatar backgroundColor="#777" />
<Avatar backgroundColor="#aaa" />
<Avatar backgroundColor="#fff" />
</ZStack>
</View>
</HStack>
</View>
<ZStack { ...args }>
<Avatar backgroundColor="#444" />
<Avatar backgroundColor="#777" />
<Avatar backgroundColor="#aaa" />
<Avatar backgroundColor="#fff" />
</ZStack>
);
};

Expand Down
47 changes: 23 additions & 24 deletions packages/components/src/z-stack/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,35 @@
import { css } from '@emotion/react';
import styled from '@emotion/styled';

/**
* Internal dependencies
*/
import { rtl } from '../utils';

export const ZStackView = styled.div`
display: flex;
position: relative;
`;

export const ZStackChildView = styled.div< {
isLayered: boolean;
offsetAmount: number;
zIndex: number;
} >`
${ ( { isLayered, offsetAmount } ) =>
isLayered
? css( rtl( { marginLeft: offsetAmount } )() )
: css( rtl( { right: offsetAmount * -1 } )() ) }
&:not( :first-of-type ) {
${ ( { offsetAmount } ) =>
css( {
marginInlineStart: offsetAmount,
} ) };
}

${ ( { isLayered } ) =>
isLayered ? positionAbsolute : positionRelative }

${ ( { zIndex } ) => css( { zIndex } ) }
`;

const positionAbsolute = css`
position: absolute;
${ ( { zIndex } ) => css( { zIndex } ) };
`;

const positionRelative = css`
export const ZStackView = styled.div< {
isLayered: boolean;
} >`
display: inline-grid;
grid-auto-flow: column;
position: relative;

& > ${ ZStackChildView } {
position: relative;
justify-self: start;

${ ( { isLayered } ) =>
isLayered
? // When `isLayered` is true, all items overlap in the same grid cell
css( { gridRowStart: 1, gridColumnStart: 1 } )
: undefined };
}
`;