From 53b7e0879bd2b5a347801f93d9d12ee8ad2f639a Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Fri, 8 Apr 2022 17:12:38 +0900 Subject: [PATCH] Keep type unions inside types.ts --- packages/components/src/input-control/input-base.tsx | 3 +-- packages/components/src/input-control/types.ts | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/components/src/input-control/input-base.tsx b/packages/components/src/input-control/input-base.tsx index adcc1cbd5be81..9151ae14c78f8 100644 --- a/packages/components/src/input-control/input-base.tsx +++ b/packages/components/src/input-control/input-base.tsx @@ -22,7 +22,6 @@ import { LabelWrapper, } from './styles/input-control-styles'; import type { InputBaseProps, LabelPosition } from './types'; -import type { FlexProps } from '../flex/types'; function useUniqueId( idProp?: string ) { const instanceId = useInstanceId( InputBase ); @@ -66,7 +65,7 @@ export function InputBase( size = 'default', suffix, ...props - }: InputBaseProps & FlexProps, + }: InputBaseProps, ref: ForwardedRef< HTMLDivElement > ) { const id = useUniqueId( idProp ); diff --git a/packages/components/src/input-control/types.ts b/packages/components/src/input-control/types.ts index 0daf9a4cf857e..7067f79453767 100644 --- a/packages/components/src/input-control/types.ts +++ b/packages/components/src/input-control/types.ts @@ -16,6 +16,7 @@ import type { useDrag } from '@use-gesture/react'; */ import type { StateReducer } from './reducer/state'; import type { WordPressComponentProps } from '../ui/context'; +import type { FlexProps } from '../flex/types'; export type LabelPosition = 'top' | 'bottom' | 'side' | 'edge'; @@ -105,7 +106,7 @@ export interface InputFieldProps extends BaseProps { type?: HTMLInputTypeAttribute; } -export interface InputBaseProps extends BaseProps { +export interface InputBaseProps extends BaseProps, FlexProps { children: ReactNode; /** * Renders an element on the left side of the input. @@ -130,7 +131,7 @@ export interface InputBaseProps extends BaseProps { } export interface InputControlProps - extends Omit< InputBaseProps, 'children' | 'isFocused' >, + extends Omit< InputBaseProps, 'children' | 'isFocused' | keyof FlexProps >, /** * The `prefix` prop in `WordPressComponentProps< InputFieldProps, 'input', false >` comes from the * `HTMLInputAttributes` and clashes with the one from `InputBaseProps`. So we have to omit it from