@medplum/react 2.0.20 → 2.0.22

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 (153) hide show
  1. package/dist/cjs/index.cjs +218 -151
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/index.min.cjs +1 -1
  4. package/dist/esm/AppShell/AppShell.mjs +2 -2
  5. package/dist/esm/AppShell/AppShell.mjs.map +1 -1
  6. package/dist/esm/AppShell/Header.mjs +1 -1
  7. package/dist/esm/AppShell/Header.mjs.map +1 -1
  8. package/dist/esm/AppShell/HeaderSearchInput.mjs +1 -1
  9. package/dist/esm/AppShell/HeaderSearchInput.mjs.map +1 -1
  10. package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs +2 -1
  11. package/dist/esm/AsyncAutocomplete/AsyncAutocomplete.mjs.map +1 -1
  12. package/dist/esm/AttachmentButton/AttachmentButton.mjs +1 -2
  13. package/dist/esm/AttachmentButton/AttachmentButton.mjs.map +1 -1
  14. package/dist/esm/DateTimeInput/DateTimeInput.mjs +1 -0
  15. package/dist/esm/DateTimeInput/DateTimeInput.mjs.map +1 -1
  16. package/dist/esm/FhirPathTable/FhirPathTable.mjs +2 -0
  17. package/dist/esm/FhirPathTable/FhirPathTable.mjs.map +1 -1
  18. package/dist/esm/Form/FormUtils.mjs +2 -1
  19. package/dist/esm/Form/FormUtils.mjs.map +1 -1
  20. package/dist/esm/MedplumProvider/MedplumProvider.mjs +12 -0
  21. package/dist/esm/MedplumProvider/MedplumProvider.mjs.map +1 -1
  22. package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.mjs +2 -1
  23. package/dist/esm/PlanDefinitionBuilder/PlanDefinitionBuilder.mjs.map +1 -1
  24. package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.mjs +3 -2
  25. package/dist/esm/QuestionnaireBuilder/QuestionnaireBuilder.mjs.map +1 -1
  26. package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.mjs +13 -5
  27. package/dist/esm/ReferenceRangeEditor/ReferenceRangeEditor.mjs.map +1 -1
  28. package/dist/esm/ResourceName/ResourceName.mjs +0 -5
  29. package/dist/esm/ResourceName/ResourceName.mjs.map +1 -1
  30. package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs +6 -3
  31. package/dist/esm/ResourcePropertyDisplay/ResourcePropertyDisplay.mjs.map +1 -1
  32. package/dist/esm/ResourceTimeline/ResourceTimeline.mjs +1 -1
  33. package/dist/esm/ResourceTimeline/ResourceTimeline.mjs.map +1 -1
  34. package/dist/esm/SearchControl/SearchControl.mjs +3 -2
  35. package/dist/esm/SearchControl/SearchControl.mjs.map +1 -1
  36. package/dist/esm/SearchControl/SearchUtils.mjs +77 -54
  37. package/dist/esm/SearchControl/SearchUtils.mjs.map +1 -1
  38. package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs +6 -7
  39. package/dist/esm/SearchFieldEditor/SearchFieldEditor.mjs.map +1 -1
  40. package/dist/esm/Timeline/Timeline.mjs +2 -1
  41. package/dist/esm/Timeline/Timeline.mjs.map +1 -1
  42. package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs +14 -5
  43. package/dist/esm/ValueSetAutocomplete/ValueSetAutocomplete.mjs.map +1 -1
  44. package/dist/esm/auth/SignInForm.mjs +10 -4
  45. package/dist/esm/auth/SignInForm.mjs.map +1 -1
  46. package/dist/esm/index.min.mjs +1 -1
  47. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/createReactComponent.mjs +1 -1
  48. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/createReactComponent.mjs.map +1 -1
  49. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.mjs +1 -1
  50. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/defaultAttributes.mjs.map +1 -1
  51. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconAdjustmentsHorizontal.mjs +1 -1
  52. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconAdjustmentsHorizontal.mjs.map +1 -1
  53. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertCircle.mjs +1 -1
  54. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertCircle.mjs.map +1 -1
  55. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBleach.mjs +1 -1
  56. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBleach.mjs.map +1 -1
  57. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBleachOff.mjs +1 -1
  58. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBleachOff.mjs.map +1 -1
  59. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBoxMultiple.mjs +1 -1
  60. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBoxMultiple.mjs.map +1 -1
  61. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBracketsContain.mjs +1 -1
  62. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBracketsContain.mjs.map +1 -1
  63. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBucket.mjs +1 -1
  64. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBucket.mjs.map +1 -1
  65. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBucketOff.mjs +1 -1
  66. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconBucketOff.mjs.map +1 -1
  67. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCalendar.mjs +1 -1
  68. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCalendar.mjs.map +1 -1
  69. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.mjs +1 -1
  70. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCheck.mjs.map +1 -1
  71. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCheckbox.mjs +1 -1
  72. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCheckbox.mjs.map +1 -1
  73. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.mjs +1 -1
  74. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronDown.mjs.map +1 -1
  75. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleMinus.mjs +1 -1
  76. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCircleMinus.mjs.map +1 -1
  77. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCirclePlus.mjs +1 -1
  78. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCirclePlus.mjs.map +1 -1
  79. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCloudUpload.mjs +1 -1
  80. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCloudUpload.mjs.map +1 -1
  81. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconColumns.mjs +1 -1
  82. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconColumns.mjs.map +1 -1
  83. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCurrencyDollar.mjs +1 -1
  84. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconCurrencyDollar.mjs.map +1 -1
  85. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconDots.mjs +1 -1
  86. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconDots.mjs.map +1 -1
  87. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEdit.mjs +1 -1
  88. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEdit.mjs.map +1 -1
  89. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEqual.mjs +1 -1
  90. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEqual.mjs.map +1 -1
  91. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEqualNot.mjs +1 -1
  92. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconEqualNot.mjs.map +1 -1
  93. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFileAlert.mjs +1 -1
  94. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFileAlert.mjs.map +1 -1
  95. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFilePlus.mjs +1 -1
  96. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFilePlus.mjs.map +1 -1
  97. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFilter.mjs +1 -1
  98. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconFilter.mjs.map +1 -1
  99. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconListDetails.mjs +1 -1
  100. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconListDetails.mjs.map +1 -1
  101. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconLogout.mjs +1 -1
  102. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconLogout.mjs.map +1 -1
  103. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMathGreater.mjs +1 -1
  104. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMathGreater.mjs.map +1 -1
  105. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMathLower.mjs +1 -1
  106. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMathLower.mjs.map +1 -1
  107. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMessage.mjs +1 -1
  108. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconMessage.mjs.map +1 -1
  109. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPin.mjs +1 -1
  110. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPin.mjs.map +1 -1
  111. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPinnedOff.mjs +1 -1
  112. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPinnedOff.mjs.map +1 -1
  113. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPlus.mjs +1 -1
  114. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconPlus.mjs.map +1 -1
  115. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.mjs +1 -1
  116. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSearch.mjs.map +1 -1
  117. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSettings.mjs +1 -1
  118. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSettings.mjs.map +1 -1
  119. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSortAscending.mjs +1 -1
  120. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSortAscending.mjs.map +1 -1
  121. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSortDescending.mjs +1 -1
  122. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSortDescending.mjs.map +1 -1
  123. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSquare.mjs +1 -1
  124. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSquare.mjs.map +1 -1
  125. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSwitchHorizontal.mjs +1 -1
  126. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconSwitchHorizontal.mjs.map +1 -1
  127. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconTableExport.mjs +1 -1
  128. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconTableExport.mjs.map +1 -1
  129. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.mjs +1 -1
  130. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconTrash.mjs.map +1 -1
  131. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconX.mjs +1 -1
  132. package/dist/esm/node_modules/@tabler/icons-react/dist/esm/icons/IconX.mjs.map +1 -1
  133. package/dist/esm/useResource/useResource.mjs +1 -0
  134. package/dist/esm/useResource/useResource.mjs.map +1 -1
  135. package/dist/esm/utils/date.mjs +9 -6
  136. package/dist/esm/utils/date.mjs.map +1 -1
  137. package/dist/esm/utils/script.mjs +1 -0
  138. package/dist/esm/utils/script.mjs.map +1 -1
  139. package/dist/types/AppShell/Header.d.ts +2 -0
  140. package/dist/types/AppShell/HeaderSearchInput.d.ts +1 -0
  141. package/dist/types/FhirPathTable/FhirPathTable.d.ts +2 -0
  142. package/dist/types/Form/FormUtils.d.ts +1 -0
  143. package/dist/types/MedplumProvider/MedplumProvider.d.ts +4 -0
  144. package/dist/types/ResourceName/ResourceName.d.ts +0 -5
  145. package/dist/types/ResourcePropertyDisplay/ResourcePropertyDisplay.d.ts +4 -2
  146. package/dist/types/SearchControl/SearchControl.d.ts +2 -0
  147. package/dist/types/SearchControl/SearchUtils.d.ts +64 -44
  148. package/dist/types/Timeline/Timeline.d.ts +1 -0
  149. package/dist/types/ValueSetAutocomplete/ValueSetAutocomplete.d.ts +3 -0
  150. package/dist/types/auth/SignInForm.d.ts +2 -0
  151. package/dist/types/useResource/useResource.d.ts +1 -0
  152. package/dist/types/utils/script.d.ts +1 -0
  153. package/package.json +12 -12
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@medplum/core'), require('react'), require('@mantine/core'), require('prop-types'), require('@mantine/notifications')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@medplum/core', 'react', '@mantine/core', 'prop-types', '@mantine/notifications'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.medplum = global.medplum || {}, global.medplum.react = {}), global.medplum.core, global.React, global.mantine.core, global.PropTypes, global.mantine.notifications));
5
- })(this, (function (exports, core, React, core$1, PropTypes, notifications) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@medplum/core'), require('react'), require('@mantine/core'), require('@mantine/notifications'), require('prop-types')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@medplum/core', 'react', '@mantine/core', '@mantine/notifications', 'prop-types'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.medplum = global.medplum || {}, global.medplum.react = {}), global.medplum.core, global.React, global.mantine.core, global.mantine.notifications, global.PropTypes));
5
+ })(this, (function (exports, core, React, core$1, notifications, PropTypes) { 'use strict';
6
6
 
7
7
  function AddressDisplay(props) {
8
8
  const address = props.value;
@@ -71,6 +71,8 @@
71
71
  * Medplum context includes:
72
72
  * 1) medplum - Medplum client library
73
73
  * 2) profile - The current user profile (if signed in)
74
+ * @param props The MedplumProvider React props.
75
+ * @returns The MedplumProvider React node.
74
76
  */
75
77
  function MedplumProvider(props) {
76
78
  const medplum = props.medplum;
@@ -89,6 +91,13 @@
89
91
  medplum.addEventListener('change', eventListener);
90
92
  return () => medplum.removeEventListeneer('change', eventListener);
91
93
  }, [medplum, state]);
94
+ React.useEffect(() => {
95
+ function eventListener() {
96
+ notifications.showNotification({ color: 'red', message: 'No connection to server', autoClose: false });
97
+ }
98
+ medplum.addEventListener('offline', eventListener);
99
+ return () => medplum.removeEventListeneer('offline', eventListener);
100
+ }, [medplum]);
92
101
  const medplumContext = {
93
102
  ...state,
94
103
  medplum,
@@ -98,6 +107,7 @@
98
107
  }
99
108
  /**
100
109
  * Returns the MedplumContext instance.
110
+ * @returns The MedplumContext instance.
101
111
  */
102
112
  function useMedplumContext() {
103
113
  return React.useContext(reactContext);
@@ -105,6 +115,7 @@
105
115
  /**
106
116
  * Returns the MedplumClient instance.
107
117
  * This is a shortcut for useMedplumContext().medplum.
118
+ * @returns The MedplumClient instance.
108
119
  */
109
120
  function useMedplum() {
110
121
  return useMedplumContext().medplum;
@@ -154,7 +165,7 @@
154
165
  }
155
166
 
156
167
  /**
157
- * @tabler/icons-react v2.19.0 - MIT
168
+ * @tabler/icons-react v2.22.0 - MIT
158
169
  */
159
170
 
160
171
  var defaultAttributes = {
@@ -170,7 +181,7 @@
170
181
  };
171
182
 
172
183
  /**
173
- * @tabler/icons-react v2.19.0 - MIT
184
+ * @tabler/icons-react v2.22.0 - MIT
174
185
  */
175
186
 
176
187
 
@@ -234,7 +245,7 @@
234
245
  };
235
246
 
236
247
  /**
237
- * @tabler/icons-react v2.19.0 - MIT
248
+ * @tabler/icons-react v2.22.0 - MIT
238
249
  */
239
250
 
240
251
 
@@ -255,7 +266,7 @@
255
266
  );
256
267
 
257
268
  /**
258
- * @tabler/icons-react v2.19.0 - MIT
269
+ * @tabler/icons-react v2.22.0 - MIT
259
270
  */
260
271
 
261
272
 
@@ -266,7 +277,7 @@
266
277
  ]);
267
278
 
268
279
  /**
269
- * @tabler/icons-react v2.19.0 - MIT
280
+ * @tabler/icons-react v2.22.0 - MIT
270
281
  */
271
282
 
272
283
 
@@ -282,7 +293,7 @@
282
293
  ]);
283
294
 
284
295
  /**
285
- * @tabler/icons-react v2.19.0 - MIT
296
+ * @tabler/icons-react v2.22.0 - MIT
286
297
  */
287
298
 
288
299
 
@@ -297,7 +308,7 @@
297
308
  ]);
298
309
 
299
310
  /**
300
- * @tabler/icons-react v2.19.0 - MIT
311
+ * @tabler/icons-react v2.22.0 - MIT
301
312
  */
302
313
 
303
314
 
@@ -319,7 +330,7 @@
319
330
  ]);
320
331
 
321
332
  /**
322
- * @tabler/icons-react v2.19.0 - MIT
333
+ * @tabler/icons-react v2.22.0 - MIT
323
334
  */
324
335
 
325
336
 
@@ -332,7 +343,7 @@
332
343
  ]);
333
344
 
334
345
  /**
335
- * @tabler/icons-react v2.19.0 - MIT
346
+ * @tabler/icons-react v2.22.0 - MIT
336
347
  */
337
348
 
338
349
 
@@ -355,7 +366,7 @@
355
366
  ]);
356
367
 
357
368
  /**
358
- * @tabler/icons-react v2.19.0 - MIT
369
+ * @tabler/icons-react v2.22.0 - MIT
359
370
  */
360
371
 
361
372
 
@@ -371,7 +382,7 @@
371
382
  ]);
372
383
 
373
384
  /**
374
- * @tabler/icons-react v2.19.0 - MIT
385
+ * @tabler/icons-react v2.22.0 - MIT
375
386
  */
376
387
 
377
388
 
@@ -391,7 +402,7 @@
391
402
  ]);
392
403
 
393
404
  /**
394
- * @tabler/icons-react v2.19.0 - MIT
405
+ * @tabler/icons-react v2.22.0 - MIT
395
406
  */
396
407
 
397
408
 
@@ -400,7 +411,7 @@
400
411
  ]);
401
412
 
402
413
  /**
403
- * @tabler/icons-react v2.19.0 - MIT
414
+ * @tabler/icons-react v2.22.0 - MIT
404
415
  */
405
416
 
406
417
 
@@ -416,7 +427,7 @@
416
427
  ]);
417
428
 
418
429
  /**
419
- * @tabler/icons-react v2.19.0 - MIT
430
+ * @tabler/icons-react v2.22.0 - MIT
420
431
  */
421
432
 
422
433
 
@@ -425,7 +436,7 @@
425
436
  ]);
426
437
 
427
438
  /**
428
- * @tabler/icons-react v2.19.0 - MIT
439
+ * @tabler/icons-react v2.22.0 - MIT
429
440
  */
430
441
 
431
442
 
@@ -435,7 +446,7 @@
435
446
  ]);
436
447
 
437
448
  /**
438
- * @tabler/icons-react v2.19.0 - MIT
449
+ * @tabler/icons-react v2.22.0 - MIT
439
450
  */
440
451
 
441
452
 
@@ -446,7 +457,7 @@
446
457
  ]);
447
458
 
448
459
  /**
449
- * @tabler/icons-react v2.19.0 - MIT
460
+ * @tabler/icons-react v2.22.0 - MIT
450
461
  */
451
462
 
452
463
 
@@ -463,7 +474,7 @@
463
474
  ]);
464
475
 
465
476
  /**
466
- * @tabler/icons-react v2.19.0 - MIT
477
+ * @tabler/icons-react v2.22.0 - MIT
467
478
  */
468
479
 
469
480
 
@@ -479,7 +490,7 @@
479
490
  ]);
480
491
 
481
492
  /**
482
- * @tabler/icons-react v2.19.0 - MIT
493
+ * @tabler/icons-react v2.22.0 - MIT
483
494
  */
484
495
 
485
496
 
@@ -495,7 +506,7 @@
495
506
  ]);
496
507
 
497
508
  /**
498
- * @tabler/icons-react v2.19.0 - MIT
509
+ * @tabler/icons-react v2.22.0 - MIT
499
510
  */
500
511
 
501
512
 
@@ -506,7 +517,7 @@
506
517
  ]);
507
518
 
508
519
  /**
509
- * @tabler/icons-react v2.19.0 - MIT
520
+ * @tabler/icons-react v2.22.0 - MIT
510
521
  */
511
522
 
512
523
 
@@ -529,7 +540,7 @@
529
540
  ]);
530
541
 
531
542
  /**
532
- * @tabler/icons-react v2.19.0 - MIT
543
+ * @tabler/icons-react v2.22.0 - MIT
533
544
  */
534
545
 
535
546
 
@@ -540,7 +551,7 @@
540
551
  ]);
541
552
 
542
553
  /**
543
- * @tabler/icons-react v2.19.0 - MIT
554
+ * @tabler/icons-react v2.22.0 - MIT
544
555
  */
545
556
 
546
557
 
@@ -550,7 +561,7 @@
550
561
  ]);
551
562
 
552
563
  /**
553
- * @tabler/icons-react v2.19.0 - MIT
564
+ * @tabler/icons-react v2.22.0 - MIT
554
565
  */
555
566
 
556
567
 
@@ -568,7 +579,7 @@
568
579
  ]);
569
580
 
570
581
  /**
571
- * @tabler/icons-react v2.19.0 - MIT
582
+ * @tabler/icons-react v2.22.0 - MIT
572
583
  */
573
584
 
574
585
 
@@ -586,7 +597,7 @@
586
597
  ]);
587
598
 
588
599
  /**
589
- * @tabler/icons-react v2.19.0 - MIT
600
+ * @tabler/icons-react v2.22.0 - MIT
590
601
  */
591
602
 
592
603
 
@@ -601,7 +612,7 @@
601
612
  ]);
602
613
 
603
614
  /**
604
- * @tabler/icons-react v2.19.0 - MIT
615
+ * @tabler/icons-react v2.22.0 - MIT
605
616
  */
606
617
 
607
618
 
@@ -627,7 +638,7 @@
627
638
  ]);
628
639
 
629
640
  /**
630
- * @tabler/icons-react v2.19.0 - MIT
641
+ * @tabler/icons-react v2.22.0 - MIT
631
642
  */
632
643
 
633
644
 
@@ -644,7 +655,7 @@
644
655
  ]);
645
656
 
646
657
  /**
647
- * @tabler/icons-react v2.19.0 - MIT
658
+ * @tabler/icons-react v2.22.0 - MIT
648
659
  */
649
660
 
650
661
 
@@ -653,7 +664,7 @@
653
664
  ]);
654
665
 
655
666
  /**
656
- * @tabler/icons-react v2.19.0 - MIT
667
+ * @tabler/icons-react v2.22.0 - MIT
657
668
  */
658
669
 
659
670
 
@@ -662,7 +673,7 @@
662
673
  ]);
663
674
 
664
675
  /**
665
- * @tabler/icons-react v2.19.0 - MIT
676
+ * @tabler/icons-react v2.22.0 - MIT
666
677
  */
667
678
 
668
679
 
@@ -679,7 +690,7 @@
679
690
  ]);
680
691
 
681
692
  /**
682
- * @tabler/icons-react v2.19.0 - MIT
693
+ * @tabler/icons-react v2.22.0 - MIT
683
694
  */
684
695
 
685
696
 
@@ -696,7 +707,7 @@
696
707
  ]);
697
708
 
698
709
  /**
699
- * @tabler/icons-react v2.19.0 - MIT
710
+ * @tabler/icons-react v2.22.0 - MIT
700
711
  */
701
712
 
702
713
 
@@ -714,7 +725,7 @@
714
725
  ]);
715
726
 
716
727
  /**
717
- * @tabler/icons-react v2.19.0 - MIT
728
+ * @tabler/icons-react v2.22.0 - MIT
718
729
  */
719
730
 
720
731
 
@@ -724,7 +735,7 @@
724
735
  ]);
725
736
 
726
737
  /**
727
- * @tabler/icons-react v2.19.0 - MIT
738
+ * @tabler/icons-react v2.22.0 - MIT
728
739
  */
729
740
 
730
741
 
@@ -734,7 +745,7 @@
734
745
  ]);
735
746
 
736
747
  /**
737
- * @tabler/icons-react v2.19.0 - MIT
748
+ * @tabler/icons-react v2.22.0 - MIT
738
749
  */
739
750
 
740
751
 
@@ -750,7 +761,7 @@
750
761
  ]);
751
762
 
752
763
  /**
753
- * @tabler/icons-react v2.19.0 - MIT
764
+ * @tabler/icons-react v2.22.0 - MIT
754
765
  */
755
766
 
756
767
 
@@ -763,7 +774,7 @@
763
774
  ]);
764
775
 
765
776
  /**
766
- * @tabler/icons-react v2.19.0 - MIT
777
+ * @tabler/icons-react v2.22.0 - MIT
767
778
  */
768
779
 
769
780
 
@@ -776,7 +787,7 @@
776
787
  ]);
777
788
 
778
789
  /**
779
- * @tabler/icons-react v2.19.0 - MIT
790
+ * @tabler/icons-react v2.22.0 - MIT
780
791
  */
781
792
 
782
793
 
@@ -791,7 +802,7 @@
791
802
  ]);
792
803
 
793
804
  /**
794
- * @tabler/icons-react v2.19.0 - MIT
805
+ * @tabler/icons-react v2.22.0 - MIT
795
806
  */
796
807
 
797
808
 
@@ -807,7 +818,7 @@
807
818
  );
808
819
 
809
820
  /**
810
- * @tabler/icons-react v2.19.0 - MIT
821
+ * @tabler/icons-react v2.22.0 - MIT
811
822
  */
812
823
 
813
824
 
@@ -826,7 +837,7 @@
826
837
  ]);
827
838
 
828
839
  /**
829
- * @tabler/icons-react v2.19.0 - MIT
840
+ * @tabler/icons-react v2.22.0 - MIT
830
841
  */
831
842
 
832
843
 
@@ -842,7 +853,7 @@
842
853
  ]);
843
854
 
844
855
  /**
845
- * @tabler/icons-react v2.19.0 - MIT
856
+ * @tabler/icons-react v2.22.0 - MIT
846
857
  */
847
858
 
848
859
 
@@ -967,6 +978,7 @@
967
978
  * React Hook to use a FHIR reference.
968
979
  * Handles the complexity of resolving references and caching resources.
969
980
  * @param value The resource or reference to resource.
981
+ * @param setOutcome Optional callback to set the OperationOutcome.
970
982
  * @returns The resolved resource.
971
983
  */
972
984
  function useResource(value, setOutcome) {
@@ -1101,8 +1113,9 @@
1101
1113
  if (!item && creatable !== false) {
1102
1114
  item = onCreate(value);
1103
1115
  }
1104
- if (item)
1116
+ if (item) {
1105
1117
  result.push(item);
1118
+ }
1106
1119
  }
1107
1120
  onChange(result);
1108
1121
  }, [creatable, onChange, onCreate]);
@@ -1193,7 +1206,7 @@
1193
1206
  navigate(`/${core.getReferenceString(item[0])}`);
1194
1207
  }
1195
1208
  }, [navigate]);
1196
- return (React.createElement(AsyncAutocomplete, { key: props.pathname, size: "sm", radius: "md", className: classes.searchInput, icon: React.createElement(IconSearch, { size: 16 }), placeholder: "Search", itemComponent: ItemComponent$1, toKey: toKey$1, toOption: toOption$1, onChange: handleSelect, loadOptions: loadData }));
1209
+ return (React.createElement(AsyncAutocomplete, { key: `${props.pathname}?${props.searchParams}`, size: "sm", radius: "md", className: classes.searchInput, icon: React.createElement(IconSearch, { size: 16 }), placeholder: "Search", itemComponent: ItemComponent$1, toKey: toKey$1, toOption: toOption$1, onChange: handleSelect, loadOptions: loadData, maxSelectedValues: 0, clearSearchOnChange: true, clearable: false }));
1197
1210
  }
1198
1211
  const ItemComponent$1 = React.forwardRef(({ resource, ...others }, ref) => {
1199
1212
  let helpText = undefined;
@@ -1406,7 +1419,7 @@
1406
1419
  React.createElement(core$1.Group, { position: "apart" },
1407
1420
  React.createElement(core$1.Group, { spacing: "xs" },
1408
1421
  React.createElement(core$1.UnstyledButton, { className: classes.logoButton, onClick: props.navbarToggle }, props.logo),
1409
- React.createElement(HeaderSearchInput, null)),
1422
+ React.createElement(HeaderSearchInput, { pathname: props.pathname, searchParams: props.searchParams })),
1410
1423
  React.createElement(core$1.Menu, { width: 260, shadow: "xl", position: "bottom-end", transitionProps: { transition: 'pop-top-right' }, opened: userMenuOpened, onClose: () => setUserMenuOpened(false) },
1411
1424
  React.createElement(core$1.Menu.Target, null,
1412
1425
  React.createElement(core$1.UnstyledButton, { className: cx(classes.user, { [classes.userActive]: userMenuOpened }), onClick: () => setUserMenuOpened((o) => !o) },
@@ -1444,6 +1457,7 @@
1444
1457
  /**
1445
1458
  * Parses an HTML form and returns the result as a JavaScript object.
1446
1459
  * @param form The HTML form element.
1460
+ * @returns Form values in key value pairs.
1447
1461
  */
1448
1462
  function parseForm(form) {
1449
1463
  const result = {};
@@ -1464,8 +1478,8 @@
1464
1478
  * Parses an HTML input element.
1465
1479
  * Sets the name/value pair in the result,
1466
1480
  * but only if the element is enabled and checked.
1467
- * @param el The input element.
1468
1481
  * @param result The result builder.
1482
+ * @param el The input element.
1469
1483
  */
1470
1484
  function parseInputElement(result, el) {
1471
1485
  if (el.disabled) {
@@ -1537,11 +1551,20 @@
1537
1551
  }
1538
1552
 
1539
1553
  function toKey(element) {
1540
- return element.code;
1554
+ if (typeof element.code === 'string') {
1555
+ return element.code;
1556
+ }
1557
+ return JSON.stringify(element);
1558
+ }
1559
+ function getDisplay(item) {
1560
+ if (typeof item.display === 'string') {
1561
+ return item.display;
1562
+ }
1563
+ return toKey(item);
1541
1564
  }
1542
1565
  function toOption(element) {
1543
1566
  return {
1544
- value: element.code,
1567
+ value: toKey(element),
1545
1568
  label: getDisplay(element),
1546
1569
  resource: element,
1547
1570
  };
@@ -1554,6 +1577,9 @@
1554
1577
  }
1555
1578
  /**
1556
1579
  * A low-level component to autocomplete based on a FHIR Valueset.
1580
+ * This is the base component for CodeableConceptInput, CodingInput, and CodeInput.
1581
+ * @param props The ValueSetAutocomplete React props.
1582
+ * @returns The ValueSetAutocomplete React node.
1557
1583
  */
1558
1584
  function ValueSetAutocomplete(props) {
1559
1585
  const medplum = useMedplum();
@@ -1575,9 +1601,6 @@
1575
1601
  }, [medplum, elementDefinition]);
1576
1602
  return (React.createElement(AsyncAutocomplete, { ...rest, creatable: creatable ?? true, clearable: clearable ?? true, toKey: toKey, toOption: toOption, loadOptions: loadValues, onCreate: createValue, getCreateLabel: creatable === false ? undefined : (query) => `+ Create ${query}` }));
1577
1603
  }
1578
- function getDisplay(item) {
1579
- return item.display || item.code || '';
1580
- }
1581
1604
 
1582
1605
  function CodeInput(props) {
1583
1606
  const [value, setValue] = React.useState(props.defaultValue);
@@ -1779,8 +1802,8 @@
1779
1802
  main: {
1780
1803
  background: theme.colorScheme === 'dark' ? theme.colors.dark[8] : theme.colors.gray[0],
1781
1804
  },
1782
- }, padding: 0, fixed: true, header: profile && React.createElement(Header, { logo: props.logo, version: props.version, navbarToggle: toggleNavbar }), navbar: profile && navbarOpen ? (React.createElement(Navbar, { pathname: props.pathname, searchParams: props.searchParams, menus: props.menus, closeNavbar: closeNavbar, displayAddBookmark: props.displayAddBookmark })) : undefined },
1783
- React.createElement(ErrorBoundary, null,
1805
+ }, padding: 0, fixed: true, header: profile && (React.createElement(Header, { pathname: props.pathname, searchParams: props.searchParams, logo: props.logo, version: props.version, navbarToggle: toggleNavbar })), navbar: profile && navbarOpen ? (React.createElement(Navbar, { pathname: props.pathname, searchParams: props.searchParams, menus: props.menus, closeNavbar: closeNavbar, displayAddBookmark: props.displayAddBookmark })) : undefined },
1806
+ React.createElement(ErrorBoundary, { key: `${props.pathname}?${props.searchParams?.toString()}` },
1784
1807
  React.createElement(React.Suspense, { fallback: React.createElement(Loading, null) }, props.children))));
1785
1808
  }
1786
1809
 
@@ -1822,8 +1845,7 @@
1822
1845
  }
1823
1846
  /**
1824
1847
  * Processes a single file.
1825
- *
1826
- * @param {File} file The file descriptor.
1848
+ * @param file The file descriptor.
1827
1849
  */
1828
1850
  function processFile(file) {
1829
1851
  if (!file) {
@@ -2048,7 +2070,9 @@
2048
2070
  }
2049
2071
 
2050
2072
  /**
2051
- * Low-level component that renders a property from a given resource, given type information
2073
+ * Low-level component that renders a property from a given resource, given type information.
2074
+ * @param props The ResourcePropertyDisplay React props.
2075
+ * @returns The ResourcePropertyDisplay React node.
2052
2076
  */
2053
2077
  function ResourcePropertyDisplay(props) {
2054
2078
  const { property, propertyType, value } = props;
@@ -2062,11 +2086,12 @@
2062
2086
  case core.PropertyType.boolean:
2063
2087
  return React.createElement(React.Fragment, null, value === undefined ? '' : Boolean(value).toString());
2064
2088
  case core.PropertyType.SystemString:
2089
+ case core.PropertyType.string:
2090
+ return React.createElement("div", { style: { whiteSpace: 'pre-wrap' } }, value);
2065
2091
  case core.PropertyType.code:
2066
2092
  case core.PropertyType.date:
2067
2093
  case core.PropertyType.integer:
2068
2094
  case core.PropertyType.positiveInt:
2069
- case core.PropertyType.string:
2070
2095
  case core.PropertyType.unsignedInt:
2071
2096
  case core.PropertyType.uri:
2072
2097
  case core.PropertyType.url:
@@ -2128,7 +2153,7 @@
2128
2153
  * According to the spec, there can only be one property for a given element definition.
2129
2154
  * This function returns the value and the type.
2130
2155
  * @param context The base context (usually a FHIR resource).
2131
- * @param property The property definition.
2156
+ * @param path The property path.
2132
2157
  * @returns The value of the property and the property type.
2133
2158
  */
2134
2159
  function getValueAndType(context, path) {
@@ -2453,6 +2478,7 @@
2453
2478
  * Returns the input type for the requested type.
2454
2479
  * JSDOM does not support many of the valid <input> type attributes.
2455
2480
  * For example, it won't fire change events for <input type="datetime-local">.
2481
+ * @returns The input type for the current environment.
2456
2482
  */
2457
2483
  function getInputType() {
2458
2484
  return 'datetime-local';
@@ -3215,11 +3241,6 @@
3215
3241
  return (React.createElement(core$1.Stack, { justify: "flex-start", spacing: "xs" }, value.map((note, index) => note.text && (React.createElement(core$1.Blockquote, { key: `note-${index}`, classNames: { cite: classes.noteCite, body: classes.noteBody, root: classes.noteRoot }, cite: note.authorReference?.display || note.authorString, icon: null }, note.text)))));
3216
3242
  }
3217
3243
 
3218
- /**
3219
- * Renders the name of a resource, given either the resource itself or a reference to the resource.
3220
- * @param props
3221
- * @returns
3222
- */
3223
3244
  function ResourceName(props) {
3224
3245
  const { value, link, ...rest } = props;
3225
3246
  const [outcome, setOutcome] = React.useState();
@@ -3585,6 +3606,7 @@
3585
3606
  function TimelineItem(props) {
3586
3607
  const { resource, profile, padding, popupMenuItems, ...others } = props;
3587
3608
  const author = profile ?? resource.meta?.author;
3609
+ const dateTime = props.dateTime ?? resource.meta?.lastUpdated;
3588
3610
  return (React.createElement(Panel, { "data-testid": "timeline-item", fill: true, ...others },
3589
3611
  React.createElement(core$1.Group, { position: "apart", spacing: 8, mx: "xs", my: "sm" },
3590
3612
  React.createElement(ResourceAvatar, { value: author, link: true, size: "md" }),
@@ -3592,7 +3614,7 @@
3592
3614
  React.createElement(core$1.Text, { size: "sm" },
3593
3615
  React.createElement(ResourceName, { color: "dark", weight: 500, value: author, link: true })),
3594
3616
  React.createElement(core$1.Text, { size: "xs" },
3595
- React.createElement(MedplumLink, { color: "dimmed", to: props.resource }, core.formatDateTime(props.resource.meta?.lastUpdated)),
3617
+ React.createElement(MedplumLink, { color: "dimmed", to: props.resource }, core.formatDateTime(dateTime)),
3596
3618
  React.createElement(core$1.Text, { component: "span", color: "dimmed", mx: 8 }, "\u00B7"),
3597
3619
  React.createElement(MedplumLink, { color: "dimmed", to: props.resource }, props.resource.resourceType))),
3598
3620
  popupMenuItems && (React.createElement(core$1.Menu, { position: "bottom-end", shadow: "md", width: 200 },
@@ -3612,8 +3634,8 @@
3612
3634
  */
3613
3635
  function sortByDateAndPriority(resources, timelineResource) {
3614
3636
  resources.sort((a, b) => {
3615
- const priority1 = getPriorityScore(a);
3616
- const priority2 = getPriorityScore(b);
3637
+ const priority1 = getPriorityScore(a, timelineResource);
3638
+ const priority2 = getPriorityScore(b, timelineResource);
3617
3639
  if (priority1 > priority2) {
3618
3640
  return 1;
3619
3641
  }
@@ -3623,10 +3645,13 @@
3623
3645
  return getTime(a, timelineResource) - getTime(b, timelineResource);
3624
3646
  });
3625
3647
  }
3626
- function getPriorityScore(resource) {
3627
- const priority = resource.priority;
3628
- if (typeof priority === 'string') {
3629
- return { stat: 4, asap: 3, urgent: 2 }[priority] || 0;
3648
+ function getPriorityScore(resource, timelineResource) {
3649
+ if (!isSameResourceType(resource, timelineResource)) {
3650
+ // Only use priority if not the primary resource of a timeline view.
3651
+ const priority = resource.priority;
3652
+ if (typeof priority === 'string') {
3653
+ return { stat: 4, asap: 3, urgent: 2 }[priority] || 0;
3654
+ }
3630
3655
  }
3631
3656
  return 0;
3632
3657
  }
@@ -3901,7 +3926,7 @@
3901
3926
  const { classes } = useStyles$7();
3902
3927
  const routine = !props.resource.priority || props.resource.priority === 'routine';
3903
3928
  const className = routine ? undefined : classes.pinnedComment;
3904
- return (React.createElement(TimelineItem, { resource: props.resource, profile: props.resource.sender, padding: true, className: className, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
3929
+ return (React.createElement(TimelineItem, { resource: props.resource, profile: props.resource.sender, dateTime: props.resource.sent, padding: true, className: className, popupMenuItems: React.createElement(TimelineItemPopupMenu, { ...props }) },
3905
3930
  React.createElement("p", null, props.resource.payload?.[0]?.contentString)));
3906
3931
  }
3907
3932
  function MediaTimelineItem(props) {
@@ -4080,8 +4105,9 @@
4080
4105
  };
4081
4106
  /**
4082
4107
  * Sets the array of filters.
4083
- *
4084
- * @param {Array} filters The new filters.
4108
+ * @param definition The original search request.
4109
+ * @param filters The new filters.
4110
+ * @returns The updated search request.
4085
4111
  */
4086
4112
  function setFilters(definition, filters) {
4087
4113
  return {
@@ -4093,25 +4119,29 @@
4093
4119
  }
4094
4120
  /**
4095
4121
  * Clears all of the filters.
4122
+ * @param definition The original search request.
4123
+ * @returns The updated search request.
4096
4124
  */
4097
4125
  function clearFilters(definition) {
4098
4126
  return setFilters(definition, []);
4099
4127
  }
4100
4128
  /**
4101
4129
  * Clears all of the filters on a certain field.
4102
- *
4103
- * @param {string} code The field key name to clear filters.
4130
+ * @param definition The original search request.
4131
+ * @param code The field key name to clear filters.
4132
+ * @returns The updated search request.
4104
4133
  */
4105
4134
  function clearFiltersOnField(definition, code) {
4106
4135
  return setFilters(definition, (definition.filters || []).filter((f) => f.code !== code));
4107
4136
  }
4108
4137
  /**
4109
4138
  * Adds a filter.
4110
- *
4111
- * @param {string} field The field key name.
4112
- * @param {Operator} op The operation key name.
4113
- * @param {?string} value The filter value.
4114
- * @param {boolean=} opt_clear Optional flag to clear filters on the field.
4139
+ * @param definition The original search request.
4140
+ * @param field The field key name.
4141
+ * @param op The operation key name.
4142
+ * @param value The filter value.
4143
+ * @param opt_clear Optional flag to clear filters on the field.
4144
+ * @returns The updated search request.
4115
4145
  */
4116
4146
  function addFilter(definition, field, op, value, opt_clear) {
4117
4147
  if (opt_clear) {
@@ -4126,8 +4156,9 @@
4126
4156
  }
4127
4157
  /**
4128
4158
  * Adds a field.
4129
- *
4130
- * @param {string} field The field key name.
4159
+ * @param definition The original search request.
4160
+ * @param field The field key name.
4161
+ * @returns The updated search request.
4131
4162
  */
4132
4163
  function addField(definition, field) {
4133
4164
  if (definition.fields && definition.fields.includes(field)) {
@@ -4146,8 +4177,9 @@
4146
4177
  }
4147
4178
  /**
4148
4179
  * Deletes a filter at the specified index.
4149
- *
4150
- * @param {number} index The filter index.
4180
+ * @param definition The original search request.
4181
+ * @param index The filter index.
4182
+ * @returns The updated search request.
4151
4183
  */
4152
4184
  function deleteFilter(definition, index) {
4153
4185
  if (!definition.filters) {
@@ -4163,24 +4195,27 @@
4163
4195
  }
4164
4196
  /**
4165
4197
  * Adds a filter that constrains the specified field to "yesterday".
4166
- *
4167
- * @param {string} field The field key name.
4198
+ * @param definition The original search request.
4199
+ * @param field The field key name.
4200
+ * @returns The updated search request.
4168
4201
  */
4169
4202
  function addYesterdayFilter(definition, field) {
4170
4203
  return addDayFilter(definition, field, -1);
4171
4204
  }
4172
4205
  /**
4173
4206
  * Adds a filter that constrains the specified field to "today".
4174
- *
4175
- * @param {string} field The field key name.
4207
+ * @param definition The original search request.
4208
+ * @param field The field key name.
4209
+ * @returns The updated search request.
4176
4210
  */
4177
4211
  function addTodayFilter(definition, field) {
4178
4212
  return addDayFilter(definition, field, 0);
4179
4213
  }
4180
4214
  /**
4181
4215
  * Adds a filter that constrains the specified field to "tomorrow".
4182
- *
4183
- * @param {string} field The field key name.
4216
+ * @param definition The original search request.
4217
+ * @param field The field key name.
4218
+ * @returns The updated search request.
4184
4219
  */
4185
4220
  function addTomorrowFilter(definition, field) {
4186
4221
  return addDayFilter(definition, field, 1);
@@ -4191,9 +4226,10 @@
4191
4226
  * "Today" would be 0.
4192
4227
  * "Yesterday" would be -1.
4193
4228
  * "Tomorrow" would be 1.
4194
- *
4195
- * @param {string} field The field key name.
4196
- * @param {number} delta The number of days from this day.
4229
+ * @param definition The original search request.
4230
+ * @param field The field key name.
4231
+ * @param delta The number of days from this day.
4232
+ * @returns The updated search request.
4197
4233
  */
4198
4234
  function addDayFilter(definition, field, delta) {
4199
4235
  const startTime = new Date();
@@ -4206,24 +4242,27 @@
4206
4242
  }
4207
4243
  /**
4208
4244
  * Adds a filter that constrains the specified field to "last month".
4209
- *
4210
- * @param {string} field The field key name.
4245
+ * @param definition The original search request.
4246
+ * @param field The field key name.
4247
+ * @returns The updated search request.
4211
4248
  */
4212
4249
  function addLastMonthFilter(definition, field) {
4213
4250
  return addMonthFilter(definition, field, -1);
4214
4251
  }
4215
4252
  /**
4216
4253
  * Adds a filter that constrains the specified field to "this month".
4217
- *
4218
- * @param {string} field The field key name.
4254
+ * @param definition The original search request.
4255
+ * @param field The field key name.
4256
+ * @returns The updated search request.
4219
4257
  */
4220
4258
  function addThisMonthFilter(definition, field) {
4221
4259
  return addMonthFilter(definition, field, 0);
4222
4260
  }
4223
4261
  /**
4224
4262
  * Adds a filter that constrains the specified field to "next month".
4225
- *
4226
- * @param {string} field The field key name.
4263
+ * @param definition The original search request.
4264
+ * @param field The field key name.
4265
+ * @returns The updated search request.
4227
4266
  */
4228
4267
  function addNextMonthFilter(definition, field) {
4229
4268
  return addMonthFilter(definition, field, 1);
@@ -4234,9 +4273,10 @@
4234
4273
  * "This month" would be 0.
4235
4274
  * "Last month" would be -1.
4236
4275
  * "Next month" would be 1.
4237
- *
4238
- * @param {string} field The field key name.
4239
- * @param {number} delta The number of months from this month.
4276
+ * @param definition The original search request.
4277
+ * @param field The field key name.
4278
+ * @param delta The number of months from this month.
4279
+ * @returns The updated search request.
4240
4280
  */
4241
4281
  function addMonthFilter(definition, field, delta) {
4242
4282
  const startTime = new Date();
@@ -4252,8 +4292,9 @@
4252
4292
  }
4253
4293
  /**
4254
4294
  * Adds a filter that constrains the specified field to the year to date.
4255
- *
4256
- * @param {string} field The field key name.
4295
+ * @param definition The original search request.
4296
+ * @param field The field key name.
4297
+ * @returns The updated search request.
4257
4298
  */
4258
4299
  function addYearToDateFilter(definition, field) {
4259
4300
  const startTime = new Date();
@@ -4265,10 +4306,11 @@
4265
4306
  }
4266
4307
  /**
4267
4308
  * Adds a filter for a date between two dates (inclusive of both dates).
4268
- *
4269
- * @param {string} field The field key name.
4270
- * @param {Date} d1 The start date.
4271
- * @param {Date} d2 The end date.
4309
+ * @param definition The original search request.
4310
+ * @param field The field key name.
4311
+ * @param d1 The start date.
4312
+ * @param d2 The end date.
4313
+ * @returns The updated search request.
4272
4314
  */
4273
4315
  function addDateFilterBetween(definition, field, d1, d2) {
4274
4316
  definition = clearFiltersOnField(definition, field);
@@ -4278,26 +4320,30 @@
4278
4320
  }
4279
4321
  /**
4280
4322
  * Adds a filter for a date before a certain date/time.
4281
- *
4282
- * @param {string} field The field key name.
4283
- * @param {Operator} op The date/time operation.
4284
- * @param {Date} value The date.
4323
+ * @param definition The original search request.
4324
+ * @param field The field key name.
4325
+ * @param op The date/time operation.
4326
+ * @param value The date.
4327
+ * @returns The updated search request.
4285
4328
  */
4286
4329
  function addDateFilterImpl(definition, field, op, value) {
4287
4330
  return addFilter(definition, field, op, value.toISOString());
4288
4331
  }
4289
4332
  /**
4290
4333
  * Adds a filter that constrains the specified field to "missing".
4291
- *
4292
- * @param {string} field The field key name.
4334
+ * @param definition The original search request.
4335
+ * @param field The field key name.
4336
+ * @param value Optional boolean value. Default is true.
4337
+ * @returns The updated search request.
4293
4338
  */
4294
4339
  function addMissingFilter(definition, field, value = true) {
4295
4340
  return addFilter(definition, field, core.Operator.MISSING, value.toString());
4296
4341
  }
4297
4342
  /**
4298
4343
  * Sets the offset (starting at zero).
4299
- *
4300
- * @param {number} offset The offset number.
4344
+ * @param definition The original search request.
4345
+ * @param offset The offset number.
4346
+ * @returns The updated search request.
4301
4347
  */
4302
4348
  function setOffset(definition, offset) {
4303
4349
  if (definition.offset === offset) {
@@ -4313,7 +4359,7 @@
4313
4359
  * Creates a new search request with the search offset at the specified page.
4314
4360
  * @param definition The search definition.
4315
4361
  * @param page The new page number
4316
- * @return The new search definition.
4362
+ * @returns The new search definition.
4317
4363
  */
4318
4364
  function setPage(definition, page) {
4319
4365
  const count = definition.count ?? core.DEFAULT_SEARCH_COUNT;
@@ -4323,8 +4369,10 @@
4323
4369
  /**
4324
4370
  * Sorts the search by the specified key, and optional direction.
4325
4371
  * Direction defaults to ascending ('asc') if not specified.
4326
- *
4327
- * @param {string} sortField The sort key.
4372
+ * @param definition The original search request.
4373
+ * @param sort The sort key.
4374
+ * @param desc Optional descending flag. Default is false.
4375
+ * @returns The updated search request.
4328
4376
  */
4329
4377
  function setSort(definition, sort, desc) {
4330
4378
  if (sort === getSortField(definition) && desc !== undefined && desc === isSortDescending(definition)) {
@@ -4345,8 +4393,9 @@
4345
4393
  * Toggles the sort of the search by key.
4346
4394
  * If the search is already sorted by the key, reverses the direction.
4347
4395
  * If the search is not sorted by the key, sort in ascending order.
4348
- *
4349
- * @param {string} key The field key name.
4396
+ * @param definition The original search request.
4397
+ * @param key The field key name.
4398
+ * @returns The updated search request.
4350
4399
  */
4351
4400
  function toggleSort(definition, key) {
4352
4401
  let desc = false;
@@ -4380,9 +4429,8 @@
4380
4429
  }
4381
4430
  /**
4382
4431
  * Returns a string representing the operation.
4383
- *
4384
- * @param {string} op The operation code.
4385
- * @return {string} A display string for the operation.
4432
+ * @param op The operation code.
4433
+ * @returns A display string for the operation.
4386
4434
  */
4387
4435
  function getOpString(op) {
4388
4436
  return operatorNames[op] ?? '';
@@ -4422,7 +4470,7 @@
4422
4470
  /**
4423
4471
  * Returns a fragment to be displayed in the search table for the value.
4424
4472
  * @param resource The parent resource.
4425
- * @param key The search code or FHIRPath expression.
4473
+ * @param field The search code or FHIRPath expression.
4426
4474
  * @returns The fragment to display.
4427
4475
  */
4428
4476
  function renderValue(resource, field) {
@@ -4491,8 +4539,7 @@
4491
4539
  /**
4492
4540
  * Handles a key down event on the "available" field.
4493
4541
  * If the user presses enter, it is a shortcut for the "Add" button.
4494
- *
4495
- * @param {KeyboardEvent} e The keyboard event.
4542
+ * @param e The keyboard event.
4496
4543
  */
4497
4544
  function handleAvailableKeyDown(e) {
4498
4545
  if (e.key === 'Enter') {
@@ -4509,8 +4556,7 @@
4509
4556
  /**
4510
4557
  * Handles a key down event on the "available" field.
4511
4558
  * If the user presses enter, it is a shortcut for the "Add" button.
4512
- *
4513
- * @param {KeyboardEvent} e The keyboard event.
4559
+ * @param e The keyboard event.
4514
4560
  */
4515
4561
  function handleSelectedKeyDown(e) {
4516
4562
  if (e.key === 'Enter') {
@@ -4597,9 +4643,9 @@
4597
4643
  }
4598
4644
  /**
4599
4645
  * Swaps two fields in the search.
4600
- *
4601
- * @param {number} i The index of the first field.
4602
- * @param {number} j The index of the second field.
4646
+ * @param fields The array of fields.
4647
+ * @param i The index of the first field.
4648
+ * @param j The index of the second field.
4603
4649
  */
4604
4650
  function swapFields(fields, i, j) {
4605
4651
  const temp = fields[i];
@@ -4644,6 +4690,7 @@
4644
4690
  * Returns a list of fields/columns available for a type.
4645
4691
  * The result is the union of properties and search parameters.
4646
4692
  * @param typeSchema The type definition.
4693
+ * @returns A list of fields/columns available for a resource type.
4647
4694
  */
4648
4695
  function getFieldsList(typeSchema) {
4649
4696
  const result = [];
@@ -5094,6 +5141,8 @@
5094
5141
  * The SearchControl component represents the embeddable search table control.
5095
5142
  * It includes the table, rows, headers, sorting, etc.
5096
5143
  * It does not include the field editor, filter editor, pagination buttons.
5144
+ * @param props The SearchControl React props.
5145
+ * @returns The SearchControl React node.
5097
5146
  */
5098
5147
  function SearchControl(props) {
5099
5148
  const { classes } = useStyles$6();
@@ -5113,7 +5162,7 @@
5113
5162
  React.useEffect(() => {
5114
5163
  setOutcome(undefined);
5115
5164
  medplum
5116
- .search(search.resourceType, core.formatSearchQuery({ ...search, total: 'estimate', fields: undefined }))
5165
+ .search(search.resourceType, core.formatSearchQuery({ ...search, total: search.total ?? 'estimate', fields: undefined }))
5117
5166
  .then((response) => {
5118
5167
  setState({ ...stateRef.current, searchResponse: response });
5119
5168
  if (onLoad) {
@@ -5176,7 +5225,6 @@
5176
5225
  }
5177
5226
  /**
5178
5227
  * Handles a click on a order row.
5179
- *
5180
5228
  * @param e The click event.
5181
5229
  * @param resource The FHIR resource.
5182
5230
  */
@@ -5354,6 +5402,8 @@
5354
5402
 
5355
5403
  /**
5356
5404
  * The FhirPathTable component represents the embeddable search table control.
5405
+ * @param props FhirPathTable React props.
5406
+ * @returns FhirPathTable React node.
5357
5407
  */
5358
5408
  function FhirPathTable(props) {
5359
5409
  const medplum = useMedplum();
@@ -5722,7 +5772,8 @@
5722
5772
  * React needs unique IDs for components for rendering performance.
5723
5773
  * All of the important components in the questionnaire builder have id properties for this:
5724
5774
  * Questionnaire, QuestionnaireItem, and QuestionnaireItemAnswerOption.
5725
- * @return A unique key.
5775
+ * @param existing Optional existing id which will update nextId.
5776
+ * @returns A unique key.
5726
5777
  */
5727
5778
  function generateId$1(existing) {
5728
5779
  if (existing) {
@@ -6258,7 +6309,8 @@
6258
6309
  /**
6259
6310
  * Generates a link ID for an item.
6260
6311
  * Link IDs are required properties on QuestionnaireItem objects.
6261
- * @return A unique link ID.
6312
+ * @param prefix The link ID prefix string.
6313
+ * @returns A unique link ID.
6262
6314
  */
6263
6315
  function generateLinkId(prefix) {
6264
6316
  return prefix + nextLinkId++;
@@ -6268,7 +6320,7 @@
6268
6320
  * React needs unique IDs for components for rendering performance.
6269
6321
  * All of the important components in the questionnaire builder have id properties for this:
6270
6322
  * Questionnaire, QuestionnaireItem, and QuestionnaireItemAnswerOption.
6271
- * @return A unique key.
6323
+ * @returns A unique key.
6272
6324
  */
6273
6325
  function generateId() {
6274
6326
  return 'id-' + nextId++;
@@ -6367,6 +6419,8 @@
6367
6419
  }
6368
6420
  /**
6369
6421
  * Add/Remove/Update specific Qualified Intervals
6422
+ * @param groupId The reference range group ID.
6423
+ * @param changedInterval The updated reference range interval.
6370
6424
  */
6371
6425
  function changeInterval(groupId, changedInterval) {
6372
6426
  setIntervalGroups((groups) => {
@@ -6446,7 +6500,9 @@
6446
6500
  React.createElement(IconCirclePlus, null)))));
6447
6501
  }
6448
6502
  /**
6449
- * Render the "filters" section of the IntervalGroup. Also populates some initial
6503
+ * Render the "filters" section of the IntervalGroup.
6504
+ * @param props The ReferenceRangeGroupFilter React props.
6505
+ * @returns The ReferenceRangeGroupFilter React node.
6450
6506
  */
6451
6507
  function ReferenceRangeGroupFilters(props) {
6452
6508
  const { intervalGroup, onChange } = props;
@@ -6510,7 +6566,7 @@
6510
6566
  * Helper function that assigns ids to each qualifiedInterval of an ObservationDefinition
6511
6567
  * @param definition An ObservationDefinition
6512
6568
  * @param setIntervalId React setState function for the intervalId
6513
- * @returns
6569
+ * @returns The updated observation definition.
6514
6570
  */
6515
6571
  function ensureQualifiedIntervalKeys(definition, setIntervalId) {
6516
6572
  const intervals = definition.qualifiedInterval || [];
@@ -6535,7 +6591,10 @@
6535
6591
  }
6536
6592
  /**
6537
6593
  * Group all ObservationDefinitionQualifiedIntervals based on the values of their "filter" properties,
6538
- * so that similar ranges can be grouped together
6594
+ * so that similar ranges can be grouped together.
6595
+ * @param intervals Array of reference range intervals.
6596
+ * @param setGroupId Callback to set the group ID.
6597
+ * @returns The grouped intervals.
6539
6598
  */
6540
6599
  function groupQualifiedIntervals(intervals, setGroupId) {
6541
6600
  let groupId = 1;
@@ -6555,8 +6614,9 @@
6555
6614
  return Object.values(groups);
6556
6615
  }
6557
6616
  /**
6558
- * Generates a unique string for each set of filter values, so that similarly filtered intervals can be grouped together
6559
- * @return A "group key" that corresponds to the value of the interval filter properties.
6617
+ * Generates a unique string for each set of filter values, so that similarly filtered intervals can be grouped together.
6618
+ * @param interval The reference range interval.
6619
+ * @returns A "group key" that corresponds to the value of the interval filter properties.
6560
6620
  */
6561
6621
  function generateGroupKey(interval) {
6562
6622
  const results = [
@@ -7144,6 +7204,7 @@
7144
7204
  /**
7145
7205
  * Dynamically creates a script tag for the specified JavaScript file.
7146
7206
  * @param src The JavaScript file URL.
7207
+ * @param onload Optional callback for the onload event.
7147
7208
  */
7148
7209
  function createScriptTag(src, onload) {
7149
7210
  const head = document.getElementsByTagName('head')[0];
@@ -7484,9 +7545,11 @@
7484
7545
  * 3) Choose profile - If the user has multiple profiles, prompt to choose one
7485
7546
  * 4) Choose scope - If the user has multiple scopes, prompt to choose one
7486
7547
  * 5) Success - Return to the caller with either a code or a redirect
7548
+ * @param props The SignInForm React props.
7549
+ * @returns The SignInForm React node.
7487
7550
  */
7488
7551
  function SignInForm(props) {
7489
- const { chooseScopes, onSuccess, onForgotPassword, onRegister, onCode, ...baseLoginRequest } = props;
7552
+ const { login: loginCode, chooseScopes, onSuccess, onForgotPassword, onRegister, onCode, ...baseLoginRequest } = props;
7490
7553
  const medplum = useMedplum();
7491
7554
  const [login, setLogin] = React.useState(undefined);
7492
7555
  const [mfaRequired, setAuthenticatorRequired] = React.useState(false);
@@ -7527,13 +7590,17 @@
7527
7590
  handleCode(response.code);
7528
7591
  }, [handleCode]);
7529
7592
  React.useEffect(() => {
7530
- if (props.login) {
7593
+ // Beware the race condition here
7594
+ // The `useMedplum` hook will return a new instance of the MedplumClient on login
7595
+ // We do not want to request the login status again in that case
7596
+ // Only request login status once
7597
+ if (loginCode && !login) {
7531
7598
  medplum
7532
- .get('auth/login/' + props.login)
7599
+ .get('auth/login/' + loginCode)
7533
7600
  .then(handleAuthResponse)
7534
7601
  .catch(console.error);
7535
7602
  }
7536
- }, [medplum, props, handleAuthResponse]);
7603
+ }, [medplum, loginCode, login, handleAuthResponse]);
7537
7604
  return (React.createElement(Document, { width: 450 }, (() => {
7538
7605
  if (!login) {
7539
7606
  return (React.createElement(AuthenticationForm, { onForgotPassword: onForgotPassword, onRegister: onRegister, handleAuthResponse: handleAuthResponse, disableGoogleAuth: props.disableGoogleAuth, ...baseLoginRequest }, props.children));