-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Toolbar: move all subcomponents under the same folder (#46951)
* Move `Toolbar` files inside `toolbar` subfolder * Move `ToolbarButton` inside `toolbar-button` subfolder * Move `ToolbarContext` inside `toolbar-context` subfolder * Move `ToolbarDropdownMenu` inside `toolbar-dropdown-menu` subfolder * Move `ToolbarGroup` inside `toolbar-group` subfolder * Move `ToolbarItem` inside `toolbar-item` subfolder * Fix `Button` import path * Fix styles import path * Rewrite package exports * Remove unnecessary `tsconfig.json` exclude lines * Fix imports in stories and tests * CHANGELOG * Fix native import * Update Docs Manifest
- Loading branch information
Showing
37 changed files
with
93 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,6 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import classnames from 'classnames'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { forwardRef } from '@wordpress/element'; | ||
import deprecated from '@wordpress/deprecated'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import ToolbarGroup from '../toolbar-group'; | ||
import ToolbarContainer from './toolbar-container'; | ||
|
||
/** | ||
* Renders a toolbar. | ||
* | ||
* To add controls, simply pass `ToolbarButton` components as children. | ||
* | ||
* @param {Object} props Component props. | ||
* @param {string} [props.className] Class to set on the container div. | ||
* @param {string} [props.label] ARIA label for toolbar container. | ||
* @param {Object} ref React Element ref. | ||
*/ | ||
function Toolbar( { className, label, ...props }, ref ) { | ||
if ( ! label ) { | ||
deprecated( 'Using Toolbar without label prop', { | ||
since: '5.6', | ||
alternative: 'ToolbarGroup component', | ||
link: 'https://developer.wordpress.org/block-editor/components/toolbar/', | ||
} ); | ||
return <ToolbarGroup { ...props } className={ className } />; | ||
} | ||
// `ToolbarGroup` already uses components-toolbar for compatibility reasons. | ||
const finalClassName = classnames( | ||
'components-accessible-toolbar', | ||
className | ||
); | ||
return ( | ||
<ToolbarContainer | ||
className={ finalClassName } | ||
label={ label } | ||
ref={ ref } | ||
{ ...props } | ||
/> | ||
); | ||
} | ||
|
||
export default forwardRef( Toolbar ); | ||
export { default as Toolbar } from './toolbar'; | ||
export { default as ToolbarButton } from './toolbar-button'; | ||
export { default as ToolbarContext } from './toolbar-context'; | ||
export { default as ToolbarDropdownMenu } from './toolbar-dropdown-menu'; | ||
export { default as ToolbarGroup } from './toolbar-group'; | ||
export { default as ToolbarItem } from './toolbar-item'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import classnames from 'classnames'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { forwardRef } from '@wordpress/element'; | ||
import deprecated from '@wordpress/deprecated'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import ToolbarGroup from '../toolbar-group'; | ||
import ToolbarContainer from './toolbar-container'; | ||
|
||
/** | ||
* Renders a toolbar. | ||
* | ||
* To add controls, simply pass `ToolbarButton` components as children. | ||
* | ||
* @param {Object} props Component props. | ||
* @param {string} [props.className] Class to set on the container div. | ||
* @param {string} [props.label] ARIA label for toolbar container. | ||
* @param {Object} ref React Element ref. | ||
*/ | ||
function Toolbar( { className, label, ...props }, ref ) { | ||
if ( ! label ) { | ||
deprecated( 'Using Toolbar without label prop', { | ||
since: '5.6', | ||
alternative: 'ToolbarGroup component', | ||
link: 'https://developer.wordpress.org/block-editor/components/toolbar/', | ||
} ); | ||
return <ToolbarGroup { ...props } className={ className } />; | ||
} | ||
// `ToolbarGroup` already uses components-toolbar for compatibility reasons. | ||
const finalClassName = classnames( | ||
'components-accessible-toolbar', | ||
className | ||
); | ||
return ( | ||
<ToolbarContainer | ||
className={ finalClassName } | ||
label={ label } | ||
ref={ ref } | ||
{ ...props } | ||
/> | ||
); | ||
} | ||
|
||
export default forwardRef( Toolbar ); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39dbf19
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in 39dbf19.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3875038862
📝 Reported issues:
specs/editor/various/multi-block-selection.test.js
/test/e2e/specs/editor/various/preview.spec.js