diff --git a/src/core/public/chrome/ui/header/header.test.tsx b/src/core/public/chrome/ui/header/header.test.tsx index a72524683c99..8aa64e5beb79 100644 --- a/src/core/public/chrome/ui/header/header.test.tsx +++ b/src/core/public/chrome/ui/header/header.test.tsx @@ -36,7 +36,7 @@ import { httpServiceMock } from '../../../http/http_service.mock'; import { applicationServiceMock, chromeServiceMock } from '../../../mocks'; import { Header } from './header'; import { StubBrowserStorage } from 'test_utils/stub_browser_storage'; -import { ISidecarConfig } from 'src/core/public/overlays'; +import { ISidecarConfig, SIDECAR_DOCKED_MODE } from 'src/core/public/overlays'; jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => ({ htmlIdGenerator: () => () => 'mockId', @@ -74,7 +74,7 @@ function mockProps() { survey: '/', logos: chromeServiceMock.createStartContract().logos, sidecarConfig$: new BehaviorSubject({ - dockedMode: 'right', + dockedMode: SIDECAR_DOCKED_MODE.RIGHT, paddingSize: 640, }), }; diff --git a/src/core/public/index.ts b/src/core/public/index.ts index 459961ecf312..9ba0552fed3a 100644 --- a/src/core/public/index.ts +++ b/src/core/public/index.ts @@ -182,7 +182,13 @@ export { IHttpResponseInterceptorOverrides, } from './http'; -export { OverlayStart, OverlayBannersStart, OverlayRef, ISidecarConfig } from './overlays'; +export { + OverlayStart, + OverlayBannersStart, + OverlayRef, + ISidecarConfig, + SIDECAR_DOCKED_MODE, +} from './overlays'; export { Toast, diff --git a/src/core/public/overlays/index.ts b/src/core/public/overlays/index.ts index 8ef817de8e74..9af24d73224d 100644 --- a/src/core/public/overlays/index.ts +++ b/src/core/public/overlays/index.ts @@ -38,4 +38,5 @@ export { OverlaySidecarOpenOptions, ISidecarConfig, getOsdSidecarPaddingStyle, + SIDECAR_DOCKED_MODE, } from './sidecar'; diff --git a/src/core/public/overlays/sidecar/index.ts b/src/core/public/overlays/sidecar/index.ts index 5963bd402469..4feb755d4fbc 100644 --- a/src/core/public/overlays/sidecar/index.ts +++ b/src/core/public/overlays/sidecar/index.ts @@ -8,5 +8,6 @@ export { OverlaySidecarStart, OverlaySidecarOpenOptions, ISidecarConfig, + SIDECAR_DOCKED_MODE, } from './sidecar_service'; export { getOsdSidecarPaddingStyle } from './helper'; diff --git a/src/core/public/overlays/sidecar/resizable_button.tsx b/src/core/public/overlays/sidecar/resizable_button.tsx index 0aae5b7b43c1..0e1b956315ea 100644 --- a/src/core/public/overlays/sidecar/resizable_button.tsx +++ b/src/core/public/overlays/sidecar/resizable_button.tsx @@ -7,7 +7,7 @@ import React, { useCallback, useRef } from 'react'; import classNames from 'classnames'; import './rsizable_button.scss'; import { getPosition } from './helper'; -import { ISidecarConfig } from './sidecar_service'; +import { ISidecarConfig, SIDECAR_DOCKED_MODE } from './sidecar_service'; interface Props { isHorizontal: boolean; @@ -25,7 +25,7 @@ export const ResizableButton = ({ flyoutSize, minSize = MIN_SIDECAR_SIZE, }: Props) => { - const isHorizontal = dockedMode !== 'takeover'; + const isHorizontal = dockedMode !== SIDECAR_DOCKED_MODE.TAKEOVER; const classes = classNames('resizableButton', { 'resizableButton--vertical': !isHorizontal, diff --git a/src/core/public/overlays/sidecar/sidecar_service.mock.ts b/src/core/public/overlays/sidecar/sidecar_service.mock.ts index 10d241c58269..e74f00ca88cb 100644 --- a/src/core/public/overlays/sidecar/sidecar_service.mock.ts +++ b/src/core/public/overlays/sidecar/sidecar_service.mock.ts @@ -6,7 +6,7 @@ import type { PublicMethodsOf } from '@osd/utility-types'; import { SidecarService, OverlaySidecarStart } from './sidecar_service'; import { BehaviorSubject } from 'rxjs'; -import { ISidecarConfig } from './sidecar_service'; +import { ISidecarConfig, SIDECAR_DOCKED_MODE } from './sidecar_service'; const createStartContractMock = () => { const startContract: jest.Mocked = { @@ -14,7 +14,7 @@ const createStartContractMock = () => { setSidecarConfig: jest.fn(), getSidecarConfig$: jest.fn().mockReturnValue( new BehaviorSubject({ - dockedMode: 'right', + dockedMode: SIDECAR_DOCKED_MODE.RIGHT, paddingSize: 640, }) ), diff --git a/src/core/public/overlays/sidecar/sidecar_service.tsx b/src/core/public/overlays/sidecar/sidecar_service.tsx index 53a045fbfe1c..6324f2b2af82 100644 --- a/src/core/public/overlays/sidecar/sidecar_service.tsx +++ b/src/core/public/overlays/sidecar/sidecar_service.tsx @@ -106,9 +106,14 @@ interface StartDeps { targetDomElement: Element; } +export enum SIDECAR_DOCKED_MODE { + LEFT = 'left', + RIGHT = 'right', + TAKEOVER = 'takeover', +} export interface ISidecarConfig { // takeover mode will docked to bottom - dockedMode: 'left' | 'right' | 'takeover'; + dockedMode: SIDECAR_DOCKED_MODE; paddingSize: number; minSize?: number; isHidden?: boolean; diff --git a/src/core/public/rendering/app_containers.test.tsx b/src/core/public/rendering/app_containers.test.tsx index 1cbf30b4f01a..aa6a50524cbb 100644 --- a/src/core/public/rendering/app_containers.test.tsx +++ b/src/core/public/rendering/app_containers.test.tsx @@ -34,13 +34,13 @@ import { mount } from 'enzyme'; import React from 'react'; import { AppWrapper, AppContainer } from './app_containers'; -import { ISidecarConfig } from '../overlays'; +import { ISidecarConfig, SIDECAR_DOCKED_MODE } from '../overlays'; describe('AppWrapper', () => { it('toggles the `hidden-chrome` class depending on the chrome visibility state', () => { const chromeVisible$ = new BehaviorSubject(true); const sidecarConfig$ = new BehaviorSubject({ - dockedMode: 'right', + dockedMode: SIDECAR_DOCKED_MODE.RIGHT, paddingSize: 640, });