diff --git a/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_Custom_Matcher.png b/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_Custom_Matcher.png index 9258323658e..10e1b2d2685 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_Custom_Matcher.png and b/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_Custom_Matcher.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_Groups.png b/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_Groups.png index c5034c96f9e..38a2db062f5 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_Groups.png and b/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_Groups.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_Nested_Options_Groups.png b/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_Nested_Options_Groups.png index c5034c96f9e..38a2db062f5 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_Nested_Options_Groups.png and b/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_Nested_Options_Groups.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_Playground.png b/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_Playground.png index c9b5b0509d1..3911b671f9b 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_Playground.png and b/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_Playground.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_With_Tooltip.png b/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_With_Tooltip.png deleted file mode 100644 index d61251e4aaa..00000000000 Binary files a/packages/eui/.loki/reference/chrome_desktop_Forms_EuiComboBox_With_Tooltip.png and /dev/null differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_Custom_Matcher.png b/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_Custom_Matcher.png index 3fa4ea31f1e..62b2e102851 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_Custom_Matcher.png and b/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_Custom_Matcher.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_Groups.png b/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_Groups.png index 3479db0db8d..bd00849b0b8 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_Groups.png and b/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_Groups.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_Nested_Options_Groups.png b/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_Nested_Options_Groups.png index 3479db0db8d..bd00849b0b8 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_Nested_Options_Groups.png and b/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_Nested_Options_Groups.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_Playground.png b/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_Playground.png index 4a8a1f8c169..1e06ba09888 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_Playground.png and b/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_Playground.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_With_Tooltip.png b/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_With_Tooltip.png deleted file mode 100644 index 0a62188a363..00000000000 Binary files a/packages/eui/.loki/reference/chrome_mobile_Forms_EuiComboBox_With_Tooltip.png and /dev/null differ diff --git a/packages/eui/changelogs/upcoming/7950.md b/packages/eui/changelogs/upcoming/7950.md new file mode 100644 index 00000000000..e3b4fde37c8 --- /dev/null +++ b/packages/eui/changelogs/upcoming/7950.md @@ -0,0 +1,3 @@ +**CSS-in-JS conversions** + +- Converted `EuiComboBox` to Emotion diff --git a/packages/eui/src/components/combo_box/__snapshots__/combo_box.test.tsx.snap b/packages/eui/src/components/combo_box/__snapshots__/combo_box.test.tsx.snap index b2c9a5808e3..0f720943656 100644 --- a/packages/eui/src/components/combo_box/__snapshots__/combo_box.test.tsx.snap +++ b/packages/eui/src/components/combo_box/__snapshots__/combo_box.test.tsx.snap @@ -2,21 +2,21 @@ exports[`EuiComboBox renders 1`] = `
styling */
- .euiComboBoxOptionsList__empty & {
- margin-bottom: 0;
- }
- }
-
- &__enterBadge {
- margin-left: $euiSizeXS;
- }
-
- &__prepend {
- margin-right: $euiSizeS;
- }
-
- &__append {
- margin-left: $euiSizeS;
- }
-
- /* Fix vertical alignment of EuiIcons in prepend/append nodes */
- &__prepend,
- &__append {
- .euiIcon {
- display: block;
- }
- }
-}
diff --git a/packages/eui/src/components/combo_box/combo_box_options_list/_combo_box_options_list.scss b/packages/eui/src/components/combo_box/combo_box_options_list/_combo_box_options_list.scss
deleted file mode 100644
index 9904605dcca..00000000000
--- a/packages/eui/src/components/combo_box/combo_box_options_list/_combo_box_options_list.scss
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * 1. Using specificity to override panel shadow
- * 2. Prevent really long input from overflowing the container.
- */
-
-.euiComboBoxOptionsList {
- max-height: 200px; // Also used/set in the JS file
- overflow: hidden;
-
- &__virtualization {
- @include euiScrollBar;
- }
-
- /* Kibana FTR affordance - without this, Selenium complains about the overlaid
- text intercepting the button click. Since `title` is always present, and
- users can't highlight or copy combobox options anyway, we might as well
- disable clicks on text */
- .euiTextTruncate {
- pointer-events: none;
- }
-}
-
-.euiComboBoxOptionsList__empty {
- @include euiTextBreakWord; /* 2 */
- padding: $euiSizeS;
- text-align: center;
- word-wrap: break-word;
-}
diff --git a/packages/eui/src/components/combo_box/combo_box_options_list/_combo_box_title.scss b/packages/eui/src/components/combo_box/combo_box_options_list/_combo_box_title.scss
deleted file mode 100644
index 5a0232e7bc4..00000000000
--- a/packages/eui/src/components/combo_box/combo_box_options_list/_combo_box_title.scss
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * 1. Force each title to be the same height as an option, so that the virtualized scroll logic
- * works.
- */
-.euiComboBoxTitle {
- display: flex;
- width: 100%;
- padding: ($euiSizeXS + $euiSizeS - 1px) $euiSizeS $euiSizeXS; /* 1 */
- font-size: $euiFontSizeXS;
- font-weight: $euiFontWeightBold;
- color: $euiColorFullShade;
-}
diff --git a/packages/eui/src/components/combo_box/combo_box_options_list/_index.scss b/packages/eui/src/components/combo_box/combo_box_options_list/_index.scss
deleted file mode 100644
index 876183f5961..00000000000
--- a/packages/eui/src/components/combo_box/combo_box_options_list/_index.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-@import 'combo_box_options_list';
-@import 'combo_box_option';
-@import 'combo_box_title';
diff --git a/packages/eui/src/components/combo_box/combo_box_options_list/combo_box_option.tsx b/packages/eui/src/components/combo_box/combo_box_options_list/combo_box_option.tsx
deleted file mode 100644
index 3f9a9636cbe..00000000000
--- a/packages/eui/src/components/combo_box/combo_box_options_list/combo_box_option.tsx
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-import React, {
- Component,
- HTMLAttributes,
- KeyboardEventHandler,
- ReactNode,
- RefCallback,
-} from 'react';
-import classNames from 'classnames';
-
-import { keys } from '../../../services';
-import { EuiComboBoxOptionOption, OptionHandler } from '../types';
-import { CommonProps } from '../../common';
-
-export interface EuiComboBoxOptionProps styling */
+ ${logicalCSS('margin-bottom', 0)}
+ }
+
+ .euiComboBoxOption__enterBadge {
+ ${logicalCSS('margin-left', euiTheme.size.xs)}
+ }
+
+ .euiComboBoxTitle {
+ display: flex;
+ ${logicalCSS('padding-horizontal', euiTheme.size.s)}
+ /* Force each title to be the same height as an option, so that the virtualized scroll logic works */
+ ${logicalCSS(
+ 'padding-top',
+ mathWithUnits(euiTheme.size.s, (x) => x + 1)
+ )}
+ ${logicalCSS('padding-bottom', euiTheme.size.xs)}
+ ${euiTitle(euiThemeContext, 'xxxs')}
+ }
+ `,
+
+ euiComboBoxOptionList__virtualization: css`
+ ${euiScrollBarStyles(euiThemeContext)}
+ `,
+
+ euiComboBoxOptionsList__empty: css`
+ padding: ${euiTheme.size.s};
+ text-align: center;
+ /* Prevent really long input from overflowing the container */
+ ${euiTextBreakWord()}
+ `,
+ };
+};
diff --git a/packages/eui/src/components/combo_box/combo_box_options_list/combo_box_options_list.tsx b/packages/eui/src/components/combo_box/combo_box_options_list/combo_box_options_list.tsx
index 2174cc76055..d70e1914773 100644
--- a/packages/eui/src/components/combo_box/combo_box_options_list/combo_box_options_list.tsx
+++ b/packages/eui/src/components/combo_box/combo_box_options_list/combo_box_options_list.tsx
@@ -15,19 +15,21 @@ import {
ListChildComponentProps,
} from 'react-window';
+import {
+ RenderWithEuiStylesMemoizer,
+ htmlIdGenerator,
+} from '../../../services';
+import { CommonProps } from '../../common';
import { EuiFlexGroup, EuiFlexItem } from '../../flex';
import { EuiHighlight } from '../../highlight';
import { EuiMark } from '../../mark';
import { EuiText } from '../../text';
import { EuiLoadingSpinner } from '../../loading';
-import { EuiComboBoxTitle } from './combo_box_title';
import { EuiI18n } from '../../i18n';
import {
EuiFilterSelectItem,
FilterChecked,
} from '../../filter_group/filter_select_item';
-import { htmlIdGenerator } from '../../../services';
-import { CommonProps } from '../../common';
import { EuiBadge } from '../../badge';
import { EuiTextTruncate } from '../../text_truncate';
import { EuiInputPopoverWidthContext } from '../../popover/input_popover';
@@ -39,6 +41,11 @@ import {
OptionHandler,
} from '../types';
import { EuiComboBoxOptionAppendPrepend } from '../utils';
+import { EuiComboBoxTitle } from './combo_box_title';
+import {
+ euiComboBoxOptionListStyles,
+ LIST_MAX_HEIGHT,
+} from './combo_box_options_list.styles';
export type EuiComboBoxOptionsListProps