Skip to content

Commit

Permalink
[EuiFieldNumber] Added any as a step option (#3562)
Browse files Browse the repository at this point in the history
  • Loading branch information
shrey authored Jun 10, 2020
1 parent 0b8dd40 commit 639d665
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Converted `EuiOverlayMask` to be a React functional component ([#3555](https://github.com/elastic/eui/pull/3555))
- Changed `responsive` and `max` behavior of `EuiBreadcrumbs` to always display collapsed items in popover [#3578](https://github.com/elastic/eui/pull/3578))
- Added `BREAKPOINTS` and `getBreakpoint` utilities [#3578](https://github.com/elastic/eui/pull/3578))
- Added `'any'` option to the `step` prop of the `EuiFieldNumber` ([#3562](https://github.com/elastic/eui/pull/3562))

**Bug fixes**

Expand Down
3 changes: 1 addition & 2 deletions src-docs/src/views/form_controls/field_number.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ export default () => {
const [value, setValue] = useState('');

const onChange = e => {
const sanitizedValue = parseInt(e.target.value, 10);
setValue(isNaN(sanitizedValue) ? '' : sanitizedValue);
setValue(e.target.value);
};

return (
Expand Down
7 changes: 6 additions & 1 deletion src/components/form/field_number/field_number.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ export type EuiFieldNumberProps = InputHTMLAttributes<HTMLInputElement> &
readOnly?: boolean;
min?: number;
max?: number;
step?: number;
/**
* Specifies the granularity that the value must adhere to.
* Accepts a `number` or the string `'any'` for no stepping to allow for any value.
* Defaults to `1`
*/
step?: number | 'any';
inputRef?: Ref<HTMLInputElement>;

/**
Expand Down

0 comments on commit 639d665

Please sign in to comment.