UNPKG

phx-react

Version:

PHX REACT

44 lines (43 loc) 1.55 kB
import React, { InputHTMLAttributes } from 'react'; import { UseFormRegisterReturn } from 'react-hook-form'; import { ComplexAction } from '../types'; import * as OutlineIcons from '@heroicons/react/24/outline'; export interface ICustomSearchConfig { onSearch: (value: string) => Promise<any[]>; onClickSearchItem?: (item: any) => string; renderItem?: (item: any) => React.ReactNode; onAddNew?: (value: string) => void; onClear?: () => void; defaultText?: string; } export interface ComplexButtonAction { content: React.ReactNode; onClick?: () => void; popupContent?: (close: () => void) => React.ReactNode; isLeftPosition?: boolean; } export interface InputProps extends InputHTMLAttributes<HTMLInputElement> { className?: string; label?: string; helpText?: string; register?: UseFormRegisterReturn; registerSelect?: UseFormRegisterReturn; error?: boolean; errorMessageCustom?: string; listOption?: Array<{ id: number; name: string; }>; selected?: number; disabled?: boolean; errorType?: 'required-field' | 'validate-input-field' | 'duplicate-field' | 'validate-phone-number' | 'validate-input-email' | 'custom-message'; prefix?: string; suffix?: string; prefixIcon?: keyof typeof OutlineIcons; suffixIcon?: keyof typeof OutlineIcons; labelAction?: ComplexAction; buttonAction?: ComplexButtonAction; searchConfig?: ICustomSearchConfig; isSearchInput?: boolean; } export declare const PHXInput: React.FC<InputProps>;