Skip to content

Commit

Permalink
Add inputRef prop to EuiFieldNumber and allow callbacks in select inp…
Browse files Browse the repository at this point in the history
…utRef (#1434)

* Add inputRef prop to EuiFieldNumber and allow callbacks in select inputRef

* ref updates

* Add changelog
  • Loading branch information
Bargs authored Jan 18, 2019
1 parent e075939 commit 1a0af58
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Added `inputRef` prop to `EuiFieldNumber` and updated `EuiFieldText`'s to a Ref type ([#1434](https://github.com/elastic/eui/pull/1434))

**Bug fixes**

- Fixed `textProps` and `contentProps` of `EuiButton` and `EuiButtonEmpty` so they don’t override classes ([#1455](https://github.com/elastic/eui/pull/1455))
Expand Down
2 changes: 2 additions & 0 deletions src/components/form/field_number/field_number.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const EuiFieldNumber = ({
compressed,
prepend,
append,
inputRef,
...rest
}) => {
const classes = classNames('euiFieldNumber', className, {
Expand Down Expand Up @@ -54,6 +55,7 @@ export const EuiFieldNumber = ({
value={value}
placeholder={placeholder}
className={classes}
ref={inputRef}
{...rest}
/>
</EuiValidatableControl>
Expand Down
5 changes: 3 additions & 2 deletions src/components/form/field_number/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CommonProps } from '../../common';
import { IconType } from '../../icon'
import { IconType } from '../../icon';

import { ReactNode, SFC, InputHTMLAttributes } from 'react';
import { ReactNode, SFC, InputHTMLAttributes, Ref } from 'react';

declare module '@elastic/eui' {

Expand All @@ -18,6 +18,7 @@ declare module '@elastic/eui' {
compressed?: boolean;
prepend?: ReactNode | ReactNode[];
append?: ReactNode | ReactNode[];
inputRef?: Ref<HTMLInputElement>;
}

export const EuiFieldNumber: SFC<
Expand Down
4 changes: 2 additions & 2 deletions src/components/form/field_text/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CommonProps } from '../../common';

import { SFC, InputHTMLAttributes } from 'react';
import { SFC, InputHTMLAttributes, Ref } from 'react';

declare module '@elastic/eui' {

Expand All @@ -12,7 +12,7 @@ declare module '@elastic/eui' {
export interface EuiFieldTextProps {
icon?: string;
isInvalid?: boolean;
inputRef?: (ref: HTMLInputElement) => void;
inputRef?: Ref<HTMLInputElement>;
fullWidth?: boolean;
isLoading?: boolean;
prepend?: React.ReactNode;
Expand Down

0 comments on commit 1a0af58

Please sign in to comment.