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

Convert EuiSuperSelect to TS #2776

Merged
merged 10 commits into from
Jan 24, 2020
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Converted `EuiFieldSearch` to TypeScript ([#2775](https://github.com/elastic/eui/pull/2775))
- Added `data-test-subj` to the `EuiContextMenuItem` in `EuiTablePagination` ([#2778](https://github.com/elastic/eui/pull/2778))
- Improved compressed `EuiPagination` by including active and last page numbers ([#2779](https://github.com/elastic/eui/pull/2779))
- Converted `EuiSuperSelect` to TypeScript ([#2776](https://github.com/elastic/eui/pull/2776))

**Bug fixes**

Expand Down
8 changes: 5 additions & 3 deletions src/components/context_menu/context_menu_item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { getSecureRelForTarget } from '../../services';

export type EuiContextMenuItemIcon = ReactElement<any> | string | HTMLElement;

type LayoutAlignment = 'center' | 'top' | 'bottom';
export type EuiContextMenuItemLayoutAlignment = 'center' | 'top' | 'bottom';

export interface EuiContextMenuItemProps extends CommonProps {
icon?: EuiContextMenuItemIcon;
Expand All @@ -43,14 +43,16 @@ export interface EuiContextMenuItemProps extends CommonProps {
/**
* How to align icon with content of button
*/
layoutAlign?: LayoutAlignment;
layoutAlign?: EuiContextMenuItemLayoutAlignment;
}

type Props = CommonProps &
Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type'> &
EuiContextMenuItemProps;

const layoutAlignToClassNames: { [align in LayoutAlignment]: string | null } = {
const layoutAlignToClassNames: {
[align in EuiContextMenuItemLayoutAlignment]: string | null
} = {
center: null,
top: 'euiContextMenu__itemLayout--top',
bottom: 'euiContextMenu__itemLayout--bottom',
Expand Down
1 change: 1 addition & 0 deletions src/components/context_menu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export {
export {
EuiContextMenuItem,
EuiContextMenuItemIcon,
EuiContextMenuItemLayoutAlignment,
} from './context_menu_item';
1 change: 0 additions & 1 deletion src/components/form/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { CommonProps } from '../common';
/// <reference path="./super_select/index.d.ts" />

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ exports[`EuiSuperSelect props more props are propogated to each option 2`] = `
fullWidth={false}
hasDividers={false}
isInvalid={false}
isLoading={false}
onChange={[Function]}
options={
Array [
Expand Down Expand Up @@ -1032,10 +1033,10 @@ exports[`EuiSuperSelect props more props are propogated to each option 2`] = `
role="listbox"
style={
Object {
"width": null,
"width": undefined,
}
}
tabIndex="0"
tabIndex={0}
>
<EuiContextMenuItem
aria-selected={true}
Expand Down
83 changes: 0 additions & 83 deletions src/components/form/super_select/index.d.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/components/form/super_select/index.js

This file was deleted.

7 changes: 7 additions & 0 deletions src/components/form/super_select/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export { EuiSuperSelect, EuiSuperSelectProps } from './super_select';

export {
EuiSuperSelectControl,
EuiSuperSelectControlProps,
EuiSuperSelectOption,
} from './super_select_control';
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { EuiSuperSelect } from './super_select';
jest.mock('../form_row/make_id', () => () => 'generated-id');

jest.mock('../../portal', () => ({
EuiPortal: ({ children }) => children,
EuiPortal: ({ children }: any) => children,
}));

// Mock the htmlIdGenerator to generate predictable ids for snapshot tests
Expand Down
Loading