Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inputRef prop to EuiFieldNumber and allow callbacks in select inputRef #1434

Merged
merged 4 commits into from
Jan 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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