diff --git a/index.d.ts b/index.d.ts index 35a12b10..114d745a 100644 --- a/index.d.ts +++ b/index.d.ts @@ -54,6 +54,7 @@ export interface DatePickerProps extends CalendarProps string; renderInput?: React.FC; + inputProps?: any } type Optional = Omit & Partial>; diff --git a/src/DatePicker.js b/src/DatePicker.js index 5b83b356..7b00d1a3 100644 --- a/src/DatePicker.js +++ b/src/DatePicker.js @@ -12,6 +12,7 @@ const DatePicker = ({ inputPlaceholder, inputClassName, inputName, + inputProps, renderInput, wrapperClassName, calendarClassName, @@ -151,6 +152,7 @@ const DatePicker = ({ renderInput={renderInput} inputName={inputName} locale={locale} + inputProps={inputProps} /> {isCalendarOpen && ( <> diff --git a/src/DatePickerInput.js b/src/DatePickerInput.js index 30d3ee7c..40a88a87 100644 --- a/src/DatePickerInput.js +++ b/src/DatePickerInput.js @@ -6,7 +6,16 @@ import { TYPE_SINGLE_DATE, TYPE_RANGE, TYPE_MUTLI_DATE } from './shared/constant const DatePickerInput = React.forwardRef( ( - { value, inputPlaceholder, inputClassName, inputName, formatInputText, renderInput, locale }, + { + value, + inputPlaceholder, + inputClassName, + inputName, + formatInputText, + renderInput, + locale, + inputProps, + }, ref, ) => { const { getLanguageDigits } = useLocaleUtils(locale); @@ -73,6 +82,7 @@ const DatePickerInput = React.forwardRef( placeholder={placeholderValue} className={`DatePicker__input -${isRtl ? 'rtl' : 'ltr'} ${inputClassName}`} aria-label={placeholderValue} + {...inputProps} /> ) );