@photonhealth/react 2.0.0-rc.1 → 2.0.0-rc.3

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 (272) hide show
  1. package/README.md +52 -9
  2. package/dist/adapters/tailwind.d.ts.map +1 -1
  3. package/dist/adapters/tailwind.js +7 -4
  4. package/dist/adapters/tailwind.js.map +1 -1
  5. package/dist/analytics/PhotonAnalyticsProvider.d.ts +19 -0
  6. package/dist/analytics/PhotonAnalyticsProvider.d.ts.map +1 -0
  7. package/dist/analytics/PhotonAnalyticsProvider.js +76 -0
  8. package/dist/analytics/PhotonAnalyticsProvider.js.map +1 -0
  9. package/dist/analytics/cardLifecycle.d.ts +10 -0
  10. package/dist/analytics/cardLifecycle.d.ts.map +1 -0
  11. package/dist/analytics/cardLifecycle.js +43 -0
  12. package/dist/analytics/cardLifecycle.js.map +1 -0
  13. package/dist/analytics/fieldInteraction.d.ts +18 -0
  14. package/dist/analytics/fieldInteraction.d.ts.map +1 -0
  15. package/dist/analytics/fieldInteraction.js +102 -0
  16. package/dist/analytics/fieldInteraction.js.map +1 -0
  17. package/dist/analytics/lifecycleOutcomes.d.ts +8 -0
  18. package/dist/analytics/lifecycleOutcomes.d.ts.map +1 -0
  19. package/dist/analytics/lifecycleOutcomes.js +16 -0
  20. package/dist/analytics/lifecycleOutcomes.js.map +1 -0
  21. package/dist/analytics/tracker.d.ts +19 -0
  22. package/dist/analytics/tracker.d.ts.map +1 -0
  23. package/dist/analytics/tracker.js +41 -0
  24. package/dist/analytics/tracker.js.map +1 -0
  25. package/dist/analytics/viewed.d.ts +11 -0
  26. package/dist/analytics/viewed.d.ts.map +1 -0
  27. package/dist/analytics/viewed.js +16 -0
  28. package/dist/analytics/viewed.js.map +1 -0
  29. package/dist/components/PhotonOrder.d.ts +18 -18
  30. package/dist/components/PhotonOrder.d.ts.map +1 -1
  31. package/dist/components/PhotonOrder.js +34 -19
  32. package/dist/components/PhotonOrder.js.map +1 -1
  33. package/dist/components/PhotonPatient.d.ts +7 -35
  34. package/dist/components/PhotonPatient.d.ts.map +1 -1
  35. package/dist/components/PhotonPatient.js +6 -78
  36. package/dist/components/PhotonPatient.js.map +1 -1
  37. package/dist/components/PhotonPrescription.d.ts +15 -26
  38. package/dist/components/PhotonPrescription.d.ts.map +1 -1
  39. package/dist/components/PhotonPrescription.js +6 -360
  40. package/dist/components/PhotonPrescription.js.map +1 -1
  41. package/dist/components/format.d.ts +2 -2
  42. package/dist/components/format.js +2 -2
  43. package/dist/components/index.d.ts +1 -1
  44. package/dist/components/index.d.ts.map +1 -1
  45. package/dist/components/index.js +1 -1
  46. package/dist/components/index.js.map +1 -1
  47. package/dist/components/open.d.ts +11 -13
  48. package/dist/components/open.d.ts.map +1 -1
  49. package/dist/components/open.js +7 -2
  50. package/dist/components/open.js.map +1 -1
  51. package/dist/components/order/DraftOrderPrompt.d.ts +18 -0
  52. package/dist/components/order/DraftOrderPrompt.d.ts.map +1 -0
  53. package/dist/components/order/DraftOrderPrompt.js +26 -0
  54. package/dist/components/order/DraftOrderPrompt.js.map +1 -0
  55. package/dist/components/patient/PatientCard/PatientCard.d.ts +30 -0
  56. package/dist/components/patient/PatientCard/PatientCard.d.ts.map +1 -0
  57. package/dist/components/patient/PatientCard/PatientCard.js +101 -0
  58. package/dist/components/patient/PatientCard/PatientCard.js.map +1 -0
  59. package/dist/components/patient/PatientCard/usePatientToShow.d.ts +22 -0
  60. package/dist/components/patient/PatientCard/usePatientToShow.d.ts.map +1 -0
  61. package/dist/components/patient/PatientCard/usePatientToShow.js +40 -0
  62. package/dist/components/patient/PatientCard/usePatientToShow.js.map +1 -0
  63. package/dist/components/patient/PatientIntakeForm.d.ts +16 -0
  64. package/dist/components/patient/PatientIntakeForm.d.ts.map +1 -0
  65. package/dist/components/patient/PatientIntakeForm.js +114 -0
  66. package/dist/components/patient/PatientIntakeForm.js.map +1 -0
  67. package/dist/components/patient/PatientSearch.d.ts +12 -0
  68. package/dist/components/patient/PatientSearch.d.ts.map +1 -0
  69. package/dist/components/patient/PatientSearch.js +148 -0
  70. package/dist/components/patient/PatientSearch.js.map +1 -0
  71. package/dist/components/patient/{Benefits.d.ts → PatientSummary/BenefitsInputForm.d.ts} +2 -2
  72. package/dist/components/patient/PatientSummary/BenefitsInputForm.d.ts.map +1 -0
  73. package/dist/components/patient/{Benefits.js → PatientSummary/BenefitsInputForm.js} +6 -5
  74. package/dist/components/patient/PatientSummary/BenefitsInputForm.js.map +1 -0
  75. package/dist/components/patient/{Clinical.d.ts → PatientSummary/ClinicalInputForm.d.ts} +15 -16
  76. package/dist/components/patient/PatientSummary/ClinicalInputForm.d.ts.map +1 -0
  77. package/dist/components/patient/{Clinical.js → PatientSummary/ClinicalInputForm.js} +29 -28
  78. package/dist/components/patient/PatientSummary/ClinicalInputForm.js.map +1 -0
  79. package/dist/components/patient/PatientSummary/CollapsedSummary.d.ts +5 -0
  80. package/dist/components/patient/PatientSummary/CollapsedSummary.d.ts.map +1 -0
  81. package/dist/components/patient/PatientSummary/CollapsedSummary.js +30 -0
  82. package/dist/components/patient/PatientSummary/CollapsedSummary.js.map +1 -0
  83. package/dist/components/patient/PatientSummary/PatientDetailsForm.d.ts +10 -0
  84. package/dist/components/patient/PatientSummary/PatientDetailsForm.d.ts.map +1 -0
  85. package/dist/components/patient/PatientSummary/PatientDetailsForm.js +65 -0
  86. package/dist/components/patient/PatientSummary/PatientDetailsForm.js.map +1 -0
  87. package/dist/components/patient/PatientSummary/PatientDetailsSchema.d.ts +53 -0
  88. package/dist/components/patient/PatientSummary/PatientDetailsSchema.d.ts.map +1 -0
  89. package/dist/components/patient/PatientSummary/PatientDetailsSchema.js +78 -0
  90. package/dist/components/patient/PatientSummary/PatientDetailsSchema.js.map +1 -0
  91. package/dist/components/patient/PatientSummary/PatientSummary.d.ts +46 -0
  92. package/dist/components/patient/PatientSummary/PatientSummary.d.ts.map +1 -0
  93. package/dist/components/patient/PatientSummary/PatientSummary.js +57 -0
  94. package/dist/components/patient/PatientSummary/PatientSummary.js.map +1 -0
  95. package/dist/components/patient/PatientSummary/SummaryHeader.d.ts +19 -0
  96. package/dist/components/patient/PatientSummary/SummaryHeader.d.ts.map +1 -0
  97. package/dist/components/patient/PatientSummary/SummaryHeader.js +22 -0
  98. package/dist/components/patient/PatientSummary/SummaryHeader.js.map +1 -0
  99. package/dist/components/patient/fields.d.ts +7 -26
  100. package/dist/components/patient/fields.d.ts.map +1 -1
  101. package/dist/components/patient/fields.js +11 -52
  102. package/dist/components/patient/fields.js.map +1 -1
  103. package/dist/components/patient/parsePatientSearchQuery.d.ts +16 -0
  104. package/dist/components/patient/parsePatientSearchQuery.d.ts.map +1 -0
  105. package/dist/components/patient/{query.js → parsePatientSearchQuery.js} +3 -10
  106. package/dist/components/patient/parsePatientSearchQuery.js.map +1 -0
  107. package/dist/components/prescription/PrescriptionCard.d.ts +51 -0
  108. package/dist/components/prescription/PrescriptionCard.d.ts.map +1 -0
  109. package/dist/components/prescription/PrescriptionCard.js +186 -0
  110. package/dist/components/prescription/PrescriptionCard.js.map +1 -0
  111. package/dist/components/prescription/PrescriptionDetailsForm/DirectionsInput.d.ts +15 -0
  112. package/dist/components/prescription/PrescriptionDetailsForm/DirectionsInput.d.ts.map +1 -0
  113. package/dist/components/prescription/PrescriptionDetailsForm/DirectionsInput.js +18 -0
  114. package/dist/components/prescription/PrescriptionDetailsForm/DirectionsInput.js.map +1 -0
  115. package/dist/components/prescription/PrescriptionDetailsForm/DispenseInputs.d.ts +23 -0
  116. package/dist/components/prescription/PrescriptionDetailsForm/DispenseInputs.d.ts.map +1 -0
  117. package/dist/components/prescription/PrescriptionDetailsForm/DispenseInputs.js +42 -0
  118. package/dist/components/prescription/PrescriptionDetailsForm/DispenseInputs.js.map +1 -0
  119. package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.d.ts +27 -0
  120. package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.d.ts.map +1 -0
  121. package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.js +169 -0
  122. package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.js.map +1 -0
  123. package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.d.ts +8 -0
  124. package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.d.ts.map +1 -0
  125. package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.js +12 -0
  126. package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.js.map +1 -0
  127. package/dist/components/prescription/PrescriptionDetailsForm/TemplatePicker.d.ts +11 -0
  128. package/dist/components/prescription/PrescriptionDetailsForm/TemplatePicker.d.ts.map +1 -0
  129. package/dist/components/prescription/PrescriptionDetailsForm/TemplatePicker.js +25 -0
  130. package/dist/components/prescription/PrescriptionDetailsForm/TemplatePicker.js.map +1 -0
  131. package/dist/components/prescription/TreatmentSearch/TreatmentPicker.d.ts +50 -0
  132. package/dist/components/prescription/TreatmentSearch/TreatmentPicker.d.ts.map +1 -0
  133. package/dist/components/{TreatmentPicker.js → prescription/TreatmentSearch/TreatmentPicker.js} +113 -105
  134. package/dist/components/prescription/TreatmentSearch/TreatmentPicker.js.map +1 -0
  135. package/dist/components/prescription/TreatmentSearch/TreatmentSearch.d.ts +28 -0
  136. package/dist/components/prescription/TreatmentSearch/TreatmentSearch.d.ts.map +1 -0
  137. package/dist/components/prescription/TreatmentSearch/TreatmentSearch.js +146 -0
  138. package/dist/components/prescription/TreatmentSearch/TreatmentSearch.js.map +1 -0
  139. package/dist/components/schemaErrors.d.ts +13 -0
  140. package/dist/components/schemaErrors.d.ts.map +1 -0
  141. package/dist/components/schemaErrors.js +25 -0
  142. package/dist/components/schemaErrors.js.map +1 -0
  143. package/dist/components/search.d.ts +1 -1
  144. package/dist/components/search.js +1 -1
  145. package/dist/index.d.ts +2 -0
  146. package/dist/index.d.ts.map +1 -1
  147. package/dist/index.js +1 -0
  148. package/dist/index.js.map +1 -1
  149. package/dist/meta/version.d.ts +5 -0
  150. package/dist/meta/version.d.ts.map +1 -0
  151. package/dist/meta/version.js +5 -0
  152. package/dist/meta/version.js.map +1 -0
  153. package/dist/primitives/PhotonProvider.d.ts +3 -1
  154. package/dist/primitives/PhotonProvider.d.ts.map +1 -1
  155. package/dist/primitives/PhotonProvider.js +23 -11
  156. package/dist/primitives/PhotonProvider.js.map +1 -1
  157. package/dist/primitives/defaults.d.ts.map +1 -1
  158. package/dist/primitives/defaults.js +6 -3
  159. package/dist/primitives/defaults.js.map +1 -1
  160. package/dist/primitives/photonContext.d.ts +3 -0
  161. package/dist/primitives/photonContext.d.ts.map +1 -0
  162. package/dist/primitives/photonContext.js +3 -0
  163. package/dist/primitives/photonContext.js.map +1 -0
  164. package/dist/primitives/types.d.ts +15 -3
  165. package/dist/primitives/types.d.ts.map +1 -1
  166. package/dist/primitives/types.js.map +1 -1
  167. package/dist/primitives/useProvidedPhoton.d.ts +8 -0
  168. package/dist/primitives/useProvidedPhoton.d.ts.map +1 -0
  169. package/dist/primitives/useProvidedPhoton.js +8 -0
  170. package/dist/primitives/useProvidedPhoton.js.map +1 -0
  171. package/dist/styles.css +45 -3
  172. package/dist/test-utils/contract.d.ts.map +1 -1
  173. package/dist/test-utils/contract.js +23 -2
  174. package/dist/test-utils/contract.js.map +1 -1
  175. package/package.json +8 -3
  176. package/src/adapters/tailwind.tsx +52 -24
  177. package/src/analytics/PhotonAnalyticsProvider.test.tsx +190 -0
  178. package/src/analytics/PhotonAnalyticsProvider.tsx +151 -0
  179. package/src/analytics/cardLifecycle.test.tsx +272 -0
  180. package/src/analytics/cardLifecycle.ts +44 -0
  181. package/src/analytics/fieldInteraction.test.tsx +186 -0
  182. package/src/analytics/fieldInteraction.tsx +148 -0
  183. package/src/analytics/lifecycleOutcomes.test.ts +78 -0
  184. package/src/analytics/lifecycleOutcomes.ts +29 -0
  185. package/src/analytics/tracker.test.ts +52 -0
  186. package/src/analytics/tracker.ts +49 -0
  187. package/src/analytics/usePhotonAnalytics.test.tsx +106 -0
  188. package/src/analytics/viewed.ts +27 -0
  189. package/src/components/PhotonOrder.test.tsx +394 -0
  190. package/src/components/PhotonOrder.tsx +79 -53
  191. package/src/components/PhotonPatient.tsx +15 -166
  192. package/src/components/PhotonPrescription.test.tsx +120 -0
  193. package/src/components/PhotonPrescription.tsx +23 -583
  194. package/src/components/ScreeningAlerts.test.tsx +81 -0
  195. package/src/components/format.ts +2 -2
  196. package/src/components/index.ts +1 -1
  197. package/src/components/open.ts +13 -16
  198. package/src/components/order/DraftOrderPrompt.test.tsx +77 -0
  199. package/src/components/order/DraftOrderPrompt.tsx +81 -0
  200. package/src/components/patient/PatientCard/PatientCard.test.tsx +255 -0
  201. package/src/components/patient/PatientCard/PatientCard.tsx +177 -0
  202. package/src/components/patient/PatientCard/usePatientToShow.ts +44 -0
  203. package/src/components/patient/PatientIntakeForm.test.tsx +262 -0
  204. package/src/components/patient/PatientIntakeForm.tsx +222 -0
  205. package/src/components/patient/PatientSearch.test.tsx +204 -0
  206. package/src/components/patient/PatientSearch.tsx +221 -0
  207. package/src/components/patient/PatientSummary/BenefitsInputForm.test.tsx +164 -0
  208. package/src/components/patient/{Benefits.tsx → PatientSummary/BenefitsInputForm.tsx} +24 -16
  209. package/src/components/patient/PatientSummary/ClinicalInputForm.test.tsx +247 -0
  210. package/src/components/patient/{Clinical.tsx → PatientSummary/ClinicalInputForm.tsx} +53 -48
  211. package/src/components/patient/PatientSummary/CollapsedSummary.test.tsx +90 -0
  212. package/src/components/patient/PatientSummary/CollapsedSummary.tsx +46 -0
  213. package/src/components/patient/PatientSummary/PatientDetailsForm.test.tsx +201 -0
  214. package/src/components/patient/PatientSummary/PatientDetailsForm.tsx +320 -0
  215. package/src/components/patient/PatientSummary/PatientDetailsSchema.test.ts +296 -0
  216. package/src/components/patient/PatientSummary/PatientDetailsSchema.ts +95 -0
  217. package/src/components/patient/PatientSummary/PatientSummary.test.tsx +194 -0
  218. package/src/components/patient/PatientSummary/PatientSummary.tsx +225 -0
  219. package/src/components/patient/PatientSummary/SummaryHeader.test.tsx +183 -0
  220. package/src/components/patient/PatientSummary/SummaryHeader.tsx +85 -0
  221. package/src/components/patient/fields.tsx +12 -124
  222. package/src/components/patient/parsePatientSearchQuery.test.ts +107 -0
  223. package/src/components/patient/{query.ts → parsePatientSearchQuery.ts} +4 -15
  224. package/src/components/prescription/PrescriptionCard.test.tsx +247 -0
  225. package/src/components/prescription/PrescriptionCard.tsx +361 -0
  226. package/src/components/prescription/PrescriptionDetailsForm/DirectionsInput.test.tsx +82 -0
  227. package/src/components/prescription/PrescriptionDetailsForm/DirectionsInput.tsx +41 -0
  228. package/src/components/prescription/PrescriptionDetailsForm/DispenseInputs.test.tsx +206 -0
  229. package/src/components/prescription/PrescriptionDetailsForm/DispenseInputs.tsx +99 -0
  230. package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.test.tsx +453 -0
  231. package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.tsx +238 -0
  232. package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.test.ts +63 -0
  233. package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.ts +15 -0
  234. package/src/components/prescription/PrescriptionDetailsForm/TemplatePicker.test.tsx +72 -0
  235. package/src/components/prescription/PrescriptionDetailsForm/TemplatePicker.tsx +41 -0
  236. package/src/components/prescription/TreatmentSearch/TreatmentPicker.tsx +375 -0
  237. package/src/components/prescription/TreatmentSearch/TreatmentSearch.test.tsx +695 -0
  238. package/src/components/prescription/TreatmentSearch/TreatmentSearch.tsx +220 -0
  239. package/src/components/schemaErrors.test.ts +49 -0
  240. package/src/components/schemaErrors.ts +34 -0
  241. package/src/components/search.tsx +1 -1
  242. package/src/index.ts +2 -0
  243. package/src/meta/version.test.ts +11 -0
  244. package/src/meta/version.ts +4 -0
  245. package/src/primitives/PhotonProvider.tsx +30 -15
  246. package/src/primitives/defaults.tsx +44 -21
  247. package/src/primitives/photonContext.ts +4 -0
  248. package/src/primitives/types.ts +15 -3
  249. package/src/primitives/useProvidedPhoton.ts +21 -0
  250. package/src/styles.css +45 -3
  251. package/src/test-utils/contract.tsx +45 -2
  252. package/dist/components/TreatmentPicker.d.ts +0 -45
  253. package/dist/components/TreatmentPicker.d.ts.map +0 -1
  254. package/dist/components/TreatmentPicker.js.map +0 -1
  255. package/dist/components/patient/Benefits.d.ts.map +0 -1
  256. package/dist/components/patient/Benefits.js.map +0 -1
  257. package/dist/components/patient/Clinical.d.ts.map +0 -1
  258. package/dist/components/patient/Clinical.js.map +0 -1
  259. package/dist/components/patient/IntakeForm.d.ts +0 -10
  260. package/dist/components/patient/IntakeForm.d.ts.map +0 -1
  261. package/dist/components/patient/IntakeForm.js +0 -324
  262. package/dist/components/patient/IntakeForm.js.map +0 -1
  263. package/dist/components/patient/Summary.d.ts +0 -48
  264. package/dist/components/patient/Summary.d.ts.map +0 -1
  265. package/dist/components/patient/Summary.js +0 -80
  266. package/dist/components/patient/Summary.js.map +0 -1
  267. package/dist/components/patient/query.d.ts +0 -23
  268. package/dist/components/patient/query.d.ts.map +0 -1
  269. package/dist/components/patient/query.js.map +0 -1
  270. package/src/components/TreatmentPicker.tsx +0 -350
  271. package/src/components/patient/IntakeForm.tsx +0 -532
  272. package/src/components/patient/Summary.tsx +0 -310
package/src/styles.css CHANGED
@@ -182,6 +182,31 @@
182
182
  position: relative;
183
183
  display: block;
184
184
  }
185
+ /* The field's ×: where the spinner goes, the text kept clear of it. */
186
+ :where(.prx-input[data-clearable]) {
187
+ padding-right: 2.2em;
188
+ }
189
+ :where(.prx-input-clear) {
190
+ position: absolute;
191
+ right: 0.35em;
192
+ top: 50%;
193
+ transform: translateY(-50%);
194
+ display: grid;
195
+ place-items: center;
196
+ padding: 0.25em;
197
+ font: inherit;
198
+ color: inherit;
199
+ background: none;
200
+ border: 0;
201
+ border-radius: var(--prx-radius, 0.5em);
202
+ cursor: pointer;
203
+ opacity: 0.7;
204
+ }
205
+ :where(.prx-input-clear:hover, .prx-input-clear:focus-visible) {
206
+ opacity: 1;
207
+ outline: 2px solid var(--prx-accent, AccentColor);
208
+ outline-offset: 0;
209
+ }
185
210
  :where(.prx-spinner) {
186
211
  position: absolute;
187
212
  right: 0.65em;
@@ -280,7 +305,7 @@
280
305
  padding: 0.35em;
281
306
  line-height: 0;
282
307
  }
283
- :where(.prx-badge-remove .prx-icon) {
308
+ :where(.prx-badge .prx-icon) {
284
309
  width: 1em;
285
310
  height: 1em;
286
311
  }
@@ -428,6 +453,21 @@
428
453
  align-items: center;
429
454
  gap: 0.6em;
430
455
  }
456
+ /* The open row's heading: a button (it reports its key), drawn as the row's text. */
457
+ :where(button.prx-option-row) {
458
+ font: inherit;
459
+ color: inherit;
460
+ background: none;
461
+ border: 0;
462
+ padding: 0;
463
+ width: 100%;
464
+ text-align: left;
465
+ cursor: pointer;
466
+ }
467
+ :where(button.prx-option-row:focus-visible) {
468
+ outline: 2px solid var(--prx-accent, AccentColor);
469
+ outline-offset: 2px;
470
+ }
431
471
  :where(.prx-option-text) {
432
472
  display: flex;
433
473
  flex-direction: column;
@@ -524,7 +564,9 @@
524
564
  }
525
565
 
526
566
  :where(.prx-badge) {
527
- display: inline-block;
567
+ display: inline-flex;
568
+ align-items: center;
569
+ gap: 0.3em;
528
570
  font-size: 0.8em;
529
571
  padding: 0.1em 0.6em;
530
572
  border-radius: 999px;
@@ -535,7 +577,7 @@
535
577
  color: inherit;
536
578
  background: none;
537
579
  border: 0;
538
- padding: 0 0 0 0.35em;
580
+ padding: 0;
539
581
  cursor: pointer;
540
582
  opacity: 0.7;
541
583
  }
@@ -117,16 +117,56 @@ export function buildingBlocksContract(brands: Brand[]): void {
117
117
  delete (HTMLSelectElement.prototype as { showPicker?: unknown }).showPicker;
118
118
  });
119
119
 
120
+ it("Input with onClear: a × named clearLabel while it has a value — not while it's empty or loading", () => {
121
+ const onClear = vi.fn();
122
+ const { rerender } = render(
123
+ <c.Input
124
+ label="Treatment"
125
+ value="Amoxicillin"
126
+ onChange={() => {}}
127
+ onClear={onClear}
128
+ clearLabel="Clear treatment"
129
+ />,
130
+ );
131
+ fireEvent.click(screen.getByRole("button", { name: "Clear treatment" }));
132
+ expect(onClear).toHaveBeenCalled();
133
+ rerender(
134
+ <c.Input label="Treatment" value="" onChange={() => {}} onClear={onClear} clearLabel="Clear treatment" />,
135
+ );
136
+ expect(screen.queryByRole("button", { name: "Clear treatment" })).toBeNull();
137
+ rerender(
138
+ <c.Input
139
+ label="Treatment"
140
+ value="amox"
141
+ onChange={() => {}}
142
+ onClear={onClear}
143
+ clearLabel="Clear treatment"
144
+ loading
145
+ />,
146
+ );
147
+ expect(screen.queryByRole("button", { name: "Clear treatment" })).toBeNull();
148
+ });
149
+
120
150
  it("Input with loading is marked busy", () => {
121
151
  render(<c.Input label="First name" value="Otto" onChange={() => {}} loading />);
122
152
  expect(screen.getByLabelText("First name").getAttribute("aria-busy")).toBe("true");
123
153
  });
124
154
 
155
+ it("Spinner alone (no label) is still a status", () => {
156
+ render(<c.Spinner />);
157
+ expect(screen.getByRole("status")).toBeTruthy();
158
+ });
159
+
125
160
  it("Spinner says what's happening, as a status", () => {
126
161
  render(<c.Spinner label="Saving…" />);
127
162
  expect(screen.getByRole("status").textContent).toBe("Saving…");
128
163
  });
129
164
 
165
+ it("Card with a label is a region by that name", () => {
166
+ render(<c.Card label="Amoxicillin">body</c.Card>);
167
+ expect(screen.getByRole("region", { name: "Amoxicillin" }).textContent).toBe("body");
168
+ });
169
+
130
170
  it("CardFooter puts `start` before the actions", () => {
131
171
  render(
132
172
  <c.CardFooter start={<span>left</span>}>
@@ -250,7 +290,7 @@ export function buildingBlocksContract(brands: Brand[]): void {
250
290
  expect(within(option).getByText("Last seen 2026").parentElement).not.toBe(name.parentElement);
251
291
  });
252
292
 
253
- it("OptionList: rows are buttons reporting their key; the active row is open (not a button) and shows its details", () => {
293
+ it("OptionList: rows are buttons reporting their key; the active row is open, its heading a button too, and shows its details", () => {
254
294
  const onSelect = vi.fn();
255
295
  const onKeyDown = vi.fn();
256
296
  render(
@@ -269,7 +309,10 @@ export function buildingBlocksContract(brands: Brand[]): void {
269
309
  </c.OptionList>,
270
310
  );
271
311
  expect(screen.getByText("Lisinopril details")).toBeTruthy();
272
- expect(screen.queryByRole("button", { name: /Lisinopril/ })).toBeNull();
312
+ const open = screen.getByRole("button", { name: /Lisinopril/, expanded: true });
313
+ expect(open.contains(screen.getByText("Lisinopril details"))).toBe(false); // the details sit beside it
314
+ fireEvent.click(open);
315
+ expect(onSelect).toHaveBeenCalledWith("a");
273
316
  fireEvent.click(screen.getByRole("button", { name: /Amlodipine/ }));
274
317
  expect(onSelect).toHaveBeenCalledWith("b");
275
318
  fireEvent.click(screen.getByRole("button", { name: "Losartan Potassium Oral Tablet 50 MG" }));
@@ -1,45 +0,0 @@
1
- import type { Change, ChangeOption } from "@photonhealth/client";
2
- import { type SearchHandle } from "./search.tsx";
3
- /**
4
- * The drug search's results (search.tsx): the server's drug choices, grouped the way a prescriber decides —
5
- * drug, then form, then strength (instead of one long list of product names), from the parts each option's
6
- * treatment carries (display.ts). A drug's one form or one strength is said under its name, not offered as
7
- * a chip; more than one, and its row says how many ("2 forms · 3 strengths") and opens to chips for them.
8
- *
9
- * Nothing is picked for the prescriber: no chip starts pressed. A drug with more than one form and strength opens
10
- * to both — every strength it comes in — and they're picked in either order. A pick greys out what doesn't go with
11
- * it in the other group (a form: the strengths it doesn't come in; a strength: the forms that don't come in it);
12
- * picking it again takes it back. A greyed chip can still be picked: it drops the other group's pick, and that's
13
- * the prescriber's to pick again — nothing is chosen for them. The pick that leaves nothing more to pick chooses
14
- * the product: a drug with one product is its row (no chevron); otherwise the second chip — or the first, when it
15
- * settles both (a form with one strength, a strength only one form comes in). While the choice saves (`chosen`),
16
- * the picker stays as it was picked, a spinner on the drug's row where the chevron goes.
17
- *
18
- * One outline at a time — wherever focus is. The first drug starts open, and reads as selected (accent
19
- * outline) only while focus is on the list — that's when the keys below act on it; in its chips, the chip
20
- * focused has the outline. Keys as every search's (1–9 / 0 opens a drug; Option/Alt + the digit from
21
- * Treatment), plus: ↓ ↑ (or J K, or Tab / Shift+Tab — past the last / first, Tab leaves the list) move between
22
- * drugs, Home / End (or g / G) to the first / last, D to the next one; the list is one tab stop, so Tab never goes
23
- * into a drug. Enter on a drug chooses one with one product, else goes to its first chips to pick from (from
24
- * Treatment too); there, Tab moves between chips, F / S to the next form / strength chip, and Enter (or Space)
25
- * picks the one focused; Esc goes back a step — from a chip to its drug, from the drug to Treatment. ← → leave the card (the card flow's: flow.ts).
26
- * A few drugs for what's typed and Treatment puts focus on the first (`focus(true)`): typing carries on there
27
- * until a key acts on the list (search.tsx). `handleRef` is how the Treatment field reaches the list.
28
- */
29
- export interface TreatmentPickerHandle extends SearchHandle {
30
- /** Enter on the open drug: choose it if it's one product, else go to its first chips. */
31
- enter: () => void;
32
- }
33
- export declare function TreatmentPicker({ change, onChoose, busy, chosen, handleRef, onBack, }: {
34
- change: Change;
35
- onChoose?: (option: ChangeOption) => void;
36
- busy?: boolean;
37
- /** The product chosen, while its save runs: shown picked, with a spinner on its row; nothing else can be picked. */
38
- chosen?: ChangeOption | null;
39
- handleRef?: {
40
- current: TreatmentPickerHandle | null;
41
- };
42
- /** Esc in the list: back to the field that searched (Treatment). */
43
- onBack?: () => void;
44
- }): import("react").JSX.Element | null;
45
- //# sourceMappingURL=TreatmentPicker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TreatmentPicker.d.ts","sourceRoot":"","sources":["../../src/components/TreatmentPicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EAAoD,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAGnG;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,yFAAyF;I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,KAAK,CAAC,IAAI,EAAE,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC;oCAAE,OAAO;gCAC7E,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;oCACtB,CAAC,CAAC,cAAc,EAAE,CAAC;oCACnB,GAAG,EAAE,CAAC;gCACR,CAAC;gCACD,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ;oCAAE,KAAK,EAAE,CAAC;4BAClC,CAAC,GACD,CACH,EACA,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAC9C,KAAC,UAAU,IACT,OAAO,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAClG,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,GAC5D,CACH,IACK,GACJ,CACP,IACK,CACT,CAAC;AACJ,CAAC"}
@@ -1,10 +0,0 @@
1
- import { type Patient } from "@photonhealth/client";
2
- export declare function PatientIntakeForm({ patient, notice, }: {
3
- patient: Patient;
4
- /** Why someone else is being found (e.g. the patient given by id isn't there): with the matches, where answers go. */
5
- notice?: {
6
- title: string;
7
- description: string;
8
- } | null;
9
- }): import("react").JSX.Element;
10
- //# sourceMappingURL=IntakeForm.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IntakeForm.d.ts","sourceRoot":"","sources":["../../../src/components/patient/IntakeForm.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA4B,KAAK,OAAO,EAAY,MAAM,sBAAsB,CAAC;AAgBxF,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,MAAM,GACP,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,sHAAsH;IACtH,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACxD,+BA0fA"}
@@ -1,324 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- /** PhotonPatient before a record: the fields a prescriber fills to find or add the patient, and the candidates. */
3
- import { useComponents } from "../../primitives/index.js";
4
- import { asksForAddress, classify } from "@photonhealth/client";
5
- import { useLatestCallback, useLive } from "../../hooks/index.js";
6
- import { useEffect, useId, useRef, useState } from "react";
7
- import { useHeldActivity } from "../activity.js";
8
- import { ChangeList } from "../ChangeList.js";
9
- import { formatDate, formatPhone, PHONE_PATTERN, toE164 } from "../format.js";
10
- import { FEW, searchKeys, SearchResults, useTypeAhead } from "../search.js";
11
- import { noAutofill, SEX_OPTIONS } from "./fields.js";
12
- import { focusProps, searchProps } from "../flow.js";
13
- import { isSearchable, parseQuery, searchBoth } from "./query.js";
14
- const IDENTITY_KEYS = ["demographic.name.first", "demographic.name.last", "demographic.dateOfBirth", "demographic.sex"];
15
- export function PatientIntakeForm({ patient, notice, }) {
16
- const { Alert, Badge, Button, Card, CardBody, CardFooter, CardHeader, Grid, Input, Select, Spinner, Stack } = useComponents();
17
- const snap = useLive(patient);
18
- const formId = useId();
19
- // Starts from what's already been sent — e.g. a host's details the server hasn't matched yet — to edit on.
20
- const known = patient.known;
21
- const [first, setFirst] = useState(known.name?.first ?? "");
22
- const [last, setLast] = useState(known.name?.last ?? "");
23
- const [dob, setDob] = useState(known.dateOfBirth ?? "");
24
- const [sex, setSex] = useState(known.sex ?? null);
25
- const [email, setEmail] = useState(known.email ?? "");
26
- const [phone, setPhone] = useState(known.phone ? formatPhone(known.phone) : "");
27
- const [street1, setStreet1] = useState(known.address?.street1 ?? "");
28
- const [street2, setStreet2] = useState(known.address?.street2 ?? "");
29
- const [city, setCity] = useState(known.address?.city ?? "");
30
- const [state, setState] = useState(known.address?.state ?? "");
31
- const [postalCode, setPostalCode] = useState(known.address?.postalCode ?? "");
32
- /**
33
- * Finding someone and adding them are two different jobs, so the card does one at a time. Searching is
34
- * one field and never writes (`search` goes without `sex`, which is what network-api needs to create).
35
- * "Create a new patient" is the prescriber saying none of these — it opens the form, filled in from what
36
- * they typed. Details handed in that the server hasn't matched start there, as they always did.
37
- */
38
- const [mode, setMode] = useState(() => known.name?.first || known.name?.last || known.dateOfBirth ? "create" : "search");
39
- const [query, setQuery] = useState("");
40
- const creating = mode === "create";
41
- /** What the matches below answer — the query as it was typed when the search went out. */
42
- const [searched, setSearched] = useState(null);
43
- /** The row the keys are on, by DOM id: the field says so with `aria-activedescendant`. */
44
- const [activeId, setActiveId] = useState(null);
45
- /** Which of the four network-api needs were empty when Save was last pressed. */
46
- const [missing, setMissing] = useState([]);
47
- /** What a required field says while Save is waiting on it. The server names all four at once; we don't. */
48
- const gap = (field) => missing.includes(field) ? { invalid: true, errorMessage: "Needed to add a patient" } : {};
49
- const busy = snap.status === "loading" || snap.status === "saving";
50
- const candidates = snap.candidates;
51
- const addressComplete = Boolean(street1.trim() && city.trim() && state.trim() && postalCode.trim());
52
- const asksAddress = asksForAddress(snap.changes, snap.error?.message);
53
- // What the server still needs to add the patient (name, DOB, sex) is what this form asks for next — not an
54
- // error. Once the prescriber has filled all four, anything it still rejects about them is shown.
55
- const identityFilled = Boolean(first.trim() && last.trim() && dob && sex);
56
- const changes = classify({
57
- ...snap.changes,
58
- unapplied: snap.changes.unapplied.filter((c) => identityFilled || !IDENTITY_KEYS.includes(c.key)),
59
- });
60
- /** Everything known on the form. Phone / email ride along once they're valid; the browser shows why otherwise. */
61
- const demographic = (overrides = {}) => {
62
- const chosenSex = overrides.sex !== undefined ? overrides.sex : sex;
63
- const validPhone = new RegExp(`^(?:${PHONE_PATTERN})$`).test(phone.trim());
64
- const validEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email.trim());
65
- return {
66
- name: { first, last },
67
- dateOfBirth: dob,
68
- ...(chosenSex ? { sex: chosenSex } : {}),
69
- ...(validPhone ? { phone: toE164(phone) } : {}),
70
- ...(validEmail ? { email: email.trim() } : {}),
71
- ...(addressComplete
72
- ? {
73
- address: {
74
- street1: street1.trim(),
75
- street2: street2.trim() || undefined,
76
- city: city.trim(),
77
- state: state.trim().toUpperCase(),
78
- postalCode: postalCode.trim(),
79
- country: "US",
80
- },
81
- }
82
- : {}),
83
- };
84
- };
85
- // What the list of matches answers: the form as it was last sent — and whether typing sent it (a search), not
86
- // leaving a field.
87
- const sent = useRef(null);
88
- const typedSearch = useRef(false);
89
- // The field whose change or exit sent the call in flight shows the spinner (held briefly, so it doesn't flicker).
90
- const [sentFrom, setSentFrom] = useState(null);
91
- if (sentFrom && !busy)
92
- setSentFrom(null); // answered
93
- const spinning = useHeldActivity(sentFrom);
94
- /**
95
- * Send everything known — `sync` (a field left: the server may find or add the patient) or `search` (typing:
96
- * it only lists who it might be). The object adds it to what it sent before; the same query isn't sent twice.
97
- */
98
- const send = (from, kind = "sync", overrides = {}) => {
99
- const input = { demographic: demographic(overrides) };
100
- sent.current = JSON.stringify(input.demographic);
101
- typedSearch.current = kind === "search";
102
- void (kind === "sync" ? patient.sync(input) : patient.search(input)).catch(() => { }); // failures land on the object
103
- if (patient.busy)
104
- setSentFrom(from);
105
- };
106
- /**
107
- * The one search field, answered. Only ever `search`: it can't create, and it can't change whoever it
108
- * finds. One word could be either name, so if it draws a blank as a first name it's asked again as a
109
- * last name — "Lovelace" is as likely to be typed as "Ada".
110
- */
111
- const runSearch = useLatestCallback(() => {
112
- const text = query.trim();
113
- const parsed = parseQuery(text);
114
- if (!isSearchable(parsed))
115
- return;
116
- typedSearch.current = true;
117
- setSentFrom("query");
118
- void (async () => {
119
- try {
120
- await patient.search({ demographic: parsed });
121
- const alsoLast = searchBoth(parsed);
122
- if (alsoLast && patient.snapshot.candidates.length === 0)
123
- await patient.search({ demographic: alsoLast });
124
- }
125
- catch {
126
- // failures land on the object
127
- }
128
- setSearched(text);
129
- })();
130
- });
131
- // Two characters: network-api matches "a first/last name prefix of 2+ characters" (`AmbiguousPatientMatch`),
132
- // and short surnames are real — Ng, Wu, Li. Not one: that would match thousands, and the server returns at
133
- // most twenty candidates, so it would hand back an arbitrary slice — a list without your patient in it reads
134
- // as "not here", which is how a duplicate gets made.
135
- const typeAhead = useTypeAhead((field) => (field === "query" ? runSearch() : send(field, "search")), {
136
- minChars: 2,
137
- });
138
- /** A field changed: keep it, and search once typing pauses. */
139
- const type = (field, set) => (e) => {
140
- set(e.target.value);
141
- // Answering what Save asked for puts it right at once: an error about a field you have just filled in
142
- // is the thing this whole screen is meant to stop doing.
143
- if (e.target.value.trim())
144
- setMissing((m) => m.filter((f) => f !== field));
145
- // While adding, there is nobody to look up — the prescriber has already said this is someone new.
146
- if (!creating)
147
- typeAhead.typed(field, e.target.value);
148
- };
149
- // Rows open one at a time, as fields are left: first / last → DOB / sex → phone / email. Once open, a row
150
- // stays open. Fields it started with (a patient given that isn't matched yet) count as left: their rows are open.
151
- const [visited, setVisited] = useState(() => new Set(Object.entries({ first, last, dob, sex, email, phone })
152
- .filter(([, value]) => value)
153
- .map(([field]) => field)));
154
- const visit = (field) => setVisited((v) => (v.has(field) ? v : new Set(v).add(field)));
155
- const bothLeft = (a, b) => visited.has(a) && visited.has(b);
156
- // Searching opened rows one at a time as the server narrowed things down. Adding is a form: it shows
157
- // what it needs, all of it, so the prescriber can see what Save is waiting on.
158
- const rows = creating ? 3 : bothLeft("dob", "sex") ? 3 : bothLeft("first", "last") ? 2 : 1;
159
- // A few matches listed: they're the next thing to look at.
160
- const few = candidates.length > 0 && candidates.length < FEW;
161
- /** The search is answered, and nobody came back. Not the same as nobody being there. */
162
- const answeredNothing = mode === "search" &&
163
- searched !== null &&
164
- searched === query.trim() &&
165
- candidates.length === 0 &&
166
- !busy &&
167
- !typeAhead.waiting();
168
- const matches = useRef(null);
169
- // The field last typed in: Esc in the matches goes back to it.
170
- const lastField = useRef(null);
171
- // Each field is a search field over the matches (searchKeys): Tab goes to the first when a few answer
172
- // what's typed. Otherwise — many matches, none, or the answer not back yet — Tab goes on to narrow them
173
- // down: the field is marked on Tab's keydown, not only on blur, so the next row renders within the same
174
- // keystroke and Tab moves into it instead of skipping ahead.
175
- const onKeys = (e, field) => {
176
- const answered = !typeAhead.waiting() &&
177
- !busy &&
178
- (field === "query" ? searched === query.trim() : sent.current === JSON.stringify(demographic()));
179
- if (searchKeys(e, matches.current, answered))
180
- return;
181
- if (e.key === "Tab" && !e.shiftKey && field !== "query")
182
- visit(field);
183
- };
184
- // A few matches for what's being typed (a search, not a field left), and the prescriber is still in the field:
185
- // focus goes to the first, ready to pick — typing carries on in the field (search.tsx). Once per answer; moving
186
- // there isn't leaving the field.
187
- const moving = useRef(false);
188
- const matchesFor = candidates.map((c) => c.id).join();
189
- const focusedFor = useRef(null);
190
- const focusFew = useLatestCallback(() => {
191
- const field = lastField.current;
192
- const answered = !typeAhead.waiting() &&
193
- !busy &&
194
- (mode === "search" ? searched === query.trim() : sent.current === JSON.stringify(demographic()));
195
- if (!few || !answered || !typedSearch.current || !field || document.activeElement !== field)
196
- return;
197
- if (focusedFor.current === matchesFor)
198
- return;
199
- focusedFor.current = matchesFor;
200
- moving.current = true;
201
- matches.current?.focus(true);
202
- moving.current = false;
203
- });
204
- // Also on `searched`: the matches can land before the card has noted which query they answer, and until
205
- // it has, they aren't an answer to move to.
206
- useEffect(() => focusFew(), [matchesFor, busy, searched, focusFew]);
207
- const leaveField = (field) => {
208
- if (moving.current)
209
- return;
210
- typeAhead.cancel();
211
- if (matches.current?.pointing?.())
212
- return; // a match is being picked: that's what's next
213
- if (!few)
214
- visit(field);
215
- // Adding a patient is its own act: nothing goes to the server until Save. Moving between fields can't
216
- // create anyone, and can't change whoever a half-finished name happens to resemble.
217
- if (!creating)
218
- send(field);
219
- };
220
- const submit = (e) => {
221
- e.preventDefault();
222
- typeAhead.cancel();
223
- if (creating)
224
- return save();
225
- send("address");
226
- };
227
- /**
228
- * Add them. network-api creates a patient only with a first name, a last name, a date of birth and a sex
229
- * (`Sex` has UNKNOWN, so there is always an answer), and the schema says nothing about which of them a
230
- * payload is short of — so the form checks before it sends, rather than Save failing with a rejection
231
- * naming every field at once.
232
- *
233
- * The server still decides what this means: it may find the patient instead of adding them, or come back
234
- * with people it might be. Only this press asks it.
235
- */
236
- const REQUIRED = [
237
- ["first", Boolean(first.trim())],
238
- ["last", Boolean(last.trim())],
239
- ["dob", Boolean(dob)],
240
- ["sex", Boolean(sex)],
241
- ];
242
- const save = () => {
243
- const empty = REQUIRED.filter(([, filled]) => !filled).map(([field]) => field);
244
- setMissing(empty);
245
- if (empty.length)
246
- return; // the fields say which; the cursor goes to the first of them (below)
247
- send("sex");
248
- };
249
- /**
250
- * None of these: add them instead. What was typed is split into the fields, so nothing is retyped and
251
- * the prescriber can see — and correct — how it was read. Sex is the one thing still missing, and the
252
- * one network-api needs to create, so that's where focus goes: the form is filled in and the deliberate
253
- * act is choosing it.
254
- */
255
- const sexField = useRef(null);
256
- const fields = useRef(null);
257
- // Save pressed with gaps: the cursor goes to the first field it is waiting on, so answering starts there.
258
- useEffect(() => {
259
- if (!missing.length)
260
- return;
261
- fields.current?.querySelector('[aria-invalid="true"], [data-invalid]')?.focus();
262
- }, [missing]);
263
- const startCreate = () => {
264
- typeAhead.cancel();
265
- const parsed = parseQuery(query);
266
- setFirst(parsed.name?.first ?? "");
267
- setLast(parsed.name?.last ?? "");
268
- setDob(parsed.dateOfBirth ?? "");
269
- if (parsed.phone)
270
- setPhone(formatPhone(parsed.phone));
271
- if (parsed.email)
272
- setEmail(parsed.email);
273
- setVisited(new Set(["first", "last", "dob", ...(parsed.phone || parsed.email ? ["sex"] : [])]));
274
- setMode("create");
275
- };
276
- // Once the form is up, the cursor goes to Sex (the Select is a building block, so by where it lands).
277
- const landed = useRef(false);
278
- useEffect(() => {
279
- if (!creating || landed.current || !sexField.current)
280
- return;
281
- landed.current = true;
282
- sexField.current.querySelector("input, select, button")?.focus();
283
- }, [creating]);
284
- return (_jsxs(Card, { divided: true, children: [_jsx(CardHeader, { title: "Patient" }), _jsx(CardBody, { children: _jsx("form", { ...noAutofill, ref: fields, id: formId, onSubmit: submit, onFocus: (e) => {
285
- if (e.target instanceof HTMLInputElement)
286
- lastField.current = e.target;
287
- }, children: _jsxs(Stack, { gap: "3", children: [mode === "search" && (_jsx("div", { ...focusProps, ...searchProps, children: _jsx(Input, { label: "Find patient", placeholder: "Name, date of birth, phone or email", value: query, onChange: (e) => {
288
- setQuery(e.target.value);
289
- typeAhead.typed("query", e.target.value);
290
- // Too little left to search on: the matches on screen answer a query that isn't there
291
- // any more, so they go, and the card is back where it started — including what it has
292
- // already moved the cursor to, or typing the same name again would land nowhere.
293
- if (typeAhead.tooShort(e.target.value)) {
294
- setSearched(null);
295
- focusedFor.current = null;
296
- }
297
- }, onBlur: () => {
298
- // Leaving asks now rather than after the pause — a search, never a sync: it can't
299
- // create anyone and it can't change whoever it finds.
300
- typeAhead.cancel();
301
- if (query.trim() !== searched)
302
- runSearch();
303
- }, onKeyDown: (e) => onKeys(e, "query"), loading: spinning === "query", role: "combobox", "aria-expanded": searched !== null, "aria-autocomplete": "list", "aria-activedescendant": activeId ?? undefined, autoFocus: true, ...noAutofill }) })), creating && (_jsxs(Grid, { min: "200px", gap: "3", children: [_jsx("div", { ...focusProps, children: _jsx(Input, { ...gap("first"), label: "First name", value: first, onChange: type("first", setFirst), onBlur: () => leaveField("first"), onKeyDown: (e) => onKeys(e, "first"), loading: spinning === "first", autoFocus: true, ...noAutofill }) }), _jsx(Input, { ...gap("last"), label: "Last name", value: last, onChange: type("last", setLast), onBlur: () => leaveField("last"), onKeyDown: (e) => onKeys(e, "last"), loading: spinning === "last", ...noAutofill }), rows >= 2 && (_jsxs(_Fragment, { children: [_jsx(Input, { ...gap("dob"), label: "Date of birth", type: "date", ...noAutofill, value: dob, onChange: type("dob", setDob), onBlur: () => leaveField("dob"), onKeyDown: (e) => onKeys(e, "dob"), loading: spinning === "dob" }), _jsx("div", { ref: sexField, onBlur: (e) => {
304
- if (!e.currentTarget.contains(e.relatedTarget))
305
- visit("sex");
306
- }, onKeyDown: (e) => onKeys(e, "sex"), children: _jsx(Select, { ...gap("sex"), label: "Sex", placeholder: "Select\u2026", options: SEX_OPTIONS, value: sex, onChange: (next) => {
307
- setSex(next);
308
- visit("sex");
309
- setMissing((m) => m.filter((f) => f !== "sex"));
310
- } }) }), rows >= 3 && (_jsxs(_Fragment, { children: [_jsx(Input, { label: "Phone", helper: "The patient is texted their order link here, so a mobile number.", type: "tel", inputMode: "tel", pattern: PHONE_PATTERN, value: phone, onChange: type("phone", setPhone), onBlur: () => {
311
- setPhone(formatPhone(phone));
312
- leaveField("phone");
313
- }, onKeyDown: (e) => onKeys(e, "phone"), loading: spinning === "phone", ...noAutofill }), _jsx(Input, { label: "Email", type: "email", inputMode: "email", value: email, onChange: type("email", setEmail), onBlur: () => leaveField("email"), onKeyDown: (e) => onKeys(e, "email"), loading: spinning === "email", ...noAutofill })] }))] }))] })), mode === "search" && answeredNothing && (_jsx(Alert, { title: "Spelling has to be exact.", description: "Try another spelling, fewer letters, or a date of birth." })), mode === "search" && searched !== null && (_jsx(SearchResults, { label: candidates.length > 0 ? "Matching patients" : "No matching patients", results: candidates.map((m) => ({
314
- key: m.id,
315
- label: [m.firstName, m.lastName].filter(Boolean).join(" "),
316
- meta: m.dateOfBirth ? formatDate(m.dateOfBirth) : undefined,
317
- })), onPick: (id) => void patient.pick(id).catch(() => { }), busy: busy, handleRef: matches, onBack: () => lastField.current?.focus(),
318
- // The cursor stays in the field: ↑ ↓ move a highlight, Return takes it, and a letter or a
319
- // Backspace always lands in the field — the prescriber can narrow or start over mid-list.
320
- inField: true, onActive: setActiveId,
321
- // The last row: ↓ past the final match lands on it, and Return takes it.
322
- action: { label: "Add new patient", icon: "add", onChoose: startCreate } })), notice && _jsx(Alert, { tone: "critical", title: notice.title, description: notice.description }), _jsx(ChangeList, { changes: changes }), snap.error && !asksForAddress(null, snap.error.message) && (_jsx(Badge, { tone: "critical", children: snap.error.message })), asksAddress && (_jsx("div", { onBlur: () => addressComplete && send("address"), children: _jsxs(Stack, { gap: "2", children: [snap.error && asksForAddress(null, snap.error.message) && (_jsx(Alert, { tone: "warning", title: "Address needed", description: snap.error.message })), _jsxs(Grid, { min: "120px", gap: "3", children: [_jsx(Input, { label: "Street", value: street1, onChange: (e) => setStreet1(e.target.value), ...noAutofill }), _jsx(Input, { label: "Apt / suite", value: street2, onChange: (e) => setStreet2(e.target.value), ...noAutofill })] }), _jsxs(Grid, { min: "120px", gap: "3", children: [_jsx(Input, { label: "City", value: city, onChange: (e) => setCity(e.target.value), ...noAutofill }), _jsx(Input, { label: "State", value: state, onChange: (e) => setState(e.target.value), maxLength: 2, ...noAutofill }), _jsx(Input, { label: "ZIP", value: postalCode, onChange: (e) => setPostalCode(e.target.value), inputMode: "numeric", ...noAutofill })] })] }) }))] }) }) }), creating && (_jsx(CardFooter, { start: busy ? _jsx(Spinner, { label: "Adding\u2026" }) : undefined, children: _jsx(Button, { type: "submit", form: formId, loading: busy, children: "Save patient" }) }))] }));
323
- }
324
- //# sourceMappingURL=IntakeForm.js.map