From 508686dc7cb486771fb96330f6b7da52699fbd99 Mon Sep 17 00:00:00 2001 From: Dimitri Mitropoulos Date: Fri, 7 Feb 2020 21:50:06 -0500 Subject: [PATCH 01/13] first pass at ComboBox components --- package.json | 2 + src/components/badge/badge.tsx | 7 +- .../__snapshots__/combo_box.test.js.snap | 524 ------------------ .../{combo_box.test.js => combo_box.test.tsx} | 46 +- .../combo_box/{combo_box.js => combo_box.tsx} | 446 ++++++++------- ...combo_box_input.js => combo_box_input.tsx} | 213 +++---- .../{combo_box_pill.js => combo_box_pill.tsx} | 50 +- .../combo_box_input/{index.js => index.ts} | 0 ...mbo_box_option.js => combo_box_option.tsx} | 49 +- ...ons_list.js => combo_box_options_list.tsx} | 174 +++--- .../{index.js => index.ts} | 0 src/components/combo_box/index.d.ts | 113 +--- src/components/combo_box/index.js | 1 - src/components/combo_box/index.ts | 16 + .../combo_box/matching_options.test.ts | 18 +- src/components/combo_box/matching_options.ts | 26 +- yarn.lock | 12 + 17 files changed, 608 insertions(+), 1089 deletions(-) delete mode 100644 src/components/combo_box/__snapshots__/combo_box.test.js.snap rename src/components/combo_box/{combo_box.test.js => combo_box.test.tsx} (90%) rename src/components/combo_box/{combo_box.js => combo_box.tsx} (74%) rename src/components/combo_box/combo_box_input/{combo_box_input.js => combo_box_input.tsx} (60%) rename src/components/combo_box/combo_box_input/{combo_box_pill.js => combo_box_pill.tsx} (71%) rename src/components/combo_box/combo_box_input/{index.js => index.ts} (100%) rename src/components/combo_box/combo_box_options_list/{combo_box_option.js => combo_box_option.tsx} (61%) rename src/components/combo_box/combo_box_options_list/{combo_box_options_list.js => combo_box_options_list.tsx} (72%) rename src/components/combo_box/combo_box_options_list/{index.js => index.ts} (100%) delete mode 100644 src/components/combo_box/index.js create mode 100644 src/components/combo_box/index.ts diff --git a/package.json b/package.json index 6d77bfa6d9c..79fe76e120f 100644 --- a/package.json +++ b/package.json @@ -89,8 +89,10 @@ "@types/jest": "^24.0.6", "@types/react": "^16.9.11", "@types/react-dom": "^16.9.4", + "@types/react-input-autosize": "^2.0.1", "@types/react-is": "^16.7.1", "@types/resize-observer-browser": "^0.1.1", + "@types/sinon": "^7.5.1", "@types/tabbable": "^3.1.0", "@types/uuid": "^3.4.4", "@typescript-eslint/eslint-plugin": "^1.13.0", diff --git a/src/components/badge/badge.tsx b/src/components/badge/badge.tsx index 8cb7def8d7b..295769f688d 100644 --- a/src/components/badge/badge.tsx +++ b/src/components/badge/badge.tsx @@ -1,7 +1,8 @@ import React, { + AriaAttributes, FunctionComponent, - MouseEventHandler, HTMLAttributes, + MouseEventHandler, ReactNode, } from 'react'; import classNames from 'classnames'; @@ -22,7 +23,7 @@ type WithButtonProps = { /** * Aria label applied to the onClick button */ - onClickAriaLabel: string; + onClickAriaLabel: AriaAttributes['aria-label']; } & Omit, 'onClick' | 'color'>; type WithSpanProps = Omit, 'onClick' | 'color'>; @@ -36,7 +37,7 @@ interface WithIconOnClick { /** * Aria label applied to the iconOnClick button */ - iconOnClickAriaLabel: string; + iconOnClickAriaLabel: AriaAttributes['aria-label']; } export type EuiBadgeProps = { diff --git a/src/components/combo_box/__snapshots__/combo_box.test.js.snap b/src/components/combo_box/__snapshots__/combo_box.test.js.snap deleted file mode 100644 index 298bcdf7af9..00000000000 --- a/src/components/combo_box/__snapshots__/combo_box.test.js.snap +++ /dev/null @@ -1,524 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`EuiComboBox is rendered 1`] = ` -