[Embeddable] EUI Visual Refresh Integration (#204452)

## Summary

Related to https://github.com/elastic/kibana/issues/203132.
Part of [#204596](https://github.com/elastic/kibana/issues/204596).

This replaces all references to euiThemeVars in favor of the useEuiTheme
hook.

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Catherine Liu 2024-12-19 10:12:09 -08:00 committed by GitHub
parent ddb34ae6a8
commit b80980694a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 20 additions and 13 deletions

View file

@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/
import { EuiMarkdownEditor, EuiMarkdownFormat } from '@elastic/eui';
import { EuiMarkdownEditor, EuiMarkdownFormat, useEuiTheme } from '@elastic/eui';
import { css } from '@emotion/react';
import { ReactEmbeddableFactory } from '@kbn/embeddable-plugin/public';
import { i18n } from '@kbn/i18n';
@ -16,7 +16,6 @@ import {
useInheritedViewMode,
useStateFromPublishingSubject,
} from '@kbn/presentation-publishing';
import { euiThemeVars } from '@kbn/ui-theme';
import React from 'react';
import { BehaviorSubject } from 'rxjs';
import { EUI_MARKDOWN_ID } from './constants';
@ -80,6 +79,7 @@ export const markdownEmbeddableFactory: ReactEmbeddableFactory<
// get state for rendering
const content = useStateFromPublishingSubject(content$);
const viewMode = useInheritedViewMode(api) ?? 'view';
const { euiTheme } = useEuiTheme();
return viewMode === 'edit' ? (
<EuiMarkdownEditor
@ -96,7 +96,7 @@ export const markdownEmbeddableFactory: ReactEmbeddableFactory<
) : (
<EuiMarkdownFormat
css={css`
padding: ${euiThemeVars.euiSizeM};
padding: ${euiTheme.size.m};
`}
>
{content ?? ''}

View file

@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, useEuiTheme } from '@elastic/eui';
import { css } from '@emotion/react';
import type { Reference } from '@kbn/content-management-utils';
import { CoreStart } from '@kbn/core-lifecycle-browser';
@ -17,7 +17,6 @@ import { ReactEmbeddableFactory } from '@kbn/embeddable-plugin/public';
import { i18n } from '@kbn/i18n';
import { initializeTitles, useBatchedPublishingSubjects } from '@kbn/presentation-publishing';
import { LazyDataViewPicker, withSuspense } from '@kbn/presentation-util-plugin/public';
import { euiThemeVars } from '@kbn/ui-theme';
import {
UnifiedFieldListSidebarContainer,
type UnifiedFieldListSidebarContainerProps,
@ -150,6 +149,7 @@ export const getFieldListFactory = (
dataViews$,
selectedFieldNames$
);
const { euiTheme } = useEuiTheme();
const selectedDataView = renderDataViews?.[0];
@ -165,7 +165,7 @@ export const getFieldListFactory = (
<EuiFlexItem
grow={false}
css={css`
padding: ${euiThemeVars.euiSizeS};
padding: ${euiTheme.size.s};
`}
>
<DataViewPicker

View file

@ -7,7 +7,15 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/
import { EuiBadge, EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiText, EuiTitle } from '@elastic/eui';
import {
EuiBadge,
EuiCallOut,
EuiFlexGroup,
EuiFlexItem,
EuiText,
EuiTitle,
useEuiTheme,
} from '@elastic/eui';
import { css } from '@emotion/react';
import { CoreStart } from '@kbn/core-lifecycle-browser';
import { ReactEmbeddableFactory } from '@kbn/embeddable-plugin/public';
@ -18,7 +26,6 @@ import {
SerializedTitles,
useBatchedPublishingSubjects,
} from '@kbn/presentation-publishing';
import { euiThemeVars } from '@kbn/ui-theme';
import React from 'react';
import { BehaviorSubject } from 'rxjs';
import { PresentationContainer } from '@kbn/presentation-containers';
@ -157,6 +164,7 @@ export const getSavedBookEmbeddableFactory = (core: CoreStart) => {
bookAttributesManager.bookTitle,
bookAttributesManager.bookSynopsis
);
const { euiTheme } = useEuiTheme();
return (
<div
@ -182,7 +190,7 @@ export const getSavedBookEmbeddableFactory = (core: CoreStart) => {
)}
<div
css={css`
padding: ${euiThemeVars.euiSizeM};
padding: ${euiTheme.size.m};
`}
>
<EuiFlexGroup

View file

@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/
import { EuiBadge, EuiStat } from '@elastic/eui';
import { EuiBadge, EuiStat, useEuiTheme } from '@elastic/eui';
import { css } from '@emotion/react';
import { DataView } from '@kbn/data-views-plugin/common';
import { ReactEmbeddableFactory } from '@kbn/embeddable-plugin/public';
@ -17,7 +17,6 @@ import {
initializeTimeRange,
useBatchedPublishingSubjects,
} from '@kbn/presentation-publishing';
import { euiThemeVars } from '@kbn/ui-theme';
import React, { useEffect } from 'react';
import { BehaviorSubject, switchMap, tap } from 'rxjs';
import { SEARCH_EMBEDDABLE_ID } from './constants';
@ -124,6 +123,7 @@ export const getSearchEmbeddableFactory = (services: Services) => {
api,
Component: () => {
const [count, error] = useBatchedPublishingSubjects(count$, blockingError$);
const { euiTheme } = useEuiTheme();
useEffect(() => {
return () => {
@ -138,7 +138,7 @@ export const getSearchEmbeddableFactory = (services: Services) => {
<div
css={css`
width: 100%;
padding: ${euiThemeVars.euiSizeM};
padding: ${euiTheme.size.m};
`}
>
<EuiStat

View file

@ -18,7 +18,6 @@
"@kbn/dashboard-plugin",
"@kbn/embeddable-plugin",
"@kbn/presentation-publishing",
"@kbn/ui-theme",
"@kbn/i18n",
"@kbn/es-query",
"@kbn/data-views-plugin",