Skip to content

Commit

Permalink
Merge pull request #673 from Atom-Learning/fix/input-types-do-not-use…
Browse files Browse the repository at this point in the history
…-override

fix: Input forwardRef type
  • Loading branch information
LimeWub authored Aug 7, 2024
2 parents 0b82ec9 + 3d398ff commit 373b6e6
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions lib/src/components/input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,8 @@ const toTextSize = {
xl: 'lg'
}

export const InputText = React.forwardRef(
(
{ type = 'text', css, size, ...rest }: InputTextProps,
ref: React.ForwardedRef<HTMLInputElement>
) => {
export const InputText: React.ForwardRefExoticComponent<InputTextProps> =
React.forwardRef(({ type = 'text', css, size, ...rest }, ref) => {
const textSize = React.useMemo(
() => overrideStitchesVariantValue(size, (s) => toTextSize[s]),
[size]
Expand All @@ -103,8 +100,7 @@ export const InputText = React.forwardRef(
{...rest}
/>
)
}
)
})

InputText.displayName = 'InputText'

Expand All @@ -117,17 +113,13 @@ export type InputProps = Omit<
state?: InputBackgroundProps['state']
}

export const Input = React.forwardRef(
(
{ size = 'md', state, disabled, css, ...rest }: InputProps,
ref: React.ForwardedRef<HTMLInputElement>
) => {
export const Input: React.ForwardRefExoticComponent<InputProps> =
React.forwardRef(({ size = 'md', state, disabled, css, ...rest }, ref) => {
return (
<InputBackground size={size} disabled={disabled} state={state} css={css}>
<InputText size={size} ref={ref} disabled={disabled} {...rest} />
</InputBackground>
)
}
)
})

Input.displayName = 'Input'

0 comments on commit 373b6e6

Please sign in to comment.