Skip to content

Commit 639d665

Browse files
authored
[EuiFieldNumber] Added any as a step option (#3562)
1 parent 0b8dd40 commit 639d665

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Converted `EuiOverlayMask` to be a React functional component ([#3555](https://github.com/elastic/eui/pull/3555))
55
- Changed `responsive` and `max` behavior of `EuiBreadcrumbs` to always display collapsed items in popover [#3578](https://github.com/elastic/eui/pull/3578))
66
- Added `BREAKPOINTS` and `getBreakpoint` utilities [#3578](https://github.com/elastic/eui/pull/3578))
7+
- Added `'any'` option to the `step` prop of the `EuiFieldNumber` ([#3562](https://github.com/elastic/eui/pull/3562))
78

89
**Bug fixes**
910

src-docs/src/views/form_controls/field_number.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ export default () => {
77
const [value, setValue] = useState('');
88

99
const onChange = e => {
10-
const sanitizedValue = parseInt(e.target.value, 10);
11-
setValue(isNaN(sanitizedValue) ? '' : sanitizedValue);
10+
setValue(e.target.value);
1211
};
1312

1413
return (

src/components/form/field_number/field_number.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ export type EuiFieldNumberProps = InputHTMLAttributes<HTMLInputElement> &
3939
readOnly?: boolean;
4040
min?: number;
4141
max?: number;
42-
step?: number;
42+
/**
43+
* Specifies the granularity that the value must adhere to.
44+
* Accepts a `number` or the string `'any'` for no stepping to allow for any value.
45+
* Defaults to `1`
46+
*/
47+
step?: number | 'any';
4348
inputRef?: Ref<HTMLInputElement>;
4449

4550
/**

0 commit comments

Comments
 (0)