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

[pull] trunk from WordPress:trunk #134

Merged
merged 3 commits into from
Jan 2, 2025
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
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

131 changes: 0 additions & 131 deletions packages/components/src/tabs/stories/index.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { useState } from '@wordpress/element';
*/
import { Tabs } from '..';
import { Slot, Fill, Provider as SlotFillProvider } from '../../slot-fill';
import DropdownMenu from '../../dropdown-menu';
import Button from '../../button';
import Tooltip from '../../tooltip';
import Icon from '../../icon';
Expand Down Expand Up @@ -367,133 +366,3 @@ const CloseButtonTemplate: StoryFn< typeof Tabs > = ( props ) => {
);
};
export const InsertCustomElements = CloseButtonTemplate.bind( {} );

const ControlledModeTemplate: StoryFn< typeof Tabs > = ( props ) => {
const [ selectedTabId, setSelectedTabId ] = useState<
string | undefined | null
>( props.selectedTabId );

return (
<>
<Tabs
{ ...props }
selectedTabId={ selectedTabId }
onSelect={ ( selectedId ) => {
setSelectedTabId( selectedId );
props.onSelect?.( selectedId );
} }
>
<Tabs.TabList>
<Tabs.Tab tabId="tab1">Tab 1</Tabs.Tab>

<Tabs.Tab tabId="tab2">Tab 2</Tabs.Tab>

<Tabs.Tab tabId="tab3">Tab 3</Tabs.Tab>
</Tabs.TabList>
<Tabs.TabPanel tabId="tab1">
<p>Selected tab: Tab 1</p>
</Tabs.TabPanel>
<Tabs.TabPanel tabId="tab2">
<p>Selected tab: Tab 2</p>
</Tabs.TabPanel>
<Tabs.TabPanel tabId="tab3">
<p>Selected tab: Tab 3</p>
</Tabs.TabPanel>
</Tabs>
<div style={ { marginTop: '200px' } }>
<p>Select a tab:</p>
<DropdownMenu
controls={ [
{
onClick: () => setSelectedTabId( 'tab1' ),
title: 'Tab 1',
isActive: selectedTabId === 'tab1',
},
{
onClick: () => setSelectedTabId( 'tab2' ),
title: 'Tab 2',
isActive: selectedTabId === 'tab2',
},
{
onClick: () => setSelectedTabId( 'tab3' ),
title: 'Tab 3',
isActive: selectedTabId === 'tab3',
},
] }
label="Choose a tab. The power is yours."
/>
</div>
</>
);
};

export const ControlledMode = ControlledModeTemplate.bind( {} );
ControlledMode.args = {
selectedTabId: 'tab3',
};

const TabBecomesDisabledTemplate: StoryFn< typeof Tabs > = ( props ) => {
const [ disableTab2, setDisableTab2 ] = useState( false );

return (
<>
<Button
variant="primary"
onClick={ () => setDisableTab2( ! disableTab2 ) }
>
{ disableTab2 ? 'Enable' : 'Disable' } Tab 2
</Button>
<Tabs { ...props }>
<Tabs.TabList>
<Tabs.Tab tabId="tab1">Tab 1</Tabs.Tab>
<Tabs.Tab tabId="tab2" disabled={ disableTab2 }>
Tab 2
</Tabs.Tab>
<Tabs.Tab tabId="tab3">Tab 3</Tabs.Tab>
</Tabs.TabList>
<Tabs.TabPanel tabId="tab1">
<p>Selected tab: Tab 1</p>
</Tabs.TabPanel>
<Tabs.TabPanel tabId="tab2">
<p>Selected tab: Tab 2</p>
</Tabs.TabPanel>
<Tabs.TabPanel tabId="tab3">
<p>Selected tab: Tab 3</p>
</Tabs.TabPanel>
</Tabs>
</>
);
};
export const TabBecomesDisabled = TabBecomesDisabledTemplate.bind( {} );

const TabGetsRemovedTemplate: StoryFn< typeof Tabs > = ( props ) => {
const [ removeTab1, setRemoveTab1 ] = useState( false );

return (
<>
<Button
variant="primary"
onClick={ () => setRemoveTab1( ! removeTab1 ) }
>
{ removeTab1 ? 'Restore' : 'Remove' } Tab 1
</Button>
<Tabs { ...props }>
<Tabs.TabList>
{ ! removeTab1 && <Tabs.Tab tabId="tab1">Tab 1</Tabs.Tab> }
<Tabs.Tab tabId="tab2">Tab 2</Tabs.Tab>
<Tabs.Tab tabId="tab3">Tab 3</Tabs.Tab>
</Tabs.TabList>
<Tabs.TabPanel tabId="tab1">
<p>Selected tab: Tab 1</p>
</Tabs.TabPanel>
<Tabs.TabPanel tabId="tab2">
<p>Selected tab: Tab 2</p>
</Tabs.TabPanel>
<Tabs.TabPanel tabId="tab3">
<p>Selected tab: Tab 3</p>
</Tabs.TabPanel>
</Tabs>
</>
);
};
export const TabGetsRemoved = TabGetsRemovedTemplate.bind( {} );
2 changes: 1 addition & 1 deletion packages/edit-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@wordpress/icons": "*",
"@wordpress/keyboard-shortcuts": "*",
"@wordpress/keycodes": "*",
"@wordpress/media-utils": "5.14.0",
"@wordpress/media-utils": "*",
"@wordpress/notices": "*",
"@wordpress/patterns": "*",
"@wordpress/plugins": "*",
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-site/src/components/layout/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
// This ensure the radius work properly.
overflow: hidden;

@media not (prefers-reduced-motion) {
@media (prefers-reduced-motion: no-preference) {
transition: border-radius, box-shadow 0.4s;
}

Expand Down
18 changes: 9 additions & 9 deletions packages/upload-media/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
"types": "build-types",
"dependencies": {
"@shopify/web-worker": "^6.4.0",
"@wordpress/api-fetch": "file:../api-fetch",
"@wordpress/blob": "file:../blob",
"@wordpress/compose": "file:../compose",
"@wordpress/data": "file:../data",
"@wordpress/element": "file:../element",
"@wordpress/i18n": "file:../i18n",
"@wordpress/preferences": "file:../preferences",
"@wordpress/private-apis": "file:../private-apis",
"@wordpress/url": "file:../url",
"@wordpress/api-fetch": "*",
"@wordpress/blob": "*",
"@wordpress/compose": "*",
"@wordpress/data": "*",
"@wordpress/element": "*",
"@wordpress/i18n": "*",
"@wordpress/preferences": "*",
"@wordpress/private-apis": "*",
"@wordpress/url": "*",
"uuid": "^9.0.1"
},
"publishConfig": {
Expand Down
Loading