@openmrs/esm-styleguide 5.8.2-pre.2345 → 5.8.2-pre.2352
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.turbo/turbo-build.log
CHANGED
|
@@ -45,4 +45,4 @@ WARNING in webpack performance recommendations:
|
|
|
45
45
|
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
|
|
46
46
|
For more info visit https://webpack.js.org/guides/code-splitting/
|
|
47
47
|
|
|
48
|
-
webpack 5.88.0 compiled with 3 warnings in
|
|
48
|
+
webpack 5.88.0 compiled with 3 warnings in 28212 ms
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-styleguide",
|
|
3
|
-
"version": "5.8.2-pre.
|
|
3
|
+
"version": "5.8.2-pre.2352",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "The styleguide for OpenMRS SPA",
|
|
6
6
|
"browser": "dist/openmrs-esm-styleguide.js",
|
|
@@ -63,12 +63,12 @@
|
|
|
63
63
|
"rxjs": "6.x"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@openmrs/esm-error-handling": "5.8.2-pre.
|
|
67
|
-
"@openmrs/esm-extensions": "5.8.2-pre.
|
|
68
|
-
"@openmrs/esm-navigation": "5.8.2-pre.
|
|
69
|
-
"@openmrs/esm-react-utils": "5.8.2-pre.
|
|
70
|
-
"@openmrs/esm-state": "5.8.2-pre.
|
|
71
|
-
"@openmrs/esm-translations": "5.8.2-pre.
|
|
66
|
+
"@openmrs/esm-error-handling": "5.8.2-pre.2352",
|
|
67
|
+
"@openmrs/esm-extensions": "5.8.2-pre.2352",
|
|
68
|
+
"@openmrs/esm-navigation": "5.8.2-pre.2352",
|
|
69
|
+
"@openmrs/esm-react-utils": "5.8.2-pre.2352",
|
|
70
|
+
"@openmrs/esm-state": "5.8.2-pre.2352",
|
|
71
|
+
"@openmrs/esm-translations": "5.8.2-pre.2352",
|
|
72
72
|
"@types/geopattern": "^1.2.9",
|
|
73
73
|
"autoprefixer": "^9.8.8",
|
|
74
74
|
"css-minimizer-webpack-plugin": "^1.2.0",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React, { useCallback, useContext, useMemo } from 'react';
|
|
1
|
+
import React, { Suspense, useCallback, useContext, useMemo } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { Header, HeaderGlobalAction, HeaderGlobalBar, HeaderMenuButton, HeaderName } from '@carbon/react';
|
|
4
4
|
import { DownToBottom, Maximize, Minimize } from '@carbon/react/icons';
|
|
5
5
|
import { ComponentContext, ExtensionSlot, isDesktop, useBodyScrollLock, useLayoutType } from '@openmrs/esm-react-utils';
|
|
6
6
|
import { getCoreTranslation } from '@openmrs/esm-translations';
|
|
7
|
+
import { I18nextProvider, useTranslation } from 'react-i18next';
|
|
7
8
|
|
|
8
9
|
import { ArrowLeftIcon, ArrowRightIcon, CloseIcon } from '../../icons';
|
|
9
10
|
import { WorkspaceNotification } from '../notification/workspace-notification.component';
|
|
@@ -11,7 +12,6 @@ import ActionMenu from './action-menu.component';
|
|
|
11
12
|
import { type OpenWorkspace, updateWorkspaceWindowState, useWorkspaces } from '../workspaces';
|
|
12
13
|
import { WorkspaceRenderer } from './workspace-renderer.component';
|
|
13
14
|
import styles from './workspace.module.scss';
|
|
14
|
-
import { useTranslation } from 'react-i18next';
|
|
15
15
|
|
|
16
16
|
export interface WorkspaceContainerProps {
|
|
17
17
|
contextKey: string;
|
|
@@ -105,10 +105,14 @@ export function WorkspaceContainer({
|
|
|
105
105
|
>
|
|
106
106
|
{workspaces.map((workspace, i) => (
|
|
107
107
|
<div
|
|
108
|
-
key={`workspace-container-${workspace ? workspace.name :
|
|
108
|
+
key={`workspace-container-${workspace ? workspace.name : `empty-${i}`}`}
|
|
109
109
|
className={classNames({ [styles.hiddenExtraWorkspace]: i !== 0 }, styles.workspaceInnerContainer)}
|
|
110
110
|
>
|
|
111
|
-
<
|
|
111
|
+
<Suspense fallback={null}>
|
|
112
|
+
<I18nextProvider i18n={window.i18next} defaultNS={workspace.moduleName}>
|
|
113
|
+
<Workspace workspaceInstance={workspace} additionalWorkspaceProps={additionalWorkspaceProps} />
|
|
114
|
+
</I18nextProvider>
|
|
115
|
+
</Suspense>
|
|
112
116
|
</div>
|
|
113
117
|
))}
|
|
114
118
|
</div>
|
|
@@ -126,7 +130,7 @@ interface WorkspaceProps {
|
|
|
126
130
|
}
|
|
127
131
|
|
|
128
132
|
function Workspace({ workspaceInstance, additionalWorkspaceProps }: WorkspaceProps) {
|
|
129
|
-
const { t } = useTranslation(
|
|
133
|
+
const { t } = useTranslation();
|
|
130
134
|
const layout = useLayoutType();
|
|
131
135
|
const { workspaceWindowState } = useWorkspaces();
|
|
132
136
|
const isMaximized = workspaceWindowState === 'maximized';
|
|
@@ -5,7 +5,6 @@ import userEvent from '@testing-library/user-event';
|
|
|
5
5
|
import { registerWorkspace } from '@openmrs/esm-extensions';
|
|
6
6
|
import { ComponentContext, isDesktop, useLayoutType } from '@openmrs/esm-react-utils';
|
|
7
7
|
import { type DefaultWorkspaceProps, WorkspaceContainer, launchWorkspace, useWorkspaces } from '..';
|
|
8
|
-
import { useTranslation } from 'react-i18next';
|
|
9
8
|
|
|
10
9
|
jest.mock('./workspace-renderer.component.tsx', () => {
|
|
11
10
|
return {
|
|
@@ -18,13 +17,6 @@ jest.mock('./workspace-renderer.component.tsx', () => {
|
|
|
18
17
|
};
|
|
19
18
|
});
|
|
20
19
|
|
|
21
|
-
jest.mock('react-i18next', () => ({
|
|
22
|
-
...jest.requireActual('react-i18next'),
|
|
23
|
-
useTranslation: jest.fn(),
|
|
24
|
-
}));
|
|
25
|
-
|
|
26
|
-
const mockedUseTranslation = jest.mocked(useTranslation);
|
|
27
|
-
|
|
28
20
|
const mockedIsDesktop = isDesktop as unknown as jest.Mock;
|
|
29
21
|
const mockedUseLayoutType = useLayoutType as jest.Mock;
|
|
30
22
|
|
|
@@ -38,22 +30,6 @@ interface ClinicalFormWorkspaceProps extends DefaultWorkspaceProps {
|
|
|
38
30
|
|
|
39
31
|
describe('WorkspaceContainer in window mode', () => {
|
|
40
32
|
beforeAll(() => {
|
|
41
|
-
// @ts-ignore
|
|
42
|
-
mockedUseTranslation.mockImplementation((namespace) => {
|
|
43
|
-
const getTranslations = () =>
|
|
44
|
-
namespace === '@openmrs/foo'
|
|
45
|
-
? {
|
|
46
|
-
clinicalForm: 'Clinical Form',
|
|
47
|
-
}
|
|
48
|
-
: namespace === '@openmrs/bar'
|
|
49
|
-
? { orderBasket: 'Order basket' }
|
|
50
|
-
: {};
|
|
51
|
-
|
|
52
|
-
return {
|
|
53
|
-
t: (key: string) => getTranslations()?.[key] ?? key,
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
|
|
57
33
|
registerWorkspace({
|
|
58
34
|
name: 'clinical-form',
|
|
59
35
|
title: 'clinicalForm',
|
|
@@ -78,10 +54,10 @@ describe('WorkspaceContainer in window mode', () => {
|
|
|
78
54
|
renderWorkspaceWindow();
|
|
79
55
|
act(() => launchWorkspace('clinical-form'));
|
|
80
56
|
let header = screen.getByRole('banner');
|
|
81
|
-
expect(within(header).getByText('
|
|
57
|
+
expect(within(header).getByText('clinicalForm')).toBeInTheDocument();
|
|
82
58
|
act(() => launchWorkspace('order-basket'));
|
|
83
59
|
header = screen.getByRole('banner');
|
|
84
|
-
expect(within(header).getByText('
|
|
60
|
+
expect(within(header).getByText('orderBasket')).toBeInTheDocument();
|
|
85
61
|
});
|
|
86
62
|
|
|
87
63
|
test('should override title via additional props and via setTitle', async () => {
|
|
@@ -161,7 +137,7 @@ describe('WorkspaceContainer in window mode', () => {
|
|
|
161
137
|
|
|
162
138
|
act(() => launchWorkspace('clinical-form'));
|
|
163
139
|
const header = screen.getByRole('banner');
|
|
164
|
-
expect(within(header).getByText('
|
|
140
|
+
expect(within(header).getByText('clinicalForm')).toBeInTheDocument();
|
|
165
141
|
expect(screen.getByRole('complementary').firstChild).not.toHaveClass('maximizedWindow');
|
|
166
142
|
|
|
167
143
|
const maximizeButton = await screen.findByRole('button', { name: 'Maximize' });
|