[kibana_react] Deprecate Exit Full Screen Button in favor of Shared UX component. (#125750)

This commit is contained in:
Clint Andrew Hall 2022-02-16 07:51:14 -06:00 committed by GitHub
parent d3201da51b
commit 6ca15e5b49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 12 deletions

View file

@ -101,4 +101,5 @@ class ExitFullScreenButtonUi extends PureComponent<ExitFullScreenButtonProps> {
}
}
/** @deprecated Use `ExitFullScreenButton` from `src/plugins/shared_ux/public`. */
export const ExitFullScreenButton = ExitFullScreenButtonUi;

View file

@ -25,8 +25,10 @@ export interface Props {
/**
* A service-enabled component that provides Kibana-specific functionality to the `ExitFullScreenButton`
* component. Use of this component requires both the `EuiTheme` context as well as the Shared UX
* `ServicesProvider`.
* component.
*
* Use of this component requires both the `EuiTheme` context as well as either a configured Shared UX
* `ServicesProvider` or the `ServicesContext` provided by the Shared UX public plugin contract.
*
* See shared-ux/public/services for information.
*/

View file

@ -5,13 +5,5 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
/* eslint-disable import/no-default-export */
import { ExitFullScreenButton } from './exit_full_screen_button';
export { ExitFullScreenButton } from './exit_full_screen_button';
/**
* Exporting the ExitFullScreenButton component as a default export so it can be
* loaded by React.lazy.
*/
export default ExitFullScreenButton;

View file

@ -13,7 +13,11 @@ import { withSuspense } from './utility';
* The Lazily-loaded `ExitFullScreenButton` component. Consumers should use `React.Suspennse` or the
* `withSuspense` HOC to load this component.
*/
export const LazyExitFullScreenButton = React.lazy(() => import('./exit_full_screen_button'));
export const LazyExitFullScreenButton = React.lazy(() =>
import('./exit_full_screen_button').then(({ ExitFullScreenButton }) => ({
default: ExitFullScreenButton,
}))
);
/**
* A `ExitFullScreenButton` component that is wrapped by the `withSuspense` HOC. This component can

View file

@ -27,8 +27,11 @@ const ServicesContext = createContext<SharedUXServices>(servicesFactory());
/**
* The `React.Context` Provider component for the `SharedUXServices` context. Any
* plugin or environemnt that consumes SharedUX components needs to wrap their React
* plugin or environment that consumes SharedUX components needs to wrap their React
* tree with this provider.
*
* Within a plugin, you can use the `ServicesContext` provided by the SharedUX plugin start
* lifeycle method.
*/
export const ServicesProvider: FC<SharedUXServices> = ({ children, ...services }) => (
<ServicesContext.Provider value={services}>{children}</ServicesContext.Provider>