Skip to content

Commit

Permalink
Omit __experimentalIsFocusable from TS types
Browse files Browse the repository at this point in the history
  • Loading branch information
mirka committed Jul 3, 2024
1 parent 40bcb70 commit 731f369
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/components/src/toolbar/toolbar-button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Button from '../../button';
import ToolbarItem from '../toolbar-item';
import ToolbarContext from '../toolbar-context';
import ToolbarButtonContainer from './toolbar-button-container';
import type { ToolbarButtonProps } from './types';
import type { ToolbarButtonDeprecatedProps, ToolbarButtonProps } from './types';
import type { WordPressComponentProps } from '../../context';

function useDeprecatedProps( {
Expand All @@ -30,7 +30,11 @@ function useDeprecatedProps( {
}

function UnforwardedToolbarButton(
props: WordPressComponentProps< ToolbarButtonProps, typeof Button, false >,
props: Omit<
WordPressComponentProps< ToolbarButtonProps, typeof Button, false >,
'__experimentalIsFocusable' // ToolbarButton will always be focusable.
> &
ToolbarButtonDeprecatedProps,
ref: ForwardedRef< any >
) {
const {
Expand Down Expand Up @@ -111,6 +115,7 @@ function UnforwardedToolbarButton(
* ```jsx
* import { Toolbar, ToolbarButton } from '@wordpress/components';
* import { edit } from '@wordpress/icons';
import { __ } from '../../../../i18n/build-types/create-i18n';
*
* function MyToolbar() {
* return (
Expand Down
10 changes: 10 additions & 0 deletions packages/components/src/toolbar/toolbar-button/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ export type ToolbarButtonProps = {
title?: string;
};

export type ToolbarButtonDeprecatedProps = {
/**
* Whether to keep the button focusable when disabled.
*
* @deprecated ToolbarButton will always be focusable.
* @ignore
*/
__experimentalIsFocusable?: boolean;
};

export type ToolbarButtonContainerProps = {
/**
* Children to be rendered inside the button container.
Expand Down

0 comments on commit 731f369

Please sign in to comment.