formanitor 0.1.11 → 0.2.1
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.
- package/dist/AddInvestigationWidget-7UGZQYI5.mjs +30 -0
- package/dist/AddInvestigationWidget-7UGZQYI5.mjs.map +1 -0
- package/dist/AddInvestigationWidget-RY62UCPM.cjs +32 -0
- package/dist/AddInvestigationWidget-RY62UCPM.cjs.map +1 -0
- package/dist/AddMedicationWidget-UG26VMUX.mjs +30 -0
- package/dist/AddMedicationWidget-UG26VMUX.mjs.map +1 -0
- package/dist/AddMedicationWidget-WPI32WAP.cjs +32 -0
- package/dist/AddMedicationWidget-WPI32WAP.cjs.map +1 -0
- package/dist/AddProcedureWidget-SF6MTRBV.cjs +278 -0
- package/dist/AddProcedureWidget-SF6MTRBV.cjs.map +1 -0
- package/dist/AddProcedureWidget-SQJUKKMK.mjs +276 -0
- package/dist/AddProcedureWidget-SQJUKKMK.mjs.map +1 -0
- package/dist/BiometryIolWorkupWidget-I5AJOYB2.cjs +300 -0
- package/dist/BiometryIolWorkupWidget-I5AJOYB2.cjs.map +1 -0
- package/dist/BiometryIolWorkupWidget-NL2M7ZAA.mjs +298 -0
- package/dist/BiometryIolWorkupWidget-NL2M7ZAA.mjs.map +1 -0
- package/dist/DateTimeWidget-DIDVF2EB.cjs +61 -0
- package/dist/DateTimeWidget-DIDVF2EB.cjs.map +1 -0
- package/dist/DateTimeWidget-LFBB6HOP.mjs +59 -0
- package/dist/DateTimeWidget-LFBB6HOP.mjs.map +1 -0
- package/dist/DateWidget-4ND5TKP2.mjs +72 -0
- package/dist/DateWidget-4ND5TKP2.mjs.map +1 -0
- package/dist/DateWidget-BCVR5GDK.cjs +74 -0
- package/dist/DateWidget-BCVR5GDK.cjs.map +1 -0
- package/dist/DiagnosisTextareaWidget-E7OQRUMX.cjs +190 -0
- package/dist/DiagnosisTextareaWidget-E7OQRUMX.cjs.map +1 -0
- package/dist/DiagnosisTextareaWidget-MAOXCXEZ.mjs +184 -0
- package/dist/DiagnosisTextareaWidget-MAOXCXEZ.mjs.map +1 -0
- package/dist/DifferentialDiagnosisWidget-ANALLNKL.cjs +17 -0
- package/dist/DifferentialDiagnosisWidget-ANALLNKL.cjs.map +1 -0
- package/dist/DifferentialDiagnosisWidget-LCY2SA2I.mjs +15 -0
- package/dist/DifferentialDiagnosisWidget-LCY2SA2I.mjs.map +1 -0
- package/dist/DischargeMedicationOrdersWidget-GYT35W7J.mjs +161 -0
- package/dist/DischargeMedicationOrdersWidget-GYT35W7J.mjs.map +1 -0
- package/dist/DischargeMedicationOrdersWidget-ILWNZ7VM.cjs +163 -0
- package/dist/DischargeMedicationOrdersWidget-ILWNZ7VM.cjs.map +1 -0
- package/dist/EditableTable-TGCVUBLO.mjs +279 -0
- package/dist/EditableTable-TGCVUBLO.mjs.map +1 -0
- package/dist/EditableTable-VCUNJZEX.cjs +281 -0
- package/dist/EditableTable-VCUNJZEX.cjs.map +1 -0
- package/dist/FollowupWidget-F6FRZO4T.mjs +283 -0
- package/dist/FollowupWidget-F6FRZO4T.mjs.map +1 -0
- package/dist/FollowupWidget-NBTOV2ML.cjs +285 -0
- package/dist/FollowupWidget-NBTOV2ML.cjs.map +1 -0
- package/dist/FunctionalImpairmentScoreWidget-5V5SNLTF.cjs +93 -0
- package/dist/FunctionalImpairmentScoreWidget-5V5SNLTF.cjs.map +1 -0
- package/dist/FunctionalImpairmentScoreWidget-QKIZE7KT.mjs +91 -0
- package/dist/FunctionalImpairmentScoreWidget-QKIZE7KT.mjs.map +1 -0
- package/dist/GsExaminationWidget-57SL4BCI.cjs +528 -0
- package/dist/GsExaminationWidget-57SL4BCI.cjs.map +1 -0
- package/dist/GsExaminationWidget-J4VABGY6.mjs +526 -0
- package/dist/GsExaminationWidget-J4VABGY6.mjs.map +1 -0
- package/dist/GsGradingWidget-3WTLIP33.mjs +90 -0
- package/dist/GsGradingWidget-3WTLIP33.mjs.map +1 -0
- package/dist/GsGradingWidget-CIXE36HF.cjs +92 -0
- package/dist/GsGradingWidget-CIXE36HF.cjs.map +1 -0
- package/dist/GsSmartHistoryWidget-6Q2IIGDG.cjs +398 -0
- package/dist/GsSmartHistoryWidget-6Q2IIGDG.cjs.map +1 -0
- package/dist/GsSmartHistoryWidget-IOGZ6GNS.mjs +396 -0
- package/dist/GsSmartHistoryWidget-IOGZ6GNS.mjs.map +1 -0
- package/dist/HiddenVitalsWidget-HBK7PBPR.cjs +55 -0
- package/dist/HiddenVitalsWidget-HBK7PBPR.cjs.map +1 -0
- package/dist/HiddenVitalsWidget-JH3NRZLM.mjs +53 -0
- package/dist/HiddenVitalsWidget-JH3NRZLM.mjs.map +1 -0
- package/dist/LensAssessmentWidget-7WMULFS2.mjs +232 -0
- package/dist/LensAssessmentWidget-7WMULFS2.mjs.map +1 -0
- package/dist/LensAssessmentWidget-GSOOD7BX.cjs +234 -0
- package/dist/LensAssessmentWidget-GSOOD7BX.cjs.map +1 -0
- package/dist/MarMedicationOrdersWidget-3E6GFOR6.cjs +76 -0
- package/dist/MarMedicationOrdersWidget-3E6GFOR6.cjs.map +1 -0
- package/dist/MarMedicationOrdersWidget-QZUVSEB5.mjs +74 -0
- package/dist/MarMedicationOrdersWidget-QZUVSEB5.mjs.map +1 -0
- package/dist/OBGExaminationWidget-F2ZNSP2M.cjs +215 -0
- package/dist/OBGExaminationWidget-F2ZNSP2M.cjs.map +1 -0
- package/dist/OBGExaminationWidget-POVLALMA.mjs +213 -0
- package/dist/OBGExaminationWidget-POVLALMA.mjs.map +1 -0
- package/dist/OBGPathwayWidget-CGT7Q4T2.mjs +517 -0
- package/dist/OBGPathwayWidget-CGT7Q4T2.mjs.map +1 -0
- package/dist/OBGPathwayWidget-WCIQENMO.cjs +519 -0
- package/dist/OBGPathwayWidget-WCIQENMO.cjs.map +1 -0
- package/dist/ObstetricHistoryWidget-EGVLL4X2.mjs +1113 -0
- package/dist/ObstetricHistoryWidget-EGVLL4X2.mjs.map +1 -0
- package/dist/ObstetricHistoryWidget-XU6R7IPP.cjs +1115 -0
- package/dist/ObstetricHistoryWidget-XU6R7IPP.cjs.map +1 -0
- package/dist/OphthalDiagnosisWidget-G5RCC2QZ.mjs +89 -0
- package/dist/OphthalDiagnosisWidget-G5RCC2QZ.mjs.map +1 -0
- package/dist/OphthalDiagnosisWidget-OQPTHJ7E.cjs +91 -0
- package/dist/OphthalDiagnosisWidget-OQPTHJ7E.cjs.map +1 -0
- package/dist/OphthalmologyWidget-I3BKWOI2.cjs +1331 -0
- package/dist/OphthalmologyWidget-I3BKWOI2.cjs.map +1 -0
- package/dist/OphthalmologyWidget-RG2AI6WA.mjs +1329 -0
- package/dist/OphthalmologyWidget-RG2AI6WA.mjs.map +1 -0
- package/dist/OrthopedicExamWidget-BBZP6NVT.mjs +366 -0
- package/dist/OrthopedicExamWidget-BBZP6NVT.mjs.map +1 -0
- package/dist/OrthopedicExamWidget-M4KKU5RC.cjs +368 -0
- package/dist/OrthopedicExamWidget-M4KKU5RC.cjs.map +1 -0
- package/dist/PainScaleFlagsWidget-E576R6QB.mjs +151 -0
- package/dist/PainScaleFlagsWidget-E576R6QB.mjs.map +1 -0
- package/dist/PainScaleFlagsWidget-QHGESXNE.cjs +153 -0
- package/dist/PainScaleFlagsWidget-QHGESXNE.cjs.map +1 -0
- package/dist/ReadOnlyTable-4Y2XW4MX.mjs +6 -0
- package/dist/ReadOnlyTable-4Y2XW4MX.mjs.map +1 -0
- package/dist/ReadOnlyTable-L7G6GWEJ.cjs +15 -0
- package/dist/ReadOnlyTable-L7G6GWEJ.cjs.map +1 -0
- package/dist/ReferralWidget-J2PWYFDT.cjs +171 -0
- package/dist/ReferralWidget-J2PWYFDT.cjs.map +1 -0
- package/dist/ReferralWidget-UPYWEO5R.mjs +169 -0
- package/dist/ReferralWidget-UPYWEO5R.mjs.map +1 -0
- package/dist/RichTextWidget-BBCNJPMH.mjs +11 -0
- package/dist/RichTextWidget-BBCNJPMH.mjs.map +1 -0
- package/dist/RichTextWidget-CRQHNVJR.cjs +24 -0
- package/dist/RichTextWidget-CRQHNVJR.cjs.map +1 -0
- package/dist/SmartTextarea-DKWV4R6H.cjs +19 -0
- package/dist/SmartTextarea-DKWV4R6H.cjs.map +1 -0
- package/dist/SmartTextarea-ZTQIW6O2.mjs +10 -0
- package/dist/SmartTextarea-ZTQIW6O2.mjs.map +1 -0
- package/dist/SuggestionTextareaWidget-22NR3JWM.mjs +215 -0
- package/dist/SuggestionTextareaWidget-22NR3JWM.mjs.map +1 -0
- package/dist/SuggestionTextareaWidget-WCTPWW2E.cjs +226 -0
- package/dist/SuggestionTextareaWidget-WCTPWW2E.cjs.map +1 -0
- package/dist/SurgicalRiskFlagsWidget-Q5FTWB3M.cjs +146 -0
- package/dist/SurgicalRiskFlagsWidget-Q5FTWB3M.cjs.map +1 -0
- package/dist/SurgicalRiskFlagsWidget-WCAHZKKG.mjs +144 -0
- package/dist/SurgicalRiskFlagsWidget-WCAHZKKG.mjs.map +1 -0
- package/dist/UrologyExaminationWidget-JYUGZ5CG.cjs +273 -0
- package/dist/UrologyExaminationWidget-JYUGZ5CG.cjs.map +1 -0
- package/dist/UrologyExaminationWidget-QDTD3FJX.mjs +271 -0
- package/dist/UrologyExaminationWidget-QDTD3FJX.mjs.map +1 -0
- package/dist/UrologyPathwayWidget-QTFKUIM7.mjs +153 -0
- package/dist/UrologyPathwayWidget-QTFKUIM7.mjs.map +1 -0
- package/dist/UrologyPathwayWidget-TXZQNGP4.cjs +155 -0
- package/dist/UrologyPathwayWidget-TXZQNGP4.cjs.map +1 -0
- package/dist/UrologySmartHistoryWidget-53NATEO3.cjs +471 -0
- package/dist/UrologySmartHistoryWidget-53NATEO3.cjs.map +1 -0
- package/dist/UrologySmartHistoryWidget-PBU4QXQJ.mjs +469 -0
- package/dist/UrologySmartHistoryWidget-PBU4QXQJ.mjs.map +1 -0
- package/dist/VitalsWidget-BRFUKGNO.mjs +187 -0
- package/dist/VitalsWidget-BRFUKGNO.mjs.map +1 -0
- package/dist/VitalsWidget-PDCYXNBM.cjs +208 -0
- package/dist/VitalsWidget-PDCYXNBM.cjs.map +1 -0
- package/dist/chunk-3KRDT7TX.mjs +137 -0
- package/dist/chunk-3KRDT7TX.mjs.map +1 -0
- package/dist/chunk-4BAKQIPJ.mjs +27 -0
- package/dist/chunk-4BAKQIPJ.mjs.map +1 -0
- package/dist/chunk-4KSZUIJE.cjs +143 -0
- package/dist/chunk-4KSZUIJE.cjs.map +1 -0
- package/dist/chunk-4PMNVBJD.mjs +121 -0
- package/dist/chunk-4PMNVBJD.mjs.map +1 -0
- package/dist/chunk-5E3APMY6.cjs +54 -0
- package/dist/chunk-5E3APMY6.cjs.map +1 -0
- package/dist/chunk-5I2RC47Y.mjs +75 -0
- package/dist/chunk-5I2RC47Y.mjs.map +1 -0
- package/dist/chunk-6YX37XBM.cjs +32 -0
- package/dist/chunk-6YX37XBM.cjs.map +1 -0
- package/dist/chunk-7L2JOWGA.mjs +30 -0
- package/dist/chunk-7L2JOWGA.mjs.map +1 -0
- package/dist/chunk-AIZ3XYEZ.cjs +551 -0
- package/dist/chunk-AIZ3XYEZ.cjs.map +1 -0
- package/dist/chunk-AZHTIUOL.mjs +116 -0
- package/dist/chunk-AZHTIUOL.mjs.map +1 -0
- package/dist/chunk-AZSAPO2V.cjs +174 -0
- package/dist/chunk-AZSAPO2V.cjs.map +1 -0
- package/dist/chunk-B3GBIAHZ.mjs +285 -0
- package/dist/chunk-B3GBIAHZ.mjs.map +1 -0
- package/dist/chunk-BMNY7F6H.mjs +148 -0
- package/dist/chunk-BMNY7F6H.mjs.map +1 -0
- package/dist/chunk-BOBX45NY.cjs +77 -0
- package/dist/chunk-BOBX45NY.cjs.map +1 -0
- package/dist/chunk-BU4ZEAAP.mjs +102 -0
- package/dist/chunk-BU4ZEAAP.mjs.map +1 -0
- package/dist/chunk-DZYV47QC.mjs +54 -0
- package/dist/chunk-DZYV47QC.mjs.map +1 -0
- package/dist/chunk-E7WUDHSA.cjs +127 -0
- package/dist/chunk-E7WUDHSA.cjs.map +1 -0
- package/dist/chunk-FHHISVCH.cjs +13 -0
- package/dist/chunk-FHHISVCH.cjs.map +1 -0
- package/dist/chunk-GNZWSVTB.mjs +29 -0
- package/dist/chunk-GNZWSVTB.mjs.map +1 -0
- package/dist/chunk-GPU5P3FB.cjs +236 -0
- package/dist/chunk-GPU5P3FB.cjs.map +1 -0
- package/dist/chunk-GXXWMHAA.mjs +49 -0
- package/dist/chunk-GXXWMHAA.mjs.map +1 -0
- package/dist/chunk-GZPCYSJK.mjs +104 -0
- package/dist/chunk-GZPCYSJK.mjs.map +1 -0
- package/dist/chunk-HEFZA2AH.mjs +22 -0
- package/dist/chunk-HEFZA2AH.mjs.map +1 -0
- package/dist/chunk-I4AV6BQF.mjs +10 -0
- package/dist/chunk-I4AV6BQF.mjs.map +1 -0
- package/dist/chunk-I7TJVWYV.cjs +73 -0
- package/dist/chunk-I7TJVWYV.cjs.map +1 -0
- package/dist/chunk-IFMQKLNW.mjs +39 -0
- package/dist/chunk-IFMQKLNW.mjs.map +1 -0
- package/dist/chunk-IFSKLIS2.cjs +12 -0
- package/dist/chunk-IFSKLIS2.cjs.map +1 -0
- package/dist/chunk-IKAKE7TR.mjs +527 -0
- package/dist/chunk-IKAKE7TR.mjs.map +1 -0
- package/dist/chunk-JE6VXRWW.cjs +86 -0
- package/dist/chunk-JE6VXRWW.cjs.map +1 -0
- package/dist/chunk-JMGUUFOJ.cjs +45 -0
- package/dist/chunk-JMGUUFOJ.cjs.map +1 -0
- package/dist/chunk-KJA5BLGX.cjs +31 -0
- package/dist/chunk-KJA5BLGX.cjs.map +1 -0
- package/dist/chunk-KMJOTMUQ.cjs +109 -0
- package/dist/chunk-KMJOTMUQ.cjs.map +1 -0
- package/dist/chunk-L4CIIT4U.cjs +388 -0
- package/dist/chunk-L4CIIT4U.cjs.map +1 -0
- package/dist/chunk-LBWB7MYU.cjs +287 -0
- package/dist/chunk-LBWB7MYU.cjs.map +1 -0
- package/dist/chunk-LGGOBIEA.mjs +61 -0
- package/dist/chunk-LGGOBIEA.mjs.map +1 -0
- package/dist/chunk-LQYWMYEC.mjs +28 -0
- package/dist/chunk-LQYWMYEC.mjs.map +1 -0
- package/dist/chunk-MQ2JV7HL.cjs +140 -0
- package/dist/chunk-MQ2JV7HL.cjs.map +1 -0
- package/dist/chunk-N4L76SHJ.cjs +65 -0
- package/dist/chunk-N4L76SHJ.cjs.map +1 -0
- package/dist/chunk-O3VQBPEW.cjs +72 -0
- package/dist/chunk-O3VQBPEW.cjs.map +1 -0
- package/dist/chunk-P62377LB.cjs +27 -0
- package/dist/chunk-P62377LB.cjs.map +1 -0
- package/dist/chunk-PHADAQSH.cjs +49 -0
- package/dist/chunk-PHADAQSH.cjs.map +1 -0
- package/dist/chunk-PZBJYPWW.cjs +52 -0
- package/dist/chunk-PZBJYPWW.cjs.map +1 -0
- package/dist/chunk-QKJ7BQSR.cjs +538 -0
- package/dist/chunk-QKJ7BQSR.cjs.map +1 -0
- package/dist/chunk-QS6WG2XJ.cjs +56 -0
- package/dist/chunk-QS6WG2XJ.cjs.map +1 -0
- package/dist/chunk-S7EMPE2D.cjs +104 -0
- package/dist/chunk-S7EMPE2D.cjs.map +1 -0
- package/dist/chunk-SCMXLRX5.mjs +42 -0
- package/dist/chunk-SCMXLRX5.mjs.map +1 -0
- package/dist/chunk-SHQHDSA4.cjs +1959 -0
- package/dist/chunk-SHQHDSA4.cjs.map +1 -0
- package/dist/chunk-TJHG5WHX.cjs +47 -0
- package/dist/chunk-TJHG5WHX.cjs.map +1 -0
- package/dist/chunk-UGGUIXUS.cjs +41 -0
- package/dist/chunk-UGGUIXUS.cjs.map +1 -0
- package/dist/chunk-ULMK3TUI.mjs +69 -0
- package/dist/chunk-ULMK3TUI.mjs.map +1 -0
- package/dist/chunk-UULLSS4O.mjs +82 -0
- package/dist/chunk-UULLSS4O.mjs.map +1 -0
- package/dist/chunk-VNFBUAZD.mjs +25 -0
- package/dist/chunk-VNFBUAZD.mjs.map +1 -0
- package/dist/chunk-VPU66PI6.mjs +11 -0
- package/dist/chunk-VPU66PI6.mjs.map +1 -0
- package/dist/chunk-VZT5YNCD.mjs +228 -0
- package/dist/chunk-VZT5YNCD.mjs.map +1 -0
- package/dist/chunk-WYVXXEZI.mjs +46 -0
- package/dist/chunk-WYVXXEZI.mjs.map +1 -0
- package/dist/chunk-XDUVO3IZ.mjs +547 -0
- package/dist/chunk-XDUVO3IZ.mjs.map +1 -0
- package/dist/chunk-Y7TIWH4I.mjs +25 -0
- package/dist/chunk-Y7TIWH4I.mjs.map +1 -0
- package/dist/chunk-YEFM2ERQ.cjs +143 -0
- package/dist/chunk-YEFM2ERQ.cjs.map +1 -0
- package/dist/chunk-YHNI5NIX.mjs +361 -0
- package/dist/chunk-YHNI5NIX.mjs.map +1 -0
- package/dist/chunk-ZTT5XJR7.mjs +1921 -0
- package/dist/chunk-ZTT5XJR7.mjs.map +1 -0
- package/dist/index.cjs +2091 -14564
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +62 -767
- package/dist/index.d.ts +62 -767
- package/dist/index.mjs +1873 -14394
- package/dist/index.mjs.map +1 -1
- package/dist/read-only-table.cjs +15 -0
- package/dist/read-only-table.cjs.map +1 -0
- package/dist/read-only-table.d.cts +10 -0
- package/dist/read-only-table.d.ts +10 -0
- package/dist/read-only-table.mjs +6 -0
- package/dist/read-only-table.mjs.map +1 -0
- package/dist/rich-text.cjs +24 -0
- package/dist/rich-text.cjs.map +1 -0
- package/dist/rich-text.d.cts +8 -0
- package/dist/rich-text.d.ts +8 -0
- package/dist/rich-text.mjs +11 -0
- package/dist/rich-text.mjs.map +1 -0
- package/dist/richTextClassName--8wkuHkW.d.cts +10 -0
- package/dist/richTextClassName--8wkuHkW.d.ts +10 -0
- package/dist/smart.cjs +23 -0
- package/dist/smart.cjs.map +1 -0
- package/dist/smart.d.cts +23 -0
- package/dist/smart.d.ts +23 -0
- package/dist/smart.mjs +10 -0
- package/dist/smart.mjs.map +1 -0
- package/dist/types-CYtJk8H9.d.cts +782 -0
- package/dist/types-CYtJk8H9.d.ts +782 -0
- package/package.json +20 -2
|
@@ -0,0 +1,1113 @@
|
|
|
1
|
+
import { useObgSymptomsSync, Panel, ChipRow } from './chunk-ULMK3TUI.mjs';
|
|
2
|
+
import { Card, CardHeader, CardTitle, CardContent } from './chunk-LGGOBIEA.mjs';
|
|
3
|
+
import { normalizeObgPathway } from './chunk-IKAKE7TR.mjs';
|
|
4
|
+
import { Checkbox } from './chunk-GNZWSVTB.mjs';
|
|
5
|
+
import { Textarea } from './chunk-4BAKQIPJ.mjs';
|
|
6
|
+
import { Input } from './chunk-VNFBUAZD.mjs';
|
|
7
|
+
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from './chunk-AZHTIUOL.mjs';
|
|
8
|
+
import { useField } from './chunk-ZTT5XJR7.mjs';
|
|
9
|
+
import { Label } from './chunk-HEFZA2AH.mjs';
|
|
10
|
+
import { cn } from './chunk-VPU66PI6.mjs';
|
|
11
|
+
import { useState, useRef, useMemo, useEffect } from 'react';
|
|
12
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
|
+
|
|
14
|
+
var OBG_PATHWAY_FIELD = "obg_pathway";
|
|
15
|
+
var AntenatalPanels = () => {
|
|
16
|
+
const pathwayField = useField(OBG_PATHWAY_FIELD);
|
|
17
|
+
const { writeSymptoms } = useObgSymptomsSync();
|
|
18
|
+
const hasField = !!pathwayField.fieldDef;
|
|
19
|
+
const safe = useMemo(
|
|
20
|
+
() => normalizeObgPathway(pathwayField.value),
|
|
21
|
+
[pathwayField.value]
|
|
22
|
+
);
|
|
23
|
+
const [ant, setAnt] = useState(() => safe.antenatal);
|
|
24
|
+
const lastWrittenRef = useRef(safe.antenatal);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (safe.antenatal === lastWrittenRef.current) return;
|
|
27
|
+
if (JSON.stringify(safe.antenatal) === JSON.stringify(lastWrittenRef.current)) return;
|
|
28
|
+
setAnt(safe.antenatal);
|
|
29
|
+
lastWrittenRef.current = safe.antenatal;
|
|
30
|
+
}, [safe.antenatal]);
|
|
31
|
+
if (!hasField) return null;
|
|
32
|
+
if (!safe.zones.includes("antenatal")) return null;
|
|
33
|
+
const disabled = pathwayField.disabled;
|
|
34
|
+
const commit = (nextAnt) => {
|
|
35
|
+
const prev = { ...safe, antenatal: ant };
|
|
36
|
+
const nextPathway = { ...safe, antenatal: nextAnt };
|
|
37
|
+
setAnt(nextAnt);
|
|
38
|
+
lastWrittenRef.current = nextAnt;
|
|
39
|
+
pathwayField.setValue(nextPathway);
|
|
40
|
+
pathwayField.setTouched();
|
|
41
|
+
writeSymptoms(prev, nextPathway);
|
|
42
|
+
};
|
|
43
|
+
const a = ant;
|
|
44
|
+
const setAntenatal = (patch) => commit({ ...a, ...patch });
|
|
45
|
+
const setAntenatalSymptom = (key) => commit({ ...a, symptoms: { ...a.symptoms, [key]: !a.symptoms[key] } });
|
|
46
|
+
const setAntenatalExam = (patch) => commit({ ...a, exam: { ...a.exam, ...patch } });
|
|
47
|
+
const setAntenatalInv = (patch) => commit({ ...a, investigations: { ...a.investigations, ...patch } });
|
|
48
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-3 text-xs", children: [
|
|
49
|
+
/* @__PURE__ */ jsx(Panel, { title: "Current pregnancy details", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-4", children: [
|
|
50
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
51
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Gravida" }),
|
|
52
|
+
/* @__PURE__ */ jsx(
|
|
53
|
+
Input,
|
|
54
|
+
{
|
|
55
|
+
type: "number",
|
|
56
|
+
min: 0,
|
|
57
|
+
className: "h-8 text-xs",
|
|
58
|
+
value: a.gravida,
|
|
59
|
+
onChange: (e) => setAntenatal({ gravida: Number(e.target.value) || 0 }),
|
|
60
|
+
disabled
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] }),
|
|
64
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
65
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "GA (LMP) \u2014 w / d" }),
|
|
66
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
67
|
+
/* @__PURE__ */ jsx(
|
|
68
|
+
Input,
|
|
69
|
+
{
|
|
70
|
+
type: "number",
|
|
71
|
+
min: 0,
|
|
72
|
+
max: 45,
|
|
73
|
+
className: "h-8 text-xs",
|
|
74
|
+
value: a.gaWeeksLmp,
|
|
75
|
+
onChange: (e) => setAntenatal({ gaWeeksLmp: Number(e.target.value) || 0 }),
|
|
76
|
+
disabled
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: "w" }),
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
Input,
|
|
82
|
+
{
|
|
83
|
+
type: "number",
|
|
84
|
+
min: 0,
|
|
85
|
+
max: 6,
|
|
86
|
+
className: "h-8 text-xs",
|
|
87
|
+
value: a.gaDaysLmp,
|
|
88
|
+
onChange: (e) => setAntenatal({ gaDaysLmp: Number(e.target.value) || 0 }),
|
|
89
|
+
disabled
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: "d" })
|
|
93
|
+
] })
|
|
94
|
+
] }),
|
|
95
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
96
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "GA (USG) \u2014 w / d" }),
|
|
97
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
98
|
+
/* @__PURE__ */ jsx(
|
|
99
|
+
Input,
|
|
100
|
+
{
|
|
101
|
+
type: "number",
|
|
102
|
+
min: 0,
|
|
103
|
+
max: 45,
|
|
104
|
+
className: "h-8 text-xs",
|
|
105
|
+
value: a.gaWeeksUsg,
|
|
106
|
+
onChange: (e) => setAntenatal({ gaWeeksUsg: Number(e.target.value) || 0 }),
|
|
107
|
+
disabled
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: "w" }),
|
|
111
|
+
/* @__PURE__ */ jsx(
|
|
112
|
+
Input,
|
|
113
|
+
{
|
|
114
|
+
type: "number",
|
|
115
|
+
min: 0,
|
|
116
|
+
max: 6,
|
|
117
|
+
className: "h-8 text-xs",
|
|
118
|
+
value: a.gaDaysUsg,
|
|
119
|
+
onChange: (e) => setAntenatal({ gaDaysUsg: Number(e.target.value) || 0 }),
|
|
120
|
+
disabled
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground", children: "d" })
|
|
124
|
+
] })
|
|
125
|
+
] }),
|
|
126
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
127
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "EDD" }),
|
|
128
|
+
/* @__PURE__ */ jsx(
|
|
129
|
+
Input,
|
|
130
|
+
{
|
|
131
|
+
type: "date",
|
|
132
|
+
className: "h-8 text-xs",
|
|
133
|
+
value: a.edd,
|
|
134
|
+
onChange: (e) => setAntenatal({ edd: e.target.value }),
|
|
135
|
+
disabled
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
] }),
|
|
139
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1 md:col-span-2", children: [
|
|
140
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Risk category" }),
|
|
141
|
+
/* @__PURE__ */ jsxs(
|
|
142
|
+
Select,
|
|
143
|
+
{
|
|
144
|
+
value: a.riskCategory === "" ? "none" : a.riskCategory,
|
|
145
|
+
onValueChange: (v) => setAntenatal({
|
|
146
|
+
riskCategory: v === "none" ? "" : v
|
|
147
|
+
}),
|
|
148
|
+
disabled,
|
|
149
|
+
children: [
|
|
150
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
151
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
152
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
153
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Low", children: "Low" }),
|
|
154
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "High", children: "High" })
|
|
155
|
+
] })
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
] })
|
|
160
|
+
] }) }),
|
|
161
|
+
/* @__PURE__ */ jsx(Panel, { title: "Antenatal symptoms", children: /* @__PURE__ */ jsx(
|
|
162
|
+
ChipRow,
|
|
163
|
+
{
|
|
164
|
+
options: [
|
|
165
|
+
{ key: "nauseaVomiting", label: "Nausea / vomiting" },
|
|
166
|
+
{ key: "bleedingPV", label: "Bleeding PV" },
|
|
167
|
+
{ key: "painAbdomen", label: "Pain abdomen" },
|
|
168
|
+
{ key: "decreasedFetalMovements", label: "Decreased fetal movements" }
|
|
169
|
+
],
|
|
170
|
+
selected: a.symptoms,
|
|
171
|
+
onToggle: (k) => setAntenatalSymptom(k),
|
|
172
|
+
disabled
|
|
173
|
+
}
|
|
174
|
+
) }),
|
|
175
|
+
/* @__PURE__ */ jsx(Panel, { title: "Antenatal examination", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-4", children: [
|
|
176
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
177
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Weight (kg)" }),
|
|
178
|
+
/* @__PURE__ */ jsx(
|
|
179
|
+
Input,
|
|
180
|
+
{
|
|
181
|
+
type: "number",
|
|
182
|
+
className: "h-8 text-xs",
|
|
183
|
+
value: a.exam.weightKg,
|
|
184
|
+
onChange: (e) => setAntenatalExam({ weightKg: Number(e.target.value) || 0 }),
|
|
185
|
+
disabled
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
] }),
|
|
189
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
190
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Height (cm)" }),
|
|
191
|
+
/* @__PURE__ */ jsx(
|
|
192
|
+
Input,
|
|
193
|
+
{
|
|
194
|
+
type: "number",
|
|
195
|
+
className: "h-8 text-xs",
|
|
196
|
+
value: a.exam.heightCm,
|
|
197
|
+
onChange: (e) => setAntenatalExam({ heightCm: Number(e.target.value) || 0 }),
|
|
198
|
+
disabled
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
] }),
|
|
202
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
203
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "BMI" }),
|
|
204
|
+
/* @__PURE__ */ jsx(
|
|
205
|
+
Input,
|
|
206
|
+
{
|
|
207
|
+
type: "number",
|
|
208
|
+
step: 0.1,
|
|
209
|
+
className: "h-8 text-xs",
|
|
210
|
+
value: a.exam.bmi,
|
|
211
|
+
onChange: (e) => setAntenatalExam({ bmi: Number(e.target.value) || 0 }),
|
|
212
|
+
disabled
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
] }),
|
|
216
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
217
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "BP" }),
|
|
218
|
+
/* @__PURE__ */ jsx(
|
|
219
|
+
Input,
|
|
220
|
+
{
|
|
221
|
+
placeholder: "e.g. 120/80",
|
|
222
|
+
className: "h-8 text-xs",
|
|
223
|
+
value: a.exam.bp,
|
|
224
|
+
onChange: (e) => setAntenatalExam({ bp: e.target.value }),
|
|
225
|
+
disabled
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
] }),
|
|
229
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-end gap-2 pb-1", children: [
|
|
230
|
+
/* @__PURE__ */ jsx(
|
|
231
|
+
Checkbox,
|
|
232
|
+
{
|
|
233
|
+
checked: a.exam.pallor,
|
|
234
|
+
onCheckedChange: (c) => setAntenatalExam({ pallor: c === true }),
|
|
235
|
+
disabled
|
|
236
|
+
}
|
|
237
|
+
),
|
|
238
|
+
/* @__PURE__ */ jsx("span", { children: "Pallor" })
|
|
239
|
+
] }),
|
|
240
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-end gap-2 pb-1", children: [
|
|
241
|
+
/* @__PURE__ */ jsx(
|
|
242
|
+
Checkbox,
|
|
243
|
+
{
|
|
244
|
+
checked: a.exam.oedema,
|
|
245
|
+
onCheckedChange: (c) => setAntenatalExam({ oedema: c === true }),
|
|
246
|
+
disabled
|
|
247
|
+
}
|
|
248
|
+
),
|
|
249
|
+
/* @__PURE__ */ jsx("span", { children: "Oedema" })
|
|
250
|
+
] }),
|
|
251
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
252
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Fundal height (cm)" }),
|
|
253
|
+
/* @__PURE__ */ jsx(
|
|
254
|
+
Input,
|
|
255
|
+
{
|
|
256
|
+
type: "number",
|
|
257
|
+
className: "h-8 text-xs",
|
|
258
|
+
value: a.exam.fundalHeightCm,
|
|
259
|
+
onChange: (e) => setAntenatalExam({ fundalHeightCm: Number(e.target.value) || 0 }),
|
|
260
|
+
disabled
|
|
261
|
+
}
|
|
262
|
+
)
|
|
263
|
+
] }),
|
|
264
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
265
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "FHR (bpm)" }),
|
|
266
|
+
/* @__PURE__ */ jsx(
|
|
267
|
+
Input,
|
|
268
|
+
{
|
|
269
|
+
type: "number",
|
|
270
|
+
className: "h-8 text-xs",
|
|
271
|
+
value: a.exam.fhrBpm,
|
|
272
|
+
onChange: (e) => setAntenatalExam({ fhrBpm: Number(e.target.value) || 0 }),
|
|
273
|
+
disabled
|
|
274
|
+
}
|
|
275
|
+
)
|
|
276
|
+
] }),
|
|
277
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
278
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Presentation" }),
|
|
279
|
+
/* @__PURE__ */ jsxs(
|
|
280
|
+
Select,
|
|
281
|
+
{
|
|
282
|
+
value: a.exam.presentation === "" ? "none" : a.exam.presentation,
|
|
283
|
+
onValueChange: (v) => setAntenatalExam({
|
|
284
|
+
presentation: v === "none" ? "" : v
|
|
285
|
+
}),
|
|
286
|
+
disabled,
|
|
287
|
+
children: [
|
|
288
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
289
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
290
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
291
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Cephalic", children: "Cephalic" }),
|
|
292
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Breech", children: "Breech" }),
|
|
293
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Other", children: "Other" })
|
|
294
|
+
] })
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
] }),
|
|
299
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
300
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Lie" }),
|
|
301
|
+
/* @__PURE__ */ jsxs(
|
|
302
|
+
Select,
|
|
303
|
+
{
|
|
304
|
+
value: a.exam.lie === "" ? "none" : a.exam.lie,
|
|
305
|
+
onValueChange: (v) => setAntenatalExam({ lie: v === "none" ? "" : v }),
|
|
306
|
+
disabled,
|
|
307
|
+
children: [
|
|
308
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
309
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
310
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
311
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Longitudinal", children: "Longitudinal" }),
|
|
312
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Transverse", children: "Transverse" }),
|
|
313
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Oblique", children: "Oblique" })
|
|
314
|
+
] })
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
)
|
|
318
|
+
] })
|
|
319
|
+
] }) }),
|
|
320
|
+
/* @__PURE__ */ jsx(Panel, { title: "Investigations tracker", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-3", children: [
|
|
321
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
322
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "Blood Group / Rh" }),
|
|
323
|
+
/* @__PURE__ */ jsx(
|
|
324
|
+
Input,
|
|
325
|
+
{
|
|
326
|
+
className: "h-8 text-xs",
|
|
327
|
+
placeholder: "e.g. O+ve",
|
|
328
|
+
value: a.investigations.bloodGroup,
|
|
329
|
+
onChange: (e) => setAntenatalInv({ bloodGroup: e.target.value }),
|
|
330
|
+
disabled
|
|
331
|
+
}
|
|
332
|
+
)
|
|
333
|
+
] }),
|
|
334
|
+
[
|
|
335
|
+
{ key: "cbc", label: "CBC" },
|
|
336
|
+
{ key: "tsh", label: "TSH" },
|
|
337
|
+
{ key: "rbsOgtt", label: "RBS / OGTT" },
|
|
338
|
+
{ key: "serology", label: "HIV / HBsAg / VDRL" },
|
|
339
|
+
{ key: "urine", label: "Urine routine" }
|
|
340
|
+
].map((row) => /* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
341
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: row.label }),
|
|
342
|
+
/* @__PURE__ */ jsxs(
|
|
343
|
+
Select,
|
|
344
|
+
{
|
|
345
|
+
value: a.investigations[row.key] === "" ? "none" : a.investigations[row.key],
|
|
346
|
+
onValueChange: (v) => setAntenatalInv({
|
|
347
|
+
[row.key]: v === "none" ? "" : v
|
|
348
|
+
}),
|
|
349
|
+
disabled,
|
|
350
|
+
children: [
|
|
351
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
352
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
353
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
354
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Done", children: "Done" }),
|
|
355
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Pending", children: "Pending" }),
|
|
356
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Abnormal", children: "Abnormal" })
|
|
357
|
+
] })
|
|
358
|
+
]
|
|
359
|
+
}
|
|
360
|
+
)
|
|
361
|
+
] }, row.key)),
|
|
362
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
363
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: "USG" }),
|
|
364
|
+
/* @__PURE__ */ jsxs(
|
|
365
|
+
Select,
|
|
366
|
+
{
|
|
367
|
+
value: a.investigations.usg === "" ? "none" : a.investigations.usg,
|
|
368
|
+
onValueChange: (v) => setAntenatalInv({
|
|
369
|
+
usg: v === "none" ? "" : v
|
|
370
|
+
}),
|
|
371
|
+
disabled,
|
|
372
|
+
children: [
|
|
373
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "\u2014" }) }),
|
|
374
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
375
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
376
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Dating", children: "Dating" }),
|
|
377
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "NT", children: "NT" }),
|
|
378
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Anomaly", children: "Anomaly" }),
|
|
379
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Growth", children: "Growth" }),
|
|
380
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "Pending", children: "Pending" })
|
|
381
|
+
] })
|
|
382
|
+
]
|
|
383
|
+
}
|
|
384
|
+
)
|
|
385
|
+
] })
|
|
386
|
+
] }) })
|
|
387
|
+
] });
|
|
388
|
+
};
|
|
389
|
+
var DEFAULT_MENSTRUAL = {
|
|
390
|
+
menarche_age: 13,
|
|
391
|
+
cycle_length: 28,
|
|
392
|
+
flow_days: 4,
|
|
393
|
+
cycle_regular: true,
|
|
394
|
+
dysmenorrhea: 0
|
|
395
|
+
};
|
|
396
|
+
var DEFAULT_DRAFT = {
|
|
397
|
+
gpal: { G: 0, P: 0, A: 0, L: 0 },
|
|
398
|
+
lmp: "",
|
|
399
|
+
pregnancy_status: "not_pregnant",
|
|
400
|
+
eddUSG: "",
|
|
401
|
+
primaryEDD: "lmp",
|
|
402
|
+
complications: "",
|
|
403
|
+
outcome: null,
|
|
404
|
+
menstrual: { ...DEFAULT_MENSTRUAL }
|
|
405
|
+
};
|
|
406
|
+
function pad2(n) {
|
|
407
|
+
return String(n).padStart(2, "0");
|
|
408
|
+
}
|
|
409
|
+
function formatDdMmYyyy(iso) {
|
|
410
|
+
const [y, m, d] = iso.split("-");
|
|
411
|
+
if (!y || !m || !d) return iso;
|
|
412
|
+
return `${pad2(Number(d))}/${pad2(Number(m))}/${y}`;
|
|
413
|
+
}
|
|
414
|
+
function todayIso() {
|
|
415
|
+
const d = /* @__PURE__ */ new Date();
|
|
416
|
+
const y = d.getFullYear();
|
|
417
|
+
const m = pad2(d.getMonth() + 1);
|
|
418
|
+
const day = pad2(d.getDate());
|
|
419
|
+
return `${y}-${m}-${day}`;
|
|
420
|
+
}
|
|
421
|
+
function isValidIsoDate(val) {
|
|
422
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(val)) return false;
|
|
423
|
+
const dt = /* @__PURE__ */ new Date(`${val}T00:00:00.000Z`);
|
|
424
|
+
return !Number.isNaN(dt.getTime());
|
|
425
|
+
}
|
|
426
|
+
function safeJsonParse(val) {
|
|
427
|
+
try {
|
|
428
|
+
return JSON.parse(val);
|
|
429
|
+
} catch {
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
function clampInt(val, min, max) {
|
|
434
|
+
if (!Number.isFinite(val)) return min;
|
|
435
|
+
return Math.max(min, Math.min(max, Math.trunc(val)));
|
|
436
|
+
}
|
|
437
|
+
function clampDysmenorrhea(val) {
|
|
438
|
+
const n = Math.round(Number(val));
|
|
439
|
+
if (!Number.isFinite(n)) return 0;
|
|
440
|
+
if (n <= 0) return 0;
|
|
441
|
+
if (n >= 3) return 3;
|
|
442
|
+
return n;
|
|
443
|
+
}
|
|
444
|
+
function isPregnancyStatus(x) {
|
|
445
|
+
return x === "not_pregnant" || x === "pregnant" || x === "unknown";
|
|
446
|
+
}
|
|
447
|
+
function normalizeMenstrual(raw) {
|
|
448
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
449
|
+
return { ...DEFAULT_MENSTRUAL };
|
|
450
|
+
}
|
|
451
|
+
const o = raw;
|
|
452
|
+
const num = (v, fb) => {
|
|
453
|
+
const n = Number(v);
|
|
454
|
+
return Number.isFinite(n) ? n : fb;
|
|
455
|
+
};
|
|
456
|
+
return {
|
|
457
|
+
menarche_age: num(o.menarche_age, DEFAULT_MENSTRUAL.menarche_age),
|
|
458
|
+
cycle_length: num(o.cycle_length, DEFAULT_MENSTRUAL.cycle_length),
|
|
459
|
+
flow_days: num(o.flow_days, DEFAULT_MENSTRUAL.flow_days),
|
|
460
|
+
cycle_regular: typeof o.cycle_regular === "boolean" ? o.cycle_regular : DEFAULT_MENSTRUAL.cycle_regular,
|
|
461
|
+
dysmenorrhea: clampDysmenorrhea(o.dysmenorrhea)
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
function parseLegacyString(input) {
|
|
465
|
+
const result = {};
|
|
466
|
+
const gpalMatch = input.match(/G(\d+)\s*P(\d+)\s*A(\d+)\s*L(\d+)/i);
|
|
467
|
+
if (gpalMatch) {
|
|
468
|
+
const [, g, p, a, l] = gpalMatch;
|
|
469
|
+
result.gpal = {
|
|
470
|
+
G: clampInt(Number(g), 0, 20),
|
|
471
|
+
P: clampInt(Number(p), 0, 20),
|
|
472
|
+
A: clampInt(Number(a), 0, 20),
|
|
473
|
+
L: clampInt(Number(l), 0, 20)
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
const lmpMatch = input.match(/LMP:\s*([^\n]+)/i);
|
|
477
|
+
if (lmpMatch?.[1]) result.lmp = lmpMatch[1].trim();
|
|
478
|
+
const eddUsgMatch = input.match(/EDD\s*\(USG\):\s*([^\n]+)/i);
|
|
479
|
+
if (eddUsgMatch?.[1]) result.eddUSG = eddUsgMatch[1].trim();
|
|
480
|
+
const primaryMatch = input.match(/Primary\s*EDD:\s*(lmp|usg)/i);
|
|
481
|
+
if (primaryMatch?.[1]) result.primaryEDD = primaryMatch[1].toLowerCase();
|
|
482
|
+
const compMatch = input.match(/Complications:\s*([^\n]+)/i);
|
|
483
|
+
if (compMatch?.[1]) result.complications = compMatch[1].trim();
|
|
484
|
+
return result;
|
|
485
|
+
}
|
|
486
|
+
function normalizeToDraft(value) {
|
|
487
|
+
if (!value) return { draft: { ...DEFAULT_DRAFT }, isNewEntry: true };
|
|
488
|
+
let parsed = value;
|
|
489
|
+
if (typeof value === "string") {
|
|
490
|
+
const json = safeJsonParse(value);
|
|
491
|
+
parsed = json ?? value;
|
|
492
|
+
}
|
|
493
|
+
const resolvePregnancyStatus = (o) => {
|
|
494
|
+
if (isPregnancyStatus(o?.pregnancy_status)) return o.pregnancy_status;
|
|
495
|
+
if (typeof o?.is_pregnant === "boolean") return o.is_pregnant ? "pregnant" : "not_pregnant";
|
|
496
|
+
return "not_pregnant";
|
|
497
|
+
};
|
|
498
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed) && "gpal" in parsed && parsed.gpal && typeof parsed.gpal === "object") {
|
|
499
|
+
const gpal = parsed.gpal ?? {};
|
|
500
|
+
const edd = parsed.edd ?? null;
|
|
501
|
+
const eddUSG = (edd && typeof edd === "object" ? edd.usg : void 0) ?? parsed.eddUSG ?? "";
|
|
502
|
+
const primaryEDD = (edd && typeof edd === "object" ? edd.primary : void 0) ?? parsed.primaryEDD ?? "lmp";
|
|
503
|
+
const lmp = parsed.lmp ?? "";
|
|
504
|
+
const complications = parsed.complications ?? "";
|
|
505
|
+
const outcome = parsed.outcome ?? null;
|
|
506
|
+
return {
|
|
507
|
+
isNewEntry: false,
|
|
508
|
+
draft: {
|
|
509
|
+
gpal: {
|
|
510
|
+
G: clampInt(Number(gpal.G ?? 0), 0, 20),
|
|
511
|
+
P: clampInt(Number(gpal.P ?? 0), 0, 20),
|
|
512
|
+
A: clampInt(Number(gpal.A ?? 0), 0, 20),
|
|
513
|
+
L: clampInt(Number(gpal.L ?? 0), 0, 20)
|
|
514
|
+
},
|
|
515
|
+
lmp: typeof lmp === "string" ? lmp : "",
|
|
516
|
+
pregnancy_status: resolvePregnancyStatus(parsed),
|
|
517
|
+
eddUSG: typeof eddUSG === "string" ? eddUSG : "",
|
|
518
|
+
primaryEDD: primaryEDD === "usg" ? "usg" : "lmp",
|
|
519
|
+
complications: typeof complications === "string" ? complications : "",
|
|
520
|
+
outcome: outcome && typeof outcome === "object" ? {
|
|
521
|
+
type: outcome.type ?? "",
|
|
522
|
+
date: typeof outcome.date === "string" ? outcome.date : "",
|
|
523
|
+
notes: typeof outcome.notes === "string" ? outcome.notes : "",
|
|
524
|
+
is_final: !!outcome.is_final
|
|
525
|
+
} : null,
|
|
526
|
+
menstrual: normalizeMenstrual(parsed.menstrual)
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
531
|
+
const gpalFromFlat = {
|
|
532
|
+
G: clampInt(Number(parsed.G ?? parsed.g ?? 0), 0, 20),
|
|
533
|
+
P: clampInt(Number(parsed.P ?? parsed.p ?? 0), 0, 20),
|
|
534
|
+
A: clampInt(Number(parsed.A ?? parsed.a ?? 0), 0, 20),
|
|
535
|
+
L: clampInt(Number(parsed.L ?? parsed.l ?? 0), 0, 20)
|
|
536
|
+
};
|
|
537
|
+
return {
|
|
538
|
+
isNewEntry: false,
|
|
539
|
+
draft: {
|
|
540
|
+
...DEFAULT_DRAFT,
|
|
541
|
+
gpal: gpalFromFlat,
|
|
542
|
+
lmp: typeof parsed.lmp === "string" ? parsed.lmp : "",
|
|
543
|
+
eddUSG: typeof parsed.eddUSG === "string" ? parsed.eddUSG : "",
|
|
544
|
+
primaryEDD: parsed.primaryEDD === "usg" ? "usg" : "lmp",
|
|
545
|
+
complications: typeof parsed.complications === "string" ? parsed.complications : "",
|
|
546
|
+
outcome: parsed.outcome && typeof parsed.outcome === "object" ? {
|
|
547
|
+
type: parsed.outcome.type ?? "",
|
|
548
|
+
date: typeof parsed.outcome.date === "string" ? parsed.outcome.date : "",
|
|
549
|
+
notes: typeof parsed.outcome.notes === "string" ? parsed.outcome.notes : "",
|
|
550
|
+
is_final: !!parsed.outcome.is_final
|
|
551
|
+
} : null,
|
|
552
|
+
pregnancy_status: resolvePregnancyStatus(parsed),
|
|
553
|
+
menstrual: normalizeMenstrual(parsed.menstrual)
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
if (typeof parsed === "string") {
|
|
558
|
+
const legacy = parseLegacyString(parsed);
|
|
559
|
+
return { isNewEntry: false, draft: { ...DEFAULT_DRAFT, ...legacy } };
|
|
560
|
+
}
|
|
561
|
+
return { draft: { ...DEFAULT_DRAFT }, isNewEntry: true };
|
|
562
|
+
}
|
|
563
|
+
function computeEddFromLmp(lmpIso) {
|
|
564
|
+
if (!isValidIsoDate(lmpIso)) return null;
|
|
565
|
+
const base = /* @__PURE__ */ new Date(`${lmpIso}T00:00:00.000Z`);
|
|
566
|
+
base.setUTCDate(base.getUTCDate() + 280);
|
|
567
|
+
const y = base.getUTCFullYear();
|
|
568
|
+
const m = pad2(base.getUTCMonth() + 1);
|
|
569
|
+
const d = pad2(base.getUTCDate());
|
|
570
|
+
return `${y}-${m}-${d}`;
|
|
571
|
+
}
|
|
572
|
+
function diffDaysUtc(fromIso, toIso) {
|
|
573
|
+
if (!isValidIsoDate(fromIso) || !isValidIsoDate(toIso)) return null;
|
|
574
|
+
const a = (/* @__PURE__ */ new Date(`${fromIso}T00:00:00.000Z`)).getTime();
|
|
575
|
+
const b = (/* @__PURE__ */ new Date(`${toIso}T00:00:00.000Z`)).getTime();
|
|
576
|
+
return Math.floor((b - a) / (1e3 * 60 * 60 * 24));
|
|
577
|
+
}
|
|
578
|
+
function computeGestationalAgeFromLmp(lmpIso, today) {
|
|
579
|
+
const days = diffDaysUtc(lmpIso, today);
|
|
580
|
+
if (days == null || days < 0) return null;
|
|
581
|
+
const weeks = Math.floor(days / 7);
|
|
582
|
+
const rem = days % 7;
|
|
583
|
+
return { weeks, days: rem, totalDays: days, basedOn: "lmp" };
|
|
584
|
+
}
|
|
585
|
+
function computeGestationalAgeFromUsgEdd(eddUsgIso, today) {
|
|
586
|
+
const daysToEdd = diffDaysUtc(today, eddUsgIso);
|
|
587
|
+
if (daysToEdd == null) return null;
|
|
588
|
+
const daysElapsed = 280 - daysToEdd;
|
|
589
|
+
if (daysElapsed < 0) return null;
|
|
590
|
+
const weeks = Math.floor(daysElapsed / 7);
|
|
591
|
+
const rem = daysElapsed % 7;
|
|
592
|
+
return { weeks, days: rem, totalDays: daysElapsed, basedOn: "usg" };
|
|
593
|
+
}
|
|
594
|
+
function computeTrimester(ga) {
|
|
595
|
+
if (!ga) return null;
|
|
596
|
+
if (ga.weeks < 13) return 1;
|
|
597
|
+
if (ga.weeks < 27) return 2;
|
|
598
|
+
if (ga.weeks < 42) return 3;
|
|
599
|
+
return null;
|
|
600
|
+
}
|
|
601
|
+
function buildStored(draft, today) {
|
|
602
|
+
const lmpIso = isValidIsoDate(draft.lmp) ? draft.lmp : null;
|
|
603
|
+
const eddUsgIso = isValidIsoDate(draft.eddUSG) ? draft.eddUSG : null;
|
|
604
|
+
if (draft.pregnancy_status !== "pregnant") {
|
|
605
|
+
return {
|
|
606
|
+
gpal: draft.gpal,
|
|
607
|
+
lmp: lmpIso,
|
|
608
|
+
is_pregnant: false,
|
|
609
|
+
pregnancy_status: draft.pregnancy_status,
|
|
610
|
+
edd: null,
|
|
611
|
+
gestationalAge: null,
|
|
612
|
+
trimester: null,
|
|
613
|
+
complications: draft.complications.trim() ? draft.complications : null,
|
|
614
|
+
outcome: draft.outcome,
|
|
615
|
+
menstrual: { ...draft.menstrual }
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
const eddFromLmp = lmpIso ? computeEddFromLmp(lmpIso) : null;
|
|
619
|
+
const gaFromLmp = lmpIso ? computeGestationalAgeFromLmp(lmpIso, today) : null;
|
|
620
|
+
const gaFromUsg = eddUsgIso ? computeGestationalAgeFromUsgEdd(eddUsgIso, today) : null;
|
|
621
|
+
const primary = draft.primaryEDD;
|
|
622
|
+
const gaPrimary = primary === "usg" && gaFromUsg ? gaFromUsg : gaFromLmp ? gaFromLmp : null;
|
|
623
|
+
return {
|
|
624
|
+
gpal: draft.gpal,
|
|
625
|
+
lmp: lmpIso,
|
|
626
|
+
is_pregnant: true,
|
|
627
|
+
pregnancy_status: "pregnant",
|
|
628
|
+
edd: { lmp: eddFromLmp, usg: eddUsgIso, primary },
|
|
629
|
+
gestationalAge: gaPrimary,
|
|
630
|
+
trimester: computeTrimester(gaPrimary),
|
|
631
|
+
complications: draft.complications.trim() ? draft.complications : null,
|
|
632
|
+
outcome: draft.outcome,
|
|
633
|
+
menstrual: { ...draft.menstrual }
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
function stripGpalSuffix(label) {
|
|
637
|
+
return label.replace(/\s*\(G-P-A-L\)\s*$/i, "").trim();
|
|
638
|
+
}
|
|
639
|
+
function useDebouncedCommit(commit, delayMs) {
|
|
640
|
+
const timeoutRef = useRef(null);
|
|
641
|
+
const latestCommit = useRef(commit);
|
|
642
|
+
latestCommit.current = commit;
|
|
643
|
+
useEffect(() => {
|
|
644
|
+
return () => {
|
|
645
|
+
if (timeoutRef.current != null) window.clearTimeout(timeoutRef.current);
|
|
646
|
+
};
|
|
647
|
+
}, []);
|
|
648
|
+
return (next) => {
|
|
649
|
+
if (timeoutRef.current != null) window.clearTimeout(timeoutRef.current);
|
|
650
|
+
timeoutRef.current = window.setTimeout(() => latestCommit.current(next), delayMs);
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
var ObstetricHistoryWidget = ({ fieldId }) => {
|
|
654
|
+
const { fieldDef, value, setValue, disabled } = useField(fieldId);
|
|
655
|
+
const [{ draft, isNewEntry }, setDraftState] = useState(() => normalizeToDraft(value));
|
|
656
|
+
const [lmpError, setLmpError] = useState(null);
|
|
657
|
+
const [primaryEddError, setPrimaryEddError] = useState(null);
|
|
658
|
+
const [activeGpalKey, setActiveGpalKey] = useState(null);
|
|
659
|
+
const refs = {
|
|
660
|
+
G: useRef(null),
|
|
661
|
+
P: useRef(null),
|
|
662
|
+
A: useRef(null),
|
|
663
|
+
L: useRef(null)
|
|
664
|
+
};
|
|
665
|
+
const today = useMemo(() => todayIso(), []);
|
|
666
|
+
useEffect(() => {
|
|
667
|
+
const next = normalizeToDraft(value);
|
|
668
|
+
const currStr = JSON.stringify(buildStored(draft, today));
|
|
669
|
+
const nextStr = JSON.stringify(buildStored(next.draft, today));
|
|
670
|
+
if (currStr !== nextStr) setDraftState(next);
|
|
671
|
+
}, [value]);
|
|
672
|
+
const commitImmediate = (nextDraft) => {
|
|
673
|
+
const stored = buildStored(nextDraft, today);
|
|
674
|
+
setValue(JSON.stringify(stored));
|
|
675
|
+
};
|
|
676
|
+
const commitDebounced = useDebouncedCommit(commitImmediate, 500);
|
|
677
|
+
const storedComputed = useMemo(() => buildStored(draft, today), [draft, today]);
|
|
678
|
+
const isPregnant = draft.pregnancy_status === "pregnant";
|
|
679
|
+
const rightPanelEnabled = isPregnant && (!!storedComputed.lmp || !!storedComputed.edd?.usg);
|
|
680
|
+
const headerLabel = fieldDef?.label ? stripGpalSuffix(fieldDef.label) : "Obstetric History";
|
|
681
|
+
const setDraft = (updater, persist) => {
|
|
682
|
+
setDraftState((prev) => {
|
|
683
|
+
const nextDraft = updater(prev.draft);
|
|
684
|
+
const nextState = { ...prev, draft: nextDraft };
|
|
685
|
+
if (persist === "immediate") commitImmediate(nextDraft);
|
|
686
|
+
else commitDebounced(nextDraft);
|
|
687
|
+
return nextState;
|
|
688
|
+
});
|
|
689
|
+
};
|
|
690
|
+
const sanitizeGpalInput = (raw) => {
|
|
691
|
+
const digits = raw.replace(/[^\d]/g, "").slice(0, 2);
|
|
692
|
+
if (!digits) return 0;
|
|
693
|
+
return clampInt(Number(digits), 0, 20);
|
|
694
|
+
};
|
|
695
|
+
const handleGpalChange = (key, raw) => {
|
|
696
|
+
const prevWasEmpty = draft.gpal[key] === 0 && activeGpalKey === key;
|
|
697
|
+
const val = sanitizeGpalInput(raw);
|
|
698
|
+
setDraft((prev) => ({ ...prev, gpal: { ...prev.gpal, [key]: val } }), "debounce");
|
|
699
|
+
const digitsOnly = raw.replace(/[^\d]/g, "");
|
|
700
|
+
const shouldAutoTab = digitsOnly.length === 1 && (prevWasEmpty || String(draft.gpal[key]).length >= 1);
|
|
701
|
+
if (shouldAutoTab) {
|
|
702
|
+
const order = ["G", "P", "A", "L"];
|
|
703
|
+
const idx = order.indexOf(key);
|
|
704
|
+
const nextKey = order[idx + 1];
|
|
705
|
+
if (nextKey) refs[nextKey].current?.focus();
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
const handleLmpChange = (nextIso) => {
|
|
709
|
+
setPrimaryEddError(null);
|
|
710
|
+
if (nextIso && nextIso > today) {
|
|
711
|
+
setLmpError("LMP cannot be in the future");
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
setLmpError(null);
|
|
715
|
+
setDraft((prev) => ({ ...prev, lmp: nextIso }), "debounce");
|
|
716
|
+
};
|
|
717
|
+
const handlePregStatus = (status) => {
|
|
718
|
+
setLmpError(null);
|
|
719
|
+
setPrimaryEddError(null);
|
|
720
|
+
setDraft((prev) => ({ ...prev, pregnancy_status: status }), "immediate");
|
|
721
|
+
};
|
|
722
|
+
const setMenstrualPatch = (patch) => {
|
|
723
|
+
setDraft((prev) => ({ ...prev, menstrual: { ...prev.menstrual, ...patch } }), "debounce");
|
|
724
|
+
};
|
|
725
|
+
const handleEddUsgChange = (nextIso) => {
|
|
726
|
+
setPrimaryEddError(null);
|
|
727
|
+
setDraft((prev) => ({ ...prev, eddUSG: nextIso }), "debounce");
|
|
728
|
+
};
|
|
729
|
+
const handlePrimaryEdd = (next) => {
|
|
730
|
+
if (next === "usg" && !isValidIsoDate(draft.eddUSG)) {
|
|
731
|
+
setPrimaryEddError("Please enter EDD from USG first");
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
setPrimaryEddError(null);
|
|
735
|
+
setDraft((prev) => ({ ...prev, primaryEDD: next }), "immediate");
|
|
736
|
+
};
|
|
737
|
+
const ensureOutcome = () => {
|
|
738
|
+
if (draft.outcome) return;
|
|
739
|
+
setDraft(
|
|
740
|
+
(prev) => ({
|
|
741
|
+
...prev,
|
|
742
|
+
outcome: { type: "", date: "", notes: "", is_final: false }
|
|
743
|
+
}),
|
|
744
|
+
"immediate"
|
|
745
|
+
);
|
|
746
|
+
};
|
|
747
|
+
const clearOutcome = () => {
|
|
748
|
+
setDraft((prev) => ({ ...prev, outcome: null }), "immediate");
|
|
749
|
+
};
|
|
750
|
+
const updateOutcomeImmediate = (updater) => {
|
|
751
|
+
setDraft(
|
|
752
|
+
(prev) => {
|
|
753
|
+
const o = prev.outcome ?? { type: "", date: "", notes: "", is_final: false };
|
|
754
|
+
return { ...prev, outcome: updater(o) };
|
|
755
|
+
},
|
|
756
|
+
"immediate"
|
|
757
|
+
);
|
|
758
|
+
};
|
|
759
|
+
const updateOutcomeNotesDebounced = (notes) => {
|
|
760
|
+
setDraft(
|
|
761
|
+
(prev) => {
|
|
762
|
+
const o = prev.outcome ?? { type: "", date: "", notes: "", is_final: false };
|
|
763
|
+
return { ...prev, outcome: { ...o, notes } };
|
|
764
|
+
},
|
|
765
|
+
"debounce"
|
|
766
|
+
);
|
|
767
|
+
};
|
|
768
|
+
return /* @__PURE__ */ jsxs(Card, { className: cn("w-full", disabled && "opacity-70 pointer-events-none"), children: [
|
|
769
|
+
/* @__PURE__ */ jsx(CardHeader, { className: "pb-3", children: /* @__PURE__ */ jsx(CardTitle, { className: "text-base font-semibold", children: headerLabel }) }),
|
|
770
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "space-y-4", children: [
|
|
771
|
+
isNewEntry && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-blue-200 bg-blue-50 px-3 py-2 text-xs text-blue-900", children: "No previous maternity episode found. Please fill obstetric details to start tracking." }),
|
|
772
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 items-start", children: [
|
|
773
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
774
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-white p-4", children: [
|
|
775
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs font-medium text-muted-foreground mb-2", children: "G-P-A-L" }),
|
|
776
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-4 gap-3", children: ["G", "P", "A", "L"].map((k) => /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
777
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `${fieldId}-gpal-${k}`, className: "text-[11px] text-muted-foreground", children: k }),
|
|
778
|
+
/* @__PURE__ */ jsx(
|
|
779
|
+
Input,
|
|
780
|
+
{
|
|
781
|
+
ref: refs[k],
|
|
782
|
+
id: `${fieldId}-gpal-${k}`,
|
|
783
|
+
inputMode: "numeric",
|
|
784
|
+
pattern: "\\d*",
|
|
785
|
+
maxLength: 2,
|
|
786
|
+
value: String(draft.gpal[k] ?? 0),
|
|
787
|
+
onFocus: () => {
|
|
788
|
+
setActiveGpalKey(k);
|
|
789
|
+
const el = refs[k].current;
|
|
790
|
+
if (el) el.select();
|
|
791
|
+
},
|
|
792
|
+
onChange: (e) => handleGpalChange(k, e.target.value),
|
|
793
|
+
onKeyDown: (e) => {
|
|
794
|
+
const allowed = ["Backspace", "Delete", "ArrowLeft", "ArrowRight", "Tab", "Home", "End"];
|
|
795
|
+
if (allowed.includes(e.key)) return;
|
|
796
|
+
if (/^\d$/.test(e.key)) return;
|
|
797
|
+
e.preventDefault();
|
|
798
|
+
},
|
|
799
|
+
className: "text-center text-base"
|
|
800
|
+
}
|
|
801
|
+
)
|
|
802
|
+
] }, k)) })
|
|
803
|
+
] }),
|
|
804
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-3", children: [
|
|
805
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2 rounded-lg border bg-white p-4", children: [
|
|
806
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `${fieldId}-lmp`, className: cn("text-sm", lmpError && "text-red-600"), children: "Last Menstrual Period (LMP)" }),
|
|
807
|
+
/* @__PURE__ */ jsx(
|
|
808
|
+
Input,
|
|
809
|
+
{
|
|
810
|
+
id: `${fieldId}-lmp`,
|
|
811
|
+
type: "date",
|
|
812
|
+
max: today,
|
|
813
|
+
value: draft.lmp,
|
|
814
|
+
onChange: (e) => handleLmpChange(e.target.value),
|
|
815
|
+
className: cn(lmpError && "border-red-500")
|
|
816
|
+
}
|
|
817
|
+
),
|
|
818
|
+
lmpError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-600", children: lmpError })
|
|
819
|
+
] }),
|
|
820
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2 rounded-lg border bg-white p-4 min-w-0", children: [
|
|
821
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: "Pregnancy Status" }),
|
|
822
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-wrap gap-2", children: [
|
|
823
|
+
/* @__PURE__ */ jsx(
|
|
824
|
+
"button",
|
|
825
|
+
{
|
|
826
|
+
type: "button",
|
|
827
|
+
onClick: () => handlePregStatus("not_pregnant"),
|
|
828
|
+
className: cn(
|
|
829
|
+
"shrink-0 rounded-full border px-3 py-1.5 text-[11px] font-medium transition-colors",
|
|
830
|
+
draft.pregnancy_status === "not_pregnant" ? "border-green-600 bg-green-600 text-white" : "border-slate-300 bg-white text-slate-700 hover:bg-slate-50"
|
|
831
|
+
),
|
|
832
|
+
children: "Not Pregnant"
|
|
833
|
+
}
|
|
834
|
+
),
|
|
835
|
+
/* @__PURE__ */ jsx(
|
|
836
|
+
"button",
|
|
837
|
+
{
|
|
838
|
+
type: "button",
|
|
839
|
+
onClick: () => handlePregStatus("pregnant"),
|
|
840
|
+
className: cn(
|
|
841
|
+
"shrink-0 rounded-full border px-3 py-1.5 text-[11px] font-medium transition-colors",
|
|
842
|
+
draft.pregnancy_status === "pregnant" ? "border-green-600 bg-green-600 text-white" : "border-slate-300 bg-white text-slate-700 hover:bg-slate-50"
|
|
843
|
+
),
|
|
844
|
+
children: "Pregnant"
|
|
845
|
+
}
|
|
846
|
+
),
|
|
847
|
+
/* @__PURE__ */ jsx(
|
|
848
|
+
"button",
|
|
849
|
+
{
|
|
850
|
+
type: "button",
|
|
851
|
+
onClick: () => handlePregStatus("unknown"),
|
|
852
|
+
className: cn(
|
|
853
|
+
"shrink-0 rounded-full border px-3 py-1.5 text-[11px] font-medium transition-colors",
|
|
854
|
+
draft.pregnancy_status === "unknown" ? "border-amber-500 bg-amber-500 text-white" : "border-slate-300 bg-white text-slate-700 hover:bg-slate-50"
|
|
855
|
+
),
|
|
856
|
+
children: "Unknown"
|
|
857
|
+
}
|
|
858
|
+
)
|
|
859
|
+
] })
|
|
860
|
+
] })
|
|
861
|
+
] }),
|
|
862
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-white p-4", children: [
|
|
863
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs font-medium text-muted-foreground mb-3", children: "Menstrual" }),
|
|
864
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 sm:grid-cols-4", children: [
|
|
865
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
866
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `${fieldId}-menarche`, className: "text-[11px] text-muted-foreground", children: "Menarche (age)" }),
|
|
867
|
+
/* @__PURE__ */ jsx(
|
|
868
|
+
Input,
|
|
869
|
+
{
|
|
870
|
+
id: `${fieldId}-menarche`,
|
|
871
|
+
type: "number",
|
|
872
|
+
min: 5,
|
|
873
|
+
max: 25,
|
|
874
|
+
value: draft.menstrual.menarche_age,
|
|
875
|
+
onChange: (e) => setMenstrualPatch({ menarche_age: Number(e.target.value) || 0 })
|
|
876
|
+
}
|
|
877
|
+
)
|
|
878
|
+
] }),
|
|
879
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
880
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `${fieldId}-cycle-length`, className: "text-[11px] text-muted-foreground", children: "Cycle (days)" }),
|
|
881
|
+
/* @__PURE__ */ jsx(
|
|
882
|
+
Input,
|
|
883
|
+
{
|
|
884
|
+
id: `${fieldId}-cycle-length`,
|
|
885
|
+
type: "number",
|
|
886
|
+
min: 0,
|
|
887
|
+
max: 120,
|
|
888
|
+
value: draft.menstrual.cycle_length,
|
|
889
|
+
onChange: (e) => setMenstrualPatch({ cycle_length: Number(e.target.value) || 0 })
|
|
890
|
+
}
|
|
891
|
+
)
|
|
892
|
+
] }),
|
|
893
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
894
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `${fieldId}-flow-days`, className: "text-[11px] text-muted-foreground", children: "Flow (days)" }),
|
|
895
|
+
/* @__PURE__ */ jsx(
|
|
896
|
+
Input,
|
|
897
|
+
{
|
|
898
|
+
id: `${fieldId}-flow-days`,
|
|
899
|
+
type: "number",
|
|
900
|
+
min: 0,
|
|
901
|
+
max: 30,
|
|
902
|
+
value: draft.menstrual.flow_days,
|
|
903
|
+
onChange: (e) => setMenstrualPatch({ flow_days: Number(e.target.value) || 0 })
|
|
904
|
+
}
|
|
905
|
+
)
|
|
906
|
+
] }),
|
|
907
|
+
/* @__PURE__ */ jsxs("label", { className: "space-y-1", children: [
|
|
908
|
+
/* @__PURE__ */ jsx(Label, { className: "text-[11px] text-muted-foreground", children: "Dysmenorrhea" }),
|
|
909
|
+
/* @__PURE__ */ jsxs(
|
|
910
|
+
"select",
|
|
911
|
+
{
|
|
912
|
+
className: "h-9 w-full rounded-md border border-input bg-background px-2 text-sm",
|
|
913
|
+
value: String(draft.menstrual.dysmenorrhea),
|
|
914
|
+
onChange: (e) => setMenstrualPatch({
|
|
915
|
+
dysmenorrhea: clampDysmenorrhea(Number(e.target.value))
|
|
916
|
+
}),
|
|
917
|
+
children: [
|
|
918
|
+
/* @__PURE__ */ jsx("option", { value: "0", children: "0 \u2014 none" }),
|
|
919
|
+
/* @__PURE__ */ jsx("option", { value: "1", children: "1 \u2014 mild" }),
|
|
920
|
+
/* @__PURE__ */ jsx("option", { value: "2", children: "2 \u2014 moderate" }),
|
|
921
|
+
/* @__PURE__ */ jsx("option", { value: "3", children: "3 \u2014 severe" })
|
|
922
|
+
]
|
|
923
|
+
}
|
|
924
|
+
)
|
|
925
|
+
] })
|
|
926
|
+
] }),
|
|
927
|
+
/* @__PURE__ */ jsxs("label", { className: "mt-3 flex items-center gap-2 text-sm", children: [
|
|
928
|
+
/* @__PURE__ */ jsx(
|
|
929
|
+
"input",
|
|
930
|
+
{
|
|
931
|
+
type: "checkbox",
|
|
932
|
+
checked: draft.menstrual.cycle_regular,
|
|
933
|
+
onChange: (e) => setMenstrualPatch({ cycle_regular: e.target.checked })
|
|
934
|
+
}
|
|
935
|
+
),
|
|
936
|
+
"Regular cycle"
|
|
937
|
+
] })
|
|
938
|
+
] }),
|
|
939
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2 rounded-lg border bg-white p-4", children: [
|
|
940
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `${fieldId}-complications`, className: "text-sm", children: "Previous Pregnancy Complications" }),
|
|
941
|
+
/* @__PURE__ */ jsx(
|
|
942
|
+
Textarea,
|
|
943
|
+
{
|
|
944
|
+
id: `${fieldId}-complications`,
|
|
945
|
+
placeholder: "e.g. Pre-eclampsia, Gestational diabetes, C-section, etc.",
|
|
946
|
+
value: draft.complications,
|
|
947
|
+
onChange: (e) => setDraft((prev) => ({ ...prev, complications: e.target.value }), "debounce"),
|
|
948
|
+
className: "min-h-[140px]"
|
|
949
|
+
}
|
|
950
|
+
)
|
|
951
|
+
] })
|
|
952
|
+
] }),
|
|
953
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-white p-4 min-h-[260px]", children: [
|
|
954
|
+
!isPregnant && /* @__PURE__ */ jsx("div", { className: "h-full flex items-center justify-center text-center text-sm text-muted-foreground px-6 py-10", children: draft.pregnancy_status === "unknown" ? "Pregnancy status unknown \u2014 confirm with UPT/USG to enable gestational age and EDD." : 'Only for "Pregnant Women" and enter LMP to calculate gestational age and EDD' }),
|
|
955
|
+
isPregnant && !rightPanelEnabled && /* @__PURE__ */ jsx("div", { className: "h-full flex items-center justify-center text-center text-sm text-muted-foreground px-6 py-10", children: "Enter LMP and/or EDD (USG) to enable gestational age and EDD calculations." }),
|
|
956
|
+
isPregnant && rightPanelEnabled && /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
957
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border p-4", children: [
|
|
958
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
959
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-semibold text-blue-700", children: "Expected Delivery Date (EDD)" }),
|
|
960
|
+
storedComputed.gestationalAge?.basedOn && /* @__PURE__ */ jsxs("span", { className: "rounded-full bg-blue-100 px-2 py-1 text-[11px] text-blue-700", children: [
|
|
961
|
+
"Based on ",
|
|
962
|
+
storedComputed.gestationalAge.basedOn.toUpperCase()
|
|
963
|
+
] })
|
|
964
|
+
] }),
|
|
965
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-3", children: [
|
|
966
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: "Gestational Age:" }),
|
|
967
|
+
/* @__PURE__ */ jsx("div", { className: "text-lg font-semibold", children: storedComputed.gestationalAge ? `${storedComputed.gestationalAge.weeks} weeks ${storedComputed.gestationalAge.days} days` : "\u2014" }),
|
|
968
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground mt-1", children: storedComputed.trimester ? `Trimester ${storedComputed.trimester}` : "Trimester \u2014" })
|
|
969
|
+
] })
|
|
970
|
+
] }),
|
|
971
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
972
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs text-muted-foreground", children: "EDD (from LMP):" }),
|
|
973
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-md border bg-muted/20 px-3 py-2 text-sm font-semibold", children: storedComputed.edd?.lmp ? formatDdMmYyyy(storedComputed.edd.lmp) : "\u2014" })
|
|
974
|
+
] }),
|
|
975
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
976
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `${fieldId}-edd-usg`, className: "text-sm", children: "EDD (from USG):" }),
|
|
977
|
+
/* @__PURE__ */ jsx(
|
|
978
|
+
Input,
|
|
979
|
+
{
|
|
980
|
+
id: `${fieldId}-edd-usg`,
|
|
981
|
+
type: "date",
|
|
982
|
+
value: draft.eddUSG,
|
|
983
|
+
onChange: (e) => handleEddUsgChange(e.target.value)
|
|
984
|
+
}
|
|
985
|
+
)
|
|
986
|
+
] }),
|
|
987
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
988
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium", children: "Primary EDD:" }),
|
|
989
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
990
|
+
/* @__PURE__ */ jsx(
|
|
991
|
+
"button",
|
|
992
|
+
{
|
|
993
|
+
type: "button",
|
|
994
|
+
onClick: () => handlePrimaryEdd("lmp"),
|
|
995
|
+
className: cn(
|
|
996
|
+
"flex-1 rounded-md border px-3 py-2 text-sm",
|
|
997
|
+
draft.primaryEDD === "lmp" ? "bg-blue-600 text-white border-blue-600" : "bg-white"
|
|
998
|
+
),
|
|
999
|
+
children: "LMP"
|
|
1000
|
+
}
|
|
1001
|
+
),
|
|
1002
|
+
/* @__PURE__ */ jsx(
|
|
1003
|
+
"button",
|
|
1004
|
+
{
|
|
1005
|
+
type: "button",
|
|
1006
|
+
onClick: () => handlePrimaryEdd("usg"),
|
|
1007
|
+
className: cn(
|
|
1008
|
+
"flex-1 rounded-md border px-3 py-2 text-sm",
|
|
1009
|
+
draft.primaryEDD === "usg" ? "bg-blue-600 text-white border-blue-600" : "bg-white"
|
|
1010
|
+
),
|
|
1011
|
+
children: "USG"
|
|
1012
|
+
}
|
|
1013
|
+
)
|
|
1014
|
+
] }),
|
|
1015
|
+
primaryEddError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-600", children: primaryEddError })
|
|
1016
|
+
] })
|
|
1017
|
+
] })
|
|
1018
|
+
] })
|
|
1019
|
+
] }),
|
|
1020
|
+
/* @__PURE__ */ jsx(AntenatalPanels, {}),
|
|
1021
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border bg-yellow-50/60 p-4", children: [
|
|
1022
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1023
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-semibold", children: "Pregnancy Outcome (Optional - To Close Episode)" }),
|
|
1024
|
+
draft.outcome && /* @__PURE__ */ jsx("button", { type: "button", className: "text-sm text-red-600 hover:underline", onClick: clearOutcome, children: "Clear" })
|
|
1025
|
+
] }),
|
|
1026
|
+
!draft.outcome && /* @__PURE__ */ jsx(
|
|
1027
|
+
"button",
|
|
1028
|
+
{
|
|
1029
|
+
type: "button",
|
|
1030
|
+
onClick: ensureOutcome,
|
|
1031
|
+
className: "mt-3 w-full rounded-md border border-yellow-300 bg-yellow-100 px-3 py-2 text-sm font-medium",
|
|
1032
|
+
children: "+ Add Pregnancy Outcome"
|
|
1033
|
+
}
|
|
1034
|
+
),
|
|
1035
|
+
draft.outcome && /* @__PURE__ */ jsxs("div", { className: "mt-4 space-y-3", children: [
|
|
1036
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
1037
|
+
/* @__PURE__ */ jsxs(Label, { className: "text-sm", children: [
|
|
1038
|
+
"Outcome Type ",
|
|
1039
|
+
/* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" })
|
|
1040
|
+
] }),
|
|
1041
|
+
/* @__PURE__ */ jsxs(
|
|
1042
|
+
"select",
|
|
1043
|
+
{
|
|
1044
|
+
className: "w-full rounded-md border px-3 py-2 text-sm bg-white",
|
|
1045
|
+
value: draft.outcome.type,
|
|
1046
|
+
onChange: (e) => updateOutcomeImmediate((o) => ({ ...o, type: e.target.value })),
|
|
1047
|
+
children: [
|
|
1048
|
+
/* @__PURE__ */ jsx("option", { value: "", children: "Select outcome..." }),
|
|
1049
|
+
/* @__PURE__ */ jsx("option", { value: "delivery", children: "Normal Delivery" }),
|
|
1050
|
+
/* @__PURE__ */ jsx("option", { value: "cesarean", children: "Cesarean Section" }),
|
|
1051
|
+
/* @__PURE__ */ jsx("option", { value: "abortion", children: "Abortion" }),
|
|
1052
|
+
/* @__PURE__ */ jsx("option", { value: "miscarriage", children: "Miscarriage" }),
|
|
1053
|
+
/* @__PURE__ */ jsx("option", { value: "stillbirth", children: "Stillbirth" })
|
|
1054
|
+
]
|
|
1055
|
+
}
|
|
1056
|
+
)
|
|
1057
|
+
] }),
|
|
1058
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
1059
|
+
/* @__PURE__ */ jsxs(Label, { htmlFor: `${fieldId}-outcome-date`, className: "text-sm", children: [
|
|
1060
|
+
"Date ",
|
|
1061
|
+
/* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" })
|
|
1062
|
+
] }),
|
|
1063
|
+
/* @__PURE__ */ jsx(
|
|
1064
|
+
Input,
|
|
1065
|
+
{
|
|
1066
|
+
id: `${fieldId}-outcome-date`,
|
|
1067
|
+
type: "date",
|
|
1068
|
+
max: today,
|
|
1069
|
+
value: draft.outcome.date,
|
|
1070
|
+
onChange: (e) => updateOutcomeImmediate((o) => ({ ...o, date: e.target.value }))
|
|
1071
|
+
}
|
|
1072
|
+
),
|
|
1073
|
+
draft.outcome.date && /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
1074
|
+
"Selected: ",
|
|
1075
|
+
formatDdMmYyyy(draft.outcome.date)
|
|
1076
|
+
] })
|
|
1077
|
+
] }),
|
|
1078
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
1079
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `${fieldId}-outcome-notes`, className: "text-sm", children: "Notes" }),
|
|
1080
|
+
/* @__PURE__ */ jsx(
|
|
1081
|
+
Textarea,
|
|
1082
|
+
{
|
|
1083
|
+
id: `${fieldId}-outcome-notes`,
|
|
1084
|
+
placeholder: "e.g. Normal vaginal delivery, healthy baby boy, 3.2kg",
|
|
1085
|
+
value: draft.outcome.notes,
|
|
1086
|
+
onChange: (e) => updateOutcomeNotesDebounced(e.target.value),
|
|
1087
|
+
className: "min-h-[90px]"
|
|
1088
|
+
}
|
|
1089
|
+
)
|
|
1090
|
+
] }),
|
|
1091
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-md border bg-white p-3", children: [
|
|
1092
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-sm", children: [
|
|
1093
|
+
/* @__PURE__ */ jsx(
|
|
1094
|
+
"input",
|
|
1095
|
+
{
|
|
1096
|
+
type: "checkbox",
|
|
1097
|
+
checked: !!draft.outcome.is_final,
|
|
1098
|
+
onChange: (e) => updateOutcomeImmediate((o) => ({ ...o, is_final: e.target.checked }))
|
|
1099
|
+
}
|
|
1100
|
+
),
|
|
1101
|
+
"Close this pregnancy episode"
|
|
1102
|
+
] }),
|
|
1103
|
+
draft.outcome.is_final && /* @__PURE__ */ jsx("div", { className: "mt-3 rounded-md border border-red-300 bg-red-50 px-3 py-2 text-xs text-red-800", children: "Checking this will mark the pregnancy as completed and is intended to close the maternity episode." })
|
|
1104
|
+
] })
|
|
1105
|
+
] })
|
|
1106
|
+
] })
|
|
1107
|
+
] })
|
|
1108
|
+
] });
|
|
1109
|
+
};
|
|
1110
|
+
|
|
1111
|
+
export { ObstetricHistoryWidget };
|
|
1112
|
+
//# sourceMappingURL=ObstetricHistoryWidget-EGVLL4X2.mjs.map
|
|
1113
|
+
//# sourceMappingURL=ObstetricHistoryWidget-EGVLL4X2.mjs.map
|