Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Remove inputProps to rely on rest in TextInput
Browse files Browse the repository at this point in the history
  • Loading branch information
opr committed May 20, 2021
1 parent a7243ec commit 1fc64cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
10 changes: 3 additions & 7 deletions packages/checkout/text-input/text-input.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { forwardRef, HTMLProps, InputHTMLAttributes } from 'react';
import { forwardRef, InputHTMLAttributes } from 'react';
import classnames from 'classnames';
import { useState } from '@wordpress/element';

Expand All @@ -26,10 +26,6 @@ interface TextInputProps
autoComplete?: string;
onChange: ( newValue: string ) => void;
onBlur?: ( newValue: string ) => void;
inputProps?: Omit<
HTMLProps< HTMLInputElement >,
'onChange' | 'onBlur' | 'ref'
>;
}

const TextInput = forwardRef< HTMLInputElement, TextInputProps >(
Expand All @@ -53,7 +49,7 @@ const TextInput = forwardRef< HTMLInputElement, TextInputProps >(
/* Do nothing */
},
feedback,
inputProps,
...rest
},
ref
) => {
Expand Down Expand Up @@ -91,7 +87,7 @@ const TextInput = forwardRef< HTMLInputElement, TextInputProps >(
: ariaDescribedBy
}
required={ required }
{ ...inputProps }
{ ...rest }
/>
<Label
label={ label }
Expand Down
15 changes: 1 addition & 14 deletions packages/checkout/text-input/validated-text-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
* External dependencies
*/
import { __ } from '@wordpress/i18n';
import {
useCallback,
useRef,
useEffect,
useState,
Component,
HTMLProps,
} from 'react';
import { useCallback, useRef, useEffect, useState, Component } from 'react';
import classnames from 'classnames';
import { withInstanceId } from '@woocommerce/base-hocs/with-instance-id';

Expand Down Expand Up @@ -52,10 +45,6 @@ type ValidatedTextInputProps = (
clearValidationError: ( errorId: string ) => void;
getValidationErrorId: ( errorId: string ) => string;
validationInputError: typeof Component;
inputProps?: Omit<
HTMLProps< HTMLInputElement >,
'onChange' | 'onBlur' | 'ref'
>;
};

const ValidatedTextInput = ( {
Expand All @@ -74,7 +63,6 @@ const ValidatedTextInput = ( {
clearValidationError,
getValidationErrorId,
validationInputError: ValidationInputError,
inputProps,
...rest
}: ValidatedTextInputProps ) => {
const [ isPristine, setIsPristine ] = useState( true );
Expand Down Expand Up @@ -167,7 +155,6 @@ const ValidatedTextInput = ( {
onChange( val );
} }
ariaDescribedBy={ describedBy }
inputProps={ inputProps }
{ ...rest }
/>
);
Expand Down

0 comments on commit 1fc64cc

Please sign in to comment.