Skip to content
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: 2 additions & 0 deletions packages/ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

### Documentation

- `Tabs`: Preserve intrinsic icon styles in the tab icons and tooltips story ([#84618](https://github.com/WordPress/gutenberg/pull/84618)).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why agents love to add empty lines between entries 🤷

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow up in #84804

- Document accessible naming for Combobox popups ([#84551](https://github.com/WordPress/gutenberg/pull/84551)).
- Add popup width stories for Autocomplete, Combobox, Select, SearchableSelect, and SearchableChipSelect ([#84320](https://github.com/WordPress/gutenberg/pull/84320)).
- `Menu`: Clarify icon and description usage, document mixed icon alignment and current layout defaults, and favor short, clear labels ([#84020](https://github.com/WordPress/gutenberg/pull/84020)).
Expand Down
31 changes: 7 additions & 24 deletions packages/ui/src/tabs/stories/index.story.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { useState, cloneElement } from '@wordpress/element';
import { useState } from '@wordpress/element';
import { link, more, wordpress } from '@wordpress/icons';
import * as Tabs from '../';
import * as Tooltip from '../../tooltip';
import { Icon } from '../../icon';

const meta: Meta< typeof Tabs.Root > = {
title: 'Components/@wordpress-ui/Tabs',
Expand Down Expand Up @@ -236,33 +237,21 @@ export const WithDisabledTab: StoryObj< typeof Tabs.Root > = {
},
};

const LinkIcon = ( props: React.SVGProps< SVGSVGElement > ) => {
return cloneElement( link, props );
};

const MoreIcon = ( props: React.SVGProps< SVGSVGElement > ) => {
return cloneElement( more, props );
};

const WordpressIcon = ( props: React.SVGProps< SVGSVGElement > ) => {
return cloneElement( wordpress, props );
};

const tabWithIconsData = [
{
value: 'tab1',
label: 'Tab one',
icon: WordpressIcon,
icon: wordpress,
},
{
value: 'tab2',
label: 'Tab two',
icon: LinkIcon,
icon: link,
},
{
value: 'tab3',
label: 'Tab three',
icon: MoreIcon,
icon: more,
},
];

Expand All @@ -271,19 +260,13 @@ export const WithTabIconsAndTooltips: StoryObj< typeof Tabs.Root > = {
...Default.args,
children: [
<Tabs.List key="list">
{ tabWithIconsData.map( ( { value, label, icon: Icon } ) => (
{ tabWithIconsData.map( ( { value, label, icon } ) => (
<Tooltip.Root key={ value }>
<Tooltip.Trigger
aria-label={ label }
render={ <Tabs.Tab value={ value } /> }
>
{ /* TODO: potentially refactor with new Icon component */ }
<Icon
style={ {
width: '20px',
height: '20px',
} }
/>
<Icon icon={ icon } size={ 20 } />
</Tooltip.Trigger>
<Tooltip.Popup
positioner={
Expand Down
Loading