Compare commits
1 Commits
main
...
05-22-Fix_
Author | SHA1 | Date | |
---|---|---|---|
|
efc5a45bac |
@ -6,7 +6,7 @@ import { Input, InputProps } from './shared/Input';
|
|||||||
const SearchBar: React.ForwardRefRenderFunction<
|
const SearchBar: React.ForwardRefRenderFunction<
|
||||||
HTMLInputElement,
|
HTMLInputElement,
|
||||||
InputProps & RefAttributes<HTMLInputElement>
|
InputProps & RefAttributes<HTMLInputElement>
|
||||||
> = ({ value, onChange, placeholder = 'Search', ...props }) => {
|
> = ({ value, onChange, placeholder = 'Search', ...props }, ref) => {
|
||||||
return (
|
return (
|
||||||
<div className="relative flex w-full">
|
<div className="relative flex w-full">
|
||||||
<Input
|
<Input
|
||||||
@ -18,6 +18,7 @@ const SearchBar: React.ForwardRefRenderFunction<
|
|||||||
appearance="borderless"
|
appearance="borderless"
|
||||||
className="w-full lg:w-[459px]"
|
className="w-full lg:w-[459px]"
|
||||||
{...props}
|
{...props}
|
||||||
|
ref={ref}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -4,7 +4,6 @@ import {
|
|||||||
useMemo,
|
useMemo,
|
||||||
ComponentPropsWithoutRef,
|
ComponentPropsWithoutRef,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { FieldValues, UseFormRegister } from 'react-hook-form';
|
|
||||||
|
|
||||||
import { WarningIcon } from 'components/shared/CustomIcon';
|
import { WarningIcon } from 'components/shared/CustomIcon';
|
||||||
import { cloneIcon } from 'utils/cloneIcon';
|
import { cloneIcon } from 'utils/cloneIcon';
|
||||||
@ -12,7 +11,7 @@ import { cn } from 'utils/classnames';
|
|||||||
|
|
||||||
import { InputTheme, inputTheme } from './Input.theme';
|
import { InputTheme, inputTheme } from './Input.theme';
|
||||||
|
|
||||||
export interface InputProps<T extends FieldValues = FieldValues>
|
export interface InputProps
|
||||||
extends InputTheme,
|
extends InputTheme,
|
||||||
Omit<ComponentPropsWithoutRef<'input'>, 'size'> {
|
Omit<ComponentPropsWithoutRef<'input'>, 'size'> {
|
||||||
label?: string;
|
label?: string;
|
||||||
@ -20,9 +19,6 @@ export interface InputProps<T extends FieldValues = FieldValues>
|
|||||||
leftIcon?: ReactNode;
|
leftIcon?: ReactNode;
|
||||||
rightIcon?: ReactNode;
|
rightIcon?: ReactNode;
|
||||||
helperText?: string;
|
helperText?: string;
|
||||||
|
|
||||||
// react-hook-form optional register
|
|
||||||
register?: ReturnType<UseFormRegister<T>>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Input = forwardRef<HTMLInputElement, InputProps>(
|
const Input = forwardRef<HTMLInputElement, InputProps>(
|
||||||
@ -34,7 +30,6 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
|
|||||||
leftIcon,
|
leftIcon,
|
||||||
rightIcon,
|
rightIcon,
|
||||||
helperText,
|
helperText,
|
||||||
register,
|
|
||||||
size,
|
size,
|
||||||
state,
|
state,
|
||||||
appearance,
|
appearance,
|
||||||
@ -107,12 +102,11 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
|
|||||||
<div className={containerCls({ class: className })}>
|
<div className={containerCls({ class: className })}>
|
||||||
{leftIcon && renderLeftIcon}
|
{leftIcon && renderLeftIcon}
|
||||||
<input
|
<input
|
||||||
{...(register ? register : {})}
|
|
||||||
className={cn(inputCls(), {
|
className={cn(inputCls(), {
|
||||||
'pl-10': leftIcon,
|
'pl-10': leftIcon,
|
||||||
})}
|
})}
|
||||||
{...props}
|
|
||||||
ref={ref}
|
ref={ref}
|
||||||
|
{...props}
|
||||||
/>
|
/>
|
||||||
{rightIcon && renderRightIcon}
|
{rightIcon && renderRightIcon}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user