@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
@@ -0,0 +1,225 @@
1
+ /** PhotonPatient with a record: the summary and its details editor, with the clinical lists and benefits. */
2
+ import { useComponents } from "../../../primitives/index.ts";
3
+ import {
4
+ type ChangeOption,
5
+ type ClassifiedChanges,
6
+ type MedicationStatus,
7
+ type PatientRecord,
8
+ type PhotonError,
9
+ } from "@photonhealth/client";
10
+ import { useState } from "react";
11
+ import { ChangeList } from "../../ChangeList.tsx";
12
+ import { BenefitsInputForm, type BenefitInput } from "./BenefitsInputForm.tsx";
13
+ import {
14
+ choicesIn,
15
+ ClinicalInputForm,
16
+ diagnosisRef,
17
+ sectionOf,
18
+ withoutInline,
19
+ type DiagnosisInput,
20
+ } from "./ClinicalInputForm.tsx";
21
+ import { PatientDetailsForm, type PatientDetailsInput } from "./PatientDetailsForm.tsx";
22
+ import { SummaryHeader } from "./SummaryHeader.tsx";
23
+ import { CollapsedSummary } from "./CollapsedSummary.tsx";
24
+
25
+ export function PatientSummary({
26
+ patient,
27
+ saving,
28
+ changes,
29
+ error,
30
+ onChoose,
31
+ onAddAllergy,
32
+ onConfirmNone,
33
+ onRemoveAllergy,
34
+ onRemoveMedication,
35
+ onAddMedication,
36
+ onAddDiagnosis,
37
+ onRemoveDiagnosis,
38
+ onAddBenefit,
39
+ onRemoveBenefit,
40
+ onConfirmNoBenefits,
41
+ onSaveDetails,
42
+ addressRequest,
43
+ onChangePatient,
44
+ readOnly,
45
+ }: {
46
+ patient: PatientRecord;
47
+ saving: boolean;
48
+ /**
49
+ * The server's changes. Each clinical list shows its own choices (AMBIGUOUS changes) and problems (e.g. a name
50
+ * nothing matches) under its field; the rest show at the bottom of the card.
51
+ */
52
+ changes: ClassifiedChanges;
53
+ /** The last save's failure, if any. */
54
+ error: PhotonError | null;
55
+ onChoose: (option: ChangeOption) => void;
56
+ onAddAllergy: (name: string) => void;
57
+ /** Record "none" for a clinical list (NKDA, no medications, no diagnoses). */
58
+ onConfirmNone: (list: "allergies" | "medications" | "diagnoses") => void;
59
+ onRemoveAllergy: (allergy: { id: string }) => void;
60
+ onRemoveMedication: (medication: { id: string; status: MedicationStatus }) => void;
61
+ onAddMedication: (name: string) => void;
62
+ onAddDiagnosis: (diagnosis: DiagnosisInput) => void;
63
+ onRemoveDiagnosis: (diagnosis: { id: string }) => void;
64
+ onAddBenefit: (benefit: BenefitInput) => void;
65
+ onRemoveBenefit: (benefit: { id: string }) => void;
66
+ onConfirmNoBenefits: () => void;
67
+ /**
68
+ * Send what PatientDetailsForm saved, as one UpdatePatient. Resolves to true once network-api has saved it, or
69
+ * false when the update failed.
70
+ */
71
+ onSaveDetails: (input: PatientDetailsInput) => Promise<boolean>;
72
+ addressRequest: string | null;
73
+ onChangePatient?: () => void;
74
+ /** Read-only (e.g. on a sent order): the summary alone — no editors, no pencil. */
75
+ readOnly?: boolean;
76
+ }) {
77
+ const { Alert, Card, CardBody, Stack } = useComponents();
78
+ const choices = changes.needsChoice;
79
+ const problems = changes.blocking;
80
+ // What the clinical lists don't show under their own fields goes at the bottom of the card.
81
+ const messages = withoutInline(changes);
82
+ const hasMessages =
83
+ messages.needsChoice.length + messages.blocking.length + messages.advisories.length > 0 || Boolean(error);
84
+ // Allergies / medications / diagnoses / insurance are summarized under the header (CollapsedSummary); the
85
+ // pencil opens their lists to add or remove, and they open by themselves when the server asks the prescriber
86
+ // to choose (e.g. which penicillin).
87
+ // A list with something to pick or fix opens by itself, and shows it under its field.
88
+ const clinicalChoices = [...choices, ...problems].filter((c) => sectionOf(c.key));
89
+ // One card, two states. Shut, it says who the patient is; open, it is everything about them that can be
90
+ // changed — the fields they were added with, their contact details, and their clinical lists. Each saves
91
+ // as it is answered (`UpdatePatient` on a record that already exists), so there is nothing to confirm.
92
+ // It also opens itself when a send fails for want of an address, and shuts again once that is answered.
93
+ const [editing, setEditing] = useState(Boolean(addressRequest));
94
+ const [seenRequest, setSeenRequest] = useState(addressRequest);
95
+ if (addressRequest !== seenRequest) {
96
+ setSeenRequest(addressRequest);
97
+ setEditing(Boolean(addressRequest));
98
+ }
99
+ // Each list: null when nothing is recorded, [] when "none" is (core's PatientRecord).
100
+ const recorded = {
101
+ allergies: patient.clinical?.allergies ?? null,
102
+ medications: patient.clinical?.medications ?? null,
103
+ diagnoses: patient.clinical?.diagnoses ?? null,
104
+ benefits: patient.benefits,
105
+ };
106
+ const confirmedNkda = recorded.allergies?.length === 0;
107
+ const allergies = recorded.allergies ?? [];
108
+ const meds = (recorded.medications ?? []).filter((m) => m.status === "ACTIVE");
109
+ const diagnoses = (recorded.diagnoses ?? []).map((x) => ({ ...x, name: x.name ?? x.icd10Code ?? "" }));
110
+ // A choice the server is waiting on (which penicillin?) opens the card too — the answer lives in here.
111
+ const expanded = !readOnly && (editing || clinicalChoices.length > 0);
112
+
113
+ // What the server said (choices, problems, a failed save) goes at the bottom of whichever section is shown.
114
+ const messageList = hasMessages && (
115
+ <>
116
+ <ChangeList changes={messages} onChoose={onChoose} busy={saving} />
117
+ {/* A failed save must never be silent (e.g. a rejected clinical patch). */}
118
+ {error && <Alert tone="critical" title="Couldn't save" description={error.message} />}
119
+ </>
120
+ );
121
+
122
+ return (
123
+ <Card divided>
124
+ <SummaryHeader
125
+ patient={patient}
126
+ expanded={expanded}
127
+ readOnly={readOnly}
128
+ onStartEditing={() => setEditing(true)}
129
+ onCancelEditing={() => setEditing(false)}
130
+ onChangePatient={onChangePatient}
131
+ />
132
+ {!expanded && (
133
+ <CardBody>
134
+ <Stack gap="4">
135
+ <CollapsedSummary patient={patient} />
136
+ {messageList}
137
+ </Stack>
138
+ </CardBody>
139
+ )}
140
+ {expanded && (
141
+ <CardBody>
142
+ <Stack gap="4">
143
+ <PatientDetailsForm
144
+ patient={patient}
145
+ addressRequest={addressRequest}
146
+ // The editors stay open until network-api answers, and stay open with what was typed if it fails.
147
+ onSave={async (input) => {
148
+ const success = await onSaveDetails(input);
149
+ if (success) setEditing(false);
150
+ }}
151
+ />
152
+ </Stack>
153
+ </CardBody>
154
+ )}
155
+ {expanded && (
156
+ <CardBody>
157
+ <Stack gap="4">
158
+ <ClinicalInputForm
159
+ label="Allergies"
160
+ fieldName="allergies"
161
+ choices={choicesIn(choices, "allergies")}
162
+ problems={choicesIn(problems, "allergies")}
163
+ onChoose={onChoose}
164
+ items={allergies}
165
+ tone="warning"
166
+ addLabel="Add allergy"
167
+ noneLabel="No known allergies"
168
+ noneAction="Mark NKDA"
169
+ confirmedNone={confirmedNkda}
170
+ unknownLabel="Unknown allergy"
171
+ saving={saving}
172
+ onAdd={onAddAllergy}
173
+ onRemove={onRemoveAllergy}
174
+ onNone={() => onConfirmNone("allergies")}
175
+ />
176
+ <ClinicalInputForm
177
+ label="Medications"
178
+ fieldName="medications"
179
+ choices={choicesIn(choices, "medications")}
180
+ problems={choicesIn(problems, "medications")}
181
+ onChoose={onChoose}
182
+ items={meds}
183
+ tone="neutral"
184
+ addLabel="Add medication"
185
+ noneLabel="No active meds"
186
+ noneAction="Mark none"
187
+ confirmedNone={recorded.medications?.length === 0}
188
+ onNone={() => onConfirmNone("medications")}
189
+ unknownLabel="Unknown medication"
190
+ saving={saving}
191
+ onAdd={onAddMedication}
192
+ onRemove={onRemoveMedication}
193
+ />
194
+ <ClinicalInputForm
195
+ label="Diagnoses"
196
+ fieldName="diagnoses"
197
+ choices={choicesIn(choices, "diagnoses")}
198
+ problems={choicesIn(problems, "diagnoses")}
199
+ onChoose={onChoose}
200
+ items={diagnoses}
201
+ tone="neutral"
202
+ addLabel="Add diagnosis"
203
+ noneLabel="No diagnoses"
204
+ noneAction="Mark none"
205
+ confirmedNone={recorded.diagnoses?.length === 0}
206
+ onNone={() => onConfirmNone("diagnoses")}
207
+ unknownLabel="Unknown diagnosis"
208
+ saving={saving}
209
+ onAdd={(text) => onAddDiagnosis(diagnosisRef(text))}
210
+ onRemove={onRemoveDiagnosis}
211
+ />
212
+ <BenefitsInputForm
213
+ benefits={recorded.benefits}
214
+ saving={saving}
215
+ onAdd={onAddBenefit}
216
+ onRemove={onRemoveBenefit}
217
+ onNone={onConfirmNoBenefits}
218
+ />
219
+ {messageList}
220
+ </Stack>
221
+ </CardBody>
222
+ )}
223
+ </Card>
224
+ );
225
+ }
@@ -0,0 +1,183 @@
1
+ import { fireEvent, render, screen } from "@testing-library/react";
2
+ import userEvent from "@testing-library/user-event";
3
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
4
+ import { demographicLine, fullName, SummaryHeader } from "./SummaryHeader.tsx";
5
+ import { patientRecord as record } from "../../../../test/patientRecord.fixtures.ts";
6
+
7
+ const renderHeader = (props: Partial<Parameters<typeof SummaryHeader>[0]> = {}) =>
8
+ render(
9
+ <SummaryHeader
10
+ patient={record()}
11
+ expanded={false}
12
+ onStartEditing={() => {}}
13
+ onCancelEditing={() => {}}
14
+ {...props}
15
+ />,
16
+ );
17
+
18
+ /** The sex / age / date of birth line under the patient's name. */
19
+ const line = () => screen.getByRole("heading").nextElementSibling;
20
+
21
+ beforeEach(() => {
22
+ // Ages are counted from today.
23
+ vi.useFakeTimers({ toFake: ["Date"] });
24
+ vi.setSystemTime(new Date(2026, 5, 15));
25
+ });
26
+ afterEach(() => vi.useRealTimers());
27
+
28
+ describe("SummaryHeader", () => {
29
+ it("patient's name: shows it as the card title", () => {
30
+ renderHeader();
31
+ expect(screen.getByRole("heading", { name: "Ada Lovelace" })).toBeInTheDocument();
32
+ });
33
+
34
+ it("sex or date of birth recorded: shows them on the line under the name", () => {
35
+ renderHeader({ patient: record({ demographic: { sex: "FEMALE", dateOfBirth: "1990-01-01" } }) });
36
+ expect(line()).toHaveTextContent("Female · Adult (36) · 1/1/90");
37
+ });
38
+
39
+ it("no sex and no date of birth: shows no line under the name", () => {
40
+ renderHeader();
41
+ expect(line()).toBeNull();
42
+ });
43
+
44
+ describe("buttons", () => {
45
+ it('collapsed: shows "Edit patient" button, not expanded', () => {
46
+ renderHeader();
47
+ expect(screen.getByRole("button", { name: "Edit patient" })).toHaveAttribute("aria-expanded", "false");
48
+ });
49
+
50
+ it('expanded: shows no "Edit patient" button', () => {
51
+ renderHeader({ expanded: true });
52
+ expect(screen.queryByRole("button", { name: "Edit patient" })).not.toBeInTheDocument();
53
+ });
54
+
55
+ it('clicking "Edit patient": calls onStartEditing', async () => {
56
+ const onStartEditing = vi.fn();
57
+ renderHeader({ onStartEditing });
58
+ await userEvent.click(screen.getByRole("button", { name: "Edit patient" }));
59
+ expect(onStartEditing).toHaveBeenCalledOnce();
60
+ });
61
+
62
+ it('readOnly: shows no "Edit patient" button', () => {
63
+ renderHeader({ readOnly: true });
64
+ expect(screen.queryByRole("button", { name: "Edit patient" })).not.toBeInTheDocument();
65
+ });
66
+
67
+ it('onChangePatient passed: clicking "Change patient" calls onChangePatient', async () => {
68
+ const onChangePatient = vi.fn();
69
+ renderHeader({ onChangePatient });
70
+ await userEvent.click(screen.getByRole("button", { name: "Change patient" }));
71
+ expect(onChangePatient).toHaveBeenCalledOnce();
72
+ });
73
+
74
+ it('onChangePatient passed and readOnly: still shows "Change patient" button', () => {
75
+ renderHeader({ onChangePatient: () => {}, readOnly: true });
76
+ expect(screen.getByRole("button", { name: "Change patient" })).toBeInTheDocument();
77
+ });
78
+
79
+ it('no onChangePatient: shows no "Change patient" button', () => {
80
+ renderHeader();
81
+ expect(screen.queryByRole("button", { name: "Change patient" })).not.toBeInTheDocument();
82
+ });
83
+
84
+ it('collapsed: shows "Change patient" button', () => {
85
+ renderHeader({ onChangePatient: () => {} });
86
+ expect(screen.getByRole("button", { name: "Change patient" })).toBeInTheDocument();
87
+ expect(screen.queryByRole("button", { name: "Cancel editing patient" })).not.toBeInTheDocument();
88
+ });
89
+
90
+ it('expanded: shows "Cancel editing patient" button instead of "Change patient"', () => {
91
+ renderHeader({ expanded: true, onChangePatient: () => {} });
92
+ expect(screen.getByRole("button", { name: "Cancel editing patient" })).toBeInTheDocument();
93
+ expect(screen.queryByRole("button", { name: "Change patient" })).not.toBeInTheDocument();
94
+ });
95
+
96
+ it('expanded and no onChangePatient: still shows "Cancel editing patient" button', () => {
97
+ renderHeader({ expanded: true });
98
+ expect(screen.getByRole("button", { name: "Cancel editing patient" })).toBeInTheDocument();
99
+ });
100
+
101
+ it('clicking "Cancel editing patient": calls onCancelEditing, not onChangePatient', async () => {
102
+ const onCancelEditing = vi.fn();
103
+ const onChangePatient = vi.fn();
104
+ renderHeader({ expanded: true, onCancelEditing, onChangePatient });
105
+ await userEvent.click(screen.getByRole("button", { name: "Cancel editing patient" }));
106
+ expect(onCancelEditing).toHaveBeenCalledOnce();
107
+ expect(onChangePatient).not.toHaveBeenCalled();
108
+ });
109
+
110
+ // Leaving a field shows its error, and pressing Cancel would take focus from the field being typed in first.
111
+ // Keeping focus where it is lets Cancel close the editors without briefly showing an error.
112
+ it('pressing "Cancel editing patient": prevents the mousedown from moving focus', () => {
113
+ renderHeader({ expanded: true });
114
+ const notPrevented = fireEvent.mouseDown(screen.getByRole("button", { name: "Cancel editing patient" }));
115
+ expect(notPrevented).toBe(false);
116
+ });
117
+ });
118
+ });
119
+
120
+ describe("fullName", () => {
121
+ it('first and last name: returns "<first> <last>"', () => {
122
+ expect(fullName({ first: "Ada", middle: null, last: "Lovelace" })).toBe("Ada Lovelace");
123
+ });
124
+
125
+ // Pins today's behavior: the middle name is recorded but never shown.
126
+ it("middle name: leaves the middle name out", () => {
127
+ expect(fullName({ first: "Ada", middle: "King", last: "Lovelace" })).toBe("Ada Lovelace");
128
+ });
129
+
130
+ it("first name only: returns the first name", () => {
131
+ expect(fullName({ first: "Ada", middle: null, last: null })).toBe("Ada");
132
+ });
133
+
134
+ it("last name only: returns the last name", () => {
135
+ expect(fullName({ first: null, middle: null, last: "Lovelace" })).toBe("Lovelace");
136
+ });
137
+
138
+ it('first and last name empty: returns "Unnamed patient"', () => {
139
+ expect(fullName({ first: "", middle: null, last: "" })).toBe("Unnamed patient");
140
+ });
141
+
142
+ it('no first or last name: returns "Unnamed patient"', () => {
143
+ expect(fullName({ first: null, middle: null, last: null })).toBe("Unnamed patient");
144
+ });
145
+
146
+ it('no name object (the patient has no demographic details): returns "Unnamed patient"', () => {
147
+ expect(fullName(undefined)).toBe("Unnamed patient");
148
+ });
149
+ });
150
+
151
+ describe("demographicLine", () => {
152
+ it('sex and date of birth, 18 or older: returns "<sex> · Adult (<age>) · <M/D/YY>"', () => {
153
+ expect(demographicLine({ sex: "FEMALE", dateOfBirth: "1990-01-01" })).toBe("Female · Adult (36) · 1/1/90");
154
+ });
155
+
156
+ it('sex and date of birth, under 18: returns "<sex> · Pediatric (<age>) · <M/D/YY>"', () => {
157
+ expect(demographicLine({ sex: "MALE", dateOfBirth: "2016-01-01" })).toBe("Male · Pediatric (10) · 1/1/16");
158
+ });
159
+
160
+ it("turns 18 today: returns Adult", () => {
161
+ expect(demographicLine({ sex: null, dateOfBirth: "2008-06-15" })).toBe("Adult (18) · 6/15/08");
162
+ });
163
+
164
+ it("turns 18 tomorrow: returns Pediatric", () => {
165
+ expect(demographicLine({ sex: null, dateOfBirth: "2008-06-16" })).toBe("Pediatric (17) · 6/16/08");
166
+ });
167
+
168
+ it("sex UNKNOWN: leaves sex out", () => {
169
+ expect(demographicLine({ sex: "UNKNOWN", dateOfBirth: "1990-01-01" })).toBe("Adult (36) · 1/1/90");
170
+ });
171
+
172
+ it("sex but no date of birth: returns only sex", () => {
173
+ expect(demographicLine({ sex: "FEMALE", dateOfBirth: null })).toBe("Female");
174
+ });
175
+
176
+ it("no sex and no date of birth: returns an empty string", () => {
177
+ expect(demographicLine({ sex: null, dateOfBirth: null })).toBe("");
178
+ });
179
+
180
+ it("no demographic details: returns an empty string", () => {
181
+ expect(demographicLine(undefined)).toBe("");
182
+ });
183
+ });
@@ -0,0 +1,85 @@
1
+ /** PatientSummary's header: who the patient is, and the buttons to edit them, cancel an edit, or change them. */
2
+ import { useComponents } from "../../../primitives/index.ts";
3
+ import { type PatientRecord } from "@photonhealth/client";
4
+ import { ageOn, shortDate } from "../../format.ts";
5
+ import { focusProps } from "../../flow.ts";
6
+
7
+ type Demographic = NonNullable<PatientRecord["demographic"]>;
8
+ type Name = Demographic["name"];
9
+
10
+ export const fullName = (name: Name | undefined) =>
11
+ [name?.first, name?.last].filter(Boolean).join(" ") || "Unnamed patient";
12
+
13
+ export const demographicLine = (d: Pick<Demographic, "sex" | "dateOfBirth"> | undefined) => {
14
+ const age = ageOn(d?.dateOfBirth);
15
+ const sex = d?.sex === "FEMALE" ? "Female" : d?.sex === "MALE" ? "Male" : null;
16
+ const ageGroup = age != null ? `${age >= 18 ? "Adult" : "Pediatric"} (${age})` : null;
17
+ return [sex, ageGroup, d?.dateOfBirth ? shortDate(d.dateOfBirth) : null].filter(Boolean).join(" · ");
18
+ };
19
+
20
+ export function SummaryHeader({
21
+ patient,
22
+ expanded,
23
+ readOnly,
24
+ onStartEditing,
25
+ onCancelEditing,
26
+ onChangePatient,
27
+ }: {
28
+ patient: PatientRecord;
29
+ /** Whether the card's editors are showing: the pencil is hidden, and Cancel shows in place of Change patient. */
30
+ expanded: boolean;
31
+ /** Read-only (e.g. on a sent order): no pencil. */
32
+ readOnly?: boolean;
33
+ /** Open the editors. Shown while collapsed; PatientDetailsForm's Save closes them again. */
34
+ onStartEditing: () => void;
35
+ /** Close the editors without saving. Shown while `expanded`, in place of Change patient. */
36
+ onCancelEditing: () => void;
37
+ onChangePatient?: () => void;
38
+ }) {
39
+ const { Button, CardHeader, Row } = useComponents();
40
+ const line = demographicLine(patient.demographic ?? undefined);
41
+ return (
42
+ <CardHeader
43
+ title={fullName(patient.demographic?.name)}
44
+ description={line || undefined}
45
+ action={
46
+ <Row gap="1">
47
+ {!readOnly && !expanded && (
48
+ <span {...focusProps}>
49
+ <Button
50
+ variant="ghost"
51
+ icon="edit"
52
+ aria-label="Edit patient"
53
+ title="Edit patient"
54
+ aria-expanded={false}
55
+ onClick={onStartEditing}
56
+ />
57
+ </span>
58
+ )}
59
+ {expanded ? (
60
+ <Button
61
+ variant="ghost"
62
+ // Pressing the button would take focus from the field being typed in first, and leaving a field shows
63
+ // its error. Keep focus where it is, so the click closes the editors without flashing an error.
64
+ onMouseDown={(e) => e.preventDefault()}
65
+ onClick={onCancelEditing}
66
+ aria-label="Cancel editing patient"
67
+ title="Cancel"
68
+ icon="close"
69
+ />
70
+ ) : (
71
+ onChangePatient && (
72
+ <Button
73
+ variant="ghost"
74
+ onClick={onChangePatient}
75
+ aria-label="Change patient"
76
+ title="Change patient"
77
+ icon="close"
78
+ />
79
+ )
80
+ )}
81
+ </Row>
82
+ }
83
+ />
84
+ );
85
+ }
@@ -1,11 +1,16 @@
1
- /** Fields both the intake form and the details editor use: sex, contact, no autofill. */
2
- import { useComponents } from "../../primitives/index.ts";
3
- import { type PatientInput, type Sex } from "@photonhealth/client";
4
- import { useState } from "react";
5
- import { formatPhone, PHONE_PATTERN, toE164 } from "../format.ts";
1
+ /** What PatientCard's forms share: the identity keys, the sex options, and no autofill. */
2
+ import { type Sex } from "@photonhealth/client";
6
3
 
7
- type PatientDemographicInput = NonNullable<PatientInput["demographic"]>;
8
- type AddressInput = NonNullable<PatientDemographicInput["address"]>;
4
+ /**
5
+ * What network-api needs to add a patient. While the prescriber is still finding or filling them in, the server's
6
+ * "still needed" about these is what the card asks for next, not an error to show.
7
+ */
8
+ export const IDENTITY_KEYS = [
9
+ "demographic.name.first",
10
+ "demographic.name.last",
11
+ "demographic.dateOfBirth",
12
+ "demographic.sex",
13
+ ];
9
14
 
10
15
  /**
11
16
  * These fields describe the patient, not the prescriber: keep the browser's autofill and password managers
@@ -25,120 +30,3 @@ export const SEX_OPTIONS: { value: Sex; label: string }[] = [
25
30
  { value: "FEMALE", label: "Female" },
26
31
  { value: "UNKNOWN", label: "Unknown" },
27
32
  ];
28
-
29
- /**
30
- * Phone / email / address, inside the demographics editor. Nothing here is required up front: the server
31
- * decides (a send needs a phone), and the editor opens itself when a send fails for want of one —
32
- * `addressRequest`.
33
- */
34
- export function ContactFields({
35
- phone,
36
- email,
37
- address,
38
- onSave,
39
- addressRequest,
40
- }: {
41
- phone: string | null;
42
- email: string | null;
43
- address: {
44
- street1: string | null;
45
- street2: string | null;
46
- city: string | null;
47
- state: string | null;
48
- postalCode: string | null;
49
- } | null;
50
- onSave: (contact: { phone?: string; email?: string; address?: AddressInput }) => void;
51
- addressRequest: string | null;
52
- }) {
53
- const { Alert, Grid, Input, Stack } = useComponents();
54
- const [phoneValue, setPhone] = useState(formatPhone(phone));
55
- const [emailValue, setEmail] = useState(email ?? "");
56
- const [street1, setStreet1] = useState(address?.street1 ?? "");
57
- const [street2, setStreet2] = useState(address?.street2 ?? "");
58
- const [city, setCity] = useState(address?.city ?? "");
59
- const [state, setState] = useState(address?.state ?? "");
60
- const [postalCode, setPostalCode] = useState(address?.postalCode ?? "");
61
-
62
- // Save early: each field saves when you leave it (the browser validates phone / email first);
63
- // the address saves once it's complete and you leave it.
64
- const addressComplete = Boolean(street1.trim() && city.trim() && state.trim() && postalCode.trim());
65
- const savePhone = (input: HTMLInputElement) => {
66
- setPhone(formatPhone(phoneValue));
67
- if (input.checkValidity() && toE164(phoneValue) !== (phone || undefined))
68
- onSave({ phone: toE164(phoneValue) ?? "" });
69
- };
70
- const saveEmail = (input: HTMLInputElement) => {
71
- if (input.checkValidity() && emailValue.trim() !== (email ?? "")) onSave({ email: emailValue.trim() });
72
- };
73
- const saveAddress = () => {
74
- if (!addressComplete) return;
75
- const next = {
76
- street1: street1.trim(),
77
- street2: street2.trim() || undefined,
78
- city: city.trim(),
79
- state: state.trim().toUpperCase(),
80
- postalCode: postalCode.trim(),
81
- country: "US",
82
- };
83
- const same =
84
- next.street1 === (address?.street1 ?? "") &&
85
- (next.street2 ?? "") === (address?.street2 ?? "") &&
86
- next.city === (address?.city ?? "") &&
87
- next.state === (address?.state ?? "") &&
88
- next.postalCode === (address?.postalCode ?? "");
89
- if (!same) onSave({ address: next });
90
- };
91
- return (
92
- <Stack gap="2">
93
- {/* The server's message can name internal ids ("patient pat_… has no address"); the title says it. A send
94
- needs a phone; an address only when the server still asks with a phone on file. */}
95
- {addressRequest && <Alert tone="warning" title={phone ? "Address needed to send" : "Phone needed to send"} />}
96
- <Grid min="120px" gap="3">
97
- <Input
98
- label="Phone"
99
- type="tel"
100
- inputMode="tel"
101
- pattern={PHONE_PATTERN}
102
- value={phoneValue}
103
- onChange={(e) => setPhone(e.target.value)}
104
- onBlur={(e) => savePhone(e.currentTarget)}
105
- {...noAutofill}
106
- />
107
- <Input
108
- label="Email"
109
- type="email"
110
- inputMode="email"
111
- value={emailValue}
112
- onChange={(e) => setEmail(e.target.value)}
113
- onBlur={(e) => saveEmail(e.currentTarget)}
114
- {...noAutofill}
115
- />
116
- </Grid>
117
- <div onBlur={saveAddress}>
118
- <Stack gap="3">
119
- <Grid min="120px" gap="3">
120
- <Input label="Street" value={street1} onChange={(e) => setStreet1(e.target.value)} {...noAutofill} />
121
- <Input label="Apt / suite" value={street2} onChange={(e) => setStreet2(e.target.value)} {...noAutofill} />
122
- </Grid>
123
- <Grid min="120px" gap="3">
124
- <Input label="City" value={city} onChange={(e) => setCity(e.target.value)} {...noAutofill} />
125
- <Input
126
- label="State"
127
- value={state}
128
- onChange={(e) => setState(e.target.value)}
129
- maxLength={2}
130
- {...noAutofill}
131
- />
132
- <Input
133
- label="ZIP"
134
- value={postalCode}
135
- onChange={(e) => setPostalCode(e.target.value)}
136
- inputMode="numeric"
137
- {...noAutofill}
138
- />
139
- </Grid>
140
- </Stack>
141
- </div>
142
- </Stack>
143
- );
144
- }