diff --git a/src/plugins/expression_error/public/expression_renderers/__stories__/error_renderer.stories.tsx b/src/plugins/expression_error/public/expression_renderers/__stories__/error_renderer.stories.tsx index 07451f1f2c32..b7f789f873de 100644 --- a/src/plugins/expression_error/public/expression_renderers/__stories__/error_renderer.stories.tsx +++ b/src/plugins/expression_error/public/expression_renderers/__stories__/error_renderer.stories.tsx @@ -9,6 +9,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; +import { coreMock } from '@kbn/core/public/mocks'; import { Render } from '@kbn/presentation-util-plugin/public/__stories__'; import { getErrorRenderer } from '../error_renderer'; @@ -17,5 +18,8 @@ storiesOf('renderers/error', module).add('default', () => { const config = { error: thrownError, }; - return ; + + return ( + + ); }); diff --git a/src/plugins/expression_error/public/expression_renderers/debug_renderer.tsx b/src/plugins/expression_error/public/expression_renderers/debug_renderer.tsx index c3d422003887..29fa69aa736b 100644 --- a/src/plugins/expression_error/public/expression_renderers/debug_renderer.tsx +++ b/src/plugins/expression_error/public/expression_renderers/debug_renderer.tsx @@ -17,7 +17,6 @@ import { i18n } from '@kbn/i18n'; import { withSuspense } from '@kbn/presentation-util-plugin/public'; import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme'; import { KibanaErrorBoundary, KibanaErrorBoundaryProvider } from '@kbn/shared-ux-error-boundary'; -import { defaultTheme$ } from '@kbn/presentation-util-plugin/common'; import { JSON } from '../../common'; import { LazyDebugRenderComponent } from '../components'; @@ -38,8 +37,7 @@ const strings = { }; export const getDebugRenderer = - (theme$: Observable = defaultTheme$) => - (): ExpressionRenderDefinition => ({ + (theme$: Observable) => (): ExpressionRenderDefinition => ({ name: 'debug', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), diff --git a/src/plugins/expression_error/public/expression_renderers/error_renderer.tsx b/src/plugins/expression_error/public/expression_renderers/error_renderer.tsx index c7865525b21f..4ba3daa15d08 100644 --- a/src/plugins/expression_error/public/expression_renderers/error_renderer.tsx +++ b/src/plugins/expression_error/public/expression_renderers/error_renderer.tsx @@ -21,7 +21,6 @@ import { import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme'; import { KibanaErrorBoundary, KibanaErrorBoundaryProvider } from '@kbn/shared-ux-error-boundary'; import { withSuspense } from '@kbn/presentation-util-plugin/public'; -import { defaultTheme$ } from '@kbn/presentation-util-plugin/common'; import { ErrorRendererConfig } from '../../common/types'; import { LazyErrorRenderComponent } from '../components'; @@ -39,8 +38,7 @@ const errorStrings = { const ErrorComponent = withSuspense(LazyErrorRenderComponent); export const getErrorRenderer = - (theme$: Observable = defaultTheme$) => - (): ExpressionRenderDefinition => ({ + (theme$: Observable) => (): ExpressionRenderDefinition => ({ name: 'error', displayName: errorStrings.getDisplayName(), help: errorStrings.getHelpDescription(), diff --git a/src/plugins/expression_image/public/expression_renderers/__stories__/image_renderer.stories.tsx b/src/plugins/expression_image/public/expression_renderers/__stories__/image_renderer.stories.tsx index 02679899b112..07fb4db558bd 100644 --- a/src/plugins/expression_image/public/expression_renderers/__stories__/image_renderer.stories.tsx +++ b/src/plugins/expression_image/public/expression_renderers/__stories__/image_renderer.stories.tsx @@ -9,6 +9,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; +import { coreMock } from '@kbn/core/public/mocks'; import { Render, waitFor } from '@kbn/presentation-util-plugin/public/__stories__'; import { getElasticLogo } from '@kbn/presentation-util-plugin/common'; import { getImageRenderer } from '../image_renderer'; @@ -20,7 +21,14 @@ const Renderer = ({ elasticLogo }: { elasticLogo: string }) => { mode: ImageMode.COVER, }; - return ; + return ( + + ); }; storiesOf('renderers/image', module).add( diff --git a/src/plugins/expression_image/public/expression_renderers/image_renderer.tsx b/src/plugins/expression_image/public/expression_renderers/image_renderer.tsx index 8954bd90dc97..e80281fc10f4 100644 --- a/src/plugins/expression_image/public/expression_renderers/image_renderer.tsx +++ b/src/plugins/expression_image/public/expression_renderers/image_renderer.tsx @@ -17,7 +17,7 @@ import { IInterpreterRenderHandlers, } from '@kbn/expressions-plugin/common'; import { i18n } from '@kbn/i18n'; -import { getElasticLogo, defaultTheme$, isValidUrl } from '@kbn/presentation-util-plugin/common'; +import { getElasticLogo, isValidUrl } from '@kbn/presentation-util-plugin/common'; import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme'; import { KibanaErrorBoundary, KibanaErrorBoundaryProvider } from '@kbn/shared-ux-error-boundary'; import { ImageRendererConfig } from '../../common/types'; @@ -34,8 +34,7 @@ const strings = { }; export const getImageRenderer = - (theme$: Observable = defaultTheme$) => - (): ExpressionRenderDefinition => ({ + (theme$: Observable) => (): ExpressionRenderDefinition => ({ name: 'image', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), diff --git a/src/plugins/expression_metric/public/expression_renderers/__stories__/metric_renderer.stories.tsx b/src/plugins/expression_metric/public/expression_renderers/__stories__/metric_renderer.stories.tsx index 03c8f9d5048d..5438bb4b4287 100644 --- a/src/plugins/expression_metric/public/expression_renderers/__stories__/metric_renderer.stories.tsx +++ b/src/plugins/expression_metric/public/expression_renderers/__stories__/metric_renderer.stories.tsx @@ -9,6 +9,7 @@ import React, { CSSProperties } from 'react'; import { storiesOf } from '@storybook/react'; +import { coreMock } from '@kbn/core/public/mocks'; import { Style } from '@kbn/expressions-plugin/common'; import { Render } from '@kbn/presentation-util-plugin/public/__stories__'; import { getMetricRenderer } from '../metric_renderer'; @@ -37,6 +38,8 @@ const metricFontSpec: CSSProperties = { color: '#b83c6f', }; +const theme$ = coreMock.createStart().theme.theme$; + storiesOf('renderers/Metric', module) .add('with null metric', () => { const config: MetricRendererConfig = { @@ -46,7 +49,7 @@ storiesOf('renderers/Metric', module) label: '', metricFormat: '', }; - return ; + return ; }) .add('with number metric', () => { const config: MetricRendererConfig = { @@ -56,7 +59,7 @@ storiesOf('renderers/Metric', module) label: '', metricFormat: '', }; - return ; + return ; }) .add('with string metric', () => { const config: MetricRendererConfig = { @@ -66,7 +69,7 @@ storiesOf('renderers/Metric', module) label: '', metricFormat: '', }; - return ; + return ; }) .add('with label', () => { const config: MetricRendererConfig = { @@ -76,7 +79,7 @@ storiesOf('renderers/Metric', module) label: 'Average price', metricFormat: '', }; - return ; + return ; }) .add('with number metric and a specified format', () => { const config: MetricRendererConfig = { @@ -86,7 +89,7 @@ storiesOf('renderers/Metric', module) label: 'Average price', metricFormat: '0.00%', }; - return ; + return ; }) .add('with formatted string metric and a specified format', () => { const config: MetricRendererConfig = { @@ -96,7 +99,7 @@ storiesOf('renderers/Metric', module) label: 'Total Revenue', metricFormat: '$0a', }; - return ; + return ; }) .add('with invalid metricFont', () => { const config: MetricRendererConfig = { @@ -106,5 +109,5 @@ storiesOf('renderers/Metric', module) label: 'Total Revenue', metricFormat: '$0a', }; - return ; + return ; }); diff --git a/src/plugins/expression_metric/public/expression_renderers/metric_renderer.tsx b/src/plugins/expression_metric/public/expression_renderers/metric_renderer.tsx index b802f4f40daf..db4b8575d5e2 100644 --- a/src/plugins/expression_metric/public/expression_renderers/metric_renderer.tsx +++ b/src/plugins/expression_metric/public/expression_renderers/metric_renderer.tsx @@ -19,7 +19,6 @@ import { import { i18n } from '@kbn/i18n'; import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme'; import { KibanaErrorBoundary, KibanaErrorBoundaryProvider } from '@kbn/shared-ux-error-boundary'; -import { defaultTheme$ } from '@kbn/presentation-util-plugin/common'; import { MetricRendererConfig } from '../../common/types'; const strings = { @@ -34,8 +33,7 @@ const strings = { }; export const getMetricRenderer = - (theme$: Observable = defaultTheme$) => - (): ExpressionRenderDefinition => ({ + (theme$: Observable) => (): ExpressionRenderDefinition => ({ name: 'metric', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), diff --git a/src/plugins/expression_repeat_image/public/expression_renderers/__stories__/repeat_image_renderer.stories.tsx b/src/plugins/expression_repeat_image/public/expression_renderers/__stories__/repeat_image_renderer.stories.tsx index fa666d98ebb9..a5f58b97970c 100644 --- a/src/plugins/expression_repeat_image/public/expression_renderers/__stories__/repeat_image_renderer.stories.tsx +++ b/src/plugins/expression_repeat_image/public/expression_renderers/__stories__/repeat_image_renderer.stories.tsx @@ -9,6 +9,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; +import { coreMock } from '@kbn/core/public/mocks'; import { Render } from '@kbn/presentation-util-plugin/public/__stories__'; import { getElasticLogo, getElasticOutline } from '@kbn/presentation-util-plugin/common'; import { waitFor } from '@kbn/presentation-util-plugin/public/__stories__'; @@ -29,7 +30,13 @@ const Renderer = ({ emptyImage: elasticOutline, }; - return ; + return ( + + ); }; storiesOf('enderers/repeatImage', module).add( diff --git a/src/plugins/expression_repeat_image/public/expression_renderers/repeat_image_renderer.tsx b/src/plugins/expression_repeat_image/public/expression_renderers/repeat_image_renderer.tsx index 6dcc13293706..9a3545988088 100644 --- a/src/plugins/expression_repeat_image/public/expression_renderers/repeat_image_renderer.tsx +++ b/src/plugins/expression_repeat_image/public/expression_renderers/repeat_image_renderer.tsx @@ -20,7 +20,7 @@ import { i18n } from '@kbn/i18n'; import { I18nProvider } from '@kbn/i18n-react'; import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme'; import { KibanaErrorBoundary, KibanaErrorBoundaryProvider } from '@kbn/shared-ux-error-boundary'; -import { defaultTheme$, getElasticOutline, isValidUrl } from '@kbn/presentation-util-plugin/common'; +import { getElasticOutline, isValidUrl } from '@kbn/presentation-util-plugin/common'; import { RepeatImageRendererConfig } from '../../common/types'; const strings = { @@ -35,8 +35,7 @@ const strings = { }; export const getRepeatImageRenderer = - (theme$: Observable = defaultTheme$) => - (): ExpressionRenderDefinition => ({ + (theme$: Observable) => (): ExpressionRenderDefinition => ({ name: 'repeatImage', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), diff --git a/src/plugins/expression_reveal_image/public/expression_renderers/__stories__/reveal_image_renderer.stories.tsx b/src/plugins/expression_reveal_image/public/expression_renderers/__stories__/reveal_image_renderer.stories.tsx index 0c1a2cb5ca16..664cc9711779 100644 --- a/src/plugins/expression_reveal_image/public/expression_renderers/__stories__/reveal_image_renderer.stories.tsx +++ b/src/plugins/expression_reveal_image/public/expression_renderers/__stories__/reveal_image_renderer.stories.tsx @@ -9,6 +9,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; +import { coreMock } from '@kbn/core/public/mocks'; import { getElasticOutline, getElasticLogo } from '@kbn/presentation-util-plugin/common'; import { Render, waitFor } from '@kbn/presentation-util-plugin/public/__stories__'; import { getRevealImageRenderer } from '..'; @@ -27,7 +28,13 @@ const Renderer = ({ origin: Origin.LEFT, percent: 0.45, }; - return ; + + return ( + + ); }; storiesOf('renderers/revealImage', module).add( diff --git a/src/plugins/expression_reveal_image/public/expression_renderers/reveal_image_renderer.tsx b/src/plugins/expression_reveal_image/public/expression_renderers/reveal_image_renderer.tsx index 5beb58ef60f3..fbfe479225ec 100644 --- a/src/plugins/expression_reveal_image/public/expression_renderers/reveal_image_renderer.tsx +++ b/src/plugins/expression_reveal_image/public/expression_renderers/reveal_image_renderer.tsx @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { I18nProvider } from '@kbn/i18n-react'; import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme'; import { KibanaErrorBoundary, KibanaErrorBoundaryProvider } from '@kbn/shared-ux-error-boundary'; -import { defaultTheme$ } from '@kbn/presentation-util-plugin/common'; import { RevealImageRendererConfig } from '../../common/types'; export const strings = { @@ -35,8 +34,7 @@ export const strings = { }; export const getRevealImageRenderer = - (theme$: Observable = defaultTheme$) => - (): ExpressionRenderDefinition => ({ + (theme$: Observable) => (): ExpressionRenderDefinition => ({ name: 'revealImage', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), diff --git a/src/plugins/expression_shape/public/expression_renderers/__stories__/progress_renderer.stories.tsx b/src/plugins/expression_shape/public/expression_renderers/__stories__/progress_renderer.stories.tsx index 22e8864d1b7d..0f93314ee081 100644 --- a/src/plugins/expression_shape/public/expression_renderers/__stories__/progress_renderer.stories.tsx +++ b/src/plugins/expression_shape/public/expression_renderers/__stories__/progress_renderer.stories.tsx @@ -10,6 +10,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; import { Render } from '@kbn/presentation-util-plugin/public/__stories__'; +import { coreMock } from '@kbn/core/public/mocks'; import { getProgressRenderer } from '../progress_renderer'; import { Progress } from '../../../common'; @@ -30,5 +31,7 @@ storiesOf('renderers/progress', module).add('default', () => { valueWeight: 15, }; - return ; + return ( + + ); }); diff --git a/src/plugins/expression_shape/public/expression_renderers/__stories__/shape_renderer.stories.tsx b/src/plugins/expression_shape/public/expression_renderers/__stories__/shape_renderer.stories.tsx index 77b54ae87239..d089174c6032 100644 --- a/src/plugins/expression_shape/public/expression_renderers/__stories__/shape_renderer.stories.tsx +++ b/src/plugins/expression_shape/public/expression_renderers/__stories__/shape_renderer.stories.tsx @@ -9,6 +9,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; +import { coreMock } from '@kbn/core/public/mocks'; import { Render } from '@kbn/presentation-util-plugin/public/__stories__'; import { getShapeRenderer } from '..'; import { Shape } from '../../../common/types'; @@ -23,5 +24,7 @@ storiesOf('renderers/shape', module).add('default', () => { maintainAspect: true, }; - return ; + return ( + + ); }); diff --git a/src/plugins/expression_shape/public/expression_renderers/progress_renderer.tsx b/src/plugins/expression_shape/public/expression_renderers/progress_renderer.tsx index 80904cf12f2b..ed7629a7d87a 100644 --- a/src/plugins/expression_shape/public/expression_renderers/progress_renderer.tsx +++ b/src/plugins/expression_shape/public/expression_renderers/progress_renderer.tsx @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { I18nProvider } from '@kbn/i18n-react'; import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme'; import { KibanaErrorBoundary, KibanaErrorBoundaryProvider } from '@kbn/shared-ux-error-boundary'; -import { defaultTheme$ } from '@kbn/presentation-util-plugin/common'; import { ProgressRendererConfig } from '../../common/types'; const strings = { @@ -35,8 +34,7 @@ const strings = { }; export const getProgressRenderer = - (theme$: Observable = defaultTheme$) => - (): ExpressionRenderDefinition => ({ + (theme$: Observable) => (): ExpressionRenderDefinition => ({ name: 'progress', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), diff --git a/src/plugins/expression_shape/public/expression_renderers/shape_renderer.tsx b/src/plugins/expression_shape/public/expression_renderers/shape_renderer.tsx index 06c442ad2d8c..650033aa4542 100644 --- a/src/plugins/expression_shape/public/expression_renderers/shape_renderer.tsx +++ b/src/plugins/expression_shape/public/expression_renderers/shape_renderer.tsx @@ -20,7 +20,6 @@ import { i18n } from '@kbn/i18n'; import { I18nProvider } from '@kbn/i18n-react'; import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme'; import { KibanaErrorBoundary, KibanaErrorBoundaryProvider } from '@kbn/shared-ux-error-boundary'; -import { defaultTheme$ } from '@kbn/presentation-util-plugin/common'; import { ShapeRendererConfig } from '../../common/types'; const strings = { @@ -35,8 +34,7 @@ const strings = { }; export const getShapeRenderer = - (theme$: Observable = defaultTheme$) => - (): ExpressionRenderDefinition => ({ + (theme$: Observable) => (): ExpressionRenderDefinition => ({ name: 'shape', displayName: strings.getDisplayName(), help: strings.getHelpDescription(), diff --git a/src/plugins/presentation_util/common/index.ts b/src/plugins/presentation_util/common/index.ts index 6917c52f4edc..b0350ca4a20f 100644 --- a/src/plugins/presentation_util/common/index.ts +++ b/src/plugins/presentation_util/common/index.ts @@ -36,7 +36,6 @@ export { } from './labs'; export { - defaultTheme$, getElasticLogo, getElasticOutline, isValidUrl, diff --git a/src/plugins/presentation_util/common/lib/utils/default_theme.ts b/src/plugins/presentation_util/common/lib/utils/default_theme.ts deleted file mode 100644 index 9c86456bc251..000000000000 --- a/src/plugins/presentation_util/common/lib/utils/default_theme.ts +++ /dev/null @@ -1,15 +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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import type { CoreTheme } from '@kbn/core/public'; -import { Observable } from 'rxjs'; - -export const defaultTheme$: Observable = new Observable((subscriber) => - subscriber.next({ darkMode: false }) -); diff --git a/src/plugins/presentation_util/common/lib/utils/index.ts b/src/plugins/presentation_util/common/lib/utils/index.ts index 20b1d8450e5a..091aa216aa83 100644 --- a/src/plugins/presentation_util/common/lib/utils/index.ts +++ b/src/plugins/presentation_util/common/lib/utils/index.ts @@ -11,7 +11,6 @@ export * from './dataurl'; export * from './httpurl'; export * from './resolve_dataurl'; export * from './url'; -export { defaultTheme$ } from './default_theme'; export async function getElasticLogo() { return await import('./elastic_logo');