@openmrs/esm-patient-registration-app 9.2.1-pre.7366 → 9.2.1-pre.7379

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.
@@ -274,7 +274,7 @@
274
274
  "auxiliaryFiles": [
275
275
  "1909.js.map"
276
276
  ],
277
- "hash": "0a3a461886c747b8",
277
+ "hash": "cb9195db036705de",
278
278
  "childrenByOrder": {}
279
279
  },
280
280
  {
@@ -425,9 +425,9 @@
425
425
  "initial": false,
426
426
  "entry": false,
427
427
  "recorded": false,
428
- "size": 1079,
428
+ "size": 1123,
429
429
  "sizes": {
430
- "javascript": 1079
430
+ "javascript": 1123
431
431
  },
432
432
  "names": [],
433
433
  "idHints": [],
@@ -441,7 +441,7 @@
441
441
  "auxiliaryFiles": [
442
442
  "3093.js.map"
443
443
  ],
444
- "hash": "eab6898db01673ff",
444
+ "hash": "66636912a1f2c12d",
445
445
  "childrenByOrder": {}
446
446
  },
447
447
  {
@@ -549,9 +549,9 @@
549
549
  "initial": false,
550
550
  "entry": false,
551
551
  "recorded": false,
552
- "size": 145744,
552
+ "size": 145685,
553
553
  "sizes": {
554
- "javascript": 145744
554
+ "javascript": 145685
555
555
  },
556
556
  "names": [],
557
557
  "idHints": [],
@@ -564,7 +564,7 @@
564
564
  "auxiliaryFiles": [
565
565
  "3474.js.map"
566
566
  ],
567
- "hash": "cc533d920d89fd30",
567
+ "hash": "b0e2dcb908f380c9",
568
568
  "childrenByOrder": {}
569
569
  },
570
570
  {
@@ -594,9 +594,9 @@
594
594
  "initial": false,
595
595
  "entry": false,
596
596
  "recorded": false,
597
- "size": 596841,
597
+ "size": 597050,
598
598
  "sizes": {
599
- "javascript": 596841
599
+ "javascript": 597050
600
600
  },
601
601
  "names": [],
602
602
  "idHints": [],
@@ -610,7 +610,7 @@
610
610
  "auxiliaryFiles": [
611
611
  "3704.js.map"
612
612
  ],
613
- "hash": "cb411f1211dadc95",
613
+ "hash": "603c490c2d805be2",
614
614
  "childrenByOrder": {}
615
615
  },
616
616
  {
@@ -967,7 +967,7 @@
967
967
  "auxiliaryFiles": [
968
968
  "6276.js.map"
969
969
  ],
970
- "hash": "ddbcca6ebc4f4111",
970
+ "hash": "1e3285b847288319",
971
971
  "childrenByOrder": {}
972
972
  },
973
973
  {
@@ -1223,7 +1223,7 @@
1223
1223
  "auxiliaryFiles": [
1224
1224
  "7248.js.map"
1225
1225
  ],
1226
- "hash": "b9e8e09bea0c4d75",
1226
+ "hash": "5aba63d53252cab1",
1227
1227
  "childrenByOrder": {}
1228
1228
  },
1229
1229
  {
@@ -1380,7 +1380,7 @@
1380
1380
  "auxiliaryFiles": [
1381
1381
  "8434.js.map"
1382
1382
  ],
1383
- "hash": "e6fd472e35a925eb",
1383
+ "hash": "8dd30bb15ddedbb3",
1384
1384
  "childrenByOrder": {}
1385
1385
  },
1386
1386
  {
@@ -1410,10 +1410,10 @@
1410
1410
  "initial": true,
1411
1411
  "entry": true,
1412
1412
  "recorded": false,
1413
- "size": 2411622,
1413
+ "size": 2411563,
1414
1414
  "sizes": {
1415
1415
  "consume-shared": 168,
1416
- "javascript": 2389047,
1416
+ "javascript": 2388988,
1417
1417
  "share-init": 336,
1418
1418
  "runtime": 22071
1419
1419
  },
@@ -1430,7 +1430,7 @@
1430
1430
  "auxiliaryFiles": [
1431
1431
  "main.js.map"
1432
1432
  ],
1433
- "hash": "fe510d869f926ccd",
1433
+ "hash": "65f95418f35ff5b0",
1434
1434
  "childrenByOrder": {}
1435
1435
  },
1436
1436
  {
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.2.0"},"pages":[{"component":"root","route":"patient-registration","online":true,"offline":true},{"component":"editPatient","routeRegex":"patient\\/([a-zA-Z0-9\\-]+)\\/edit","online":true,"offline":true}],"extensions":[{"component":"addPatientLink","name":"add-patient-action","slot":"top-nav-actions-slot","online":true,"offline":true,"order":30},{"component":"patientPhotoExtension","name":"patient-photo-widget","slot":"patient-photo-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-actions-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-search-actions-slot","online":true,"offline":true}],"modals":[{"name":"cancel-patient-edit-modal","component":"cancelPatientEditModal"},{"name":"delete-identifier-confirmation-modal","component":"deleteIdentifierConfirmationModal"}],"version":"9.2.1-pre.7366"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"webservices.rest":">=2.2.0"},"pages":[{"component":"root","route":"patient-registration","online":true,"offline":true},{"component":"editPatient","routeRegex":"patient\\/([a-zA-Z0-9\\-]+)\\/edit","online":true,"offline":true}],"extensions":[{"component":"addPatientLink","name":"add-patient-action","slot":"top-nav-actions-slot","online":true,"offline":true,"order":30},{"component":"patientPhotoExtension","name":"patient-photo-widget","slot":"patient-photo-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-actions-slot","online":true,"offline":true},{"component":"editPatientDetailsButton","name":"edit-patient-details-button","slot":"patient-search-actions-slot","online":true,"offline":true}],"modals":[{"name":"cancel-patient-edit-modal","component":"cancelPatientEditModal"},{"name":"delete-identifier-confirmation-modal","component":"deleteIdentifierConfirmationModal"}],"version":"9.2.1-pre.7379"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-patient-registration-app",
3
- "version": "9.2.1-pre.7366",
3
+ "version": "9.2.1-pre.7379",
4
4
  "description": "Patient registration microfrontend for O3",
5
5
  "browser": "dist/openmrs-esm-patient-registration-app.js",
6
6
  "main": "src/index.ts",
@@ -13,8 +13,6 @@ export default function Root() {
13
13
  <HeaderGlobalAction
14
14
  aria-label={t('addPatient', 'Add patient')}
15
15
  aria-labelledby={t('addPatient', 'Add patient')}
16
- enterDelayMs={500}
17
- name="AddPatientIcon"
18
16
  onClick={addPatient}
19
17
  className={styles.slotStyles}>
20
18
  <UserFollow size={20} />
@@ -1,7 +1,4 @@
1
- declare module '@carbon/react';
2
1
  declare module '*.scss' {
3
2
  const content: { [className: string]: string };
4
3
  export default content;
5
4
  }
6
-
7
- declare type SideNavProps = {};
@@ -74,7 +74,10 @@ export const AddressComponent: React.FC = () => {
74
74
  if (addressTemplate && !Object.keys(addressTemplate)?.length) {
75
75
  return (
76
76
  <AddressComponentContainer>
77
- <SkeletonText role="progressbar" />
77
+ <SkeletonText
78
+ // @ts-expect-error
79
+ role="progressbar"
80
+ />
78
81
  </AddressComponentContainer>
79
82
  );
80
83
  }
@@ -99,7 +102,10 @@ export const AddressComponent: React.FC = () => {
99
102
  if (isLoadingFieldOrder) {
100
103
  return (
101
104
  <AddressComponentContainer>
102
- <SkeletonText />
105
+ <SkeletonText
106
+ // @ts-expect-error
107
+ role="progressbar"
108
+ />
103
109
  </AddressComponentContainer>
104
110
  );
105
111
  }
@@ -69,12 +69,7 @@ function DeathTimeField() {
69
69
  pattern="^(1[0-2]|0?[1-9]):([0-5]?[0-9])$"
70
70
  invalid={!!(deathTimeMeta.touched && deathTimeMeta.error)}
71
71
  invalidText={t(deathTimeMeta.error)}>
72
- <TimePickerSelect
73
- {...deathTimeFormatField}
74
- id="time-format-picker"
75
- aria-label={t('timeFormat', 'Time Format')}
76
- invalid={!!deathTimeFormatMeta.touched && deathTimeFormatMeta.error}
77
- invalidText={t(deathTimeFormatMeta.error)}>
72
+ <TimePickerSelect {...deathTimeFormatField} id="time-format-picker" aria-label={t('timeFormat', 'Time Format')}>
78
73
  <SelectItem value="AM" text="AM" />
79
74
  <SelectItem value="PM" text="PM" />
80
75
  </TimePickerSelect>
@@ -95,7 +95,7 @@ export const DobField: React.FC = () => {
95
95
  <div className={styles.dobContentSwitcherLabel}>
96
96
  <span className={styles.label01}>{t('dobToggleLabelText', 'Date of birth known?')}</span>
97
97
  </div>
98
- <ContentSwitcher onChange={onToggle} selectedIndex={dobUnknown ? 1 : 0}>
98
+ <ContentSwitcher size="md" onChange={onToggle} selectedIndex={dobUnknown ? 1 : 0}>
99
99
  <Switch name="known" text={t('yes', 'Yes')} />
100
100
  <Switch name="unknown" text={t('no', 'No')} />
101
101
  </ContentSwitcher>
@@ -113,7 +113,10 @@ export const Identifiers: React.FC = () => {
113
113
  <div className={styles.identifierLabelText}>
114
114
  <h4 className={styles.productiveHeading02Light}>{t('idFieldLabelText', 'Identifiers')}</h4>
115
115
  </div>
116
- <SkeletonText role="progressbar" />
116
+ <SkeletonText
117
+ // @ts-expect-error
118
+ role="progressbar"
119
+ />
117
120
  </div>
118
121
  );
119
122
  }
@@ -119,6 +119,7 @@ export const NameField = () => {
119
119
  </div>
120
120
  <ContentSwitcher
121
121
  className={styles.contentSwitcher}
122
+ size="md"
122
123
  selectedIndex={isPatientUnknown ? 1 : 0}
123
124
  onChange={toggleNameKnown}>
124
125
  <Switch name="known" text={t('yes', 'Yes')} />
@@ -10,13 +10,14 @@ interface ComboInputProps {
10
10
  fieldProps: {
11
11
  value: string;
12
12
  labelText: string;
13
+ id?: string;
13
14
  [x: string]: any;
14
15
  };
15
16
  handleInputChange: (newValue: string) => void;
16
17
  handleSelection: (newSelection) => void;
17
18
  }
18
19
 
19
- const ComboInput: React.FC<ComboInputProps> = ({ entries, fieldProps, handleInputChange, handleSelection }) => {
20
+ const ComboInput: React.FC<ComboInputProps> = ({ entries, name, fieldProps, handleInputChange, handleSelection }) => {
20
21
  const [highlightedEntry, setHighlightedEntry] = useState(-1);
21
22
  const { value = '' } = fieldProps;
22
23
  const [showEntries, setShowEntries] = useState(false);
@@ -38,7 +39,7 @@ const ComboInput: React.FC<ComboInputProps> = ({ entries, fieldProps, handleInpu
38
39
  }, [entries, value]);
39
40
 
40
41
  const handleOptionClick = useCallback(
41
- (newSelection: string, e: KeyboardEvent = null) => {
42
+ (newSelection: string, e: React.KeyboardEvent<HTMLInputElement> | null = null) => {
42
43
  e?.preventDefault();
43
44
  handleSelection(newSelection);
44
45
  setShowEntries(false);
@@ -47,7 +48,7 @@ const ComboInput: React.FC<ComboInputProps> = ({ entries, fieldProps, handleInpu
47
48
  );
48
49
 
49
50
  const handleKeyPress = useCallback(
50
- (e: KeyboardEvent) => {
51
+ (e: React.KeyboardEvent<HTMLInputElement>) => {
51
52
  const totalResults = filteredEntries.length ?? 0;
52
53
 
53
54
  if (e.key === 'Tab') {
@@ -84,6 +85,7 @@ const ComboInput: React.FC<ComboInputProps> = ({ entries, fieldProps, handleInpu
84
85
  <Layer>
85
86
  <TextInput
86
87
  {...fieldProps}
88
+ id={fieldProps.id || name}
87
89
  onChange={(e) => {
88
90
  setHighlightedEntry(-1);
89
91
  handleInputChange(e.target.value);
@@ -1,5 +1,5 @@
1
1
  import React, { type HTMLAttributes, useEffect, useRef, useState } from 'react';
2
- import { Layer, Search, type SearchProps } from '@carbon/react';
2
+ import { Layer, Search } from '@carbon/react';
3
3
  import classNames from 'classnames';
4
4
  import styles from './autosuggest.scss';
5
5
 
@@ -51,7 +51,7 @@ interface SearchProps extends InputPropsBase {
51
51
  /**
52
52
  * Optional callback called when the search value changes.
53
53
  */
54
- onChange?(e: { target: HTMLInputElement; type: 'change' }): void;
54
+ onChange?(e: React.ChangeEvent<HTMLInputElement>): void;
55
55
 
56
56
  /**
57
57
  * Optional callback called when the search value is cleared.
@@ -98,9 +98,9 @@ interface SearchProps extends InputPropsBase {
98
98
  }
99
99
 
100
100
  interface AutosuggestProps extends SearchProps {
101
- getDisplayValue: Function;
102
- getFieldValue: Function;
103
- getSearchResults: (query: string) => Promise<any>;
101
+ getDisplayValue: (suggestion: any) => string;
102
+ getFieldValue: (suggestion: any) => string;
103
+ getSearchResults: (query: string) => Promise<Array<any>>;
104
104
  onSuggestionSelected: (field: string, value: string) => void;
105
105
  invalid?: boolean | undefined;
106
106
  invalidText?: string | undefined;
@@ -128,8 +128,8 @@ export const Autosuggest: React.FC<AutosuggestProps> = ({
128
128
  };
129
129
  }, [wrapper]);
130
130
 
131
- const handleClickOutsideComponent = (e) => {
132
- if (wrapper.current && !wrapper.current.contains(e.target)) {
131
+ const handleClickOutsideComponent = (e: MouseEvent) => {
132
+ if (wrapper.current && !wrapper.current.contains(e.target as Node)) {
133
133
  setSuggestions([]);
134
134
  }
135
135
  };
@@ -147,7 +147,7 @@ export const Autosuggest: React.FC<AutosuggestProps> = ({
147
147
  }
148
148
  };
149
149
 
150
- const handleClear = (e: React.ChangeEvent<HTMLInputElement>) => {
150
+ const handleClear = () => {
151
151
  onSuggestionSelected(name, undefined);
152
152
  };
153
153
 
@@ -397,8 +397,8 @@ describe('Registering a new patient', () => {
397
397
  expect(mockSavePatient).toHaveBeenCalledTimes(1);
398
398
  expect(mockSaveEncounter).toHaveBeenCalledTimes(1);
399
399
 
400
- (expect(mockShowSnackbar).toHaveBeenCalledWith(expect.objectContaining({ subtitle: 'an error message' })),
401
- mockSaveEncounter.mockResolvedValue({} as FetchResponse));
400
+ expect(mockShowSnackbar).toHaveBeenCalledWith(expect.objectContaining({ subtitle: 'an error message' }));
401
+ mockSaveEncounter.mockResolvedValue({} as FetchResponse);
402
402
 
403
403
  await user.click(registerPatientButton);
404
404
  expect(mockSavePatient).toHaveBeenCalledTimes(2);
@@ -1,13 +1,5 @@
1
1
  import React, { useCallback, useEffect, useId, useState } from 'react';
2
- import {
3
- Button,
4
- Layer,
5
- Select,
6
- SelectItem,
7
- InlineNotification,
8
- NotificationActionButton,
9
- SkeletonText,
10
- } from '@carbon/react';
2
+ import { ActionableNotification, Button, Layer, Select, SelectItem, SkeletonText } from '@carbon/react';
11
3
  import { TrashCan } from '@carbon/react/icons';
12
4
  import { FieldArray } from 'formik';
13
5
  import { useTranslation } from 'react-i18next';
@@ -147,14 +139,11 @@ const RelationshipView: React.FC<RelationshipViewProps> = ({
147
139
  </div>
148
140
  </div>
149
141
  ) : (
150
- <InlineNotification
142
+ <ActionableNotification
151
143
  kind="info"
152
144
  title={t('relationshipRemovedText', 'Relationship removed')}
153
- actions={
154
- <NotificationActionButton onClick={restoreRelationship}>
155
- {t('restoreRelationshipActionButton', 'Undo')}
156
- </NotificationActionButton>
157
- }
145
+ actionButtonLabel={t('restoreRelationshipActionButton', 'Undo')}
146
+ onActionButtonClick={restoreRelationship}
158
147
  />
159
148
  );
160
149
  };
@@ -178,11 +167,13 @@ export const RelationshipsSection = () => {
178
167
  uuid: type.uuid,
179
168
  direction: 'bIsToA',
180
169
  };
181
- aIsToB.display === bIsToA.display
182
- ? tmp.push(aIsToB)
183
- : bIsToA.display === 'Patient'
184
- ? tmp.push(aIsToB, { display: `Patient (${aIsToB.display})`, uuid: type.uuid, direction: 'bIsToA' })
185
- : tmp.push(aIsToB, bIsToA);
170
+ if (aIsToB.display === bIsToA.display) {
171
+ tmp.push(aIsToB);
172
+ } else if (bIsToA.display === 'Patient') {
173
+ tmp.push(aIsToB, { display: `Patient (${aIsToB.display})`, uuid: type.uuid, direction: 'bIsToA' });
174
+ } else {
175
+ tmp.push(aIsToB, bIsToA);
176
+ }
186
177
  });
187
178
  setDisplayRelationshipTypes(tmp);
188
179
  }
@@ -191,7 +182,10 @@ export const RelationshipsSection = () => {
191
182
  if (!relationshipTypes) {
192
183
  return (
193
184
  <section aria-label="Loading relationships section">
194
- <SkeletonText role="progressbar" />
185
+ <SkeletonText
186
+ // @ts-expect-error
187
+ role="progressbar"
188
+ />
195
189
  </section>
196
190
  );
197
191
  }
@@ -12,7 +12,7 @@ const EditPatientDetailsButton: React.FC<EditPatientDetailsButtonProps> = ({ pat
12
12
  const { t } = useTranslation();
13
13
  const handleClick = React.useCallback(() => {
14
14
  navigate({ to: `\${openmrsSpaBase}/patient/${patientUuid}/edit` });
15
- onTransition && onTransition();
15
+ onTransition?.();
16
16
  }, [onTransition, patientUuid]);
17
17
 
18
18
  return (