diff --git a/src/components/BaseInput/props.ts b/src/components/BaseInput/props.ts index 1f987ac8..d0662bbb 100644 --- a/src/components/BaseInput/props.ts +++ b/src/components/BaseInput/props.ts @@ -45,4 +45,9 @@ export type BaseInputProps = { */ className?: string + /** + * autofocus property of the HTMLElement + */ + autoFocus?: boolean + } diff --git a/src/components/Checkbox/Checkbox.tsx b/src/components/Checkbox/Checkbox.tsx index 91962b45..f2412d49 100644 --- a/src/components/Checkbox/Checkbox.tsx +++ b/src/components/Checkbox/Checkbox.tsx @@ -43,6 +43,7 @@ export const Checkbox = ({ value, children = label, className: classNameProp, + autoFocus, }: CheckboxProps): ReactElement => { const className = useMemo(() => classnames([ styles.checkbox, @@ -51,6 +52,7 @@ export const Checkbox = ({ return ( = { children?: ReactNode className?: string + + /** + * autofocus property of the HTMLElement + */ + autoFocus?: boolean } diff --git a/src/components/Input/Input.tsx b/src/components/Input/Input.tsx index 8f495206..260c8e84 100644 --- a/src/components/Input/Input.tsx +++ b/src/components/Input/Input.tsx @@ -87,6 +87,7 @@ export const Input = ( onChange, placeholder, iconLeft, + autoFocus, iconRight, allowClear, maxLength, @@ -165,6 +166,7 @@ export const Input = ( addonBefore={addonBefore} allowClear={allowClear} appearance={appearance} + autoFocus={autoFocus} className={styles.input} component={AntInput} defaultValue={inputDefaultValue} diff --git a/src/components/InputNumber/InputNumber.tsx b/src/components/InputNumber/InputNumber.tsx index a40e602a..dd9b612e 100644 --- a/src/components/InputNumber/InputNumber.tsx +++ b/src/components/InputNumber/InputNumber.tsx @@ -51,10 +51,12 @@ export const InputNumber = ( max, step, precision, + autoFocus, }: InputNumberProps) : ReactElement => { return ( ( inputRef, iconLeft, iconRight = defaults.iconRight, + autoFocus, onChange, onSelect, onSearch, @@ -68,6 +69,7 @@ export const Search = ( return ( >> appearance={appearance} + autoFocus={autoFocus} className={styles.search} component={AntAutoComplete} defaultValue={defaultValue} diff --git a/src/components/Select/Select.tsx b/src/components/Select/Select.tsx index d181b30a..77ffeeaf 100644 --- a/src/components/Select/Select.tsx +++ b/src/components/Select/Select.tsx @@ -70,6 +70,7 @@ export const Select = ( allowClear, options, inputRef, + autoFocus, onChange, onClear, onSelect, @@ -93,6 +94,7 @@ export const Select = ( >> allowClear={allowClear} appearance={appearance} + autoFocus={autoFocus} className={className} component={AntSelect} defaultValue={defaultValue} diff --git a/src/components/TextArea/TextArea.tsx b/src/components/TextArea/TextArea.tsx index c4070dab..c46fd191 100644 --- a/src/components/TextArea/TextArea.tsx +++ b/src/components/TextArea/TextArea.tsx @@ -50,11 +50,13 @@ export const TextArea = ( minLength, maxLength, rows, + autoFocus, }: TextAreaProps) : ReactElement => { return (