Skip to content

Commit

Permalink
Upgrade EUI to v43.1.1 (elastic#120935)
Browse files Browse the repository at this point in the history
* eui to v43.0.0

* update themeprovider types

* update sass import location

* storyshots

* snapshots

* jest

* jest

* timepicker functional test helpers

* snapshots

* timepicker functional test helpers

* invert checked logic

* fix i18n token

* snapshots

* handle new refresh interval operations order

* refactor refresh interval logic, test

* jest

* timepicker popover order

* eui to v43.1.0

* jest

* jest

* jest

* euicode selector

* jest

* functional tests

* functional tests

* timepicker

* bump timeout

* conditional click to close

* clean up

* eui to v43.1.1

* clean up

* loading background

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
thompsongl and kibanamachine authored Dec 20, 2021
1 parent 46a0999 commit 604409b
Show file tree
Hide file tree
Showing 57 changed files with 1,040 additions and 995 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"@elastic/datemath": "link:bazel-bin/packages/elastic-datemath",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@^8.0.0-canary.35",
"@elastic/ems-client": "8.0.0",
"@elastic/eui": "41.2.3",
"@elastic/eui": "43.1.1",
"@elastic/filesaver": "1.1.2",
"@elastic/node-crypto": "1.2.1",
"@elastic/numeral": "^2.5.1",
Expand Down
2 changes: 0 additions & 2 deletions packages/elastic-eslint-config-kibana/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ module.exports = {
...[
'@elastic/eui/dist/eui_theme_light.json',
'@elastic/eui/dist/eui_theme_dark.json',
'@elastic/eui/dist/eui_theme_amsterdam_light.json',
'@elastic/eui/dist/eui_theme_amsterdam_dark.json',
].map(from => ({
from,
to: false,
Expand Down
8 changes: 4 additions & 4 deletions packages/kbn-ui-shared-deps-npm/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ module.exports = (_, argv) => {
'@elastic/eui/dist/eui_charts_theme',
'@elastic/eui/lib/services',
'@elastic/eui/lib/services/format',
'@elastic/eui/dist/eui_theme_amsterdam_light.json',
'@elastic/eui/dist/eui_theme_amsterdam_dark.json',
'@elastic/eui/dist/eui_theme_light.json',
'@elastic/eui/dist/eui_theme_dark.json',
'@elastic/numeral',
'@emotion/react',
'classnames',
Expand All @@ -96,8 +96,8 @@ module.exports = (_, argv) => {
'styled-components',
'tslib',
],
'kbn-ui-shared-deps-npm.v8.dark': ['@elastic/eui/dist/eui_theme_amsterdam_dark.css'],
'kbn-ui-shared-deps-npm.v8.light': ['@elastic/eui/dist/eui_theme_amsterdam_light.css'],
'kbn-ui-shared-deps-npm.v8.dark': ['@elastic/eui/dist/eui_theme_dark.css'],
'kbn-ui-shared-deps-npm.v8.light': ['@elastic/eui/dist/eui_theme_light.css'],
},
context: __dirname,
devtool: 'cheap-source-map',
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-ui-shared-deps-src/src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
*/

/* eslint-disable-next-line @kbn/eslint/module_migration */
import { default as v8Light } from '@elastic/eui/dist/eui_theme_amsterdam_light.json';
import { default as v8Light } from '@elastic/eui/dist/eui_theme_light.json';
/* eslint-disable-next-line @kbn/eslint/module_migration */
import { default as v8Dark } from '@elastic/eui/dist/eui_theme_amsterdam_dark.json';
import { default as v8Dark } from '@elastic/eui/dist/eui_theme_dark.json';

const globals: any = typeof window === 'undefined' ? {} : window;

Expand Down
4 changes: 2 additions & 2 deletions src/core/public/core_app/styles/_globals_v8dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
//
// prepended to all .scss imports (from JS, when v8dark theme selected)

@import '@elastic/eui/src/themes/eui-amsterdam/eui_amsterdam_colors_dark';
@import '@elastic/eui/src/themes/eui-amsterdam/eui_amsterdam_globals';
@import '@elastic/eui/src/themes/amsterdam/colors_dark';
@import '@elastic/eui/src/themes/amsterdam/globals';

@import './mixins';

Expand Down
4 changes: 2 additions & 2 deletions src/core/public/core_app/styles/_globals_v8light.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
//
// prepended to all .scss imports (from JS, when v8light theme selected)

@import '@elastic/eui/src/themes/eui-amsterdam/eui_amsterdam_colors_light';
@import '@elastic/eui/src/themes/eui-amsterdam/eui_amsterdam_globals';
@import '@elastic/eui/src/themes/amsterdam/colors_light';
@import '@elastic/eui/src/themes/amsterdam/globals';

@import './mixins';

Expand Down
38 changes: 25 additions & 13 deletions src/core/public/i18n/__snapshots__/i18n_service.test.tsx.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

142 changes: 90 additions & 52 deletions src/core/public/i18n/i18n_eui_mapping.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ export const getEuiContextMapping = (): EuiTokensObject => {
'euiAccordion.isLoading': i18n.translate('core.euiAccordion.isLoading', {
defaultMessage: 'Loading',
}),
'euiAutoRefresh.autoRefreshLabel': i18n.translate('core.euiAutoRefresh.autoRefreshLabel', {
defaultMessage: 'Auto refresh',
}),
'euiAutoRefresh.buttonLabelOff': i18n.translate('core.euiAutoRefresh.buttonLabelOff', {
defaultMessage: 'Auto refresh is off',
}),
'euiAutoRefresh.buttonLabelOn': ({ prettyInterval }: EuiValues) =>
i18n.translate('core.euiAutoRefresh.buttonLabelOn', {
defaultMessage: 'Auto refresh is on and set to {prettyInterval}',
values: { prettyInterval },
}),
'euiBasicTable.selectAllRows': i18n.translate('core.euiBasicTable.selectAllRows', {
defaultMessage: 'Select all rows',
description: 'ARIA and displayed label on a checkbox to select all table rows',
Expand Down Expand Up @@ -495,6 +506,42 @@ export const getEuiContextMapping = (): EuiTokensObject => {
defaultMessage: 'Update needed: {title}',
values: { title },
}),
'euiDisplaySelector.buttonText': i18n.translate('core.euiDisplaySelector.buttonText', {
defaultMessage: 'Display options',
}),
'euiDisplaySelector.resetButtonText': i18n.translate(
'core.euiDisplaySelector.resetButtonText',
{
defaultMessage: 'Reset to default',
}
),
'euiDisplaySelector.densityLabel': i18n.translate('core.euiDisplaySelector.densityLabel', {
defaultMessage: 'Density',
}),
'euiDisplaySelector.labelCompact': i18n.translate('core.euiDisplaySelector.labelCompact', {
defaultMessage: 'Compact',
}),
'euiDisplaySelector.labelNormal': i18n.translate('core.euiDisplaySelector.labelNormal', {
defaultMessage: 'Normal',
}),
'euiDisplaySelector.labelExpanded': i18n.translate('core.euiDisplaySelector.labelExpanded', {
defaultMessage: 'Expanded',
}),
'euiDisplaySelector.labelSingle': i18n.translate('core.euiDisplaySelector.labelSingle', {
defaultMessage: 'Single',
}),
'euiDisplaySelector.labelAuto': i18n.translate('core.euiDisplaySelector.labelAuto', {
defaultMessage: 'Auto fit',
}),
'euiDisplaySelector.labelCustom': i18n.translate('core.euiDisplaySelector.labelCustom', {
defaultMessage: 'Custom',
}),
'euiDisplaySelector.rowHeightLabel': i18n.translate('core.euiDisplaySelector.rowHeightLabel', {
defaultMessage: 'Row height',
}),
'euiDisplaySelector.lineCountLabel': i18n.translate('core.euiDisplaySelector.lineCountLabel', {
defaultMessage: 'Lines per row',
}),
'euiFieldPassword.showPassword': i18n.translate('core.euiFieldPassword.showPassword', {
defaultMessage:
'Show password as plain text. Note: this will visually expose your password on the screen.',
Expand Down Expand Up @@ -708,32 +755,13 @@ export const getEuiContextMapping = (): EuiTokensObject => {
defaultMessage: 'hide',
}
),
'euiPagination.nextPage': ({ page }: EuiValues) =>
i18n.translate('core.euiPagination.nextPage', {
defaultMessage: 'Next page, {page}',
values: { page },
}),
'euiPagination.pageOfTotalCompressed': ({ page, total }: EuiValues) => (
<FormattedMessage
id="core.euiPagination.pageOfTotalCompressed"
defaultMessage="{page} of {total}"
values={{ page, total }}
/>
),
'euiPagination.previousPage': ({ page }: EuiValues) =>
i18n.translate('core.euiPagination.previousPage', {
defaultMessage: 'Previous page, {page}',
values: { page },
}),
'euiPagination.disabledPreviousPage': i18n.translate(
'core.euiPagination.disabledPreviousPage',
{
defaultMessage: 'Previous page',
}
),
'euiPagination.disabledNextPage': i18n.translate('core.euiPagination.disabledNextPage', {
defaultMessage: 'Next page',
}),
'euiPagination.firstRangeAriaLabel': ({ lastPage }: EuiValues) =>
i18n.translate('core.euiPagination.firstRangeAriaLabel', {
defaultMessage: 'Skipping pages 2 to {lastPage}',
Expand All @@ -744,6 +772,21 @@ export const getEuiContextMapping = (): EuiTokensObject => {
defaultMessage: 'Skipping pages {firstPage} to {lastPage}',
values: { firstPage, lastPage },
}),
'euiPagination.last': i18n.translate('core.euiPagination.last', {
defaultMessage: 'Last',
}),
'euiPagination.page': i18n.translate('core.euiPagination.page', {
defaultMessage: 'Page',
}),
'euiPagination.of': i18n.translate('core.euiPagination.of', {
defaultMessage: 'of',
}),
'euiPagination.collection': i18n.translate('core.euiPagination.collection', {
defaultMessage: 'collection',
}),
'euiPagination.fromEndLabel': i18n.translate('core.euiPagination.fromEndLabel', {
defaultMessage: 'from end',
}),
'euiPaginationButton.longPageString': ({ page, totalPages }: EuiValues) =>
i18n.translate('core.euiPaginationButton.longPageString', {
defaultMessage: 'Page {page} of {totalPages}',
Expand All @@ -756,6 +799,24 @@ export const getEuiContextMapping = (): EuiTokensObject => {
values: { page },
description: 'Text to describe the current page of a paginated section',
}),
'euiPaginationButtonArrow.nextPage': i18n.translate('core.euiPaginationButtonArrow.nextPage', {
defaultMessage: 'Next page',
}),
'euiPaginationButtonArrow.previousPage': i18n.translate(
'core.euiPaginationButtonArrow.previousPage',
{
defaultMessage: 'Previous page',
}
),
'euiPaginationButtonArrow.firstPage': i18n.translate(
'core.euiPaginationButtonArrow.firstPage',
{
defaultMessage: 'First page',
}
),
'euiPaginationButtonArrow.lastPage': i18n.translate('core.euiPaginationButtonArrow.lastPage', {
defaultMessage: 'Last page',
}),
'euiPinnableListGroup.pinExtraActionLabel': i18n.translate(
'core.euiPinnableListGroup.pinExtraActionLabel',
{
Expand Down Expand Up @@ -811,20 +872,19 @@ export const getEuiContextMapping = (): EuiTokensObject => {
'euiRecentlyUsed.legend': i18n.translate('core.euiRecentlyUsed.legend', {
defaultMessage: 'Recently used date ranges',
}),
'euiRefreshInterval.fullDescription': ({ optionValue, optionText }: EuiValues) =>
i18n.translate('core.euiRefreshInterval.fullDescription', {
defaultMessage: 'Refresh interval currently set to {optionValue} {optionText}.',
values: { optionValue, optionText },
}),
'euiRefreshInterval.legend': i18n.translate('core.euiRefreshInterval.legend', {
defaultMessage: 'Refresh every',
}),
'euiRefreshInterval.start': i18n.translate('core.euiRefreshInterval.start', {
defaultMessage: 'Start',
}),
'euiRefreshInterval.stop': i18n.translate('core.euiRefreshInterval.stop', {
defaultMessage: 'Stop',
}),
'euiRefreshInterval.fullDescriptionOff': ({ optionValue, optionText }: EuiValues) =>
i18n.translate('core.euiRefreshInterval.fullDescriptionOff', {
defaultMessage: 'Refresh is off, interval set to {optionValue} {optionText}.',
values: { optionValue, optionText },
}),
'euiRefreshInterval.fullDescriptionOn': ({ optionValue, optionText }: EuiValues) =>
i18n.translate('core.euiRefreshInterval.fullDescriptionOn', {
defaultMessage: 'Refresh is on, interval set to {optionValue} {optionText}.',
values: { optionValue, optionText },
}),
'euiRelativeTab.fullDescription': ({ unit }: EuiValues) =>
i18n.translate('core.euiRelativeTab.fullDescription', {
defaultMessage: 'The unit is changeable. Currently set to {unit}.',
Expand Down Expand Up @@ -1028,28 +1088,6 @@ export const getEuiContextMapping = (): EuiTokensObject => {
defaultMessage: 'Step {number} is loading',
values: { number },
}),
'euiStyleSelector.buttonText': i18n.translate('core.euiStyleSelector.buttonText', {
defaultMessage: 'Density',
}),
'euiStyleSelector.buttonLegend': i18n.translate('core.euiStyleSelector.buttonLegend', {
defaultMessage: 'Select the display density for the data grid',
}),
'euiStyleSelector.labelExpanded': i18n.translate('core.euiStyleSelector.labelExpanded', {
defaultMessage: 'Expanded density',
}),
'euiStyleSelector.labelNormal': i18n.translate('core.euiStyleSelector.labelNormal', {
defaultMessage: 'Normal density',
}),
'euiStyleSelector.labelCompact': i18n.translate('core.euiStyleSelector.labelCompact', {
defaultMessage: 'Compact density',
}),
'euiSuperDatePicker.showDatesButtonLabel': i18n.translate(
'core.euiSuperDatePicker.showDatesButtonLabel',
{
defaultMessage: 'Show dates',
description: 'Displayed in a button that shows date picker',
}
),
'euiSuperSelect.screenReaderAnnouncement': i18n.translate(
'core.euiSuperSelect.screenReaderAnnouncement',
{
Expand Down
7 changes: 4 additions & 3 deletions src/core/public/theme/convert_core_theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@
* Side Public License, v 1.
*/

import type { EuiThemeSystem, EuiThemeColorMode } from '@elastic/eui';
import { COLOR_MODES_STANDARD } from '@elastic/eui';
import type { EuiThemeSystem, EuiThemeColorModeStandard } from '@elastic/eui';
import type { CoreTheme } from './types';

/** @internal */
export interface EuiTheme {
colorMode: EuiThemeColorMode;
colorMode: EuiThemeColorModeStandard;
euiThemeSystem?: EuiThemeSystem;
}

/** @internal */
export const convertCoreTheme = (coreTheme: CoreTheme): EuiTheme => {
const { darkMode } = coreTheme;
return {
colorMode: darkMode ? 'DARK' : 'LIGHT',
colorMode: darkMode ? COLOR_MODES_STANDARD.dark : COLOR_MODES_STANDARD.light,
};
};
3 changes: 2 additions & 1 deletion src/core/public/theme/core_theme_provider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ import { act } from 'react-dom/test-utils';
import type { ReactWrapper } from 'enzyme';
import { of, BehaviorSubject } from 'rxjs';
import { useEuiTheme } from '@elastic/eui';
import type { UseEuiTheme } from '@elastic/eui';
import { mountWithIntl } from '@kbn/test/jest';
import { CoreThemeProvider } from './core_theme_provider';
import type { CoreTheme } from './types';

describe('CoreThemeProvider', () => {
let euiTheme: ReturnType<typeof useEuiTheme> | undefined;
let euiTheme: UseEuiTheme | undefined;

beforeEach(() => {
euiTheme = undefined;
Expand Down
Loading

0 comments on commit 604409b

Please sign in to comment.