Skip to content

Commit

Permalink
feat(Input): adds step, min, max attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Firsov committed Apr 2, 2019
1 parent b9c46d1 commit ba4c626
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/common/Tag/Tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ const COLLECTED_PROPS = [
'href',
'target',
'rel',
'step',
'min',
'max',
];

const HTML_TAGS = [
Expand Down
9 changes: 9 additions & 0 deletions src/components/Input/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ type InputProps = {
onBlur?: (?SyntheticFocusEvent<HTMLInputElement>) => void,
/** callback which called on clear */
onClear?: () => void,
step?: string | number,
min?: string | number,
max?: string | number,
} & InputCommonProps;

class Input extends PureComponent<InputProps> {
Expand Down Expand Up @@ -124,6 +127,9 @@ class Input extends PureComponent<InputProps> {
clearable,
onClear,
autoFocus,
step,
min,
max,
...rest
} = this.props;
const hasLeftIcon = !!leftIcon;
Expand All @@ -149,6 +155,9 @@ class Input extends PureComponent<InputProps> {
readOnly,
stretch,
autoFocus,
step,
min,
max,
};

return (
Expand Down
9 changes: 9 additions & 0 deletions src/components/InputField/InputField.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ type InputFieldProps = {
onClear?: () => void,
/** html auto-focus representation */
autoFocus?: boolean,
step?: string | number,
min?: string | number,
max?: string | number,
};

const InputField = ({
Expand All @@ -66,6 +69,9 @@ const InputField = ({
autoComplete,
autoFocus,
onClear,
step,
min,
max,
...rest
}: InputFieldProps) => {
const { name, value, onChange, onFocus, onBlur } = input;
Expand Down Expand Up @@ -106,6 +112,9 @@ const InputField = ({
rightIcon={ rightIcon }
onClear={ onClear }
autoFocus={ autoFocus }
step={ step }
min={ min }
max={ max }
/>
</FormField>
);
Expand Down

0 comments on commit ba4c626

Please sign in to comment.