-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* First pass pulling from previous work I royally borked * Adds missing attribute to dropdown menu types * Spelling * Adding some ignores and removes some others. * Onclick event to dropdown-menu onClick prop. * Makes data-toolbar-item optional on dropdown props * Fixes story inconsistencies * JSDoc changes * Updates ToolbarGroupControls types w/ dropdown types * Toolbar-group tests * Toolbar-group types cleanup * Toolbar group internal props / toggleProps from dropdown * Toolbar group extraction * isNested toolbar group first pass * Updates types and null to undefined in toolbar-group * Cleans up dead code, changes dropdown menu role type, swaps some comments around * Adds changelog reference * Weird fat finger another dash, removing
- Loading branch information
Showing
10 changed files
with
170 additions
and
45 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
8 changes: 0 additions & 8 deletions
8
packages/components/src/toolbar/toolbar-group/toolbar-group-container.js
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
packages/components/src/toolbar/toolbar-group/toolbar-group-container.tsx
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,16 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import type { WordPressComponentProps } from '../../ui/context'; | ||
import type { ToolbarGroupContainerProps } from './types'; | ||
|
||
const ToolbarGroupContainer = ( { | ||
className, | ||
children, | ||
...props | ||
}: WordPressComponentProps< ToolbarGroupContainerProps, 'div', false > ) => ( | ||
<div className={ className } { ...props }> | ||
{ children } | ||
</div> | ||
); | ||
export default ToolbarGroupContainer; |
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,92 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import type { ReactNode } from 'react'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import type { | ||
DropdownMenuProps, | ||
DropdownOption, | ||
} from '../../dropdown-menu/types'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import type { Props as IconProps } from '../../icon'; | ||
|
||
export type ToolbarGroupControls = DropdownOption & { | ||
/** | ||
* An optional subscript associated to the control. | ||
*/ | ||
subscript?: string; | ||
}; | ||
|
||
type ToolbarGroupPropsBase = { | ||
/** | ||
* The controls to render in this toolbar. | ||
*/ | ||
controls?: ToolbarGroupControls[] | ToolbarGroupControls[][]; | ||
|
||
/** | ||
* Class to set on the container div. | ||
*/ | ||
className?: string; | ||
|
||
/** | ||
* Any other things to render inside the toolbar besides the controls. | ||
*/ | ||
children?: ReactNode; | ||
|
||
/** | ||
* The Dashicon icon slug to be shown for the option. | ||
*/ | ||
icon?: IconProps[ 'icon' ]; | ||
}; | ||
|
||
export type ToolbarGroupProps = ToolbarGroupPropsBase & | ||
( | ||
| { | ||
/** | ||
* When true, turns `ToolbarGroup` into a dropdown menu. | ||
*/ | ||
isCollapsed?: false; | ||
/** | ||
* Any other things to render inside the toolbar besides the controls. | ||
*/ | ||
children?: ReactNode; | ||
title?: never; | ||
} | ||
| { | ||
/** | ||
* When true, turns `ToolbarGroup` into a dropdown menu. | ||
*/ | ||
isCollapsed: true; | ||
/** | ||
* Any other things to render inside the toolbar besides the controls. | ||
*/ | ||
children?: ToolbarGroupCollapsedProps[ 'children' ]; | ||
/** | ||
* ARIA label for dropdown menu if is collapsed. | ||
*/ | ||
title: string; | ||
} | ||
); | ||
|
||
export type ToolbarGroupCollapsedProps = DropdownMenuProps; | ||
|
||
export type ToolbarGroupContainerProps = { | ||
/** | ||
* Children to be rendered inside the toolbar. | ||
*/ | ||
children?: ReactNode; | ||
/** | ||
* Class to set on the container div. | ||
*/ | ||
className?: string; | ||
/** | ||
* Props to be passed. | ||
*/ | ||
props?: any; | ||
}; |
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