diff --git a/packages/components/src/item-group/stories/index.js b/packages/components/src/item-group/stories/index.js
index 2ae503630345dc..fb8dc64c606918 100644
--- a/packages/components/src/item-group/stories/index.js
+++ b/packages/components/src/item-group/stories/index.js
@@ -4,15 +4,20 @@
* External dependencies
*/
import { boolean, select } from '@storybook/addon-knobs';
+import { css } from '@emotion/react';
+import styled from '@emotion/styled';
/**
* WordPress dependencies
*/
-import { typography } from '@wordpress/icons';
+import { typography, chevronRight } from '@wordpress/icons';
+import { useMemo } from '@wordpress/element';
+import { isRTL } from '@wordpress/i18n';
/**
* Internal dependencies
*/
+import { useCx } from '../../utils';
import { ItemGroup, Item } from '..';
import Button from '../../button';
import { FlexItem, FlexBlock } from '../../flex';
@@ -117,6 +122,58 @@ const SimpleColorSwatch = ( { color, style } ) => (
/>
);
+const ChevronWrapper = styled( FlexItem )`
+ display: block;
+ fill: currentColor;
+ transition: transform 0.15s ease-out;
+`;
+
+const ItemWithChevron = ( {
+ children,
+ className,
+ alwaysVisible,
+ ...otherProps
+} ) => {
+ const isRtlLayout = isRTL();
+ const cx = useCx();
+
+ const appearingChevron = css`
+ &:not( :hover ):not( :focus ) ${ ChevronWrapper } {
+ display: none;
+ }
+ `;
+
+ const itemClassName = useMemo(
+ () => cx( ! alwaysVisible && appearingChevron, className ),
+ [ alwaysVisible, className ]
+ );
+
+ const chevronIconClassName = useMemo(
+ () =>
+ cx( css`
+ display: block;
+ fill: currentColor;
+ transform: ${ isRtlLayout ? 'scaleX( -100% )' : 'none' };
+ ` ),
+ [ isRtlLayout ]
+ );
+
+ return (
+ -
+
+ { children }
+
+
+
+
+
+ );
+};
+
export const complexLayouts = () => {
const colors = [
{
@@ -177,6 +234,31 @@ export const complexLayouts = () => {
+
+ alert( 'Single color setting' ) }>
+
+
+
+ Chevron on hover and focus
+
+
+
+ alert( 'Single color setting' ) }
+ >
+
+
+
+ Chevron always visible
+
+
);
};