@kenyaemr/esm-bed-management-app 1.0.1-pre.11
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/.editorconfig +12 -0
- package/.eslintignore +2 -0
- package/.eslintrc +37 -0
- package/.husky/pre-commit +4 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.prettierignore +14 -0
- package/.turbo.json +18 -0
- package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +541 -0
- package/.yarn/plugins/@yarnpkg/plugin-version.cjs +550 -0
- package/.yarn/versions/3d353a50.yml +0 -0
- package/LICENSE +373 -0
- package/README.md +40 -0
- package/dist/207.js +1 -0
- package/dist/207.js.map +1 -0
- package/dist/26.js +2 -0
- package/dist/26.js.LICENSE.txt +32 -0
- package/dist/26.js.map +1 -0
- package/dist/283.js +1 -0
- package/dist/283.js.map +1 -0
- package/dist/294.js +2 -0
- package/dist/294.js.LICENSE.txt +9 -0
- package/dist/294.js.map +1 -0
- package/dist/330.js +2 -0
- package/dist/330.js.LICENSE.txt +44 -0
- package/dist/330.js.map +1 -0
- package/dist/404.js +1 -0
- package/dist/404.js.map +1 -0
- package/dist/455.js +2 -0
- package/dist/455.js.LICENSE.txt +9 -0
- package/dist/455.js.map +1 -0
- package/dist/558.js +2 -0
- package/dist/558.js.LICENSE.txt +14 -0
- package/dist/558.js.map +1 -0
- package/dist/574.js +1 -0
- package/dist/629.js +1 -0
- package/dist/629.js.map +1 -0
- package/dist/637.js +1 -0
- package/dist/637.js.map +1 -0
- package/dist/707.js +1 -0
- package/dist/707.js.map +1 -0
- package/dist/800.js +2 -0
- package/dist/800.js.LICENSE.txt +3 -0
- package/dist/800.js.map +1 -0
- package/dist/850.js +1 -0
- package/dist/850.js.map +1 -0
- package/dist/884.js +1 -0
- package/dist/884.js.map +1 -0
- package/dist/933.js +1 -0
- package/dist/933.js.map +1 -0
- package/dist/esm-kenyaemr-bed-management-app.js +1 -0
- package/dist/esm-kenyaemr-bed-management-app.js.buildmanifest.json +506 -0
- package/dist/esm-kenyaemr-bed-management-app.js.map +1 -0
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -0
- package/dist/routes.json +1 -0
- package/i18next-parser.config.js +89 -0
- package/jest.config.js +0 -0
- package/package.json +112 -0
- package/src/__mocks__/react-i18next.js +55 -0
- package/src/admin-card-link.component.tsx +27 -0
- package/src/assets/landing-page.png +0 -0
- package/src/assets/logo.svg +1 -0
- package/src/bed-administration/bed-administration-form.component.tsx +326 -0
- package/src/bed-administration/bed-administration-form.scss +0 -0
- package/src/bed-administration/bed-administration-table.component.tsx +317 -0
- package/src/bed-administration/bed-administration-table.scss +112 -0
- package/src/bed-administration/bed-administration-types.ts +20 -0
- package/src/bed-administration/bed-administration.resource.ts +59 -0
- package/src/bed-administration/edit-bed-form.component.tsx +100 -0
- package/src/bed-administration/new-bed-form.component.tsx +112 -0
- package/src/bed-admission/active-patients/active-patients-table.component.tsx +299 -0
- package/src/bed-admission/active-patients/active-visits.resource.ts +171 -0
- package/src/bed-admission/active-patients/admission-action-button-styles.scss +0 -0
- package/src/bed-admission/active-patients/admission-action-button.component.tsx +26 -0
- package/src/bed-admission/active-patients/index.tsx +15 -0
- package/src/bed-admission/active-patients/patient-queues.resource.ts +136 -0
- package/src/bed-admission/active-patients/styles.scss +284 -0
- package/src/bed-admission/active-patients/view-action-menu.component.tsx +33 -0
- package/src/bed-admission/admitted-patients/active-admissions.resource.ts +125 -0
- package/src/bed-admission/admitted-patients/admitted-patients-table.component.tsx +280 -0
- package/src/bed-admission/admitted-patients/admitted-patients.component.tsx +22 -0
- package/src/bed-admission/admitted-patients/location-combo-box.component.tsx +55 -0
- package/src/bed-admission/admitted-patients/styles.scss +284 -0
- package/src/bed-admission/bed-admission-tabs-styles.scss +30 -0
- package/src/bed-admission/bed-admission-tabs.component.tsx +69 -0
- package/src/bed-admission/bed-admission.component.tsx +15 -0
- package/src/bed-admission/bed-admission.resource.ts +52 -0
- package/src/bed-admission/bed-layout/bed-layout-list.component.tsx +101 -0
- package/src/bed-admission/bed-layout/bed-layout.component.tsx +64 -0
- package/src/bed-admission/bed-layout/bed-layout.scss +118 -0
- package/src/bed-admission/bed-layout/min-bed-layout.component.tsx +26 -0
- package/src/bed-admission/bed-tag/bed-tag-administration-table.component.tsx +217 -0
- package/src/bed-admission/bed-tag/bed-tags-admin-form.component.tsx +131 -0
- package/src/bed-admission/bed-tag/edit-tag-form.component.tsx +80 -0
- package/src/bed-admission/bed-tag/new-tag-form.component.tsx +83 -0
- package/src/bed-admission/bed-type/bed-type-admin-form.component.tsx +173 -0
- package/src/bed-admission/bed-type/bed-type-administration-table.component.tsx +222 -0
- package/src/bed-admission/bed-type/edit-bed-type.component.tsx +80 -0
- package/src/bed-admission/bed-type/new-bed-type-form.component.tsx +87 -0
- package/src/bed-admission/createDashboardLink.tsx +47 -0
- package/src/bed-admission/discharged-patients/discharged-patients.componet.tsx +19 -0
- package/src/bed-admission/helpers/functions.ts +102 -0
- package/src/bed-admission/types.ts +133 -0
- package/src/config-schema.ts +31 -0
- package/src/declarations.d.ts +7 -0
- package/src/empty-state/empty-state.component.tsx +69 -0
- package/src/empty-state/empty-state.scss +62 -0
- package/src/header/header.component.tsx +51 -0
- package/src/header/header.scss +72 -0
- package/src/header/illustration.component.tsx +13 -0
- package/src/home.component.tsx +15 -0
- package/src/home.scss +5 -0
- package/src/index.ts +78 -0
- package/src/left-panel/left-panel.component.tsx +33 -0
- package/src/left-panel/left-panel.scss +41 -0
- package/src/left-panel-link.component.tsx +49 -0
- package/src/root.component.tsx +39 -0
- package/src/root.scss +11 -0
- package/src/routes.json +56 -0
- package/src/setup-tests.ts +1 -0
- package/src/summary/summary.component.tsx +74 -0
- package/src/summary/summary.resource.ts +211 -0
- package/src/summary/summary.scss +72 -0
- package/src/types.ts +163 -0
- package/src/ward-card/ward-card.component.tsx +41 -0
- package/src/ward-card/ward-card.scss +51 -0
- package/src/ward-with-beds/ward-with-beds.component.tsx +186 -0
- package/src/ward-with-beds/ward-with-beds.scss +27 -0
- package/src/workspace/allocate-bed-workspace.component.tsx +188 -0
- package/src/workspace/allocate-bed.scss +124 -0
- package/src/workspace/overlay.component.tsx +55 -0
- package/src/workspace/overlay.scss +96 -0
- package/translations/en.json +7 -0
- package/tsconfig.json +23 -0
- package/webpack.config.js +1 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@use '@carbon/layout';
|
|
2
|
+
|
|
3
|
+
.container {
|
|
4
|
+
margin: 1rem;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.backButton {
|
|
8
|
+
align-items: center;
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: flex-start;
|
|
11
|
+
margin-left: 1rem;
|
|
12
|
+
|
|
13
|
+
button {
|
|
14
|
+
display: flex;
|
|
15
|
+
padding-left: 0 !important;
|
|
16
|
+
|
|
17
|
+
svg {
|
|
18
|
+
order: 1;
|
|
19
|
+
margin-right: layout.$spacing-03;
|
|
20
|
+
margin-left: 0.5 !important;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
span {
|
|
24
|
+
order: 2;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import React, { useCallback, useState } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { Stack, ButtonSet, Button } from "@carbon/react";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import {
|
|
6
|
+
openmrsFetch,
|
|
7
|
+
showNotification,
|
|
8
|
+
showToast,
|
|
9
|
+
useConfig,
|
|
10
|
+
useLayoutType,
|
|
11
|
+
} from "@openmrs/esm-framework";
|
|
12
|
+
import styles from "./allocate-bed.scss";
|
|
13
|
+
import Overlay from "./overlay.component";
|
|
14
|
+
import {
|
|
15
|
+
assignPatientBed,
|
|
16
|
+
endPatientQueue,
|
|
17
|
+
findLatestClinicalEncounter,
|
|
18
|
+
} from "../bed-admission/bed-admission.resource";
|
|
19
|
+
import BedLayoutList from "../bed-admission/bed-layout/bed-layout-list.component";
|
|
20
|
+
import LocationComboBox from "../bed-admission/admitted-patients/location-combo-box.component";
|
|
21
|
+
import { Bed } from "../types";
|
|
22
|
+
import useSWR from "swr";
|
|
23
|
+
import { EmptyState } from "@openmrs/esm-patient-common-lib";
|
|
24
|
+
|
|
25
|
+
interface WorkSpaceProps {
|
|
26
|
+
closePanel: (e: boolean) => void;
|
|
27
|
+
headerTitle?: string;
|
|
28
|
+
queueStatus: string;
|
|
29
|
+
patientDetails: {
|
|
30
|
+
name: string;
|
|
31
|
+
patientUuid: string;
|
|
32
|
+
locationUuid: string;
|
|
33
|
+
locationTo: string;
|
|
34
|
+
locationFrom: string;
|
|
35
|
+
queueUuid: string;
|
|
36
|
+
encounter: {
|
|
37
|
+
uuid: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const AllocateBedWorkSpace: React.FC<WorkSpaceProps> = ({
|
|
43
|
+
headerTitle,
|
|
44
|
+
closePanel,
|
|
45
|
+
patientDetails,
|
|
46
|
+
queueStatus,
|
|
47
|
+
}) => {
|
|
48
|
+
const { t } = useTranslation();
|
|
49
|
+
const isTablet = useLayoutType() === "tablet";
|
|
50
|
+
const {
|
|
51
|
+
restrictWardAdministrationToLoginLocation,
|
|
52
|
+
admissionFormUuid,
|
|
53
|
+
admissionEncounterTypeUuid,
|
|
54
|
+
} = useConfig();
|
|
55
|
+
const locationsUrl = `/ws/rest/v1/encounter?patient=${patientDetails.patientUuid}&encounterType=${admissionEncounterTypeUuid}&v=default`;
|
|
56
|
+
const {
|
|
57
|
+
data: encounters,
|
|
58
|
+
error,
|
|
59
|
+
isLoading: isLoadingEncounters,
|
|
60
|
+
} = useSWR<{ data }>(locationsUrl, openmrsFetch);
|
|
61
|
+
const [selectedBed, setSelectedBed] = useState<Bed>();
|
|
62
|
+
const [isBedAssigned, setIsBedAssigned] = useState(false);
|
|
63
|
+
const [isQueueEnded, setIsQueueEnded] = useState(false);
|
|
64
|
+
const [locationUuid, setLocation] = useState(
|
|
65
|
+
restrictWardAdministrationToLoginLocation ? patientDetails.locationUuid : ""
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
let lastClinicalEncounter;
|
|
69
|
+
if (admissionEncounterTypeUuid !== undefined) {
|
|
70
|
+
const { data } = findLatestClinicalEncounter(
|
|
71
|
+
patientDetails.patientUuid,
|
|
72
|
+
admissionEncounterTypeUuid,
|
|
73
|
+
encounters,
|
|
74
|
+
admissionFormUuid
|
|
75
|
+
);
|
|
76
|
+
lastClinicalEncounter = data;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const handleClick = (bed) => {
|
|
80
|
+
setSelectedBed(bed);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const handleAssignBedToPatient = useCallback(() => {
|
|
84
|
+
if (lastClinicalEncounter === "") {
|
|
85
|
+
showNotification({
|
|
86
|
+
title: t("errorAssigningBed", "Error assigning bed"),
|
|
87
|
+
kind: "error",
|
|
88
|
+
critical: true,
|
|
89
|
+
description: t(
|
|
90
|
+
"admissionEncounterRequired",
|
|
91
|
+
"This operation requires an admission encounter filled first"
|
|
92
|
+
),
|
|
93
|
+
});
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const patientAndEncounterUuids = {
|
|
98
|
+
encounterUuid: lastClinicalEncounter,
|
|
99
|
+
patientUuid: patientDetails.patientUuid,
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
assignPatientBed(patientAndEncounterUuids, selectedBed.bedId)
|
|
103
|
+
.then(() => {
|
|
104
|
+
setIsBedAssigned(true);
|
|
105
|
+
showToast({
|
|
106
|
+
title: t("bedAssigned", "Bed Assigned"),
|
|
107
|
+
kind: "success",
|
|
108
|
+
critical: true,
|
|
109
|
+
description: `Bed ${selectedBed.bedNumber} was assigned to ${patientDetails.name} successfully.`,
|
|
110
|
+
});
|
|
111
|
+
closePanel(false);
|
|
112
|
+
})
|
|
113
|
+
.catch((error) => {
|
|
114
|
+
showNotification({
|
|
115
|
+
title: t("errorAssigningBed", "Error assigning bed"),
|
|
116
|
+
kind: "error",
|
|
117
|
+
critical: true,
|
|
118
|
+
description: error?.message,
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
}, [patientDetails, selectedBed, t, closePanel, lastClinicalEncounter]);
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<>
|
|
125
|
+
<Overlay header={headerTitle} closePanel={() => closePanel(false)}>
|
|
126
|
+
<div className={styles.container}>
|
|
127
|
+
<Stack gap={8} className={styles.container}>
|
|
128
|
+
<section className={styles.section}>
|
|
129
|
+
{restrictWardAdministrationToLoginLocation ? (
|
|
130
|
+
<LocationComboBox setLocationUuid={setLocation} />
|
|
131
|
+
) : (
|
|
132
|
+
<>
|
|
133
|
+
<LocationComboBox setLocationUuid={setLocation} />
|
|
134
|
+
</>
|
|
135
|
+
)}
|
|
136
|
+
{lastClinicalEncounter !== "" && (
|
|
137
|
+
<BedLayoutList
|
|
138
|
+
locationUuid={locationUuid}
|
|
139
|
+
handleClick={handleClick}
|
|
140
|
+
patientDetails={patientDetails}
|
|
141
|
+
/>
|
|
142
|
+
)}
|
|
143
|
+
{lastClinicalEncounter === "" && (
|
|
144
|
+
<div className={styles.missingEncounter}>
|
|
145
|
+
{t(
|
|
146
|
+
"missingAdmissionEncounter",
|
|
147
|
+
"Clinical encounter for admission is required!"
|
|
148
|
+
)}
|
|
149
|
+
</div>
|
|
150
|
+
)}
|
|
151
|
+
</section>
|
|
152
|
+
</Stack>
|
|
153
|
+
</div>
|
|
154
|
+
{selectedBed && (
|
|
155
|
+
<span className={styles.admitPatientInfo}>
|
|
156
|
+
{" "}
|
|
157
|
+
{t(
|
|
158
|
+
"admittingPatientToBedText",
|
|
159
|
+
`Click Save button to admit patient to Bed ${selectedBed.bedNumber}`
|
|
160
|
+
)}
|
|
161
|
+
</span>
|
|
162
|
+
)}
|
|
163
|
+
|
|
164
|
+
<ButtonSet className={isTablet ? styles.tablet : styles.desktop}>
|
|
165
|
+
<Button
|
|
166
|
+
className={styles.button}
|
|
167
|
+
kind="secondary"
|
|
168
|
+
onClick={closePanel}
|
|
169
|
+
>
|
|
170
|
+
{t("discard", "Discard")}
|
|
171
|
+
</Button>
|
|
172
|
+
<Button
|
|
173
|
+
onClick={handleAssignBedToPatient}
|
|
174
|
+
className={classNames(styles.button, {
|
|
175
|
+
[styles.disabled]: !lastClinicalEncounter || !selectedBed,
|
|
176
|
+
})}
|
|
177
|
+
kind="primary"
|
|
178
|
+
type="submit"
|
|
179
|
+
>
|
|
180
|
+
{t("save", "Save")}
|
|
181
|
+
</Button>
|
|
182
|
+
</ButtonSet>
|
|
183
|
+
</Overlay>
|
|
184
|
+
</>
|
|
185
|
+
);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export default AllocateBedWorkSpace;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@use '@carbon/styles/scss/type';
|
|
3
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
4
|
+
|
|
5
|
+
.container {
|
|
6
|
+
// margin: spacing.$spacing-05 0rem;
|
|
7
|
+
background-color: $ui-background;
|
|
8
|
+
max-height: 100%;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
& section {
|
|
12
|
+
margin: spacing.$spacing-09 0 0;
|
|
13
|
+
// overflow-y: auto;
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:global(.cds--text-input) {
|
|
18
|
+
&:focus,
|
|
19
|
+
&:hover {
|
|
20
|
+
outline: 2px solid var(--cds-focus,#ff832b);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.admitPatientInfo {
|
|
26
|
+
padding: 2rem;
|
|
27
|
+
background-color: #fff;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.heading {
|
|
31
|
+
@include type.type-style('heading-03');
|
|
32
|
+
margin: spacing.$spacing-05;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.sectionTitle {
|
|
36
|
+
@include type.type-style('heading-compact-02');
|
|
37
|
+
color: $text-02;
|
|
38
|
+
margin-bottom: spacing.$spacing-05;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.dateTimeSection {
|
|
42
|
+
display: flex;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.radioButton {
|
|
46
|
+
margin: spacing.$spacing-05 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.headerGridRow {
|
|
50
|
+
border-bottom: 0.0625rem solid $grey-2;
|
|
51
|
+
margin: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.dataGridRow {
|
|
55
|
+
display: grid;
|
|
56
|
+
grid-template-columns: 50% 10% 1fr;
|
|
57
|
+
margin: spacing.$spacing-03 spacing.$spacing-05;
|
|
58
|
+
width: 100%;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.form {
|
|
62
|
+
background-color: $ui-background;
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
justify-content: space-between;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.button {
|
|
69
|
+
height: 4rem;
|
|
70
|
+
display: flex;
|
|
71
|
+
align-content: flex-start;
|
|
72
|
+
align-items: baseline;
|
|
73
|
+
min-width: 50%;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.tablet {
|
|
77
|
+
padding: spacing.$spacing-06 spacing.$spacing-05;
|
|
78
|
+
background-color: $ui-02;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.desktop {
|
|
82
|
+
padding: 0rem;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@media screen and (max-width: 600px) {
|
|
86
|
+
.dateTimeSection {
|
|
87
|
+
flex-direction: column;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.backButton {
|
|
92
|
+
align-items: center;
|
|
93
|
+
display: flex;
|
|
94
|
+
justify-content: flex-start;
|
|
95
|
+
margin: spacing.$spacing-03 0;
|
|
96
|
+
padding: 0;
|
|
97
|
+
@include type.type-style('body-compact-01');
|
|
98
|
+
|
|
99
|
+
button {
|
|
100
|
+
display: flex;
|
|
101
|
+
|
|
102
|
+
svg {
|
|
103
|
+
order: 1;
|
|
104
|
+
margin-right: spacing.$spacing-03;
|
|
105
|
+
margin-left: 0rem !important;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
span {
|
|
109
|
+
order: 2;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.disabled {
|
|
115
|
+
opacity: 0.8;
|
|
116
|
+
pointer-events: none;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.missingEncounter {
|
|
120
|
+
@include type.type-style('heading-compact-01');
|
|
121
|
+
color: $text-02;
|
|
122
|
+
margin-top: spacing.$spacing-05;
|
|
123
|
+
margin-bottom: spacing.$spacing-03;
|
|
124
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button, Header } from "@carbon/react";
|
|
3
|
+
import { ArrowLeft, Close } from "@carbon/react/icons";
|
|
4
|
+
import { isDesktop, useLayoutType } from "@openmrs/esm-framework";
|
|
5
|
+
import styles from "./overlay.scss";
|
|
6
|
+
import { useTranslation } from "react-i18next";
|
|
7
|
+
|
|
8
|
+
interface OverlayProps {
|
|
9
|
+
closePanel: () => void;
|
|
10
|
+
header: string;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const Overlay: React.FC<OverlayProps> = ({ closePanel, children, header }) => {
|
|
15
|
+
const layout = useLayoutType();
|
|
16
|
+
const { t } = useTranslation();
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
className={
|
|
21
|
+
isDesktop(layout) ? styles.desktopOverlay : styles.tabletOverlay
|
|
22
|
+
}
|
|
23
|
+
>
|
|
24
|
+
{isDesktop(layout) ? (
|
|
25
|
+
<div className={styles.desktopHeader}>
|
|
26
|
+
<div className={styles.headerContent}>{header}</div>
|
|
27
|
+
<Button
|
|
28
|
+
className={styles.closePanelButton}
|
|
29
|
+
onClick={closePanel}
|
|
30
|
+
kind="ghost"
|
|
31
|
+
hasIconOnly
|
|
32
|
+
renderIcon={(props) => <Close size={16} {...props} />}
|
|
33
|
+
iconDescription={t("closeOverlay", "Close overlay")}
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
) : (
|
|
37
|
+
<Header
|
|
38
|
+
aria-label="Tablet overlay"
|
|
39
|
+
className={styles.tabletOverlayHeader}
|
|
40
|
+
>
|
|
41
|
+
<Button
|
|
42
|
+
onClick={closePanel}
|
|
43
|
+
hasIconOnly
|
|
44
|
+
renderIcon={(props) => <ArrowLeft size={16} {...props} />}
|
|
45
|
+
iconDescription={t("closeOverlay", "Close overlay")}
|
|
46
|
+
/>
|
|
47
|
+
<div className={styles.headerContent}>{header}</div>
|
|
48
|
+
</Header>
|
|
49
|
+
)}
|
|
50
|
+
{children}
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default Overlay;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
@use '@carbon/styles/scss/spacing';
|
|
2
|
+
@use '@carbon/styles/scss/type';
|
|
3
|
+
@import '~@openmrs/esm-styleguide/src/vars';
|
|
4
|
+
@import '../root.scss';
|
|
5
|
+
|
|
6
|
+
.desktopOverlay {
|
|
7
|
+
position: fixed;
|
|
8
|
+
top: spacing.$spacing-09;
|
|
9
|
+
width: 37rem;
|
|
10
|
+
right: 0;
|
|
11
|
+
bottom: 0;
|
|
12
|
+
border-left: 1px solid $text-03;
|
|
13
|
+
background-color: $ui-01;
|
|
14
|
+
overflow-y: auto;
|
|
15
|
+
height: calc(100vh - 3rem);
|
|
16
|
+
z-index: 99999;
|
|
17
|
+
display: grid;
|
|
18
|
+
grid-template-rows: 1fr auto;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.desktopOverlay::after {
|
|
22
|
+
height: 100%;
|
|
23
|
+
border-left: 1px solid $text-03;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.tabletOverlay {
|
|
27
|
+
position: fixed;
|
|
28
|
+
top: 0;
|
|
29
|
+
bottom: 0;
|
|
30
|
+
left: 0;
|
|
31
|
+
right: 0;
|
|
32
|
+
z-index: 9999;
|
|
33
|
+
background-color: $ui-01;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
padding-top: spacing.$spacing-09;
|
|
36
|
+
display: grid;
|
|
37
|
+
grid-template-rows: 1fr auto;
|
|
38
|
+
overflow-y: auto;
|
|
39
|
+
height: 100vh;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.tabletOverlayHeader {
|
|
43
|
+
button {
|
|
44
|
+
@include brand-01(background-color);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.headerContent {
|
|
48
|
+
color: $ui-02;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.desktopHeader {
|
|
53
|
+
display: flex;
|
|
54
|
+
justify-content: space-between;
|
|
55
|
+
align-items: center;
|
|
56
|
+
background-color: $ui-03;
|
|
57
|
+
border-bottom: 1px solid $text-03;
|
|
58
|
+
position: absolute;
|
|
59
|
+
position: -webkit-sticky;
|
|
60
|
+
width: 100%;
|
|
61
|
+
z-index: 1000;
|
|
62
|
+
top: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.headerContent {
|
|
66
|
+
@include type.type-style('heading-compact-02');
|
|
67
|
+
padding: 0 spacing.$spacing-05;
|
|
68
|
+
color: $ui-05;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.closePanelButton {
|
|
72
|
+
background-color: $ui-background;
|
|
73
|
+
color: $ui-05;
|
|
74
|
+
fill: $ui-05;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Desktop */
|
|
78
|
+
:global(.omrs-breakpoint-gt-tablet) {
|
|
79
|
+
.overlayContent {
|
|
80
|
+
padding: 0 0 0 0;
|
|
81
|
+
overflow-y: auto;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Tablet */
|
|
86
|
+
:global(.omrs-breakpoint-lt-desktop) {
|
|
87
|
+
.overlayContent {
|
|
88
|
+
padding: 0 0 0 0;
|
|
89
|
+
overflow-y: auto;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.wardLabel {
|
|
94
|
+
@include type.type-style('label-01');
|
|
95
|
+
// color: colors.$gray-70;
|
|
96
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"esModuleInterop": true,
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"allowSyntheticDefaultImports": true,
|
|
6
|
+
"jsx": "react",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"moduleResolution": "node",
|
|
9
|
+
"lib": [
|
|
10
|
+
"dom",
|
|
11
|
+
"es5",
|
|
12
|
+
"scripthost",
|
|
13
|
+
"es2015",
|
|
14
|
+
"es2015.promise",
|
|
15
|
+
"es2016.array.include",
|
|
16
|
+
"es2018",
|
|
17
|
+
"es2020"
|
|
18
|
+
],
|
|
19
|
+
"resolveJsonModule": true,
|
|
20
|
+
"noEmit": true,
|
|
21
|
+
"target": "esnext"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("openmrs/default-webpack-config");
|