@mieweb/ui 0.11.0-dev.32 → 0.11.0-dev.34

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 (108) hide show
  1. package/dist/{chunk-PJN4HM2X.cjs → chunk-3O3Q3DX7.cjs} +21 -21
  2. package/dist/{chunk-PJN4HM2X.cjs.map → chunk-3O3Q3DX7.cjs.map} +1 -1
  3. package/dist/{chunk-M42FTWY2.cjs → chunk-46RYJYN2.cjs} +6 -6
  4. package/dist/{chunk-M42FTWY2.cjs.map → chunk-46RYJYN2.cjs.map} +1 -1
  5. package/dist/{chunk-JMAZ2GKT.js → chunk-4GSFVD5V.js} +3 -3
  6. package/dist/{chunk-JMAZ2GKT.js.map → chunk-4GSFVD5V.js.map} +1 -1
  7. package/dist/{chunk-2R3ILG4Y.cjs → chunk-4M2KE4O5.cjs} +7 -7
  8. package/dist/{chunk-2R3ILG4Y.cjs.map → chunk-4M2KE4O5.cjs.map} +1 -1
  9. package/dist/{chunk-L52HKEUD.js → chunk-4SUEBKTY.js} +3 -3
  10. package/dist/{chunk-L52HKEUD.js.map → chunk-4SUEBKTY.js.map} +1 -1
  11. package/dist/{chunk-SCYLVQWA.cjs → chunk-6O6EYKOG.cjs} +130 -874
  12. package/dist/chunk-6O6EYKOG.cjs.map +1 -0
  13. package/dist/{chunk-INMDLVUB.cjs → chunk-6UYMO3PF.cjs} +7 -2
  14. package/dist/chunk-6UYMO3PF.cjs.map +1 -0
  15. package/dist/{chunk-2Z2GFDRS.cjs → chunk-DXNVQQYN.cjs} +4 -4
  16. package/dist/{chunk-2Z2GFDRS.cjs.map → chunk-DXNVQQYN.cjs.map} +1 -1
  17. package/dist/{chunk-JN2CL7MK.js → chunk-EWPNM6OO.js} +25 -5
  18. package/dist/chunk-EWPNM6OO.js.map +1 -0
  19. package/dist/{chunk-JQAGNAY2.js → chunk-EX7Q5545.js} +4 -4
  20. package/dist/{chunk-JQAGNAY2.js.map → chunk-EX7Q5545.js.map} +1 -1
  21. package/dist/{chunk-YG7BR76Y.js → chunk-GMNF4E7B.js} +3 -42
  22. package/dist/chunk-GMNF4E7B.js.map +1 -0
  23. package/dist/chunk-HTZ27DGZ.js +46 -0
  24. package/dist/chunk-HTZ27DGZ.js.map +1 -0
  25. package/dist/{chunk-SNAMNKFH.js → chunk-JEXEFWEM.js} +7 -2
  26. package/dist/chunk-JEXEFWEM.js.map +1 -0
  27. package/dist/{chunk-KIVEYQGA.cjs → chunk-MSX2P5JE.cjs} +2 -48
  28. package/dist/chunk-MSX2P5JE.cjs.map +1 -0
  29. package/dist/{chunk-VV2U36T6.cjs → chunk-MZR634HI.cjs} +9 -9
  30. package/dist/{chunk-VV2U36T6.cjs.map → chunk-MZR634HI.cjs.map} +1 -1
  31. package/dist/{chunk-JCO62XMU.cjs → chunk-NCPDUJKJ.cjs} +43 -26
  32. package/dist/chunk-NCPDUJKJ.cjs.map +1 -0
  33. package/dist/{chunk-DG3CXR24.js → chunk-NW6D6AFL.js} +80 -819
  34. package/dist/chunk-NW6D6AFL.js.map +1 -0
  35. package/dist/{chunk-BP4LXRC6.cjs → chunk-PGJLW2NO.cjs} +7 -7
  36. package/dist/{chunk-BP4LXRC6.cjs.map → chunk-PGJLW2NO.cjs.map} +1 -1
  37. package/dist/chunk-PHYQSCP6.cjs +54 -0
  38. package/dist/chunk-PHYQSCP6.cjs.map +1 -0
  39. package/dist/{chunk-ZFJJMDV3.js → chunk-RTADGBBN.js} +3 -3
  40. package/dist/{chunk-ZFJJMDV3.js.map → chunk-RTADGBBN.js.map} +1 -1
  41. package/dist/{chunk-FQUSSPXX.cjs → chunk-S2CJ57BX.cjs} +25 -5
  42. package/dist/chunk-S2CJ57BX.cjs.map +1 -0
  43. package/dist/{chunk-KSQQBFDQ.js → chunk-SPGP252Q.js} +43 -26
  44. package/dist/chunk-SPGP252Q.js.map +1 -0
  45. package/dist/{chunk-67SD6VPF.cjs → chunk-SVC7NPQ6.cjs} +6 -6
  46. package/dist/{chunk-67SD6VPF.cjs.map → chunk-SVC7NPQ6.cjs.map} +1 -1
  47. package/dist/{chunk-TWQSMUE6.js → chunk-VMEVLBI3.js} +46 -38
  48. package/dist/chunk-VMEVLBI3.js.map +1 -0
  49. package/dist/{chunk-QNJEDBIN.js → chunk-X5HLVACK.js} +4 -4
  50. package/dist/{chunk-QNJEDBIN.js.map → chunk-X5HLVACK.js.map} +1 -1
  51. package/dist/{chunk-LC3JL2HB.cjs → chunk-XEHD2HA5.cjs} +46 -38
  52. package/dist/chunk-XEHD2HA5.cjs.map +1 -0
  53. package/dist/{chunk-R3MJKY63.js → chunk-YGSPIDE4.js} +3 -3
  54. package/dist/{chunk-R3MJKY63.js.map → chunk-YGSPIDE4.js.map} +1 -1
  55. package/dist/{chunk-7LKTIZLR.js → chunk-YR45POH2.js} +3 -3
  56. package/dist/{chunk-7LKTIZLR.js.map → chunk-YR45POH2.js.map} +1 -1
  57. package/dist/components/AlertDialog/index.cjs +6 -6
  58. package/dist/components/AlertDialog/index.js +2 -2
  59. package/dist/components/EmailEditor/index.cjs +14 -12
  60. package/dist/components/EmailEditor/index.js +5 -3
  61. package/dist/components/KeyboardShortcutsOverlay/index.cjs +4 -4
  62. package/dist/components/KeyboardShortcutsOverlay/index.js +2 -2
  63. package/dist/components/MediaEditor/index.cjs +7 -7
  64. package/dist/components/MediaEditor/index.js +2 -2
  65. package/dist/components/MediaFeed/index.cjs +3 -3
  66. package/dist/components/MediaFeed/index.js +2 -2
  67. package/dist/components/Modal/index.cjs +9 -9
  68. package/dist/components/Modal/index.js +1 -1
  69. package/dist/components/RichTextEditor/index.cjs +6 -4
  70. package/dist/components/RichTextEditor/index.js +3 -1
  71. package/dist/components/SuperChat/index.cjs +3 -3
  72. package/dist/components/SuperChat/index.js +2 -2
  73. package/dist/components/Textarea/index.cjs +7 -5
  74. package/dist/components/Textarea/index.js +4 -2
  75. package/dist/esheet.cjs +1119 -1393
  76. package/dist/esheet.cjs.map +1 -1
  77. package/dist/esheet.d.cts +211 -4
  78. package/dist/esheet.d.ts +211 -4
  79. package/dist/esheet.js +946 -1239
  80. package/dist/esheet.js.map +1 -1
  81. package/dist/hooks/index.cjs +41 -40
  82. package/dist/hooks/index.js +2 -1
  83. package/dist/index.cjs +1058 -285
  84. package/dist/index.cjs.map +1 -1
  85. package/dist/index.d.cts +6 -2
  86. package/dist/index.d.ts +6 -2
  87. package/dist/index.js +809 -20
  88. package/dist/index.js.map +1 -1
  89. package/dist/{model-NPW2JMHZ.cjs → model-EFXX5JZN.cjs} +18 -18
  90. package/dist/{model-NPW2JMHZ.cjs.map → model-EFXX5JZN.cjs.map} +1 -1
  91. package/dist/{model-SG5H3TCJ.js → model-TAARSYDY.js} +4 -4
  92. package/dist/{model-SG5H3TCJ.js.map → model-TAARSYDY.js.map} +1 -1
  93. package/dist/styles.css +1 -1
  94. package/dist/tailwind-preset.cjs +4 -4
  95. package/dist/tailwind-preset.js +1 -1
  96. package/package.json +1 -1
  97. package/dist/chunk-DG3CXR24.js.map +0 -1
  98. package/dist/chunk-FQUSSPXX.cjs.map +0 -1
  99. package/dist/chunk-INMDLVUB.cjs.map +0 -1
  100. package/dist/chunk-JCO62XMU.cjs.map +0 -1
  101. package/dist/chunk-JN2CL7MK.js.map +0 -1
  102. package/dist/chunk-KIVEYQGA.cjs.map +0 -1
  103. package/dist/chunk-KSQQBFDQ.js.map +0 -1
  104. package/dist/chunk-LC3JL2HB.cjs.map +0 -1
  105. package/dist/chunk-SCYLVQWA.cjs.map +0 -1
  106. package/dist/chunk-SNAMNKFH.js.map +0 -1
  107. package/dist/chunk-TWQSMUE6.js.map +0 -1
  108. package/dist/chunk-YG7BR76Y.js.map +0 -1
@@ -1,26 +1,21 @@
1
1
  'use strict';
2
2
 
3
- var chunkJCO62XMU_cjs = require('./chunk-JCO62XMU.cjs');
3
+ var chunkNCPDUJKJ_cjs = require('./chunk-NCPDUJKJ.cjs');
4
4
  var chunkGLG6UE2H_cjs = require('./chunk-GLG6UE2H.cjs');
5
5
  var chunkG7EQ3JPX_cjs = require('./chunk-G7EQ3JPX.cjs');
6
6
  var chunkAIJAFPGJ_cjs = require('./chunk-AIJAFPGJ.cjs');
7
7
  var chunkPHUTJKHL_cjs = require('./chunk-PHUTJKHL.cjs');
8
- var chunk2Z2GFDRS_cjs = require('./chunk-2Z2GFDRS.cjs');
8
+ var chunkDXNVQQYN_cjs = require('./chunk-DXNVQQYN.cjs');
9
9
  var chunkFSLI5IKP_cjs = require('./chunk-FSLI5IKP.cjs');
10
10
  var chunkUPWIJC6I_cjs = require('./chunk-UPWIJC6I.cjs');
11
11
  var chunkPINIBEIU_cjs = require('./chunk-PINIBEIU.cjs');
12
12
  var chunkMJWFNV3L_cjs = require('./chunk-MJWFNV3L.cjs');
13
13
  var chunk7AECNMYV_cjs = require('./chunk-7AECNMYV.cjs');
14
- var chunkLC3JL2HB_cjs = require('./chunk-LC3JL2HB.cjs');
14
+ var chunkXEHD2HA5_cjs = require('./chunk-XEHD2HA5.cjs');
15
15
  var chunkZ5S5JEJD_cjs = require('./chunk-Z5S5JEJD.cjs');
16
16
  var chunkGF2BE4FB_cjs = require('./chunk-GF2BE4FB.cjs');
17
17
  var chunkCPDNX3LS_cjs = require('./chunk-CPDNX3LS.cjs');
18
- var chunkNNEFAUHV_cjs = require('./chunk-NNEFAUHV.cjs');
19
- var chunkFHY3K6PL_cjs = require('./chunk-FHY3K6PL.cjs');
20
- var chunkFSGEDDF2_cjs = require('./chunk-FSGEDDF2.cjs');
21
- var chunkAOHJILLU_cjs = require('./chunk-AOHJILLU.cjs');
22
18
  var chunkCW75IKA6_cjs = require('./chunk-CW75IKA6.cjs');
23
- var chunkSCV7C55E_cjs = require('./chunk-SCV7C55E.cjs');
24
19
  var chunkL7L5S2HO_cjs = require('./chunk-L7L5S2HO.cjs');
25
20
  var chunkZ3WMDVMR_cjs = require('./chunk-Z3WMDVMR.cjs');
26
21
  var chunk7E46YDOT_cjs = require('./chunk-7E46YDOT.cjs');
@@ -28,8 +23,6 @@ var chunkFSARTLUE_cjs = require('./chunk-FSARTLUE.cjs');
28
23
  var chunkS5RVSXDV_cjs = require('./chunk-S5RVSXDV.cjs');
29
24
  var React4 = require('react');
30
25
  var jsxRuntime = require('react/jsx-runtime');
31
- var reactDom = require('react-dom');
32
- var lucideReact = require('lucide-react');
33
26
 
34
27
  function _interopNamespace(e) {
35
28
  if (e && e.__esModule) return e;
@@ -159,11 +152,11 @@ function AllergyRow({
159
152
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-xs", children: allergy.note })
160
153
  ] }),
161
154
  !readOnly && actions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
162
- chunkJCO62XMU_cjs.RowActionToolbar,
155
+ chunkNCPDUJKJ_cjs.RowActionToolbar,
163
156
  {
164
157
  label: m("Actions for {name}", { name: allergy.allergen }),
165
158
  children: actions.map((action) => /* @__PURE__ */ jsxRuntime.jsx(
166
- chunkJCO62XMU_cjs.RowIconButton,
159
+ chunkNCPDUJKJ_cjs.RowIconButton,
167
160
  {
168
161
  label: m(ACTION_META[action].label),
169
162
  icon: ACTION_META[action].icon,
@@ -301,7 +294,7 @@ var AllergyList = React4__namespace.forwardRef(
301
294
  onClick: onAdd,
302
295
  leftIcon: /* @__PURE__ */ jsxRuntime.jsx(chunkL7L5S2HO_cjs.Plus, { size: 12 }),
303
296
  className: "h-auto rounded-full px-2.5 py-1 text-xs",
304
- children: m("Add allergy\u2026")
297
+ children: m("Add")
305
298
  }
306
299
  )
307
300
  ] })
@@ -359,12 +352,12 @@ function AllergyEditor({
359
352
  const unchangedLegacyAllergen = allergy && !allergy.code && draft.allergen === allergy.allergen && (draft.type ?? "drug") === (allergy.type ?? "drug");
360
353
  const canSave = draft.allergen.trim().length > 0 && (!requireCode || hasCode || Boolean(unchangedLegacyAllergen));
361
354
  const isDrug = (draft.type ?? "drug") === "drug";
362
- return /* @__PURE__ */ jsxRuntime.jsxs(chunkLC3JL2HB_cjs.Modal, { open: true, onOpenChange: (o) => !o && onClose(), size: "md", children: [
363
- /* @__PURE__ */ jsxRuntime.jsxs(chunkLC3JL2HB_cjs.ModalHeader, { children: [
364
- /* @__PURE__ */ jsxRuntime.jsx(chunkLC3JL2HB_cjs.ModalTitle, { children: allergy ? m("Correct Allergy") : m("Add Allergy") }),
365
- /* @__PURE__ */ jsxRuntime.jsx(chunkLC3JL2HB_cjs.ModalClose, { "aria-label": m("Close") })
355
+ return /* @__PURE__ */ jsxRuntime.jsxs(chunkXEHD2HA5_cjs.Modal, { open: true, onOpenChange: (o) => !o && onClose(), size: "md", children: [
356
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkXEHD2HA5_cjs.ModalHeader, { children: [
357
+ /* @__PURE__ */ jsxRuntime.jsx(chunkXEHD2HA5_cjs.ModalTitle, { children: allergy ? m("Correct Allergy") : m("Add Allergy") }),
358
+ /* @__PURE__ */ jsxRuntime.jsx(chunkXEHD2HA5_cjs.ModalClose, { "aria-label": m("Close") })
366
359
  ] }),
367
- /* @__PURE__ */ jsxRuntime.jsx(chunkLC3JL2HB_cjs.ModalBody, { className: "space-y-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: bodyRef, className: "contents", children: [
360
+ /* @__PURE__ */ jsxRuntime.jsx(chunkXEHD2HA5_cjs.ModalBody, { className: "space-y-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: bodyRef, className: "contents", children: [
368
361
  /* @__PURE__ */ jsxRuntime.jsxs(
369
362
  chunkG7EQ3JPX_cjs.RadioGroup,
370
363
  {
@@ -491,7 +484,7 @@ function AllergyEditor({
491
484
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
492
485
  /* @__PURE__ */ jsxRuntime.jsx(chunkAIJAFPGJ_cjs.Label, { htmlFor: "alg-note", children: m("Note") }),
493
486
  /* @__PURE__ */ jsxRuntime.jsx(
494
- chunk2Z2GFDRS_cjs.Textarea,
487
+ chunkDXNVQQYN_cjs.Textarea,
495
488
  {
496
489
  id: "alg-note",
497
490
  value: draft.note ?? "",
@@ -501,7 +494,7 @@ function AllergyEditor({
501
494
  )
502
495
  ] })
503
496
  ] }) }),
504
- /* @__PURE__ */ jsxRuntime.jsxs(chunkLC3JL2HB_cjs.ModalFooter, { children: [
497
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkXEHD2HA5_cjs.ModalFooter, { children: [
505
498
  /* @__PURE__ */ jsxRuntime.jsx(chunkFSARTLUE_cjs.Button, { variant: "secondary", onClick: onClose, children: m("Cancel") }),
506
499
  /* @__PURE__ */ jsxRuntime.jsx(
507
500
  chunkFSARTLUE_cjs.Button,
@@ -571,7 +564,7 @@ function AllergyManager({
571
564
  bare: true,
572
565
  clearOnSelect: true,
573
566
  placeholder: m(
574
- "Search drug allergens to add \u2014 use Add allergy\u2026 for food/environmental"
567
+ "Search drug allergens to add \u2014 use Add for food/environmental"
575
568
  ),
576
569
  onSelect: (result) => {
577
570
  if (requireCode && (!result.codetype.trim() || !result.fullcode.trim()))
@@ -636,17 +629,17 @@ function AllergyManager({
636
629
  },
637
630
  dialog.kind === "correct" ? dialog.allergy.id : "add"
638
631
  ),
639
- dialog?.kind === "note" && /* @__PURE__ */ jsxRuntime.jsxs(chunkLC3JL2HB_cjs.Modal, { open: true, onOpenChange: (o) => !o && setDialog(null), size: "md", children: [
640
- /* @__PURE__ */ jsxRuntime.jsxs(chunkLC3JL2HB_cjs.ModalHeader, { children: [
641
- /* @__PURE__ */ jsxRuntime.jsx(chunkLC3JL2HB_cjs.ModalTitle, { children: m("Allergy Notes") }),
642
- /* @__PURE__ */ jsxRuntime.jsx(chunkLC3JL2HB_cjs.ModalClose, { "aria-label": m("Close") })
632
+ dialog?.kind === "note" && /* @__PURE__ */ jsxRuntime.jsxs(chunkXEHD2HA5_cjs.Modal, { open: true, onOpenChange: (o) => !o && setDialog(null), size: "md", children: [
633
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkXEHD2HA5_cjs.ModalHeader, { children: [
634
+ /* @__PURE__ */ jsxRuntime.jsx(chunkXEHD2HA5_cjs.ModalTitle, { children: m("Allergy Notes") }),
635
+ /* @__PURE__ */ jsxRuntime.jsx(chunkXEHD2HA5_cjs.ModalClose, { "aria-label": m("Close") })
643
636
  ] }),
644
- /* @__PURE__ */ jsxRuntime.jsxs(chunkLC3JL2HB_cjs.ModalBody, { className: "space-y-4", children: [
637
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkXEHD2HA5_cjs.ModalBody, { className: "space-y-4", children: [
645
638
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: dialog.allergy.allergen }),
646
639
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
647
640
  /* @__PURE__ */ jsxRuntime.jsx(chunkAIJAFPGJ_cjs.Label, { htmlFor: "alg-note-dlg", children: m("Note") }),
648
641
  /* @__PURE__ */ jsxRuntime.jsx(
649
- chunk2Z2GFDRS_cjs.Textarea,
642
+ chunkDXNVQQYN_cjs.Textarea,
650
643
  {
651
644
  id: "alg-note-dlg",
652
645
  value: noteDraft,
@@ -656,7 +649,7 @@ function AllergyManager({
656
649
  )
657
650
  ] })
658
651
  ] }),
659
- /* @__PURE__ */ jsxRuntime.jsxs(chunkLC3JL2HB_cjs.ModalFooter, { children: [
652
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkXEHD2HA5_cjs.ModalFooter, { children: [
660
653
  /* @__PURE__ */ jsxRuntime.jsx(chunkFSARTLUE_cjs.Button, { variant: "secondary", onClick: () => setDialog(null), children: m("Cancel") }),
661
654
  /* @__PURE__ */ jsxRuntime.jsx(
662
655
  chunkFSARTLUE_cjs.Button,
@@ -921,13 +914,13 @@ function OrderRow({
921
914
  ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
922
915
  /* @__PURE__ */ jsxRuntime.jsx(OrderContent, { order }),
923
916
  interactive && /* @__PURE__ */ jsxRuntime.jsxs(
924
- chunkJCO62XMU_cjs.RowActionToolbar,
917
+ chunkNCPDUJKJ_cjs.RowActionToolbar,
925
918
  {
926
919
  label: m("Actions for {name}", { name: order.display }),
927
920
  group: "order",
928
921
  children: [
929
922
  canEdit && /* @__PURE__ */ jsxRuntime.jsx(
930
- chunkJCO62XMU_cjs.RowIconButton,
923
+ chunkNCPDUJKJ_cjs.RowIconButton,
931
924
  {
932
925
  label: m("Edit"),
933
926
  icon: chunkL7L5S2HO_cjs.Pencil,
@@ -992,7 +985,7 @@ function OrderRow({
992
985
  }
993
986
  ),
994
987
  controls?.remove && /* @__PURE__ */ jsxRuntime.jsx(
995
- chunkJCO62XMU_cjs.RowIconButton,
988
+ chunkNCPDUJKJ_cjs.RowIconButton,
996
989
  {
997
990
  label: m("Remove"),
998
991
  icon: chunkL7L5S2HO_cjs.Trash2,
@@ -1181,9 +1174,22 @@ var Assessment = React4__namespace.forwardRef(
1181
1174
  const [pendingFreeText, setPendingFreeText] = React4__namespace.useState(
1182
1175
  null
1183
1176
  );
1177
+ const [freeDraft, setFreeDraft] = React4__namespace.useState("");
1184
1178
  React4__namespace.useEffect(() => {
1185
1179
  if (addMode !== "auto") setPendingFreeText(null);
1186
1180
  }, [addMode]);
1181
+ const handleAddFreeText = (text) => {
1182
+ if (addMode === "problem") {
1183
+ onAddAssessment?.({ label: text });
1184
+ } else if (addMode === "order") {
1185
+ onAddOrder?.(null, {
1186
+ type: "procedure",
1187
+ display: text
1188
+ });
1189
+ } else {
1190
+ setPendingFreeText(text);
1191
+ }
1192
+ };
1187
1193
  const [announcement, setAnnouncement] = chunkCPDNX3LS_cjs.useLiveAnnouncement();
1188
1194
  const ambientCodeLookup = useCodeLookupConfig();
1189
1195
  const effectiveRenderOrderSearch = renderOrderSearch === false ? void 0 : renderOrderSearch ?? (ambientCodeLookup ? contextOrderSearch(ambientCodeLookup) : void 0);
@@ -1454,9 +1460,9 @@ var Assessment = React4__namespace.forwardRef(
1454
1460
  ] }),
1455
1461
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground font-medium", children: assertion.text }),
1456
1462
  assertion.verificationStatus !== "confirmed" && /* @__PURE__ */ jsxRuntime.jsx(chunk7E46YDOT_cjs.Badge, { variant: "warning", size: "sm", children: m(assertion.verificationStatus) }),
1457
- /* @__PURE__ */ jsxRuntime.jsx(chunkJCO62XMU_cjs.CodingChips, { coding: assertion.coding }),
1463
+ /* @__PURE__ */ jsxRuntime.jsx(chunkNCPDUJKJ_cjs.CodingChips, { coding: assertion.coding }),
1458
1464
  !readOnly && showConcernToolbar && /* @__PURE__ */ jsxRuntime.jsxs(
1459
- chunkJCO62XMU_cjs.RowActionToolbar,
1465
+ chunkNCPDUJKJ_cjs.RowActionToolbar,
1460
1466
  {
1461
1467
  label: m("Actions for {name}", {
1462
1468
  name: assertion.text
@@ -1472,7 +1478,7 @@ var Assessment = React4__namespace.forwardRef(
1472
1478
  toolbarActions.map((action) => {
1473
1479
  const meta = ACTION_META2[action];
1474
1480
  return /* @__PURE__ */ jsxRuntime.jsx(
1475
- chunkJCO62XMU_cjs.RowIconButton,
1481
+ chunkNCPDUJKJ_cjs.RowIconButton,
1476
1482
  {
1477
1483
  label: m(meta.label),
1478
1484
  icon: meta.icon,
@@ -1493,7 +1499,7 @@ var Assessment = React4__namespace.forwardRef(
1493
1499
  );
1494
1500
  }),
1495
1501
  rowActions.includes("remove") && onRemoveAssessment && /* @__PURE__ */ jsxRuntime.jsx(
1496
- chunkJCO62XMU_cjs.RowIconButton,
1502
+ chunkNCPDUJKJ_cjs.RowIconButton,
1497
1503
  {
1498
1504
  label: m("Remove {name} from assessment", {
1499
1505
  name: assertion.text
@@ -1559,7 +1565,7 @@ var Assessment = React4__namespace.forwardRef(
1559
1565
  item.concernId
1560
1566
  );
1561
1567
  }) }),
1562
- !readOnly && availableAddModes.length > 0 && effectiveRenderOrderSearch && (onAddAssessment || onAddOrder) && /* @__PURE__ */ jsxRuntime.jsxs(
1568
+ !readOnly && availableAddModes.length > 0 && (onAddAssessment || onAddOrder) && /* @__PURE__ */ jsxRuntime.jsxs(
1563
1569
  "div",
1564
1570
  {
1565
1571
  role: "form",
@@ -1588,7 +1594,7 @@ var Assessment = React4__namespace.forwardRef(
1588
1594
  ]
1589
1595
  }
1590
1596
  ),
1591
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-64 flex-1", children: effectiveRenderOrderSearch({
1597
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-64 flex-1", children: effectiveRenderOrderSearch ? effectiveRenderOrderSearch({
1592
1598
  domains: addMode === "problem" ? ["condition", "occupational"] : addMode === "order" ? ["med", "lab", "procedure", "vaccine"] : void 0,
1593
1599
  // auto: everything — the pick decides
1594
1600
  // auto: concerns rank ahead of orders — surveillance
@@ -1625,19 +1631,46 @@ var Assessment = React4__namespace.forwardRef(
1625
1631
  });
1626
1632
  }
1627
1633
  },
1628
- onFreeText: (text) => {
1629
- if (addMode === "problem") {
1630
- onAddAssessment?.({ label: text });
1631
- } else if (addMode === "order") {
1632
- onAddOrder?.(null, {
1633
- type: "procedure",
1634
- display: text
1635
- });
1636
- } else {
1637
- setPendingFreeText(text);
1634
+ onFreeText: handleAddFreeText
1635
+ }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
1636
+ /* @__PURE__ */ jsxRuntime.jsx(
1637
+ "input",
1638
+ {
1639
+ type: "text",
1640
+ "data-slot": "input",
1641
+ value: freeDraft,
1642
+ onChange: (e) => setFreeDraft(e.target.value),
1643
+ onKeyDown: (e) => {
1644
+ if (e.key === "Enter" && freeDraft.trim()) {
1645
+ handleAddFreeText(freeDraft.trim());
1646
+ setFreeDraft("");
1647
+ }
1648
+ },
1649
+ placeholder: m("Type a name and press Enter\u2026"),
1650
+ "aria-label": m("Add as free text"),
1651
+ className: chunkS5RVSXDV_cjs.cn(
1652
+ "border-border bg-background text-foreground placeholder:text-muted-foreground",
1653
+ "h-10 w-full rounded-md border px-2.5 text-sm",
1654
+ "focus:ring-ring focus:ring-2 focus:outline-none"
1655
+ )
1638
1656
  }
1639
- }
1640
- }) }),
1657
+ ),
1658
+ /* @__PURE__ */ jsxRuntime.jsx(
1659
+ chunkFSARTLUE_cjs.Button,
1660
+ {
1661
+ variant: "outline",
1662
+ size: "sm",
1663
+ onClick: () => {
1664
+ handleAddFreeText(freeDraft.trim());
1665
+ setFreeDraft("");
1666
+ },
1667
+ disabled: !freeDraft.trim(),
1668
+ leftIcon: /* @__PURE__ */ jsxRuntime.jsx(chunkL7L5S2HO_cjs.Plus, { size: 12 }),
1669
+ className: "h-10",
1670
+ children: m("Add")
1671
+ }
1672
+ )
1673
+ ] }) }),
1641
1674
  addMode === "auto" && pendingFreeText !== null && /* @__PURE__ */ jsxRuntime.jsxs(
1642
1675
  "div",
1643
1676
  {
@@ -1889,7 +1922,7 @@ function ConditionEditor({
1889
1922
  "data-testid": dataTestId
1890
1923
  }) {
1891
1924
  const m = chunkFSLI5IKP_cjs.useMessages();
1892
- const prior = concern ? chunkJCO62XMU_cjs.currentAssertion(concern) : void 0;
1925
+ const prior = concern ? chunkNCPDUJKJ_cjs.currentAssertion(concern) : void 0;
1893
1926
  const ambientCodeLookup = useCodeLookupConfig();
1894
1927
  const effectiveRenderCodeSearch = renderCodeSearch === false ? void 0 : renderCodeSearch ?? (ambientCodeLookup ? contextConditionCodeSearch(ambientCodeLookup) : void 0);
1895
1928
  const [text, setText] = React4__namespace.useState("");
@@ -1992,18 +2025,18 @@ function ConditionEditor({
1992
2025
  };
1993
2026
  const saveDisabled = mode === "relate" ? !relTarget : mode === "observe" ? !observation.trim() : !text.trim() || hasInvalidOnsetDate;
1994
2027
  return /* @__PURE__ */ jsxRuntime.jsxs(
1995
- chunkLC3JL2HB_cjs.Modal,
2028
+ chunkXEHD2HA5_cjs.Modal,
1996
2029
  {
1997
2030
  open,
1998
2031
  onOpenChange,
1999
2032
  size: "2xl",
2000
2033
  className,
2001
2034
  children: [
2002
- /* @__PURE__ */ jsxRuntime.jsx(chunkLC3JL2HB_cjs.ModalHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkLC3JL2HB_cjs.ModalTitle, { children: [
2035
+ /* @__PURE__ */ jsxRuntime.jsx(chunkXEHD2HA5_cjs.ModalHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(chunkXEHD2HA5_cjs.ModalTitle, { children: [
2003
2036
  m(MODE_META[mode].title),
2004
2037
  prior ? ` \u2014 ${prior.text}` : ""
2005
2038
  ] }) }),
2006
- /* @__PURE__ */ jsxRuntime.jsx(chunkLC3JL2HB_cjs.ModalBody, { "data-testid": dataTestId, className: "space-y-5", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-5", children: [
2039
+ /* @__PURE__ */ jsxRuntime.jsx(chunkXEHD2HA5_cjs.ModalBody, { "data-testid": dataTestId, className: "space-y-5", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-5", children: [
2007
2040
  mode === "revise" && /* @__PURE__ */ jsxRuntime.jsxs(
2008
2041
  "div",
2009
2042
  {
@@ -2037,7 +2070,7 @@ function ConditionEditor({
2037
2070
  placeholder: m("Select a problem\u2026"),
2038
2071
  options: relatableConcerns.filter((c) => c.concernId !== concern?.concernId).map((c) => ({
2039
2072
  value: c.concernId,
2040
- label: chunkJCO62XMU_cjs.currentAssertion(c)?.text ?? c.concernId
2073
+ label: chunkNCPDUJKJ_cjs.currentAssertion(c)?.text ?? c.concernId
2041
2074
  })),
2042
2075
  value: relTarget,
2043
2076
  onValueChange: setRelTarget
@@ -2046,7 +2079,7 @@ function ConditionEditor({
2046
2079
  ] }) : mode === "observe" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2047
2080
  /* @__PURE__ */ jsxRuntime.jsx(ObservationHistory, { concern }),
2048
2081
  /* @__PURE__ */ jsxRuntime.jsx(
2049
- chunk2Z2GFDRS_cjs.Textarea,
2082
+ chunkDXNVQQYN_cjs.Textarea,
2050
2083
  {
2051
2084
  label: m("New observation"),
2052
2085
  value: observation,
@@ -2372,7 +2405,7 @@ function ConditionEditor({
2372
2405
  ] })
2373
2406
  ] }),
2374
2407
  /* @__PURE__ */ jsxRuntime.jsx(
2375
- chunk2Z2GFDRS_cjs.Textarea,
2408
+ chunkDXNVQQYN_cjs.Textarea,
2376
2409
  {
2377
2410
  label: m("Note"),
2378
2411
  value: note,
@@ -2398,7 +2431,7 @@ function ConditionEditor({
2398
2431
  ] })
2399
2432
  ] })
2400
2433
  ] }) }),
2401
- /* @__PURE__ */ jsxRuntime.jsxs(chunkLC3JL2HB_cjs.ModalFooter, { children: [
2434
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkXEHD2HA5_cjs.ModalFooter, { children: [
2402
2435
  /* @__PURE__ */ jsxRuntime.jsx(chunkFSARTLUE_cjs.Button, { variant: "secondary", onClick: () => onOpenChange(false), children: m("Cancel") }),
2403
2436
  /* @__PURE__ */ jsxRuntime.jsx(chunkFSARTLUE_cjs.Button, { onClick: handleSave, disabled: saveDisabled, children: m(
2404
2437
  mode === "relate" ? "Relate" : mode === "observe" ? "Add observation" : "Save"
@@ -2410,793 +2443,6 @@ function ConditionEditor({
2410
2443
  );
2411
2444
  }
2412
2445
  ConditionEditor.displayName = "ConditionEditor";
2413
- function getDefaultPresets(labels = {}) {
2414
- const {
2415
- today = "Today",
2416
- thisWeek = "This Week",
2417
- thisMonth = "This Month",
2418
- lastMonth = "Last Month",
2419
- last24Hours = "Last 24 Hours",
2420
- last7Days = "Last 7 Days",
2421
- last30Days = "Last 30 Days"
2422
- } = labels;
2423
- return [
2424
- { key: "today", label: today },
2425
- { key: "this-week", label: thisWeek },
2426
- { key: "this-month", label: thisMonth },
2427
- { key: "last-month", label: lastMonth },
2428
- { key: "last-24-hours", label: last24Hours },
2429
- { key: "last-7-days", label: last7Days },
2430
- { key: "last-30-days", label: last30Days }
2431
- ];
2432
- }
2433
- function getExtendedPresets(labels = {}) {
2434
- const {
2435
- today = "Today",
2436
- yesterday = "Yesterday",
2437
- thisWeek = "This Week",
2438
- lastWeek = "Last Week",
2439
- thisMonth = "This Month",
2440
- lastMonth = "Last Month",
2441
- thisQuarter = "This Quarter",
2442
- lastQuarter = "Last Quarter",
2443
- thisYear = "This Year",
2444
- lastYear = "Last Year",
2445
- last24Hours = "Last 24 Hours",
2446
- last7Days = "Last 7 Days",
2447
- last30Days = "Last 30 Days",
2448
- last90Days = "Last 90 Days",
2449
- last365Days = "Last 365 Days"
2450
- } = labels;
2451
- return [
2452
- { key: "today", label: today },
2453
- { key: "yesterday", label: yesterday },
2454
- { key: "last-24-hours", label: last24Hours },
2455
- { key: "this-week", label: thisWeek },
2456
- { key: "last-week", label: lastWeek },
2457
- { key: "last-7-days", label: last7Days },
2458
- { key: "this-month", label: thisMonth },
2459
- { key: "last-month", label: lastMonth },
2460
- { key: "last-30-days", label: last30Days },
2461
- { key: "this-quarter", label: thisQuarter },
2462
- { key: "last-quarter", label: lastQuarter },
2463
- { key: "last-90-days", label: last90Days },
2464
- { key: "this-year", label: thisYear },
2465
- { key: "last-year", label: lastYear },
2466
- { key: "last-365-days", label: last365Days }
2467
- ];
2468
- }
2469
- function endOfDay(d) {
2470
- return new Date(d.getFullYear(), d.getMonth(), d.getDate(), 23, 59, 59, 999);
2471
- }
2472
- function calculateDateRange(presetKey) {
2473
- const now = /* @__PURE__ */ new Date();
2474
- const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
2475
- switch (presetKey) {
2476
- case "today":
2477
- return { start: today, end: endOfDay(today) };
2478
- case "yesterday": {
2479
- const yesterday = new Date(today);
2480
- yesterday.setDate(today.getDate() - 1);
2481
- return { start: yesterday, end: endOfDay(yesterday) };
2482
- }
2483
- case "this-week": {
2484
- const dayOfWeek = today.getDay();
2485
- const sunday = new Date(today);
2486
- sunday.setDate(today.getDate() - dayOfWeek);
2487
- const saturday = new Date(sunday);
2488
- saturday.setDate(sunday.getDate() + 6);
2489
- return { start: sunday, end: endOfDay(saturday) };
2490
- }
2491
- case "last-week": {
2492
- const dayOfWeek = today.getDay();
2493
- const lastSunday = new Date(today);
2494
- lastSunday.setDate(today.getDate() - dayOfWeek - 7);
2495
- const lastSaturday = new Date(lastSunday);
2496
- lastSaturday.setDate(lastSunday.getDate() + 6);
2497
- return { start: lastSunday, end: endOfDay(lastSaturday) };
2498
- }
2499
- case "this-month": {
2500
- const firstDay = new Date(now.getFullYear(), now.getMonth(), 1);
2501
- const lastDay = new Date(now.getFullYear(), now.getMonth() + 1, 0);
2502
- return { start: firstDay, end: endOfDay(lastDay) };
2503
- }
2504
- case "last-month": {
2505
- const firstDay = new Date(now.getFullYear(), now.getMonth() - 1, 1);
2506
- const lastDay = new Date(now.getFullYear(), now.getMonth(), 0);
2507
- return { start: firstDay, end: endOfDay(lastDay) };
2508
- }
2509
- case "this-quarter": {
2510
- const quarter = Math.floor(now.getMonth() / 3);
2511
- const firstDay = new Date(now.getFullYear(), quarter * 3, 1);
2512
- const lastDay = new Date(now.getFullYear(), quarter * 3 + 3, 0);
2513
- return { start: firstDay, end: endOfDay(lastDay) };
2514
- }
2515
- case "last-quarter": {
2516
- const quarter = Math.floor(now.getMonth() / 3);
2517
- const firstDay = new Date(now.getFullYear(), (quarter - 1) * 3, 1);
2518
- const lastDay = new Date(now.getFullYear(), quarter * 3, 0);
2519
- return { start: firstDay, end: endOfDay(lastDay) };
2520
- }
2521
- case "this-year": {
2522
- const firstDay = new Date(now.getFullYear(), 0, 1);
2523
- const lastDay = new Date(now.getFullYear(), 11, 31);
2524
- return { start: firstDay, end: endOfDay(lastDay) };
2525
- }
2526
- case "last-year": {
2527
- const firstDay = new Date(now.getFullYear() - 1, 0, 1);
2528
- const lastDay = new Date(now.getFullYear() - 1, 11, 31);
2529
- return { start: firstDay, end: endOfDay(lastDay) };
2530
- }
2531
- case "last-24-hours":
2532
- return {
2533
- start: new Date(now.getTime() - 24 * 60 * 60 * 1e3),
2534
- end: now
2535
- };
2536
- case "last-7-days":
2537
- return {
2538
- start: new Date(now.getTime() - 7 * 24 * 60 * 60 * 1e3),
2539
- end: now
2540
- };
2541
- case "last-30-days":
2542
- return {
2543
- start: new Date(now.getTime() - 30 * 24 * 60 * 60 * 1e3),
2544
- end: now
2545
- };
2546
- case "last-90-days":
2547
- return {
2548
- start: new Date(now.getTime() - 90 * 24 * 60 * 60 * 1e3),
2549
- end: now
2550
- };
2551
- case "last-365-days":
2552
- return {
2553
- start: new Date(now.getTime() - 365 * 24 * 60 * 60 * 1e3),
2554
- end: now
2555
- };
2556
- default:
2557
- return { start: null, end: null };
2558
- }
2559
- }
2560
- function formatDateRange(range) {
2561
- if (!range.start && !range.end) return "";
2562
- const formatDate = (d) => {
2563
- if (!d) return "";
2564
- return d.toLocaleDateString("en-US", {
2565
- month: "short",
2566
- day: "numeric",
2567
- year: "numeric"
2568
- });
2569
- };
2570
- if (range.start && range.end) {
2571
- return `${formatDate(range.start)} - ${formatDate(range.end)}`;
2572
- }
2573
- return formatDate(range.start || range.end);
2574
- }
2575
- function DateRangePicker({
2576
- value,
2577
- onChange,
2578
- presets,
2579
- activePreset,
2580
- placeholder = "Pick a date range",
2581
- className,
2582
- align = "auto",
2583
- showPresets = true,
2584
- variant = "desktop",
2585
- labels = {}
2586
- }) {
2587
- const finalPresets = presets || getDefaultPresets(labels);
2588
- const [isCalendarOpen, setIsCalendarOpen] = React4__namespace.useState(false);
2589
- const [leftMonth, setLeftMonth] = React4__namespace.useState(
2590
- () => value?.start?.getMonth() ?? (/* @__PURE__ */ new Date()).getMonth()
2591
- );
2592
- const [leftYear, setLeftYear] = React4__namespace.useState(
2593
- () => value?.start?.getFullYear() ?? (/* @__PURE__ */ new Date()).getFullYear()
2594
- );
2595
- const [rangeStart, setRangeStart] = React4__namespace.useState(
2596
- value?.start ?? null
2597
- );
2598
- const [rangeEnd, setRangeEnd] = React4__namespace.useState(
2599
- value?.end ?? null
2600
- );
2601
- const [selectingEnd, setSelectingEnd] = React4__namespace.useState(false);
2602
- const [hoverDate, setHoverDate] = React4__namespace.useState(null);
2603
- const calendarRef = React4__namespace.useRef(null);
2604
- const triggerRef = React4__namespace.useRef(null);
2605
- const [resolvedAlign, setResolvedAlign] = React4__namespace.useState(
2606
- align === "end" ? "end" : "start"
2607
- );
2608
- const isMobileVariant = variant === "mobile";
2609
- const isResponsive = variant === "responsive";
2610
- const focusTrapRef = chunkNNEFAUHV_cjs.useFocusTrap(
2611
- isMobileVariant && isCalendarOpen
2612
- );
2613
- const rightMonth = leftMonth === 11 ? 0 : leftMonth + 1;
2614
- const rightYear = leftMonth === 11 ? leftYear + 1 : leftYear;
2615
- React4__namespace.useEffect(() => {
2616
- if (!value) {
2617
- setRangeStart(null);
2618
- setRangeEnd(null);
2619
- return;
2620
- }
2621
- setRangeStart(value.start ?? null);
2622
- setRangeEnd(value.end ?? null);
2623
- }, [value]);
2624
- const wrapperRef = React4__namespace.useRef(null);
2625
- const outsideRefs = React4__namespace.useMemo(
2626
- () => [wrapperRef, calendarRef],
2627
- [calendarRef]
2628
- );
2629
- chunkFSGEDDF2_cjs.useClickOutside(
2630
- outsideRefs,
2631
- () => {
2632
- setIsCalendarOpen(false);
2633
- setSelectingEnd(false);
2634
- },
2635
- isCalendarOpen
2636
- );
2637
- const { anchorRef, floatingRef, style } = chunkAOHJILLU_cjs.useAnchoredPosition({
2638
- open: !isMobileVariant && isCalendarOpen,
2639
- placement: resolvedAlign === "end" ? "bottom-end" : "bottom-start"
2640
- });
2641
- chunkFHY3K6PL_cjs.useEscapeKey(() => {
2642
- setIsCalendarOpen(false);
2643
- setSelectingEnd(false);
2644
- triggerRef.current?.focus();
2645
- }, isCalendarOpen);
2646
- React4__namespace.useEffect(() => {
2647
- if (chunkSCV7C55E_cjs.isStorybookDocsMode()) return;
2648
- if (isMobileVariant && isCalendarOpen) {
2649
- const prev = document.body.style.overflow;
2650
- document.body.style.overflow = "hidden";
2651
- return () => {
2652
- document.body.style.overflow = prev;
2653
- };
2654
- }
2655
- }, [isMobileVariant, isCalendarOpen]);
2656
- React4__namespace.useLayoutEffect(() => {
2657
- if (isMobileVariant || !isCalendarOpen) return;
2658
- if (align === "start" || align === "end") {
2659
- setResolvedAlign(align);
2660
- return;
2661
- }
2662
- if (typeof window === "undefined") return;
2663
- const trigger = triggerRef.current;
2664
- if (!trigger) return;
2665
- const rect = trigger.getBoundingClientRect();
2666
- const estimatedPopupWidth = showPresets ? 840 : 640;
2667
- const margin = 8;
2668
- const overflowsRight = rect.left + estimatedPopupWidth > window.innerWidth - margin;
2669
- const fitsLeftAligned = rect.right - estimatedPopupWidth >= margin;
2670
- setResolvedAlign(overflowsRight && fitsLeftAligned ? "end" : "start");
2671
- }, [align, isCalendarOpen, isMobileVariant, showPresets]);
2672
- const handlePresetSelect = (presetKey) => {
2673
- const range = calculateDateRange(presetKey);
2674
- setRangeStart(range.start);
2675
- setRangeEnd(range.end);
2676
- setSelectingEnd(false);
2677
- setIsCalendarOpen(false);
2678
- if (range.start) {
2679
- setLeftMonth(range.start.getMonth());
2680
- setLeftYear(range.start.getFullYear());
2681
- }
2682
- onChange(range, presetKey);
2683
- };
2684
- const handleDayClick = (day, month, year) => {
2685
- const clicked = new Date(year, month, day);
2686
- if (!selectingEnd) {
2687
- setRangeStart(clicked);
2688
- setRangeEnd(null);
2689
- setSelectingEnd(true);
2690
- } else {
2691
- let start = rangeStart;
2692
- let end = clicked;
2693
- if (end < start) {
2694
- [start, end] = [end, start];
2695
- }
2696
- setRangeStart(start);
2697
- setRangeEnd(end);
2698
- setSelectingEnd(false);
2699
- if (variant !== "mobile") {
2700
- setIsCalendarOpen(false);
2701
- }
2702
- onChange({ start, end });
2703
- }
2704
- };
2705
- const toggleCalendar = () => {
2706
- if (!isCalendarOpen) {
2707
- if (value?.start) {
2708
- setRangeStart(value.start);
2709
- setRangeEnd(value.end ?? null);
2710
- setLeftMonth(value.start.getMonth());
2711
- setLeftYear(value.start.getFullYear());
2712
- } else {
2713
- const now = /* @__PURE__ */ new Date();
2714
- setLeftMonth(now.getMonth());
2715
- setLeftYear(now.getFullYear());
2716
- }
2717
- setSelectingEnd(false);
2718
- }
2719
- setIsCalendarOpen(!isCalendarOpen);
2720
- };
2721
- const goToPrevMonth = () => {
2722
- if (leftMonth === 0) {
2723
- setLeftMonth(11);
2724
- setLeftYear(leftYear - 1);
2725
- } else {
2726
- setLeftMonth(leftMonth - 1);
2727
- }
2728
- };
2729
- const goToNextMonth = () => {
2730
- if (leftMonth === 11) {
2731
- setLeftMonth(0);
2732
- setLeftYear(leftYear + 1);
2733
- } else {
2734
- setLeftMonth(leftMonth + 1);
2735
- }
2736
- };
2737
- const getDaysInMonth = (month, year) => new Date(year, month + 1, 0).getDate();
2738
- const getFirstDayOfMonth = (month, year) => new Date(year, month, 1).getDay();
2739
- const isSameDay = (a, b) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
2740
- const isInRange = (date) => {
2741
- const start = rangeStart;
2742
- const end = selectingEnd ? hoverDate : rangeEnd;
2743
- if (!start || !end) return false;
2744
- const [lo, hi] = start <= end ? [start, end] : [end, start];
2745
- return date > lo && date < hi;
2746
- };
2747
- const isStart = (date) => {
2748
- if (!rangeStart) return false;
2749
- return isSameDay(date, rangeStart);
2750
- };
2751
- const isEnd = (date) => {
2752
- const end = selectingEnd ? hoverDate : rangeEnd;
2753
- if (!end) return false;
2754
- return isSameDay(date, end);
2755
- };
2756
- const isToday = (date) => {
2757
- const today = /* @__PURE__ */ new Date();
2758
- return isSameDay(date, today);
2759
- };
2760
- const displayValue = value ? formatDateRange(value) : "";
2761
- const monthNames = React4__namespace.useMemo(
2762
- () => Array.from(
2763
- { length: 12 },
2764
- (_, i) => new Intl.DateTimeFormat(void 0, { month: "long" }).format(
2765
- new Date(2e3, i, 1)
2766
- )
2767
- ),
2768
- []
2769
- );
2770
- const weekdayNames = React4__namespace.useMemo(
2771
- () => Array.from(
2772
- { length: 7 },
2773
- (_, i) => new Intl.DateTimeFormat(void 0, { weekday: "short" }).format(
2774
- new Date(1970, 0, 4 + i)
2775
- )
2776
- ),
2777
- []
2778
- );
2779
- const renderMonthGrid = (month, year) => {
2780
- const daysInMonth = getDaysInMonth(month, year);
2781
- const firstDay = getFirstDayOfMonth(month, year);
2782
- const prevMonth = month === 0 ? 11 : month - 1;
2783
- const prevYear = month === 0 ? year - 1 : year;
2784
- const daysInPrevMonth = getDaysInMonth(prevMonth, prevYear);
2785
- const cells = [];
2786
- for (let i = firstDay - 1; i >= 0; i--) {
2787
- cells.push({
2788
- day: daysInPrevMonth - i,
2789
- month: prevMonth,
2790
- year: prevYear,
2791
- isCurrentMonth: false
2792
- });
2793
- }
2794
- for (let i = 1; i <= daysInMonth; i++) {
2795
- cells.push({ day: i, month, year, isCurrentMonth: true });
2796
- }
2797
- const nextMonth = month === 11 ? 0 : month + 1;
2798
- const nextYear = month === 11 ? year + 1 : year;
2799
- const remaining = 42 - cells.length;
2800
- for (let i = 1; i <= remaining; i++) {
2801
- cells.push({
2802
- day: i,
2803
- month: nextMonth,
2804
- year: nextYear,
2805
- isCurrentMonth: false
2806
- });
2807
- }
2808
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-[280px]", "data-slot": "date-range-grid", children: [
2809
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-1 grid grid-cols-7", "data-slot": "date-range-weekdays", children: weekdayNames.map((dayName) => /* @__PURE__ */ jsxRuntime.jsx(
2810
- "div",
2811
- {
2812
- className: "text-muted-foreground py-1 text-center text-xs font-medium",
2813
- "data-slot": "date-range-weekday",
2814
- children: dayName
2815
- },
2816
- dayName
2817
- )) }),
2818
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7", "data-slot": "date-range-day-grid", children: cells.map((cell, index) => {
2819
- const date = new Date(cell.year, cell.month, cell.day);
2820
- const inRange = isInRange(date);
2821
- const start = isStart(date);
2822
- const end = isEnd(date);
2823
- const today = isToday(date);
2824
- return /* @__PURE__ */ jsxRuntime.jsx(
2825
- "button",
2826
- {
2827
- type: "button",
2828
- "data-slot": "date-range-day",
2829
- onClick: () => handleDayClick(cell.day, cell.month, cell.year),
2830
- onMouseEnter: () => {
2831
- if (selectingEnd) {
2832
- setHoverDate(date);
2833
- }
2834
- },
2835
- className: chunkS5RVSXDV_cjs.cn(
2836
- "relative h-9 w-10 text-center text-sm",
2837
- "focus:ring-ring focus:z-10 focus:ring-2 focus:outline-none",
2838
- "transition-colors",
2839
- // Not current month — dimmed
2840
- !cell.isCurrentMonth && "text-muted-foreground/50",
2841
- // Current month — normal
2842
- cell.isCurrentMonth && "text-foreground",
2843
- // Hover
2844
- "hover:bg-muted",
2845
- // In range background
2846
- inRange && "bg-muted",
2847
- // Start date
2848
- start && "bg-foreground text-background hover:bg-foreground rounded-s-md font-semibold",
2849
- // End date
2850
- end && !start && "border-foreground text-foreground rounded-e-md border font-semibold",
2851
- // Today indicator (only if not start/end)
2852
- today && !start && !end && "font-semibold"
2853
- ),
2854
- children: cell.day
2855
- },
2856
- index
2857
- );
2858
- }) })
2859
- ] });
2860
- };
2861
- return /* @__PURE__ */ jsxRuntime.jsxs(
2862
- "div",
2863
- {
2864
- ref: (node) => {
2865
- wrapperRef.current = node;
2866
- anchorRef.current = node;
2867
- },
2868
- className: chunkS5RVSXDV_cjs.cn("relative inline-block", className),
2869
- "data-slot": "date-range-picker",
2870
- children: [
2871
- /* @__PURE__ */ jsxRuntime.jsxs(
2872
- "button",
2873
- {
2874
- ref: triggerRef,
2875
- type: "button",
2876
- onClick: toggleCalendar,
2877
- "aria-expanded": isCalendarOpen,
2878
- "aria-haspopup": "dialog",
2879
- "data-slot": "date-range-trigger",
2880
- className: chunkS5RVSXDV_cjs.cn(
2881
- "border-input bg-background hover:bg-muted",
2882
- "inline-flex w-[300px] items-center gap-2 rounded-md border px-4 py-2 text-start text-sm font-normal",
2883
- "focus:ring-ring focus:ring-2 focus:outline-none",
2884
- "transition-colors",
2885
- !displayValue && "text-muted-foreground"
2886
- ),
2887
- children: [
2888
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "h-4 w-4", "data-slot": "date-range-trigger-icon" }),
2889
- displayValue || placeholder
2890
- ]
2891
- }
2892
- ),
2893
- isMobileVariant && isCalendarOpen && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
2894
- /* @__PURE__ */ jsxRuntime.jsx(
2895
- "div",
2896
- {
2897
- "data-slot": "date-range-mobile-overlay",
2898
- className: "fixed inset-0 z-50 flex items-end justify-center bg-black/40",
2899
- onClick: (event) => {
2900
- if (event.target !== event.currentTarget) return;
2901
- setIsCalendarOpen(false);
2902
- setSelectingEnd(false);
2903
- setHoverDate(null);
2904
- if (triggerRef.current instanceof HTMLElement) {
2905
- triggerRef.current.focus();
2906
- }
2907
- },
2908
- children: /* @__PURE__ */ jsxRuntime.jsxs(
2909
- "div",
2910
- {
2911
- ref: (node) => {
2912
- calendarRef.current = node;
2913
- focusTrapRef.current = node;
2914
- },
2915
- className: "bg-background animate-in slide-in-from-bottom max-h-[90vh] w-full max-w-md overflow-y-auto rounded-t-2xl px-6 pt-4 pb-6 shadow-xl",
2916
- role: "dialog",
2917
- "aria-modal": "true",
2918
- "aria-labelledby": "mobile-date-range-title",
2919
- "data-slot": "date-range-mobile-sheet",
2920
- children: [
2921
- /* @__PURE__ */ jsxRuntime.jsx(
2922
- "div",
2923
- {
2924
- className: "bg-muted mx-auto mb-4 h-1 w-10 rounded-full",
2925
- "data-slot": "date-range-mobile-handle"
2926
- }
2927
- ),
2928
- /* @__PURE__ */ jsxRuntime.jsx(
2929
- "h3",
2930
- {
2931
- id: "mobile-date-range-title",
2932
- className: "mb-4 text-lg font-semibold",
2933
- "data-slot": "date-range-mobile-title",
2934
- children: placeholder
2935
- }
2936
- ),
2937
- /* @__PURE__ */ jsxRuntime.jsxs(
2938
- "div",
2939
- {
2940
- className: "mb-3 flex items-center justify-center gap-4",
2941
- "data-slot": "date-range-month-header",
2942
- children: [
2943
- /* @__PURE__ */ jsxRuntime.jsx(
2944
- "button",
2945
- {
2946
- type: "button",
2947
- onClick: goToPrevMonth,
2948
- className: "hover:bg-muted rounded-md p-1 transition-colors",
2949
- "aria-label": "Previous month",
2950
- "data-slot": "date-range-nav",
2951
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "h-4 w-4 rtl:-scale-x-100" })
2952
- }
2953
- ),
2954
- /* @__PURE__ */ jsxRuntime.jsxs(
2955
- "div",
2956
- {
2957
- className: "text-sm font-medium",
2958
- "data-slot": "date-range-month-label",
2959
- children: [
2960
- monthNames[leftMonth],
2961
- " ",
2962
- leftYear
2963
- ]
2964
- }
2965
- ),
2966
- /* @__PURE__ */ jsxRuntime.jsx(
2967
- "button",
2968
- {
2969
- type: "button",
2970
- onClick: goToNextMonth,
2971
- className: "hover:bg-muted rounded-md p-1 transition-colors",
2972
- "aria-label": "Next month",
2973
- "data-slot": "date-range-nav",
2974
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4 rtl:-scale-x-100" })
2975
- }
2976
- )
2977
- ]
2978
- }
2979
- ),
2980
- /* @__PURE__ */ jsxRuntime.jsx(
2981
- "div",
2982
- {
2983
- className: "flex justify-center",
2984
- onMouseLeave: () => setHoverDate(null),
2985
- children: renderMonthGrid(leftMonth, leftYear)
2986
- }
2987
- ),
2988
- /* @__PURE__ */ jsxRuntime.jsx(
2989
- "button",
2990
- {
2991
- type: "button",
2992
- "data-slot": "date-range-mobile-done",
2993
- onClick: () => {
2994
- setIsCalendarOpen(false);
2995
- setSelectingEnd(false);
2996
- if (triggerRef.current instanceof HTMLElement) {
2997
- triggerRef.current.focus();
2998
- }
2999
- },
3000
- className: "border-input hover:bg-muted mt-6 w-full rounded-lg border py-3 text-sm font-medium transition-colors",
3001
- children: labels?.done ?? "Done"
3002
- }
3003
- )
3004
- ]
3005
- }
3006
- )
3007
- }
3008
- ),
3009
- !isMobileVariant && isCalendarOpen && reactDom.createPortal(
3010
- /* @__PURE__ */ jsxRuntime.jsx(
3011
- "div",
3012
- {
3013
- ref: (node) => {
3014
- calendarRef.current = node;
3015
- floatingRef.current = node;
3016
- },
3017
- style,
3018
- className: chunkS5RVSXDV_cjs.cn(
3019
- "overflow-auto",
3020
- "bg-background border-border rounded-lg border shadow-lg"
3021
- ),
3022
- role: "dialog",
3023
- "aria-label": "Choose date range",
3024
- "data-slot": "date-range-popup",
3025
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex", children: [
3026
- showPresets && /* @__PURE__ */ jsxRuntime.jsx(
3027
- "div",
3028
- {
3029
- className: chunkS5RVSXDV_cjs.cn(
3030
- "border-border flex w-[200px] shrink-0 flex-col gap-0.5 border-e p-3",
3031
- isResponsive && "hidden md:flex"
3032
- ),
3033
- "data-slot": "date-range-presets",
3034
- children: finalPresets.map((preset) => /* @__PURE__ */ jsxRuntime.jsx(
3035
- "button",
3036
- {
3037
- type: "button",
3038
- onClick: () => handlePresetSelect(preset.key),
3039
- "data-slot": "date-range-preset",
3040
- className: chunkS5RVSXDV_cjs.cn(
3041
- "rounded-md px-3 py-1.5 text-start text-sm transition-colors",
3042
- "hover:bg-muted",
3043
- activePreset === preset.key && "bg-primary-800 text-white"
3044
- ),
3045
- children: preset.label
3046
- },
3047
- preset.key
3048
- ))
3049
- }
3050
- ),
3051
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", "data-slot": "date-range-calendar", children: [
3052
- /* @__PURE__ */ jsxRuntime.jsx(
3053
- "p",
3054
- {
3055
- className: "text-muted-foreground mb-4 text-sm",
3056
- "data-slot": "date-range-subtitle",
3057
- children: "Select a start and end date from the calendar."
3058
- }
3059
- ),
3060
- /* @__PURE__ */ jsxRuntime.jsxs(
3061
- "div",
3062
- {
3063
- className: "flex gap-8",
3064
- onMouseLeave: () => setHoverDate(null),
3065
- "data-slot": "date-range-calendars",
3066
- children: [
3067
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3068
- /* @__PURE__ */ jsxRuntime.jsxs(
3069
- "div",
3070
- {
3071
- className: "mb-3 flex items-center",
3072
- "data-slot": "date-range-month-header",
3073
- children: [
3074
- /* @__PURE__ */ jsxRuntime.jsx(
3075
- "button",
3076
- {
3077
- type: "button",
3078
- onClick: goToPrevMonth,
3079
- className: "hover:bg-muted rounded-md p-1 transition-colors",
3080
- "aria-label": "Previous month",
3081
- "data-slot": "date-range-nav",
3082
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "h-4 w-4 rtl:-scale-x-100" })
3083
- }
3084
- ),
3085
- /* @__PURE__ */ jsxRuntime.jsxs(
3086
- "div",
3087
- {
3088
- className: "flex-1 text-center text-sm font-medium",
3089
- "data-slot": "date-range-month-label",
3090
- children: [
3091
- monthNames[leftMonth],
3092
- " ",
3093
- leftYear
3094
- ]
3095
- }
3096
- ),
3097
- isResponsive && /* @__PURE__ */ jsxRuntime.jsx(
3098
- "button",
3099
- {
3100
- type: "button",
3101
- onClick: goToNextMonth,
3102
- className: "hover:bg-muted rounded-md p-1 transition-colors md:hidden",
3103
- "aria-label": "Next month",
3104
- "data-slot": "date-range-nav",
3105
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4 rtl:-scale-x-100" })
3106
- }
3107
- )
3108
- ]
3109
- }
3110
- ),
3111
- renderMonthGrid(leftMonth, leftYear)
3112
- ] }),
3113
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkS5RVSXDV_cjs.cn(isResponsive && "hidden md:block"), children: [
3114
- /* @__PURE__ */ jsxRuntime.jsxs(
3115
- "div",
3116
- {
3117
- className: "mb-3 flex items-center",
3118
- "data-slot": "date-range-month-header",
3119
- children: [
3120
- /* @__PURE__ */ jsxRuntime.jsxs(
3121
- "div",
3122
- {
3123
- className: "flex-1 text-center text-sm font-medium",
3124
- "data-slot": "date-range-month-label",
3125
- children: [
3126
- monthNames[rightMonth],
3127
- " ",
3128
- rightYear
3129
- ]
3130
- }
3131
- ),
3132
- /* @__PURE__ */ jsxRuntime.jsx(
3133
- "button",
3134
- {
3135
- type: "button",
3136
- onClick: goToNextMonth,
3137
- className: "hover:bg-muted rounded-md p-1 transition-colors",
3138
- "aria-label": "Next month",
3139
- "data-slot": "date-range-nav",
3140
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4 rtl:-scale-x-100" })
3141
- }
3142
- )
3143
- ]
3144
- }
3145
- ),
3146
- renderMonthGrid(rightMonth, rightYear)
3147
- ] })
3148
- ]
3149
- }
3150
- )
3151
- ] })
3152
- ] })
3153
- }
3154
- ),
3155
- document.body
3156
- )
3157
- ]
3158
- }
3159
- );
3160
- }
3161
- function DateRangeFilter({
3162
- value: _value,
3163
- onChange,
3164
- presets,
3165
- activePreset,
3166
- variant = "outline",
3167
- className,
3168
- labels = {}
3169
- }) {
3170
- const finalPresets = presets || getDefaultPresets(labels);
3171
- const activeLabel = finalPresets.find((p) => p.key === activePreset)?.label;
3172
- const handlePresetSelect = (presetKey) => {
3173
- const range = calculateDateRange(presetKey);
3174
- onChange(range, presetKey);
3175
- };
3176
- return /* @__PURE__ */ jsxRuntime.jsx(
3177
- chunkPINIBEIU_cjs.Dropdown,
3178
- {
3179
- trigger: /* @__PURE__ */ jsxRuntime.jsxs(chunkFSARTLUE_cjs.Button, { variant, size: "md", className, children: [
3180
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Calendar, { className: "me-2 h-4 w-4" }),
3181
- activeLabel || labels.filter || "Filter by Date",
3182
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "ms-2 h-3 w-3" })
3183
- ] }),
3184
- className: "w-56",
3185
- "data-slot": "date-range-filter",
3186
- children: finalPresets.map((preset) => /* @__PURE__ */ jsxRuntime.jsx(
3187
- chunkPINIBEIU_cjs.DropdownItem,
3188
- {
3189
- onClick: () => handlePresetSelect(preset.key),
3190
- className: chunkS5RVSXDV_cjs.cn(
3191
- activePreset === preset.key && "bg-primary/10 text-primary"
3192
- ),
3193
- children: preset.label
3194
- },
3195
- preset.key
3196
- ))
3197
- }
3198
- );
3199
- }
3200
2446
  var GROUP_ORDER = [
3201
2447
  "unreconciled",
3202
2448
  "taking",
@@ -3328,12 +2574,12 @@ function MedicationRow({
3328
2574
  ] })
3329
2575
  ] }),
3330
2576
  !readOnly && /* @__PURE__ */ jsxRuntime.jsxs(
3331
- chunkJCO62XMU_cjs.RowActionToolbar,
2577
+ chunkNCPDUJKJ_cjs.RowActionToolbar,
3332
2578
  {
3333
2579
  label: m("Actions for {name}", { name: medication.name }),
3334
2580
  children: [
3335
2581
  actions.includes("open") && /* @__PURE__ */ jsxRuntime.jsx(
3336
- chunkJCO62XMU_cjs.RowIconButton,
2582
+ chunkNCPDUJKJ_cjs.RowIconButton,
3337
2583
  {
3338
2584
  label: m(ACTION_META3.open.label),
3339
2585
  icon: ACTION_META3.open.icon,
@@ -3341,7 +2587,7 @@ function MedicationRow({
3341
2587
  }
3342
2588
  ),
3343
2589
  STATUS_BUTTON_META.map(({ status, label, icon }) => /* @__PURE__ */ jsxRuntime.jsx(
3344
- chunkJCO62XMU_cjs.RowIconButton,
2590
+ chunkNCPDUJKJ_cjs.RowIconButton,
3345
2591
  {
3346
2592
  label: m(label),
3347
2593
  icon,
@@ -3351,7 +2597,7 @@ function MedicationRow({
3351
2597
  status
3352
2598
  )),
3353
2599
  actions.filter((a) => a !== "open").map((action) => /* @__PURE__ */ jsxRuntime.jsx(
3354
- chunkJCO62XMU_cjs.RowIconButton,
2600
+ chunkNCPDUJKJ_cjs.RowIconButton,
3355
2601
  {
3356
2602
  label: m(ACTION_META3[action].label),
3357
2603
  icon: ACTION_META3[action].icon,
@@ -3502,7 +2748,7 @@ var MedicationList = React4__namespace.forwardRef(
3502
2748
  onClick: onAddOther,
3503
2749
  leftIcon: /* @__PURE__ */ jsxRuntime.jsx(chunkL7L5S2HO_cjs.Plus, { size: 12 }),
3504
2750
  className: "h-auto rounded-full px-2.5 py-1 text-xs",
3505
- children: m("Other\u2026")
2751
+ children: m("Add")
3506
2752
  }
3507
2753
  )
3508
2754
  ] })
@@ -3631,6 +2877,12 @@ function lookupToMedicationFields(result) {
3631
2877
  function newId2() {
3632
2878
  return `med-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
3633
2879
  }
2880
+ function isoDateToDisplay(value) {
2881
+ return value && /^\d{4}-\d{2}-\d{2}$/.test(value) ? chunkCW75IKA6_cjs.dateToDisplayFormat(value) : value;
2882
+ }
2883
+ function displayDateToIso(value) {
2884
+ return value ? chunkCW75IKA6_cjs.displayFormatToDateString(value) : value;
2885
+ }
3634
2886
  function MedicationEditor({
3635
2887
  open,
3636
2888
  medication,
@@ -3643,7 +2895,11 @@ function MedicationEditor({
3643
2895
  const ambientCodeLookup = useCodeLookupConfig();
3644
2896
  const effectiveCodeLookup = codeLookup === false ? void 0 : codeLookup ?? ambientCodeLookup ?? void 0;
3645
2897
  const [draft, setDraft] = React4__namespace.useState(
3646
- () => medication ?? {
2898
+ () => medication ? {
2899
+ ...medication,
2900
+ startDate: isoDateToDisplay(medication.startDate),
2901
+ endDate: isoDateToDisplay(medication.endDate)
2902
+ } : {
3647
2903
  id: newId2(),
3648
2904
  name: "",
3649
2905
  status: "unreconciled"
@@ -3668,12 +2924,12 @@ function MedicationEditor({
3668
2924
  const unchangedLegacyName = medication && !medication.code && draft.name === medication.name;
3669
2925
  const canSave = draft.name.trim().length > 0 && (!requireCode || hasCode || Boolean(unchangedLegacyName));
3670
2926
  if (!open) return null;
3671
- return /* @__PURE__ */ jsxRuntime.jsxs(chunkLC3JL2HB_cjs.Modal, { open: true, onOpenChange: (o) => !o && onClose(), size: "lg", children: [
3672
- /* @__PURE__ */ jsxRuntime.jsxs(chunkLC3JL2HB_cjs.ModalHeader, { children: [
3673
- /* @__PURE__ */ jsxRuntime.jsx(chunkLC3JL2HB_cjs.ModalTitle, { children: medication ? m("Correct Medication") : m("Add Medication") }),
3674
- /* @__PURE__ */ jsxRuntime.jsx(chunkLC3JL2HB_cjs.ModalClose, { "aria-label": m("Close") })
2927
+ return /* @__PURE__ */ jsxRuntime.jsxs(chunkXEHD2HA5_cjs.Modal, { open: true, onOpenChange: (o) => !o && onClose(), size: "lg", children: [
2928
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkXEHD2HA5_cjs.ModalHeader, { children: [
2929
+ /* @__PURE__ */ jsxRuntime.jsx(chunkXEHD2HA5_cjs.ModalTitle, { children: medication ? m("Correct Medication") : m("Add Medication") }),
2930
+ /* @__PURE__ */ jsxRuntime.jsx(chunkXEHD2HA5_cjs.ModalClose, { "aria-label": m("Close") })
3675
2931
  ] }),
3676
- /* @__PURE__ */ jsxRuntime.jsx(chunkLC3JL2HB_cjs.ModalBody, { className: "space-y-5", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: bodyRef, className: "contents", children: [
2932
+ /* @__PURE__ */ jsxRuntime.jsx(chunkXEHD2HA5_cjs.ModalBody, { className: "space-y-5", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: bodyRef, className: "contents", children: [
3677
2933
  /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "space-y-3", "aria-label": m("Medication"), children: [
3678
2934
  effectiveCodeLookup ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
3679
2935
  /* @__PURE__ */ jsxRuntime.jsx(chunkAIJAFPGJ_cjs.Label, { htmlFor: "med-search", children: m("Medication") }),
@@ -3808,7 +3064,7 @@ function MedicationEditor({
3808
3064
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
3809
3065
  /* @__PURE__ */ jsxRuntime.jsx(chunkAIJAFPGJ_cjs.Label, { htmlFor: "med-sig", children: m("Sig (patient directions)") }),
3810
3066
  /* @__PURE__ */ jsxRuntime.jsx(
3811
- chunk2Z2GFDRS_cjs.Textarea,
3067
+ chunkDXNVQQYN_cjs.Textarea,
3812
3068
  {
3813
3069
  id: "med-sig",
3814
3070
  value: draft.sig ?? "",
@@ -3867,7 +3123,7 @@ function MedicationEditor({
3867
3123
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
3868
3124
  /* @__PURE__ */ jsxRuntime.jsx(chunkAIJAFPGJ_cjs.Label, { htmlFor: "med-pharmacy-notes", children: m("Pharmacy notes") }),
3869
3125
  /* @__PURE__ */ jsxRuntime.jsx(
3870
- chunk2Z2GFDRS_cjs.Textarea,
3126
+ chunkDXNVQQYN_cjs.Textarea,
3871
3127
  {
3872
3128
  id: "med-pharmacy-notes",
3873
3129
  value: draft.pharmacyNotes ?? "",
@@ -3878,13 +3134,18 @@ function MedicationEditor({
3878
3134
  ] })
3879
3135
  ] })
3880
3136
  ] }) }),
3881
- /* @__PURE__ */ jsxRuntime.jsxs(chunkLC3JL2HB_cjs.ModalFooter, { children: [
3137
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkXEHD2HA5_cjs.ModalFooter, { children: [
3882
3138
  /* @__PURE__ */ jsxRuntime.jsx(chunkFSARTLUE_cjs.Button, { variant: "secondary", onClick: onClose, children: m("Cancel") }),
3883
3139
  /* @__PURE__ */ jsxRuntime.jsx(
3884
3140
  chunkFSARTLUE_cjs.Button,
3885
3141
  {
3886
3142
  onClick: () => {
3887
- onSave({ ...draft, name: draft.name.trim() });
3143
+ onSave({
3144
+ ...draft,
3145
+ name: draft.name.trim(),
3146
+ startDate: displayDateToIso(draft.startDate),
3147
+ endDate: displayDateToIso(draft.endDate)
3148
+ });
3888
3149
  onClose();
3889
3150
  },
3890
3151
  disabled: !canSave,
@@ -3917,17 +3178,17 @@ function MedicationDialog({
3917
3178
  onSave(form);
3918
3179
  onClose();
3919
3180
  };
3920
- return /* @__PURE__ */ jsxRuntime.jsxs(chunkLC3JL2HB_cjs.Modal, { open: true, onOpenChange: (open) => !open && onClose(), size: "md", children: [
3921
- /* @__PURE__ */ jsxRuntime.jsxs(chunkLC3JL2HB_cjs.ModalHeader, { children: [
3922
- /* @__PURE__ */ jsxRuntime.jsx(chunkLC3JL2HB_cjs.ModalTitle, { children: dialog.kind === "note" ? m("Medication Notes") : m("Add Task") }),
3923
- /* @__PURE__ */ jsxRuntime.jsx(chunkLC3JL2HB_cjs.ModalClose, { "aria-label": m("Close") })
3181
+ return /* @__PURE__ */ jsxRuntime.jsxs(chunkXEHD2HA5_cjs.Modal, { open: true, onOpenChange: (open) => !open && onClose(), size: "md", children: [
3182
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkXEHD2HA5_cjs.ModalHeader, { children: [
3183
+ /* @__PURE__ */ jsxRuntime.jsx(chunkXEHD2HA5_cjs.ModalTitle, { children: dialog.kind === "note" ? m("Medication Notes") : m("Add Task") }),
3184
+ /* @__PURE__ */ jsxRuntime.jsx(chunkXEHD2HA5_cjs.ModalClose, { "aria-label": m("Close") })
3924
3185
  ] }),
3925
- /* @__PURE__ */ jsxRuntime.jsxs(chunkLC3JL2HB_cjs.ModalBody, { className: "space-y-4", children: [
3186
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkXEHD2HA5_cjs.ModalBody, { className: "space-y-4", children: [
3926
3187
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: dialog.medication.name }),
3927
3188
  dialog.kind === "note" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
3928
3189
  /* @__PURE__ */ jsxRuntime.jsx(chunkAIJAFPGJ_cjs.Label, { htmlFor: "med-note", children: m("Note") }),
3929
3190
  /* @__PURE__ */ jsxRuntime.jsx(
3930
- chunk2Z2GFDRS_cjs.Textarea,
3191
+ chunkDXNVQQYN_cjs.Textarea,
3931
3192
  {
3932
3193
  id: "med-note",
3933
3194
  value: form.note,
@@ -3938,7 +3199,7 @@ function MedicationDialog({
3938
3199
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
3939
3200
  /* @__PURE__ */ jsxRuntime.jsx(chunkAIJAFPGJ_cjs.Label, { htmlFor: "med-task", children: m("Task") }),
3940
3201
  /* @__PURE__ */ jsxRuntime.jsx(
3941
- chunk2Z2GFDRS_cjs.Textarea,
3202
+ chunkDXNVQQYN_cjs.Textarea,
3942
3203
  {
3943
3204
  id: "med-task",
3944
3205
  value: form.task,
@@ -3949,7 +3210,7 @@ function MedicationDialog({
3949
3210
  )
3950
3211
  ] })
3951
3212
  ] }),
3952
- /* @__PURE__ */ jsxRuntime.jsxs(chunkLC3JL2HB_cjs.ModalFooter, { children: [
3213
+ /* @__PURE__ */ jsxRuntime.jsxs(chunkXEHD2HA5_cjs.ModalFooter, { children: [
3953
3214
  /* @__PURE__ */ jsxRuntime.jsx(chunkFSARTLUE_cjs.Button, { variant: "secondary", onClick: onClose, children: m("Cancel") }),
3954
3215
  /* @__PURE__ */ jsxRuntime.jsx(chunkFSARTLUE_cjs.Button, { onClick: handleSave, children: m("Save") })
3955
3216
  ] })
@@ -4131,18 +3392,13 @@ exports.Assessment = Assessment;
4131
3392
  exports.CodeLookupContext = CodeLookupContext;
4132
3393
  exports.CodeLookupProvider = CodeLookupProvider;
4133
3394
  exports.ConditionEditor = ConditionEditor;
4134
- exports.DateRangeFilter = DateRangeFilter;
4135
- exports.DateRangePicker = DateRangePicker;
4136
3395
  exports.MEDICATION_STATUS_LABELS = MEDICATION_STATUS_LABELS;
4137
3396
  exports.MedicationEditor = MedicationEditor;
4138
3397
  exports.MedicationList = MedicationList;
4139
3398
  exports.MedicationReconciliation = MedicationReconciliation;
4140
3399
  exports.ORDER_TYPE_META = ORDER_TYPE_META;
4141
3400
  exports.ORDER_TYPE_SEARCH_DOMAINS = ORDER_TYPE_SEARCH_DOMAINS;
4142
- exports.calculateDateRange = calculateDateRange;
4143
3401
  exports.doseFormToQuantityUnit = doseFormToQuantityUnit;
4144
- exports.getDefaultPresets = getDefaultPresets;
4145
- exports.getExtendedPresets = getExtendedPresets;
4146
3402
  exports.isConditionCodetype = isConditionCodetype;
4147
3403
  exports.labelToMedicationFields = labelToMedicationFields;
4148
3404
  exports.lookupToMedicationFields = lookupToMedicationFields;
@@ -4151,5 +3407,5 @@ exports.orderTypeForCodetype = orderTypeForCodetype;
4151
3407
  exports.parseMedicationLabel = parseMedicationLabel;
4152
3408
  exports.parseSig = parseSig;
4153
3409
  exports.useCodeLookupConfig = useCodeLookupConfig;
4154
- //# sourceMappingURL=chunk-SCYLVQWA.cjs.map
4155
- //# sourceMappingURL=chunk-SCYLVQWA.cjs.map
3410
+ //# sourceMappingURL=chunk-6O6EYKOG.cjs.map
3411
+ //# sourceMappingURL=chunk-6O6EYKOG.cjs.map