From 42c4265b95d96246caad5f7f54d0bada00ade621 Mon Sep 17 00:00:00 2001 From: Greg Thompson Date: Tue, 4 Jun 2019 16:54:45 -0500 Subject: [PATCH 1/2] fix euiSuperSelect ts defs --- .../__snapshots__/super_select.test.js.snap | 3 --- src/components/form/super_select/index.d.ts | 23 +++++++++++++------ .../form/super_select/super_select.js | 5 +++- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/components/form/super_select/__snapshots__/super_select.test.js.snap b/src/components/form/super_select/__snapshots__/super_select.test.js.snap index 8c5d0163611..a3fa033b8ed 100644 --- a/src/components/form/super_select/__snapshots__/super_select.test.js.snap +++ b/src/components/form/super_select/__snapshots__/super_select.test.js.snap @@ -448,7 +448,6 @@ exports[`EuiSuperSelect props more props are propogated to each option 2`] = ` fullWidth={false} isInvalid={false} isLoading={false} - onChange={[Function]} onClick={[Function]} onKeyDown={[Function]} options={ @@ -499,7 +498,6 @@ exports[`EuiSuperSelect props more props are propogated to each option 2`] = ` fullWidth={false} isInvalid={false} isLoading={false} - onChange={[Function]} onClick={[Function]} onKeyDown={[Function]} options={ @@ -563,7 +561,6 @@ exports[`EuiSuperSelect props more props are propogated to each option 2`] = ` aria-selected={true} className="euiSuperSelectControl euiSuperSelect--isOpen__button" data-test-subj="superSelect" - onChange={[Function]} onClick={[Function]} onKeyDown={[Function]} role="option" diff --git a/src/components/form/super_select/index.d.ts b/src/components/form/super_select/index.d.ts index bff18e7858d..a161f69d606 100644 --- a/src/components/form/super_select/index.d.ts +++ b/src/components/form/super_select/index.d.ts @@ -1,4 +1,4 @@ -import { CommonProps } from '../../common'; +import { CommonProps, Omit } from '../../common'; import { FunctionComponent, ReactNode, ButtonHTMLAttributes } from 'react'; @@ -7,8 +7,8 @@ declare module '@elastic/eui' { * @see './super_select.js' */ - export type EuiSuperSelectProps = CommonProps & - ButtonHTMLAttributes & { + export type EuiSuperSelectProps = CommonProps & + Omit, 'onChange'> & { /** * Pass an array of options that must at least include: * `value`: storing unique value of item, @@ -16,12 +16,14 @@ declare module '@elastic/eui' { * `dropdownDisplay` (optional): what shows for the item in the dropdown */ options: Array<{ - value: string; + value: T; inputDisplay?: ReactNode; dropdownDisplay?: ReactNode; + disabled?: boolean; + 'data-test-subj'?: string; }>; - valueOfSelected?: string; + valueOfSelected?: T; /** * Classes for the context menu item @@ -31,7 +33,7 @@ declare module '@elastic/eui' { /** * You must pass an `onChange` function to handle the update of the value */ - onChange?: (value: string) => void; + onChange?: (value: T) => void; /** * Change to `true` if you want horizontal lines between options. @@ -54,6 +56,11 @@ declare module '@elastic/eui' { */ isInvalid?: boolean; + /** + * Provides a loading indicator. Default: false + */ + isLoading?: boolean; + /** * Make it short. Default: false */ @@ -70,5 +77,7 @@ declare module '@elastic/eui' { isOpen?: boolean; }; - export const EuiSuperSelect: FunctionComponent; + export const EuiSuperSelect: ( + props: EuiSuperSelectProps + ) => ReturnType>>; } diff --git a/src/components/form/super_select/super_select.js b/src/components/form/super_select/super_select.js index 687562eda1e..7ea860c41ba 100644 --- a/src/components/form/super_select/super_select.js +++ b/src/components/form/super_select/super_select.js @@ -195,7 +195,6 @@ export class EuiSuperSelect extends Component { Date: Tue, 4 Jun 2019 17:58:43 -0500 Subject: [PATCH 2/2] #1995 CL entry --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa939384164..4c13a0f05b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ## [`master`](https://github.com/elastic/eui/tree/master) -No public interface changes since `11.3.0`. +**Bug fixes** + +- Fixed `EuiSuperSelect` TS definitions ([#1995](https://github.com/elastic/eui/pull/1995)) ## [`11.3.0`](https://github.com/elastic/eui/tree/v11.3.0)