diff --git a/packages/kbn-user-profile-components/src/services.tsx b/packages/kbn-user-profile-components/src/services.tsx index 0e08ca911eb61..683b9ac0ce01e 100644 --- a/packages/kbn-user-profile-components/src/services.tsx +++ b/packages/kbn-user-profile-components/src/services.tsx @@ -7,10 +7,11 @@ */ import React, { FC, useContext } from 'react'; -import type { Observable } from 'rxjs'; + +import type { I18nStart } from '@kbn/core-i18n-browser'; import type { NotificationsStart, ToastOptions } from '@kbn/core-notifications-browser'; -import type { MountPoint } from '@kbn/core-mount-utils-browser'; import type { ThemeServiceStart } from '@kbn/core-theme-browser'; +import { toMountPoint } from '@kbn/react-kibana-mount'; import type { UserProfileAPIClient } from './types'; @@ -41,6 +42,7 @@ export interface UserProfilesKibanaDependencies { core: { notifications: NotificationsStart; theme: ThemeServiceStart; + i18n: I18nStart; }; security: { userProfiles: UserProfileAPIClient; @@ -52,10 +54,7 @@ export interface UserProfilesKibanaDependencies { * import { toMountPoint } from '@kbn/kibana-react-plugin/public'; * ``` */ - toMountPoint: ( - node: React.ReactNode, - options?: { theme$: Observable<{ readonly darkMode: boolean }> } - ) => MountPoint; + toMountPoint: typeof toMountPoint; } /** @@ -66,9 +65,9 @@ export const UserProfilesKibanaProvider: FC = ({ ...services }) => { const { - core: { notifications, theme }, + core: { notifications, i18n, theme }, security: { userProfiles: userProfileApiClient }, - toMountPoint, + toMountPoint: toMountPointUtility, } = services; return ( @@ -82,7 +81,7 @@ export const UserProfilesKibanaProvider: FC = ({ notifications.toasts.addSuccess( { title, - text: text ? toMountPoint(text, { theme$: theme.theme$ }) : undefined, + text: text ? toMountPointUtility(text, { i18n, theme }) : undefined, }, toastOptions ); diff --git a/packages/kbn-user-profile-components/tsconfig.json b/packages/kbn-user-profile-components/tsconfig.json index a602ca242d733..a10ea2923ff4f 100644 --- a/packages/kbn-user-profile-components/tsconfig.json +++ b/packages/kbn-user-profile-components/tsconfig.json @@ -17,7 +17,8 @@ "@kbn/core-notifications-browser", "@kbn/core", "@kbn/core-theme-browser", - "@kbn/core-mount-utils-browser", + "@kbn/react-kibana-mount", + "@kbn/core-i18n-browser", ], "exclude": [ "target/**/*", diff --git a/src/plugins/navigation/kibana.jsonc b/src/plugins/navigation/kibana.jsonc index 3c0e6246e66a9..73ab422db2fad 100644 --- a/src/plugins/navigation/kibana.jsonc +++ b/src/plugins/navigation/kibana.jsonc @@ -8,6 +8,6 @@ "browser": true, "optionalPlugins": ["cloud","security"], "requiredPlugins": ["unifiedSearch"], - "requiredBundles": ["kibanaReact"] + "requiredBundles": [] } } diff --git a/src/plugins/navigation/public/solution_nav_userprofile_toggle/solution_nav_userprofile_toggle.tsx b/src/plugins/navigation/public/solution_nav_userprofile_toggle/solution_nav_userprofile_toggle.tsx index ac33ce5d6e860..178bd8aceb680 100644 --- a/src/plugins/navigation/public/solution_nav_userprofile_toggle/solution_nav_userprofile_toggle.tsx +++ b/src/plugins/navigation/public/solution_nav_userprofile_toggle/solution_nav_userprofile_toggle.tsx @@ -19,7 +19,7 @@ import { i18n } from '@kbn/i18n'; import type { SecurityPluginStart } from '@kbn/security-plugin/public'; import { UserProfilesKibanaProvider } from '@kbn/user-profile-components'; import { CoreStart } from '@kbn/core-lifecycle-browser'; -import { toMountPoint } from '@kbn/kibana-react-plugin/public'; +import { toMountPoint } from '@kbn/react-kibana-mount'; import { useSolutionNavUserProfileToggle } from './use_solution_nav_userprofile_toggle'; diff --git a/src/plugins/navigation/tsconfig.json b/src/plugins/navigation/tsconfig.json index 0651d57bd3191..ecf3aba49c9ce 100644 --- a/src/plugins/navigation/tsconfig.json +++ b/src/plugins/navigation/tsconfig.json @@ -28,7 +28,6 @@ "@kbn/solution-nav-oblt", "@kbn/config", "@kbn/solution-nav-analytics", - "@kbn/kibana-react-plugin", "@kbn/security-plugin", "@kbn/user-profile-components", "@kbn/core-lifecycle-browser", diff --git a/x-pack/plugins/cloud_integrations/cloud_links/kibana.jsonc b/x-pack/plugins/cloud_integrations/cloud_links/kibana.jsonc index 660f6e64a2446..a8dbc9b23af63 100644 --- a/x-pack/plugins/cloud_integrations/cloud_links/kibana.jsonc +++ b/x-pack/plugins/cloud_integrations/cloud_links/kibana.jsonc @@ -12,9 +12,7 @@ "security", "guidedOnboarding" ], - "requiredBundles": [ - "kibanaReact" - ], + "requiredBundles": [], "requiredPlugins": [ "share" ] diff --git a/x-pack/plugins/cloud_integrations/cloud_links/public/maybe_add_cloud_links/theme_darkmode_toggle.tsx b/x-pack/plugins/cloud_integrations/cloud_links/public/maybe_add_cloud_links/theme_darkmode_toggle.tsx index 20085172b2c68..731dc6768c48f 100644 --- a/x-pack/plugins/cloud_integrations/cloud_links/public/maybe_add_cloud_links/theme_darkmode_toggle.tsx +++ b/x-pack/plugins/cloud_integrations/cloud_links/public/maybe_add_cloud_links/theme_darkmode_toggle.tsx @@ -19,7 +19,7 @@ import type { SecurityPluginStart } from '@kbn/security-plugin/public'; import { IUiSettingsClient } from '@kbn/core-ui-settings-browser'; import { UserProfilesKibanaProvider } from '@kbn/user-profile-components'; import { CoreStart } from '@kbn/core-lifecycle-browser'; -import { toMountPoint } from '@kbn/kibana-react-plugin/public'; +import { toMountPoint } from '@kbn/react-kibana-mount'; import { useThemeDarkmodeToggle } from './theme_darkmode_hook'; diff --git a/x-pack/plugins/cloud_integrations/cloud_links/tsconfig.json b/x-pack/plugins/cloud_integrations/cloud_links/tsconfig.json index 43f411cadf060..b7759fb7f1c5e 100644 --- a/x-pack/plugins/cloud_integrations/cloud_links/tsconfig.json +++ b/x-pack/plugins/cloud_integrations/cloud_links/tsconfig.json @@ -22,7 +22,6 @@ "@kbn/core-ui-settings-browser", "@kbn/user-profile-components", "@kbn/core-lifecycle-browser", - "@kbn/kibana-react-plugin", "@kbn/share-plugin", "@kbn/cloud", "@kbn/react-kibana-mount", diff --git a/x-pack/plugins/security/public/account_management/account_management_app.tsx b/x-pack/plugins/security/public/account_management/account_management_app.tsx index d7bb63e5a8ce7..e7a41e49f3cb5 100644 --- a/x-pack/plugins/security/public/account_management/account_management_app.tsx +++ b/x-pack/plugins/security/public/account_management/account_management_app.tsx @@ -9,22 +9,18 @@ import type { History } from 'history'; import type { FunctionComponent } from 'react'; import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; -import type { Observable } from 'rxjs'; import type { ApplicationSetup, AppMountParameters, CoreStart, - CoreTheme, StartServicesAccessor, } from '@kbn/core/public'; import { i18n } from '@kbn/i18n'; import { I18nProvider } from '@kbn/i18n-react'; -import { - KibanaContextProvider, - KibanaThemeProvider, - toMountPoint, -} from '@kbn/kibana-react-plugin/public'; +import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; +import { KibanaThemeProvider } from '@kbn/react-kibana-context-theme'; +import { toMountPoint } from '@kbn/react-kibana-mount'; import type { AuthenticationServiceSetup } from '@kbn/security-plugin-types-public'; import { Router } from '@kbn/shared-ux-router'; import { UserProfilesKibanaProvider } from '@kbn/user-profile-components'; @@ -51,7 +47,7 @@ export const accountManagementApp = Object.freeze({ }), visibleIn: [], appRoute: '/security/account', - async mount({ element, theme$, history }: AppMountParameters) { + async mount({ element, history }: AppMountParameters) { const [[coreStart], { AccountManagementPage }] = await Promise.all([ getStartServices(), import('./account_management_page'), @@ -60,7 +56,6 @@ export const accountManagementApp = Object.freeze({ render( ; history: History; authc: AuthenticationServiceSetup; securityApiClients: SecurityApiClients; @@ -87,7 +81,6 @@ export interface ProvidersProps { export const Providers: FunctionComponent = ({ services, - theme$, history, authc, securityApiClients, @@ -98,7 +91,7 @@ export const Providers: FunctionComponent = ({ - + ', () => { }, }, }; - const theme$ = themeServiceMock.createTheme$(); let history = scopedHistoryMock.create(); const authc = securityMock.createSetup().authc; @@ -55,7 +54,6 @@ describe('', () => { const { findByRole } = render( ( { const testWrapper = mount( { const testWrapper = mount( { const testWrapper = mount( { const testWrapper = mount( { const testWrapper = mount( { const testWrapper = mount( { const testWrapper = mount( { const testWrapper = mount(