@openmrs/esm-fast-data-entry-app 1.0.1-pre.99 → 1.1.0

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.
Files changed (190) hide show
  1. package/__mocks__/react-i18next.js +9 -14
  2. package/dist/12.js +1 -0
  3. package/dist/12.js.map +1 -0
  4. package/dist/132.js +1 -0
  5. package/dist/151.js +2 -0
  6. package/dist/151.js.map +1 -0
  7. package/dist/195.js +1 -0
  8. package/dist/195.js.map +1 -0
  9. package/dist/197.js +1 -0
  10. package/dist/221.js +1 -0
  11. package/dist/221.js.map +1 -0
  12. package/dist/259.js +1 -0
  13. package/dist/259.js.map +1 -0
  14. package/dist/265.js +1 -0
  15. package/dist/265.js.map +1 -0
  16. package/dist/269.js +1 -0
  17. package/dist/269.js.map +1 -0
  18. package/dist/{574.js → 300.js} +1 -1
  19. package/dist/335.js +1 -0
  20. package/dist/367.js +1 -0
  21. package/dist/367.js.map +1 -0
  22. package/dist/384.js +1 -0
  23. package/dist/384.js.map +1 -0
  24. package/dist/{294.js → 540.js} +2 -2
  25. package/dist/{294.js.map → 540.js.map} +1 -1
  26. package/dist/55.js +1 -0
  27. package/dist/579.js +1 -0
  28. package/dist/579.js.map +1 -0
  29. package/dist/595.js +2 -0
  30. package/dist/{409.js.LICENSE.txt → 595.js.LICENSE.txt} +14 -6
  31. package/dist/595.js.map +1 -0
  32. package/dist/602.js +1 -0
  33. package/dist/602.js.map +1 -0
  34. package/dist/616.js +1 -0
  35. package/dist/616.js.map +1 -0
  36. package/dist/626.js +2 -0
  37. package/dist/626.js.map +1 -0
  38. package/dist/652.js +1 -0
  39. package/dist/77.js +1 -0
  40. package/dist/77.js.map +1 -0
  41. package/dist/773.js +2 -0
  42. package/dist/{897.js.LICENSE.txt → 773.js.LICENSE.txt} +13 -2
  43. package/dist/773.js.map +1 -0
  44. package/dist/88.js +1 -0
  45. package/dist/88.js.map +1 -0
  46. package/dist/930.js +1 -0
  47. package/dist/930.js.map +1 -0
  48. package/dist/961.js +2 -0
  49. package/dist/961.js.map +1 -0
  50. package/dist/983.js +1 -0
  51. package/dist/983.js.map +1 -0
  52. package/dist/99.js +1 -0
  53. package/dist/main.js +1 -1
  54. package/dist/main.js.map +1 -1
  55. package/dist/openmrs-esm-fast-data-entry-app.js +1 -1
  56. package/dist/openmrs-esm-fast-data-entry-app.js.buildmanifest.json +386 -154
  57. package/dist/openmrs-esm-fast-data-entry-app.js.map +1 -1
  58. package/dist/routes.json +1 -1
  59. package/jest.config.json +2 -1
  60. package/package.json +39 -36
  61. package/prettier.config.js +8 -0
  62. package/src/CancelModal.tsx +9 -15
  63. package/src/CompleteModal.tsx +7 -18
  64. package/src/FormBootstrap.tsx +31 -18
  65. package/src/Root.tsx +7 -12
  66. package/src/add-group-modal/AddGroupModal.tsx +73 -112
  67. package/src/add-group-modal/styles.scss +7 -3
  68. package/src/config-schema.ts +63 -24
  69. package/src/constant.ts +1 -1
  70. package/src/context/FormWorkflowContext.tsx +26 -39
  71. package/src/context/FormWorkflowReducer.ts +50 -74
  72. package/src/context/GroupFormWorkflowContext.tsx +40 -59
  73. package/src/context/GroupFormWorkflowReducer.ts +84 -109
  74. package/src/declarations.d.ts +3 -0
  75. package/src/empty-state/EmptyDataIllustration.tsx +4 -16
  76. package/src/empty-state/EmptyState.tsx +8 -13
  77. package/src/empty-state/styles.scss +14 -14
  78. package/src/form-entry-workflow/FormEntryWorkflow.tsx +43 -55
  79. package/src/form-entry-workflow/form-review-card/FormReviewCard.tsx +7 -7
  80. package/src/form-entry-workflow/form-review-card/index.ts +1 -1
  81. package/src/form-entry-workflow/form-review-card/styles.scss +9 -11
  82. package/src/form-entry-workflow/index.ts +1 -1
  83. package/src/form-entry-workflow/patient-banner/PatientBanner.test.tsx +5 -5
  84. package/src/form-entry-workflow/patient-banner/PatientBanner.tsx +14 -27
  85. package/src/form-entry-workflow/patient-banner/index.ts +1 -1
  86. package/src/form-entry-workflow/patient-banner/styles.scss +11 -12
  87. package/src/form-entry-workflow/patient-search-header/PatientSearchHeader.tsx +19 -28
  88. package/src/form-entry-workflow/patient-search-header/index.ts +1 -1
  89. package/src/form-entry-workflow/patient-search-header/styles.scss +13 -10
  90. package/src/form-entry-workflow/styles.scss +11 -13
  91. package/src/form-entry-workflow/workflow-review/WorkflowReview.tsx +13 -11
  92. package/src/form-entry-workflow/workflow-review/index.ts +1 -1
  93. package/src/form-entry-workflow/workflow-review/styles.scss +0 -4
  94. package/src/forms-app-menu-link.tsx +4 -6
  95. package/src/forms-page/FormsPage.tsx +23 -51
  96. package/src/forms-page/forms-table/FormsTable.tsx +22 -42
  97. package/src/forms-page/forms-table/index.ts +1 -1
  98. package/src/forms-page/forms-table/styles.scss +4 -5
  99. package/src/forms-page/index.ts +1 -1
  100. package/src/forms-page/styles.scss +3 -5
  101. package/src/group-form-entry-workflow/GroupFormEntryWorkflow.tsx +9 -9
  102. package/src/group-form-entry-workflow/GroupSessionWorkspace.tsx +77 -117
  103. package/src/group-form-entry-workflow/SessionDetailsForm.tsx +73 -50
  104. package/src/group-form-entry-workflow/SessionMetaWorkspace.tsx +20 -28
  105. package/src/group-form-entry-workflow/attendance-table/AttendanceTable.tsx +15 -29
  106. package/src/group-form-entry-workflow/attendance-table/index.ts +1 -1
  107. package/src/group-form-entry-workflow/configurable-questions/ConfigurableQuestionsSection.tsx +45 -0
  108. package/src/group-form-entry-workflow/group-display-header/GroupDisplayHeader.test.tsx +5 -5
  109. package/src/group-form-entry-workflow/group-display-header/GroupDisplayHeader.tsx +13 -21
  110. package/src/group-form-entry-workflow/group-display-header/index.ts +1 -1
  111. package/src/group-form-entry-workflow/group-display-header/styles.scss +20 -20
  112. package/src/group-form-entry-workflow/group-search/CompactGroupResults.tsx +24 -35
  113. package/src/group-form-entry-workflow/group-search/CompactGroupSearch.tsx +13 -15
  114. package/src/group-form-entry-workflow/group-search/GroupSearch.tsx +22 -38
  115. package/src/group-form-entry-workflow/group-search/compact-group-result.scss +16 -17
  116. package/src/group-form-entry-workflow/group-search/compact-group-search.scss +7 -8
  117. package/src/group-form-entry-workflow/group-search/group-search.scss +20 -23
  118. package/src/group-form-entry-workflow/group-search-header/GroupSearchHeader.tsx +20 -21
  119. package/src/group-form-entry-workflow/group-search-header/index.ts +1 -1
  120. package/src/group-form-entry-workflow/group-search-header/styles.scss +8 -8
  121. package/src/group-form-entry-workflow/index.ts +1 -1
  122. package/src/group-form-entry-workflow/styles.scss +13 -16
  123. package/src/hooks/index.ts +7 -6
  124. package/src/hooks/useFormState.ts +3 -3
  125. package/src/hooks/useGetAllForms.ts +7 -15
  126. package/src/hooks/useGetEncounter.ts +3 -3
  127. package/src/hooks/useGetPatient.ts +2 -2
  128. package/src/hooks/useGetPatients.ts +4 -6
  129. package/src/hooks/useGetSystemSetting.ts +3 -5
  130. package/src/hooks/useKeyPress.ts +5 -5
  131. package/src/hooks/usePostEndpoint.ts +10 -10
  132. package/src/hooks/useSearchEndpoint.ts +23 -40
  133. package/src/hooks/useSpecificQuestions.ts +75 -0
  134. package/src/hooks/useStartVisit.ts +18 -28
  135. package/src/index.ts +8 -20
  136. package/src/patient-card/PatientCard.tsx +8 -20
  137. package/src/patient-card/index.ts +1 -1
  138. package/src/patient-card/styles.scss +2 -4
  139. package/src/routes.json +2 -2
  140. package/src/setup-tests.ts +1 -1
  141. package/src/types.ts +25 -0
  142. package/tools/i18next-parser.config.js +19 -19
  143. package/translations/am.json +75 -0
  144. package/translations/ar.json +75 -0
  145. package/translations/en.json +7 -1
  146. package/translations/es.json +75 -0
  147. package/translations/fr.json +33 -8
  148. package/translations/he.json +75 -0
  149. package/translations/km.json +75 -0
  150. package/tsconfig.json +2 -1
  151. package/turbo.json +18 -0
  152. package/webpack.config.js +1 -1
  153. package/dist/136.js +0 -1
  154. package/dist/136.js.map +0 -1
  155. package/dist/141.js +0 -2
  156. package/dist/141.js.map +0 -1
  157. package/dist/233.js +0 -2
  158. package/dist/233.js.map +0 -1
  159. package/dist/242.js +0 -1
  160. package/dist/242.js.map +0 -1
  161. package/dist/327.js +0 -1
  162. package/dist/327.js.map +0 -1
  163. package/dist/387.js +0 -1
  164. package/dist/387.js.map +0 -1
  165. package/dist/405.js +0 -1
  166. package/dist/405.js.map +0 -1
  167. package/dist/409.js +0 -2
  168. package/dist/409.js.map +0 -1
  169. package/dist/431.js +0 -1
  170. package/dist/431.js.map +0 -1
  171. package/dist/559.js +0 -1
  172. package/dist/559.js.map +0 -1
  173. package/dist/757.js +0 -1
  174. package/dist/820.js +0 -1
  175. package/dist/820.js.map +0 -1
  176. package/dist/846.js +0 -1
  177. package/dist/846.js.map +0 -1
  178. package/dist/885.js +0 -1
  179. package/dist/885.js.map +0 -1
  180. package/dist/897.js +0 -2
  181. package/dist/897.js.map +0 -1
  182. package/dist/92.js +0 -1
  183. package/dist/92.js.map +0 -1
  184. package/dist/935.js +0 -2
  185. package/dist/935.js.map +0 -1
  186. package/src/declarations.d.tsx +0 -2
  187. /package/dist/{141.js.LICENSE.txt → 151.js.LICENSE.txt} +0 -0
  188. /package/dist/{294.js.LICENSE.txt → 540.js.LICENSE.txt} +0 -0
  189. /package/dist/{233.js.LICENSE.txt → 626.js.LICENSE.txt} +0 -0
  190. /package/dist/{935.js.LICENSE.txt → 961.js.LICENSE.txt} +0 -0
@@ -1,19 +1,19 @@
1
- import React, { useEffect, useReducer, useRef } from "react";
2
- import { SkeletonIcon, SkeletonText } from "@carbon/react";
3
- import { Events } from "@carbon/react/icons";
4
- import styles from "./compact-group-result.scss";
5
- import { useTranslation } from "react-i18next";
6
- import useKeyPress from "../../hooks/useKeyPress";
1
+ import React, { useEffect, useReducer, useRef } from 'react';
2
+ import { SkeletonIcon, SkeletonText } from '@carbon/react';
3
+ import { Events } from '@carbon/react/icons';
4
+ import styles from './compact-group-result.scss';
5
+ import { useTranslation } from 'react-i18next';
6
+ import useKeyPress from '../../hooks/useKeyPress';
7
7
 
8
8
  const reducer = (state, action) => {
9
9
  switch (action.type) {
10
- case "arrowUp":
10
+ case 'arrowUp':
11
11
  return { selectedIndex: Math.max(state.selectedIndex - 1, 0) };
12
- case "arrowDown":
12
+ case 'arrowDown':
13
13
  return {
14
14
  selectedIndex: Math.min(state.selectedIndex + 1, action.listLength - 1),
15
15
  };
16
- case "select":
16
+ case 'select':
17
17
  return { selectedIndex: action.payload };
18
18
  default:
19
19
  return state;
@@ -21,19 +21,11 @@ const reducer = (state, action) => {
21
21
  };
22
22
 
23
23
  const scrollingOptions = {
24
- behavior: "smooth",
25
- block: "nearest",
24
+ behavior: 'smooth',
25
+ block: 'nearest',
26
26
  };
27
27
 
28
- const ResultItem = ({
29
- index,
30
- selectGroupAction,
31
- group,
32
- dispatch,
33
- state,
34
- totalGroups,
35
- lastRef,
36
- }) => {
28
+ const ResultItem = ({ index, selectGroupAction, group, dispatch, state, totalGroups, lastRef }) => {
37
29
  const ref = useRef(null);
38
30
  const { t } = useTranslation();
39
31
 
@@ -48,12 +40,10 @@ const ResultItem = ({
48
40
  return (
49
41
  <div
50
42
  onClick={() => {
51
- dispatch({ type: "select", payload: index });
43
+ dispatch({ type: 'select', payload: index });
52
44
  selectGroupAction(group);
53
45
  }}
54
- className={`${styles.patientSearchResult} ${
55
- index === state.selectedIndex && styles.patientSearchResultSelected
56
- }`}
46
+ className={`${styles.patientSearchResult} ${index === state.selectedIndex && styles.patientSearchResultSelected}`}
57
47
  role="button"
58
48
  aria-pressed={index === state.selectedIndex}
59
49
  tabIndex={0}
@@ -65,7 +55,7 @@ const ResultItem = ({
65
55
  <div>
66
56
  <h2 className={styles.patientName}>{group.name}</h2>
67
57
  <p className={styles.demographics}>
68
- {group.cohortMembers?.length ?? 0} {t("members", "members")}
58
+ {group.cohortMembers?.length ?? 0} {t('members', 'members')}
69
59
  <span className={styles.middot}>&middot;</span> {group.description}
70
60
  </p>
71
61
  </div>
@@ -74,21 +64,21 @@ const ResultItem = ({
74
64
  };
75
65
 
76
66
  const CompactGroupResults = ({ groups, selectGroupAction, lastRef }) => {
77
- const arrowUpPressed = useKeyPress("ArrowUp");
78
- const arrowDownPressed = useKeyPress("ArrowDown");
79
- const enterPressed = useKeyPress("Enter");
67
+ const arrowUpPressed = useKeyPress('ArrowUp');
68
+ const arrowDownPressed = useKeyPress('ArrowDown');
69
+ const enterPressed = useKeyPress('Enter');
80
70
 
81
71
  const [state, dispatch] = useReducer(reducer, { selectedIndex: 0 });
82
72
 
83
73
  useEffect(() => {
84
74
  if (arrowUpPressed) {
85
- dispatch({ type: "arrowUp" });
75
+ dispatch({ type: 'arrowUp' });
86
76
  }
87
77
  }, [arrowUpPressed]);
88
78
 
89
79
  useEffect(() => {
90
80
  if (arrowDownPressed) {
91
- dispatch({ type: "arrowDown", listLength: groups.length });
81
+ dispatch({ type: 'arrowDown', listLength: groups.length });
92
82
  }
93
83
  }, [arrowDownPressed, groups.length]);
94
84
 
@@ -117,8 +107,8 @@ export const SearchResultSkeleton = () => {
117
107
  <div className={styles.patientAvatar} role="img">
118
108
  <SkeletonIcon
119
109
  style={{
120
- height: "3rem",
121
- width: "3rem",
110
+ height: '3rem',
111
+ width: '3rem',
122
112
  }}
123
113
  />
124
114
  </div>
@@ -127,9 +117,8 @@ export const SearchResultSkeleton = () => {
127
117
  <SkeletonText />
128
118
  </h2>
129
119
  <span className={styles.demographics}>
130
- <SkeletonIcon /> <span className={styles.middot}>&middot;</span>{" "}
131
- <SkeletonIcon /> <span className={styles.middot}>&middot;</span>{" "}
132
- <SkeletonIcon />
120
+ <SkeletonIcon /> <span className={styles.middot}>&middot;</span> <SkeletonIcon />{' '}
121
+ <span className={styles.middot}>&middot;</span> <SkeletonIcon />
133
122
  </span>
134
123
  </div>
135
124
  </div>
@@ -1,26 +1,24 @@
1
- import React, { useState } from "react";
2
- import { GroupType } from "../../context/GroupFormWorkflowContext";
3
- import styles from "./compact-group-search.scss";
4
- import GroupSearch from "./GroupSearch";
5
- import { Button, Search } from "@carbon/react";
6
- import { useTranslation } from "react-i18next";
7
- import debounce from "lodash-es/debounce";
1
+ import React, { useState } from 'react';
2
+ import { type GroupType } from '../../context/GroupFormWorkflowContext';
3
+ import styles from './compact-group-search.scss';
4
+ import GroupSearch from './GroupSearch';
5
+ import { Button, Search } from '@carbon/react';
6
+ import { useTranslation } from 'react-i18next';
7
+ import debounce from 'lodash-es/debounce';
8
8
 
9
9
  interface CompactGroupSearchProps {
10
10
  selectGroupAction?: (group: GroupType) => void;
11
11
  }
12
12
 
13
- const CompactGroupSearch: React.FC<CompactGroupSearchProps> = ({
14
- selectGroupAction,
15
- }) => {
13
+ const CompactGroupSearch: React.FC<CompactGroupSearchProps> = ({ selectGroupAction }) => {
16
14
  const { t } = useTranslation();
17
- const [query, setQuery] = useState("");
15
+ const [query, setQuery] = useState('');
18
16
  const [dropdownShown, setDropdownShown] = useState(false);
19
17
 
20
18
  const onGroupSelect = (group) => {
21
19
  selectGroupAction(group);
22
20
  setDropdownShown(false);
23
- setQuery("");
21
+ setQuery('');
24
22
  };
25
23
 
26
24
  const handleSearchChange = (e) => {
@@ -42,18 +40,18 @@ const CompactGroupSearch: React.FC<CompactGroupSearchProps> = ({
42
40
  <Search
43
41
  autoFocus
44
42
  className={styles.patientSearchInput}
45
- closeButtonLabelText={t("clearSearch", "Clear")}
43
+ closeButtonLabelText={t('clearSearch', 'Clear')}
46
44
  labelText=""
47
45
  onChange={(event) => {
48
46
  handleSearchChange(event.target.value);
49
47
  }}
50
48
  onClear={() => undefined}
51
- placeholder={t("searchForGroup", "Search for a group by name")}
49
+ placeholder={t('searchForGroup', 'Search for a group by name')}
52
50
  size="sm"
53
51
  value={query}
54
52
  />
55
53
  <Button kind="secondary" size="sm">
56
- {t("search", "Search")}
54
+ {t('search', 'Search')}
57
55
  </Button>
58
56
  </div>
59
57
  {dropdownShown && (
@@ -1,23 +1,18 @@
1
- import React, { useCallback, useRef } from "react";
2
- import { useTranslation } from "react-i18next";
3
- import { Layer, Tile, Loading } from "@carbon/react";
4
- import styles from "./group-search.scss";
5
- import { EmptyDataIllustration } from "../../empty-state/EmptyDataIllustration";
6
- import CompactGroupResults, {
7
- SearchResultSkeleton,
8
- } from "./CompactGroupResults";
9
- import { GroupType } from "../../context/GroupFormWorkflowContext";
10
- import { useSearchCohortInfinite } from "../../hooks/useSearchEndpoint";
1
+ import React, { useCallback, useRef } from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import { Layer, Tile, Loading } from '@carbon/react';
4
+ import styles from './group-search.scss';
5
+ import { EmptyDataIllustration } from '../../empty-state/EmptyDataIllustration';
6
+ import CompactGroupResults, { SearchResultSkeleton } from './CompactGroupResults';
7
+ import { type GroupType } from '../../context/GroupFormWorkflowContext';
8
+ import { useSearchCohortInfinite } from '../../hooks/useSearchEndpoint';
11
9
 
12
10
  interface GroupSearchProps {
13
11
  query: string;
14
12
  selectGroupAction?: (group: GroupType) => void;
15
13
  }
16
14
 
17
- const GroupSearch: React.FC<GroupSearchProps> = ({
18
- query = "",
19
- selectGroupAction,
20
- }) => {
15
+ const GroupSearch: React.FC<GroupSearchProps> = ({ query = '', selectGroupAction }) => {
21
16
  const { t } = useTranslation();
22
17
  const {
23
18
  isLoading,
@@ -31,7 +26,7 @@ const GroupSearch: React.FC<GroupSearchProps> = ({
31
26
  searchTerm: query,
32
27
  searching: !!query,
33
28
  parameters: {
34
- v: "full",
29
+ v: 'full',
35
30
  },
36
31
  });
37
32
 
@@ -53,13 +48,13 @@ const GroupSearch: React.FC<GroupSearchProps> = ({
53
48
  },
54
49
  {
55
50
  threshold: 0.75,
56
- }
51
+ },
57
52
  );
58
53
  if (node) {
59
54
  observer.current.observe(node);
60
55
  }
61
56
  },
62
- [loadingNewData, hasMore, setPage]
57
+ [loadingNewData, hasMore, setPage],
63
58
  );
64
59
 
65
60
  if (error) {
@@ -69,11 +64,11 @@ const GroupSearch: React.FC<GroupSearchProps> = ({
69
64
  <Tile className={styles.emptySearchResultsTile}>
70
65
  <EmptyDataIllustration />
71
66
  <div>
72
- <p className={styles.errorMessage}>{t("error", "Error")}</p>
67
+ <p className={styles.errorMessage}>{t('error', 'Error')}</p>
73
68
  <p className={styles.errorCopy}>
74
69
  {t(
75
- "errorCopy",
76
- "Sorry, there was an error. You can try to reload this page, or contact the site administrator and quote the error code above."
70
+ 'errorCopy',
71
+ 'Sorry, there was an error. You can try to reload this page, or contact the site administrator and quote the error code above.',
77
72
  )}
78
73
  </p>
79
74
  </div>
@@ -101,18 +96,11 @@ const GroupSearch: React.FC<GroupSearchProps> = ({
101
96
  <Layer>
102
97
  <Tile className={styles.emptySearchResultsTile}>
103
98
  <EmptyDataIllustration />
104
- <p className={styles.emptyResultText}>
105
- {t("noGroupsFoundMessage", "Sorry, no groups have been found")}
106
- </p>
99
+ <p className={styles.emptyResultText}>{t('noGroupsFoundMessage', 'Sorry, no groups have been found')}</p>
107
100
  <p className={styles.actionText}>
108
- <span>
109
- {t(
110
- "trySearchWithPatientUniqueID",
111
- "Try searching with the cohort's description"
112
- )}
113
- </span>
101
+ <span>{t('trySearchWithPatientUniqueID', "Try searching with the cohort's description")}</span>
114
102
  <br />
115
- <span>{t("orLabelName", "OR label name")}</span>
103
+ <span>{t('orLabelName', 'OR label name')}</span>
116
104
  </p>
117
105
  </Tile>
118
106
  </Layer>
@@ -125,21 +113,17 @@ const GroupSearch: React.FC<GroupSearchProps> = ({
125
113
  <div
126
114
  className={styles.searchResults}
127
115
  style={{
128
- maxHeight: "22rem",
116
+ maxHeight: '22rem',
129
117
  }}
130
118
  >
131
119
  <p className={styles.resultsText}>
132
- {totalResults} {t("searchResultsText", "search result(s)")}
120
+ {totalResults} {t('searchResultsText', 'search result(s)')}
133
121
  </p>
134
- <CompactGroupResults
135
- groups={results}
136
- selectGroupAction={selectGroupAction}
137
- lastRef={lastItem}
138
- />
122
+ <CompactGroupResults groups={results} selectGroupAction={selectGroupAction} lastRef={lastItem} />
139
123
  <div ref={lastItem}>
140
124
  <div className={styles.lastItem} ref={loadingRef}>
141
125
  {hasMore && <Loading withOverlay={false} small />}
142
- {!hasMore && <p>{t("noMoreResults", "End of search results")}</p>}
126
+ {!hasMore && <p>{t('noMoreResults', 'End of search results')}</p>}
143
127
  </div>
144
128
  </div>
145
129
  </div>
@@ -1,18 +1,17 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @use '@carbon/styles/scss/type';
3
- @use '@carbon/styles/scss/colors';
4
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/colors';
2
+ @use '@carbon/layout';
3
+ @use '@carbon/type';
5
4
 
6
5
  .patientSearchResult {
7
6
  text-decoration: none;
8
7
  display: flex;
9
8
  align-items: center;
10
- border-bottom: 1px solid $ui-03;
11
- padding: 0 spacing.$spacing-04;
9
+ border-bottom: 1px solid colors.$gray-20;
10
+ padding: 0 layout.$spacing-04;
12
11
 
13
12
  &:hover,
14
13
  &:focus {
15
- background-color: $ui-01;
14
+ background-color: colors.$gray-10;
16
15
  }
17
16
  }
18
17
 
@@ -29,9 +28,9 @@
29
28
  }
30
29
 
31
30
  .patientAvatar {
32
- width: spacing.$spacing-09;
33
- height: spacing.$spacing-09;
34
- margin: spacing.$spacing-03 spacing.$spacing-05 spacing.$spacing-03 0;
31
+ width: layout.$spacing-09;
32
+ height: layout.$spacing-09;
33
+ margin: layout.$spacing-03 layout.$spacing-05 layout.$spacing-03 0;
35
34
  border-radius: 1px;
36
35
  }
37
36
 
@@ -39,26 +38,26 @@
39
38
  width: 100%;
40
39
  display: flex;
41
40
  flex-flow: column wrap;
42
- margin: spacing.$spacing-05;
41
+ margin: layout.$spacing-05;
43
42
  cursor: pointer;
44
43
  }
45
44
 
46
45
  .demographics {
47
- margin-top: spacing.$spacing-03;
46
+ margin-top: layout.$spacing-03;
48
47
  @include type.type-style('body-compact-02');
49
- color: $text-02;
48
+ color: colors.$gray-70;
50
49
  }
51
50
 
52
51
  .identifiers {
53
52
  @include type.type-style('body-compact-02');
54
- color: $ui-04;
53
+ color: colors.$gray-50;
55
54
  }
56
55
 
57
56
  .actionsContainer {
58
- padding-top: spacing.$spacing-03;
59
- margin-top: spacing.$spacing-05;
57
+ padding-top: layout.$spacing-03;
58
+ margin-top: layout.$spacing-05;
60
59
  }
61
60
 
62
61
  .middot {
63
- margin: 0 spacing.$spacing-03;
62
+ margin: 0 layout.$spacing-03;
64
63
  }
@@ -1,7 +1,6 @@
1
-
2
- @use '@carbon/styles/scss/spacing';
3
- @use '@carbon/styles/scss/colors';
4
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/colors';
2
+ @use '@carbon/layout';
3
+ @use '@carbon/type';
5
4
 
6
5
  .patientSearchBar {
7
6
  width: 50vw;
@@ -11,11 +10,11 @@
11
10
  .floatingSearchResultsContainer {
12
11
  position: absolute;
13
12
  overflow-y: auto;
14
- box-shadow: 0 spacing.$spacing-03 spacing.$spacing-05 $ui-03;
13
+ box-shadow: 0 layout.$spacing-03 layout.$spacing-05 colors.$gray-20;
15
14
  z-index: 99;
16
- border: 0 1px 1px 1px solid $ui-03;
15
+ border: 0 1px 1px 1px solid colors.$gray-20;
17
16
  width: 100%;
18
- background-color: $ui-02;
17
+ background-color: colors.$white-0;
19
18
  }
20
19
 
21
20
  .searchArea {
@@ -23,7 +22,7 @@
23
22
  display: flex;
24
23
  justify-content: center;
25
24
  align-items: center;
26
- border: 1px solid $ui-04;
25
+ border: 1px solid colors.$gray-50;
27
26
  }
28
27
 
29
28
  .patientSearchInput {
@@ -1,17 +1,15 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @use '@carbon/styles/scss/type';
3
- @import '~@openmrs/esm-styleguide/src/vars';
4
-
5
-
1
+ @use '@carbon/colors';
2
+ @use '@carbon/layout';
3
+ @use '@carbon/type';
6
4
 
7
5
  .searchResultsContainer {
8
6
  width: 100%;
9
- background-color: $ui-02;
7
+ background-color: colors.$white-0;
10
8
 
11
9
  a {
12
10
  text-decoration: none;
13
11
  @include type.type-style('heading-02');
14
- color: $text-02;
12
+ color: colors.$gray-70;
15
13
  margin: 0rem;
16
14
  }
17
15
  }
@@ -22,7 +20,7 @@
22
20
 
23
21
  :global(.omrs-breakpoint-gt-tablet) .searchResultsContainer {
24
22
  padding: 0;
25
- top: spacing.$spacing-09;
23
+ top: layout.$spacing-09;
26
24
  }
27
25
 
28
26
  .searchResults {
@@ -30,7 +28,6 @@
30
28
  }
31
29
 
32
30
 
33
-
34
31
  .searchTerm {
35
32
  @include type.type-style('heading-03');
36
33
  margin-top: 0.375rem;
@@ -38,9 +35,9 @@
38
35
 
39
36
  .resultsText {
40
37
  @include type.type-style('label-01');
41
- color: $text-02;
42
- line-height: spacing.$spacing-05;
43
- margin: spacing.$spacing-03 spacing.$spacing-05;
38
+ color: colors.$gray-70;
39
+ line-height: layout.$spacing-05;
40
+ margin: layout.$spacing-03 layout.$spacing-05;
44
41
  }
45
42
 
46
43
  .helperText {
@@ -50,46 +47,46 @@
50
47
 
51
48
  .emptyResultText {
52
49
  @include type.type-style('heading-compact-01');
53
- color: $text-02;
54
- margin-top: spacing.$spacing-05;
50
+ color: colors.$gray-70;
51
+ margin-top: layout.$spacing-05;
55
52
  margin-bottom: 0.313rem;
56
53
  }
57
54
 
58
55
  .actionText {
59
56
  @include type.type-style('body-01');
60
- color: $text-02;
57
+ color: colors.$gray-70;
61
58
  }
62
59
 
63
60
  .pagination {
64
61
  display: flex;
65
62
  justify-content: space-evenly;
66
- padding: 4.688rem 0 spacing.$spacing-06;
63
+ padding: 4.688rem 0 layout.$spacing-06;
67
64
  }
68
65
 
69
66
  .emptySearchResultsTile {
70
67
  text-align: center;
71
- margin-top: spacing.$spacing-05;
72
- padding: spacing.$spacing-09 0rem;
68
+ margin-top: layout.$spacing-05;
69
+ padding: layout.$spacing-09 0rem;
73
70
  }
74
71
 
75
72
  :global(.omrs-breakpoint-gt-tablet) .emptySearchResultsTile {
76
- margin: spacing.$spacing-05;
73
+ margin: layout.$spacing-05;
77
74
  }
78
75
 
79
76
  .errorMessage {
80
77
  @include type.type-style('heading-compact-02');
81
78
  margin-top: 2.25rem;
82
- margin-bottom: spacing.$spacing-03;
79
+ margin-bottom: layout.$spacing-03;
83
80
  }
84
81
 
85
82
  .errorCopy {
86
- margin-bottom: spacing.$spacing-03;
83
+ margin-bottom: layout.$spacing-03;
87
84
  @include type.type-style('body-01');
88
- color: $text-02;
85
+ color: colors.$gray-70;
89
86
  }
90
87
 
91
88
  .lastItem {
92
- padding: spacing.$spacing-05;
89
+ padding: layout.$spacing-05;
93
90
  display: flex;
94
91
  justify-content: center;
95
92
  align-items: center;
@@ -1,19 +1,22 @@
1
- import { Close, Add } from "@carbon/react/icons";
2
- import { Button } from "@carbon/react";
3
- import React, { useCallback, useContext, useState } from "react";
4
- import GroupFormWorkflowContext from "../../context/GroupFormWorkflowContext";
5
- import styles from "./styles.scss";
6
- import { useTranslation } from "react-i18next";
7
- import CompactGroupSearch from "../group-search/CompactGroupSearch";
8
- import AddGroupModal from "../../add-group-modal/AddGroupModal";
1
+ import { Close, Add } from '@carbon/react/icons';
2
+ import { Button } from '@carbon/react';
3
+ import React, { useCallback, useContext, useState } from 'react';
4
+ import GroupFormWorkflowContext from '../../context/GroupFormWorkflowContext';
5
+ import styles from './styles.scss';
6
+ import { useTranslation } from 'react-i18next';
7
+ import CompactGroupSearch from '../group-search/CompactGroupSearch';
8
+ import AddGroupModal from '../../add-group-modal/AddGroupModal';
9
9
 
10
10
  const GroupSearchHeader = () => {
11
11
  const { t } = useTranslation();
12
- const { activeGroupUuid, setGroup, destroySession } = useContext(
13
- GroupFormWorkflowContext
14
- );
12
+ const { activeGroupUuid, setGroup, destroySession } = useContext(GroupFormWorkflowContext);
15
13
  const [isOpen, setOpen] = useState(false);
16
14
  const handleSelectGroup = (group) => {
15
+ group.cohortMembers.sort((a, b) => {
16
+ const aName = a?.patient?.person?.names?.[0]?.display;
17
+ const bName = b?.patient?.person?.names?.[0]?.display;
18
+ return aName.localeCompare(bName, undefined, { sensitivity: 'base' });
19
+ });
17
20
  setGroup(group);
18
21
  };
19
22
 
@@ -33,24 +36,20 @@ const GroupSearchHeader = () => {
33
36
 
34
37
  return (
35
38
  <div className={styles.searchHeaderContainer}>
36
- <span className={styles.padded}>{t("findGroup", "Find group")}:</span>
39
+ <span className={styles.padded}>{t('findGroup', 'Find group')}:</span>
37
40
  <span className={styles.searchBarWrapper}>
38
41
  <CompactGroupSearch selectGroupAction={handleSelectGroup} />
39
42
  </span>
40
- <span className={styles.padded}>{t("or", "or")}</span>
43
+ <span className={styles.padded}>{t('or', 'or')}</span>
41
44
  <span>
42
- <Button
43
- onClick={handleOpenClick}
44
- renderIcon={Add}
45
- iconDescription="Add"
46
- >
47
- {t("createNewGroup", "Create New Group")}
45
+ <Button onClick={handleOpenClick} renderIcon={Add} iconDescription="Add">
46
+ {t('createNewGroup', 'Create New Group')}
48
47
  </Button>
49
48
  <AddGroupModal
50
49
  {...{
51
50
  isCreate: true,
52
51
  isOpen: isOpen,
53
- handleCancel: handleCancel,
52
+ onPostCancel: handleCancel,
54
53
  onPostSubmit: onPostSubmit,
55
54
  }}
56
55
  />
@@ -63,7 +62,7 @@ const GroupSearchHeader = () => {
63
62
  destroySession();
64
63
  }}
65
64
  >
66
- {t("cancel", "Cancel")} <Close size={20} />
65
+ {t('cancel', 'Cancel')} <Close size={20} />
67
66
  </Button>
68
67
  </span>
69
68
  </div>
@@ -1,3 +1,3 @@
1
- import GroupSearchHeader from "./GroupSearchHeader";
1
+ import GroupSearchHeader from './GroupSearchHeader';
2
2
 
3
3
  export default GroupSearchHeader;
@@ -1,14 +1,14 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @import '~@openmrs/esm-styleguide/src/vars';
1
+ @use '@carbon/colors';
2
+ @use '@carbon/layout';
3
3
 
4
4
  .searchHeaderContainer {
5
- height: spacing.$spacing-11;
5
+ height: layout.$spacing-11;
6
6
  display: flex;
7
7
  align-items: center;
8
- background-color: $ui-02;
9
- border-top: 0.0125rem solid $ui-03;
10
- border-bottom: 0.0125rem solid $ui-03;
11
- padding: 0 spacing.$spacing-05;
8
+ background-color: colors.$white-0;
9
+ border-top: 0.0125rem solid colors.$gray-20;
10
+ border-bottom: 0.0125rem solid colors.$gray-20;
11
+ padding: 0 layout.$spacing-05;
12
12
  }
13
13
 
14
14
  .searchBarWrapper {
@@ -16,5 +16,5 @@
16
16
  }
17
17
 
18
18
  .padded {
19
- padding: spacing.$spacing-05;
19
+ padding: layout.$spacing-05;
20
20
  }
@@ -1,3 +1,3 @@
1
- import GroupFormEntryWorkflow from "./GroupFormEntryWorkflow";
1
+ import GroupFormEntryWorkflow from './GroupFormEntryWorkflow';
2
2
 
3
3
  export default GroupFormEntryWorkflow;