-
Notifications
You must be signed in to change notification settings - Fork 4.7k
ToolbarGroup - Typescript #54317
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
Merged
Merged
ToolbarGroup - Typescript #54317
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
7bfb2e5
First pass pulling from previous work I royally borked
margolisj aed34ba
Adds missing attribute to dropdown menu types
margolisj d48f736
Spelling
margolisj 9d77967
Adding some ignores and removes some others.
margolisj a0a4c63
Onclick event to dropdown-menu onClick prop.
margolisj 118c56a
Makes data-toolbar-item optional on dropdown props
margolisj ff87d17
Fixes story inconsistencies
margolisj e1f46f4
JSDoc changes
margolisj 2148f69
Updates ToolbarGroupControls types w/ dropdown types
margolisj 6ef00ff
Toolbar-group tests
margolisj 219a895
Toolbar-group types cleanup
margolisj 5b886fd
Toolbar group internal props / toggleProps from dropdown
margolisj 7601c08
Toolbar group extraction
margolisj 3c7f827
isNested toolbar group first pass
margolisj 4ab80d2
Updates types and null to undefined in toolbar-group
margolisj 1177741
Cleans up dead code, changes dropdown menu role type, swaps some comm…
margolisj aff56b6
Adds changelog reference
margolisj 862caeb
Merge branch 'trunk' into ToolbarGroup-typescript
margolisj 566a1e3
Weird fat finger another dash, removing
margolisj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
margolisj marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.