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 type definitions to EuiSuperSelect #1752 #1907

Merged
merged 5 commits into from
May 21, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Added `selectable` prop to `EuiCard` ([#1895](https://github.com/elastic/eui/pull/1895))
- Converted `EuiValidatableControl` to TS ([#1879](https://github.com/elastic/eui/pull/1879))
- Add type definitions to `EuiSuperSelect` ([##1752](https://github.com/elastic/eui/issues/1752))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to move this back up to master so it doesn't get tied to an old release.


**Bug fixes**

Expand Down
1 change: 1 addition & 0 deletions src/components/form/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { CommonProps } from '../common';
/// <reference path="./radio/index.d.ts" />
/// <reference path="./range/index.d.ts" />
/// <reference path="./select/index.d.ts" />
/// <reference path="./super_select/index.d.ts" />
/// <reference path="./switch/index.d.ts" />
/// <reference path="./text_area/index.d.ts" />

Expand Down
74 changes: 74 additions & 0 deletions src/components/form/super_select/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { CommonProps } from '../../common';

import {FunctionComponent, ReactNode, ButtonHTMLAttributes} from 'react';

declare module '@elastic/eui' {
/**
* @see './super_select.js'
*/

export type EuiSuperSelectProps = CommonProps & ButtonHTMLAttributes<HTMLButtonElement> & {
/**
* Classes for the context menu item
*/
itemClassName: string;

/**
* You must pass an `onChange` function to handle the update of the value
*/
onChange: (value: string) => void;

/**
* Pass an array of options that must at least include:
* `value`: storing unique value of item,
* `inputDisplay`: what shows inside the form input when selected
* `dropdownDisplay` (optional): what shows for the item in the dropdown
*/
options?: Array<{
value: string;
inputDisplay: ReactNode;
dropdownDisplay?: ReactNode;
}>;

valueOfSelected: string;

/**
* Change to `true` if you want horizontal lines between options.
* This is best used when options are multi-line.
*/
hasDividers?: boolean;

/**
* Change `EuiContextMenuItem` layout position of icon
*/
itemLayoutAlign: string;

/**
* Make it wide. Default: false
*/
fullWidth?: boolean;

/**
* Provides invalid styling. Default: false
*/
isInvalid?: boolean;

/**
* Make it short. Default: false
*/
compressed?: boolean;

/**
* Applied to the outermost wrapper (popover)
*/
popoverClassName: string;

/**
* Controls whether the options are shown. Default: false
*/
isOpen?: boolean;

};

export const EuiSuperSelect: FunctionComponent<EuiSuperSelectProps>;
}