From cc8e8fe6a645a41f941104b405e549f15ee54bef Mon Sep 17 00:00:00 2001 From: Vadim Kibana <82822460+vadimkibana@users.noreply.github.com> Date: Mon, 14 Aug 2023 15:36:38 +0200 Subject: [PATCH] Update usage of deprecated EUI components in SharedUx plugins (#163560) ## Summary Partially addresses https://github.com/elastic/kibana/issues/161422 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .../public/common/example_page.tsx | 6 +-- .../public/todo/todo.tsx | 12 +++--- .../public/with_data_services/app.tsx | 6 +-- examples/ui_actions_explorer/public/app.tsx | 37 ++++++++++--------- examples/ui_actions_explorer/public/page.tsx | 25 ++++--------- .../url_service/redirect/components/page.tsx | 22 +++-------- src/plugins/share/tsconfig.json | 1 + .../public/components/page/index.tsx | 27 ++++---------- 8 files changed, 53 insertions(+), 83 deletions(-) diff --git a/examples/state_containers_examples/public/common/example_page.tsx b/examples/state_containers_examples/public/common/example_page.tsx index ab1141fd96e6c..b60fb87248d9f 100644 --- a/examples/state_containers_examples/public/common/example_page.tsx +++ b/examples/state_containers_examples/public/common/example_page.tsx @@ -7,7 +7,7 @@ */ import React, { PropsWithChildren } from 'react'; -import { EuiPage, EuiPageSideBar_Deprecated as EuiPageSideBar, EuiSideNav } from '@elastic/eui'; +import { EuiPage, EuiPageTemplate, EuiSideNav } from '@elastic/eui'; import { CoreStart } from '@kbn/core/public'; export interface ExampleLink { @@ -53,9 +53,9 @@ export const StateContainersExamplesPage: React.FC = ({ }: PropsWithChildren) => { return ( - + - + {children} ); diff --git a/examples/state_containers_examples/public/todo/todo.tsx b/examples/state_containers_examples/public/todo/todo.tsx index f7577331aee65..3abd0941da846 100644 --- a/examples/state_containers_examples/public/todo/todo.tsx +++ b/examples/state_containers_examples/public/todo/todo.tsx @@ -15,8 +15,8 @@ import { EuiCheckbox, EuiFieldText, EuiPageBody, - EuiPageContent_Deprecated as EuiPageContent, - EuiPageContentBody_Deprecated as EuiPageContentBody, + EuiPageTemplate, + EuiPageSection, EuiPageHeader, EuiPageHeaderSection, EuiSpacer, @@ -202,8 +202,8 @@ export const TodoAppPage: React.FC<{ - - + + @@ -233,8 +233,8 @@ export const TodoAppPage: React.FC<{ setUseHashedUrl(!useHashedUrl)}> {useHashedUrl ? 'Use Expanded State' : 'Use Hashed State'} - - + + ); diff --git a/examples/state_containers_examples/public/with_data_services/app.tsx b/examples/state_containers_examples/public/with_data_services/app.tsx index a70c956e17bb9..2dda3faf0db88 100644 --- a/examples/state_containers_examples/public/with_data_services/app.tsx +++ b/examples/state_containers_examples/public/with_data_services/app.tsx @@ -13,7 +13,7 @@ import { Router } from '@kbn/shared-ux-router'; import { EuiFieldText, EuiPageBody, - EuiPageContent_Deprecated as EuiPageContent, + EuiPageTemplate, EuiPageHeader, EuiText, EuiTitle, @@ -99,7 +99,7 @@ export const App = ({ useDefaultBehaviors={true} showSaveQuery={true} /> - +

In addition to state from query bar also sync your arbitrary application state:

@@ -109,7 +109,7 @@ export const App = ({ onChange={(e) => appStateContainer.set({ ...appState, name: e.target.value })} aria-label="My name" /> -
+ diff --git a/examples/ui_actions_explorer/public/app.tsx b/examples/ui_actions_explorer/public/app.tsx index b467c4c47d585..e267279296324 100644 --- a/examples/ui_actions_explorer/public/app.tsx +++ b/examples/ui_actions_explorer/public/app.tsx @@ -9,18 +9,19 @@ import React, { useState } from 'react'; import ReactDOM from 'react-dom'; -import { EuiPage } from '@elastic/eui'; - -import { EuiButton } from '@elastic/eui'; -import { EuiPageBody } from '@elastic/eui'; -import { EuiPageContent_Deprecated as EuiPageContent } from '@elastic/eui'; -import { EuiPageContentBody_Deprecated as EuiPageContentBody } from '@elastic/eui'; -import { EuiSpacer } from '@elastic/eui'; -import { EuiText } from '@elastic/eui'; -import { EuiFieldText } from '@elastic/eui'; -import { EuiCallOut } from '@elastic/eui'; -import { EuiPageHeader } from '@elastic/eui'; -import { EuiModalBody } from '@elastic/eui'; +import { + EuiPage, + EuiButton, + EuiPageBody, + EuiPageTemplate, + EuiPageSection, + EuiSpacer, + EuiText, + EuiFieldText, + EuiCallOut, + EuiPageHeader, + EuiModalBody, +} from '@elastic/eui'; import { toMountPoint } from '@kbn/kibana-react-plugin/public'; import { UiActionsStart, createAction } from '@kbn/ui-actions-plugin/public'; import { AppMountParameters, OverlayStart } from '@kbn/core/public'; @@ -39,9 +40,11 @@ const ActionsExplorer = ({ uiActionsApi, openModal }: Props) => { return ( - Ui Actions Explorer - - + + + + +

By default there is a single action attached to the `HELLO_WORLD_TRIGGER`. Clicking @@ -105,8 +108,8 @@ const ActionsExplorer = ({ uiActionsApi, openModal }: Props) => { - - + + ); diff --git a/examples/ui_actions_explorer/public/page.tsx b/examples/ui_actions_explorer/public/page.tsx index 05d64781c2ea3..a713cd89eeea1 100644 --- a/examples/ui_actions_explorer/public/page.tsx +++ b/examples/ui_actions_explorer/public/page.tsx @@ -8,14 +8,7 @@ import React from 'react'; -import { - EuiPageBody, - EuiPageContent_Deprecated as EuiPageContent, - EuiPageContentBody_Deprecated as EuiPageContentBody, - EuiPageHeader, - EuiPageHeaderSection, - EuiTitle, -} from '@elastic/eui'; +import { EuiPageBody, EuiPageTemplate, EuiPageSection, EuiPageHeader } from '@elastic/eui'; interface PageProps { title: string; @@ -25,16 +18,12 @@ interface PageProps { export function Page({ title, children }: PageProps) { return ( - - - -

{title}

- - - - - {children} - + + + + + {children} +
); } diff --git a/src/plugins/share/public/url_service/redirect/components/page.tsx b/src/plugins/share/public/url_service/redirect/components/page.tsx index 38aeafa5920d5..b64c87cd374cc 100644 --- a/src/plugins/share/public/url_service/redirect/components/page.tsx +++ b/src/plugins/share/public/url_service/redirect/components/page.tsx @@ -8,9 +8,9 @@ import * as React from 'react'; import useObservable from 'react-use/lib/useObservable'; -import { EuiPageTemplate_Deprecated as EuiPageTemplate } from '@elastic/eui'; +import { EuiPageTemplate } from '@elastic/eui'; import { ThemeServiceSetup } from '@kbn/core/public'; -import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public'; +import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme'; import { CustomBrandingStart } from '@kbn/core-custom-branding-browser'; import { Error } from './error'; import { RedirectManager } from '../redirect_manager'; @@ -28,13 +28,8 @@ export const Page: React.FC = ({ manager, theme, customBranding }) => if (error) { return ( - - + + @@ -42,13 +37,8 @@ export const Page: React.FC = ({ manager, theme, customBranding }) => } return ( - - + + diff --git a/src/plugins/share/tsconfig.json b/src/plugins/share/tsconfig.json index 396c751fccbcc..47fa82eae4c97 100644 --- a/src/plugins/share/tsconfig.json +++ b/src/plugins/share/tsconfig.json @@ -14,6 +14,7 @@ "@kbn/config-schema", "@kbn/core-custom-branding-browser", "@kbn/core-saved-objects-utils-server", + "@kbn/react-kibana-context-theme", ], "exclude": [ "target/**/*", diff --git a/x-pack/examples/ui_actions_enhanced_examples/public/components/page/index.tsx b/x-pack/examples/ui_actions_enhanced_examples/public/components/page/index.tsx index 54b930fdb982d..66b68b877da1c 100644 --- a/x-pack/examples/ui_actions_enhanced_examples/public/components/page/index.tsx +++ b/x-pack/examples/ui_actions_enhanced_examples/public/components/page/index.tsx @@ -6,14 +6,7 @@ */ import * as React from 'react'; -import { - EuiPageBody, - EuiPageContent_Deprecated as EuiPageContent, - EuiPageContentBody_Deprecated as EuiPageContentBody, - EuiPageHeader, - EuiPageHeaderSection, - EuiTitle, -} from '@elastic/eui'; +import { EuiPageBody, EuiPageTemplate, EuiPageSection, EuiPageHeader } from '@elastic/eui'; export interface PageProps { title?: React.ReactNode; @@ -22,18 +15,12 @@ export interface PageProps { export const Page: React.FC = ({ title = 'Untitled', children }) => { return ( - - - -

{title}

-
-
-
- - - {children} - - + + + + + {children} +
); };