@openmrs/esm-styleguide 10.0.1-pre.5720 → 10.0.1-pre.5738
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 +1 -1
- package/dist/workspaces2/workspace2.component.d.ts +9 -8
- package/dist/workspaces2/workspace2.component.d.ts.map +1 -1
- package/package.json +25 -25
- package/src/workspaces2/active-workspace-window.component.tsx +2 -2
- package/src/workspaces2/active-workspace-window.test.tsx +3 -3
- package/src/workspaces2/exported-workspace.test.tsx +3 -3
- package/src/workspaces2/workspace2.component.tsx +14 -9
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
[0] Successfully compiled: 117 files, copied 171 files with swc (
|
|
1
|
+
[0] Successfully compiled: 117 files, copied 171 files with swc (167.72ms)
|
|
2
2
|
[0] swc --strip-leading-paths --copy-files src -d dist && svgo -rf dist --quiet exited with code 0
|
|
3
3
|
[1] tsc --project tsconfig.build.json exited with code 0
|
|
@@ -36,15 +36,16 @@ export interface Workspace2DefinitionProps<WorkspaceProps extends object = objec
|
|
|
36
36
|
windowName: string;
|
|
37
37
|
isRootWorkspace: boolean;
|
|
38
38
|
showActionMenu: boolean;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The props the framework actually passes to a workspace: the public `Workspace2DefinitionProps` plus
|
|
42
|
+
* the setters `<Workspace2>` uses to report its `title` and `hasUnsavedChanges` to the workspace window.
|
|
43
|
+
* Not part of the public API.
|
|
44
|
+
*/
|
|
45
|
+
export interface Workspace2InternalProps<WorkspaceProps extends object = object, WindowProps extends object = object, GroupProps extends object = object> extends Workspace2DefinitionProps<WorkspaceProps, WindowProps, GroupProps> {
|
|
46
|
+
/** Records the title of this workspace, for display in the workspace window header. */
|
|
43
47
|
setWorkspaceTitle(title: string): void;
|
|
44
|
-
/**
|
|
45
|
-
* Records whether this workspace has unsaved changes.
|
|
46
|
-
* @internal Called by `<Workspace2>`; use its `hasUnsavedChanges` prop instead.
|
|
47
|
-
*/
|
|
48
|
+
/** Records whether this workspace has unsaved changes. */
|
|
48
49
|
setHasUnsavedChanges(hasUnsavedChanges: boolean): void;
|
|
49
50
|
}
|
|
50
51
|
export type Workspace2Definition<WorkspaceProps extends object, WindowProps extends object, GroupProps extends object> = React.FC<Workspace2DefinitionProps<WorkspaceProps, WindowProps, GroupProps>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace2.component.d.ts","sourceRoot":"","sources":["../../src/workspaces2/workspace2.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzD,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,yBAAyB,CACxC,cAAc,SAAS,MAAM,GAAG,MAAM,EACtC,WAAW,SAAS,MAAM,GAAG,MAAM,EACnC,UAAU,SAAS,MAAM,GAAG,MAAM;IAElC;;;;;;OAMG;IACH,oBAAoB,CAAC,KAAK,SAAS,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzG;;;;;;OAMG;IACH,cAAc,CAAC,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,qBAAqB,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEvG,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B;;;OAGG;IACH,aAAa,CAAC,EAAE,QAAQ,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B,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB,CACtC,cAAc,SAAS,MAAM,GAAG,MAAM,EACtC,WAAW,SAAS,MAAM,GAAG,MAAM,EACnC,UAAU,SAAS,MAAM,GAAG,MAAM,CAClC,SAAQ,yBAAyB,CAAC,cAAc,EAAE,WAAW,EAAE,UAAU,CAAC;IAC1E,uFAAuF;IACvF,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvC,0DAA0D;IAC1D,oBAAoB,CAAC,iBAAiB,EAAE,OAAO,GAAG,IAAI,CAAC;CACxD;AAED,MAAM,MAAM,oBAAoB,CAC9B,cAAc,SAAS,MAAM,EAC7B,WAAW,SAAS,MAAM,EAC1B,UAAU,SAAS,MAAM,IACvB,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAAC,cAAc,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;AAEjF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAiBhD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-styleguide",
|
|
3
|
-
"version": "10.0.1-pre.
|
|
3
|
+
"version": "10.0.1-pre.5738",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "The styleguide for OpenMRS SPA",
|
|
6
6
|
"module": "dist/internal.js",
|
|
@@ -79,18 +79,18 @@
|
|
|
79
79
|
"uuid": "^11.1.1"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
|
-
"@openmrs/esm-api": "^10.0.1-pre.
|
|
83
|
-
"@openmrs/esm-config": "^10.0.1-pre.
|
|
84
|
-
"@openmrs/esm-emr-api": "^10.0.1-pre.
|
|
85
|
-
"@openmrs/esm-error-handling": "^10.0.1-pre.
|
|
86
|
-
"@openmrs/esm-extensions": "^10.0.1-pre.
|
|
87
|
-
"@openmrs/esm-globals": "^10.0.1-pre.
|
|
88
|
-
"@openmrs/esm-navigation": "^10.0.1-pre.
|
|
89
|
-
"@openmrs/esm-react-utils": "^10.0.1-pre.
|
|
90
|
-
"@openmrs/esm-routes": "^10.0.1-pre.
|
|
91
|
-
"@openmrs/esm-state": "^10.0.1-pre.
|
|
92
|
-
"@openmrs/esm-translations": "^10.0.1-pre.
|
|
93
|
-
"@openmrs/esm-utils": "^10.0.1-pre.
|
|
82
|
+
"@openmrs/esm-api": "^10.0.1-pre.5738",
|
|
83
|
+
"@openmrs/esm-config": "^10.0.1-pre.5738",
|
|
84
|
+
"@openmrs/esm-emr-api": "^10.0.1-pre.5738",
|
|
85
|
+
"@openmrs/esm-error-handling": "^10.0.1-pre.5738",
|
|
86
|
+
"@openmrs/esm-extensions": "^10.0.1-pre.5738",
|
|
87
|
+
"@openmrs/esm-globals": "^10.0.1-pre.5738",
|
|
88
|
+
"@openmrs/esm-navigation": "^10.0.1-pre.5738",
|
|
89
|
+
"@openmrs/esm-react-utils": "^10.0.1-pre.5738",
|
|
90
|
+
"@openmrs/esm-routes": "^10.0.1-pre.5738",
|
|
91
|
+
"@openmrs/esm-state": "^10.0.1-pre.5738",
|
|
92
|
+
"@openmrs/esm-translations": "^10.0.1-pre.5738",
|
|
93
|
+
"@openmrs/esm-utils": "^10.0.1-pre.5738",
|
|
94
94
|
"dayjs": "1.x",
|
|
95
95
|
"i18next": "25.x",
|
|
96
96
|
"react": "18.x",
|
|
@@ -99,18 +99,18 @@
|
|
|
99
99
|
"swr": "2.x"
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
|
-
"@openmrs/esm-api": "10.0.1-pre.
|
|
103
|
-
"@openmrs/esm-config": "10.0.1-pre.
|
|
104
|
-
"@openmrs/esm-emr-api": "10.0.1-pre.
|
|
105
|
-
"@openmrs/esm-error-handling": "10.0.1-pre.
|
|
106
|
-
"@openmrs/esm-extensions": "10.0.1-pre.
|
|
107
|
-
"@openmrs/esm-globals": "10.0.1-pre.
|
|
108
|
-
"@openmrs/esm-navigation": "10.0.1-pre.
|
|
109
|
-
"@openmrs/esm-react-utils": "10.0.1-pre.
|
|
110
|
-
"@openmrs/esm-routes": "10.0.1-pre.
|
|
111
|
-
"@openmrs/esm-state": "10.0.1-pre.
|
|
112
|
-
"@openmrs/esm-translations": "10.0.1-pre.
|
|
113
|
-
"@openmrs/esm-utils": "10.0.1-pre.
|
|
102
|
+
"@openmrs/esm-api": "10.0.1-pre.5738",
|
|
103
|
+
"@openmrs/esm-config": "10.0.1-pre.5738",
|
|
104
|
+
"@openmrs/esm-emr-api": "10.0.1-pre.5738",
|
|
105
|
+
"@openmrs/esm-error-handling": "10.0.1-pre.5738",
|
|
106
|
+
"@openmrs/esm-extensions": "10.0.1-pre.5738",
|
|
107
|
+
"@openmrs/esm-globals": "10.0.1-pre.5738",
|
|
108
|
+
"@openmrs/esm-navigation": "10.0.1-pre.5738",
|
|
109
|
+
"@openmrs/esm-react-utils": "10.0.1-pre.5738",
|
|
110
|
+
"@openmrs/esm-routes": "10.0.1-pre.5738",
|
|
111
|
+
"@openmrs/esm-state": "10.0.1-pre.5738",
|
|
112
|
+
"@openmrs/esm-translations": "10.0.1-pre.5738",
|
|
113
|
+
"@openmrs/esm-utils": "10.0.1-pre.5738",
|
|
114
114
|
"@swc/cli": "0.8.1",
|
|
115
115
|
"@swc/core": "1.15.21",
|
|
116
116
|
"@types/geopattern": "^1.2.9",
|
|
@@ -16,7 +16,7 @@ import { loadLifeCycles } from '@openmrs/esm-routes';
|
|
|
16
16
|
import { getCoreTranslation } from '@openmrs/esm-translations';
|
|
17
17
|
import { ArrowRightIcon, CloseIcon } from '../icons';
|
|
18
18
|
import { closeWorkspaceGroup2, getOpenedWindowWidth, useWorkspace2Store } from './workspace2';
|
|
19
|
-
import { type
|
|
19
|
+
import { type Workspace2InternalProps } from './workspace2.component';
|
|
20
20
|
import { type WorkspaceWindowActions } from './workspace-window-actions';
|
|
21
21
|
import styles from './workspace2.module.scss';
|
|
22
22
|
|
|
@@ -127,7 +127,7 @@ const ActiveWorkspace: React.FC<ActiveWorkspaceProps> = ({
|
|
|
127
127
|
isLeafWorkspace,
|
|
128
128
|
showActionMenu,
|
|
129
129
|
}) => {
|
|
130
|
-
const props:
|
|
130
|
+
const props: Workspace2InternalProps = useMemo(
|
|
131
131
|
() =>
|
|
132
132
|
openedWorkspace && {
|
|
133
133
|
closeWorkspace: async (options = {}) => {
|
|
@@ -5,7 +5,7 @@ import { workspace2Store, type OpenedWindow, type OpenedWorkspace } from '@openm
|
|
|
5
5
|
import { loadLifeCycles } from '@openmrs/esm-routes';
|
|
6
6
|
import ActiveWorkspaceWindow from './active-workspace-window.component';
|
|
7
7
|
import styles from './workspace2.module.scss';
|
|
8
|
-
import { type
|
|
8
|
+
import { type Workspace2InternalProps } from './workspace2.component';
|
|
9
9
|
import { type WorkspaceWindowActions } from './workspace-window-actions';
|
|
10
10
|
|
|
11
11
|
vi.mock('@openmrs/esm-routes', () => ({
|
|
@@ -14,13 +14,13 @@ vi.mock('@openmrs/esm-routes', () => ({
|
|
|
14
14
|
|
|
15
15
|
// Records the props each parcel was handed, keyed by workspace name, so tests can call them the way
|
|
16
16
|
// the workspace component would.
|
|
17
|
-
const { parcelProps } = vi.hoisted(() => ({ parcelProps: {} as Record<string,
|
|
17
|
+
const { parcelProps } = vi.hoisted(() => ({ parcelProps: {} as Record<string, Workspace2InternalProps> }));
|
|
18
18
|
vi.mock('single-spa-react/parcel', () => ({
|
|
19
19
|
default: ({
|
|
20
20
|
config,
|
|
21
21
|
wrapClassName,
|
|
22
22
|
...props
|
|
23
|
-
}: { config: { name: string }; wrapClassName?: string } &
|
|
23
|
+
}: { config: { name: string }; wrapClassName?: string } & Workspace2InternalProps) => {
|
|
24
24
|
parcelProps[props.workspaceName] = props;
|
|
25
25
|
// Surface the wrapper class the real Parcel would apply, so tests can assert stacking/visibility.
|
|
26
26
|
return (
|
|
@@ -5,7 +5,7 @@ import { workspace2Store } from '@openmrs/esm-extensions';
|
|
|
5
5
|
import { loadLifeCycles } from '@openmrs/esm-routes';
|
|
6
6
|
import { showModal } from '../modals';
|
|
7
7
|
import { ExportedWorkspace, type ExportedWorkspaceWindowInfo } from './exported-workspace.component';
|
|
8
|
-
import { type
|
|
8
|
+
import { type Workspace2InternalProps } from './workspace2.component';
|
|
9
9
|
|
|
10
10
|
vi.mock('@openmrs/esm-routes', () => ({
|
|
11
11
|
loadLifeCycles: vi.fn(),
|
|
@@ -18,9 +18,9 @@ vi.mock('../modals', () => ({
|
|
|
18
18
|
// The parcel is where the workspace component (and its <Workspace2>) would mount. We stub it out,
|
|
19
19
|
// surface the workspace name it was handed, and record its props (keyed by workspace name) so tests
|
|
20
20
|
// can call them the way the workspace component would.
|
|
21
|
-
const { parcelProps } = vi.hoisted(() => ({ parcelProps: {} as Record<string,
|
|
21
|
+
const { parcelProps } = vi.hoisted(() => ({ parcelProps: {} as Record<string, Workspace2InternalProps> }));
|
|
22
22
|
vi.mock('single-spa-react/parcel', () => ({
|
|
23
|
-
default: (props:
|
|
23
|
+
default: (props: Workspace2InternalProps) => {
|
|
24
24
|
parcelProps[props.workspaceName] = props;
|
|
25
25
|
return <div data-testid="parcel">{props.workspaceName}</div>;
|
|
26
26
|
},
|
|
@@ -42,17 +42,22 @@ export interface Workspace2DefinitionProps<
|
|
|
42
42
|
windowName: string;
|
|
43
43
|
isRootWorkspace: boolean;
|
|
44
44
|
showActionMenu: boolean;
|
|
45
|
+
}
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
/**
|
|
48
|
+
* The props the framework actually passes to a workspace: the public `Workspace2DefinitionProps` plus
|
|
49
|
+
* the setters `<Workspace2>` uses to report its `title` and `hasUnsavedChanges` to the workspace window.
|
|
50
|
+
* Not part of the public API.
|
|
51
|
+
*/
|
|
52
|
+
export interface Workspace2InternalProps<
|
|
53
|
+
WorkspaceProps extends object = object,
|
|
54
|
+
WindowProps extends object = object,
|
|
55
|
+
GroupProps extends object = object,
|
|
56
|
+
> extends Workspace2DefinitionProps<WorkspaceProps, WindowProps, GroupProps> {
|
|
57
|
+
/** Records the title of this workspace, for display in the workspace window header. */
|
|
50
58
|
setWorkspaceTitle(title: string): void;
|
|
51
59
|
|
|
52
|
-
/**
|
|
53
|
-
* Records whether this workspace has unsaved changes.
|
|
54
|
-
* @internal Called by `<Workspace2>`; use its `hasUnsavedChanges` prop instead.
|
|
55
|
-
*/
|
|
60
|
+
/** Records whether this workspace has unsaved changes. */
|
|
56
61
|
setHasUnsavedChanges(hasUnsavedChanges: boolean): void;
|
|
57
62
|
}
|
|
58
63
|
|
|
@@ -71,7 +76,7 @@ export type Workspace2Definition<
|
|
|
71
76
|
export const Workspace2: React.FC<Workspace2Props> = ({ title, children, hasUnsavedChanges = false }) => {
|
|
72
77
|
// These are bound to this workspace instance, in whichever store holds it (the global store, or an
|
|
73
78
|
// `<ExportedWorkspace>`'s local store). They skip writes that change nothing.
|
|
74
|
-
const { setHasUnsavedChanges, setWorkspaceTitle } = useWorkspace2Context();
|
|
79
|
+
const { setHasUnsavedChanges, setWorkspaceTitle } = useWorkspace2Context() as Workspace2InternalProps;
|
|
75
80
|
|
|
76
81
|
useEffect(() => {
|
|
77
82
|
setHasUnsavedChanges(hasUnsavedChanges ?? false);
|