Skip to content

Commit

Permalink
[Embeddable] EUI Visual Refresh Integration (elastic#204452)
Browse files Browse the repository at this point in the history
## Summary

Related to elastic#203132.
Part of [elastic#204596](elastic#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 <[email protected]>
Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
3 people authored Dec 19, 2024
1 parent ddb34ae commit b809806
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -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
Expand All @@ -96,7 +96,7 @@ export const markdownEmbeddableFactory: ReactEmbeddableFactory<
) : (
<EuiMarkdownFormat
css={css`
padding: ${euiThemeVars.euiSizeM};
padding: ${euiTheme.size.m};
`}
>
{content ?? ''}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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,
Expand Down Expand Up @@ -150,6 +149,7 @@ export const getFieldListFactory = (
dataViews$,
selectedFieldNames$
);
const { euiTheme } = useEuiTheme();

const selectedDataView = renderDataViews?.[0];

Expand All @@ -165,7 +165,7 @@ export const getFieldListFactory = (
<EuiFlexItem
grow={false}
css={css`
padding: ${euiThemeVars.euiSizeS};
padding: ${euiTheme.size.s};
`}
>
<DataViewPicker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -157,6 +164,7 @@ export const getSavedBookEmbeddableFactory = (core: CoreStart) => {
bookAttributesManager.bookTitle,
bookAttributesManager.bookSynopsis
);
const { euiTheme } = useEuiTheme();

return (
<div
Expand All @@ -182,7 +190,7 @@ export const getSavedBookEmbeddableFactory = (core: CoreStart) => {
)}
<div
css={css`
padding: ${euiThemeVars.euiSizeM};
padding: ${euiTheme.size.m};
`}
>
<EuiFlexGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -124,6 +123,7 @@ export const getSearchEmbeddableFactory = (services: Services) => {
api,
Component: () => {
const [count, error] = useBatchedPublishingSubjects(count$, blockingError$);
const { euiTheme } = useEuiTheme();

useEffect(() => {
return () => {
Expand All @@ -138,7 +138,7 @@ export const getSearchEmbeddableFactory = (services: Services) => {
<div
css={css`
width: 100%;
padding: ${euiThemeVars.euiSizeM};
padding: ${euiTheme.size.m};
`}
>
<EuiStat
Expand Down
1 change: 0 additions & 1 deletion examples/embeddable_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit b809806

Please sign in to comment.